@bettercms-ai/kit 3.0.2 → 3.1.1
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/schema.js +5 -5
- package/dist/adapters/schema.js.map +1 -1
- package/dist/brand/logo.js +18 -67
- package/dist/brand/logo.js.map +1 -1
- package/dist/context.js +3 -8
- package/dist/context.js.map +1 -1
- package/dist/controls/button.js +134 -451
- package/dist/controls/button.js.map +1 -1
- package/dist/controls/choice.js +95 -336
- package/dist/controls/choice.js.map +1 -1
- package/dist/controls/code.js +72 -245
- package/dist/controls/code.js.map +1 -1
- package/dist/controls/color.js +31 -108
- package/dist/controls/color.js.map +1 -1
- package/dist/controls/date.js +83 -268
- package/dist/controls/date.js.map +1 -1
- package/dist/controls/form-picker.js +9 -26
- package/dist/controls/form-picker.js.map +1 -1
- package/dist/controls/icon.js +100 -341
- package/dist/controls/icon.js.map +1 -1
- package/dist/controls/json.js +7 -20
- package/dist/controls/json.js.map +1 -1
- package/dist/controls/link.js +156 -561
- package/dist/controls/link.js.map +1 -1
- package/dist/controls/location.js +35 -124
- package/dist/controls/location.js.map +1 -1
- package/dist/controls/media.js +267 -928
- package/dist/controls/media.js.map +1 -1
- package/dist/controls/number.js +23 -80
- package/dist/controls/number.js.map +1 -1
- package/dist/controls/reference.js +155 -516
- package/dist/controls/reference.js.map +1 -1
- package/dist/controls/rich-text/article-shell.js +86 -327
- package/dist/controls/rich-text/article-shell.js.map +1 -1
- package/dist/controls/rich-text/author.js +21 -78
- package/dist/controls/rich-text/author.js.map +1 -1
- package/dist/controls/rich-text/blocks.js +317 -1086
- package/dist/controls/rich-text/blocks.js.map +1 -1
- package/dist/controls/rich-text/button.js +10 -31
- package/dist/controls/rich-text/button.js.map +1 -1
- package/dist/controls/rich-text/catalog.js +51 -168
- package/dist/controls/rich-text/catalog.js.map +1 -1
- package/dist/controls/rich-text/columns.js +31 -104
- package/dist/controls/rich-text/columns.js.map +1 -1
- package/dist/controls/rich-text/component-card.js +209 -790
- package/dist/controls/rich-text/component-card.js.map +1 -1
- package/dist/controls/rich-text/component-panel.js +40 -102
- package/dist/controls/rich-text/component-panel.js.map +1 -1
- package/dist/controls/rich-text/control.js +32 -101
- package/dist/controls/rich-text/control.js.map +1 -1
- package/dist/controls/rich-text/editor.js +108 -369
- package/dist/controls/rich-text/editor.js.map +1 -1
- package/dist/controls/rich-text/embed.js +51 -184
- package/dist/controls/rich-text/embed.js.map +1 -1
- package/dist/controls/rich-text/floating.js +42 -171
- package/dist/controls/rich-text/floating.js.map +1 -1
- package/dist/controls/rich-text/footnote.js +28 -89
- package/dist/controls/rich-text/footnote.js.map +1 -1
- package/dist/controls/rich-text/gallery.js +27 -88
- package/dist/controls/rich-text/gallery.js.map +1 -1
- package/dist/controls/rich-text/link-form.d.ts +10 -0
- package/dist/controls/rich-text/link-form.js +16 -204
- package/dist/controls/rich-text/link-form.js.map +1 -1
- package/dist/controls/rich-text/plain.js +3 -8
- package/dist/controls/rich-text/plain.js.map +1 -1
- package/dist/controls/rich-text/related.js +25 -86
- package/dist/controls/rich-text/related.js.map +1 -1
- package/dist/controls/rich-text/toc.js +15 -48
- package/dist/controls/rich-text/toc.js.map +1 -1
- package/dist/controls/rich-text/toolbar.js +105 -402
- package/dist/controls/rich-text/toolbar.js.map +1 -1
- package/dist/controls/scale.js +52 -169
- package/dist/controls/scale.js.map +1 -1
- package/dist/controls/slot.js +73 -238
- package/dist/controls/slot.js.map +1 -1
- package/dist/controls/table/table-editor.js +500 -1766
- package/dist/controls/table/table-editor.js.map +1 -1
- package/dist/controls/table/table-link.js +41 -121
- package/dist/controls/table/table-link.js.map +1 -1
- package/dist/controls/table/table.js +9 -26
- package/dist/controls/table/table.js.map +1 -1
- package/dist/controls/text.js +68 -221
- package/dist/controls/text.js.map +1 -1
- package/dist/controls/unknown-value.js +22 -79
- package/dist/controls/unknown-value.js.map +1 -1
- package/dist/engine/array.js +228 -821
- package/dist/engine/array.js.map +1 -1
- package/dist/engine/bits.js +13 -38
- package/dist/engine/bits.js.map +1 -1
- package/dist/engine/breadcrumb.js +8 -25
- package/dist/engine/breadcrumb.js.map +1 -1
- package/dist/engine/expand.js +13 -38
- package/dist/engine/expand.js.map +1 -1
- package/dist/engine/field-list.js +5 -14
- package/dist/engine/field-list.js.map +1 -1
- package/dist/engine/field-shell.js +244 -849
- package/dist/engine/field-shell.js.map +1 -1
- package/dist/engine/frame.js +78 -275
- package/dist/engine/frame.js.map +1 -1
- package/dist/engine/grouping.js +193 -630
- package/dist/engine/grouping.js.map +1 -1
- package/dist/engine/item-list.js +50 -187
- package/dist/engine/item-list.js.map +1 -1
- package/dist/engine/kit-field.js +95 -320
- package/dist/engine/kit-field.js.map +1 -1
- package/dist/engine/schema-form.js +32 -101
- package/dist/engine/schema-form.js.map +1 -1
- package/dist/engine/slot.js +45 -146
- package/dist/engine/slot.js.map +1 -1
- package/dist/lib/icons.js +5 -14
- package/dist/lib/icons.js.map +1 -1
- package/dist/library/kit-catalog.json +2 -1
- package/dist/styles.css +1 -5821
- package/dist/table/table-view.js +16 -49
- package/dist/table/table-view.js.map +1 -1
- package/dist/testing/test-form.js +5 -14
- package/dist/testing/test-form.js.map +1 -1
- package/dist/theme.js +3 -8
- package/dist/theme.js.map +1 -1
- package/dist/ui/action-tray.js +24 -97
- package/dist/ui/action-tray.js.map +1 -1
- package/dist/ui/autocomplete.js +38 -135
- package/dist/ui/autocomplete.js.map +1 -1
- package/dist/ui/button.js +31 -108
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/choice-switch.js +5 -14
- package/dist/ui/choice-switch.js.map +1 -1
- package/dist/ui/controls.js +86 -279
- package/dist/ui/controls.js.map +1 -1
- package/dist/ui/display.js +116 -401
- package/dist/ui/display.js.map +1 -1
- package/dist/ui/expanded-editor-modal.js +27 -100
- package/dist/ui/expanded-editor-modal.js.map +1 -1
- package/dist/ui/floating-panel.js +37 -130
- package/dist/ui/floating-panel.js.map +1 -1
- package/dist/ui/input.js +59 -196
- package/dist/ui/input.js.map +1 -1
- package/dist/ui/mode-bar.js +11 -32
- package/dist/ui/mode-bar.js.map +1 -1
- package/dist/ui/overlay.js +176 -613
- package/dist/ui/overlay.js.map +1 -1
- package/dist/ui/path-crumbs.js +113 -374
- package/dist/ui/path-crumbs.js.map +1 -1
- package/dist/ui/select.js +78 -311
- package/dist/ui/select.js.map +1 -1
- package/dist/ui/shortcut-hint.js +6 -19
- package/dist/ui/shortcut-hint.js.map +1 -1
- package/dist/ui/spinner.js +7 -20
- package/dist/ui/spinner.js.map +1 -1
- package/dist/ui/split-button.js +10 -35
- package/dist/ui/split-button.js.map +1 -1
- package/dist/ui/tab.js +17 -50
- package/dist/ui/tab.js.map +1 -1
- package/dist/ui/toast.js +30 -107
- package/dist/ui/toast.js.map +1 -1
- package/dist/ui/tooltip-root.js +7 -24
- package/dist/ui/tooltip-root.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,18 +5,18 @@ import { Popover, PopoverContent, PopoverTrigger } from "../../ui/overlay.js";
|
|
|
5
5
|
import { Input } from "../../ui/input.js";
|
|
6
6
|
import { Select } from "../../ui/select.js";
|
|
7
7
|
import * as React from "react";
|
|
8
|
-
import {
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { IconLink } from "@tabler/icons-react";
|
|
10
10
|
//#region src/controls/table/table-link.tsx
|
|
11
11
|
/**
|
|
12
12
|
* A link cell's address (BE TableLink `{ label, href, newTab?, rel? }`): the address, "Open in a new tab" and the
|
|
13
|
-
* relationship search engines read. V2
|
|
14
|
-
*
|
|
13
|
+
* relationship search engines read. V2's spreadsheet has its own cell popover for this (table/table-editor.tsx `LinkUrl`:
|
|
14
|
+
* an address and Save), apart from the global link panel the rest of the kit uses; this is that popover, writing the same
|
|
15
|
+
* four keys the backend takes and nothing else.
|
|
15
16
|
*
|
|
16
17
|
* Refusals are named before anything is written: a script address (javascript:, data:, vbscript:) is refused here
|
|
17
18
|
* exactly as the backend refuses it (`link_value_invalid`).
|
|
18
19
|
*/
|
|
19
|
-
var _jsxFileName = "D:/Github/bettercms/bettercms-backend/packages/kit/src/controls/table/table-link.tsx";
|
|
20
20
|
var LINK_RELS = [
|
|
21
21
|
{
|
|
22
22
|
value: "follow",
|
|
@@ -55,22 +55,18 @@ function LinkAddressEditor({ link, onSave, onCancel, autoFocus }) {
|
|
|
55
55
|
const id = React.useId();
|
|
56
56
|
const problem = hrefProblem(href);
|
|
57
57
|
const save = () => !problem && onSave(tableLink(link.label, href.trim(), newTab, rel));
|
|
58
|
-
return /* @__PURE__ */
|
|
58
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
59
59
|
className: "flex flex-col gap-3",
|
|
60
60
|
children: [
|
|
61
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ jsxs("div", {
|
|
62
62
|
className: "flex flex-col gap-1.5",
|
|
63
63
|
children: [
|
|
64
|
-
/* @__PURE__ */
|
|
64
|
+
/* @__PURE__ */ jsx("label", {
|
|
65
65
|
htmlFor: `${id}-href`,
|
|
66
66
|
className: "text-kit-xs font-medium text-kit-fg-2",
|
|
67
67
|
children: "Address"
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
lineNumber: 56,
|
|
71
|
-
columnNumber: 9
|
|
72
|
-
}, this),
|
|
73
|
-
/* @__PURE__ */ jsxDEV(Input, {
|
|
68
|
+
}),
|
|
69
|
+
/* @__PURE__ */ jsx(Input, {
|
|
74
70
|
id: `${id}-href`,
|
|
75
71
|
size: "sm",
|
|
76
72
|
autoFocus,
|
|
@@ -85,153 +81,89 @@ function LinkAddressEditor({ link, onSave, onCancel, autoFocus }) {
|
|
|
85
81
|
save();
|
|
86
82
|
}
|
|
87
83
|
}
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
lineNumber: 57,
|
|
91
|
-
columnNumber: 9
|
|
92
|
-
}, this),
|
|
93
|
-
problem ? /* @__PURE__ */ jsxDEV("p", {
|
|
84
|
+
}),
|
|
85
|
+
problem ? /* @__PURE__ */ jsx("p", {
|
|
94
86
|
id: `${id}-problem`,
|
|
95
87
|
role: "alert",
|
|
96
88
|
className: "text-kit-xs text-kit-danger-fg",
|
|
97
89
|
children: problem
|
|
98
|
-
}
|
|
99
|
-
fileName: _jsxFileName,
|
|
100
|
-
lineNumber: 70,
|
|
101
|
-
columnNumber: 20
|
|
102
|
-
}, this) : null
|
|
90
|
+
}) : null
|
|
103
91
|
]
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
lineNumber: 55,
|
|
107
|
-
columnNumber: 7
|
|
108
|
-
}, this),
|
|
109
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
92
|
+
}),
|
|
93
|
+
/* @__PURE__ */ jsxs("div", {
|
|
110
94
|
className: "flex min-h-8 items-center justify-between gap-2 text-kit-sm text-kit-fg-2",
|
|
111
|
-
children: [/* @__PURE__ */
|
|
95
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
112
96
|
"aria-hidden": true,
|
|
113
97
|
children: "Open in a new tab"
|
|
114
|
-
},
|
|
115
|
-
fileName: _jsxFileName,
|
|
116
|
-
lineNumber: 73,
|
|
117
|
-
columnNumber: 9
|
|
118
|
-
}, this), /* @__PURE__ */ jsxDEV(Switch, {
|
|
98
|
+
}), /* @__PURE__ */ jsx(Switch, {
|
|
119
99
|
size: "sm",
|
|
120
100
|
checked: newTab,
|
|
121
101
|
onCheckedChange: setNewTab,
|
|
122
102
|
"aria-label": "Open in a new tab"
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
columnNumber: 9
|
|
127
|
-
}, this)]
|
|
128
|
-
}, void 0, true, {
|
|
129
|
-
fileName: _jsxFileName,
|
|
130
|
-
lineNumber: 72,
|
|
131
|
-
columnNumber: 7
|
|
132
|
-
}, this),
|
|
133
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
103
|
+
})]
|
|
104
|
+
}),
|
|
105
|
+
/* @__PURE__ */ jsxs("div", {
|
|
134
106
|
className: "flex flex-col gap-1.5",
|
|
135
|
-
children: [/* @__PURE__ */
|
|
107
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
136
108
|
id: `${id}-rel`,
|
|
137
109
|
className: "text-kit-xs font-medium text-kit-fg-2",
|
|
138
110
|
children: "Search engines"
|
|
139
|
-
},
|
|
140
|
-
fileName: _jsxFileName,
|
|
141
|
-
lineNumber: 77,
|
|
142
|
-
columnNumber: 9
|
|
143
|
-
}, this), /* @__PURE__ */ jsxDEV(Select, {
|
|
111
|
+
}), /* @__PURE__ */ jsx(Select, {
|
|
144
112
|
"aria-label": "Search engines",
|
|
145
113
|
size: "sm",
|
|
146
114
|
value: rel,
|
|
147
115
|
onValueChange: (v) => setRel(v),
|
|
148
116
|
options: LINK_RELS
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
columnNumber: 9
|
|
153
|
-
}, this)]
|
|
154
|
-
}, void 0, true, {
|
|
155
|
-
fileName: _jsxFileName,
|
|
156
|
-
lineNumber: 76,
|
|
157
|
-
columnNumber: 7
|
|
158
|
-
}, this),
|
|
159
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
117
|
+
})]
|
|
118
|
+
}),
|
|
119
|
+
/* @__PURE__ */ jsxs("div", {
|
|
160
120
|
className: "flex items-center justify-end gap-1.5",
|
|
161
121
|
children: [
|
|
162
|
-
link.href ? /* @__PURE__ */
|
|
122
|
+
link.href ? /* @__PURE__ */ jsx(Button, {
|
|
163
123
|
size: "sm",
|
|
164
124
|
variant: "ghost",
|
|
165
125
|
className: "mr-auto text-kit-fg-2",
|
|
166
126
|
onClick: () => onSave(tableLink(link.label, "")),
|
|
167
127
|
children: "Remove link"
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
lineNumber: 82,
|
|
171
|
-
columnNumber: 11
|
|
172
|
-
}, this) : null,
|
|
173
|
-
onCancel ? /* @__PURE__ */ jsxDEV(Button, {
|
|
128
|
+
}) : null,
|
|
129
|
+
onCancel ? /* @__PURE__ */ jsx(Button, {
|
|
174
130
|
size: "sm",
|
|
175
131
|
variant: "ghost",
|
|
176
132
|
onClick: onCancel,
|
|
177
133
|
children: "Cancel"
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
lineNumber: 87,
|
|
181
|
-
columnNumber: 11
|
|
182
|
-
}, this) : null,
|
|
183
|
-
/* @__PURE__ */ jsxDEV(Button, {
|
|
134
|
+
}) : null,
|
|
135
|
+
/* @__PURE__ */ jsx(Button, {
|
|
184
136
|
size: "sm",
|
|
185
137
|
variant: "primary",
|
|
186
138
|
disabled: !!problem,
|
|
187
139
|
onClick: save,
|
|
188
140
|
children: "Save"
|
|
189
|
-
}
|
|
190
|
-
fileName: _jsxFileName,
|
|
191
|
-
lineNumber: 91,
|
|
192
|
-
columnNumber: 9
|
|
193
|
-
}, this)
|
|
141
|
+
})
|
|
194
142
|
]
|
|
195
|
-
}
|
|
196
|
-
fileName: _jsxFileName,
|
|
197
|
-
lineNumber: 80,
|
|
198
|
-
columnNumber: 7
|
|
199
|
-
}, this)
|
|
143
|
+
})
|
|
200
144
|
]
|
|
201
|
-
}
|
|
202
|
-
fileName: _jsxFileName,
|
|
203
|
-
lineNumber: 54,
|
|
204
|
-
columnNumber: 5
|
|
205
|
-
}, this);
|
|
145
|
+
});
|
|
206
146
|
}
|
|
207
147
|
/** The small link button beside a link cell's words: opens the address editor. */
|
|
208
148
|
function LinkAddressButton({ link, onSave, readOnly, className }) {
|
|
209
149
|
const [open, setOpen] = React.useState(false);
|
|
210
150
|
if (readOnly && !link.href) return null;
|
|
211
|
-
return /* @__PURE__ */
|
|
151
|
+
return /* @__PURE__ */ jsxs(Popover, {
|
|
212
152
|
open,
|
|
213
153
|
onOpenChange: setOpen,
|
|
214
|
-
children: [/* @__PURE__ */
|
|
154
|
+
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
215
155
|
disabled: readOnly,
|
|
216
156
|
tabIndex: -1,
|
|
217
157
|
"aria-label": link.href ? `Link: ${link.href}` : "Add a link address",
|
|
218
158
|
className: cn("flex size-5 shrink-0 items-center justify-center rounded-kit-sm text-kit-fg-4 outline-none hover:bg-kit-hover hover:text-kit-fg", link.href && "text-kit-fg-2", className),
|
|
219
|
-
children: /* @__PURE__ */
|
|
159
|
+
children: /* @__PURE__ */ jsx(IconLink, {
|
|
220
160
|
className: "size-3.5",
|
|
221
161
|
stroke: 1.75
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
lineNumber: 115,
|
|
225
|
-
columnNumber: 9
|
|
226
|
-
}, this)
|
|
227
|
-
}, void 0, false, {
|
|
228
|
-
fileName: _jsxFileName,
|
|
229
|
-
lineNumber: 105,
|
|
230
|
-
columnNumber: 7
|
|
231
|
-
}, this), /* @__PURE__ */ jsxDEV(PopoverContent, {
|
|
162
|
+
})
|
|
163
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
232
164
|
align: "end",
|
|
233
165
|
className: "w-[320px] p-3",
|
|
234
|
-
children: /* @__PURE__ */
|
|
166
|
+
children: /* @__PURE__ */ jsx(LinkAddressEditor, {
|
|
235
167
|
link,
|
|
236
168
|
autoFocus: true,
|
|
237
169
|
onCancel: () => setOpen(false),
|
|
@@ -239,21 +171,9 @@ function LinkAddressButton({ link, onSave, readOnly, className }) {
|
|
|
239
171
|
onSave(l);
|
|
240
172
|
setOpen(false);
|
|
241
173
|
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
columnNumber: 9
|
|
246
|
-
}, this)
|
|
247
|
-
}, void 0, false, {
|
|
248
|
-
fileName: _jsxFileName,
|
|
249
|
-
lineNumber: 117,
|
|
250
|
-
columnNumber: 7
|
|
251
|
-
}, this)]
|
|
252
|
-
}, void 0, true, {
|
|
253
|
-
fileName: _jsxFileName,
|
|
254
|
-
lineNumber: 104,
|
|
255
|
-
columnNumber: 5
|
|
256
|
-
}, this);
|
|
174
|
+
})
|
|
175
|
+
})]
|
|
176
|
+
});
|
|
257
177
|
}
|
|
258
178
|
//#endregion
|
|
259
179
|
export { LINK_RELS, LinkAddressButton, LinkAddressEditor, hrefProblem, isScriptHref, tableLink };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-link.js","names":[],"sources":["../../../src/controls/table/table-link.tsx"],"sourcesContent":["/**\n * A link cell's address (BE TableLink `{ label, href, newTab?, rel? }`): the address, \"Open in a new tab\" and the\n * relationship search engines read. V2
|
|
1
|
+
{"version":3,"file":"table-link.js","names":[],"sources":["../../../src/controls/table/table-link.tsx"],"sourcesContent":["/**\n * A link cell's address (BE TableLink `{ label, href, newTab?, rel? }`): the address, \"Open in a new tab\" and the\n * relationship search engines read. V2's spreadsheet has its own cell popover for this (table/table-editor.tsx `LinkUrl`:\n * an address and Save), apart from the global link panel the rest of the kit uses; this is that popover, writing the same\n * four keys the backend takes and nothing else.\n *\n * Refusals are named before anything is written: a script address (javascript:, data:, vbscript:) is refused here\n * exactly as the backend refuses it (`link_value_invalid`).\n */\nimport * as React from \"react\";\nimport { IconLink } from \"@tabler/icons-react\";\nimport { cn } from \"../../lib/cn\";\nimport { Button } from \"../../ui/button\";\nimport { Input } from \"../../ui/input\";\nimport { Switch } from \"../../ui/controls\";\nimport { Select } from \"../../ui/select\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../../ui/overlay\";\nimport type { TableLink } from \"../../schema/table\";\n\nexport const LINK_RELS: { value: NonNullable<TableLink[\"rel\"]>; label: string }[] = [\n { value: \"follow\", label: \"Follow (default)\" },\n { value: \"nofollow\", label: \"Don't vouch for it (nofollow)\" },\n { value: \"sponsored\", label: \"Paid or sponsored\" },\n { value: \"ugc\", label: \"Written by visitors\" },\n];\n\n/** BE link-value.ts isScriptHref: what no link may hold. */\nexport const isScriptHref = (href: string) => /^\\s*(javascript|data|vbscript):/i.test(href.replace(/[\\p{Cc}\\s]+/gu, \"\"));\nexport const hrefProblem = (href: string) => (isScriptHref(href) ? \"Script links (javascript:, data:, vbscript:) aren't allowed.\" : null);\n\n/** The stored link with only the keys it uses: `newTab` only when on, `rel` only when not the default. */\nexport function tableLink(label: string, href: string, newTab?: boolean, rel?: TableLink[\"rel\"]): TableLink {\n return { label, href, ...(newTab ? { newTab: true } : {}), ...(rel && rel !== \"follow\" ? { rel } : {}) };\n}\n\n/** Address + options, as one popover body (the spreadsheet's link button) or inline (a row's link cell). */\nexport function LinkAddressEditor({\n link,\n onSave,\n onCancel,\n autoFocus,\n}: {\n link: TableLink;\n onSave: (next: TableLink) => void;\n onCancel?: () => void;\n autoFocus?: boolean;\n}) {\n const [href, setHref] = React.useState(link.href);\n const [newTab, setNewTab] = React.useState(!!link.newTab);\n const [rel, setRel] = React.useState<NonNullable<TableLink[\"rel\"]>>(link.rel ?? \"follow\");\n const id = React.useId();\n const problem = hrefProblem(href);\n const save = () => !problem && onSave(tableLink(link.label, href.trim(), newTab, rel));\n return (\n <div className=\"flex flex-col gap-3\">\n <div className=\"flex flex-col gap-1.5\">\n <label htmlFor={`${id}-href`} className=\"text-kit-xs font-medium text-kit-fg-2\">Address</label>\n <Input\n id={`${id}-href`}\n size=\"sm\"\n autoFocus={autoFocus}\n value={href}\n placeholder=\"https://… or /pricing\"\n aria-invalid={problem ? true : undefined}\n aria-describedby={problem ? `${id}-problem` : undefined}\n onChange={(e) => setHref(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\") { e.preventDefault(); save(); }\n }}\n />\n {problem ? <p id={`${id}-problem`} role=\"alert\" className=\"text-kit-xs text-kit-danger-fg\">{problem}</p> : null}\n </div>\n <div className=\"flex min-h-8 items-center justify-between gap-2 text-kit-sm text-kit-fg-2\">\n <span aria-hidden>Open in a new tab</span>\n <Switch size=\"sm\" checked={newTab} onCheckedChange={setNewTab} aria-label=\"Open in a new tab\" />\n </div>\n <div className=\"flex flex-col gap-1.5\">\n <span id={`${id}-rel`} className=\"text-kit-xs font-medium text-kit-fg-2\">Search engines</span>\n <Select aria-label=\"Search engines\" size=\"sm\" value={rel} onValueChange={(v) => setRel(v as typeof rel)} options={LINK_RELS} />\n </div>\n <div className=\"flex items-center justify-end gap-1.5\">\n {link.href ? (\n <Button size=\"sm\" variant=\"ghost\" className=\"mr-auto text-kit-fg-2\" onClick={() => onSave(tableLink(link.label, \"\"))}>\n Remove link\n </Button>\n ) : null}\n {onCancel ? (\n <Button size=\"sm\" variant=\"ghost\" onClick={onCancel}>\n Cancel\n </Button>\n ) : null}\n <Button size=\"sm\" variant=\"primary\" disabled={!!problem} onClick={save}>\n Save\n </Button>\n </div>\n </div>\n );\n}\n\n/** The small link button beside a link cell's words: opens the address editor. */\nexport function LinkAddressButton({ link, onSave, readOnly, className }: { link: TableLink; onSave: (l: TableLink) => void; readOnly?: boolean; className?: string }) {\n const [open, setOpen] = React.useState(false);\n if (readOnly && !link.href) return null;\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger\n disabled={readOnly}\n tabIndex={-1}\n aria-label={link.href ? `Link: ${link.href}` : \"Add a link address\"}\n className={cn(\n \"flex size-5 shrink-0 items-center justify-center rounded-kit-sm text-kit-fg-4 outline-none hover:bg-kit-hover hover:text-kit-fg\",\n link.href && \"text-kit-fg-2\",\n className,\n )}\n >\n <IconLink className=\"size-3.5\" stroke={1.75} />\n </PopoverTrigger>\n <PopoverContent align=\"end\" className=\"w-[320px] p-3\">\n <LinkAddressEditor\n link={link}\n autoFocus\n onCancel={() => setOpen(false)}\n onSave={(l) => {\n onSave(l);\n setOpen(false);\n }}\n />\n </PopoverContent>\n </Popover>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,IAAa,YAAuE;CAClF;EAAE,OAAO;EAAU,OAAO;CAAmB;CAC7C;EAAE,OAAO;EAAY,OAAO;CAAgC;CAC5D;EAAE,OAAO;EAAa,OAAO;CAAoB;CACjD;EAAE,OAAO;EAAO,OAAO;CAAsB;AAC/C;;AAGA,IAAa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AA,oBAAC,UAAD;IAAU,WAAU;IAAW,QAAQ;GAAO,CAAA;EAChC,CAAA,GAChB,oBAAC,gBAAD;GAAgB,OAAM;GAAM,WAAU;GACpC,UAAA,oBAAC,mBAAD;IACQ;IACN,WAAA;IACA,gBAAgB,QAAQ,KAAK;IAC7B,SAAS,MAAM;KACb,OAAO,CAAC;KACR,QAAQ,KAAK;IACf;GACD,CAAA;EACa,CAAA,CACT;;AAEb"}
|
|
@@ -4,7 +4,7 @@ import { resolveFieldAccess, useForm, useKitEnv } from "../../context.js";
|
|
|
4
4
|
import { TableEditor, TableFullScreenButton, TableItemEditor } from "./table-editor.js";
|
|
5
5
|
import { storedTable } from "./stored.js";
|
|
6
6
|
import * as React from "react";
|
|
7
|
-
import {
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
8
|
//#region src/controls/table/table.tsx
|
|
9
9
|
/**
|
|
10
10
|
* TABLE control (CPO D42, D50, D52; port of V2 kit/controls/table.tsx): the `table` field type (a content-model `table`
|
|
@@ -18,7 +18,6 @@ import { jsxDEV } from "react/jsx-dev-runtime";
|
|
|
18
18
|
* Value: `TableValue` (schema/table.ts), written in the exact shape the backend stores (stored.ts): keys the editor
|
|
19
19
|
* fills in for itself are never written back unless the person changed them.
|
|
20
20
|
*/
|
|
21
|
-
var _jsxFileName = "D:/Github/bettercms/bettercms-backend/packages/kit/src/controls/table/table.tsx";
|
|
22
21
|
var fullKey = null;
|
|
23
22
|
var subs = /* @__PURE__ */ new Set();
|
|
24
23
|
var setFullKey = (k) => {
|
|
@@ -31,14 +30,10 @@ var fullKeyOf = (docId, path) => `${docId}:${pathKey(path)}`;
|
|
|
31
30
|
/** Label-row action of a table field (KitField ACTIONS.table): the one way into the full-screen spreadsheet (D49). */
|
|
32
31
|
function TableFullScreenAction({ path }) {
|
|
33
32
|
const env = useKitEnv();
|
|
34
|
-
return /* @__PURE__ */
|
|
33
|
+
return /* @__PURE__ */ jsx(TableFullScreenButton, {
|
|
35
34
|
className: "-my-1",
|
|
36
35
|
onOpen: () => setFullKey(fullKeyOf(env.docId, path))
|
|
37
|
-
}
|
|
38
|
-
fileName: _jsxFileName,
|
|
39
|
-
lineNumber: 37,
|
|
40
|
-
columnNumber: 10
|
|
41
|
-
}, this);
|
|
36
|
+
});
|
|
42
37
|
}
|
|
43
38
|
function TableControl({ field, value, onChange, readOnly, path }) {
|
|
44
39
|
const env = useKitEnv();
|
|
@@ -62,11 +57,11 @@ function TableControl({ field, value, onChange, readOnly, path }) {
|
|
|
62
57
|
key,
|
|
63
58
|
path
|
|
64
59
|
]);
|
|
65
|
-
return /* @__PURE__ */
|
|
60
|
+
return /* @__PURE__ */ jsx("div", {
|
|
66
61
|
ref: host,
|
|
67
62
|
className: "min-w-0",
|
|
68
63
|
"data-kit-control": "table",
|
|
69
|
-
children: /* @__PURE__ */
|
|
64
|
+
children: /* @__PURE__ */ jsx(TableEditor, {
|
|
70
65
|
value: t ?? fallback,
|
|
71
66
|
onChange: (next) => onChange(storedTable(next, value)),
|
|
72
67
|
readOnly,
|
|
@@ -80,16 +75,8 @@ function TableControl({ field, value, onChange, readOnly, path }) {
|
|
|
80
75
|
onOpenChange: (o) => setFullKey(o ? key : null),
|
|
81
76
|
returnFocus: () => host.current?.closest("[data-field-key]")?.querySelector("button[aria-label=\"Edit in full screen\"]") ?? null
|
|
82
77
|
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
lineNumber: 57,
|
|
86
|
-
columnNumber: 7
|
|
87
|
-
}, this)
|
|
88
|
-
}, void 0, false, {
|
|
89
|
-
fileName: _jsxFileName,
|
|
90
|
-
lineNumber: 56,
|
|
91
|
-
columnNumber: 5
|
|
92
|
-
}, this);
|
|
78
|
+
})
|
|
79
|
+
});
|
|
93
80
|
}
|
|
94
81
|
/** The body of a drilled table row or column frame (FrameView draws the standard header above it): FrameSlots.TableFrame. */
|
|
95
82
|
function TableFrame({ frame }) {
|
|
@@ -100,7 +87,7 @@ function TableFrame({ frame }) {
|
|
|
100
87
|
const tablePath = it.arrayPath.slice(0, -1);
|
|
101
88
|
const raw = form.getAt(tablePath);
|
|
102
89
|
const readOnly = resolveFieldAccess(field, env).readOnly;
|
|
103
|
-
return /* @__PURE__ */
|
|
90
|
+
return /* @__PURE__ */ jsx(TableItemEditor, {
|
|
104
91
|
kind: frame.kind === "tableRow" ? "row" : "column",
|
|
105
92
|
index: it.index,
|
|
106
93
|
value: normalizeTable(raw),
|
|
@@ -108,11 +95,7 @@ function TableFrame({ frame }) {
|
|
|
108
95
|
options: field.table ?? GENERAL_TABLE,
|
|
109
96
|
developer: env.can("schema.manage"),
|
|
110
97
|
readOnly
|
|
111
|
-
}
|
|
112
|
-
fileName: _jsxFileName,
|
|
113
|
-
lineNumber: 86,
|
|
114
|
-
columnNumber: 5
|
|
115
|
-
}, this);
|
|
98
|
+
});
|
|
116
99
|
}
|
|
117
100
|
//#endregion
|
|
118
101
|
export { TableControl, TableFrame, TableFullScreenAction };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.js","names":[],"sources":["../../../src/controls/table/table.tsx"],"sourcesContent":["/**\n * TABLE control (CPO D42, D50, D52; port of V2 kit/controls/table.tsx): the `table` field type (a content-model `table`\n * field, or a component `table` prop with `config.mode: \"data\"`) edits like any nested array, with no container of its\n * own: Title, Columns, Rows (groups live in the row list), Note under the table, and a collapsed Table settings that\n * offers only what `field.table.settings` allows (no `table` options = a general table, everything offered). A row or a\n * column drills through the form's own navigation (TableFrame), so the breadcrumb and frame header are the ones every\n * FAQ or feature item uses. The ⤢ button in the field's label row (TableFullScreenAction) opens the spreadsheet in the\n * expanded-editor modal (D49).\n *\n * Value: `TableValue` (schema/table.ts), written in the exact shape the backend stores (stored.ts): keys the editor\n * fills in for itself are never written back unless the person changed them.\n */\nimport * as React from \"react\";\nimport { resolveFieldAccess, useForm, useKitEnv } from \"../../context\";\nimport type { Frame } from \"../../lib/frames\";\nimport { pathKey } from \"../../lib/path\";\nimport type { FieldPath } from \"../../schema/types\";\nimport { GENERAL_TABLE, emptyTable, isTableValue, normalizeTable, type TableValue } from \"../../schema/table\";\nimport type { ControlProps } from \"../../types\";\nimport { TableEditor, TableFullScreenButton, TableItemEditor } from \"./table-editor\";\nimport { storedTable } from \"./stored\";\n\n/* Which table field has its spreadsheet open (the label-row button and the control share it). */\nlet fullKey: string | null = null;\nconst subs = new Set<() => void>();\nconst setFullKey = (k: string | null) => {\n fullKey = k;\n subs.forEach((f) => f());\n};\nconst subscribe = (f: () => void) => (subs.add(f), () => void subs.delete(f));\nconst useFullOpen = (k: string) => React.useSyncExternalStore(subscribe, () => fullKey === k, () => false);\nconst fullKeyOf = (docId: string, path: FieldPath) => `${docId}:${pathKey(path)}`;\n\n/** Label-row action of a table field (KitField ACTIONS.table): the one way into the full-screen spreadsheet (D49). */\nexport function TableFullScreenAction({ path }: Pick<ControlProps, \"path\">) {\n const env = useKitEnv();\n return <TableFullScreenButton className=\"-my-1\" onOpen={() => setFullKey(fullKeyOf(env.docId, path))} />;\n}\n\nexport function TableControl({ field, value, onChange, readOnly, path }: ControlProps) {\n const env = useKitEnv();\n const form = useForm();\n const t = React.useMemo(() => (isTableValue(value) ? normalizeTable(value) : null), [value]);\n // no value yet: the field's default table, else an empty 3 × 2 one (nothing is written until the person edits it)\n const fallback = React.useMemo(() => (isTableValue(field.initialValue) ? normalizeTable(field.initialValue) : emptyTable()), [field.initialValue]);\n const key = fullKeyOf(env.docId, path);\n const full = useFullOpen(key);\n // the spreadsheet belongs to this mount: a dock closed with it open must not reopen it on the next visit\n React.useEffect(() => () => void (fullKey === key && setFullKey(null)), [key]);\n const host = React.useRef<HTMLDivElement>(null);\n const nav = React.useMemo(\n () => (form?.canNavigate ? { id: key, basePath: path, open: (kind: \"rows\" | \"columns\", i: number) => form.navigate([...path, kind, i]) } : undefined),\n [form, key, path],\n );\n return (\n <div ref={host} className=\"min-w-0\" data-kit-control=\"table\">\n <TableEditor\n value={t ?? fallback}\n onChange={(next: TableValue) => onChange(storedTable(next, value))}\n readOnly={readOnly}\n options={field.table ?? GENERAL_TABLE}\n developer={env.can(\"schema.manage\")}\n label={field.title}\n parentTitle={env.docTitle}\n nav={nav}\n fullScreen={{\n open: full,\n onOpenChange: (o) => setFullKey(o ? key : null),\n returnFocus: () => host.current?.closest(\"[data-field-key]\")?.querySelector<HTMLElement>('button[aria-label=\"Edit in full screen\"]') ?? null,\n }}\n />\n </div>\n );\n}\n\n/** The body of a drilled table row or column frame (FrameView draws the standard header above it): FrameSlots.TableFrame. */\nexport function TableFrame({ frame }: { frame: Frame }) {\n const form = useForm()!;\n const env = useKitEnv();\n const it = frame.item!;\n const field = frame.field!;\n const tablePath = it.arrayPath.slice(0, -1);\n const raw = form.getAt(tablePath);\n const readOnly = resolveFieldAccess(field, env).readOnly;\n return (\n <TableItemEditor\n kind={frame.kind === \"tableRow\" ? \"row\" : \"column\"}\n index={it.index}\n value={normalizeTable(raw)}\n onChange={(next) => form.setAt(tablePath, storedTable(next, raw))}\n options={field.table ?? GENERAL_TABLE}\n developer={env.can(\"schema.manage\")}\n readOnly={readOnly}\n />\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"table.js","names":[],"sources":["../../../src/controls/table/table.tsx"],"sourcesContent":["/**\n * TABLE control (CPO D42, D50, D52; port of V2 kit/controls/table.tsx): the `table` field type (a content-model `table`\n * field, or a component `table` prop with `config.mode: \"data\"`) edits like any nested array, with no container of its\n * own: Title, Columns, Rows (groups live in the row list), Note under the table, and a collapsed Table settings that\n * offers only what `field.table.settings` allows (no `table` options = a general table, everything offered). A row or a\n * column drills through the form's own navigation (TableFrame), so the breadcrumb and frame header are the ones every\n * FAQ or feature item uses. The ⤢ button in the field's label row (TableFullScreenAction) opens the spreadsheet in the\n * expanded-editor modal (D49).\n *\n * Value: `TableValue` (schema/table.ts), written in the exact shape the backend stores (stored.ts): keys the editor\n * fills in for itself are never written back unless the person changed them.\n */\nimport * as React from \"react\";\nimport { resolveFieldAccess, useForm, useKitEnv } from \"../../context\";\nimport type { Frame } from \"../../lib/frames\";\nimport { pathKey } from \"../../lib/path\";\nimport type { FieldPath } from \"../../schema/types\";\nimport { GENERAL_TABLE, emptyTable, isTableValue, normalizeTable, type TableValue } from \"../../schema/table\";\nimport type { ControlProps } from \"../../types\";\nimport { TableEditor, TableFullScreenButton, TableItemEditor } from \"./table-editor\";\nimport { storedTable } from \"./stored\";\n\n/* Which table field has its spreadsheet open (the label-row button and the control share it). */\nlet fullKey: string | null = null;\nconst subs = new Set<() => void>();\nconst setFullKey = (k: string | null) => {\n fullKey = k;\n subs.forEach((f) => f());\n};\nconst subscribe = (f: () => void) => (subs.add(f), () => void subs.delete(f));\nconst useFullOpen = (k: string) => React.useSyncExternalStore(subscribe, () => fullKey === k, () => false);\nconst fullKeyOf = (docId: string, path: FieldPath) => `${docId}:${pathKey(path)}`;\n\n/** Label-row action of a table field (KitField ACTIONS.table): the one way into the full-screen spreadsheet (D49). */\nexport function TableFullScreenAction({ path }: Pick<ControlProps, \"path\">) {\n const env = useKitEnv();\n return <TableFullScreenButton className=\"-my-1\" onOpen={() => setFullKey(fullKeyOf(env.docId, path))} />;\n}\n\nexport function TableControl({ field, value, onChange, readOnly, path }: ControlProps) {\n const env = useKitEnv();\n const form = useForm();\n const t = React.useMemo(() => (isTableValue(value) ? normalizeTable(value) : null), [value]);\n // no value yet: the field's default table, else an empty 3 × 2 one (nothing is written until the person edits it)\n const fallback = React.useMemo(() => (isTableValue(field.initialValue) ? normalizeTable(field.initialValue) : emptyTable()), [field.initialValue]);\n const key = fullKeyOf(env.docId, path);\n const full = useFullOpen(key);\n // the spreadsheet belongs to this mount: a dock closed with it open must not reopen it on the next visit\n React.useEffect(() => () => void (fullKey === key && setFullKey(null)), [key]);\n const host = React.useRef<HTMLDivElement>(null);\n const nav = React.useMemo(\n () => (form?.canNavigate ? { id: key, basePath: path, open: (kind: \"rows\" | \"columns\", i: number) => form.navigate([...path, kind, i]) } : undefined),\n [form, key, path],\n );\n return (\n <div ref={host} className=\"min-w-0\" data-kit-control=\"table\">\n <TableEditor\n value={t ?? fallback}\n onChange={(next: TableValue) => onChange(storedTable(next, value))}\n readOnly={readOnly}\n options={field.table ?? GENERAL_TABLE}\n developer={env.can(\"schema.manage\")}\n label={field.title}\n parentTitle={env.docTitle}\n nav={nav}\n fullScreen={{\n open: full,\n onOpenChange: (o) => setFullKey(o ? key : null),\n returnFocus: () => host.current?.closest(\"[data-field-key]\")?.querySelector<HTMLElement>('button[aria-label=\"Edit in full screen\"]') ?? null,\n }}\n />\n </div>\n );\n}\n\n/** The body of a drilled table row or column frame (FrameView draws the standard header above it): FrameSlots.TableFrame. */\nexport function TableFrame({ frame }: { frame: Frame }) {\n const form = useForm()!;\n const env = useKitEnv();\n const it = frame.item!;\n const field = frame.field!;\n const tablePath = it.arrayPath.slice(0, -1);\n const raw = form.getAt(tablePath);\n const readOnly = resolveFieldAccess(field, env).readOnly;\n return (\n <TableItemEditor\n kind={frame.kind === \"tableRow\" ? \"row\" : \"column\"}\n index={it.index}\n value={normalizeTable(raw)}\n onChange={(next) => form.setAt(tablePath, storedTable(next, raw))}\n options={field.table ?? GENERAL_TABLE}\n developer={env.can(\"schema.manage\")}\n readOnly={readOnly}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuBA,IAAI,UAAyB;AAC7B,IAAM,uBAAO,IAAI,IAAgB;AACjC,IAAM,cAAc,MAAqB;CACvC,UAAU;CACV,KAAK,SAAS,MAAM,EAAE,CAAC;AACzB;AACA,IAAM,aAAa,OAAmB,KAAK,IAAI,CAAC,SAAS,KAAK,KAAK,OAAO,CAAC;AAC3E,IAAM,eAAe,MAAc,MAAM,qBAAqB,iBAAiB,YAAY,SAAS,KAAK;AACzG,IAAM,aAAa,OAAe,SAAoB,GAAG,MAAM,GAAG,QAAQ,IAAI;;AAG9E,SAAgB,sBAAsB,EAAE,QAAoC;CAC1E,MAAM,MAAM,UAAU;CACtB,OAAO,oBAAC,uBAAD;EAAuB,W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