@arbidocs/blocks 0.5.152 → 0.5.154
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-244UIHSM.cjs → ConnectedNativeDocxComparison-2DAQX5GX.cjs} +9 -9
- package/dist/{ConnectedStreamedWordArtifact-V6BRZMEQ.cjs.map → ConnectedNativeDocxComparison-2DAQX5GX.cjs.map} +1 -1
- package/dist/{ConnectedPresentation-JUXIXKYN.cjs → ConnectedPresentation-J42JPUVR.cjs} +13 -13
- package/dist/{ConnectedPresentation-JUXIXKYN.cjs.map → ConnectedPresentation-J42JPUVR.cjs.map} +1 -1
- package/dist/{ConnectedSlidesTab-JA3VB66W.cjs → ConnectedSlidesTab-BYS7HFNK.cjs} +12 -12
- package/dist/{ConnectedSlidesTab-JA3VB66W.cjs.map → ConnectedSlidesTab-BYS7HFNK.cjs.map} +1 -1
- package/dist/{ConnectedStreamedWordArtifact-V6BRZMEQ.cjs → ConnectedStreamedWordArtifact-LTYB62VM.cjs} +9 -9
- package/dist/{ConnectedNativeDocxComparison-244UIHSM.cjs.map → ConnectedStreamedWordArtifact-LTYB62VM.cjs.map} +1 -1
- package/dist/{DocumentReviewCard-5W2QQWKA.cjs → DocumentReviewCard-ILDLYZ5A.cjs} +15 -13
- package/dist/DocumentReviewCard-ILDLYZ5A.cjs.map +1 -0
- package/dist/{FilesViewerDialog-63QUTG4L.cjs → FilesViewerDialog-YLD5YFP2.cjs} +25 -22
- package/dist/FilesViewerDialog-YLD5YFP2.cjs.map +1 -0
- package/dist/{RechartsRenderer-NU6WUZJS.cjs → RechartsRenderer-EPVL5QZA.cjs} +2 -2
- package/dist/{RechartsRenderer-NU6WUZJS.cjs.map → RechartsRenderer-EPVL5QZA.cjs.map} +1 -1
- package/dist/{SpotlightStrip-HXQFPAAL.cjs → SpotlightStrip-JE6MXUBT.cjs} +6 -6
- package/dist/{SpotlightStrip-HXQFPAAL.cjs.map → SpotlightStrip-JE6MXUBT.cjs.map} +1 -1
- package/dist/{WorkspaceTableView-2QP2HJLK.cjs → WorkspaceTableView-V3N64LJG.cjs} +13 -11
- package/dist/WorkspaceTableView-V3N64LJG.cjs.map +1 -0
- package/dist/agents/index.cjs +245 -244
- package/dist/agents/workflows/WorkflowLauncher.d.ts +3 -1
- package/dist/agents/workflows/WorkflowLauncher.js +2 -0
- package/dist/agents/workflows/WorkflowLauncher.js.map +2 -2
- package/dist/{ai-ODGRIL6Y.cjs → ai-QFY4LYQZ.cjs} +16 -16
- package/dist/ai-QFY4LYQZ.cjs.map +1 -0
- package/dist/calls/index.cjs +25 -24
- package/dist/calls/index.cjs.map +1 -1
- package/dist/{chunk-MAKCWF45.cjs → chunk-6GKCGCMT.cjs} +4 -4
- package/dist/{chunk-MAKCWF45.cjs.map → chunk-6GKCGCMT.cjs.map} +1 -1
- package/dist/{chunk-LYKT336H.cjs → chunk-6I5HHWCD.cjs} +5 -5
- package/dist/{chunk-LYKT336H.cjs.map → chunk-6I5HHWCD.cjs.map} +1 -1
- package/dist/{chunk-KWJW5TMH.cjs → chunk-6OPDKROP.cjs} +4 -41
- package/dist/chunk-6OPDKROP.cjs.map +1 -0
- package/dist/{chunk-QWOPEBH2.cjs → chunk-6P4U63HO.cjs} +4 -4
- package/dist/{chunk-QWOPEBH2.cjs.map → chunk-6P4U63HO.cjs.map} +1 -1
- package/dist/{chunk-QKCFV36K.cjs → chunk-7UPEFZCV.cjs} +9 -9
- package/dist/{chunk-QKCFV36K.cjs.map → chunk-7UPEFZCV.cjs.map} +1 -1
- package/dist/{chunk-DUNXLT63.cjs → chunk-AHUEBRLX.cjs} +2 -238
- package/dist/chunk-AHUEBRLX.cjs.map +1 -0
- package/dist/{chunk-B5BGVPQ5.cjs → chunk-AURL2KT5.cjs} +4 -4
- package/dist/{chunk-B5BGVPQ5.cjs.map → chunk-AURL2KT5.cjs.map} +1 -1
- package/dist/chunk-BH322H5B.cjs +594 -0
- package/dist/chunk-BH322H5B.cjs.map +1 -0
- package/dist/{chunk-ZCQXQIBA.cjs → chunk-BNDIMTWJ.cjs} +28 -28
- package/dist/{chunk-ZCQXQIBA.cjs.map → chunk-BNDIMTWJ.cjs.map} +1 -1
- package/dist/{chunk-AG6KAGAX.cjs → chunk-BTQ7IAOH.cjs} +4 -4
- package/dist/{chunk-AG6KAGAX.cjs.map → chunk-BTQ7IAOH.cjs.map} +1 -1
- package/dist/{chunk-FCT62ZPE.cjs → chunk-BZVK7JW5.cjs} +5 -5
- package/dist/{chunk-FCT62ZPE.cjs.map → chunk-BZVK7JW5.cjs.map} +1 -1
- package/dist/{chunk-WUM76MJU.cjs → chunk-CNBYM5Q7.cjs} +7 -7
- package/dist/{chunk-WUM76MJU.cjs.map → chunk-CNBYM5Q7.cjs.map} +1 -1
- package/dist/{chunk-HNLNRAEU.cjs → chunk-DSLMJ24E.cjs} +2 -261
- package/dist/chunk-DSLMJ24E.cjs.map +1 -0
- package/dist/chunk-DWRUGOTQ.cjs +35 -0
- package/dist/chunk-DWRUGOTQ.cjs.map +1 -0
- package/dist/{chunk-GAA222SK.cjs → chunk-EG3DPKXM.cjs} +5 -5
- package/dist/{chunk-GAA222SK.cjs.map → chunk-EG3DPKXM.cjs.map} +1 -1
- package/dist/chunk-FEAHTNTY.cjs +1447 -0
- package/dist/chunk-FEAHTNTY.cjs.map +1 -0
- package/dist/{chunk-VSDD5TH5.cjs → chunk-G3MRW4WB.cjs} +10 -8
- package/dist/chunk-G3MRW4WB.cjs.map +1 -0
- package/dist/{chunk-TFRCNIUY.cjs → chunk-GF6AYAMI.cjs} +9 -9
- package/dist/{chunk-TFRCNIUY.cjs.map → chunk-GF6AYAMI.cjs.map} +1 -1
- package/dist/{chunk-4ZR4O5SP.cjs → chunk-GK3U3FWY.cjs} +60 -28
- package/dist/chunk-GK3U3FWY.cjs.map +1 -0
- package/dist/{chunk-3CJTO6RV.cjs → chunk-GXRD5OSU.cjs} +8 -8
- package/dist/{chunk-3CJTO6RV.cjs.map → chunk-GXRD5OSU.cjs.map} +1 -1
- package/dist/{chunk-JLNKD56X.cjs → chunk-GYI4UXX6.cjs} +4 -4
- package/dist/{chunk-JLNKD56X.cjs.map → chunk-GYI4UXX6.cjs.map} +1 -1
- package/dist/{chunk-4I2PCP7O.cjs → chunk-I3XTTTPZ.cjs} +41 -40
- package/dist/chunk-I3XTTTPZ.cjs.map +1 -0
- package/dist/chunk-JWCVA4LC.cjs +248 -0
- package/dist/chunk-JWCVA4LC.cjs.map +1 -0
- package/dist/{chunk-UM3EWCDE.cjs → chunk-K5F2VNCX.cjs} +35 -10
- package/dist/chunk-K5F2VNCX.cjs.map +1 -0
- package/dist/chunk-KD66CBYO.cjs +44 -0
- package/dist/chunk-KD66CBYO.cjs.map +1 -0
- package/dist/chunk-LLVE5TST.cjs +318 -0
- package/dist/chunk-LLVE5TST.cjs.map +1 -0
- package/dist/{chunk-JCFXS336.cjs → chunk-NRGLF4J4.cjs} +2 -466
- package/dist/chunk-NRGLF4J4.cjs.map +1 -0
- package/dist/{chunk-CVVQHFLR.cjs → chunk-O7U6KL2W.cjs} +72 -650
- package/dist/chunk-O7U6KL2W.cjs.map +1 -0
- package/dist/{chunk-Z3N32LL4.cjs → chunk-OOANNOH4.cjs} +35 -33
- package/dist/chunk-OOANNOH4.cjs.map +1 -0
- package/dist/chunk-SGYURQ23.cjs +271 -0
- package/dist/chunk-SGYURQ23.cjs.map +1 -0
- package/dist/{chunk-A5SKK3CU.cjs → chunk-SLCH5JRI.cjs} +64 -35
- package/dist/chunk-SLCH5JRI.cjs.map +1 -0
- package/dist/chunk-T26UYA6Q.cjs +64 -0
- package/dist/chunk-T26UYA6Q.cjs.map +1 -0
- package/dist/chunk-T3Y3LZ4Y.cjs +477 -0
- package/dist/chunk-T3Y3LZ4Y.cjs.map +1 -0
- package/dist/{chunk-4XNP27N4.cjs → chunk-T7BUGVSG.cjs} +36 -36
- package/dist/{chunk-4XNP27N4.cjs.map → chunk-T7BUGVSG.cjs.map} +1 -1
- package/dist/{chunk-SMO4SPPB.cjs → chunk-TD5V5BZ3.cjs} +5 -5
- package/dist/{chunk-SMO4SPPB.cjs.map → chunk-TD5V5BZ3.cjs.map} +1 -1
- package/dist/{chunk-IXTDOPSB.cjs → chunk-TSAZWUPZ.cjs} +4 -4
- package/dist/{chunk-IXTDOPSB.cjs.map → chunk-TSAZWUPZ.cjs.map} +1 -1
- package/dist/{chunk-5DGNJ6VJ.cjs → chunk-UD3LPATQ.cjs} +6 -6
- package/dist/{chunk-5DGNJ6VJ.cjs.map → chunk-UD3LPATQ.cjs.map} +1 -1
- package/dist/{chunk-OF7KMG6R.cjs → chunk-UJHQ4DA4.cjs} +5 -5
- package/dist/{chunk-OF7KMG6R.cjs.map → chunk-UJHQ4DA4.cjs.map} +1 -1
- package/dist/{chunk-NUFZFWHZ.cjs → chunk-W5QSKW7T.cjs} +3 -29
- package/dist/chunk-W5QSKW7T.cjs.map +1 -0
- package/dist/{chunk-NNZFZYTI.cjs → chunk-WOVNXJK5.cjs} +4 -54
- package/dist/chunk-WOVNXJK5.cjs.map +1 -0
- package/dist/{chunk-E6BM5ENI.cjs → chunk-WRTEKOQP.cjs} +2 -309
- package/dist/chunk-WRTEKOQP.cjs.map +1 -0
- package/dist/{chunk-KRQCUVH7.cjs → chunk-YSAUOJA7.cjs} +9 -3
- package/dist/chunk-YSAUOJA7.cjs.map +1 -0
- package/dist/{chunk-6ZZWQ3OL.cjs → chunk-YXY52OGU.cjs} +4 -4
- package/dist/{chunk-6ZZWQ3OL.cjs.map → chunk-YXY52OGU.cjs.map} +1 -1
- package/dist/{chunk-D5DOK2AE.cjs → chunk-ZW2ZFC3Q.cjs} +58 -58
- package/dist/{chunk-D5DOK2AE.cjs.map → chunk-ZW2ZFC3Q.cjs.map} +1 -1
- package/dist/components/gestures/usePointerGesture.d.ts +13 -1
- package/dist/components/gestures/usePointerGesture.js +33 -8
- package/dist/components/gestures/usePointerGesture.js.map +2 -2
- package/dist/connect/docx.cjs +12 -12
- package/dist/connect/index.cjs +1319 -2361
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.d.ts +1 -0
- package/dist/connect/index.js +1 -0
- package/dist/connect/index.js.map +2 -2
- package/dist/connect/viewer.cjs +15 -12
- package/dist/connection/dashboards/DashboardPanel.d.ts +2 -0
- package/dist/connection/dashboards/DashboardPanel.js +4 -0
- package/dist/connection/dashboards/DashboardPanel.js.map +2 -2
- package/dist/connection/dashboards/index.d.ts +1 -1
- package/dist/connection/dashboards/index.js +2 -0
- package/dist/connection/dashboards/index.js.map +2 -2
- package/dist/connection/dashboards/templates.d.ts +10 -5
- package/dist/connection/dashboards/templates.js +7 -1
- package/dist/connection/dashboards/templates.js.map +2 -2
- package/dist/connection/live-blocks/ConnectedAgendaBlock.d.ts +13 -0
- package/dist/connection/live-blocks/ConnectedAgendaBlock.js +19 -0
- package/dist/connection/live-blocks/ConnectedAgendaBlock.js.map +7 -0
- package/dist/connection/live-blocks/ConnectedCarouselBlock.d.ts +7 -0
- package/dist/connection/live-blocks/ConnectedCarouselBlock.js +84 -0
- package/dist/connection/live-blocks/ConnectedCarouselBlock.js.map +7 -0
- package/dist/connection/live-blocks/ConnectedListBlock.d.ts +29 -0
- package/dist/connection/live-blocks/ConnectedListBlock.js +193 -0
- package/dist/connection/live-blocks/ConnectedListBlock.js.map +7 -0
- package/dist/connection/live-blocks/ConnectedStartBlock.d.ts +7 -0
- package/dist/connection/live-blocks/ConnectedStartBlock.js +16 -0
- package/dist/connection/live-blocks/ConnectedStartBlock.js.map +7 -0
- package/dist/connection/live-blocks/DashboardAgenda.d.ts +10 -0
- package/dist/connection/{workspace-dashboard → live-blocks}/DashboardAgenda.js +10 -2
- package/dist/connection/live-blocks/DashboardAgenda.js.map +7 -0
- package/dist/connection/{workspace-dashboard → live-blocks}/DashboardStart.js.map +1 -1
- package/dist/connection/live-blocks/LiveBlockRoot.d.ts +11 -0
- package/dist/connection/live-blocks/LiveBlockRoot.js +22 -0
- package/dist/connection/live-blocks/LiveBlockRoot.js.map +7 -0
- package/dist/connection/live-blocks/index.d.ts +5 -0
- package/dist/connection/live-blocks/index.js +20 -0
- package/dist/connection/live-blocks/index.js.map +7 -0
- package/dist/connection/{workspace-dashboard/dashboard-rows.d.ts → live-blocks/list-rows.d.ts} +22 -4
- package/dist/connection/{workspace-dashboard/dashboard-rows.js → live-blocks/list-rows.js} +13 -8
- package/dist/connection/live-blocks/list-rows.js.map +7 -0
- package/dist/connection/{workspace-dashboard → live-blocks}/useDashboardAdd.js.map +1 -1
- package/dist/connection/live-blocks/workspace-dashboard-blocks.d.ts +23 -0
- package/dist/connection/live-blocks/workspace-dashboard-blocks.js +58 -0
- package/dist/connection/live-blocks/workspace-dashboard-blocks.js.map +7 -0
- package/dist/connection/pages/BlockEditor.d.ts +3 -1
- package/dist/connection/pages/BlockEditor.js +18 -1
- package/dist/connection/pages/BlockEditor.js.map +2 -2
- package/dist/connection/pages/ConnectedPagesPage.d.ts +5 -4
- package/dist/connection/pages/ConnectedPagesPage.js +122 -46
- package/dist/connection/pages/ConnectedPagesPage.js.map +2 -2
- package/dist/connection/pages/EditablePageGrid.d.ts +25 -15
- package/dist/connection/pages/EditablePageGrid.js +145 -50
- package/dist/connection/pages/EditablePageGrid.js.map +2 -2
- package/dist/connection/pages/LiveBlockEditor.d.ts +30 -0
- package/dist/connection/pages/LiveBlockEditor.js +175 -0
- package/dist/connection/pages/LiveBlockEditor.js.map +7 -0
- package/dist/connection/pages/PageBlockView.d.ts +5 -3
- package/dist/connection/pages/PageBlockView.js +69 -4
- package/dist/connection/pages/PageBlockView.js.map +2 -2
- package/dist/connection/pages/PageGrid.d.ts +4 -3
- package/dist/connection/pages/PageGrid.js +4 -2
- package/dist/connection/pages/PageGrid.js.map +2 -2
- package/dist/connection/pages/PagesList.d.ts +4 -3
- package/dist/connection/pages/PagesList.js.map +2 -2
- package/dist/connection/pages/TableViewBlock.d.ts +5 -4
- package/dist/connection/pages/TableViewBlock.js +19 -19
- package/dist/connection/pages/TableViewBlock.js.map +2 -2
- package/dist/connection/pages/grid-layout.d.ts +44 -12
- package/dist/connection/pages/grid-layout.js +71 -27
- package/dist/connection/pages/grid-layout.js.map +2 -2
- package/dist/connection/pages/index.d.ts +4 -2
- package/dist/connection/pages/index.js +34 -5
- package/dist/connection/pages/index.js.map +2 -2
- package/dist/connection/pages/labels.js +5 -1
- package/dist/connection/pages/labels.js.map +2 -2
- package/dist/connection/pages/page-templates.d.ts +10 -0
- package/dist/connection/pages/page-templates.js +16 -0
- package/dist/connection/pages/page-templates.js.map +7 -0
- package/dist/connection/storage/ConnectedStorageProjectCard.js +1 -1
- package/dist/connection/storage/ConnectedStorageProjectCard.js.map +2 -2
- package/dist/connection/storage/ConnectedWorkspaceTrash.d.ts +3 -0
- package/dist/connection/storage/ConnectedWorkspaceTrash.js +41 -17
- package/dist/connection/storage/ConnectedWorkspaceTrash.js.map +2 -2
- package/dist/connection/workflows/ConnectedWorkflowStart.d.ts +2 -0
- package/dist/connection/workflows/ConnectedWorkflowStart.js.map +2 -2
- package/dist/connection/workspace-dashboard/ConnectedWorkspaceDashboard.d.ts +10 -7
- package/dist/connection/workspace-dashboard/ConnectedWorkspaceDashboard.js +31 -171
- package/dist/connection/workspace-dashboard/ConnectedWorkspaceDashboard.js.map +3 -3
- package/dist/dashboards/ChartRenderer.d.ts +5 -3
- package/dist/dashboards/ChartRenderer.js +29 -18
- package/dist/dashboards/ChartRenderer.js.map +2 -2
- package/dist/dashboards/PanelView.d.ts +6 -1
- package/dist/dashboards/PanelView.js +24 -7
- package/dist/dashboards/PanelView.js.map +2 -2
- package/dist/dashboards/RechartsRenderer.d.ts +2 -1
- package/dist/dashboards/RechartsRenderer.js.map +2 -2
- package/dist/dashboards/index.cjs +25 -21
- package/dist/embed/index.cjs +23 -20
- package/dist/files/index.cjs +250 -249
- package/dist/home/FactsStrip.d.ts +3 -1
- package/dist/home/FactsStrip.js +3 -2
- package/dist/home/FactsStrip.js.map +2 -2
- package/dist/home/RecentList.d.ts +4 -2
- package/dist/home/RecentList.js +3 -2
- package/dist/home/RecentList.js.map +2 -2
- package/dist/home/StartTiles.d.ts +6 -1
- package/dist/home/StartTiles.js +55 -33
- package/dist/home/StartTiles.js.map +2 -2
- package/dist/home/index.cjs +62 -57
- package/dist/home/index.d.ts +1 -1
- package/dist/home/index.js +2 -1
- package/dist/home/index.js.map +2 -2
- package/dist/home/sections.d.ts +5 -0
- package/dist/home/sections.js +7 -0
- package/dist/home/sections.js.map +2 -2
- package/dist/index.cjs +339 -337
- package/dist/index.cjs.map +1 -1
- package/dist/pages/index.cjs +635 -157
- package/dist/pages/index.cjs.map +1 -1
- package/dist/settings/index.cjs +170 -169
- package/dist/shell/index.cjs +35 -34
- package/dist/studio/index.cjs +12 -12
- package/dist/styles.css +1 -1
- package/dist/workflow-canvas/index.cjs +33 -29
- package/dist/workflow-canvas/index.cjs.map +1 -1
- package/dist/workspaces/index.cjs +49 -47
- package/dist/workspaces/index.cjs.map +1 -1
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
- package/dist/DocumentReviewCard-5W2QQWKA.cjs.map +0 -1
- package/dist/FilesViewerDialog-63QUTG4L.cjs.map +0 -1
- package/dist/WorkspaceTableView-2QP2HJLK.cjs.map +0 -1
- package/dist/ai-ODGRIL6Y.cjs.map +0 -1
- package/dist/chunk-4I2PCP7O.cjs.map +0 -1
- package/dist/chunk-4ZR4O5SP.cjs.map +0 -1
- package/dist/chunk-A5SKK3CU.cjs.map +0 -1
- package/dist/chunk-CVVQHFLR.cjs.map +0 -1
- package/dist/chunk-DUNXLT63.cjs.map +0 -1
- package/dist/chunk-E6BM5ENI.cjs.map +0 -1
- package/dist/chunk-HNLNRAEU.cjs.map +0 -1
- package/dist/chunk-JCFXS336.cjs.map +0 -1
- package/dist/chunk-KRQCUVH7.cjs.map +0 -1
- package/dist/chunk-KWJW5TMH.cjs.map +0 -1
- package/dist/chunk-NNZFZYTI.cjs.map +0 -1
- package/dist/chunk-NUFZFWHZ.cjs.map +0 -1
- package/dist/chunk-UM3EWCDE.cjs.map +0 -1
- package/dist/chunk-VSDD5TH5.cjs.map +0 -1
- package/dist/chunk-Z3N32LL4.cjs.map +0 -1
- package/dist/connection/workspace-dashboard/DashboardAgenda.d.ts +0 -1
- package/dist/connection/workspace-dashboard/DashboardAgenda.js.map +0 -7
- package/dist/connection/workspace-dashboard/dashboard-rows.js.map +0 -7
- /package/dist/connection/{workspace-dashboard → live-blocks}/DashboardStart.d.ts +0 -0
- /package/dist/connection/{workspace-dashboard → live-blocks}/DashboardStart.js +0 -0
- /package/dist/connection/{workspace-dashboard → live-blocks}/useDashboardAdd.d.ts +0 -0
- /package/dist/connection/{workspace-dashboard → live-blocks}/useDashboardAdd.js +0 -0
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
import { Table2 } from "lucide-react";
|
|
5
|
-
import {
|
|
5
|
+
import { useTableViewRows } from "@arbidocs/react";
|
|
6
6
|
import { Card, cn } from "@arbidocs/react/ui";
|
|
7
7
|
import { DatabaseTable } from "../../databases/DatabaseTable.js";
|
|
8
|
+
import {
|
|
9
|
+
DATABASE_COLUMN_TYPES
|
|
10
|
+
} from "../../databases/column-types.js";
|
|
8
11
|
const DEFAULT_TABLE_VIEW_BLOCK_LABELS = {
|
|
9
12
|
loading: "Loading\u2026",
|
|
10
13
|
unavailable: "This table view is not available to you.",
|
|
@@ -16,6 +19,12 @@ const toRowView = (r) => ({
|
|
|
16
19
|
titles: { ...r.titles ?? {} },
|
|
17
20
|
shared: r.shared ?? true
|
|
18
21
|
});
|
|
22
|
+
const GRID_TYPES = new Set(DATABASE_COLUMN_TYPES);
|
|
23
|
+
const isGridType = (type) => GRID_TYPES.has(type);
|
|
24
|
+
const toColumnView = (c) => ({
|
|
25
|
+
...c,
|
|
26
|
+
type: isGridType(c.type) ? c.type : "text"
|
|
27
|
+
});
|
|
19
28
|
function TableViewBlock({
|
|
20
29
|
viewId,
|
|
21
30
|
actions,
|
|
@@ -24,34 +33,25 @@ function TableViewBlock({
|
|
|
24
33
|
testId
|
|
25
34
|
}) {
|
|
26
35
|
const l = { ...DEFAULT_TABLE_VIEW_BLOCK_LABELS, ...labels };
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const rows = useDatabaseRows(databaseId, "", { view: viewId });
|
|
32
|
-
const columns = useMemo(() => {
|
|
33
|
-
const all = database.data?.columns ?? [];
|
|
34
|
-
const wanted = view.data?.spec.columns ?? [];
|
|
35
|
-
if (!wanted.length) return all;
|
|
36
|
-
const byId = new Map(all.map((c) => [c.id, c]));
|
|
37
|
-
return wanted.flatMap((id) => byId.get(id) ?? []);
|
|
38
|
-
}, [database.data, view.data]);
|
|
36
|
+
const read = useTableViewRows(viewId || null);
|
|
37
|
+
const data = read.data;
|
|
38
|
+
const columns = useMemo(() => (data?.columns ?? []).map(toColumnView), [data]);
|
|
39
|
+
const rows = useMemo(() => (data?.rows ?? []).map(toRowView), [data]);
|
|
39
40
|
let body;
|
|
40
|
-
if (
|
|
41
|
+
if (read.isError) {
|
|
41
42
|
body = /* @__PURE__ */ jsx("p", { className: "p-4 text-sm text-muted-foreground", children: l.unavailable });
|
|
42
|
-
} else if (
|
|
43
|
+
} else if (data && !data.database) {
|
|
43
44
|
body = /* @__PURE__ */ jsx("p", { className: "p-4 text-sm text-muted-foreground", children: l.notADatabase });
|
|
44
|
-
} else if (!
|
|
45
|
+
} else if (!data) {
|
|
45
46
|
body = /* @__PURE__ */ jsx("p", { className: "p-4 text-sm text-muted-foreground", children: l.loading });
|
|
46
47
|
} else {
|
|
47
48
|
body = /* @__PURE__ */ jsx(
|
|
48
49
|
DatabaseTable,
|
|
49
50
|
{
|
|
50
51
|
columns,
|
|
51
|
-
rows
|
|
52
|
+
rows,
|
|
52
53
|
readOnly: true,
|
|
53
54
|
isFiltered: true,
|
|
54
|
-
isLoading: rows.isLoading,
|
|
55
55
|
gridId: `page-view-${viewId}`,
|
|
56
56
|
height: "100%",
|
|
57
57
|
testId: testId && `${testId}-table`
|
|
@@ -67,7 +67,7 @@ function TableViewBlock({
|
|
|
67
67
|
children: [
|
|
68
68
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 border-b border-border px-4 py-2", children: [
|
|
69
69
|
/* @__PURE__ */ jsx(Table2, { className: "size-4 text-muted-foreground" }),
|
|
70
|
-
/* @__PURE__ */ jsx("span", { className: "truncate text-sm font-medium", "data-testid": testId && `${testId}-name`, children: view.
|
|
70
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-sm font-medium", "data-testid": testId && `${testId}-name`, children: data?.view.spec.name ?? "" }),
|
|
71
71
|
actions && /* @__PURE__ */ jsx("div", { className: "ml-auto flex gap-1", children: actions })
|
|
72
72
|
] }),
|
|
73
73
|
/* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1", children: body })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/connection/pages/TableViewBlock.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * `TableViewBlock`: a page's table block. It shows one saved table view of a database: the database's
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["/**\n * `TableViewBlock`: a page's table block. It shows one saved table view of a database: the view,\n * its database's columns and its rows read in one request with the view applied on the server\n * (`useTableViewRows`: its filters, sort and columns), through the database grid (`DatabaseTable`)\n * in read mode. Only what the viewer can read: a view they cannot see (someone else's private one,\n * or deleted), or whose database they cannot, says so instead.\n */\nimport { useMemo, type ReactNode } from 'react'\nimport { Table2 } from 'lucide-react'\nimport { useTableViewRows, type DatabaseColumn, type DatabaseRow } from '@arbidocs/react'\nimport { Card, cn } from '@arbidocs/react/ui'\nimport { DatabaseTable } from '../../databases/DatabaseTable'\nimport {\n DATABASE_COLUMN_TYPES,\n type DatabaseColumnType,\n type DatabaseColumnView,\n type DatabaseRowView,\n} from '../../databases/column-types'\n\nexport interface TableViewBlockLabels {\n loading: string\n /** The view is not one the viewer can see (private to someone else, or deleted). */\n unavailable: string\n /** A view of the document table (pages show database views). */\n notADatabase: string\n}\n\nexport const DEFAULT_TABLE_VIEW_BLOCK_LABELS: TableViewBlockLabels = {\n loading: 'Loading\u2026',\n unavailable: 'This table view is not available to you.',\n notADatabase: 'This view is of the documents table, which a page does not show.',\n}\n\nexport interface TableViewBlockProps {\n viewId: string\n /** Buttons in the block's corner (a page being edited). */\n actions?: ReactNode\n labels?: Partial<TableViewBlockLabels>\n className?: string\n testId?: string\n}\n\nconst toRowView = (r: DatabaseRow): DatabaseRowView => ({\n id: r.id,\n values: { ...r.values },\n titles: { ...(r.titles ?? {}) },\n shared: r.shared ?? true,\n})\n\nconst GRID_TYPES: ReadonlySet<string> = new Set<string>(DATABASE_COLUMN_TYPES)\nconst isGridType = (type: string): type is DatabaseColumnType => GRID_TYPES.has(type)\n\n/** A column as the grid reads it: a type the grid does not draw (a tag column) reads as text. */\nconst toColumnView = (c: DatabaseColumn): DatabaseColumnView => ({\n ...c,\n type: isGridType(c.type) ? c.type : 'text',\n})\n\nexport function TableViewBlock({\n viewId,\n actions,\n labels,\n className,\n testId,\n}: TableViewBlockProps) {\n const l = { ...DEFAULT_TABLE_VIEW_BLOCK_LABELS, ...labels }\n const read = useTableViewRows(viewId || null)\n const data = read.data\n const columns = useMemo(() => (data?.columns ?? []).map(toColumnView), [data])\n const rows = useMemo(() => (data?.rows ?? []).map(toRowView), [data])\n\n let body: ReactNode\n if (read.isError) {\n body = <p className=\"p-4 text-sm text-muted-foreground\">{l.unavailable}</p>\n } else if (data && !data.database) {\n body = <p className=\"p-4 text-sm text-muted-foreground\">{l.notADatabase}</p>\n } else if (!data) {\n body = <p className=\"p-4 text-sm text-muted-foreground\">{l.loading}</p>\n } else {\n body = (\n <DatabaseTable\n columns={columns}\n rows={rows}\n readOnly\n isFiltered\n gridId={`page-view-${viewId}`}\n height=\"100%\"\n testId={testId && `${testId}-table`}\n />\n )\n }\n\n return (\n <Card\n variant=\"elevated\"\n className={cn('flex h-full min-h-[12rem] flex-col overflow-hidden rounded-xl p-0', className)}\n data-testid={testId}\n >\n <div className=\"flex items-center gap-2 border-b border-border px-4 py-2\">\n <Table2 className=\"size-4 text-muted-foreground\" />\n <span className=\"truncate text-sm font-medium\" data-testid={testId && `${testId}-name`}>\n {data?.view.spec.name ?? ''}\n </span>\n {actions && <div className=\"ml-auto flex gap-1\">{actions}</div>}\n </div>\n <div className=\"min-h-0 flex-1\">{body}</div>\n </Card>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAyEW,cAyBL,YAzBK;AAlEX,SAAS,eAA+B;AACxC,SAAS,cAAc;AACvB,SAAS,wBAA+D;AACxE,SAAS,MAAM,UAAU;AACzB,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,OAIK;AAUA,MAAM,kCAAwD;AAAA,EACnE,SAAS;AAAA,EACT,aAAa;AAAA,EACb,cAAc;AAChB;AAWA,MAAM,YAAY,CAAC,OAAqC;AAAA,EACtD,IAAI,EAAE;AAAA,EACN,QAAQ,EAAE,GAAG,EAAE,OAAO;AAAA,EACtB,QAAQ,EAAE,GAAI,EAAE,UAAU,CAAC,EAAG;AAAA,EAC9B,QAAQ,EAAE,UAAU;AACtB;AAEA,MAAM,aAAkC,IAAI,IAAY,qBAAqB;AAC7E,MAAM,aAAa,CAAC,SAA6C,WAAW,IAAI,IAAI;AAGpF,MAAM,eAAe,CAAC,OAA2C;AAAA,EAC/D,GAAG;AAAA,EACH,MAAM,WAAW,EAAE,IAAI,IAAI,EAAE,OAAO;AACtC;AAEO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAwB;AACtB,QAAM,IAAI,EAAE,GAAG,iCAAiC,GAAG,OAAO;AAC1D,QAAM,OAAO,iBAAiB,UAAU,IAAI;AAC5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
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* A page's grid as it is arranged: blocks in SLOTS. The page is 4 slots wide and as many slots
|
|
3
|
+
* tall as its blocks need; every block is 1 to 4 slots wide and 1 to 4 slots tall, in any
|
|
4
|
+
* combination. A slot is 3 of the page's 12 stored columns wide and 3 rows tall
|
|
5
|
+
* (`SLOT_COLUMNS`, `SLOT_ROWS`), so a block is saved as before (`x`/`y`/`w`/`h`), each a multiple
|
|
6
|
+
* of 3. Blocks never overlap and leave no gaps above them (vertical compaction, as dashboard grids
|
|
7
|
+
* do). Moving or resizing one pushes the blocks it lands on out of its way (up into the room it
|
|
8
|
+
* left, when they fit there, else down), and the rest float up again. Pure functions of the
|
|
9
|
+
* layouts: the grid calls them on every snapped step of a drag, and saves the result on drop.
|
|
7
10
|
*/
|
|
8
11
|
import { type BlockLayout, type PageBlockKind } from '@arbidocs/react';
|
|
9
|
-
/**
|
|
10
|
-
export declare const
|
|
12
|
+
/** A slot's width, in the page's 12 columns: a quarter of the page. */
|
|
13
|
+
export declare const SLOT_COLUMNS = 3;
|
|
14
|
+
/** A slot's height, in the page's rows (`PAGE_ROW_HEIGHT` each): about as tall as it is wide. */
|
|
15
|
+
export declare const SLOT_ROWS = 3;
|
|
16
|
+
/** The page is this many slots wide; a block is at most this many slots wide or tall. */
|
|
17
|
+
export declare const SLOTS_ACROSS: number;
|
|
18
|
+
export declare const MAX_BLOCK_SLOTS = 4;
|
|
19
|
+
/** A new block's size, in slots, by kind (any size may be chosen after). */
|
|
20
|
+
export declare const DEFAULT_BLOCK_SLOTS: Record<PageBlockKind, {
|
|
11
21
|
w: number;
|
|
12
22
|
h: number;
|
|
13
23
|
}>;
|
|
24
|
+
/** A new block's layout (columns and rows), by kind. */
|
|
25
|
+
export declare function defaultLayout(kind: PageBlockKind): BlockLayout;
|
|
14
26
|
export interface GridItem {
|
|
15
27
|
id: string;
|
|
16
|
-
kind: PageBlockKind;
|
|
17
28
|
layout: BlockLayout;
|
|
18
29
|
}
|
|
19
30
|
/**
|
|
@@ -22,17 +33,38 @@ export interface GridItem {
|
|
|
22
33
|
*/
|
|
23
34
|
export declare function compactLayout<T extends GridItem>(items: readonly T[], pinned?: string): T[];
|
|
24
35
|
/**
|
|
25
|
-
* A
|
|
26
|
-
* the
|
|
36
|
+
* A layout in slot cells: each side to the nearest whole slot (1 to 4 slots wide and tall), on
|
|
37
|
+
* the page. Columns and rows in, fractions allowed (a pointer's).
|
|
38
|
+
*/
|
|
39
|
+
export declare function snapLayout(layout: BlockLayout): BlockLayout;
|
|
40
|
+
/**
|
|
41
|
+
* Blocks in slot cells: a layout saved before slots at the nearest slot size and place, then
|
|
42
|
+
* compacted. One already in slots comes back as it was.
|
|
43
|
+
*/
|
|
44
|
+
export declare function normalizeLayout<T extends GridItem>(items: readonly T[]): T[];
|
|
45
|
+
/**
|
|
46
|
+
* A block moved (its new place in columns and rows, fractions allowed) into the nearest slot cell:
|
|
47
|
+
* what it lands on makes way. `settle`: compact the block itself too (on drop); while dragging it
|
|
48
|
+
* stays where the pointer has it.
|
|
27
49
|
*/
|
|
28
50
|
export declare function moveBlock<T extends GridItem>(items: readonly T[], id: string, to: {
|
|
29
51
|
x: number;
|
|
30
52
|
y: number;
|
|
31
53
|
}, settle?: boolean): T[];
|
|
32
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* A block resized to the nearest whole slots (in columns and rows, fractions allowed): 1 to 4
|
|
56
|
+
* slots each way, no wider than the page from where it starts.
|
|
57
|
+
*/
|
|
33
58
|
export declare function resizeBlock<T extends GridItem>(items: readonly T[], id: string, to: {
|
|
34
59
|
w: number;
|
|
35
60
|
h: number;
|
|
36
61
|
}, settle?: boolean): T[];
|
|
37
|
-
/** A
|
|
62
|
+
/** A block one slot wider or narrower (`dw`), taller or shorter (`dh`), as far as it may go. */
|
|
63
|
+
export declare function stepSize<T extends GridItem>(items: readonly T[], id: string, dw: -1 | 0 | 1, dh: -1 | 0 | 1): T[];
|
|
64
|
+
/**
|
|
65
|
+
* A block one slot over: left or right a slot, or up or down past the nearest block above or
|
|
66
|
+
* below it (they swap places). Nothing that way: it stays.
|
|
67
|
+
*/
|
|
68
|
+
export declare function stepMove<T extends GridItem>(items: readonly T[], id: string, dx: -1 | 0 | 1, dy: -1 | 0 | 1): T[];
|
|
69
|
+
/** A new block: below everything, at the left, in slot cells. */
|
|
38
70
|
export declare function appendBlock<T extends GridItem>(items: readonly T[], item: T): T[];
|
|
@@ -3,16 +3,27 @@ import {
|
|
|
3
3
|
DEFAULT_BLOCK_HEIGHT,
|
|
4
4
|
PAGE_GRID_COLUMNS
|
|
5
5
|
} from "@arbidocs/react";
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
const SLOT_COLUMNS = 3;
|
|
7
|
+
const SLOT_ROWS = 3;
|
|
8
|
+
const SLOTS_ACROSS = PAGE_GRID_COLUMNS / SLOT_COLUMNS;
|
|
9
|
+
const MAX_BLOCK_SLOTS = 4;
|
|
10
|
+
const DEFAULT_BLOCK_SLOTS = {
|
|
11
|
+
metric: { w: 1, h: DEFAULT_BLOCK_HEIGHT.metric / SLOT_ROWS },
|
|
12
|
+
text: { w: 2, h: DEFAULT_BLOCK_HEIGHT.text / SLOT_ROWS },
|
|
13
|
+
chart: { w: 2, h: DEFAULT_BLOCK_HEIGHT.chart / SLOT_ROWS },
|
|
14
|
+
table: { w: 4, h: DEFAULT_BLOCK_HEIGHT.table / SLOT_ROWS },
|
|
15
|
+
document: { w: 2, h: DEFAULT_BLOCK_HEIGHT.document / SLOT_ROWS },
|
|
16
|
+
gallery: { w: 2, h: DEFAULT_BLOCK_HEIGHT.gallery / SLOT_ROWS },
|
|
17
|
+
list: { w: 2, h: DEFAULT_BLOCK_HEIGHT.list / SLOT_ROWS },
|
|
18
|
+
carousel: { w: 4, h: DEFAULT_BLOCK_HEIGHT.carousel / SLOT_ROWS },
|
|
19
|
+
agenda: { w: 2, h: DEFAULT_BLOCK_HEIGHT.agenda / SLOT_ROWS },
|
|
20
|
+
start: { w: 4, h: DEFAULT_BLOCK_HEIGHT.start / SLOT_ROWS }
|
|
13
21
|
};
|
|
22
|
+
function defaultLayout(kind) {
|
|
23
|
+
const { w, h } = DEFAULT_BLOCK_SLOTS[kind];
|
|
24
|
+
return { x: 0, y: 0, w: w * SLOT_COLUMNS, h: h * SLOT_ROWS };
|
|
25
|
+
}
|
|
14
26
|
const 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;
|
|
15
|
-
const clampInt = (n, lo, hi) => Math.min(hi, Math.max(lo, Math.round(n)));
|
|
16
27
|
function compactLayout(items, pinned) {
|
|
17
28
|
const placed = [];
|
|
18
29
|
const out = /* @__PURE__ */ new Map();
|
|
@@ -56,43 +67,76 @@ function place(items, id, layout) {
|
|
|
56
67
|
moved
|
|
57
68
|
);
|
|
58
69
|
}
|
|
70
|
+
const clampSlots = (n, lo, hi) => Math.min(hi, Math.max(lo, Math.round(n)));
|
|
71
|
+
function snapLayout(layout) {
|
|
72
|
+
const w = clampSlots(layout.w / SLOT_COLUMNS, 1, MAX_BLOCK_SLOTS);
|
|
73
|
+
const h = clampSlots(layout.h / SLOT_ROWS, 1, MAX_BLOCK_SLOTS);
|
|
74
|
+
const x = clampSlots(layout.x / SLOT_COLUMNS, 0, SLOTS_ACROSS - w);
|
|
75
|
+
const y = Math.max(0, Math.round(layout.y / SLOT_ROWS));
|
|
76
|
+
return { x: x * SLOT_COLUMNS, y: y * SLOT_ROWS, w: w * SLOT_COLUMNS, h: h * SLOT_ROWS };
|
|
77
|
+
}
|
|
78
|
+
function normalizeLayout(items) {
|
|
79
|
+
return compactLayout(items.map((i) => ({ ...i, layout: snapLayout(i.layout) })));
|
|
80
|
+
}
|
|
59
81
|
function moveBlock(items, id, to, settle = true) {
|
|
60
82
|
const item = items.find((i) => i.id === id);
|
|
61
83
|
if (!item) return [...items];
|
|
62
|
-
const layout = {
|
|
63
|
-
...item.layout,
|
|
64
|
-
x: clampInt(to.x, 0, PAGE_GRID_COLUMNS - item.layout.w),
|
|
65
|
-
y: Math.max(0, Math.round(to.y))
|
|
66
|
-
};
|
|
84
|
+
const layout = snapLayout({ ...item.layout, x: to.x, y: to.y });
|
|
67
85
|
const next = compactLayout(place(items, id, layout), id);
|
|
68
86
|
return settle ? compactLayout(next) : next;
|
|
69
87
|
}
|
|
70
88
|
function resizeBlock(items, id, to, settle = true) {
|
|
71
89
|
const item = items.find((i) => i.id === id);
|
|
72
90
|
if (!item) return [...items];
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
to.w,
|
|
78
|
-
Math.min(min.w, PAGE_GRID_COLUMNS - item.layout.x),
|
|
79
|
-
PAGE_GRID_COLUMNS - item.layout.x
|
|
80
|
-
),
|
|
81
|
-
h: Math.max(min.h, Math.round(to.h))
|
|
82
|
-
};
|
|
91
|
+
const room = SLOTS_ACROSS - item.layout.x / SLOT_COLUMNS;
|
|
92
|
+
const w = clampSlots(to.w / SLOT_COLUMNS, 1, Math.min(MAX_BLOCK_SLOTS, room));
|
|
93
|
+
const h = clampSlots(to.h / SLOT_ROWS, 1, MAX_BLOCK_SLOTS);
|
|
94
|
+
const layout = { ...item.layout, w: w * SLOT_COLUMNS, h: h * SLOT_ROWS };
|
|
83
95
|
const next = compactLayout(place(items, id, layout), id);
|
|
84
96
|
return settle ? compactLayout(next) : next;
|
|
85
97
|
}
|
|
98
|
+
function stepSize(items, id, dw, dh) {
|
|
99
|
+
const item = items.find((i) => i.id === id);
|
|
100
|
+
if (!item) return [...items];
|
|
101
|
+
return resizeBlock(items, id, {
|
|
102
|
+
w: item.layout.w + dw * SLOT_COLUMNS,
|
|
103
|
+
h: item.layout.h + dh * SLOT_ROWS
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function stepMove(items, id, dx, dy) {
|
|
107
|
+
const item = items.find((i) => i.id === id);
|
|
108
|
+
if (!item) return [...items];
|
|
109
|
+
const at = item.layout;
|
|
110
|
+
if (dx) return moveBlock(items, id, { x: at.x + dx * SLOT_COLUMNS, y: at.y });
|
|
111
|
+
if (!dy) return [...items];
|
|
112
|
+
const sameColumns = (b) => b.x < at.x + at.w && at.x < b.x + b.w;
|
|
113
|
+
const others = items.filter((i) => i.id !== id && sameColumns(i.layout)).map((i) => i.layout);
|
|
114
|
+
if (dy > 0) {
|
|
115
|
+
const below = others.filter((b) => b.y >= at.y + at.h).sort((a, b) => a.y - b.y)[0];
|
|
116
|
+
return below ? moveBlock(items, id, { x: at.x, y: below.y + below.h - at.h }) : [...items];
|
|
117
|
+
}
|
|
118
|
+
const above = others.filter((b) => b.y + b.h <= at.y).sort((a, b) => b.y - a.y)[0];
|
|
119
|
+
return above ? moveBlock(items, id, { x: at.x, y: above.y }) : [...items];
|
|
120
|
+
}
|
|
86
121
|
function appendBlock(items, item) {
|
|
87
122
|
const bottom = Math.max(0, ...items.map((i) => i.layout.y + i.layout.h));
|
|
88
|
-
const
|
|
89
|
-
return compactLayout([...items, { ...item, layout
|
|
123
|
+
const layout = snapLayout({ ...item.layout, x: 0, y: bottom });
|
|
124
|
+
return compactLayout([...items, { ...item, layout }]);
|
|
90
125
|
}
|
|
91
126
|
export {
|
|
92
|
-
|
|
127
|
+
DEFAULT_BLOCK_SLOTS,
|
|
128
|
+
MAX_BLOCK_SLOTS,
|
|
129
|
+
SLOTS_ACROSS,
|
|
130
|
+
SLOT_COLUMNS,
|
|
131
|
+
SLOT_ROWS,
|
|
93
132
|
appendBlock,
|
|
94
133
|
compactLayout,
|
|
134
|
+
defaultLayout,
|
|
95
135
|
moveBlock,
|
|
96
|
-
|
|
136
|
+
normalizeLayout,
|
|
137
|
+
resizeBlock,
|
|
138
|
+
snapLayout,
|
|
139
|
+
stepMove,
|
|
140
|
+
stepSize
|
|
97
141
|
};
|
|
98
142
|
//# sourceMappingURL=grid-layout.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/connection/pages/grid-layout.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * A page's grid as it is
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["/**\n * A page's grid as it is arranged: blocks in SLOTS. The page is 4 slots wide and as many slots\n * tall as its blocks need; every block is 1 to 4 slots wide and 1 to 4 slots tall, in any\n * combination. A slot is 3 of the page's 12 stored columns wide and 3 rows tall\n * (`SLOT_COLUMNS`, `SLOT_ROWS`), so a block is saved as before (`x`/`y`/`w`/`h`), each a multiple\n * of 3. Blocks never overlap and leave no gaps above them (vertical compaction, as dashboard grids\n * do). Moving or resizing one pushes the blocks it lands on out of its way (up into the room it\n * left, when they fit there, else down), and the rest float up again. Pure functions of the\n * layouts: the grid calls them on every snapped step of a drag, and saves the result on drop.\n */\nimport {\n DEFAULT_BLOCK_HEIGHT,\n PAGE_GRID_COLUMNS,\n type BlockLayout,\n type PageBlockKind,\n} from '@arbidocs/react'\n\n/** A slot's width, in the page's 12 columns: a quarter of the page. */\nexport const SLOT_COLUMNS = 3\n/** A slot's height, in the page's rows (`PAGE_ROW_HEIGHT` each): about as tall as it is wide. */\nexport const SLOT_ROWS = 3\n/** The page is this many slots wide; a block is at most this many slots wide or tall. */\nexport const SLOTS_ACROSS = PAGE_GRID_COLUMNS / SLOT_COLUMNS\nexport const MAX_BLOCK_SLOTS = 4\n\n/** A new block's size, in slots, by kind (any size may be chosen after). */\nexport const DEFAULT_BLOCK_SLOTS: Record<PageBlockKind, { w: number; h: number }> = {\n metric: { w: 1, h: DEFAULT_BLOCK_HEIGHT.metric / SLOT_ROWS },\n text: { w: 2, h: DEFAULT_BLOCK_HEIGHT.text / SLOT_ROWS },\n chart: { w: 2, h: DEFAULT_BLOCK_HEIGHT.chart / SLOT_ROWS },\n table: { w: 4, h: DEFAULT_BLOCK_HEIGHT.table / SLOT_ROWS },\n document: { w: 2, h: DEFAULT_BLOCK_HEIGHT.document / SLOT_ROWS },\n gallery: { w: 2, h: DEFAULT_BLOCK_HEIGHT.gallery / SLOT_ROWS },\n list: { w: 2, h: DEFAULT_BLOCK_HEIGHT.list / SLOT_ROWS },\n carousel: { w: 4, h: DEFAULT_BLOCK_HEIGHT.carousel / SLOT_ROWS },\n agenda: { w: 2, h: DEFAULT_BLOCK_HEIGHT.agenda / SLOT_ROWS },\n start: { w: 4, h: DEFAULT_BLOCK_HEIGHT.start / SLOT_ROWS },\n}\n\n/** A new block's layout (columns and rows), by kind. */\nexport function defaultLayout(kind: PageBlockKind): BlockLayout {\n const { w, h } = DEFAULT_BLOCK_SLOTS[kind]\n return { x: 0, y: 0, w: w * SLOT_COLUMNS, h: h * SLOT_ROWS }\n}\n\nexport interface GridItem {\n id: string\n layout: BlockLayout\n}\n\nconst overlaps = (a: BlockLayout, b: BlockLayout) =>\n a.x < b.x + b.w && b.x < a.x + a.w && a.y < b.y + b.h && b.y < a.y + a.h\n\n/**\n * Float every block up as far as it goes, top to bottom (left to right in a row), never onto\n * another. `pinned` stays where it is (the block being dragged): the others settle around it.\n */\nexport function compactLayout<T extends GridItem>(items: readonly T[], pinned?: string): T[] {\n const placed: BlockLayout[] = []\n const out = new Map<string, T>()\n const fixed = items.find((i) => i.id === pinned)\n if (fixed) {\n placed.push(fixed.layout)\n out.set(fixed.id, fixed)\n }\n const order = items\n .filter((i) => i.id !== pinned)\n .sort((a, b) => a.layout.y - b.layout.y || a.layout.x - b.layout.x)\n for (const item of order) {\n const layout = { ...item.layout }\n while (placed.some((p) => overlaps(p, layout))) layout.y += 1\n while (layout.y > 0 && !placed.some((p) => overlaps(p, { ...layout, y: layout.y - 1 })))\n layout.y -= 1\n placed.push(layout)\n out.set(item.id, { ...item, layout })\n }\n return items.map((i) => out.get(i.id) ?? i)\n}\n\n/** Push every block that overlaps `mover` out of its way: up into room it fits, else below it. */\nfunction pushAway<T extends GridItem>(items: T[], mover: T): T[] {\n let next = items\n const others = () => next.filter((i) => i.id !== mover.id)\n for (const hit of others().sort((a, b) => a.layout.y - b.layout.y)) {\n const current = next.find((i) => i.id === hit.id)\n if (!current || !overlaps(current.layout, mover.layout)) continue\n const above = { ...current.layout, y: mover.layout.y - current.layout.h }\n const fitsAbove =\n above.y >= 0 && !next.some((i) => i.id !== current.id && overlaps(i.layout, above))\n const layout = fitsAbove ? above : { ...current.layout, y: mover.layout.y + mover.layout.h }\n const moved = { ...current, layout }\n next = next.map((i) => (i.id === moved.id ? moved : i))\n // A block pushed down pushes what it now lands on (the mover keeps its place).\n if (!fitsAbove) next = pushAway(next, moved).map((i) => (i.id === mover.id ? mover : i))\n }\n return next\n}\n\nfunction place<T extends GridItem>(items: readonly T[], id: string, layout: BlockLayout): T[] {\n const mover = items.find((i) => i.id === id)\n if (!mover) return [...items]\n const moved = { ...mover, layout }\n return pushAway(\n items.map((i) => (i.id === id ? moved : i)),\n moved\n )\n}\n\nconst clampSlots = (n: number, lo: number, hi: number) => Math.min(hi, Math.max(lo, Math.round(n)))\n\n/**\n * A layout in slot cells: each side to the nearest whole slot (1 to 4 slots wide and tall), on\n * the page. Columns and rows in, fractions allowed (a pointer's).\n */\nexport function snapLayout(layout: BlockLayout): BlockLayout {\n const w = clampSlots(layout.w / SLOT_COLUMNS, 1, MAX_BLOCK_SLOTS)\n const h = clampSlots(layout.h / SLOT_ROWS, 1, MAX_BLOCK_SLOTS)\n const x = clampSlots(layout.x / SLOT_COLUMNS, 0, SLOTS_ACROSS - w)\n const y = Math.max(0, Math.round(layout.y / SLOT_ROWS))\n return { x: x * SLOT_COLUMNS, y: y * SLOT_ROWS, w: w * SLOT_COLUMNS, h: h * SLOT_ROWS }\n}\n\n/**\n * Blocks in slot cells: a layout saved before slots at the nearest slot size and place, then\n * compacted. One already in slots comes back as it was.\n */\nexport function normalizeLayout<T extends GridItem>(items: readonly T[]): T[] {\n return compactLayout(items.map((i) => ({ ...i, layout: snapLayout(i.layout) })))\n}\n\n/**\n * A block moved (its new place in columns and rows, fractions allowed) into the nearest slot cell:\n * what it lands on makes way. `settle`: compact the block itself too (on drop); while dragging it\n * stays where the pointer has it.\n */\nexport function moveBlock<T extends GridItem>(\n items: readonly T[],\n id: string,\n to: { x: number; y: number },\n settle = true\n): T[] {\n const item = items.find((i) => i.id === id)\n if (!item) return [...items]\n const layout = snapLayout({ ...item.layout, x: to.x, y: to.y })\n const next = compactLayout(place(items, id, layout), id)\n return settle ? compactLayout(next) : next\n}\n\n/**\n * A block resized to the nearest whole slots (in columns and rows, fractions allowed): 1 to 4\n * slots each way, no wider than the page from where it starts.\n */\nexport function resizeBlock<T extends GridItem>(\n items: readonly T[],\n id: string,\n to: { w: number; h: number },\n settle = true\n): T[] {\n const item = items.find((i) => i.id === id)\n if (!item) return [...items]\n const room = SLOTS_ACROSS - item.layout.x / SLOT_COLUMNS\n const w = clampSlots(to.w / SLOT_COLUMNS, 1, Math.min(MAX_BLOCK_SLOTS, room))\n const h = clampSlots(to.h / SLOT_ROWS, 1, MAX_BLOCK_SLOTS)\n const layout = { ...item.layout, w: w * SLOT_COLUMNS, h: h * SLOT_ROWS }\n const next = compactLayout(place(items, id, layout), id)\n return settle ? compactLayout(next) : next\n}\n\n/** A block one slot wider or narrower (`dw`), taller or shorter (`dh`), as far as it may go. */\nexport function stepSize<T extends GridItem>(\n items: readonly T[],\n id: string,\n dw: -1 | 0 | 1,\n dh: -1 | 0 | 1\n): T[] {\n const item = items.find((i) => i.id === id)\n if (!item) return [...items]\n return resizeBlock(items, id, {\n w: item.layout.w + dw * SLOT_COLUMNS,\n h: item.layout.h + dh * SLOT_ROWS,\n })\n}\n\n/**\n * A block one slot over: left or right a slot, or up or down past the nearest block above or\n * below it (they swap places). Nothing that way: it stays.\n */\nexport function stepMove<T extends GridItem>(\n items: readonly T[],\n id: string,\n dx: -1 | 0 | 1,\n dy: -1 | 0 | 1\n): T[] {\n const item = items.find((i) => i.id === id)\n if (!item) return [...items]\n const at = item.layout\n if (dx) return moveBlock(items, id, { x: at.x + dx * SLOT_COLUMNS, y: at.y })\n if (!dy) return [...items]\n const sameColumns = (b: BlockLayout) => b.x < at.x + at.w && at.x < b.x + b.w\n const others = items.filter((i) => i.id !== id && sameColumns(i.layout)).map((i) => i.layout)\n if (dy > 0) {\n const below = others.filter((b) => b.y >= at.y + at.h).sort((a, b) => a.y - b.y)[0]\n return below ? moveBlock(items, id, { x: at.x, y: below.y + below.h - at.h }) : [...items]\n }\n const above = others.filter((b) => b.y + b.h <= at.y).sort((a, b) => b.y - a.y)[0]\n return above ? moveBlock(items, id, { x: at.x, y: above.y }) : [...items]\n}\n\n/** A new block: below everything, at the left, in slot cells. */\nexport function appendBlock<T extends GridItem>(items: readonly T[], item: T): T[] {\n const bottom = Math.max(0, ...items.map((i) => i.layout.y + i.layout.h))\n const layout = snapLayout({ ...item.layout, x: 0, y: bottom })\n return compactLayout([...items, { ...item, layout }])\n}\n"],
|
|
5
|
+
"mappings": ";AAUA;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AAGA,MAAM,eAAe;AAErB,MAAM,YAAY;AAElB,MAAM,eAAe,oBAAoB;AACzC,MAAM,kBAAkB;AAGxB,MAAM,sBAAuE;AAAA,EAClF,QAAQ,EAAE,GAAG,GAAG,GAAG,qBAAqB,SAAS,UAAU;AAAA,EAC3D,MAAM,EAAE,GAAG,GAAG,GAAG,qBAAqB,OAAO,UAAU;AAAA,EACvD,OAAO,EAAE,GAAG,GAAG,GAAG,qBAAqB,QAAQ,UAAU;AAAA,EACzD,OAAO,EAAE,GAAG,GAAG,GAAG,qBAAqB,QAAQ,UAAU;AAAA,EACzD,UAAU,EAAE,GAAG,GAAG,GAAG,qBAAqB,WAAW,UAAU;AAAA,EAC/D,SAAS,EAAE,GAAG,GAAG,GAAG,qBAAqB,UAAU,UAAU;AAAA,EAC7D,MAAM,EAAE,GAAG,GAAG,GAAG,qBAAqB,OAAO,UAAU;AAAA,EACvD,UAAU,EAAE,GAAG,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K,GAAG;AACV,UAAM,QAAQ,OAAO,OAAO,CAAC,MAAM,EAAE,KAAK,GAAG,IAAI,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AAClF,WAAO,QAAQ,UAAU,OAAO,IAAI,EAAE,GAAG,GAAG,GAAG,GAAG,MAAM,IAAI,MAAM,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,KAAK;AAAA,EAC3F;AACA,QAAM,QAAQ,OAAO,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AACjF,SAAO,QAAQ,UAAU,OAAO,IAAI,EAAE,GAAG,GAAG,GAAG,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,GAAG,KAAK;AAC1E;AAGO,SAAS,YAAgC,OAAqB,MAAc;AACjF,QAAM,SAAS,KAAK,IAAI,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,OAAO,IAAI,EAAE,OAAO,CAAC,CAAC;AACvE,QAAM,SAAS,WAAW,EAAE,GAAG,KAAK,QAAQ,GAAG,GAAG,GAAG,OAAO,CAAC;AAC7D,SAAO,cAAc,CAAC,GAAG,OAAO,EAAE,GAAG,MAAM,OAAO,CAAC,CAAC;AACtD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,8 +2,10 @@ export { ConnectedPagesPage, type ConnectedPagesPageProps } from './ConnectedPag
|
|
|
2
2
|
export { DEFAULT_PAGES_PAGE_LABELS, type PagesPageLabels } from './labels';
|
|
3
3
|
export { BlockEditor, DEFAULT_BLOCK_EDITOR_LABELS, type BlockEditorLabels, type BlockEditorProps, } from './BlockEditor';
|
|
4
4
|
export { PageBlockView, type PageBlockViewProps } from './PageBlockView';
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
5
|
+
export { DEFAULT_LIVE_BLOCK_EDITOR_LABELS, LiveBlockEditor, type LiveBlockEditorLabels, type LiveBlockEditorProps, } from './LiveBlockEditor';
|
|
6
|
+
export { PAGE_TEMPLATES, pageOfTemplate } from './page-templates';
|
|
7
|
+
export { DEFAULT_EDITABLE_PAGE_GRID_LABELS, EditablePageGrid, NO_DRAG, type EditablePageGridLabels, type EditablePageGridProps, } from './EditablePageGrid';
|
|
8
|
+
export { DEFAULT_BLOCK_SLOTS, MAX_BLOCK_SLOTS, SLOT_COLUMNS, SLOT_ROWS, SLOTS_ACROSS, appendBlock, compactLayout, defaultLayout, moveBlock, normalizeLayout, resizeBlock, snapLayout, stepMove, stepSize, type GridItem, } from './grid-layout';
|
|
7
9
|
export { PAGE_ROW_HEIGHT, PageCell, PageGrid, inReadingOrder, type PageGridProps } from './PageGrid';
|
|
8
10
|
export { DEFAULT_TABLE_VIEW_BLOCK_LABELS, TableViewBlock, type TableViewBlockLabels, type TableViewBlockProps, } from './TableViewBlock';
|
|
9
11
|
export { DEFAULT_VIEW_PICKER_LABELS, ViewPicker, type ViewPickerLabels, type ViewPickerProps, } from './ViewPicker';
|
|
@@ -6,16 +6,31 @@ import {
|
|
|
6
6
|
DEFAULT_BLOCK_EDITOR_LABELS
|
|
7
7
|
} from "./BlockEditor.js";
|
|
8
8
|
import { PageBlockView } from "./PageBlockView.js";
|
|
9
|
+
import {
|
|
10
|
+
DEFAULT_LIVE_BLOCK_EDITOR_LABELS,
|
|
11
|
+
LiveBlockEditor
|
|
12
|
+
} from "./LiveBlockEditor.js";
|
|
13
|
+
import { PAGE_TEMPLATES, pageOfTemplate } from "./page-templates.js";
|
|
9
14
|
import {
|
|
10
15
|
DEFAULT_EDITABLE_PAGE_GRID_LABELS,
|
|
11
|
-
EditablePageGrid
|
|
16
|
+
EditablePageGrid,
|
|
17
|
+
NO_DRAG
|
|
12
18
|
} from "./EditablePageGrid.js";
|
|
13
19
|
import {
|
|
14
|
-
|
|
20
|
+
DEFAULT_BLOCK_SLOTS,
|
|
21
|
+
MAX_BLOCK_SLOTS,
|
|
22
|
+
SLOT_COLUMNS,
|
|
23
|
+
SLOT_ROWS,
|
|
24
|
+
SLOTS_ACROSS,
|
|
15
25
|
appendBlock,
|
|
16
26
|
compactLayout,
|
|
27
|
+
defaultLayout,
|
|
17
28
|
moveBlock,
|
|
18
|
-
|
|
29
|
+
normalizeLayout,
|
|
30
|
+
resizeBlock,
|
|
31
|
+
snapLayout,
|
|
32
|
+
stepMove,
|
|
33
|
+
stepSize
|
|
19
34
|
} from "./grid-layout.js";
|
|
20
35
|
import { PAGE_ROW_HEIGHT, PageCell, PageGrid, inReadingOrder } from "./PageGrid.js";
|
|
21
36
|
import {
|
|
@@ -40,9 +55,11 @@ export {
|
|
|
40
55
|
BlockEditor,
|
|
41
56
|
ConnectedPagesPage,
|
|
42
57
|
DEFAULT_BLOCK_EDITOR_LABELS,
|
|
58
|
+
DEFAULT_BLOCK_SLOTS,
|
|
43
59
|
DEFAULT_DOCUMENTS_PICKER_LABELS,
|
|
44
60
|
DEFAULT_DOCUMENT_BLOCK_LABELS,
|
|
45
61
|
DEFAULT_EDITABLE_PAGE_GRID_LABELS,
|
|
62
|
+
DEFAULT_LIVE_BLOCK_EDITOR_LABELS,
|
|
46
63
|
DEFAULT_PAGES_PAGE_LABELS,
|
|
47
64
|
DEFAULT_TABLE_VIEW_BLOCK_LABELS,
|
|
48
65
|
DEFAULT_VIEW_PICKER_LABELS,
|
|
@@ -51,17 +68,29 @@ export {
|
|
|
51
68
|
DocumentsPicker,
|
|
52
69
|
EditablePageGrid,
|
|
53
70
|
GalleryBlockView,
|
|
54
|
-
|
|
71
|
+
LiveBlockEditor,
|
|
72
|
+
MAX_BLOCK_SLOTS,
|
|
73
|
+
NO_DRAG,
|
|
55
74
|
PAGE_ROW_HEIGHT,
|
|
75
|
+
PAGE_TEMPLATES,
|
|
56
76
|
PageBlockView,
|
|
57
77
|
PageCell,
|
|
58
78
|
PageGrid,
|
|
79
|
+
SLOTS_ACROSS,
|
|
80
|
+
SLOT_COLUMNS,
|
|
81
|
+
SLOT_ROWS,
|
|
59
82
|
TableViewBlock,
|
|
60
83
|
ViewPicker,
|
|
61
84
|
appendBlock,
|
|
62
85
|
compactLayout,
|
|
86
|
+
defaultLayout,
|
|
63
87
|
inReadingOrder,
|
|
64
88
|
moveBlock,
|
|
65
|
-
|
|
89
|
+
normalizeLayout,
|
|
90
|
+
pageOfTemplate,
|
|
91
|
+
resizeBlock,
|
|
92
|
+
snapLayout,
|
|
93
|
+
stepMove,
|
|
94
|
+
stepSize
|
|
66
95
|
};
|
|
67
96
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/connection/pages/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { ConnectedPagesPage, type ConnectedPagesPageProps } from './ConnectedPagesPage'\nexport { DEFAULT_PAGES_PAGE_LABELS, type PagesPageLabels } from './labels'\nexport {\n BlockEditor,\n DEFAULT_BLOCK_EDITOR_LABELS,\n type BlockEditorLabels,\n type BlockEditorProps,\n} from './BlockEditor'\nexport { PageBlockView, type PageBlockViewProps } from './PageBlockView'\nexport {\n DEFAULT_EDITABLE_PAGE_GRID_LABELS,\n EditablePageGrid,\n type EditablePageGridLabels,\n type EditablePageGridProps,\n} from './EditablePageGrid'\nexport {\n
|
|
5
|
-
"mappings": ";AAAA,SAAS,0BAAwD;AACjE,SAAS,iCAAuD;AAChE;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP,SAAS,qBAA8C;AACvD;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,iBAAiB,UAAU,UAAU,sBAA0C;AACxF;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAGK;",
|
|
4
|
+
"sourcesContent": ["export { ConnectedPagesPage, type ConnectedPagesPageProps } from './ConnectedPagesPage'\nexport { DEFAULT_PAGES_PAGE_LABELS, type PagesPageLabels } from './labels'\nexport {\n BlockEditor,\n DEFAULT_BLOCK_EDITOR_LABELS,\n type BlockEditorLabels,\n type BlockEditorProps,\n} from './BlockEditor'\nexport { PageBlockView, type PageBlockViewProps } from './PageBlockView'\nexport {\n DEFAULT_LIVE_BLOCK_EDITOR_LABELS,\n LiveBlockEditor,\n type LiveBlockEditorLabels,\n type LiveBlockEditorProps,\n} from './LiveBlockEditor'\nexport { PAGE_TEMPLATES, pageOfTemplate } from './page-templates'\nexport {\n DEFAULT_EDITABLE_PAGE_GRID_LABELS,\n EditablePageGrid,\n NO_DRAG,\n type EditablePageGridLabels,\n type EditablePageGridProps,\n} from './EditablePageGrid'\nexport {\n DEFAULT_BLOCK_SLOTS,\n MAX_BLOCK_SLOTS,\n SLOT_COLUMNS,\n SLOT_ROWS,\n SLOTS_ACROSS,\n appendBlock,\n compactLayout,\n defaultLayout,\n moveBlock,\n normalizeLayout,\n resizeBlock,\n snapLayout,\n stepMove,\n stepSize,\n type GridItem,\n} from './grid-layout'\nexport { PAGE_ROW_HEIGHT, PageCell, PageGrid, inReadingOrder, type PageGridProps } from './PageGrid'\nexport {\n DEFAULT_TABLE_VIEW_BLOCK_LABELS,\n TableViewBlock,\n type TableViewBlockLabels,\n type TableViewBlockProps,\n} from './TableViewBlock'\nexport {\n DEFAULT_VIEW_PICKER_LABELS,\n ViewPicker,\n type ViewPickerLabels,\n type ViewPickerProps,\n} from './ViewPicker'\nexport {\n DEFAULT_DOCUMENT_BLOCK_LABELS,\n DocumentBlockView,\n DocumentReadView,\n GalleryBlockView,\n type DocumentBlockLabels,\n type DocumentBlockViewProps,\n type DocumentReadViewProps,\n type GalleryBlockViewProps,\n} from './DocumentBlocks'\nexport {\n DEFAULT_DOCUMENTS_PICKER_LABELS,\n DocumentsPicker,\n type DocumentsPickerLabels,\n type DocumentsPickerProps,\n} from './DocumentsPicker'\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,0BAAwD;AACjE,SAAS,iCAAuD;AAChE;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP,SAAS,qBAA8C;AACvD;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP,SAAS,gBAAgB,sBAAsB;AAC/C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,iBAAiB,UAAU,UAAU,sBAA0C;AACxF;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAGK;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -34,7 +34,11 @@ const DEFAULT_PAGES_PAGE_LABELS = {
|
|
|
34
34
|
text: "Text",
|
|
35
35
|
table: "Table",
|
|
36
36
|
document: "Document",
|
|
37
|
-
gallery: "Gallery"
|
|
37
|
+
gallery: "Gallery",
|
|
38
|
+
list: "Recent list",
|
|
39
|
+
carousel: "Carousel",
|
|
40
|
+
agenda: "Agenda",
|
|
41
|
+
start: "Start"
|
|
38
42
|
},
|
|
39
43
|
editBlock: "Edit the block",
|
|
40
44
|
removeBlock: "Remove the block",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/connection/pages/labels.ts"],
|
|
4
|
-
"sourcesContent": ["import type { PageBlockKind } from '@arbidocs/react'\n\n/** The words of `ConnectedPagesPage` (a host passes its own through `labels`). */\nexport interface PagesPageLabels {\n title: string\n description: string\n /** The list's two parts: the viewer's own pages, and the workspace's shared ones. */\n mine: string\n shared: string\n newPage: string\n blank: string\n untitled: string\n empty: string\n emptyDescription: string\n /** Nothing in one part of the list. */\n noneMine: string\n noneShared: string\n loadError: string\n /** Offline with no pages cached. */\n offline: string\n retry: string\n blocks: (count: number) => string\n back: string\n edit: string\n /** The \"\u2026\" menu of an open page (its rarer actions: delete). */\n more: string\n delete: string\n confirmDelete: (title: string) => string\n deleteFailed: string\n /** Leaving the editor with changes not saved. */\n confirmDiscard: string\n save: string\n saving: string\n cancel: string\n pageTitle: string\n pageDescription: string\n addBlock: string\n kinds: Record<PageBlockKind, string>\n editBlock: string\n removeBlock: string\n noBlocks: string\n saved: string\n saveFailed: string\n /** The one-way share button of an open page, and what it asks first. */\n share: string\n confirmShare: (title: string) => string\n sharedBadge: string\n privateBadge: string\n sharedDone: string\n shareFailed: string\n /** A dashboard from before pages, not yet saved into a workspace. */\n legacy: string\n /** The figure of a new page made from a database (\"Chart this\"): its rows. */\n rows: string\n /** Saved pages that could not be opened (sealed under another key, or damaged). */\n unreadable: (count: number) => string\n deleteUnreadable: string\n confirmDeleteUnreadable: (count: number) => string\n}\n\nexport const DEFAULT_PAGES_PAGE_LABELS: PagesPageLabels = {\n title: 'Pages',\n description:\n 'Charts, figures, notes and tables from your documents, threads, tags, facts, workflows, AI usage and databases.',\n mine: 'Mine',\n shared: 'Shared',\n newPage: 'New page',\n blank: 'Blank page',\n untitled: 'Untitled page',\n empty: 'No pages yet',\n emptyDescription:\n 'Start from a template or a blank page, then add charts, figures, text and tables.',\n noneMine: 'You have no pages of your own here.',\n noneShared: 'No page is shared with this workspace yet.',\n loadError: 'The pages could not be loaded.',\n offline: 'You are offline. Your pages show when the connection is back.',\n retry: 'Try again',\n blocks: (count) => `${count} ${count === 1 ? 'block' : 'blocks'}`,\n back: 'All pages',\n edit: 'Edit',\n more: 'More page actions',\n delete: 'Delete',\n confirmDelete: (title) => `Delete the page \u201C${title}\u201D? Its blocks go with it.`,\n deleteFailed: 'The page could not be deleted',\n confirmDiscard: 'Discard the changes to this page?',\n save: 'Save',\n saving: 'Saving\u2026',\n cancel: 'Cancel',\n pageTitle: 'Name',\n pageDescription: 'Description',\n addBlock: 'Add a block',\n kinds: {\n chart: 'Chart',\n metric: 'Figure',\n text: 'Text',\n table: 'Table',\n document: 'Document',\n gallery: 'Gallery',\n },\n editBlock: 'Edit the block',\n removeBlock: 'Remove the block',\n noBlocks: 'No blocks yet. Add one to start.',\n saved: 'Page saved',\n saveFailed: 'The page could not be saved',\n share: 'Share with the workspace',\n confirmShare: (title) =>\n `Share \u201C${title}\u201D with the workspace? Every member will see it. Sharing cannot be undone: once shared, only a workspace owner can delete it.`,\n sharedBadge: 'Shared with the workspace',\n privateBadge: 'Private',\n sharedDone: 'The page is shared with the workspace',\n shareFailed: 'The page could not be shared',\n legacy: 'A dashboard from before pages: saving it puts it in this workspace.',\n rows: 'Rows',\n unreadable: (count) => `${count} saved ${count === 1 ? 'page' : 'pages'} could not be opened.`,\n deleteUnreadable: 'Delete',\n confirmDeleteUnreadable: (count) =>\n `Delete the ${count === 1 ? 'page' : `${count} pages`} that could not be opened?`,\n}\n"],
|
|
5
|
-
"mappings": ";AA4DO,MAAM,4BAA6C;AAAA,EACxD,OAAO;AAAA,EACP,aACE;AAAA,EACF,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,OAAO;AAAA,EACP,UAAU;AAAA,EACV,OAAO;AAAA,EACP,kBACE;AAAA,EACF,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ,CAAC,UAAU,GAAG,KAAK,IAAI,UAAU,IAAI,UAAU,QAAQ;AAAA,EAC/D,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,eAAe,CAAC,UAAU,yBAAoB,KAAK;AAAA,EACnD,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,UAAU;AAAA,EACV,OAAO;AAAA,IACL,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,OAAO;AAAA,IACP,UAAU;AAAA,IACV,SAAS;AAAA,
|
|
4
|
+
"sourcesContent": ["import type { PageBlockKind } from '@arbidocs/react'\n\n/** The words of `ConnectedPagesPage` (a host passes its own through `labels`). */\nexport interface PagesPageLabels {\n title: string\n description: string\n /** The list's two parts: the viewer's own pages, and the workspace's shared ones. */\n mine: string\n shared: string\n newPage: string\n blank: string\n untitled: string\n empty: string\n emptyDescription: string\n /** Nothing in one part of the list. */\n noneMine: string\n noneShared: string\n loadError: string\n /** Offline with no pages cached. */\n offline: string\n retry: string\n blocks: (count: number) => string\n back: string\n edit: string\n /** The \"\u2026\" menu of an open page (its rarer actions: delete). */\n more: string\n delete: string\n confirmDelete: (title: string) => string\n deleteFailed: string\n /** Leaving the editor with changes not saved. */\n confirmDiscard: string\n save: string\n saving: string\n cancel: string\n pageTitle: string\n pageDescription: string\n addBlock: string\n kinds: Record<PageBlockKind, string>\n editBlock: string\n removeBlock: string\n noBlocks: string\n saved: string\n saveFailed: string\n /** The one-way share button of an open page, and what it asks first. */\n share: string\n confirmShare: (title: string) => string\n sharedBadge: string\n privateBadge: string\n sharedDone: string\n shareFailed: string\n /** A dashboard from before pages, not yet saved into a workspace. */\n legacy: string\n /** The figure of a new page made from a database (\"Chart this\"): its rows. */\n rows: string\n /** Saved pages that could not be opened (sealed under another key, or damaged). */\n unreadable: (count: number) => string\n deleteUnreadable: string\n confirmDeleteUnreadable: (count: number) => string\n}\n\nexport const DEFAULT_PAGES_PAGE_LABELS: PagesPageLabels = {\n title: 'Pages',\n description:\n 'Charts, figures, notes and tables from your documents, threads, tags, facts, workflows, AI usage and databases.',\n mine: 'Mine',\n shared: 'Shared',\n newPage: 'New page',\n blank: 'Blank page',\n untitled: 'Untitled page',\n empty: 'No pages yet',\n emptyDescription:\n 'Start from a template or a blank page, then add charts, figures, text and tables.',\n noneMine: 'You have no pages of your own here.',\n noneShared: 'No page is shared with this workspace yet.',\n loadError: 'The pages could not be loaded.',\n offline: 'You are offline. Your pages show when the connection is back.',\n retry: 'Try again',\n blocks: (count) => `${count} ${count === 1 ? 'block' : 'blocks'}`,\n back: 'All pages',\n edit: 'Edit',\n more: 'More page actions',\n delete: 'Delete',\n confirmDelete: (title) => `Delete the page \u201C${title}\u201D? Its blocks go with it.`,\n deleteFailed: 'The page could not be deleted',\n confirmDiscard: 'Discard the changes to this page?',\n save: 'Save',\n saving: 'Saving\u2026',\n cancel: 'Cancel',\n pageTitle: 'Name',\n pageDescription: 'Description',\n addBlock: 'Add a block',\n kinds: {\n chart: 'Chart',\n metric: 'Figure',\n text: 'Text',\n table: 'Table',\n document: 'Document',\n gallery: 'Gallery',\n list: 'Recent list',\n carousel: 'Carousel',\n agenda: 'Agenda',\n start: 'Start',\n },\n editBlock: 'Edit the block',\n removeBlock: 'Remove the block',\n noBlocks: 'No blocks yet. Add one to start.',\n saved: 'Page saved',\n saveFailed: 'The page could not be saved',\n share: 'Share with the workspace',\n confirmShare: (title) =>\n `Share \u201C${title}\u201D with the workspace? Every member will see it. Sharing cannot be undone: once shared, only a workspace owner can delete it.`,\n sharedBadge: 'Shared with the workspace',\n privateBadge: 'Private',\n sharedDone: 'The page is shared with the workspace',\n shareFailed: 'The page could not be shared',\n legacy: 'A dashboard from before pages: saving it puts it in this workspace.',\n rows: 'Rows',\n unreadable: (count) => `${count} saved ${count === 1 ? 'page' : 'pages'} could not be opened.`,\n deleteUnreadable: 'Delete',\n confirmDeleteUnreadable: (count) =>\n `Delete the ${count === 1 ? 'page' : `${count} pages`} that could not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AK,QAAQ;AACzD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The starting points "New page" offers by default (`PAGE_TEMPLATES`): the workspace dashboard
|
|
3
|
+
* first (its live blocks, so a page can be the dashboard and then be changed), then the Analytics
|
|
4
|
+
* dashboards (`DASHBOARD_TEMPLATES`).
|
|
5
|
+
*/
|
|
6
|
+
import { type PageSpec } from '@arbidocs/react';
|
|
7
|
+
import { type PageTemplate } from '../dashboards/templates';
|
|
8
|
+
export declare const PAGE_TEMPLATES: readonly PageTemplate[];
|
|
9
|
+
/** The page a template makes: a dashboard's panels laid out in order, or the page itself. */
|
|
10
|
+
export declare function pageOfTemplate(template: PageTemplate): PageSpec;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { pageFromDashboard } from "@arbidocs/react";
|
|
3
|
+
import { DASHBOARD_TEMPLATES } from "../dashboards/templates.js";
|
|
4
|
+
import { WORKSPACE_DASHBOARD_PAGE } from "../live-blocks/workspace-dashboard-blocks.js";
|
|
5
|
+
const PAGE_TEMPLATES = [
|
|
6
|
+
WORKSPACE_DASHBOARD_PAGE,
|
|
7
|
+
...DASHBOARD_TEMPLATES
|
|
8
|
+
];
|
|
9
|
+
function pageOfTemplate(template) {
|
|
10
|
+
return "panels" in template ? pageFromDashboard(template) : structuredClone(template);
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
PAGE_TEMPLATES,
|
|
14
|
+
pageOfTemplate
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=page-templates.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/connection/pages/page-templates.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * The starting points \"New page\" offers by default (`PAGE_TEMPLATES`): the workspace dashboard\n * first (its live blocks, so a page can be the dashboard and then be changed), then the Analytics\n * dashboards (`DASHBOARD_TEMPLATES`).\n */\nimport { pageFromDashboard, type PageSpec } from '@arbidocs/react'\nimport { DASHBOARD_TEMPLATES, type PageTemplate } from '../dashboards/templates'\nimport { WORKSPACE_DASHBOARD_PAGE } from '../live-blocks/workspace-dashboard-blocks'\n\nexport const PAGE_TEMPLATES: readonly PageTemplate[] = [\n WORKSPACE_DASHBOARD_PAGE,\n ...DASHBOARD_TEMPLATES,\n]\n\n/** The page a template makes: a dashboard's panels laid out in order, or the page itself. */\nexport function pageOfTemplate(template: PageTemplate): PageSpec {\n return 'panels' in template ? pageFromDashboard(template) : structuredClone(template)\n}\n"],
|
|
5
|
+
"mappings": ";AAKA,SAAS,yBAAwC;AACjD,SAAS,2BAA8C;AACvD,SAAS,gCAAgC;AAElC,MAAM,iBAA0C;AAAA,EACrD;AAAA,EACA,GAAG;AACL;AAGO,SAAS,eAAe,UAAkC;AAC/D,SAAO,YAAY,WAAW,kBAAkB,QAAQ,IAAI,gBAAgB,QAAQ;AACtF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|