@protobase/ui 0.119.5 → 0.119.6
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/account/messages.d.ts +2 -2
- package/dist/activity-chart/messages.d.ts +2 -2
- package/dist/app/change-confirm/messages.d.ts +2 -2
- package/dist/app/charts/messages.d.ts +2 -2
- package/dist/app/confirm-sign-in-messages.d.ts +2 -2
- package/dist/app/conversation/message-composer.d.ts +11 -2
- package/dist/app/conversation/message-composer.js +10 -5
- package/dist/app/conversation/messages.d.ts +2 -2
- package/dist/app/conversation/thread-items.d.ts +2 -0
- package/dist/app/conversation/thread-items.js +2 -1
- package/dist/app/conversation-page/conversation-header.d.ts +15 -0
- package/dist/app/conversation-page/conversation-header.js +47 -0
- package/dist/app/conversation-page/conversation-message.d.ts +19 -0
- package/dist/app/conversation-page/conversation-message.js +35 -0
- package/dist/app/conversation-page/conversation-messages.d.ts +22 -0
- package/dist/app/conversation-page/conversation-messages.js +85 -0
- package/dist/app/conversation-page/conversation-page.d.ts +14 -0
- package/dist/app/conversation-page/conversation-page.js +69 -0
- package/dist/app/conversation-page/conversation-reads.d.ts +19 -0
- package/dist/app/conversation-page/conversation-reads.js +23 -0
- package/dist/app/conversation-page/conversation-rows.d.ts +43 -0
- package/dist/app/conversation-page/conversation-rows.js +53 -0
- package/dist/app/conversation-page/member-search.d.ts +11 -0
- package/dist/app/conversation-page/member-search.js +16 -0
- package/dist/app/conversation-page/members-title.d.ts +11 -0
- package/dist/app/conversation-page/members-title.js +34 -0
- package/dist/app/conversation-page/messages.d.ts +7 -0
- package/dist/app/conversation-page/messages.js +5 -0
- package/dist/app/conversation-page/use-new-line.d.ts +8 -0
- package/dist/app/conversation-page/use-new-line.js +18 -0
- package/dist/app/conversation-page/use-read-position.d.ts +26 -0
- package/dist/app/conversation-page/use-read-position.js +96 -0
- package/dist/app/create/messages.d.ts +2 -2
- package/dist/app/custom-section.d.ts +1 -1
- package/dist/app/delete/messages.d.ts +2 -2
- package/dist/app/displays/list-cards.d.ts +1 -1
- package/dist/app/displays/messages.d.ts +2 -2
- package/dist/app/embedded-list/messages.d.ts +2 -2
- package/dist/app/export/messages.d.ts +2 -2
- package/dist/app/field-messages.d.ts +2 -2
- package/dist/app/field-types/custom-step-container/messages.d.ts +2 -2
- package/dist/app/field-types/json/messages.d.ts +2 -2
- package/dist/app/field-types/runner-install/messages.d.ts +2 -2
- package/dist/app/field-types/widget-part.d.ts +1 -1
- package/dist/app/field-types/workflow/definition.d.ts +1 -1
- package/dist/app/field-types/workflow/messages.d.ts +2 -2
- package/dist/app/field-types/workflow-page/messages.d.ts +2 -2
- package/dist/app/field-types/workflow-run/messages.d.ts +2 -2
- package/dist/app/file-viewers/messages.d.ts +2 -2
- package/dist/app/focus/messages.d.ts +2 -2
- package/dist/app/focus/record-focus-page.d.ts +3 -1
- package/dist/app/full-area-record.d.ts +8 -1
- package/dist/app/full-area-record.js +5 -1
- package/dist/app/gallery/messages.d.ts +2 -2
- package/dist/app/hand-order/messages.d.ts +2 -2
- package/dist/app/import/messages.d.ts +2 -2
- package/dist/app/list-edit/messages.d.ts +2 -2
- package/dist/app/list-messages.d.ts +2 -2
- package/dist/app/messages.d.ts +2 -2
- package/dist/app/meta-gate-messages.d.ts +2 -2
- package/dist/app/new-version/messages.d.ts +2 -2
- package/dist/app/pages/custom-boundary.d.ts +1 -1
- package/dist/app/pages/custom-chosen.d.ts +1 -1
- package/dist/app/pages/messages.d.ts +2 -2
- package/dist/app/pages/use-layout-data.d.ts +1 -1
- package/dist/app/record-chart/messages.d.ts +2 -2
- package/dist/app/record-messages.d.ts +2 -2
- package/dist/app/record-page.js +12 -1
- package/dist/app/record-row/messages.d.ts +2 -2
- package/dist/app/related-cards/messages.d.ts +2 -2
- package/dist/app/runtime/messages.d.ts +2 -2
- package/dist/app/saved/messages.d.ts +2 -2
- package/dist/app/saved/saved-list.d.ts +1 -1
- package/dist/app/searches/messages.d.ts +2 -2
- package/dist/app/titles/member-names.d.ts +10 -0
- package/dist/app/titles/member-names.js +14 -0
- package/dist/app/titles/record-title-of.d.ts +2 -1
- package/dist/app/titles/record-title-of.js +5 -2
- package/dist/app-shell/messages.d.ts +2 -2
- package/dist/assistant-dock/messages.d.ts +2 -2
- package/dist/auth/messages.d.ts +2 -2
- package/dist/calls/messages.d.ts +2 -2
- package/dist/chat/messages.d.ts +2 -2
- package/dist/data-grid/column-spec.d.ts +1 -1
- package/dist/data-grid/messages.d.ts +2 -2
- package/dist/filter-panel/messages.d.ts +2 -2
- package/dist/format/messages.d.ts +2 -2
- package/dist/forms/messages.d.ts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/invitations/messages.d.ts +2 -2
- package/dist/live/messages.d.ts +2 -2
- package/dist/locale/en.js +5 -1
- package/dist/locale/en.json.d.ts +4 -0
- package/dist/locale/messages.d.ts +8 -0
- package/dist/locale/nl.js +5 -1
- package/dist/locale/texts-gate.d.ts +1 -1
- package/dist/mailbox/messages.d.ts +2 -2
- package/dist/mocks/customers.d.ts +1 -1
- package/dist/mocks/invoices.d.ts +2 -2
- package/dist/mocks/orders.d.ts +2 -2
- package/dist/mocks/stockMoves.d.ts +1 -1
- package/dist/notifications/bell/messages.d.ts +2 -2
- package/dist/organizations/messages.d.ts +2 -2
- package/dist/package.js +1 -1
- package/dist/plugins/before-sign-in.d.ts +1 -1
- package/dist/primitives/messages.d.ts +2 -2
- package/dist/shell/assets/{account-page-ve4BUXRh.js → account-page-BNtfocSb.js} +2 -2
- package/dist/shell/assets/app-Cfc4Mr5v.js +34 -0
- package/dist/shell/assets/{assistant-shell-KyMQvcsn.js → assistant-shell-BPyCi5kW.js} +2 -2
- package/dist/shell/assets/board-display-B41TuoWo.js +2 -0
- package/dist/shell/assets/calendar-display-63b_rkuL.js +2 -0
- package/dist/shell/assets/{call-rings-DUzC7UYz.js → call-rings-DBe0CIEa.js} +2 -2
- package/dist/shell/assets/{calls-drZLv0wW.js → calls-DwpgAZRF.js} +2 -2
- package/dist/shell/assets/{circle-alert-COV0WNyG.js → circle-alert-C9z9GbbN.js} +2 -2
- package/dist/shell/assets/{composed-page-CBJLOXNJ.js → composed-page-UB2y5c99.js} +2 -2
- package/dist/shell/assets/{composer-section-05sGMnpR.js → composer-section-CMoh0kSd.js} +2 -2
- package/dist/shell/assets/{connect-route-KBsPFlW4.js → connect-route-DRcj6Ruu.js} +2 -2
- package/dist/shell/assets/{copy-field-14Vmg95D.js → copy-field-MTVXamwX.js} +2 -2
- package/dist/shell/assets/create-route-CEfuAg9p.js +2 -0
- package/dist/shell/assets/{custom-step-container-field-D0cmhURR.js → custom-step-container-field-19o4BVGX.js} +4 -4
- package/dist/shell/assets/embedded-list-CWzU8ruS.js +3 -0
- package/dist/shell/assets/en-BLkfn3BD.js +2 -0
- package/dist/shell/assets/{export-dialog-Cz26bxgN.js → export-dialog-DHbFHvEa.js} +2 -2
- package/dist/shell/assets/export-worker-D0h27FKA.js +15 -0
- package/dist/shell/assets/{first-organization-page-C9ejBI4S.js → first-organization-page-Uc0es2bM.js} +2 -2
- package/dist/shell/assets/{graph-view-B3TE-xbG.js → graph-view-C_kd2p_w.js} +2 -2
- package/dist/shell/assets/{group-donut-BAyTgqYv.js → group-donut-w_BFP4Nu.js} +2 -2
- package/dist/shell/assets/{guest-call-page-CEcPrLXS.js → guest-call-page-D3gaOqIw.js} +3 -3
- package/dist/shell/assets/{html-viewer-DaeVR6PB.js → html-viewer-BrCIs_XH.js} +2 -2
- package/dist/shell/assets/{import-dialog-6I25EI49.js → import-dialog-DCcZNJgD.js} +2 -2
- package/dist/shell/assets/import-table-dialog-CWL7kUhP.js +2 -0
- package/dist/shell/assets/{index-CLyiQa16.js → index-CI4ggWZ9.js} +1 -1
- package/dist/shell/assets/invitations-page-CX-S9_g6.js +2 -0
- package/dist/shell/assets/{layout-grid-BTGS8Vdw.js → layout-grid-DK79NnII.js} +2 -2
- package/dist/shell/assets/{legend-item-DkIaBiD0.js → legend-item-IhWkwVRv.js} +2 -2
- package/dist/shell/assets/list-page-BJ7BwcjM.js +4 -0
- package/dist/shell/assets/{maplibre-JTZsxvhv.js → maplibre-XgWOYlHw.js} +2 -2
- package/dist/shell/assets/{markdown-content-DBVa63k_.js → markdown-content-oKb66g72.js} +2 -2
- package/dist/shell/assets/members-page-CB947V03.js +2 -0
- package/dist/shell/assets/{message-content-DzyGCvgQ.js → message-content-Cae9o0KB.js} +3 -3
- package/dist/shell/assets/messages-KWWs-PYa.js +2 -0
- package/dist/shell/assets/nl-Ozd1Th1I.js +2 -0
- package/dist/shell/assets/organization-page-Daa29-ya.js +2 -0
- package/dist/shell/assets/organizations-page-DFla8W4s.js +2 -0
- package/dist/shell/assets/parse-worker-BzKm_KiA.js +35 -0
- package/dist/shell/assets/{pending-invitation-row-DvqK-Lh5.js → pending-invitation-row-ufQDhiqy.js} +2 -2
- package/dist/shell/assets/{period-chart-Cn9bgVfB.js → period-chart-CDAaiRKi.js} +2 -2
- package/dist/shell/assets/{person-row-CSBZnBQc.js → person-row-DKpGU4lp.js} +2 -2
- package/dist/shell/assets/public-form-page-CWI8qeDR.js +2 -0
- package/dist/shell/assets/{record-lines-3DhkRSpH.js → record-lines-Dr5kvt8p.js} +2 -2
- package/dist/shell/assets/{record-map-D4rgUOwb.js → record-map-JMNMJGUZ.js} +2 -2
- package/dist/shell/assets/{record-opens-BSFQWqio.js → record-opens-iz29YMzQ.js} +2 -2
- package/dist/shell/assets/record-page-Db_9ytem.js +3 -0
- package/dist/shell/assets/{record-preview-Bdzkrw0H.js → record-preview-BCYfgSHu.js} +2 -2
- package/dist/shell/assets/{records-map-BfkBfva4.js → records-map-iNOkFYn9.js} +2 -2
- package/dist/shell/assets/render-node-D5xobkr6.js +3 -0
- package/dist/shell/assets/reorder-button-05HCaCaE.js +2 -0
- package/dist/shell/assets/{run-trace-view-Cd3DppYM.js → run-trace-view-BSrF6_Kg.js} +2 -2
- package/dist/shell/assets/{runner-install-field-CK3olYt5.js → runner-install-field-CgXWqOkx.js} +2 -2
- package/dist/shell/assets/{runtime-update-BNTp15Vo.js → runtime-update-BrM_FHvq.js} +2 -2
- package/dist/shell/assets/shared-protobase-ui-CtGq44Ix.js +1 -0
- package/dist/shell/assets/{sheet-source-DONoSDqu.js → sheet-source-BdUpw5K0.js} +3 -3
- package/dist/shell/assets/sign-in-policy-page-CavUG1RD.js +2 -0
- package/dist/shell/assets/start-block-queries-DrZpbWHB.js +2 -0
- package/dist/shell/assets/step-catalog-C49x4u-Y.js +2 -0
- package/dist/shell/assets/{step-panel-CoFQOZfZ.js → step-panel-CyZhEKcD.js} +2 -2
- package/dist/shell/assets/timeline-display-Bzg1mU4E.js +2 -0
- package/dist/shell/assets/{trash-BFH8OA7M.js → trash-CqUcV16Q.js} +2 -2
- package/dist/shell/assets/{update-set-CivHicWr.js → update-set-Da02tZfu.js} +2 -2
- package/dist/shell/assets/use-calendar-move-D93tEWOf.js +2 -0
- package/dist/shell/assets/{use-display-rows-7iLrRpz6.js → use-display-rows-BPgcYLdT.js} +2 -2
- package/dist/shell/assets/use-my-invitations-CPQ3DMUh.js +2 -0
- package/dist/shell/assets/{use-paged-search-CblCRsCd.js → use-paged-search-w0puq1Yl.js} +2 -2
- package/dist/shell/assets/{use-run-trace-vMzYYuXG.js → use-run-trace-BEM0bOMt.js} +2 -2
- package/dist/shell/assets/{use-workflow-page-Dac4wyOA.js → use-workflow-page-DpBacPYs.js} +2 -2
- package/dist/shell/assets/{use-workflow-types-Bi8u42jQ.js → use-workflow-types-Bc6SdoP6.js} +2 -2
- package/dist/shell/assets/{workflow-canvas-2owtFZNz.js → workflow-canvas-DpONgLJR.js} +4 -4
- package/dist/shell/assets/{workflow-field-Ct0HoH5Z.js → workflow-field-4i7H_hCR.js} +3 -3
- package/dist/shell/assets/{workflow-graph-editor-oAKVQAgf.js → workflow-graph-editor-BP_eCoyB.js} +2 -2
- package/dist/shell/assets/{workflow-run-field-C7ff1D9_.js → workflow-run-field-e0JGWLQd.js} +3 -3
- package/dist/shell/assets/workflow-status-field-RevEnRLG.js +2 -0
- package/dist/shell/assets/workflow-workbench-DY0czZaG.js +4 -0
- package/dist/shell/index.html +3 -3
- package/dist/shell/protobase.shell.json +2 -2
- package/dist/shell/protobase.sw.js +2 -2
- package/dist/shell-source-maps/assets/{account-page-ve4BUXRh.js.map → account-page-BNtfocSb.js.map} +1 -1
- package/dist/shell-source-maps/assets/app-Cfc4Mr5v.js.map +1 -0
- package/dist/shell-source-maps/assets/{assistant-shell-KyMQvcsn.js.map → assistant-shell-BPyCi5kW.js.map} +1 -1
- package/dist/shell-source-maps/assets/{board-display-BaMLmYUJ.js.map → board-display-B41TuoWo.js.map} +1 -1
- package/dist/shell-source-maps/assets/{calendar-display-CzQPcItV.js.map → calendar-display-63b_rkuL.js.map} +1 -1
- package/dist/shell-source-maps/assets/{call-rings-DUzC7UYz.js.map → call-rings-DBe0CIEa.js.map} +1 -1
- package/dist/shell-source-maps/assets/{calls-drZLv0wW.js.map → calls-DwpgAZRF.js.map} +1 -1
- package/dist/shell-source-maps/assets/{circle-alert-COV0WNyG.js.map → circle-alert-C9z9GbbN.js.map} +1 -1
- package/dist/shell-source-maps/assets/{composed-page-CBJLOXNJ.js.map → composed-page-UB2y5c99.js.map} +1 -1
- package/dist/shell-source-maps/assets/{composer-section-05sGMnpR.js.map → composer-section-CMoh0kSd.js.map} +1 -1
- package/dist/shell-source-maps/assets/{connect-route-KBsPFlW4.js.map → connect-route-DRcj6Ruu.js.map} +1 -1
- package/dist/shell-source-maps/assets/{copy-field-14Vmg95D.js.map → copy-field-MTVXamwX.js.map} +1 -1
- package/dist/shell-source-maps/assets/{create-route-DAprAV2h.js.map → create-route-CEfuAg9p.js.map} +1 -1
- package/dist/shell-source-maps/assets/{custom-step-container-field-D0cmhURR.js.map → custom-step-container-field-19o4BVGX.js.map} +1 -1
- package/dist/shell-source-maps/assets/{embedded-list-Ra3OLUh6.js.map → embedded-list-CWzU8ruS.js.map} +1 -1
- package/dist/shell-source-maps/assets/en-BLkfn3BD.js.map +1 -0
- package/dist/shell-source-maps/assets/{export-dialog-Cz26bxgN.js.map → export-dialog-DHbFHvEa.js.map} +1 -1
- package/dist/shell-source-maps/assets/export-worker-D0h27FKA.js.map +1 -0
- package/dist/shell-source-maps/assets/{first-organization-page-C9ejBI4S.js.map → first-organization-page-Uc0es2bM.js.map} +1 -1
- package/dist/shell-source-maps/assets/{graph-view-B3TE-xbG.js.map → graph-view-C_kd2p_w.js.map} +1 -1
- package/dist/shell-source-maps/assets/{group-donut-BAyTgqYv.js.map → group-donut-w_BFP4Nu.js.map} +1 -1
- package/dist/shell-source-maps/assets/{guest-call-page-CEcPrLXS.js.map → guest-call-page-D3gaOqIw.js.map} +1 -1
- package/dist/shell-source-maps/assets/{html-viewer-DaeVR6PB.js.map → html-viewer-BrCIs_XH.js.map} +1 -1
- package/dist/shell-source-maps/assets/{import-dialog-6I25EI49.js.map → import-dialog-DCcZNJgD.js.map} +1 -1
- package/dist/shell-source-maps/assets/{import-table-dialog-COsPNket.js.map → import-table-dialog-CWL7kUhP.js.map} +1 -1
- package/dist/shell-source-maps/assets/{invitations-page-TBz_-ekD.js.map → invitations-page-CX-S9_g6.js.map} +1 -1
- package/dist/shell-source-maps/assets/{layout-grid-BTGS8Vdw.js.map → layout-grid-DK79NnII.js.map} +1 -1
- package/dist/shell-source-maps/assets/{legend-item-DkIaBiD0.js.map → legend-item-IhWkwVRv.js.map} +1 -1
- package/dist/shell-source-maps/assets/{list-page-Dpq9M7YO.js.map → list-page-BJ7BwcjM.js.map} +1 -1
- package/dist/shell-source-maps/assets/{maplibre-JTZsxvhv.js.map → maplibre-XgWOYlHw.js.map} +1 -1
- package/dist/shell-source-maps/assets/{markdown-content-DBVa63k_.js.map → markdown-content-oKb66g72.js.map} +1 -1
- package/dist/shell-source-maps/assets/{members-page-CHRY9H9W.js.map → members-page-CB947V03.js.map} +1 -1
- package/dist/shell-source-maps/assets/{message-content-DzyGCvgQ.js.map → message-content-Cae9o0KB.js.map} +1 -1
- package/dist/shell-source-maps/assets/{messages-BwcGcxFR.js.map → messages-KWWs-PYa.js.map} +1 -1
- package/dist/shell-source-maps/assets/nl-Ozd1Th1I.js.map +1 -0
- package/dist/shell-source-maps/assets/{organization-page-BE182e_K.js.map → organization-page-Daa29-ya.js.map} +1 -1
- package/dist/shell-source-maps/assets/{organizations-page-DaN6zQZj.js.map → organizations-page-DFla8W4s.js.map} +1 -1
- package/dist/shell-source-maps/assets/parse-worker-BzKm_KiA.js.map +1 -0
- package/dist/shell-source-maps/assets/{pending-invitation-row-DvqK-Lh5.js.map → pending-invitation-row-ufQDhiqy.js.map} +1 -1
- package/dist/shell-source-maps/assets/{period-chart-Cn9bgVfB.js.map → period-chart-CDAaiRKi.js.map} +1 -1
- package/dist/shell-source-maps/assets/{person-row-CSBZnBQc.js.map → person-row-DKpGU4lp.js.map} +1 -1
- package/dist/shell-source-maps/assets/{public-form-page-CaNVr6BS.js.map → public-form-page-CWI8qeDR.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-lines-3DhkRSpH.js.map → record-lines-Dr5kvt8p.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-map-D4rgUOwb.js.map → record-map-JMNMJGUZ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-opens-BSFQWqio.js.map → record-opens-iz29YMzQ.js.map} +1 -1
- package/dist/shell-source-maps/assets/record-page-Db_9ytem.js.map +1 -0
- package/dist/shell-source-maps/assets/{record-preview-Bdzkrw0H.js.map → record-preview-BCYfgSHu.js.map} +1 -1
- package/dist/shell-source-maps/assets/{records-map-BfkBfva4.js.map → records-map-iNOkFYn9.js.map} +1 -1
- package/dist/shell-source-maps/assets/render-node-D5xobkr6.js.map +1 -0
- package/dist/shell-source-maps/assets/{reorder-button-pGaEX5DI.js.map → reorder-button-05HCaCaE.js.map} +1 -1
- package/dist/shell-source-maps/assets/{run-trace-view-Cd3DppYM.js.map → run-trace-view-BSrF6_Kg.js.map} +1 -1
- package/dist/shell-source-maps/assets/{runner-install-field-CK3olYt5.js.map → runner-install-field-CgXWqOkx.js.map} +1 -1
- package/dist/shell-source-maps/assets/{runtime-update-BNTp15Vo.js.map → runtime-update-BrM_FHvq.js.map} +1 -1
- package/dist/shell-source-maps/assets/{sheet-source-DONoSDqu.js.map → sheet-source-BdUpw5K0.js.map} +1 -1
- package/dist/shell-source-maps/assets/{sign-in-policy-page-C4MEEpwM.js.map → sign-in-policy-page-CavUG1RD.js.map} +1 -1
- package/dist/shell-source-maps/assets/{start-block-queries-B7qJvkWD.js.map → start-block-queries-DrZpbWHB.js.map} +1 -1
- package/dist/shell-source-maps/assets/{step-catalog-CgPcuEu_.js.map → step-catalog-C49x4u-Y.js.map} +1 -1
- package/dist/shell-source-maps/assets/{step-panel-CoFQOZfZ.js.map → step-panel-CyZhEKcD.js.map} +1 -1
- package/dist/shell-source-maps/assets/{timeline-display-F8qMrey9.js.map → timeline-display-Bzg1mU4E.js.map} +1 -1
- package/dist/shell-source-maps/assets/{trash-BFH8OA7M.js.map → trash-CqUcV16Q.js.map} +1 -1
- package/dist/shell-source-maps/assets/{update-set-CivHicWr.js.map → update-set-Da02tZfu.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-calendar-move-CezBW0KE.js.map → use-calendar-move-D93tEWOf.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-display-rows-7iLrRpz6.js.map → use-display-rows-BPgcYLdT.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-my-invitations-B7w0Q5kk.js.map → use-my-invitations-CPQ3DMUh.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-paged-search-CblCRsCd.js.map → use-paged-search-w0puq1Yl.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-run-trace-vMzYYuXG.js.map → use-run-trace-BEM0bOMt.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-workflow-page-Dac4wyOA.js.map → use-workflow-page-DpBacPYs.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-workflow-types-Bi8u42jQ.js.map → use-workflow-types-Bc6SdoP6.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-canvas-2owtFZNz.js.map → workflow-canvas-DpONgLJR.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-field-Ct0HoH5Z.js.map → workflow-field-4i7H_hCR.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-graph-editor-oAKVQAgf.js.map → workflow-graph-editor-BP_eCoyB.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-run-field-C7ff1D9_.js.map → workflow-run-field-e0JGWLQd.js.map} +1 -1
- package/dist/shell-source-maps/assets/workflow-status-field-RevEnRLG.js.map +1 -0
- package/dist/shell-source-maps/assets/{workflow-workbench-BCsEjQVw.js.map → workflow-workbench-DY0czZaG.js.map} +1 -1
- package/dist/status/messages.d.ts +2 -2
- package/dist/users/messages.d.ts +2 -2
- package/package.json +5 -5
- package/dist/shell/assets/app-DU-Bny4k.js +0 -34
- package/dist/shell/assets/board-display-BaMLmYUJ.js +0 -2
- package/dist/shell/assets/calendar-display-CzQPcItV.js +0 -2
- package/dist/shell/assets/create-route-DAprAV2h.js +0 -2
- package/dist/shell/assets/embedded-list-Ra3OLUh6.js +0 -3
- package/dist/shell/assets/en-dURxhEht.js +0 -2
- package/dist/shell/assets/export-worker-DfIG4xQy.js +0 -15
- package/dist/shell/assets/import-table-dialog-COsPNket.js +0 -2
- package/dist/shell/assets/invitations-page-TBz_-ekD.js +0 -2
- package/dist/shell/assets/list-page-Dpq9M7YO.js +0 -4
- package/dist/shell/assets/members-page-CHRY9H9W.js +0 -2
- package/dist/shell/assets/messages-BwcGcxFR.js +0 -2
- package/dist/shell/assets/nl-B0dpIbbz.js +0 -2
- package/dist/shell/assets/organization-page-BE182e_K.js +0 -2
- package/dist/shell/assets/organizations-page-DaN6zQZj.js +0 -2
- package/dist/shell/assets/parse-worker-VaelBbE0.js +0 -35
- package/dist/shell/assets/public-form-page-CaNVr6BS.js +0 -2
- package/dist/shell/assets/record-page-Cbx9gqMY.js +0 -3
- package/dist/shell/assets/render-node-ChsAMZVA.js +0 -3
- package/dist/shell/assets/reorder-button-pGaEX5DI.js +0 -2
- package/dist/shell/assets/shared-protobase-ui-gnK6D3Al.js +0 -1
- package/dist/shell/assets/sign-in-policy-page-C4MEEpwM.js +0 -2
- package/dist/shell/assets/start-block-queries-B7qJvkWD.js +0 -2
- package/dist/shell/assets/step-catalog-CgPcuEu_.js +0 -2
- package/dist/shell/assets/timeline-display-F8qMrey9.js +0 -2
- package/dist/shell/assets/use-calendar-move-CezBW0KE.js +0 -2
- package/dist/shell/assets/use-my-invitations-B7w0Q5kk.js +0 -2
- package/dist/shell/assets/workflow-status-field-iHUr4FZM.js +0 -2
- package/dist/shell/assets/workflow-workbench-BCsEjQVw.js +0 -4
- package/dist/shell-source-maps/assets/app-DU-Bny4k.js.map +0 -1
- package/dist/shell-source-maps/assets/en-dURxhEht.js.map +0 -1
- package/dist/shell-source-maps/assets/export-worker-DfIG4xQy.js.map +0 -1
- package/dist/shell-source-maps/assets/nl-B0dpIbbz.js.map +0 -1
- package/dist/shell-source-maps/assets/parse-worker-VaelBbE0.js.map +0 -1
- package/dist/shell-source-maps/assets/record-page-Cbx9gqMY.js.map +0 -1
- package/dist/shell-source-maps/assets/render-node-ChsAMZVA.js.map +0 -1
- package/dist/shell-source-maps/assets/workflow-status-field-iHUr4FZM.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-organization-page-
|
|
1
|
+
{"version":3,"file":"first-organization-page-Uc0es2bM.js","names":["n","a","t","__toESM","reopenIn","SectionError","useAuth","AuthLayout","Link","useOrganizationText","Button","MyInvitationRow","useJoinInvitation","NewOrganizationForm","useMyInvitations","import_jsx_runtime","require_jsx_runtime","linkClass","SignedInAs","children","onSignOut","FirstOrganizationPage","settings","read","opened","basePath","all","seesAll","footer","invitations","path","mayCreate","error","joining","invitation","join"],"sources":["../../../src/organizations/first-organization-page.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { AuthLayout } from '../auth/auth-layout'\nimport { useAuth } from '../auth/auth-provider'\nimport { SectionError } from '../account/account-section'\nimport { Link } from '../app/router'\nimport { Button } from '../primitives/button'\nimport { MyInvitationRow } from './my-invitation-row'\nimport { NewOrganizationForm } from './new-organization-form'\nimport { firstOrganizationFormPath, firstOrganizationPath, organizationsPath } from './organization-paths'\nimport { useOrganizationText } from './organization-word'\nimport { useJoinInvitation } from './use-join-invitation'\nimport { useMyInvitations } from './use-my-invitations'\nimport { reopenIn } from './use-organizations'\n\nexport type FirstOrganizationPageProps = {\n /** The screen's own address: the form alone below the invitations at `firstOrganizationFormPath`. */\n path: string\n basePath: string\n /** The address the person is signed in as. */\n email: string\n /** Whether they may create an organization (`organizations.create`). */\n mayCreate: boolean\n /** Whether a global role lets them work in any organization, which the organizations page lists. */\n seesAll: boolean\n /** Signs out, asking first. */\n onSignOut: () => void\n}\n\n// As the sign-in screens' own links and buttons beside their form.\nconst linkClass = 'font-medium text-primary-text hover:underline'\n\n// Who is signed in, and the way out, under the card's content.\nconst SignedInAs = ({ email, onSignOut, children }: { email: string; onSignOut: () => void; children?: ReactNode }) => {\n const t = useOrganizationText()\n return (\n <div className=\"mt-5 flex flex-col gap-2 border-t pt-4 text-center text-muted-foreground\">\n {children}\n <p className=\"break-words\">{t('signedInAs', { email })}</p>\n <button type=\"button\" onClick={onSignOut} className=\"self-center font-medium text-muted-foreground hover:text-foreground hover:underline\">{t('signOut')}</button>\n </div>\n )\n}\n\n/**\n * Where someone signed in without an organization starts: their pending invitations first, each joined in one press,\n * with a way to create one of their own instead; without invitations, the one field that names it. Joining or creating\n * opens the app afresh at its start address. Someone who may not create and has no invitation is told to ask for one.\n */\nexport const FirstOrganizationPage = ({ path, basePath, email, mayCreate, seesAll, onSignOut }: FirstOrganizationPageProps) => {\n const { organizations: settings } = useAuth()\n const t = useOrganizationText()\n const read = useMyInvitations()\n const opened = () => reopenIn(basePath)\n const { busy, error, joining, join } = useJoinInvitation(opened)\n const all = seesAll && <Link to={organizationsPath} className={linkClass}>{t('allOrganizations')}</Link>\n const footer = <SignedInAs email={email} onSignOut={onSignOut}>{all}</SignedInAs>\n\n // Blank for the moment the invitations take, rather than a title that may change to the invitations' own\n if (read.state === 'loading') return <div className=\"min-h-full\" aria-busy />\n // A failed read never falls back to the form: someone invited would make an empty organization instead of joining\n if (read.state === 'failed') {\n return (\n <AuthLayout title={t('invitationsNotLoaded')} description={t('invitationsNotLoadedHelp')}>\n <Button variant=\"primary\" className=\"min-h-10 w-full\" onClick={read.retry}>{t('tryAgain')}</Button>\n {footer}\n </AuthLayout>\n )\n }\n const invitations = read.invitations\n // The form's own address shows the form, when they may create one; otherwise their invitations stay the way in\n if (invitations.length > 0 && (path !== firstOrganizationFormPath || !mayCreate)) {\n return (\n <AuthLayout title={t('invitedTitle')} description={mayCreate ? t('invitedSubtitle') : t('invitedSubtitleJoinOnly')}>\n <SectionError message={error} />\n <ul className=\"divide-y rounded-md border\">\n {invitations.map((invitation) => (\n <MyInvitationRow key={invitation.id} invitation={invitation} t={t} busy={busy} joining={joining === invitation.id} onJoin={() => join(invitation.id)} />\n ))}\n </ul>\n {mayCreate && (\n <p className=\"mt-4 text-center\">\n <Link to={firstOrganizationFormPath} className={linkClass}>{t('createInstead')}</Link>\n </p>\n )}\n {footer}\n </AuthLayout>\n )\n }\n if (!mayCreate) {\n return (\n <AuthLayout title={t('notInAnyTitle')} description={t('notInAny', { email })}>\n {footer}\n </AuthLayout>\n )\n }\n return (\n <AuthLayout title={t('createTitle')} {...(settings?.createDescription && { description: settings.createDescription })}>\n <NewOrganizationForm autoFocus onCreated={opened} />\n {invitations.length > 0 && (\n <p className=\"mt-4 text-center\">\n <Link to={firstOrganizationPath} className={linkClass}>{t('backToInvitations')}</Link>\n </p>\n )}\n {footer}\n </AuthLayout>\n )\n}\n"],"mappings":"6tBA6BMiB,EAAY,gDAGZC,GAAc,CAAE,QAAO,YAAW,cAA+E,CACrH,IAAMhB,EAAIO,EAAoB,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.js.map → graph-view-C_kd2p_w.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-view-B3TE-xbG.js","names":["_Fragment","useMemo","useState","useState","useMemo","ReactFlow","n","a","t","__toESM","require_react","require_jsx_runtime","edgeConditions","evaluateCondition","scopeValue","edgeCondition","valueTone","ToneEdge","FieldBadge","scopeOf","RouteLink","RecordScope","valueColor","Position","MarkerType","ReactFlowProvider","useReactFlow","Controls","index","Handle","useElk","import_react","toneStrokes","dashes","edgeConditionsOf","props","name","holds","parsed","scope","row","path","edgeLook","status","colors","view","value","edge","stroke","dash","conditions","labelValue","labels","label","nodeSize","padding","elkPadding","placedGap","groupId","id","nodeId","algorithmOptions","input","unplaced","shape","node","graphElk","nodes","options","box","groups","members","group","loose","laid","edges","boundsOf","boxes","x","y","placeGraph","placed","position","engine","visit","child","parent","at","laidOut","above","below","shift","whole","moved","import_jsx_runtime","handle","Handles","sides","frame","chosen","RecordNode","data","fields","content","to","model","GroupNode","useGraphLayout","elk","signature","placedOnly","setLaidOut","failure","setFailure","current","result","error","nodeTypes","minHeight","maxHeight","fitViewOptions","themed","number","flowNodes","read","drawn","layout","select","flowEdges","look","straight","FitOnLayout","flow","Flow","measured","setMeasured","sizes","positions","layoutName","direction","ready","measure","heights","changes","change","next","before","size","GraphView"],"sources":["../../../src/app/pages/blocks/graph/graph-edges.ts","../../../src/app/pages/blocks/graph/graph-layout.ts","../../../src/app/pages/blocks/graph/graph-nodes.tsx","../../../src/app/pages/blocks/graph/use-graph-layout.ts","../../../src/app/pages/blocks/graph/graph-view.tsx"],"sourcesContent":["import { edgeCondition, edgeConditions, evaluateCondition, scopeValue, type GraphProps, type ShapeEdge } from '@protobase/layout'\nimport type { BadgeTone, ViewModel } from '@protobase/schema'\nimport { valueColor, valueTone } from '../../../../live/value-color'\n\n/** How an edge draws: its line's colour, whether it moves, its dashes, and the text on its middle. */\nexport type EdgeLook = { stroke: string; animated: boolean; dash?: string; label?: string }\n\n// A line in the colour its value's badge has, the app's border colour without one\nconst toneStrokes: Record<BadgeTone, string> = {\n neutral: 'var(--color-border-strong)',\n blue: 'var(--color-primary)',\n green: 'var(--color-success)',\n amber: 'var(--color-warning)',\n red: 'var(--color-danger)',\n violet: 'var(--color-violet)',\n}\n\nconst dashes = { dashed: '6 4', dotted: '1.5 4' }\n\ntype Parsed = Partial<Record<(typeof edgeConditions)[number], ReturnType<typeof edgeCondition>>>\n\n/** The graph's conditions on an edge, parsed once: a condition that does not parse never holds. */\nexport const edgeConditionsOf = (props: Pick<GraphProps, (typeof edgeConditions)[number]>): Parsed =>\n Object.fromEntries(edgeConditions.flatMap((name) => (typeof props[name] === 'string' ? [[name, edgeCondition(props[name])]] : [])))\n\nconst holds = (parsed: ReturnType<typeof edgeCondition> | undefined, row: Record<string, unknown>) => {\n if (!parsed?.ok) return false\n const scope = { stack: [{ record: row }] }\n return evaluateCondition(parsed, Object.fromEntries(parsed.paths.map((path) => [path, scopeValue(scope, path)])))\n}\n\n/** How `edge` draws by the graph's `edgeStatus`, `edgeLabel` and conditions, its colours and value labels the edges view's. */\nexport const edgeLook = (edge: ShapeEdge, props: Pick<GraphProps, 'edgeLabel' | 'edgeStatus'>, conditions: Parsed, view: ViewModel | undefined): EdgeLook => {\n const status = props.edgeStatus\n const colors = status === undefined ? undefined : view?.fields[status]?.valueColors\n const value = status === undefined ? undefined : edge.row[status]\n const stroke = status === undefined || value == null ? toneStrokes.neutral : (valueColor(colors, value) ?? toneStrokes[valueTone(colors, value)])\n const dash = holds(conditions.dotted, edge.row) ? dashes.dotted : holds(conditions.dashed, edge.row) ? dashes.dashed : undefined\n const labelValue = props.edgeLabel === undefined ? undefined : edge.row[props.edgeLabel]\n const labels = props.edgeLabel === undefined ? undefined : view?.fields[props.edgeLabel]?.valueLabels\n const label = labelValue == null || labelValue === '' ? undefined : (labels?.[String(labelValue)] ?? String(labelValue))\n return { stroke, animated: holds(conditions.animated, edge.row), ...(dash && { dash }), ...(label !== undefined && { label }) }\n}\n","import type { ElkNode } from 'elkjs/lib/elk-api'\nimport type { GraphLayoutName, GraphShape } from '@protobase/layout'\n\n/** A node's size: room for its label on one or two lines and its status badge, the width a node's own contents get. */\nexport const nodeSize = { width: 200, height: 64 }\n\n/** The width of a node that draws contents of its own, whose height they decide. */\nexport const contentWidth = 224\n\n/** A box at its top-left corner, in the graph's own coordinates. */\nexport type Box = { x: number; y: number; width: number; height: number }\n\nexport type Size = { width: number; height: number }\n\n/** Where each group and node of a graph sits, each group a region around its nodes, and the size of the whole. */\nexport type GraphLayout = { groups: Map<string, Box>; nodes: Map<string, Box>; width: number; height: number }\n\n/** How a graph is laid out: its algorithm, which way a layered one runs, each node's size, and the nodes placed by their records. */\nexport type LayoutInput = { layout: GraphLayoutName; direction: 'down' | 'right'; sizes: ReadonlyMap<string, Size>; positions: ReadonlyMap<string, { x: number; y: number }> }\n\n// Room in a region around its nodes, more on top for its value\nconst padding = { top: 32, side: 16, bottom: 16 }\nconst elkPadding = `[top=${padding.top},left=${padding.side},bottom=${padding.bottom},right=${padding.side}]`\n\n// The space between the nodes the engine lays out and the ones placed above them\nconst placedGap = 48\n\nconst groupId = (id: string) => `group:${id}`\nconst nodeId = (id: string) => `node:${id}`\n\nconst algorithmOptions = (input: LayoutInput): Record<string, string> =>\n input.layout === 'force'\n ? // Its seed is fixed, so the same records always make the same picture\n { 'elk.algorithm': 'force', 'elk.randomSeed': '1', 'elk.spacing.nodeNode': '40' }\n : { 'elk.algorithm': 'layered', 'elk.direction': input.direction === 'right' ? 'RIGHT' : 'DOWN', 'elk.layered.spacing.nodeNodeBetweenLayers': '56', 'elk.spacing.nodeNode': '32' }\n\n/** The nodes the engine places: those without a position of their own. */\nconst unplaced = (shape: GraphShape, input: LayoutInput) => shape.nodes.filter((node) => !input.positions.has(node.id))\n\n/**\n * The graph ELK lays out: each node without a position as a box of its size, inside a box of its group, and each edge\n * between two of them. A layered graph lays its groups out with the rest (hierarchy INCLUDE_CHILDREN); a force one\n * lays each group out inside its box, then the boxes as nodes. `undefined` when every node has a position.\n */\nexport const graphElk = (shape: GraphShape, input: LayoutInput): ElkNode | undefined => {\n const nodes = unplaced(shape, input)\n if (nodes.length === 0) return undefined\n const options = algorithmOptions(input)\n const box = (id: string): ElkNode => ({ id: nodeId(id), ...(input.sizes.get(id) ?? nodeSize) })\n const groups = shape.groups.flatMap((group): ElkNode[] => {\n const members = nodes.filter((node) => node.group === group.id)\n return members.length === 0 ? [] : [{ id: groupId(group.id), layoutOptions: { ...options, 'elk.padding': elkPadding }, children: members.map((node) => box(node.id)) }]\n })\n const loose = nodes.filter((node) => node.group === undefined).map((node) => box(node.id))\n const laid = new Set(nodes.map((node) => node.id))\n const edges = shape.edges.filter((edge) => laid.has(edge.source) && laid.has(edge.target) && edge.source !== edge.target).map((edge) => ({ id: `edge:${edge.id}`, sources: [nodeId(edge.source)], targets: [nodeId(edge.target)] }))\n return { id: 'root', layoutOptions: { ...options, ...(input.layout === 'layered' && { 'elk.hierarchyHandling': 'INCLUDE_CHILDREN' }) }, children: [...groups, ...loose], edges }\n}\n\nconst boundsOf = (boxes: Box[]): Box | undefined => {\n if (boxes.length === 0) return undefined\n const x = Math.min(...boxes.map((box) => box.x))\n const y = Math.min(...boxes.map((box) => box.y))\n return { x, y, width: Math.max(...boxes.map((box) => box.x + box.width)) - x, height: Math.max(...boxes.map((box) => box.y + box.height)) - y }\n}\n\n/**\n * Where everything sits: each placed node at its position, the nodes the engine laid out (`laidOut`, from `graphElk`)\n * under them, each group a region around its nodes, the whole moved so it starts at 0, 0.\n */\nexport const placeGraph = (shape: GraphShape, input: LayoutInput, laidOut?: ElkNode): GraphLayout => {\n const placed = new Map<string, Box>()\n for (const node of shape.nodes) {\n const position = input.positions.get(node.id)\n if (position) placed.set(node.id, { ...position, ...(input.sizes.get(node.id) ?? nodeSize) })\n }\n // ELK gives each child its place inside its parent\n const engine = new Map<string, Box>()\n const visit = (parent: ElkNode, x: number, y: number) => {\n for (const child of parent.children ?? []) {\n const at = { x: x + (child.x ?? 0), y: y + (child.y ?? 0) }\n if (child.id.startsWith('node:')) engine.set(child.id.slice('node:'.length), { ...at, width: child.width ?? nodeSize.width, height: child.height ?? nodeSize.height })\n else visit(child, at.x, at.y)\n }\n }\n if (laidOut) visit(laidOut, 0, 0)\n const above = boundsOf([...placed.values()])\n const below = boundsOf([...engine.values()])\n const shift = above && below ? { x: above.x - below.x, y: above.y + above.height + placedGap - below.y } : { x: 0, y: 0 }\n for (const [id, box] of engine) placed.set(id, { ...box, x: box.x + shift.x, y: box.y + shift.y })\n const groups = new Map<string, Box>()\n for (const group of shape.groups) {\n const members = boundsOf(shape.nodes.filter((node) => node.group === group.id && placed.has(node.id)).map((node) => placed.get(node.id)!))\n if (members) groups.set(group.id, { x: members.x - padding.side, y: members.y - padding.top, width: members.width + 2 * padding.side, height: members.height + padding.top + padding.bottom })\n }\n const whole = boundsOf([...placed.values(), ...groups.values()]) ?? { x: 0, y: 0, width: 0, height: 0 }\n const moved = (box: Box): Box => ({ ...box, x: box.x - whole.x, y: box.y - whole.y })\n return {\n nodes: new Map([...placed].map(([id, box]) => [id, moved(box)])),\n groups: new Map([...groups].map(([id, box]) => [id, moved(box)])),\n width: whole.width,\n height: whole.height,\n }\n}\n","import type { GraphFields } from '@protobase/layout'\nimport type { ResourceModel, ViewModel } from '@protobase/schema'\nimport { Handle, Position, type Node, type NodeProps } from '@xyflow/react'\nimport type { ReactNode } from 'react'\nimport { RouteLink, type RouteTarget } from '../../../../primitives/route-link'\nimport { FieldBadge } from '../../../field-badge'\nimport { ToneEdge } from '../../../related-cards/tone-edge'\nimport { RecordScope } from '../../record-scope'\nimport { scopeOf } from '../../use-layout-data'\n\ntype Drawn = { model: ResourceModel; view: ViewModel | undefined; fields: GraphFields }\n\n/** Which sides a node's edges meet it on: the top and bottom for a graph that runs down, else the left and right. */\nexport type Sides = 'vertical' | 'horizontal'\n\n/**\n * A node as it draws: its record, what the graph draws in each node, the link that chooses it when the graph has\n * `select`, whether it is chosen, and which sides its edges meet.\n */\nexport type RecordNodeData = Drawn & { row: Record<string, unknown>; content?: ReactNode; to?: RouteTarget; chosen: boolean; sides: Sides }\n\n/** A group as it draws: the record of one of its nodes, whose `group` value it shows. */\nexport type GroupNodeData = Drawn & { row: Record<string, unknown> }\n\n// The handles take no part in the drawing, since the graph cannot be edited\nconst handle = 'pointer-events-none !min-h-0 !min-w-0 !border-0 !bg-transparent'\n\nconst Handles = ({ sides }: { sides: Sides }) => (\n <>\n <Handle type=\"target\" position={sides === 'vertical' ? Position.Top : Position.Left} isConnectable={false} className={handle} />\n <Handle type=\"source\" position={sides === 'vertical' ? Position.Bottom : Position.Right} isConnectable={false} className={handle} />\n </>\n)\n\nconst frame = (chosen: boolean) => `relative rounded-lg border bg-surface text-body ${chosen ? 'border-primary ring-2 ring-primary/40' : 'border-border'}`\n\n/**\n * A node: with contents of the graph's own, those, drawn inside its record, the whole node a link that chooses it; else\n * its label, linking to the page with it chosen, over its status badge. Its status colours its left edge.\n */\nexport const RecordNode = ({ data }: NodeProps<Node<RecordNodeData, 'record'>>) => {\n const { model, view, fields, row, content, to, chosen, sides } = data\n const label = String(row[fields.label] ?? '')\n const edge = fields.status && <ToneEdge view={view} field={fields.status} record={row} />\n if (content !== undefined) {\n return (\n <div data-chosen={chosen || undefined} className={`${frame(chosen)} flex w-full flex-col gap-1 px-3 py-2`}>\n <Handles sides={sides} />\n {edge}\n {/* A link over the whole node chooses it, under the contents, whose own links stay theirs; React Flow turns\n pointer events off on a node that cannot be dragged or selected, so each takes them back */}\n {to && <RouteLink to={to} aria-label={label} aria-current={chosen || undefined} className=\"pointer-events-auto absolute inset-0 rounded-lg hover:bg-muted/40\" />}\n <div className=\"relative min-w-0 [overflow-wrap:anywhere] [&_a]:pointer-events-auto\">\n <RecordScope value={scopeOf(model, row)}>{content}</RecordScope>\n </div>\n </div>\n )\n }\n return (\n <div data-chosen={chosen || undefined} className={`${frame(chosen)} flex size-full flex-col justify-center gap-1 px-3 py-2`}>\n <Handles sides={sides} />\n {edge}\n {to ? (\n <RouteLink to={to} aria-current={chosen || undefined} className=\"pointer-events-auto line-clamp-2 min-w-0 font-medium [overflow-wrap:anywhere] text-primary-text hover:underline\">\n {label}\n </RouteLink>\n ) : (\n <span className=\"line-clamp-2 min-w-0 font-medium [overflow-wrap:anywhere]\">{label}</span>\n )}\n {fields.status && (\n <div className=\"flex\">\n <FieldBadge model={model} view={view} field={fields.status} record={row} />\n </div>\n )}\n </div>\n )\n}\n\n/** A group: a region around its nodes, its `group` value at its top. */\nexport const GroupNode = ({ data }: NodeProps<Node<GroupNodeData, 'group-box'>>) => (\n <div className=\"size-full rounded-xl border border-dashed border-border-strong bg-muted/40\">\n {data.fields.group && (\n <div className=\"flex px-2 pt-1 text-xs\">\n <FieldBadge model={data.model} view={data.view} field={data.fields.group} record={data.row} />\n </div>\n )}\n </div>\n)\n","import { useEffect, useMemo, useState } from 'react'\nimport type { GraphShape } from '@protobase/layout'\nimport { useElk } from '../../../../lib/elk/use-elk'\nimport { graphElk, placeGraph, type GraphLayout, type LayoutInput } from './graph-layout'\n\n/**\n * Where the graph's groups and nodes sit, laid out again when its nodes, edges, sizes or positions change; undefined\n * until the first layout is done. A layout that a newer one overtook is dropped. Without a node to lay out, the engine\n * is never asked. A layout that fails throws, for the block's fallback or the page's error boundary to draw.\n */\nexport const useGraphLayout = (shape: GraphShape, input: LayoutInput): GraphLayout | undefined => {\n const elk = graphElk(shape, input)\n const engine = useElk()\n // One text for what the layout is made from, so a new shape of the same records lays nothing out again\n const signature = JSON.stringify([elk, shape.nodes.map((node) => node.id), shape.groups.map((group) => group.id), [...input.positions], [...input.sizes]])\n const placedOnly = useMemo(() => (elk ? undefined : placeGraph(shape, input)), [signature])\n const [laidOut, setLaidOut] = useState<{ signature: string; layout: GraphLayout }>()\n const [failure, setFailure] = useState<Error>()\n useEffect(() => {\n if (!engine || !elk) return\n let current = true\n engine.layout(elk).then(\n (result) => {\n if (current) setLaidOut({ signature, layout: placeGraph(shape, input, result) })\n },\n (error: unknown) => {\n if (current) setFailure(error instanceof Error ? error : new Error(String(error)))\n },\n )\n return () => {\n current = false\n }\n }, [engine, signature])\n // A layout that failed, such as a worker that cannot load, draws the graph's fallback or its error, not a blank box\n if (failure) throw failure\n if (placedOnly) return placedOnly\n // The last layout stands while the next one is made, so a live update does not blank the graph\n return laidOut?.layout\n}\n","import { Controls, MarkerType, ReactFlow, ReactFlowProvider, useReactFlow, type Edge, type Node, type NodeChange } from '@xyflow/react'\nimport type { GraphFields, GraphProps, GraphShape } from '@protobase/layout'\nimport { useEffect, useMemo, useState, type CSSProperties, type ReactNode } from 'react'\nimport type { ComponentRead, ComponentSelect } from '../../component-reads'\nimport { edgeConditionsOf, edgeLook } from './graph-edges'\nimport { contentWidth, nodeSize, type GraphLayout, type Size } from './graph-layout'\nimport { GroupNode, RecordNode, type GroupNodeData, type RecordNodeData, type Sides } from './graph-nodes'\nimport { useGraphLayout } from './use-graph-layout'\nimport '@xyflow/react/dist/style.css'\n\nconst nodeTypes = { record: RecordNode, 'group-box': GroupNode }\n\n// The box's height follows the graph's shape at the box's width, within bounds, so the page scrolls past it\nconst minHeight = 256\nconst maxHeight = 'min(40rem, 70vh)'\n\n// A graph wider than the box, as on a phone, stays readable and pans; the fit button shows all of it\nconst fitViewOptions = { minZoom: 0.6, maxZoom: 1 }\n\n// The library's lines and controls in the app's tokens, over the page's own background: the variables it reads over\n// its own defaults\nconst themed = {\n '--xy-edge-stroke': 'var(--color-border-strong)',\n '--xy-edge-stroke-width': '1.5',\n '--xy-background-color': 'transparent',\n '--xy-edge-label-background-color': 'var(--color-surface)',\n '--xy-edge-label-color': 'var(--color-muted-foreground)',\n '--xy-controls-button-background-color': 'var(--color-surface)',\n '--xy-controls-button-background-color-hover': 'var(--color-muted)',\n '--xy-controls-button-color': 'var(--color-foreground)',\n '--xy-controls-button-color-hover': 'var(--color-foreground)',\n '--xy-controls-button-border-color': 'var(--color-border)',\n '--xy-attribution-background-color': 'transparent',\n} as CSSProperties\n\nexport type GraphViewProps = {\n shape: GraphShape\n nodes: Pick<ComponentRead, 'model' | 'view'>\n edges: Pick<ComponentRead, 'model' | 'view'>\n fields: GraphFields\n props: Pick<GraphProps, 'layout' | 'direction' | 'x' | 'y' | 'edgeLabel' | 'edgeStatus' | 'animated' | 'dashed' | 'dotted'>\n select?: ComponentSelect\n /** What each node draws, inside its record, the graph's `node`; its label and status without it. */\n content?: ReactNode\n}\n\nconst number = (value: unknown) => (typeof value === 'number' && Number.isFinite(value) ? value : typeof value === 'string' && value.trim() !== '' && Number.isFinite(Number(value)) ? Number(value) : undefined)\n\n// The nodes React Flow draws: each group's region under the nodes, each node at its box, one with contents of its own\n// as wide as they are given and as tall as they draw, which it measures\nconst flowNodes = ({ shape, nodes: read, fields, select, content }: GraphViewProps, layout: GraphLayout | undefined, sides: Sides): Node[] => {\n const drawn = { model: read.model, view: read.view, fields }\n const groups = shape.groups.flatMap((group): Node<GroupNodeData>[] => {\n const box = layout?.groups.get(group.id)\n const row = shape.nodes.find((node) => node.group === group.id)!.row\n return box ? [{ id: `group:${group.id}`, type: 'group-box', position: { x: box.x, y: box.y }, width: box.width, height: box.height, zIndex: -1, data: { ...drawn, row }, draggable: false, selectable: false, focusable: false }] : []\n })\n const nodes = shape.nodes.map((node): Node<RecordNodeData> => {\n const box = layout?.nodes.get(node.id)\n const chosen = select?.chosen === node.id\n return {\n id: `node:${node.id}`,\n type: 'record',\n position: box ? { x: box.x, y: box.y } : { x: 0, y: 0 },\n ...(content === undefined ? { width: nodeSize.width, height: nodeSize.height } : { style: { width: contentWidth } }),\n data: { ...drawn, row: node.row, chosen, sides, ...(content !== undefined && { content }), ...(select && { to: select.linkTo(node.id) }) },\n draggable: false,\n selectable: false,\n }\n })\n return [...groups, ...nodes]\n}\n\nconst flowEdges = ({ shape, edges: read, props }: GraphViewProps, straight: boolean): Edge[] => {\n const conditions = edgeConditionsOf(props)\n return shape.edges.map((edge) => {\n const look = edgeLook(edge, props, conditions, read.view)\n return {\n id: `edge:${edge.id}`,\n source: `node:${edge.source}`,\n target: `node:${edge.target}`,\n ...(straight && { type: 'straight' }),\n markerEnd: { type: MarkerType.ArrowClosed, color: look.stroke },\n style: { stroke: look.stroke, ...(look.dash && { strokeDasharray: look.dash }) },\n animated: look.animated,\n ...(look.label !== undefined && { label: look.label, labelBgPadding: [4, 2] as [number, number], labelBgBorderRadius: 4 }),\n focusable: false,\n selectable: false,\n }\n })\n}\n\n// Fits the graph to its box each time it is laid out anew, as its first fit does, a frame later, once the nodes stand\n// where the layout put them\nconst FitOnLayout = ({ layout }: { layout: GraphLayout | undefined }) => {\n const flow = useReactFlow()\n useEffect(() => {\n if (!layout) return\n const frame = requestAnimationFrame(() => void flow.fitView(fitViewOptions))\n return () => cancelAnimationFrame(frame)\n }, [flow, layout])\n return null\n}\n\nconst Flow = (props: GraphViewProps) => {\n const { shape, content } = props\n const [measured, setMeasured] = useState<ReadonlyMap<string, Size>>(new Map())\n const sizes = useMemo(() => new Map(shape.nodes.map((node) => [node.id, content === undefined ? nodeSize : { width: contentWidth, height: measured.get(node.id)?.height ?? nodeSize.height }])), [shape, content, measured])\n const positions = useMemo(() => {\n const { x, y } = props.props\n if (x === undefined || y === undefined) return new Map<string, { x: number; y: number }>()\n return new Map(shape.nodes.flatMap((node) => {\n const at = { x: number(node.row[x]), y: number(node.row[y]) }\n return at.x === undefined || at.y === undefined ? [] : [[node.id, at as { x: number; y: number }]]\n }))\n }, [shape, props.props.x, props.props.y])\n const layoutName = props.props.layout ?? 'layered'\n const direction = props.props.direction ?? 'down'\n const layout = useGraphLayout(shape, { layout: layoutName, direction, sizes, positions })\n // A node with contents of its own is laid out at the height it draws at, so until each has drawn once the graph is\n // see-through: React Flow shows each node itself, so hiding the box would not hide them\n const ready = layout !== undefined && (content === undefined || shape.nodes.every((node) => measured.has(node.id)))\n const sides: Sides = layoutName === 'layered' && direction === 'right' ? 'horizontal' : 'vertical'\n const nodes = flowNodes(props, layout, sides)\n const edges = useMemo(() => flowEdges(props, layoutName === 'force'), [shape, props.edges.view, props.props, layoutName])\n const measure = (changes: NodeChange[]) => {\n const heights = changes.flatMap((change) => (change.type === 'dimensions' && change.dimensions && change.id.startsWith('node:') ? [[change.id.slice('node:'.length), change.dimensions] as const] : []))\n if (heights.length === 0) return\n setMeasured((before) => {\n const next = new Map(before)\n for (const [id, size] of heights) next.set(id, { width: Math.round(size.width), height: Math.round(size.height) })\n const same = next.size === before.size && [...next].every(([id, size]) => before.get(id)?.height === size.height)\n return same ? before : next\n })\n }\n return (\n <div className=\"w-full\" style={{ ...themed, aspectRatio: layout ? `${Math.max(layout.width, 1)} / ${Math.max(layout.height, 1)}` : undefined, minHeight, maxHeight, ...(!ready && { opacity: 0 }) }}>\n <ReactFlow\n nodes={nodes}\n edges={edges}\n nodeTypes={nodeTypes}\n onNodesChange={content === undefined ? undefined : measure}\n fitView\n fitViewOptions={fitViewOptions}\n minZoom={0.1}\n nodesDraggable={false}\n nodesConnectable={false}\n elementsSelectable={false}\n edgesFocusable={false}\n zoomOnScroll={false}\n zoomOnDoubleClick={false}\n preventScrolling={false}\n zoomOnPinch\n panOnDrag\n >\n <FitOnLayout layout={ready ? layout : undefined} />\n <Controls showInteractive={false} />\n </ReactFlow>\n </div>\n )\n}\n\n/**\n * The graph in a box as wide as the page and as tall as its shape asks, within bounds, fitted to it unless that would\n * shrink it past reading: pinch or the zoom buttons zoom it, dragging pans it, and the wheel scrolls the page past it.\n * Read-only: nothing moves, connects or is deleted.\n */\nexport const GraphView = (props: GraphViewProps) => (\n <ReactFlowProvider>\n <Flow {...props} />\n </ReactFlowProvider>\n)\n"],"mappings":"m3BAQMgC,EAAyC,CAC7C,QAAS,6BACT,KAAM,uBACN,MAAO,uBACP,MAAO,uBACP,IAAK,sBACL,OAAQ,qBACV,EAEMC,EAAS,CAAE,OAAQ,MAAO,OAAQ,OAAQ,EAKnCC,EAAoB,GAC/B,OAAO,YAAYtB,EAAe,QAAS,GAAU,O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,GAAW,YAAW,YAAW,GAAI,CAACc,GAAS,CAAE,QAAS,CAAE,CAAG,EAChM,UAAA,EAAA9C,EAAA,KAAA,CAACzF,EAAD,CACS,QACA,QACI,YACX,cAAekG,IAAY,IAAA,GAAY,IAAA,GAAYsC,EACnD,QAAA,GACgB,iBAChB,QAAS,GACT,eAAgB,GAChB,iBAAkB,GAClB,mBAAoB,GACpB,eAAgB,GAChB,aAAc,GACd,kBAAmB,GACnB,iBAAkB,GAClB,YAAA,GACA,UAAA,GAhBF,SAAA,EAkBE,EAAA/C,EAAA,IAAA,CAACqC,GAAD,CAAa,OAAQS,EAAQd,EAAS,IAAA,EAAY,CAAA,GAClD,EAAAhC,EAAA,IAAA,CAACnE,EAAD,CAAU,gBAAiB,EAAQ,CAAA,CAC1B,GACR,CAAA,CAET,EAOayH,GAAa,IACxB,EAAAtD,EAAA,IAAA,CAACrE,EAAD,CAAA,UACE,EAAAqE,EAAA,IAAA,CAACuC,GAAD,CAAM,GAAIlG,CAAQ,CAAA,CACD,CAAA","debugId":"774c4fb1-6c68-4e6c-a03e-27d3eb6463bc"}
|
|
1
|
+
{"version":3,"file":"graph-view-C_kd2p_w.js","names":["_Fragment","useMemo","useState","useState","useMemo","ReactFlow","n","a","t","__toESM","require_react","require_jsx_runtime","edgeCondition","edgeConditions","evaluateCondition","valueTone","ToneEdge","FieldBadge","RouteLink","scopeOf","RecordScope","scopeValue","valueColor","Position","MarkerType","ReactFlowProvider","useReactFlow","Controls","index","Handle","useElk","import_react","toneStrokes","dashes","edgeConditionsOf","props","name","holds","parsed","scope","row","path","edgeLook","status","colors","view","value","edge","stroke","dash","conditions","labelValue","labels","label","nodeSize","padding","elkPadding","placedGap","groupId","id","nodeId","algorithmOptions","input","unplaced","shape","node","graphElk","nodes","options","box","groups","members","group","loose","laid","edges","boundsOf","boxes","x","y","placeGraph","placed","position","engine","visit","child","parent","at","laidOut","above","below","shift","whole","moved","import_jsx_runtime","handle","Handles","sides","frame","chosen","RecordNode","data","fields","content","to","model","GroupNode","useGraphLayout","elk","signature","placedOnly","setLaidOut","failure","setFailure","current","result","error","nodeTypes","minHeight","maxHeight","fitViewOptions","themed","number","flowNodes","read","drawn","layout","select","flowEdges","look","straight","FitOnLayout","flow","Flow","measured","setMeasured","sizes","positions","layoutName","direction","ready","measure","heights","changes","change","next","before","size","GraphView"],"sources":["../../../src/app/pages/blocks/graph/graph-edges.ts","../../../src/app/pages/blocks/graph/graph-layout.ts","../../../src/app/pages/blocks/graph/graph-nodes.tsx","../../../src/app/pages/blocks/graph/use-graph-layout.ts","../../../src/app/pages/blocks/graph/graph-view.tsx"],"sourcesContent":["import { edgeCondition, edgeConditions, evaluateCondition, scopeValue, type GraphProps, type ShapeEdge } from '@protobase/layout'\nimport type { BadgeTone, ViewModel } from '@protobase/schema'\nimport { valueColor, valueTone } from '../../../../live/value-color'\n\n/** How an edge draws: its line's colour, whether it moves, its dashes, and the text on its middle. */\nexport type EdgeLook = { stroke: string; animated: boolean; dash?: string; label?: string }\n\n// A line in the colour its value's badge has, the app's border colour without one\nconst toneStrokes: Record<BadgeTone, string> = {\n neutral: 'var(--color-border-strong)',\n blue: 'var(--color-primary)',\n green: 'var(--color-success)',\n amber: 'var(--color-warning)',\n red: 'var(--color-danger)',\n violet: 'var(--color-violet)',\n}\n\nconst dashes = { dashed: '6 4', dotted: '1.5 4' }\n\ntype Parsed = Partial<Record<(typeof edgeConditions)[number], ReturnType<typeof edgeCondition>>>\n\n/** The graph's conditions on an edge, parsed once: a condition that does not parse never holds. */\nexport const edgeConditionsOf = (props: Pick<GraphProps, (typeof edgeConditions)[number]>): Parsed =>\n Object.fromEntries(edgeConditions.flatMap((name) => (typeof props[name] === 'string' ? [[name, edgeCondition(props[name])]] : [])))\n\nconst holds = (parsed: ReturnType<typeof edgeCondition> | undefined, row: Record<string, unknown>) => {\n if (!parsed?.ok) return false\n const scope = { stack: [{ record: row }] }\n return evaluateCondition(parsed, Object.fromEntries(parsed.paths.map((path) => [path, scopeValue(scope, path)])))\n}\n\n/** How `edge` draws by the graph's `edgeStatus`, `edgeLabel` and conditions, its colours and value labels the edges view's. */\nexport const edgeLook = (edge: ShapeEdge, props: Pick<GraphProps, 'edgeLabel' | 'edgeStatus'>, conditions: Parsed, view: ViewModel | undefined): EdgeLook => {\n const status = props.edgeStatus\n const colors = status === undefined ? undefined : view?.fields[status]?.valueColors\n const value = status === undefined ? undefined : edge.row[status]\n const stroke = status === undefined || value == null ? toneStrokes.neutral : (valueColor(colors, value) ?? toneStrokes[valueTone(colors, value)])\n const dash = holds(conditions.dotted, edge.row) ? dashes.dotted : holds(conditions.dashed, edge.row) ? dashes.dashed : undefined\n const labelValue = props.edgeLabel === undefined ? undefined : edge.row[props.edgeLabel]\n const labels = props.edgeLabel === undefined ? undefined : view?.fields[props.edgeLabel]?.valueLabels\n const label = labelValue == null || labelValue === '' ? undefined : (labels?.[String(labelValue)] ?? String(labelValue))\n return { stroke, animated: holds(conditions.animated, edge.row), ...(dash && { dash }), ...(label !== undefined && { label }) }\n}\n","import type { ElkNode } from 'elkjs/lib/elk-api'\nimport type { GraphLayoutName, GraphShape } from '@protobase/layout'\n\n/** A node's size: room for its label on one or two lines and its status badge, the width a node's own contents get. */\nexport const nodeSize = { width: 200, height: 64 }\n\n/** The width of a node that draws contents of its own, whose height they decide. */\nexport const contentWidth = 224\n\n/** A box at its top-left corner, in the graph's own coordinates. */\nexport type Box = { x: number; y: number; width: number; height: number }\n\nexport type Size = { width: number; height: number }\n\n/** Where each group and node of a graph sits, each group a region around its nodes, and the size of the whole. */\nexport type GraphLayout = { groups: Map<string, Box>; nodes: Map<string, Box>; width: number; height: number }\n\n/** How a graph is laid out: its algorithm, which way a layered one runs, each node's size, and the nodes placed by their records. */\nexport type LayoutInput = { layout: GraphLayoutName; direction: 'down' | 'right'; sizes: ReadonlyMap<string, Size>; positions: ReadonlyMap<string, { x: number; y: number }> }\n\n// Room in a region around its nodes, more on top for its value\nconst padding = { top: 32, side: 16, bottom: 16 }\nconst elkPadding = `[top=${padding.top},left=${padding.side},bottom=${padding.bottom},right=${padding.side}]`\n\n// The space between the nodes the engine lays out and the ones placed above them\nconst placedGap = 48\n\nconst groupId = (id: string) => `group:${id}`\nconst nodeId = (id: string) => `node:${id}`\n\nconst algorithmOptions = (input: LayoutInput): Record<string, string> =>\n input.layout === 'force'\n ? // Its seed is fixed, so the same records always make the same picture\n { 'elk.algorithm': 'force', 'elk.randomSeed': '1', 'elk.spacing.nodeNode': '40' }\n : { 'elk.algorithm': 'layered', 'elk.direction': input.direction === 'right' ? 'RIGHT' : 'DOWN', 'elk.layered.spacing.nodeNodeBetweenLayers': '56', 'elk.spacing.nodeNode': '32' }\n\n/** The nodes the engine places: those without a position of their own. */\nconst unplaced = (shape: GraphShape, input: LayoutInput) => shape.nodes.filter((node) => !input.positions.has(node.id))\n\n/**\n * The graph ELK lays out: each node without a position as a box of its size, inside a box of its group, and each edge\n * between two of them. A layered graph lays its groups out with the rest (hierarchy INCLUDE_CHILDREN); a force one\n * lays each group out inside its box, then the boxes as nodes. `undefined` when every node has a position.\n */\nexport const graphElk = (shape: GraphShape, input: LayoutInput): ElkNode | undefined => {\n const nodes = unplaced(shape, input)\n if (nodes.length === 0) return undefined\n const options = algorithmOptions(input)\n const box = (id: string): ElkNode => ({ id: nodeId(id), ...(input.sizes.get(id) ?? nodeSize) })\n const groups = shape.groups.flatMap((group): ElkNode[] => {\n const members = nodes.filter((node) => node.group === group.id)\n return members.length === 0 ? [] : [{ id: groupId(group.id), layoutOptions: { ...options, 'elk.padding': elkPadding }, children: members.map((node) => box(node.id)) }]\n })\n const loose = nodes.filter((node) => node.group === undefined).map((node) => box(node.id))\n const laid = new Set(nodes.map((node) => node.id))\n const edges = shape.edges.filter((edge) => laid.has(edge.source) && laid.has(edge.target) && edge.source !== edge.target).map((edge) => ({ id: `edge:${edge.id}`, sources: [nodeId(edge.source)], targets: [nodeId(edge.target)] }))\n return { id: 'root', layoutOptions: { ...options, ...(input.layout === 'layered' && { 'elk.hierarchyHandling': 'INCLUDE_CHILDREN' }) }, children: [...groups, ...loose], edges }\n}\n\nconst boundsOf = (boxes: Box[]): Box | undefined => {\n if (boxes.length === 0) return undefined\n const x = Math.min(...boxes.map((box) => box.x))\n const y = Math.min(...boxes.map((box) => box.y))\n return { x, y, width: Math.max(...boxes.map((box) => box.x + box.width)) - x, height: Math.max(...boxes.map((box) => box.y + box.height)) - y }\n}\n\n/**\n * Where everything sits: each placed node at its position, the nodes the engine laid out (`laidOut`, from `graphElk`)\n * under them, each group a region around its nodes, the whole moved so it starts at 0, 0.\n */\nexport const placeGraph = (shape: GraphShape, input: LayoutInput, laidOut?: ElkNode): GraphLayout => {\n const placed = new Map<string, Box>()\n for (const node of shape.nodes) {\n const position = input.positions.get(node.id)\n if (position) placed.set(node.id, { ...position, ...(input.sizes.get(node.id) ?? nodeSize) })\n }\n // ELK gives each child its place inside its parent\n const engine = new Map<string, Box>()\n const visit = (parent: ElkNode, x: number, y: number) => {\n for (const child of parent.children ?? []) {\n const at = { x: x + (child.x ?? 0), y: y + (child.y ?? 0) }\n if (child.id.startsWith('node:')) engine.set(child.id.slice('node:'.length), { ...at, width: child.width ?? nodeSize.width, height: child.height ?? nodeSize.height })\n else visit(child, at.x, at.y)\n }\n }\n if (laidOut) visit(laidOut, 0, 0)\n const above = boundsOf([...placed.values()])\n const below = boundsOf([...engine.values()])\n const shift = above && below ? { x: above.x - below.x, y: above.y + above.height + placedGap - below.y } : { x: 0, y: 0 }\n for (const [id, box] of engine) placed.set(id, { ...box, x: box.x + shift.x, y: box.y + shift.y })\n const groups = new Map<string, Box>()\n for (const group of shape.groups) {\n const members = boundsOf(shape.nodes.filter((node) => node.group === group.id && placed.has(node.id)).map((node) => placed.get(node.id)!))\n if (members) groups.set(group.id, { x: members.x - padding.side, y: members.y - padding.top, width: members.width + 2 * padding.side, height: members.height + padding.top + padding.bottom })\n }\n const whole = boundsOf([...placed.values(), ...groups.values()]) ?? { x: 0, y: 0, width: 0, height: 0 }\n const moved = (box: Box): Box => ({ ...box, x: box.x - whole.x, y: box.y - whole.y })\n return {\n nodes: new Map([...placed].map(([id, box]) => [id, moved(box)])),\n groups: new Map([...groups].map(([id, box]) => [id, moved(box)])),\n width: whole.width,\n height: whole.height,\n }\n}\n","import type { GraphFields } from '@protobase/layout'\nimport type { ResourceModel, ViewModel } from '@protobase/schema'\nimport { Handle, Position, type Node, type NodeProps } from '@xyflow/react'\nimport type { ReactNode } from 'react'\nimport { RouteLink, type RouteTarget } from '../../../../primitives/route-link'\nimport { FieldBadge } from '../../../field-badge'\nimport { ToneEdge } from '../../../related-cards/tone-edge'\nimport { RecordScope } from '../../record-scope'\nimport { scopeOf } from '../../use-layout-data'\n\ntype Drawn = { model: ResourceModel; view: ViewModel | undefined; fields: GraphFields }\n\n/** Which sides a node's edges meet it on: the top and bottom for a graph that runs down, else the left and right. */\nexport type Sides = 'vertical' | 'horizontal'\n\n/**\n * A node as it draws: its record, what the graph draws in each node, the link that chooses it when the graph has\n * `select`, whether it is chosen, and which sides its edges meet.\n */\nexport type RecordNodeData = Drawn & { row: Record<string, unknown>; content?: ReactNode; to?: RouteTarget; chosen: boolean; sides: Sides }\n\n/** A group as it draws: the record of one of its nodes, whose `group` value it shows. */\nexport type GroupNodeData = Drawn & { row: Record<string, unknown> }\n\n// The handles take no part in the drawing, since the graph cannot be edited\nconst handle = 'pointer-events-none !min-h-0 !min-w-0 !border-0 !bg-transparent'\n\nconst Handles = ({ sides }: { sides: Sides }) => (\n <>\n <Handle type=\"target\" position={sides === 'vertical' ? Position.Top : Position.Left} isConnectable={false} className={handle} />\n <Handle type=\"source\" position={sides === 'vertical' ? Position.Bottom : Position.Right} isConnectable={false} className={handle} />\n </>\n)\n\nconst frame = (chosen: boolean) => `relative rounded-lg border bg-surface text-body ${chosen ? 'border-primary ring-2 ring-primary/40' : 'border-border'}`\n\n/**\n * A node: with contents of the graph's own, those, drawn inside its record, the whole node a link that chooses it; else\n * its label, linking to the page with it chosen, over its status badge. Its status colours its left edge.\n */\nexport const RecordNode = ({ data }: NodeProps<Node<RecordNodeData, 'record'>>) => {\n const { model, view, fields, row, content, to, chosen, sides } = data\n const label = String(row[fields.label] ?? '')\n const edge = fields.status && <ToneEdge view={view} field={fields.status} record={row} />\n if (content !== undefined) {\n return (\n <div data-chosen={chosen || undefined} className={`${frame(chosen)} flex w-full flex-col gap-1 px-3 py-2`}>\n <Handles sides={sides} />\n {edge}\n {/* A link over the whole node chooses it, under the contents, whose own links stay theirs; React Flow turns\n pointer events off on a node that cannot be dragged or selected, so each takes them back */}\n {to && <RouteLink to={to} aria-label={label} aria-current={chosen || undefined} className=\"pointer-events-auto absolute inset-0 rounded-lg hover:bg-muted/40\" />}\n <div className=\"relative min-w-0 [overflow-wrap:anywhere] [&_a]:pointer-events-auto\">\n <RecordScope value={scopeOf(model, row)}>{content}</RecordScope>\n </div>\n </div>\n )\n }\n return (\n <div data-chosen={chosen || undefined} className={`${frame(chosen)} flex size-full flex-col justify-center gap-1 px-3 py-2`}>\n <Handles sides={sides} />\n {edge}\n {to ? (\n <RouteLink to={to} aria-current={chosen || undefined} className=\"pointer-events-auto line-clamp-2 min-w-0 font-medium [overflow-wrap:anywhere] text-primary-text hover:underline\">\n {label}\n </RouteLink>\n ) : (\n <span className=\"line-clamp-2 min-w-0 font-medium [overflow-wrap:anywhere]\">{label}</span>\n )}\n {fields.status && (\n <div className=\"flex\">\n <FieldBadge model={model} view={view} field={fields.status} record={row} />\n </div>\n )}\n </div>\n )\n}\n\n/** A group: a region around its nodes, its `group` value at its top. */\nexport const GroupNode = ({ data }: NodeProps<Node<GroupNodeData, 'group-box'>>) => (\n <div className=\"size-full rounded-xl border border-dashed border-border-strong bg-muted/40\">\n {data.fields.group && (\n <div className=\"flex px-2 pt-1 text-xs\">\n <FieldBadge model={data.model} view={data.view} field={data.fields.group} record={data.row} />\n </div>\n )}\n </div>\n)\n","import { useEffect, useMemo, useState } from 'react'\nimport type { GraphShape } from '@protobase/layout'\nimport { useElk } from '../../../../lib/elk/use-elk'\nimport { graphElk, placeGraph, type GraphLayout, type LayoutInput } from './graph-layout'\n\n/**\n * Where the graph's groups and nodes sit, laid out again when its nodes, edges, sizes or positions change; undefined\n * until the first layout is done. A layout that a newer one overtook is dropped. Without a node to lay out, the engine\n * is never asked. A layout that fails throws, for the block's fallback or the page's error boundary to draw.\n */\nexport const useGraphLayout = (shape: GraphShape, input: LayoutInput): GraphLayout | undefined => {\n const elk = graphElk(shape, input)\n const engine = useElk()\n // One text for what the layout is made from, so a new shape of the same records lays nothing out again\n const signature = JSON.stringify([elk, shape.nodes.map((node) => node.id), shape.groups.map((group) => group.id), [...input.positions], [...input.sizes]])\n const placedOnly = useMemo(() => (elk ? undefined : placeGraph(shape, input)), [signature])\n const [laidOut, setLaidOut] = useState<{ signature: string; layout: GraphLayout }>()\n const [failure, setFailure] = useState<Error>()\n useEffect(() => {\n if (!engine || !elk) return\n let current = true\n engine.layout(elk).then(\n (result) => {\n if (current) setLaidOut({ signature, layout: placeGraph(shape, input, result) })\n },\n (error: unknown) => {\n if (current) setFailure(error instanceof Error ? error : new Error(String(error)))\n },\n )\n return () => {\n current = false\n }\n }, [engine, signature])\n // A layout that failed, such as a worker that cannot load, draws the graph's fallback or its error, not a blank box\n if (failure) throw failure\n if (placedOnly) return placedOnly\n // The last layout stands while the next one is made, so a live update does not blank the graph\n return laidOut?.layout\n}\n","import { Controls, MarkerType, ReactFlow, ReactFlowProvider, useReactFlow, type Edge, type Node, type NodeChange } from '@xyflow/react'\nimport type { GraphFields, GraphProps, GraphShape } from '@protobase/layout'\nimport { useEffect, useMemo, useState, type CSSProperties, type ReactNode } from 'react'\nimport type { ComponentRead, ComponentSelect } from '../../component-reads'\nimport { edgeConditionsOf, edgeLook } from './graph-edges'\nimport { contentWidth, nodeSize, type GraphLayout, type Size } from './graph-layout'\nimport { GroupNode, RecordNode, type GroupNodeData, type RecordNodeData, type Sides } from './graph-nodes'\nimport { useGraphLayout } from './use-graph-layout'\nimport '@xyflow/react/dist/style.css'\n\nconst nodeTypes = { record: RecordNode, 'group-box': GroupNode }\n\n// The box's height follows the graph's shape at the box's width, within bounds, so the page scrolls past it\nconst minHeight = 256\nconst maxHeight = 'min(40rem, 70vh)'\n\n// A graph wider than the box, as on a phone, stays readable and pans; the fit button shows all of it\nconst fitViewOptions = { minZoom: 0.6, maxZoom: 1 }\n\n// The library's lines and controls in the app's tokens, over the page's own background: the variables it reads over\n// its own defaults\nconst themed = {\n '--xy-edge-stroke': 'var(--color-border-strong)',\n '--xy-edge-stroke-width': '1.5',\n '--xy-background-color': 'transparent',\n '--xy-edge-label-background-color': 'var(--color-surface)',\n '--xy-edge-label-color': 'var(--color-muted-foreground)',\n '--xy-controls-button-background-color': 'var(--color-surface)',\n '--xy-controls-button-background-color-hover': 'var(--color-muted)',\n '--xy-controls-button-color': 'var(--color-foreground)',\n '--xy-controls-button-color-hover': 'var(--color-foreground)',\n '--xy-controls-button-border-color': 'var(--color-border)',\n '--xy-attribution-background-color': 'transparent',\n} as CSSProperties\n\nexport type GraphViewProps = {\n shape: GraphShape\n nodes: Pick<ComponentRead, 'model' | 'view'>\n edges: Pick<ComponentRead, 'model' | 'view'>\n fields: GraphFields\n props: Pick<GraphProps, 'layout' | 'direction' | 'x' | 'y' | 'edgeLabel' | 'edgeStatus' | 'animated' | 'dashed' | 'dotted'>\n select?: ComponentSelect\n /** What each node draws, inside its record, the graph's `node`; its label and status without it. */\n content?: ReactNode\n}\n\nconst number = (value: unknown) => (typeof value === 'number' && Number.isFinite(value) ? value : typeof value === 'string' && value.trim() !== '' && Number.isFinite(Number(value)) ? Number(value) : undefined)\n\n// The nodes React Flow draws: each group's region under the nodes, each node at its box, one with contents of its own\n// as wide as they are given and as tall as they draw, which it measures\nconst flowNodes = ({ shape, nodes: read, fields, select, content }: GraphViewProps, layout: GraphLayout | undefined, sides: Sides): Node[] => {\n const drawn = { model: read.model, view: read.view, fields }\n const groups = shape.groups.flatMap((group): Node<GroupNodeData>[] => {\n const box = layout?.groups.get(group.id)\n const row = shape.nodes.find((node) => node.group === group.id)!.row\n return box ? [{ id: `group:${group.id}`, type: 'group-box', position: { x: box.x, y: box.y }, width: box.width, height: box.height, zIndex: -1, data: { ...drawn, row }, draggable: false, selectable: false, focusable: false }] : []\n })\n const nodes = shape.nodes.map((node): Node<RecordNodeData> => {\n const box = layout?.nodes.get(node.id)\n const chosen = select?.chosen === node.id\n return {\n id: `node:${node.id}`,\n type: 'record',\n position: box ? { x: box.x, y: box.y } : { x: 0, y: 0 },\n ...(content === undefined ? { width: nodeSize.width, height: nodeSize.height } : { style: { width: contentWidth } }),\n data: { ...drawn, row: node.row, chosen, sides, ...(content !== undefined && { content }), ...(select && { to: select.linkTo(node.id) }) },\n draggable: false,\n selectable: false,\n }\n })\n return [...groups, ...nodes]\n}\n\nconst flowEdges = ({ shape, edges: read, props }: GraphViewProps, straight: boolean): Edge[] => {\n const conditions = edgeConditionsOf(props)\n return shape.edges.map((edge) => {\n const look = edgeLook(edge, props, conditions, read.view)\n return {\n id: `edge:${edge.id}`,\n source: `node:${edge.source}`,\n target: `node:${edge.target}`,\n ...(straight && { type: 'straight' }),\n markerEnd: { type: MarkerType.ArrowClosed, color: look.stroke },\n style: { stroke: look.stroke, ...(look.dash && { strokeDasharray: look.dash }) },\n animated: look.animated,\n ...(look.label !== undefined && { label: look.label, labelBgPadding: [4, 2] as [number, number], labelBgBorderRadius: 4 }),\n focusable: false,\n selectable: false,\n }\n })\n}\n\n// Fits the graph to its box each time it is laid out anew, as its first fit does, a frame later, once the nodes stand\n// where the layout put them\nconst FitOnLayout = ({ layout }: { layout: GraphLayout | undefined }) => {\n const flow = useReactFlow()\n useEffect(() => {\n if (!layout) return\n const frame = requestAnimationFrame(() => void flow.fitView(fitViewOptions))\n return () => cancelAnimationFrame(frame)\n }, [flow, layout])\n return null\n}\n\nconst Flow = (props: GraphViewProps) => {\n const { shape, content } = props\n const [measured, setMeasured] = useState<ReadonlyMap<string, Size>>(new Map())\n const sizes = useMemo(() => new Map(shape.nodes.map((node) => [node.id, content === undefined ? nodeSize : { width: contentWidth, height: measured.get(node.id)?.height ?? nodeSize.height }])), [shape, content, measured])\n const positions = useMemo(() => {\n const { x, y } = props.props\n if (x === undefined || y === undefined) return new Map<string, { x: number; y: number }>()\n return new Map(shape.nodes.flatMap((node) => {\n const at = { x: number(node.row[x]), y: number(node.row[y]) }\n return at.x === undefined || at.y === undefined ? [] : [[node.id, at as { x: number; y: number }]]\n }))\n }, [shape, props.props.x, props.props.y])\n const layoutName = props.props.layout ?? 'layered'\n const direction = props.props.direction ?? 'down'\n const layout = useGraphLayout(shape, { layout: layoutName, direction, sizes, positions })\n // A node with contents of its own is laid out at the height it draws at, so until each has drawn once the graph is\n // see-through: React Flow shows each node itself, so hiding the box would not hide them\n const ready = layout !== undefined && (content === undefined || shape.nodes.every((node) => measured.has(node.id)))\n const sides: Sides = layoutName === 'layered' && direction === 'right' ? 'horizontal' : 'vertical'\n const nodes = flowNodes(props, layout, sides)\n const edges = useMemo(() => flowEdges(props, layoutName === 'force'), [shape, props.edges.view, props.props, layoutName])\n const measure = (changes: NodeChange[]) => {\n const heights = changes.flatMap((change) => (change.type === 'dimensions' && change.dimensions && change.id.startsWith('node:') ? [[change.id.slice('node:'.length), change.dimensions] as const] : []))\n if (heights.length === 0) return\n setMeasured((before) => {\n const next = new Map(before)\n for (const [id, size] of heights) next.set(id, { width: Math.round(size.width), height: Math.round(size.height) })\n const same = next.size === before.size && [...next].every(([id, size]) => before.get(id)?.height === size.height)\n return same ? before : next\n })\n }\n return (\n <div className=\"w-full\" style={{ ...themed, aspectRatio: layout ? `${Math.max(layout.width, 1)} / ${Math.max(layout.height, 1)}` : undefined, minHeight, maxHeight, ...(!ready && { opacity: 0 }) }}>\n <ReactFlow\n nodes={nodes}\n edges={edges}\n nodeTypes={nodeTypes}\n onNodesChange={content === undefined ? undefined : measure}\n fitView\n fitViewOptions={fitViewOptions}\n minZoom={0.1}\n nodesDraggable={false}\n nodesConnectable={false}\n elementsSelectable={false}\n edgesFocusable={false}\n zoomOnScroll={false}\n zoomOnDoubleClick={false}\n preventScrolling={false}\n zoomOnPinch\n panOnDrag\n >\n <FitOnLayout layout={ready ? layout : undefined} />\n <Controls showInteractive={false} />\n </ReactFlow>\n </div>\n )\n}\n\n/**\n * The graph in a box as wide as the page and as tall as its shape asks, within bounds, fitted to it unless that would\n * shrink it past reading: pinch or the zoom buttons zoom it, dragging pans it, and the wheel scrolls the page past it.\n * Read-only: nothing moves, connects or is deleted.\n */\nexport const GraphView = (props: GraphViewProps) => (\n <ReactFlowProvider>\n <Flow {...props} />\n </ReactFlowProvider>\n)\n"],"mappings":"m3BAQMgC,EAAyC,CAC7C,QAAS,6BACT,KAAM,uBACN,MAAO,uBACP,MAAO,uBACP,IAAK,sBACL,OAAQ,qBACV,EAEMC,EAAS,CAAE,OAAQ,MAAO,OAAQ,OAAQ,EAKnCC,EAAoB,GAC/B,OAAO,YAAYrB,EAAe,QAAS,GAAU,OAAOsB,EAAMC,IAAU,SAAW,CAAC,CAACA,EAAMxB,EAAcuB,EAAMC,EAAK,CAAC,CAAC,EAAI,CAAC,CAAE,CAAC,EAE9HC,GAAS,EAAsD,IAAiC,CACpG,GAAI,CAACC,GAAQ,GAAI,MAAO,GACxB,IAAMC,EAAQ,CAAE,MAAO,CAAC,CAAE,OAAQC,CAAI,CAAC,CAAE,EACzC,OAAO1B,EAAkBwB,EAAQ,OAAO,YAAYA,EAAO,MAAM,IAAK,GAAS,CAACG,EAAMpB,EAAWkB,EAAOE,CAAI,CAAC,CAAC,CAAC,CAAC,CAClH,EAGaC,GAAY,EAAiB,EAAqD,EAAoB,IAA0C,CAC3J,IAAMC,EAASR,EAAM,WACfS,EAASD,IAAW,IAAA,GAAY,IAAA,GAAYE,GAAM,OAAOF,EAAO,EAAE,YAClEG,EAAQH,IAAW,IAAA,GAAY,IAAA,GAAYI,EAAK,IAAIJ,GACpDK,EAASL,IAAW,IAAA,IAAaG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AM,GAAIlG,CAAQ,CAAA,CACD,CAAA","debugId":"bf91dda9-ff07-4c83-bf1e-5999de10d401"}
|
package/dist/shell-source-maps/assets/{group-donut-BAyTgqYv.js.map → group-donut-w_BFP4Nu.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group-donut-
|
|
1
|
+
{"version":3,"file":"group-donut-w_BFP4Nu.js","names":["n","a","t","__toESM","measureText","Tooltip","ResponsiveContainer","Pie","PieChart","Cell","LegendItem","import_jsx_runtime","require_jsx_runtime","percent","whole","part","SliceTooltip","slice","payload","active","measure","GroupDonut","drawn","slices","sum"],"sources":["../../../src/app/charts/group-donut.tsx"],"sourcesContent":["import { Cell, Pie, PieChart, ResponsiveContainer, Tooltip } from 'recharts'\nimport type { ViewModel } from '@protobase/schema'\nimport { LegendItem } from './legend-item'\nimport { measureText, type ChartMeasure, type ChartSlice } from './chart-groups'\n\nconst percent = (part: number, whole: number) => (whole > 0 ? `${Math.round((part / whole) * 100)}%` : '')\n\nconst SliceTooltip = ({ active, payload, measure }: { active?: boolean; payload?: Array<{ payload: ChartSlice }>; measure: ChartMeasure }) => {\n const slice = payload?.[0]?.payload\n if (!active || !slice) return null\n return (\n <div className=\"rounded-md border bg-background px-2.5 py-1.5 text-xs shadow-pop\">\n <div className=\"text-muted-foreground\">{slice.label}</div>\n <div className=\"font-semibold tabular-nums\">{measureText(slice.value, measure)}</div>\n </div>\n )\n}\n\n/**\n * A donut of how a total shares out over a field's values, with a legend that names each, gives its number and share,\n * and links to its records: the legend, not the colour, says which slice is which.\n */\nexport const GroupDonut = ({ resource, view, slices, measure }: { resource: string; view: ViewModel | undefined; slices: ChartSlice[]; measure: ChartMeasure }) => {\n const drawn = slices.filter((slice) => slice.value !== null && slice.value > 0)\n const whole = drawn.reduce((sum, slice) => sum + slice.value!, 0)\n return (\n <div className=\"flex flex-col items-center gap-4 sm:flex-row sm:items-center\">\n <div className=\"size-36 shrink-0\">\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <PieChart>\n <Pie data={drawn} dataKey=\"value\" nameKey=\"label\" innerRadius=\"62%\" outerRadius=\"100%\" paddingAngle={drawn.length > 1 ? 1 : 0} stroke=\"var(--background)\" strokeWidth={2} isAnimationActive={false}>\n {drawn.map((slice) => (\n <Cell key={slice.key} fill={slice.color} />\n ))}\n </Pie>\n <Tooltip content={<SliceTooltip measure={measure} />} isAnimationActive={false} />\n </PieChart>\n </ResponsiveContainer>\n </div>\n <ul className=\"flex w-full min-w-0 flex-col gap-0.5\">\n {slices.map((slice) => (\n <LegendItem key={slice.key} resource={resource} view={view} filter={slice.filter} color={slice.color} label={slice.label}>\n <span className=\"font-medium tabular-nums\">{measureText(slice.value, measure)}</span>\n <span className=\"w-9 text-right text-xs text-muted-foreground tabular-nums\">{percent(slice.value ?? 0, whole)}</span>\n </LegendItem>\n ))}\n </ul>\n </div>\n )\n}\n"],"mappings":"suBAKMa,GAAW,EAAc,IAAmBC,EAAQ,EAAI,GAAG,KAAK,MAAOC,EAAOD,EAAS,GAAG,EAAE,GAAK,GAEjGE,GAAgB,CAAE,SAAQ,UAAS,aAAqG,CAC5I,IAAMC,EAAQC,IAAU,EAAE,EAAE,QAE5B,MADI,CAACC,GAAU,CAACF,EAAc,MAE5B,EAAAN,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,mEAAf,SAAA,EACE,EAAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,wBAAyB,SAAAM,EAAM,KAAW,CAAA,GACzD,EAAAN,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,6BAA8B,SAAAP,EAAYa,EAAM,MAAOG,CAAO,CAAO,CAAA,CACjF,GAET,EAMaC,GAAc,CAAE,WAAU,OAAM,SAAQ,aAA8G,CACjK,IAAMC,EAAQC,EAAO,OAAQ,GAAUN,EAAM,QAAU,MAAQA,EAAM,MAAQ,CAAC,EACxEH,EAAQQ,EAAM,QAAQ,EAAK,IAAUE,EAAMP,EAAM,MAAQ,CAAC,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CAAM,UAAU,aACd,YAAAA,EAAA,KAACI,EAAD,CAAU,IAAKC,EAAeX,EAAY,QAAQ,EAAc,YAAiB,OAAM,WAAcO,EAAK,SAAS,EAAG,MAAO,CAAE,KAAMJ,EAAM,aAAgBX,EAAQ,EAAI,CAAE,CAAI,EACzK,EAEV","names":["GuestCallPage","draft","setDraft","useState","name","setName","left","setLeft","admission","useCallback","__vitePreload","guestAdmission","guestLobby","link","signal","systemPath","submit","event","here","guestCallLink","base","import_jsx_runtime","text","Input","Button","CallView","guestCallsPath"],"ignoreList":[],"sources":["../../../src/calls/guest-call-page.tsx"],"sourcesContent":["import { useCallback, useState, type FormEvent } from 'react'\nimport { guestCallsPath } from '@protobase/schema/internal'\nimport { Button } from '../primitives/button'\nimport { Input } from '../primitives/input'\nimport { CallView } from './call-view'\nimport { guestAdmission } from './guest-admission'\nimport { guestCallLink } from './guest-call-link'\nimport { maxGuestNameLength } from './guest-name-length'\nimport { text } from './messages'\n\nexport type GuestCallPageProps = {\n /** The guest link's token. */\n link: string\n /** The API's system path, such as `/api` or `https://api.example.com/api`. */\n systemPath: string\n /** The app's base, which the guest link is at. */\n base: string\n}\n\n/**\n * The page a guest link opens, for someone with no account: their name, then the call view's check of their microphone\n * and camera, Ask to join, the wait in the lobby until someone in the call lets them in, and the call. They reach\n * nothing else of the app: the page asks only the lobby and the guest call socket.\n */\nexport const GuestCallPage = ({ link, systemPath, base }: GuestCallPageProps) => {\n const [draft, setDraft] = useState('')\n const [name, setName] = useState<string>()\n const [left, setLeft] = useState(false)\n const admission = useCallback(\n async (signal: AbortSignal) => {\n const { guestLobby } = await import('@protobase/client/calls')\n return guestAdmission(guestLobby({ systemPath }), link, name!, signal)\n },\n [systemPath, link, name],\n )\n const submit = (event: FormEvent) => {\n event.preventDefault()\n if (draft.trim()) setName(draft.trim())\n }\n const here = guestCallLink(base, link)\n\n if (left) {\n return (\n <p role=\"status\" className=\"flex min-h-[100dvh] items-center justify-center bg-background p-4 text-sm text-foreground\">\n {text('youLeft')}\n </p>\n )\n }\n if (name === undefined) {\n return (\n <main className=\"flex min-h-[100dvh] items-center justify-center bg-background p-4\">\n <form onSubmit={submit} className=\"flex w-full max-w-sm flex-col gap-3\">\n <p className=\"text-sm text-foreground\">{text('guestIntro')}</p>\n <label className=\"flex flex-col gap-1 text-sm text-foreground\">\n {text('yourName')}\n <Input autoFocus autoComplete=\"name\" maxLength={maxGuestNameLength} value={draft} onChange={(event) => setDraft(event.target.value)} />\n </label>\n <Button type=\"submit\" variant=\"primary\" disabled={!draft.trim()}>\n {text('continue')}\n </Button>\n </form>\n </main>\n )\n }\n return (\n <main className=\"h-[100dvh]\">\n <CallView url={guestCallsPath(systemPath, 'socket')} admission={admission} name={name} nameOf={() => text('someone')} leave={{ href: here, onFollow: () => setLeft(true) }} />\n </main>\n )\n}\n"],"file":"guest-call-page-
|
|
1
|
+
{"version":3,"mappings":";mtBAwBaA,GAAiB,CAAE,OAAM,aAAY,UAA+B,CAC/E,GAAM,CAACC,EAAOC,IAAA,EAAYC,YAAS,EAAE,EAC/B,CAACC,EAAMC,IAAA,EAAWF,YAAiB,EACnC,CAACG,EAAMC,IAAA,EAAWJ,YAAS,EAAK,EAChCK,GAAA,EAAYC,eAChB,KAAO,IAAwB,CAC7B,GAAM,CAAE,oBAAAC,EAAA,UAAF,IAAE,cAAe,MAAM,OAAO,6EACpC,OAAOC,EAAeC,EAAW,CAAE,YAAW,CAAC,EAAGC,EAAMT,EAAOU,CAAM,CACvE,EACA,CAACC,EAAYF,EAAMT,CAAI,CACzB,EACMY,EAAU,GAAqB,CACnCC,EAAM,eAAe,EACjBhB,EAAM,KAAK,GAAGI,EAAQJ,EAAM,KAAK,CAAC,CACxC,EACMiB,EAAOC,EAAcC,EAAMP,CAAI,EAyBrC,OAvBIP,GAEA,EAAAe,EAAA,KAAC,IAAD,CAAG,KAAK,SAAS,UAAU,4FACxB,SAAAC,EAAK,SAAS,CACd,GAGHlB,IAAS,QAET,EAAAiB,EAAA,KAAC,OAAD,CAAM,UAAU,oEACd,YAAAA,EAAA,MAAC,OAAD,CAAM,SAAUL,EAAQ,UAAU,sCAAlC,WACE,EAAAK,EAAA,KAAC,IAAD,CAAG,UAAU,0BAA2B,SAAAC,EAAK,YAAY,CAAK,IAC9D,EAAAD,EAAA,MAAC,QAAD,CAAO,UAAU,8CAAjB,UACGC,EAAK,UAAU,GAChB,EAAAD,EAAA,KAACE,EAAD,CAAO,aAAU,aAAa,OAAO,aAA+B,MAAOtB,EAAO,SAAW,GAAUC,EAASe,EAAM,OAAO,KAAK,CAAI,EACjI,KACP,EAAAI,EAAA,KAACG,EAAD,CAAQ,KAAK,SAAS,QAAQ,UAAU,SAAU,CAACvB,EAAM,KAAK,EAC3D,SAAAqB,EAAK,UAAU,CACV,EACJ,GACF,IAIR,EAAAD,EAAA,KAAC,OAAD,CAAM,UAAU,aACd,YAAAA,EAAA,KAACI,EAAD,CAAU,IAAKC,EAAeX,EAAY,QAAQ,EAAc,YAAiB,OAAM,WAAcO,EAAK,SAAS,EAAG,MAAO,CAAE,KAAMJ,EAAM,aAAgBX,EAAQ,EAAI,CAAE,CAAI,EACzK,EAEV","names":["GuestCallPage","draft","setDraft","useState","name","setName","left","setLeft","admission","useCallback","__vitePreload","guestAdmission","guestLobby","link","signal","systemPath","submit","event","here","guestCallLink","base","import_jsx_runtime","text","Input","Button","CallView","guestCallsPath"],"ignoreList":[],"sources":["../../../src/calls/guest-call-page.tsx"],"sourcesContent":["import { useCallback, useState, type FormEvent } from 'react'\nimport { guestCallsPath } from '@protobase/schema/internal'\nimport { Button } from '../primitives/button'\nimport { Input } from '../primitives/input'\nimport { CallView } from './call-view'\nimport { guestAdmission } from './guest-admission'\nimport { guestCallLink } from './guest-call-link'\nimport { maxGuestNameLength } from './guest-name-length'\nimport { text } from './messages'\n\nexport type GuestCallPageProps = {\n /** The guest link's token. */\n link: string\n /** The API's system path, such as `/api` or `https://api.example.com/api`. */\n systemPath: string\n /** The app's base, which the guest link is at. */\n base: string\n}\n\n/**\n * The page a guest link opens, for someone with no account: their name, then the call view's check of their microphone\n * and camera, Ask to join, the wait in the lobby until someone in the call lets them in, and the call. They reach\n * nothing else of the app: the page asks only the lobby and the guest call socket.\n */\nexport const GuestCallPage = ({ link, systemPath, base }: GuestCallPageProps) => {\n const [draft, setDraft] = useState('')\n const [name, setName] = useState<string>()\n const [left, setLeft] = useState(false)\n const admission = useCallback(\n async (signal: AbortSignal) => {\n const { guestLobby } = await import('@protobase/client/calls')\n return guestAdmission(guestLobby({ systemPath }), link, name!, signal)\n },\n [systemPath, link, name],\n )\n const submit = (event: FormEvent) => {\n event.preventDefault()\n if (draft.trim()) setName(draft.trim())\n }\n const here = guestCallLink(base, link)\n\n if (left) {\n return (\n <p role=\"status\" className=\"flex min-h-[100dvh] items-center justify-center bg-background p-4 text-sm text-foreground\">\n {text('youLeft')}\n </p>\n )\n }\n if (name === undefined) {\n return (\n <main className=\"flex min-h-[100dvh] items-center justify-center bg-background p-4\">\n <form onSubmit={submit} className=\"flex w-full max-w-sm flex-col gap-3\">\n <p className=\"text-sm text-foreground\">{text('guestIntro')}</p>\n <label className=\"flex flex-col gap-1 text-sm text-foreground\">\n {text('yourName')}\n <Input autoFocus autoComplete=\"name\" maxLength={maxGuestNameLength} value={draft} onChange={(event) => setDraft(event.target.value)} />\n </label>\n <Button type=\"submit\" variant=\"primary\" disabled={!draft.trim()}>\n {text('continue')}\n </Button>\n </form>\n </main>\n )\n }\n return (\n <main className=\"h-[100dvh]\">\n <CallView url={guestCallsPath(systemPath, 'socket')} admission={admission} name={name} nameOf={() => text('someone')} leave={{ href: here, onFollow: () => setLeft(true) }} />\n </main>\n )\n}\n"],"file":"guest-call-page-D3gaOqIw.js","debugId":"f781a3aa-230a-4d00-aa4c-1427c32e860c"}
|
package/dist/shell-source-maps/assets/{html-viewer-DaeVR6PB.js.map → html-viewer-BrCIs_XH.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-viewer-
|
|
1
|
+
{"version":3,"file":"html-viewer-BrCIs_XH.js","names":["useCallback","n","a","t","__toESM","require_react","require_jsx_runtime","useAppAddress","HtmlFrame","useSiblingPage","useViewedResource","PageSkeleton","useFileText","import_react","openTab","url","useFrameLinks","resource","fileAddress","file","link","href","to","newTab","go","import_jsx_runtime","HtmlViewer","read","page","siblings","address","follow"],"sources":["../../../src/app/file-viewers/use-frame-links.ts","../../../src/app/file-viewers/html-viewer.tsx"],"sourcesContent":["import { useCallback } from 'react'\nimport { useAppAddress } from '../use-app-address'\nimport type { SiblingFile } from './file-viewer'\nimport type { FrameLink } from './sibling-page'\nimport { useViewedResource } from './viewed-resource'\n\nconst openTab = (url: string) => window.open(url, '_blank', 'noopener,noreferrer')\n\n/**\n * The links of a sibling page in a file viewer. A sibling opens on its record's address with `?file=<field>`, which its\n * link shows, in this tab or a new one: in its viewer, or beside its download when it has none. An outside address\n * opens in a new tab that cannot reach back to the app.\n */\nexport const useFrameLinks = () => {\n const resource = useViewedResource()\n const { go, href } = useAppAddress()\n\n const fileAddress = useCallback((file: SiblingFile) => ({ kind: 'record', resource, key: file.key, file: file.field }) as const, [resource])\n\n const address = useCallback(\n (link: FrameLink<SiblingFile>) => (link.kind === 'external' ? link.url : new URL(href(fileAddress(link.file)), window.location.href).href),\n [fileAddress, href],\n )\n\n const follow = useCallback(\n (link: FrameLink<SiblingFile>, { newTab }: { newTab: boolean }) => {\n if (link.kind === 'external') {\n openTab(link.url)\n return\n }\n const to = fileAddress(link.file)\n if (newTab) {\n openTab(href(to))\n return\n }\n go(to)\n },\n [fileAddress, go, href],\n )\n\n return { address, follow }\n}\n","import { PageSkeleton } from './page-skeleton'\nimport type { FileViewerProps } from './file-viewer'\nimport { HtmlFrame } from './html-frame'\nimport { useFileText } from './use-file-text'\nimport { useFrameLinks } from './use-frame-links'\nimport { useSiblingPage } from './use-sibling-page'\n\n/**\n * Protobase's viewer for HTML files: the page in an `HtmlFrame` that runs none of its scripts, with its images, videos\n * and links resolved to its siblings. A file it cannot read throws, so the viewer page offers the download instead.\n */\nexport const HtmlViewer = ({ file, siblings }: FileViewerProps) => {\n const read = useFileText(file)\n const { address, follow } = useFrameLinks()\n const page = useSiblingPage(read.data, siblings, address)\n if (read.error) throw read.error\n if (!page) return <PageSkeleton name={file.name} />\n return <HtmlFrame html={page.html} title={file.name} links={page.links} onLink={follow} />\n}\n"],"mappings":"upBAMMc,EAAW,GAAgB,OAAO,KAAKC,EAAK,SAAU,qBAAqB,EAOpEC,MAAsB,CACjC,IAAMC,EAAWP,EAAkB,EAC7B,CAAE,KAAI,QAASH,EAAc,EAE7BW,GAAA,EAAclB,EAAAA,YAAAA,CAAa,IAAuB,CAAE,KAAM,SAAU,WAAU,IAAKmB,EAAK,IAAK,KAAMA,EAAK,KAAM,GAAa,CAACF,CAAQ,CAAC,EAuB3I,MAAO,CAAE,SAAA,EArBOjB,EAAAA,YAAAA,CACb,GAAkCoB,EAAK,OAAS,WAAaA,EAAK,IAAM,IAAI,IAAIC,EAAKH,EAAYE,EAAK,IAAI,CAAC,EAAG,OAAO,SAAS,IAAI,CAAC,CAAC,KACrI,CAACF,EAAaG,CAAI,CAmBX,EAAS,QAAA,EAhBHrB,EAAAA,YAAAA,EACZ,EAA8B,CAAE,YAAkC,CACjE,GAAIoB,EAAK,OAAS,WAAY,CAC5BN,EAAQM,EAAK,GAAG,EAChB,MACF,CACA,IAAME,EAAKJ,EAAYE,EAAK,IAAI,EAChC,GAAIG,EAAQ,CACVT,EAAQO,EAAKC,CAAE,CAAC,EAChB,MACF,CACAE,EAAGF,CAAE,CACP,EACA,CAACJ,EAAaM,EAAIH,CAAI,CAGN,CAAO,CAC3B,aC9BaK,GAAc,CAAE,OAAM,cAAgC,CACjE,IAAMC,EAAOf,EAAYO,CAAI,EACvB,CAAE,UAAS,UAAWH,EAAc,EACpCY,EAAOnB,EAAekB,EAAK,KAAME,EAAUC,CAAO,EACxD,GAAIH,EAAK,MAAO,MAAMA,EAAK,MAE3B,OADKC,GACE,EAAAH,EAAA,IAAA,CAACjB,EAAD,CAAW,KAAMoB,EAAK,KAAM,MAAOT,EAAK,KAAM,MAAOS,EAAK,MAAO,OAAQG,CAAS,CAAA,GADvE,EAAAN,EAAA,IAAA,CAACd,EAAD,CAAc,KAAMQ,EAAK,IAAO,CAAA,CAEpD","debugId":"6b088b3f-5c7f-45a1-bf1a-42798dd16cab"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-dialog-6I25EI49.js","names":["useState","useMemo","useRef","_Fragment","n","a","t","__toESM","require_react","require_jsx_runtime","localeDecimal","ResponsiveDialog","Segmented","ErrorBanner","TriangleAlert","Button","useResourceClients","formatTag","humanize","useQueryClient","requiredOnCreate","ImportFileStep","ImportChecking","runImport","autoMapping","relationModel","matchFields","ImportSummary","checkImport","importableFields","createLookups","ImportSelect","fieldLabel","ImportProgressStep","ImportCheckStep","workerSheetSource","readHead","unmappedRequired","text","cellText","columnName","import_jsx_runtime","modes","modeHelp","skip","ImportMappingStep","view","views","model","headers","flow","sample","missing","fieldOptions","field","columnOptions","column","keys","canUpdate","mapped","entry","target","resources","examples","row","example","name","next","candidate","matchBy","import_react","localeFormats","decimal","locale","parts","part","isJsonFile","file","emptyProgress","useImportFlow","clientFor","queryClient","step","setStep","error","setError","setFile","json","fields","sheet","setSheet","head","setHead","mode","setMode","columns","setColumns","match","setMatch","options","setOptions","cancelled","checking","fail","cause","choose","source","sourceFor","chosen","sheets","open","read","fileFields","key","keyColumn","openSheet","mapColumn","others","current","b","matchColumnBy","plan","context","controller","result","latest","progress","prefix","errorTitle","readyToCheck","ImportDialog","plural","close","onClose","cancelButton","rows"],"sources":["../../../src/app/import/import-mapping-step.tsx","../../../src/app/import/locale-formats.ts","../../../src/app/import/sheet-file.ts","../../../src/app/import/use-import-flow.ts","../../../src/app/import/import-dialog.tsx"],"sourcesContent":["import { TriangleAlert } from 'lucide-react'\nimport type { ResourceModel, ViewModel } from '@protobase/schema'\nimport { Segmented } from '../../primitives/segmented'\nimport { ImportSelect } from './import-select'\nimport { fieldLabel, matchFields, relationModel, requiredOnCreate, unmappedRequired, type ImportMode } from './mapping'\nimport { cellText, columnName } from './sheet-cell'\nimport type { ImportFlow } from './use-import-flow'\nimport { text } from './messages'\n\ntype ImportMappingStepProps = {\n flow: ImportFlow\n model: ResourceModel\n resources: Record<string, ResourceModel>\n views: Record<string, ViewModel>\n /** Whether the user may update records, which the update modes need. */\n canUpdate: boolean\n}\n\nconst modes = (): Array<{ value: ImportMode; label: string }> => [\n { value: 'create', label: text('create') },\n { value: 'update', label: text('update') },\n { value: 'upsert', label: text('upsert') },\n]\n\nconst modeHelp = { create: 'createHint', update: 'updateHint', upsert: 'upsertHint' } as const satisfies Record<ImportMode, string>\n\nconst skip = ''\n\n/**\n * Which field each column of the file fills: matched by header to a field's label or name, changed or skipped here. A\n * relation's column also says which field of the related records its values are, and an update which column finds the\n * records it changes.\n */\nexport const ImportMappingStep = ({ flow, model, resources, views, canUpdate }: ImportMappingStepProps) => {\n const view = views[model.name]\n const headers = flow.head?.headers ?? []\n const sample = flow.head?.sample ?? []\n const missing = unmappedRequired(flow.mode, flow.fields, flow.columns)\n const fieldOptions = [{ value: skip, label: text('doNotImport') }, ...flow.fields.map((field) => ({ value: field.name, label: `${fieldLabel(view, field.name)}${requiredOnCreate(field) ? ' *' : ''}` }))]\n const columnOptions = headers.map((_, column) => ({ value: String(column), label: columnName(headers, column) }))\n const keys = matchFields(model)\n\n return (\n <div className=\"flex flex-col gap-5\">\n {canUpdate && (\n <div className=\"flex flex-col gap-1.5\">\n <span className=\"font-medium\">{text('rows')}</span>\n <div>\n <Segmented label={text('whatEachRowDoes')} size=\"md\" value={flow.mode} options={modes()} onChange={flow.setMode} />\n </div>\n <p className=\"text-xs text-muted-foreground\">{text(modeHelp[flow.mode])}</p>\n </div>\n )}\n {flow.mode !== 'create' && (\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\n <ImportSelect\n label={text('findBy')}\n value={flow.match?.field ?? skip}\n options={[{ value: skip, label: text('chooseField') }, ...keys.map((field) => ({ value: field.name, label: fieldLabel(view, field.name) }))]}\n onChange={(field) => flow.setMatch(field ? { field, column: flow.match?.column ?? 0 } : undefined)}\n help={text('findByHint')}\n />\n <ImportSelect\n label={text('foundInColumn')}\n value={flow.match ? String(flow.match.column) : skip}\n options={[{ value: skip, label: text('chooseColumn') }, ...columnOptions]}\n onChange={(column) => flow.setMatch(column && flow.match ? { ...flow.match, column: Number(column) } : flow.match)}\n />\n </div>\n )}\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\n <ImportSelect\n label={text('numbers')}\n value={flow.options.decimal}\n options={[\n { value: '.', label: '1,234.56' },\n { value: ',', label: '1.234,56' },\n ]}\n onChange={(decimal) => flow.setOptions({ ...flow.options, decimal: decimal as '.' | ',' })}\n />\n <ImportSelect\n label={text('dates')}\n value={flow.options.dateOrder}\n options={[\n { value: 'dmy', label: text('dayFirst') },\n { value: 'mdy', label: text('monthFirst') },\n ]}\n onChange={(dateOrder) => flow.setOptions({ ...flow.options, dateOrder: dateOrder as 'dmy' | 'mdy' })}\n help={text('datesHint')}\n />\n </div>\n {flow.mode !== 'update' && <p className=\"-mb-3 text-xs text-muted-foreground\">{text('requiredMarked')}</p>}\n <section aria-label={text('columns')} className=\"flex flex-col divide-y divide-border border-y\">\n {headers.map((_, column) => {\n const mapped = flow.columns.find((entry) => entry.column === column)\n const field = mapped ? model.fields[mapped.field] : undefined\n const target = field ? relationModel(field, resources) : undefined\n const examples = sample.map((row) => cellText(row.cells[column] ?? null)).filter((example) => example !== '').slice(0, 3)\n const name = columnName(headers, column)\n return (\n <div key={column} className=\"grid grid-cols-1 gap-2 py-3 sm:grid-cols-2 sm:gap-4\">\n <div className=\"min-w-0\">\n <p className=\"truncate font-medium\">{name}</p>\n <p className=\"truncate text-xs text-muted-foreground\">{examples.length > 0 ? examples.join(', ') : text('emptyInFirstRows')}</p>\n </div>\n <div className=\"flex min-w-0 flex-col gap-2\">\n <ImportSelect label={text('field')} name={text('fieldFor', { name })} value={mapped?.field ?? skip} options={fieldOptions} onChange={(next) => flow.mapColumn(column, next || undefined)} />\n {target && (\n <ImportSelect\n label={text('foundBy')}\n name={text('pluralFoundBy', { plural: views[target.name]?.names?.plural ?? fieldLabel(view, field!.name) })}\n value={mapped!.matchBy ?? target.primaryKey[0]!}\n options={matchFields(target).map((candidate) => ({ value: candidate.name, label: fieldLabel(views[target.name], candidate.name) }))}\n onChange={(matchBy) => flow.matchColumnBy(column, matchBy)}\n />\n )}\n </div>\n </div>\n )\n })}\n </section>\n {missing.length > 0 && (\n <p role=\"alert\" className=\"flex gap-2 rounded-lg border border-warning/30 bg-warning-soft px-3 py-2 text-warning-text\">\n <TriangleAlert className=\"mt-0.5 size-4 shrink-0\" />\n <span>\n {text('noColumnFills', { fields: missing.map((field) => fieldLabel(view, field.name)).join(', ') })}\n </span>\n </p>\n )}\n </div>\n )\n}\n","import { localeDecimal } from '../../format/number-text'\nimport type { ConvertOptions } from './convert'\n\n/**\n * How the browser's locale writes numbers and dates, as the import's starting choice: its decimal separator, and whether\n * its dates put the day or the month first. The user sees both and can change them.\n */\nexport const localeFormats = (locale?: string): ConvertOptions => {\n const decimal = localeDecimal(locale)\n const parts = new Intl.DateTimeFormat(locale).formatToParts(new Date(2026, 3, 3)).map((part) => part.type)\n return { decimal, dateOrder: parts.indexOf('month') < parts.indexOf('day') ? 'mdy' : 'dmy' }\n}\n","import { createCsvParser } from './csv-chunks'\nimport { jsonRows } from './json-rows'\nimport type { SheetRow } from './sheet-cell'\nimport { openWorkbook } from './xlsx-reader'\nimport { text } from './messages'\n\n/** The file kinds an import reads. */\nexport type SheetFormat = 'xlsx' | 'csv' | 'json'\n\n/** Whether the file is JSON, by its name's extension or its media type. */\nexport const isJsonFile = (file: File) => /\\.json$/i.test(file.name) || file.type.split(';')[0]!.trim().toLowerCase() === 'application/json'\n\n// An .xlsx is a ZIP archive, which starts with \"PK\"\nconst startsAsZip = async (file: Blob) => {\n const head = new Uint8Array(await file.slice(0, 2).arrayBuffer())\n return head[0] === 0x50 && head[1] === 0x4b\n}\n\n/** Whether the file is a workbook, CSV text or JSON: by its name's extension, else by whether it is a ZIP archive. */\nexport const sheetFormat = async (file: File): Promise<SheetFormat> => {\n if (isJsonFile(file)) return 'json'\n const extension = /\\.([^.]+)$/.exec(file.name)?.[1]?.toLowerCase()\n if (extension === 'xlsx') return 'xlsx'\n if (extension === 'csv' || extension === 'tsv' || extension === 'txt') return 'csv'\n return (await startsAsZip(file)) ? 'xlsx' : 'csv'\n}\n\n/** The workbook's sheet names, in order; a CSV or JSON file has none. */\nexport const sheetNames = async (file: File) => ((await sheetFormat(file)) === 'xlsx' ? (await openWorkbook(file)).sheets : [])\n\nconst notText = () => new Error(text('fileNotUtf8'))\n\nasync function* csvRows(file: Blob): AsyncGenerator<SheetRow> {\n const parser = createCsvParser()\n // Fatal, so a file in another encoding is refused rather than read with replacement characters\n const decoder = new TextDecoder('utf-8', { fatal: true })\n const decode = (bytes?: Uint8Array) => {\n try {\n return bytes ? decoder.decode(bytes, { stream: true }) : decoder.decode()\n } catch (error) {\n if (error instanceof TypeError) throw notText()\n throw error\n }\n }\n const reader = file.stream().getReader()\n let line = 0\n const numbered = (rows: string[][]) => rows.map((cells) => ({ line: ++line, cells }))\n try {\n for (;;) {\n const { done, value } = await reader.read()\n if (done) break\n yield* numbered(parser.push(decode(value)))\n }\n yield* numbered([...parser.push(decode()), ...parser.end()])\n } finally {\n await reader.cancel()\n }\n}\n\n/**\n * The rows of the file, the header first: a CSV's (UTF-8, with its delimiter found from the header line) or the named\n * sheet of a workbook, read as the file streams in, or a JSON file's objects, read whole.\n */\nexport async function* sheetRows(file: File, sheet?: string): AsyncGenerator<SheetRow> {\n const format = await sheetFormat(file)\n if (format === 'csv') return yield* csvRows(file)\n if (format === 'json') return yield* await jsonRows(file)\n const workbook = await openWorkbook(file)\n const name = sheet ?? workbook.sheets[0]\n if (name === undefined) throw new Error(text('noSheets'))\n yield* workbook.rows(name)\n}\n","import { useQueryClient } from '@tanstack/react-query'\nimport { useMemo, useRef, useState } from 'react'\nimport type { ResourceModel, ViewModel } from '@protobase/schema'\nimport { useResourceClients } from '../../data/api-provider'\nimport type { ConvertOptions } from './convert'\nimport { localeFormats } from './locale-formats'\nimport { createLookups } from './lookups'\nimport { autoMapping, importableFields, matchFields, type ColumnMapping, type ImportMode } from './mapping'\nimport type { ImportPlan } from './prepare-rows'\nimport { checkImport, readHead, runImport, type ImportCheck, type ImportProgress, type SheetHead } from './run-import'\nimport { isJsonFile } from './sheet-file'\nimport { workerSheetSource, type SheetSource } from './sheet-source'\n\n/** Where the import dialog is: choosing a file, mapping its columns, checking its rows, writing them, or done. */\nexport type ImportStep =\n | { kind: 'file'; reading: boolean }\n | { kind: 'map' }\n | { kind: 'checking'; rows: number }\n | { kind: 'checked'; check: ImportCheck }\n | { kind: 'importing'; progress: ImportProgress; total: number; cancelling: boolean }\n | { kind: 'done'; result: ImportProgress & { cancelled: boolean }; stopped?: unknown }\n\nexport type ImportFlowOptions = {\n model: ResourceModel\n resources: Record<string, ResourceModel>\n views: Record<string, ViewModel>\n /** Reads the chosen file; a Web Worker by default. */\n sourceFor?: (file: File) => SheetSource\n}\n\nconst emptyProgress: ImportProgress = { created: 0, updated: 0, skipped: 0, failed: 0, notWritten: [] }\n\n/** The state of an import, from choosing the file to its summary, and the moves between its steps. */\nexport const useImportFlow = ({ model, resources, views, sourceFor = workerSheetSource }: ImportFlowOptions) => {\n const clientFor = useResourceClients()\n const queryClient = useQueryClient()\n const view = views[model.name]\n const [step, setStep] = useState<ImportStep>({ kind: 'file', reading: false })\n const [error, setError] = useState<unknown>()\n const [file, setFile] = useState<{ file: File; source: SheetSource; sheets: string[] }>()\n const json = file ? isJsonFile(file.file) : false\n const fields = useMemo(() => importableFields(model, resources, { json }), [model, resources, json])\n const [sheet, setSheet] = useState<string>()\n const [head, setHead] = useState<SheetHead>()\n const [mode, setMode] = useState<ImportMode>('create')\n const [columns, setColumns] = useState<ColumnMapping[]>([])\n const [match, setMatch] = useState<ImportPlan['match']>()\n const [options, setOptions] = useState<ConvertOptions>(() => localeFormats())\n const cancelled = useRef(false)\n const checking = useRef<AbortController | undefined>(undefined)\n\n const fail = (next: ImportStep) => (cause: unknown) => {\n setError(cause)\n setStep(next)\n }\n\n /** Reads the chosen file's sheet names; a CSV, or a workbook of one sheet, goes on to its columns. */\n const choose = (chosen: File) => {\n setError(undefined)\n setStep({ kind: 'file', reading: true })\n const source = sourceFor(chosen)\n void source\n .sheets()\n .then((sheets) => {\n setFile({ file: chosen, source, sheets })\n setSheet(sheets[0])\n if (sheets.length <= 1) return open(source, sheets[0], importableFields(model, resources, { json: isJsonFile(chosen) }))\n setStep({ kind: 'file', reading: false })\n })\n .catch(fail({ kind: 'file', reading: false }))\n }\n\n // The sheet's header and first rows, with each column mapped to the field its header names; the fields are the\n // chosen file's, which a file just chosen has not yet made the ones the flow shows\n const open = async (source: SheetSource, name: string | undefined, fileFields: typeof fields) => {\n setStep({ kind: 'file', reading: true })\n const read = await readHead(source, name)\n setHead(read)\n setColumns(autoMapping(read.headers, fileFields, view))\n const key = matchFields(model)[0]\n const keyColumn = key ? autoMapping(read.headers, [key], view)[0] : undefined\n setMatch(key && keyColumn ? { field: key.name, column: keyColumn.column } : undefined)\n setStep({ kind: 'map' })\n }\n\n const openSheet = () => {\n if (!file) return\n setError(undefined)\n open(file.source, sheet, fields).catch(fail({ kind: 'file', reading: false }))\n }\n\n /** Maps the column to the field, or skips it without one; a field fills one column, so another that had it is skipped. */\n const mapColumn = (column: number, field: string | undefined) =>\n setColumns((current) => {\n const others = current.filter((entry) => entry.column !== column && entry.field !== field)\n return field ? [...others, { column, field }].sort((a, b) => a.column - b.column) : others\n })\n\n /** The field of the related record a relation column is found by. */\n const matchColumnBy = (column: number, matchBy: string) => setColumns((current) => current.map((entry) => (entry.column === column ? { ...entry, matchBy } : entry)))\n\n const plan = (): ImportPlan => ({ mode, columns, match: mode === 'create' ? undefined : match, options })\n const context = () => ({ model, resources, views, lookups: createLookups(clientFor) })\n\n /** Reads the whole file and prepares each row as the import would, writing nothing. */\n const check = () => {\n if (!file) return\n setError(undefined)\n const controller = new AbortController()\n checking.current = controller\n setStep({ kind: 'checking', rows: 0 })\n checkImport(file.source, sheet, plan(), context(), (rows) => setStep({ kind: 'checking', rows }), controller.signal)\n .then((result) => {\n if (!controller.signal.aborted) setStep({ kind: 'checked', check: result })\n })\n .catch((cause: unknown) => {\n if (!controller.signal.aborted) fail({ kind: 'map' })(cause)\n })\n }\n\n const back = () => {\n checking.current?.abort()\n setError(undefined)\n setStep({ kind: 'map' })\n }\n\n /** Writes the rows in batches; Cancel stops it between two. */\n const start = (total: number) => {\n if (!file) return\n setError(undefined)\n cancelled.current = false\n setStep({ kind: 'importing', progress: emptyProgress, total, cancelling: false })\n let latest = emptyProgress\n const refresh = () => {\n for (const prefix of ['page', 'list', 'first-page', 'map', 'facets', 'series', 'aggregate', 'count']) void queryClient.invalidateQueries({ queryKey: [prefix, model.name] })\n }\n runImport(file.source, sheet, plan(), context(), {\n client: clientFor(model.name),\n onProgress: (progress) => {\n latest = progress\n setStep({ kind: 'importing', progress, total, cancelling: cancelled.current })\n },\n cancelled: () => cancelled.current,\n })\n .then((result) => setStep({ kind: 'done', result }))\n .catch((cause: unknown) => setStep({ kind: 'done', result: { ...latest, cancelled: false }, stopped: cause }))\n .finally(refresh)\n }\n\n const cancel = () => {\n cancelled.current = true\n setStep((current) => (current.kind === 'importing' ? { ...current, cancelling: true } : current))\n }\n\n /** Stops a check that is still reading, when the dialog closes. */\n const stop = () => checking.current?.abort()\n\n return {\n step,\n error,\n file: file?.file,\n sheets: file?.sheets ?? [],\n sheet,\n setSheet,\n head,\n fields,\n mode,\n setMode,\n columns,\n mapColumn,\n matchColumnBy,\n match,\n setMatch,\n options,\n setOptions,\n choose,\n openSheet,\n check,\n back,\n start,\n cancel,\n stop,\n }\n}\n\nexport type ImportFlow = ReturnType<typeof useImportFlow>\n","import type { ResourceModel, ViewModel } from '@protobase/schema'\nimport { humanize } from '../../live/naming'\nimport { Button } from '../../primitives/button'\nimport { ResponsiveDialog } from '../../primitives/responsive-dialog'\nimport { ErrorBanner } from '../error-banner'\nimport { ImportChecking, ImportCheckStep } from './import-check-step'\nimport { ImportFileStep } from './import-file-step'\nimport { ImportMappingStep } from './import-mapping-step'\nimport { ImportProgressStep, ImportSummary } from './import-result-step'\nimport { unmappedRequired } from './mapping'\nimport type { SheetSource } from './sheet-source'\nimport { useImportFlow, type ImportFlow } from './use-import-flow'\nimport { formatTag } from '../../locale/active-locale'\nimport { text } from './messages'\n\nexport type ImportDialogProps = {\n model: ResourceModel\n resources: Record<string, ResourceModel>\n views: Record<string, ViewModel>\n /** Whether the user may update records, which the update modes need. */\n canUpdate: boolean\n onClose: () => void\n /** Reads the chosen file; a Web Worker by default. */\n sourceFor?: (file: File) => SheetSource\n}\n\nconst errorTitle = (flow: ImportFlow) => (flow.step.kind === 'file' ? text('couldNotReadFile') : text('couldNotCheck'))\n\n// Whether the mapping is complete enough to check: a column to import, the fields new records need, and the column\n// that finds the records to update\nconst readyToCheck = (flow: ImportFlow) => {\n if (flow.columns.length === 0) return false\n if (flow.mode === 'create') return unmappedRequired('create', flow.fields, flow.columns).length === 0\n return flow.match !== undefined\n}\n\n/**\n * Imports records from an .xlsx or CSV file into a resource: choose the file (and its sheet), map its columns to\n * fields, check every row, then write them in batches with progress, Cancel between batches, and a summary with the rows\n * not imported to download.\n */\nexport const ImportDialog = ({ model, resources, views, canUpdate, onClose, sourceFor }: ImportDialogProps) => {\n const flow = useImportFlow({ model, resources, views, sourceFor })\n const view = views[model.name]\n const plural = view?.names?.plural ?? humanize(model.name)\n const { step } = flow\n const headers = flow.head?.headers ?? []\n\n const close = () => {\n if (step.kind === 'importing') return\n flow.stop()\n onClose()\n }\n const cancelButton = <Button onClick={close}>{text('cancel')}</Button>\n\n const actions = () => {\n switch (step.kind) {\n case 'file':\n return (\n <>\n {cancelButton}\n {flow.sheets.length > 1 && (\n <Button variant=\"primary\" loading={step.reading} onClick={flow.openSheet}>\n {text('next')}\n </Button>\n )}\n </>\n )\n case 'map':\n return (\n <>\n {cancelButton}\n <Button variant=\"primary\" disabled={!readyToCheck(flow)} onClick={flow.check}>\n {text('checkRows')}\n </Button>\n </>\n )\n case 'checking':\n return (\n <>\n <Button onClick={flow.back}>{text('back')}</Button>\n <Button variant=\"primary\" loading>\n {text('checking')}\n </Button>\n </>\n )\n case 'checked': {\n const rows = step.check.creates + step.check.updates\n return (\n <>\n <Button onClick={flow.back}>{text('back')}</Button>\n <Button variant=\"primary\" disabled={rows === 0} onClick={() => flow.start(rows)}>\n {text('importRows', { count: rows.toLocaleString(formatTag()), rows })}\n </Button>\n </>\n )\n }\n case 'importing':\n return (\n <Button variant=\"danger\" disabled={step.cancelling} onClick={flow.cancel}>\n {text('cancelImport')}\n </Button>\n )\n case 'done':\n return (\n <Button variant=\"primary\" onClick={onClose}>\n {text('done')}\n </Button>\n )\n }\n }\n\n const body = () => {\n switch (step.kind) {\n case 'file':\n return <ImportFileStep file={flow.file} sheets={flow.sheets} sheet={flow.sheet} reading={step.reading} onChoose={flow.choose} onSheet={flow.setSheet} />\n case 'map':\n return <ImportMappingStep flow={flow} model={model} resources={resources} views={views} canUpdate={canUpdate} />\n case 'checking':\n return <ImportChecking rows={step.rows} />\n case 'checked':\n return <ImportCheckStep check={step.check} model={model} resources={resources} views={views} columns={flow.columns} headers={headers} fileName={flow.file?.name} />\n case 'importing':\n return <ImportProgressStep progress={step.progress} total={step.total} cancelling={step.cancelling} />\n case 'done':\n return <ImportSummary result={step.result} stopped={step.stopped} headers={headers} fileName={flow.file?.name} />\n }\n }\n\n return (\n <ResponsiveDialog open wide title={text('importPlural', { plural })} description={flow.file && step.kind !== 'file' ? flow.file.name : undefined} onClose={close} actions={actions()}>\n <div className=\"flex flex-col gap-4\">\n {flow.error !== undefined && <ErrorBanner title={errorTit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EAAD,CAAe,OAAQuD,EAAK,OAAQ,QAASA,EAAK,QAAkB,UAAS,SAAUhC,EAAK,MAAM,IAAO,CAAA,CACpH,CACF,EAMO,CAAK,CACH,GACW,CAAA,CAEtB","debugId":"3a236e44-238f-4cbb-8bee-cab567dec795"}
|
|
1
|
+
{"version":3,"file":"import-dialog-DCcZNJgD.js","names":["useState","useMemo","useRef","_Fragment","n","a","t","__toESM","require_react","require_jsx_runtime","localeDecimal","Segmented","ResponsiveDialog","humanize","TriangleAlert","ErrorBanner","useResourceClients","formatTag","Button","useQueryClient","requiredOnCreate","ImportFileStep","ImportChecking","runImport","autoMapping","relationModel","matchFields","ImportSummary","checkImport","importableFields","createLookups","ImportSelect","fieldLabel","ImportProgressStep","ImportCheckStep","workerSheetSource","readHead","unmappedRequired","text","cellText","columnName","import_jsx_runtime","modes","modeHelp","skip","ImportMappingStep","view","views","model","headers","flow","sample","missing","fieldOptions","field","columnOptions","column","keys","canUpdate","mapped","entry","target","resources","examples","row","example","name","next","candidate","matchBy","import_react","localeFormats","decimal","locale","parts","part","isJsonFile","file","emptyProgress","useImportFlow","clientFor","queryClient","step","setStep","error","setError","setFile","json","fields","sheet","setSheet","head","setHead","mode","setMode","columns","setColumns","match","setMatch","options","setOptions","cancelled","checking","fail","cause","choose","source","sourceFor","chosen","sheets","open","read","fileFields","key","keyColumn","openSheet","mapColumn","others","current","b","matchColumnBy","plan","context","controller","result","latest","progress","prefix","errorTitle","readyToCheck","ImportDialog","plural","close","onClose","cancelButton","rows"],"sources":["../../../src/app/import/import-mapping-step.tsx","../../../src/app/import/locale-formats.ts","../../../src/app/import/sheet-file.ts","../../../src/app/import/use-import-flow.ts","../../../src/app/import/import-dialog.tsx"],"sourcesContent":["import { TriangleAlert } from 'lucide-react'\nimport type { ResourceModel, ViewModel } from '@protobase/schema'\nimport { Segmented } from '../../primitives/segmented'\nimport { ImportSelect } from './import-select'\nimport { fieldLabel, matchFields, relationModel, requiredOnCreate, unmappedRequired, type ImportMode } from './mapping'\nimport { cellText, columnName } from './sheet-cell'\nimport type { ImportFlow } from './use-import-flow'\nimport { text } from './messages'\n\ntype ImportMappingStepProps = {\n flow: ImportFlow\n model: ResourceModel\n resources: Record<string, ResourceModel>\n views: Record<string, ViewModel>\n /** Whether the user may update records, which the update modes need. */\n canUpdate: boolean\n}\n\nconst modes = (): Array<{ value: ImportMode; label: string }> => [\n { value: 'create', label: text('create') },\n { value: 'update', label: text('update') },\n { value: 'upsert', label: text('upsert') },\n]\n\nconst modeHelp = { create: 'createHint', update: 'updateHint', upsert: 'upsertHint' } as const satisfies Record<ImportMode, string>\n\nconst skip = ''\n\n/**\n * Which field each column of the file fills: matched by header to a field's label or name, changed or skipped here. A\n * relation's column also says which field of the related records its values are, and an update which column finds the\n * records it changes.\n */\nexport const ImportMappingStep = ({ flow, model, resources, views, canUpdate }: ImportMappingStepProps) => {\n const view = views[model.name]\n const headers = flow.head?.headers ?? []\n const sample = flow.head?.sample ?? []\n const missing = unmappedRequired(flow.mode, flow.fields, flow.columns)\n const fieldOptions = [{ value: skip, label: text('doNotImport') }, ...flow.fields.map((field) => ({ value: field.name, label: `${fieldLabel(view, field.name)}${requiredOnCreate(field) ? ' *' : ''}` }))]\n const columnOptions = headers.map((_, column) => ({ value: String(column), label: columnName(headers, column) }))\n const keys = matchFields(model)\n\n return (\n <div className=\"flex flex-col gap-5\">\n {canUpdate && (\n <div className=\"flex flex-col gap-1.5\">\n <span className=\"font-medium\">{text('rows')}</span>\n <div>\n <Segmented label={text('whatEachRowDoes')} size=\"md\" value={flow.mode} options={modes()} onChange={flow.setMode} />\n </div>\n <p className=\"text-xs text-muted-foreground\">{text(modeHelp[flow.mode])}</p>\n </div>\n )}\n {flow.mode !== 'create' && (\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\n <ImportSelect\n label={text('findBy')}\n value={flow.match?.field ?? skip}\n options={[{ value: skip, label: text('chooseField') }, ...keys.map((field) => ({ value: field.name, label: fieldLabel(view, field.name) }))]}\n onChange={(field) => flow.setMatch(field ? { field, column: flow.match?.column ?? 0 } : undefined)}\n help={text('findByHint')}\n />\n <ImportSelect\n label={text('foundInColumn')}\n value={flow.match ? String(flow.match.column) : skip}\n options={[{ value: skip, label: text('chooseColumn') }, ...columnOptions]}\n onChange={(column) => flow.setMatch(column && flow.match ? { ...flow.match, column: Number(column) } : flow.match)}\n />\n </div>\n )}\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\n <ImportSelect\n label={text('numbers')}\n value={flow.options.decimal}\n options={[\n { value: '.', label: '1,234.56' },\n { value: ',', label: '1.234,56' },\n ]}\n onChange={(decimal) => flow.setOptions({ ...flow.options, decimal: decimal as '.' | ',' })}\n />\n <ImportSelect\n label={text('dates')}\n value={flow.options.dateOrder}\n options={[\n { value: 'dmy', label: text('dayFirst') },\n { value: 'mdy', label: text('monthFirst') },\n ]}\n onChange={(dateOrder) => flow.setOptions({ ...flow.options, dateOrder: dateOrder as 'dmy' | 'mdy' })}\n help={text('datesHint')}\n />\n </div>\n {flow.mode !== 'update' && <p className=\"-mb-3 text-xs text-muted-foreground\">{text('requiredMarked')}</p>}\n <section aria-label={text('columns')} className=\"flex flex-col divide-y divide-border border-y\">\n {headers.map((_, column) => {\n const mapped = flow.columns.find((entry) => entry.column === column)\n const field = mapped ? model.fields[mapped.field] : undefined\n const target = field ? relationModel(field, resources) : undefined\n const examples = sample.map((row) => cellText(row.cells[column] ?? null)).filter((example) => example !== '').slice(0, 3)\n const name = columnName(headers, column)\n return (\n <div key={column} className=\"grid grid-cols-1 gap-2 py-3 sm:grid-cols-2 sm:gap-4\">\n <div className=\"min-w-0\">\n <p className=\"truncate font-medium\">{name}</p>\n <p className=\"truncate text-xs text-muted-foreground\">{examples.length > 0 ? examples.join(', ') : text('emptyInFirstRows')}</p>\n </div>\n <div className=\"flex min-w-0 flex-col gap-2\">\n <ImportSelect label={text('field')} name={text('fieldFor', { name })} value={mapped?.field ?? skip} options={fieldOptions} onChange={(next) => flow.mapColumn(column, next || undefined)} />\n {target && (\n <ImportSelect\n label={text('foundBy')}\n name={text('pluralFoundBy', { plural: views[target.name]?.names?.plural ?? fieldLabel(view, field!.name) })}\n value={mapped!.matchBy ?? target.primaryKey[0]!}\n options={matchFields(target).map((candidate) => ({ value: candidate.name, label: fieldLabel(views[target.name], candidate.name) }))}\n onChange={(matchBy) => flow.matchColumnBy(column, matchBy)}\n />\n )}\n </div>\n </div>\n )\n })}\n </section>\n {missing.length > 0 && (\n <p role=\"alert\" className=\"flex gap-2 rounded-lg border border-warning/30 bg-warning-soft px-3 py-2 text-warning-text\">\n <TriangleAlert className=\"mt-0.5 size-4 shrink-0\" />\n <span>\n {text('noColumnFills', { fields: missing.map((field) => fieldLabel(view, field.name)).join(', ') })}\n </span>\n </p>\n )}\n </div>\n )\n}\n","import { localeDecimal } from '../../format/number-text'\nimport type { ConvertOptions } from './convert'\n\n/**\n * How the browser's locale writes numbers and dates, as the import's starting choice: its decimal separator, and whether\n * its dates put the day or the month first. The user sees both and can change them.\n */\nexport const localeFormats = (locale?: string): ConvertOptions => {\n const decimal = localeDecimal(locale)\n const parts = new Intl.DateTimeFormat(locale).formatToParts(new Date(2026, 3, 3)).map((part) => part.type)\n return { decimal, dateOrder: parts.indexOf('month') < parts.indexOf('day') ? 'mdy' : 'dmy' }\n}\n","import { createCsvParser } from './csv-chunks'\nimport { jsonRows } from './json-rows'\nimport type { SheetRow } from './sheet-cell'\nimport { openWorkbook } from './xlsx-reader'\nimport { text } from './messages'\n\n/** The file kinds an import reads. */\nexport type SheetFormat = 'xlsx' | 'csv' | 'json'\n\n/** Whether the file is JSON, by its name's extension or its media type. */\nexport const isJsonFile = (file: File) => /\\.json$/i.test(file.name) || file.type.split(';')[0]!.trim().toLowerCase() === 'application/json'\n\n// An .xlsx is a ZIP archive, which starts with \"PK\"\nconst startsAsZip = async (file: Blob) => {\n const head = new Uint8Array(await file.slice(0, 2).arrayBuffer())\n return head[0] === 0x50 && head[1] === 0x4b\n}\n\n/** Whether the file is a workbook, CSV text or JSON: by its name's extension, else by whether it is a ZIP archive. */\nexport const sheetFormat = async (file: File): Promise<SheetFormat> => {\n if (isJsonFile(file)) return 'json'\n const extension = /\\.([^.]+)$/.exec(file.name)?.[1]?.toLowerCase()\n if (extension === 'xlsx') return 'xlsx'\n if (extension === 'csv' || extension === 'tsv' || extension === 'txt') return 'csv'\n return (await startsAsZip(file)) ? 'xlsx' : 'csv'\n}\n\n/** The workbook's sheet names, in order; a CSV or JSON file has none. */\nexport const sheetNames = async (file: File) => ((await sheetFormat(file)) === 'xlsx' ? (await openWorkbook(file)).sheets : [])\n\nconst notText = () => new Error(text('fileNotUtf8'))\n\nasync function* csvRows(file: Blob): AsyncGenerator<SheetRow> {\n const parser = createCsvParser()\n // Fatal, so a file in another encoding is refused rather than read with replacement characters\n const decoder = new TextDecoder('utf-8', { fatal: true })\n const decode = (bytes?: Uint8Array) => {\n try {\n return bytes ? decoder.decode(bytes, { stream: true }) : decoder.decode()\n } catch (error) {\n if (error instanceof TypeError) throw notText()\n throw error\n }\n }\n const reader = file.stream().getReader()\n let line = 0\n const numbered = (rows: string[][]) => rows.map((cells) => ({ line: ++line, cells }))\n try {\n for (;;) {\n const { done, value } = await reader.read()\n if (done) break\n yield* numbered(parser.push(decode(value)))\n }\n yield* numbered([...parser.push(decode()), ...parser.end()])\n } finally {\n await reader.cancel()\n }\n}\n\n/**\n * The rows of the file, the header first: a CSV's (UTF-8, with its delimiter found from the header line) or the named\n * sheet of a workbook, read as the file streams in, or a JSON file's objects, read whole.\n */\nexport async function* sheetRows(file: File, sheet?: string): AsyncGenerator<SheetRow> {\n const format = await sheetFormat(file)\n if (format === 'csv') return yield* csvRows(file)\n if (format === 'json') return yield* await jsonRows(file)\n const workbook = await openWorkbook(file)\n const name = sheet ?? workbook.sheets[0]\n if (name === undefined) throw new Error(text('noSheets'))\n yield* workbook.rows(name)\n}\n","import { useQueryClient } from '@tanstack/react-query'\nimport { useMemo, useRef, useState } from 'react'\nimport type { ResourceModel, ViewModel } from '@protobase/schema'\nimport { useResourceClients } from '../../data/api-provider'\nimport type { ConvertOptions } from './convert'\nimport { localeFormats } from './locale-formats'\nimport { createLookups } from './lookups'\nimport { autoMapping, importableFields, matchFields, type ColumnMapping, type ImportMode } from './mapping'\nimport type { ImportPlan } from './prepare-rows'\nimport { checkImport, readHead, runImport, type ImportCheck, type ImportProgress, type SheetHead } from './run-import'\nimport { isJsonFile } from './sheet-file'\nimport { workerSheetSource, type SheetSource } from './sheet-source'\n\n/** Where the import dialog is: choosing a file, mapping its columns, checking its rows, writing them, or done. */\nexport type ImportStep =\n | { kind: 'file'; reading: boolean }\n | { kind: 'map' }\n | { kind: 'checking'; rows: number }\n | { kind: 'checked'; check: ImportCheck }\n | { kind: 'importing'; progress: ImportProgress; total: number; cancelling: boolean }\n | { kind: 'done'; result: ImportProgress & { cancelled: boolean }; stopped?: unknown }\n\nexport type ImportFlowOptions = {\n model: ResourceModel\n resources: Record<string, ResourceModel>\n views: Record<string, ViewModel>\n /** Reads the chosen file; a Web Worker by default. */\n sourceFor?: (file: File) => SheetSource\n}\n\nconst emptyProgress: ImportProgress = { created: 0, updated: 0, skipped: 0, failed: 0, notWritten: [] }\n\n/** The state of an import, from choosing the file to its summary, and the moves between its steps. */\nexport const useImportFlow = ({ model, resources, views, sourceFor = workerSheetSource }: ImportFlowOptions) => {\n const clientFor = useResourceClients()\n const queryClient = useQueryClient()\n const view = views[model.name]\n const [step, setStep] = useState<ImportStep>({ kind: 'file', reading: false })\n const [error, setError] = useState<unknown>()\n const [file, setFile] = useState<{ file: File; source: SheetSource; sheets: string[] }>()\n const json = file ? isJsonFile(file.file) : false\n const fields = useMemo(() => importableFields(model, resources, { json }), [model, resources, json])\n const [sheet, setSheet] = useState<string>()\n const [head, setHead] = useState<SheetHead>()\n const [mode, setMode] = useState<ImportMode>('create')\n const [columns, setColumns] = useState<ColumnMapping[]>([])\n const [match, setMatch] = useState<ImportPlan['match']>()\n const [options, setOptions] = useState<ConvertOptions>(() => localeFormats())\n const cancelled = useRef(false)\n const checking = useRef<AbortController | undefined>(undefined)\n\n const fail = (next: ImportStep) => (cause: unknown) => {\n setError(cause)\n setStep(next)\n }\n\n /** Reads the chosen file's sheet names; a CSV, or a workbook of one sheet, goes on to its columns. */\n const choose = (chosen: File) => {\n setError(undefined)\n setStep({ kind: 'file', reading: true })\n const source = sourceFor(chosen)\n void source\n .sheets()\n .then((sheets) => {\n setFile({ file: chosen, source, sheets })\n setSheet(sheets[0])\n if (sheets.length <= 1) return open(source, sheets[0], importableFields(model, resources, { json: isJsonFile(chosen) }))\n setStep({ kind: 'file', reading: false })\n })\n .catch(fail({ kind: 'file', reading: false }))\n }\n\n // The sheet's header and first rows, with each column mapped to the field its header names; the fields are the\n // chosen file's, which a file just chosen has not yet made the ones the flow shows\n const open = async (source: SheetSource, name: string | undefined, fileFields: typeof fields) => {\n setStep({ kind: 'file', reading: true })\n const read = await readHead(source, name)\n setHead(read)\n setColumns(autoMapping(read.headers, fileFields, view))\n const key = matchFields(model)[0]\n const keyColumn = key ? autoMapping(read.headers, [key], view)[0] : undefined\n setMatch(key && keyColumn ? { field: key.name, column: keyColumn.column } : undefined)\n setStep({ kind: 'map' })\n }\n\n const openSheet = () => {\n if (!file) return\n setError(undefined)\n open(file.source, sheet, fields).catch(fail({ kind: 'file', reading: false }))\n }\n\n /** Maps the column to the field, or skips it without one; a field fills one column, so another that had it is skipped. */\n const mapColumn = (column: number, field: string | undefined) =>\n setColumns((current) => {\n const others = current.filter((entry) => entry.column !== column && entry.field !== field)\n return field ? [...others, { column, field }].sort((a, b) => a.column - b.column) : others\n })\n\n /** The field of the related record a relation column is found by. */\n const matchColumnBy = (column: number, matchBy: string) => setColumns((current) => current.map((entry) => (entry.column === column ? { ...entry, matchBy } : entry)))\n\n const plan = (): ImportPlan => ({ mode, columns, match: mode === 'create' ? undefined : match, options })\n const context = () => ({ model, resources, views, lookups: createLookups(clientFor) })\n\n /** Reads the whole file and prepares each row as the import would, writing nothing. */\n const check = () => {\n if (!file) return\n setError(undefined)\n const controller = new AbortController()\n checking.current = controller\n setStep({ kind: 'checking', rows: 0 })\n checkImport(file.source, sheet, plan(), context(), (rows) => setStep({ kind: 'checking', rows }), controller.signal)\n .then((result) => {\n if (!controller.signal.aborted) setStep({ kind: 'checked', check: result })\n })\n .catch((cause: unknown) => {\n if (!controller.signal.aborted) fail({ kind: 'map' })(cause)\n })\n }\n\n const back = () => {\n checking.current?.abort()\n setError(undefined)\n setStep({ kind: 'map' })\n }\n\n /** Writes the rows in batches; Cancel stops it between two. */\n const start = (total: number) => {\n if (!file) return\n setError(undefined)\n cancelled.current = false\n setStep({ kind: 'importing', progress: emptyProgress, total, cancelling: false })\n let latest = emptyProgress\n const refresh = () => {\n for (const prefix of ['page', 'list', 'first-page', 'map', 'facets', 'series', 'aggregate', 'count']) void queryClient.invalidateQueries({ queryKey: [prefix, model.name] })\n }\n runImport(file.source, sheet, plan(), context(), {\n client: clientFor(model.name),\n onProgress: (progress) => {\n latest = progress\n setStep({ kind: 'importing', progress, total, cancelling: cancelled.current })\n },\n cancelled: () => cancelled.current,\n })\n .then((result) => setStep({ kind: 'done', result }))\n .catch((cause: unknown) => setStep({ kind: 'done', result: { ...latest, cancelled: false }, stopped: cause }))\n .finally(refresh)\n }\n\n const cancel = () => {\n cancelled.current = true\n setStep((current) => (current.kind === 'importing' ? { ...current, cancelling: true } : current))\n }\n\n /** Stops a check that is still reading, when the dialog closes. */\n const stop = () => checking.current?.abort()\n\n return {\n step,\n error,\n file: file?.file,\n sheets: file?.sheets ?? [],\n sheet,\n setSheet,\n head,\n fields,\n mode,\n setMode,\n columns,\n mapColumn,\n matchColumnBy,\n match,\n setMatch,\n options,\n setOptions,\n choose,\n openSheet,\n check,\n back,\n start,\n cancel,\n stop,\n }\n}\n\nexport type ImportFlow = ReturnType<typeof useImportFlow>\n","import type { ResourceModel, ViewModel } from '@protobase/schema'\nimport { humanize } from '../../live/naming'\nimport { Button } from '../../primitives/button'\nimport { ResponsiveDialog } from '../../primitives/responsive-dialog'\nimport { ErrorBanner } from '../error-banner'\nimport { ImportChecking, ImportCheckStep } from './import-check-step'\nimport { ImportFileStep } from './import-file-step'\nimport { ImportMappingStep } from './import-mapping-step'\nimport { ImportProgressStep, ImportSummary } from './import-result-step'\nimport { unmappedRequired } from './mapping'\nimport type { SheetSource } from './sheet-source'\nimport { useImportFlow, type ImportFlow } from './use-import-flow'\nimport { formatTag } from '../../locale/active-locale'\nimport { text } from './messages'\n\nexport type ImportDialogProps = {\n model: ResourceModel\n resources: Record<string, ResourceModel>\n views: Record<string, ViewModel>\n /** Whether the user may update records, which the update modes need. */\n canUpdate: boolean\n onClose: () => void\n /** Reads the chosen file; a Web Worker by default. */\n sourceFor?: (file: File) => SheetSource\n}\n\nconst errorTitle = (flow: ImportFlow) => (flow.step.kind === 'file' ? text('couldNotReadFile') : text('couldNotCheck'))\n\n// Whether the mapping is complete enough to check: a column to import, the fields new records need, and the column\n// that finds the records to update\nconst readyToCheck = (flow: ImportFlow) => {\n if (flow.columns.length === 0) return false\n if (flow.mode === 'create') return unmappedRequired('create', flow.fields, flow.columns).length === 0\n return flow.match !== undefined\n}\n\n/**\n * Imports records from an .xlsx or CSV file into a resource: choose the file (and its sheet), map its columns to\n * fields, check every row, then write them in batches with progress, Cancel between batches, and a summary with the rows\n * not imported to download.\n */\nexport const ImportDialog = ({ model, resources, views, canUpdate, onClose, sourceFor }: ImportDialogProps) => {\n const flow = useImportFlow({ model, resources, views, sourceFor })\n const view = views[model.name]\n const plural = view?.names?.plural ?? humanize(model.name)\n const { step } = flow\n const headers = flow.head?.headers ?? []\n\n const close = () => {\n if (step.kind === 'importing') return\n flow.stop()\n onClose()\n }\n const cancelButton = <Button onClick={close}>{text('cancel')}</Button>\n\n const actions = () => {\n switch (step.kind) {\n case 'file':\n return (\n <>\n {cancelButton}\n {flow.sheets.length > 1 && (\n <Button variant=\"primary\" loading={step.reading} onClick={flow.openSheet}>\n {text('next')}\n </Button>\n )}\n </>\n )\n case 'map':\n return (\n <>\n {cancelButton}\n <Button variant=\"primary\" disabled={!readyToCheck(flow)} onClick={flow.check}>\n {text('checkRows')}\n </Button>\n </>\n )\n case 'checking':\n return (\n <>\n <Button onClick={flow.back}>{text('back')}</Button>\n <Button variant=\"primary\" loading>\n {text('checking')}\n </Button>\n </>\n )\n case 'checked': {\n const rows = step.check.creates + step.check.updates\n return (\n <>\n <Button onClick={flow.back}>{text('back')}</Button>\n <Button variant=\"primary\" disabled={rows === 0} onClick={() => flow.start(rows)}>\n {text('importRows', { count: rows.toLocaleString(formatTag()), rows })}\n </Button>\n </>\n )\n }\n case 'importing':\n return (\n <Button variant=\"danger\" disabled={step.cancelling} onClick={flow.cancel}>\n {text('cancelImport')}\n </Button>\n )\n case 'done':\n return (\n <Button variant=\"primary\" onClick={onClose}>\n {text('done')}\n </Button>\n )\n }\n }\n\n const body = () => {\n switch (step.kind) {\n case 'file':\n return <ImportFileStep file={flow.file} sheets={flow.sheets} sheet={flow.sheet} reading={step.reading} onChoose={flow.choose} onSheet={flow.setSheet} />\n case 'map':\n return <ImportMappingStep flow={flow} model={model} resources={resources} views={views} canUpdate={canUpdate} />\n case 'checking':\n return <ImportChecking rows={step.rows} />\n case 'checked':\n return <ImportCheckStep check={step.check} model={model} resources={resources} views={views} columns={flow.columns} headers={headers} fileName={flow.file?.name} />\n case 'importing':\n return <ImportProgressStep progress={step.progress} total={step.total} cancelling={step.cancelling} />\n case 'done':\n return <ImportSummary result={step.result} stopped={step.stopped} headers={headers} fileName={flow.file?.name} />\n }\n }\n\n return (\n <ResponsiveDialog open wide title={text('importPlural', { plural })} description={flow.file && step.kind !== 'file' ? flow.file.name : undefined} onClose={close} actions={actions()}>\n <div className=\"flex flex-col gap-4\">\n {flow.error !== undefined && <ErrorBanner title={errorTitle(flow)} error={flow.error} />}\n {body()}\n </div>\n </ResponsiveDialog>\n )\n}\n"],"mappings":"u7BAkBM0C,MAA2D,CAC/D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