@arbidocs/blocks 0.5.151 → 0.5.152
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/{ConnectedNativeDocxComparison-JLT3VHYQ.cjs → ConnectedNativeDocxComparison-244UIHSM.cjs} +9 -9
- package/dist/{ConnectedStreamedWordArtifact-KWK6HLCZ.cjs.map → ConnectedNativeDocxComparison-244UIHSM.cjs.map} +1 -1
- package/dist/{ConnectedPresentation-SY42ADRU.cjs → ConnectedPresentation-JUXIXKYN.cjs} +9 -8
- package/dist/ConnectedPresentation-JUXIXKYN.cjs.map +1 -0
- package/dist/{ConnectedSlidesTab-JATNBI22.cjs → ConnectedSlidesTab-JA3VB66W.cjs} +8 -7
- package/dist/ConnectedSlidesTab-JA3VB66W.cjs.map +1 -0
- package/dist/{ConnectedStreamedWordArtifact-KWK6HLCZ.cjs → ConnectedStreamedWordArtifact-V6BRZMEQ.cjs} +9 -9
- package/dist/{ConnectedNativeDocxComparison-JLT3VHYQ.cjs.map → ConnectedStreamedWordArtifact-V6BRZMEQ.cjs.map} +1 -1
- package/dist/{DocumentReviewCard-USFBTVEL.cjs → DocumentReviewCard-5W2QQWKA.cjs} +14 -14
- package/dist/{DocumentReviewCard-USFBTVEL.cjs.map → DocumentReviewCard-5W2QQWKA.cjs.map} +1 -1
- package/dist/{FilesViewerDialog-O4CY7GM3.cjs → FilesViewerDialog-63QUTG4L.cjs} +12 -12
- package/dist/{FilesViewerDialog-O4CY7GM3.cjs.map → FilesViewerDialog-63QUTG4L.cjs.map} +1 -1
- package/dist/{RechartsRenderer-NRLQZSSY.cjs → RechartsRenderer-NU6WUZJS.cjs} +21 -20
- package/dist/RechartsRenderer-NU6WUZJS.cjs.map +1 -0
- package/dist/{SpotlightStrip-QQ2WUI32.cjs → SpotlightStrip-HXQFPAAL.cjs} +6 -5
- package/dist/SpotlightStrip-HXQFPAAL.cjs.map +1 -0
- package/dist/agents/index.cjs +179 -179
- package/dist/{chunk-3XCYPWC5.cjs → chunk-2P7VH2SK.cjs} +3 -3
- package/dist/chunk-2P7VH2SK.cjs.map +1 -0
- package/dist/{chunk-7Q46YAX4.cjs → chunk-3CJTO6RV.cjs} +152 -199
- package/dist/chunk-3CJTO6RV.cjs.map +1 -0
- package/dist/{chunk-PJTKXKDS.cjs → chunk-4I2PCP7O.cjs} +28 -28
- package/dist/{chunk-PJTKXKDS.cjs.map → chunk-4I2PCP7O.cjs.map} +1 -1
- package/dist/{chunk-OGJCEWME.cjs → chunk-4XNP27N4.cjs} +36 -36
- package/dist/{chunk-OGJCEWME.cjs.map → chunk-4XNP27N4.cjs.map} +1 -1
- package/dist/{chunk-2SILSQNF.cjs → chunk-4ZR4O5SP.cjs} +26 -8
- package/dist/chunk-4ZR4O5SP.cjs.map +1 -0
- package/dist/{chunk-ILATBO5Z.cjs → chunk-6ZZWQ3OL.cjs} +4 -4
- package/dist/{chunk-ILATBO5Z.cjs.map → chunk-6ZZWQ3OL.cjs.map} +1 -1
- package/dist/{chunk-VH4QXK5W.cjs → chunk-AG6KAGAX.cjs} +4 -4
- package/dist/{chunk-VH4QXK5W.cjs.map → chunk-AG6KAGAX.cjs.map} +1 -1
- package/dist/{chunk-MFZW4FEW.cjs → chunk-B5BGVPQ5.cjs} +4 -4
- package/dist/{chunk-MFZW4FEW.cjs.map → chunk-B5BGVPQ5.cjs.map} +1 -1
- package/dist/{chunk-PJ6J4EMZ.cjs → chunk-CULUTYOD.cjs} +4 -4
- package/dist/{chunk-PJ6J4EMZ.cjs.map → chunk-CULUTYOD.cjs.map} +1 -1
- package/dist/{chunk-H7AI54V2.cjs → chunk-CVVQHFLR.cjs} +3 -3
- package/dist/{chunk-H7AI54V2.cjs.map → chunk-CVVQHFLR.cjs.map} +1 -1
- package/dist/{chunk-R3C3S6EH.cjs → chunk-D5DOK2AE.cjs} +58 -58
- package/dist/{chunk-R3C3S6EH.cjs.map → chunk-D5DOK2AE.cjs.map} +1 -1
- package/dist/{chunk-MH7P5FEK.cjs → chunk-FCT62ZPE.cjs} +4 -4
- package/dist/{chunk-MH7P5FEK.cjs.map → chunk-FCT62ZPE.cjs.map} +1 -1
- package/dist/{chunk-QX2LAMVE.cjs → chunk-IXTDOPSB.cjs} +4 -4
- package/dist/{chunk-QX2LAMVE.cjs.map → chunk-IXTDOPSB.cjs.map} +1 -1
- package/dist/{chunk-AKR4JN6I.cjs → chunk-JCFXS336.cjs} +3 -3
- package/dist/{chunk-AKR4JN6I.cjs.map → chunk-JCFXS336.cjs.map} +1 -1
- package/dist/{chunk-N4TOSY7B.cjs → chunk-JLNKD56X.cjs} +4 -4
- package/dist/{chunk-N4TOSY7B.cjs.map → chunk-JLNKD56X.cjs.map} +1 -1
- package/dist/{chunk-DNTSR7UV.cjs → chunk-LYKT336H.cjs} +5 -5
- package/dist/{chunk-DNTSR7UV.cjs.map → chunk-LYKT336H.cjs.map} +1 -1
- package/dist/{chunk-MGGDT6JK.cjs → chunk-MAKCWF45.cjs} +4 -4
- package/dist/{chunk-MGGDT6JK.cjs.map → chunk-MAKCWF45.cjs.map} +1 -1
- package/dist/{chunk-DGUQK5GA.cjs → chunk-TFRCNIUY.cjs} +6 -6
- package/dist/{chunk-DGUQK5GA.cjs.map → chunk-TFRCNIUY.cjs.map} +1 -1
- package/dist/chunk-UM3EWCDE.cjs +105 -0
- package/dist/chunk-UM3EWCDE.cjs.map +1 -0
- package/dist/{chunk-WPUEGDBE.cjs → chunk-WUM76MJU.cjs} +6 -6
- package/dist/{chunk-WPUEGDBE.cjs.map → chunk-WUM76MJU.cjs.map} +1 -1
- package/dist/{chunk-6WWYH66F.cjs → chunk-Z3N32LL4.cjs} +8 -8
- package/dist/{chunk-6WWYH66F.cjs.map → chunk-Z3N32LL4.cjs.map} +1 -1
- package/dist/{chunk-JMBAUHI7.cjs → chunk-ZCQXQIBA.cjs} +28 -28
- package/dist/{chunk-JMBAUHI7.cjs.map → chunk-ZCQXQIBA.cjs.map} +1 -1
- package/dist/components/MetricCard.js +1 -1
- package/dist/components/MetricCard.js.map +2 -2
- package/dist/components/gestures/GestureHandle.d.ts +21 -0
- package/dist/components/gestures/GestureHandle.js +44 -0
- package/dist/components/gestures/GestureHandle.js.map +7 -0
- package/dist/components/gestures/handles.d.ts +43 -0
- package/dist/components/gestures/handles.js +18 -0
- package/dist/components/gestures/handles.js.map +7 -0
- package/dist/components/gestures/index.d.ts +3 -0
- package/dist/components/gestures/index.js +5 -0
- package/dist/components/gestures/index.js.map +7 -0
- package/dist/components/gestures/usePointerGesture.d.ts +51 -0
- package/dist/components/gestures/usePointerGesture.js +61 -0
- package/dist/components/gestures/usePointerGesture.js.map +7 -0
- package/dist/connect/docx.cjs +12 -12
- package/dist/connect/index.cjs +613 -613
- package/dist/connect/viewer.cjs +10 -10
- package/dist/connection/dashboards/DashboardPanel.js +6 -1
- package/dist/connection/dashboards/DashboardPanel.js.map +2 -2
- package/dist/connection/pages/BlockEditor.d.ts +0 -5
- package/dist/connection/pages/BlockEditor.js +3 -65
- package/dist/connection/pages/BlockEditor.js.map +2 -2
- package/dist/connection/pages/ConnectedPagesPage.d.ts +4 -1
- package/dist/connection/pages/ConnectedPagesPage.js +52 -71
- package/dist/connection/pages/ConnectedPagesPage.js.map +2 -2
- package/dist/connection/pages/DocumentBlocks.js +3 -3
- package/dist/connection/pages/DocumentBlocks.js.map +2 -2
- package/dist/connection/pages/DocumentsPicker.js +1 -1
- package/dist/connection/pages/DocumentsPicker.js.map +2 -2
- package/dist/connection/pages/EditablePageGrid.d.ts +31 -0
- package/dist/connection/pages/EditablePageGrid.js +200 -0
- package/dist/connection/pages/EditablePageGrid.js.map +7 -0
- package/dist/connection/pages/PageGrid.d.ts +7 -4
- package/dist/connection/pages/PageGrid.js +9 -3
- package/dist/connection/pages/PageGrid.js.map +2 -2
- package/dist/connection/pages/TableViewBlock.js +1 -1
- package/dist/connection/pages/TableViewBlock.js.map +2 -2
- package/dist/connection/pages/grid-layout.d.ts +38 -0
- package/dist/connection/pages/grid-layout.js +98 -0
- package/dist/connection/pages/grid-layout.js.map +7 -0
- package/dist/connection/pages/index.d.ts +2 -0
- package/dist/connection/pages/index.js +19 -1
- package/dist/connection/pages/index.js.map +2 -2
- package/dist/connection/pages/labels.d.ts +0 -2
- package/dist/connection/pages/labels.js +0 -2
- package/dist/connection/pages/labels.js.map +2 -2
- package/dist/connection/shell/experimentalNav.d.ts +8 -0
- package/dist/connection/shell/experimentalNav.js +23 -0
- package/dist/connection/shell/experimentalNav.js.map +7 -0
- package/dist/dashboards/ChartRenderer.d.ts +6 -0
- package/dist/dashboards/ChartRenderer.js +7 -2
- package/dist/dashboards/ChartRenderer.js.map +2 -2
- package/dist/dashboards/PanelView.d.ts +2 -0
- package/dist/dashboards/PanelView.js +12 -2
- package/dist/dashboards/PanelView.js.map +2 -2
- package/dist/dashboards/RechartsRenderer.js +19 -18
- package/dist/dashboards/RechartsRenderer.js.map +2 -2
- package/dist/dashboards/index.cjs +16 -16
- package/dist/embed/index.cjs +13 -13
- package/dist/facts/index.cjs +1 -1
- package/dist/files/index.cjs +226 -226
- package/dist/index.cjs +338 -320
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +2 -2
- package/dist/pages/index.cjs +389 -181
- package/dist/pages/index.cjs.map +1 -1
- package/dist/presentation/StageBox.js +63 -86
- package/dist/presentation/StageBox.js.map +2 -2
- package/dist/presentation/StageItem.js +86 -117
- package/dist/presentation/StageItem.js.map +2 -2
- package/dist/site/index.cjs +5 -5
- package/dist/studio/index.cjs +13 -13
- package/dist/styles.css +1 -1
- package/dist/workflow-canvas/index.cjs +25 -25
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
- package/dist/ConnectedPresentation-SY42ADRU.cjs.map +0 -1
- package/dist/ConnectedSlidesTab-JATNBI22.cjs.map +0 -1
- package/dist/RechartsRenderer-NRLQZSSY.cjs.map +0 -1
- package/dist/SpotlightStrip-QQ2WUI32.cjs.map +0 -1
- package/dist/chunk-2SILSQNF.cjs.map +0 -1
- package/dist/chunk-3XCYPWC5.cjs.map +0 -1
- package/dist/chunk-7Q46YAX4.cjs.map +0 -1
package/dist/pages/index.cjs
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkUM3EWCDE_cjs = require('../chunk-UM3EWCDE.cjs');
|
|
5
|
+
var chunkDLGYR4JL_cjs = require('../chunk-DLGYR4JL.cjs');
|
|
6
|
+
var chunkLYKT336H_cjs = require('../chunk-LYKT336H.cjs');
|
|
5
7
|
var chunkKRQCUVH7_cjs = require('../chunk-KRQCUVH7.cjs');
|
|
6
|
-
var
|
|
8
|
+
var chunk4ZR4O5SP_cjs = require('../chunk-4ZR4O5SP.cjs');
|
|
7
9
|
require('../chunk-PBPO54KZ.cjs');
|
|
8
|
-
var chunkDLGYR4JL_cjs = require('../chunk-DLGYR4JL.cjs');
|
|
9
10
|
var chunkQ25CZLK6_cjs = require('../chunk-Q25CZLK6.cjs');
|
|
10
11
|
require('../chunk-MWHVETKN.cjs');
|
|
11
12
|
var chunkNSD37OF5_cjs = require('../chunk-NSD37OF5.cjs');
|
|
12
|
-
require('../chunk-
|
|
13
|
+
require('../chunk-2P7VH2SK.cjs');
|
|
13
14
|
require('../chunk-ZU2B2RZK.cjs');
|
|
14
15
|
require('../chunk-YA6GXWC2.cjs');
|
|
15
16
|
require('../chunk-ZVEW3JBT.cjs');
|
|
@@ -84,7 +85,7 @@ function DocumentsPicker({
|
|
|
84
85
|
"data-testid": `${testId}-search`
|
|
85
86
|
}
|
|
86
87
|
),
|
|
87
|
-
documents.isLoading ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: l.loading }) : found.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: l.none }) : /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "max-h-56 overflow-y-auto rounded-md border", role: "listbox", children: found.map((d) => {
|
|
88
|
+
documents.isLoading ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: l.loading }) : found.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: l.none }) : /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "max-h-56 overflow-y-auto rounded-md border border-border", role: "listbox", children: found.map((d) => {
|
|
88
89
|
const blocked = sharedOnly && !d.shared;
|
|
89
90
|
const chosen = value.includes(d.external_id);
|
|
90
91
|
return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -204,43 +205,12 @@ function ViewPicker({
|
|
|
204
205
|
}
|
|
205
206
|
var DEFAULT_BLOCK_EDITOR_LABELS = {
|
|
206
207
|
title: "Block",
|
|
207
|
-
description: "Choose what the block shows
|
|
208
|
+
description: "Choose what the block shows. Drag it on the page to place and size it.",
|
|
208
209
|
text: "Text (Markdown)",
|
|
209
210
|
view: "Table view",
|
|
210
|
-
width: "Width",
|
|
211
|
-
height: "Height",
|
|
212
|
-
columns: (n) => n === react.PAGE_GRID_COLUMNS ? "Full width" : n === 6 ? "Half" : `${n} of ${react.PAGE_GRID_COLUMNS} columns`,
|
|
213
|
-
rows: (n) => `${n} ${n === 1 ? "row" : "rows"}`,
|
|
214
211
|
cancel: "Cancel",
|
|
215
212
|
done: "Done"
|
|
216
213
|
};
|
|
217
|
-
var WIDTHS = [3, 4, 6, 8, 9, 12];
|
|
218
|
-
var HEIGHTS = [1, 2, 3, 4, 5, 6, 8, 10, 12];
|
|
219
|
-
function SizeSelect({
|
|
220
|
-
id,
|
|
221
|
-
label,
|
|
222
|
-
value,
|
|
223
|
-
options,
|
|
224
|
-
format,
|
|
225
|
-
onChange,
|
|
226
|
-
testId
|
|
227
|
-
}) {
|
|
228
|
-
const all = options.includes(value) ? options : [...options, value].sort((a, b) => a - b);
|
|
229
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
230
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: id, children: label }),
|
|
231
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
232
|
-
"select",
|
|
233
|
-
{
|
|
234
|
-
id,
|
|
235
|
-
className: "h-9 rounded-md border border-input bg-background px-2 text-sm",
|
|
236
|
-
value,
|
|
237
|
-
onChange: (e) => onChange(Number(e.target.value)),
|
|
238
|
-
"data-testid": testId,
|
|
239
|
-
children: all.map((n) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: n, children: format(n) }, n))
|
|
240
|
-
}
|
|
241
|
-
)
|
|
242
|
-
] });
|
|
243
|
-
}
|
|
244
214
|
function BlockEditor({
|
|
245
215
|
block,
|
|
246
216
|
shared,
|
|
@@ -255,7 +225,6 @@ function BlockEditor({
|
|
|
255
225
|
const l = { ...DEFAULT_BLOCK_EDITOR_LABELS, ...labels };
|
|
256
226
|
const [value, setValue] = react$1.useState(block);
|
|
257
227
|
react$1.useEffect(() => setValue(block), [block]);
|
|
258
|
-
const setLayout = (patch) => setValue((b) => b ? { ...b, layout: { ...b.layout, ...patch } } : b);
|
|
259
228
|
const setPanel = (panel) => setValue((b) => b ? { ...react.blockOfPanel(panel, b.layout.h), layout: b.layout } : b);
|
|
260
229
|
const ready = !!value && (value.kind === "table" ? !!value.config.view : value.kind === "document" ? !!value.config.document : value.kind === "gallery" ? value.config.documents.length > 0 : true);
|
|
261
230
|
return /* @__PURE__ */ jsxRuntime.jsx(ui.Dialog, { open: block !== null, onOpenChange: (open) => !open && onCancel(), children: /* @__PURE__ */ jsxRuntime.jsxs(ui.DialogContent, { className: "max-h-[90dvh] max-w-5xl overflow-y-auto", "data-testid": testId, children: [
|
|
@@ -265,7 +234,7 @@ function BlockEditor({
|
|
|
265
234
|
] }),
|
|
266
235
|
value && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
|
|
267
236
|
(value.kind === "chart" || value.kind === "metric") && /* @__PURE__ */ jsxRuntime.jsx(
|
|
268
|
-
|
|
237
|
+
chunkLYKT336H_cjs.PanelEditor,
|
|
269
238
|
{
|
|
270
239
|
value: react.panelOfBlock(value),
|
|
271
240
|
onChange: setPanel,
|
|
@@ -308,33 +277,7 @@ function BlockEditor({
|
|
|
308
277
|
labels: documentsLabels,
|
|
309
278
|
testId: `${testId}-documents`
|
|
310
279
|
}
|
|
311
|
-
)
|
|
312
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-4 sm:grid-cols-2", children: [
|
|
313
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
314
|
-
SizeSelect,
|
|
315
|
-
{
|
|
316
|
-
id: `${testId}-width`,
|
|
317
|
-
label: l.width,
|
|
318
|
-
value: value.layout.w,
|
|
319
|
-
options: WIDTHS,
|
|
320
|
-
format: l.columns,
|
|
321
|
-
onChange: (w) => setLayout({ w }),
|
|
322
|
-
testId: `${testId}-width`
|
|
323
|
-
}
|
|
324
|
-
),
|
|
325
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
326
|
-
SizeSelect,
|
|
327
|
-
{
|
|
328
|
-
id: `${testId}-height`,
|
|
329
|
-
label: l.height,
|
|
330
|
-
value: value.layout.h,
|
|
331
|
-
options: HEIGHTS,
|
|
332
|
-
format: l.rows,
|
|
333
|
-
onChange: (h) => setLayout({ h }),
|
|
334
|
-
testId: `${testId}-height`
|
|
335
|
-
}
|
|
336
|
-
)
|
|
337
|
-
] })
|
|
280
|
+
)
|
|
338
281
|
] }),
|
|
339
282
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.DialogFooter, { children: [
|
|
340
283
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "ghost", onClick: onCancel, children: l.cancel }),
|
|
@@ -350,6 +293,324 @@ function BlockEditor({
|
|
|
350
293
|
] })
|
|
351
294
|
] }) });
|
|
352
295
|
}
|
|
296
|
+
var MIN_BLOCK_SIZE = {
|
|
297
|
+
metric: { w: 2, h: react.DEFAULT_BLOCK_HEIGHT.metric },
|
|
298
|
+
text: { w: 2, h: react.DEFAULT_BLOCK_HEIGHT.text },
|
|
299
|
+
chart: { w: 3, h: react.DEFAULT_BLOCK_HEIGHT.chart },
|
|
300
|
+
table: { w: 4, h: react.DEFAULT_BLOCK_HEIGHT.table },
|
|
301
|
+
document: { w: 3, h: react.DEFAULT_BLOCK_HEIGHT.document },
|
|
302
|
+
gallery: { w: 3, h: react.DEFAULT_BLOCK_HEIGHT.gallery }
|
|
303
|
+
};
|
|
304
|
+
var overlaps = (a, b) => a.x < b.x + b.w && b.x < a.x + a.w && a.y < b.y + b.h && b.y < a.y + a.h;
|
|
305
|
+
var clampInt = (n, lo, hi) => Math.min(hi, Math.max(lo, Math.round(n)));
|
|
306
|
+
function compactLayout(items, pinned) {
|
|
307
|
+
const placed = [];
|
|
308
|
+
const out = /* @__PURE__ */ new Map();
|
|
309
|
+
const fixed = items.find((i) => i.id === pinned);
|
|
310
|
+
if (fixed) {
|
|
311
|
+
placed.push(fixed.layout);
|
|
312
|
+
out.set(fixed.id, fixed);
|
|
313
|
+
}
|
|
314
|
+
const order = items.filter((i) => i.id !== pinned).sort((a, b) => a.layout.y - b.layout.y || a.layout.x - b.layout.x);
|
|
315
|
+
for (const item of order) {
|
|
316
|
+
const layout = { ...item.layout };
|
|
317
|
+
while (placed.some((p) => overlaps(p, layout))) layout.y += 1;
|
|
318
|
+
while (layout.y > 0 && !placed.some((p) => overlaps(p, { ...layout, y: layout.y - 1 })))
|
|
319
|
+
layout.y -= 1;
|
|
320
|
+
placed.push(layout);
|
|
321
|
+
out.set(item.id, { ...item, layout });
|
|
322
|
+
}
|
|
323
|
+
return items.map((i) => out.get(i.id) ?? i);
|
|
324
|
+
}
|
|
325
|
+
function pushAway(items, mover) {
|
|
326
|
+
let next = items;
|
|
327
|
+
const others = () => next.filter((i) => i.id !== mover.id);
|
|
328
|
+
for (const hit of others().sort((a, b) => a.layout.y - b.layout.y)) {
|
|
329
|
+
const current = next.find((i) => i.id === hit.id);
|
|
330
|
+
if (!current || !overlaps(current.layout, mover.layout)) continue;
|
|
331
|
+
const above = { ...current.layout, y: mover.layout.y - current.layout.h };
|
|
332
|
+
const fitsAbove = above.y >= 0 && !next.some((i) => i.id !== current.id && overlaps(i.layout, above));
|
|
333
|
+
const layout = fitsAbove ? above : { ...current.layout, y: mover.layout.y + mover.layout.h };
|
|
334
|
+
const moved = { ...current, layout };
|
|
335
|
+
next = next.map((i) => i.id === moved.id ? moved : i);
|
|
336
|
+
if (!fitsAbove) next = pushAway(next, moved).map((i) => i.id === mover.id ? mover : i);
|
|
337
|
+
}
|
|
338
|
+
return next;
|
|
339
|
+
}
|
|
340
|
+
function place(items, id, layout) {
|
|
341
|
+
const mover = items.find((i) => i.id === id);
|
|
342
|
+
if (!mover) return [...items];
|
|
343
|
+
const moved = { ...mover, layout };
|
|
344
|
+
return pushAway(
|
|
345
|
+
items.map((i) => i.id === id ? moved : i),
|
|
346
|
+
moved
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
function moveBlock(items, id, to, settle = true) {
|
|
350
|
+
const item = items.find((i) => i.id === id);
|
|
351
|
+
if (!item) return [...items];
|
|
352
|
+
const layout = {
|
|
353
|
+
...item.layout,
|
|
354
|
+
x: clampInt(to.x, 0, react.PAGE_GRID_COLUMNS - item.layout.w),
|
|
355
|
+
y: Math.max(0, Math.round(to.y))
|
|
356
|
+
};
|
|
357
|
+
const next = compactLayout(place(items, id, layout), id);
|
|
358
|
+
return settle ? compactLayout(next) : next;
|
|
359
|
+
}
|
|
360
|
+
function resizeBlock(items, id, to, settle = true) {
|
|
361
|
+
const item = items.find((i) => i.id === id);
|
|
362
|
+
if (!item) return [...items];
|
|
363
|
+
const min = MIN_BLOCK_SIZE[item.kind];
|
|
364
|
+
const layout = {
|
|
365
|
+
...item.layout,
|
|
366
|
+
w: clampInt(
|
|
367
|
+
to.w,
|
|
368
|
+
Math.min(min.w, react.PAGE_GRID_COLUMNS - item.layout.x),
|
|
369
|
+
react.PAGE_GRID_COLUMNS - item.layout.x
|
|
370
|
+
),
|
|
371
|
+
h: Math.max(min.h, Math.round(to.h))
|
|
372
|
+
};
|
|
373
|
+
const next = compactLayout(place(items, id, layout), id);
|
|
374
|
+
return settle ? compactLayout(next) : next;
|
|
375
|
+
}
|
|
376
|
+
function appendBlock(items, item) {
|
|
377
|
+
const bottom = Math.max(0, ...items.map((i) => i.layout.y + i.layout.h));
|
|
378
|
+
const w = clampInt(item.layout.w, 1, react.PAGE_GRID_COLUMNS);
|
|
379
|
+
return compactLayout([...items, { ...item, layout: { ...item.layout, x: 0, y: bottom, w } }]);
|
|
380
|
+
}
|
|
381
|
+
var PAGE_ROW_HEIGHT = "4.5rem";
|
|
382
|
+
function PageGrid({ children, className, testId, gridRef }) {
|
|
383
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
384
|
+
"div",
|
|
385
|
+
{
|
|
386
|
+
ref: gridRef,
|
|
387
|
+
className: ui.cn("grid grid-cols-1 gap-4 md:grid-cols-12", className),
|
|
388
|
+
style: { gridAutoRows: `minmax(${PAGE_ROW_HEIGHT}, auto)` },
|
|
389
|
+
"data-slot": "page-grid",
|
|
390
|
+
"data-testid": testId,
|
|
391
|
+
children
|
|
392
|
+
}
|
|
393
|
+
);
|
|
394
|
+
}
|
|
395
|
+
function inReadingOrder(blocks) {
|
|
396
|
+
return [...blocks].sort((a, b) => a.layout.y - b.layout.y || a.layout.x - b.layout.x);
|
|
397
|
+
}
|
|
398
|
+
function PageCell({
|
|
399
|
+
layout,
|
|
400
|
+
children,
|
|
401
|
+
className,
|
|
402
|
+
style,
|
|
403
|
+
testId,
|
|
404
|
+
cellRef,
|
|
405
|
+
...rest
|
|
406
|
+
}) {
|
|
407
|
+
const place2 = {
|
|
408
|
+
"--page-col": `${layout.x + 1} / span ${layout.w}`,
|
|
409
|
+
"--page-row": `${layout.y + 1} / span ${layout.h}`
|
|
410
|
+
};
|
|
411
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
412
|
+
"div",
|
|
413
|
+
{
|
|
414
|
+
...rest,
|
|
415
|
+
ref: cellRef,
|
|
416
|
+
className: ui.cn(
|
|
417
|
+
"col-span-1 min-w-0 md:[grid-column:var(--page-col)] md:[grid-row:var(--page-row)]",
|
|
418
|
+
className
|
|
419
|
+
),
|
|
420
|
+
style: { ...place2, ...style },
|
|
421
|
+
"data-slot": "page-cell",
|
|
422
|
+
"data-testid": testId,
|
|
423
|
+
children
|
|
424
|
+
}
|
|
425
|
+
);
|
|
426
|
+
}
|
|
427
|
+
var DEFAULT_EDITABLE_PAGE_GRID_LABELS = {
|
|
428
|
+
move: "Move the block",
|
|
429
|
+
moveHint: "Drag to move. Arrow keys move it; Shift and the arrow keys resize it.",
|
|
430
|
+
resize: "Resize the block"
|
|
431
|
+
};
|
|
432
|
+
var RESIZE_HANDLES = [
|
|
433
|
+
{ kind: "e", left: "100%", top: "50%", cursor: "ew-resize" },
|
|
434
|
+
{ kind: "s", left: "50%", top: "100%", cursor: "ns-resize" },
|
|
435
|
+
{ kind: "se", left: "100%", top: "100%", cursor: "nwse-resize" }
|
|
436
|
+
];
|
|
437
|
+
var px = (value) => {
|
|
438
|
+
const n = parseFloat(value);
|
|
439
|
+
return Number.isFinite(n) ? n : 0;
|
|
440
|
+
};
|
|
441
|
+
function pitchOf(grid) {
|
|
442
|
+
if (!grid) return { col: 0, row: 0 };
|
|
443
|
+
const view = grid.ownerDocument.defaultView ?? window;
|
|
444
|
+
const style = view.getComputedStyle(grid);
|
|
445
|
+
const rem = px(view.getComputedStyle(grid.ownerDocument.documentElement).fontSize) || 16;
|
|
446
|
+
const gapX = px(style.columnGap);
|
|
447
|
+
const gapY = px(style.rowGap);
|
|
448
|
+
return {
|
|
449
|
+
col: (grid.getBoundingClientRect().width + gapX) / 12,
|
|
450
|
+
row: px(PAGE_ROW_HEIGHT) * rem + gapY
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
var keyOf = (blocks) => blocks.map((b) => `${b.id}:${b.layout.x},${b.layout.y},${b.layout.w},${b.layout.h}`).join("|");
|
|
454
|
+
function EditableCell({
|
|
455
|
+
block,
|
|
456
|
+
layout,
|
|
457
|
+
grid,
|
|
458
|
+
blocks,
|
|
459
|
+
dragged,
|
|
460
|
+
onPreview,
|
|
461
|
+
onCommit,
|
|
462
|
+
renderBlock,
|
|
463
|
+
l,
|
|
464
|
+
testId
|
|
465
|
+
}) {
|
|
466
|
+
const element = react$1.useRef(null);
|
|
467
|
+
const gesture = chunkUM3EWCDE_cjs.usePointerGesture({
|
|
468
|
+
element,
|
|
469
|
+
threshold: 3,
|
|
470
|
+
begin: () => {
|
|
471
|
+
const { col, row } = pitchOf(grid());
|
|
472
|
+
if (!col || !row) return null;
|
|
473
|
+
return { base: blocks, start: block.layout, col, row, shown: keyOf(blocks) };
|
|
474
|
+
},
|
|
475
|
+
dragStart: () => {
|
|
476
|
+
if (element.current) element.current.style.willChange = "transform";
|
|
477
|
+
},
|
|
478
|
+
update: (g, kind, { dx, dy }) => {
|
|
479
|
+
const cols = Math.round(dx / g.col);
|
|
480
|
+
const rows = Math.round(dy / g.row);
|
|
481
|
+
const next = kind === "move" ? moveBlock(g.base, block.id, { x: g.start.x + cols, y: g.start.y + rows }, false) : resizeBlock(
|
|
482
|
+
g.base,
|
|
483
|
+
block.id,
|
|
484
|
+
{
|
|
485
|
+
w: g.start.w + (kind === "s" ? 0 : cols),
|
|
486
|
+
h: g.start.h + (kind === "e" ? 0 : rows)
|
|
487
|
+
},
|
|
488
|
+
false
|
|
489
|
+
);
|
|
490
|
+
return { blocks: next, key: keyOf(next), dx, dy };
|
|
491
|
+
},
|
|
492
|
+
apply: (g, next, kind) => {
|
|
493
|
+
if (kind === "move" && element.current) {
|
|
494
|
+
element.current.style.transform = `translate3d(${next.dx}px, ${next.dy}px, 0)`;
|
|
495
|
+
}
|
|
496
|
+
if (next.key !== g.shown) {
|
|
497
|
+
g.shown = next.key;
|
|
498
|
+
onPreview({ id: block.id, moving: kind === "move", blocks: next.blocks });
|
|
499
|
+
}
|
|
500
|
+
},
|
|
501
|
+
end: (g, next, kind) => {
|
|
502
|
+
if (element.current) {
|
|
503
|
+
element.current.style.transform = "";
|
|
504
|
+
element.current.style.willChange = "";
|
|
505
|
+
}
|
|
506
|
+
onPreview(null);
|
|
507
|
+
if (!next) return;
|
|
508
|
+
const to = next.blocks.find((b) => b.id === block.id)?.layout ?? block.layout;
|
|
509
|
+
const settled = kind === "move" ? moveBlock(g.base, block.id, to) : resizeBlock(g.base, block.id, to);
|
|
510
|
+
if (keyOf(settled) !== keyOf(g.base)) onCommit(settled);
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
const onKeyDown = (event) => {
|
|
514
|
+
const step = {
|
|
515
|
+
ArrowLeft: [-1, 0],
|
|
516
|
+
ArrowRight: [1, 0],
|
|
517
|
+
ArrowUp: [0, -1],
|
|
518
|
+
ArrowDown: [0, 1]
|
|
519
|
+
}[event.key];
|
|
520
|
+
if (!step) return;
|
|
521
|
+
event.preventDefault();
|
|
522
|
+
const [x, y] = step;
|
|
523
|
+
const { layout: at } = block;
|
|
524
|
+
onCommit(
|
|
525
|
+
event.shiftKey ? resizeBlock(blocks, block.id, { w: at.w + x, h: at.h + y }) : moveBlock(blocks, block.id, { x: at.x + x, y: at.y + y })
|
|
526
|
+
);
|
|
527
|
+
};
|
|
528
|
+
const grip = /* @__PURE__ */ jsxRuntime.jsx(
|
|
529
|
+
ui.Button,
|
|
530
|
+
{
|
|
531
|
+
variant: "ghost",
|
|
532
|
+
size: "icon",
|
|
533
|
+
className: "hidden size-7 cursor-grab touch-none active:cursor-grabbing md:inline-flex",
|
|
534
|
+
"aria-label": l.move,
|
|
535
|
+
title: l.moveHint,
|
|
536
|
+
onPointerDown: (event) => gesture.start(event, "move"),
|
|
537
|
+
onKeyDown,
|
|
538
|
+
"data-testid": `${testId}-move-${block.id}`,
|
|
539
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.GripVertical, { className: "size-3.5" })
|
|
540
|
+
}
|
|
541
|
+
);
|
|
542
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
543
|
+
PageCell,
|
|
544
|
+
{
|
|
545
|
+
layout,
|
|
546
|
+
cellRef: element,
|
|
547
|
+
className: ui.cn("group/cell relative", dragged && "z-10 opacity-90"),
|
|
548
|
+
...gesture.handlers,
|
|
549
|
+
testId: `${testId}-cell-${block.id}`,
|
|
550
|
+
children: [
|
|
551
|
+
renderBlock(block, grip),
|
|
552
|
+
RESIZE_HANDLES.map(({ kind, left, top, cursor }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
553
|
+
chunkUM3EWCDE_cjs.GestureHandle,
|
|
554
|
+
{
|
|
555
|
+
left,
|
|
556
|
+
top,
|
|
557
|
+
cursor,
|
|
558
|
+
size: "sm",
|
|
559
|
+
bar: kind === "e" ? "v" : kind === "s" ? "h" : void 0,
|
|
560
|
+
className: "hidden opacity-0 transition-opacity group-hover/cell:opacity-100 pointer-coarse:opacity-100 md:flex",
|
|
561
|
+
onPointerDown: (event) => gesture.start(event, kind),
|
|
562
|
+
"aria-label": l.resize,
|
|
563
|
+
testId: `${testId}-resize-${kind}-${block.id}`
|
|
564
|
+
},
|
|
565
|
+
kind
|
|
566
|
+
))
|
|
567
|
+
]
|
|
568
|
+
}
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
function EditablePageGrid({
|
|
572
|
+
blocks,
|
|
573
|
+
onChange,
|
|
574
|
+
renderBlock,
|
|
575
|
+
labels,
|
|
576
|
+
testId = "page"
|
|
577
|
+
}) {
|
|
578
|
+
const l = { ...DEFAULT_EDITABLE_PAGE_GRID_LABELS, ...labels };
|
|
579
|
+
const grid = react$1.useRef(null);
|
|
580
|
+
const [preview, setPreview] = react$1.useState(null);
|
|
581
|
+
const placeOf = (block) => preview?.blocks.find((b) => b.id === block.id)?.layout ?? block.layout;
|
|
582
|
+
const target = preview?.moving ? preview.blocks.find((b) => b.id === preview.id) : void 0;
|
|
583
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(PageGrid, { testId: `${testId}-grid`, gridRef: grid, children: [
|
|
584
|
+
target && /* @__PURE__ */ jsxRuntime.jsx(
|
|
585
|
+
PageCell,
|
|
586
|
+
{
|
|
587
|
+
layout: target.layout,
|
|
588
|
+
className: "rounded-xl border-2 border-dashed border-primary/30 bg-primary/5",
|
|
589
|
+
"aria-hidden": true,
|
|
590
|
+
testId: `${testId}-drop-target`
|
|
591
|
+
}
|
|
592
|
+
),
|
|
593
|
+
inReadingOrder(blocks).map((block) => {
|
|
594
|
+
const isDragged = preview?.id === block.id;
|
|
595
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
596
|
+
EditableCell,
|
|
597
|
+
{
|
|
598
|
+
block,
|
|
599
|
+
layout: isDragged && preview.moving ? block.layout : placeOf(block),
|
|
600
|
+
grid: () => grid.current,
|
|
601
|
+
blocks,
|
|
602
|
+
dragged: isDragged,
|
|
603
|
+
onPreview: setPreview,
|
|
604
|
+
onCommit: onChange,
|
|
605
|
+
renderBlock,
|
|
606
|
+
l,
|
|
607
|
+
testId
|
|
608
|
+
},
|
|
609
|
+
block.id
|
|
610
|
+
);
|
|
611
|
+
})
|
|
612
|
+
] });
|
|
613
|
+
}
|
|
353
614
|
var DEFAULT_DOCUMENT_BLOCK_LABELS = {
|
|
354
615
|
loading: "Loading\u2026",
|
|
355
616
|
unavailable: "This document is not available to you.",
|
|
@@ -403,7 +664,7 @@ function BlockCard({
|
|
|
403
664
|
className: ui.cn("flex h-full min-h-[14rem] flex-col overflow-hidden rounded-xl p-0", className),
|
|
404
665
|
"data-testid": testId,
|
|
405
666
|
children: [
|
|
406
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 border-b px-4 py-2", children: [
|
|
667
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 border-b border-border px-4 py-2", children: [
|
|
407
668
|
icon,
|
|
408
669
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm font-medium", "data-testid": testId && `${testId}-name`, children: title }),
|
|
409
670
|
actions && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-auto flex gap-1", children: actions })
|
|
@@ -509,7 +770,7 @@ function GalleryBlockView({
|
|
|
509
770
|
},
|
|
510
771
|
current
|
|
511
772
|
) }),
|
|
512
|
-
count > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-2 overflow-x-auto border-t p-2", role: "list", children: documentIds.map((id, i) => {
|
|
773
|
+
count > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-2 overflow-x-auto border-t border-border p-2", role: "list", children: documentIds.map((id, i) => {
|
|
513
774
|
const src = thumbnails.get(id);
|
|
514
775
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
515
776
|
"button",
|
|
@@ -520,7 +781,7 @@ function GalleryBlockView({
|
|
|
520
781
|
"aria-current": i === at,
|
|
521
782
|
onClick: () => setIndex(i),
|
|
522
783
|
className: ui.cn(
|
|
523
|
-
"flex h-14 w-12 shrink-0 items-center justify-center overflow-hidden rounded border bg-muted",
|
|
784
|
+
"flex h-14 w-12 shrink-0 items-center justify-center overflow-hidden rounded border border-border bg-muted",
|
|
524
785
|
i === at && "ring-2 ring-primary"
|
|
525
786
|
),
|
|
526
787
|
"data-testid": testId && `${testId}-thumb-${i}`,
|
|
@@ -593,7 +854,7 @@ function TableViewBlock({
|
|
|
593
854
|
className: ui.cn("flex h-full min-h-[12rem] flex-col overflow-hidden rounded-xl p-0", className),
|
|
594
855
|
"data-testid": testId,
|
|
595
856
|
children: [
|
|
596
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 border-b px-4 py-2", children: [
|
|
857
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 border-b border-border px-4 py-2", children: [
|
|
597
858
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Table2, { className: "size-4 text-muted-foreground" }),
|
|
598
859
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm font-medium", "data-testid": testId && `${testId}-name`, children: view.data?.spec.name ?? "" }),
|
|
599
860
|
actions && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-auto flex gap-1", children: actions })
|
|
@@ -616,7 +877,7 @@ function PageBlockView({
|
|
|
616
877
|
case "chart":
|
|
617
878
|
case "metric":
|
|
618
879
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
619
|
-
|
|
880
|
+
chunk4ZR4O5SP_cjs.DashboardPanel,
|
|
620
881
|
{
|
|
621
882
|
panel: react.panelOfBlock(block),
|
|
622
883
|
actions,
|
|
@@ -673,46 +934,6 @@ function PageBlockView({
|
|
|
673
934
|
) });
|
|
674
935
|
}
|
|
675
936
|
}
|
|
676
|
-
var PAGE_ROW_HEIGHT = "4.5rem";
|
|
677
|
-
function PageGrid({ children, className, testId }) {
|
|
678
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
679
|
-
"div",
|
|
680
|
-
{
|
|
681
|
-
className: ui.cn("grid grid-cols-1 gap-4 md:grid-cols-12", className),
|
|
682
|
-
style: { gridAutoRows: `minmax(${PAGE_ROW_HEIGHT}, auto)` },
|
|
683
|
-
"data-slot": "page-grid",
|
|
684
|
-
"data-testid": testId,
|
|
685
|
-
children
|
|
686
|
-
}
|
|
687
|
-
);
|
|
688
|
-
}
|
|
689
|
-
function inReadingOrder(blocks) {
|
|
690
|
-
return [...blocks].sort((a, b) => a.layout.y - b.layout.y || a.layout.x - b.layout.x);
|
|
691
|
-
}
|
|
692
|
-
function PageCell({
|
|
693
|
-
layout,
|
|
694
|
-
children,
|
|
695
|
-
className,
|
|
696
|
-
testId
|
|
697
|
-
}) {
|
|
698
|
-
const place = {
|
|
699
|
-
"--page-col": `${layout.x + 1} / span ${layout.w}`,
|
|
700
|
-
"--page-row": `${layout.y + 1} / span ${layout.h}`
|
|
701
|
-
};
|
|
702
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
703
|
-
"div",
|
|
704
|
-
{
|
|
705
|
-
className: ui.cn(
|
|
706
|
-
"col-span-1 min-w-0 md:[grid-column:var(--page-col)] md:[grid-row:var(--page-row)]",
|
|
707
|
-
className
|
|
708
|
-
),
|
|
709
|
-
style: place,
|
|
710
|
-
"data-slot": "page-cell",
|
|
711
|
-
"data-testid": testId,
|
|
712
|
-
children
|
|
713
|
-
}
|
|
714
|
-
);
|
|
715
|
-
}
|
|
716
937
|
function NewPageButton({
|
|
717
938
|
templates,
|
|
718
939
|
l,
|
|
@@ -951,8 +1172,6 @@ var DEFAULT_PAGES_PAGE_LABELS = {
|
|
|
951
1172
|
gallery: "Gallery"
|
|
952
1173
|
},
|
|
953
1174
|
editBlock: "Edit the block",
|
|
954
|
-
moveUp: "Move up",
|
|
955
|
-
moveDown: "Move down",
|
|
956
1175
|
removeBlock: "Remove the block",
|
|
957
1176
|
noBlocks: "No blocks yet. Add one to start.",
|
|
958
1177
|
saved: "Page saved",
|
|
@@ -1000,6 +1219,7 @@ function ConnectedPagesPage({
|
|
|
1000
1219
|
panelLabels,
|
|
1001
1220
|
editorLabels,
|
|
1002
1221
|
blockLabels,
|
|
1222
|
+
gridLabels,
|
|
1003
1223
|
tableLabels,
|
|
1004
1224
|
pickerLabels,
|
|
1005
1225
|
className,
|
|
@@ -1085,7 +1305,7 @@ function ConnectedPagesPage({
|
|
|
1085
1305
|
setDraft(null);
|
|
1086
1306
|
};
|
|
1087
1307
|
const updateDraft = (patch) => setDraft((d) => d ? { ...d, spec: { ...d.spec, ...patch } } : d);
|
|
1088
|
-
const setBlocks = (blocks) => updateDraft({ blocks
|
|
1308
|
+
const setBlocks = (blocks) => updateDraft({ blocks });
|
|
1089
1309
|
const commit = async () => {
|
|
1090
1310
|
if (!draft) return;
|
|
1091
1311
|
try {
|
|
@@ -1120,13 +1340,7 @@ function ConnectedPagesPage({
|
|
|
1120
1340
|
};
|
|
1121
1341
|
let content;
|
|
1122
1342
|
if (draft) {
|
|
1123
|
-
const blocks =
|
|
1124
|
-
const move = (index, by) => {
|
|
1125
|
-
const next = [...blocks];
|
|
1126
|
-
const [moved] = next.splice(index, 1);
|
|
1127
|
-
next.splice(index + by, 0, moved);
|
|
1128
|
-
setBlocks(next);
|
|
1129
|
-
};
|
|
1343
|
+
const blocks = draft.spec.blocks;
|
|
1130
1344
|
content = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6", "data-testid": `${testId}-editor`, children: [
|
|
1131
1345
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1132
1346
|
chunkNSD37OF5_cjs.PageHeader,
|
|
@@ -1179,64 +1393,51 @@ function ConnectedPagesPage({
|
|
|
1179
1393
|
)
|
|
1180
1394
|
] })
|
|
1181
1395
|
] }),
|
|
1182
|
-
blocks.length ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1183
|
-
|
|
1396
|
+
blocks.length ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1397
|
+
EditablePageGrid,
|
|
1184
1398
|
{
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
testId
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
),
|
|
1226
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1227
|
-
ui.Button,
|
|
1228
|
-
{
|
|
1229
|
-
variant: "ghost",
|
|
1230
|
-
size: "icon",
|
|
1231
|
-
className: "size-7",
|
|
1232
|
-
"aria-label": l.removeBlock,
|
|
1233
|
-
onClick: () => setBlocks(blocks.filter((_, j) => j !== i)),
|
|
1234
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "size-3.5" })
|
|
1235
|
-
}
|
|
1236
|
-
)
|
|
1237
|
-
] })
|
|
1399
|
+
blocks,
|
|
1400
|
+
onChange: setBlocks,
|
|
1401
|
+
labels: gridLabels,
|
|
1402
|
+
testId,
|
|
1403
|
+
renderBlock: (block, grip) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1404
|
+
PageBlockView,
|
|
1405
|
+
{
|
|
1406
|
+
block,
|
|
1407
|
+
panelLabels,
|
|
1408
|
+
tableLabels,
|
|
1409
|
+
testId: `${testId}-block-${block.id}`,
|
|
1410
|
+
actions: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1411
|
+
grip,
|
|
1412
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1413
|
+
ui.Button,
|
|
1414
|
+
{
|
|
1415
|
+
variant: "ghost",
|
|
1416
|
+
size: "icon",
|
|
1417
|
+
className: "size-7",
|
|
1418
|
+
"aria-label": l.editBlock,
|
|
1419
|
+
onClick: () => setEditing({ block, isNew: false }),
|
|
1420
|
+
"data-testid": `${testId}-edit-block-${block.id}`,
|
|
1421
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { className: "size-3.5" })
|
|
1422
|
+
}
|
|
1423
|
+
),
|
|
1424
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1425
|
+
ui.Button,
|
|
1426
|
+
{
|
|
1427
|
+
variant: "ghost",
|
|
1428
|
+
size: "icon",
|
|
1429
|
+
className: "size-7",
|
|
1430
|
+
"aria-label": l.removeBlock,
|
|
1431
|
+
onClick: () => setBlocks(compactLayout(blocks.filter((b) => b.id !== block.id))),
|
|
1432
|
+
"data-testid": `${testId}-remove-block-${block.id}`,
|
|
1433
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "size-3.5" })
|
|
1434
|
+
}
|
|
1435
|
+
)
|
|
1436
|
+
] })
|
|
1437
|
+
}
|
|
1438
|
+
)
|
|
1238
1439
|
}
|
|
1239
|
-
)
|
|
1440
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: l.noBlocks }),
|
|
1240
1441
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu, { children: [
|
|
1241
1442
|
/* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { variant: "outline", "data-testid": `${testId}-add-block`, children: [
|
|
1242
1443
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "size-4" }),
|
|
@@ -1248,7 +1449,7 @@ function ConnectedPagesPage({
|
|
|
1248
1449
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1249
1450
|
ui.DropdownMenuItem,
|
|
1250
1451
|
{
|
|
1251
|
-
onSelect: () => setEditing({
|
|
1452
|
+
onSelect: () => setEditing({ block: newBlock(kind), isNew: true }),
|
|
1252
1453
|
"data-testid": `${testId}-add-${kind}`,
|
|
1253
1454
|
children: [
|
|
1254
1455
|
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-4" }),
|
|
@@ -1272,9 +1473,9 @@ function ConnectedPagesPage({
|
|
|
1272
1473
|
onCancel: () => setEditing(null),
|
|
1273
1474
|
onDone: (block) => {
|
|
1274
1475
|
if (!editing) return;
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1476
|
+
setBlocks(
|
|
1477
|
+
editing.isNew ? appendBlock(blocks, block) : blocks.map((b) => b.id === block.id ? block : b)
|
|
1478
|
+
);
|
|
1278
1479
|
setEditing(null);
|
|
1279
1480
|
}
|
|
1280
1481
|
}
|
|
@@ -1345,19 +1546,26 @@ exports.ConnectedPagesPage = ConnectedPagesPage;
|
|
|
1345
1546
|
exports.DEFAULT_BLOCK_EDITOR_LABELS = DEFAULT_BLOCK_EDITOR_LABELS;
|
|
1346
1547
|
exports.DEFAULT_DOCUMENTS_PICKER_LABELS = DEFAULT_DOCUMENTS_PICKER_LABELS;
|
|
1347
1548
|
exports.DEFAULT_DOCUMENT_BLOCK_LABELS = DEFAULT_DOCUMENT_BLOCK_LABELS;
|
|
1549
|
+
exports.DEFAULT_EDITABLE_PAGE_GRID_LABELS = DEFAULT_EDITABLE_PAGE_GRID_LABELS;
|
|
1348
1550
|
exports.DEFAULT_PAGES_PAGE_LABELS = DEFAULT_PAGES_PAGE_LABELS;
|
|
1349
1551
|
exports.DEFAULT_TABLE_VIEW_BLOCK_LABELS = DEFAULT_TABLE_VIEW_BLOCK_LABELS;
|
|
1350
1552
|
exports.DEFAULT_VIEW_PICKER_LABELS = DEFAULT_VIEW_PICKER_LABELS;
|
|
1351
1553
|
exports.DocumentBlockView = DocumentBlockView;
|
|
1352
1554
|
exports.DocumentReadView = DocumentReadView;
|
|
1353
1555
|
exports.DocumentsPicker = DocumentsPicker;
|
|
1556
|
+
exports.EditablePageGrid = EditablePageGrid;
|
|
1354
1557
|
exports.GalleryBlockView = GalleryBlockView;
|
|
1558
|
+
exports.MIN_BLOCK_SIZE = MIN_BLOCK_SIZE;
|
|
1355
1559
|
exports.PAGE_ROW_HEIGHT = PAGE_ROW_HEIGHT;
|
|
1356
1560
|
exports.PageBlockView = PageBlockView;
|
|
1357
1561
|
exports.PageCell = PageCell;
|
|
1358
1562
|
exports.PageGrid = PageGrid;
|
|
1359
1563
|
exports.TableViewBlock = TableViewBlock;
|
|
1360
1564
|
exports.ViewPicker = ViewPicker;
|
|
1565
|
+
exports.appendBlock = appendBlock;
|
|
1566
|
+
exports.compactLayout = compactLayout;
|
|
1361
1567
|
exports.inReadingOrder = inReadingOrder;
|
|
1568
|
+
exports.moveBlock = moveBlock;
|
|
1569
|
+
exports.resizeBlock = resizeBlock;
|
|
1362
1570
|
//# sourceMappingURL=index.cjs.map
|
|
1363
1571
|
//# sourceMappingURL=index.cjs.map
|