@bettercms-ai/kit 3.1.31 → 3.2.0
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/context.d.ts +11 -0
- package/dist/context.js.map +1 -1
- package/dist/controls/rich-text/blocks.js +1 -1
- package/dist/controls/rich-text/control.d.ts +2 -1
- package/dist/controls/rich-text/control.js +21 -8
- package/dist/controls/rich-text/control.js.map +1 -1
- package/dist/controls/rich-text/editor.js +1 -1
- package/dist/engine/frame.js +1 -1
- package/dist/engine/frame.js.map +1 -1
- package/dist/engine/held.d.ts +82 -0
- package/dist/engine/held.js +190 -0
- package/dist/engine/held.js.map +1 -0
- package/dist/engine/kit-field.d.ts +9 -3
- package/dist/engine/kit-field.js +38 -12
- package/dist/engine/kit-field.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/schema/types.d.ts +9 -0
- package/dist/schema/types.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HELD fields and the kit's error surfaces (kit 3.2.0).
|
|
3
|
+
*
|
|
4
|
+
* A held field is one the form cannot edit without changing what is stored: it renders read-only inside the usual
|
|
5
|
+
* FieldShell (label, help), shows the stored value as faithfully as the kit can (rich text as its HTML, scalars as text,
|
|
6
|
+
* objects and lists as a short readable summary), names why in one line, and never writes. It replaces handing the
|
|
7
|
+
* value to the host's old control (LegacyFallback, removed in 4.0.0).
|
|
8
|
+
*
|
|
9
|
+
* - `FieldSchema.held` / `KitServices.heldReason`: the host holds a field (KitField checks both before anything else)
|
|
10
|
+
* - a control that refuses a value (rich text the codec cannot carry) draws `HeldValue` in its place
|
|
11
|
+
* - a control that throws while rendering: `FieldBoundary` holds that one field; the rest of the form keeps working
|
|
12
|
+
* - a whole form that throws: the host draws `KitErrorCard` (reason, "Nothing was changed.", Retry)
|
|
13
|
+
*
|
|
14
|
+
* Markers: the value box carries `data-kit-held="<type>"`, its reason line `data-slot="kit-held-reason"`, the error card
|
|
15
|
+
* `data-kit-error`.
|
|
16
|
+
*/
|
|
17
|
+
import * as React from "react";
|
|
18
|
+
import type { FieldPath, FieldSchema } from "../schema/types";
|
|
19
|
+
/**
|
|
20
|
+
* A stored value as readable lines (never a JSON dump unless nothing else reads): a scalar is its text, a list is its
|
|
21
|
+
* count and its first items, an object its set keys by their field titles.
|
|
22
|
+
*/
|
|
23
|
+
export declare function heldLines(field: FieldSchema, value: unknown): string[];
|
|
24
|
+
export interface HeldValueProps {
|
|
25
|
+
field: FieldSchema;
|
|
26
|
+
value: unknown;
|
|
27
|
+
/** the FieldShell id: the shell's label names this box */
|
|
28
|
+
id: string;
|
|
29
|
+
/** why the field is held, as a clause or a sentence ("it holds formatting this editor cannot keep") */
|
|
30
|
+
reason: string;
|
|
31
|
+
/** rich text: the HTML the codec read for the value, when it could read it (shown read-only, sanitized) */
|
|
32
|
+
html?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The body of a held field (inside a FieldShell): the reason line, then the stored value read-only. Takes no onChange,
|
|
36
|
+
* so it cannot write.
|
|
37
|
+
*/
|
|
38
|
+
export declare function HeldValue({ field, value, id, reason, html }: HeldValueProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
/** A whole held field: the kit FieldShell (label, help, read-only) around HeldValue. Must be inside <SchemaForm>. */
|
|
40
|
+
export declare function HeldField({ field, path, reason, html }: {
|
|
41
|
+
field: FieldSchema;
|
|
42
|
+
path: FieldPath;
|
|
43
|
+
reason: string;
|
|
44
|
+
html?: string;
|
|
45
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
/**
|
|
47
|
+
* One field's error boundary: a control that throws while rendering holds that field ("this field could not be drawn:
|
|
48
|
+
* <message>") and the rest of the form keeps working. Retried once the field's schema or value changes (a schema edit,
|
|
49
|
+
* a save from elsewhere, an undo).
|
|
50
|
+
*/
|
|
51
|
+
export declare class FieldBoundary extends React.Component<{
|
|
52
|
+
field: FieldSchema;
|
|
53
|
+
path: FieldPath;
|
|
54
|
+
value: unknown;
|
|
55
|
+
children: React.ReactNode;
|
|
56
|
+
}, {
|
|
57
|
+
reason: string | null;
|
|
58
|
+
}> {
|
|
59
|
+
state: {
|
|
60
|
+
reason: string | null;
|
|
61
|
+
};
|
|
62
|
+
static getDerivedStateFromError(error: unknown): {
|
|
63
|
+
reason: string;
|
|
64
|
+
};
|
|
65
|
+
componentDidUpdate(prev: {
|
|
66
|
+
field: FieldSchema;
|
|
67
|
+
value: unknown;
|
|
68
|
+
}): void;
|
|
69
|
+
render(): string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
|
|
70
|
+
}
|
|
71
|
+
export interface KitErrorCardProps {
|
|
72
|
+
/** what failed, as a sentence or a clause ("The form could not be drawn: x is undefined") */
|
|
73
|
+
reason: string;
|
|
74
|
+
/** draws the form again */
|
|
75
|
+
onRetry: () => void;
|
|
76
|
+
className?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* For a form that throws as a whole: the reason, "Nothing was changed.", and Retry. Carries `data-kit-error`. The host
|
|
80
|
+
* reports the error itself; this card only shows it.
|
|
81
|
+
*/
|
|
82
|
+
export declare function KitErrorCard({ reason, onRetry, className }: KitErrorCardProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { isObj } from "../lib/path.js";
|
|
2
|
+
import { plainText } from "../lib/schema.js";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
import { useForm } from "../context.js";
|
|
5
|
+
import { Button } from "../ui/button.js";
|
|
6
|
+
import { FieldShell } from "./field-shell.js";
|
|
7
|
+
import { sanitize } from "../controls/rich-text/dom.js";
|
|
8
|
+
import { plainOf } from "./kit-field.js";
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
//#region src/engine/held.tsx
|
|
12
|
+
/**
|
|
13
|
+
* HELD fields and the kit's error surfaces (kit 3.2.0).
|
|
14
|
+
*
|
|
15
|
+
* A held field is one the form cannot edit without changing what is stored: it renders read-only inside the usual
|
|
16
|
+
* FieldShell (label, help), shows the stored value as faithfully as the kit can (rich text as its HTML, scalars as text,
|
|
17
|
+
* objects and lists as a short readable summary), names why in one line, and never writes. It replaces handing the
|
|
18
|
+
* value to the host's old control (LegacyFallback, removed in 4.0.0).
|
|
19
|
+
*
|
|
20
|
+
* - `FieldSchema.held` / `KitServices.heldReason`: the host holds a field (KitField checks both before anything else)
|
|
21
|
+
* - a control that refuses a value (rich text the codec cannot carry) draws `HeldValue` in its place
|
|
22
|
+
* - a control that throws while rendering: `FieldBoundary` holds that one field; the rest of the form keeps working
|
|
23
|
+
* - a whole form that throws: the host draws `KitErrorCard` (reason, "Nothing was changed.", Retry)
|
|
24
|
+
*
|
|
25
|
+
* Markers: the value box carries `data-kit-held="<type>"`, its reason line `data-slot="kit-held-reason"`, the error card
|
|
26
|
+
* `data-kit-error`.
|
|
27
|
+
*/
|
|
28
|
+
var sentence = (s) => s.trim().replace(/[.\s]*$/, ".");
|
|
29
|
+
var noop = () => {};
|
|
30
|
+
/** The HTML a stored rich-text value carries (an HTML string, a `{ html }` / `{ format: "html", value }` envelope), or null. */
|
|
31
|
+
function storedHtml(value) {
|
|
32
|
+
if (typeof value === "string") return /<[a-z!/]/i.test(value) ? value : null;
|
|
33
|
+
if (!isObj(value)) return null;
|
|
34
|
+
if (typeof value.html === "string" && value.html) return value.html;
|
|
35
|
+
if (value.format === "html" && typeof value.value === "string") return value.value;
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
/** One list item in a few words: its own text (title, label, name, block text) or a plain count of what it holds. */
|
|
39
|
+
function itemText(v) {
|
|
40
|
+
if (v == null || v === "") return "Empty";
|
|
41
|
+
if (typeof v !== "object") return String(v);
|
|
42
|
+
const t = plainText(v);
|
|
43
|
+
if (t) return t;
|
|
44
|
+
if (Array.isArray(v)) return `${v.length} ${v.length === 1 ? "item" : "items"}`;
|
|
45
|
+
const n = Object.keys(v).filter((k) => !k.startsWith("_")).length;
|
|
46
|
+
return `${n} ${n === 1 ? "field" : "fields"}`;
|
|
47
|
+
}
|
|
48
|
+
var clip = (s, n = 120) => s.length > n ? `${s.slice(0, n - 1)}…` : s;
|
|
49
|
+
var MAX_LINES = 6;
|
|
50
|
+
/**
|
|
51
|
+
* A stored value as readable lines (never a JSON dump unless nothing else reads): a scalar is its text, a list is its
|
|
52
|
+
* count and its first items, an object its set keys by their field titles.
|
|
53
|
+
*/
|
|
54
|
+
function heldLines(field, value) {
|
|
55
|
+
if (value == null || value === "" || Array.isArray(value) && !value.length) return [];
|
|
56
|
+
if (Array.isArray(value)) return [
|
|
57
|
+
`${value.length} ${value.length === 1 ? "item" : "items"}`,
|
|
58
|
+
...value.slice(0, MAX_LINES).map((v) => clip(itemText(v))),
|
|
59
|
+
...value.length > MAX_LINES ? [`and ${value.length - MAX_LINES} more`] : []
|
|
60
|
+
];
|
|
61
|
+
if (isObj(value)) {
|
|
62
|
+
if (field.type === "richtext") {
|
|
63
|
+
const t = plainText(value);
|
|
64
|
+
return t ? [t] : [];
|
|
65
|
+
}
|
|
66
|
+
const titleOf = (k) => field.fields?.find((f) => f.name === k)?.title ?? k;
|
|
67
|
+
const lines = Object.entries(value).filter(([k, v]) => !k.startsWith("_") && v != null && v !== "" && !(Array.isArray(v) && !v.length)).map(([k, v]) => `${titleOf(k)}: ${clip(itemText(v), 80)}`);
|
|
68
|
+
if (lines.length) return lines.length > MAX_LINES ? [...lines.slice(0, MAX_LINES), `and ${lines.length - MAX_LINES} more`] : lines;
|
|
69
|
+
const raw = JSON.stringify(value);
|
|
70
|
+
return raw && raw !== "{}" ? [clip(raw, 200)] : [];
|
|
71
|
+
}
|
|
72
|
+
const t = field.type === "richtext" ? plainText(value) : plainOf(field, value) || String(value);
|
|
73
|
+
return t ? [t] : [];
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The body of a held field (inside a FieldShell): the reason line, then the stored value read-only. Takes no onChange,
|
|
77
|
+
* so it cannot write.
|
|
78
|
+
*/
|
|
79
|
+
function HeldValue({ field, value, id, reason, html }) {
|
|
80
|
+
const rich = field.type === "richtext" ? html ?? storedHtml(value) : null;
|
|
81
|
+
const lines = rich == null ? heldLines(field, value) : [];
|
|
82
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
83
|
+
"data-kit-held": field.type,
|
|
84
|
+
className: "flex min-w-0 flex-col gap-1.5",
|
|
85
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
86
|
+
role: "note",
|
|
87
|
+
"data-slot": "kit-held-reason",
|
|
88
|
+
className: "rounded-kit-md bg-kit-subtle px-2.5 py-1.5 text-kit-xs text-kit-fg-2",
|
|
89
|
+
children: ["Shown read-only: ", sentence(reason)]
|
|
90
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
91
|
+
id,
|
|
92
|
+
tabIndex: 0,
|
|
93
|
+
role: "group",
|
|
94
|
+
"aria-labelledby": `${id}-label ${id}`,
|
|
95
|
+
"aria-readonly": "true",
|
|
96
|
+
"data-slot": "kit-held-value",
|
|
97
|
+
className: cn("min-w-0 break-words rounded-kit-sm text-kit-sm leading-6 text-kit-fg focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-kit-focus-ring focus-visible:[outline-style:solid] [html[data-input-modality=pointer]_&]:focus-visible:outline-0", rich == null && "whitespace-pre-wrap"),
|
|
98
|
+
children: rich != null ? /* @__PURE__ */ jsx("div", {
|
|
99
|
+
"data-slot": "kit-held-html",
|
|
100
|
+
className: "[&_a]:underline [&_ol]:list-decimal [&_ol]:pl-5 [&_ul]:list-disc [&_ul]:pl-5",
|
|
101
|
+
dangerouslySetInnerHTML: { __html: sanitize(rich) }
|
|
102
|
+
}) : lines.length ? lines.length === 1 ? lines[0] : /* @__PURE__ */ jsx("ul", {
|
|
103
|
+
className: "flex flex-col",
|
|
104
|
+
children: lines.map((l, i) => /* @__PURE__ */ jsx("li", {
|
|
105
|
+
className: cn(i === 0 && Array.isArray(value) ? "text-kit-xs text-kit-fg-3" : void 0),
|
|
106
|
+
children: l
|
|
107
|
+
}, i))
|
|
108
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
109
|
+
className: "text-kit-fg-3",
|
|
110
|
+
children: "Empty"
|
|
111
|
+
})
|
|
112
|
+
})]
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
/** A whole held field: the kit FieldShell (label, help, read-only) around HeldValue. Must be inside <SchemaForm>. */
|
|
116
|
+
function HeldField({ field, path, reason, html }) {
|
|
117
|
+
const form = useForm();
|
|
118
|
+
const id = React.useId();
|
|
119
|
+
const value = form?.getAt(path);
|
|
120
|
+
return /* @__PURE__ */ jsx(FieldShell, {
|
|
121
|
+
field,
|
|
122
|
+
path,
|
|
123
|
+
id,
|
|
124
|
+
value,
|
|
125
|
+
onChange: noop,
|
|
126
|
+
readOnly: true,
|
|
127
|
+
children: /* @__PURE__ */ jsx(HeldValue, {
|
|
128
|
+
field,
|
|
129
|
+
value,
|
|
130
|
+
id,
|
|
131
|
+
reason,
|
|
132
|
+
html
|
|
133
|
+
})
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* One field's error boundary: a control that throws while rendering holds that field ("this field could not be drawn:
|
|
138
|
+
* <message>") and the rest of the form keeps working. Retried once the field's schema or value changes (a schema edit,
|
|
139
|
+
* a save from elsewhere, an undo).
|
|
140
|
+
*/
|
|
141
|
+
var FieldBoundary = class extends React.Component {
|
|
142
|
+
state = { reason: null };
|
|
143
|
+
static getDerivedStateFromError(error) {
|
|
144
|
+
return { reason: error instanceof Error ? error.message : String(error) };
|
|
145
|
+
}
|
|
146
|
+
componentDidUpdate(prev) {
|
|
147
|
+
if (this.state.reason === null) return;
|
|
148
|
+
if (prev.value !== this.props.value || JSON.stringify(prev.field) !== JSON.stringify(this.props.field)) this.setState({ reason: null });
|
|
149
|
+
}
|
|
150
|
+
render() {
|
|
151
|
+
if (this.state.reason === null) return this.props.children;
|
|
152
|
+
return /* @__PURE__ */ jsx(HeldField, {
|
|
153
|
+
field: this.props.field,
|
|
154
|
+
path: this.props.path,
|
|
155
|
+
reason: `this field could not be drawn: ${this.state.reason}`
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* For a form that throws as a whole: the reason, "Nothing was changed.", and Retry. Carries `data-kit-error`. The host
|
|
161
|
+
* reports the error itself; this card only shows it.
|
|
162
|
+
*/
|
|
163
|
+
function KitErrorCard({ reason, onRetry, className }) {
|
|
164
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
165
|
+
role: "alert",
|
|
166
|
+
"data-kit-error": "",
|
|
167
|
+
className: cn("flex flex-col items-start gap-2 rounded-kit-lg border border-kit-line bg-kit-subtle p-3", className),
|
|
168
|
+
children: [
|
|
169
|
+
/* @__PURE__ */ jsx("p", {
|
|
170
|
+
"data-slot": "kit-error-reason",
|
|
171
|
+
className: "text-kit-sm text-kit-fg",
|
|
172
|
+
children: sentence(reason)
|
|
173
|
+
}),
|
|
174
|
+
/* @__PURE__ */ jsx("p", {
|
|
175
|
+
className: "text-kit-xs text-kit-fg-2",
|
|
176
|
+
children: "Nothing was changed."
|
|
177
|
+
}),
|
|
178
|
+
/* @__PURE__ */ jsx(Button, {
|
|
179
|
+
variant: "secondary",
|
|
180
|
+
size: "sm",
|
|
181
|
+
onClick: onRetry,
|
|
182
|
+
children: "Retry"
|
|
183
|
+
})
|
|
184
|
+
]
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
//#endregion
|
|
188
|
+
export { FieldBoundary, HeldField, HeldValue, KitErrorCard, heldLines };
|
|
189
|
+
|
|
190
|
+
//# sourceMappingURL=held.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"held.js","names":[],"sources":["../../src/engine/held.tsx"],"sourcesContent":["/**\n * HELD fields and the kit's error surfaces (kit 3.2.0).\n *\n * A held field is one the form cannot edit without changing what is stored: it renders read-only inside the usual\n * FieldShell (label, help), shows the stored value as faithfully as the kit can (rich text as its HTML, scalars as text,\n * objects and lists as a short readable summary), names why in one line, and never writes. It replaces handing the\n * value to the host's old control (LegacyFallback, removed in 4.0.0).\n *\n * - `FieldSchema.held` / `KitServices.heldReason`: the host holds a field (KitField checks both before anything else)\n * - a control that refuses a value (rich text the codec cannot carry) draws `HeldValue` in its place\n * - a control that throws while rendering: `FieldBoundary` holds that one field; the rest of the form keeps working\n * - a whole form that throws: the host draws `KitErrorCard` (reason, \"Nothing was changed.\", Retry)\n *\n * Markers: the value box carries `data-kit-held=\"<type>\"`, its reason line `data-slot=\"kit-held-reason\"`, the error card\n * `data-kit-error`.\n */\nimport * as React from \"react\";\nimport { cn } from \"../lib/cn\";\nimport { isObj } from \"../lib/path\";\nimport { plainText } from \"../lib/schema\";\nimport type { FieldPath, FieldSchema } from \"../schema/types\";\nimport { useForm } from \"../context\";\nimport { Button } from \"../ui/button\";\nimport { sanitize } from \"../controls/rich-text/dom\";\nimport { FieldShell } from \"./field-shell\";\nimport { plainOf } from \"./kit-field\";\n\nconst sentence = (s: string) => s.trim().replace(/[.\\s]*$/, \".\");\nconst noop = () => {};\n\n/** The HTML a stored rich-text value carries (an HTML string, a `{ html }` / `{ format: \"html\", value }` envelope), or null. */\nfunction storedHtml(value: unknown): string | null {\n if (typeof value === \"string\") return /<[a-z!/]/i.test(value) ? value : null;\n if (!isObj(value)) return null;\n if (typeof value.html === \"string\" && value.html) return value.html;\n if (value.format === \"html\" && typeof value.value === \"string\") return value.value;\n return null;\n}\n\n/** One list item in a few words: its own text (title, label, name, block text) or a plain count of what it holds. */\nfunction itemText(v: unknown): string {\n if (v == null || v === \"\") return \"Empty\";\n if (typeof v !== \"object\") return String(v);\n const t = plainText(v);\n if (t) return t;\n if (Array.isArray(v)) return `${v.length} ${v.length === 1 ? \"item\" : \"items\"}`;\n const n = Object.keys(v).filter((k) => !k.startsWith(\"_\")).length;\n return `${n} ${n === 1 ? \"field\" : \"fields\"}`;\n}\n\nconst clip = (s: string, n = 120) => (s.length > n ? `${s.slice(0, n - 1)}…` : s);\nconst MAX_LINES = 6;\n\n/**\n * A stored value as readable lines (never a JSON dump unless nothing else reads): a scalar is its text, a list is its\n * count and its first items, an object its set keys by their field titles.\n */\nexport function heldLines(field: FieldSchema, value: unknown): string[] {\n if (value == null || value === \"\" || (Array.isArray(value) && !value.length)) return [];\n if (Array.isArray(value)) {\n const head = `${value.length} ${value.length === 1 ? \"item\" : \"items\"}`;\n const items = value.slice(0, MAX_LINES).map((v) => clip(itemText(v)));\n return [head, ...items, ...(value.length > MAX_LINES ? [`and ${value.length - MAX_LINES} more`] : [])];\n }\n if (isObj(value)) {\n if (field.type === \"richtext\") {\n const t = plainText(value);\n return t ? [t] : [];\n }\n const titleOf = (k: string) => field.fields?.find((f) => f.name === k)?.title ?? k;\n const lines = Object.entries(value)\n .filter(([k, v]) => !k.startsWith(\"_\") && v != null && v !== \"\" && !(Array.isArray(v) && !v.length))\n .map(([k, v]) => `${titleOf(k)}: ${clip(itemText(v), 80)}`);\n if (lines.length) return lines.length > MAX_LINES ? [...lines.slice(0, MAX_LINES), `and ${lines.length - MAX_LINES} more`] : lines;\n const raw = JSON.stringify(value);\n return raw && raw !== \"{}\" ? [clip(raw, 200)] : [];\n }\n const t = field.type === \"richtext\" ? plainText(value) : plainOf(field, value) || String(value);\n return t ? [t] : [];\n}\n\nexport interface HeldValueProps {\n field: FieldSchema;\n value: unknown;\n /** the FieldShell id: the shell's label names this box */\n id: string;\n /** why the field is held, as a clause or a sentence (\"it holds formatting this editor cannot keep\") */\n reason: string;\n /** rich text: the HTML the codec read for the value, when it could read it (shown read-only, sanitized) */\n html?: string;\n}\n\n/**\n * The body of a held field (inside a FieldShell): the reason line, then the stored value read-only. Takes no onChange,\n * so it cannot write.\n */\nexport function HeldValue({ field, value, id, reason, html }: HeldValueProps) {\n const rich = field.type === \"richtext\" ? (html ?? storedHtml(value)) : null;\n const lines = rich == null ? heldLines(field, value) : [];\n return (\n <div data-kit-held={field.type} className=\"flex min-w-0 flex-col gap-1.5\">\n <p role=\"note\" data-slot=\"kit-held-reason\" className=\"rounded-kit-md bg-kit-subtle px-2.5 py-1.5 text-kit-xs text-kit-fg-2\">\n Shown read-only: {sentence(reason)}\n </p>\n <div\n id={id}\n tabIndex={0}\n role=\"group\"\n aria-labelledby={`${id}-label ${id}`}\n aria-readonly=\"true\"\n data-slot=\"kit-held-value\"\n className={cn(\n \"min-w-0 break-words rounded-kit-sm text-kit-sm leading-6 text-kit-fg focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-kit-focus-ring focus-visible:[outline-style:solid] [html[data-input-modality=pointer]_&]:focus-visible:outline-0\",\n rich == null && \"whitespace-pre-wrap\",\n )}\n >\n {rich != null ? (\n <div data-slot=\"kit-held-html\" className=\"[&_a]:underline [&_ol]:list-decimal [&_ol]:pl-5 [&_ul]:list-disc [&_ul]:pl-5\" dangerouslySetInnerHTML={{ __html: sanitize(rich) }} />\n ) : lines.length ? (\n lines.length === 1 ? (\n lines[0]\n ) : (\n <ul className=\"flex flex-col\">\n {lines.map((l, i) => (\n <li key={i} className={cn(i === 0 && Array.isArray(value) ? \"text-kit-xs text-kit-fg-3\" : undefined)}>\n {l}\n </li>\n ))}\n </ul>\n )\n ) : (\n <span className=\"text-kit-fg-3\">Empty</span>\n )}\n </div>\n </div>\n );\n}\n\n/** A whole held field: the kit FieldShell (label, help, read-only) around HeldValue. Must be inside <SchemaForm>. */\nexport function HeldField({ field, path, reason, html }: { field: FieldSchema; path: FieldPath; reason: string; html?: string }) {\n const form = useForm();\n const id = React.useId();\n const value = form?.getAt(path);\n return (\n <FieldShell field={field} path={path} id={id} value={value} onChange={noop} readOnly>\n <HeldValue field={field} value={value} id={id} reason={reason} html={html} />\n </FieldShell>\n );\n}\n\n/**\n * One field's error boundary: a control that throws while rendering holds that field (\"this field could not be drawn:\n * <message>\") and the rest of the form keeps working. Retried once the field's schema or value changes (a schema edit,\n * a save from elsewhere, an undo).\n */\nexport class FieldBoundary extends React.Component<\n { field: FieldSchema; path: FieldPath; value: unknown; children: React.ReactNode },\n { reason: string | null }\n> {\n state = { reason: null as string | null };\n static getDerivedStateFromError(error: unknown) {\n return { reason: error instanceof Error ? error.message : String(error) };\n }\n componentDidUpdate(prev: { field: FieldSchema; value: unknown }) {\n if (this.state.reason === null) return;\n if (prev.value !== this.props.value || JSON.stringify(prev.field) !== JSON.stringify(this.props.field)) this.setState({ reason: null });\n }\n render() {\n if (this.state.reason === null) return this.props.children;\n return <HeldField field={this.props.field} path={this.props.path} reason={`this field could not be drawn: ${this.state.reason}`} />;\n }\n}\n\nexport interface KitErrorCardProps {\n /** what failed, as a sentence or a clause (\"The form could not be drawn: x is undefined\") */\n reason: string;\n /** draws the form again */\n onRetry: () => void;\n className?: string;\n}\n\n/**\n * For a form that throws as a whole: the reason, \"Nothing was changed.\", and Retry. Carries `data-kit-error`. The host\n * reports the error itself; this card only shows it.\n */\nexport function KitErrorCard({ reason, onRetry, className }: KitErrorCardProps) {\n return (\n <div role=\"alert\" data-kit-error=\"\" className={cn(\"flex flex-col items-start gap-2 rounded-kit-lg border border-kit-line bg-kit-subtle p-3\", className)}>\n <p data-slot=\"kit-error-reason\" className=\"text-kit-sm text-kit-fg\">\n {sentence(reason)}\n </p>\n <p className=\"text-kit-xs text-kit-fg-2\">Nothing was changed.</p>\n <Button variant=\"secondary\" size=\"sm\" onClick={onRetry}>\n Retry\n </Button>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAM,YAAY,MAAc,EAAE,KAAK,CAAC,CAAC,QAAQ,WAAW,GAAG;AAC/D,I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,KAAK,UAAU,KAAK,KAAK,MAAM,KAAK,UAAU,KAAK,MAAM,KAAK,GAAG,KAAK,SAAS,EAAE,QAAQ,KAAK,CAAC;CACxI;CACA,SAAS;EACP,IAAI,KAAK,MAAM,WAAW,MAAM,OAAO,KAAK,MAAM;EAClD,OAAO,oBAAC,WAAD;GAAW,OAAO,KAAK,MAAM;GAAO,MAAM,KAAK,MAAM;GAAM,QAAQ,kCAAkC,KAAK,MAAM;EAAW,CAAA;CACpI;AACF;;;;;AAcA,SAAgB,aAAa,EAAE,QAAQ,SAAS,aAAgC;CAC9E,OACE,qBAAC,OAAD;EAAK,MAAK;EAAQ,kBAAe;EAAG,WAAW,GAAG,2FAA2F,SAAS;EAAtJ,UAAA;GACE,oBAAC,KAAD;IAAG,aAAU;IAAmB,WAAU;IACvC,UAAA,SAAS,MAAM;GACf,CAAA;GACH,oBAAC,KAAD;IAAG,WAAU;IAA4B,UAAA;GAAuB,CAAA;GAChE,oBAAC,QAAD;IAAQ,SAAQ;IAAY,MAAK;IAAK,SAAS;IAAS,UAAA;GAEhD,CAAA;EACL;;AAET"}
|
|
@@ -33,7 +33,11 @@ export declare function useFieldAccess(field: FieldSchema): {
|
|
|
33
33
|
};
|
|
34
34
|
/** CPO D39: the field's help line — schema text first, then a line computed from its settings, then the house convention. */
|
|
35
35
|
export declare function withDefaultHelp(field: FieldSchema, isPublished?: boolean, readOnly?: boolean): FieldSchema;
|
|
36
|
-
|
|
36
|
+
/**
|
|
37
|
+
* One field. A held field (FieldSchema.held, or a reason from KitServices.heldReason) renders read-only with its reason
|
|
38
|
+
* and is never written; a control that throws while rendering holds that one field (FieldBoundary).
|
|
39
|
+
*/
|
|
40
|
+
export declare function KitField(props: KitFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
37
41
|
/**
|
|
38
42
|
* A row that opens something (V2 NavRow): type tile, title over a summary line, the field's chrome (from RowChrome),
|
|
39
43
|
* the issue rollup and a chevron.
|
|
@@ -66,7 +70,9 @@ export declare function FallbackControl(props: ControlProps): import("react/jsx-
|
|
|
66
70
|
* A control that cannot carry a stored value unchanged (rich text holding formatting its editor would drop) hands that
|
|
67
71
|
* value to the host's control for the type (KitServices.LegacyControl: the dashboard's FieldRenderer arm), bare inside
|
|
68
72
|
* the kit FieldShell, which owns the label and the help; the control names its reason above it. The box carries
|
|
69
|
-
* `data-kit-legacy="<type>"`, so the parity harness counts it (mismatch class `legacy-control`). A
|
|
70
|
-
*
|
|
73
|
+
* `data-kit-legacy="<type>"`, so the parity harness counts it (mismatch class `legacy-control`). A control that throws
|
|
74
|
+
* while rendering says why in words; the form around it keeps working.
|
|
75
|
+
* Kit 3.2.0: a host with no LegacyControl gets a HELD field instead (held.tsx: the value read-only, with the reason, no
|
|
76
|
+
* `data-kit-legacy`). LegacyControl, this hand-off and `data-kit-legacy` are removed in 4.0.0.
|
|
71
77
|
*/
|
|
72
78
|
export declare function LegacyFallback(props: ControlProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/engine/kit-field.js
CHANGED
|
@@ -17,6 +17,7 @@ import { ExpandAction, ExpandedField, expandKey, expandSpecFor, isExpandShortcut
|
|
|
17
17
|
import { SchemaForm } from "./schema-form.js";
|
|
18
18
|
import { SlotField } from "./slot.js";
|
|
19
19
|
import { JsonControl } from "../controls/json.js";
|
|
20
|
+
import { FieldBoundary, HeldField, HeldValue } from "./held.js";
|
|
20
21
|
import * as React from "react";
|
|
21
22
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
22
23
|
import { IconChevronRight } from "@tabler/icons-react";
|
|
@@ -66,12 +67,36 @@ function withDefaultHelp(field, isPublished, readOnly) {
|
|
|
66
67
|
description: help
|
|
67
68
|
};
|
|
68
69
|
}
|
|
69
|
-
|
|
70
|
+
/**
|
|
71
|
+
* One field. A held field (FieldSchema.held, or a reason from KitServices.heldReason) renders read-only with its reason
|
|
72
|
+
* and is never written; a control that throws while rendering holds that one field (FieldBoundary).
|
|
73
|
+
*/
|
|
74
|
+
function KitField(props) {
|
|
75
|
+
const form = useForm();
|
|
76
|
+
return /* @__PURE__ */ jsx(FieldBoundary, {
|
|
77
|
+
field: props.field,
|
|
78
|
+
path: props.path,
|
|
79
|
+
value: form?.getAt(props.path),
|
|
80
|
+
children: /* @__PURE__ */ jsx(KitFieldBody, { ...props })
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function KitFieldBody({ field, path, parent }) {
|
|
70
84
|
const form = useForm();
|
|
71
85
|
const env = useKitEnv();
|
|
86
|
+
const services = useKitServices();
|
|
72
87
|
const id = React.useId();
|
|
73
88
|
const { readOnly } = useFieldAccess(field);
|
|
74
89
|
if (!form) return null;
|
|
90
|
+
const heldReason = field.held?.reason || services.heldReason?.({
|
|
91
|
+
field,
|
|
92
|
+
path,
|
|
93
|
+
value: form.getAt(path)
|
|
94
|
+
});
|
|
95
|
+
if (heldReason) return /* @__PURE__ */ jsx(HeldField, {
|
|
96
|
+
field: withDefaultHelp(field, env.isPublished, true),
|
|
97
|
+
path,
|
|
98
|
+
reason: heldReason
|
|
99
|
+
});
|
|
75
100
|
const Custom = env.controls?.[pathKey(path)];
|
|
76
101
|
if (Custom) {
|
|
77
102
|
const ck = pathKey(path);
|
|
@@ -489,28 +514,29 @@ function FallbackControl(props) {
|
|
|
489
514
|
* A control that cannot carry a stored value unchanged (rich text holding formatting its editor would drop) hands that
|
|
490
515
|
* value to the host's control for the type (KitServices.LegacyControl: the dashboard's FieldRenderer arm), bare inside
|
|
491
516
|
* the kit FieldShell, which owns the label and the help; the control names its reason above it. The box carries
|
|
492
|
-
* `data-kit-legacy="<type>"`, so the parity harness counts it (mismatch class `legacy-control`). A
|
|
493
|
-
*
|
|
517
|
+
* `data-kit-legacy="<type>"`, so the parity harness counts it (mismatch class `legacy-control`). A control that throws
|
|
518
|
+
* while rendering says why in words; the form around it keeps working.
|
|
519
|
+
* Kit 3.2.0: a host with no LegacyControl gets a HELD field instead (held.tsx: the value read-only, with the reason, no
|
|
520
|
+
* `data-kit-legacy`). LegacyControl, this hand-off and `data-kit-legacy` are removed in 4.0.0.
|
|
494
521
|
*/
|
|
495
522
|
function LegacyFallback(props) {
|
|
496
523
|
const { LegacyControl } = useKitServices();
|
|
497
524
|
const { field, id } = props;
|
|
525
|
+
if (!LegacyControl) return /* @__PURE__ */ jsx(HeldValue, {
|
|
526
|
+
field,
|
|
527
|
+
value: props.value,
|
|
528
|
+
id,
|
|
529
|
+
reason: `this view has no control for ${field.type} fields`
|
|
530
|
+
});
|
|
498
531
|
return /* @__PURE__ */ jsx("div", {
|
|
499
532
|
"data-kit-legacy": field.type,
|
|
500
533
|
className: "min-w-0",
|
|
501
|
-
children:
|
|
534
|
+
children: /* @__PURE__ */ jsx(LegacyBoundary, {
|
|
502
535
|
field,
|
|
503
536
|
id,
|
|
504
537
|
value: props.value,
|
|
505
538
|
children: /* @__PURE__ */ jsx(LegacyControl, { ...props })
|
|
506
|
-
}, JSON.stringify(field))
|
|
507
|
-
id,
|
|
508
|
-
children: [
|
|
509
|
-
"This view has no control for ",
|
|
510
|
-
field.type,
|
|
511
|
-
" fields."
|
|
512
|
-
]
|
|
513
|
-
})
|
|
539
|
+
}, JSON.stringify(field))
|
|
514
540
|
});
|
|
515
541
|
}
|
|
516
542
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kit-field.js","names":[],"sources":["../../src/engine/kit-field.tsx"],"sourcesContent":["/**\n * KitField — renders ONE field of the schema at `path` (must be inside <SchemaForm>): the shell + the control for its\n * type (V2 HEAD 9829bf1 kit/engine/kit-field.tsx).\n *\n * Arrays (array.tsx) and slots (slot.tsx) get their rows; objects open inline (FieldInset), drill (NavRow -> a frame),\n * popover or dialog (NestedForm: its own navigation stack). Primitive types dispatch through the CONTROLS table, which\n * the controls lanes fill. Every SchemaType has a control there; a type that is none of them (a schema newer than this\n * kit) edits its raw value in the JSON control (FallbackControl), never nothing and never a stand-in.\n */\nimport * as React from \"react\";\nimport type { ComponentType } from \"react\";\nimport { IconChevronRight } from \"@tabler/icons-react\";\nimport { KitIcon } from \"../lib/icons\";\nimport { cn } from \"../lib/cn\";\nimport type { FieldPath, FieldSchema, PrimitiveType, SchemaType } from \"../schema/types\";\nimport { resolveHelp } from \"../schema/help\";\nimport type { ControlProps } from \"../types\";\nimport { resolveFieldAccess, useForm, useKitEnv, useKitServices, type KitPeer } from \"../context\";\nimport { Button } from \"../ui/button\";\nimport { Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, Popover, PopoverContent, PopoverTrigger } from \"../ui/overlay\";\nimport { isObj, pathKey } from \"../lib/path\";\nimport { condCtx, isHidden, objectOpenMode, plainText, summarize } from \"../lib/schema\";\nimport { isIconImage } from \"../lib/icon-image\";\nimport { ArrayField, type NestedFormProps } from \"./array\";\nimport { ExpandAction, ExpandedField, expandKey, expandSpecFor, isExpandShortcut, openExpanded } from \"./expand\";\nimport { FieldShell } from \"./field-shell\";\nimport { FieldList } from \"./field-list\";\nimport { IssueDot, RowChrome } from \"./bits\";\nimport { FieldInset, FieldRun, groupSummary, useInsetDepth } from \"./grouping\";\nimport { SchemaForm } from \"./schema-form\";\nimport { SlotField } from \"./slot\";\nimport { JsonControl } from \"../controls/json\";\n\nexport interface KitFieldProps {\n field: FieldSchema;\n path: (string | number)[];\n parent?: Record<string, unknown>;\n}\n\n/** Type → control. Registered by the controls lane; a type with no entry edits its raw value (FallbackControl). */\nexport const CONTROLS: Partial<Record<SchemaType, ComponentType<ControlProps>>> = {};\n\n/**\n * Type → label-row action (DESIGN 4.4: slug Generate, rich text expand, table Edit in full screen), registered by the\n * controls lane next to its control. It gets the control's props. V2 draws it only while the field is editable, except\n * the types in ACTION_WHEN_READ_ONLY, whose action takes `readOnly` and decides for itself (slug Generate).\n */\nexport const ACTIONS: Partial<Record<SchemaType, ComponentType<ControlProps>>> = {};\nexport const ACTION_WHEN_READ_ONLY = new Set<SchemaType>([\"slug\"]);\n\n/** D58: the field for the lens: read-only (plain text) when it can't edit it. Hidden fields never reach here\n * (SchemaForm drops them from the schema). */\nexport function useFieldAccess(field: FieldSchema) {\n const env = useKitEnv();\n return { readOnly: resolveFieldAccess(field, env).readOnly };\n}\n\n/** CPO D39: the field's help line — schema text first, then a line computed from its settings, then the house convention. */\nexport function withDefaultHelp(field: FieldSchema, isPublished?: boolean, readOnly?: boolean): FieldSchema {\n let computed: string | undefined;\n /* a value set elsewhere says where, in one plain line (never a lock or a key) */\n if (readOnly && field.lockReason) return { ...field, description: field.lockReason.replace(/\\.?$/, \".\") };\n if (field.type === \"slug\" && !isPublished) computed = \"Follows the title until you change it or publish.\";\n else if (field.type === \"number\" && !field.scale && field.layout !== \"slider\" && field.numeric?.unit) {\n /* D63: the unit sits in the input (\"/ 5\", \"min\"), so a line that only restates it or its range is noise. A range\n still earns a line when the unit does not already say it (\"Between 1 and 12 items.\"). */\n const { min, max, unit } = field.numeric;\n const said = unit.startsWith(\"/\") || (max != null && unit.includes(String(max)));\n computed = said || (min == null && max == null) ? \"\" : min != null && max != null ? `Between ${min} and ${max} ${unit}.` : min != null ? `${min} ${unit} or more.` : `Up to ${max} ${unit}.`;\n } else if (field.type === \"number\" && !field.scale && field.layout !== \"slider\" && (field.numeric?.min != null || field.numeric?.max != null)) {\n const { min, max } = field.numeric ?? {};\n computed = min != null && max != null ? `Between ${min} and ${max}.` : min != null ? `${min} or more.` : `Up to ${max}.`;\n }\n /* resolve here so the computed line wins over the house convention; \"\" survives as \"deliberately none\" */\n const help = resolveHelp(field, computed) ?? \"\";\n return help === field.description ? field : { ...field, description: help };\n}\n\nexport function KitField({ field, path, parent }: KitFieldProps) {\n const form = useForm();\n const env = useKitEnv();\n const id = React.useId();\n const { readOnly } = useFieldAccess(field);\n if (!form) return null;\n\n /* a host's own control for this field (KitEnv.controls), inside the usual shell */\n const Custom = env.controls?.[pathKey(path)];\n if (Custom) {\n const ck = pathKey(path);\n const cissue = form.visibleIssue(ck);\n const cf = withDefaultHelp(field, env.isPublished, readOnly);\n return (\n <FieldShell field={cf} path={path} id={id} value={form.getAt(path)} onChange={(v) => form.setAt(path, v)} readOnly={readOnly} issue={cissue}>\n <div onBlur={() => form.touch(ck)} className=\"min-w-0\">\n <Custom field={cf} value={form.getAt(path)} onChange={(v) => form.setAt(path, v)} id={id} invalid={cissue?.level === \"error\"} readOnly={readOnly} path={path} parent={parent} onBlur={() => form.touch(ck)} />\n </div>\n </FieldShell>\n );\n }\n\n if (field.type === \"array\") return <ArrayField field={field} path={path} parent={parent} />;\n if (field.type === \"slot\") return <SlotField field={field} path={path} />;\n if (field.type === \"object\") return <ObjectField field={field} path={path} />;\n\n const key = pathKey(path);\n const value = form.getAt(path);\n const onChange = (v: unknown) => form.setAt(path, v);\n const onBlur = () => form.touch(key);\n const issue = form.visibleIssue(key);\n const Control = CONTROLS[field.type] ?? FallbackControl;\n const Action = ACTIONS[field.type];\n const f = withDefaultHelp(field, env.isPublished, readOnly);\n const plain = readOnly && PLAIN_TYPES.has(field.type as PrimitiveType);\n const card = field.type === \"boolean\" && field.layout !== \"checkbox\";\n /* an icon's row carries its own name (controls/media.tsx IconImageRow): no label above it as well */\n const iconRow = isIconImage(field, value);\n /* D49: rich text, code and tables open the shared expanded editor (expand.tsx). A lane that registers its\n own ACTIONS[type] owns its expansion too (rich text's editor modal, the table's spreadsheet): the engine draws no\n second modal and binds no second ⌘↵ for it. */\n const expand = plain || Action ? null : expandSpecFor(field, { readOnly, hasKitControl: !!CONTROLS[field.type], variant: env.variant });\n const action =\n Action && (!readOnly || ACTION_WHEN_READ_ONLY.has(field.type)) ? (\n <Action field={f} value={value} onChange={onChange} id={id} readOnly={readOnly} path={path} parent={parent} />\n ) : expand ? (\n <ExpandAction field={f} path={path} spec={expand} />\n ) : undefined;\n return (\n <FieldShell field={f} path={path} id={id} value={value} onChange={onChange} readOnly={readOnly} issue={issue} layout={card ? \"card\" : iconRow ? \"row\" : \"stack\"} action={action}>\n {plain ? (\n card ? null /* the switch card already reads On / Off */ : <PlainValue field={f} value={value} id={id} />\n ) : (\n <div\n onBlur={onBlur}\n onKeyDown={\n expand\n ? (e) => {\n if (!isExpandShortcut(e)) return;\n e.preventDefault();\n openExpanded(expandKey(env.docId, path));\n }\n : undefined\n }\n className=\"min-w-0\"\n >\n <Control field={f} value={value} onChange={onChange} id={id} invalid={issue?.level === \"error\"} readOnly={readOnly} path={path} parent={parent} onBlur={onBlur} />\n </div>\n )}\n {expand ? (\n <ExpandedField field={f} path={path} spec={expand} Control={Control} value={value} onChange={onChange} onBlur={onBlur} invalid={issue?.level === \"error\"} id={id} parent={parent} />\n ) : null}\n </FieldShell>\n );\n}\n\n/**\n * A row that opens something (V2 NavRow): type tile, title over a summary line, the field's chrome (from RowChrome),\n * the issue rollup and a chevron.\n * Like V2 it always draws its button and chevron, also with no `onClick` (a popover trigger around it opens on the\n * click). Only `inert` (the form draws no frames, so nothing can open) leaves both out.\n */\nexport function NavRow({\n icon,\n title,\n subtitle,\n path,\n onClick,\n inert,\n className,\n trailing,\n}: {\n icon?: string;\n title: string;\n subtitle?: string;\n path?: FieldPath;\n onClick?: () => void;\n inert?: boolean;\n className?: string;\n trailing?: React.ReactNode;\n}) {\n const form = useForm();\n const roll = path && form ? form.rollup(path) : { errors: 0, warnings: 0 };\n const subId = React.useId();\n const chrome = React.useContext(RowChrome);\n const text = (\n <>\n <span className=\"block truncate text-kit-sm text-kit-fg\">{title}</span>\n <span id={subId} className=\"block truncate text-kit-xs text-kit-fg-3\">\n {subtitle || \"Nothing set yet\"}\n </span>\n </>\n );\n return (\n <div\n className={cn(\n \"group/nav relative flex min-h-11 w-full min-w-0 items-center gap-2.5 rounded-kit-lg border border-kit-line-strong bg-kit-control-bg py-1.5 pl-2 pr-2 text-left transition-colors hover:border-[var(--kit-emphasis-line)] hover:bg-kit-subtle\",\n className,\n )}\n >\n <span className=\"flex size-7 shrink-0 items-center justify-center rounded-kit-md bg-kit-muted text-kit-fg-2\">\n <KitIcon name={icon} fallback=\"folder\" className=\"size-4\" />\n </span>\n {!inert ? (\n <button\n type=\"button\"\n data-nav-main\n onClick={onClick}\n aria-label={`Open ${title}${roll.errors ? `, ${roll.errors} ${roll.errors === 1 ? \"issue\" : \"issues\"}` : \"\"}`}\n aria-describedby={subId}\n className=\"min-w-0 flex-1 text-left outline-none after:absolute after:inset-0 after:rounded-kit-lg after:content-[''] focus-visible:after:outline-2 focus-visible:after:outline-offset-2 focus-visible:after:outline-kit-focus-ring focus-visible:after:[outline-style:solid] [html[data-input-modality=pointer]_&]:focus-visible:after:outline-none\"\n >\n {text}\n </button>\n ) : (\n <div data-nav-main className=\"min-w-0 flex-1 text-left\">\n {text}\n </div>\n )}\n <IssueDot errors={roll.errors} warnings={roll.warnings} className=\"relative\" />\n {chrome ? <span className=\"relative z-[1] flex shrink-0 items-center gap-0.5 empty:hidden\">{chrome}</span> : null}\n {trailing}\n {!inert ? <IconChevronRight aria-hidden className=\"pointer-events-none size-4 shrink-0 text-kit-fg-3 transition-transform group-hover/nav:translate-x-0.5\" stroke={1.5} /> : null}\n </div>\n );\n}\n\n/* ── Object: inline · drill · popover · dialog (V2 ObjectField) ───── */\n\nfunction ObjectField({ field, path }: { field: FieldSchema; path: FieldPath }) {\n const form = useForm()!;\n const id = React.useId();\n const { readOnly } = useFieldAccess(field);\n const depth = useInsetDepth();\n const value = form.getAt(path);\n const obj = isObj(value) ? value : {};\n const fields = field.fields ?? [];\n /* D45 nesting rule: one container per level. Inside an inset (or an expanded row) an \"inline\" object would be a box in a\n box, so it drills instead — level 3+ is always a new frame, never more indentation. */\n const wanted = objectOpenMode(field);\n const mode = wanted === \"inline\" && depth > 0 ? \"drill\" : wanted;\n const [open, setOpen] = React.useState(false);\n const sum = groupSummary(fields, obj) || summarize(fields, obj);\n const nav = React.useRef<{ back: () => boolean }>(null);\n const shell = (control: React.ReactNode, layout?: \"row\") => (\n <FieldShell field={field} path={path} id={id} value={value} onChange={(v) => form.setAt(path, v)} readOnly={readOnly} issue={form.visibleIssue(pathKey(path))} layout={layout}>\n {control}\n </FieldShell>\n );\n if (mode === \"inline\") {\n const cc = condCtx(form, path);\n const visible = fields.filter((f) => !isHidden(f, obj, cc));\n /* D63: label, then the children behind one inset line; short neighbours pair up only on a wide form */\n return shell(\n <FieldInset label={field.title}>\n <FieldRun fields={visible} values={obj} render={(f) => <KitField field={f} path={[...path, f.name]} parent={obj} />} />\n </FieldInset>,\n );\n }\n const help = resolveHelp(field) ?? \"\";\n if (mode === \"popover\")\n /* V2: Radix <PopoverTrigger asChild><div> — the whole row is the trigger (aria-expanded, aria-haspopup=\"dialog\");\n NavRow gets no onClick but still draws its button (\"Open <title>\") and chevron, whose click opens the popover. */\n return shell(\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger nativeButton={false} render={<div />}>\n <NavRow icon={field.icon} title={field.title} subtitle={sum || help} path={path} />\n </PopoverTrigger>\n <PopoverContent className=\"w-[340px] p-3\" align=\"start\">\n <FieldList fields={fields} basePath={path} memoryKey={`pop:${pathKey(path)}`} />\n </PopoverContent>\n </Popover>,\n \"row\",\n );\n if (mode === \"dialog\")\n return shell(\n <>\n <NavRow icon={field.icon} title={field.title} subtitle={sum || help} path={path} onClick={() => setOpen(true)} />\n <Modal\n open={open}\n onOpenChange={(o, d) => {\n // Escape steps back inside the dialog's own frames first (V2: onEscapeKeyDown + nav.back())\n if (!o && d.reason === \"escape-key\" && nav.current?.back()) return d.cancel();\n setOpen(o);\n }}\n >\n <ModalContent size=\"lg\">\n <ModalHeader title={field.title} description={field.description} />\n <ModalBody className=\"flex min-h-[320px] flex-col gap-5\">\n <NestedForm fields={fields} title={field.title} icon={field.icon} path={path} navRef={nav} />\n </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={() => setOpen(false)}>\n Done\n </Button>\n </ModalFooter>\n </ModalContent>\n </Modal>\n </>,\n \"row\",\n );\n return shell(<NavRow icon={field.icon} title={field.title} subtitle={sum || help} path={path} onClick={() => form.navigate(path)} inert={!form.canNavigate} />, \"row\");\n}\n\n/**\n * A dialog gets its OWN navigation stack: lists inside it drill inside the dialog (breadcrumb, Esc, stepper), never the\n * panel behind. Writes go straight into the parent form at `path`.\n */\nexport function NestedForm({ fields, title, icon, path, navRef }: NestedFormProps) {\n const form = useForm()!;\n const env = useKitEnv();\n const key = pathKey(path);\n const schema = React.useMemo(() => ({ name: key || \"nested\", title, icon, kind: \"object\" as const, fields }), [key, title, icon, fields]);\n const raw = form.getAt(path);\n const pub = form.hasPublished ? form.publishedAt(path) : undefined;\n const presence = React.useMemo(() => {\n const out: Record<string, KitPeer[]> = {};\n for (const [k, v] of Object.entries(env.presence)) if (k.startsWith(`${key}.`)) out[k.slice(key.length + 1)] = v;\n return out;\n }, [env.presence, key]);\n return (\n <SchemaForm\n schema={schema}\n value={isObj(raw) ? raw : {}}\n onChange={(v) => form.setAt(path, v)}\n variant=\"document\"\n scroll={false}\n navRef={navRef}\n resolveSchema={form.resolveSchema}\n blockLibrary={form.blockLibrary}\n published={isObj(pub) ? pub : undefined}\n presence={presence}\n readOnly={env.readOnly}\n showErrors={form.showAllErrors}\n onOpenReference={env.onOpenReference}\n env={{ docId: `${env.docId}:${key}`, docTitle: env.docTitle, urlPrefix: env.urlPrefix, isPublished: env.isPublished, palette: env.palette, helpDisplay: env.helpDisplay }}\n />\n );\n}\n\n/* ── Read-only as plain text (D58 §0): no greyed input, just the value ── */\nconst PLAIN_TYPES = new Set<PrimitiveType>([\"string\", \"text\", \"richtext\", \"number\", \"slug\", \"url\", \"email\", \"date\", \"datetime\", \"select\", \"multiselect\", \"tags\", \"boolean\", \"rating\"]);\nexport function plainOf(field: FieldSchema, value: unknown): string {\n if (value == null || value === \"\") return \"\";\n const label = (v: unknown) => field.options?.find((o) => o.value === v)?.label ?? String(v);\n if (field.type === \"boolean\") return value ? \"On\" : \"Off\";\n if (field.type === \"select\") return label(value);\n // before the list arm: stored rich text may be a Portable Text block array\n if (field.type === \"richtext\") return plainText(value);\n if (Array.isArray(value)) return value.map(label).join(\", \");\n if (field.type === \"date\" || field.type === \"datetime\") {\n const d = new Date(String(value).replace(/\\[.*\\]$/, \"\"));\n return Number.isNaN(+d) ? String(value) : d.toLocaleString(\"en-US\", field.type === \"date\" ? { month: \"short\", day: \"numeric\", year: \"numeric\" } : { month: \"short\", day: \"numeric\", year: \"numeric\", hour: \"numeric\", minute: \"2-digit\" });\n }\n if (field.type === \"number\" && isObj(value)) return String((value as { value?: unknown }).value ?? \"\");\n return typeof value === \"object\" ? \"\" : String(value);\n}\nfunction PlainValue({ field, value, id }: { field: FieldSchema; value: unknown; id: string }) {\n const text = plainOf(field, value);\n return (\n // NEW-Q48-PLAINLABEL: a <p> is not labelable, so label[for] named nothing; the group is named \"<field> <value>\"\n <p id={id} tabIndex={0} role=\"group\" aria-labelledby={`${id}-label ${id}`} data-slot=\"kit-plain\" className={cn(\"min-w-0 whitespace-pre-wrap break-words text-kit-sm leading-6 text-kit-fg outline-none\", (field.type === \"slug\" || field.type === \"url\") && \"font-kit-mono text-kit-xs leading-6\")}>\n {text || <span className=\"text-kit-fg-3\">Empty</span>}\n </p>\n );\n}\n\n/* ── Unknown type: the raw value, in the JSON control ── */\n/**\n * Every SchemaType has a kit control (kit-field.test checks CONTROLS against the type list in schema/types.ts). A field\n * whose type is none of them edits its raw stored value in the JSON control, tagged `data-kit-fallback=\"<type>\"`: the\n * value is shown and kept, and an edit is written only once it parses.\n */\nexport function FallbackControl(props: ControlProps) {\n return (\n <div data-kit-fallback={props.field.type} className=\"min-w-0\">\n <JsonControl {...props} />\n </div>\n );\n}\n\n/* ── Hand-off: the host's own control for a value the kit refuses ── */\n/**\n * A control that cannot carry a stored value unchanged (rich text holding formatting its editor would drop) hands that\n * value to the host's control for the type (KitServices.LegacyControl: the dashboard's FieldRenderer arm), bare inside\n * the kit FieldShell, which owns the label and the help; the control names its reason above it. The box carries\n * `data-kit-legacy=\"<type>\"`, so the parity harness counts it (mismatch class `legacy-control`). A host with no legacy\n * service, or a control that throws while rendering, says why in words; the form around it keeps working.\n */\nexport function LegacyFallback(props: ControlProps) {\n const { LegacyControl } = useKitServices();\n const { field, id } = props;\n return (\n <div data-kit-legacy={field.type} className=\"min-w-0\">\n {LegacyControl ? (\n // keyed by the schema's content: a schema edit remounts the control (KitField hands over a fresh field object on\n // every render, so identity would remount on every keystroke). A value change retries in place (componentDidUpdate).\n <LegacyBoundary key={JSON.stringify(field)} field={field} id={id} value={props.value}>\n <LegacyControl {...props} />\n </LegacyBoundary>\n ) : (\n <LegacyRefusal id={id}>This view has no control for {field.type} fields.</LegacyRefusal>\n )}\n </div>\n );\n}\n\n/**\n * An `<output>`: a labelable element, so the FieldShell label's `for` lands on it, and focusable, so a keyboard user\n * reaches the reason. The neutral focus ring shows under keyboard modality only.\n */\nfunction LegacyRefusal({ id, children }: { id: string; children: React.ReactNode }) {\n return (\n <output\n id={id}\n role=\"note\"\n tabIndex={0}\n data-slot=\"kit-legacy-refusal\"\n className=\"block rounded-kit-sm text-kit-xs text-kit-fg-3 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-kit-focus-ring focus-visible:[outline-style:solid] [html[data-input-modality=pointer]_&]:focus-visible:outline-0\"\n >\n {children}\n </output>\n );\n}\n\n/** Retries the control once its field or value changes (a schema edit, a save from elsewhere, an undo). */\nclass LegacyBoundary extends React.Component<{ field: FieldSchema; id: string; value: unknown; children: React.ReactNode }, { reason: string | null }> {\n state = { reason: null as string | null };\n static getDerivedStateFromError(error: unknown) {\n return { reason: error instanceof Error ? error.message : String(error) };\n }\n componentDidUpdate(prev: { field: FieldSchema; value: unknown }) {\n if (this.state.reason === null) return;\n // by content: KitField hands over a fresh field object (withDefaultHelp) on every render\n if (prev.value !== this.props.value || JSON.stringify(prev.field) !== JSON.stringify(this.props.field)) this.setState({ reason: null });\n }\n render() {\n if (this.state.reason === null) return this.props.children;\n return (\n <LegacyRefusal id={this.props.id}>\n The {this.props.field.title} control could not load: {this.state.reason}\n </LegacyRefusal>\n );\n }\n}\n"],"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K,MAAM;EAClD,OACE,qBAAC,eAAD;GAAe,IAAI,KAAK,MAAM;GAA9B,UAAA;IAAkC;IAC3B,KAAK,MAAM,MAAM;IAAM;IAA0B,KAAK,MAAM;GACpD;;CAEnB;AACF"}
|
|
1
|
+
{"version":3,"file":"kit-field.js","names":[],"sources":["../../src/engine/kit-field.tsx"],"sourcesContent":["/**\n * KitField — renders ONE field of the schema at `path` (must be inside <SchemaForm>): the shell + the control for its\n * type (V2 HEAD 9829bf1 kit/engine/kit-field.tsx).\n *\n * Arrays (array.tsx) and slots (slot.tsx) get their rows; objects open inline (FieldInset), drill (NavRow -> a frame),\n * popover or dialog (NestedForm: its own navigation stack). Primitive types dispatch through the CONTROLS table, which\n * the controls lanes fill. Every SchemaType has a control there; a type that is none of them (a schema newer than this\n * kit) edits its raw value in the JSON control (FallbackControl), never nothing and never a stand-in.\n */\nimport * as React from \"react\";\nimport type { ComponentType } from \"react\";\nimport { IconChevronRight } from \"@tabler/icons-react\";\nimport { KitIcon } from \"../lib/icons\";\nimport { cn } from \"../lib/cn\";\nimport type { FieldPath, FieldSchema, PrimitiveType, SchemaType } from \"../schema/types\";\nimport { resolveHelp } from \"../schema/help\";\nimport type { ControlProps } from \"../types\";\nimport { resolveFieldAccess, useForm, useKitEnv, useKitServices, type KitPeer } from \"../context\";\nimport { Button } from \"../ui/button\";\nimport { Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, Popover, PopoverContent, PopoverTrigger } from \"../ui/overlay\";\nimport { isObj, pathKey } from \"../lib/path\";\nimport { condCtx, isHidden, objectOpenMode, plainText, summarize } from \"../lib/schema\";\nimport { isIconImage } from \"../lib/icon-image\";\nimport { ArrayField, type NestedFormProps } from \"./array\";\nimport { ExpandAction, ExpandedField, expandKey, expandSpecFor, isExpandShortcut, openExpanded } from \"./expand\";\nimport { FieldShell } from \"./field-shell\";\nimport { FieldList } from \"./field-list\";\nimport { IssueDot, RowChrome } from \"./bits\";\nimport { FieldInset, FieldRun, groupSummary, useInsetDepth } from \"./grouping\";\nimport { SchemaForm } from \"./schema-form\";\nimport { SlotField } from \"./slot\";\nimport { JsonControl } from \"../controls/json\";\nimport { FieldBoundary, HeldField, HeldValue } from \"./held\";\n\nexport interface KitFieldProps {\n field: FieldSchema;\n path: (string | number)[];\n parent?: Record<string, unknown>;\n}\n\n/** Type → control. Registered by the controls lane; a type with no entry edits its raw value (FallbackControl). */\nexport const CONTROLS: Partial<Record<SchemaType, ComponentType<ControlProps>>> = {};\n\n/**\n * Type → label-row action (DESIGN 4.4: slug Generate, rich text expand, table Edit in full screen), registered by the\n * controls lane next to its control. It gets the control's props. V2 draws it only while the field is editable, except\n * the types in ACTION_WHEN_READ_ONLY, whose action takes `readOnly` and decides for itself (slug Generate).\n */\nexport const ACTIONS: Partial<Record<SchemaType, ComponentType<ControlProps>>> = {};\nexport const ACTION_WHEN_READ_ONLY = new Set<SchemaType>([\"slug\"]);\n\n/** D58: the field for the lens: read-only (plain text) when it can't edit it. Hidden fields never reach here\n * (SchemaForm drops them from the schema). */\nexport function useFieldAccess(field: FieldSchema) {\n const env = useKitEnv();\n return { readOnly: resolveFieldAccess(field, env).readOnly };\n}\n\n/** CPO D39: the field's help line — schema text first, then a line computed from its settings, then the house convention. */\nexport function withDefaultHelp(field: FieldSchema, isPublished?: boolean, readOnly?: boolean): FieldSchema {\n let computed: string | undefined;\n /* a value set elsewhere says where, in one plain line (never a lock or a key) */\n if (readOnly && field.lockReason) return { ...field, description: field.lockReason.replace(/\\.?$/, \".\") };\n if (field.type === \"slug\" && !isPublished) computed = \"Follows the title until you change it or publish.\";\n else if (field.type === \"number\" && !field.scale && field.layout !== \"slider\" && field.numeric?.unit) {\n /* D63: the unit sits in the input (\"/ 5\", \"min\"), so a line that only restates it or its range is noise. A range\n still earns a line when the unit does not already say it (\"Between 1 and 12 items.\"). */\n const { min, max, unit } = field.numeric;\n const said = unit.startsWith(\"/\") || (max != null && unit.includes(String(max)));\n computed = said || (min == null && max == null) ? \"\" : min != null && max != null ? `Between ${min} and ${max} ${unit}.` : min != null ? `${min} ${unit} or more.` : `Up to ${max} ${unit}.`;\n } else if (field.type === \"number\" && !field.scale && field.layout !== \"slider\" && (field.numeric?.min != null || field.numeric?.max != null)) {\n const { min, max } = field.numeric ?? {};\n computed = min != null && max != null ? `Between ${min} and ${max}.` : min != null ? `${min} or more.` : `Up to ${max}.`;\n }\n /* resolve here so the computed line wins over the house convention; \"\" survives as \"deliberately none\" */\n const help = resolveHelp(field, computed) ?? \"\";\n return help === field.description ? field : { ...field, description: help };\n}\n\n/**\n * One field. A held field (FieldSchema.held, or a reason from KitServices.heldReason) renders read-only with its reason\n * and is never written; a control that throws while rendering holds that one field (FieldBoundary).\n */\nexport function KitField(props: KitFieldProps) {\n const form = useForm();\n return (\n <FieldBoundary field={props.field} path={props.path} value={form?.getAt(props.path)}>\n <KitFieldBody {...props} />\n </FieldBoundary>\n );\n}\n\nfunction KitFieldBody({ field, path, parent }: KitFieldProps) {\n const form = useForm();\n const env = useKitEnv();\n const services = useKitServices();\n const id = React.useId();\n const { readOnly } = useFieldAccess(field);\n if (!form) return null;\n\n const heldReason = field.held?.reason || services.heldReason?.({ field, path, value: form.getAt(path) });\n if (heldReason) return <HeldField field={withDefaultHelp(field, env.isPublished, true)} path={path} reason={heldReason} />;\n\n /* a host's own control for this field (KitEnv.controls), inside the usual shell */\n const Custom = env.controls?.[pathKey(path)];\n if (Custom) {\n const ck = pathKey(path);\n const cissue = form.visibleIssue(ck);\n const cf = withDefaultHelp(field, env.isPublished, readOnly);\n return (\n <FieldShell field={cf} path={path} id={id} value={form.getAt(path)} onChange={(v) => form.setAt(path, v)} readOnly={readOnly} issue={cissue}>\n <div onBlur={() => form.touch(ck)} className=\"min-w-0\">\n <Custom field={cf} value={form.getAt(path)} onChange={(v) => form.setAt(path, v)} id={id} invalid={cissue?.level === \"error\"} readOnly={readOnly} path={path} parent={parent} onBlur={() => form.touch(ck)} />\n </div>\n </FieldShell>\n );\n }\n\n if (field.type === \"array\") return <ArrayField field={field} path={path} parent={parent} />;\n if (field.type === \"slot\") return <SlotField field={field} path={path} />;\n if (field.type === \"object\") return <ObjectField field={field} path={path} />;\n\n const key = pathKey(path);\n const value = form.getAt(path);\n const onChange = (v: unknown) => form.setAt(path, v);\n const onBlur = () => form.touch(key);\n const issue = form.visibleIssue(key);\n const Control = CONTROLS[field.type] ?? FallbackControl;\n const Action = ACTIONS[field.type];\n const f = withDefaultHelp(field, env.isPublished, readOnly);\n const plain = readOnly && PLAIN_TYPES.has(field.type as PrimitiveType);\n const card = field.type === \"boolean\" && field.layout !== \"checkbox\";\n /* an icon's row carries its own name (controls/media.tsx IconImageRow): no label above it as well */\n const iconRow = isIconImage(field, value);\n /* D49: rich text, code and tables open the shared expanded editor (expand.tsx). A lane that registers its\n own ACTIONS[type] owns its expansion too (rich text's editor modal, the table's spreadsheet): the engine draws no\n second modal and binds no second ⌘↵ for it. */\n const expand = plain || Action ? null : expandSpecFor(field, { readOnly, hasKitControl: !!CONTROLS[field.type], variant: env.variant });\n const action =\n Action && (!readOnly || ACTION_WHEN_READ_ONLY.has(field.type)) ? (\n <Action field={f} value={value} onChange={onChange} id={id} readOnly={readOnly} path={path} parent={parent} />\n ) : expand ? (\n <ExpandAction field={f} path={path} spec={expand} />\n ) : undefined;\n return (\n <FieldShell field={f} path={path} id={id} value={value} onChange={onChange} readOnly={readOnly} issue={issue} layout={card ? \"card\" : iconRow ? \"row\" : \"stack\"} action={action}>\n {plain ? (\n card ? null /* the switch card already reads On / Off */ : <PlainValue field={f} value={value} id={id} />\n ) : (\n <div\n onBlur={onBlur}\n onKeyDown={\n expand\n ? (e) => {\n if (!isExpandShortcut(e)) return;\n e.preventDefault();\n openExpanded(expandKey(env.docId, path));\n }\n : undefined\n }\n className=\"min-w-0\"\n >\n <Control field={f} value={value} onChange={onChange} id={id} invalid={issue?.level === \"error\"} readOnly={readOnly} path={path} parent={parent} onBlur={onBlur} />\n </div>\n )}\n {expand ? (\n <ExpandedField field={f} path={path} spec={expand} Control={Control} value={value} onChange={onChange} onBlur={onBlur} invalid={issue?.level === \"error\"} id={id} parent={parent} />\n ) : null}\n </FieldShell>\n );\n}\n\n/**\n * A row that opens something (V2 NavRow): type tile, title over a summary line, the field's chrome (from RowChrome),\n * the issue rollup and a chevron.\n * Like V2 it always draws its button and chevron, also with no `onClick` (a popover trigger around it opens on the\n * click). Only `inert` (the form draws no frames, so nothing can open) leaves both out.\n */\nexport function NavRow({\n icon,\n title,\n subtitle,\n path,\n onClick,\n inert,\n className,\n trailing,\n}: {\n icon?: string;\n title: string;\n subtitle?: string;\n path?: FieldPath;\n onClick?: () => void;\n inert?: boolean;\n className?: string;\n trailing?: React.ReactNode;\n}) {\n const form = useForm();\n const roll = path && form ? form.rollup(path) : { errors: 0, warnings: 0 };\n const subId = React.useId();\n const chrome = React.useContext(RowChrome);\n const text = (\n <>\n <span className=\"block truncate text-kit-sm text-kit-fg\">{title}</span>\n <span id={subId} className=\"block truncate text-kit-xs text-kit-fg-3\">\n {subtitle || \"Nothing set yet\"}\n </span>\n </>\n );\n return (\n <div\n className={cn(\n \"group/nav relative flex min-h-11 w-full min-w-0 items-center gap-2.5 rounded-kit-lg border border-kit-line-strong bg-kit-control-bg py-1.5 pl-2 pr-2 text-left transition-colors hover:border-[var(--kit-emphasis-line)] hover:bg-kit-subtle\",\n className,\n )}\n >\n <span className=\"flex size-7 shrink-0 items-center justify-center rounded-kit-md bg-kit-muted text-kit-fg-2\">\n <KitIcon name={icon} fallback=\"folder\" className=\"size-4\" />\n </span>\n {!inert ? (\n <button\n type=\"button\"\n data-nav-main\n onClick={onClick}\n aria-label={`Open ${title}${roll.errors ? `, ${roll.errors} ${roll.errors === 1 ? \"issue\" : \"issues\"}` : \"\"}`}\n aria-describedby={subId}\n className=\"min-w-0 flex-1 text-left outline-none after:absolute after:inset-0 after:rounded-kit-lg after:content-[''] focus-visible:after:outline-2 focus-visible:after:outline-offset-2 focus-visible:after:outline-kit-focus-ring focus-visible:after:[outline-style:solid] [html[data-input-modality=pointer]_&]:focus-visible:after:outline-none\"\n >\n {text}\n </button>\n ) : (\n <div data-nav-main className=\"min-w-0 flex-1 text-left\">\n {text}\n </div>\n )}\n <IssueDot errors={roll.errors} warnings={roll.warnings} className=\"relative\" />\n {chrome ? <span className=\"relative z-[1] flex shrink-0 items-center gap-0.5 empty:hidden\">{chrome}</span> : null}\n {trailing}\n {!inert ? <IconChevronRight aria-hidden className=\"pointer-events-none size-4 shrink-0 text-kit-fg-3 transition-transform group-hover/nav:translate-x-0.5\" stroke={1.5} /> : null}\n </div>\n );\n}\n\n/* ── Object: inline · drill · popover · dialog (V2 ObjectField) ───── */\n\nfunction ObjectField({ field, path }: { field: FieldSchema; path: FieldPath }) {\n const form = useForm()!;\n const id = React.useId();\n const { readOnly } = useFieldAccess(field);\n const depth = useInsetDepth();\n const value = form.getAt(path);\n const obj = isObj(value) ? value : {};\n const fields = field.fields ?? [];\n /* D45 nesting rule: one container per level. Inside an inset (or an expanded row) an \"inline\" object would be a box in a\n box, so it drills instead — level 3+ is always a new frame, never more indentation. */\n const wanted = objectOpenMode(field);\n const mode = wanted === \"inline\" && depth > 0 ? \"drill\" : wanted;\n const [open, setOpen] = React.useState(false);\n const sum = groupSummary(fields, obj) || summarize(fields, obj);\n const nav = React.useRef<{ back: () => boolean }>(null);\n const shell = (control: React.ReactNode, layout?: \"row\") => (\n <FieldShell field={field} path={path} id={id} value={value} onChange={(v) => form.setAt(path, v)} readOnly={readOnly} issue={form.visibleIssue(pathKey(path))} layout={layout}>\n {control}\n </FieldShell>\n );\n if (mode === \"inline\") {\n const cc = condCtx(form, path);\n const visible = fields.filter((f) => !isHidden(f, obj, cc));\n /* D63: label, then the children behind one inset line; short neighbours pair up only on a wide form */\n return shell(\n <FieldInset label={field.title}>\n <FieldRun fields={visible} values={obj} render={(f) => <KitField field={f} path={[...path, f.name]} parent={obj} />} />\n </FieldInset>,\n );\n }\n const help = resolveHelp(field) ?? \"\";\n if (mode === \"popover\")\n /* V2: Radix <PopoverTrigger asChild><div> — the whole row is the trigger (aria-expanded, aria-haspopup=\"dialog\");\n NavRow gets no onClick but still draws its button (\"Open <title>\") and chevron, whose click opens the popover. */\n return shell(\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger nativeButton={false} render={<div />}>\n <NavRow icon={field.icon} title={field.title} subtitle={sum || help} path={path} />\n </PopoverTrigger>\n <PopoverContent className=\"w-[340px] p-3\" align=\"start\">\n <FieldList fields={fields} basePath={path} memoryKey={`pop:${pathKey(path)}`} />\n </PopoverContent>\n </Popover>,\n \"row\",\n );\n if (mode === \"dialog\")\n return shell(\n <>\n <NavRow icon={field.icon} title={field.title} subtitle={sum || help} path={path} onClick={() => setOpen(true)} />\n <Modal\n open={open}\n onOpenChange={(o, d) => {\n // Escape steps back inside the dialog's own frames first (V2: onEscapeKeyDown + nav.back())\n if (!o && d.reason === \"escape-key\" && nav.current?.back()) return d.cancel();\n setOpen(o);\n }}\n >\n <ModalContent size=\"lg\">\n <ModalHeader title={field.title} description={field.description} />\n <ModalBody className=\"flex min-h-[320px] flex-col gap-5\">\n <NestedForm fields={fields} title={field.title} icon={field.icon} path={path} navRef={nav} />\n </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={() => setOpen(false)}>\n Done\n </Button>\n </ModalFooter>\n </ModalContent>\n </Modal>\n </>,\n \"row\",\n );\n return shell(<NavRow icon={field.icon} title={field.title} subtitle={sum || help} path={path} onClick={() => form.navigate(path)} inert={!form.canNavigate} />, \"row\");\n}\n\n/**\n * A dialog gets its OWN navigation stack: lists inside it drill inside the dialog (breadcrumb, Esc, stepper), never the\n * panel behind. Writes go straight into the parent form at `path`.\n */\nexport function NestedForm({ fields, title, icon, path, navRef }: NestedFormProps) {\n const form = useForm()!;\n const env = useKitEnv();\n const key = pathKey(path);\n const schema = React.useMemo(() => ({ name: key || \"nested\", title, icon, kind: \"object\" as const, fields }), [key, title, icon, fields]);\n const raw = form.getAt(path);\n const pub = form.hasPublished ? form.publishedAt(path) : undefined;\n const presence = React.useMemo(() => {\n const out: Record<string, KitPeer[]> = {};\n for (const [k, v] of Object.entries(env.presence)) if (k.startsWith(`${key}.`)) out[k.slice(key.length + 1)] = v;\n return out;\n }, [env.presence, key]);\n return (\n <SchemaForm\n schema={schema}\n value={isObj(raw) ? raw : {}}\n onChange={(v) => form.setAt(path, v)}\n variant=\"document\"\n scroll={false}\n navRef={navRef}\n resolveSchema={form.resolveSchema}\n blockLibrary={form.blockLibrary}\n published={isObj(pub) ? pub : undefined}\n presence={presence}\n readOnly={env.readOnly}\n showErrors={form.showAllErrors}\n onOpenReference={env.onOpenReference}\n env={{ docId: `${env.docId}:${key}`, docTitle: env.docTitle, urlPrefix: env.urlPrefix, isPublished: env.isPublished, palette: env.palette, helpDisplay: env.helpDisplay }}\n />\n );\n}\n\n/* ── Read-only as plain text (D58 §0): no greyed input, just the value ── */\nconst PLAIN_TYPES = new Set<PrimitiveType>([\"string\", \"text\", \"richtext\", \"number\", \"slug\", \"url\", \"email\", \"date\", \"datetime\", \"select\", \"multiselect\", \"tags\", \"boolean\", \"rating\"]);\nexport function plainOf(field: FieldSchema, value: unknown): string {\n if (value == null || value === \"\") return \"\";\n const label = (v: unknown) => field.options?.find((o) => o.value === v)?.label ?? String(v);\n if (field.type === \"boolean\") return value ? \"On\" : \"Off\";\n if (field.type === \"select\") return label(value);\n // before the list arm: stored rich text may be a Portable Text block array\n if (field.type === \"richtext\") return plainText(value);\n if (Array.isArray(value)) return value.map(label).join(\", \");\n if (field.type === \"date\" || field.type === \"datetime\") {\n const d = new Date(String(value).replace(/\\[.*\\]$/, \"\"));\n return Number.isNaN(+d) ? String(value) : d.toLocaleString(\"en-US\", field.type === \"date\" ? { month: \"short\", day: \"numeric\", year: \"numeric\" } : { month: \"short\", day: \"numeric\", year: \"numeric\", hour: \"numeric\", minute: \"2-digit\" });\n }\n if (field.type === \"number\" && isObj(value)) return String((value as { value?: unknown }).value ?? \"\");\n return typeof value === \"object\" ? \"\" : String(value);\n}\nfunction PlainValue({ field, value, id }: { field: FieldSchema; value: unknown; id: string }) {\n const text = plainOf(field, value);\n return (\n // NEW-Q48-PLAINLABEL: a <p> is not labelable, so label[for] named nothing; the group is named \"<field> <value>\"\n <p id={id} tabIndex={0} role=\"group\" aria-labelledby={`${id}-label ${id}`} data-slot=\"kit-plain\" className={cn(\"min-w-0 whitespace-pre-wrap break-words text-kit-sm leading-6 text-kit-fg outline-none\", (field.type === \"slug\" || field.type === \"url\") && \"font-kit-mono text-kit-xs leading-6\")}>\n {text || <span className=\"text-kit-fg-3\">Empty</span>}\n </p>\n );\n}\n\n/* ── Unknown type: the raw value, in the JSON control ── */\n/**\n * Every SchemaType has a kit control (kit-field.test checks CONTROLS against the type list in schema/types.ts). A field\n * whose type is none of them edits its raw stored value in the JSON control, tagged `data-kit-fallback=\"<type>\"`: the\n * value is shown and kept, and an edit is written only once it parses.\n */\nexport function FallbackControl(props: ControlProps) {\n return (\n <div data-kit-fallback={props.field.type} className=\"min-w-0\">\n <JsonControl {...props} />\n </div>\n );\n}\n\n/* ── Hand-off: the host's own control for a value the kit refuses ── */\n/**\n * A control that cannot carry a stored value unchanged (rich text holding formatting its editor would drop) hands that\n * value to the host's control for the type (KitServices.LegacyControl: the dashboard's FieldRenderer arm), bare inside\n * the kit FieldShell, which owns the label and the help; the control names its reason above it. The box carries\n * `data-kit-legacy=\"<type>\"`, so the parity harness counts it (mismatch class `legacy-control`). A control that throws\n * while rendering says why in words; the form around it keeps working.\n * Kit 3.2.0: a host with no LegacyControl gets a HELD field instead (held.tsx: the value read-only, with the reason, no\n * `data-kit-legacy`). LegacyControl, this hand-off and `data-kit-legacy` are removed in 4.0.0.\n */\nexport function LegacyFallback(props: ControlProps) {\n const { LegacyControl } = useKitServices();\n const { field, id } = props;\n if (!LegacyControl) return <HeldValue field={field} value={props.value} id={id} reason={`this view has no control for ${field.type} fields`} />;\n return (\n <div data-kit-legacy={field.type} className=\"min-w-0\">\n {/* keyed by the schema's content: a schema edit remounts the control (KitField hands over a fresh field object on\n every render, so identity would remount on every keystroke). A value change retries in place (componentDidUpdate). */}\n <LegacyBoundary key={JSON.stringify(field)} field={field} id={id} value={props.value}>\n <LegacyControl {...props} />\n </LegacyBoundary>\n </div>\n );\n}\n\n/**\n * An `<output>`: a labelable element, so the FieldShell label's `for` lands on it, and focusable, so a keyboard user\n * reaches the reason. The neutral focus ring shows under keyboard modality only.\n */\nfunction LegacyRefusal({ id, children }: { id: string; children: React.ReactNode }) {\n return (\n <output\n id={id}\n role=\"note\"\n tabIndex={0}\n data-slot=\"kit-legacy-refusal\"\n className=\"block rounded-kit-sm text-kit-xs text-kit-fg-3 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-kit-focus-ring focus-visible:[outline-style:solid] [html[data-input-modality=pointer]_&]:focus-visible:outline-0\"\n >\n {children}\n </output>\n );\n}\n\n/** Retries the control once its field or value changes (a schema edit, a save from elsewhere, an undo). */\nclass LegacyBoundary extends React.Component<{ field: FieldSchema; id: string; value: unknown; children: React.ReactNode }, { reason: string | null }> {\n state = { reason: null as string | null };\n static getDerivedStateFromError(error: unknown) {\n return { reason: error instanceof Error ? error.message : String(error) };\n }\n componentDidUpdate(prev: { field: FieldSchema; value: unknown }) {\n if (this.state.reason === null) return;\n // by content: KitField hands over a fresh field object (withDefaultHelp) on every render\n if (prev.value !== this.props.value || JSON.stringify(prev.field) !== JSON.stringify(this.props.field)) this.setState({ reason: null });\n }\n render() {\n if (this.state.reason === null) return this.props.children;\n return (\n <LegacyRefusal id={this.props.id}>\n The {this.props.field.title} control could not load: {this.state.reason}\n </LegacyRefusal>\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,IAAa,WAAqE,CAAC;;;;;;AAOnF,IAAa,UAAoE,CAAC;AAClF,IAAa,wCAAwB,IAAI,IAAgB,CAAC,MAAM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OAAgB;EAC9C,OAAO,EAAE,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EAAE;CAC1E;CACA,mBAAmB,MAA8C;EAC/D,IAAI,KAAK,MAAM,WAAW,MAAM;EAEhC,IAAI,KAAK,UAAU,KAAK,MAAM,SAAS,KAAK,UAAU,KAAK,KAAK,MAAM,KAAK,UAAU,KAAK,MAAM,KAAK,GAAG,KAAK,SAAS,EAAE,QAAQ,KAAK,CAAC;CACxI;CACA,SAAS;EACP,IAAI,KAAK,MAAM,WAAW,MAAM,OAAO,KAAK,MAAM;EAClD,OACE,qBAAC,eAAD;GAAe,IAAI,KAAK,MAAM;GAA9B,UAAA;IAAkC;IAC3B,KAAK,MAAM,MAAM;IAAM;IAA0B,KAAK,MAAM;GACpD;;CAEnB;AACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./context";
|
|
|
13
13
|
export type { ControlProps } from "./types";
|
|
14
14
|
export * from "./engine/schema-form";
|
|
15
15
|
export * from "./engine/kit-field";
|
|
16
|
+
export * from "./engine/held";
|
|
16
17
|
export * from "./engine/field-shell";
|
|
17
18
|
export * from "./engine/bits";
|
|
18
19
|
export * from "./engine/group-summary";
|