SPB Git

Repository Public License

Catalog+FamilyB.swift 58.0 KB 505 lines swift

1import Foundation2import PrismComponentSDK3import PrismCore45/// Catalog family B: inputs, forms, productivity and time.6extension Catalog {7    // MARK: Builders89    /// A prop that must be `{"$bind": "stateKey"}`: the component writes its value there.10    private static func bound(_ name: String, _ kind: PropSpec.Kind, _ summary: String) -> PropSpec {11        PropSpec(name, kind, summary, required: true, dynamic: false, binding: .required)12    }1314    /// A prop that may be bound to state so the component can mirror a value there.15    private static func mirror(_ name: String, _ kind: PropSpec.Kind, _ summary: String) -> PropSpec {16        PropSpec(name, kind, summary, dynamic: false, binding: .optional)17    }1819    private static let labelProp = PropSpec("label", .string, "Label shown above the control.")20    private static let placeholderProp = PropSpec("placeholder", .string, "Hint shown while empty.")21    private static let optionsProp = PropSpec("options", .list, "The choices, as a list of strings.")22    private static let optionsFromProp = PropSpec("optionsFrom", .object, "`{table, column}`: add that column's distinct values to the choices.", dynamic: false)23    private static let minProp = PropSpec("min", .number, "Lowest allowed value.", dynamic: false)24    private static let maxProp = PropSpec("max", .number, "Highest allowed value.", dynamic: false)25    private static let stepProp = PropSpec("step", .number, "Increment.", default: 1, dynamic: false)26    private static let tableProp = PropSpec("table", .string, "The table whose records are shown.", required: true, dynamic: false)27    private static let dateColumnProp = PropSpec("dateColumn", .string, "Date column that places each record on a day.", required: true, dynamic: false)28    private static let titleColumnProp = PropSpec("titleColumn", .string, "Column shown as each record's title; defaults to the first text column.", dynamic: false)29    private static let actionItemsProp = PropSpec("items", .list, "Entries: `{title, icon?, actions:[…]}`; each runs its actions when chosen.", required: true, dynamic: false)3031    /// A to-do table with a boolean, a status and a date column, for the productivity fixtures.32    static let tasksTable: JSONValue = [33        "id": "fx_tasks", "type": "prism.data.table", "name": "Tasks",34        "props": [35            "columns": [36                ["name": "title", "type": "text", "label": "Task", "required": true], ["name": "done", "type": "boolean", "label": "Done"],37                ["name": "status", "type": "text", "label": "Status", "options": ["To do", "Doing", "Done"]],38                ["name": "owner", "type": "text", "label": "Owner"],39            ],40            "seed": [41                ["title": "Draft the proposal", "done": true, "status": "Done", "owner": "Maya"],42                ["title": "Review the budget", "done": false, "status": "Doing", "owner": "Leo"],43                ["title": "Book the venue", "done": false, "status": "To do", "owner": "Maya"],44                ["title": "Send invitations", "done": false, "status": "To do", "owner": "Sam"],45            ],46        ],47    ]4849    // MARK: Manifests5051    static let familyB: [ComponentManifest] = familyBInputs + familyBControls + familyBProductivity5253    private static let familyBInputs: [ComponentManifest] = [54        ComponentManifest(55            type: "prism.slider", name: "Slider", category: "input", summary: "Drag to pick a number between a minimum and a maximum; writes it to state.",56            props: [labelProp, bound("value", .number, "State key holding the number."), PropSpec("min", .number, "Lowest value.", default: 0, dynamic: false),57                    PropSpec("max", .number, "Highest value.", default: 100, dynamic: false), stepProp, PropSpec("showValue", .boolean, "Show the number beside the track.", default: true, dynamic: false)],58            events: ["change"], keywords: ["range", "volume", "level", "drag", "number", "percentage"], accessibilityRole: "slider", accessibilityLabelProp: "label",59            examples: [["id": "volume", "type": "prism.slider", "props": ["label": "Volume", "value": ["$bind": "volume"], "min": 0, "max": 100, "step": 5]]],60            fixture: fixture("prism.slider", ["label": "Volume", "value": ["$bind": "volume"], "min": 0, "max": 100, "step": 5], state: ["volume": 40])61        ),62        ComponentManifest(63            type: "prism.stepper", name: "Stepper", category: "input", summary: "Up and down arrows that raise or lower a number in state by a fixed step.",64            props: [labelProp, bound("value", .number, "State key holding the number."), minProp, maxProp, stepProp],65            events: ["change"], keywords: ["increment", "decrement", "quantity", "arrows", "number"], accessibilityRole: "stepper", accessibilityLabelProp: "label",66            examples: [["id": "guests", "type": "prism.stepper", "props": ["label": "Guests", "value": ["$bind": "guests"], "min": 1, "max": 12]]],67            fixture: fixture("prism.stepper", ["label": "Guests", "value": ["$bind": "guests"], "min": 1, "max": 12], state: ["guests": 2])68        ),69        ComponentManifest(70            type: "prism.ratingInput", name: "Rating input", category: "input", summary: "Clickable stars that store a rating (0 to max) in state.",71            props: [labelProp, bound("value", .number, "State key holding the rating; 0 means not rated."), PropSpec("max", .number, "Number of stars (1 to 10).", default: 5, dynamic: false),72                    PropSpec("icon", .string, "SF Symbol with a `.fill` variant.", default: "star", dynamic: false)],73            events: ["change"], keywords: ["stars", "review", "score", "feedback", "rate"], accessibilityRole: "slider", accessibilityLabelProp: "label",74            examples: [["id": "rating", "type": "prism.ratingInput", "props": ["label": "Your rating", "value": ["$bind": "rating"], "max": 5]]],75            fixture: fixture("prism.ratingInput", ["label": "Your rating", "value": ["$bind": "rating"], "max": 5], state: ["rating": 3])76        ),77        ComponentManifest(78            type: "prism.colorPicker", name: "Color picker", category: "input", summary: "Pick a color from swatches or the system color panel; stores it as #RRGGBB in state.",79            props: [labelProp, bound("value", .string, "State key holding the color as `#RRGGBB`."), PropSpec("presets", .list, "Swatches offered, as `#RRGGBB` strings; a default palette when omitted.")],80            events: ["change"], keywords: ["colour", "hex", "swatch", "palette", "paint"], accessibilityRole: "colorWell", accessibilityLabelProp: "label",81            examples: [["id": "label_color", "type": "prism.colorPicker", "props": ["label": "Label color", "value": ["$bind": "labelColor"]]]],82            fixture: fixture("prism.colorPicker", ["label": "Label color", "value": ["$bind": "color"]], state: ["color": "#34C759"])83        ),84        ComponentManifest(85            type: "prism.timePicker", name: "Time picker", category: "time", summary: "Hour and minute input; stores the time as 24-hour HH:mm in state.",86            props: [labelProp, bound("value", .string, "State key holding the time as `HH:mm`.")],87            events: ["change"], keywords: ["time", "hour", "minute", "clock", "schedule", "alarm"], accessibilityRole: "dateField", accessibilityLabelProp: "label",88            examples: [["id": "start_time", "type": "prism.timePicker", "props": ["label": "Starts at", "value": ["$bind": "startTime"]]]],89            fixture: fixture("prism.timePicker", ["label": "Starts at", "value": ["$bind": "startTime"]], state: ["startTime": "09:30"])90        ),91        ComponentManifest(92            type: "prism.dateRange", name: "Date range", category: "time", summary: "Two date pickers for a start and an end day (YYYY-MM-DD); keeps the end on or after the start.",93            props: [labelProp, bound("start", .string, "State key holding the first day."), bound("end", .string, "State key holding the last day.")],94            events: ["change"], keywords: ["period", "from to", "between", "dates", "interval", "filter by date"], accessibilityRole: "group", accessibilityLabelProp: "label",95            examples: [["id": "period", "type": "prism.dateRange", "props": ["label": "Period", "start": ["$bind": "fromDate"], "end": ["$bind": "toDate"]]]],96            fixture: fixture("prism.dateRange", ["label": "Period", "start": ["$bind": "fromDate"], "end": ["$bind": "toDate"]], state: ["fromDate": "2026-01-01", "toDate": "2026-03-31"])97        ),98        ComponentManifest(99            type: "prism.multiSelect", name: "Multi-select", category: "input", summary: "A pull-down that ticks several options; stores the chosen strings as a list in state.",100            props: [labelProp, bound("value", .list, "State key holding the list of chosen options."), optionsProp, optionsFromProp, PropSpec("placeholder", .string, "Text shown when nothing is chosen.", default: "Choose…")],101            events: ["change"], keywords: ["multiple choice", "tags", "categories", "filter", "pick several", "dropdown"], accessibilityRole: "popUpButton", accessibilityLabelProp: "label",102            examples: [["id": "categories", "type": "prism.multiSelect", "props": ["label": "Categories", "value": ["$bind": "categories"], "options": ["Food", "Housing", "Fun"]]]],103            fixture: fixture("prism.multiSelect", ["label": "Categories", "value": ["$bind": "categories"], "options": ["Food", "Housing", "Fun", "Travel"]], state: ["categories": ["Food", "Fun"]])104        ),105        ComponentManifest(106            type: "prism.checkbox", name: "Checkbox", category: "input", summary: "A single tick box bound to a true/false state key.",107            props: [PropSpec("label", .string, "Text beside the box.", required: true), bound("value", .boolean, "State key holding true or false.")],108            events: ["change"], keywords: ["tick", "check", "agree", "boolean", "option"], accessibilityRole: "checkBox", accessibilityLabelProp: "label",109            examples: [["id": "agree", "type": "prism.checkbox", "props": ["label": "I accept the terms", "value": ["$bind": "accepted"]]]],110            fixture: fixture("prism.checkbox", ["label": "Send me a copy", "value": ["$bind": "copy"]], state: ["copy": true])111        ),112        ComponentManifest(113            type: "prism.checkboxGroup", name: "Checkbox group", category: "input", summary: "A set of tick boxes; the ticked options are stored as a list in state.",114            props: [labelProp, bound("value", .list, "State key holding the ticked options."), optionsProp, optionsFromProp,115                    PropSpec("direction", .enum, "Stacked or side by side.", default: "vertical", values: ["vertical", "horizontal"], dynamic: false)],116            events: ["change"], keywords: ["multiple choice", "tick boxes", "options", "features", "toppings"], accessibilityRole: "group", accessibilityLabelProp: "label",117            examples: [["id": "toppings", "type": "prism.checkboxGroup", "props": ["label": "Toppings", "value": ["$bind": "toppings"], "options": ["Cheese", "Mushrooms", "Olives"]]]],118            fixture: fixture("prism.checkboxGroup", ["label": "Toppings", "value": ["$bind": "toppings"], "options": ["Cheese", "Mushrooms", "Olives", "Peppers"]], state: ["toppings": ["Cheese", "Olives"]])119        ),120        ComponentManifest(121            type: "prism.radioGroup", name: "Radio group", category: "input", summary: "Radio buttons to pick exactly one option; stores the choice in state.",122            props: [labelProp, bound("value", .string, "State key holding the chosen option."), optionsProp, optionsFromProp,123                    PropSpec("direction", .enum, "Stacked or side by side.", default: "vertical", values: ["vertical", "horizontal"], dynamic: false)],124            events: ["change"], keywords: ["single choice", "radio buttons", "pick one", "option", "plan"], accessibilityRole: "radioGroup", accessibilityLabelProp: "label",125            examples: [["id": "plan", "type": "prism.radioGroup", "props": ["label": "Plan", "value": ["$bind": "plan"], "options": ["Free", "Pro", "Team"]]]],126            fixture: fixture("prism.radioGroup", ["label": "Plan", "value": ["$bind": "plan"], "options": ["Free", "Pro", "Team"]], state: ["plan": "Pro"])127        ),128        ComponentManifest(129            type: "prism.tagsInput", name: "Tags input", category: "input", summary: "Type a tag and press Return to add it, click a tag to remove it; the tags are a list in state.",130            props: [labelProp, bound("value", .list, "State key holding the list of tags."), PropSpec("placeholder", .string, "Hint in the entry field.", default: "Add a tag and press Return")],131            events: ["change", "add", "remove"], keywords: ["labels", "keywords", "chips", "tokens", "hashtags"], accessibilityRole: "group", accessibilityLabelProp: "label",132            examples: [["id": "tags", "type": "prism.tagsInput", "props": ["label": "Tags", "value": ["$bind": "tags"]]]],133            fixture: fixture("prism.tagsInput", ["label": "Tags", "value": ["$bind": "tags"]], state: ["tags": ["urgent", "client", "q3"]])134        ),135        ComponentManifest(136            type: "prism.textArea", name: "Text area", category: "forms", summary: "Multi-line text input bound to state, for comments and descriptions.",137            props: [labelProp, bound("value", .string, "State key holding the text."), placeholderProp, PropSpec("lines", .number, "Visible lines (2 to 40).", default: 4, dynamic: false)],138            events: ["change"], keywords: ["multiline", "comment", "description", "message", "paragraph", "long text"], accessibilityRole: "textArea", accessibilityLabelProp: "label",139            examples: [["id": "comment", "type": "prism.textArea", "props": ["label": "Comment", "placeholder": "What happened?", "value": ["$bind": "comment"], "lines": 5]]],140            fixture: fixture("prism.textArea", ["label": "Comment", "placeholder": "What happened?", "value": ["$bind": "comment"], "lines": 5], state: ["comment": "The delivery arrived a day early.\nEverything was in good condition."])141        ),142        ComponentManifest(143            type: "prism.secureField", name: "Secure field", category: "forms", summary: "Single-line input that hides what is typed (passwords, codes); bound to state.",144            props: [labelProp, placeholderProp, bound("value", .string, "State key holding the text.")],145            events: ["change", "submit"], keywords: ["password", "secret", "passcode", "hidden", "login"], accessibilityRole: "secureTextField", accessibilityLabelProp: "label",146            examples: [["id": "password", "type": "prism.secureField", "props": ["label": "Password", "value": ["$bind": "password"]]]],147            fixture: fixture("prism.secureField", ["label": "Password", "placeholder": "At least 8 characters", "value": ["$bind": "password"]], state: ["password": "hunter22"])148        ),149        ComponentManifest(150            type: "prism.comboBox", name: "Combo box", category: "input", summary: "A text field with a menu of options: pick one or type anything; bound to state.",151            props: [labelProp, bound("value", .string, "State key holding the text."), optionsProp, optionsFromProp, placeholderProp],152            events: ["change"], keywords: ["editable dropdown", "pick or type", "free text", "select", "options"], accessibilityRole: "comboBox", accessibilityLabelProp: "label",153            examples: [["id": "city", "type": "prism.comboBox", "props": ["label": "City", "value": ["$bind": "city"], "options": ["Montréal", "Québec", "Gatineau"]]]],154            fixture: fixture("prism.comboBox", ["label": "City", "value": ["$bind": "city"], "options": ["Montréal", "Québec", "Gatineau"], "placeholder": "Type or choose"], state: ["city": "Gatineau"])155        ),156        ComponentManifest(157            type: "prism.autocomplete", name: "Autocomplete", category: "input", summary: "A text field that suggests matching options while typing, from a fixed list or a table column's distinct values.",158            props: [labelProp, bound("value", .string, "State key holding the text."), optionsProp, optionsFromProp, placeholderProp,159                    PropSpec("maxSuggestions", .number, "Most suggestions shown at once.", default: 6, dynamic: false)],160            events: ["change", "select"], keywords: ["suggestions", "typeahead", "complete", "lookup", "search as you type"], accessibilityRole: "comboBox", accessibilityLabelProp: "label",161            examples: [["id": "payee", "type": "prism.autocomplete", "props": ["label": "Payee", "value": ["$bind": "payee"], "optionsFrom": ["table": "transactions", "column": "description"]]]],162            fixture: fixture("prism.autocomplete", ["label": "Title", "value": ["$bind": "title"], "optionsFrom": ["table": "fx_items", "column": "title"], "placeholder": "Start typing"], state: ["title": "Re"], extra: [sampleTable], permissions: storage)163        ),164        ComponentManifest(165            type: "prism.pinInput", name: "PIN input", category: "input", summary: "A row of digit boxes for a fixed-length code; stores the digits as text and fires `complete` when full.",166            props: [labelProp, bound("value", .string, "State key holding the digits typed so far."), PropSpec("length", .number, "Number of digits (1 to 12).", default: 4, dynamic: false),167                    PropSpec("masked", .boolean, "Show dots instead of the digits.", default: false, dynamic: false)],168            events: ["change", "complete"], keywords: ["code", "otp", "verification", "passcode", "digits", "two factor"], accessibilityRole: "textField", accessibilityLabelProp: "label",169            examples: [["id": "code", "type": "prism.pinInput", "props": ["label": "Verification code", "value": ["$bind": "code"], "length": 6],170                        "events": ["complete": [["type": "showNotification", "message": "Code entered."]]]]],171            fixture: fixture("prism.pinInput", ["label": "Verification code", "value": ["$bind": "code"], "length": 6], state: ["code": "4271"])172        ),173        ComponentManifest(174            type: "prism.rangeSlider", name: "Range slider", category: "input", summary: "A track with two handles for a low and a high number (price range, age range); each is bound to state.",175            props: [labelProp, bound("low", .number, "State key holding the lower number."), bound("high", .number, "State key holding the upper number."),176                    PropSpec("min", .number, "Lowest value.", default: 0, dynamic: false), PropSpec("max", .number, "Highest value.", default: 100, dynamic: false), stepProp],177            events: ["change"], keywords: ["price range", "between", "min max", "two handles", "interval", "filter"], accessibilityRole: "slider", accessibilityLabelProp: "label",178            examples: [["id": "price_range", "type": "prism.rangeSlider", "props": ["label": "Price", "low": ["$bind": "priceMin"], "high": ["$bind": "priceMax"], "min": 0, "max": 500, "step": 10]]],179            fixture: fixture("prism.rangeSlider", ["label": "Price", "low": ["$bind": "priceMin"], "high": ["$bind": "priceMax"], "min": 0, "max": 500, "step": 10], state: ["priceMin": 120, "priceMax": 380])180        ),181        ComponentManifest(182            type: "prism.chipSelect", name: "Chip select", category: "input", summary: "Choice chips: pick one (stored as text) or, with `multiple`, several (stored as a list).",183            props: [labelProp, bound("value", .any, "State key holding the chosen option, or the list of chosen options when `multiple` is true."), optionsProp, optionsFromProp,184                    PropSpec("multiple", .boolean, "Allow several chips at once.", default: false, dynamic: false)],185            events: ["change"], keywords: ["pills", "filter chips", "quick filter", "tags", "choice"], accessibilityRole: "group", accessibilityLabelProp: "label",186            examples: [["id": "size", "type": "prism.chipSelect", "props": ["label": "Size", "value": ["$bind": "size"], "options": ["S", "M", "L", "XL"]]]],187            fixture: fixture("prism.chipSelect", ["label": "Interests", "value": ["$bind": "interests"], "options": ["Design", "Code", "Music", "Travel", "Food"], "multiple": true], state: ["interests": ["Code", "Music"]])188        ),189        ComponentManifest(190            type: "prism.emailField", name: "Email field", category: "forms", summary: "Text input for an email address; shows an inline message while the address is malformed.",191            props: [labelProp, placeholderProp, bound("value", .string, "State key holding the address.")],192            events: ["change", "submit"], keywords: ["e-mail", "address", "contact", "validation", "login"], accessibilityRole: "textField", accessibilityLabelProp: "label",193            examples: [["id": "email", "type": "prism.emailField", "props": ["label": "Email", "value": ["$bind": "email"]]]],194            fixture: fixture("prism.emailField", ["label": "Email", "value": ["$bind": "email"]], state: ["email": "maya@example"])195        ),196        ComponentManifest(197            type: "prism.urlField", name: "URL field", category: "forms", summary: "Text input for a web address; shows an inline message unless it is a valid http(s) URL.",198            props: [labelProp, placeholderProp, bound("value", .string, "State key holding the address.")],199            events: ["change", "submit"], keywords: ["link", "website", "web address", "http", "validation"], accessibilityRole: "textField", accessibilityLabelProp: "label",200            examples: [["id": "website", "type": "prism.urlField", "props": ["label": "Website", "value": ["$bind": "website"]]]],201            fixture: fixture("prism.urlField", ["label": "Website", "value": ["$bind": "website"]], state: ["website": "https://example.com/pricing"])202        ),203        ComponentManifest(204            type: "prism.phoneField", name: "Phone field", category: "forms", summary: "Text input for a phone number; shows an inline message unless it has 7 to 15 digits.",205            props: [labelProp, placeholderProp, bound("value", .string, "State key holding the number as typed.")],206            events: ["change", "submit"], keywords: ["telephone", "mobile", "contact", "number", "validation"], accessibilityRole: "textField", accessibilityLabelProp: "label",207            examples: [["id": "phone", "type": "prism.phoneField", "props": ["label": "Phone", "value": ["$bind": "phone"]]]],208            fixture: fixture("prism.phoneField", ["label": "Phone", "value": ["$bind": "phone"]], state: ["phone": "+1 (819) 555-0142"])209        ),210        ComponentManifest(211            type: "prism.percentField", name: "Percent field", category: "forms", summary: "Number input with a % suffix; stores the percentage (e.g. 12.5) and shows a message while it is not a number in range.",212            props: [labelProp, bound("value", .number, "State key holding the percentage, e.g. 12.5 for 12.5 %."), PropSpec("min", .number, "Lowest allowed percentage.", default: 0, dynamic: false),213                    PropSpec("max", .number, "Highest allowed percentage.", default: 100, dynamic: false)],214            events: ["change"], keywords: ["percentage", "rate", "discount", "tax", "interest"], accessibilityRole: "textField", accessibilityLabelProp: "label",215            examples: [["id": "tax_rate", "type": "prism.percentField", "props": ["label": "Tax rate", "value": ["$bind": "taxRate"], "max": 30]]],216            fixture: fixture("prism.percentField", ["label": "Tax rate", "value": ["$bind": "taxRate"], "max": 30], state: ["taxRate": 14.975])217        ),218        ComponentManifest(219            type: "prism.unitField", name: "Unit field", category: "forms", summary: "Number input followed by a unit (kg, km, h…); stores the number and shows a message while it is malformed.",220            props: [labelProp, bound("value", .number, "State key holding the number."), PropSpec("unit", .string, "Unit shown after the number, e.g. `kg`.", required: true), minProp, maxProp],221            events: ["change"], keywords: ["measurement", "weight", "distance", "quantity", "kg", "suffix"], accessibilityRole: "textField", accessibilityLabelProp: "label",222            examples: [["id": "weight", "type": "prism.unitField", "props": ["label": "Weight", "value": ["$bind": "weight"], "unit": "kg", "min": 0]]],223            fixture: fixture("prism.unitField", ["label": "Weight", "value": ["$bind": "weight"], "unit": "kg", "min": 0], state: ["weight": 72.5])224        ),225    ]226227    private static let familyBControls: [ComponentManifest] = [228        ComponentManifest(229            type: "prism.toggleButton", name: "Toggle button", category: "input", summary: "A button that stays pressed while a true/false state key is on (bold, pin, favourite).",230            props: [PropSpec("title", .string, "Button label."), PropSpec("icon", .string, "SF Symbol."), bound("value", .boolean, "State key holding true or false.")],231            events: ["change"], keywords: ["pressed", "on off", "favorite", "pin", "bold", "sticky button"], accessibilityRole: "toggleButton", accessibilityLabelProp: "title",232            examples: [["id": "pin_toggle", "type": "prism.toggleButton", "props": ["title": "Pinned", "icon": "pin", "value": ["$bind": "pinned"]]]],233            fixture: fixture("prism.toggleButton", ["title": "Pinned", "icon": "pin", "value": ["$bind": "pinned"]], state: ["pinned": true])234        ),235        ComponentManifest(236            type: "prism.buttonGroup", name: "Button group", category: "input", summary: "Several related buttons joined in one segmented bar; each runs its own actions.",237            props: [PropSpec("label", .string, "Accessible name of the group."), actionItemsProp],238            keywords: ["segmented buttons", "toolbar group", "actions", "joined buttons", "control group"], accessibilityRole: "group", accessibilityLabelProp: "label",239            examples: [["id": "zoom_buttons", "type": "prism.buttonGroup", "props": ["label": "Zoom", "items": [240                ["title": "Smaller", "icon": "minus", "actions": [["type": "setState", "key": "zoom", "value": ["$expr": "state.zoom - 10"]]]],241                ["title": "Larger", "icon": "plus", "actions": [["type": "setState", "key": "zoom", "value": ["$expr": "state.zoom + 10"]]]],242            ]]]],243            fixture: fixture("prism.buttonGroup", ["label": "Zoom", "items": [244                ["title": "Smaller", "icon": "minus", "actions": [["type": "setState", "key": "zoom", "value": ["$expr": "state.zoom - 10"]]]],245                ["title": "Reset", "actions": [["type": "setState", "key": "zoom", "value": 100]]],246                ["title": "Larger", "icon": "plus", "actions": [["type": "setState", "key": "zoom", "value": ["$expr": "state.zoom + 10"]]]],247            ]], state: ["zoom": 100])248        ),249        ComponentManifest(250            type: "prism.splitButton", name: "Split button", category: "input", summary: "A main button (fires `click`) with an attached arrow that opens a menu of alternative actions.",251            props: [PropSpec("title", .string, "Label of the main button.", required: true), PropSpec("icon", .string, "SF Symbol.", dynamic: false), actionItemsProp],252            events: ["click"], keywords: ["menu button", "default action", "more options", "save as", "dropdown button"], accessibilityRole: "menuButton", accessibilityLabelProp: "title",253            examples: [["id": "save_button", "type": "prism.splitButton", "props": ["title": "Save", "icon": "square.and.arrow.down", "items": [["title": "Save and close", "actions": [["type": "setState", "key": "showEditor", "value": false]]]]],254                        "events": ["click": [["type": "showNotification", "message": "Saved."]]]]],255            fixture: fixture("prism.splitButton", ["title": "Save", "icon": "square.and.arrow.down", "items": [256                ["title": "Save and close", "icon": "xmark.circle", "actions": [["type": "setState", "key": "open", "value": false]]],257                ["title": "Save as draft", "icon": "doc", "actions": [["type": "setState", "key": "draft", "value": true]]],258            ]], state: ["open": true, "draft": false])259        ),260        ComponentManifest(261            type: "prism.copyButton", name: "Copy button", category: "input", summary: "Copies a fixed or computed value to the clipboard and confirms with a check mark; fires `copy`.",262            props: [PropSpec("title", .string, "Button label.", default: "Copy"), PropSpec("value", .any, "The text or number to copy.", required: true)],263            events: ["copy"], keywords: ["clipboard", "pasteboard", "copy to clipboard", "share code", "duplicate text"], accessibilityRole: "button", accessibilityLabelProp: "title",264            examples: [["id": "copy_code", "type": "prism.copyButton", "props": ["title": "Copy code", "value": ["$expr": "state.inviteCode"]]]],265            fixture: fixture("prism.copyButton", ["title": "Copy invite code", "value": ["$expr": "state.inviteCode"]], state: ["inviteCode": "PRISM-4271"])266        ),267        ComponentManifest(268            type: "prism.iconButton", name: "Icon button", category: "input", summary: "A compact button showing only an SF Symbol; runs its `click` actions.",269            props: [PropSpec("icon", .string, "SF Symbol name.", required: true), PropSpec("label", .string, "Spoken name and tooltip, e.g. “Refresh”."), toneProp,270                    PropSpec("size", .number, "Symbol size in points.", default: 15, dynamic: false), PropSpec("bordered", .boolean, "Draw the button frame.", default: true, dynamic: false),271                    PropSpec("disabled", .boolean, "Whether the button is inactive.", default: false)],272            events: ["click"], keywords: ["symbol button", "toolbar button", "glyph", "compact action", "refresh"], accessibilityRole: "button", accessibilityLabelProp: "label",273            examples: [["id": "refresh", "type": "prism.iconButton", "props": ["icon": "arrow.clockwise", "label": "Refresh"], "events": ["click": [["type": "showNotification", "message": "Refreshed."]]]]],274            fixture: fixture("prism.iconButton", ["icon": "arrow.clockwise", "label": "Refresh", "tone": "accent", "size": 18])275        ),276        ComponentManifest(277            type: "prism.linkButton", name: "Link button", category: "input", summary: "A link that opens an http or https address in the browser; any other scheme is refused. Fires `open`.",278            props: [PropSpec("title", .string, "Link text; the address when omitted."), PropSpec("url", .string, "Address starting with http:// or https://.", required: true), PropSpec("icon", .string, "SF Symbol.", dynamic: false)],279            events: ["open"], keywords: ["hyperlink", "website", "external link", "open in browser", "url"], accessibilityRole: "link", accessibilityLabelProp: "title",280            examples: [["id": "docs_link", "type": "prism.linkButton", "props": ["title": "Read the guide", "url": "https://example.com/guide"]]],281            fixture: fixture("prism.linkButton", ["title": "Read the guide", "url": "https://example.com/guide"])282        ),283        ComponentManifest(284            type: "prism.form", name: "Form", category: "forms", summary: "A titled container of fields with a submit button: fires `submit` only when no validation rule fails, otherwise lists the messages.",285            props: [PropSpec("title", .string, "Heading above the fields."), PropSpec("submitTitle", .string, "Submit button text.", default: "Submit"),286                    PropSpec("rules", .list, "Rules checked on submit: `{when: {$expr}, message}`; a rule fails while `when` is true.", dynamic: false)],287            events: ["submit"], acceptsChildren: true, keywords: ["submit", "validation", "sign up", "fields", "contact form", "save"], accessibilityRole: "group", accessibilityLabelProp: "title",288            examples: [["id": "signup_form", "type": "prism.form", "props": ["title": "Sign up", "submitTitle": "Create account", "rules": [["when": ["$expr": "isEmpty(state.email)"], "message": "Email is required."]]],289                        "children": ["email"], "events": ["submit": [["type": "showNotification", "message": "Account created.", "tone": "success"]]]]],290            fixture: fixture("prism.form", ["title": "Sign up", "submitTitle": "Create account", "rules": [["when": ["$expr": "isEmpty(state.email)"], "message": "Email is required."]]], state: ["email": "", "name": "Maya"], extra: [291                ["id": "fx_name", "type": "prism.textField", "name": "Name", "props": ["label": "Name", "value": ["$bind": "name"]]],292                ["id": "fx_email", "type": "prism.emailField", "name": "Email", "props": ["label": "Email", "value": ["$bind": "email"]]],293            ], children: ["fx_name", "fx_email"])294        ),295        ComponentManifest(296            type: "prism.inlineEdit", name: "Inline edit", category: "input", summary: "Text that turns into a field when clicked; Return or clicking away writes it to state, Escape cancels.",297            props: [bound("value", .string, "State key holding the text."), PropSpec("placeholder", .string, "Shown while the text is empty.", default: "Click to edit")],298            events: ["change"], keywords: ["click to edit", "rename", "editable label", "title edit", "in place"], accessibilityRole: "button", accessibilityLabelProp: "placeholder",299            examples: [["id": "project_name", "type": "prism.inlineEdit", "props": ["value": ["$bind": "projectName"], "placeholder": "Name this project"]]],300            fixture: fixture("prism.inlineEdit", ["value": ["$bind": "projectName"], "placeholder": "Name this project"], state: ["projectName": "Spring campaign"])301        ),302        ComponentManifest(303            type: "prism.drawingPad", name: "Drawing pad", category: "input", summary: "A canvas for freehand strokes (signature, sketch); the strokes live in state as a list of point lists, with undo and clear.",304            props: [labelProp, bound("value", .list, "State key holding the strokes: a list of strokes, each a list of `[x, y]` points."),305                    PropSpec("strokeWidth", .number, "Line width in points.", default: 3, dynamic: false), PropSpec("canvasHeight", .number, "Height of the canvas in points.", default: 180, dynamic: false), toneProp],306            events: ["change", "reset"], keywords: ["signature", "sketch", "draw", "freehand", "canvas", "whiteboard"], accessibilityRole: "image", accessibilityLabelProp: "label",307            examples: [["id": "signature", "type": "prism.drawingPad", "props": ["label": "Signature", "value": ["$bind": "signature"], "canvasHeight": 140]]],308            fixture: fixture("prism.drawingPad", ["label": "Signature", "value": ["$bind": "signature"], "canvasHeight": 160, "tone": "accent"], state: ["signature": [309                [[40, 110], [60, 60], [80, 110], [100, 60], [120, 110], [150, 70], [185, 105]],310                [[215, 60], [215, 110]], [[235, 110], [260, 60], [285, 110]], [[245, 90], [275, 90]],311            ]])312        ),313        ComponentManifest(314            type: "prism.emojiPicker", name: "Emoji picker", category: "input", summary: "A grid of emoji; clicking one stores it in state (mood, reaction, list icon).",315            props: [labelProp, bound("value", .string, "State key holding the chosen emoji."), PropSpec("options", .list, "Emoji offered; a curated set when omitted.")],316            events: ["change"], keywords: ["emoticon", "reaction", "mood", "smiley", "symbol"], accessibilityRole: "group", accessibilityLabelProp: "label",317            examples: [["id": "mood", "type": "prism.emojiPicker", "props": ["label": "Mood", "value": ["$bind": "mood"]]]],318            fixture: fixture("prism.emojiPicker", ["label": "Mood", "value": ["$bind": "mood"]], state: ["mood": "🥳"])319        ),320        ComponentManifest(321            type: "prism.iconPicker", name: "Icon picker", category: "input", summary: "A filterable grid of SF Symbols; clicking one stores its name in state, ready for any `icon` prop.",322            props: [labelProp, bound("value", .string, "State key holding the chosen SF Symbol name."), PropSpec("options", .list, "SF Symbol names offered; a curated set when omitted.")],323            events: ["change"], keywords: ["sf symbol", "glyph", "symbol chooser", "category icon", "pictogram"], accessibilityRole: "group", accessibilityLabelProp: "label",324            examples: [["id": "category_icon", "type": "prism.iconPicker", "props": ["label": "Icon", "value": ["$bind": "categoryIcon"]]]],325            fixture: fixture("prism.iconPicker", ["label": "Icon", "value": ["$bind": "categoryIcon"]], state: ["categoryIcon": "cart"])326        ),327        ComponentManifest(328            type: "prism.searchSuggest", name: "Search with suggestions", category: "input", summary: "A search box with clickable recent and suggested terms; submitting a search adds it to the recent list.",329            props: [PropSpec("placeholder", .string, "Hint text.", default: "Search"), bound("value", .string, "State key holding the search text."),330                    PropSpec("suggestions", .list, "Suggested terms."), mirror("recent", .list, "State key holding the list of recent searches; kept up to date on submit."),331                    PropSpec("maxRecent", .number, "Most recent searches kept.", default: 5, dynamic: false)],332            events: ["change", "submit", "select"], keywords: ["search history", "recent searches", "suggested terms", "find", "quick search"], accessibilityRole: "searchField", accessibilityLabelProp: "placeholder",333            examples: [["id": "product_search", "type": "prism.searchSuggest", "props": ["placeholder": "Search products", "value": ["$bind": "search"], "suggestions": ["Chairs", "Desks", "Lamps"], "recent": ["$bind": "recentSearches"]]]],334            fixture: fixture("prism.searchSuggest", ["placeholder": "Search products", "value": ["$bind": "q"], "suggestions": ["Chairs", "Desks", "Lamps", "Shelves"], "recent": ["$bind": "recent"]], state: ["q": "", "recent": ["standing desk", "monitor arm"]])335        ),336        ComponentManifest(337            type: "prism.keypad", name: "Numeric keypad", category: "input", summary: "On-screen digit keys with delete that edit a bound value: text by default, a number with `numeric`.",338            props: [labelProp, bound("value", .any, "State key holding the typed digits (text), or the number when `numeric` is true."),339                    PropSpec("numeric", .boolean, "Store a number instead of text.", default: false, dynamic: false), PropSpec("decimal", .boolean, "Offer the decimal point.", default: true, dynamic: false),340                    PropSpec("maxLength", .number, "Most characters accepted.", default: 12, dynamic: false)],341            events: ["change"], keywords: ["number pad", "dial pad", "digits", "touch keys", "point of sale", "amount entry"], accessibilityRole: "group", accessibilityLabelProp: "label",342            examples: [["id": "amount_pad", "type": "prism.keypad", "props": ["label": "Amount", "value": ["$bind": "amount"], "numeric": true]]],343            fixture: fixture("prism.keypad", ["label": "Amount", "value": ["$bind": "amount"], "numeric": true], state: ["amount": 42.5])344        ),345        ComponentManifest(346            type: "prism.dial", name: "Dial", category: "input", summary: "A circular knob dragged to set a bounded number (temperature, volume); writes it to state.",347            props: [labelProp, bound("value", .number, "State key holding the number."), PropSpec("min", .number, "Lowest value.", default: 0, dynamic: false),348                    PropSpec("max", .number, "Highest value.", default: 100, dynamic: false), stepProp, PropSpec("diameter", .number, "Size of the knob in points (60 to 400).", default: 120, dynamic: false)],349            events: ["change"], keywords: ["knob", "rotary", "thermostat", "gauge control", "volume", "circular slider"], accessibilityRole: "slider", accessibilityLabelProp: "label",350            examples: [["id": "thermostat", "type": "prism.dial", "props": ["label": "Temperature", "value": ["$bind": "temperature"], "min": 10, "max": 30, "step": 0.5]]],351            fixture: fixture("prism.dial", ["label": "Temperature", "value": ["$bind": "temperature"], "min": 10, "max": 30, "step": 0.5, "diameter": 150], state: ["temperature": 21.5])352        ),353    ]354355    private static let familyBProductivity: [ComponentManifest] = [356        ComponentManifest(357            type: "prism.kanban", name: "Kanban board", category: "productivity", summary: "A board with one column per value of a status column; each record is a card, and dragging a card to another column updates the record.",358            props: [tableProp, PropSpec("statusColumn", .string, "Text column whose value is the card's column.", required: true, dynamic: false), titleColumnProp,359                    PropSpec("subtitleColumn", .string, "Column shown under each card's title.", dynamic: false),360                    PropSpec("options", .list, "Column order; defaults to the status column's `options`, then any other value found."),361                    mirror("selection", .any, "State key that receives the clicked card's record id.")],362            events: ["drop", "select"], permissions: storage, keywords: ["board", "trello", "pipeline", "workflow", "status columns", "drag and drop", "tasks"], accessibilityRole: "group",363            examples: [["id": "task_board", "type": "prism.kanban", "props": ["table": "tasks", "statusColumn": "status", "titleColumn": "title", "selection": ["$bind": "selectedId"]]]],364            fixture: fixture("prism.kanban", ["table": "fx_tasks", "statusColumn": "status", "titleColumn": "title", "subtitleColumn": "owner", "selection": ["$bind": "selected"]], state: ["selected": nil], extra: [tasksTable], permissions: storage)365        ),366        ComponentManifest(367            type: "prism.calendar", name: "Calendar", category: "time", summary: "A month grid showing a table's records on their day; clicking a day writes its date (YYYY-MM-DD) to state and fires `select`.",368            props: [tableProp, dateColumnProp, titleColumnProp, mirror("selection", .string, "State key that receives the clicked day; the grid opens on its month.")],369            events: ["select"], permissions: storage, keywords: ["month view", "events", "schedule", "date grid", "appointments", "planner"], accessibilityRole: "grid",370            examples: [["id": "events_calendar", "type": "prism.calendar", "props": ["table": "events", "dateColumn": "date", "titleColumn": "title", "selection": ["$bind": "selectedDay"]]]],371            fixture: fixture("prism.calendar", ["table": "fx_items", "dateColumn": "date", "titleColumn": "title", "selection": ["$bind": "day"]], state: ["day": "2026-01-12"], extra: [sampleTable], permissions: storage)372        ),373        ComponentManifest(374            type: "prism.agenda", name: "Agenda", category: "time", summary: "A table's records grouped under their day, upcoming days first; clicking a record fires `select`.",375            props: [tableProp, dateColumnProp, titleColumnProp, PropSpec("subtitleColumn", .string, "Column shown at the end of each line.", dynamic: false), PropSpec("title", .string, "Heading."),376                    PropSpec("from", .string, "First day listed as upcoming (YYYY-MM-DD); today when omitted."), PropSpec("includePast", .boolean, "Also list earlier days, after the upcoming ones.", default: false, dynamic: false),377                    PropSpec("limit", .number, "Most records listed.", default: 50, dynamic: false), PropSpec("emptyText", .string, "Text when nothing is listed.", default: "Nothing coming up.")],378            events: ["select"], permissions: storage, keywords: ["upcoming", "schedule list", "events list", "timeline", "what's next", "due dates"], accessibilityRole: "list", accessibilityLabelProp: "title",379            examples: [["id": "upcoming", "type": "prism.agenda", "props": ["table": "events", "dateColumn": "date", "titleColumn": "title", "title": "Upcoming"]]],380            fixture: fixture("prism.agenda", ["table": "fx_items", "dateColumn": "date", "titleColumn": "title", "subtitleColumn": "category", "title": "Upcoming", "from": "2026-02-01", "includePast": true], extra: [sampleTable], permissions: storage)381        ),382        ComponentManifest(383            type: "prism.checklist", name: "Checklist", category: "productivity", summary: "A table's records as tick boxes over a boolean column: ticking updates the record, and a quick-add field creates one.",384            props: [tableProp, PropSpec("doneColumn", .string, "Boolean column that is true when the item is done.", required: true, dynamic: false), titleColumnProp, PropSpec("title", .string, "Heading."),385                    PropSpec("allowAdd", .boolean, "Show the quick-add field.", default: true, dynamic: false), PropSpec("hideDone", .boolean, "Hide the items already done.", default: false, dynamic: false),386                    PropSpec("placeholder", .string, "Hint in the quick-add field.", default: "Add an item")],387            events: ["toggle", "add"], permissions: storage, keywords: ["todo", "to-do list", "tasks", "tick off", "shopping list", "done"], accessibilityRole: "list", accessibilityLabelProp: "title",388            examples: [["id": "todo_list", "type": "prism.checklist", "props": ["table": "tasks", "doneColumn": "done", "titleColumn": "title", "title": "To do"]]],389            fixture: fixture("prism.checklist", ["table": "fx_tasks", "doneColumn": "done", "titleColumn": "title", "title": "Launch checklist"], extra: [tasksTable], permissions: storage)390        ),391        ComponentManifest(392            type: "prism.notes", name: "Notes", category: "productivity", summary: "A multi-line note editor bound to state, with a live character count and an optional length limit.",393            props: [labelProp, bound("value", .string, "State key holding the note."), PropSpec("placeholder", .string, "Hint shown while empty.", default: "Write a note…"),394                    PropSpec("maxLength", .number, "Longest note accepted, in characters.", dynamic: false)],395            events: ["change"], keywords: ["notepad", "memo", "journal", "scratchpad", "character count", "free text"], accessibilityRole: "textArea", accessibilityLabelProp: "label",396            examples: [["id": "meeting_notes", "type": "prism.notes", "props": ["label": "Meeting notes", "value": ["$bind": "notes"], "maxLength": 2000]]],397            fixture: fixture("prism.notes", ["label": "Meeting notes", "value": ["$bind": "notes"], "maxLength": 500], state: ["notes": "Agreed on the launch date.\nMaya follows up with the venue."])398        ),399        ComponentManifest(400            type: "prism.stopwatch", name: "Stopwatch", category: "time", summary: "Counts up with start, stop and reset; mirrors the elapsed whole seconds to an optional state key.",401            props: [labelProp, mirror("value", .number, "State key that receives the elapsed seconds.")],402            events: ["start", "stop", "reset"], keywords: ["elapsed time", "chronometer", "lap", "time tracking", "count up"], accessibilityRole: "timer", accessibilityLabelProp: "label",403            examples: [["id": "task_timer", "type": "prism.stopwatch", "props": ["label": "Time on task", "value": ["$bind": "elapsed"]]]],404            fixture: fixture("prism.stopwatch", ["label": "Time on task", "value": ["$bind": "elapsed"]], state: ["elapsed": 0])405        ),406        ComponentManifest(407            type: "prism.countdownTimer", name: "Countdown timer", category: "time", summary: "Counts down from a set duration with start, pause and reset; fires `complete` at zero.",408            props: [labelProp, PropSpec("duration", .number, "Starting duration in seconds.", default: 60, dynamic: false), PropSpec("editable", .boolean, "Let the user add or remove minutes.", default: true, dynamic: false),409                    mirror("value", .number, "State key that receives the seconds left.")],410            events: ["start", "stop", "reset", "complete"], keywords: ["timer", "count down", "egg timer", "time limit", "alarm", "minutes left"], accessibilityRole: "timer", accessibilityLabelProp: "label",411            examples: [["id": "tea_timer", "type": "prism.countdownTimer", "props": ["label": "Tea", "duration": 180], "events": ["complete": [["type": "showNotification", "message": "Your tea is ready.", "tone": "success"]]]]],412            fixture: fixture("prism.countdownTimer", ["label": "Tea", "duration": 180, "value": ["$bind": "left"]], state: ["left": 180])413        ),414        ComponentManifest(415            type: "prism.pomodoro", name: "Pomodoro timer", category: "time", summary: "Focus sessions alternating with short breaks and a long break every few sessions; fires `complete` after each focus session.",416            props: [labelProp, PropSpec("workMinutes", .number, "Length of a focus session.", default: 25, dynamic: false), PropSpec("breakMinutes", .number, "Length of a short break.", default: 5, dynamic: false),417                    PropSpec("longBreakMinutes", .number, "Length of the long break.", default: 15, dynamic: false), PropSpec("cyclesBeforeLongBreak", .number, "Focus sessions before a long break.", default: 4, dynamic: false),418                    mirror("value", .number, "State key that receives the number of focus sessions completed.")],419            events: ["start", "stop", "reset", "complete"], keywords: ["focus timer", "work break", "productivity timer", "tomato", "deep work", "sessions"], accessibilityRole: "timer", accessibilityLabelProp: "label",420            examples: [["id": "focus", "type": "prism.pomodoro", "props": ["label": "Focus", "workMinutes": 25, "breakMinutes": 5, "value": ["$bind": "sessionsDone"]]]],421            fixture: fixture("prism.pomodoro", ["label": "Focus", "workMinutes": 25, "breakMinutes": 5, "value": ["$bind": "sessions"]], state: ["sessions": 0])422        ),423        ComponentManifest(424            type: "prism.calculator", name: "Calculator", category: "productivity", summary: "A four-function calculator (+ − × ÷, percent, sign); mirrors each result to an optional state key.",425            props: [labelProp, mirror("value", .number, "State key that receives the result.")],426            events: ["change"], keywords: ["arithmetic", "add", "multiply", "divide", "compute", "math"], accessibilityRole: "group", accessibilityLabelProp: "label",427            examples: [["id": "calc", "type": "prism.calculator", "props": ["label": "Calculator", "value": ["$bind": "result"]]]],428            fixture: fixture("prism.calculator", ["label": "Calculator", "value": ["$bind": "result"]], state: ["result": 0])429        ),430        ComponentManifest(431            type: "prism.counter", name: "Counter", category: "productivity", summary: "A number with − and + buttons, bounded by min and max; writes it to state (tally, score, quantity).",432            props: [labelProp, bound("value", .number, "State key holding the count."), minProp, maxProp, stepProp],433            events: ["change"], keywords: ["tally", "score", "plus minus", "count", "clicker", "quantity"], accessibilityRole: "stepper", accessibilityLabelProp: "label",434            examples: [["id": "glasses", "type": "prism.counter", "props": ["label": "Glasses of water", "value": ["$bind": "glasses"], "min": 0, "max": 12]]],435            fixture: fixture("prism.counter", ["label": "Glasses of water", "value": ["$bind": "glasses"], "min": 0, "max": 12], state: ["glasses": 5])436        ),437        ComponentManifest(438            type: "prism.habitGrid", name: "Habit grid", category: "productivity", summary: "A contribution-style heat grid: one square per day, darker the more records a table has on that date.",439            props: [tableProp, dateColumnProp, PropSpec("title", .string, "Heading."), PropSpec("weeks", .number, "Number of week columns (1 to 53).", default: 18, dynamic: false),440                    PropSpec("endDate", .string, "Last day shown (YYYY-MM-DD); today when omitted."), toneProp],441            events: [], permissions: storage, keywords: ["heatmap", "streak", "contributions", "activity", "habit tracker", "github graph"], accessibilityRole: "image", accessibilityLabelProp: "title",442            examples: [["id": "workout_grid", "type": "prism.habitGrid", "props": ["table": "workouts", "dateColumn": "date", "title": "Workouts", "weeks": 26]]],443            fixture: fixture("prism.habitGrid", ["table": "fx_items", "dateColumn": "date", "title": "Activity", "weeks": 14, "endDate": "2026-03-08", "tone": "success"], extra: [sampleTable], permissions: storage)444        ),445        ComponentManifest(446            type: "prism.weekPlanner", name: "Week planner", category: "time", summary: "Seven day columns showing a table's records on their date, with previous and next week buttons.",447            props: [tableProp, dateColumnProp, titleColumnProp, PropSpec("week", .string, "Any day (YYYY-MM-DD) of the week shown; today when omitted. Bind it to keep the week in state.", binding: .optional)],448            events: ["select", "change"], permissions: storage, keywords: ["weekly schedule", "week view", "timetable", "7 days", "meal plan", "planner"], accessibilityRole: "grid",449            examples: [["id": "week", "type": "prism.weekPlanner", "props": ["table": "events", "dateColumn": "date", "titleColumn": "title", "week": ["$bind": "weekOf"]]]],450            fixture: fixture("prism.weekPlanner", ["table": "fx_items", "dateColumn": "date", "titleColumn": "title", "week": ["$bind": "weekOf"]], state: ["weekOf": "2026-01-05"], extra: [sampleTable], permissions: storage)451        ),452        ComponentManifest(453            type: "prism.tree", name: "Tree", category: "productivity", summary: "A collapsible outline built from nested items; clicking a row writes its id to state and fires `select`.",454            props: [PropSpec("items", .list, "Nodes: `{id, title, icon?, children?: […]}`, nested to any depth.", required: true, dynamic: false),455                    mirror("selection", .string, "State key that receives the selected node's id."), PropSpec("expandAll", .boolean, "Start with every branch open.", default: true, dynamic: false)],456            events: ["select"], keywords: ["outline", "hierarchy", "folders", "nested list", "file tree", "categories"], accessibilityRole: "outline",457            examples: [["id": "folders", "type": "prism.tree", "props": ["selection": ["$bind": "folder"], "items": [458                ["id": "inbox", "title": "Inbox", "icon": "tray"], ["id": "projects", "title": "Projects", "icon": "folder", "children": [["id": "alpha", "title": "Alpha"], ["id": "beta", "title": "Beta"]]],459            ]]]],460            fixture: fixture("prism.tree", ["selection": ["$bind": "folder"], "items": [461                ["id": "inbox", "title": "Inbox", "icon": "tray"],462                ["id": "projects", "title": "Projects", "icon": "folder", "children": [463                    ["id": "alpha", "title": "Alpha", "icon": "doc.text"],464                    ["id": "beta", "title": "Beta", "icon": "folder", "children": [["id": "beta_notes", "title": "Notes", "icon": "doc.text"], ["id": "beta_budget", "title": "Budget", "icon": "doc.text"]]],465                ]],466                ["id": "archive", "title": "Archive", "icon": "archivebox"],467            ]], state: ["folder": "alpha"])468        ),469        ComponentManifest(470            type: "prism.pagination", name: "Pagination", category: "productivity", summary: "Previous, next and numbered page buttons; writes the 1-based page to state and fires `page`.",471            props: [bound("page", .number, "State key holding the current page, starting at 1."), PropSpec("pageCount", .number, "Total number of pages.", required: true)],472            events: ["page"], keywords: ["pager", "pages", "next previous", "page numbers", "paging"], accessibilityRole: "group",473            examples: [["id": "pager", "type": "prism.pagination", "props": ["page": ["$bind": "page"], "pageCount": ["$expr": "ceil(count(queries.all_rows) / 20)"]]]],474            fixture: fixture("prism.pagination", ["page": ["$bind": "page"], "pageCount": 12], state: ["page": 5])475        ),476        ComponentManifest(477            type: "prism.commandBar", name: "Command bar", category: "productivity", summary: "A searchable list of commands: type to filter, click or press Return to run a command's actions.",478            props: [PropSpec("placeholder", .string, "Hint in the search field.", default: "Type a command"), actionItemsProp, PropSpec("maxResults", .number, "Most commands listed.", default: 8, dynamic: false)],479            keywords: ["command palette", "quick actions", "spotlight", "launcher", "search actions", "shortcuts"], accessibilityRole: "group", accessibilityLabelProp: "placeholder",480            examples: [["id": "commands", "type": "prism.commandBar", "props": ["placeholder": "Type a command", "items": [481                ["title": "New transaction", "icon": "plus", "actions": [["type": "setState", "key": "showEditor", "value": true]]],482                ["title": "Clear filters", "icon": "xmark.circle", "actions": [["type": "setState", "key": "category", "value": "All"]]],483            ]]]],484            fixture: fixture("prism.commandBar", ["placeholder": "Type a command", "items": [485                ["title": "New task", "icon": "plus", "actions": [["type": "setState", "key": "showEditor", "value": true]]],486                ["title": "Show completed tasks", "icon": "checkmark.circle", "actions": [["type": "setState", "key": "showDone", "value": true]]],487                ["title": "Hide completed tasks", "icon": "eye.slash", "actions": [["type": "setState", "key": "showDone", "value": false]]],488                ["title": "Say hello", "icon": "hand.wave", "actions": [["type": "showNotification", "message": "Hello!"]]],489            ]], state: ["showEditor": false, "showDone": true])490        ),491        ComponentManifest(492            type: "prism.wizard", name: "Wizard", category: "productivity", summary: "Shows its children one step at a time with Back and Next (each child's `name` is the step title); fires `complete` on Finish.",493            props: [mirror("step", .number, "State key holding the current step, starting at 0."), PropSpec("finishTitle", .string, "Text of the last step's button.", default: "Finish")],494            events: ["complete", "change"], acceptsChildren: true, keywords: ["steps", "onboarding", "multi-step form", "setup assistant", "stepper", "next back"], accessibilityRole: "group",495            examples: [["id": "setup", "type": "prism.wizard", "props": ["step": ["$bind": "setupStep"], "finishTitle": "Done"], "children": ["step_account", "step_preferences"],496                        "events": ["complete": [["type": "showNotification", "message": "Setup complete.", "tone": "success"]]]]],497            fixture: fixture("prism.wizard", ["step": ["$bind": "step"], "finishTitle": "Create"], state: ["step": 1, "plan": "Pro"], extra: [498                text("fx_a", "Account"),499                ["id": "fx_b", "type": "prism.radioGroup", "name": "Plan", "props": ["label": "Choose a plan", "value": ["$bind": "plan"], "options": ["Free", "Pro", "Team"]]],500                text("fx_c", "Confirm"),501            ], children: ["fx_a", "fx_b", "fx_c"])502        ),503    ]504}505
Files main
Menu

Theme