@bettercms-ai/kit 2.0.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -303,8 +303,8 @@ export type CatalogFeature = keyof typeof CATALOG;
303
303
  /**
304
304
  * Keys the import (BE derive-schema.ts, register-editable-pages.ts, template-copy.ts) writes onto a field for the
305
305
  * SERVER: how publish writes a value back into the site's own HTML (`attr`, `numeric`, `iconFont`, `htmlClasses`,
306
- * `units`, `lead`), which band a field belongs to (`band`, `family`, `shape`), and import markers (`seeded`, `shared`,
307
- * `sharedValue`). No form reads them, so no form loses anything by leaving them alone, and no agent may write them: the
306
+ * `units`, `lead`), which band a field belongs to (`band`, `family`, `shape`), import markers (`seeded`, `shared`,
307
+ * `sharedValue`), and `staleRule`, the rule that hid a field as decorative (so a release can show it again). No form reads them, so no form loses anything by leaving them alone, and no agent may write them: the
308
308
  * backend MCP drops them from what an agent sends, and its contract test fails on any key the import writes that is
309
309
  * neither here, a host key, nor read by the kit (kit-catalog.json `fieldConfig`).
310
310
  */
@@ -259,8 +259,8 @@ var CATALOG = {
259
259
  /**
260
260
  * Keys the import (BE derive-schema.ts, register-editable-pages.ts, template-copy.ts) writes onto a field for the
261
261
  * SERVER: how publish writes a value back into the site's own HTML (`attr`, `numeric`, `iconFont`, `htmlClasses`,
262
- * `units`, `lead`), which band a field belongs to (`band`, `family`, `shape`), and import markers (`seeded`, `shared`,
263
- * `sharedValue`). No form reads them, so no form loses anything by leaving them alone, and no agent may write them: the
262
+ * `units`, `lead`), which band a field belongs to (`band`, `family`, `shape`), import markers (`seeded`, `shared`,
263
+ * `sharedValue`), and `staleRule`, the rule that hid a field as decorative (so a release can show it again). No form reads them, so no form loses anything by leaving them alone, and no agent may write them: the
264
264
  * backend MCP drops them from what an agent sends, and its contract test fails on any key the import writes that is
265
265
  * neither here, a host key, nor read by the kit (kit-catalog.json `fieldConfig`).
266
266
  */
@@ -276,7 +276,8 @@ var SERVER_CONFIG_KEYS = /* @__PURE__ */ new Set([
276
276
  "lead",
277
277
  "band",
278
278
  "family",
279
- "shape"
279
+ "shape",
280
+ "staleRule"
280
281
  ]);
281
282
  /** The prop config keys CATALOG "host config" covers: any type's, then a rich text's (richtext, document) own. */
282
283
  var HOST_CONFIG_KEYS = {
@@ -1 +1 @@
1
- {"version":3,"file":"lossy.js","names":[],"sources":["../../src/adapters/lossy.ts"],"sourcesContent":["/**\n * LOSSY ITEMS — every V2 schema feature the production language cannot hold is named, never dropped silently.\n * CATALOG ITEMS (below) are the V2 metadata a host sets at seeding time, which the dock never stores.\n *\n * `path` is a JSON pointer into the V2 TypeSchema (\"/fields/3/of/0/fields/1/localized\"). `feature` is a stable name\n * from FEATURES (what the lossy ledger counts), `reason` says why prod cannot keep it, and FEATURES[feature].backlog\n * names what removes the loss.\n */\nexport interface LossyItem {\n path: string;\n feature: LossyFeature;\n reason: string;\n}\n\n/**\n * What removes a lossy feature: a named backend backlog item (its receipt is this feature's lossy count reaching 0), or\n * an explicit disposition that is not backend work: `corpus-fix` (the V2 schema breaks a prod rule the author can\n * satisfy: rename, shorten, reorder, drop a key the type cannot use), `dashboard:F12` (prod stores it; only the dock's\n * DockFieldTabs drops it, and the kit's GroupTabs replaces that at the dock cutover), `wontfix:depth` (a prod rule kept\n * on purpose: the backend refuses an 11th level with field_depth_exceeded), `wontfix:item-config` (the backend refuses\n * per-item config on a list of scalars on purpose, array_config_key_unknown), `wontfix:nesting` (the backend keeps a\n * slot's settings leaf fields, on purpose: slot_settings_invalid), `deferred:shopify` (owner 2026-10-11: a Shopify\n * reference stays locked text until the Shopify integration pipeline is built; allowed-deviations.json \"deferred\"). Owner 2026-10-11 (C11): the backend keeps a scalar list's\n * item settings (config.item), a list's bounds to 500, openMode on code, a slot's allow names (config.allow), a dotted\n * document preview path, the tabs no top-level prop sits in (components.tabs) and a nested field's tab (ui.tab { id }).\n * corpus-fix items are V2 corpus defects, an\n * owner note for the demo repo: the sandbox renders them from the V2 schema, seeding skips them.\n *\n * Landed on origin/dev and mapped here, so they name no feature any more: prop-reference (73a120c50), prop reference targets + filter (a4ce1ae95; shopify stays named), validation-parity\n * (dd021ceba), option-meta (ab15fe893), chrome-keys (98e48b9e3, 324580b2e), adapter:icons (the V2 icon vocabulary,\n * e126bf33d), localized-flag (279a10490), table / polymorphic list nesting (B1/B2: a data table or a polymorphic list at\n * any depth, in an object, a list's rows or an item type), slot nesting (C1/C2: a slot prop at any depth). What those\n * keys still cannot hold is a value the backend refuses, named below as corpus-fix.\n */\nexport type Backlog =\n | \"reference-targets\"\n | \"table\"\n | \"slot\"\n | \"block-model-fields\"\n | \"corpus-fix\"\n | \"dashboard:F12\"\n | \"wontfix:depth\"\n | \"wontfix:nesting\"\n | \"wontfix:item-config\"\n | \"deferred:shopify\";\n\nexport const FEATURES = {\n /* field types prod has no home for (the value is kept in a json field, or a near type) */\n \"type:table\": { backlog: \"table\", reason: \"Prod has no table field type (BE: a new type): the TableValue is stored verbatim in a json field.\" },\n \"type:slot\": { backlog: \"slot\", reason: \"Blocks inside a block on a content model: the backend's slot field (kind:'block' models by blockSlugs) is not mapped by this adapter yet, so it is stored as json. A component's top-level slot is a slot prop.\" },\n \"type:polymorphic-array\": { backlog: \"slot\", reason: \"An array of several item types: a model stores it as modular and a prop as a polymorphic list (table, config.mode \\\"types\\\"), both of object item types only. A list mixing scalar item types is stored as json.\" },\n \"item chrome (types)\": { backlog: \"slot\", reason: \"A polymorphic list's item type is { name, label?, fields, icon?, preview? } (item_types_invalid): it keeps its dock icon and row preview, and no other chrome.\" },\n \"type:primitive-array\": { backlog: \"wontfix:item-config\", reason: \"A list of this item type has no prod array form: config.itemType is text, number, date, image, link or richtext. Stored as json.\" },\n \"depth>10\": { backlog: \"wontfix:depth\", reason: \"Prod allows 10 field levels: the object at level 10 that would nest an 11th is stored as json.\" },\n /* document level */\n \"type name\": { backlog: \"corpus-fix\", reason: \"The schema name is stored as a kebab-case slug, which does not read back as this name.\" },\n /* tabs and sections */\n \"group name>40\": { backlog: \"corpus-fix\", reason: \"A tab name is at most 40 characters; truncated.\" },\n \"group title\": { backlog: \"corpus-fix\", reason: \"A prop tab's label is the group title trimmed (1–20 characters): a blank title defines no tab, so the group is not stored and its props sit in the default tab; spaces around a title are not kept.\" },\n \"group default\": { backlog: \"corpus-fix\", reason: \"The default tab is always the first one in prod.\" },\n \"group icon\": { backlog: \"corpus-fix\", reason: \"A tab icon is a dock icon name (DOCK_ICON_NAMES); this name is not one.\" },\n \"group (nested)\": { backlog: \"corpus-fix\", reason: \"A nested field names its tab as ui.tab { id } only when the tab is stored: this group is not (named on the group itself).\" },\n \"groups>3\": { backlog: \"dashboard:F12\", reason: \"The dock shows at most 3 tabs (DockFieldTabs), so the adapter keeps 3 until the kit GroupTabs replaces DockFieldTabs at the dock cutover: later groups' fields land in the default tab meanwhile.\" },\n \"group name collision\": { backlog: \"corpus-fix\", reason: \"Two tabs share an id, or a stored name (the first 20 characters, trimmed, any case): the backend refuses that (tab_name, fieldset ids), so the later tab is not stored.\" },\n \"prop tab limit\": { backlog: \"corpus-fix\", reason: \"A component holds at most 8 tabs, each with an id of 1–40 characters (the backend's ui.tab rule): this group is not stored and its props sit in the default tab.\" },\n \"fieldset spans groups\": { backlog: \"corpus-fix\", reason: \"A prod fieldset sits in one tab; this field's tab differs from its fieldset's.\" },\n \"fieldset (props)\": { backlog: \"corpus-fix\", reason: \"A prop group is defined on the first prop that uses it: a fieldset no prop uses is not stored (and the ones after it move up a place).\" },\n \"fieldset name>limit\": { backlog: \"corpus-fix\", reason: \"A fieldset name is at most 60 characters (a prop group label 32); truncated.\" },\n \"fieldset collision\": { backlog: \"corpus-fix\", reason: \"A fieldset shares its id with a group, or this field names a fieldset the schema does not define.\" },\n /* field chrome and rules */\n \"duplicate name\": { backlog: \"corpus-fix\", reason: \"Two sibling fields share a name; prod keys are unique per level, so the later one is renamed.\" },\n \"reserved name\": {\n backlog: \"corpus-fix\",\n reason: \"A model field's key is not one the API reserves (types' KEY_RESERVED: derived, layout, page, a forbidden key or a leading _) and is a letter, then letters, digits, - and _ (KEY_FORMAT): this one is stored renamed. id is allowed.\",\n },\n rows: { backlog: \"corpus-fix\", reason: \"ui.rows is a whole number from 1 to 40, on a text or long text field only.\" },\n synced: { backlog: \"corpus-fix\", reason: \"ui.synced names its global in 1–64 characters (trimmed).\" },\n valueShape: { backlog: \"corpus-fix\", reason: \"ui.valueShape is for a link, image or button field only.\" },\n \"default value\": { backlog: \"corpus-fix\", reason: \"This initial value holds what the prod value cannot keep (named under it): a crop preset with no image size, a datetime without seconds, a button icon outside the dock vocabulary…\" },\n slotSettings: { backlog: \"wontfix:nesting\", reason: \"A slot's per-child settings are at most 20 leaf fields (slot_settings_invalid): this setting is an object, a list, a table, a slot or a form, or past the 20th, or the field holding them is not a slot.\" },\n icon: { backlog: \"corpus-fix\", reason: \"A field icon is ui.icon, a dock icon name, on a nesting field only (an object, a list of objects, a modular list); this field is a leaf, or the name is not a dock icon.\" },\n layout: { backlog: \"corpus-fix\", reason: \"This layout does not fit the field in prod: ui.control is dropdown / radio / grid on a select, cards on a select or multiselect, checkbox on a boolean or multiselect, switch on a boolean, segmented on a select of 2–4 options, slider on a number with min < max (≤ 1000 stops); a list of scalars or entries lays out as rows or a gallery.\" },\n \"help>limit\": { backlog: \"corpus-fix\", reason: \"Help text is at most 500 characters on a field and 200 on a prop (a placeholder 120, a prop group description 200); truncated.\" },\n \"option icon\": { backlog: \"corpus-fix\", reason: \"Option icons are dock icon names, all or none per list: an icon in this list is not a dock name, so the list stores none (option_icon_unknown).\" },\n \"option description\": { backlog: \"corpus-fix\", reason: \"An option description is one line of 1–140 characters (option_description_invalid).\" },\n condition: { backlog: \"corpus-fix\", reason: \"This condition has no prod showIf form: it names something that is not a sibling (the block's _variant is one only for a top-level prop: show_if_variant_field), names it by `scope` (prod resolves a rule at the nearest level that declares its field), or tests a value showIf cannot.\" },\n access: { backlog: \"corpus-fix\", reason: \"ui.access takes view \\\"schema.view\\\" and edit \\\"schema.manage\\\" only (access_cap_unknown), and a developer lock (readOnly \\\"developer\\\") is not also a plain read-only flag.\" },\n timezone: { backlog: \"corpus-fix\", reason: \"A field's time zone is true, false, \\\"site\\\" or an IANA zone name, on a date or datetime.\" },\n \"richtext references\": {\n backlog: \"corpus-fix\",\n reason: \"A rich text's references (config.references) are { posts?, authors? }, each a content-model id (letters, digits, - and _, 1-64), on a rich text or document field only: anything else is not stored.\",\n },\n \"richtext features\": {\n backlog: \"corpus-fix\",\n reason: \"A rich text's features (config.features) are distinct names from types RICHTEXT_FEATURES, on a rich text or document field only: a name outside it is not stored, and the rest are.\",\n },\n \"shopify reference\": {\n backlog: \"deferred:shopify\",\n reason:\n \"A prop reference to Shopify: no Shopify integration backs one (reference_target_unsupported), so a Shopify-only reference is locked text holding the product id (SHOPIFY_REF_LOCK) and a mixed one keeps its other targets. Owner 2026-10-11: deferred until the Shopify integration pipeline is built (allowed-deviations.json status deferred).\",\n },\n \"reference target\": { backlog: \"reference-targets\", reason: \"A prop reference keeps entry models (contentModelId / allowedModelSlugs) and page, form and collection (config.targets, backend a4ce1ae95); Shopify has no integration behind it (reference_target_unsupported), so a shopify target is dropped and a reference with only shopify is stored as json. A content-model field keeps entry models only.\" },\n \"reference order\": { backlog: \"corpus-fix\", reason: \"Prod keeps a reference's entry models apart from its page / form / collection targets: the list reads back entry models first, then the targets.\" },\n \"reference filter\": { backlog: \"reference-targets\", reason: \"A prop reference keeps its filter as config.filter (1–500 characters, no $parameters or ^ parent: reference_filter_invalid); a content-model field keeps none.\" },\n \"numeric unit\": { backlog: \"corpus-fix\", reason: \"config.unit is a number's (1–24 characters); a rating has no unit.\" },\n \"rating bounds\": { backlog: \"corpus-fix\", reason: \"A prod rating runs from config.min (≥ 0) to config.max (a whole 1–10) in steps of config.step, min < max and at most 100 whole steps apart.\" },\n \"scale rules\": { backlog: \"corpus-fix\", reason: \"This scale breaks prod's scale rules: token values 1–32 characters and distinct, labels 1–24, at most 50 steps and 20 presets, a token preset naming a step, a { value, unit } preset needing allowCustom.\" },\n \"validation.patternMessage\": { backlog: \"corpus-fix\", reason: \"A pattern message needs a stored pattern and is 1–200 characters.\" },\n \"validation.pattern\": { backlog: \"corpus-fix\", reason: \"A pattern is kept on text, long text and url values, a regex of at most 200 characters that compiles.\" },\n \"validation.length\": { backlog: \"corpus-fix\", reason: \"Length limits are whole numbers ≥ 0, on text, long text, url and rich text values.\" },\n \"validation.items\": { backlog: \"corpus-fix\", reason: \"Item limits are whole numbers ≥ 0 on a list, min ≤ max: a tags max 1–500 and min 0–500, a prop's own list (table, array) at most 500 (LIST_ITEMS_CAP), a slot's at most 50 (SLOT_ITEMS_CAP).\" },\n \"validation.unique\": { backlog: \"corpus-fix\", reason: \"unique is for text, long text, slug, email, phone, link, number, select, date and single-model reference fields, and lists; a polymorphic reference has no one id to compare.\" },\n \"validation.recommendedMax\": { backlog: \"corpus-fix\", reason: \"A soft limit is a positive whole number in prod.\" },\n \"item identity\": { backlog: \"corpus-fix\", reason: \"A list item's name is an identifier (a letter, then letters, digits or _; ≤ 64) and its title 1–60 characters (ui.itemName / ui.itemTitle); an object item keeps no other key.\" },\n \"item settings\": { backlog: \"corpus-fix\", reason: \"A list of scalars keeps its item's description (1–200 characters), localized flag, required, a text or rich text item's length and a text item's pattern (config.item, array_item_settings_invalid): this setting is none of those, or out of their bounds (a multi-line text item reads back single-line).\" },\n itemNoun: { backlog: \"corpus-fix\", reason: \"The item noun is ui.itemLabel, capitalised, at most 24 characters.\" },\n \"block model field\": { backlog: \"block-model-fields\", reason: \"A modular item type is a kind:'block' model, which holds only fields a block primitive renders (text, long text, rich text, image, link, slug, email, phone, color, select, number, rating, date, datetime, boolean): this field is not stored.\" },\n \"item icon\": { backlog: \"corpus-fix\", reason: \"Prod keeps one icon per list (ui.icon, a dock name) and one per polymorphic item type: the list has its own icon, or this name is not a dock icon.\" },\n \"preview icon\": { backlog: \"corpus-fix\", reason: \"A row preview's icon is a dock icon name.\" },\n \"preview path\": { backlog: \"corpus-fix\", reason: \"A row preview names a child key, or a dotted path whose later segments are children or keys of an image, video, link, button, file, location, json, code or reference value, or a data table's caption or notes (preview_path_unknown).\" },\n openMode: { backlog: \"corpus-fix\", reason: \"openMode is for object, array, table and code fields only (openMode_leaf).\" },\n \"unsupported key\": { backlog: \"corpus-fix\", reason: \"This V2 key has no prod mapping.\" },\n} as const satisfies Record<string, { reason: string; backlog: Backlog }>;\n\nexport type LossyFeature = keyof typeof FEATURES;\n\n/**\n * CATALOG ITEMS — V2 metadata the dock never stores, set when a schema is seeded or placed by its host: not a loss of\n * stored content. Reported apart from LossyItem so the lossy ledger counts only what prod drops.\n */\nexport interface CatalogItem {\n path: string;\n feature: CatalogFeature;\n reason: string;\n}\n\nexport const CATALOG = {\n \"block icon\": \"The block picker's icon: a component stores it as component.icon and a model as content_models.icon, both a dock icon, so only one with no dock name for it lands here.\",\n category: \"The block picker's category is catalog metadata. A component takes the nearest prod category (CATEGORY_TO_PROD) when there is one; a model has none.\",\n \"document preview\": \"The document-level preview (how a row of this type reads in a parent's list) has no place on a model; a component stores it as component.preview.\",\n \"document preview path\": \"component.preview names a top-level prop key or a dotted path into one (`slides.0.heading`, componentPreviewRefusals); a key no prop has, or a path through a renamed value key (`image.alt`), is not stored (preview_key_unknown), so the slot row reads the child's first text instead.\",\n \"kind:block (fields)\": \"A section's fields are stored as a model (kind model): which host places it is set at seeding.\",\n \"kind:global\": \"A global (synced) block is a host-level placement; its fields are stored as a model or a component.\",\n \"kind:page\": \"A page schema is stored as a model; the host makes it a page.\",\n \"kind:object\": \"An object type is stored as a model.\",\n \"kind:entry (props)\": \"Only blocks become components; the host decides what an entry schema is placed as.\",\n variants: \"Variants are separate components sharing a sectionType in prod: the host seeds one per variant.\",\n ai: \"Not lost since A3: a field and a prop, at any depth, store the AI-assist sparkle (`ai`).\",\n \"item openMode\": \"Prod keeps one openMode per list, the array's own; the V2 engine reads only that one too (lib/schema.ts itemOpenMode ignores the item's), so the item's changes nothing the dock shows.\",\n \"itemNoun (derived)\": \"A list with no itemNoun whose item title is not the field title's singular: ui.itemLabel keeps the item title, and the read side names the noun from it, which is the noun the V2 engine already falls back to (lib/schema.ts itemNoun).\",\n \"fieldset (derived)\": \"A field names a fieldset the schema does not declare: the V2 engine draws it as a section titled by its name (engine/field-list.tsx arrange), so it is stored as that prop group and the read side declares it. Not a loss.\",\n \"prop target\": \"A V2 prop has no binding path, so fromTypeSchema('props') returns none: seeding binds each prop to its target. Not a loss.\",\n \"block placement\": \"Where a block fits (inline / section / page) is the host's: the block picker and a body's Insert menu place it; a model or component carries none.\",\n \"slot allow\": \"A slot keeps its V2 allow list as config.allow (1–50 block names of 1–64 characters, no repeats: slot_allow_invalid), which the dock resolves to the project's components; this list breaks those bounds, so the slot takes any component.\",\n \"segmented fallback\": \"A segmented select of more than SEGMENTED_MAX (8) options: V2 draws the dropdown (D46, choice.tsx fitsSegmented) and prod stores the select with no control (control_segmented holds 2–8), which the dock draws as the same dropdown. Nothing drawn differs.\",\n \"seeded instance\": \"A starting value the host writes into a new instance when it seeds or places one: a schema-level initialValue, a reference prop's default (a definition holds none: reference_in_definition), or a slot's children (they name V2 block types, which become component instances at seeding).\",\n \"not applicable (props)\": \"unique on a scalar prop, or on a sub-field outside a table: each placement holds its own value, so there is nothing to be unique across (unique_prop_scope). The instance is the whole document.\",\n \"host config\": \"A prod-only prop config key the host reads, not the V2 schema: a rich text's Accept list, its one-paragraph flags (allowMultipleParagraphs, the older inline), allowTargetBlank and component allowlist (the dock's rich-text codec and insert menu read them from the stored prop: dock-v2 richTextCodec configAt, kitServices insertableComponents), a section label, and the import's write-back metadata no editor reads (SERVER_CONFIG_KEYS). Read back, it names no loss: the kit never writes a definition, so the config rides untouched.\",\n} as const;\n\nexport type CatalogFeature = keyof typeof CATALOG;\n\n/**\n * Keys the import (BE derive-schema.ts, register-editable-pages.ts, template-copy.ts) writes onto a field for the\n * SERVER: how publish writes a value back into the site's own HTML (`attr`, `numeric`, `iconFont`, `htmlClasses`,\n * `units`, `lead`), which band a field belongs to (`band`, `family`, `shape`), and import markers (`seeded`, `shared`,\n * `sharedValue`). No form reads them, so no form loses anything by leaving them alone, and no agent may write them: the\n * backend MCP drops them from what an agent sends, and its contract test fails on any key the import writes that is\n * neither here, a host key, nor read by the kit (kit-catalog.json `fieldConfig`).\n */\nexport const SERVER_CONFIG_KEYS: ReadonlySet<string> = new Set([\n \"seeded\", \"shared\", \"sharedValue\", \"attr\", \"numeric\", \"iconFont\", \"htmlClasses\", \"units\", \"lead\", \"band\", \"family\", \"shape\",\n]);\n\n/** The prop config keys CATALOG \"host config\" covers: any type's, then a rich text's (richtext, document) own. */\nexport const HOST_CONFIG_KEYS: { any: ReadonlySet<string>; richtext: ReadonlySet<string> } = {\n // A band's name, its kind and its own heading, which the derive lane writes on the band's first field.\n // `format`: how a number is shown ($1,200+), which the canvas, the classic preview and publish read; the value stays a number\n any: new Set([\"sectionLabel\", \"sectionShape\", \"sectionTitle\", \"format\", ...SERVER_CONFIG_KEYS]),\n // `hostTag` is read from the stored field by the rich-text host, like the rest. `features` is a V2 facet now (RT0, facets.ts)\n richtext: new Set([\"accept\", \"allowMultipleParagraphs\", \"inline\", \"allowTargetBlank\", \"components\", \"hostTag\"]),\n};\n\nexport const isHostConfigKey = (type: string, key: string): boolean =>\n HOST_CONFIG_KEYS.any.has(key) || ((type === \"richtext\" || type === \"document\") && HOST_CONFIG_KEYS.richtext.has(key));\n\n/**\n * The prod config keys the kit adapter READS, per prod field type (`*` = every type): what an agent may write on a\n * field and still edit it in the kit. Exported to the backend with the host and server keys (kit-catalog.json\n * `fieldConfig`), where the MCP warns on any other key and its contract test checks what the import writes.\n * field-config-contract.test.ts proves each entry against `toTypeSchema`, so this list cannot claim a key the\n * adapter drops; a key missing here only costs a warning.\n */\nexport const KIT_READ_CONFIG_KEYS: Readonly<Record<string, readonly string[]>> = {\n \"*\": [\"placeholder\", \"zones\", \"options\", \"fields\", \"linkHref\"],\n text: [\"minLength\", \"maxLength\", \"pattern\", \"patternMessage\", \"inputType\"],\n longtext: [\"minLength\", \"maxLength\", \"pattern\", \"patternMessage\", \"inputType\"],\n url: [\"minLength\", \"maxLength\", \"pattern\", \"patternMessage\", \"inputType\"],\n richtext: [\"minLength\", \"maxLength\", \"pattern\", \"patternMessage\", \"inputType\", \"features\", \"references\"],\n document: [\"minLength\", \"maxLength\", \"pattern\", \"patternMessage\", \"inputType\", \"features\", \"references\"],\n number: [\"min\", \"max\", \"step\", \"scale\", \"unit\", \"validation\"],\n rating: [\"min\", \"max\", \"step\", \"scale\", \"unit\", \"validation\"],\n select: [\"multiSelect\"],\n multiselect: [\"min\", \"max\", \"allowCustom\"],\n tags: [\"min\", \"max\", \"allowCustom\"],\n code: [\"language\", \"languages\"],\n date: [\"timezone\", \"includeTime\"],\n datetime: [\"timezone\", \"includeTime\"],\n reference: [\"contentModelId\", \"polymorphic\", \"allowedModelSlugs\", \"targets\", \"filter\"],\n \"multi-reference\": [\"contentModelId\", \"polymorphic\", \"allowedModelSlugs\", \"targets\", \"filter\", \"min\", \"max\"],\n array: [\"itemType\", \"minItems\", \"maxItems\", \"item\"],\n image: [\"media\"],\n modular: [\"blockSlugs\", \"minItems\", \"maxItems\"],\n};\n\n/** The field-config contract the backend reads (kit-catalog.json `fieldConfig`). */\nexport const fieldConfigContract = () => ({\n read: KIT_READ_CONFIG_KEYS,\n host: { any: [...HOST_CONFIG_KEYS.any].filter((k) => !SERVER_CONFIG_KEYS.has(k)), richtext: [...HOST_CONFIG_KEYS.richtext] },\n server: [...SERVER_CONFIG_KEYS],\n});\n"],"mappings":";AA8CA,IAAa,WAAW;CAEtB,cAAc;EAAE,SAAS;EAAS,QAAQ;CAAoG;CAC9I,aAAa;EAAE,SAAS;EAAQ,QAAQ;CAAkN;CAC1P,0BAA0B;EAAE,SAAS;EAAQ,QAAQ;CAAmN;CACxQ,uBAAuB;EAAE,SAAS;EAAQ,QAAQ;CAAiK;CACnN,wBAAwB;EAAE,SAAS;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aAAa;CACtB,aAAa;EAAC;EAAO;EAAO;CAAa;CACzC,MAAM;EAAC;EAAO;EAAO;CAAa;CAClC,MAAM,CAAC,YAAY,WAAW;CAC9B,MAAM,CAAC,YAAY,aAAa;CAChC,UAAU,CAAC,YAAY,aAAa;CACpC,WAAW;EAAC;EAAkB;EAAe;EAAqB;EAAW;CAAQ;CACrF,mBAAmB;EAAC;EAAkB;EAAe;EAAqB;EAAW;EAAU;EAAO;CAAK;CAC3G,OAAO;EAAC;EAAY;EAAY;EAAY;CAAM;CAClD,OAAO,CAAC,OAAO;CACf,SAAS;EAAC;EAAc;EAAY;CAAU;AAChD;;AAGA,IAAa,6BAA6B;CACxC,MAAM;CACN,MAAM;EAAE,KAAK,CAAC,GAAG,iBAAiB,GAAG,CAAC,CAAC,QAAQ,MAAM,CAAC,mBAAmB,IAAI,CAAC,CAAC;EAAG,UAAU,CAAC,GAAG,iBAAiB,QAAQ;CAAE;CAC3H,QAAQ,CAAC,GAAG,kBAAkB;AAChC"}
1
+ {"version":3,"file":"lossy.js","names":[],"sources":["../../src/adapters/lossy.ts"],"sourcesContent":["/**\n * LOSSY ITEMS — every V2 schema feature the production language cannot hold is named, never dropped silently.\n * CATALOG ITEMS (below) are the V2 metadata a host sets at seeding time, which the dock never stores.\n *\n * `path` is a JSON pointer into the V2 TypeSchema (\"/fields/3/of/0/fields/1/localized\"). `feature` is a stable name\n * from FEATURES (what the lossy ledger counts), `reason` says why prod cannot keep it, and FEATURES[feature].backlog\n * names what removes the loss.\n */\nexport interface LossyItem {\n path: string;\n feature: LossyFeature;\n reason: string;\n}\n\n/**\n * What removes a lossy feature: a named backend backlog item (its receipt is this feature's lossy count reaching 0), or\n * an explicit disposition that is not backend work: `corpus-fix` (the V2 schema breaks a prod rule the author can\n * satisfy: rename, shorten, reorder, drop a key the type cannot use), `dashboard:F12` (prod stores it; only the dock's\n * DockFieldTabs drops it, and the kit's GroupTabs replaces that at the dock cutover), `wontfix:depth` (a prod rule kept\n * on purpose: the backend refuses an 11th level with field_depth_exceeded), `wontfix:item-config` (the backend refuses\n * per-item config on a list of scalars on purpose, array_config_key_unknown), `wontfix:nesting` (the backend keeps a\n * slot's settings leaf fields, on purpose: slot_settings_invalid), `deferred:shopify` (owner 2026-10-11: a Shopify\n * reference stays locked text until the Shopify integration pipeline is built; allowed-deviations.json \"deferred\"). Owner 2026-10-11 (C11): the backend keeps a scalar list's\n * item settings (config.item), a list's bounds to 500, openMode on code, a slot's allow names (config.allow), a dotted\n * document preview path, the tabs no top-level prop sits in (components.tabs) and a nested field's tab (ui.tab { id }).\n * corpus-fix items are V2 corpus defects, an\n * owner note for the demo repo: the sandbox renders them from the V2 schema, seeding skips them.\n *\n * Landed on origin/dev and mapped here, so they name no feature any more: prop-reference (73a120c50), prop reference targets + filter (a4ce1ae95; shopify stays named), validation-parity\n * (dd021ceba), option-meta (ab15fe893), chrome-keys (98e48b9e3, 324580b2e), adapter:icons (the V2 icon vocabulary,\n * e126bf33d), localized-flag (279a10490), table / polymorphic list nesting (B1/B2: a data table or a polymorphic list at\n * any depth, in an object, a list's rows or an item type), slot nesting (C1/C2: a slot prop at any depth). What those\n * keys still cannot hold is a value the backend refuses, named below as corpus-fix.\n */\nexport type Backlog =\n | \"reference-targets\"\n | \"table\"\n | \"slot\"\n | \"block-model-fields\"\n | \"corpus-fix\"\n | \"dashboard:F12\"\n | \"wontfix:depth\"\n | \"wontfix:nesting\"\n | \"wontfix:item-config\"\n | \"deferred:shopify\";\n\nexport const FEATURES = {\n /* field types prod has no home for (the value is kept in a json field, or a near type) */\n \"type:table\": { backlog: \"table\", reason: \"Prod has no table field type (BE: a new type): the TableValue is stored verbatim in a json field.\" },\n \"type:slot\": { backlog: \"slot\", reason: \"Blocks inside a block on a content model: the backend's slot field (kind:'block' models by blockSlugs) is not mapped by this adapter yet, so it is stored as json. A component's top-level slot is a slot prop.\" },\n \"type:polymorphic-array\": { backlog: \"slot\", reason: \"An array of several item types: a model stores it as modular and a prop as a polymorphic list (table, config.mode \\\"types\\\"), both of object item types only. A list mixing scalar item types is stored as json.\" },\n \"item chrome (types)\": { backlog: \"slot\", reason: \"A polymorphic list's item type is { name, label?, fields, icon?, preview? } (item_types_invalid): it keeps its dock icon and row preview, and no other chrome.\" },\n \"type:primitive-array\": { backlog: \"wontfix:item-config\", reason: \"A list of this item type has no prod array form: config.itemType is text, number, date, image, link or richtext. Stored as json.\" },\n \"depth>10\": { backlog: \"wontfix:depth\", reason: \"Prod allows 10 field levels: the object at level 10 that would nest an 11th is stored as json.\" },\n /* document level */\n \"type name\": { backlog: \"corpus-fix\", reason: \"The schema name is stored as a kebab-case slug, which does not read back as this name.\" },\n /* tabs and sections */\n \"group name>40\": { backlog: \"corpus-fix\", reason: \"A tab name is at most 40 characters; truncated.\" },\n \"group title\": { backlog: \"corpus-fix\", reason: \"A prop tab's label is the group title trimmed (1–20 characters): a blank title defines no tab, so the group is not stored and its props sit in the default tab; spaces around a title are not kept.\" },\n \"group default\": { backlog: \"corpus-fix\", reason: \"The default tab is always the first one in prod.\" },\n \"group icon\": { backlog: \"corpus-fix\", reason: \"A tab icon is a dock icon name (DOCK_ICON_NAMES); this name is not one.\" },\n \"group (nested)\": { backlog: \"corpus-fix\", reason: \"A nested field names its tab as ui.tab { id } only when the tab is stored: this group is not (named on the group itself).\" },\n \"groups>3\": { backlog: \"dashboard:F12\", reason: \"The dock shows at most 3 tabs (DockFieldTabs), so the adapter keeps 3 until the kit GroupTabs replaces DockFieldTabs at the dock cutover: later groups' fields land in the default tab meanwhile.\" },\n \"group name collision\": { backlog: \"corpus-fix\", reason: \"Two tabs share an id, or a stored name (the first 20 characters, trimmed, any case): the backend refuses that (tab_name, fieldset ids), so the later tab is not stored.\" },\n \"prop tab limit\": { backlog: \"corpus-fix\", reason: \"A component holds at most 8 tabs, each with an id of 1–40 characters (the backend's ui.tab rule): this group is not stored and its props sit in the default tab.\" },\n \"fieldset spans groups\": { backlog: \"corpus-fix\", reason: \"A prod fieldset sits in one tab; this field's tab differs from its fieldset's.\" },\n \"fieldset (props)\": { backlog: \"corpus-fix\", reason: \"A prop group is defined on the first prop that uses it: a fieldset no prop uses is not stored (and the ones after it move up a place).\" },\n \"fieldset name>limit\": { backlog: \"corpus-fix\", reason: \"A fieldset name is at most 60 characters (a prop group label 32); truncated.\" },\n \"fieldset collision\": { backlog: \"corpus-fix\", reason: \"A fieldset shares its id with a group, or this field names a fieldset the schema does not define.\" },\n /* field chrome and rules */\n \"duplicate name\": { backlog: \"corpus-fix\", reason: \"Two sibling fields share a name; prod keys are unique per level, so the later one is renamed.\" },\n \"reserved name\": {\n backlog: \"corpus-fix\",\n reason: \"A model field's key is not one the API reserves (types' KEY_RESERVED: derived, layout, page, a forbidden key or a leading _) and is a letter, then letters, digits, - and _ (KEY_FORMAT): this one is stored renamed. id is allowed.\",\n },\n rows: { backlog: \"corpus-fix\", reason: \"ui.rows is a whole number from 1 to 40, on a text or long text field only.\" },\n synced: { backlog: \"corpus-fix\", reason: \"ui.synced names its global in 1–64 characters (trimmed).\" },\n valueShape: { backlog: \"corpus-fix\", reason: \"ui.valueShape is for a link, image or button field only.\" },\n \"default value\": { backlog: \"corpus-fix\", reason: \"This initial value holds what the prod value cannot keep (named under it): a crop preset with no image size, a datetime without seconds, a button icon outside the dock vocabulary…\" },\n slotSettings: { backlog: \"wontfix:nesting\", reason: \"A slot's per-child settings are at most 20 leaf fields (slot_settings_invalid): this setting is an object, a list, a table, a slot or a form, or past the 20th, or the field holding them is not a slot.\" },\n icon: { backlog: \"corpus-fix\", reason: \"A field icon is ui.icon, a dock icon name, on a nesting field only (an object, a list of objects, a modular list); this field is a leaf, or the name is not a dock icon.\" },\n layout: { backlog: \"corpus-fix\", reason: \"This layout does not fit the field in prod: ui.control is dropdown / radio / grid on a select, cards on a select or multiselect, checkbox on a boolean or multiselect, switch on a boolean, segmented on a select of 2–4 options, slider on a number with min < max (≤ 1000 stops); a list of scalars or entries lays out as rows or a gallery.\" },\n \"help>limit\": { backlog: \"corpus-fix\", reason: \"Help text is at most 500 characters on a field and 200 on a prop (a placeholder 120, a prop group description 200); truncated.\" },\n \"option icon\": { backlog: \"corpus-fix\", reason: \"Option icons are dock icon names, all or none per list: an icon in this list is not a dock name, so the list stores none (option_icon_unknown).\" },\n \"option description\": { backlog: \"corpus-fix\", reason: \"An option description is one line of 1–140 characters (option_description_invalid).\" },\n condition: { backlog: \"corpus-fix\", reason: \"This condition has no prod showIf form: it names something that is not a sibling (the block's _variant is one only for a top-level prop: show_if_variant_field), names it by `scope` (prod resolves a rule at the nearest level that declares its field), or tests a value showIf cannot.\" },\n access: { backlog: \"corpus-fix\", reason: \"ui.access takes view \\\"schema.view\\\" and edit \\\"schema.manage\\\" only (access_cap_unknown), and a developer lock (readOnly \\\"developer\\\") is not also a plain read-only flag.\" },\n timezone: { backlog: \"corpus-fix\", reason: \"A field's time zone is true, false, \\\"site\\\" or an IANA zone name, on a date or datetime.\" },\n \"richtext references\": {\n backlog: \"corpus-fix\",\n reason: \"A rich text's references (config.references) are { posts?, authors? }, each a content-model id (letters, digits, - and _, 1-64), on a rich text or document field only: anything else is not stored.\",\n },\n \"richtext features\": {\n backlog: \"corpus-fix\",\n reason: \"A rich text's features (config.features) are distinct names from types RICHTEXT_FEATURES, on a rich text or document field only: a name outside it is not stored, and the rest are.\",\n },\n \"shopify reference\": {\n backlog: \"deferred:shopify\",\n reason:\n \"A prop reference to Shopify: no Shopify integration backs one (reference_target_unsupported), so a Shopify-only reference is locked text holding the product id (SHOPIFY_REF_LOCK) and a mixed one keeps its other targets. Owner 2026-10-11: deferred until the Shopify integration pipeline is built (allowed-deviations.json status deferred).\",\n },\n \"reference target\": { backlog: \"reference-targets\", reason: \"A prop reference keeps entry models (contentModelId / allowedModelSlugs) and page, form and collection (config.targets, backend a4ce1ae95); Shopify has no integration behind it (reference_target_unsupported), so a shopify target is dropped and a reference with only shopify is stored as json. A content-model field keeps entry models only.\" },\n \"reference order\": { backlog: \"corpus-fix\", reason: \"Prod keeps a reference's entry models apart from its page / form / collection targets: the list reads back entry models first, then the targets.\" },\n \"reference filter\": { backlog: \"reference-targets\", reason: \"A prop reference keeps its filter as config.filter (1–500 characters, no $parameters or ^ parent: reference_filter_invalid); a content-model field keeps none.\" },\n \"numeric unit\": { backlog: \"corpus-fix\", reason: \"config.unit is a number's (1–24 characters); a rating has no unit.\" },\n \"rating bounds\": { backlog: \"corpus-fix\", reason: \"A prod rating runs from config.min (≥ 0) to config.max (a whole 1–10) in steps of config.step, min < max and at most 100 whole steps apart.\" },\n \"scale rules\": { backlog: \"corpus-fix\", reason: \"This scale breaks prod's scale rules: token values 1–32 characters and distinct, labels 1–24, at most 50 steps and 20 presets, a token preset naming a step, a { value, unit } preset needing allowCustom.\" },\n \"validation.patternMessage\": { backlog: \"corpus-fix\", reason: \"A pattern message needs a stored pattern and is 1–200 characters.\" },\n \"validation.pattern\": { backlog: \"corpus-fix\", reason: \"A pattern is kept on text, long text and url values, a regex of at most 200 characters that compiles.\" },\n \"validation.length\": { backlog: \"corpus-fix\", reason: \"Length limits are whole numbers ≥ 0, on text, long text, url and rich text values.\" },\n \"validation.items\": { backlog: \"corpus-fix\", reason: \"Item limits are whole numbers ≥ 0 on a list, min ≤ max: a tags max 1–500 and min 0–500, a prop's own list (table, array) at most 500 (LIST_ITEMS_CAP), a slot's at most 50 (SLOT_ITEMS_CAP).\" },\n \"validation.unique\": { backlog: \"corpus-fix\", reason: \"unique is for text, long text, slug, email, phone, link, number, select, date and single-model reference fields, and lists; a polymorphic reference has no one id to compare.\" },\n \"validation.recommendedMax\": { backlog: \"corpus-fix\", reason: \"A soft limit is a positive whole number in prod.\" },\n \"item identity\": { backlog: \"corpus-fix\", reason: \"A list item's name is an identifier (a letter, then letters, digits or _; ≤ 64) and its title 1–60 characters (ui.itemName / ui.itemTitle); an object item keeps no other key.\" },\n \"item settings\": { backlog: \"corpus-fix\", reason: \"A list of scalars keeps its item's description (1–200 characters), localized flag, required, a text or rich text item's length and a text item's pattern (config.item, array_item_settings_invalid): this setting is none of those, or out of their bounds (a multi-line text item reads back single-line).\" },\n itemNoun: { backlog: \"corpus-fix\", reason: \"The item noun is ui.itemLabel, capitalised, at most 24 characters.\" },\n \"block model field\": { backlog: \"block-model-fields\", reason: \"A modular item type is a kind:'block' model, which holds only fields a block primitive renders (text, long text, rich text, image, link, slug, email, phone, color, select, number, rating, date, datetime, boolean): this field is not stored.\" },\n \"item icon\": { backlog: \"corpus-fix\", reason: \"Prod keeps one icon per list (ui.icon, a dock name) and one per polymorphic item type: the list has its own icon, or this name is not a dock icon.\" },\n \"preview icon\": { backlog: \"corpus-fix\", reason: \"A row preview's icon is a dock icon name.\" },\n \"preview path\": { backlog: \"corpus-fix\", reason: \"A row preview names a child key, or a dotted path whose later segments are children or keys of an image, video, link, button, file, location, json, code or reference value, or a data table's caption or notes (preview_path_unknown).\" },\n openMode: { backlog: \"corpus-fix\", reason: \"openMode is for object, array, table and code fields only (openMode_leaf).\" },\n \"unsupported key\": { backlog: \"corpus-fix\", reason: \"This V2 key has no prod mapping.\" },\n} as const satisfies Record<string, { reason: string; backlog: Backlog }>;\n\nexport type LossyFeature = keyof typeof FEATURES;\n\n/**\n * CATALOG ITEMS — V2 metadata the dock never stores, set when a schema is seeded or placed by its host: not a loss of\n * stored content. Reported apart from LossyItem so the lossy ledger counts only what prod drops.\n */\nexport interface CatalogItem {\n path: string;\n feature: CatalogFeature;\n reason: string;\n}\n\nexport const CATALOG = {\n \"block icon\": \"The block picker's icon: a component stores it as component.icon and a model as content_models.icon, both a dock icon, so only one with no dock name for it lands here.\",\n category: \"The block picker's category is catalog metadata. A component takes the nearest prod category (CATEGORY_TO_PROD) when there is one; a model has none.\",\n \"document preview\": \"The document-level preview (how a row of this type reads in a parent's list) has no place on a model; a component stores it as component.preview.\",\n \"document preview path\": \"component.preview names a top-level prop key or a dotted path into one (`slides.0.heading`, componentPreviewRefusals); a key no prop has, or a path through a renamed value key (`image.alt`), is not stored (preview_key_unknown), so the slot row reads the child's first text instead.\",\n \"kind:block (fields)\": \"A section's fields are stored as a model (kind model): which host places it is set at seeding.\",\n \"kind:global\": \"A global (synced) block is a host-level placement; its fields are stored as a model or a component.\",\n \"kind:page\": \"A page schema is stored as a model; the host makes it a page.\",\n \"kind:object\": \"An object type is stored as a model.\",\n \"kind:entry (props)\": \"Only blocks become components; the host decides what an entry schema is placed as.\",\n variants: \"Variants are separate components sharing a sectionType in prod: the host seeds one per variant.\",\n ai: \"Not lost since A3: a field and a prop, at any depth, store the AI-assist sparkle (`ai`).\",\n \"item openMode\": \"Prod keeps one openMode per list, the array's own; the V2 engine reads only that one too (lib/schema.ts itemOpenMode ignores the item's), so the item's changes nothing the dock shows.\",\n \"itemNoun (derived)\": \"A list with no itemNoun whose item title is not the field title's singular: ui.itemLabel keeps the item title, and the read side names the noun from it, which is the noun the V2 engine already falls back to (lib/schema.ts itemNoun).\",\n \"fieldset (derived)\": \"A field names a fieldset the schema does not declare: the V2 engine draws it as a section titled by its name (engine/field-list.tsx arrange), so it is stored as that prop group and the read side declares it. Not a loss.\",\n \"prop target\": \"A V2 prop has no binding path, so fromTypeSchema('props') returns none: seeding binds each prop to its target. Not a loss.\",\n \"block placement\": \"Where a block fits (inline / section / page) is the host's: the block picker and a body's Insert menu place it; a model or component carries none.\",\n \"slot allow\": \"A slot keeps its V2 allow list as config.allow (1–50 block names of 1–64 characters, no repeats: slot_allow_invalid), which the dock resolves to the project's components; this list breaks those bounds, so the slot takes any component.\",\n \"segmented fallback\": \"A segmented select of more than SEGMENTED_MAX (8) options: V2 draws the dropdown (D46, choice.tsx fitsSegmented) and prod stores the select with no control (control_segmented holds 2–8), which the dock draws as the same dropdown. Nothing drawn differs.\",\n \"seeded instance\": \"A starting value the host writes into a new instance when it seeds or places one: a schema-level initialValue, a reference prop's default (a definition holds none: reference_in_definition), or a slot's children (they name V2 block types, which become component instances at seeding).\",\n \"not applicable (props)\": \"unique on a scalar prop, or on a sub-field outside a table: each placement holds its own value, so there is nothing to be unique across (unique_prop_scope). The instance is the whole document.\",\n \"host config\": \"A prod-only prop config key the host reads, not the V2 schema: a rich text's Accept list, its one-paragraph flags (allowMultipleParagraphs, the older inline), allowTargetBlank and component allowlist (the dock's rich-text codec and insert menu read them from the stored prop: dock-v2 richTextCodec configAt, kitServices insertableComponents), a section label, and the import's write-back metadata no editor reads (SERVER_CONFIG_KEYS). Read back, it names no loss: the kit never writes a definition, so the config rides untouched.\",\n} as const;\n\nexport type CatalogFeature = keyof typeof CATALOG;\n\n/**\n * Keys the import (BE derive-schema.ts, register-editable-pages.ts, template-copy.ts) writes onto a field for the\n * SERVER: how publish writes a value back into the site's own HTML (`attr`, `numeric`, `iconFont`, `htmlClasses`,\n * `units`, `lead`), which band a field belongs to (`band`, `family`, `shape`), import markers (`seeded`, `shared`,\n * `sharedValue`), and `staleRule`, the rule that hid a field as decorative (so a release can show it again). No form reads them, so no form loses anything by leaving them alone, and no agent may write them: the\n * backend MCP drops them from what an agent sends, and its contract test fails on any key the import writes that is\n * neither here, a host key, nor read by the kit (kit-catalog.json `fieldConfig`).\n */\nexport const SERVER_CONFIG_KEYS: ReadonlySet<string> = new Set([\n \"seeded\", \"shared\", \"sharedValue\", \"attr\", \"numeric\", \"iconFont\", \"htmlClasses\", \"units\", \"lead\", \"band\", \"family\", \"shape\",\n \"staleRule\",\n]);\n\n/** The prop config keys CATALOG \"host config\" covers: any type's, then a rich text's (richtext, document) own. */\nexport const HOST_CONFIG_KEYS: { any: ReadonlySet<string>; richtext: ReadonlySet<string> } = {\n // A band's name, its kind and its own heading, which the derive lane writes on the band's first field.\n // `format`: how a number is shown ($1,200+), which the canvas, the classic preview and publish read; the value stays a number\n any: new Set([\"sectionLabel\", \"sectionShape\", \"sectionTitle\", \"format\", ...SERVER_CONFIG_KEYS]),\n // `hostTag` is read from the stored field by the rich-text host, like the rest. `features` is a V2 facet now (RT0, facets.ts)\n richtext: new Set([\"accept\", \"allowMultipleParagraphs\", \"inline\", \"allowTargetBlank\", \"components\", \"hostTag\"]),\n};\n\nexport const isHostConfigKey = (type: string, key: string): boolean =>\n HOST_CONFIG_KEYS.any.has(key) || ((type === \"richtext\" || type === \"document\") && HOST_CONFIG_KEYS.richtext.has(key));\n\n/**\n * The prod config keys the kit adapter READS, per prod field type (`*` = every type): what an agent may write on a\n * field and still edit it in the kit. Exported to the backend with the host and server keys (kit-catalog.json\n * `fieldConfig`), where the MCP warns on any other key and its contract test checks what the import writes.\n * field-config-contract.test.ts proves each entry against `toTypeSchema`, so this list cannot claim a key the\n * adapter drops; a key missing here only costs a warning.\n */\nexport const KIT_READ_CONFIG_KEYS: Readonly<Record<string, readonly string[]>> = {\n \"*\": [\"placeholder\", \"zones\", \"options\", \"fields\", \"linkHref\"],\n text: [\"minLength\", \"maxLength\", \"pattern\", \"patternMessage\", \"inputType\"],\n longtext: [\"minLength\", \"maxLength\", \"pattern\", \"patternMessage\", \"inputType\"],\n url: [\"minLength\", \"maxLength\", \"pattern\", \"patternMessage\", \"inputType\"],\n richtext: [\"minLength\", \"maxLength\", \"pattern\", \"patternMessage\", \"inputType\", \"features\", \"references\"],\n document: [\"minLength\", \"maxLength\", \"pattern\", \"patternMessage\", \"inputType\", \"features\", \"references\"],\n number: [\"min\", \"max\", \"step\", \"scale\", \"unit\", \"validation\"],\n rating: [\"min\", \"max\", \"step\", \"scale\", \"unit\", \"validation\"],\n select: [\"multiSelect\"],\n multiselect: [\"min\", \"max\", \"allowCustom\"],\n tags: [\"min\", \"max\", \"allowCustom\"],\n code: [\"language\", \"languages\"],\n date: [\"timezone\", \"includeTime\"],\n datetime: [\"timezone\", \"includeTime\"],\n reference: [\"contentModelId\", \"polymorphic\", \"allowedModelSlugs\", \"targets\", \"filter\"],\n \"multi-reference\": [\"contentModelId\", \"polymorphic\", \"allowedModelSlugs\", \"targets\", \"filter\", \"min\", \"max\"],\n array: [\"itemType\", \"minItems\", \"maxItems\", \"item\"],\n image: [\"media\"],\n modular: [\"blockSlugs\", \"minItems\", \"maxItems\"],\n};\n\n/** The field-config contract the backend reads (kit-catalog.json `fieldConfig`). */\nexport const fieldConfigContract = () => ({\n read: KIT_READ_CONFIG_KEYS,\n host: { any: [...HOST_CONFIG_KEYS.any].filter((k) => !SERVER_CONFIG_KEYS.has(k)), richtext: [...HOST_CONFIG_KEYS.richtext] },\n server: [...SERVER_CONFIG_KEYS],\n});\n"],"mappings":";AA8CA,IAAa,WAAW;CAEtB,cAAc;EAAE,SAAS;EAAS,QAAQ;CAAoG;CAC9I,aAAa;EAAE,SAAS;EAAQ,QAAQ;CAAkN;CAC1P,0BAA0B;EAAE,SAAS;EAAQ,QAAQ;CAAmN;CACxQ,uBAAuB;EAAE,SAAS;EAAQ,QAAQ;CAAiK;CACnN,wBAAwB;EAAE,SAAS;EAAuB,QAAQ;CAAmI;CACrM,YAAY;EAAE,SAAS;EAAiB,QAAQ;CAAiG;CAEjJ,aAAa;EAAE,SAAS;EAAc,QAAQ;CAAyF;CAEvI,iBAAiB;EAAE,SAAS;EAAc,QAAQ;CAAkD;CACpG,eAAe;EAAE,SAAS;EAAc,QAAQ;CAAsM;CACtP,iBAAiB;EAAE,SAAS;EAAc,QAAQ;CAAmD;CACrG,cAAc;EAAE,SAAS;EAAc,QAAQ;CAA0E;CACzH,kBAAkB;EAAE,SAAS;EAAc,QAAQ;CAA4H;CAC/K,YAAY;EAAE,SAAS;EAAiB,QAAQ;CAAoM;CACpP,wBAAwB;EAAE,SAAS;EAAc,QAAQ;CAA0K;CACnO,kBAAkB;EAAE,SAAS;EAAc,QAAQ;CAAmK;CACtN,yBAAyB;EAAE,SAAS;EAAc,QAAQ;CAAiF;CAC3I,oBAAoB;EAAE,SAAS;EAAc,QAAQ;CAAyI;CAC9L,uBAAuB;EAAE,SAAS;EAAc,QAAQ;CAA+E;CACvI,sBAAsB;EAAE,SAAS;EAAc,QAAQ;CAAoG;CAE3J,kBAAkB;EAAE,SAAS;EAAc,QAAQ;CAAgG;CACnJ,iBAAiB;EACf,SAAS;EACT,QAAQ;CACV;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,uBAAoE;CAC/E,KAAK;EAAC;EAAe;EAAS;EAAW;EAAU;CAAU;CAC7D,MAAM;EAAC;EAAa;EAAa;EAAW;EAAkB;CAAW;CACzE,UAAU;EAAC;EAAa;EAAa;EAAW;EAAkB;CAAW;CAC7E,KAAK;EAAC;EAAa;EAAa;EAAW;EAAkB;CAAW;CACxE,UAAU;EAAC;EAAa;EAAa;EAAW;EAAkB;EAAa;EAAY;CAAY;CACvG,UAAU;EAAC;EAAa;EAAa;EAAW;EAAkB;EAAa;EAAY;CAAY;CACvG,QAAQ;EAAC;EAAO;EAAO;EAAQ;EAAS;EAAQ;CAAY;CAC5D,QAAQ;EAAC;EAAO;EAAO;EAAQ;EAAS;EAAQ;CAAY;CAC5D,QAAQ,CAAC,aAAa;CACtB,aAAa;EAAC;EAAO;EAAO;CAAa;CACzC,MAAM;EAAC;EAAO;EAAO;CAAa;CAClC,MAAM,CAAC,YAAY,WAAW;CAC9B,MAAM,CAAC,YAAY,aAAa;CAChC,UAAU,CAAC,YAAY,aAAa;CACpC,WAAW;EAAC;EAAkB;EAAe;EAAqB;EAAW;CAAQ;CACrF,mBAAmB;EAAC;EAAkB;EAAe;EAAqB;EAAW;EAAU;EAAO;CAAK;CAC3G,OAAO;EAAC;EAAY;EAAY;EAAY;CAAM;CAClD,OAAO,CAAC,OAAO;CACf,SAAS;EAAC;EAAc;EAAY;CAAU;AAChD;;AAGA,IAAa,6BAA6B;CACxC,MAAM;CACN,MAAM;EAAE,KAAK,CAAC,GAAG,iBAAiB,GAAG,CAAC,CAAC,QAAQ,MAAM,CAAC,mBAAmB,IAAI,CAAC,CAAC;EAAG,UAAU,CAAC,GAAG,iBAAiB,QAAQ;CAAE;CAC3H,QAAQ,CAAC,GAAG,kBAAkB;AAChC"}
@@ -574,6 +574,7 @@ function RowList({ field, rows, readOnly, layout, mode, openId, onOpen, onCloseI
574
574
  function Row({ r, count, field, readOnly, grid, mode, open, onOpen, ops, sort, leading, toggle, extra, inline, popover, onClosePopover }) {
575
575
  const form = useForm();
576
576
  const env = useKitEnv();
577
+ const { mediaSrc } = useKitServices();
577
578
  const uid = React.useId();
578
579
  const isDragging = sort.active === r.id;
579
580
  const dragging = sort.active != null;
@@ -657,7 +658,7 @@ function Row({ r, count, field, readOnly, grid, mode, open, onOpen, ops, sort, l
657
658
  const tile = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
658
659
  className: "flex aspect-[4/3] items-center justify-center bg-kit-muted",
659
660
  children: r.preview.media ? /* @__PURE__ */ jsx("img", {
660
- src: r.preview.media,
661
+ src: mediaSrc ? mediaSrc(r.preview.media) : r.preview.media,
661
662
  alt: "",
662
663
  className: "size-full object-cover"
663
664
  }) : /* @__PURE__ */ jsx(KitIcon, {
@@ -1 +1 @@
1
- {"version":3,"file":"array.js","names":[],"sources":["../../src/engine/array.tsx"],"sourcesContent":["/**\n * ARRAYS — compact PREVIEW ROWS that rest closed (CPO D8 + production; V2 HEAD 9829bf1 kit/engine/array.tsx): grip ·\n * thumb · title + subtitle · validation dot · presence · always-visible ⋯ (Move up/down, Duplicate, Add above/below,\n * Remove). Opening a row follows ONE rule (CPO D43): ≤3 simple fields expand inline, else it drills in (`openMode`\n * overrides). Reorder by drag with layout animation; delete with an Undo toast; \"Add {noun}\" (a type menu when several\n * item types); min/max honoured.\n * Arrays of primitives render as a gallery (images), reference chips, or — for text, numbers and URLs — the ITEM LIST\n * (CPO D47): one input per row, no drill. Arrays of one-field objects (`[{ text }]`) use the same item list. Small\n * objects with an `included` / `isIncluded` switch get that switch as a check on the row itself.\n *\n * Host wiring (RowsHostContext): a drill row calls `drill(path)` (the frame push); without one it falls back to\n * `form.navigate` while the form draws frames (`form.canNavigate`), else drill rows are inert (no button, no ›).\n * Dialog items render the host's `NestedForm` (V2 kit-field NestedForm: its own navigation stack); without one the\n * dialog shows the item's FieldList.\n *\n * Kit deviations from V2: sorting is `useDragReorder` (no @dnd-kit in the kit; it keeps dnd-kit's pointer and keyboard\n * sensor semantics: Space / Enter picks up, arrows move, Space / Enter drops as one write, Escape cancels; the table editor's cross-list drag via\n * `sortableId` is not ported); toasts come from KitServices (absent → silent); the gallery and reference-chip controls come from\n * ARRAY_CONTROLS (registered by the controls lane); a host that never registered them edits the raw list (FallbackControl).\n */\nimport * as React from \"react\";\nimport type { ComponentType } from \"react\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport {\n IconArrowDown, IconArrowUp, IconArrowsDiagonal, IconCheck, IconChevronDown, IconChevronRight, IconCopy, IconDots, IconGripVertical, IconMinus, IconPlus, IconRowInsertBottom, IconRowInsertTop, IconTrash, IconX,\n} from \"@tabler/icons-react\";\nimport { Button } from \"../ui/button\";\nimport { Menu, MenuContent, MenuItem, MenuLabel, MenuSeparator, MenuTrigger, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, Popover, PopoverAnchor, PopoverContent, Tooltip } from \"../ui/overlay\";\nimport { cn } from \"../lib/cn\";\nimport type { FieldPath, FieldSchema } from \"../schema/types\";\nimport type { ControlProps } from \"../types\";\nimport { useForm, useKitEnv, useKitServices } from \"../context\";\nimport { ensureKeys, isObj, itemId, newKey, pathKey } from \"../lib/path\";\nimport { initialFor, itemNoun, itemOpenMode, itemSchemaFor, itemSchemas, newItem, previewOf, primitiveItem, type Preview } from \"../lib/schema\";\nimport { IssueDot, Thumb } from \"./bits\";\nimport { KitIcon } from \"../lib/icons\";\nimport { FieldShell, PeerStack } from \"./field-shell\";\nimport { FieldLabelForContext } from \"../ui/field-context\";\nimport { FieldList } from \"./field-list\";\nimport { INSET_LINE, InsetScope } from \"./grouping\";\nimport { arrayMove, ItemList, OrderLockSlot, useDragReorder, type ItemKind, type ItemListAdapter } from \"./item-list\";\nimport { CONTROLS, FallbackControl, useFieldAccess } from \"./kit-field\";\n\n/* ── Host wiring ───────────────────────────────────────────────────── */\n/** V2 kit-field NestedForm's props: a dialog's own SchemaForm over `fields`, writing into the parent form at `path`. */\nexport interface NestedFormProps {\n fields: FieldSchema[];\n title: string;\n icon?: string;\n path: FieldPath;\n navRef?: React.Ref<{ back: () => boolean }>;\n}\nexport interface RowsHost {\n /** Push a frame for an item / block path (F7b frames). Default: `form.navigate` while `form.canNavigate`. */\n drill?: (path: FieldPath) => void;\n /** Dialog-mode items: V2's NestedForm (own navigation stack). Default: the item's FieldList. */\n NestedForm?: ComponentType<NestedFormProps>;\n}\nexport const RowsHostContext = React.createContext<RowsHost>({});\n/** The frame push for a drill row, or undefined when nothing can draw the frame (the row is then inert). */\nexport function useDrill(): ((path: FieldPath) => void) | undefined {\n const host = React.useContext(RowsHostContext);\n const form = useForm();\n return host.drill ?? (form?.canNavigate ? form.navigate : undefined);\n}\n\n/** Primitive-array controls V2 imports from controls/media (GalleryControl) and controls/reference (ReferencesControl). */\nexport const ARRAY_CONTROLS: { gallery?: ComponentType<ControlProps>; references?: ComponentType<ControlProps> } = {};\n\nconst plural = (noun: string) => (noun.endsWith(\"y\") && !/[aeiou]y$/.test(noun) ? `${noun.slice(0, -1)}ies` : noun.endsWith(\"s\") ? noun : `${noun}s`);\n\nexport function ArrayField({ field, path }: { field: FieldSchema; path: FieldPath; parent?: Record<string, unknown> }) {\n const prim = primitiveItem(field);\n if (prim) return <PrimitiveArray field={field} item={prim} path={path} />;\n const one = oneFieldItem(field);\n if (one) return <OneFieldArray field={field} item={one.item} inner={one.inner} path={path} />;\n return <ObjectArray field={field} path={path} />;\n}\n\n/** Item types that edit as one line in the item list. */\nconst LIST_KIND: Partial<Record<FieldSchema[\"type\"], ItemKind>> = { string: \"text\", text: \"text\", slug: \"text\", url: \"url\", email: \"email\", number: \"number\" };\n\n/** `[{ _key, text }]` — an object item with exactly one line-like field edits as the item list (unless the schema forces another open mode). */\nfunction oneFieldItem(field: FieldSchema): { item: FieldSchema; inner: FieldSchema } | undefined {\n if (field.openMode && field.openMode !== \"inline\") return undefined;\n const of = itemSchemas(field);\n const item = of.length === 1 ? of[0] : undefined;\n const inner = item?.type === \"object\" && item.fields?.length === 1 ? item.fields[0] : undefined;\n return item && inner && LIST_KIND[inner.type] && !inner.scale ? { item, inner } : undefined;\n}\n\n/** The boolean an item shows as a check on its row (\"included\" in a feature list). */\nconst ROW_TOGGLE = /^(is)?included$/i;\nexport const rowToggleField = (s?: FieldSchema) => s?.fields?.find((f) => f.type === \"boolean\" && ROW_TOGGLE.test(f.name));\n\n/** List meta on the message line: \"3 items · max 6\". */\nfunction listMeta(n: number, field: FieldSchema) {\n const { min, max } = field.validation ?? {};\n const base = `${n} ${n === 1 ? \"item\" : \"items\"}`;\n return max != null ? `${base} · max ${max}` : min != null ? `${base} · min ${min}` : n ? base : \"\";\n}\n\n/* ── Primitive arrays ──────────────────────────────────────────────── */\nfunction PrimitiveArray({ field, item, path }: { field: FieldSchema; item: FieldSchema; path: FieldPath }) {\n const form = useForm()!;\n const id = React.useId();\n const { readOnly } = useFieldAccess(field);\n const key = pathKey(path);\n const value = form.getAt(path);\n const list = Array.isArray(value) ? value : [];\n const onChange = (v: unknown) => form.setAt(path, v);\n const props = { field, value: list, onChange, id, readOnly, path, onBlur: () => form.touch(key) };\n const kind = LIST_KIND[item.type];\n const adapter = React.useMemo<ItemListAdapter | undefined>(\n () =>\n kind\n ? {\n kind,\n read: (v) => (v == null ? \"\" : String(v)),\n write: (v) => v,\n valuePath: (i) => [i],\n placeholder: item.placeholder ?? (item.title && !/^(item|value)$/i.test(item.title) ? item.title : undefined),\n }\n : undefined,\n [kind, item.placeholder, item.title],\n );\n const Gallery = ARRAY_CONTROLS.gallery;\n const References = ARRAY_CONTROLS.references;\n const control =\n item.type === \"image\" ? (Gallery ? <Gallery {...props} /> : <FallbackControl {...props} />) :\n item.type === \"reference\" ? (References ? <References {...props} field={{ ...field, reference: item.reference }} /> : <FallbackControl {...props} />) :\n adapter ? <ItemList field={field} path={path} list={list} readOnly={readOnly} adapter={adapter} inputId={id} /> :\n <InlineList field={field} item={item} path={path} list={list} readOnly={readOnly} />;\n return (\n <FieldShell field={field} path={path} id={id} value={list} onChange={onChange} readOnly={readOnly} issue={form.visibleIssue(key)} meta={item.type === \"reference\" ? undefined : <span className=\"text-kit-xs text-kit-fg-3\">{listMeta(list.length, field)}</span>}>\n <div className=\"@container\">{control}</div>\n </FieldShell>\n );\n}\n\n/* ── One-field object arrays: same item list, value lives at item[inner.name] ── */\nfunction OneFieldArray({ field, item, inner, path }: { field: FieldSchema; item: FieldSchema; inner: FieldSchema; path: FieldPath }) {\n const form = useForm()!;\n const id = React.useId();\n const { readOnly } = useFieldAccess(field);\n const key = pathKey(path);\n const value = form.getAt(path);\n const list = Array.isArray(value) ? value : [];\n const adapter = React.useMemo<ItemListAdapter>(\n () => ({\n kind: LIST_KIND[inner.type]!,\n read: (v) => {\n const x = isObj(v) ? v[inner.name] : undefined;\n return x == null ? \"\" : String(x);\n },\n write: (v, prev) => ({ ...(isObj(prev) ? prev : (newItem(field, item) as object)), [inner.name]: v }),\n keyOf: (v) => (isObj(v) && typeof v._key === \"string\" ? v._key : undefined),\n valuePath: (i) => [i, inner.name],\n placeholder: inner.placeholder ?? item.preview?.fallback?.replace(/^Untitled /i, \"\").replace(/^./, (c) => c.toUpperCase()),\n }),\n [field, item, inner],\n );\n // legacy rows without `_key` get one on first render so rows stay stable while typing and dragging\n React.useEffect(() => {\n if (!readOnly && list.some((it) => isObj(it) && typeof it._key !== \"string\")) form.setAt(path, ensureKeys(list));\n }, [list, readOnly]); // eslint-disable-line react-hooks/exhaustive-deps\n return (\n <FieldShell field={field} path={path} id={id} value={list} onChange={(v) => form.setAt(path, v)} readOnly={readOnly} issue={form.visibleIssue(key)} meta={<span className=\"text-kit-xs text-kit-fg-3\">{listMeta(list.length, field)}</span>}>\n <div className=\"@container\">\n <ItemList field={field} path={path} list={list} readOnly={readOnly} adapter={adapter} inputId={id} />\n </div>\n </FieldShell>\n );\n}\n\nfunction InlineList({ field, item, path, list, readOnly }: { field: FieldSchema; item: FieldSchema; path: FieldPath; list: unknown[]; readOnly: boolean }) {\n const form = useForm()!;\n const Control = CONTROLS[item.type] ?? FallbackControl;\n const max = field.validation?.max;\n const ids = list.map((_, i) => `p${i}`);\n const sort = useDragReorder(ids, (from, to) => form.setAt(path, arrayMove(list, from, to)), { disabled: readOnly || !!field.orderLocked });\n // The same remove the preview rows have: an Undo toast that puts the row back at its index (D-10a issue 10).\n const ops = useListOps(field, path, list, (next) => form.setAt(path, next));\n const rowControl = (v: unknown, i: number) => (\n <Control field={{ ...item, title: `${item.title} ${i + 1}` }} value={v} onChange={(n) => form.setAt([...path, i], n)} id={`${pathKey(path)}-${i}`} path={[...path, i]} readOnly={readOnly} />\n );\n return (\n <div className=\"flex flex-col gap-1.5\">\n {list.map((v, i) => (\n <InlineRow key={ids[i]} id={ids[i]} labelId={`${pathKey(path)}-${i}-label`} sort={sort} readOnly={readOnly} orderLocked={!!field.orderLocked} onRemove={() => ops.remove(i, `${item.title} ${i + 1}`)}>\n {/* V2 draws no label on a row, so the row's name is an sr-only span (no <label> element) at the id a FieldShell's\n label has (`${id}-label`): aria-labelledby controls (rich text) and the row group read it, and the kit\n Input/Textarea/Select/Switch/Checkbox whose id is the row's take it through FieldLabelForContext (<label for>\n semantics without the element) */}\n <span id={`${pathKey(path)}-${i}-label`} className=\"sr-only\">{`${item.title} ${i + 1}`}</span>\n <FieldLabelForContext.Provider value={{ htmlFor: `${pathKey(path)}-${i}`, labelId: `${pathKey(path)}-${i}-label` }}>\n {rowControl(v, i)}\n </FieldLabelForContext.Provider>\n </InlineRow>\n ))}\n {sort.a11y}\n {readOnly ? null : (\n <Button size=\"sm\" variant=\"ghost\" className=\"self-start text-kit-fg-2\" leftIcon={<IconPlus stroke={1.5} />} disabled={max != null && list.length >= max} onClick={() => form.setAt(path, [...list, initialFor(item)])}>\n Add {itemNoun(field)}\n </Button>\n )}\n </div>\n );\n}\nfunction InlineRow({ id, labelId, sort, children, onRemove, readOnly, orderLocked }: { id: string; labelId: string; sort: ReturnType<typeof useDragReorder>; children: React.ReactNode; onRemove: () => void; readOnly: boolean; orderLocked?: boolean }) {\n return (\n <div ref={sort.register(id)} style={sort.style(id)} className={cn(\"group/il flex items-start gap-1\", sort.active === id && \"relative z-10\")}>\n {readOnly ? null : orderLocked ? (\n <OrderLockSlot className=\"mt-1.5\" />\n ) : (\n <button type=\"button\" aria-label=\"Drag to reorder\" {...sort.handle(id)} className=\"mt-1.5 flex h-5 w-4 shrink-0 cursor-grab touch-none items-center justify-center text-kit-fg-4 hover:text-kit-fg-2 active:cursor-grabbing\">\n <IconGripVertical className=\"size-3.5\" stroke={1.5} />\n </button>\n )}\n <div role=\"group\" aria-labelledby={labelId} className=\"min-w-0 flex-1\">{children}</div>\n {readOnly ? null : (\n <Tooltip content=\"Remove\">\n <button type=\"button\" aria-label=\"Remove\" onClick={onRemove} className=\"mt-1 flex size-6 shrink-0 items-center justify-center rounded-kit-md text-kit-fg-3 opacity-0 transition-opacity hover:bg-kit-hover hover:text-kit-fg focus-visible:opacity-100 group-hover/il:opacity-100\">\n <IconX className=\"size-3.5\" stroke={1.5} />\n </button>\n </Tooltip>\n )}\n </div>\n );\n}\n\n/* ── Object arrays: preview rows ───────────────────────────────────── */\nexport interface RowModel {\n id: string;\n index: number;\n item: unknown;\n preview: Preview;\n path: FieldPath;\n chip?: string;\n extra?: string;\n /** an included-style switch that is OFF: the title reads muted */\n dim?: boolean;\n}\n\nfunction ObjectArray({ field, path }: { field: FieldSchema; path: FieldPath }) {\n const form = useForm()!;\n const host = React.useContext(RowsHostContext);\n const drill = useDrill();\n const id = React.useId();\n const { readOnly } = useFieldAccess(field);\n const key = pathKey(path);\n const value = form.getAt(path);\n const list = Array.isArray(value) ? value : [];\n const of = itemSchemas(field);\n const mode = itemOpenMode(field);\n const rows: RowModel[] = list.map((it, i) => {\n const s = itemSchemaFor(field, it);\n const tf = rowToggleField(s);\n return {\n id: itemId(it, i), index: i, item: it, preview: previewOf(s, it, i, s?.title ?? itemNoun(field)), path: [...path, i], chip: of.length > 1 ? s?.title : undefined,\n dim: tf ? isObj(it) && it[tf.name] === false : undefined,\n };\n });\n const write = (next: unknown[]) => form.setAt(path, ensureKeys(next));\n const ops = useListOps(field, path, list, write, (i) => (mode === \"drill\" ? drill?.([...path, i]) : undefined));\n const [openId, setOpenId] = React.useState<string | null>(null);\n const dialogNav = React.useRef<{ back: () => boolean }>(null);\n const Nested = host.NestedForm;\n return (\n <FieldShell field={field} path={path} id={id} value={list} onChange={(v) => form.setAt(path, v)} readOnly={readOnly} issue={form.visibleIssue(key)} meta={<span className=\"text-kit-xs text-kit-fg-3\">{listMeta(list.length, field)}</span>}>\n <RowList\n field={field}\n rows={rows}\n readOnly={readOnly}\n layout={field.arrayLayout ?? \"list\"}\n mode={mode}\n openId={openId}\n onOpen={\n mode === \"drill\"\n ? drill && ((r) => drill(r.path))\n : (r) => setOpenId(openId === r.id ? null : r.id)\n }\n onCloseInline={() => setOpenId(null)}\n ops={ops}\n dialogNav={dialogNav}\n rowToggle={(r) => {\n const tf = rowToggleField(itemSchemaFor(field, r.item));\n if (!tf) return null;\n const on = isObj(r.item) && r.item[tf.name] !== false;\n return <RowCheck on={on} label={tf.title} title={r.preview.title} readOnly={readOnly} onToggle={() => form.setAt([...r.path, tf.name], !on)} />;\n }}\n renderInline={(r) => {\n const s = itemSchemaFor(field, r.item);\n // dialogs get their own navigation stack (nested lists drill inside the dialog)\n if (mode === \"dialog\" && Nested) return <Nested fields={s?.fields ?? []} title={r.preview.title} icon={s?.icon} path={r.path} navRef={dialogNav} />;\n // the row's own check IS the included switch — don't repeat it in the card\n const tf = rowToggleField(s);\n return <FieldList fields={(s?.fields ?? []).filter((f) => f !== tf)} basePath={r.path} memoryKey={`inl:${pathKey(r.path)}`} />;\n }}\n emptyLabel={`No ${plural(itemNoun(field))} yet.`}\n addButton={<AddItemButton field={field} disabled={readOnly || (field.validation?.max != null && list.length >= field.validation.max)} onAdd={ops.add} />}\n />\n </FieldShell>\n );\n}\n\n/** Shared list operations (arrays and slots). Remove shows an Undo toast; add can drill into the new item. */\nexport function useListOps(field: FieldSchema, _path: FieldPath, list: unknown[], write: (next: unknown[]) => void, afterAdd?: (index: number) => void) {\n const { toast } = useKitServices();\n const { min, max } = field.validation ?? {};\n const atMax = max != null && list.length >= max;\n const atMin = min != null && list.length <= min;\n const limit = () => toast?.(\"Limit reached\", { description: `${field.title} allows ${max} at most.` });\n return {\n atMax,\n atMin,\n add: (item: unknown, at = list.length) => {\n if (atMax) return limit();\n const next = [...list.slice(0, at), item, ...list.slice(at)];\n write(next);\n window.setTimeout(() => afterAdd?.(at), 0);\n },\n duplicate: (i: number) => {\n if (atMax) return limit();\n const copy = isObj(list[i]) ? { ...(structuredClone(list[i]) as object), _key: newKey() } : list[i];\n write([...list.slice(0, i + 1), copy, ...list.slice(i + 1)]);\n },\n move: (i: number, d: -1 | 1) => write(arrayMove(list, i, i + d)),\n reorder: (from: number, to: number) => write(arrayMove(list, from, to)),\n remove: (i: number, title: string) => {\n if (atMin) return toast?.(`At least ${min} required`, { description: `${field.title} needs ${min} or more.` });\n const prev = list;\n write(list.filter((_, j) => j !== i));\n toast?.(`“${title}” removed`, { action: { label: \"Undo\", onClick: () => write(prev) }, duration: 10_000 });\n },\n insertBlank: (at: number) => {\n const s = itemSchemas(field)[0];\n if (!s || atMax) return;\n const next = [...list.slice(0, at), newItem(field, s), ...list.slice(at)];\n write(next);\n },\n };\n}\nexport type ListOps = ReturnType<typeof useListOps>;\n\nfunction AddItemButton({ field, onAdd, disabled }: { field: FieldSchema; onAdd: (item: unknown) => void; disabled?: boolean }) {\n const of = itemSchemas(field);\n const noun = itemNoun(field);\n if (of.length <= 1)\n return (\n <Button size=\"sm\" variant=\"ghost\" className=\"text-kit-fg-2\" leftIcon={<IconPlus stroke={1.5} />} disabled={disabled} onClick={() => of[0] && onAdd(newItem(field, of[0]))}>\n Add {noun}\n </Button>\n );\n return (\n <Menu>\n <MenuTrigger render={<Button size=\"sm\" variant=\"ghost\" className=\"text-kit-fg-2\" leftIcon={<IconPlus stroke={1.5} />} disabled={disabled} />}>Add {noun}</MenuTrigger>\n <MenuContent align=\"start\" className=\"w-64\">\n <MenuLabel>Add to {field.title.toLowerCase()}</MenuLabel>\n {of.map((s) => (\n <MenuItem key={s.name} icon={<KitIcon name={s.icon} />} onClick={() => onAdd(newItem(field, s))} className=\"h-auto py-1.5\">\n <span className=\"flex flex-col\">\n <span>{s.title}</span>\n {s.description ? <span className=\"whitespace-normal text-kit-xs text-kit-fg-3\">{s.description}</span> : null}\n </span>\n </MenuItem>\n ))}\n </MenuContent>\n </Menu>\n );\n}\n\n/** The row list used by arrays AND slots. Without `onOpen` the rows are inert (a drill nothing can draw yet). */\nexport function RowList({\n field,\n rows,\n readOnly,\n layout,\n mode,\n openId,\n onOpen,\n onCloseInline,\n ops,\n renderInline,\n emptyLabel,\n addButton,\n leading,\n rowToggle,\n dialogNav,\n menuExtra,\n}: {\n dialogNav?: React.RefObject<{ back: () => boolean } | null>;\n field: FieldSchema;\n rows: RowModel[];\n readOnly: boolean;\n layout: \"list\" | \"grid\";\n mode: ReturnType<typeof itemOpenMode>;\n openId: string | null;\n onOpen?: (r: RowModel) => void;\n onCloseInline: () => void;\n ops: ListOps;\n renderInline: (r: RowModel) => React.ReactNode;\n emptyLabel: string;\n addButton: React.ReactNode;\n leading?: (r: RowModel) => React.ReactNode;\n /** a control BEFORE the title button (never inside it): the included check of feature rows */\n rowToggle?: (r: RowModel) => React.ReactNode;\n /** extra items in a row's ⋯ menu, above Remove (a table row's \"Move to group\") */\n menuExtra?: (r: RowModel) => React.ReactNode;\n}) {\n const sort = useDragReorder(rows.map((r) => r.id), ops.reorder, { axis: layout === \"grid\" ? \"grid\" : \"y\", disabled: readOnly || !!field.orderLocked, distance: 5 });\n const openRow = rows.find((r) => r.id === openId);\n if (rows.length === 0)\n return (\n <div className=\"flex flex-col items-center gap-2 rounded-kit-lg border border-dashed border-kit-line-strong px-4 py-5 text-center\">\n <span className=\"text-kit-sm text-kit-fg-3\">{emptyLabel}</span>\n {readOnly ? null : addButton}\n </div>\n );\n return (\n <div className=\"flex flex-col gap-1.5\">\n <div className={cn(layout === \"grid\" ? \"grid grid-cols-2 gap-1.5 @[520px]:grid-cols-3\" : \"overflow-hidden rounded-kit-lg border border-kit-line bg-kit-surface\")}>\n <AnimatePresence initial={false}>\n {rows.map((r) => (\n <Row\n key={r.id}\n r={r}\n count={rows.length}\n field={field}\n readOnly={readOnly}\n grid={layout === \"grid\"}\n mode={mode}\n open={openId === r.id}\n onOpen={onOpen ? () => onOpen(r) : undefined}\n ops={ops}\n sort={sort}\n leading={leading?.(r)}\n toggle={rowToggle?.(r)}\n extra={menuExtra?.(r)}\n inline={mode === \"inline\" && openId === r.id ? renderInline(r) : null}\n popover={mode === \"popover\" && openId === r.id ? renderInline(r) : null}\n onClosePopover={onCloseInline}\n />\n ))}\n </AnimatePresence>\n </div>\n {sort.a11y}\n {readOnly ? null : <div className=\"flex items-center\">{addButton}</div>}\n {mode === \"dialog\" && openRow ? (\n <Modal\n open\n onOpenChange={(o, d) => {\n if (o) return;\n // Escape steps back inside the dialog's own frames first\n if (d.reason === \"escape-key\" && dialogNav?.current?.back()) return d.cancel();\n onCloseInline();\n }}\n >\n <ModalContent size=\"lg\">\n <ModalHeader title={openRow.preview.title} description={`${field.title} · ${openRow.index + 1} of ${rows.length}`} icon={<KitIcon name={openRow.preview.icon ?? field.icon} />} />\n <ModalBody className=\"flex min-h-[320px] flex-col gap-5\">{renderInline(openRow)}</ModalBody>\n <ModalFooter>\n <span className=\"mr-auto text-kit-xs text-kit-fg-3\">Changes save as you type</span>\n <Button variant=\"primary\" onClick={onCloseInline}>Done</Button>\n </ModalFooter>\n </ModalContent>\n </Modal>\n ) : null}\n </div>\n );\n}\n\nfunction Row({\n r, count, field, readOnly, grid, mode, open, onOpen, ops, sort, leading, toggle, extra, inline, popover, onClosePopover,\n}: {\n r: RowModel; count: number; field: FieldSchema; readOnly: boolean; grid: boolean; mode: string; open: boolean; onOpen?: () => void; ops: ListOps;\n sort: ReturnType<typeof useDragReorder>; leading?: React.ReactNode; toggle?: React.ReactNode; extra?: React.ReactNode; inline: React.ReactNode; popover: React.ReactNode; onClosePopover: () => void;\n}) {\n const form = useForm(); // null when a RowList is used outside a kit form (a table in a design-system demo)\n const env = useKitEnv();\n /* V2 used `${r.id}-body`; ids without a _key fall back to i0, i1… and sample data reuses _keys across lists, so two\n arrays could share an id and aria-controls would point at the wrong body. The useId prefix keeps it unique. */\n const uid = React.useId();\n const isDragging = sort.active === r.id;\n // while anything is being dragged, rows move without the enter / exit height animation and without layout animation\n const dragging = sort.active != null;\n const roll = form?.rollup(r.path) ?? { errors: 0, warnings: 0 };\n const peers = Object.entries(env.presence).filter(([k]) => k === pathKey(r.path) || k.startsWith(`${pathKey(r.path)}.`)).flatMap(([, p]) => p);\n /* D61 Review changes: a changed item gets the author-colour bar on its row edge and \"2 changed\" in its summary */\n const nChanged = env.review?.count(r.path) ?? 0;\n const changeBar = nChanged ? <span aria-hidden className=\"pointer-events-none absolute inset-y-1.5 left-0 z-[1] w-0.5 rounded-full\" style={{ background: env.review!.color(r.path) ?? \"var(--kit-warning)\" }} /> : null;\n const changedNote = nChanged ? `${nChanged} changed` : \"\";\n const menu = readOnly ? null : (\n <Menu>\n <MenuTrigger\n aria-label={`${r.preview.title} actions`}\n onClick={(e) => e.stopPropagation()}\n className=\"flex size-7 shrink-0 items-center justify-center rounded-kit-md text-kit-fg-3 hover:bg-kit-hover hover:text-kit-fg data-[popup-open]:bg-kit-hover data-[popup-open]:text-kit-fg\"\n >\n <IconDots className=\"size-4\" stroke={1.5} />\n </MenuTrigger>\n <MenuContent align=\"end\" className=\"w-52\">\n <MenuItem icon={<IconArrowUp stroke={1.5} />} disabled={!!field.orderLocked || r.index === 0} onClick={() => ops.move(r.index, -1)}>Move up</MenuItem>\n <MenuItem icon={<IconArrowDown stroke={1.5} />} disabled={!!field.orderLocked || r.index === count - 1} onClick={() => ops.move(r.index, 1)}>Move down</MenuItem>\n <MenuSeparator />\n <MenuItem icon={<IconCopy stroke={1.5} />} disabled={ops.atMax} onClick={() => ops.duplicate(r.index)}>{ops.atMax ? \"Duplicate · limit reached\" : \"Duplicate\"}</MenuItem>\n {field.type === \"array\" ? (\n <>\n <MenuItem icon={<IconRowInsertTop stroke={1.5} />} disabled={ops.atMax} onClick={() => ops.insertBlank(r.index)}>Add item above</MenuItem>\n <MenuItem icon={<IconRowInsertBottom stroke={1.5} />} disabled={ops.atMax} onClick={() => ops.insertBlank(r.index + 1)}>Add item below</MenuItem>\n </>\n ) : null}\n {extra ? (\n <>\n <MenuSeparator />\n {extra}\n </>\n ) : null}\n <MenuSeparator />\n <MenuItem danger icon={<IconTrash stroke={1.5} />} disabled={ops.atMin} onClick={() => ops.remove(r.index, r.preview.title)}>{ops.atMin ? `Remove · at least ${field.validation?.min} required` : \"Remove\"}</MenuItem>\n </MenuContent>\n </Menu>\n );\n const grip = readOnly ? null : field.orderLocked ? (\n <OrderLockSlot className=\"h-7 items-center\" />\n ) : (\n <button\n type=\"button\"\n aria-label={`Reorder ${r.preview.title}`}\n onClick={(e) => e.stopPropagation()}\n {...sort.handle(r.id)}\n className=\"relative flex h-7 w-4 shrink-0 cursor-grab touch-none items-center justify-center text-kit-fg-4 transition-colors before:absolute before:-inset-2 hover:text-kit-fg-2 active:cursor-grabbing\"\n >\n <IconGripVertical className=\"size-3.5\" stroke={1.5} />\n </button>\n );\n if (grid) {\n const tile = (\n <>\n <span className=\"flex aspect-[4/3] items-center justify-center bg-kit-muted\">\n {r.preview.media ? <img src={r.preview.media} alt=\"\" className=\"size-full object-cover\" /> : <KitIcon name={r.preview.icon ?? field.icon} className=\"size-5 text-kit-fg-3\" />}\n </span>\n <span className=\"block truncate px-2 pb-1.5 pt-1.5 text-kit-xs font-medium text-kit-fg\">{r.preview.title}</span>\n </>\n );\n return (\n <div ref={sort.register(r.id)} style={sort.style(r.id)} className={cn(\"relative\", isDragging && \"z-10\")}>\n <motion.div\n layout={!isDragging ? \"position\" : false}\n initial={{ opacity: 0, scale: 0.97 }}\n animate={{ opacity: 1, scale: 1 }}\n exit={{ opacity: 0, scale: 0.97 }}\n className={cn(\"group/row relative overflow-hidden rounded-kit-lg border border-kit-line bg-kit-surface transition-colors hover:border-kit-line-strong\", isDragging && \"shadow-kit-lg\")}\n >\n {onOpen ? (\n <button type=\"button\" onClick={onOpen} aria-label={`Open ${r.preview.title}, ${r.index + 1} of ${count}`} aria-haspopup={mode === \"popover\" || mode === \"dialog\" ? \"dialog\" : undefined} className=\"block w-full text-left\">\n {tile}\n </button>\n ) : (\n <div className=\"block w-full text-left\">{tile}</div>\n )}\n <div className=\"absolute right-1 top-1 flex items-center gap-0.5 rounded-kit-md bg-kit-surface/90 opacity-0 shadow-kit-xs transition-opacity group-hover/row:opacity-100 [@media(pointer:coarse)]:opacity-100\">\n {grip}\n {menu}\n </div>\n <IssueDot errors={roll.errors} warnings={roll.warnings} className=\"absolute left-2 top-2 ring-2 ring-kit-surface\" />\n {changeBar}\n </motion.div>\n </div>\n );\n }\n /* CPO D43 — a row says what opening it does: › drills into a new frame, ⌄ expands in place (rotates when open),\n ⧉ opens a popover or dialog. The WHOLE row is the hit area (hover tint); the title button carries focus,\n Enter / Space and the label (\"Open Starter\" / \"Expand Net-60 terms\"). */\n const inlineMode = mode === \"inline\";\n const bodyId = `${uid}${r.id}-body`;\n const verb = inlineMode ? (open ? \"Collapse\" : \"Expand\") : \"Open\";\n const trailing = !onOpen ? null : inlineMode ? (\n <IconChevronDown aria-hidden className={cn(\"size-4 shrink-0 text-kit-fg-3 transition-transform duration-200\", open && \"rotate-180 text-kit-fg-2\")} stroke={1.5} />\n ) : mode === \"drill\" ? (\n <IconChevronRight aria-hidden className=\"size-4 shrink-0 text-kit-fg-3 transition-transform duration-150 group-hover/row:translate-x-0.5\" stroke={1.5} />\n ) : (\n <IconArrowsDiagonal aria-hidden className=\"size-3.5 shrink-0 text-kit-fg-3\" stroke={1.5} />\n );\n const titleInner = (\n <>\n {leading ?? (toggle && !r.preview.media ? null : <Thumb media={r.preview.media} icon={r.preview.icon ?? field.icon} />)}\n <span className=\"min-w-0 flex-1\">\n <span className={cn(\"flex items-center gap-1.5 truncate text-kit-sm\", r.preview.empty || r.dim ? \"text-kit-fg-3\" : \"text-kit-fg\", open && \"font-medium\")}>\n <span className=\"truncate\">{r.preview.title}</span>\n {r.chip ? <span className=\"shrink-0 rounded-kit-md bg-kit-muted px-1 text-kit-2xs font-medium text-kit-fg-2\">{r.chip}</span> : null}\n </span>\n {/* the title already says what the item is; no \"Item 2 of 4\" filler (the position is in the aria label) */}\n {(r.extra ?? r.preview.subtitle) || changedNote ? (\n <span className=\"block truncate text-kit-xs text-kit-fg-3\">\n {changedNote ? <span className=\"text-kit-fg-2\">{changedNote}{r.extra ?? r.preview.subtitle ? \" · \" : \"\"}</span> : null}\n {r.extra ?? r.preview.subtitle}\n </span>\n ) : null}\n </span>\n </>\n );\n const rowInner = (\n <div\n onClick={(e) => {\n // anywhere on the row opens it, except its own controls (grip, ⋯, presence). The ⋯ menu renders in a portal but\n // React still bubbles its clicks here, so a click whose target is outside the row's own DOM (any menu item:\n // menuitem, menuitemradio, menuitemcheckbox, a submenu) never opens the row.\n const target = e.target as HTMLElement;\n if (!onOpen || !e.currentTarget.contains(target) || target.closest(\"button,[role^=menuitem],a,input\")) return;\n onOpen();\n }}\n className={cn(onOpen ? \"group/row flex min-h-12 cursor-pointer items-center gap-2 py-1.5 pl-1.5 pr-2 transition-colors\" : \"group/row flex min-h-12 items-center gap-2 py-1.5 pl-1.5 pr-2 transition-colors\", open ? \"bg-kit-subtle\" : onOpen && \"hover:bg-kit-subtle\")}\n >\n {grip}\n {toggle}\n {onOpen ? (\n <button\n type=\"button\"\n onClick={onOpen}\n data-row-open={r.id}\n aria-expanded={mode === \"drill\" ? undefined : open}\n aria-controls={inlineMode && open ? bodyId : undefined}\n aria-haspopup={mode === \"popover\" || mode === \"dialog\" ? \"dialog\" : undefined}\n aria-label={`${verb} ${r.preview.title}${r.chip ? `, ${r.chip}` : \"\"}${changedNote ? `, ${changedNote}` : \"\"}, ${r.index + 1} of ${count}`}\n className=\"flex min-w-0 flex-1 items-center gap-2.5 rounded-kit-md text-left outline-none\"\n >\n {titleInner}\n </button>\n ) : (\n <div data-row-open={r.id} className=\"flex min-w-0 flex-1 items-center gap-2.5 text-left\">\n {titleInner}\n </div>\n )}\n <IssueDot errors={roll.errors} warnings={roll.warnings} />\n {peers.length ? <PeerStack peers={peers} size={16} /> : null}\n {menu}\n {trailing}\n </div>\n );\n return (\n <div\n ref={sort.register(r.id)}\n style={sort.style(r.id)}\n data-row-id={r.id}\n className={cn(\"relative border-b border-kit-line-subtle bg-kit-surface last:border-b-0\", isDragging && \"z-10 rounded-kit-lg shadow-kit-lg ring-1 ring-kit-line-strong\")}\n >\n {changeBar}\n <motion.div\n layout={!isDragging && !dragging ? \"position\" : false}\n initial={dragging ? false : { opacity: 0, height: 0 }}\n animate={{ opacity: 1, height: \"auto\" }}\n exit={dragging ? { opacity: 0, height: 0, transition: { duration: 0 } } : { opacity: 0, height: 0 }}\n transition={{ duration: 0.2, ease: [0.22, 1, 0.36, 1] }}\n className=\"overflow-hidden\"\n >\n {mode === \"popover\" ? (\n <Popover open={open} onOpenChange={(o) => !o && onClosePopover()}>\n <PopoverAnchor render={rowInner} />\n <PopoverContent className=\"w-[340px] p-4\" align=\"end\" side=\"left\" sideOffset={10}>\n {popover}\n </PopoverContent>\n </Popover>\n ) : (\n rowInner\n )}\n {inlineMode ? (\n <AnimatePresence initial={false}>\n {open ? (\n <motion.div initial={{ height: 0, opacity: 0 }} animate={{ height: \"auto\", opacity: 1 }} exit={{ height: 0, opacity: 0 }} transition={{ duration: 0.2, ease: [0.22, 1, 0.36, 1] }} className=\"overflow-hidden\">\n {/* D63: the row's fields sit behind the one inset line under its title; no tint, no card inside the row */}\n <div className=\"px-3 pb-3 pt-1\">\n <div id={bodyId} role=\"group\" aria-label={r.preview.title} data-group=\"inset\" className={INSET_LINE}><InsetScope>{inline}</InsetScope></div>\n </div>\n </motion.div>\n ) : null}\n </AnimatePresence>\n ) : null}\n </motion.div>\n </div>\n );\n}\n\n/** The included / not-included check on a feature row (D47): a real checkbox, outside the row's open button. */\nfunction RowCheck({ on, label, title, readOnly, onToggle }: { on: boolean; label: string; title: string; readOnly: boolean; onToggle: () => void }) {\n return (\n <Tooltip content={on ? label : `Not ${label.toLowerCase()}`}>\n <button\n type=\"button\"\n role=\"checkbox\"\n aria-checked={on}\n aria-label={`${label}: ${title}`}\n disabled={readOnly}\n onClick={(e) => {\n e.stopPropagation();\n onToggle();\n }}\n className=\"group/chk flex size-7 shrink-0 items-center justify-center rounded-kit-md transition-colors hover:bg-kit-hover disabled:pointer-events-none\"\n >\n <span\n className={cn(\n \"flex size-[18px] items-center justify-center rounded-full transition-colors\",\n on ? \"bg-kit-control-checked text-kit-fg-inverse\" : \"border border-dashed border-kit-field-border-hover text-kit-fg-3 group-hover/chk:border-[var(--kit-emphasis-line)]\",\n )}\n >\n {on ? <IconCheck className=\"size-3\" stroke={2.5} /> : <IconMinus className=\"size-3\" stroke={2} />}\n </span>\n </button>\n </Tooltip>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,IAAa,kBAAkB,MAAM,cAAwB,CAAC,CAAC;;AAE/D,SAAgB,WAAoD;CAClE,MAAM,OAAO,MAAM,WAAW,eAAe;CAC7C,MAAM,OAAO,QAAQ;CACrB,OAAO,KAAK,UAAU,MAAM,cAAc,KAAK,WAAW,KAAA;AAC5D;;AAGA,IAAa,iBAAsG,CAAC;AAEpH,IAAM,UAAU,SAAkB,KAAK,SAAS,GAAG,KAAK,CAAC,YAAY,KAAK,IAAI,IAAI,GAAG,KAAK,MAAM,GAAG,EAAE,EAAE,OAAO,KAAK,SAAS,GAAG,IAAI,OAAO,GAAG,KAAK;AAElJ,SAAgB,WAAW,EAAE,OAAO,QAAmF;CACrH,MAAM,OAAO,cAAc,KAAK;CAChC,IAAI,MAAM,OAAO,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U,MAAM;IACd,EAAE,gBAAgB;IAClB,SAAS;GACX;GACA,WAAU;GAEV,UAAA,oBAAC,QAAD;IACE,WAAW,GACT,+EACA,KAAK,+CAA+C,oHACtD;IAEC,UAAA,KAAK,oBAAC,WAAD;KAAW,WAAU;KAAS,QAAQ;IAAM,CAAA,IAAI,oBAAC,WAAD;KAAW,WAAU;KAAS,QAAQ;IAAI,CAAA;GAC5F,CAAA;EACA,CAAA;CACD,CAAA;AAEb"}
1
+ {"version":3,"file":"array.js","names":[],"sources":["../../src/engine/array.tsx"],"sourcesContent":["/**\n * ARRAYS — compact PREVIEW ROWS that rest closed (CPO D8 + production; V2 HEAD 9829bf1 kit/engine/array.tsx): grip ·\n * thumb · title + subtitle · validation dot · presence · always-visible ⋯ (Move up/down, Duplicate, Add above/below,\n * Remove). Opening a row follows ONE rule (CPO D43): ≤3 simple fields expand inline, else it drills in (`openMode`\n * overrides). Reorder by drag with layout animation; delete with an Undo toast; \"Add {noun}\" (a type menu when several\n * item types); min/max honoured.\n * Arrays of primitives render as a gallery (images), reference chips, or — for text, numbers and URLs — the ITEM LIST\n * (CPO D47): one input per row, no drill. Arrays of one-field objects (`[{ text }]`) use the same item list. Small\n * objects with an `included` / `isIncluded` switch get that switch as a check on the row itself.\n *\n * Host wiring (RowsHostContext): a drill row calls `drill(path)` (the frame push); without one it falls back to\n * `form.navigate` while the form draws frames (`form.canNavigate`), else drill rows are inert (no button, no ›).\n * Dialog items render the host's `NestedForm` (V2 kit-field NestedForm: its own navigation stack); without one the\n * dialog shows the item's FieldList.\n *\n * Kit deviations from V2: sorting is `useDragReorder` (no @dnd-kit in the kit; it keeps dnd-kit's pointer and keyboard\n * sensor semantics: Space / Enter picks up, arrows move, Space / Enter drops as one write, Escape cancels; the table editor's cross-list drag via\n * `sortableId` is not ported); toasts come from KitServices (absent → silent); the gallery and reference-chip controls come from\n * ARRAY_CONTROLS (registered by the controls lane); a host that never registered them edits the raw list (FallbackControl).\n */\nimport * as React from \"react\";\nimport type { ComponentType } from \"react\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport {\n IconArrowDown, IconArrowUp, IconArrowsDiagonal, IconCheck, IconChevronDown, IconChevronRight, IconCopy, IconDots, IconGripVertical, IconMinus, IconPlus, IconRowInsertBottom, IconRowInsertTop, IconTrash, IconX,\n} from \"@tabler/icons-react\";\nimport { Button } from \"../ui/button\";\nimport { Menu, MenuContent, MenuItem, MenuLabel, MenuSeparator, MenuTrigger, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, Popover, PopoverAnchor, PopoverContent, Tooltip } from \"../ui/overlay\";\nimport { cn } from \"../lib/cn\";\nimport type { FieldPath, FieldSchema } from \"../schema/types\";\nimport type { ControlProps } from \"../types\";\nimport { useForm, useKitEnv, useKitServices } from \"../context\";\nimport { ensureKeys, isObj, itemId, newKey, pathKey } from \"../lib/path\";\nimport { initialFor, itemNoun, itemOpenMode, itemSchemaFor, itemSchemas, newItem, previewOf, primitiveItem, type Preview } from \"../lib/schema\";\nimport { IssueDot, Thumb } from \"./bits\";\nimport { KitIcon } from \"../lib/icons\";\nimport { FieldShell, PeerStack } from \"./field-shell\";\nimport { FieldLabelForContext } from \"../ui/field-context\";\nimport { FieldList } from \"./field-list\";\nimport { INSET_LINE, InsetScope } from \"./grouping\";\nimport { arrayMove, ItemList, OrderLockSlot, useDragReorder, type ItemKind, type ItemListAdapter } from \"./item-list\";\nimport { CONTROLS, FallbackControl, useFieldAccess } from \"./kit-field\";\n\n/* ── Host wiring ───────────────────────────────────────────────────── */\n/** V2 kit-field NestedForm's props: a dialog's own SchemaForm over `fields`, writing into the parent form at `path`. */\nexport interface NestedFormProps {\n fields: FieldSchema[];\n title: string;\n icon?: string;\n path: FieldPath;\n navRef?: React.Ref<{ back: () => boolean }>;\n}\nexport interface RowsHost {\n /** Push a frame for an item / block path (F7b frames). Default: `form.navigate` while `form.canNavigate`. */\n drill?: (path: FieldPath) => void;\n /** Dialog-mode items: V2's NestedForm (own navigation stack). Default: the item's FieldList. */\n NestedForm?: ComponentType<NestedFormProps>;\n}\nexport const RowsHostContext = React.createContext<RowsHost>({});\n/** The frame push for a drill row, or undefined when nothing can draw the frame (the row is then inert). */\nexport function useDrill(): ((path: FieldPath) => void) | undefined {\n const host = React.useContext(RowsHostContext);\n const form = useForm();\n return host.drill ?? (form?.canNavigate ? form.navigate : undefined);\n}\n\n/** Primitive-array controls V2 imports from controls/media (GalleryControl) and controls/reference (ReferencesControl). */\nexport const ARRAY_CONTROLS: { gallery?: ComponentType<ControlProps>; references?: ComponentType<ControlProps> } = {};\n\nconst plural = (noun: string) => (noun.endsWith(\"y\") && !/[aeiou]y$/.test(noun) ? `${noun.slice(0, -1)}ies` : noun.endsWith(\"s\") ? noun : `${noun}s`);\n\nexport function ArrayField({ field, path }: { field: FieldSchema; path: FieldPath; parent?: Record<string, unknown> }) {\n const prim = primitiveItem(field);\n if (prim) return <PrimitiveArray field={field} item={prim} path={path} />;\n const one = oneFieldItem(field);\n if (one) return <OneFieldArray field={field} item={one.item} inner={one.inner} path={path} />;\n return <ObjectArray field={field} path={path} />;\n}\n\n/** Item types that edit as one line in the item list. */\nconst LIST_KIND: Partial<Record<FieldSchema[\"type\"], ItemKind>> = { string: \"text\", text: \"text\", slug: \"text\", url: \"url\", email: \"email\", number: \"number\" };\n\n/** `[{ _key, text }]` — an object item with exactly one line-like field edits as the item list (unless the schema forces another open mode). */\nfunction oneFieldItem(field: FieldSchema): { item: FieldSchema; inner: FieldSchema } | undefined {\n if (field.openMode && field.openMode !== \"inline\") return undefined;\n const of = itemSchemas(field);\n const item = of.length === 1 ? of[0] : undefined;\n const inner = item?.type === \"object\" && item.fields?.length === 1 ? item.fields[0] : undefined;\n return item && inner && LIST_KIND[inner.type] && !inner.scale ? { item, inner } : undefined;\n}\n\n/** The boolean an item shows as a check on its row (\"included\" in a feature list). */\nconst ROW_TOGGLE = /^(is)?included$/i;\nexport const rowToggleField = (s?: FieldSchema) => s?.fields?.find((f) => f.type === \"boolean\" && ROW_TOGGLE.test(f.name));\n\n/** List meta on the message line: \"3 items · max 6\". */\nfunction listMeta(n: number, field: FieldSchema) {\n const { min, max } = field.validation ?? {};\n const base = `${n} ${n === 1 ? \"item\" : \"items\"}`;\n return max != null ? `${base} · max ${max}` : min != null ? `${base} · min ${min}` : n ? base : \"\";\n}\n\n/* ── Primitive arrays ──────────────────────────────────────────────── */\nfunction PrimitiveArray({ field, item, path }: { field: FieldSchema; item: FieldSchema; path: FieldPath }) {\n const form = useForm()!;\n const id = React.useId();\n const { readOnly } = useFieldAccess(field);\n const key = pathKey(path);\n const value = form.getAt(path);\n const list = Array.isArray(value) ? value : [];\n const onChange = (v: unknown) => form.setAt(path, v);\n const props = { field, value: list, onChange, id, readOnly, path, onBlur: () => form.touch(key) };\n const kind = LIST_KIND[item.type];\n const adapter = React.useMemo<ItemListAdapter | undefined>(\n () =>\n kind\n ? {\n kind,\n read: (v) => (v == null ? \"\" : String(v)),\n write: (v) => v,\n valuePath: (i) => [i],\n placeholder: item.placeholder ?? (item.title && !/^(item|value)$/i.test(item.title) ? item.title : undefined),\n }\n : undefined,\n [kind, item.placeholder, item.title],\n );\n const Gallery = ARRAY_CONTROLS.gallery;\n const References = ARRAY_CONTROLS.references;\n const control =\n item.type === \"image\" ? (Gallery ? <Gallery {...props} /> : <FallbackControl {...props} />) :\n item.type === \"reference\" ? (References ? <References {...props} field={{ ...field, reference: item.reference }} /> : <FallbackControl {...props} />) :\n adapter ? <ItemList field={field} path={path} list={list} readOnly={readOnly} adapter={adapter} inputId={id} /> :\n <InlineList field={field} item={item} path={path} list={list} readOnly={readOnly} />;\n return (\n <FieldShell field={field} path={path} id={id} value={list} onChange={onChange} readOnly={readOnly} issue={form.visibleIssue(key)} meta={item.type === \"reference\" ? undefined : <span className=\"text-kit-xs text-kit-fg-3\">{listMeta(list.length, field)}</span>}>\n <div className=\"@container\">{control}</div>\n </FieldShell>\n );\n}\n\n/* ── One-field object arrays: same item list, value lives at item[inner.name] ── */\nfunction OneFieldArray({ field, item, inner, path }: { field: FieldSchema; item: FieldSchema; inner: FieldSchema; path: FieldPath }) {\n const form = useForm()!;\n const id = React.useId();\n const { readOnly } = useFieldAccess(field);\n const key = pathKey(path);\n const value = form.getAt(path);\n const list = Array.isArray(value) ? value : [];\n const adapter = React.useMemo<ItemListAdapter>(\n () => ({\n kind: LIST_KIND[inner.type]!,\n read: (v) => {\n const x = isObj(v) ? v[inner.name] : undefined;\n return x == null ? \"\" : String(x);\n },\n write: (v, prev) => ({ ...(isObj(prev) ? prev : (newItem(field, item) as object)), [inner.name]: v }),\n keyOf: (v) => (isObj(v) && typeof v._key === \"string\" ? v._key : undefined),\n valuePath: (i) => [i, inner.name],\n placeholder: inner.placeholder ?? item.preview?.fallback?.replace(/^Untitled /i, \"\").replace(/^./, (c) => c.toUpperCase()),\n }),\n [field, item, inner],\n );\n // legacy rows without `_key` get one on first render so rows stay stable while typing and dragging\n React.useEffect(() => {\n if (!readOnly && list.some((it) => isObj(it) && typeof it._key !== \"string\")) form.setAt(path, ensureKeys(list));\n }, [list, readOnly]); // eslint-disable-line react-hooks/exhaustive-deps\n return (\n <FieldShell field={field} path={path} id={id} value={list} onChange={(v) => form.setAt(path, v)} readOnly={readOnly} issue={form.visibleIssue(key)} meta={<span className=\"text-kit-xs text-kit-fg-3\">{listMeta(list.length, field)}</span>}>\n <div className=\"@container\">\n <ItemList field={field} path={path} list={list} readOnly={readOnly} adapter={adapter} inputId={id} />\n </div>\n </FieldShell>\n );\n}\n\nfunction InlineList({ field, item, path, list, readOnly }: { field: FieldSchema; item: FieldSchema; path: FieldPath; list: unknown[]; readOnly: boolean }) {\n const form = useForm()!;\n const Control = CONTROLS[item.type] ?? FallbackControl;\n const max = field.validation?.max;\n const ids = list.map((_, i) => `p${i}`);\n const sort = useDragReorder(ids, (from, to) => form.setAt(path, arrayMove(list, from, to)), { disabled: readOnly || !!field.orderLocked });\n // The same remove the preview rows have: an Undo toast that puts the row back at its index (D-10a issue 10).\n const ops = useListOps(field, path, list, (next) => form.setAt(path, next));\n const rowControl = (v: unknown, i: number) => (\n <Control field={{ ...item, title: `${item.title} ${i + 1}` }} value={v} onChange={(n) => form.setAt([...path, i], n)} id={`${pathKey(path)}-${i}`} path={[...path, i]} readOnly={readOnly} />\n );\n return (\n <div className=\"flex flex-col gap-1.5\">\n {list.map((v, i) => (\n <InlineRow key={ids[i]} id={ids[i]} labelId={`${pathKey(path)}-${i}-label`} sort={sort} readOnly={readOnly} orderLocked={!!field.orderLocked} onRemove={() => ops.remove(i, `${item.title} ${i + 1}`)}>\n {/* V2 draws no label on a row, so the row's name is an sr-only span (no <label> element) at the id a FieldShell's\n label has (`${id}-label`): aria-labelledby controls (rich text) and the row group read it, and the kit\n Input/Textarea/Select/Switch/Checkbox whose id is the row's take it through FieldLabelForContext (<label for>\n semantics without the element) */}\n <span id={`${pathKey(path)}-${i}-label`} className=\"sr-only\">{`${item.title} ${i + 1}`}</span>\n <FieldLabelForContext.Provider value={{ htmlFor: `${pathKey(path)}-${i}`, labelId: `${pathKey(path)}-${i}-label` }}>\n {rowControl(v, i)}\n </FieldLabelForContext.Provider>\n </InlineRow>\n ))}\n {sort.a11y}\n {readOnly ? null : (\n <Button size=\"sm\" variant=\"ghost\" className=\"self-start text-kit-fg-2\" leftIcon={<IconPlus stroke={1.5} />} disabled={max != null && list.length >= max} onClick={() => form.setAt(path, [...list, initialFor(item)])}>\n Add {itemNoun(field)}\n </Button>\n )}\n </div>\n );\n}\nfunction InlineRow({ id, labelId, sort, children, onRemove, readOnly, orderLocked }: { id: string; labelId: string; sort: ReturnType<typeof useDragReorder>; children: React.ReactNode; onRemove: () => void; readOnly: boolean; orderLocked?: boolean }) {\n return (\n <div ref={sort.register(id)} style={sort.style(id)} className={cn(\"group/il flex items-start gap-1\", sort.active === id && \"relative z-10\")}>\n {readOnly ? null : orderLocked ? (\n <OrderLockSlot className=\"mt-1.5\" />\n ) : (\n <button type=\"button\" aria-label=\"Drag to reorder\" {...sort.handle(id)} className=\"mt-1.5 flex h-5 w-4 shrink-0 cursor-grab touch-none items-center justify-center text-kit-fg-4 hover:text-kit-fg-2 active:cursor-grabbing\">\n <IconGripVertical className=\"size-3.5\" stroke={1.5} />\n </button>\n )}\n <div role=\"group\" aria-labelledby={labelId} className=\"min-w-0 flex-1\">{children}</div>\n {readOnly ? null : (\n <Tooltip content=\"Remove\">\n <button type=\"button\" aria-label=\"Remove\" onClick={onRemove} className=\"mt-1 flex size-6 shrink-0 items-center justify-center rounded-kit-md text-kit-fg-3 opacity-0 transition-opacity hover:bg-kit-hover hover:text-kit-fg focus-visible:opacity-100 group-hover/il:opacity-100\">\n <IconX className=\"size-3.5\" stroke={1.5} />\n </button>\n </Tooltip>\n )}\n </div>\n );\n}\n\n/* ── Object arrays: preview rows ───────────────────────────────────── */\nexport interface RowModel {\n id: string;\n index: number;\n item: unknown;\n preview: Preview;\n path: FieldPath;\n chip?: string;\n extra?: string;\n /** an included-style switch that is OFF: the title reads muted */\n dim?: boolean;\n}\n\nfunction ObjectArray({ field, path }: { field: FieldSchema; path: FieldPath }) {\n const form = useForm()!;\n const host = React.useContext(RowsHostContext);\n const drill = useDrill();\n const id = React.useId();\n const { readOnly } = useFieldAccess(field);\n const key = pathKey(path);\n const value = form.getAt(path);\n const list = Array.isArray(value) ? value : [];\n const of = itemSchemas(field);\n const mode = itemOpenMode(field);\n const rows: RowModel[] = list.map((it, i) => {\n const s = itemSchemaFor(field, it);\n const tf = rowToggleField(s);\n return {\n id: itemId(it, i), index: i, item: it, preview: previewOf(s, it, i, s?.title ?? itemNoun(field)), path: [...path, i], chip: of.length > 1 ? s?.title : undefined,\n dim: tf ? isObj(it) && it[tf.name] === false : undefined,\n };\n });\n const write = (next: unknown[]) => form.setAt(path, ensureKeys(next));\n const ops = useListOps(field, path, list, write, (i) => (mode === \"drill\" ? drill?.([...path, i]) : undefined));\n const [openId, setOpenId] = React.useState<string | null>(null);\n const dialogNav = React.useRef<{ back: () => boolean }>(null);\n const Nested = host.NestedForm;\n return (\n <FieldShell field={field} path={path} id={id} value={list} onChange={(v) => form.setAt(path, v)} readOnly={readOnly} issue={form.visibleIssue(key)} meta={<span className=\"text-kit-xs text-kit-fg-3\">{listMeta(list.length, field)}</span>}>\n <RowList\n field={field}\n rows={rows}\n readOnly={readOnly}\n layout={field.arrayLayout ?? \"list\"}\n mode={mode}\n openId={openId}\n onOpen={\n mode === \"drill\"\n ? drill && ((r) => drill(r.path))\n : (r) => setOpenId(openId === r.id ? null : r.id)\n }\n onCloseInline={() => setOpenId(null)}\n ops={ops}\n dialogNav={dialogNav}\n rowToggle={(r) => {\n const tf = rowToggleField(itemSchemaFor(field, r.item));\n if (!tf) return null;\n const on = isObj(r.item) && r.item[tf.name] !== false;\n return <RowCheck on={on} label={tf.title} title={r.preview.title} readOnly={readOnly} onToggle={() => form.setAt([...r.path, tf.name], !on)} />;\n }}\n renderInline={(r) => {\n const s = itemSchemaFor(field, r.item);\n // dialogs get their own navigation stack (nested lists drill inside the dialog)\n if (mode === \"dialog\" && Nested) return <Nested fields={s?.fields ?? []} title={r.preview.title} icon={s?.icon} path={r.path} navRef={dialogNav} />;\n // the row's own check IS the included switch — don't repeat it in the card\n const tf = rowToggleField(s);\n return <FieldList fields={(s?.fields ?? []).filter((f) => f !== tf)} basePath={r.path} memoryKey={`inl:${pathKey(r.path)}`} />;\n }}\n emptyLabel={`No ${plural(itemNoun(field))} yet.`}\n addButton={<AddItemButton field={field} disabled={readOnly || (field.validation?.max != null && list.length >= field.validation.max)} onAdd={ops.add} />}\n />\n </FieldShell>\n );\n}\n\n/** Shared list operations (arrays and slots). Remove shows an Undo toast; add can drill into the new item. */\nexport function useListOps(field: FieldSchema, _path: FieldPath, list: unknown[], write: (next: unknown[]) => void, afterAdd?: (index: number) => void) {\n const { toast } = useKitServices();\n const { min, max } = field.validation ?? {};\n const atMax = max != null && list.length >= max;\n const atMin = min != null && list.length <= min;\n const limit = () => toast?.(\"Limit reached\", { description: `${field.title} allows ${max} at most.` });\n return {\n atMax,\n atMin,\n add: (item: unknown, at = list.length) => {\n if (atMax) return limit();\n const next = [...list.slice(0, at), item, ...list.slice(at)];\n write(next);\n window.setTimeout(() => afterAdd?.(at), 0);\n },\n duplicate: (i: number) => {\n if (atMax) return limit();\n const copy = isObj(list[i]) ? { ...(structuredClone(list[i]) as object), _key: newKey() } : list[i];\n write([...list.slice(0, i + 1), copy, ...list.slice(i + 1)]);\n },\n move: (i: number, d: -1 | 1) => write(arrayMove(list, i, i + d)),\n reorder: (from: number, to: number) => write(arrayMove(list, from, to)),\n remove: (i: number, title: string) => {\n if (atMin) return toast?.(`At least ${min} required`, { description: `${field.title} needs ${min} or more.` });\n const prev = list;\n write(list.filter((_, j) => j !== i));\n toast?.(`“${title}” removed`, { action: { label: \"Undo\", onClick: () => write(prev) }, duration: 10_000 });\n },\n insertBlank: (at: number) => {\n const s = itemSchemas(field)[0];\n if (!s || atMax) return;\n const next = [...list.slice(0, at), newItem(field, s), ...list.slice(at)];\n write(next);\n },\n };\n}\nexport type ListOps = ReturnType<typeof useListOps>;\n\nfunction AddItemButton({ field, onAdd, disabled }: { field: FieldSchema; onAdd: (item: unknown) => void; disabled?: boolean }) {\n const of = itemSchemas(field);\n const noun = itemNoun(field);\n if (of.length <= 1)\n return (\n <Button size=\"sm\" variant=\"ghost\" className=\"text-kit-fg-2\" leftIcon={<IconPlus stroke={1.5} />} disabled={disabled} onClick={() => of[0] && onAdd(newItem(field, of[0]))}>\n Add {noun}\n </Button>\n );\n return (\n <Menu>\n <MenuTrigger render={<Button size=\"sm\" variant=\"ghost\" className=\"text-kit-fg-2\" leftIcon={<IconPlus stroke={1.5} />} disabled={disabled} />}>Add {noun}</MenuTrigger>\n <MenuContent align=\"start\" className=\"w-64\">\n <MenuLabel>Add to {field.title.toLowerCase()}</MenuLabel>\n {of.map((s) => (\n <MenuItem key={s.name} icon={<KitIcon name={s.icon} />} onClick={() => onAdd(newItem(field, s))} className=\"h-auto py-1.5\">\n <span className=\"flex flex-col\">\n <span>{s.title}</span>\n {s.description ? <span className=\"whitespace-normal text-kit-xs text-kit-fg-3\">{s.description}</span> : null}\n </span>\n </MenuItem>\n ))}\n </MenuContent>\n </Menu>\n );\n}\n\n/** The row list used by arrays AND slots. Without `onOpen` the rows are inert (a drill nothing can draw yet). */\nexport function RowList({\n field,\n rows,\n readOnly,\n layout,\n mode,\n openId,\n onOpen,\n onCloseInline,\n ops,\n renderInline,\n emptyLabel,\n addButton,\n leading,\n rowToggle,\n dialogNav,\n menuExtra,\n}: {\n dialogNav?: React.RefObject<{ back: () => boolean } | null>;\n field: FieldSchema;\n rows: RowModel[];\n readOnly: boolean;\n layout: \"list\" | \"grid\";\n mode: ReturnType<typeof itemOpenMode>;\n openId: string | null;\n onOpen?: (r: RowModel) => void;\n onCloseInline: () => void;\n ops: ListOps;\n renderInline: (r: RowModel) => React.ReactNode;\n emptyLabel: string;\n addButton: React.ReactNode;\n leading?: (r: RowModel) => React.ReactNode;\n /** a control BEFORE the title button (never inside it): the included check of feature rows */\n rowToggle?: (r: RowModel) => React.ReactNode;\n /** extra items in a row's ⋯ menu, above Remove (a table row's \"Move to group\") */\n menuExtra?: (r: RowModel) => React.ReactNode;\n}) {\n const sort = useDragReorder(rows.map((r) => r.id), ops.reorder, { axis: layout === \"grid\" ? \"grid\" : \"y\", disabled: readOnly || !!field.orderLocked, distance: 5 });\n const openRow = rows.find((r) => r.id === openId);\n if (rows.length === 0)\n return (\n <div className=\"flex flex-col items-center gap-2 rounded-kit-lg border border-dashed border-kit-line-strong px-4 py-5 text-center\">\n <span className=\"text-kit-sm text-kit-fg-3\">{emptyLabel}</span>\n {readOnly ? null : addButton}\n </div>\n );\n return (\n <div className=\"flex flex-col gap-1.5\">\n <div className={cn(layout === \"grid\" ? \"grid grid-cols-2 gap-1.5 @[520px]:grid-cols-3\" : \"overflow-hidden rounded-kit-lg border border-kit-line bg-kit-surface\")}>\n <AnimatePresence initial={false}>\n {rows.map((r) => (\n <Row\n key={r.id}\n r={r}\n count={rows.length}\n field={field}\n readOnly={readOnly}\n grid={layout === \"grid\"}\n mode={mode}\n open={openId === r.id}\n onOpen={onOpen ? () => onOpen(r) : undefined}\n ops={ops}\n sort={sort}\n leading={leading?.(r)}\n toggle={rowToggle?.(r)}\n extra={menuExtra?.(r)}\n inline={mode === \"inline\" && openId === r.id ? renderInline(r) : null}\n popover={mode === \"popover\" && openId === r.id ? renderInline(r) : null}\n onClosePopover={onCloseInline}\n />\n ))}\n </AnimatePresence>\n </div>\n {sort.a11y}\n {readOnly ? null : <div className=\"flex items-center\">{addButton}</div>}\n {mode === \"dialog\" && openRow ? (\n <Modal\n open\n onOpenChange={(o, d) => {\n if (o) return;\n // Escape steps back inside the dialog's own frames first\n if (d.reason === \"escape-key\" && dialogNav?.current?.back()) return d.cancel();\n onCloseInline();\n }}\n >\n <ModalContent size=\"lg\">\n <ModalHeader title={openRow.preview.title} description={`${field.title} · ${openRow.index + 1} of ${rows.length}`} icon={<KitIcon name={openRow.preview.icon ?? field.icon} />} />\n <ModalBody className=\"flex min-h-[320px] flex-col gap-5\">{renderInline(openRow)}</ModalBody>\n <ModalFooter>\n <span className=\"mr-auto text-kit-xs text-kit-fg-3\">Changes save as you type</span>\n <Button variant=\"primary\" onClick={onCloseInline}>Done</Button>\n </ModalFooter>\n </ModalContent>\n </Modal>\n ) : null}\n </div>\n );\n}\n\nfunction Row({\n r, count, field, readOnly, grid, mode, open, onOpen, ops, sort, leading, toggle, extra, inline, popover, onClosePopover,\n}: {\n r: RowModel; count: number; field: FieldSchema; readOnly: boolean; grid: boolean; mode: string; open: boolean; onOpen?: () => void; ops: ListOps;\n sort: ReturnType<typeof useDragReorder>; leading?: React.ReactNode; toggle?: React.ReactNode; extra?: React.ReactNode; inline: React.ReactNode; popover: React.ReactNode; onClosePopover: () => void;\n}) {\n const form = useForm(); // null when a RowList is used outside a kit form (a table in a design-system demo)\n const env = useKitEnv();\n const { mediaSrc } = useKitServices();\n /* V2 used `${r.id}-body`; ids without a _key fall back to i0, i1… and sample data reuses _keys across lists, so two\n arrays could share an id and aria-controls would point at the wrong body. The useId prefix keeps it unique. */\n const uid = React.useId();\n const isDragging = sort.active === r.id;\n // while anything is being dragged, rows move without the enter / exit height animation and without layout animation\n const dragging = sort.active != null;\n const roll = form?.rollup(r.path) ?? { errors: 0, warnings: 0 };\n const peers = Object.entries(env.presence).filter(([k]) => k === pathKey(r.path) || k.startsWith(`${pathKey(r.path)}.`)).flatMap(([, p]) => p);\n /* D61 Review changes: a changed item gets the author-colour bar on its row edge and \"2 changed\" in its summary */\n const nChanged = env.review?.count(r.path) ?? 0;\n const changeBar = nChanged ? <span aria-hidden className=\"pointer-events-none absolute inset-y-1.5 left-0 z-[1] w-0.5 rounded-full\" style={{ background: env.review!.color(r.path) ?? \"var(--kit-warning)\" }} /> : null;\n const changedNote = nChanged ? `${nChanged} changed` : \"\";\n const menu = readOnly ? null : (\n <Menu>\n <MenuTrigger\n aria-label={`${r.preview.title} actions`}\n onClick={(e) => e.stopPropagation()}\n className=\"flex size-7 shrink-0 items-center justify-center rounded-kit-md text-kit-fg-3 hover:bg-kit-hover hover:text-kit-fg data-[popup-open]:bg-kit-hover data-[popup-open]:text-kit-fg\"\n >\n <IconDots className=\"size-4\" stroke={1.5} />\n </MenuTrigger>\n <MenuContent align=\"end\" className=\"w-52\">\n <MenuItem icon={<IconArrowUp stroke={1.5} />} disabled={!!field.orderLocked || r.index === 0} onClick={() => ops.move(r.index, -1)}>Move up</MenuItem>\n <MenuItem icon={<IconArrowDown stroke={1.5} />} disabled={!!field.orderLocked || r.index === count - 1} onClick={() => ops.move(r.index, 1)}>Move down</MenuItem>\n <MenuSeparator />\n <MenuItem icon={<IconCopy stroke={1.5} />} disabled={ops.atMax} onClick={() => ops.duplicate(r.index)}>{ops.atMax ? \"Duplicate · limit reached\" : \"Duplicate\"}</MenuItem>\n {field.type === \"array\" ? (\n <>\n <MenuItem icon={<IconRowInsertTop stroke={1.5} />} disabled={ops.atMax} onClick={() => ops.insertBlank(r.index)}>Add item above</MenuItem>\n <MenuItem icon={<IconRowInsertBottom stroke={1.5} />} disabled={ops.atMax} onClick={() => ops.insertBlank(r.index + 1)}>Add item below</MenuItem>\n </>\n ) : null}\n {extra ? (\n <>\n <MenuSeparator />\n {extra}\n </>\n ) : null}\n <MenuSeparator />\n <MenuItem danger icon={<IconTrash stroke={1.5} />} disabled={ops.atMin} onClick={() => ops.remove(r.index, r.preview.title)}>{ops.atMin ? `Remove · at least ${field.validation?.min} required` : \"Remove\"}</MenuItem>\n </MenuContent>\n </Menu>\n );\n const grip = readOnly ? null : field.orderLocked ? (\n <OrderLockSlot className=\"h-7 items-center\" />\n ) : (\n <button\n type=\"button\"\n aria-label={`Reorder ${r.preview.title}`}\n onClick={(e) => e.stopPropagation()}\n {...sort.handle(r.id)}\n className=\"relative flex h-7 w-4 shrink-0 cursor-grab touch-none items-center justify-center text-kit-fg-4 transition-colors before:absolute before:-inset-2 hover:text-kit-fg-2 active:cursor-grabbing\"\n >\n <IconGripVertical className=\"size-3.5\" stroke={1.5} />\n </button>\n );\n if (grid) {\n const tile = (\n <>\n <span className=\"flex aspect-[4/3] items-center justify-center bg-kit-muted\">\n {r.preview.media ? <img src={mediaSrc ? mediaSrc(r.preview.media) : r.preview.media} alt=\"\" className=\"size-full object-cover\" /> : <KitIcon name={r.preview.icon ?? field.icon} className=\"size-5 text-kit-fg-3\" />}\n </span>\n <span className=\"block truncate px-2 pb-1.5 pt-1.5 text-kit-xs font-medium text-kit-fg\">{r.preview.title}</span>\n </>\n );\n return (\n <div ref={sort.register(r.id)} style={sort.style(r.id)} className={cn(\"relative\", isDragging && \"z-10\")}>\n <motion.div\n layout={!isDragging ? \"position\" : false}\n initial={{ opacity: 0, scale: 0.97 }}\n animate={{ opacity: 1, scale: 1 }}\n exit={{ opacity: 0, scale: 0.97 }}\n className={cn(\"group/row relative overflow-hidden rounded-kit-lg border border-kit-line bg-kit-surface transition-colors hover:border-kit-line-strong\", isDragging && \"shadow-kit-lg\")}\n >\n {onOpen ? (\n <button type=\"button\" onClick={onOpen} aria-label={`Open ${r.preview.title}, ${r.index + 1} of ${count}`} aria-haspopup={mode === \"popover\" || mode === \"dialog\" ? \"dialog\" : undefined} className=\"block w-full text-left\">\n {tile}\n </button>\n ) : (\n <div className=\"block w-full text-left\">{tile}</div>\n )}\n <div className=\"absolute right-1 top-1 flex items-center gap-0.5 rounded-kit-md bg-kit-surface/90 opacity-0 shadow-kit-xs transition-opacity group-hover/row:opacity-100 [@media(pointer:coarse)]:opacity-100\">\n {grip}\n {menu}\n </div>\n <IssueDot errors={roll.errors} warnings={roll.warnings} className=\"absolute left-2 top-2 ring-2 ring-kit-surface\" />\n {changeBar}\n </motion.div>\n </div>\n );\n }\n /* CPO D43 — a row says what opening it does: › drills into a new frame, ⌄ expands in place (rotates when open),\n ⧉ opens a popover or dialog. The WHOLE row is the hit area (hover tint); the title button carries focus,\n Enter / Space and the label (\"Open Starter\" / \"Expand Net-60 terms\"). */\n const inlineMode = mode === \"inline\";\n const bodyId = `${uid}${r.id}-body`;\n const verb = inlineMode ? (open ? \"Collapse\" : \"Expand\") : \"Open\";\n const trailing = !onOpen ? null : inlineMode ? (\n <IconChevronDown aria-hidden className={cn(\"size-4 shrink-0 text-kit-fg-3 transition-transform duration-200\", open && \"rotate-180 text-kit-fg-2\")} stroke={1.5} />\n ) : mode === \"drill\" ? (\n <IconChevronRight aria-hidden className=\"size-4 shrink-0 text-kit-fg-3 transition-transform duration-150 group-hover/row:translate-x-0.5\" stroke={1.5} />\n ) : (\n <IconArrowsDiagonal aria-hidden className=\"size-3.5 shrink-0 text-kit-fg-3\" stroke={1.5} />\n );\n const titleInner = (\n <>\n {leading ?? (toggle && !r.preview.media ? null : <Thumb media={r.preview.media} icon={r.preview.icon ?? field.icon} />)}\n <span className=\"min-w-0 flex-1\">\n <span className={cn(\"flex items-center gap-1.5 truncate text-kit-sm\", r.preview.empty || r.dim ? \"text-kit-fg-3\" : \"text-kit-fg\", open && \"font-medium\")}>\n <span className=\"truncate\">{r.preview.title}</span>\n {r.chip ? <span className=\"shrink-0 rounded-kit-md bg-kit-muted px-1 text-kit-2xs font-medium text-kit-fg-2\">{r.chip}</span> : null}\n </span>\n {/* the title already says what the item is; no \"Item 2 of 4\" filler (the position is in the aria label) */}\n {(r.extra ?? r.preview.subtitle) || changedNote ? (\n <span className=\"block truncate text-kit-xs text-kit-fg-3\">\n {changedNote ? <span className=\"text-kit-fg-2\">{changedNote}{r.extra ?? r.preview.subtitle ? \" · \" : \"\"}</span> : null}\n {r.extra ?? r.preview.subtitle}\n </span>\n ) : null}\n </span>\n </>\n );\n const rowInner = (\n <div\n onClick={(e) => {\n // anywhere on the row opens it, except its own controls (grip, ⋯, presence). The ⋯ menu renders in a portal but\n // React still bubbles its clicks here, so a click whose target is outside the row's own DOM (any menu item:\n // menuitem, menuitemradio, menuitemcheckbox, a submenu) never opens the row.\n const target = e.target as HTMLElement;\n if (!onOpen || !e.currentTarget.contains(target) || target.closest(\"button,[role^=menuitem],a,input\")) return;\n onOpen();\n }}\n className={cn(onOpen ? \"group/row flex min-h-12 cursor-pointer items-center gap-2 py-1.5 pl-1.5 pr-2 transition-colors\" : \"group/row flex min-h-12 items-center gap-2 py-1.5 pl-1.5 pr-2 transition-colors\", open ? \"bg-kit-subtle\" : onOpen && \"hover:bg-kit-subtle\")}\n >\n {grip}\n {toggle}\n {onOpen ? (\n <button\n type=\"button\"\n onClick={onOpen}\n data-row-open={r.id}\n aria-expanded={mode === \"drill\" ? undefined : open}\n aria-controls={inlineMode && open ? bodyId : undefined}\n aria-haspopup={mode === \"popover\" || mode === \"dialog\" ? \"dialog\" : undefined}\n aria-label={`${verb} ${r.preview.title}${r.chip ? `, ${r.chip}` : \"\"}${changedNote ? `, ${changedNote}` : \"\"}, ${r.index + 1} of ${count}`}\n className=\"flex min-w-0 flex-1 items-center gap-2.5 rounded-kit-md text-left outline-none\"\n >\n {titleInner}\n </button>\n ) : (\n <div data-row-open={r.id} className=\"flex min-w-0 flex-1 items-center gap-2.5 text-left\">\n {titleInner}\n </div>\n )}\n <IssueDot errors={roll.errors} warnings={roll.warnings} />\n {peers.length ? <PeerStack peers={peers} size={16} /> : null}\n {menu}\n {trailing}\n </div>\n );\n return (\n <div\n ref={sort.register(r.id)}\n style={sort.style(r.id)}\n data-row-id={r.id}\n className={cn(\"relative border-b border-kit-line-subtle bg-kit-surface last:border-b-0\", isDragging && \"z-10 rounded-kit-lg shadow-kit-lg ring-1 ring-kit-line-strong\")}\n >\n {changeBar}\n <motion.div\n layout={!isDragging && !dragging ? \"position\" : false}\n initial={dragging ? false : { opacity: 0, height: 0 }}\n animate={{ opacity: 1, height: \"auto\" }}\n exit={dragging ? { opacity: 0, height: 0, transition: { duration: 0 } } : { opacity: 0, height: 0 }}\n transition={{ duration: 0.2, ease: [0.22, 1, 0.36, 1] }}\n className=\"overflow-hidden\"\n >\n {mode === \"popover\" ? (\n <Popover open={open} onOpenChange={(o) => !o && onClosePopover()}>\n <PopoverAnchor render={rowInner} />\n <PopoverContent className=\"w-[340px] p-4\" align=\"end\" side=\"left\" sideOffset={10}>\n {popover}\n </PopoverContent>\n </Popover>\n ) : (\n rowInner\n )}\n {inlineMode ? (\n <AnimatePresence initial={false}>\n {open ? (\n <motion.div initial={{ height: 0, opacity: 0 }} animate={{ height: \"auto\", opacity: 1 }} exit={{ height: 0, opacity: 0 }} transition={{ duration: 0.2, ease: [0.22, 1, 0.36, 1] }} className=\"overflow-hidden\">\n {/* D63: the row's fields sit behind the one inset line under its title; no tint, no card inside the row */}\n <div className=\"px-3 pb-3 pt-1\">\n <div id={bodyId} role=\"group\" aria-label={r.preview.title} data-group=\"inset\" className={INSET_LINE}><InsetScope>{inline}</InsetScope></div>\n </div>\n </motion.div>\n ) : null}\n </AnimatePresence>\n ) : null}\n </motion.div>\n </div>\n );\n}\n\n/** The included / not-included check on a feature row (D47): a real checkbox, outside the row's open button. */\nfunction RowCheck({ on, label, title, readOnly, onToggle }: { on: boolean; label: string; title: string; readOnly: boolean; onToggle: () => void }) {\n return (\n <Tooltip content={on ? label : `Not ${label.toLowerCase()}`}>\n <button\n type=\"button\"\n role=\"checkbox\"\n aria-checked={on}\n aria-label={`${label}: ${title}`}\n disabled={readOnly}\n onClick={(e) => {\n e.stopPropagation();\n onToggle();\n }}\n className=\"group/chk flex size-7 shrink-0 items-center justify-center rounded-kit-md transition-colors hover:bg-kit-hover disabled:pointer-events-none\"\n >\n <span\n className={cn(\n \"flex size-[18px] items-center justify-center rounded-full transition-colors\",\n on ? \"bg-kit-control-checked text-kit-fg-inverse\" : \"border border-dashed border-kit-field-border-hover text-kit-fg-3 group-hover/chk:border-[var(--kit-emphasis-line)]\",\n )}\n >\n {on ? <IconCheck className=\"size-3\" stroke={2.5} /> : <IconMinus className=\"size-3\" stroke={2} />}\n </span>\n </button>\n </Tooltip>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,IAAa,kBAAkB,MAAM,cAAwB,CAAC,CAAC;;AAE/D,SAAgB,WAAoD;CAClE,MAAM,OAAO,MAAM,WAAW,eAAe;CAC7C,MAAM,OAAO,QAAQ;CACrB,OAAO,KAAK,UAAU,MAAM,cAAc,KAAK,WAAW,KAAA;AAC5D;;AAGA,IAAa,iBAAsG,CAAC;AAEpH,IAAM,UAAU,SAAkB,KAAK,SAAS,GAAG,KAAK,CAAC,YAAY,KAAK,IAAI,IAAI,GAAG,KAAK,MAAM,GAAG,EAAE,EAAE,OAAO,KAAK,SAAS,GAAG,IAAI,OAAO,GAAG,KAAK;AAElJ,SAAgB,WAAW,EAAE,OAAO,QAAmF;CACrH,MAAM,OAAO,cAAc,KAAK;CAChC,IAAI,MAAM,OAAO,oBAAC,gBAAD;EAAuB;EAAO,MAAM;EAAY;CAAO,CAAA;CACxE,MAAM,MAAM,aAAa,KAAK;CAC9B,IAAI,KAAK,OAAO,oBAAC,eAAD;EAAsB;EAAO,MAAM,IAA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QAAD;IACE,WAAW,GACT,+EACA,KAAK,+CAA+C,oHACtD;IAEC,UAAA,KAAK,oBAAC,WAAD;KAAW,WAAU;KAAS,QAAQ;IAAM,CAAA,IAAI,oBAAC,WAAD;KAAW,WAAU;KAAS,QAAQ;IAAI,CAAA;GAC5F,CAAA;EACA,CAAA;CACD,CAAA;AAEb"}
@@ -1,4 +1,5 @@
1
1
  import { cn } from "../lib/cn.js";
2
+ import { useKitServices } from "../context.js";
2
3
  import { KitIcon } from "../lib/icons.js";
3
4
  import { Tooltip } from "../ui/overlay.js";
4
5
  import * as React from "react";
@@ -26,8 +27,9 @@ function IssueDot({ errors, warnings, className }) {
26
27
  * 28px leading tile for rows: image when there is one, else the type icon.
27
28
  */
28
29
  function Thumb({ media, icon, size = 28, className }) {
30
+ const { mediaSrc } = useKitServices();
29
31
  if (media) return /* @__PURE__ */ jsx("img", {
30
- src: media,
32
+ src: mediaSrc ? mediaSrc(media) : media,
31
33
  alt: "",
32
34
  style: {
33
35
  width: size,
@@ -1 +1 @@
1
- {"version":3,"file":"bits.js","names":[],"sources":["../../src/engine/bits.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { KitIcon } from \"../lib/icons\";\nimport { cn } from \"../lib/cn\";\nimport { Tooltip } from \"../ui/overlay\";\n\n/**\n * CPO D45: a field that IS its own row (an object that drills in) has no label row above it; its shell hands the\n * chrome (ⓘ, badges, comments, presence, ⋯) to the row through this context, and the row draws it before its chevron.\n */\nexport const RowChrome = React.createContext<React.ReactNode>(null);\n\n/** Validation rollup dot: red for errors, amber for warnings. Never colour alone — the tooltip names it. */\nexport function IssueDot({ errors, warnings, className }: { errors: number; warnings?: number; className?: string }) {\n if (!errors && !warnings) return null;\n const text = errors ? `${errors} ${errors === 1 ? \"issue\" : \"issues\"} to fix` : `${warnings} ${warnings === 1 ? \"suggestion\" : \"suggestions\"}`;\n return (\n <Tooltip content={text}>\n <span role=\"img\" aria-label={text} className={cn(\"relative inline-flex size-2 shrink-0 rounded-full\", errors ? \"bg-kit-danger\" : \"bg-kit-warning\", className)} />\n </Tooltip>\n );\n}\n\n/**\n * 28px leading tile for rows: image when there is one, else the type icon.\n */\nexport function Thumb({ media, icon, size = 28, className }: { media?: string; icon?: string; size?: number; className?: string }) {\n if (media) return <img src={media} alt=\"\" style={{ width: size, height: size }} className={cn(\"shrink-0 rounded-kit-md border border-kit-line object-cover\", className)} />;\n return (\n <span style={{ width: size, height: size }} className={cn(\"flex shrink-0 items-center justify-center rounded-kit-md bg-kit-muted text-kit-fg-2\", className)}>\n <KitIcon name={icon} className=\"size-4\" />\n </span>\n );\n}\n\nexport function Kbdish({ children }: { children: React.ReactNode }) {\n return (\n <kbd data-hint=\"shortcuts\" className=\"inline-flex h-4 min-w-4 items-center justify-center rounded-kit-md border border-kit-line bg-kit-subtle px-1 font-kit-sans text-kit-2xs text-kit-fg-3\">\n {children}\n </kbd>\n );\n}\n"],"mappings":";;;;;;;;;;AASA,IAAa,YAAY,MAAM,cAA+B,IAAI;;AAGlE,SAAgB,SAAS,EAAE,QAAQ,UAAU,aAAwE;CACnH,IAAI,CAAC,UAAU,CAAC,UAAU,OAAO;CACjC,MAAM,OAAO,SAAS,GAAG,OAAO,GAAG,WAAW,IAAI,UAAU,SAAS,WAAW,GAAG,SAAS,GAAG,aAAa,IAAI,eAAe;CAC/H,OACE,oBAAC,SAAD;EAAS,SAAS;EAChB,UAAA,oBAAC,QAAD;GAAM,MAAK;GAAM,cAAY;GAAM,WAAW,GAAG,qDAAqD,SAAS,kBAAkB,kBAAkB,SAAS;EAAI,CAAA;CACzJ,CAAA;AAEb;;;;AAKA,SAAgB,MAAM,EAAE,OAAO,MAAM,OAAO,IAAI,aAAmF;CACjI,IAAI,OAAO,OAAO,oBAAC,OAAD;EAAK,KAAK;EAAO,KAAI;EAAG,OAAO;GAAE,OAAO;GAAM,QAAQ;EAAK;EAAG,WAAW,GAAG,+DAA+D,SAAS;CAAI,CAAA;CAC1K,OACE,oBAAC,QAAD;EAAM,OAAO;GAAE,OAAO;GAAM,QAAQ;EAAK;EAAG,WAAW,GAAG,uFAAuF,SAAS;EACxJ,UAAA,oBAAC,SAAD;GAAS,MAAM;GAAM,WAAU;EAAU,CAAA;CACrC,CAAA;AAEV;AAEA,SAAgB,OAAO,EAAE,YAA2C;CAClE,OACE,oBAAC,OAAD;EAAK,aAAU;EAAY,WAAU;EAClC;CACE,CAAA;AAET"}
1
+ {"version":3,"file":"bits.js","names":[],"sources":["../../src/engine/bits.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { KitIcon } from \"../lib/icons\";\nimport { cn } from \"../lib/cn\";\nimport { Tooltip } from \"../ui/overlay\";\nimport { useKitServices } from \"../context\";\n\n/**\n * CPO D45: a field that IS its own row (an object that drills in) has no label row above it; its shell hands the\n * chrome (ⓘ, badges, comments, presence, ⋯) to the row through this context, and the row draws it before its chevron.\n */\nexport const RowChrome = React.createContext<React.ReactNode>(null);\n\n/** Validation rollup dot: red for errors, amber for warnings. Never colour alone — the tooltip names it. */\nexport function IssueDot({ errors, warnings, className }: { errors: number; warnings?: number; className?: string }) {\n if (!errors && !warnings) return null;\n const text = errors ? `${errors} ${errors === 1 ? \"issue\" : \"issues\"} to fix` : `${warnings} ${warnings === 1 ? \"suggestion\" : \"suggestions\"}`;\n return (\n <Tooltip content={text}>\n <span role=\"img\" aria-label={text} className={cn(\"relative inline-flex size-2 shrink-0 rounded-full\", errors ? \"bg-kit-danger\" : \"bg-kit-warning\", className)} />\n </Tooltip>\n );\n}\n\n/**\n * 28px leading tile for rows: image when there is one, else the type icon.\n */\nexport function Thumb({ media, icon, size = 28, className }: { media?: string; icon?: string; size?: number; className?: string }) {\n // the same address the image field's frame draws (mediaSrc: a site path, an SVG missing its xmlns)\n const { mediaSrc } = useKitServices();\n if (media) return <img src={mediaSrc ? mediaSrc(media) : media} alt=\"\" style={{ width: size, height: size }} className={cn(\"shrink-0 rounded-kit-md border border-kit-line object-cover\", className)} />;\n return (\n <span style={{ width: size, height: size }} className={cn(\"flex shrink-0 items-center justify-center rounded-kit-md bg-kit-muted text-kit-fg-2\", className)}>\n <KitIcon name={icon} className=\"size-4\" />\n </span>\n );\n}\n\nexport function Kbdish({ children }: { children: React.ReactNode }) {\n return (\n <kbd data-hint=\"shortcuts\" className=\"inline-flex h-4 min-w-4 items-center justify-center rounded-kit-md border border-kit-line bg-kit-subtle px-1 font-kit-sans text-kit-2xs text-kit-fg-3\">\n {children}\n </kbd>\n );\n}\n"],"mappings":";;;;;;;;;;;AAUA,IAAa,YAAY,MAAM,cAA+B,IAAI;;AAGlE,SAAgB,SAAS,EAAE,QAAQ,UAAU,aAAwE;CACnH,IAAI,CAAC,UAAU,CAAC,UAAU,OAAO;CACjC,MAAM,OAAO,SAAS,GAAG,OAAO,GAAG,WAAW,IAAI,UAAU,SAAS,WAAW,GAAG,SAAS,GAAG,aAAa,IAAI,eAAe;CAC/H,OACE,oBAAC,SAAD;EAAS,SAAS;EAChB,UAAA,oBAAC,QAAD;GAAM,MAAK;GAAM,cAAY;GAAM,WAAW,GAAG,qDAAqD,SAAS,kBAAkB,kBAAkB,SAAS;EAAI,CAAA;CACzJ,CAAA;AAEb;;;;AAKA,SAAgB,MAAM,EAAE,OAAO,MAAM,OAAO,IAAI,aAAmF;CAEjI,MAAM,EAAE,aAAa,eAAe;CACpC,IAAI,OAAO,OAAO,oBAAC,OAAD;EAAK,KAAK,WAAW,SAAS,KAAK,IAAI;EAAO,KAAI;EAAG,OAAO;GAAE,OAAO;GAAM,QAAQ;EAAK;EAAG,WAAW,GAAG,+DAA+D,SAAS;CAAI,CAAA;CACvM,OACE,oBAAC,QAAD;EAAM,OAAO;GAAE,OAAO;GAAM,QAAQ;EAAK;EAAG,WAAW,GAAG,uFAAuF,SAAS;EACxJ,UAAA,oBAAC,SAAD;GAAS,MAAM;GAAM,WAAU;EAAU,CAAA;CACrC,CAAA;AAEV;AAEA,SAAgB,OAAO,EAAE,YAA2C;CAClE,OACE,oBAAC,OAAD;EAAK,aAAU;EAAY,WAAU;EAClC;CACE,CAAA;AAET"}
@@ -309,18 +309,19 @@ function previewOf(itemSchema, item, index, fallbackTitle) {
309
309
  const fields = (itemSchema && "fields" in itemSchema ? itemSchema.fields : void 0) ?? [];
310
310
  const cfg = itemSchema?.preview;
311
311
  const at = (p) => fieldText(fields.find((f) => f.name === p), getIn(v, p.split(".")));
312
+ const shown = fields.filter((f) => f.hidden !== true);
312
313
  let title = cfg?.title ? at(cfg.title) : "";
313
314
  let titleField = cfg?.title;
314
315
  if (!title) {
315
- const t = firstText(fields, v);
316
+ const t = firstText(shown, v);
316
317
  title = t?.text ?? "";
317
318
  titleField = t?.name;
318
319
  }
319
320
  let subtitle = cfg?.subtitle ? at(cfg.subtitle) : "";
320
- if (!subtitle && !cfg?.subtitle) subtitle = firstText(fields, v, titleField)?.text ?? "";
321
+ if (!subtitle && !cfg?.subtitle) subtitle = firstText(shown, v, titleField)?.text ?? "";
321
322
  let media = cfg?.media ? imageUrl(getIn(v, cfg.media.split("."))) : void 0;
322
323
  if (!media && !cfg?.media) {
323
- const img = fields.find((f) => f.type === "image");
324
+ const img = shown.find((f) => f.type === "image");
324
325
  if (img) media = imageUrl(v[img.name]);
325
326
  }
326
327
  const empty = !title;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","names":[],"sources":["../../src/lib/schema.ts"],"sourcesContent":["/**\n * Schema helpers — pure functions the engine uses to decide HOW a field is edited and WHAT a row shows.\n */\nimport type { Condition, FieldSchema, OpenMode, PrimitiveType, SchemaType, TypeSchema } from \"../schema/types\";\nimport { getIn, isObj, newKey } from \"./path\";\nimport { cellValue, isEmptyCell, isTableValue, tableSummary } from \"../schema/table\";\n\nconst PRIMITIVES: ReadonlySet<SchemaType> = new Set<PrimitiveType>([\n \"string\", \"text\", \"richtext\", \"number\", \"boolean\", \"slug\", \"url\", \"email\", \"date\", \"datetime\", \"color\", \"select\", \"multiselect\",\n \"tags\", \"image\", \"file\", \"video\", \"icon\", \"link\", \"button\", \"reference\", \"code\", \"json\", \"geopoint\", \"rating\", \"table\",\n]);\nexport const isPrimitive = (t: SchemaType) => PRIMITIVES.has(t);\n/** Types whose value is plain text (counters, AI rewrite, copy/paste as text). */\nexport const isTextual = (t: SchemaType) => t === \"string\" || t === \"text\" || t === \"richtext\" || t === \"slug\" || t === \"url\" || t === \"email\";\n/** Types that are cheap to show inline inside a small object (no heavy surfaces). */\nconst INLINE_OK: ReadonlySet<SchemaType> = new Set([\"string\", \"number\", \"boolean\", \"select\", \"color\", \"icon\", \"url\", \"email\", \"date\", \"rating\", \"slug\"]);\n\nexport const itemSchemas = (f: FieldSchema): FieldSchema[] => (Array.isArray(f.of) ? f.of : []);\nexport const slotAllow = (f: FieldSchema): string[] | undefined => (f.of && !Array.isArray(f.of) ? f.of.allow : undefined);\nexport const itemSchemaFor = (f: FieldSchema, item: unknown): FieldSchema | undefined => {\n const of = itemSchemas(f);\n if (isObj(item) && typeof item._type === \"string\") return of.find((o) => o.name === item._type) ?? of[0];\n return of[0];\n};\n/** An array whose single item type is a primitive (tags, gallery, references, list of strings). */\nexport const primitiveItem = (f: FieldSchema): FieldSchema | undefined => {\n const of = itemSchemas(f);\n return of.length === 1 && isPrimitive(of[0].type) ? of[0] : undefined;\n};\nexport const isSmallObject = (fields: FieldSchema[] = []) => fields.length > 0 && fields.length <= 3 && fields.every((f) => INLINE_OK.has(f.type));\n\n/** How an object field / array item opens (CPO D8: inline for ≤3 primitives, else drill). */\nexport function objectOpenMode(f: FieldSchema): OpenMode {\n if (f.openMode) return f.openMode;\n return isSmallObject(f.fields) ? \"inline\" : \"drill\";\n}\n/**\n * CPO D43 — one rule for rows: an item of ≤3 simple fields (text, number, switch, select, colour, icon, url, email,\n * date, rating, slug) EXPANDS inline under its row; anything bigger, nested or rich DRILLS into its own frame.\n * `openMode` on the array still wins (developer override). Several item types → drill (they rarely share a shape).\n */\nexport function itemOpenMode(arrayField: FieldSchema): OpenMode {\n if (arrayField.openMode) return arrayField.openMode;\n const of = itemSchemas(arrayField);\n return of.length === 1 && isSmallObject(of[0].fields) ? \"inline\" : \"drill\";\n}\n\nexport function emptyFor(f: FieldSchema): unknown {\n switch (f.type) {\n case \"boolean\": return false;\n case \"number\": case \"rating\": return null;\n case \"multiselect\": case \"tags\": case \"array\": case \"slot\": return [];\n case \"object\": return objectInitial(f.fields ?? []);\n case \"image\": case \"file\": case \"video\": case \"reference\": case \"link\": case \"button\": case \"geopoint\": case \"json\": case \"table\": return null;\n default: return \"\";\n }\n}\nexport const initialFor = (f: FieldSchema) => (f.initialValue !== undefined ? structuredCloneSafe(f.initialValue) : emptyFor(f));\nexport function objectInitial(fields: FieldSchema[]): Record<string, unknown> {\n const o: Record<string, unknown> = {};\n for (const f of fields) if (f.initialValue !== undefined) o[f.name] = structuredCloneSafe(f.initialValue);\n return o;\n}\n/** A new array item for `itemSchema` (stamped with `_key` and, when the array allows several types, `_type`). */\nexport function newItem(arrayField: FieldSchema, itemSchema: FieldSchema): unknown {\n if (isPrimitive(itemSchema.type)) return initialFor(itemSchema);\n const base = itemSchema.initialValue && isObj(itemSchema.initialValue) ? structuredCloneSafe(itemSchema.initialValue) : objectInitial(itemSchema.fields ?? []);\n const multi = itemSchemas(arrayField).length > 1;\n return { _key: newKey(), ...(multi ? { _type: itemSchema.name } : {}), ...(base as object) };\n}\nexport function newBlock(block: TypeSchema, settings?: FieldSchema[]): Record<string, unknown> {\n const init = block.initialValue ? structuredCloneSafe(block.initialValue) : objectInitial(block.fields);\n const s = settings?.length ? { _settings: objectInitial(settings) } : {};\n return { _key: newKey(), _type: block.name, ...(block.variants?.[0] ? { _variant: block.variants[0].id } : {}), ...s, ...(init as object) };\n}\nexport function structuredCloneSafe<T>(v: T): T {\n try {\n return structuredClone(v);\n } catch {\n return JSON.parse(JSON.stringify(v)) as T;\n }\n}\n\n/* ── Conditions ───────────────────────────────────────────────────────── */\n/**\n * What a condition can read beyond the fields beside it (V2 kit lib/schema.ts CondCtx): the object that holds them\n * (`parent`), the top of the component or CMS item (`root`) and its variant. Callers that don't pass it get the sibling\n * rules only; a `_variant` rule that can't be read then counts as met (the field shows), never as a silent hide.\n */\nexport interface CondCtx {\n parent?: unknown;\n root?: unknown;\n /** the component's variant id, its first variant when the value has none */\n variant?: string;\n}\n/** The condition context for fields under `basePath` of a form (the nearest slot child is the component's root). V2 condCtx. */\nexport function condCtx(form: { schema: TypeSchema; getAt: (p: (string | number)[]) => unknown; resolveSchema?: (t: string) => TypeSchema | undefined }, basePath: (string | number)[]): CondCtx {\n const up = (p: (string | number)[]) => {\n const q = [...p];\n // the container may be a list item ([\"items\", 0]): the object holding it is one key further up\n while (q.length && typeof q[q.length - 1] === \"number\") q.pop();\n q.pop();\n return q;\n };\n let rootPath: (string | number)[] = [];\n let rootSchema: TypeSchema | undefined = form.schema;\n for (let i = basePath.length; i > 0; i--) {\n const v = form.getAt(basePath.slice(0, i));\n if (isObj(v) && typeof v._type === \"string\" && typeof basePath[i - 1] === \"number\") {\n rootPath = basePath.slice(0, i);\n rootSchema = form.resolveSchema?.(v._type);\n break;\n }\n }\n const root = form.getAt(rootPath);\n const own = isObj(root) && typeof root._variant === \"string\" ? root._variant : undefined;\n return { parent: basePath.length > rootPath.length ? form.getAt(up(basePath)) : undefined, root, variant: own ?? rootSchema?.variants?.[0]?.id };\n}\n\nconst num = (v: unknown) => (typeof v === \"number\" ? v : typeof v === \"string\" && v.trim() !== \"\" && !Number.isNaN(Number(v)) ? Number(v) : typeof v === \"string\" && !Number.isNaN(Date.parse(v)) ? Date.parse(v) : NaN);\n/** One rule (V2 ruleHolds): true when it holds, null when it can't be read here (no context). */\nfunction ruleHolds(c: Condition, siblings: unknown, ctx: CondCtx | undefined): boolean | null {\n let v: unknown;\n if (c.field === \"_variant\" && !c.scope) {\n if (isObj(siblings) && typeof siblings._variant === \"string\") v = siblings._variant;\n else if (ctx) v = ctx.variant;\n else return null;\n } else if (c.scope) {\n if (!ctx) return null;\n const from = c.scope === \"root\" ? ctx.root : ctx.parent;\n v = c.field === \"_variant\" ? ctx.variant : isObj(from) ? from[c.field] : undefined;\n } else v = isObj(siblings) ? siblings[c.field] : undefined;\n const op = c.op ?? (c.notEmpty ? \"notEmpty\" : c.equals !== undefined ? (Array.isArray(c.equals) ? \"in\" : \"is\") : null);\n const target = c.op ? c.value : c.equals;\n const list = Array.isArray(target) ? target : [target];\n const has = (x: unknown) => list.some((y) => y === x || (Array.isArray(x) && x.includes(y as never)));\n switch (op) {\n case \"notEmpty\": return !isEmptyValue(v);\n case \"empty\": return isEmptyValue(v);\n case \"is\":\n case \"in\": return has(v);\n case \"isNot\":\n case \"notIn\": return !has(v);\n case \"gt\": return num(v) > num(target);\n case \"lt\": return num(v) < num(target);\n default: return true;\n }\n}\n\n/** `hidden: true` hides; a Condition SHOWS the field only while its rules hold (types.ts contract). A rule it can't read\n * here (a `_variant` or scoped rule with no context) holds, so the field shows. V2 isHidden. */\nexport function isHidden(f: FieldSchema, parent: unknown, ctx?: CondCtx): boolean {\n if (f.hidden === true) return true;\n if (!f.hidden) return false;\n const c = f.hidden as Condition;\n const met = [c, ...(c.also ?? [])].map((r) => ruleHolds(r, parent, ctx) ?? true);\n return !(c.match === \"any\" ? met.some(Boolean) : met.every(Boolean));\n}\n\n/* ── Values → text ────────────────────────────────────────────────────── */\n/** Portable Text blocks' text, one block per space; \"\" when the array holds no blocks (a list of items). */\nconst blocksText = (v: unknown[]): string =>\n v\n .map((b) => (isObj(b) && Array.isArray(b.children) ? b.children.map((c) => (isObj(c) && typeof c.text === \"string\" ? c.text : \"\")).join(\"\") : \"\"))\n .filter(Boolean)\n .join(\" \")\n .replace(/\\s+/g, \" \")\n .trim();\nconst NAMED_ENTITIES: Record<string, string> = { amp: \"&\", lt: \"<\", gt: \">\", quot: '\"', apos: \"'\", nbsp: \" \" };\n/**\n * Markup's character references as the characters they stand for, AFTER the tags are gone (so a decoded `&lt;b&gt;`\n * stays words). Named ones a rich text editor writes, and every numeric one; anything else is left as written.\n */\nconst decodeEntities = (s: string): string =>\n s.replace(/&(#x[0-9a-f]+|#\\d+|[a-z]+);/gi, (whole, ref: string) => {\n if (ref[0] !== \"#\") return NAMED_ENTITIES[ref.toLowerCase()] ?? whole;\n const code = ref[1] === \"x\" || ref[1] === \"X\" ? parseInt(ref.slice(2), 16) : parseInt(ref.slice(1), 10);\n return Number.isFinite(code) && code > 0 && code <= 0x10ffff ? String.fromCodePoint(code) : whole;\n });\n/**\n * A value as one line of text. Stored rich text reads as its words in every shape production keeps: an html string,\n * Portable Text blocks, the component props envelope `{ content: { version, content: blocks }, html }`, and the field\n * envelope `{ format, value: blocks, html }`.\n *\n * 🔴 An html string's words are DECODED: a row titled by `<p>Advisors &amp; specialists</p>` read \"Advisors &amp;\n * specialists\" in the dock (marby-astro QA, 2026-10-22).\n */\nexport const plainText = (v: unknown): string => {\n if (typeof v === \"string\") return decodeEntities(v.replace(/<[^>]*>/g, \" \")).replace(/\\s+/g, \" \").trim();\n if (typeof v === \"number\") return String(v);\n if (Array.isArray(v)) return blocksText(v);\n if (isObj(v)) {\n if (typeof v.label === \"string\" && v.label) return v.label;\n if (typeof v.title === \"string\") return v.title;\n if (typeof v.href === \"string\") return v.href;\n if (typeof v.name === \"string\") return v.name;\n // the envelope's blocks first: their text is unescaped (the html holds `&amp;`)\n if (\"content\" in v && typeof v.content === \"object\" && v.content !== null) {\n const t = plainText(v.content);\n if (t) return t;\n }\n if (Array.isArray(v.value)) {\n const t = blocksText(v.value);\n if (t) return t;\n }\n if (typeof v.html === \"string\") return plainText(v.html);\n }\n return \"\";\n};\nexport function isEmptyValue(v: unknown): boolean {\n if (v == null) return true;\n if (typeof v === \"string\") return plainText(v) === \"\" && !/<img|<hr|<table|data-block|data-embed/.test(v);\n if (Array.isArray(v)) return v.length === 0;\n if (isTableValue(v)) return !v.caption?.trim() && v.rows.every((r) => Object.values(r.cells ?? {}).every((c) => isEmptyCell(cellValue(c))));\n if (isObj(v)) {\n if (\"url\" in v) return !v.url;\n if (\"href\" in v && !(\"label\" in v)) return !v.href;\n if (\"label\" in v && \"href\" in v) return !v.label && !v.href;\n return Object.keys(v).filter((k) => !k.startsWith(\"_\")).every((k) => isEmptyValue(v[k]));\n }\n return false;\n}\nexport const imageUrl = (v: unknown): string | undefined =>\n typeof v === \"string\" && /^(https?:|blob:|data:image|\\/)/.test(v) ? v : isObj(v) && typeof v.url === \"string\" && v.url ? v.url : undefined;\n\n/** Singular noun for an array's items: itemNoun → item title → field title minus \"s\". */\nexport function itemNoun(f: FieldSchema): string {\n if (f.itemNoun) return f.itemNoun;\n const of = itemSchemas(f);\n if (of.length === 1 && of[0].title && !isPrimitive(of[0].type)) return of[0].title.toLowerCase();\n const t = f.title.toLowerCase();\n return t.endsWith(\"ies\") ? `${t.slice(0, -3)}y` : t.endsWith(\"s\") ? t.slice(0, -1) : \"item\";\n}\n\n/* ── Previews (array rows, slot rows, crumbs) ─────────────────────────── */\nexport interface Preview {\n title: string;\n subtitle?: string;\n media?: string;\n icon?: string;\n empty: boolean;\n}\n/** Display text of one field value (select → option label). */\nfunction fieldText(f: FieldSchema | undefined, v: unknown): string {\n if (f?.type === \"select\") return f.options?.find((o) => o.value === v)?.label ?? plainText(v);\n return plainText(v);\n}\nfunction firstText(fields: FieldSchema[], v: Record<string, unknown>, skip?: string) {\n for (const f of fields) {\n if (f.name === skip) continue;\n if (f.type === \"select\") {\n const t = fieldText(f, v[f.name]);\n if (t) return { name: f.name, text: t };\n }\n if (f.type === \"string\" || f.type === \"text\" || f.type === \"richtext\" || f.type === \"number\") {\n const t = plainText(v[f.name]);\n if (t) return { name: f.name, text: t };\n }\n if (f.type === \"button\" || f.type === \"link\") {\n const t = plainText(v[f.name]);\n if (t) return { name: f.name, text: t };\n }\n }\n // no prose anywhere: a URL or address still beats \"Item 3\" (D47 — item titles use the first text value)\n for (const f of fields) {\n if (f.name === skip || (f.type !== \"url\" && f.type !== \"email\" && f.type !== \"slug\")) continue;\n const t = plainText(v[f.name]);\n if (t) return { name: f.name, text: t };\n }\n return undefined;\n}\nexport function previewOf(itemSchema: FieldSchema | TypeSchema | undefined, item: unknown, index: number, fallbackTitle?: string): Preview {\n const v = isObj(item) ? item : {};\n const fields = (itemSchema && \"fields\" in itemSchema ? itemSchema.fields : undefined) ?? [];\n const cfg = itemSchema?.preview;\n const at = (p: string) => fieldText(fields.find((f) => f.name === p), getIn(v, p.split(\".\")));\n let title = cfg?.title ? at(cfg.title) : \"\";\n let titleField = cfg?.title;\n if (!title) {\n const t = firstText(fields, v);\n title = t?.text ?? \"\";\n titleField = t?.name;\n }\n let subtitle = cfg?.subtitle ? at(cfg.subtitle) : \"\";\n if (!subtitle && !cfg?.subtitle) subtitle = firstText(fields, v, titleField)?.text ?? \"\";\n let media = cfg?.media ? imageUrl(getIn(v, cfg.media.split(\".\"))) : undefined;\n if (!media && !cfg?.media) {\n const img = fields.find((f) => f.type === \"image\");\n if (img) media = imageUrl(v[img.name]);\n }\n const empty = !title;\n const noun = fallbackTitle ?? (itemSchema?.title ?? \"Item\");\n return {\n title: title || cfg?.fallback || `${noun} ${index + 1}`,\n subtitle: subtitle ? (subtitle.length > 90 ? `${subtitle.slice(0, 88)}…` : subtitle) : undefined,\n media,\n icon: cfg?.icon ?? (itemSchema as FieldSchema | undefined)?.icon,\n empty,\n };\n}\n\n/**\n * How one slot child reads as a row (SlotField): its block's preview (the block's title while it has no text), the\n * variant chip its `_variant` names, and the line under it (block title · settings, else description, else \"Block i of n\").\n */\nexport function slotRowOf(block: TypeSchema | undefined, item: unknown, index: number, count: number, slotSettings?: FieldSchema[]): { preview: Preview; chip?: string; extra: string } {\n const pv = previewOf(block, item, index, block?.title ?? \"Block\");\n const variant = block?.variants?.find((v) => isObj(item) && v.id === item._variant)?.name;\n const settings = slotSettings && isObj(item) ? summarize(slotSettings, item._settings, 2) : \"\";\n return {\n preview: { ...pv, title: pv.empty ? (block?.title ?? \"Unknown block\") : pv.title, icon: block?.icon ?? \"box\" },\n chip: variant,\n extra: [pv.empty ? undefined : block?.title, settings].filter(Boolean).join(\" · \") || block?.description || `Block ${index + 1} of ${count}`,\n };\n}\n\n/** \"Cast iron · 4 items\" — one-line summary of an object for collapsed rows and fieldset headers. */\nexport function summarize(fields: FieldSchema[], v: unknown, max = 2): string {\n if (!isObj(v)) return \"\";\n const parts: string[] = [];\n for (const f of fields) {\n if (parts.length >= max) break;\n const x = v[f.name];\n if (isEmptyValue(x)) continue;\n if (f.type === \"reference\" || f.type === \"json\" || f.type === \"code\" || f.type === \"image\" || f.type === \"file\") continue; // ids and blobs read badly\n if (f.type === \"table\") {\n parts.push(tableSummary(x));\n continue;\n }\n if (f.type === \"rating\" && typeof x === \"number\") {\n parts.push(`${x} / 5`);\n continue;\n }\n if (Array.isArray(x)) parts.push(`${x.length} ${x.length === 1 ? itemNounSafe(f) : `${itemNounSafe(f)}s`}`);\n else if (typeof x === \"boolean\") parts.push(`${f.title}: ${x ? \"on\" : \"off\"}`);\n else {\n const t = fieldText(f, x);\n if (t) parts.push(t.length > 40 ? `${t.slice(0, 38)}…` : t);\n }\n }\n return parts.join(\" · \");\n}\nconst itemNounSafe = (f: FieldSchema) => (f.type === \"array\" || f.type === \"slot\" ? itemNoun(f) : \"item\");\n"],"mappings":";;;AAOA,IAAM,6BAAsC,IAAI,IAAmB;CACjE;CAAU;CAAQ;CAAY;CAAU;CAAW;CAAQ;CAAO;CAAS;CAAQ;CAAY;CAAS;CAAU;CAClH;CAAQ;CAAS;CAAQ;CAAS;CAAQ;CAAQ;CAAU;CAAa;CAAQ;CAAQ;CAAY;CAAU;AACjH,CAAC;AACD,IAAa,eAAe,MAAkB,WAAW,IAAI,CAAC;;AAE9D,IAAa,aAAa,MAAkB,MAAM,YAAY,MAAM,UAAU,MAAM,cAAc,MAAM,UAAU,MAAM,SAAS,MAAM;;AAEvI,IAAM,4BAAqC,IAAI,IAAI;CAAC;CAAU;CAAU;CAAW;CAAU;CAAS;CAAQ;CAAO;CAAS;CAAQ;CAAU;AAAM,CAAC;AAEvJ,IAAa,eAAe,MAAmC,MA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D,MAAM,KAAK,GAAG,EAAE,KAAK;GACrB;EACF;EACA,IAAI,MAAM,QAAQ,CAAC,GAAG,MAAM,KAAK,GAAG,EAAE,OAAO,GAAG,EAAE,WAAW,IAAI,aAAa,CAAC,IAAI,GAAG,aAAa,CAAC,EAAE,IAAI;OACrG,IAAI,OAAO,MAAM,WAAW,MAAM,KAAK,GAAG,EAAE,MAAM,IAAI,IAAI,OAAO,OAAO;OACxE;GACH,MAAM,IAAI,UAAU,GAAG,CAAC;GACxB,IAAI,GAAG,MAAM,KAAK,EAAE,SAAS,KAAK,GAAG,EAAE,MAAM,GAAG,EAAE,EAAE,KAAK,CAAC;EAC5D;CACF;CACA,OAAO,MAAM,KAAK,KAAK;AACzB;AACA,IAAM,gBAAgB,MAAoB,EAAE,SAAS,WAAW,EAAE,SAAS,SAAS,SAAS,CAAC,IAAI"}
1
+ {"version":3,"file":"schema.js","names":[],"sources":["../../src/lib/schema.ts"],"sourcesContent":["/**\n * Schema helpers — pure functions the engine uses to decide HOW a field is edited and WHAT a row shows.\n */\nimport type { Condition, FieldSchema, OpenMode, PrimitiveType, SchemaType, TypeSchema } from \"../schema/types\";\nimport { getIn, isObj, newKey } from \"./path\";\nimport { cellValue, isEmptyCell, isTableValue, tableSummary } from \"../schema/table\";\n\nconst PRIMITIVES: ReadonlySet<SchemaType> = new Set<PrimitiveType>([\n \"string\", \"text\", \"richtext\", \"number\", \"boolean\", \"slug\", \"url\", \"email\", \"date\", \"datetime\", \"color\", \"select\", \"multiselect\",\n \"tags\", \"image\", \"file\", \"video\", \"icon\", \"link\", \"button\", \"reference\", \"code\", \"json\", \"geopoint\", \"rating\", \"table\",\n]);\nexport const isPrimitive = (t: SchemaType) => PRIMITIVES.has(t);\n/** Types whose value is plain text (counters, AI rewrite, copy/paste as text). */\nexport const isTextual = (t: SchemaType) => t === \"string\" || t === \"text\" || t === \"richtext\" || t === \"slug\" || t === \"url\" || t === \"email\";\n/** Types that are cheap to show inline inside a small object (no heavy surfaces). */\nconst INLINE_OK: ReadonlySet<SchemaType> = new Set([\"string\", \"number\", \"boolean\", \"select\", \"color\", \"icon\", \"url\", \"email\", \"date\", \"rating\", \"slug\"]);\n\nexport const itemSchemas = (f: FieldSchema): FieldSchema[] => (Array.isArray(f.of) ? f.of : []);\nexport const slotAllow = (f: FieldSchema): string[] | undefined => (f.of && !Array.isArray(f.of) ? f.of.allow : undefined);\nexport const itemSchemaFor = (f: FieldSchema, item: unknown): FieldSchema | undefined => {\n const of = itemSchemas(f);\n if (isObj(item) && typeof item._type === \"string\") return of.find((o) => o.name === item._type) ?? of[0];\n return of[0];\n};\n/** An array whose single item type is a primitive (tags, gallery, references, list of strings). */\nexport const primitiveItem = (f: FieldSchema): FieldSchema | undefined => {\n const of = itemSchemas(f);\n return of.length === 1 && isPrimitive(of[0].type) ? of[0] : undefined;\n};\nexport const isSmallObject = (fields: FieldSchema[] = []) => fields.length > 0 && fields.length <= 3 && fields.every((f) => INLINE_OK.has(f.type));\n\n/** How an object field / array item opens (CPO D8: inline for ≤3 primitives, else drill). */\nexport function objectOpenMode(f: FieldSchema): OpenMode {\n if (f.openMode) return f.openMode;\n return isSmallObject(f.fields) ? \"inline\" : \"drill\";\n}\n/**\n * CPO D43 — one rule for rows: an item of ≤3 simple fields (text, number, switch, select, colour, icon, url, email,\n * date, rating, slug) EXPANDS inline under its row; anything bigger, nested or rich DRILLS into its own frame.\n * `openMode` on the array still wins (developer override). Several item types → drill (they rarely share a shape).\n */\nexport function itemOpenMode(arrayField: FieldSchema): OpenMode {\n if (arrayField.openMode) return arrayField.openMode;\n const of = itemSchemas(arrayField);\n return of.length === 1 && isSmallObject(of[0].fields) ? \"inline\" : \"drill\";\n}\n\nexport function emptyFor(f: FieldSchema): unknown {\n switch (f.type) {\n case \"boolean\": return false;\n case \"number\": case \"rating\": return null;\n case \"multiselect\": case \"tags\": case \"array\": case \"slot\": return [];\n case \"object\": return objectInitial(f.fields ?? []);\n case \"image\": case \"file\": case \"video\": case \"reference\": case \"link\": case \"button\": case \"geopoint\": case \"json\": case \"table\": return null;\n default: return \"\";\n }\n}\nexport const initialFor = (f: FieldSchema) => (f.initialValue !== undefined ? structuredCloneSafe(f.initialValue) : emptyFor(f));\nexport function objectInitial(fields: FieldSchema[]): Record<string, unknown> {\n const o: Record<string, unknown> = {};\n for (const f of fields) if (f.initialValue !== undefined) o[f.name] = structuredCloneSafe(f.initialValue);\n return o;\n}\n/** A new array item for `itemSchema` (stamped with `_key` and, when the array allows several types, `_type`). */\nexport function newItem(arrayField: FieldSchema, itemSchema: FieldSchema): unknown {\n if (isPrimitive(itemSchema.type)) return initialFor(itemSchema);\n const base = itemSchema.initialValue && isObj(itemSchema.initialValue) ? structuredCloneSafe(itemSchema.initialValue) : objectInitial(itemSchema.fields ?? []);\n const multi = itemSchemas(arrayField).length > 1;\n return { _key: newKey(), ...(multi ? { _type: itemSchema.name } : {}), ...(base as object) };\n}\nexport function newBlock(block: TypeSchema, settings?: FieldSchema[]): Record<string, unknown> {\n const init = block.initialValue ? structuredCloneSafe(block.initialValue) : objectInitial(block.fields);\n const s = settings?.length ? { _settings: objectInitial(settings) } : {};\n return { _key: newKey(), _type: block.name, ...(block.variants?.[0] ? { _variant: block.variants[0].id } : {}), ...s, ...(init as object) };\n}\nexport function structuredCloneSafe<T>(v: T): T {\n try {\n return structuredClone(v);\n } catch {\n return JSON.parse(JSON.stringify(v)) as T;\n }\n}\n\n/* ── Conditions ───────────────────────────────────────────────────────── */\n/**\n * What a condition can read beyond the fields beside it (V2 kit lib/schema.ts CondCtx): the object that holds them\n * (`parent`), the top of the component or CMS item (`root`) and its variant. Callers that don't pass it get the sibling\n * rules only; a `_variant` rule that can't be read then counts as met (the field shows), never as a silent hide.\n */\nexport interface CondCtx {\n parent?: unknown;\n root?: unknown;\n /** the component's variant id, its first variant when the value has none */\n variant?: string;\n}\n/** The condition context for fields under `basePath` of a form (the nearest slot child is the component's root). V2 condCtx. */\nexport function condCtx(form: { schema: TypeSchema; getAt: (p: (string | number)[]) => unknown; resolveSchema?: (t: string) => TypeSchema | undefined }, basePath: (string | number)[]): CondCtx {\n const up = (p: (string | number)[]) => {\n const q = [...p];\n // the container may be a list item ([\"items\", 0]): the object holding it is one key further up\n while (q.length && typeof q[q.length - 1] === \"number\") q.pop();\n q.pop();\n return q;\n };\n let rootPath: (string | number)[] = [];\n let rootSchema: TypeSchema | undefined = form.schema;\n for (let i = basePath.length; i > 0; i--) {\n const v = form.getAt(basePath.slice(0, i));\n if (isObj(v) && typeof v._type === \"string\" && typeof basePath[i - 1] === \"number\") {\n rootPath = basePath.slice(0, i);\n rootSchema = form.resolveSchema?.(v._type);\n break;\n }\n }\n const root = form.getAt(rootPath);\n const own = isObj(root) && typeof root._variant === \"string\" ? root._variant : undefined;\n return { parent: basePath.length > rootPath.length ? form.getAt(up(basePath)) : undefined, root, variant: own ?? rootSchema?.variants?.[0]?.id };\n}\n\nconst num = (v: unknown) => (typeof v === \"number\" ? v : typeof v === \"string\" && v.trim() !== \"\" && !Number.isNaN(Number(v)) ? Number(v) : typeof v === \"string\" && !Number.isNaN(Date.parse(v)) ? Date.parse(v) : NaN);\n/** One rule (V2 ruleHolds): true when it holds, null when it can't be read here (no context). */\nfunction ruleHolds(c: Condition, siblings: unknown, ctx: CondCtx | undefined): boolean | null {\n let v: unknown;\n if (c.field === \"_variant\" && !c.scope) {\n if (isObj(siblings) && typeof siblings._variant === \"string\") v = siblings._variant;\n else if (ctx) v = ctx.variant;\n else return null;\n } else if (c.scope) {\n if (!ctx) return null;\n const from = c.scope === \"root\" ? ctx.root : ctx.parent;\n v = c.field === \"_variant\" ? ctx.variant : isObj(from) ? from[c.field] : undefined;\n } else v = isObj(siblings) ? siblings[c.field] : undefined;\n const op = c.op ?? (c.notEmpty ? \"notEmpty\" : c.equals !== undefined ? (Array.isArray(c.equals) ? \"in\" : \"is\") : null);\n const target = c.op ? c.value : c.equals;\n const list = Array.isArray(target) ? target : [target];\n const has = (x: unknown) => list.some((y) => y === x || (Array.isArray(x) && x.includes(y as never)));\n switch (op) {\n case \"notEmpty\": return !isEmptyValue(v);\n case \"empty\": return isEmptyValue(v);\n case \"is\":\n case \"in\": return has(v);\n case \"isNot\":\n case \"notIn\": return !has(v);\n case \"gt\": return num(v) > num(target);\n case \"lt\": return num(v) < num(target);\n default: return true;\n }\n}\n\n/** `hidden: true` hides; a Condition SHOWS the field only while its rules hold (types.ts contract). A rule it can't read\n * here (a `_variant` or scoped rule with no context) holds, so the field shows. V2 isHidden. */\nexport function isHidden(f: FieldSchema, parent: unknown, ctx?: CondCtx): boolean {\n if (f.hidden === true) return true;\n if (!f.hidden) return false;\n const c = f.hidden as Condition;\n const met = [c, ...(c.also ?? [])].map((r) => ruleHolds(r, parent, ctx) ?? true);\n return !(c.match === \"any\" ? met.some(Boolean) : met.every(Boolean));\n}\n\n/* ── Values → text ────────────────────────────────────────────────────── */\n/** Portable Text blocks' text, one block per space; \"\" when the array holds no blocks (a list of items). */\nconst blocksText = (v: unknown[]): string =>\n v\n .map((b) => (isObj(b) && Array.isArray(b.children) ? b.children.map((c) => (isObj(c) && typeof c.text === \"string\" ? c.text : \"\")).join(\"\") : \"\"))\n .filter(Boolean)\n .join(\" \")\n .replace(/\\s+/g, \" \")\n .trim();\nconst NAMED_ENTITIES: Record<string, string> = { amp: \"&\", lt: \"<\", gt: \">\", quot: '\"', apos: \"'\", nbsp: \" \" };\n/**\n * Markup's character references as the characters they stand for, AFTER the tags are gone (so a decoded `&lt;b&gt;`\n * stays words). Named ones a rich text editor writes, and every numeric one; anything else is left as written.\n */\nconst decodeEntities = (s: string): string =>\n s.replace(/&(#x[0-9a-f]+|#\\d+|[a-z]+);/gi, (whole, ref: string) => {\n if (ref[0] !== \"#\") return NAMED_ENTITIES[ref.toLowerCase()] ?? whole;\n const code = ref[1] === \"x\" || ref[1] === \"X\" ? parseInt(ref.slice(2), 16) : parseInt(ref.slice(1), 10);\n return Number.isFinite(code) && code > 0 && code <= 0x10ffff ? String.fromCodePoint(code) : whole;\n });\n/**\n * A value as one line of text. Stored rich text reads as its words in every shape production keeps: an html string,\n * Portable Text blocks, the component props envelope `{ content: { version, content: blocks }, html }`, and the field\n * envelope `{ format, value: blocks, html }`.\n *\n * 🔴 An html string's words are DECODED: a row titled by `<p>Advisors &amp; specialists</p>` read \"Advisors &amp;\n * specialists\" in the dock (marby-astro QA, 2026-10-22).\n */\nexport const plainText = (v: unknown): string => {\n if (typeof v === \"string\") return decodeEntities(v.replace(/<[^>]*>/g, \" \")).replace(/\\s+/g, \" \").trim();\n if (typeof v === \"number\") return String(v);\n if (Array.isArray(v)) return blocksText(v);\n if (isObj(v)) {\n if (typeof v.label === \"string\" && v.label) return v.label;\n if (typeof v.title === \"string\") return v.title;\n if (typeof v.href === \"string\") return v.href;\n if (typeof v.name === \"string\") return v.name;\n // the envelope's blocks first: their text is unescaped (the html holds `&amp;`)\n if (\"content\" in v && typeof v.content === \"object\" && v.content !== null) {\n const t = plainText(v.content);\n if (t) return t;\n }\n if (Array.isArray(v.value)) {\n const t = blocksText(v.value);\n if (t) return t;\n }\n if (typeof v.html === \"string\") return plainText(v.html);\n }\n return \"\";\n};\nexport function isEmptyValue(v: unknown): boolean {\n if (v == null) return true;\n if (typeof v === \"string\") return plainText(v) === \"\" && !/<img|<hr|<table|data-block|data-embed/.test(v);\n if (Array.isArray(v)) return v.length === 0;\n if (isTableValue(v)) return !v.caption?.trim() && v.rows.every((r) => Object.values(r.cells ?? {}).every((c) => isEmptyCell(cellValue(c))));\n if (isObj(v)) {\n if (\"url\" in v) return !v.url;\n if (\"href\" in v && !(\"label\" in v)) return !v.href;\n if (\"label\" in v && \"href\" in v) return !v.label && !v.href;\n return Object.keys(v).filter((k) => !k.startsWith(\"_\")).every((k) => isEmptyValue(v[k]));\n }\n return false;\n}\nexport const imageUrl = (v: unknown): string | undefined =>\n typeof v === \"string\" && /^(https?:|blob:|data:image|\\/)/.test(v) ? v : isObj(v) && typeof v.url === \"string\" && v.url ? v.url : undefined;\n\n/** Singular noun for an array's items: itemNoun → item title → field title minus \"s\". */\nexport function itemNoun(f: FieldSchema): string {\n if (f.itemNoun) return f.itemNoun;\n const of = itemSchemas(f);\n if (of.length === 1 && of[0].title && !isPrimitive(of[0].type)) return of[0].title.toLowerCase();\n const t = f.title.toLowerCase();\n return t.endsWith(\"ies\") ? `${t.slice(0, -3)}y` : t.endsWith(\"s\") ? t.slice(0, -1) : \"item\";\n}\n\n/* ── Previews (array rows, slot rows, crumbs) ─────────────────────────── */\nexport interface Preview {\n title: string;\n subtitle?: string;\n media?: string;\n icon?: string;\n empty: boolean;\n}\n/** Display text of one field value (select → option label). */\nfunction fieldText(f: FieldSchema | undefined, v: unknown): string {\n if (f?.type === \"select\") return f.options?.find((o) => o.value === v)?.label ?? plainText(v);\n return plainText(v);\n}\nfunction firstText(fields: FieldSchema[], v: Record<string, unknown>, skip?: string) {\n for (const f of fields) {\n if (f.name === skip) continue;\n if (f.type === \"select\") {\n const t = fieldText(f, v[f.name]);\n if (t) return { name: f.name, text: t };\n }\n if (f.type === \"string\" || f.type === \"text\" || f.type === \"richtext\" || f.type === \"number\") {\n const t = plainText(v[f.name]);\n if (t) return { name: f.name, text: t };\n }\n if (f.type === \"button\" || f.type === \"link\") {\n const t = plainText(v[f.name]);\n if (t) return { name: f.name, text: t };\n }\n }\n // no prose anywhere: a URL or address still beats \"Item 3\" (D47 — item titles use the first text value)\n for (const f of fields) {\n if (f.name === skip || (f.type !== \"url\" && f.type !== \"email\" && f.type !== \"slug\")) continue;\n const t = plainText(v[f.name]);\n if (t) return { name: f.name, text: t };\n }\n return undefined;\n}\nexport function previewOf(itemSchema: FieldSchema | TypeSchema | undefined, item: unknown, index: number, fallbackTitle?: string): Preview {\n const v = isObj(item) ? item : {};\n const fields = (itemSchema && \"fields\" in itemSchema ? itemSchema.fields : undefined) ?? [];\n const cfg = itemSchema?.preview;\n const at = (p: string) => fieldText(fields.find((f) => f.name === p), getIn(v, p.split(\".\")));\n // what the row picks for itself never comes from a hidden field (a decorative chevron or icon); a named path still reads\n const shown = fields.filter((f) => f.hidden !== true);\n let title = cfg?.title ? at(cfg.title) : \"\";\n let titleField = cfg?.title;\n if (!title) {\n const t = firstText(shown, v);\n title = t?.text ?? \"\";\n titleField = t?.name;\n }\n let subtitle = cfg?.subtitle ? at(cfg.subtitle) : \"\";\n if (!subtitle && !cfg?.subtitle) subtitle = firstText(shown, v, titleField)?.text ?? \"\";\n let media = cfg?.media ? imageUrl(getIn(v, cfg.media.split(\".\"))) : undefined;\n if (!media && !cfg?.media) {\n const img = shown.find((f) => f.type === \"image\");\n if (img) media = imageUrl(v[img.name]);\n }\n const empty = !title;\n const noun = fallbackTitle ?? (itemSchema?.title ?? \"Item\");\n return {\n title: title || cfg?.fallback || `${noun} ${index + 1}`,\n subtitle: subtitle ? (subtitle.length > 90 ? `${subtitle.slice(0, 88)}…` : subtitle) : undefined,\n media,\n icon: cfg?.icon ?? (itemSchema as FieldSchema | undefined)?.icon,\n empty,\n };\n}\n\n/**\n * How one slot child reads as a row (SlotField): its block's preview (the block's title while it has no text), the\n * variant chip its `_variant` names, and the line under it (block title · settings, else description, else \"Block i of n\").\n */\nexport function slotRowOf(block: TypeSchema | undefined, item: unknown, index: number, count: number, slotSettings?: FieldSchema[]): { preview: Preview; chip?: string; extra: string } {\n const pv = previewOf(block, item, index, block?.title ?? \"Block\");\n const variant = block?.variants?.find((v) => isObj(item) && v.id === item._variant)?.name;\n const settings = slotSettings && isObj(item) ? summarize(slotSettings, item._settings, 2) : \"\";\n return {\n preview: { ...pv, title: pv.empty ? (block?.title ?? \"Unknown block\") : pv.title, icon: block?.icon ?? \"box\" },\n chip: variant,\n extra: [pv.empty ? undefined : block?.title, settings].filter(Boolean).join(\" · \") || block?.description || `Block ${index + 1} of ${count}`,\n };\n}\n\n/** \"Cast iron · 4 items\" — one-line summary of an object for collapsed rows and fieldset headers. */\nexport function summarize(fields: FieldSchema[], v: unknown, max = 2): string {\n if (!isObj(v)) return \"\";\n const parts: string[] = [];\n for (const f of fields) {\n if (parts.length >= max) break;\n const x = v[f.name];\n if (isEmptyValue(x)) continue;\n if (f.type === \"reference\" || f.type === \"json\" || f.type === \"code\" || f.type === \"image\" || f.type === \"file\") continue; // ids and blobs read badly\n if (f.type === \"table\") {\n parts.push(tableSummary(x));\n continue;\n }\n if (f.type === \"rating\" && typeof x === \"number\") {\n parts.push(`${x} / 5`);\n continue;\n }\n if (Array.isArray(x)) parts.push(`${x.length} ${x.length === 1 ? itemNounSafe(f) : `${itemNounSafe(f)}s`}`);\n else if (typeof x === \"boolean\") parts.push(`${f.title}: ${x ? \"on\" : \"off\"}`);\n else {\n const t = fieldText(f, x);\n if (t) parts.push(t.length > 40 ? `${t.slice(0, 38)}…` : t);\n }\n }\n return parts.join(\" · \");\n}\nconst itemNounSafe = (f: FieldSchema) => (f.type === \"array\" || f.type === \"slot\" ? itemNoun(f) : \"item\");\n"],"mappings":";;;AAOA,IAAM,6BAAsC,IAAI,IAAmB;CACjE;CAAU;CAAQ;CAAY;CAAU;CAAW;CAAQ;CAAO;CAAS;CAAQ;CAAY;CAAS;CAAU;CAClH;CAAQ;CAAS;CAAQ;CAAS;CAAQ;CAAQ;CAAU;CAAa;CAAQ;CAAQ;CAAY;CAAU;AACjH,CAAC;AACD,IAAa,eAAe,MAAkB,WAAW,IAAI,CAAC;;AAE9D,IAAa,aAAa,MAAkB,MAAM,YAAY,MAAM,UAAU,MAAM,cAAc,MAAM,UAAU,MAAM,SAAS,MAAM;;AAEvI,IAAM,4BAAqC,IAAI,IAAI;CAAC;CAAU;CAAU;CAAW;CAAU;CAAS;CAAQ;CAAO;CAAS;CAAQ;CAAU;AAAM,CAAC;AAEvJ,IAAa,eAAe,MAAmC,MAAM,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC;AAC7F,IAAa,aAAa,MAA0C,EAAE,MAAM,CAAC,MAAM,QAAQ,EAAE,EAAE,IAAI,EAAE,GAAG,QAAQ,KAAA;AAChH,IAAa,iBA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GAAG,EAAE,WAAW,IAAI,aAAa,CAAC,IAAI,GAAG,aAAa,CAAC,EAAE,IAAI;OACrG,IAAI,OAAO,MAAM,WAAW,MAAM,KAAK,GAAG,EAAE,MAAM,IAAI,IAAI,OAAO,OAAO;OACxE;GACH,MAAM,IAAI,UAAU,GAAG,CAAC;GACxB,IAAI,GAAG,MAAM,KAAK,EAAE,SAAS,KAAK,GAAG,EAAE,MAAM,GAAG,EAAE,EAAE,KAAK,CAAC;EAC5D;CACF;CACA,OAAO,MAAM,KAAK,KAAK;AACzB;AACA,IAAM,gBAAgB,MAAoB,EAAE,SAAS,WAAW,EAAE,SAAS,SAAS,SAAS,CAAC,IAAI"}
@@ -148,7 +148,8 @@
148
148
  "lead",
149
149
  "band",
150
150
  "family",
151
- "shape"
151
+ "shape",
152
+ "staleRule"
152
153
  ]
153
154
  },
154
155
  "categories": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bettercms-ai/kit",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "The BetterCMS V2 Block Kit: schema language, form engine, controls and design tokens.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -73,7 +73,7 @@
73
73
  },
74
74
  "peerDependencies": {
75
75
  "@base-ui/react": "^1.4.1",
76
- "@bettercms-ai/types": "^1.60.0",
76
+ "@bettercms-ai/types": "^1.61.0",
77
77
  "@tabler/icons-react": "^3.48.0",
78
78
  "framer-motion": "^12.40.0",
79
79
  "react": "^19.2.0",