@bettercms-ai/kit 3.1.0 → 3.1.2
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.
- package/dist/adapters/lossy.d.ts +1 -1
- package/dist/adapters/lossy.js +3 -2
- package/dist/adapters/lossy.js.map +1 -1
- package/dist/adapters/prod-types.d.ts +3 -0
- package/dist/adapters/prod-types.js.map +1 -1
- package/dist/adapters/schema.js +8 -5
- package/dist/adapters/schema.js.map +1 -1
- package/dist/adapters/values.d.ts +5 -4
- package/dist/adapters/values.js +13 -11
- package/dist/adapters/values.js.map +1 -1
- package/dist/controls/media.d.ts +1 -1
- package/dist/controls/media.js.map +1 -1
- package/dist/controls/rich-text/editor.js +19 -6
- package/dist/controls/rich-text/editor.js.map +1 -1
- package/dist/controls/rich-text/toolbar.js +1 -1
- package/dist/controls/rich-text/toolbar.js.map +1 -1
- package/dist/engine/array.d.ts +2 -0
- package/dist/engine/array.js +8 -3
- package/dist/engine/array.js.map +1 -1
- package/dist/engine/slot.d.ts +10 -1
- package/dist/engine/slot.js +38 -7
- package/dist/engine/slot.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/lib/validate.d.ts +1 -0
- package/dist/lib/validate.js +14 -1
- package/dist/lib/validate.js.map +1 -1
- package/dist/library/kit-catalog.json +2 -1
- package/package.json +2 -2
|
@@ -92,16 +92,17 @@ export declare function cropRect(crop: V2ImageCrop, width: number, height: numbe
|
|
|
92
92
|
}): ProdImageCrop | undefined;
|
|
93
93
|
/** A stored rect → the preset whose aspect it cuts (within 1%), when the image's pixel size is known. */
|
|
94
94
|
export declare function cropPreset(rect: ProdImageCrop, width: number, height: number): V2ImageCrop | undefined;
|
|
95
|
-
/** The asset facts an image value refers to
|
|
95
|
+
/** The asset facts an image value refers to: its size in bytes lives only on the asset; width and height are stored on the value too (BL-587). */
|
|
96
96
|
export interface ImageAsset {
|
|
97
97
|
width?: number;
|
|
98
98
|
height?: number;
|
|
99
99
|
size?: number;
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
|
-
* The contract holds against `imageFromProd(value)` with no asset (how stored defaults are read): a crop
|
|
103
|
-
*
|
|
104
|
-
* `lost`. Passing the asset to imageFromProd
|
|
102
|
+
* The contract holds against `imageFromProd(value)` with no asset (how stored defaults are read): a crop preset is cut
|
|
103
|
+
* into the rect prod stores against the value's pixel size, width and height are written on the value (BL-587), and
|
|
104
|
+
* size lives on the asset alone, so only it (and a caption) is named in `lost`. Passing the asset to imageFromProd
|
|
105
|
+
* restores the size and reads the rect back as its preset.
|
|
105
106
|
*/
|
|
106
107
|
export declare function imageToProd(v: V2ImageValue | string | null | undefined): ValueResult<ProdImageValue | string | null>;
|
|
107
108
|
/** A crop window as prod stores it: four 0–1 edges that leave something on both axes. */
|
package/dist/adapters/values.js
CHANGED
|
@@ -202,9 +202,10 @@ function cropPreset(rect, width, height) {
|
|
|
202
202
|
return Object.entries(CROPS).find(([, r]) => Math.abs(ratio - r) / r < .01)?.[0];
|
|
203
203
|
}
|
|
204
204
|
/**
|
|
205
|
-
* The contract holds against `imageFromProd(value)` with no asset (how stored defaults are read): a crop
|
|
206
|
-
*
|
|
207
|
-
* `lost`. Passing the asset to imageFromProd
|
|
205
|
+
* The contract holds against `imageFromProd(value)` with no asset (how stored defaults are read): a crop preset is cut
|
|
206
|
+
* into the rect prod stores against the value's pixel size, width and height are written on the value (BL-587), and
|
|
207
|
+
* size lives on the asset alone, so only it (and a caption) is named in `lost`. Passing the asset to imageFromProd
|
|
208
|
+
* restores the size and reads the rect back as its preset.
|
|
208
209
|
*/
|
|
209
210
|
function imageToProd(v) {
|
|
210
211
|
if (v == null) return {
|
|
@@ -235,12 +236,9 @@ function imageToProd(v) {
|
|
|
235
236
|
if (rect) out.crop = rect;
|
|
236
237
|
else lost.push("crop");
|
|
237
238
|
}
|
|
238
|
-
for (const k of [
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
"height",
|
|
242
|
-
"size"
|
|
243
|
-
]) if (v[k] !== void 0) lost.push(k);
|
|
239
|
+
for (const k of ["width", "height"]) if (side(v[k])) out[k] = v[k];
|
|
240
|
+
for (const k of ["caption", "size"]) if (v[k] !== void 0) lost.push(k);
|
|
241
|
+
for (const k of ["width", "height"]) if (v[k] !== void 0 && !side(v[k])) lost.push(k);
|
|
244
242
|
for (const k of Object.keys(v)) if (![
|
|
245
243
|
"url",
|
|
246
244
|
"id",
|
|
@@ -258,6 +256,8 @@ function imageToProd(v) {
|
|
|
258
256
|
lost
|
|
259
257
|
};
|
|
260
258
|
}
|
|
259
|
+
/** A width or height in pixels: positive and finite. */
|
|
260
|
+
var side = (n) => typeof n === "number" && Number.isFinite(n) && n > 0;
|
|
261
261
|
/** A crop window as prod stores it: four 0–1 edges that leave something on both axes. */
|
|
262
262
|
function isCropRect(v) {
|
|
263
263
|
if (!isObj(v)) return false;
|
|
@@ -285,8 +285,10 @@ function imageFromProd(v, asset = {}) {
|
|
|
285
285
|
y: round(p.focal.y * 100)
|
|
286
286
|
};
|
|
287
287
|
if (isCropRect(p.crop)) out.crop = (asset.width && asset.height ? cropPreset(p.crop, asset.width, asset.height) : void 0) ?? { ...p.crop };
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
const width = asset.width ?? (side(p.width) ? p.width : void 0);
|
|
289
|
+
const height = asset.height ?? (side(p.height) ? p.height : void 0);
|
|
290
|
+
if (width !== void 0) out.width = width;
|
|
291
|
+
if (height !== void 0) out.height = height;
|
|
290
292
|
if (asset.size !== void 0) out.size = asset.size;
|
|
291
293
|
return out;
|
|
292
294
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"values.js","names":[],"sources":["../../src/adapters/values.ts"],"sourcesContent":["/**\n * VALUE ADAPTERS — a V2 stored value ↔ the value production stores for the same field (Lane C map,\n * docs/design-system/v2-map/C-controls.md §2, updated for F1). Storage stays prod's: `*ToProd` returns what the\n * backend accepts, `*FromProd` the V2 shape the kit controls edit.\n *\n * Every `*ToProd` returns `{ value, lost }`. `lost` names the V2 keys prod cannot keep (relative to the value), so\n * `*FromProd(*ToProd(v).value)` equals `v` minus exactly those keys. Nothing is dropped without being named.\n */\nimport type { ScaleSchema, ScaleValue } from \"../schema/types\";\nimport type { TableValue } from \"../schema/table\";\nimport {\n BUTTON_SIZES,\n BUTTON_VARIANTS,\n CODE_MAX_LENGTH,\n DOCK_ICON_NAME_SET,\n LINK_RELS,\n LINK_VALUE_TYPES,\n RATING_DEFAULT_MAX,\n TAG_VALUE_MAX_LENGTH,\n VIDEO_TRANSCRIPT_MAX,\n VIDEO_VALUE_KEYS,\n type DockIconName,\n type ProdButtonValue,\n type ProdFormRef,\n type ProdImageCrop,\n type ProdImageValue,\n type ProdLinkValue,\n type ProdPolymorphicRef,\n type ProdTargetRef,\n type ProdVideoValue,\n type ScaleUnit,\n} from \"./prod-types\";\n\nexport interface ValueResult<T> {\n value: T;\n /** V2 keys (dotted, relative to the value) production cannot keep. */\n lost: string[];\n}\n\ntype Obj = Record<string, unknown>;\nconst isObj = (v: unknown): v is Obj => !!v && typeof v === \"object\" && !Array.isArray(v);\n\n/* ── V2 value shapes (DESIGN §6.7, §6.9; V2 HEAD controls/link.tsx, controls/media.tsx) ── */\nexport type V2LinkType = \"page\" | \"entry\" | \"url\" | \"section\" | \"email\" | \"phone\" | \"file\";\nexport type V2ButtonStyle = \"primary\" | \"secondary\" | \"outline\" | \"link\";\nexport interface V2LinkValue {\n type?: V2LinkType;\n href: string;\n label?: string;\n title?: string;\n pageId?: string;\n entryId?: string;\n anchor?: string;\n assetId?: string;\n email?: string;\n subject?: string;\n phone?: string;\n target?: \"_self\" | \"_blank\";\n newTab?: boolean;\n rel?: \"follow\" | \"nofollow\" | \"ugc\" | \"sponsored\";\n}\nexport interface V2ButtonValue extends V2LinkValue {\n style?: V2ButtonStyle;\n variant?: V2ButtonStyle;\n size?: \"sm\" | \"md\" | \"lg\";\n arrow?: boolean;\n icon?: string;\n fullWidth?: boolean;\n}\nexport type V2ImageCrop = \"original\" | \"16:9\" | \"4:3\" | \"1:1\" | \"4:5\";\nexport interface V2ImageValue {\n url: string;\n alt?: string;\n /** percent */\n focal?: { x: number; y: number };\n /** A preset to cut (written as its rect, so it needs the size), or the stored rect itself, carried as it was read. */\n crop?: V2ImageCrop | ProdImageCrop;\n caption?: string;\n name?: string;\n width?: number;\n height?: number;\n size?: number;\n id?: string;\n}\n\n/** The keys only a button carries; a link field never stores them. */\nconst BUTTON_ONLY = [\"style\", \"variant\", \"size\", \"arrow\", \"icon\", \"fullWidth\"] as const;\nconst isScriptHref = (href: string) => /^(javascript|data|vbscript):/i.test(href.replace(/[\\u0000- \\u007F]/g, \"\"));\n\n/* ── link ─────────────────────────────────────────────────────────────── */\n/**\n * F1 stores the V2 link object as sent (link-value.ts: the kit's pageId, entryId, anchor, email, phone, label… are\n * kept), plus `ref` for a page / entry link so delivery resolves it. A bare href string stays a string.\n */\nexport function linkToProd(v: V2LinkValue | string | null | undefined): ValueResult<ProdLinkValue | string | null> {\n if (v == null) return { value: null, lost: [] };\n if (typeof v === \"string\") return isScriptHref(v) ? { value: null, lost: [\"\"] } : { value: v, lost: [] };\n if (isScriptHref(v.href)) return { value: null, lost: [\"\"] };\n const lost: string[] = [];\n const out: Obj = {};\n for (const [k, x] of Object.entries(v)) {\n if ((BUTTON_ONLY as readonly string[]).includes(k)) lost.push(k);\n else out[k] = x;\n }\n if (v.type !== undefined && !(LINK_VALUE_TYPES as readonly string[]).includes(v.type)) {\n lost.push(\"type\");\n delete out.type;\n }\n // The backend refuses a target that disagrees with newTab; newTab is the one the kit reads.\n if (typeof v.newTab === \"boolean\" && v.target !== undefined && v.newTab !== (v.target === \"_blank\")) {\n lost.push(\"target\");\n delete out.target;\n }\n const ref = v.type === \"page\" ? v.pageId : v.type === \"entry\" ? v.entryId : undefined;\n if (ref) out.ref = ref;\n return { value: out as unknown as ProdLinkValue, lost };\n}\n\nexport function linkFromProd(v: unknown): V2LinkValue | string | null {\n if (typeof v === \"string\") return v;\n if (!isObj(v) || typeof v.href !== \"string\") return null;\n const { ref, ...rest } = v;\n const out = rest as unknown as V2LinkValue;\n // `ref` mirrors the kit's own id key; a ref with no twin (written by another client) becomes that key.\n if (typeof ref === \"string\") {\n if (out.type === \"page\" && out.pageId === undefined) out.pageId = ref;\n if (out.type === \"entry\" && out.entryId === undefined) out.entryId = ref;\n }\n return out;\n}\n\n/* ── button ───────────────────────────────────────────────────────────── */\n/**\n * A V2 button is a link with a label and a look, flattened. Prod's ButtonValue reads `label`, `href` (string or link\n * object), `variant`, `size`, `arrow`, `icon` (a dock icon name), `newTab`, `rel`; other keys are kept and ignored,\n * so the link half (type, pageId, anchor…) rides along as sent. The look is written as `variant` (what renderers read).\n */\nexport function buttonToProd(v: V2ButtonValue | null | undefined): ValueResult<ProdButtonValue | null> {\n if (v == null) return { value: null, lost: [] };\n if (typeof v.href === \"string\" && isScriptHref(v.href)) return { value: null, lost: [\"\"] };\n const lost: string[] = [];\n const out: Obj = { ...v };\n const valid = (x: unknown) => typeof x === \"string\" && (BUTTON_VARIANTS as readonly string[]).includes(x);\n // the first valid of variant, style is the look prod renders; an invalid variant never shadows a valid style\n const look = [v.variant, v.style].find(valid);\n if (look !== undefined) out.variant = look;\n else delete out.variant;\n if (v.variant !== undefined && !valid(v.variant)) lost.push(\"variant\");\n // Both set: the kit writes them in sync, prod keeps one look.\n if (v.style !== undefined && v.variant !== undefined && v.style === v.variant) lost.push(\"variant\");\n if (v.size !== undefined && !(BUTTON_SIZES as readonly string[]).includes(v.size)) {\n lost.push(\"size\");\n delete out.size;\n }\n if (v.icon !== undefined && !DOCK_ICON_NAME_SET.has(v.icon)) {\n lost.push(\"icon\");\n delete out.icon;\n }\n // A button's rel is one of nofollow / sponsored / ugc; \"follow\" is no rel at all.\n if (v.rel !== undefined && !(LINK_RELS as readonly string[]).includes(v.rel)) {\n lost.push(\"rel\");\n delete out.rel;\n }\n if (typeof v.newTab === \"boolean\" && v.target !== undefined && v.newTab !== (v.target === \"_blank\")) {\n lost.push(\"target\");\n delete out.target;\n }\n // fullWidth is true or false (the backend refuses anything else a write brings: button_full_width_invalid)\n if (v.fullWidth !== undefined && typeof v.fullWidth !== \"boolean\") {\n lost.push(\"fullWidth\");\n delete out.fullWidth;\n }\n // prod's ButtonValue requires both; a filled-in \"\" reads back where the kit had nothing, so it is named\n if (typeof out.label !== \"string\") {\n out.label = \"\";\n lost.push(\"label\");\n }\n if (typeof out.href !== \"string\") {\n out.href = \"\";\n lost.push(\"href\");\n }\n return { value: out as unknown as ProdButtonValue, lost: [...new Set(lost)] };\n}\n\nexport function buttonFromProd(v: unknown): V2ButtonValue | null {\n if (!isObj(v)) return null;\n const out: Obj = { ...v };\n if (isObj(v.href)) {\n // A link object in `href` (written by another client): flatten it the way the kit stores a button.\n const link = linkFromProd(v.href);\n if (isObj(link)) Object.assign(out, link);\n }\n if (out.style !== undefined && out.variant === out.style) delete out.variant;\n if (out.icon === null) delete out.icon;\n // An unfilled button: no label, and the bare \"#\" a new button block starts with (blockDefs button) or the classic\n // editor carries. It links nowhere, so it reads as V2's empty button (\"Add link\", a Page link), never as a link to a\n // section of this page. The \"\" it reads as is what an untouched form compares against, so opening it writes nothing.\n if ((out.label === undefined || out.label === \"\") && out.href === \"#\") out.href = \"\";\n return out as unknown as V2ButtonValue;\n}\n\n/* ── date / datetime ──────────────────────────────────────────────────── */\nconst ZONED = /^(.*)\\[([^\\]]+)\\]$/;\nconst NO_SECONDS = /^(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2})(Z|[+-]\\d{2}:?\\d{2})?$/;\nconst OFFSET = /(?:Z|[+-]\\d{2}:?\\d{2})$/;\n\n/** A date is the same \"YYYY-MM-DD\" string on both sides. */\nexport const dateToProd = (v: string | null | undefined): ValueResult<string | null> => ({ value: v ?? null, lost: [] });\nexport const dateFromProd = (v: unknown): string | null => (typeof v === \"string\" ? v : null);\n\n/**\n * V2 stores RFC 9557 (`2026-10-14T09:00:00+05:30[Asia/Kolkata]`). Prod keeps the ISO instant with seconds and its\n * offset; a `[Zone]` suffix is checked and dropped on write. So the zone survives only as the field's own\n * `config.timezone` when that names it (pass it as `zone`); otherwise it is lost.\n */\nexport function datetimeToProd(v: string | null | undefined, opts: { zone?: string } = {}): ValueResult<string | null> {\n if (v == null || v === \"\") return { value: v ?? null, lost: [] };\n const lost: string[] = [];\n const m = ZONED.exec(v);\n let bare = m ? m[1] : v;\n // the zone reads back only from config.timezone, and only onto a value with an offset\n if (m && (m[2] !== opts.zone || !OFFSET.test(bare))) lost.push(\"zone\");\n const short = NO_SECONDS.exec(bare);\n if (short) {\n bare = `${short[1]}:00${short[2] ?? \"\"}`;\n lost.push(\"format\");\n }\n return { value: bare, lost };\n}\n\nexport function datetimeFromProd(v: unknown, opts: { zone?: string } = {}): string | null {\n if (typeof v !== \"string\") return null;\n const zone = opts.zone && opts.zone !== \"site\" ? opts.zone : undefined;\n return zone && OFFSET.test(v) && !ZONED.test(v) ? `${v}[${zone}]` : v;\n}\n\n/* ── image ────────────────────────────────────────────────────────────── */\nconst CROPS: Record<Exclude<V2ImageCrop, \"original\">, number> = { \"16:9\": 16 / 9, \"4:3\": 4 / 3, \"1:1\": 1, \"4:5\": 4 / 5 };\nconst round = (n: number) => Math.round(n * 1e6) / 1e6;\nconst clamp01 = (n: number) => Math.min(1, Math.max(0, n));\n\n/** A crop preset → the centred-on-focal rect prod stores. Needs the image's pixel size. */\nexport function cropRect(crop: V2ImageCrop, width: number, height: number, focal = { x: 50, y: 50 }): ProdImageCrop | undefined {\n if (crop === \"original\" || !(width > 0 && height > 0)) return undefined;\n const want = CROPS[crop];\n const have = width / height;\n const w = want < have ? want / have : 1;\n const h = want < have ? 1 : have / want;\n const left = clamp01(Math.min(1 - w, Math.max(0, focal.x / 100 - w / 2)));\n const top = clamp01(Math.min(1 - h, Math.max(0, focal.y / 100 - h / 2)));\n return { top: round(top), right: round(1 - left - w), bottom: round(1 - top - h), left: round(left) };\n}\n\n/** A stored rect → the preset whose aspect it cuts (within 1%), when the image's pixel size is known. */\nexport function cropPreset(rect: ProdImageCrop, width: number, height: number): V2ImageCrop | undefined {\n const w = (1 - rect.left - rect.right) * width;\n const h = (1 - rect.top - rect.bottom) * height;\n if (!(w > 0 && h > 0)) return undefined;\n const ratio = w / h;\n const hit = (Object.entries(CROPS) as [V2ImageCrop, number][]).find(([, r]) => Math.abs(ratio - r) / r < 0.01);\n return hit?.[0];\n}\n\n/** The asset facts an image value refers to but prod does not store in the value (width, height, size). */\nexport interface ImageAsset {\n width?: number;\n height?: number;\n size?: number;\n}\n\n/**\n * The contract holds against `imageFromProd(value)` with no asset (how stored defaults are read): a crop rect needs the\n * image's pixel size to read back as its preset, and width / height / size live on the asset, so all four are named in\n * `lost`. Passing the asset to imageFromProd restores them.\n */\nexport function imageToProd(v: V2ImageValue | string | null | undefined): ValueResult<ProdImageValue | string | null> {\n if (v == null) return { value: null, lost: [] };\n if (typeof v === \"string\") return { value: v, lost: [] };\n const lost: string[] = [];\n const out: ProdImageValue = { url: v.url };\n if (v.id !== undefined) out.id = v.id;\n if (v.name !== undefined) out.name = v.name;\n if (v.alt !== undefined) out.altText = v.alt;\n if (v.focal) out.focal = { x: round(v.focal.x / 100), y: round(v.focal.y / 100) };\n // A stored rect is carried as it was read (it reads back the same), a preset is cut against the picture's size, and\n // \"original\" is no crop at all. Only a preset with no size to cut against has nowhere to go.\n if (isCropRect(v.crop)) out.crop = { top: v.crop.top, right: v.crop.right, bottom: v.crop.bottom, left: v.crop.left };\n else if (typeof v.crop === \"string\" && v.crop !== \"original\") {\n const rect = v.width && v.height ? cropRect(v.crop, v.width, v.height, v.focal) : undefined;\n if (rect) out.crop = rect;\n else lost.push(\"crop\");\n }\n // The normaliser rebuilds the value from these keys; the rest is the asset's (width, height, size) or has no home.\n for (const k of [\"caption\", \"width\", \"height\", \"size\"] as const) if (v[k] !== undefined) lost.push(k);\n for (const k of Object.keys(v)) if (![\"url\", \"id\", \"name\", \"alt\", \"focal\", \"crop\", \"caption\", \"width\", \"height\", \"size\"].includes(k)) lost.push(k);\n return { value: out, lost };\n}\n\n/** A crop window as prod stores it: four 0–1 edges that leave something on both axes. */\nexport function isCropRect(v: unknown): v is ProdImageCrop {\n if (!isObj(v)) return false;\n const { top, right, bottom, left } = v as Record<string, unknown>;\n const num = (n: unknown): n is number => typeof n === \"number\" && Number.isFinite(n) && n >= 0 && n <= 1;\n return num(top) && num(right) && num(bottom) && num(left) && top + bottom < 1 && left + right < 1;\n}\n\n/**\n * Pass the asset's pixel size to read a stored crop rect back as its preset and to restore width / height / size.\n * An older value written as `{ src, alt }` (the block's own image props) reads as the same picture and alt text.\n */\nexport function imageFromProd(v: unknown, asset: ImageAsset = {}): V2ImageValue | string | null {\n if (typeof v === \"string\") return v;\n if (!isObj(v)) return null;\n const url = typeof v.url === \"string\" ? v.url : typeof v.src === \"string\" ? v.src : null;\n if (url === null) return null;\n const p = v as unknown as ProdImageValue & { alt?: unknown };\n const out: V2ImageValue = { url };\n if (p.id !== undefined) out.id = p.id;\n if (p.name !== undefined) out.name = p.name;\n if (p.altText !== undefined) out.alt = p.altText;\n else if (typeof p.alt === \"string\") out.alt = p.alt;\n if (p.focal) out.focal = { x: round(p.focal.x * 100), y: round(p.focal.y * 100) };\n if (isCropRect(p.crop)) {\n const preset = asset.width && asset.height ? cropPreset(p.crop, asset.width, asset.height) : undefined;\n out.crop = preset ?? { ...p.crop };\n }\n if (asset.width !== undefined) out.width = asset.width;\n if (asset.height !== undefined) out.height = asset.height;\n if (asset.size !== undefined) out.size = asset.size;\n return out;\n}\n\n/* ── reference ────────────────────────────────────────────────────────── */\n/**\n * A V2 reference value is the target's id. Prod reads a bare id as an ENTRY on a prop reference that takes entries\n * (backend acceptsEntries), so a page, form or collection picked there travels in the kit as `\"<kind>:<id>\"` (the\n * dock's reference services hand such picks back tagged) and is stored as `{ kind, id }` (targetRefOf). A stored\n * `{ kind, id }` reads back tagged, whatever the field takes, so a save writes the same target back.\n */\nconst TARGET_TAG = /^(page|form|collection):(.+)$/;\nexport const targetTag = (kind: ProdTargetRef[\"kind\"], id: string): string => `${kind}:${id}`;\nexport function parseTargetTag(v: string): ProdTargetRef | null {\n const m = TARGET_TAG.exec(v);\n return m ? { kind: m[1] as ProdTargetRef[\"kind\"], id: m[2] } : null;\n}\nconst isTargetRef = (v: unknown): v is ProdTargetRef =>\n isObj(v) && typeof v.kind === \"string\" && TARGET_TAG.test(`${v.kind}:x`) && typeof v.id === \"string\" && v.id !== \"\";\n\n/**\n * V2 stores the target id (`\"en_12\"`; a list for many). Prod stores the same id, or `{ entryId, modelSlug }` on a\n * polymorphic field (pass `modelSlug`), or `{ formId }` on a component `form` prop (`to: \"form\"`), or `{ kind, id }` for\n * a tagged page / form / collection pick (`\"page:pg_1\"`).\n */\nexport function referenceToProd(\n v: string | string[] | null | undefined,\n opts: { to?: \"form\"; modelSlug?: string } = {},\n): ValueResult<string | (string | ProdTargetRef)[] | ProdPolymorphicRef | ProdFormRef | ProdTargetRef | null> {\n if (v == null || v === \"\") return { value: null, lost: [] };\n if (Array.isArray(v)) return { value: v.map((x) => parseTargetTag(x) ?? x), lost: [] };\n if (opts.to === \"form\") return { value: { formId: v }, lost: [] };\n const target = parseTargetTag(v);\n if (target) return { value: target, lost: [] };\n if (opts.modelSlug) return { value: { entryId: v, modelSlug: opts.modelSlug }, lost: [] };\n return { value: v, lost: [] };\n}\n\nconst refId = (v: unknown): string | null =>\n typeof v === \"string\"\n ? v || null\n : isTargetRef(v)\n ? targetTag(v.kind, v.id)\n : isObj(v)\n ? ((typeof v.entryId === \"string\" && v.entryId) || (typeof v.formId === \"string\" && v.formId) || null)\n : null;\n\nexport function referenceFromProd(v: unknown): string | string[] | null {\n if (Array.isArray(v)) return v.map(refId).filter((x): x is string => !!x);\n return refId(v);\n}\n\n/* ── table ────────────────────────────────────────────────────────────── */\n/**\n * Prod has no table type: the schema adapter stores a V2 table as a `json` field (named in the lossy ledger), and\n * `json` keeps any JSON value, so the TableValue itself is stored verbatim (typed columns, groups, footer,\n * footnotes, caption, design, jsonLd).\n */\nexport function tableToProd(v: TableValue | null | undefined): ValueResult<TableValue | null> {\n return { value: v == null ? null : (JSON.parse(JSON.stringify(v)) as TableValue), lost: [] };\n}\nexport const tableFromProd = (v: unknown): TableValue | null => (isObj(v) ? (v as unknown as TableValue) : null);\n\n/* ── scale ────────────────────────────────────────────────────────────── */\nconst SCALE_UNITS: readonly ScaleUnit[] = [\"px\", \"%\", \"rem\", \"em\", \"vw\", \"vh\"];\n/**\n * Prod stores the three V2 scale shapes as they are (CPO D41, reference-validation.ts scaleValueProblem): a bare number,\n * a token step's string, a custom `{ value, unit }`. Pass the field's scale: a token it does not list, or a custom value\n * it does not allow (allowCustom off, a unit outside its units, past its bounds), is refused by the backend, so it is\n * not written (`lost: [\"\"]`). With no scale only a number is known to fit.\n */\nexport function scaleToProd(v: ScaleValue | null | undefined, scale?: ScaleSchema): ValueResult<ScaleValue | null> {\n if (v == null) return { value: null, lost: [] };\n if (typeof v === \"number\") return Number.isFinite(v) ? { value: v, lost: [] } : { value: null, lost: [\"\"] };\n const refused = { value: null, lost: [\"\"] };\n if (!scale) return refused;\n if (typeof v === \"string\") return Array.isArray(scale.steps) && scale.steps.some((x) => x.value === v) ? { value: v, lost: [] } : refused;\n if (!isObj(v) || !scale.allowCustom || typeof v.value !== \"number\" || !Number.isFinite(v.value) || Object.keys(v).some((k) => k !== \"value\" && k !== \"unit\")) return refused;\n const custom = typeof scale.allowCustom === \"object\" ? scale.allowCustom : {};\n const units = custom.units ?? scale.units ?? SCALE_UNITS;\n if (!units.includes(v.unit)) return refused;\n const bound = (b: number | Partial<Record<ScaleUnit, number>> | undefined) => (typeof b === \"number\" ? b : b?.[v.unit]);\n const min = bound(custom.min);\n const max = bound(custom.max);\n if ((min !== undefined && v.value < min) || (max !== undefined && v.value > max)) return refused;\n return { value: { value: v.value, unit: v.unit }, lost: [] };\n}\nexport function scaleFromProd(v: unknown): ScaleValue | null {\n if (typeof v === \"number\") return Number.isFinite(v) ? v : null;\n if (typeof v === \"string\") return v;\n if (isObj(v) && typeof v.value === \"number\" && typeof v.unit === \"string\" && (SCALE_UNITS as readonly string[]).includes(v.unit)) return { value: v.value, unit: v.unit as ScaleUnit };\n return null;\n}\n\n/* ── video ────────────────────────────────────────────────────────────── */\nexport type V2VideoValue = string | { url: string; poster?: string; autoplay?: boolean; loop?: boolean; transcript?: string };\n/** An http(s) URL or a site path; \"\" is an unset one (video-value.ts isVideoUrl). */\nconst isVideoUrl = (s: string) => s === \"\" || /^https?:\\/\\/[^\\s]+$/i.test(s.trim()) || /^\\/(?!\\/)\\S*$/.test(s.trim());\n/**\n * The V2 video value and prod's are the same shape: a URL string, or `{ url, poster?, autoplay?, loop?, transcript? }`\n * (the video block's props). The backend refuses any other key, and a url or poster that is not an http(s) URL or a\n * site path (video_value_invalid): another key is left out and named, a bad url refuses the value whole.\n */\nexport function videoToProd(v: V2VideoValue | null | undefined): ValueResult<ProdVideoValue | string | null> {\n if (v == null) return { value: null, lost: [] };\n if (typeof v === \"string\") return isVideoUrl(v) ? { value: v, lost: [] } : { value: null, lost: [\"\"] };\n if (!isObj(v) || typeof v.url !== \"string\" || !isVideoUrl(v.url)) return { value: null, lost: [\"\"] };\n const lost: string[] = [];\n const out: Obj = {};\n for (const [k, x] of Object.entries(v)) {\n const ok =\n !(VIDEO_VALUE_KEYS as readonly string[]).includes(k) ? false\n : k === \"url\" ? true\n : k === \"poster\" ? typeof x === \"string\" && isVideoUrl(x)\n : k === \"transcript\" ? typeof x === \"string\" && x.length <= VIDEO_TRANSCRIPT_MAX\n : typeof x === \"boolean\";\n if (ok) out[k] = x;\n else if (x !== undefined) lost.push(k);\n }\n return { value: out as unknown as ProdVideoValue, lost };\n}\nexport function videoFromProd(v: unknown): V2VideoValue | null {\n if (typeof v === \"string\") return v;\n if (!isObj(v) || typeof v.url !== \"string\") return null;\n return { ...v } as V2VideoValue;\n}\n\n/* ── primitive lists ──────────────────────────────────────────────────── */\nexport type ListItemType = \"text\" | \"number\" | \"date\" | \"image\" | \"link\" | \"richtext\";\n/**\n * A V2 list of one primitive (`of: [{ type }]`) is a prod `array` with `config.itemType`, each item judged and normalized\n * as a field of its type: an image item stores prod's image keys (altText, 0–1 focal), a link item its stored link. Scalar\n * and rich text items pass as they are. `lost` names `<index>/<key>` (or `<index>` for a whole item) per item.\n */\nexport function listToProd(v: unknown, itemType: ListItemType): ValueResult<unknown[] | null> {\n if (v == null) return { value: null, lost: [] };\n if (!Array.isArray(v)) return { value: null, lost: [\"\"] };\n const lost: string[] = [];\n const out: unknown[] = [];\n v.forEach((x, i) => {\n const r = itemType === \"image\" ? imageToProd(x as V2ImageValue) : itemType === \"link\" ? linkToProd(x as V2LinkValue) : { value: x, lost: [] };\n for (const l of r.lost) lost.push(l ? `${i}/${l}` : String(i));\n out.push(r.value);\n });\n return { value: out, lost };\n}\nexport function listFromProd(v: unknown, itemType: ListItemType): unknown[] {\n if (!Array.isArray(v)) return [];\n return itemType === \"image\" ? v.map((x) => imageFromProd(x)) : itemType === \"link\" ? v.map((x) => linkFromProd(x)) : [...v];\n}\n\n/* ── tags ─────────────────────────────────────────────────────────────── */\n/**\n * The backend judges tags trimmed and case-insensitively (reference-validation.ts tagsValueProblem): a field write\n * trims and de-dupes, a prop value is refused (tags_value_invalid). So the value is written clean for both: trimmed,\n * first spelling of a case-repeat kept, and an empty, over-long, off-list (`allowCustom: false`) or over-`max` tag left\n * out. `lost` names each changed or dropped tag by its index in `v`.\n */\nexport function tagsToProd(\n v: string[] | null | undefined,\n opts: { max?: number; allowCustom?: boolean; options?: (string | { value: string })[] } = {},\n): ValueResult<string[] | null> {\n if (v == null) return { value: null, lost: [] };\n const allowed = opts.allowCustom === false ? new Set((opts.options ?? []).map((o) => (typeof o === \"string\" ? o : o.value).trim().toLowerCase())) : undefined;\n const out: string[] = [];\n const seen = new Set<string>();\n const lost: string[] = [];\n v.forEach((x, i) => {\n const t = typeof x === \"string\" ? x.trim() : \"\";\n const folded = t.toLowerCase();\n const keep =\n t !== \"\" && Array.from(t).length <= TAG_VALUE_MAX_LENGTH && !seen.has(folded) && (!allowed || allowed.has(folded)) && (opts.max === undefined || out.length < opts.max);\n if (keep) {\n seen.add(folded);\n out.push(t);\n }\n if (!keep || t !== x) lost.push(String(i));\n });\n return { value: out, lost };\n}\nexport const tagsFromProd = (v: unknown): string[] => (Array.isArray(v) ? v.filter((x): x is string => typeof x === \"string\") : []);\n\n/* ── rating ───────────────────────────────────────────────────────────── */\nexport interface RatingScale {\n min?: number;\n max?: number;\n step?: number;\n}\n/**\n * A prod rating runs from config.min (0 unset) to config.max (5 unset) in steps of config.step (1 unset), and 0 is \"not\n * rated\" on every scale (validation-parity.ts ratingScale / onRatingScale). V2's empty rating is null: it is written as\n * null, and any other number off the scale is refused by the backend (rating_value_invalid), so it is not written either.\n */\nexport function ratingToProd(v: number | null | undefined, opts: RatingScale = {}): ValueResult<number | null> {\n if (v == null) return { value: null, lost: [] };\n const min = opts.min ?? 0;\n const max = opts.max ?? RATING_DEFAULT_MAX;\n const step = opts.step ?? 1;\n const steps = (v - min) / step;\n const ok = Number.isFinite(v) && v >= min && v <= max && Math.abs(steps - Math.round(steps)) < 1e-9;\n return ok ? { value: v, lost: [] } : { value: null, lost: [\"\"] };\n}\n/** A stored number back; 0 on a scale that starts above it is prod's \"not rated\", which V2 holds as null. */\nexport function ratingFromProd(v: unknown, opts: RatingScale = {}): number | null {\n if (typeof v !== \"number\" || !Number.isFinite(v)) return null;\n return v === 0 && (opts.min ?? 0) > 0 ? null : v;\n}\n\n/* ── code ─────────────────────────────────────────────────────────────── */\nexport type V2CodeValue = string | { language?: string; code: string };\n/**\n * Prod stores a code value as a string, or `{ language?, code }` (no other key). A language outside the field's\n * `config.languages` is refused by the backend (code_value_invalid), so it is left out and named; a value over\n * CODE_MAX_LENGTH characters is refused whole.\n */\nexport function codeToProd(v: V2CodeValue | null | undefined, opts: { languages?: string[] } = {}): ValueResult<V2CodeValue | null> {\n if (v == null) return { value: null, lost: [] };\n const code = typeof v === \"string\" ? v : v.code;\n if (typeof code !== \"string\" || code.length > CODE_MAX_LENGTH) return { value: null, lost: [\"\"] };\n if (typeof v === \"string\") return { value: v, lost: [] };\n const lost = Object.keys(v).filter((k) => k !== \"code\" && k !== \"language\");\n const out: { language?: string; code: string } = { code };\n if (v.language !== undefined) {\n if (typeof v.language === \"string\" && (!opts.languages || opts.languages.includes(v.language))) out.language = v.language;\n else lost.push(\"language\");\n }\n return { value: out, lost };\n}\nexport function codeFromProd(v: unknown): V2CodeValue | null {\n if (typeof v === \"string\") return v;\n if (!isObj(v) || typeof v.code !== \"string\") return null;\n return typeof v.language === \"string\" ? { language: v.language, code: v.code } : { code: v.code };\n}\n\n/* ── zoned arrays ─────────────────────────────────────────────────────── */\n/** A V2 list of object items is stored by prod as the repeatable zone of its array: `{ repeatable: [...] }`. */\nexport const zoneListToProd = (v: unknown[] | null | undefined): { repeatable: unknown[] } => ({ repeatable: v ? [...v] : [] });\nexport const zoneListFromProd = (v: unknown): unknown[] => (isObj(v) && Array.isArray(v.repeatable) ? [...v.repeatable] : Array.isArray(v) ? [...v] : []);\n\n/* ── polymorphic list (prop table, config.mode \"types\") ─────────────── */\n/** A row of a polymorphic list: V2's and prod's shape alike, `{ _key?, _type, ...fields }` (BE prop-fields typedRowIssues). */\nexport type TypedRow = Record<string, unknown> & { _type: string; _key?: string };\nconst isTypedRow = (v: unknown): v is TypedRow => isObj(v) && typeof v._type === \"string\" && v._type !== \"\";\n\n/**\n * V2 rows → the stored rows. Prod keeps V2's own row shape, so a row passes as it is after `mapRow` (its fields through\n * their plans); a row with no `_type` has no item type to be judged by (item_type_required) and is named, by index.\n */\nexport function typedRowsToProd(v: unknown, mapRow: (row: TypedRow, i: number) => Record<string, unknown> = (r) => ({ ...r })): ValueResult<unknown> {\n if (v == null) return { value: v ?? null, lost: [] };\n if (!Array.isArray(v)) return { value: v, lost: [\"(value)\"] };\n const lost: string[] = [];\n const value = v.map((row, i) => {\n if (isTypedRow(row)) return mapRow(row, i);\n lost.push(String(i));\n return row;\n });\n return { value, lost };\n}\n\n/** Stored rows → V2 rows: the same shape, each row through `mapRow`; a row that is not typed passes as stored. */\nexport function typedRowsFromProd(v: unknown, mapRow: (row: TypedRow, i: number) => Record<string, unknown> = (r) => ({ ...r })): unknown {\n if (!Array.isArray(v)) return v;\n return v.map((row, i) => (isTypedRow(row) ? mapRow(row, i) : row));\n}\n\n/** A dock icon name passes through; anything else is not a prod icon. */\nexport const isDockIcon = (v: unknown): v is DockIconName => typeof v === \"string\" && DOCK_ICON_NAME_SET.has(v);\n"],"mappings":";;AAwCA,IAAM,SAAS,MAAyB,CAAC,CAAC,KAAK,OAAO,MAAM,YAAY,CAAC,MAAM,QAAQ,CAAC;;AA8CxF,IAAM,cAAc;CAAC;CAAS;CAAW;CAAQ;CAAS;CAAQ;AAAW;AAC7E,IAAM,gBAAgB,SAAiB,gCAAgC,KAAK,KAAK,QAAQ,qBAAqB,EAAE,CAAC;;;;;AAOjH,SAAgB,WAAW,GAAwF;CACjH,IAAI,KAAK,MAAM,OAAO;EAAE,OAAO;EAAM,MAAM,CAAC;CAAE;CAC9C,IAAI,OAAO,MAAM,UAAU,OAAO,aAAa,CAAC,IAAI;EAAE,OAAO;EAAM,MAAM,CAAC,EAAE;CAAE,IAAI;EAAE,OAAO;EAAG,MAAM,CAAC;CAAE;CACvG,IAAI,aAAa,EAAE,IAAI,GAAG,OAAO;EAAE,OAAO;EAAM,MAAM,CAAC,EAAE;CAAE;CAC3D,MAAM,OAAiB,CAAC;CACxB,MAAM,MAAW,CAAC;CAClB,KAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,CAAC,GACnC,IAAK,YAAkC,SAAS,CAAC,GAAG,KAAK,KAAK,CAAC;MAC1D,IAAI,KAAK;CAEhB,IAAI,EAAE,SAAS,KAAA,KAAa,CAAE,iBAAuC,SAAS,EAAE,IAAI,GAAG;EACrF,KAAK,KAAK,MAAM;EAChB,OAAO,IAAI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G;;AAIA,IAAa,kBAAkB,OAAgE,EAAE,YAAY,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;AAC7H,IAAa,oBAAoB,MAA2B,MAAM,CAAC,KAAK,MAAM,QAAQ,EAAE,UAAU,IAAI,CAAC,GAAG,EAAE,UAAU,IAAI,MAAM,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;AAKvJ,IAAM,cAAc,MAA8B,MAAM,CAAC,KAAK,OAAO,EAAE,UAAU,YAAY,EAAE,UAAU;;;;;AAMzG,SAAgB,gBAAgB,GAAY,UAAiE,OAAO,EAAE,GAAG,EAAE,IAA0B;CACnJ,IAAI,KAAK,MAAM,OAAO;EAAE,OAAO,KAAK;EAAM,MAAM,CAAC;CAAE;CACnD,IAAI,CAAC,MAAM,QAAQ,CAAC,GAAG,OAAO;EAAE,OAAO;EAAG,MAAM,CAAC,SAAS;CAAE;CAC5D,MAAM,OAAiB,CAAC;CAMxB,OAAO;EAAE,OALK,EAAE,KAAK,KAAK,MAAM;GAC9B,IAAI,WAAW,GAAG,GAAG,OAAO,OAAO,KAAK,CAAC;GACzC,KAAK,KAAK,OAAO,CAAC,CAAC;GACnB,OAAO;EACT,CACS;EAAO;CAAK;AACvB;;AAGA,SAAgB,kBAAkB,GAAY,UAAiE,OAAO,EAAE,GAAG,EAAE,IAAa;CACxI,IAAI,CAAC,MAAM,QAAQ,CAAC,GAAG,OAAO;CAC9B,OAAO,EAAE,KAAK,KAAK,MAAO,WAAW,GAAG,IAAI,OAAO,KAAK,CAAC,IAAI,GAAI;AACnE;;AAGA,IAAa,cAAc,MAAkC,OAAO,MAAM,YAAY,mBAAmB,IAAI,CAAC"}
|
|
1
|
+
{"version":3,"file":"values.js","names":[],"sources":["../../src/adapters/values.ts"],"sourcesContent":["/**\n * VALUE ADAPTERS — a V2 stored value ↔ the value production stores for the same field (Lane C map,\n * docs/design-system/v2-map/C-controls.md §2, updated for F1). Storage stays prod's: `*ToProd` returns what the\n * backend accepts, `*FromProd` the V2 shape the kit controls edit.\n *\n * Every `*ToProd` returns `{ value, lost }`. `lost` names the V2 keys prod cannot keep (relative to the value), so\n * `*FromProd(*ToProd(v).value)` equals `v` minus exactly those keys. Nothing is dropped without being named.\n */\nimport type { ScaleSchema, ScaleValue } from \"../schema/types\";\nimport type { TableValue } from \"../schema/table\";\nimport {\n BUTTON_SIZES,\n BUTTON_VARIANTS,\n CODE_MAX_LENGTH,\n DOCK_ICON_NAME_SET,\n LINK_RELS,\n LINK_VALUE_TYPES,\n RATING_DEFAULT_MAX,\n TAG_VALUE_MAX_LENGTH,\n VIDEO_TRANSCRIPT_MAX,\n VIDEO_VALUE_KEYS,\n type DockIconName,\n type ProdButtonValue,\n type ProdFormRef,\n type ProdImageCrop,\n type ProdImageValue,\n type ProdLinkValue,\n type ProdPolymorphicRef,\n type ProdTargetRef,\n type ProdVideoValue,\n type ScaleUnit,\n} from \"./prod-types\";\n\nexport interface ValueResult<T> {\n value: T;\n /** V2 keys (dotted, relative to the value) production cannot keep. */\n lost: string[];\n}\n\ntype Obj = Record<string, unknown>;\nconst isObj = (v: unknown): v is Obj => !!v && typeof v === \"object\" && !Array.isArray(v);\n\n/* ── V2 value shapes (DESIGN §6.7, §6.9; V2 HEAD controls/link.tsx, controls/media.tsx) ── */\nexport type V2LinkType = \"page\" | \"entry\" | \"url\" | \"section\" | \"email\" | \"phone\" | \"file\";\nexport type V2ButtonStyle = \"primary\" | \"secondary\" | \"outline\" | \"link\";\nexport interface V2LinkValue {\n type?: V2LinkType;\n href: string;\n label?: string;\n title?: string;\n pageId?: string;\n entryId?: string;\n anchor?: string;\n assetId?: string;\n email?: string;\n subject?: string;\n phone?: string;\n target?: \"_self\" | \"_blank\";\n newTab?: boolean;\n rel?: \"follow\" | \"nofollow\" | \"ugc\" | \"sponsored\";\n}\nexport interface V2ButtonValue extends V2LinkValue {\n style?: V2ButtonStyle;\n variant?: V2ButtonStyle;\n size?: \"sm\" | \"md\" | \"lg\";\n arrow?: boolean;\n icon?: string;\n fullWidth?: boolean;\n}\nexport type V2ImageCrop = \"original\" | \"16:9\" | \"4:3\" | \"1:1\" | \"4:5\";\nexport interface V2ImageValue {\n url: string;\n alt?: string;\n /** percent */\n focal?: { x: number; y: number };\n /** A preset to cut (written as its rect, so it needs the size), or the stored rect itself, carried as it was read. */\n crop?: V2ImageCrop | ProdImageCrop;\n caption?: string;\n name?: string;\n width?: number;\n height?: number;\n size?: number;\n id?: string;\n}\n\n/** The keys only a button carries; a link field never stores them. */\nconst BUTTON_ONLY = [\"style\", \"variant\", \"size\", \"arrow\", \"icon\", \"fullWidth\"] as const;\nconst isScriptHref = (href: string) => /^(javascript|data|vbscript):/i.test(href.replace(/[\\u0000- \\u007F]/g, \"\"));\n\n/* ── link ─────────────────────────────────────────────────────────────── */\n/**\n * F1 stores the V2 link object as sent (link-value.ts: the kit's pageId, entryId, anchor, email, phone, label… are\n * kept), plus `ref` for a page / entry link so delivery resolves it. A bare href string stays a string.\n */\nexport function linkToProd(v: V2LinkValue | string | null | undefined): ValueResult<ProdLinkValue | string | null> {\n if (v == null) return { value: null, lost: [] };\n if (typeof v === \"string\") return isScriptHref(v) ? { value: null, lost: [\"\"] } : { value: v, lost: [] };\n if (isScriptHref(v.href)) return { value: null, lost: [\"\"] };\n const lost: string[] = [];\n const out: Obj = {};\n for (const [k, x] of Object.entries(v)) {\n if ((BUTTON_ONLY as readonly string[]).includes(k)) lost.push(k);\n else out[k] = x;\n }\n if (v.type !== undefined && !(LINK_VALUE_TYPES as readonly string[]).includes(v.type)) {\n lost.push(\"type\");\n delete out.type;\n }\n // The backend refuses a target that disagrees with newTab; newTab is the one the kit reads.\n if (typeof v.newTab === \"boolean\" && v.target !== undefined && v.newTab !== (v.target === \"_blank\")) {\n lost.push(\"target\");\n delete out.target;\n }\n const ref = v.type === \"page\" ? v.pageId : v.type === \"entry\" ? v.entryId : undefined;\n if (ref) out.ref = ref;\n return { value: out as unknown as ProdLinkValue, lost };\n}\n\nexport function linkFromProd(v: unknown): V2LinkValue | string | null {\n if (typeof v === \"string\") return v;\n if (!isObj(v) || typeof v.href !== \"string\") return null;\n const { ref, ...rest } = v;\n const out = rest as unknown as V2LinkValue;\n // `ref` mirrors the kit's own id key; a ref with no twin (written by another client) becomes that key.\n if (typeof ref === \"string\") {\n if (out.type === \"page\" && out.pageId === undefined) out.pageId = ref;\n if (out.type === \"entry\" && out.entryId === undefined) out.entryId = ref;\n }\n return out;\n}\n\n/* ── button ───────────────────────────────────────────────────────────── */\n/**\n * A V2 button is a link with a label and a look, flattened. Prod's ButtonValue reads `label`, `href` (string or link\n * object), `variant`, `size`, `arrow`, `icon` (a dock icon name), `newTab`, `rel`; other keys are kept and ignored,\n * so the link half (type, pageId, anchor…) rides along as sent. The look is written as `variant` (what renderers read).\n */\nexport function buttonToProd(v: V2ButtonValue | null | undefined): ValueResult<ProdButtonValue | null> {\n if (v == null) return { value: null, lost: [] };\n if (typeof v.href === \"string\" && isScriptHref(v.href)) return { value: null, lost: [\"\"] };\n const lost: string[] = [];\n const out: Obj = { ...v };\n const valid = (x: unknown) => typeof x === \"string\" && (BUTTON_VARIANTS as readonly string[]).includes(x);\n // the first valid of variant, style is the look prod renders; an invalid variant never shadows a valid style\n const look = [v.variant, v.style].find(valid);\n if (look !== undefined) out.variant = look;\n else delete out.variant;\n if (v.variant !== undefined && !valid(v.variant)) lost.push(\"variant\");\n // Both set: the kit writes them in sync, prod keeps one look.\n if (v.style !== undefined && v.variant !== undefined && v.style === v.variant) lost.push(\"variant\");\n if (v.size !== undefined && !(BUTTON_SIZES as readonly string[]).includes(v.size)) {\n lost.push(\"size\");\n delete out.size;\n }\n if (v.icon !== undefined && !DOCK_ICON_NAME_SET.has(v.icon)) {\n lost.push(\"icon\");\n delete out.icon;\n }\n // A button's rel is one of nofollow / sponsored / ugc; \"follow\" is no rel at all.\n if (v.rel !== undefined && !(LINK_RELS as readonly string[]).includes(v.rel)) {\n lost.push(\"rel\");\n delete out.rel;\n }\n if (typeof v.newTab === \"boolean\" && v.target !== undefined && v.newTab !== (v.target === \"_blank\")) {\n lost.push(\"target\");\n delete out.target;\n }\n // fullWidth is true or false (the backend refuses anything else a write brings: button_full_width_invalid)\n if (v.fullWidth !== undefined && typeof v.fullWidth !== \"boolean\") {\n lost.push(\"fullWidth\");\n delete out.fullWidth;\n }\n // prod's ButtonValue requires both; a filled-in \"\" reads back where the kit had nothing, so it is named\n if (typeof out.label !== \"string\") {\n out.label = \"\";\n lost.push(\"label\");\n }\n if (typeof out.href !== \"string\") {\n out.href = \"\";\n lost.push(\"href\");\n }\n return { value: out as unknown as ProdButtonValue, lost: [...new Set(lost)] };\n}\n\nexport function buttonFromProd(v: unknown): V2ButtonValue | null {\n if (!isObj(v)) return null;\n const out: Obj = { ...v };\n if (isObj(v.href)) {\n // A link object in `href` (written by another client): flatten it the way the kit stores a button.\n const link = linkFromProd(v.href);\n if (isObj(link)) Object.assign(out, link);\n }\n if (out.style !== undefined && out.variant === out.style) delete out.variant;\n if (out.icon === null) delete out.icon;\n // An unfilled button: no label, and the bare \"#\" a new button block starts with (blockDefs button) or the classic\n // editor carries. It links nowhere, so it reads as V2's empty button (\"Add link\", a Page link), never as a link to a\n // section of this page. The \"\" it reads as is what an untouched form compares against, so opening it writes nothing.\n if ((out.label === undefined || out.label === \"\") && out.href === \"#\") out.href = \"\";\n return out as unknown as V2ButtonValue;\n}\n\n/* ── date / datetime ──────────────────────────────────────────────────── */\nconst ZONED = /^(.*)\\[([^\\]]+)\\]$/;\nconst NO_SECONDS = /^(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2})(Z|[+-]\\d{2}:?\\d{2})?$/;\nconst OFFSET = /(?:Z|[+-]\\d{2}:?\\d{2})$/;\n\n/** A date is the same \"YYYY-MM-DD\" string on both sides. */\nexport const dateToProd = (v: string | null | undefined): ValueResult<string | null> => ({ value: v ?? null, lost: [] });\nexport const dateFromProd = (v: unknown): string | null => (typeof v === \"string\" ? v : null);\n\n/**\n * V2 stores RFC 9557 (`2026-10-14T09:00:00+05:30[Asia/Kolkata]`). Prod keeps the ISO instant with seconds and its\n * offset; a `[Zone]` suffix is checked and dropped on write. So the zone survives only as the field's own\n * `config.timezone` when that names it (pass it as `zone`); otherwise it is lost.\n */\nexport function datetimeToProd(v: string | null | undefined, opts: { zone?: string } = {}): ValueResult<string | null> {\n if (v == null || v === \"\") return { value: v ?? null, lost: [] };\n const lost: string[] = [];\n const m = ZONED.exec(v);\n let bare = m ? m[1] : v;\n // the zone reads back only from config.timezone, and only onto a value with an offset\n if (m && (m[2] !== opts.zone || !OFFSET.test(bare))) lost.push(\"zone\");\n const short = NO_SECONDS.exec(bare);\n if (short) {\n bare = `${short[1]}:00${short[2] ?? \"\"}`;\n lost.push(\"format\");\n }\n return { value: bare, lost };\n}\n\nexport function datetimeFromProd(v: unknown, opts: { zone?: string } = {}): string | null {\n if (typeof v !== \"string\") return null;\n const zone = opts.zone && opts.zone !== \"site\" ? opts.zone : undefined;\n return zone && OFFSET.test(v) && !ZONED.test(v) ? `${v}[${zone}]` : v;\n}\n\n/* ── image ────────────────────────────────────────────────────────────── */\nconst CROPS: Record<Exclude<V2ImageCrop, \"original\">, number> = { \"16:9\": 16 / 9, \"4:3\": 4 / 3, \"1:1\": 1, \"4:5\": 4 / 5 };\nconst round = (n: number) => Math.round(n * 1e6) / 1e6;\nconst clamp01 = (n: number) => Math.min(1, Math.max(0, n));\n\n/** A crop preset → the centred-on-focal rect prod stores. Needs the image's pixel size. */\nexport function cropRect(crop: V2ImageCrop, width: number, height: number, focal = { x: 50, y: 50 }): ProdImageCrop | undefined {\n if (crop === \"original\" || !(width > 0 && height > 0)) return undefined;\n const want = CROPS[crop];\n const have = width / height;\n const w = want < have ? want / have : 1;\n const h = want < have ? 1 : have / want;\n const left = clamp01(Math.min(1 - w, Math.max(0, focal.x / 100 - w / 2)));\n const top = clamp01(Math.min(1 - h, Math.max(0, focal.y / 100 - h / 2)));\n return { top: round(top), right: round(1 - left - w), bottom: round(1 - top - h), left: round(left) };\n}\n\n/** A stored rect → the preset whose aspect it cuts (within 1%), when the image's pixel size is known. */\nexport function cropPreset(rect: ProdImageCrop, width: number, height: number): V2ImageCrop | undefined {\n const w = (1 - rect.left - rect.right) * width;\n const h = (1 - rect.top - rect.bottom) * height;\n if (!(w > 0 && h > 0)) return undefined;\n const ratio = w / h;\n const hit = (Object.entries(CROPS) as [V2ImageCrop, number][]).find(([, r]) => Math.abs(ratio - r) / r < 0.01);\n return hit?.[0];\n}\n\n/** The asset facts an image value refers to: its size in bytes lives only on the asset; width and height are stored on the value too (BL-587). */\nexport interface ImageAsset {\n width?: number;\n height?: number;\n size?: number;\n}\n\n/**\n * The contract holds against `imageFromProd(value)` with no asset (how stored defaults are read): a crop preset is cut\n * into the rect prod stores against the value's pixel size, width and height are written on the value (BL-587), and\n * size lives on the asset alone, so only it (and a caption) is named in `lost`. Passing the asset to imageFromProd\n * restores the size and reads the rect back as its preset.\n */\nexport function imageToProd(v: V2ImageValue | string | null | undefined): ValueResult<ProdImageValue | string | null> {\n if (v == null) return { value: null, lost: [] };\n if (typeof v === \"string\") return { value: v, lost: [] };\n const lost: string[] = [];\n const out: ProdImageValue = { url: v.url };\n if (v.id !== undefined) out.id = v.id;\n if (v.name !== undefined) out.name = v.name;\n if (v.alt !== undefined) out.altText = v.alt;\n if (v.focal) out.focal = { x: round(v.focal.x / 100), y: round(v.focal.y / 100) };\n // A stored rect is carried as it was read (it reads back the same), a preset is cut against the picture's size, and\n // \"original\" is no crop at all. Only a preset with no size to cut against has nowhere to go.\n if (isCropRect(v.crop)) out.crop = { top: v.crop.top, right: v.crop.right, bottom: v.crop.bottom, left: v.crop.left };\n else if (typeof v.crop === \"string\" && v.crop !== \"original\") {\n const rect = v.width && v.height ? cropRect(v.crop, v.width, v.height, v.focal) : undefined;\n if (rect) out.crop = rect;\n else lost.push(\"crop\");\n }\n // BL-587: the picture's pixel size is stored on the value (the backend keeps it), so it is written, not lost.\n for (const k of [\"width\", \"height\"] as const) if (side(v[k])) out[k] = v[k];\n // The normaliser rebuilds the value from these keys; the rest is the asset's (size), a width/height that is no size,\n // or has no home.\n for (const k of [\"caption\", \"size\"] as const) if (v[k] !== undefined) lost.push(k);\n for (const k of [\"width\", \"height\"] as const) if (v[k] !== undefined && !side(v[k])) lost.push(k);\n for (const k of Object.keys(v)) if (![\"url\", \"id\", \"name\", \"alt\", \"focal\", \"crop\", \"caption\", \"width\", \"height\", \"size\"].includes(k)) lost.push(k);\n return { value: out, lost };\n}\n\n/** A width or height in pixels: positive and finite. */\nconst side = (n: unknown): n is number => typeof n === \"number\" && Number.isFinite(n) && n > 0;\n\n/** A crop window as prod stores it: four 0–1 edges that leave something on both axes. */\nexport function isCropRect(v: unknown): v is ProdImageCrop {\n if (!isObj(v)) return false;\n const { top, right, bottom, left } = v as Record<string, unknown>;\n const num = (n: unknown): n is number => typeof n === \"number\" && Number.isFinite(n) && n >= 0 && n <= 1;\n return num(top) && num(right) && num(bottom) && num(left) && top + bottom < 1 && left + right < 1;\n}\n\n/**\n * Pass the asset's pixel size to read a stored crop rect back as its preset and to restore width / height / size.\n * An older value written as `{ src, alt }` (the block's own image props) reads as the same picture and alt text.\n */\nexport function imageFromProd(v: unknown, asset: ImageAsset = {}): V2ImageValue | string | null {\n if (typeof v === \"string\") return v;\n if (!isObj(v)) return null;\n const url = typeof v.url === \"string\" ? v.url : typeof v.src === \"string\" ? v.src : null;\n if (url === null) return null;\n const p = v as unknown as ProdImageValue & { alt?: unknown };\n const out: V2ImageValue = { url };\n if (p.id !== undefined) out.id = p.id;\n if (p.name !== undefined) out.name = p.name;\n if (p.altText !== undefined) out.alt = p.altText;\n else if (typeof p.alt === \"string\") out.alt = p.alt;\n if (p.focal) out.focal = { x: round(p.focal.x * 100), y: round(p.focal.y * 100) };\n if (isCropRect(p.crop)) {\n const preset = asset.width && asset.height ? cropPreset(p.crop, asset.width, asset.height) : undefined;\n out.crop = preset ?? { ...p.crop };\n }\n // The asset's size is the picture's; a stored one stands in where there is no asset (BL-587).\n const width = asset.width ?? (side(p.width) ? p.width : undefined);\n const height = asset.height ?? (side(p.height) ? p.height : undefined);\n if (width !== undefined) out.width = width;\n if (height !== undefined) out.height = height;\n if (asset.size !== undefined) out.size = asset.size;\n return out;\n}\n\n/* ── reference ────────────────────────────────────────────────────────── */\n/**\n * A V2 reference value is the target's id. Prod reads a bare id as an ENTRY on a prop reference that takes entries\n * (backend acceptsEntries), so a page, form or collection picked there travels in the kit as `\"<kind>:<id>\"` (the\n * dock's reference services hand such picks back tagged) and is stored as `{ kind, id }` (targetRefOf). A stored\n * `{ kind, id }` reads back tagged, whatever the field takes, so a save writes the same target back.\n */\nconst TARGET_TAG = /^(page|form|collection):(.+)$/;\nexport const targetTag = (kind: ProdTargetRef[\"kind\"], id: string): string => `${kind}:${id}`;\nexport function parseTargetTag(v: string): ProdTargetRef | null {\n const m = TARGET_TAG.exec(v);\n return m ? { kind: m[1] as ProdTargetRef[\"kind\"], id: m[2] } : null;\n}\nconst isTargetRef = (v: unknown): v is ProdTargetRef =>\n isObj(v) && typeof v.kind === \"string\" && TARGET_TAG.test(`${v.kind}:x`) && typeof v.id === \"string\" && v.id !== \"\";\n\n/**\n * V2 stores the target id (`\"en_12\"`; a list for many). Prod stores the same id, or `{ entryId, modelSlug }` on a\n * polymorphic field (pass `modelSlug`), or `{ formId }` on a component `form` prop (`to: \"form\"`), or `{ kind, id }` for\n * a tagged page / form / collection pick (`\"page:pg_1\"`).\n */\nexport function referenceToProd(\n v: string | string[] | null | undefined,\n opts: { to?: \"form\"; modelSlug?: string } = {},\n): ValueResult<string | (string | ProdTargetRef)[] | ProdPolymorphicRef | ProdFormRef | ProdTargetRef | null> {\n if (v == null || v === \"\") return { value: null, lost: [] };\n if (Array.isArray(v)) return { value: v.map((x) => parseTargetTag(x) ?? x), lost: [] };\n if (opts.to === \"form\") return { value: { formId: v }, lost: [] };\n const target = parseTargetTag(v);\n if (target) return { value: target, lost: [] };\n if (opts.modelSlug) return { value: { entryId: v, modelSlug: opts.modelSlug }, lost: [] };\n return { value: v, lost: [] };\n}\n\nconst refId = (v: unknown): string | null =>\n typeof v === \"string\"\n ? v || null\n : isTargetRef(v)\n ? targetTag(v.kind, v.id)\n : isObj(v)\n ? ((typeof v.entryId === \"string\" && v.entryId) || (typeof v.formId === \"string\" && v.formId) || null)\n : null;\n\nexport function referenceFromProd(v: unknown): string | string[] | null {\n if (Array.isArray(v)) return v.map(refId).filter((x): x is string => !!x);\n return refId(v);\n}\n\n/* ── table ────────────────────────────────────────────────────────────── */\n/**\n * Prod has no table type: the schema adapter stores a V2 table as a `json` field (named in the lossy ledger), and\n * `json` keeps any JSON value, so the TableValue itself is stored verbatim (typed columns, groups, footer,\n * footnotes, caption, design, jsonLd).\n */\nexport function tableToProd(v: TableValue | null | undefined): ValueResult<TableValue | null> {\n return { value: v == null ? null : (JSON.parse(JSON.stringify(v)) as TableValue), lost: [] };\n}\nexport const tableFromProd = (v: unknown): TableValue | null => (isObj(v) ? (v as unknown as TableValue) : null);\n\n/* ── scale ────────────────────────────────────────────────────────────── */\nconst SCALE_UNITS: readonly ScaleUnit[] = [\"px\", \"%\", \"rem\", \"em\", \"vw\", \"vh\"];\n/**\n * Prod stores the three V2 scale shapes as they are (CPO D41, reference-validation.ts scaleValueProblem): a bare number,\n * a token step's string, a custom `{ value, unit }`. Pass the field's scale: a token it does not list, or a custom value\n * it does not allow (allowCustom off, a unit outside its units, past its bounds), is refused by the backend, so it is\n * not written (`lost: [\"\"]`). With no scale only a number is known to fit.\n */\nexport function scaleToProd(v: ScaleValue | null | undefined, scale?: ScaleSchema): ValueResult<ScaleValue | null> {\n if (v == null) return { value: null, lost: [] };\n if (typeof v === \"number\") return Number.isFinite(v) ? { value: v, lost: [] } : { value: null, lost: [\"\"] };\n const refused = { value: null, lost: [\"\"] };\n if (!scale) return refused;\n if (typeof v === \"string\") return Array.isArray(scale.steps) && scale.steps.some((x) => x.value === v) ? { value: v, lost: [] } : refused;\n if (!isObj(v) || !scale.allowCustom || typeof v.value !== \"number\" || !Number.isFinite(v.value) || Object.keys(v).some((k) => k !== \"value\" && k !== \"unit\")) return refused;\n const custom = typeof scale.allowCustom === \"object\" ? scale.allowCustom : {};\n const units = custom.units ?? scale.units ?? SCALE_UNITS;\n if (!units.includes(v.unit)) return refused;\n const bound = (b: number | Partial<Record<ScaleUnit, number>> | undefined) => (typeof b === \"number\" ? b : b?.[v.unit]);\n const min = bound(custom.min);\n const max = bound(custom.max);\n if ((min !== undefined && v.value < min) || (max !== undefined && v.value > max)) return refused;\n return { value: { value: v.value, unit: v.unit }, lost: [] };\n}\nexport function scaleFromProd(v: unknown): ScaleValue | null {\n if (typeof v === \"number\") return Number.isFinite(v) ? v : null;\n if (typeof v === \"string\") return v;\n if (isObj(v) && typeof v.value === \"number\" && typeof v.unit === \"string\" && (SCALE_UNITS as readonly string[]).includes(v.unit)) return { value: v.value, unit: v.unit as ScaleUnit };\n return null;\n}\n\n/* ── video ────────────────────────────────────────────────────────────── */\nexport type V2VideoValue = string | { url: string; poster?: string; autoplay?: boolean; loop?: boolean; transcript?: string };\n/** An http(s) URL or a site path; \"\" is an unset one (video-value.ts isVideoUrl). */\nconst isVideoUrl = (s: string) => s === \"\" || /^https?:\\/\\/[^\\s]+$/i.test(s.trim()) || /^\\/(?!\\/)\\S*$/.test(s.trim());\n/**\n * The V2 video value and prod's are the same shape: a URL string, or `{ url, poster?, autoplay?, loop?, transcript? }`\n * (the video block's props). The backend refuses any other key, and a url or poster that is not an http(s) URL or a\n * site path (video_value_invalid): another key is left out and named, a bad url refuses the value whole.\n */\nexport function videoToProd(v: V2VideoValue | null | undefined): ValueResult<ProdVideoValue | string | null> {\n if (v == null) return { value: null, lost: [] };\n if (typeof v === \"string\") return isVideoUrl(v) ? { value: v, lost: [] } : { value: null, lost: [\"\"] };\n if (!isObj(v) || typeof v.url !== \"string\" || !isVideoUrl(v.url)) return { value: null, lost: [\"\"] };\n const lost: string[] = [];\n const out: Obj = {};\n for (const [k, x] of Object.entries(v)) {\n const ok =\n !(VIDEO_VALUE_KEYS as readonly string[]).includes(k) ? false\n : k === \"url\" ? true\n : k === \"poster\" ? typeof x === \"string\" && isVideoUrl(x)\n : k === \"transcript\" ? typeof x === \"string\" && x.length <= VIDEO_TRANSCRIPT_MAX\n : typeof x === \"boolean\";\n if (ok) out[k] = x;\n else if (x !== undefined) lost.push(k);\n }\n return { value: out as unknown as ProdVideoValue, lost };\n}\nexport function videoFromProd(v: unknown): V2VideoValue | null {\n if (typeof v === \"string\") return v;\n if (!isObj(v) || typeof v.url !== \"string\") return null;\n return { ...v } as V2VideoValue;\n}\n\n/* ── primitive lists ──────────────────────────────────────────────────── */\nexport type ListItemType = \"text\" | \"number\" | \"date\" | \"image\" | \"link\" | \"richtext\";\n/**\n * A V2 list of one primitive (`of: [{ type }]`) is a prod `array` with `config.itemType`, each item judged and normalized\n * as a field of its type: an image item stores prod's image keys (altText, 0–1 focal), a link item its stored link. Scalar\n * and rich text items pass as they are. `lost` names `<index>/<key>` (or `<index>` for a whole item) per item.\n */\nexport function listToProd(v: unknown, itemType: ListItemType): ValueResult<unknown[] | null> {\n if (v == null) return { value: null, lost: [] };\n if (!Array.isArray(v)) return { value: null, lost: [\"\"] };\n const lost: string[] = [];\n const out: unknown[] = [];\n v.forEach((x, i) => {\n const r = itemType === \"image\" ? imageToProd(x as V2ImageValue) : itemType === \"link\" ? linkToProd(x as V2LinkValue) : { value: x, lost: [] };\n for (const l of r.lost) lost.push(l ? `${i}/${l}` : String(i));\n out.push(r.value);\n });\n return { value: out, lost };\n}\nexport function listFromProd(v: unknown, itemType: ListItemType): unknown[] {\n if (!Array.isArray(v)) return [];\n return itemType === \"image\" ? v.map((x) => imageFromProd(x)) : itemType === \"link\" ? v.map((x) => linkFromProd(x)) : [...v];\n}\n\n/* ── tags ─────────────────────────────────────────────────────────────── */\n/**\n * The backend judges tags trimmed and case-insensitively (reference-validation.ts tagsValueProblem): a field write\n * trims and de-dupes, a prop value is refused (tags_value_invalid). So the value is written clean for both: trimmed,\n * first spelling of a case-repeat kept, and an empty, over-long, off-list (`allowCustom: false`) or over-`max` tag left\n * out. `lost` names each changed or dropped tag by its index in `v`.\n */\nexport function tagsToProd(\n v: string[] | null | undefined,\n opts: { max?: number; allowCustom?: boolean; options?: (string | { value: string })[] } = {},\n): ValueResult<string[] | null> {\n if (v == null) return { value: null, lost: [] };\n const allowed = opts.allowCustom === false ? new Set((opts.options ?? []).map((o) => (typeof o === \"string\" ? o : o.value).trim().toLowerCase())) : undefined;\n const out: string[] = [];\n const seen = new Set<string>();\n const lost: string[] = [];\n v.forEach((x, i) => {\n const t = typeof x === \"string\" ? x.trim() : \"\";\n const folded = t.toLowerCase();\n const keep =\n t !== \"\" && Array.from(t).length <= TAG_VALUE_MAX_LENGTH && !seen.has(folded) && (!allowed || allowed.has(folded)) && (opts.max === undefined || out.length < opts.max);\n if (keep) {\n seen.add(folded);\n out.push(t);\n }\n if (!keep || t !== x) lost.push(String(i));\n });\n return { value: out, lost };\n}\nexport const tagsFromProd = (v: unknown): string[] => (Array.isArray(v) ? v.filter((x): x is string => typeof x === \"string\") : []);\n\n/* ── rating ───────────────────────────────────────────────────────────── */\nexport interface RatingScale {\n min?: number;\n max?: number;\n step?: number;\n}\n/**\n * A prod rating runs from config.min (0 unset) to config.max (5 unset) in steps of config.step (1 unset), and 0 is \"not\n * rated\" on every scale (validation-parity.ts ratingScale / onRatingScale). V2's empty rating is null: it is written as\n * null, and any other number off the scale is refused by the backend (rating_value_invalid), so it is not written either.\n */\nexport function ratingToProd(v: number | null | undefined, opts: RatingScale = {}): ValueResult<number | null> {\n if (v == null) return { value: null, lost: [] };\n const min = opts.min ?? 0;\n const max = opts.max ?? RATING_DEFAULT_MAX;\n const step = opts.step ?? 1;\n const steps = (v - min) / step;\n const ok = Number.isFinite(v) && v >= min && v <= max && Math.abs(steps - Math.round(steps)) < 1e-9;\n return ok ? { value: v, lost: [] } : { value: null, lost: [\"\"] };\n}\n/** A stored number back; 0 on a scale that starts above it is prod's \"not rated\", which V2 holds as null. */\nexport function ratingFromProd(v: unknown, opts: RatingScale = {}): number | null {\n if (typeof v !== \"number\" || !Number.isFinite(v)) return null;\n return v === 0 && (opts.min ?? 0) > 0 ? null : v;\n}\n\n/* ── code ─────────────────────────────────────────────────────────────── */\nexport type V2CodeValue = string | { language?: string; code: string };\n/**\n * Prod stores a code value as a string, or `{ language?, code }` (no other key). A language outside the field's\n * `config.languages` is refused by the backend (code_value_invalid), so it is left out and named; a value over\n * CODE_MAX_LENGTH characters is refused whole.\n */\nexport function codeToProd(v: V2CodeValue | null | undefined, opts: { languages?: string[] } = {}): ValueResult<V2CodeValue | null> {\n if (v == null) return { value: null, lost: [] };\n const code = typeof v === \"string\" ? v : v.code;\n if (typeof code !== \"string\" || code.length > CODE_MAX_LENGTH) return { value: null, lost: [\"\"] };\n if (typeof v === \"string\") return { value: v, lost: [] };\n const lost = Object.keys(v).filter((k) => k !== \"code\" && k !== \"language\");\n const out: { language?: string; code: string } = { code };\n if (v.language !== undefined) {\n if (typeof v.language === \"string\" && (!opts.languages || opts.languages.includes(v.language))) out.language = v.language;\n else lost.push(\"language\");\n }\n return { value: out, lost };\n}\nexport function codeFromProd(v: unknown): V2CodeValue | null {\n if (typeof v === \"string\") return v;\n if (!isObj(v) || typeof v.code !== \"string\") return null;\n return typeof v.language === \"string\" ? { language: v.language, code: v.code } : { code: v.code };\n}\n\n/* ── zoned arrays ─────────────────────────────────────────────────────── */\n/** A V2 list of object items is stored by prod as the repeatable zone of its array: `{ repeatable: [...] }`. */\nexport const zoneListToProd = (v: unknown[] | null | undefined): { repeatable: unknown[] } => ({ repeatable: v ? [...v] : [] });\nexport const zoneListFromProd = (v: unknown): unknown[] => (isObj(v) && Array.isArray(v.repeatable) ? [...v.repeatable] : Array.isArray(v) ? [...v] : []);\n\n/* ── polymorphic list (prop table, config.mode \"types\") ─────────────── */\n/** A row of a polymorphic list: V2's and prod's shape alike, `{ _key?, _type, ...fields }` (BE prop-fields typedRowIssues). */\nexport type TypedRow = Record<string, unknown> & { _type: string; _key?: string };\nconst isTypedRow = (v: unknown): v is TypedRow => isObj(v) && typeof v._type === \"string\" && v._type !== \"\";\n\n/**\n * V2 rows → the stored rows. Prod keeps V2's own row shape, so a row passes as it is after `mapRow` (its fields through\n * their plans); a row with no `_type` has no item type to be judged by (item_type_required) and is named, by index.\n */\nexport function typedRowsToProd(v: unknown, mapRow: (row: TypedRow, i: number) => Record<string, unknown> = (r) => ({ ...r })): ValueResult<unknown> {\n if (v == null) return { value: v ?? null, lost: [] };\n if (!Array.isArray(v)) return { value: v, lost: [\"(value)\"] };\n const lost: string[] = [];\n const value = v.map((row, i) => {\n if (isTypedRow(row)) return mapRow(row, i);\n lost.push(String(i));\n return row;\n });\n return { value, lost };\n}\n\n/** Stored rows → V2 rows: the same shape, each row through `mapRow`; a row that is not typed passes as stored. */\nexport function typedRowsFromProd(v: unknown, mapRow: (row: TypedRow, i: number) => Record<string, unknown> = (r) => ({ ...r })): unknown {\n if (!Array.isArray(v)) return v;\n return v.map((row, i) => (isTypedRow(row) ? mapRow(row, i) : row));\n}\n\n/** A dock icon name passes through; anything else is not a prod icon. */\nexport const isDockIcon = (v: unknown): v is DockIconName => typeof v === \"string\" && DOCK_ICON_NAME_SET.has(v);\n"],"mappings":";;AAwCA,IAAM,SAAS,MAAyB,CAAC,CAAC,KAAK,OAAO,MAAM,YAAY,CAAC,MAAM,QAAQ,CAAC;;AA8CxF,IAAM,cAAc;CAAC;CAAS;CAAW;CAAQ;CAAS;CAAQ;AAAW;AAC7E,IAAM,gBAAgB,SAAiB,gCAAgC,KAAK,KAAK,QAAQ,qBAAqB,EAAE,CAAC;;;;;AAOjH,SAAgB,WAAW,GAAwF;CACjH,IAAI,KAAK,MAAM,OAAO;EAAE,OAAO;EAAM,MAAM,CAAC;CAAE;CAC9C,IAAI,OAAO,MAAM,UAAU,OAAO,aAAa,CAAC,IAAI;EAAE,OAAO;E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,UAAiE,OAAO,EAAE,GAAG,EAAE,IAA0B;CACnJ,IAAI,KAAK,MAAM,OAAO;EAAE,OAAO,KAAK;EAAM,MAAM,CAAC;CAAE;CACnD,IAAI,CAAC,MAAM,QAAQ,CAAC,GAAG,OAAO;EAAE,OAAO;EAAG,MAAM,CAAC,SAAS;CAAE;CAC5D,MAAM,OAAiB,CAAC;CAMxB,OAAO;EAAE,OALK,EAAE,KAAK,KAAK,MAAM;GAC9B,IAAI,WAAW,GAAG,GAAG,OAAO,OAAO,KAAK,CAAC;GACzC,KAAK,KAAK,OAAO,CAAC,CAAC;GACnB,OAAO;EACT,CACS;EAAO;CAAK;AACvB;;AAGA,SAAgB,kBAAkB,GAAY,UAAiE,OAAO,EAAE,GAAG,EAAE,IAAa;CACxI,IAAI,CAAC,MAAM,QAAQ,CAAC,GAAG,OAAO;CAC9B,OAAO,EAAE,KAAK,KAAK,MAAO,WAAW,GAAG,IAAI,OAAO,KAAK,CAAC,IAAI,GAAI;AACnE;;AAGA,IAAa,cAAc,MAAkC,OAAO,MAAM,YAAY,mBAAmB,IAAI,CAAC"}
|
package/dist/controls/media.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ import { type V2ImageCrop } from "../adapters/values";
|
|
|
24
24
|
import type { ProdImageCrop } from "../adapters/prod-types";
|
|
25
25
|
import { type KitMediaAsset, type KitServices } from "../context";
|
|
26
26
|
import type { ControlProps } from "../types";
|
|
27
|
-
/** The image value the kit edits (V2 ImageValue, minus what prod cannot store: caption
|
|
27
|
+
/** The image value the kit edits (V2 ImageValue, minus what prod cannot store: caption and size; width and height are kept, BL-587). */
|
|
28
28
|
export interface ImageValue {
|
|
29
29
|
url: string;
|
|
30
30
|
alt?: string;
|