SPB Git

Repository Public License

Catalog+FamilyA.swift 63.6 KB 658 lines swift

1import Foundation2import PrismComponentSDK3import PrismCore45/// Catalog family A: layout, display, text and feedback.6extension Catalog {7    static let familyA: [ComponentManifest] = familyALayout + familyADisplay + familyAText + familyAFeedback89    // MARK: Builders1011    /// `tone` with another default than neutral.12    private static func tone(_ fallback: String, _ summary: String = "Semantic color.") -> PropSpec {13        PropSpec("tone", .enum, summary, default: .string(fallback), values: tones, dynamic: true)14    }1516    /// A fixture whose previewed object also carries events.17    private static func fixtureA(_ type: String, _ props: JSONValue, events: JSONValue, state: JSONValue = [:], extra: [JSONValue] = [], children: [String] = []) -> JSONValue {18        var root: [String: JSONValue] = ["id": "fx", "type": .string(type), "name": "Preview", "props": props, "events": events]19        if !children.isEmpty { root["children"] = .array(children.map(JSONValue.string)) }20        return ["root": "fx", "objects": .array([.object(root)] + extra), "state": state, "permissions": []]21    }2223    /// A fixture where the previewed object (listed first) sits inside a horizontal or vertical stack with companions.24    private static func fixtureInStack(_ object: JSONValue, direction: String, around: [JSONValue], order: [String], state: JSONValue = [:]) -> JSONValue {25        let stack: JSONValue = ["id": "fx", "type": "prism.stack", "name": "Preview", "props": ["direction": .string(direction), "align": direction == "horizontal" ? "center" : "leading"], "children": .array(order.map(JSONValue.string))]26        return ["root": "fx", "objects": .array([object, stack] + around), "state": state, "permissions": []]27    }2829    private static func note(_ id: String, _ text: String) -> JSONValue {30        ["id": .string(id), "type": "prism.text", "name": .string(id), "props": ["text": .string(text), "tone": "neutral"]]31    }3233    private static func panel(_ id: String, _ name: String, _ body: String) -> JSONValue {34        ["id": .string(id), "type": "prism.text", "name": .string(name), "props": ["text": .string(body)]]35    }3637    // MARK: Layout3839    static let familyALayout: [ComponentManifest] = [40        ComponentManifest(41            type: "prism.spacer", name: "Spacer", category: "layout", summary: "Flexible empty space that pushes its neighbours apart inside a stack, toolbar or footer bar.",42            props: [PropSpec("minLength", .number, "Smallest gap in points; the spacer grows to fill the room left.", default: 0, dynamic: false)],43            keywords: ["gap", "space", "push", "flexible", "separate"], accessibilityRole: "none",44            examples: [["id": "push_right", "type": "prism.spacer", "props": ["minLength": 12]]],45            fixture: fixtureInStack(["id": "fx_spacer", "type": "prism.spacer", "name": "Spacer", "props": ["minLength": 24]], direction: "horizontal",46                                    around: [text("fx_a", "Pushed to the left"), text("fx_b", "Pushed to the right")], order: ["fx_a", "fx_spacer", "fx_b"])47        ),48        ComponentManifest(49            type: "prism.box", name: "Box", category: "layout", summary: "A plain container with a background (tinted, solid, themed surface or none), inner padding, a corner radius and an optional border.",50            props: [51                PropSpec("fill", .enum, "Background: a light tint of the tone, the solid tone, the theme's panel, or nothing.", default: "tinted", values: ["tinted", "solid", "surface", "none"], dynamic: false),52                toneProp,53                PropSpec("inset", .number, "Padding between the edge and the children, in points.", default: 12, dynamic: false),54                PropSpec("border", .boolean, "Draw a border in the tone.", default: false, dynamic: false),55                PropSpec("cornerRadius", .number, "Corner radius in points; the theme's radius when omitted.", dynamic: false),56            ],57            acceptsChildren: true, keywords: ["container", "background", "border", "frame", "wrapper", "highlight"], accessibilityRole: "group",58            examples: [["id": "tip_box", "type": "prism.box", "props": ["fill": "tinted", "tone": "info", "border": true], "children": ["tip_text"]]],59            fixture: fixture("prism.box", ["fill": "tinted", "tone": "info", "border": true, "inset": 16],60                             extra: [text("fx_a", "A box groups content on a tinted background."), text("fx_b", "It can also be solid, a themed surface, or have no fill.")], children: ["fx_a", "fx_b"])61        ),62        ComponentManifest(63            type: "prism.center", name: "Center", category: "layout", summary: "Centers its children horizontally, vertically or both in the space available.",64            props: [PropSpec("axis", .enum, "Which direction is centered.", default: "both", values: ["both", "horizontal", "vertical"], dynamic: false)],65            acceptsChildren: true, keywords: ["middle", "align", "centered", "placement"], accessibilityRole: "group",66            examples: [["id": "welcome_center", "type": "prism.center", "props": ["axis": "both"], "children": ["welcome_text"]]],67            fixture: fixture("prism.center", ["axis": "both"], extra: [68                ["id": "fx_a", "type": "prism.heading", "name": "Title", "props": ["text": "Centered content", "level": 2]], text("fx_b", "Both axes, in the space of the page."),69            ], children: ["fx_a", "fx_b"])70        ),71        ComponentManifest(72            type: "prism.overlay", name: "Overlay", category: "layout", summary: "Stacks its children on top of each other (first at the back), aligned to a corner, an edge or the center.",73            props: [PropSpec("align", .enum, "Where the children are pinned.", default: "center",74                             values: ["topLeading", "top", "topTrailing", "leading", "center", "trailing", "bottomLeading", "bottom", "bottomTrailing"], dynamic: false)],75            acceptsChildren: true, keywords: ["zstack", "layer", "on top", "superimpose", "corner badge"], accessibilityRole: "group",76            examples: [["id": "photo_with_badge", "type": "prism.overlay", "props": ["align": "topTrailing"], "children": ["photo_tile", "new_badge"]]],77            fixture: fixture("prism.overlay", ["align": "topTrailing"], extra: [78                ["id": "fx_a", "type": "prism.symbolTile", "name": "Tile", "props": ["symbol": "photo", "size": 120, "tone": "info", "accessibilityLabel": "Photo"]],79                ["id": "fx_b", "type": "prism.badge", "name": "Badge", "props": ["text": "New", "tone": "danger"]],80            ], children: ["fx_a", "fx_b"])81        ),82        ComponentManifest(83            type: "prism.wrap", name: "Wrap", category: "layout", summary: "A flow layout: children go left to right and wrap onto new lines when the width runs out.",84            props: [85                PropSpec("spacing", .number, "Gap between children on a line, in points.", default: 8, dynamic: false),86                PropSpec("lineSpacing", .number, "Gap between lines; same as `spacing` when omitted.", dynamic: false),87                PropSpec("align", .enum, "How each line is aligned.", default: "leading", values: ["leading", "center", "trailing"], dynamic: false),88            ],89            acceptsChildren: true, keywords: ["flow", "wrapping", "multiline row", "flex wrap", "tags row"], accessibilityRole: "group",90            examples: [["id": "actions_wrap", "type": "prism.wrap", "props": ["spacing": 8], "children": ["save_button", "share_button", "print_button"]]],91            fixture: fixture("prism.wrap", ["spacing": 8, "lineSpacing": 8], extra: ["Design", "Engineering", "Research", "Marketing", "Customer support", "Finance", "Operations", "Legal", "People", "Security", "Data science"].enumerated().map { (i: Int, name: String) -> JSONValue in92                ["id": .string("fx_\(i)"), "type": "prism.badge", "name": .string(name), "props": ["text": .string(name), "tone": .string(tones[i % tones.count])]]93            }, children: (0..<11).map { "fx_\($0)" })94        ),95        ComponentManifest(96            type: "prism.accordion", name: "Accordion", category: "layout", summary: "Collapsible panels, one per child and titled by the child's `name`; at most one is open at a time.",97            props: [PropSpec("open", .string, "Id of the open child, or a state key holding it; the first child when omitted, none when empty.", dynamic: false, binding: .optional)],98            events: ["expand", "collapse"], acceptsChildren: true, keywords: ["collapsible", "faq", "panels", "expand", "sections", "fold"], accessibilityRole: "group",99            examples: [["id": "faq", "type": "prism.accordion", "props": ["open": ["$bind": "openQuestion"]], "children": ["faq_shipping", "faq_returns"]]],100            fixture: fixture("prism.accordion", ["open": ["$bind": "openPanel"]], state: ["openPanel": "fx_a"], extra: [101                panel("fx_a", "How do I import my data?", "Use the import button and pick a CSV file; columns are matched by name."),102                panel("fx_b", "Where is my data stored?", "In a private database on this Mac."),103                panel("fx_c", "Can I publish the app?", "Yes, as a separate desktop app."),104            ], children: ["fx_a", "fx_b", "fx_c"])105        ),106        ComponentManifest(107            type: "prism.disclosure", name: "Disclosure", category: "layout", summary: "One collapsible section: a title row that shows or hides its children.",108            props: [109                PropSpec("title", .string, "Text of the title row.", required: true),110                PropSpec("expanded", .boolean, "Whether it starts open, or a state key holding true/false.", default: false, dynamic: false, binding: .optional),111            ],112            events: ["toggle"], acceptsChildren: true, keywords: ["collapsible", "show more", "details", "expand", "advanced options"], accessibilityRole: "disclosureTriangle", accessibilityLabelProp: "title",113            examples: [["id": "advanced", "type": "prism.disclosure", "props": ["title": "Advanced options", "expanded": ["$bind": "showAdvanced"]], "children": ["advanced_fields"]]],114            fixture: fixture("prism.disclosure", ["title": "Advanced options", "expanded": ["$bind": "showAdvanced"]], state: ["showAdvanced": true],115                             extra: [text("fx_a", "These settings are rarely needed."), text("fx_b", "Click the title to hide them.")], children: ["fx_a", "fx_b"])116        ),117        ComponentManifest(118            type: "prism.carousel", name: "Carousel", category: "layout", summary: "Shows one child at a time with previous/next arrows and page dots.",119            props: [120                PropSpec("page", .number, "Zero-based index of the first page shown, or a state key holding the current page.", default: 0, dynamic: false, binding: .optional),121                PropSpec("showArrows", .boolean, "Show the previous/next buttons.", default: true, dynamic: false),122                PropSpec("showDots", .boolean, "Show one dot per page.", default: true, dynamic: false),123                PropSpec("loop", .boolean, "Going past the last page returns to the first.", default: false, dynamic: false),124            ],125            events: ["page"], acceptsChildren: true, keywords: ["slides", "pager", "slideshow", "onboarding", "gallery", "swipe"], accessibilityRole: "group",126            examples: [["id": "tour", "type": "prism.carousel", "props": ["page": ["$bind": "tourPage"], "loop": true], "children": ["tour_one", "tour_two", "tour_three"]]],127            fixture: fixture("prism.carousel", ["page": ["$bind": "slide"], "loop": true], state: ["slide": 1], extra: [128                ["id": "fx_a", "type": "prism.callout", "name": "One", "props": ["title": "Describe it", "text": "Say what you need in plain words.", "symbol": "text.bubble", "tone": "info"]],129                ["id": "fx_b", "type": "prism.callout", "name": "Two", "props": ["title": "Build it", "text": "The app is assembled from verified components.", "symbol": "hammer", "tone": "success"]],130                ["id": "fx_c", "type": "prism.callout", "name": "Three", "props": ["title": "Evolve it", "text": "Change it whenever you want.", "symbol": "arrow.triangle.2.circlepath", "tone": "accent"]],131            ], children: ["fx_a", "fx_b", "fx_c"])132        ),133        ComponentManifest(134            type: "prism.aspect", name: "Aspect ratio", category: "layout", summary: "Keeps its child in a frame of a fixed width-to-height ratio (16:9, square…) that scales with the width available.",135            props: [PropSpec("ratio", .number, "Width divided by height: 1.778 for 16:9, 1 for a square.", default: 1.778, dynamic: false)],136            acceptsChildren: true, maxChildren: 1, keywords: ["ratio", "square", "16:9", "proportion", "frame", "thumbnail"], accessibilityRole: "group",137            examples: [["id": "cover_frame", "type": "prism.aspect", "props": ["ratio": 1.778], "children": ["cover"]]],138            fixture: fixture("prism.aspect", ["ratio": 2.4, "width": 420], extra: [139                ["id": "fx_a", "type": "prism.box", "name": "Frame", "props": ["fill": "tinted", "tone": "accent", "border": true, "grow": true], "children": ["fx_b"]],140                text("fx_b", "A 2.4 : 1 frame"),141            ], children: ["fx_a"])142        ),143        ComponentManifest(144            type: "prism.columns", name: "Columns", category: "layout", summary: "Children side by side in columns whose widths follow weights, e.g. a 2:1 main area and side column.",145            props: [146                PropSpec("weights", .list, "One number per child, e.g. [2, 1]; equal widths when omitted.", dynamic: false),147                PropSpec("spacing", .number, "Gap between columns, in points.", default: 12, dynamic: false),148                PropSpec("align", .enum, "Vertical alignment of the columns.", default: "top", values: ["top", "center", "bottom"], dynamic: false),149            ],150            acceptsChildren: true, keywords: ["layout", "side by side", "two column", "proportional", "weighted", "main and aside"], accessibilityRole: "group",151            examples: [["id": "main_columns", "type": "prism.columns", "props": ["weights": [2, 1], "spacing": 16], "children": ["main_area", "side_area"]]],152            fixture: fixture("prism.columns", ["weights": [2, 1], "spacing": 16], extra: [153                ["id": "fx_a", "type": "prism.card", "name": "Main", "props": ["title": "Main (weight 2)"], "children": ["fx_c"]],154                ["id": "fx_b", "type": "prism.card", "name": "Side", "props": ["title": "Side (weight 1)"], "children": ["fx_d"]],155                text("fx_c", "Two thirds of the width."), text("fx_d", "One third."),156            ], children: ["fx_a", "fx_b"])157        ),158        ComponentManifest(159            type: "prism.listGroup", name: "List group", category: "layout", summary: "Shows its children as the rows of one grouped panel with separators, like a settings list.",160            props: [161                PropSpec("title", .string, "Small heading above the panel."),162                PropSpec("separators", .boolean, "Draw a hairline between rows.", default: true, dynamic: false),163            ],164            acceptsChildren: true, keywords: ["rows", "inset grouped", "settings list", "separators", "group"], accessibilityRole: "list", accessibilityLabelProp: "title",165            examples: [["id": "account_rows", "type": "prism.listGroup", "props": ["title": "Account"], "children": ["name_row", "email_row", "plan_row"]]],166            fixture: fixture("prism.listGroup", ["title": "Account"], extra: [167                ["id": "fx_a", "type": "prism.keyValue", "name": "Name", "props": ["label": "Name", "value": "Ada Lovelace"]],168                ["id": "fx_b", "type": "prism.keyValue", "name": "Email", "props": ["label": "Email", "value": "ada@example.com"]],169                ["id": "fx_c", "type": "prism.keyValue", "name": "Plan", "props": ["label": "Plan", "value": "Team", "tone": "accent"]],170            ], children: ["fx_a", "fx_b", "fx_c"])171        ),172        ComponentManifest(173            type: "prism.section", name: "Section", category: "layout", summary: "A titled block of content with an optional subtitle under the title and a footer note below the children.",174            props: [175                PropSpec("title", .string, "Section title.", required: true), PropSpec("subtitle", .string, "Line under the title."),176                PropSpec("footer", .string, "Small note under the content."),177            ],178            acceptsChildren: true, keywords: ["heading", "titled", "block", "group", "subtitle", "footer note"], accessibilityRole: "group", accessibilityLabelProp: "title",179            examples: [["id": "billing_section", "type": "prism.section", "props": ["title": "Billing", "subtitle": "How you pay", "footer": "Invoices are sent monthly."], "children": ["billing_rows"]]],180            fixture: fixture("prism.section", ["title": "Notifications", "subtitle": "Choose what you hear about.", "footer": "You can change this at any time."],181                             extra: [text("fx_a", "Weekly summary every Monday."), text("fx_b", "A message when a goal is reached.")], children: ["fx_a", "fx_b"])182        ),183        ComponentManifest(184            type: "prism.hero", name: "Hero", category: "layout", summary: "A header band for the top of a page: a large title, a subtitle and a symbol on a soft gradient; children become its action row.",185            props: [186                PropSpec("title", .string, "The large title.", required: true), PropSpec("subtitle", .string, "Supporting line under the title."),187                PropSpec("symbol", .string, "SF Symbol shown above the title."), tone("accent", "Color of the band and the symbol."),188                PropSpec("align", .enum, "Text alignment.", default: "leading", values: ["leading", "center"], dynamic: false),189            ],190            acceptsChildren: true, keywords: ["header", "banner", "welcome", "landing", "title band", "intro"], accessibilityRole: "group", accessibilityLabelProp: "title",191            examples: [["id": "home_hero", "type": "prism.hero", "props": ["title": "Welcome back", "subtitle": "Here is what changed this week.", "symbol": "sparkles"]]],192            fixture: fixture("prism.hero", ["title": "Plan your week", "subtitle": "Tasks, goals and notes in one place.", "symbol": "calendar", "tone": "accent"],193                             extra: [["id": "fx_a", "type": "prism.badge", "name": "Badge", "props": ["text": "3 tasks due today", "tone": "warning"]]], children: ["fx_a"])194        ),195        ComponentManifest(196            type: "prism.footerBar", name: "Footer bar", category: "layout", summary: "A bar for the bottom of a page or panel: a caption on the left and its children (buttons, status) aligned beside it.",197            props: [198                PropSpec("text", .string, "Caption shown at the leading edge."),199                PropSpec("align", .enum, "Where the children sit in the bar.", default: "trailing", values: ["leading", "center", "trailing"], dynamic: false),200            ],201            acceptsChildren: true, keywords: ["bottom bar", "status bar", "actions", "footer", "summary line"], accessibilityRole: "group", accessibilityLabelProp: "text",202            examples: [["id": "page_footer", "type": "prism.footerBar", "props": ["text": ["$expr": "concat(state.itemCount, ' items')"]], "children": ["save_button"]]],203            fixture: fixture("prism.footerBar", ["text": "12 items · saved a minute ago", "align": "trailing"],204                             extra: [["id": "fx_a", "type": "prism.badge", "name": "State", "props": ["text": "Synced", "tone": "success"]]], children: ["fx_a"])205        ),206        ComponentManifest(207            type: "prism.popover", name: "Popover", category: "layout", summary: "A button that shows its children in a popover attached to it.",208            props: [209                PropSpec("title", .string, "Button label."), PropSpec("icon", .string, "SF Symbol on the button."),210                PropSpec("edge", .enum, "Side of the button the popover prefers.", default: "bottom", values: ["top", "bottom", "leading", "trailing"], dynamic: false),211            ],212            events: ["open", "close"], acceptsChildren: true, keywords: ["popup", "flyout", "more info", "details bubble", "dropdown panel"], accessibilityRole: "popUpButton", accessibilityLabelProp: "title",213            examples: [["id": "info_popover", "type": "prism.popover", "props": ["title": "Details", "icon": "info.circle"], "children": ["details_text"]]],214            fixture: fixture("prism.popover", ["title": "Details", "icon": "info.circle", "edge": "bottom"], extra: [text("fx_a", "Shown inside the popover.")], children: ["fx_a"])215        ),216        ComponentManifest(217            type: "prism.tooltip", name: "Tooltip", category: "layout", summary: "Wraps its children and shows an explanatory text when the pointer rests on them.",218            props: [PropSpec("text", .string, "The help text.", required: true)],219            acceptsChildren: true, keywords: ["hint", "hover", "help text", "explain"], accessibilityRole: "group",220            examples: [["id": "total_hint", "type": "prism.tooltip", "props": ["text": "Sum of this month, taxes included."], "children": ["total_label"]]],221            fixture: fixture("prism.tooltip", ["text": "Sum of this month, taxes included."], extra: [222                ["id": "fx_a", "type": "prism.label", "name": "Label", "props": ["text": "Rest the pointer here for an explanation", "symbol": "questionmark.circle"]],223            ], children: ["fx_a"])224        ),225        ComponentManifest(226            type: "prism.ribbon", name: "Ribbon", category: "layout", summary: "Draws a short label as a ribbon across a top corner, or as a band along the top or bottom edge, of its children.",227            props: [228                PropSpec("text", .string, "Ribbon text; keep it to one or two words.", required: true), tone("accent", "Ribbon color."),229                PropSpec("position", .enum, "Corner (diagonal ribbon) or edge (full-width band).", default: "topTrailing", values: ["topTrailing", "topLeading", "top", "bottom"], dynamic: false),230            ],231            acceptsChildren: true, keywords: ["corner label", "sash", "new", "sale", "featured", "band"], accessibilityRole: "group", accessibilityLabelProp: "text",232            examples: [["id": "plan_ribbon", "type": "prism.ribbon", "props": ["text": "Popular", "tone": "success"], "children": ["plan_card"]]],233            fixture: fixture("prism.ribbon", ["text": "Popular", "tone": "success", "position": "topTrailing", "width": 320], extra: [234                ["id": "fx_a", "type": "prism.card", "name": "Card", "props": ["title": "Team plan"], "children": ["fx_b", "fx_c"]],235                text("fx_b", "Up to ten people."), text("fx_c", "Shared projects and history."),236            ], children: ["fx_a"])237        ),238    ]239240    // MARK: Display241242    static let familyADisplay: [ComponentManifest] = [243        ComponentManifest(244            type: "prism.avatar", name: "Avatar", category: "display", summary: "A person or thing as initials (from `name`) or an SF Symbol in a colored circle.",245            props: [246                PropSpec("name", .string, "Full name; its initials are shown and it is the spoken label."), PropSpec("symbol", .string, "SF Symbol shown instead of initials."),247                PropSpec("size", .number, "Diameter in points.", default: 40, dynamic: false), tone("accent"),248            ],249            keywords: ["initials", "person", "user", "profile", "contact", "picture"], accessibilityRole: "image", accessibilityLabelProp: "name",250            examples: [["id": "owner_avatar", "type": "prism.avatar", "props": ["name": ["$expr": "state.ownerName"], "size": 32]]],251            fixture: fixture("prism.avatar", ["name": "Ada Lovelace", "size": 64, "tone": "accent"])252        ),253        ComponentManifest(254            type: "prism.avatarGroup", name: "Avatar group", category: "display", summary: "Overlapping avatars for a list of names, with a \"+N\" circle for the ones that do not fit.",255            props: [256                PropSpec("names", .list, "The names; each becomes an avatar with initials.", required: true),257                PropSpec("max", .number, "How many avatars are shown before \"+N\".", default: 4, dynamic: false),258                PropSpec("size", .number, "Diameter in points.", default: 32, dynamic: false), tone("accent"),259            ],260            keywords: ["team", "members", "people", "participants", "assignees", "facepile"], accessibilityRole: "image",261            examples: [["id": "team_faces", "type": "prism.avatarGroup", "props": ["names": ["Ada Lovelace", "Alan Turing", "Grace Hopper"], "max": 3]]],262            fixture: fixture("prism.avatarGroup", ["names": ["Ada Lovelace", "Alan Turing", "Grace Hopper", "Katherine Johnson", "Linus Torvalds", "Margaret Hamilton"], "max": 4, "size": 44])263        ),264        ComponentManifest(265            type: "prism.keyValue", name: "Key-value row", category: "display", summary: "One label with its value, on a row (label left, value right) or stacked; use several in a list group for a detail view.",266            props: [267                PropSpec("label", .string, "What the value is.", required: true), PropSpec("value", .any, "The value, fixed or computed.", required: true),268                PropSpec("layout", .enum, "Row or label above value.", default: "row", values: ["row", "stacked"], dynamic: false),269                PropSpec("tone", .enum, "Color of the value.", default: "neutral", values: tones),270            ],271            keywords: ["field", "property", "detail", "attribute", "label value", "row"], accessibilityRole: "staticText", accessibilityLabelProp: "label",272            examples: [["id": "status_row", "type": "prism.keyValue", "props": ["label": "Status", "value": ["$expr": "state.status"]]]],273            fixture: fixture("prism.keyValue", ["label": "Order number", "value": "A-10492", "width": 320])274        ),275        ComponentManifest(276            type: "prism.descriptionList", name: "Description list", category: "display", summary: "A list of terms and their values in two aligned columns (or stacked), for specifications and record details.",277            props: [278                PropSpec("items", .list, "Entries: `{term, value}`.", required: true),279                PropSpec("layout", .enum, "Two columns, or each term above its value.", default: "columns", values: ["columns", "stacked"], dynamic: false),280            ],281            keywords: ["details", "specifications", "properties", "terms", "definition list", "summary"], accessibilityRole: "list",282            examples: [["id": "specs", "type": "prism.descriptionList", "props": ["items": [["term": "Weight", "value": "1.2 kg"], ["term": "Color", "value": "Silver"]]]]],283            fixture: fixture("prism.descriptionList", ["items": [284                ["term": "Customer", "value": "Northwind Traders"], ["term": "Contact", "value": "Maria Anders"],285                ["term": "Address", "value": "Obere Str. 57, Berlin"], ["term": "Since", "value": "March 2021"],286            ]])287        ),288        ComponentManifest(289            type: "prism.trend", name: "Trend", category: "display", summary: "A headline value with its change (up or down arrow and amount), green or red depending on whether the change is good.",290            props: [291                PropSpec("value", .any, "The headline value, already formatted or computed.", required: true), PropSpec("label", .string, "What the value is."),292                PropSpec("delta", .number, "The change: a fraction for `percent` (0.12 is +12%), a plain number otherwise."),293                PropSpec("deltaFormat", .enum, "How the change is written.", default: "percent", values: ["percent", "number"], dynamic: false),294                PropSpec("positiveIsGood", .boolean, "False when a rise is bad news (costs, errors).", default: true, dynamic: false),295                PropSpec("tone", .enum, "Color of the change; `auto` follows its sign.", default: "auto", values: ["auto"] + tones),296            ],297            keywords: ["delta", "change", "growth", "increase", "decrease", "variation", "kpi"], accessibilityRole: "staticText", accessibilityLabelProp: "label",298            examples: [["id": "revenue_trend", "type": "prism.trend", "props": ["label": "Revenue", "value": ["$expr": "formatCurrency(state.revenue)"], "delta": ["$expr": "state.revenueChange"]]]],299            fixture: fixture("prism.trend", ["label": "Revenue this month", "value": "$48,200", "delta": 0.124])300        ),301        ComponentManifest(302            type: "prism.tagList", name: "Tag list", category: "display", summary: "A list of strings shown as chips that wrap onto several lines; `click` receives the clicked string as `value`.",303            props: [PropSpec("tags", .list, "The strings to show.", required: true), toneProp],304            events: ["click"], keywords: ["tags", "labels", "pills", "keywords", "skills", "topics"], accessibilityRole: "list",305            examples: [["id": "skills", "type": "prism.tagList", "props": ["tags": ["Swift", "SQL", "Design"], "tone": "info"]]],306            fixture: fixture("prism.tagList", ["tags": ["Swift", "SQLite", "Accessibility", "Design systems", "Testing", "Localization", "Performance"], "tone": "info"])307        ),308        ComponentManifest(309            type: "prism.chip", name: "Chip", category: "display", summary: "One compact pill with text and an optional symbol; a button when `click` has actions or `selected` is bound to state (it then toggles).",310            props: [311                PropSpec("text", .string, "Chip text.", required: true), PropSpec("symbol", .string, "SF Symbol before the text."), toneProp,312                PropSpec("selected", .boolean, "Draw it filled, as the active choice; when bound to a state key, clicking toggles that key.", default: false, binding: .optional),313            ],314            events: ["click"], keywords: ["pill", "tag", "token", "toggle chip", "choice"], accessibilityRole: "button", accessibilityLabelProp: "text",315            examples: [["id": "urgent_chip", "type": "prism.chip", "props": ["text": "Urgent", "symbol": "flame", "tone": "danger", "selected": ["$bind": "onlyUrgent"]]]],316            fixture: fixture("prism.chip", ["text": "Urgent only", "symbol": "flame", "tone": "danger", "selected": ["$bind": "onlyUrgent"]], state: ["onlyUrgent": true])317        ),318        ComponentManifest(319            type: "prism.ratingDisplay", name: "Rating display", category: "display", summary: "Read-only stars for a number (half stars included), e.g. 3.5 out of 5.",320            props: [321                PropSpec("value", .number, "The rating.", required: true), PropSpec("max", .number, "Number of stars.", default: 5, dynamic: false),322                PropSpec("showValue", .boolean, "Write the number after the stars.", default: false, dynamic: false), tone("warning", "Star color."),323            ],324            keywords: ["stars", "score", "review", "rating", "note"], accessibilityRole: "image",325            examples: [["id": "product_rating", "type": "prism.ratingDisplay", "props": ["value": ["$expr": "state.rating"], "showValue": true]]],326            fixture: fixture("prism.ratingDisplay", ["value": 3.5, "max": 5, "showValue": true])327        ),328        ComponentManifest(329            type: "prism.timeline", name: "Timeline", category: "display", summary: "A vertical list of events joined by a line, each with a title, a subtitle, a symbol and a tone.",330            props: [PropSpec("items", .list, "Events in order: `{title, subtitle?, symbol?, tone?}`.", required: true)],331            keywords: ["history", "activity", "events", "log", "milestones", "chronology"], accessibilityRole: "list",332            examples: [["id": "order_history", "type": "prism.timeline", "props": ["items": [["title": "Ordered", "subtitle": "March 3", "symbol": "cart", "tone": "info"], ["title": "Delivered", "subtitle": "March 6", "symbol": "checkmark", "tone": "success"]]]]],333            fixture: fixture("prism.timeline", ["items": [334                ["title": "Order placed", "subtitle": "March 3, 09:12", "symbol": "cart", "tone": "info"],335                ["title": "Payment confirmed", "subtitle": "March 3, 09:13", "symbol": "creditcard", "tone": "success"],336                ["title": "Shipped", "subtitle": "March 4, 16:40", "symbol": "shippingbox", "tone": "accent"],337                ["title": "Delivery delayed", "subtitle": "March 6, weather", "symbol": "exclamationmark.triangle", "tone": "warning"],338            ]])339        ),340        ComponentManifest(341            type: "prism.steps", name: "Steps", category: "display", summary: "A horizontal step indicator: earlier steps are checked, the current one is highlighted, later ones are dimmed.",342            props: [343                PropSpec("steps", .list, "The step titles, in order.", required: true),344                PropSpec("current", .number, "Zero-based index of the current step.", required: true), tone("accent"),345            ],346            keywords: ["stepper", "wizard", "progress steps", "stages", "checkout", "onboarding"], accessibilityRole: "list",347            examples: [["id": "checkout_steps", "type": "prism.steps", "props": ["steps": ["Cart", "Shipping", "Payment", "Done"], "current": ["$expr": "state.step"]]]],348            fixture: fixture("prism.steps", ["steps": ["Account", "Profile", "Plan", "Done"], "current": 1])349        ),350        ComponentManifest(351            type: "prism.statusDot", name: "Status dot", category: "display", summary: "A small colored dot with a label, for states such as online, paused or failed.",352            props: [353                PropSpec("label", .string, "The state in words.", required: true), toneProp,354                PropSpec("pulse", .boolean, "Animate a halo to show live activity (off when Reduce Motion is on).", default: false),355            ],356            keywords: ["status", "online", "state", "indicator", "presence", "health"], accessibilityRole: "staticText", accessibilityLabelProp: "label",357            examples: [["id": "server_status", "type": "prism.statusDot", "props": ["label": "Online", "tone": "success", "pulse": true]]],358            fixture: fixture("prism.statusDot", ["label": "All systems operational", "tone": "success"])359        ),360        ComponentManifest(361            type: "prism.counterBadge", name: "Counter badge", category: "display", summary: "A number in a small pill (unread, pending, in cart); can hide at zero and caps large values as \"99+\".",362            props: [363                PropSpec("count", .number, "The number to show.", required: true), PropSpec("label", .string, "What is counted, for VoiceOver."),364                PropSpec("max", .number, "Values above this read \"max+\".", default: 99, dynamic: false),365                PropSpec("hideZero", .boolean, "Show nothing when the count is zero.", default: true, dynamic: false), tone("danger"),366            ],367            keywords: ["unread", "notification count", "bubble", "number pill", "pending"], accessibilityRole: "staticText", accessibilityLabelProp: "label",368            examples: [["id": "unread_count", "type": "prism.counterBadge", "props": ["count": ["$expr": "count(queries.unread)"], "label": "Unread messages"]]],369            fixture: fixture("prism.counterBadge", ["count": 128, "label": "Unread messages", "max": 99])370        ),371        ComponentManifest(372            type: "prism.ring", name: "Progress ring", category: "display", summary: "Circular progress for a fraction from 0 to 1, with a label in the middle (the percentage by default).",373            props: [374                PropSpec("value", .number, "Fraction complete, 0 to 1.", required: true), PropSpec("label", .string, "Text in the middle; the percentage when omitted."),375                PropSpec("caption", .string, "Small text under the label, also the spoken name."),376                PropSpec("size", .number, "Diameter in points.", default: 96, dynamic: false), PropSpec("lineWidth", .number, "Thickness of the ring.", default: 10, dynamic: false), toneProp,377            ],378            keywords: ["circular progress", "donut", "completion", "goal", "activity ring", "percent"], accessibilityRole: "progressIndicator", accessibilityLabelProp: "caption",379            examples: [["id": "goal_ring", "type": "prism.ring", "props": ["value": ["$expr": "state.done / state.goal"], "caption": "Goal"]]],380            fixture: fixture("prism.ring", ["value": 0.72, "caption": "Daily goal", "size": 140, "lineWidth": 14, "tone": "success"])381        ),382        ComponentManifest(383            type: "prism.gauge", name: "Gauge", category: "display", summary: "A half-circle dial showing where a value sits between a minimum and a maximum, e.g. temperature or speed.",384            props: [385                PropSpec("value", .number, "The current value.", required: true), PropSpec("min", .number, "Lowest value of the dial.", default: 0),386                PropSpec("max", .number, "Highest value of the dial.", default: 100), PropSpec("label", .string, "What is measured."),387                PropSpec("unit", .string, "Text added after the number, e.g. \" °C\" or \"%\"."), PropSpec("size", .number, "Width in points.", default: 160, dynamic: false), toneProp,388            ],389            keywords: ["dial", "speedometer", "half circle", "measure", "temperature", "level"], accessibilityRole: "levelIndicator", accessibilityLabelProp: "label",390            examples: [["id": "cpu_gauge", "type": "prism.gauge", "props": ["value": ["$expr": "state.cpu"], "min": 0, "max": 100, "label": "CPU", "unit": "%"]]],391            fixture: fixture("prism.gauge", ["value": 68, "min": 0, "max": 100, "label": "CPU load", "unit": "%", "size": 220, "tone": "warning"])392        ),393        ComponentManifest(394            type: "prism.meter", name: "Level meter", category: "display", summary: "A row of segments lit up to a level, e.g. signal strength, password strength or volume.",395            props: [396                PropSpec("value", .number, "The level, from 0 to `max`.", required: true), PropSpec("max", .number, "The level at which every segment is lit.", default: 1),397                PropSpec("segments", .number, "Number of segments.", default: 10, dynamic: false), PropSpec("label", .string, "What is measured."), toneProp,398            ],399            keywords: ["segments", "level", "strength", "signal", "volume", "battery"], accessibilityRole: "levelIndicator", accessibilityLabelProp: "label",400            examples: [["id": "strength_meter", "type": "prism.meter", "props": ["label": "Password strength", "value": ["$expr": "length(state.password)"], "max": 16, "segments": 8]]],401            fixture: fixture("prism.meter", ["label": "Signal strength", "value": 7, "max": 10, "segments": 10, "tone": "success"])402        ),403        ComponentManifest(404            type: "prism.colorSwatch", name: "Color swatches", category: "display", summary: "Round color chips from a list of hex colors; clicking one selects it, writes it to state and fires `select`.",405            props: [406                PropSpec("colors", .list, "Hex colors such as \"#0A84FF\".", required: true),407                PropSpec("selection", .string, "The selected hex, or a state key that holds it.", dynamic: false, binding: .optional),408                PropSpec("size", .number, "Diameter of a chip in points.", default: 28, dynamic: false),409            ],410            events: ["select"], keywords: ["palette", "color picker", "colors", "theme choice", "hex"], accessibilityRole: "radioGroup",411            examples: [["id": "label_color", "type": "prism.colorSwatch", "props": ["colors": ["#0A84FF", "#30D158", "#FF9F0A", "#FF375F"], "selection": ["$bind": "labelColor"]]]],412            fixture: fixture("prism.colorSwatch", ["colors": ["#0A84FF", "#5E5CE6", "#BF5AF2", "#FF375F", "#FF9F0A", "#FFD60A", "#30D158", "#40C8E0", "#8E8E93"], "selection": ["$bind": "color"], "size": 36], state: ["color": "#FF9F0A"])413        ),414        ComponentManifest(415            type: "prism.qrCode", name: "QR code", category: "display", summary: "A scannable QR code generated on this Mac for a text or web address.",416            props: [417                PropSpec("value", .string, "The text or URL to encode.", required: true), PropSpec("size", .number, "Side in points.", default: 160, dynamic: false),418                PropSpec("correction", .enum, "Error correction, from lowest (L) to highest (H).", default: "M", values: ["L", "M", "Q", "H"], dynamic: false),419            ],420            keywords: ["qr", "barcode", "scan", "share link", "2d code"], accessibilityRole: "image",421            examples: [["id": "share_qr", "type": "prism.qrCode", "props": ["value": ["$expr": "concat('https://example.com/t/', state.ticketId)"], "size": 180]]],422            fixture: fixture("prism.qrCode", ["value": "https://example.com/tickets/A-10492", "size": 200])423        ),424        ComponentManifest(425            type: "prism.featureList", name: "Feature list", category: "display", summary: "A list of features or benefits, each with an SF Symbol, a title and a line of text, in one or more columns.",426            props: [427                PropSpec("items", .list, "Entries: `{symbol?, title, text?}`.", required: true),428                PropSpec("columns", .number, "Number of columns, 1 to 4.", default: 1, dynamic: false), tone("accent", "Symbol color."),429            ],430            keywords: ["benefits", "highlights", "bullets", "what's new", "onboarding", "icons list"], accessibilityRole: "list",431            examples: [["id": "whats_new", "type": "prism.featureList", "props": ["items": [["symbol": "bolt", "title": "Faster", "text": "Opens in half the time."], ["symbol": "lock", "title": "Private", "text": "Your data stays on this Mac."]]]]],432            fixture: fixture("prism.featureList", ["columns": 2, "items": [433                ["symbol": "bolt.fill", "title": "Fast", "text": "Opens instantly, even with years of data."],434                ["symbol": "lock.fill", "title": "Private", "text": "Everything stays on this Mac."],435                ["symbol": "arrow.triangle.2.circlepath", "title": "Evolving", "text": "Change the app whenever your needs change."],436                ["symbol": "square.and.arrow.up", "title": "Shareable", "text": "Publish it as its own desktop app."],437            ]])438        ),439        ComponentManifest(440            type: "prism.pricingCard", name: "Pricing card", category: "display", summary: "A plan card with a title, a price and its period, a list of included features and a call-to-action button.",441            props: [442                PropSpec("title", .string, "Plan name.", required: true), PropSpec("price", .any, "The price, already formatted, e.g. \"$12\".", required: true),443                PropSpec("period", .string, "Billing period after the price, e.g. \"per month\"."), PropSpec("features", .list, "What the plan includes, one string each."),444                PropSpec("buttonTitle", .string, "Button text.", default: "Choose"), PropSpec("badge", .string, "Small badge beside the title, e.g. \"Popular\"."),445                PropSpec("highlighted", .boolean, "Outline the card and fill the button, for the recommended plan.", default: false),446            ],447            events: ["click"], keywords: ["plan", "price", "subscription", "tier", "offer", "upgrade"], accessibilityRole: "group", accessibilityLabelProp: "title",448            examples: [["id": "team_plan", "type": "prism.pricingCard", "props": ["title": "Team", "price": "$12", "period": "per month", "features": ["Ten people", "Shared history"], "highlighted": true],449                        "events": ["click": [["type": "setState", "key": "plan", "value": "team"]]]]],450            fixture: fixtureA("prism.pricingCard", ["title": "Team", "price": "$12", "period": "per person / month", "badge": "Popular", "highlighted": true, "buttonTitle": "Choose Team", "width": 300,451                                                    "features": ["Up to ten people", "Shared projects and history", "Priority support"]],452                              events: ["click": [["type": "showNotification", "message": "Team plan chosen.", "tone": "success"]]])453        ),454        ComponentManifest(455            type: "prism.symbolTile", name: "Symbol tile", category: "display", summary: "An SF Symbol in white on a rounded gradient tile, like an app or settings icon.",456            props: [PropSpec("symbol", .string, "SF Symbol name.", required: true), PropSpec("size", .number, "Side in points.", default: 56, dynamic: false), tone("accent", "Tile color.")],457            keywords: ["icon tile", "app icon", "glyph", "rounded square", "settings icon"], accessibilityRole: "image",458            examples: [["id": "wifi_tile", "type": "prism.symbolTile", "props": ["symbol": "wifi", "tone": "info", "size": 32, "accessibilityLabel": "Wi-Fi"]]],459            fixture: fixture("prism.symbolTile", ["symbol": "leaf.fill", "tone": "success", "size": 96, "accessibilityLabel": "Leaf"])460        ),461        ComponentManifest(462            type: "prism.legend", name: "Legend", category: "display", summary: "Color and label pairs that explain what the colors of a figure or a set of rings, dots and swatches mean.",463            props: [464                PropSpec("items", .list, "Entries: `{label, color?: hex, tone?}`; without a color the theme's series colors are used in order.", required: true),465                PropSpec("direction", .enum, "On a wrapping line, or one per row.", default: "horizontal", values: ["horizontal", "vertical"], dynamic: false),466            ],467            keywords: ["key", "color key", "series", "explain colors", "graph legend"], accessibilityRole: "list",468            examples: [["id": "status_legend", "type": "prism.legend", "props": ["items": [["label": "Done", "tone": "success"], ["label": "Late", "tone": "danger"], ["label": "Planned", "color": "#8E8E93"]]]]],469            fixture: fixture("prism.legend", ["items": [["label": "Food", "color": "#FF9F0A"], ["label": "Housing", "color": "#0A84FF"], ["label": "Leisure", "color": "#BF5AF2"], ["label": "Savings", "tone": "success"]]])470        ),471    ]472473    // MARK: Text474475    static let familyAText: [ComponentManifest] = [476        ComponentManifest(477            type: "prism.codeBlock", name: "Code block", category: "text", summary: "Monospaced, selectable text for code, commands or logs, with a Copy button.",478            props: [479                PropSpec("code", .string, "The text to show.", required: true), PropSpec("language", .string, "Caption above the code, e.g. \"swift\"."),480                PropSpec("showCopy", .boolean, "Show the Copy button.", default: true, dynamic: false),481                PropSpec("wrap", .boolean, "Wrap long lines instead of scrolling sideways.", default: false, dynamic: false),482            ],483            events: ["copy"], keywords: ["code", "snippet", "monospace", "terminal", "command", "copy"], accessibilityRole: "staticText", accessibilityLabelProp: "language",484            examples: [["id": "install_snippet", "type": "prism.codeBlock", "props": ["language": "shell", "code": "swift build -c release"]]],485            fixture: fixture("prism.codeBlock", ["language": "swift", "code": "struct Greeting {\n    let name: String\n    var text: String { \"Hello, \\(name)!\" }\n}\n\nprint(Greeting(name: \"PRISM\").text)"])486        ),487        ComponentManifest(488            type: "prism.quote", name: "Quote", category: "text", summary: "A quotation set apart by an accent bar, with an optional author line.",489            props: [PropSpec("text", .string, "The quoted words.", required: true), PropSpec("author", .string, "Who said it."), tone("accent", "Color of the bar.")],490            keywords: ["blockquote", "citation", "testimonial", "saying", "pull quote"], accessibilityRole: "staticText", accessibilityLabelProp: "text",491            examples: [["id": "customer_quote", "type": "prism.quote", "props": ["text": "It replaced three spreadsheets.", "author": "A happy customer"]]],492            fixture: fixture("prism.quote", ["text": "The most dangerous phrase in the language is: we've always done it this way.", "author": "Grace Hopper"])493        ),494        ComponentManifest(495            type: "prism.markdown", name: "Markdown text", category: "text", summary: "A paragraph with inline Markdown: **bold**, *italic*, `code`, ~~strikethrough~~ and [links](https://…) that open in the browser.",496            props: [497                PropSpec("text", .string, "Inline Markdown source.", required: true),498                PropSpec("style", .enum, "Typography role.", default: "body", values: ["body", "callout", "caption", "headline", "title"], dynamic: false), toneProp,499            ],500            keywords: ["rich text", "bold", "italic", "formatted", "inline link", "md"], accessibilityRole: "staticText", accessibilityLabelProp: "text",501            examples: [["id": "intro", "type": "prism.markdown", "props": ["text": "Import a **CSV** file, then *edit* any row. See the [guide](https://example.com/guide)."]]],502            fixture: fixture("prism.markdown", ["text": "Import a **CSV** file, then *edit* any row. Use `Tab` to move between cells, ~~no manual~~ required. Read the [guide](https://example.com/guide) for more."])503        ),504        ComponentManifest(505            type: "prism.link", name: "Web link", category: "text", summary: "A link that opens an http or https address in the default browser; any other kind of address is refused and shown disabled.",506            props: [507                PropSpec("url", .string, "The address; must start with https:// or http://.", required: true), PropSpec("title", .string, "Link text; the address when omitted."),508                PropSpec("symbol", .string, "SF Symbol before the text."),509            ],510            events: ["open"], keywords: ["url", "hyperlink", "website", "open in browser", "external"], accessibilityRole: "link", accessibilityLabelProp: "title",511            examples: [["id": "docs_link", "type": "prism.link", "props": ["title": "Documentation", "url": "https://example.com/docs", "symbol": "book"]]],512            fixture: fixture("prism.link", ["title": "Read the documentation", "url": "https://example.com/docs", "symbol": "arrow.up.right.square"])513        ),514        ComponentManifest(515            type: "prism.shortcut", name: "Keyboard shortcut", category: "text", summary: "Shows a keyboard shortcut as keycaps (⌘ ⇧ K) from key names, with an optional label; display only.",516            props: [517                PropSpec("keys", .list, "Key names in order: cmd, shift, option, ctrl, return, esc, tab, space, delete, up, down, left, right, or a character.", required: true),518                PropSpec("label", .string, "What the shortcut does."),519            ],520            keywords: ["keys", "hotkey", "keycap", "key combination", "command key"], accessibilityRole: "staticText", accessibilityLabelProp: "label",521            examples: [["id": "search_shortcut", "type": "prism.shortcut", "props": ["label": "Search", "keys": ["cmd", "k"]]]],522            fixture: fixture("prism.shortcut", ["label": "Open the command palette", "keys": ["cmd", "shift", "p"]])523        ),524        ComponentManifest(525            type: "prism.label", name: "Label", category: "text", summary: "An SF Symbol followed by a line of text.",526            props: [527                PropSpec("text", .string, "The text.", required: true), PropSpec("symbol", .string, "SF Symbol before the text."),528                PropSpec("style", .enum, "Typography role.", default: "body", values: ["body", "caption", "callout", "headline", "title"], dynamic: false), toneProp,529            ],530            keywords: ["icon and text", "symbol text", "caption with icon", "bullet"], accessibilityRole: "staticText", accessibilityLabelProp: "text",531            examples: [["id": "due_label", "type": "prism.label", "props": ["text": ["$expr": "concat('Due ', formatDate(state.due))"], "symbol": "calendar"]]],532            fixture: fixture("prism.label", ["text": "Due on Friday", "symbol": "calendar", "style": "headline", "tone": "accent"])533        ),534        ComponentManifest(535            type: "prism.breadcrumb", name: "Breadcrumb", category: "text", summary: "A path of ancestors (Home › Projects › Atlas); clicking an earlier item fires `click` with its `value`, or its zero-based index.",536            props: [PropSpec("items", .list, "Titles in order, as strings or `{title, value?}`; the last one is the current place.", required: true)],537            events: ["click"], keywords: ["path", "trail", "hierarchy", "where am i", "back navigation"], accessibilityRole: "group",538            examples: [["id": "path", "type": "prism.breadcrumb", "props": ["items": ["Home", "Projects", "Atlas"]], "events": ["click": [["type": "setState", "key": "level", "value": ["$expr": "value"]]]]]],539            fixture: fixtureA("prism.breadcrumb", ["items": ["Home", "Projects", "Atlas", "Settings"]], events: ["click": [["type": "setState", "key": "level", "value": ["$expr": "value"]]]], state: ["level": 3])540        ),541    ]542543    // MARK: Feedback and time544545    static let familyAFeedback: [ComponentManifest] = [546        ComponentManifest(547            type: "prism.callout", name: "Callout", category: "feedback", summary: "A tinted note inside the content with a symbol, a title and a text: tips, explanations, cautions.",548            props: [549                PropSpec("title", .string, "Headline.", required: true), PropSpec("text", .string, "Supporting text."),550                PropSpec("symbol", .string, "SF Symbol; one matching the tone when omitted."), tone("info"),551            ],552            keywords: ["note", "tip", "info box", "hint", "admonition", "caution"], accessibilityRole: "note", accessibilityLabelProp: "title",553            examples: [["id": "tip", "type": "prism.callout", "props": ["title": "Tip", "text": "Drag a row to reorder it.", "symbol": "lightbulb", "tone": "info"]]],554            fixture: fixture("prism.callout", ["title": "Tip", "text": "You can import several files at once; rows already present are skipped.", "symbol": "lightbulb.fill", "tone": "info"])555        ),556        ComponentManifest(557            type: "prism.emptyState", name: "Empty state", category: "feedback", summary: "What to show when there is nothing yet: a symbol, a title, a message and an optional action button.",558            props: [559                PropSpec("title", .string, "Headline.", required: true), PropSpec("message", .string, "What the user can do."),560                PropSpec("symbol", .string, "SF Symbol above the title."), PropSpec("actionTitle", .string, "Text of the action button; no button when omitted."),561            ],562            events: ["click"], keywords: ["no data", "nothing here", "placeholder", "zero state", "get started", "blank"], accessibilityRole: "group", accessibilityLabelProp: "title",563            examples: [["id": "no_tasks", "type": "prism.emptyState", "props": ["title": "No tasks yet", "message": "Add your first task to get started.", "symbol": "checklist", "actionTitle": "Add a task"],564                        "events": ["click": [["type": "setState", "key": "showEditor", "value": true]]]]],565            fixture: fixtureA("prism.emptyState", ["title": "No tasks yet", "message": "Add your first task to get started.", "symbol": "checklist", "actionTitle": "Add a task"],566                              events: ["click": [["type": "showNotification", "message": "A task would be added here.", "tone": "info"]]])567        ),568        ComponentManifest(569            type: "prism.skeleton", name: "Skeleton", category: "feedback", summary: "Grey placeholder bars standing in for content that is still loading; the gentle pulse stops when Reduce Motion is on.",570            props: [571                PropSpec("lines", .number, "Number of bars.", default: 3, dynamic: false), PropSpec("avatar", .boolean, "Add a round placeholder before the bars.", default: false, dynamic: false),572                PropSpec("animated", .boolean, "Pulse while shown.", default: true, dynamic: false),573            ],574            keywords: ["placeholder", "loading", "shimmer", "ghost", "pending content"], accessibilityRole: "progressIndicator",575            examples: [["id": "loading_rows", "type": "prism.skeleton", "props": ["lines": 4, "avatar": true, "visible": ["$expr": "state.loading"]]]],576            fixture: fixture("prism.skeleton", ["lines": 4, "avatar": true])577        ),578        ComponentManifest(579            type: "prism.banner", name: "Banner", category: "feedback", summary: "A full-width message with a close button; bind `presented` to state so closing it is remembered and it can be shown again.",580            props: [581                PropSpec("title", .string, "The message headline.", required: true), PropSpec("message", .string, "Supporting text."),582                PropSpec("symbol", .string, "SF Symbol; one matching the tone when omitted."), tone("info"),583                PropSpec("dismissible", .boolean, "Show the close button.", default: true, dynamic: false),584                PropSpec("presented", .boolean, "State key that is true while the banner is shown; shown until closed when omitted.", default: true, binding: .optional),585            ],586            events: ["dismiss"], keywords: ["announcement", "notice", "dismissible", "message bar", "info strip"], accessibilityRole: "status", accessibilityLabelProp: "title",587            examples: [["id": "update_banner", "type": "prism.banner", "props": ["title": "A new version is ready", "message": "Restart to update.", "tone": "info", "presented": ["$bind": "showUpdate"]]]],588            fixture: fixture("prism.banner", ["title": "A new version is ready", "message": "Restart the app to get the latest improvements.", "tone": "info", "presented": ["$bind": "showUpdate"]], state: ["showUpdate": true])589        ),590        ComponentManifest(591            type: "prism.spinner", name: "Spinner", category: "feedback", summary: "An indeterminate activity indicator with a label, for work whose duration is unknown.",592            props: [593                PropSpec("label", .string, "What is happening."),594                PropSpec("size", .enum, "Indicator size.", default: "regular", values: ["small", "regular", "large"], dynamic: false),595            ],596            keywords: ["loading", "busy", "activity indicator", "working", "wait"], accessibilityRole: "progressIndicator", accessibilityLabelProp: "label",597            examples: [["id": "saving_spinner", "type": "prism.spinner", "props": ["label": "Saving…", "size": "small", "visible": ["$expr": "state.saving"]]]],598            fixture: fixture("prism.spinner", ["label": "Loading your data…"])599        ),600        ComponentManifest(601            type: "prism.confirm", name: "Confirmation dialog", category: "feedback", summary: "Invisible until its state key is true, then asks the user to confirm or cancel (e.g. before deleting); fires `confirm` or `cancelled`.",602            props: [603                PropSpec("presented", .boolean, "State key that is true while the dialog is open.", required: true, dynamic: false, binding: .required),604                PropSpec("title", .string, "The question.", required: true), PropSpec("message", .string, "Consequences, in one sentence."),605                PropSpec("confirmTitle", .string, "Text of the confirming button.", default: "Confirm"), PropSpec("cancelTitle", .string, "Text of the cancelling button.", default: "Cancel"),606                PropSpec("destructive", .boolean, "Mark the confirming button as destructive.", default: false, dynamic: false),607            ],608            events: ["confirm", "cancelled"], keywords: ["are you sure", "dialog", "delete confirmation", "prompt", "ask before"], accessibilityRole: "dialog", accessibilityLabelProp: "title",609            examples: [["id": "delete_confirm", "type": "prism.confirm", "props": ["presented": ["$bind": "askDelete"], "title": "Delete this item?", "message": "This cannot be undone.", "confirmTitle": "Delete", "destructive": true],610                        "events": ["confirm": [["type": "showNotification", "message": "Deleted.", "tone": "success"]]]]],611            fixture: fixtureInStack(612                ["id": "fx_confirm", "type": "prism.confirm", "name": "Confirmation", "props": ["presented": ["$bind": "askDelete"], "title": "Delete this item?", "message": "This cannot be undone.", "confirmTitle": "Delete", "destructive": true],613                 "events": ["confirm": [["type": "showNotification", "message": "Deleted.", "tone": "success"]], "cancelled": [["type": "showNotification", "message": "Nothing was deleted.", "tone": "info"]]]],614                direction: "vertical",615                around: [616                    ["id": "fx_ask", "type": "prism.button", "name": "Ask", "props": ["title": "Delete…", "icon": "trash", "style": "destructive"], "events": ["click": [["type": "setState", "key": "askDelete", "value": true]]]],617                    note("fx_note", "The dialog opens when the button sets its state key to true."),618                ], order: ["fx_ask", "fx_note", "fx_confirm"], state: ["askDelete": false])619        ),620        ComponentManifest(621            type: "prism.loadingOverlay", name: "Loading overlay", category: "feedback", summary: "Dims and disables its children and shows a spinner over them while a state value or expression is true.",622            props: [623                PropSpec("loading", .boolean, "True while the content is busy.", required: true, binding: .optional),624                PropSpec("label", .string, "Text under the spinner."),625            ],626            acceptsChildren: true, keywords: ["busy", "blocking", "dim", "progress cover", "wait"], accessibilityRole: "group", accessibilityLabelProp: "label",627            examples: [["id": "form_busy", "type": "prism.loadingOverlay", "props": ["loading": ["$expr": "state.saving"], "label": "Saving…"], "children": ["form"]]],628            fixture: fixture("prism.loadingOverlay", ["loading": ["$bind": "busy"], "label": "Saving…"], state: ["busy": true], extra: [629                ["id": "fx_a", "type": "prism.card", "name": "Card", "props": ["title": "Profile"], "children": ["fx_b", "fx_c"]],630                text("fx_b", "Name: Ada Lovelace"), text("fx_c", "Plan: Team"),631            ], children: ["fx_a"])632        ),633        ComponentManifest(634            type: "prism.clock", name: "Clock", category: "time", summary: "The current time or date, refreshed every second, in the Mac's or a chosen time zone.",635            props: [636                PropSpec("format", .enum, "What is shown.", default: "timeWithSeconds", values: ["time", "timeWithSeconds", "date", "dateTime"], dynamic: false),637                PropSpec("timeZone", .string, "IANA zone such as \"Europe/Paris\"; the Mac's zone when omitted.", dynamic: false),638                PropSpec("style", .enum, "Typography role.", default: "title", values: ["body", "callout", "headline", "title", "largeTitle"], dynamic: false), toneProp,639            ],640            keywords: ["time", "now", "current time", "world clock", "today", "live date"], accessibilityRole: "staticText",641            examples: [["id": "paris_clock", "type": "prism.clock", "props": ["format": "time", "timeZone": "Europe/Paris", "accessibilityLabel": "Time in Paris"]]],642            fixture: fixture("prism.clock", ["format": "timeWithSeconds", "style": "largeTitle", "accessibilityLabel": "Current time"])643        ),644        ComponentManifest(645            type: "prism.countdown", name: "Countdown", category: "time", summary: "Days, hours, minutes and seconds left until a date (YYYY-MM-DD) or an ISO date and time; fires `complete` when it reaches zero on screen.",646            props: [647                PropSpec("until", .string, "The deadline: \"2027-01-01\" (local midnight), \"2027-01-01T18:30\" (local) or an ISO 8601 datetime with a zone.", required: true),648                PropSpec("label", .string, "What is awaited."), PropSpec("doneText", .string, "Shown once the time has passed.", default: "Time's up"),649                PropSpec("showSeconds", .boolean, "Show the seconds.", default: true, dynamic: false), toneProp,650            ],651            events: ["complete"], keywords: ["deadline", "time left", "remaining", "launch", "event", "days until"], accessibilityRole: "timer", accessibilityLabelProp: "label",652            examples: [["id": "launch_countdown", "type": "prism.countdown", "props": ["label": "Launch", "until": ["$expr": "state.launchDate"]],653                        "events": ["complete": [["type": "showNotification", "message": "Launch time!", "tone": "success"]]]]],654            fixture: fixture("prism.countdown", ["label": "Until the product launch", "until": "2030-01-01", "tone": "accent"])655        ),656    ]657}658
Files main
Menu

Theme