@arbidocs/blocks 0.5.155 → 0.5.156
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-2DAQX5GX.cjs → ConnectedNativeDocxComparison-G3AIBKSN.cjs} +7 -7
- package/dist/{ConnectedNativeDocxComparison-2DAQX5GX.cjs.map → ConnectedNativeDocxComparison-G3AIBKSN.cjs.map} +1 -1
- package/dist/{ConnectedStreamedWordArtifact-LTYB62VM.cjs → ConnectedStreamedWordArtifact-ISNLUTAT.cjs} +7 -7
- package/dist/{ConnectedStreamedWordArtifact-LTYB62VM.cjs.map → ConnectedStreamedWordArtifact-ISNLUTAT.cjs.map} +1 -1
- package/dist/{DocumentReviewCard-5AP55NGZ.cjs → DocumentReviewCard-7ZH575KX.cjs} +13 -13
- package/dist/{DocumentReviewCard-5AP55NGZ.cjs.map → DocumentReviewCard-7ZH575KX.cjs.map} +1 -1
- package/dist/{FilesViewerDialog-SHWCE3UN.cjs → FilesViewerDialog-6RWJSZZV.cjs} +10 -10
- package/dist/{FilesViewerDialog-SHWCE3UN.cjs.map → FilesViewerDialog-6RWJSZZV.cjs.map} +1 -1
- package/dist/{WorkspaceTableView-S4IBYQVF.cjs → WorkspaceTableView-NMERZJZZ.cjs} +4 -4
- package/dist/{WorkspaceTableView-S4IBYQVF.cjs.map → WorkspaceTableView-NMERZJZZ.cjs.map} +1 -1
- package/dist/agents/index.cjs +172 -172
- package/dist/{chunk-JCFXS336.cjs → chunk-44M4FI2N.cjs} +8 -8
- package/dist/chunk-44M4FI2N.cjs.map +1 -0
- package/dist/{chunk-KWWGUQJV.cjs → chunk-4I4IYVC6.cjs} +7 -7
- package/dist/{chunk-KWWGUQJV.cjs.map → chunk-4I4IYVC6.cjs.map} +1 -1
- package/dist/{chunk-BTQ7IAOH.cjs → chunk-B2L3XNZH.cjs} +4 -4
- package/dist/{chunk-BTQ7IAOH.cjs.map → chunk-B2L3XNZH.cjs.map} +1 -1
- package/dist/{chunk-4XNP27N4.cjs → chunk-BNHFDXJI.cjs} +36 -36
- package/dist/{chunk-4XNP27N4.cjs.map → chunk-BNHFDXJI.cjs.map} +1 -1
- package/dist/{chunk-ZCQXQIBA.cjs → chunk-DCD4OHDF.cjs} +28 -28
- package/dist/{chunk-ZCQXQIBA.cjs.map → chunk-DCD4OHDF.cjs.map} +1 -1
- package/dist/{chunk-6ZZWQ3OL.cjs → chunk-FNBUFKHE.cjs} +4 -4
- package/dist/{chunk-6ZZWQ3OL.cjs.map → chunk-FNBUFKHE.cjs.map} +1 -1
- package/dist/{chunk-B5BGVPQ5.cjs → chunk-HGD4B7GO.cjs} +4 -4
- package/dist/{chunk-B5BGVPQ5.cjs.map → chunk-HGD4B7GO.cjs.map} +1 -1
- package/dist/{chunk-4UDGCXUR.cjs → chunk-HJHDKS4V.cjs} +5 -5
- package/dist/{chunk-4UDGCXUR.cjs.map → chunk-HJHDKS4V.cjs.map} +1 -1
- package/dist/{chunk-3SGFIDID.cjs → chunk-HLUZMXEZ.cjs} +56 -56
- package/dist/{chunk-3SGFIDID.cjs.map → chunk-HLUZMXEZ.cjs.map} +1 -1
- package/dist/{chunk-BZVK7JW5.cjs → chunk-K7GBHLLY.cjs} +4 -4
- package/dist/{chunk-BZVK7JW5.cjs.map → chunk-K7GBHLLY.cjs.map} +1 -1
- package/dist/{chunk-MAKCWF45.cjs → chunk-M24FBUAP.cjs} +4 -4
- package/dist/{chunk-MAKCWF45.cjs.map → chunk-M24FBUAP.cjs.map} +1 -1
- package/dist/{chunk-QEH375MU.cjs → chunk-PD47L6KS.cjs} +4 -4
- package/dist/{chunk-QEH375MU.cjs.map → chunk-PD47L6KS.cjs.map} +1 -1
- package/dist/{chunk-Y2Z5UHHV.cjs → chunk-PTT5MZ7O.cjs} +8 -8
- package/dist/{chunk-Y2Z5UHHV.cjs.map → chunk-PTT5MZ7O.cjs.map} +1 -1
- package/dist/{chunk-TSAZWUPZ.cjs → chunk-Q7G2W5VQ.cjs} +4 -4
- package/dist/{chunk-TSAZWUPZ.cjs.map → chunk-Q7G2W5VQ.cjs.map} +1 -1
- package/dist/{chunk-RL2HI6NP.cjs → chunk-S3GVFAFB.cjs} +3 -3
- package/dist/{chunk-RL2HI6NP.cjs.map → chunk-S3GVFAFB.cjs.map} +1 -1
- package/dist/{chunk-OZJENXU3.cjs → chunk-U6JUIJTP.cjs} +9 -9
- package/dist/{chunk-OZJENXU3.cjs.map → chunk-U6JUIJTP.cjs.map} +1 -1
- package/dist/{chunk-2XOIULVN.cjs → chunk-V4B2GSC6.cjs} +29 -29
- package/dist/{chunk-2XOIULVN.cjs.map → chunk-V4B2GSC6.cjs.map} +1 -1
- package/dist/{chunk-TN3UP3CI.cjs → chunk-YHXJWYOF.cjs} +6 -6
- package/dist/{chunk-TN3UP3CI.cjs.map → chunk-YHXJWYOF.cjs.map} +1 -1
- package/dist/{chunk-74RUAGVD.cjs → chunk-YO7GDNEW.cjs} +5 -5
- package/dist/{chunk-74RUAGVD.cjs.map → chunk-YO7GDNEW.cjs.map} +1 -1
- package/dist/connect/docx.cjs +10 -10
- package/dist/connect/index.cjs +658 -655
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/viewer.cjs +8 -8
- package/dist/connection/files/page/ConnectedFilesPage.js +16 -13
- package/dist/connection/files/page/ConnectedFilesPage.js.map +2 -2
- package/dist/connection/pages/DocumentBlocks.js +1 -1
- package/dist/connection/pages/DocumentBlocks.js.map +2 -2
- package/dist/connection/pages/EditablePageGrid.js +44 -13
- package/dist/connection/pages/EditablePageGrid.js.map +2 -2
- package/dist/connection/storage/ConnectedWorkspaceTrash.d.ts +5 -4
- package/dist/connection/storage/ConnectedWorkspaceTrash.js +1 -1
- package/dist/connection/storage/ConnectedWorkspaceTrash.js.map +2 -2
- package/dist/embed/index.cjs +12 -12
- package/dist/facts/index.cjs +43 -43
- package/dist/files/FilesPage.d.ts +4 -1
- package/dist/files/FilesPage.js +1 -1
- package/dist/files/FilesPage.js.map +2 -2
- package/dist/files/SelectionBar.js +1 -1
- package/dist/files/SelectionBar.js.map +2 -2
- package/dist/files/index.cjs +229 -229
- package/dist/index.cjs +220 -220
- package/dist/pages/index.cjs +53 -28
- package/dist/pages/index.cjs.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/workflow-canvas/index.cjs +23 -23
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
- package/src/blocks.css +18 -0
- package/dist/chunk-JCFXS336.cjs.map +0 -1
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
useId,
|
|
5
|
+
useLayoutEffect,
|
|
6
|
+
useMemo,
|
|
7
|
+
useRef,
|
|
8
|
+
useState
|
|
9
|
+
} from "react";
|
|
4
10
|
import { Move } from "lucide-react";
|
|
5
11
|
import { Button, cn } from "@arbidocs/react/ui";
|
|
6
12
|
import { GestureHandle, usePointerGesture } from "../../components/gestures/index.js";
|
|
@@ -43,10 +49,31 @@ function pitchOf(grid) {
|
|
|
43
49
|
row: px(PAGE_ROW_HEIGHT) * rem + px(style.rowGap)
|
|
44
50
|
};
|
|
45
51
|
}
|
|
46
|
-
function pressesHeader(
|
|
52
|
+
function pressesHeader(event, header) {
|
|
53
|
+
const target = event.target;
|
|
47
54
|
if (!(target instanceof Element)) return false;
|
|
48
55
|
if (target.closest("[data-page-move]")) return true;
|
|
49
|
-
|
|
56
|
+
if (target.closest(NO_DRAG)) return false;
|
|
57
|
+
if (target.closest("[data-page-header]")) return true;
|
|
58
|
+
if (!header) return false;
|
|
59
|
+
const band = header.getBoundingClientRect();
|
|
60
|
+
return event.clientY >= band.top && event.clientY < band.bottom;
|
|
61
|
+
}
|
|
62
|
+
function useHeaderEnd(cell, controls) {
|
|
63
|
+
useLayoutEffect(() => {
|
|
64
|
+
const el = cell.current;
|
|
65
|
+
const box = controls.current;
|
|
66
|
+
if (!el || !box) return;
|
|
67
|
+
const measure = () => {
|
|
68
|
+
const width = box.offsetWidth;
|
|
69
|
+
el.style.setProperty("--page-header-end", width ? `${width}px` : "0px");
|
|
70
|
+
};
|
|
71
|
+
measure();
|
|
72
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
73
|
+
const observer = new ResizeObserver(measure);
|
|
74
|
+
observer.observe(box);
|
|
75
|
+
return () => observer.disconnect();
|
|
76
|
+
}, [cell, controls]);
|
|
50
77
|
}
|
|
51
78
|
const keyOf = (blocks) => blocks.map((b) => `${b.id}:${b.layout.x},${b.layout.y},${b.layout.w},${b.layout.h}`).join("|");
|
|
52
79
|
const ARROWS = {
|
|
@@ -70,13 +97,16 @@ function EditableCell({
|
|
|
70
97
|
testId
|
|
71
98
|
}) {
|
|
72
99
|
const element = useRef(null);
|
|
100
|
+
const header = useRef(null);
|
|
101
|
+
const controls = useRef(null);
|
|
102
|
+
useHeaderEnd(element, controls);
|
|
73
103
|
const dropped = useRef(false);
|
|
74
104
|
const escape = useRef(null);
|
|
75
105
|
const gesture = usePointerGesture({
|
|
76
106
|
element,
|
|
77
107
|
threshold: 4,
|
|
78
108
|
begin: (kind, event) => {
|
|
79
|
-
if (kind === "move" && !pressesHeader(event.
|
|
109
|
+
if (kind === "move" && !pressesHeader(event, header.current)) return null;
|
|
80
110
|
const { col, row } = pitchOf(grid());
|
|
81
111
|
if (!col || !row) return null;
|
|
82
112
|
return { base: blocks, start: block.layout, col, row, shown: keyOf(blocks) };
|
|
@@ -156,6 +186,10 @@ function EditableCell({
|
|
|
156
186
|
),
|
|
157
187
|
"data-dragging": dragged || void 0,
|
|
158
188
|
...gesture.handlers,
|
|
189
|
+
onPointerDown: (event) => {
|
|
190
|
+
dropped.current = false;
|
|
191
|
+
gesture.start(event, "move", { lazy: true });
|
|
192
|
+
},
|
|
159
193
|
onClickCapture: (event) => {
|
|
160
194
|
if (!dropped.current) return;
|
|
161
195
|
dropped.current = false;
|
|
@@ -165,20 +199,17 @@ function EditableCell({
|
|
|
165
199
|
testId: `${testId}-cell-${block.id}`,
|
|
166
200
|
children: [
|
|
167
201
|
renderBlock(block),
|
|
168
|
-
/* @__PURE__ */
|
|
202
|
+
/* @__PURE__ */ jsx(
|
|
169
203
|
"div",
|
|
170
204
|
{
|
|
205
|
+
ref: header,
|
|
171
206
|
className: cn(
|
|
172
|
-
"absolute inset-x-0 top-0 z-10 flex h-10 items-center justify-end
|
|
173
|
-
dragged
|
|
207
|
+
"pointer-events-none absolute inset-x-0 top-0 z-10 flex h-10 items-center justify-end rounded-t-xl px-2",
|
|
208
|
+
dragged && "cursor-grabbing"
|
|
174
209
|
),
|
|
175
210
|
"data-page-header": true,
|
|
176
|
-
onPointerDown: (event) => {
|
|
177
|
-
dropped.current = false;
|
|
178
|
-
gesture.start(event, "move", { lazy: true });
|
|
179
|
-
},
|
|
180
211
|
"data-testid": `${testId}-header-${block.id}`,
|
|
181
|
-
children: [
|
|
212
|
+
children: /* @__PURE__ */ jsxs("div", { ref: controls, className: "pointer-events-auto flex items-center gap-1 md:touch-none", children: [
|
|
182
213
|
actionsOf?.(block),
|
|
183
214
|
/* @__PURE__ */ jsx(
|
|
184
215
|
Button,
|
|
@@ -198,7 +229,7 @@ function EditableCell({
|
|
|
198
229
|
children: /* @__PURE__ */ jsx(Move, { className: "size-3.5" })
|
|
199
230
|
}
|
|
200
231
|
)
|
|
201
|
-
]
|
|
232
|
+
] })
|
|
202
233
|
}
|
|
203
234
|
),
|
|
204
235
|
RESIZE_HANDLES.map(({ kind, left, top, cursor }) => /* @__PURE__ */ jsx(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/connection/pages/EditablePageGrid.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * `EditablePageGrid`: a page's blocks on its grid for someone who may arrange them, in the page\n * as it is read (no edit mode). The page is 4 slots wide; a block is 1 to 4 slots each way\n * (`grid-layout`). A block is moved by dragging its header row (the top of the tile, where its\n * title is) or the move icon there, and resized from its right side, bottom or corner; it snaps\n * into slot cells (shown while it is dragged), and the blocks it lands on make way (pushed out of\n * its way, everything floated up so no gaps are left). Its content never starts a drag: clicks,\n * scrolling and selecting text inside work as ever. A layout saved before slots is shown in the\n * nearest slots, and saved so on the next change.\n *\n * The move icon and the resize handles show while the block is under the pointer or focused. The\n * move icon takes the keyboard: the arrows move the block a slot, Shift and the arrows resize it,\n * Escape drops a drag. On a phone the blocks stack, as they read, and are not dragged.\n *\n * The gestures are the presentation stage's (`usePointerGesture`): the dragged block follows the\n * pointer by a GPU transform once per animation frame, and only a step into another slot re-lays\n * the grid. The layout is handed on once, on drop.\n */\nimport { useId, useMemo, useRef, useState, type KeyboardEvent, type ReactNode } from 'react'\nimport { Move } from 'lucide-react'\nimport type { BlockLayout, PageBlock } from '@arbidocs/react'\nimport { Button, cn } from '@arbidocs/react/ui'\nimport { GestureHandle, usePointerGesture } from '../../components/gestures'\nimport {\n SLOT_COLUMNS,\n SLOT_ROWS,\n SLOTS_ACROSS,\n moveBlock,\n normalizeLayout,\n resizeBlock,\n stepMove,\n stepSize,\n} from './grid-layout'\nimport { PAGE_ROW_HEIGHT, PageCell, PageGrid, inReadingOrder } from './PageGrid'\n\nexport interface EditablePageGridLabels {\n /** The move icon's tooltip. */\n move: string\n /** How the move icon is used from the keyboard (for assistive technology). */\n arrange: string\n resize: string\n}\n\nexport const DEFAULT_EDITABLE_PAGE_GRID_LABELS: EditablePageGridLabels = {\n move: 'Drag to move',\n arrange: 'Arrow keys move the block a slot; Shift and the arrow keys resize it.',\n resize: 'Drag to resize',\n}\n\nexport interface EditablePageGridProps {\n blocks: readonly PageBlock[]\n /** The blocks laid out again (a drop, a resize, a key), in slots. */\n onChange: (blocks: PageBlock[]) => void\n renderBlock: (block: PageBlock) => ReactNode\n /** Buttons for a block, in its header beside the move icon (edit, remove). */\n actionsOf?: (block: PageBlock) => ReactNode\n labels?: Partial<EditablePageGridLabels>\n testId?: string\n}\n\n/** What a press on a block's header never drags from: controls, and anything `data-no-drag`. */\nexport const NO_DRAG =\n 'input, textarea, select, button, a[href], label, [contenteditable=\"true\"], [contenteditable=\"\"], [role=\"button\"], [role=\"slider\"], [role=\"scrollbar\"], [data-no-drag]'\n\ntype Kind = 'move' | 'e' | 's' | 'se'\n\ninterface Gesture {\n base: readonly PageBlock[]\n start: BlockLayout\n /** One column and one row, in pixels, gap included. */\n col: number\n row: number\n /** The last snapped layout shown (a new one re-lays the grid). */\n shown: string\n}\n\n/** While a block is dragged: the layout it would drop into (the others are drawn there). */\ninterface Preview {\n id: string\n /** Moved (it follows the pointer), not resized (it takes each size as it snaps). */\n moving: boolean\n blocks: PageBlock[]\n}\n\ninterface Next {\n blocks: PageBlock[]\n key: string\n dx: number\n dy: number\n}\n\nconst RESIZE_HANDLES: { kind: Exclude<Kind, 'move'>; left: string; top: string; cursor: string }[] =\n [\n { kind: 'e', left: '100%', top: '50%', cursor: 'ew-resize' },\n { kind: 's', left: '50%', top: '100%', cursor: 'ns-resize' },\n { kind: 'se', left: '100%', top: '100%', cursor: 'nwse-resize' },\n ]\n\n/** Hover affordances: on the block under the pointer or focused, always on a touch screen. */\nconst ON_HOVER =\n 'z-10 hidden opacity-0 transition-opacity group-hover/cell:opacity-100 group-focus-within/cell:opacity-100 md:flex'\n\nconst px = (value: string) => {\n const n = parseFloat(value)\n return Number.isFinite(n) ? n : 0\n}\n\n/** The grid's column and row pitch on screen (0 when it is not laid out in 12 columns). */\nfunction pitchOf(grid: HTMLElement | null): { col: number; row: number } {\n if (!grid) return { col: 0, row: 0 }\n const view = grid.ownerDocument.defaultView ?? window\n const style = view.getComputedStyle(grid)\n // Stacked in one column (a phone): blocks are not dragged there.\n const tracks = style.gridTemplateColumns.trim()\n if (tracks && tracks !== 'none' && tracks.split(/\\s+/).length < 12) return { col: 0, row: 0 }\n const rem = px(view.getComputedStyle(grid.ownerDocument.documentElement).fontSize) || 16\n return {\n col: (grid.getBoundingClientRect().width + px(style.columnGap)) / 12,\n row: px(PAGE_ROW_HEIGHT) * rem + px(style.rowGap),\n }\n}\n\n/** A press that drags: on the header row or the move icon, not on a control in the header. */\nfunction pressesHeader(target: EventTarget | null) {\n if (!(target instanceof Element)) return false\n if (target.closest('[data-page-move]')) return true\n return !!target.closest('[data-page-header]') && !target.closest(NO_DRAG)\n}\n\nconst keyOf = (blocks: readonly PageBlock[]) =>\n blocks.map((b) => `${b.id}:${b.layout.x},${b.layout.y},${b.layout.w},${b.layout.h}`).join('|')\n\nconst ARROWS: Record<string, [-1 | 0 | 1, -1 | 0 | 1]> = {\n ArrowLeft: [-1, 0],\n ArrowRight: [1, 0],\n ArrowUp: [0, -1],\n ArrowDown: [0, 1],\n}\n\nfunction EditableCell({\n block,\n layout,\n grid,\n blocks,\n dragged,\n onPreview,\n onCommit,\n renderBlock,\n actionsOf,\n l,\n hintId,\n testId,\n}: {\n actionsOf: EditablePageGridProps['actionsOf']\n hintId: string\n block: PageBlock\n /** Where it is drawn (the preview's place while another block is dragged). */\n layout: BlockLayout\n grid: () => HTMLElement | null\n blocks: readonly PageBlock[]\n dragged: boolean\n onPreview: (preview: Preview | null) => void\n onCommit: (blocks: PageBlock[]) => void\n renderBlock: EditablePageGridProps['renderBlock']\n l: EditablePageGridLabels\n testId: string\n}) {\n const element = useRef<HTMLDivElement>(null)\n // A drag just ended: the click the browser sends after it is not a click on what is inside.\n const dropped = useRef(false)\n const escape = useRef<((event: globalThis.KeyboardEvent) => void) | null>(null)\n const gesture = usePointerGesture<Kind, Gesture, Next>({\n element,\n threshold: 4,\n begin: (kind, event) => {\n if (kind === 'move' && !pressesHeader(event.target)) return null\n const { col, row } = pitchOf(grid())\n if (!col || !row) return null\n return { base: blocks, start: block.layout, col, row, shown: keyOf(blocks) }\n },\n dragStart: () => {\n if (element.current) element.current.style.willChange = 'transform'\n const doc = element.current?.ownerDocument ?? document\n escape.current = (event) => {\n if (event.key === 'Escape') gesture.cancel()\n }\n doc.addEventListener('keydown', escape.current)\n },\n update: (g, kind, { dx, dy }) => {\n const cols = dx / g.col\n const rows = dy / g.row\n const next =\n kind === 'move'\n ? moveBlock(g.base, block.id, { x: g.start.x + cols, y: g.start.y + rows }, false)\n : resizeBlock(\n g.base,\n block.id,\n {\n w: g.start.w + (kind === 's' ? 0 : cols),\n h: g.start.h + (kind === 'e' ? 0 : rows),\n },\n false\n )\n return { blocks: next, key: keyOf(next), dx, dy }\n },\n apply: (g, next, kind) => {\n if (kind === 'move' && element.current) {\n element.current.style.transform = `translate3d(${next.dx}px, ${next.dy}px, 0)`\n }\n if (next.key !== g.shown) {\n g.shown = next.key\n onPreview({ id: block.id, moving: kind === 'move', blocks: next.blocks })\n }\n },\n end: (g, next, kind) => {\n const el = element.current\n if (el) {\n el.style.transform = ''\n el.style.willChange = ''\n }\n if (escape.current) {\n ;(el?.ownerDocument ?? document).removeEventListener('keydown', escape.current)\n escape.current = null\n }\n onPreview(null)\n if (!next) return\n dropped.current = true\n const to = next.blocks.find((b) => b.id === block.id)?.layout ?? block.layout\n const settled =\n kind === 'move' ? moveBlock(g.base, block.id, to) : resizeBlock(g.base, block.id, to)\n if (keyOf(settled) !== keyOf(g.base)) onCommit(settled)\n },\n })\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape' && gesture.active()) {\n gesture.cancel()\n return\n }\n const arrow = ARROWS[event.key]\n if (!arrow) return\n event.preventDefault()\n const [dx, dy] = arrow\n const next = event.shiftKey\n ? stepSize(blocks, block.id, dx, dy)\n : stepMove(blocks, block.id, dx, dy)\n if (keyOf(next) !== keyOf(blocks)) onCommit(next)\n }\n\n return (\n <PageCell\n layout={layout}\n cellRef={element}\n // A tap on a touch screen focuses it: its move icon and handles show.\n tabIndex={-1}\n className={cn(\n 'group/cell relative rounded-xl outline-none',\n // Lifted while dragged: above the others, a strong outline, a shadow.\n dragged && 'z-20 scale-[1.02] select-none shadow-xl ring-2 ring-primary'\n )}\n data-dragging={dragged || undefined}\n {...gesture.handlers}\n onClickCapture={(event) => {\n if (!dropped.current) return\n dropped.current = false\n event.preventDefault()\n event.stopPropagation()\n }}\n testId={`${testId}-cell-${block.id}`}\n >\n {renderBlock(block)}\n {/* The header row: over the block's own (its title shows through), the drag area. */}\n <div\n className={cn(\n 'absolute inset-x-0 top-0 z-10 flex h-10 items-center justify-end gap-1 rounded-t-xl px-2 md:touch-none',\n dragged ? 'cursor-grabbing' : 'md:cursor-grab'\n )}\n data-page-header\n onPointerDown={(event) => {\n dropped.current = false\n gesture.start(event, 'move', { lazy: true })\n }}\n data-testid={`${testId}-header-${block.id}`}\n >\n {actionsOf?.(block)}\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className={cn(\n 'hidden size-7 opacity-0 transition-opacity focus-visible:opacity-100 group-hover/cell:opacity-100 group-focus-within/cell:opacity-100 md:inline-flex',\n dragged ? 'cursor-grabbing opacity-100' : 'cursor-grab'\n )}\n aria-label={l.move}\n aria-describedby={hintId}\n title={l.move}\n data-page-move\n onKeyDown={onKeyDown}\n data-testid={`${testId}-move-${block.id}`}\n >\n <Move className=\"size-3.5\" />\n </Button>\n </div>\n {RESIZE_HANDLES.map(({ kind, left, top, cursor }) => (\n <GestureHandle\n key={kind}\n left={left}\n top={top}\n cursor={cursor}\n size=\"sm\"\n bar={kind === 'e' ? 'v' : kind === 's' ? 'h' : undefined}\n className={ON_HOVER}\n onPointerDown={(event) => gesture.start(event, kind)}\n aria-label={l.resize}\n title={l.resize}\n testId={`${testId}-resize-${kind}-${block.id}`}\n />\n ))}\n </PageCell>\n )\n}\n\nexport function EditablePageGrid({\n blocks: saved,\n onChange,\n renderBlock,\n actionsOf,\n labels,\n testId = 'page',\n}: EditablePageGridProps) {\n const l = { ...DEFAULT_EDITABLE_PAGE_GRID_LABELS, ...labels }\n const grid = useRef<HTMLDivElement>(null)\n const hintId = useId()\n // In slots (a layout saved before them, in the nearest ones; saved so on the next change).\n const blocks = useMemo(() => normalizeLayout(saved), [saved])\n const [preview, setPreview] = useState<Preview | null>(null)\n const placeOf = (block: PageBlock) =>\n preview?.blocks.find((b) => b.id === block.id)?.layout ?? block.layout\n const target = preview?.blocks.find((b) => b.id === preview.id)\n\n // While dragging: the slot cells, down to a slot row past the lowest block.\n const slotRows = preview\n ? Math.max(...preview.blocks.map((b) => b.layout.y + b.layout.h)) / SLOT_ROWS + 1\n : 0\n const cells = Array.from({ length: slotRows * SLOTS_ACROSS }, (_, i) => ({\n x: (i % SLOTS_ACROSS) * SLOT_COLUMNS,\n y: Math.floor(i / SLOTS_ACROSS) * SLOT_ROWS,\n w: SLOT_COLUMNS,\n h: SLOT_ROWS,\n }))\n\n return (\n <PageGrid testId={`${testId}-grid`} gridRef={grid}>\n <p id={hintId} className=\"sr-only\">\n {l.arrange}\n </p>\n {cells.map((cell) => (\n <PageCell\n key={`${cell.x}-${cell.y}`}\n layout={cell}\n className=\"pointer-events-none hidden rounded-xl border border-dashed border-border bg-muted/20 md:block\"\n aria-hidden\n testId={`${testId}-slot`}\n />\n ))}\n {/* Where the dragged block lands. */}\n {target && (\n <PageCell\n layout={target.layout}\n className=\"pointer-events-none hidden rounded-xl border-2 border-primary/50 bg-primary/10 md:block\"\n aria-hidden\n testId={`${testId}-drop-target`}\n />\n )}\n {/* In reading order: how they stack on a phone. */}\n {inReadingOrder(blocks).map((block) => {\n const isDragged = preview?.id === block.id\n return (\n <EditableCell\n key={block.id}\n block={block}\n // A block being moved stays in its cell and follows the pointer; one resized takes its\n // new size as it snaps.\n layout={isDragged && preview.moving ? block.layout : placeOf(block)}\n grid={() => grid.current}\n blocks={blocks}\n dragged={isDragged}\n onPreview={setPreview}\n onCommit={onChange}\n renderBlock={renderBlock}\n actionsOf={actionsOf}\n l={l}\n hintId={hintId}\n testId={testId}\n />\n )\n })}\n </PageGrid>\n )\n}\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["/**\n * `EditablePageGrid`: a page's blocks on its grid for someone who may arrange them, in the page\n * as it is read (no edit mode). The page is 4 slots wide; a block is 1 to 4 slots each way\n * (`grid-layout`). A block is moved by dragging its header row (the top of the tile, where its\n * title is) or the move icon there, and resized from its right side, bottom or corner; it snaps\n * into slot cells (shown while it is dragged), and the blocks it lands on make way (pushed out of\n * its way, everything floated up so no gaps are left). Its content never starts a drag: clicks,\n * scrolling and selecting text inside work as ever. A layout saved before slots is shown in the\n * nearest slots, and saved so on the next change.\n *\n * The move icon and the resize handles show while the block is under the pointer or focused. The\n * move icon takes the keyboard: the arrows move the block a slot, Shift and the arrows resize it,\n * Escape drops a drag. On a phone the blocks stack, as they read, and are not dragged.\n *\n * The gestures are the presentation stage's (`usePointerGesture`): the dragged block follows the\n * pointer by a GPU transform once per animation frame, and only a step into another slot re-lays\n * the grid. The layout is handed on once, on drop.\n */\nimport {\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type KeyboardEvent,\n type PointerEvent as ReactPointerEvent,\n type ReactNode,\n type RefObject,\n} from 'react'\nimport { Move } from 'lucide-react'\nimport type { BlockLayout, PageBlock } from '@arbidocs/react'\nimport { Button, cn } from '@arbidocs/react/ui'\nimport { GestureHandle, usePointerGesture } from '../../components/gestures'\nimport {\n SLOT_COLUMNS,\n SLOT_ROWS,\n SLOTS_ACROSS,\n moveBlock,\n normalizeLayout,\n resizeBlock,\n stepMove,\n stepSize,\n} from './grid-layout'\nimport { PAGE_ROW_HEIGHT, PageCell, PageGrid, inReadingOrder } from './PageGrid'\n\nexport interface EditablePageGridLabels {\n /** The move icon's tooltip. */\n move: string\n /** How the move icon is used from the keyboard (for assistive technology). */\n arrange: string\n resize: string\n}\n\nexport const DEFAULT_EDITABLE_PAGE_GRID_LABELS: EditablePageGridLabels = {\n move: 'Drag to move',\n arrange: 'Arrow keys move the block a slot; Shift and the arrow keys resize it.',\n resize: 'Drag to resize',\n}\n\nexport interface EditablePageGridProps {\n blocks: readonly PageBlock[]\n /** The blocks laid out again (a drop, a resize, a key), in slots. */\n onChange: (blocks: PageBlock[]) => void\n renderBlock: (block: PageBlock) => ReactNode\n /** Buttons for a block, in its header beside the move icon (edit, remove). */\n actionsOf?: (block: PageBlock) => ReactNode\n labels?: Partial<EditablePageGridLabels>\n testId?: string\n}\n\n/** What a press on a block's header never drags from: controls, and anything `data-no-drag`. */\nexport const NO_DRAG =\n 'input, textarea, select, button, a[href], label, [contenteditable=\"true\"], [contenteditable=\"\"], [role=\"button\"], [role=\"slider\"], [role=\"scrollbar\"], [data-no-drag]'\n\ntype Kind = 'move' | 'e' | 's' | 'se'\n\ninterface Gesture {\n base: readonly PageBlock[]\n start: BlockLayout\n /** One column and one row, in pixels, gap included. */\n col: number\n row: number\n /** The last snapped layout shown (a new one re-lays the grid). */\n shown: string\n}\n\n/** While a block is dragged: the layout it would drop into (the others are drawn there). */\ninterface Preview {\n id: string\n /** Moved (it follows the pointer), not resized (it takes each size as it snaps). */\n moving: boolean\n blocks: PageBlock[]\n}\n\ninterface Next {\n blocks: PageBlock[]\n key: string\n dx: number\n dy: number\n}\n\nconst RESIZE_HANDLES: { kind: Exclude<Kind, 'move'>; left: string; top: string; cursor: string }[] =\n [\n { kind: 'e', left: '100%', top: '50%', cursor: 'ew-resize' },\n { kind: 's', left: '50%', top: '100%', cursor: 'ns-resize' },\n { kind: 'se', left: '100%', top: '100%', cursor: 'nwse-resize' },\n ]\n\n/** Hover affordances: on the block under the pointer or focused, always on a touch screen. */\nconst ON_HOVER =\n 'z-10 hidden opacity-0 transition-opacity group-hover/cell:opacity-100 group-focus-within/cell:opacity-100 md:flex'\n\nconst px = (value: string) => {\n const n = parseFloat(value)\n return Number.isFinite(n) ? n : 0\n}\n\n/** The grid's column and row pitch on screen (0 when it is not laid out in 12 columns). */\nfunction pitchOf(grid: HTMLElement | null): { col: number; row: number } {\n if (!grid) return { col: 0, row: 0 }\n const view = grid.ownerDocument.defaultView ?? window\n const style = view.getComputedStyle(grid)\n // Stacked in one column (a phone): blocks are not dragged there.\n const tracks = style.gridTemplateColumns.trim()\n if (tracks && tracks !== 'none' && tracks.split(/\\s+/).length < 12) return { col: 0, row: 0 }\n const rem = px(view.getComputedStyle(grid.ownerDocument.documentElement).fontSize) || 16\n return {\n col: (grid.getBoundingClientRect().width + px(style.columnGap)) / 12,\n row: px(PAGE_ROW_HEIGHT) * rem + px(style.rowGap),\n }\n}\n\n/**\n * A press that drags: the move icon, or anywhere in the header row but a control. The row lets\n * presses through to the block's own title row (its buttons work), so it is judged by where the\n * press lands, not by what it lands on.\n */\nfunction pressesHeader(event: ReactPointerEvent, header: HTMLElement | null) {\n const target = event.target\n if (!(target instanceof Element)) return false\n if (target.closest('[data-page-move]')) return true\n if (target.closest(NO_DRAG)) return false\n if (target.closest('[data-page-header]')) return true\n if (!header) return false\n const band = header.getBoundingClientRect()\n return event.clientY >= band.top && event.clientY < band.bottom\n}\n\n/**\n * The width the header's own controls (the block's actions, the move icon) take at the cell's end,\n * as `--page-header-end` on the cell: a block keeps its own title-row controls clear of it.\n */\nfunction useHeaderEnd(\n cell: RefObject<HTMLElement | null>,\n controls: RefObject<HTMLElement | null>\n) {\n useLayoutEffect(() => {\n const el = cell.current\n const box = controls.current\n if (!el || !box) return\n const measure = () => {\n const width = box.offsetWidth\n el.style.setProperty('--page-header-end', width ? `${width}px` : '0px')\n }\n measure()\n if (typeof ResizeObserver === 'undefined') return\n const observer = new ResizeObserver(measure)\n observer.observe(box)\n return () => observer.disconnect()\n }, [cell, controls])\n}\n\nconst keyOf = (blocks: readonly PageBlock[]) =>\n blocks.map((b) => `${b.id}:${b.layout.x},${b.layout.y},${b.layout.w},${b.layout.h}`).join('|')\n\nconst ARROWS: Record<string, [-1 | 0 | 1, -1 | 0 | 1]> = {\n ArrowLeft: [-1, 0],\n ArrowRight: [1, 0],\n ArrowUp: [0, -1],\n ArrowDown: [0, 1],\n}\n\nfunction EditableCell({\n block,\n layout,\n grid,\n blocks,\n dragged,\n onPreview,\n onCommit,\n renderBlock,\n actionsOf,\n l,\n hintId,\n testId,\n}: {\n actionsOf: EditablePageGridProps['actionsOf']\n hintId: string\n block: PageBlock\n /** Where it is drawn (the preview's place while another block is dragged). */\n layout: BlockLayout\n grid: () => HTMLElement | null\n blocks: readonly PageBlock[]\n dragged: boolean\n onPreview: (preview: Preview | null) => void\n onCommit: (blocks: PageBlock[]) => void\n renderBlock: EditablePageGridProps['renderBlock']\n l: EditablePageGridLabels\n testId: string\n}) {\n const element = useRef<HTMLDivElement>(null)\n const header = useRef<HTMLDivElement>(null)\n const controls = useRef<HTMLDivElement>(null)\n useHeaderEnd(element, controls)\n // A drag just ended: the click the browser sends after it is not a click on what is inside.\n const dropped = useRef(false)\n const escape = useRef<((event: globalThis.KeyboardEvent) => void) | null>(null)\n const gesture = usePointerGesture<Kind, Gesture, Next>({\n element,\n threshold: 4,\n begin: (kind, event) => {\n if (kind === 'move' && !pressesHeader(event, header.current)) return null\n const { col, row } = pitchOf(grid())\n if (!col || !row) return null\n return { base: blocks, start: block.layout, col, row, shown: keyOf(blocks) }\n },\n dragStart: () => {\n if (element.current) element.current.style.willChange = 'transform'\n const doc = element.current?.ownerDocument ?? document\n escape.current = (event) => {\n if (event.key === 'Escape') gesture.cancel()\n }\n doc.addEventListener('keydown', escape.current)\n },\n update: (g, kind, { dx, dy }) => {\n const cols = dx / g.col\n const rows = dy / g.row\n const next =\n kind === 'move'\n ? moveBlock(g.base, block.id, { x: g.start.x + cols, y: g.start.y + rows }, false)\n : resizeBlock(\n g.base,\n block.id,\n {\n w: g.start.w + (kind === 's' ? 0 : cols),\n h: g.start.h + (kind === 'e' ? 0 : rows),\n },\n false\n )\n return { blocks: next, key: keyOf(next), dx, dy }\n },\n apply: (g, next, kind) => {\n if (kind === 'move' && element.current) {\n element.current.style.transform = `translate3d(${next.dx}px, ${next.dy}px, 0)`\n }\n if (next.key !== g.shown) {\n g.shown = next.key\n onPreview({ id: block.id, moving: kind === 'move', blocks: next.blocks })\n }\n },\n end: (g, next, kind) => {\n const el = element.current\n if (el) {\n el.style.transform = ''\n el.style.willChange = ''\n }\n if (escape.current) {\n ;(el?.ownerDocument ?? document).removeEventListener('keydown', escape.current)\n escape.current = null\n }\n onPreview(null)\n if (!next) return\n dropped.current = true\n const to = next.blocks.find((b) => b.id === block.id)?.layout ?? block.layout\n const settled =\n kind === 'move' ? moveBlock(g.base, block.id, to) : resizeBlock(g.base, block.id, to)\n if (keyOf(settled) !== keyOf(g.base)) onCommit(settled)\n },\n })\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape' && gesture.active()) {\n gesture.cancel()\n return\n }\n const arrow = ARROWS[event.key]\n if (!arrow) return\n event.preventDefault()\n const [dx, dy] = arrow\n const next = event.shiftKey\n ? stepSize(blocks, block.id, dx, dy)\n : stepMove(blocks, block.id, dx, dy)\n if (keyOf(next) !== keyOf(blocks)) onCommit(next)\n }\n\n return (\n <PageCell\n layout={layout}\n cellRef={element}\n // A tap on a touch screen focuses it: its move icon and handles show.\n tabIndex={-1}\n className={cn(\n 'group/cell relative rounded-xl outline-none',\n // Lifted while dragged: above the others, a strong outline, a shadow.\n dragged && 'z-20 scale-[1.02] select-none shadow-xl ring-2 ring-primary'\n )}\n data-dragging={dragged || undefined}\n {...gesture.handlers}\n // A move starts from a press in the header row (see pressesHeader); handles start their own.\n onPointerDown={(event) => {\n dropped.current = false\n gesture.start(event, 'move', { lazy: true })\n }}\n onClickCapture={(event) => {\n if (!dropped.current) return\n dropped.current = false\n event.preventDefault()\n event.stopPropagation()\n }}\n testId={`${testId}-cell-${block.id}`}\n >\n {renderBlock(block)}\n {/* The header row: over the block's own title row, the drag area. Presses pass through it to\n the block's own controls (a gallery's previous / next); only its own controls take them. */}\n <div\n ref={header}\n className={cn(\n 'pointer-events-none absolute inset-x-0 top-0 z-10 flex h-10 items-center justify-end rounded-t-xl px-2',\n dragged && 'cursor-grabbing'\n )}\n data-page-header\n data-testid={`${testId}-header-${block.id}`}\n >\n <div ref={controls} className=\"pointer-events-auto flex items-center gap-1 md:touch-none\">\n {actionsOf?.(block)}\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className={cn(\n 'hidden size-7 opacity-0 transition-opacity focus-visible:opacity-100 group-hover/cell:opacity-100 group-focus-within/cell:opacity-100 md:inline-flex',\n dragged ? 'cursor-grabbing opacity-100' : 'cursor-grab'\n )}\n aria-label={l.move}\n aria-describedby={hintId}\n title={l.move}\n data-page-move\n onKeyDown={onKeyDown}\n data-testid={`${testId}-move-${block.id}`}\n >\n <Move className=\"size-3.5\" />\n </Button>\n </div>\n </div>\n {RESIZE_HANDLES.map(({ kind, left, top, cursor }) => (\n <GestureHandle\n key={kind}\n left={left}\n top={top}\n cursor={cursor}\n size=\"sm\"\n bar={kind === 'e' ? 'v' : kind === 's' ? 'h' : undefined}\n className={ON_HOVER}\n onPointerDown={(event) => gesture.start(event, kind)}\n aria-label={l.resize}\n title={l.resize}\n testId={`${testId}-resize-${kind}-${block.id}`}\n />\n ))}\n </PageCell>\n )\n}\n\nexport function EditablePageGrid({\n blocks: saved,\n onChange,\n renderBlock,\n actionsOf,\n labels,\n testId = 'page',\n}: EditablePageGridProps) {\n const l = { ...DEFAULT_EDITABLE_PAGE_GRID_LABELS, ...labels }\n const grid = useRef<HTMLDivElement>(null)\n const hintId = useId()\n // In slots (a layout saved before them, in the nearest ones; saved so on the next change).\n const blocks = useMemo(() => normalizeLayout(saved), [saved])\n const [preview, setPreview] = useState<Preview | null>(null)\n const placeOf = (block: PageBlock) =>\n preview?.blocks.find((b) => b.id === block.id)?.layout ?? block.layout\n const target = preview?.blocks.find((b) => b.id === preview.id)\n\n // While dragging: the slot cells, down to a slot row past the lowest block.\n const slotRows = preview\n ? Math.max(...preview.blocks.map((b) => b.layout.y + b.layout.h)) / SLOT_ROWS + 1\n : 0\n const cells = Array.from({ length: slotRows * SLOTS_ACROSS }, (_, i) => ({\n x: (i % SLOTS_ACROSS) * SLOT_COLUMNS,\n y: Math.floor(i / SLOTS_ACROSS) * SLOT_ROWS,\n w: SLOT_COLUMNS,\n h: SLOT_ROWS,\n }))\n\n return (\n <PageGrid testId={`${testId}-grid`} gridRef={grid}>\n <p id={hintId} className=\"sr-only\">\n {l.arrange}\n </p>\n {cells.map((cell) => (\n <PageCell\n key={`${cell.x}-${cell.y}`}\n layout={cell}\n className=\"pointer-events-none hidden rounded-xl border border-dashed border-border bg-muted/20 md:block\"\n aria-hidden\n testId={`${testId}-slot`}\n />\n ))}\n {/* Where the dragged block lands. */}\n {target && (\n <PageCell\n layout={target.layout}\n className=\"pointer-events-none hidden rounded-xl border-2 border-primary/50 bg-primary/10 md:block\"\n aria-hidden\n testId={`${testId}-drop-target`}\n />\n )}\n {/* In reading order: how they stack on a phone. */}\n {inReadingOrder(blocks).map((block) => {\n const isDragged = preview?.id === block.id\n return (\n <EditableCell\n key={block.id}\n block={block}\n // A block being moved stays in its cell and follows the pointer; one resized takes its\n // new size as it snaps.\n layout={isDragged && preview.moving ? block.layout : placeOf(block)}\n grid={() => grid.current}\n blocks={blocks}\n dragged={isDragged}\n onPreview={setPreview}\n onCommit={onChange}\n renderBlock={renderBlock}\n actionsOf={actionsOf}\n l={l}\n hintId={hintId}\n testId={testId}\n />\n )\n })}\n </PageGrid>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AA6UQ,SAgBI,KAhBJ;AA3TR;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AACP,SAAS,YAAY;AAErB,SAAS,QAAQ,UAAU;AAC3B,SAAS,eAAe,yBAAyB;AACjD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB,UAAU,UAAU,sBAAsB;AAU7D,MAAM,oCAA4D;AAAA,EACvE,MAAM;AAAA,EACN,SAAS;AAAA,EACT,QAAQ;AACV;AAcO,MAAM,UACX;AA6BF,MAAM,iBACJ;AAAA,EACE,EAAE,MAAM,KAAK,MAAM,QAAQ,KAAK,OAAO,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,IACC,MAAM,IAAI,CAAC,SACV;AAAA,MAAC;AAAA;AAAA,QAEC,QAAQ;AAAA,QACR,WAAU;AAAA,QACV,eAAW;AAAA,QACX,QAAQ,GAAG,MAAM;AAAA;AAAA,MAJZ,GAAG,KAAK,CAAC,IAAI,KAAK,CAAC;AAAA,IAK1B,CACD;AAAA,IAEA,UACC;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ,OAAO;AAAA,QACf,WAAU;AAAA,QACV,eAAW;AAAA,QACX,QAAQ,GAAG,MAAM;AAAA;AAAA,IACnB;AAAA,IAGD,eAAe,MAAM,EAAE,IAAI,CAAC,UAAU;AACrC,YAAM,YAAY,SAAS,OAAO,MAAM;AACxC,aACE;AAAA,QAAC;AAAA;AAAA,UAEC;AAAA,UAGA,QAAQ,aAAa,QAAQ,SAAS,MAAM,SAAS,QAAQ,KAAK;AAAA,UAClE,MAAM,MAAM,KAAK;AAAA,UACjB;AAAA,UACA,SAAS;AAAA,UACT,WAAW;AAAA,UACX,UAAU;AAAA,UACV;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA;AAAA,QAdK,MAAM;AAAA,MAeb;AAAA,IAEJ,CAAC;AAAA,KACH;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
* ConnectedWorkspaceTrash: one workspace's Recently deleted, as RLS lets the viewer see it.
|
|
3
3
|
*
|
|
4
4
|
* Everyone sees only the deleted documents they could see live (shared ones and their own) and may restore
|
|
5
|
-
* or delete their own
|
|
6
|
-
* delete any listed document and Empty trash for the whole
|
|
7
|
-
* documents are never listed to them, only counted, and go only
|
|
8
|
-
* Empty trash removes just their own deleted documents.
|
|
5
|
+
* or delete their own private ones (sharing is one-way: a shared document is the workspace's, even its
|
|
6
|
+
* creator's). A workspace manager may restore or delete any listed document and Empty trash for the whole
|
|
7
|
+
* workspace; other members' private deleted documents are never listed to them, only counted, and go only
|
|
8
|
+
* when they tick the opt-in. Anyone else's Empty trash removes just their own private deleted documents.
|
|
9
|
+
* What each viewer may do is the server's `can_restore` / `can_delete`.
|
|
9
10
|
*
|
|
10
11
|
* Delete permanently and Empty trash look done at once: the dialog closes and the documents leave the list
|
|
11
12
|
* before the server answers (the button shows Emptying… meanwhile); if it refuses, they come back.
|
|
@@ -32,7 +32,7 @@ function ConnectedWorkspaceTrash({
|
|
|
32
32
|
const others = page?.others_private;
|
|
33
33
|
const othersCount = others?.count ?? 0;
|
|
34
34
|
const removable = items.filter((d) => !d.restoring);
|
|
35
|
-
const emptiable = manager ? removable : removable.filter((d) => d.
|
|
35
|
+
const emptiable = manager ? removable : removable.filter((d) => d.can_delete);
|
|
36
36
|
const emptiableBytes = emptiable.reduce((sum, d) => sum + d.bytes, 0);
|
|
37
37
|
const run = async (action, failure, undo) => {
|
|
38
38
|
setBusy(true);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/connection/storage/ConnectedWorkspaceTrash.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * ConnectedWorkspaceTrash: one workspace's Recently deleted, as RLS lets the viewer see it.\n *\n * Everyone sees only the deleted documents they could see live (shared ones and their own) and may restore\n * or delete their own. A workspace manager (the project's owner, or the workspace's owner) may restore or\n * delete any listed document and Empty trash for the whole workspace; other members' private deleted\n * documents are never listed to them, only counted, and go only when they tick the opt-in. Anyone else's\n * Empty trash removes just their own deleted documents.\n *\n * Delete permanently and Empty trash look done at once: the dialog closes and the documents leave the list\n * before the server answers (the button shows Emptying\u2026 meanwhile); if it refuses, they come back.\n */\n\nimport { useState } from 'react'\nimport { Loader2, Lock, RotateCcw, Trash2 } from 'lucide-react'\nimport { Button, Checkbox, formatFriendlyDate } from '@arbidocs/react/ui'\nimport { ConfirmDialog } from '../../provider/dialogs'\nimport {\n useHideFromWorkspaceTrash,\n useInvalidateStorage,\n useStorageActions,\n useWorkspaceTrash,\n type DeletedDocument,\n} from '@arbidocs/react'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { formatBytes, RECENTLY_DELETED_NOTE } from './storage-labels'\n\ntype Pending = { kind: 'purge'; doc: DeletedDocument } | { kind: 'empty' }\n\nexport interface ConnectedWorkspaceTrashProps {\n workspaceExtId: string\n /** Shown above the list (e.g. the workspace's name on the project's Storage). */\n title?: string\n testId?: string\n}\n\nexport function ConnectedWorkspaceTrash({\n workspaceExtId,\n title,\n testId = 'workspace-trash',\n}: ConnectedWorkspaceTrashProps) {\n const trash = useWorkspaceTrash(workspaceExtId)\n const invalidate = useInvalidateStorage()\n const hide = useHideFromWorkspaceTrash()\n const { purgeDeletedDocuments, restoreDocuments } = useStorageActions()\n const { notify } = useBlocksEnvironment()\n const [pending, setPending] = useState<Pending | null>(null)\n const [includeOthers, setIncludeOthers] = useState(false)\n const [busy, setBusy] = useState(false)\n // Delete permanently / Empty trash on its way (the dialog has closed, the documents are off the list).\n const [removing, setRemoving] = useState<Pending['kind'] | null>(null)\n\n const page = trash.data\n const items = page?.items ?? []\n const manager = page?.can_manage ?? false\n const others = page?.others_private\n const othersCount = others?.count ?? 0\n // What Empty trash removes without the opt-in: everything listed for a manager, the viewer's own otherwise.\n // Documents being restored are on their way back, not in the trash any more.\n const removable = items.filter((d) => !d.restoring)\n const emptiable = manager ? removable : removable.filter((d) => d.mine)\n const emptiableBytes = emptiable.reduce((sum, d) => sum + d.bytes, 0)\n\n // The refetch after an action is not waited for: the action's own answer is what the viewer waits on.\n const run = async (action: () => Promise<string>, failure: string, undo?: () => void) => {\n setBusy(true)\n try {\n notify(await action(), 'success')\n void invalidate()\n } catch (error) {\n undo?.()\n notify(error instanceof Error ? error.message : failure, 'error')\n } finally {\n setBusy(false)\n setRemoving(null)\n setPending(null)\n setIncludeOthers(false)\n }\n }\n\n const restore = (doc: DeletedDocument) =>\n run(async () => {\n await restoreDocuments(workspaceExtId, [doc.external_id])\n return 'Restoring. It reappears in the workspace when its files are back.'\n }, 'Could not restore')\n\n const confirm = () => {\n if (!pending) return\n // Off the list and the dialog closed now; back on the list if the server refuses.\n const withOthers = pending.kind === 'empty' && manager && includeOthers\n const undo = hide(\n workspaceExtId,\n pending.kind === 'purge' ? [pending.doc.external_id] : emptiable.map((d) => d.external_id),\n withOthers\n )\n setRemoving(pending.kind)\n setPending(null)\n if (pending.kind === 'purge') {\n void run(\n async () => {\n await purgeDeletedDocuments(workspaceExtId, { externalIds: [pending.doc.external_id] })\n return `Deleted permanently \u00B7 ${formatBytes(pending.doc.bytes)} freed`\n },\n 'Could not delete permanently',\n undo\n )\n return\n }\n const freed = emptiableBytes + (withOthers ? (others?.bytes ?? 0) : 0)\n void run(\n async () => {\n const removed = await purgeDeletedDocuments(workspaceExtId, {\n includeOthersPrivate: withOthers,\n })\n return `Trash emptied \u00B7 ${removed.length} ${removed.length === 1 ? 'item' : 'items'} \u00B7 ${formatBytes(freed)} freed`\n },\n 'Could not empty the trash',\n undo\n )\n }\n\n const nothingToEmpty = emptiable.length === 0 && !(manager && othersCount > 0)\n\n return (\n <section className=\"space-y-2\" data-testid={testId}>\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div className=\"min-w-0\">\n {title && <h4 className=\"truncate text-sm font-medium text-foreground\">{title}</h4>}\n <p className=\"text-xs text-muted-foreground\">\n {manager\n ? RECENTLY_DELETED_NOTE\n : `${RECENTLY_DELETED_NOTE} You can remove your own deleted items.`}\n </p>\n </div>\n <Button\n size=\"sm\"\n variant=\"outline\"\n disabled={busy || trash.isLoading || nothingToEmpty}\n onClick={() => setPending({ kind: 'empty' })}\n data-testid={`${testId}-empty`}\n >\n {removing === 'empty' ? (\n <>\n <Loader2 className=\"mr-1.5 size-4 animate-spin\" aria-hidden=\"true\" />\n Emptying\u2026\n </>\n ) : (\n <>\n <Trash2 className=\"mr-1.5 size-4\" />\n {manager ? 'Empty trash' : 'Empty my trash'}\n </>\n )}\n </Button>\n </div>\n\n {trash.isLoading ? (\n <p className=\"text-sm text-muted-foreground\">Loading\u2026</p>\n ) : trash.isError ? (\n <p className=\"text-sm text-muted-foreground\" data-testid={`${testId}-error`}>\n {trash.error instanceof Error ? trash.error.message : 'Could not load Recently deleted'}\n </p>\n ) : (\n <ul className=\"divide-y divide-border rounded-md border border-border\">\n {items.length === 0 && (\n <li\n className=\"px-3 py-3 text-sm text-muted-foreground\"\n data-testid={`${testId}-empty-state`}\n >\n Nothing in Recently deleted\n </li>\n )}\n {items.map((doc) => (\n <li\n key={doc.external_id}\n className=\"flex items-center justify-between gap-3 px-3 py-2 text-sm\"\n data-testid={`${testId}-row-${doc.external_id}`}\n >\n <span className=\"min-w-0 truncate\">\n <span className=\"font-medium text-foreground\">{doc.file_name || 'Untitled'}</span>\n <span className=\"text-muted-foreground\">\n {' '}\n \u00B7 deleted {formatFriendlyDate(doc.deleted_at)} \u00B7 {formatBytes(doc.bytes)}\n </span>\n </span>\n {doc.restoring ? (\n <span\n className=\"inline-flex shrink-0 items-center gap-1.5 text-sm text-muted-foreground\"\n data-testid={`${testId}-restoring-${doc.external_id}`}\n >\n <Loader2 className=\"size-4 animate-spin\" aria-hidden=\"true\" />\n Restoring\u2026\n </span>\n ) : (\n <span className=\"flex shrink-0 gap-1\">\n {doc.can_restore && (\n <Button\n size=\"sm\"\n variant=\"ghost\"\n disabled={busy}\n onClick={() => void restore(doc)}\n data-testid={`${testId}-restore-${doc.external_id}`}\n >\n <RotateCcw className=\"mr-1.5 size-4\" />\n Restore\n </Button>\n )}\n {doc.can_delete && (\n <Button\n size=\"sm\"\n variant=\"ghost\"\n disabled={busy}\n onClick={() => setPending({ kind: 'purge', doc })}\n data-testid={`${testId}-delete-${doc.external_id}`}\n >\n Delete permanently\n </Button>\n )}\n </span>\n )}\n </li>\n ))}\n {manager && othersCount > 0 && (\n <li\n className=\"flex items-center gap-2 px-3 py-2 text-sm text-muted-foreground\"\n data-testid={`${testId}-others-private`}\n >\n <Lock className=\"size-4 shrink-0\" aria-hidden=\"true\" />\n {othersCount} private {othersCount === 1 ? 'item' : 'items'} of other members \u00B7{' '}\n {formatBytes(others?.bytes ?? 0)}\n </li>\n )}\n </ul>\n )}\n\n <ConfirmDialog\n isOpen={pending !== null}\n onClose={() => {\n setPending(null)\n setIncludeOthers(false)\n }}\n onConfirm={confirm}\n isLoading={busy}\n title={pending?.kind === 'purge' ? 'Delete permanently?' : 'Empty trash?'}\n description={\n pending?.kind === 'purge'\n ? `${pending.doc.file_name || 'It'} is removed for good now and stops using storage. This cannot be undone.`\n : manager\n ? `${emptiable.length} deleted ${emptiable.length === 1 ? 'item' : 'items'} you can see (${formatBytes(emptiableBytes)}) ${emptiable.length === 1 ? 'is' : 'are'} removed for good now and stop using storage. This cannot be undone.`\n : `Your ${emptiable.length} deleted ${emptiable.length === 1 ? 'item' : 'items'} in this workspace (${formatBytes(emptiableBytes)}) ${emptiable.length === 1 ? 'is' : 'are'} removed for good now. This cannot be undone.`\n }\n confirmText={pending?.kind === 'purge' ? 'Delete permanently' : 'Empty'}\n testId={`${testId}-confirm`}\n >\n {pending?.kind === 'empty' && manager && othersCount > 0 && (\n <label\n className=\"flex items-start gap-2 text-sm text-foreground\"\n data-testid={`${testId}-include-others`}\n >\n <Checkbox\n checked={includeOthers}\n onCheckedChange={(checked) => setIncludeOthers(checked === true)}\n aria-label=\"Also delete other members' private items\"\n />\n <span>\n Also delete {othersCount} private {othersCount === 1 ? 'item' : 'items'} of other\n members ({formatBytes(others?.bytes ?? 0)})\n <span className=\"block text-xs text-muted-foreground\">\n {\n \"You can't see these. Left alone, their owners can still restore them until they're removed automatically.\"\n }\n </span>\n </span>\n </label>\n )}\n </ConfirmDialog>\n </section>\n )\n}\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["/**\n * ConnectedWorkspaceTrash: one workspace's Recently deleted, as RLS lets the viewer see it.\n *\n * Everyone sees only the deleted documents they could see live (shared ones and their own) and may restore\n * or delete their own private ones (sharing is one-way: a shared document is the workspace's, even its\n * creator's). A workspace manager may restore or delete any listed document and Empty trash for the whole\n * workspace; other members' private deleted documents are never listed to them, only counted, and go only\n * when they tick the opt-in. Anyone else's Empty trash removes just their own private deleted documents.\n * What each viewer may do is the server's `can_restore` / `can_delete`.\n *\n * Delete permanently and Empty trash look done at once: the dialog closes and the documents leave the list\n * before the server answers (the button shows Emptying\u2026 meanwhile); if it refuses, they come back.\n */\n\nimport { useState } from 'react'\nimport { Loader2, Lock, RotateCcw, Trash2 } from 'lucide-react'\nimport { Button, Checkbox, formatFriendlyDate } from '@arbidocs/react/ui'\nimport { ConfirmDialog } from '../../provider/dialogs'\nimport {\n useHideFromWorkspaceTrash,\n useInvalidateStorage,\n useStorageActions,\n useWorkspaceTrash,\n type DeletedDocument,\n} from '@arbidocs/react'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { formatBytes, RECENTLY_DELETED_NOTE } from './storage-labels'\n\ntype Pending = { kind: 'purge'; doc: DeletedDocument } | { kind: 'empty' }\n\nexport interface ConnectedWorkspaceTrashProps {\n workspaceExtId: string\n /** Shown above the list (e.g. the workspace's name on the project's Storage). */\n title?: string\n testId?: string\n}\n\nexport function ConnectedWorkspaceTrash({\n workspaceExtId,\n title,\n testId = 'workspace-trash',\n}: ConnectedWorkspaceTrashProps) {\n const trash = useWorkspaceTrash(workspaceExtId)\n const invalidate = useInvalidateStorage()\n const hide = useHideFromWorkspaceTrash()\n const { purgeDeletedDocuments, restoreDocuments } = useStorageActions()\n const { notify } = useBlocksEnvironment()\n const [pending, setPending] = useState<Pending | null>(null)\n const [includeOthers, setIncludeOthers] = useState(false)\n const [busy, setBusy] = useState(false)\n // Delete permanently / Empty trash on its way (the dialog has closed, the documents are off the list).\n const [removing, setRemoving] = useState<Pending['kind'] | null>(null)\n\n const page = trash.data\n const items = page?.items ?? []\n const manager = page?.can_manage ?? false\n const others = page?.others_private\n const othersCount = others?.count ?? 0\n // What Empty trash removes without the opt-in: everything listed for a manager, otherwise what the viewer\n // may delete: their own private documents (a shared one is the workspace's, even their own).\n // Documents being restored are on their way back, not in the trash any more.\n const removable = items.filter((d) => !d.restoring)\n const emptiable = manager ? removable : removable.filter((d) => d.can_delete)\n const emptiableBytes = emptiable.reduce((sum, d) => sum + d.bytes, 0)\n\n // The refetch after an action is not waited for: the action's own answer is what the viewer waits on.\n const run = async (action: () => Promise<string>, failure: string, undo?: () => void) => {\n setBusy(true)\n try {\n notify(await action(), 'success')\n void invalidate()\n } catch (error) {\n undo?.()\n notify(error instanceof Error ? error.message : failure, 'error')\n } finally {\n setBusy(false)\n setRemoving(null)\n setPending(null)\n setIncludeOthers(false)\n }\n }\n\n const restore = (doc: DeletedDocument) =>\n run(async () => {\n await restoreDocuments(workspaceExtId, [doc.external_id])\n return 'Restoring. It reappears in the workspace when its files are back.'\n }, 'Could not restore')\n\n const confirm = () => {\n if (!pending) return\n // Off the list and the dialog closed now; back on the list if the server refuses.\n const withOthers = pending.kind === 'empty' && manager && includeOthers\n const undo = hide(\n workspaceExtId,\n pending.kind === 'purge' ? [pending.doc.external_id] : emptiable.map((d) => d.external_id),\n withOthers\n )\n setRemoving(pending.kind)\n setPending(null)\n if (pending.kind === 'purge') {\n void run(\n async () => {\n await purgeDeletedDocuments(workspaceExtId, { externalIds: [pending.doc.external_id] })\n return `Deleted permanently \u00B7 ${formatBytes(pending.doc.bytes)} freed`\n },\n 'Could not delete permanently',\n undo\n )\n return\n }\n const freed = emptiableBytes + (withOthers ? (others?.bytes ?? 0) : 0)\n void run(\n async () => {\n const removed = await purgeDeletedDocuments(workspaceExtId, {\n includeOthersPrivate: withOthers,\n })\n return `Trash emptied \u00B7 ${removed.length} ${removed.length === 1 ? 'item' : 'items'} \u00B7 ${formatBytes(freed)} freed`\n },\n 'Could not empty the trash',\n undo\n )\n }\n\n const nothingToEmpty = emptiable.length === 0 && !(manager && othersCount > 0)\n\n return (\n <section className=\"space-y-2\" data-testid={testId}>\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div className=\"min-w-0\">\n {title && <h4 className=\"truncate text-sm font-medium text-foreground\">{title}</h4>}\n <p className=\"text-xs text-muted-foreground\">\n {manager\n ? RECENTLY_DELETED_NOTE\n : `${RECENTLY_DELETED_NOTE} You can remove your own deleted items.`}\n </p>\n </div>\n <Button\n size=\"sm\"\n variant=\"outline\"\n disabled={busy || trash.isLoading || nothingToEmpty}\n onClick={() => setPending({ kind: 'empty' })}\n data-testid={`${testId}-empty`}\n >\n {removing === 'empty' ? (\n <>\n <Loader2 className=\"mr-1.5 size-4 animate-spin\" aria-hidden=\"true\" />\n Emptying\u2026\n </>\n ) : (\n <>\n <Trash2 className=\"mr-1.5 size-4\" />\n {manager ? 'Empty trash' : 'Empty my trash'}\n </>\n )}\n </Button>\n </div>\n\n {trash.isLoading ? (\n <p className=\"text-sm text-muted-foreground\">Loading\u2026</p>\n ) : trash.isError ? (\n <p className=\"text-sm text-muted-foreground\" data-testid={`${testId}-error`}>\n {trash.error instanceof Error ? trash.error.message : 'Could not load Recently deleted'}\n </p>\n ) : (\n <ul className=\"divide-y divide-border rounded-md border border-border\">\n {items.length === 0 && (\n <li\n className=\"px-3 py-3 text-sm text-muted-foreground\"\n data-testid={`${testId}-empty-state`}\n >\n Nothing in Recently deleted\n </li>\n )}\n {items.map((doc) => (\n <li\n key={doc.external_id}\n className=\"flex items-center justify-between gap-3 px-3 py-2 text-sm\"\n data-testid={`${testId}-row-${doc.external_id}`}\n >\n <span className=\"min-w-0 truncate\">\n <span className=\"font-medium text-foreground\">{doc.file_name || 'Untitled'}</span>\n <span className=\"text-muted-foreground\">\n {' '}\n \u00B7 deleted {formatFriendlyDate(doc.deleted_at)} \u00B7 {formatBytes(doc.bytes)}\n </span>\n </span>\n {doc.restoring ? (\n <span\n className=\"inline-flex shrink-0 items-center gap-1.5 text-sm text-muted-foreground\"\n data-testid={`${testId}-restoring-${doc.external_id}`}\n >\n <Loader2 className=\"size-4 animate-spin\" aria-hidden=\"true\" />\n Restoring\u2026\n </span>\n ) : (\n <span className=\"flex shrink-0 gap-1\">\n {doc.can_restore && (\n <Button\n size=\"sm\"\n variant=\"ghost\"\n disabled={busy}\n onClick={() => void restore(doc)}\n data-testid={`${testId}-restore-${doc.external_id}`}\n >\n <RotateCcw className=\"mr-1.5 size-4\" />\n Restore\n </Button>\n )}\n {doc.can_delete && (\n <Button\n size=\"sm\"\n variant=\"ghost\"\n disabled={busy}\n onClick={() => setPending({ kind: 'purge', doc })}\n data-testid={`${testId}-delete-${doc.external_id}`}\n >\n Delete permanently\n </Button>\n )}\n </span>\n )}\n </li>\n ))}\n {manager && othersCount > 0 && (\n <li\n className=\"flex items-center gap-2 px-3 py-2 text-sm text-muted-foreground\"\n data-testid={`${testId}-others-private`}\n >\n <Lock className=\"size-4 shrink-0\" aria-hidden=\"true\" />\n {othersCount} private {othersCount === 1 ? 'item' : 'items'} of other members \u00B7{' '}\n {formatBytes(others?.bytes ?? 0)}\n </li>\n )}\n </ul>\n )}\n\n <ConfirmDialog\n isOpen={pending !== null}\n onClose={() => {\n setPending(null)\n setIncludeOthers(false)\n }}\n onConfirm={confirm}\n isLoading={busy}\n title={pending?.kind === 'purge' ? 'Delete permanently?' : 'Empty trash?'}\n description={\n pending?.kind === 'purge'\n ? `${pending.doc.file_name || 'It'} is removed for good now and stops using storage. This cannot be undone.`\n : manager\n ? `${emptiable.length} deleted ${emptiable.length === 1 ? 'item' : 'items'} you can see (${formatBytes(emptiableBytes)}) ${emptiable.length === 1 ? 'is' : 'are'} removed for good now and stop using storage. This cannot be undone.`\n : `Your ${emptiable.length} deleted ${emptiable.length === 1 ? 'item' : 'items'} in this workspace (${formatBytes(emptiableBytes)}) ${emptiable.length === 1 ? 'is' : 'are'} removed for good now. This cannot be undone.`\n }\n confirmText={pending?.kind === 'purge' ? 'Delete permanently' : 'Empty'}\n testId={`${testId}-confirm`}\n >\n {pending?.kind === 'empty' && manager && othersCount > 0 && (\n <label\n className=\"flex items-start gap-2 text-sm text-foreground\"\n data-testid={`${testId}-include-others`}\n >\n <Checkbox\n checked={includeOthers}\n onCheckedChange={(checked) => setIncludeOthers(checked === true)}\n aria-label=\"Also delete other members' private items\"\n />\n <span>\n Also delete {othersCount} private {othersCount === 1 ? 'item' : 'items'} of other\n members ({formatBytes(others?.bytes ?? 0)})\n <span className=\"block text-xs text-muted-foreground\">\n {\n \"You can't see these. Left alone, their owners can still restore them until they're removed automatically.\"\n }\n </span>\n </span>\n </label>\n )}\n </ConfirmDialog>\n </section>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAgIQ,SAgBI,UAfQ,KADZ;AAlHR,SAAS,gBAAgB;AACzB,SAAS,SAAS,MAAM,WAAW,cAAc;AACjD,SAAS,QAAQ,UAAU,0BAA0B;AACrD,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,4BAA4B;AACrC,SAAS,aAAa,6BAA6B;AAW5C,SAAS,wBAAwB;AAAA,EACtC;AAAA,EACA;AAAA,EACA,SAAS;AACX,GAAiC;AAC/B,QAAM,QAAQ,kBAAkB,cAAc;AAC9C,QAAM,aAAa,qBAAqB;AACxC,QAAM,OAAO,0BAA0B;AACvC,QAAM,EAAE,uBAAuB,iBAAiB,IAAI,kBAAkB;AACtE,QAAM,EAAE,OAAO,IAAI,qBAAqB;AACxC,QAAM,CAAC,SAAS,UAAU,IAAI,SAAyB,IAAI;AAC3D,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAS,KAAK;AACxD,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,KAAK;AAEtC,QAAM,CAAC,UAAU,WAAW,IAAI,SAAiC,IAAI;AAErE,QAAM,OAAO,MAAM;AACnB,QAAM,QAAQ,MAAM,SAAS,CAAC;AAC9B,QAAM,UAAU,MAAM,cAAc;AACpC,QAAM,SAAS,MAAM;AACrB,QAAM,cAAc,QAAQ,SAAS;AAIrC,QAAM,YAAY,MAAM,OAAO,CAAC,MAAM,CAAC,EAAE,SAAS;AAClD,QAAM,YAAY,UAAU,YA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D,YAAY,QAAQ,SAAS,CAAC;AAAA,gBAAE;AAAA,gBAC1C,oBAAC,UAAK,WAAU,uCAEZ,uHAEJ;AAAA,iBACF;AAAA;AAAA;AAAA,QACF;AAAA;AAAA,IAEJ;AAAA,KACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/embed/index.cjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkPTT5MZ7O_cjs = require('../chunk-PTT5MZ7O.cjs');
|
|
5
5
|
require('../chunk-6P4U63HO.cjs');
|
|
6
|
-
require('../chunk-
|
|
7
|
-
require('../chunk-
|
|
6
|
+
require('../chunk-FNBUFKHE.cjs');
|
|
7
|
+
require('../chunk-M24FBUAP.cjs');
|
|
8
8
|
require('../chunk-TJY7XPDE.cjs');
|
|
9
9
|
require('../chunk-XNW62J54.cjs');
|
|
10
10
|
require('../chunk-7UPEFZCV.cjs');
|
|
11
11
|
require('../chunk-V27WLYTG.cjs');
|
|
12
12
|
require('../chunk-CYWOL2LS.cjs');
|
|
13
|
-
require('../chunk-
|
|
13
|
+
require('../chunk-BNHFDXJI.cjs');
|
|
14
14
|
require('../chunk-AHUEBRLX.cjs');
|
|
15
15
|
require('../chunk-HYUKPHCT.cjs');
|
|
16
16
|
require('../chunk-JWCVA4LC.cjs');
|
|
17
|
-
require('../chunk-
|
|
17
|
+
require('../chunk-44M4FI2N.cjs');
|
|
18
18
|
require('../chunk-223D4727.cjs');
|
|
19
19
|
require('../chunk-SNUBQMIS.cjs');
|
|
20
20
|
require('../chunk-5GBM7BQB.cjs');
|
|
@@ -44,7 +44,7 @@ require('../chunk-3YEXZX4H.cjs');
|
|
|
44
44
|
require('../chunk-4PA6VCCR.cjs');
|
|
45
45
|
require('../chunk-G3MRW4WB.cjs');
|
|
46
46
|
require('../chunk-AHDJXIUB.cjs');
|
|
47
|
-
require('../chunk-
|
|
47
|
+
require('../chunk-S3GVFAFB.cjs');
|
|
48
48
|
require('../chunk-6UZC4XVV.cjs');
|
|
49
49
|
require('../chunk-SLCH5JRI.cjs');
|
|
50
50
|
require('../chunk-DKY67DA6.cjs');
|
|
@@ -89,27 +89,27 @@ require('../chunk-PLIF5CUV.cjs');
|
|
|
89
89
|
|
|
90
90
|
Object.defineProperty(exports, "ArbiChat", {
|
|
91
91
|
enumerable: true,
|
|
92
|
-
get: function () { return
|
|
92
|
+
get: function () { return chunkPTT5MZ7O_cjs.ArbiChat; }
|
|
93
93
|
});
|
|
94
94
|
Object.defineProperty(exports, "ConnectedCompactLogin", {
|
|
95
95
|
enumerable: true,
|
|
96
|
-
get: function () { return
|
|
96
|
+
get: function () { return chunkPTT5MZ7O_cjs.ConnectedCompactLogin; }
|
|
97
97
|
});
|
|
98
98
|
Object.defineProperty(exports, "ConnectedEmbeddedChat", {
|
|
99
99
|
enumerable: true,
|
|
100
|
-
get: function () { return
|
|
100
|
+
get: function () { return chunkPTT5MZ7O_cjs.ConnectedEmbeddedChat; }
|
|
101
101
|
});
|
|
102
102
|
Object.defineProperty(exports, "ConnectedLoginPage", {
|
|
103
103
|
enumerable: true,
|
|
104
|
-
get: function () { return
|
|
104
|
+
get: function () { return chunkPTT5MZ7O_cjs.ConnectedLoginPage; }
|
|
105
105
|
});
|
|
106
106
|
Object.defineProperty(exports, "EmbeddedChatPanel", {
|
|
107
107
|
enumerable: true,
|
|
108
|
-
get: function () { return
|
|
108
|
+
get: function () { return chunkPTT5MZ7O_cjs.EmbeddedChatPanel; }
|
|
109
109
|
});
|
|
110
110
|
Object.defineProperty(exports, "defaultHost", {
|
|
111
111
|
enumerable: true,
|
|
112
|
-
get: function () { return
|
|
112
|
+
get: function () { return chunkPTT5MZ7O_cjs.defaultHost; }
|
|
113
113
|
});
|
|
114
114
|
Object.defineProperty(exports, "useConnection", {
|
|
115
115
|
enumerable: true,
|