@protobase/ui 0.117.1 → 0.117.2
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/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/messages.d.ts +2 -2
- package/dist/app/conversation/thread-state.d.ts +1 -1
- 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/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/focus/messages.d.ts +2 -2
- package/dist/app/gallery/messages.d.ts +2 -2
- package/dist/app/history/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/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/guide/billing-config.d.ts +1 -1
- package/dist/app/pages/guide/billing-views.d.ts +1 -1
- package/dist/app/pages/messages.d.ts +2 -2
- package/dist/app/record-chart/messages.d.ts +2 -2
- package/dist/app/record-messages.d.ts +2 -2
- package/dist/app/record-mode/shown-layout.d.ts +1 -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/saved/use-favorite.d.ts +1 -1
- package/dist/app/search/messages.d.ts +2 -2
- package/dist/app/searches/messages.d.ts +2 -2
- package/dist/app/searches/use-save-search.d.ts +1 -1
- 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/compact-table/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/forms/messages.d.ts +2 -2
- package/dist/inline-child-table/messages.d.ts +2 -2
- package/dist/live/messages.d.ts +2 -2
- 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/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/plugins/messages.d.ts +2 -2
- package/dist/primitives/messages.d.ts +2 -2
- package/dist/record-view/messages.d.ts +2 -2
- package/dist/record-view/use-autosave.d.ts +1 -1
- package/dist/shell/assets/{account-page-DtK7jKts.js → account-page-U7RldneI.js} +2 -2
- package/dist/shell/assets/{app-BjX4WRlX.js → app-94a88jzE.js} +5 -5
- package/dist/shell/assets/{assistant-shell-m4yudVE_.js → assistant-shell-BJWCAwCu.js} +2 -2
- package/dist/shell/assets/{board-display-DTeV61do.js → board-display-DSazq67h.js} +2 -2
- package/dist/shell/assets/{calendar-display-C9M_BrdC.js → calendar-display-CpqjM4oV.js} +2 -2
- package/dist/shell/assets/{call-rings-TD7_HvNB.js → call-rings-DnL8InVq.js} +2 -2
- package/dist/shell/assets/{calls-Bp_BwXBR.js → calls-CTRygR5f.js} +2 -2
- package/dist/shell/assets/{circle-alert-Z5jvi5Dk.js → circle-alert-B63XjMgn.js} +2 -2
- package/dist/shell/assets/{composed-page-7cjr_6Rj.js → composed-page-BVm_6eWU.js} +2 -2
- package/dist/shell/assets/{composer-section-BOic27ni.js → composer-section-DETU2Obd.js} +2 -2
- package/dist/shell/assets/{connect-route-BQKWurfi.js → connect-route-BILeY04q.js} +2 -2
- package/dist/shell/assets/{copy-field-J-xjCVww.js → copy-field-CmFjZmVI.js} +2 -2
- package/dist/shell/assets/{create-route-cKTgbHdL.js → create-route-BT69PwsI.js} +2 -2
- package/dist/shell/assets/{custom-step-container-field-ClXbgsmG.js → custom-step-container-field-CZDuNAGK.js} +2 -2
- package/dist/shell/assets/{embedded-list-CdGDYOeK.js → embedded-list-C9U2ypuX.js} +3 -3
- package/dist/shell/assets/{export-dialog-DJFPmWjl.js → export-dialog-DoaQ8h-M.js} +2 -2
- package/dist/shell/assets/{graph-view-DdCNEjjp.js → graph-view-COd5Mp2P.js} +2 -2
- package/dist/shell/assets/{group-donut-YHImqCyt.js → group-donut-DUBQuhYa.js} +2 -2
- package/dist/shell/assets/{guest-call-page-DuJmX_uH.js → guest-call-page-Bu41Ptk4.js} +3 -3
- package/dist/shell/assets/{html-viewer-BXSFoAH-.js → html-viewer-Bz3ots0-.js} +2 -2
- package/dist/shell/assets/{import-dialog-D1pihaEn.js → import-dialog-B0lJXEBq.js} +2 -2
- package/dist/shell/assets/{import-table-dialog-Dd851s8K.js → import-table-dialog-CaZameXo.js} +2 -2
- package/dist/shell/assets/{index-B5AApF7s.js → index-YZpQ8sMq.js} +1 -1
- package/dist/shell/assets/{invitations-page-CVnZFr42.js → invitations-page-DPzcVGHk.js} +2 -2
- package/dist/shell/assets/{layout-grid-B4BydwOr.js → layout-grid-hoLv1QVh.js} +2 -2
- package/dist/shell/assets/{legend-item-DStfKS-y.js → legend-item-CU6Kt-GZ.js} +2 -2
- package/dist/shell/assets/{list-page-HyJhabYe.js → list-page-C8Z3OhmV.js} +4 -4
- package/dist/shell/assets/{maplibre-v43v0z7e.js → maplibre-BOVzS79J.js} +2 -2
- package/dist/shell/assets/{markdown-content-R7RUN0DQ.js → markdown-content-BMDl_vl_.js} +2 -2
- package/dist/shell/assets/{members-page-BIWsatyd.js → members-page-O752tFj8.js} +2 -2
- package/dist/shell/assets/{messages-CPMEQgWR.js → messages-TLh-JbDm.js} +2 -2
- package/dist/shell/assets/{organization-page-DY5ndg2R.js → organization-page-DDwBkk8F.js} +2 -2
- package/dist/shell/assets/{organizations-page-6HwVXvoa.js → organizations-page-DNYezYgw.js} +2 -2
- package/dist/shell/assets/{pending-invitation-row-Cy5mVb52.js → pending-invitation-row-DRjEfn76.js} +2 -2
- package/dist/shell/assets/{period-chart-dl5O03oa.js → period-chart-B_Vtp_OD.js} +2 -2
- package/dist/shell/assets/{person-row-CC1Anzap.js → person-row-ehgAozYT.js} +2 -2
- package/dist/shell/assets/{public-form-page-DdR2id-n.js → public-form-page-JM_r4BIq.js} +2 -2
- package/dist/shell/assets/{record-lines-D4ajVvtc.js → record-lines-B8maPngL.js} +2 -2
- package/dist/shell/assets/{record-map-IJBljngZ.js → record-map-BJI9HhZO.js} +2 -2
- package/dist/shell/assets/{record-opens-Dth-MEBS.js → record-opens-BP2LRuAM.js} +2 -2
- package/dist/shell/assets/{record-page-DZUqVmk0.js → record-page-DsLORKNo.js} +3 -3
- package/dist/shell/assets/{record-preview-wMoagd6i.js → record-preview-BDMeb9qp.js} +2 -2
- package/dist/shell/assets/{records-map-BbgGOE7w.js → records-map-D2IAAn9Z.js} +2 -2
- package/dist/shell/assets/{render-node-h9cWEbE-.js → render-node-CAL7-6hf.js} +3 -3
- package/dist/shell/assets/{reorder-button-gdDrG56h.js → reorder-button-D9hO_nqd.js} +2 -2
- package/dist/shell/assets/{run-trace-view-DqRcTHlR.js → run-trace-view-CqCld741.js} +2 -2
- package/dist/shell/assets/{runner-install-field-BhcDC4pg.js → runner-install-field-Cpd0yW2w.js} +2 -2
- package/dist/shell/assets/{runtime-update-BazQF8nl.js → runtime-update-Cg98ENel.js} +2 -2
- package/dist/shell/assets/{shared-protobase-ui-Dd-bY2Qa.js → shared-protobase-ui-JVA65IEp.js} +1 -1
- package/dist/shell/assets/{sheet-source-CA05AnuE.js → sheet-source-fKebPN-3.js} +2 -2
- package/dist/shell/assets/{sign-in-policy-page-7hl0azIr.js → sign-in-policy-page-DtxdycdZ.js} +2 -2
- package/dist/shell/assets/{start-block-queries-BVzV-uV2.js → start-block-queries-DIJZ-fEE.js} +2 -2
- package/dist/shell/assets/{step-catalog-DGutomuv.js → step-catalog-DefIkvlp.js} +2 -2
- package/dist/shell/assets/{step-panel-BuIiRC-g.js → step-panel-DhFvGljv.js} +2 -2
- package/dist/shell/assets/{timeline-display-DdkySfMr.js → timeline-display-CsGry__i.js} +2 -2
- package/dist/shell/assets/{trash-IReijQWL.js → trash-B3Zy6Kx1.js} +2 -2
- package/dist/shell/assets/{update-set-Ijp4W4Df.js → update-set-C_skfvwV.js} +2 -2
- package/dist/shell/assets/{use-calendar-move-D07CQGsB.js → use-calendar-move-CZtjDwpL.js} +2 -2
- package/dist/shell/assets/{use-display-rows-BowlA8tv.js → use-display-rows-DHVZ49lA.js} +2 -2
- package/dist/shell/assets/{use-paged-search-BPiYdk9e.js → use-paged-search-COK4rUdF.js} +2 -2
- package/dist/shell/assets/{use-run-trace-CctJj-s_.js → use-run-trace-CRPYmppF.js} +2 -2
- package/dist/shell/assets/{use-workflow-page-G3NuEfi0.js → use-workflow-page-NQnBpQBn.js} +2 -2
- package/dist/shell/assets/{use-workflow-types-BWS5utgc.js → use-workflow-types-BONTV-ip.js} +2 -2
- package/dist/shell/assets/{workflow-canvas-BHHRCAvI.js → workflow-canvas-wK7am90B.js} +2 -2
- package/dist/shell/assets/{workflow-field-B1MbuDxB.js → workflow-field-D4NB5B1z.js} +3 -3
- package/dist/shell/assets/{workflow-graph-editor-C-soTaTw.js → workflow-graph-editor-CBPqhazd.js} +2 -2
- package/dist/shell/assets/{workflow-run-field-CuLkIloc.js → workflow-run-field-C1N-mmHl.js} +3 -3
- package/dist/shell/assets/{workflow-status-field-Co0qx9xC.js → workflow-status-field-DEgDvkpV.js} +2 -2
- package/dist/shell/assets/{workflow-workbench-CSnD-k-9.js → workflow-workbench-mJR1exSe.js} +2 -2
- package/dist/shell/index.html +3 -3
- package/dist/shell/protobase.shell.json +3 -3
- package/dist/shell/protobase.sw.js +2 -2
- package/dist/shell-source-maps/assets/{account-page-DtK7jKts.js.map → account-page-U7RldneI.js.map} +1 -1
- package/dist/shell-source-maps/assets/{app-BjX4WRlX.js.map → app-94a88jzE.js.map} +1 -1
- package/dist/shell-source-maps/assets/{assistant-shell-m4yudVE_.js.map → assistant-shell-BJWCAwCu.js.map} +1 -1
- package/dist/shell-source-maps/assets/{board-display-DTeV61do.js.map → board-display-DSazq67h.js.map} +1 -1
- package/dist/shell-source-maps/assets/{calendar-display-C9M_BrdC.js.map → calendar-display-CpqjM4oV.js.map} +1 -1
- package/dist/shell-source-maps/assets/{call-rings-TD7_HvNB.js.map → call-rings-DnL8InVq.js.map} +1 -1
- package/dist/shell-source-maps/assets/{calls-Bp_BwXBR.js.map → calls-CTRygR5f.js.map} +1 -1
- package/dist/shell-source-maps/assets/{circle-alert-Z5jvi5Dk.js.map → circle-alert-B63XjMgn.js.map} +1 -1
- package/dist/shell-source-maps/assets/{composed-page-7cjr_6Rj.js.map → composed-page-BVm_6eWU.js.map} +1 -1
- package/dist/shell-source-maps/assets/{composer-section-BOic27ni.js.map → composer-section-DETU2Obd.js.map} +1 -1
- package/dist/shell-source-maps/assets/{connect-route-BQKWurfi.js.map → connect-route-BILeY04q.js.map} +1 -1
- package/dist/shell-source-maps/assets/{copy-field-J-xjCVww.js.map → copy-field-CmFjZmVI.js.map} +1 -1
- package/dist/shell-source-maps/assets/{create-route-cKTgbHdL.js.map → create-route-BT69PwsI.js.map} +1 -1
- package/dist/shell-source-maps/assets/{custom-step-container-field-ClXbgsmG.js.map → custom-step-container-field-CZDuNAGK.js.map} +1 -1
- package/dist/shell-source-maps/assets/{embedded-list-CdGDYOeK.js.map → embedded-list-C9U2ypuX.js.map} +1 -1
- package/dist/shell-source-maps/assets/{export-dialog-DJFPmWjl.js.map → export-dialog-DoaQ8h-M.js.map} +1 -1
- package/dist/shell-source-maps/assets/{graph-view-DdCNEjjp.js.map → graph-view-COd5Mp2P.js.map} +1 -1
- package/dist/shell-source-maps/assets/{group-donut-YHImqCyt.js.map → group-donut-DUBQuhYa.js.map} +1 -1
- package/dist/shell-source-maps/assets/{guest-call-page-DuJmX_uH.js.map → guest-call-page-Bu41Ptk4.js.map} +1 -1
- package/dist/shell-source-maps/assets/{html-viewer-BXSFoAH-.js.map → html-viewer-Bz3ots0-.js.map} +1 -1
- package/dist/shell-source-maps/assets/{import-dialog-D1pihaEn.js.map → import-dialog-B0lJXEBq.js.map} +1 -1
- package/dist/shell-source-maps/assets/{import-table-dialog-Dd851s8K.js.map → import-table-dialog-CaZameXo.js.map} +1 -1
- package/dist/shell-source-maps/assets/{invitations-page-CVnZFr42.js.map → invitations-page-DPzcVGHk.js.map} +1 -1
- package/dist/shell-source-maps/assets/{layout-grid-B4BydwOr.js.map → layout-grid-hoLv1QVh.js.map} +1 -1
- package/dist/shell-source-maps/assets/{legend-item-DStfKS-y.js.map → legend-item-CU6Kt-GZ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{list-page-HyJhabYe.js.map → list-page-C8Z3OhmV.js.map} +1 -1
- package/dist/shell-source-maps/assets/{maplibre-v43v0z7e.js.map → maplibre-BOVzS79J.js.map} +1 -1
- package/dist/shell-source-maps/assets/{markdown-content-R7RUN0DQ.js.map → markdown-content-BMDl_vl_.js.map} +1 -1
- package/dist/shell-source-maps/assets/{members-page-BIWsatyd.js.map → members-page-O752tFj8.js.map} +1 -1
- package/dist/shell-source-maps/assets/{messages-CPMEQgWR.js.map → messages-TLh-JbDm.js.map} +1 -1
- package/dist/shell-source-maps/assets/{organization-page-DY5ndg2R.js.map → organization-page-DDwBkk8F.js.map} +1 -1
- package/dist/shell-source-maps/assets/{organizations-page-6HwVXvoa.js.map → organizations-page-DNYezYgw.js.map} +1 -1
- package/dist/shell-source-maps/assets/{pending-invitation-row-Cy5mVb52.js.map → pending-invitation-row-DRjEfn76.js.map} +1 -1
- package/dist/shell-source-maps/assets/{period-chart-dl5O03oa.js.map → period-chart-B_Vtp_OD.js.map} +1 -1
- package/dist/shell-source-maps/assets/{person-row-CC1Anzap.js.map → person-row-ehgAozYT.js.map} +1 -1
- package/dist/shell-source-maps/assets/{public-form-page-DdR2id-n.js.map → public-form-page-JM_r4BIq.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-lines-D4ajVvtc.js.map → record-lines-B8maPngL.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-map-IJBljngZ.js.map → record-map-BJI9HhZO.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-opens-Dth-MEBS.js.map → record-opens-BP2LRuAM.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-page-DZUqVmk0.js.map → record-page-DsLORKNo.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-preview-wMoagd6i.js.map → record-preview-BDMeb9qp.js.map} +1 -1
- package/dist/shell-source-maps/assets/{records-map-BbgGOE7w.js.map → records-map-D2IAAn9Z.js.map} +1 -1
- package/dist/shell-source-maps/assets/{render-node-h9cWEbE-.js.map → render-node-CAL7-6hf.js.map} +1 -1
- package/dist/shell-source-maps/assets/{reorder-button-gdDrG56h.js.map → reorder-button-D9hO_nqd.js.map} +1 -1
- package/dist/shell-source-maps/assets/{run-trace-view-DqRcTHlR.js.map → run-trace-view-CqCld741.js.map} +1 -1
- package/dist/shell-source-maps/assets/{runner-install-field-BhcDC4pg.js.map → runner-install-field-Cpd0yW2w.js.map} +1 -1
- package/dist/shell-source-maps/assets/{runtime-update-BazQF8nl.js.map → runtime-update-Cg98ENel.js.map} +1 -1
- package/dist/shell-source-maps/assets/{sheet-source-CA05AnuE.js.map → sheet-source-fKebPN-3.js.map} +1 -1
- package/dist/shell-source-maps/assets/{sign-in-policy-page-7hl0azIr.js.map → sign-in-policy-page-DtxdycdZ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{start-block-queries-BVzV-uV2.js.map → start-block-queries-DIJZ-fEE.js.map} +1 -1
- package/dist/shell-source-maps/assets/{step-catalog-DGutomuv.js.map → step-catalog-DefIkvlp.js.map} +1 -1
- package/dist/shell-source-maps/assets/{step-panel-BuIiRC-g.js.map → step-panel-DhFvGljv.js.map} +1 -1
- package/dist/shell-source-maps/assets/{timeline-display-DdkySfMr.js.map → timeline-display-CsGry__i.js.map} +1 -1
- package/dist/shell-source-maps/assets/{trash-IReijQWL.js.map → trash-B3Zy6Kx1.js.map} +1 -1
- package/dist/shell-source-maps/assets/{update-set-Ijp4W4Df.js.map → update-set-C_skfvwV.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-calendar-move-D07CQGsB.js.map → use-calendar-move-CZtjDwpL.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-display-rows-BowlA8tv.js.map → use-display-rows-DHVZ49lA.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-paged-search-BPiYdk9e.js.map → use-paged-search-COK4rUdF.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-run-trace-CctJj-s_.js.map → use-run-trace-CRPYmppF.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-workflow-page-G3NuEfi0.js.map → use-workflow-page-NQnBpQBn.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-workflow-types-BWS5utgc.js.map → use-workflow-types-BONTV-ip.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-canvas-BHHRCAvI.js.map → workflow-canvas-wK7am90B.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-field-B1MbuDxB.js.map → workflow-field-D4NB5B1z.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-graph-editor-C-soTaTw.js.map → workflow-graph-editor-CBPqhazd.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-run-field-CuLkIloc.js.map → workflow-run-field-C1N-mmHl.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-status-field-Co0qx9xC.js.map → workflow-status-field-DEgDvkpV.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-workbench-CSnD-k-9.js.map → workflow-workbench-mJR1exSe.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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant-shell-
|
|
1
|
+
{"version":3,"file":"assistant-shell-BJWCAwCu.js","names":["n","a","t","__toESM","useAssistant","AssistantDock","useAssistantClient","import_jsx_runtime","require_jsx_runtime","ConnectedDock","client","send","text","page","act","OwnDock","props","url","AssistantPanel"],"sources":["../../../src/app/assistant-shell.tsx"],"sourcesContent":["import type { AssistantClient } from '@protobase/client'\nimport { AssistantDock, useAssistant, useAssistantClient } from '../assistant-dock'\n\ntype DockProps = { page: string; onClose: () => void }\n\nconst ConnectedDock = ({ client, page, onClose }: DockProps & { client: AssistantClient | undefined }) => {\n const { state, offline, error, send, act } = useAssistant(client)\n return <AssistantDock state={state} offline={offline} error={error} onSend={(text) => send(text, page)} onAction={act} onClose={onClose} client={client} />\n}\n\nconst OwnDock = ({ url, ...props }: DockProps & { url: string }) => <ConnectedDock client={useAssistantClient(url)} {...props} />\n\n/**\n * The dock for the backend `/meta` names, signed in as the user, sending each message with the `page` the user is on;\n * `client` replaces it in stories and tests.\n */\nexport const AssistantPanel = ({ url, client, ...props }: DockProps & { url: string; client?: AssistantClient }) =>\n client ? <ConnectedDock client={client} {...props} /> : <OwnDock url={url} {...props} />\n"],"mappings":"mnBAKMS,GAAiB,CAAE,SAAQ,OAAM,aAAmE,CACxG,GAAM,CAAE,QAAO,UAAS,QAAO,OAAM,OAAQL,EAAaM,CAAM,EAChE,OAAO,EAAAH,EAAA,IAAA,CAACF,EAAD,CAAsB,QAAgB,UAAgB,QAAO,OAAS,GAASM,EAAKC,EAAMC,CAAI,EAAG,SAAUC,EAAc,UAAiB,QAAS,CAAA,CAC5J,EAEMC,GAAW,CAAE,MAAK,GAAGC,MAAyC,EAAAT,EAAA,IAAA,CAACE,EAAD,CAAe,OAAQH,EAAmBW,CAAG,EAAG,GAAID,CAAQ,CAAA,EAMnHE,GAAkB,CAAE,MAAK,SAAQ,GAAGF,KAC/CN,GAAS,EAAAH,EAAA,IAAA,CAACE,EAAD,CAAuB,SAAQ,GAAIO,CAAQ,CAAA,GAAI,EAAAT,EAAA,IAAA,CAACQ,EAAD,CAAc,MAAK,GAAIC,CAAQ,CAAA","debugId":"49582030-0aef-4e1b-b4a1-ecfacc27ff81"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"board-display-DTeV61do.js","names":["isRank","text","text","useState","useRef","text","orderText","useState","useRef","text","n","a","t","__toESM","require_react","require_jsx_runtime","Problem","Skeleton","cn","useProjectUi","humanize","parseFilter","can","formatTag","recordKey","usePermissions","useAdminMeta","Button","boardColumns","boardCard","useToast","text$1","ErrorBanner","encodeKey","useClient","boardRank","columnFilter","useRefreshResource","rowAllows","ValueBadge","useMutation","RecordCard","useLiveRows","useSensor","MouseSensor","useDroppable","KeyboardSensor","DragOverlay","TouchSensor","DndContext","useSensors","verticalListSortingStrategy","useSortable","arrayMove","SortableContext","undoOps","rankBounds","listHandOrder","numberedBefore","moveRefusal","anchoredMove","text$3","text$2","collision","columnId","cardCoordinates","useDisplayRows","isRank$1","value","reorderSpan","rising","first","ranks","tail","last","from","start","to","import_react","useBoardColumn","rows","fields","filter","by","model","import_jsx_runtime","inOrder","order","byKey","row","named","key","BoardColumnView","list","display","column","card","view","loaded","moving","moves","entry","leaving","arriving","staying","placing","all","limit","more","count","isOver","plural","hints","setNodeRef","index","BoardCard","movable","placeable","draggable","active","element","setActivatorNodeRef","listeners","event","dragged","transform","isDragging","flatten","expr","text","allowedBy","clause","values","columnsAllowed","parsed","columns","clauses","dropWrite","drop","placedRows","placeOps","move","rank","bumped","bump","boardWrites","keyOf","record","result","before","stored","written","was","isRank","rankedPlace","end","reason","at","span","ranked","i","rankOf","bound","mine","above","bounds","below","refusal","title","useBoardMove","client","toast","refresh","setMoves","undoToast","settle","current","undo","undoing","error","dropped","write","etag","saved","writes","show","moved","keys","allowed","place","titleOf","stays","placed","landing","mutation","landed","labelOf","id","placeOver","data","over","own","BoardDisplay","every","permissions","drag","dropName","boardDrops","takes","columnOrder","orderBy","setActive","sensors","columnOf","valueOf","crosses","announced","refused","target","picked","said"],"sources":["../../../../schema/src/reorder-span.ts","../../../src/app/displays/use-board-column.ts","../../../src/app/displays/board-column.tsx","../../../src/app/displays/board-allowed.ts","../../../src/app/displays/board-drop.ts","../../../src/app/displays/board-place.ts","../../../src/app/rank-after/ranked-place.ts","../../../src/app/displays/use-board-move.ts","../../../src/app/displays/board-display.tsx"],"sourcesContent":["/** The stretch of an ordered list a `reorder` numbers: the records `first` to `last`, valued `start`, `start` + 1, ... */\nexport type ReorderSpan = { first: number; last: number; start: number }\n\nconst isRank = (value: unknown): value is number => typeof value === 'number' && Number.isInteger(value)\n\n/**\n * The shortest stretch that saves a move: `ranks` are the records' values in their new order, and `first` to `last`\n * the places that moved. The records before it keep their values, so they must already rise, and the stretch starts\n * just above them, or at 1; it then reaches on until the next record already ranks above it. When the values were\n * 1, 2, 3, ... that is the records that moved and nothing else, so a long list sends a few keys instead of all of them.\n */\nexport const reorderSpan = (ranks: readonly unknown[], first: number, last: number): ReorderSpan => {\n // How far from the start the values rise, and from where they rise to the end\n let rising = 0\n while (rising < first && isRank(ranks[rising]) && (rising === 0 || (ranks[rising] as number) > (ranks[rising - 1] as number))) rising += 1\n let tail = ranks.length\n while (tail - 1 > last && isRank(ranks[tail - 1]) && (tail === ranks.length || (ranks[tail - 1] as number) < (ranks[tail] as number))) tail -= 1\n\n const from = Math.min(first, rising)\n const start = from === 0 ? 1 : (ranks[from - 1] as number) + 1\n let to = Math.max(last, tail - 1)\n while (to + 1 < ranks.length && (ranks[to + 1] as number) <= start + (to - from)) to += 1\n return { first: from, last: to, start }\n}\n","import type { ResourceModel } from '@protobase/schema'\nimport { useLiveRows } from '../../live/use-live-rows'\nimport { useAdminMeta } from '../meta-gate'\nimport { columnFilter } from './board-columns'\nimport type { ListDisplay } from './display-context'\nimport { useDisplayRows } from './use-display-rows'\n\nexport type BoardColumnParams = {\n model: ResourceModel\n by: string\n value: string | null\n /** The fields the cards show, which the records' relations are labelled for. */\n fields: string[]\n /** The list's filter, its search included, and its order, as the list API takes them. */\n filter: string\n orderBy: string\n}\n\n/**\n * The records of one column of a board, page by page through the list API: the list's filter with the column's value\n * added, in the list's order, with how many there are. A change to the resource reloads them, as it does the table.\n */\nexport const useBoardColumn = ({ model, by, value, fields, filter, orderBy }: BoardColumnParams): ListDisplay => {\n const { resources, views } = useAdminMeta()\n const rows = useLiveRows({ resources, views, model, columns: fields, filter: columnFilter(filter, by, value), orderBy })\n return useDisplayRows(model, rows.page, rows.key, true)\n}\n","import { useDroppable } from '@dnd-kit/core'\nimport { SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable'\nimport type { ResourceModel, ViewModel } from '@protobase/schema'\nimport { cn } from '../../lib/cn'\nimport { humanize } from '../../live/naming'\nimport { Button } from '../../primitives/button'\nimport { Skeleton } from '../../primitives/skeleton'\nimport { ErrorBanner } from '../error-banner'\nimport { rowAllows } from '../permissions'\nimport { ValueBadge } from '../value-badge'\nimport { boardCard, type BoardColumn, type BoardDisplayModel } from './board-columns'\nimport { columnId } from './board-dnd'\nimport type { ListDisplayRow } from './list-displays'\nimport { RecordCard } from './record-card'\nimport { useBoardColumn } from './use-board-column'\nimport type { BoardMove } from './use-board-move'\nimport { formatTag } from '../../locale/active-locale'\nimport { text } from './messages'\n\ntype ColumnProps = {\n model: ResourceModel\n view: ViewModel | undefined\n display: BoardDisplayModel\n fields: string[]\n filter: string\n orderBy: string\n limit?: number\n column: BoardColumn\n moves: BoardMove[]\n /** Whether the user may move a card of this column to another, and whether to another place: that of the card it is dropped on. */\n movable: boolean\n placeable: boolean\n dragged: () => boolean\n}\n\n// The rows shown in the order a ranked drop on its way gives them, those it does not name after them\nconst inOrder = (rows: ListDisplayRow[], order: string[] | undefined) => {\n if (!order) return rows\n const byKey = new Map(rows.map((row) => [row.key, row]))\n const named = new Set(order)\n return [...order.flatMap((key) => byKey.get(key) ?? []), ...rows.filter((row) => !named.has(row.key))]\n}\n\n/**\n * One column of a board: its loaded records, those on their way out shown in their new column, and those on their way\n * in at its top, or on a ranked board at the place they were dropped.\n */\nexport const BoardColumnView = ({ model, view, display, column, fields, filter, orderBy, limit, moves, movable, placeable, dragged }: ColumnProps) => {\n const list = useBoardColumn({ model, by: display.by, value: column.value, fields, filter, orderBy })\n const card = boardCard(model, view, display)\n const loaded = new Set(list.rows.map((row) => row.key))\n const moving = new Map(moves.map((entry) => [entry.row.key, entry]))\n const leaving = list.rows.filter((row) => moving.has(row.key) && moving.get(row.key)!.to !== column.value)\n const arriving = moves.filter((entry) => entry.to === column.value && !loaded.has(entry.row.key)).map((entry) => entry.row)\n const staying = list.rows.filter((row) => !leaving.includes(row)).map((row) => (moving.has(row.key) ? moving.get(row.key)!.row : row))\n const placing = moves.findLast((entry) => entry.to === column.value && entry.order)\n const all = inOrder([...arriving, ...staying], placing?.order)\n const rows = all.slice(0, limit)\n // Cards below the last one shown, not loaded or cut off, so a drop after it does not know the card after it\n const more = list.more || all.length > rows.length\n const { setNodeRef, isOver } = useDroppable({ id: columnId(column.value), data: { column, rows, more } })\n const count = list.total - leaving.length + arriving.length\n // The column of records without a value shows only while some are in it\n if (column.value === null && !list.loading && count === 0 && !isOver) return null\n\n const plural = (view?.names?.plural ?? humanize(model.name)).toLowerCase()\n const hints = view?.fields[display.by]\n return (\n <section\n ref={setNodeRef}\n aria-label={`${column.label}, ${count}`}\n className={cn('flex w-72 shrink-0 snap-start flex-col gap-2 rounded-lg bg-surface p-2', isOver && 'ring-2 ring-primary/30')}\n >\n <header className=\"flex items-center justify-between gap-2 px-1 pt-0.5\">\n <h2 className=\"min-w-0 truncate text-body font-medium\">\n {column.value === null ? (\n <span className=\"text-muted-foreground\">{column.label}</span>\n ) : (\n <ValueBadge value={column.value} hints={hints}>\n {column.label}\n </ValueBadge>\n )}\n </h2>\n {!list.loading && <span className=\"text-xs tabular-nums text-muted-foreground\">{count.toLocaleString(formatTag())}</span>}\n </header>\n {list.loading ? (\n Array.from({ length: 3 }, (_, index) => <Skeleton key={index} className=\"h-20\" />)\n ) : list.error ? (\n <ErrorBanner title={text('couldNotLoadRows')} error={list.error} />\n ) : rows.length === 0 ? (\n <p className=\"px-1 py-4 text-center text-xs text-muted-foreground\">{text('noPlural', { plural })}</p>\n ) : (\n // Cards tile without gaps, so a pointer in the column is over a card or below the last one\n <SortableContext id={columnId(column.value)} items={rows.map((row) => row.key)} strategy={verticalListSortingStrategy}>\n <ul className=\"-mb-2 flex flex-col\">\n {rows.map((row) => (\n <BoardCard\n key={row.key}\n model={model}\n view={view}\n card={card}\n row={row}\n column={column}\n rows={rows}\n more={more}\n draggable={(movable || placeable) && rowAllows(row.record, 'update')}\n placeable={placeable}\n dragged={dragged}\n />\n ))}\n </ul>\n </SortableContext>\n )}\n {limit === undefined && list.more && (\n <Button size=\"sm\" variant=\"ghost\" onClick={list.loadMore}>\n {text('showMore')}\n </Button>\n )}\n </section>\n )\n}\n\ntype CardProps = {\n model: ResourceModel\n view: ViewModel | undefined\n card: ReturnType<typeof boardCard>\n row: ListDisplayRow\n column: BoardColumn\n rows: ListDisplayRow[]\n more: boolean\n draggable: boolean\n placeable: boolean\n dragged: () => boolean\n}\n\n/**\n * A record's card, picked up by dragging it or by Space on its link; one the user may not update stays put. Where the\n * user may change the order of a ranked board, a card is dropped on too: in its own column the cards make room as it\n * moves, in another a bar marks its place.\n */\nconst BoardCard = ({ model, view, card, row, column, rows, more, draggable, placeable, dragged }: CardProps) => {\n const { setNodeRef, setActivatorNodeRef, listeners, isDragging, isOver, active, transform, transition } = useSortable({\n id: row.key,\n data: { row, column, rows, more },\n disabled: { draggable: !draggable, droppable: !placeable },\n })\n const arriving = isOver && (active?.data.current?.column as BoardColumn | undefined)?.value !== column.value\n return (\n <li\n ref={(element) => {\n setNodeRef(element)\n // Space picks the card up from its link, which has the focus\n setActivatorNodeRef(element?.querySelector('a[data-card-link]') ?? element)\n }}\n {...listeners}\n // The card is a link, which the browser would drag as one\n onDragStart={(event) => event.preventDefault()}\n onClickCapture={(event) => {\n if (!dragged()) return\n event.preventDefault()\n event.stopPropagation()\n }}\n style={{ transform: transform ? `translate3d(${transform.x}px, ${transform.y}px, 0)` : undefined, transition }}\n className={cn(\n 'relative pb-2',\n draggable && 'cursor-grab touch-manipulation',\n isDragging && 'opacity-40',\n arriving && 'before:absolute before:inset-x-0 before:-top-1 before:h-0.5 before:rounded-full before:bg-primary',\n )}\n >\n <RecordCard model={model} view={view} display={card} row={row} swipe={false} />\n </li>\n )\n}\n","import { parseFilter, type FilterExpr } from '@protobase/schema'\nimport type { BoardColumn } from './board-columns'\n\nconst flatten = (expr: FilterExpr): FilterExpr[] => (expr.kind === 'and' ? expr.args.flatMap(flatten) : [expr])\n\nconst text = (value: { kind: string; value?: unknown }) => (value.kind === 'string' ? String(value.value) : undefined)\n\n// The values `by = \"v\"` or `in(by, ...)` allows, or none for any other clause\nconst allowedBy = (clause: FilterExpr, by: string): string[] | undefined => {\n if (clause.kind === 'compare' && clause.op === '=' && clause.field.path.join('.') === by) {\n const value = text(clause.value)\n return value === undefined ? undefined : [value]\n }\n if (clause.kind === 'in' && clause.field.path.join('.') === by) {\n const values = clause.values.map(text)\n return values.every((value) => value !== undefined) ? (values as string[]) : undefined\n }\n return undefined\n}\n\n/**\n * The columns of a board `filter` does not rule out: those its top-level `by = \"v\"` and `in(by, ...)` clauses allow. Any\n * other clause leaves every column, so a column is left out only when no record in it can match.\n */\nexport const columnsAllowed = (filter: string, by: string, columns: BoardColumn[]): BoardColumn[] => {\n const parsed = parseFilter(filter)\n if (!parsed.ok || !parsed.ast) return columns\n const clauses = flatten(parsed.ast).map((clause) => allowedBy(clause, by)).filter((values) => values !== undefined)\n return columns.filter((column) => clauses.every((values) => column.value !== null && values.includes(column.value)))\n}\n","import type { Client } from '@protobase/client'\nimport type { KeyValue } from '@protobase/schema'\n\n/** What a board drop's write gets: the card's record as listed, its key and ETag, the column it was dropped on, and the API. */\nexport type BoardDropContext = {\n resource: string\n record: Record<string, unknown>\n /** The record's key as the API takes it. */\n recordKey: KeyValue | readonly KeyValue[]\n etag: string\n /** The value of the column the card was dropped on. */\n to: string\n client: Client\n}\n\n/** What undoes a board drop's write, such as deleting the record it created. */\nexport type BoardDropUndo = () => Promise<void>\n\n/** A board drop's write for one column: what it saves in place of the record's `by`, and what undoes it, when it can be undone. */\nexport type BoardDropWrite = (context: BoardDropContext) => Promise<BoardDropUndo | void>\n\n/**\n * How cards move between a board's columns, a view's `drag.board` naming it: by the value of each column that takes a\n * card, what a drop there writes, such as creating a record of a related resource when `by` is computed from them. A\n * card in or dropped on any other column stays in its column, as does one dropped on the column of records without a\n * value.\n */\nexport type BoardDrop = Record<string, BoardDropWrite>\n\n/** The write a drop on the column of `value` performs, if that column takes cards. */\nexport const dropWrite = (drop: BoardDrop, value: string | null) => (value !== null && Object.hasOwn(drop, value) ? drop[value] : undefined)\n","import { arrayMove } from '@dnd-kit/sortable'\nimport type { BatchOp, BatchResult } from '@protobase/client'\nimport type { ResourceModel } from '@protobase/schema'\nimport { encodeKey } from '@protobase/schema/internal'\nimport { recordKey } from '../../live/model-helpers'\nimport { anchoredMove } from '../hand-order/anchored-move'\nimport { numberedBefore } from '../hand-order/numbered-before'\nimport type { DragWrite } from '../hand-order/undo-ops'\nimport { columnFilter, type BoardColumn } from './board-columns'\nimport type { ListDisplayRow } from './list-displays'\n\n/** Where a card is dropped: the column, its cards as shown before the drop, whether more follow them, and the place among them. */\nexport type BoardPlace = { column: BoardColumn; rows: ListDisplayRow[]; more: boolean; index: number }\n\n/**\n * The column's cards once `row` is dropped at `index`. In its own column it moves there, as a sortable list moves an\n * item; in another it goes in before the card at `index`, or last.\n */\nexport const placedRows = (rows: ListDisplayRow[], row: ListDisplayRow, index: number) => {\n const from = rows.findIndex((entry) => entry.key === row.key)\n if (from !== -1) return arrayMove(rows, from, index)\n return [...rows.slice(0, index), row, ...rows.slice(index)]\n}\n\n/** The column's cards once `row` is dropped at `index`, with the first and last place that changed. */\nexport const placing = (rows: ListDisplayRow[], row: ListDisplayRow, index: number) => {\n const from = rows.findIndex((entry) => entry.key === row.key)\n return { order: placedRows(rows, row, index), first: from === -1 ? index : Math.min(from, index), last: from === -1 ? index : Math.max(from, index) }\n}\n\n/**\n * The batch that saves a drop on a ranked board: in another column first the update of `by`, then a `move` of the card\n * to its place in `order`, the column's cards once dropped, anchored to the cards around it (see `anchoredMove`) in\n * the column `filter` reads, so it saves whatever else changed meanwhile; with `more` cards after `order`, unloaded. With `bump`, the card, last in the column,\n * first takes that rank in a `reorder` of its own, so it ranks above a record it depends on (see `rankedPlace`), and the\n * `move` then only checks its place. The update and the bump write any version, as the `move` decides the order.\n */\nexport const placeOps = (model: ResourceModel, by: string, rank: string, filter: string, row: ListDisplayRow, column: BoardColumn, order: ListDisplayRow[], more: boolean, bump?: number): BatchOp[] => {\n const key = recordKey(model, row.record)\n const index = order.findIndex((entry) => entry.key === row.key)\n const move = anchoredMove(model, rank, columnFilter(filter, by, column.value), order.map((entry) => entry.record), index, more)\n const bumped: BatchOp[] = bump === undefined ? [] : [{ op: 'reorder', resource: model.name, field: rank, keys: [key], start: bump, etags: { [encodeKey(key)]: '*' } }]\n const moving = (row.record[by] ?? null) !== column.value\n const update: BatchOp[] = moving ? [{ op: 'update', resource: model.name, key, data: { [by]: column.value }, etag: '*' }] : []\n return [...update, ...bumped, move]\n}\n\n/**\n * What the batch of a drop saved: each record it wrote, as it stored it last, with its values in `rows`, the column's\n * cards as listed before the drop, and its `rank` as the server had it before the batch, so the drop can be undone.\n */\nexport const boardWrites = (model: ResourceModel, rank: string, rows: ListDisplayRow[], result: BatchResult): DragWrite[] => {\n const keyOf = (record: Record<string, unknown>) => encodeKey(recordKey(model, record))\n const ranks = numberedBefore(result.results, keyOf)\n const before = new Map(rows.map((row) => {\n const key = keyOf(row.record)\n return [key, ranks.has(key) ? { ...row.record, [rank]: ranks.get(key) } : row.record]\n }))\n const stored = new Map<string, { record: Record<string, unknown>; etag: string }>()\n for (const entry of result.results) {\n const written = entry.op === 'reorder' || entry.op === 'move' ? entry.records : entry.op === 'update' ? [entry] : []\n for (const { record, etag } of written) stored.set(keyOf(record), { record, etag })\n }\n return [...stored].flatMap(([key, written]) => {\n const was = before.get(key)\n return was ? [{ before: was, ...written }] : []\n })\n}\n","import type { ResourceModel } from '@protobase/schema'\nimport { encodeKey } from '@protobase/schema/internal'\nimport { recordKey } from '../../live/model-helpers'\nimport { placing } from '../displays/board-place'\nimport type { ListDisplayRow } from '../displays/list-displays'\nimport { reorderSpan } from '@protobase/schema/internal'\nimport { text } from './messages'\nimport type { RankBound, RankBounds } from './rank-bounds'\n\n/** Where a dropped card lands: its place in the column, and the rank it takes there when that must be above its column's order. */\nexport type RankedPlace = { index: number; bump?: number }\n\ntype Request = { model: ResourceModel; rank: string; rows: ListDisplayRow[]; row: ListDisplayRow; index: number; bounds: RankBounds; title: string }\n\nconst isRank = (value: unknown) => value !== null && value !== undefined && value !== ''\n\n/**\n * Where a card of a ranked board dropped at `index` of a column, its cards `rows`, may land by `bounds`: at the first\n * place from there down where the ranks its `reorder` gives keep it below each record it depends on and above each that\n * depends on it, wherever those are. In the last place it may take a rank just above what it depends on, for a record\n * of another column that ranks above the whole column. With the reason it refused `index`; with no place, none.\n */\nexport const rankedPlace = ({ model, rank, rows, row, index, bounds, title }: Request): { place?: RankedPlace; reason?: string } => {\n const own = rows.some((entry) => entry.key === row.key)\n const end = own ? rows.length - 1 : rows.length\n let reason: string | undefined\n for (let at = index; at <= end; at++) {\n const { order, first, last } = placing(rows, row, at)\n const ranks = order.map((entry) => entry.record[rank])\n const span = reorderSpan(ranks, first, last)\n const ranked = new Map(order.map((entry, i) => [encodeKey(recordKey(model, entry.record)), i >= span.first && i <= span.last ? span.start + i - span.first : ranks[i]]))\n const rankOf = (bound: RankBound) => (ranked.has(bound.key) ? ranked.get(bound.key) : bound.rank)\n const mine = Number(ranked.get(encodeKey(recordKey(model, row.record))))\n const above = bounds.after.filter((bound) => isRank(rankOf(bound)) && Number(rankOf(bound)) >= mine)\n const below = bounds.before.find((bound) => isRank(rankOf(bound)) && Number(rankOf(bound)) <= mine)\n const refusal = below ? text('dependsOn', { record: below.title, other: title }) : above[0] && text('dependsOn', { record: title, other: above[0].title })\n if (!refusal) return { place: { index: at }, ...(reason !== undefined && { reason }) }\n reason ??= refusal\n if (at !== end || below) continue\n // Last in its column, nothing after it there keeps its rank down\n const bump = Math.max(...above.map((bound) => Number(rankOf(bound)))) + 1\n if (bounds.before.every((bound) => !isRank(rankOf(bound)) || Number(rankOf(bound)) > bump)) return { place: { index: at, bump }, reason }\n }\n return { reason: reason! }\n}\n","import { useMutation } from '@tanstack/react-query'\nimport { useRef, useState } from 'react'\nimport type { KeyValue, ResourceModel, ViewModel } from '@protobase/schema'\nimport { useClient } from '../../data/api-provider'\nimport { recordKey } from '../../live/model-helpers'\nimport { useToast } from '../../toasts'\nimport { text as orderText } from '../hand-order/messages'\nimport { moveRefusal } from '../hand-order/move-refusal'\nimport { undoOps, type DragWrite } from '../hand-order/undo-ops'\nimport { useRefreshResource } from '../pages/use-layout-data'\nimport { rankBounds } from '../rank-after/rank-bounds'\nimport { rankedPlace, type RankedPlace } from '../rank-after/ranked-place'\nimport type { BoardColumn } from './board-columns'\nimport { dropWrite, type BoardDrop } from './board-drop'\nimport { boardWrites, placeOps, placing, type BoardPlace } from './board-place'\nimport type { ListDisplayRow } from './list-displays'\nimport { text } from './messages'\n\n/**\n * A card on its way to another column or place: the record as it will be, shown there until the columns have reloaded,\n * and on a ranked board the keys of the column's cards in their new order.\n */\nexport type BoardMove = { row: ListDisplayRow; to: string | null; order?: string[] }\n\ntype Move = { row: ListDisplayRow; to: BoardColumn; place?: Omit<BoardPlace, 'column'> }\n\n// What a move saved: the column its record is in now, and what undoes it, when it can be undone; nothing when it stayed put\ntype Saved = { landed: string | null; undo?: () => Promise<unknown> } | undefined\n\ntype Options = {\n model: ResourceModel\n view: ViewModel | undefined\n by: string\n rank?: string | undefined\n /** The list's filter, its search included, which a column narrows to its records. */\n filter: string\n /** The board's own writes for a card dropped on another column, in place of saving `by`. */\n drop?: BoardDrop | undefined\n /** The heading of the column of a value. */\n labelOf: (value: string | null) => string\n /** The title a card shows. */\n titleOf: (row: ListDisplayRow) => string\n}\n\n/**\n * Moving a board's card to another column: one update of the record with the column's value and the ETag it was listed\n * with, as a named update action sends, so the resource's access rules and `validate` decide. On a ranked board a drop\n * at a place is one batch instead, that update when the column changes and a `move` by `rank` among the column's cards,\n * anchored to the card above where it was dropped (see `placeOps`).\n * With the board's `drop`, a card dropped on another column runs that column's write instead, and then reads the record\n * again to say which column it is in now. The card shows in its new place at once; a saved move says so with **Undo**,\n * which puts back the values it changed or runs the undo the drop's write gave, and a refusal puts it back and says why,\n * or that the board changed where it was dropped.\n * With the position's `after`, a card dropped above a record it depends on lands at the first place below that keeps\n * the order, or stays where it was, with a warning saying why (see `rankedPlace`).\n * Either way every list of the resource reloads, which puts the card where its record now is.\n */\nexport const useBoardMove = ({ model, view, by, rank, filter, drop, labelOf, titleOf }: Options) => {\n const client = useClient()\n const toast = useToast()\n const refresh = useRefreshResource()\n const [moves, setMoves] = useState<BoardMove[]>([])\n // Only the latest move can be undone, so its toast replaces the one before\n const undoToast = useRef<number>(undefined)\n const settle = (key: string) => setMoves((current) => current.filter((move) => move.row.key !== key))\n const fields = rank ? [by, rank] : [by]\n\n const undo = useMutation({\n mutationFn: (undoing: () => Promise<unknown>) => undoing(),\n onError: (error) => toast.show(moveRefusal(error, text('couldNotUndo'), { place: 'board' })),\n onSettled: () => refresh(model.name),\n })\n\n // A drop on a column of the board's `drop`: its write, then the record read again for the column it is in now\n const dropped = async (row: ListDisplayRow, to: BoardColumn): Promise<Saved> => {\n const write = drop && dropWrite(drop, to.value)\n if (!write) throw new Error(`The column ${to.label} takes no cards`)\n const key = recordKey(model, row.record) as KeyValue\n const etag = typeof row.record.etag === 'string' ? row.record.etag : '*'\n const undoing = await write({ resource: model.name, record: row.record, recordKey: key, etag, to: to.value!, client })\n const stored = await client.get(model.name, key)\n return { landed: (stored.record[by] ?? null) as string | null, ...(undoing && { undo: undoing }) }\n }\n\n // The values a move or placing saved, which its undo puts back\n const saved = (writes: DragWrite[], to: BoardColumn): Saved => ({ landed: to.value, undo: () => client.batchWrite(undoOps(model, writes, fields)) })\n\n // The card shown in its column, in `order` when it has a place there\n const show = (row: ListDisplayRow, to: BoardColumn, order?: ListDisplayRow[]) => {\n const moved = { ...row, record: { ...row.record, [by]: to.value } }\n const keys = order?.map((entry) => entry.key)\n setMoves((current) => [...current.filter((move) => move.row.key !== row.key), { row: moved, to: to.value, ...(keys && { order: keys }) }])\n }\n\n // Where the card lands by what its record depends on, saying so when that is not where it was dropped\n const allowed = async (row: ListDisplayRow, to: BoardColumn, place: NonNullable<Move['place']>): Promise<RankedPlace | undefined> => {\n if (!model.position?.after) return { index: place.index }\n const bounds = await rankBounds(client, model, view, row.record)\n const ranked = rankedPlace({ model, rank: rank!, rows: place.rows, row, index: place.index, bounds, title: titleOf(row) })\n // Back in its own place it stays as it was, unwritten\n const stays = !ranked.place || (ranked.place.bump === undefined && ranked.place.index === place.rows.findIndex((entry) => entry.key === row.key))\n if (ranked.reason !== undefined) toast.show({ state: 'warning', title: stays ? orderText('notMoved') : orderText('movedToPlace', { place: ranked.place!.index + 1 }), description: ranked.reason })\n if (stays) return undefined\n if (ranked.place!.index !== place.index) show(row, to, placing(place.rows, row, ranked.place!.index).order)\n return ranked.place\n }\n\n // A drop at a place: the card's move among the column's cards, with its update first when it changes column\n const placed = async (row: ListDisplayRow, to: BoardColumn, place: NonNullable<Move['place']>): Promise<Saved> => {\n const landing = await allowed(row, to, place)\n if (!landing) return undefined\n const { order } = placing(place.rows, row, landing.index)\n return saved(boardWrites(model, rank!, order, await client.batchWrite(placeOps(model, by, rank!, filter, row, to, order, place.more, landing.bump))), to)\n }\n\n const mutation = useMutation({\n mutationFn: async ({ row, to, place }: Move): Promise<Saved> => {\n if (place && !rank) throw new Error('A board places a card only by its rank')\n const from = (row.record[by] ?? null) as string | null\n if (drop && to.value !== from) return dropped(row, to)\n if (place) return placed(row, to, place)\n const etag = typeof row.record.etag === 'string' ? row.record.etag : '*'\n const stored = await client.update(model.name, recordKey(model, row.record) as KeyValue, { [by]: to.value }, etag)\n return saved([{ before: row.record, record: stored.record, etag: stored.etag }], to)\n },\n onMutate: ({ row, to, place }) => show(row, to, place && placing(place.rows, row, place.index).order),\n onSuccess: (result, { row, to }) => {\n if (!result) return\n const { landed, undo: undoing } = result\n if (undoToast.current !== undefined) toast.dismiss(undoToast.current)\n undoToast.current = undefined\n const from = row.record[by] ?? null\n const title = landed !== from ? text('movedTo', { column: labelOf(landed) }) : from === to.value ? text('orderChanged') : text('stayedIn', { column: labelOf(landed) })\n if (!undoing) {\n toast.show({ state: 'success', title })\n return\n }\n const id = toast.show({\n state: 'success',\n title,\n action: {\n label: text('undo'),\n onClick: () => {\n toast.dismiss(id)\n undoToast.current = undefined\n undo.mutate(undoing)\n },\n },\n })\n undoToast.current = id\n },\n onError: (error, { row, to }) => {\n settle(row.key)\n const title = (row.record[by] ?? null) === to.value ? text('couldNotReorder') : text('couldNotMoveTo', { to: to.label })\n toast.show(moveRefusal(error, title, { place: 'board', title: titleOf(row) }))\n },\n onSettled: async (_result, _error, { row }) => {\n await refresh(model.name)\n settle(row.key)\n },\n })\n\n return { moves, move: (row: ListDisplayRow, to: BoardColumn, place?: NonNullable<Move['place']>) => mutation.mutate({ row, to, ...(place && { place }) }) }\n}\n","import { DndContext, DragOverlay, KeyboardSensor, MouseSensor, TouchSensor, useSensor, useSensors, type Announcements, type DragEndEvent, type DragStartEvent, type Over } from '@dnd-kit/core'\nimport { useRef, useState } from 'react'\nimport type { ResourceModel, ViewModel } from '@protobase/schema'\nimport { listHandOrder } from '../hand-order/hand-order'\nimport { usePermissions } from '../meta-gate'\nimport { can } from '../permissions'\nimport { BoardColumnView } from './board-column'\nimport { columnsAllowed } from './board-allowed'\nimport { Problem } from '../pages/problem'\nimport { useProjectUi } from '../pages/project-ui'\nimport { boardCard, boardColumns, boardRank, type BoardColumn, type BoardDisplayModel } from './board-columns'\nimport { cardCoordinates, collision, columnId } from './board-dnd'\nimport { dropWrite } from './board-drop'\nimport type { BoardPlace } from './board-place'\nimport type { ListDisplayRow } from './list-displays'\nimport { RecordCard } from './record-card'\nimport { useBoardMove } from './use-board-move'\nimport { text } from './messages'\n\ntype BoardProps = {\n model: ResourceModel\n view: ViewModel | undefined\n display: BoardDisplayModel\n /** The fields the cards show, which the records' relations are labelled for. */\n fields: string[]\n /** The list's filter, its search included, and its order, as the list API takes them. */\n filter: string\n orderBy: string\n /** The most cards a column shows, without a button for more, as an embedded list shows them. */\n limit?: number\n}\n\n// Where a card over `over` would be dropped: before the card it is over, or after the last card of the column\nconst placeOver = (over: Over, row: ListDisplayRow): BoardPlace | undefined => {\n const data = over.data.current as { column?: BoardPlace['column']; rows?: ListDisplayRow[]; more?: boolean; sortable?: { index: number } } | undefined\n if (!data?.column || !data.rows) return undefined\n const more = data.more === true\n if (data.sortable) return { column: data.column, rows: data.rows, more, index: data.sortable.index }\n const own = data.rows.some((entry) => entry.key === row.key)\n return { column: data.column, rows: data.rows, more, index: own ? data.rows.length - 1 : data.rows.length }\n}\n\n/**\n * A column per value of the board's enum field, each loading its own records through the list API, with their count.\n * When the list's `drag.board` is on, a card dragged, or moved with the keyboard, to another column saves the record\n * with that column's value; when it names a board drop of the UI config, only between the columns it names, each\n * running its own write. When the resource has a position, its records ordered as one, the columns are in its order,\n * and when `drag.rank` is on a card is dropped at a place: the up and down arrow keys move it within its column, and\n * the drop renumbers the cards before it. Each change says so with **Undo**.\n */\nexport const BoardDisplay = ({ model, view, display, fields, filter, orderBy, limit }: BoardProps) => {\n const every = boardColumns(model, view, display)\n const columns = columnsAllowed(filter, display.by, every)\n const card = boardCard(model, view, display)\n const permissions = usePermissions(model.name)\n const { boardDrops } = useProjectUi()\n const drag = view?.list?.drag\n const dropName = typeof drag?.board === 'string' ? drag.board : undefined\n const drop = dropName === undefined ? undefined : boardDrops?.[dropName]\n // Whether a card moves in or out of a column: any with `board: true`, else those the named board drop lists\n const takes = (value: string | null) =>\n can(permissions, 'update') && (drag?.board === true ? !model.fields[display.by]?.readOnly : drop !== undefined && dropWrite(drop, value) !== undefined)\n const movable = columns.some((column) => takes(column.value))\n const rank = boardRank(model)\n // Changing the order takes the same right as sorting the list by hand\n const placeable = drag?.rank === true && rank !== undefined && listHandOrder(model, permissions) !== undefined\n const columnOrder = rank ? `${rank} asc` : orderBy\n const labelOf = (value: string | null) => every.find((column) => column.value === value)?.label ?? String(value)\n const title = (row: ListDisplayRow) => String(row.labels[card.title!] ?? row.record[card.title!] ?? row.key)\n const { moves, move } = useBoardMove({ model, view, by: display.by, rank, filter, drop, labelOf, titleOf: title })\n const [active, setActive] = useState<ListDisplayRow | undefined>()\n // The click that ends a drag with a mouse lands on the card's link, which must not open the record\n const dragged = useRef(false)\n const sensors = useSensors(\n useSensor(MouseSensor, { activationConstraint: { distance: 4 } }),\n useSensor(TouchSensor, { activationConstraint: { delay: 250, tolerance: 5 } }),\n // Enter opens the card's record, so only Space picks a card up\n useSensor(KeyboardSensor, { keyboardCodes: { start: ['Space'], cancel: ['Escape'], end: ['Space', 'Enter'] }, coordinateGetter: cardCoordinates }),\n )\n if (dropName !== undefined && !drop) return <Problem>{text.rich('noDrop', { drop: dropName })}</Problem>\n\n const columnOf = (id: unknown) => columns.find((column) => columnId(column.value) === id)\n const valueOf = (row: ListDisplayRow) => (row.record[display.by] ?? null) as string | null\n const crosses = (row: ListDisplayRow, to: BoardColumn) => takes(valueOf(row)) && takes(to.value)\n const announced = (row: ListDisplayRow, over: Over | null) => {\n if (!over) return { over: text('noColumn') }\n const place = placeable ? placeOver(over, row) : undefined\n if (!place) return { over: columnOf(over.id)?.label ?? text('noColumn') }\n const count = place.rows.some((entry) => entry.key === row.key) ? place.rows.length : place.rows.length + 1\n return { over: text('placeOf', { column: place.column.label, place: place.index + 1, count }), place: text('place', { column: place.column.label, place: place.index + 1 }) }\n }\n // Whether a drop on `over` takes the card to a column it may not move to\n const refused = (row: ListDisplayRow, over: Over) => {\n const target = (placeable ? placeOver(over, row)?.column : undefined) ?? columnOf(over.id)\n return target !== undefined && target.value !== valueOf(row) && !crosses(row, target)\n }\n const announcements: Announcements = {\n onDragStart: ({ active: picked }) => text('pickedUp', { title: title(picked.data.current!.row) }),\n onDragOver: ({ active: picked, over }) => text('isOver', { title: title(picked.data.current!.row), over: announced(picked.data.current!.row, over).over }),\n onDragEnd: ({ active: picked, over }) => {\n const row = picked.data.current!.row as ListDisplayRow\n if (!over || refused(row, over)) return text('putBack', { title: title(row) })\n const said = announced(row, over)\n return text('wasMovedTo', { title: title(row), to: said.place ?? said.over })\n },\n onDragCancel: ({ active: picked }) => text('cancelled', { title: title(picked.data.current!.row) }),\n }\n\n const start = ({ active: picked }: DragStartEvent) => {\n dragged.current = true\n setActive(picked.data.current!.row as ListDisplayRow)\n }\n const end = ({ active: picked, over }: DragEndEvent) => {\n setActive(undefined)\n setTimeout(() => (dragged.current = false))\n const row = picked.data.current!.row as ListDisplayRow\n if (!over) return\n const place = placeable ? placeOver(over, row) : undefined\n if (!place) {\n const target = columnOf(over.id)\n if (target && target.value !== valueOf(row) && crosses(row, target)) move(row, target)\n return\n }\n const from = place.rows.findIndex((entry) => entry.key === row.key)\n // A card the user may not move to another column goes back\n if (from === -1 && !crosses(row, place.column)) return\n // A board drop's write decides where the card lands in another column, so it has no place there\n if (from === -1 && drop) return move(row, place.column)\n if (from === place.index) return\n move(row, place.column, { rows: place.rows, more: place.more, index: place.index })\n }\n\n return (\n <DndContext\n sensors={sensors}\n collisionDetection={collision}\n onDragStart={start}\n onDragEnd={end}\n onDragCancel={() => {\n setActive(undefined)\n setTimeout(() => (dragged.current = false))\n }}\n accessibility={{\n announcements,\n screenReaderInstructions: {\n draggable: !placeable\n ? text('boardAcross')\n : movable\n ? text('boardAnywhere')\n : text('boardWithin'),\n },\n }}\n >\n {/* As tall as its longest column, scrolling with the page, and sideways when its columns are wider than the page; positioned, so what its cards place absolutely, such as their screen-reader labels, scrolls inside it instead of widening the page */}\n <div className=\"relative min-w-0 flex-1 overflow-x-auto\">\n <div className=\"flex snap-x items-start gap-3 pb-2\">\n {columns.map((column) => (\n <BoardColumnView\n key={columnId(column.value)}\n model={model}\n view={view}\n display={display}\n column={column}\n fields={fields}\n filter={filter}\n orderBy={columnOrder}\n limit={limit}\n moves={moves}\n movable={takes(column.value)}\n placeable={placeable}\n dragged={() => dragged.current}\n />\n ))}\n </div>\n </div>\n <DragOverlay>{active && <RecordCard model={model} view={view} display={card} row={active} swipe={false} />}</DragOverlay>\n </DndContext>\n )\n}\n"],"mappings":"gyCAGA,IAAMA,GAAU,GAAoC,OAAOoE,GAAU,UAAY,OAAO,UAAUA,CAAK,EAQ1FC,IAAe,EAA2B,EAAe,IAA8B,CAElG,IAAIC,EAAS,EACb,KAAOA,EAASC,GAASvE,GAAOwE,EAAMF,EAAO,IAAMA,IAAW,GAAME,EAAMF,GAAsBE,EAAMF,EAAS,KAAgB,GAAU,EACzI,IAAIG,EAAOD,EAAM,OACjB,KAAOC,EAAO,EAAIC,GAAQ1E,GAAOwE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AE,MAAO+J,EAAM/E,CAAG,EAAG,GAAImI,EAAK,OAASA,EAAK,IAAK,CAAC,CAC9E,EACA,cAAe,CAAE,OAAQD,KAAalN,EAAK,YAAa,CAAE,MAAO+J,EAAMmD,EAAO,KAAK,QAAS,GAAG,CAAE,CAAC,CAsC9F,EACA,yBAA0B,CACxB,UAGMlN,EAHM4G,EAERD,EACO,gBACA,cAHF,aAGe,CAC1B,CACF,EAlBF,SAAA,EAqBE,EAAA/B,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,0CACb,UAAA,EAAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,qCACZ,SAAAkD,EAAQ,IAAK,IACZ,EAAAlD,EAAA,IAAA,CAACO,GAAD,CAES,QACD,OACG,UACD,SACA,SACA,SACR,QAASqH,EACF,QACA,QACP,QAASD,EAAMjH,EAAO,KAAK,EAChB,YACX,YAAe6B,EAAQ,OACxB,EAbM5D,EAAS+B,EAAO,KAAK,CAa3B,CACF,CACE,CAAA,CACF,CAAA,GACL,EAAAV,EAAA,IAAA,CAACtC,EAAD,CAAA,SAAcwE,IAAU,EAAAlC,EAAA,IAAA,CAAC5C,EAAD,CAAmB,QAAa,OAAM,QAASuD,EAAM,IAAKuB,EAAQ,MAAO,EAAQ,CAAA,CAAe,CAAA,CAC9G,GAEhB","debugId":"d3795eb5-768b-4b18-93c9-86efabd484fa"}
|
|
1
|
+
{"version":3,"file":"board-display-DSazq67h.js","names":["isRank","text","text","useState","useRef","text","orderText","useState","useRef","text","n","a","t","__toESM","require_react","require_jsx_runtime","Problem","Skeleton","cn","useProjectUi","humanize","parseFilter","can","formatTag","recordKey","usePermissions","useAdminMeta","Button","boardColumns","boardCard","useToast","text$1","ErrorBanner","encodeKey","useClient","boardRank","columnFilter","useRefreshResource","rowAllows","ValueBadge","useMutation","RecordCard","useLiveRows","useSensor","MouseSensor","useDroppable","KeyboardSensor","DragOverlay","TouchSensor","DndContext","useSensors","verticalListSortingStrategy","useSortable","arrayMove","SortableContext","undoOps","rankBounds","listHandOrder","numberedBefore","moveRefusal","anchoredMove","text$3","text$2","collision","columnId","cardCoordinates","useDisplayRows","isRank$1","value","reorderSpan","rising","first","ranks","tail","last","from","start","to","import_react","useBoardColumn","rows","fields","filter","by","model","import_jsx_runtime","inOrder","order","byKey","row","named","key","BoardColumnView","list","display","column","card","view","loaded","moving","moves","entry","leaving","arriving","staying","placing","all","limit","more","count","isOver","plural","hints","setNodeRef","index","BoardCard","movable","placeable","draggable","active","element","setActivatorNodeRef","listeners","event","dragged","transform","isDragging","flatten","expr","text","allowedBy","clause","values","columnsAllowed","parsed","columns","clauses","dropWrite","drop","placedRows","placeOps","move","rank","bumped","bump","boardWrites","keyOf","record","result","before","stored","written","was","isRank","rankedPlace","end","reason","at","span","ranked","i","rankOf","bound","mine","above","bounds","below","refusal","title","useBoardMove","client","toast","refresh","setMoves","undoToast","settle","current","undo","undoing","error","dropped","write","etag","saved","writes","show","moved","keys","allowed","place","titleOf","stays","placed","landing","mutation","landed","labelOf","id","placeOver","data","over","own","BoardDisplay","every","permissions","drag","dropName","boardDrops","takes","columnOrder","orderBy","setActive","sensors","columnOf","valueOf","crosses","announced","refused","target","picked","said"],"sources":["../../../../schema/src/reorder-span.ts","../../../src/app/displays/use-board-column.ts","../../../src/app/displays/board-column.tsx","../../../src/app/displays/board-allowed.ts","../../../src/app/displays/board-drop.ts","../../../src/app/displays/board-place.ts","../../../src/app/rank-after/ranked-place.ts","../../../src/app/displays/use-board-move.ts","../../../src/app/displays/board-display.tsx"],"sourcesContent":["/** The stretch of an ordered list a `reorder` numbers: the records `first` to `last`, valued `start`, `start` + 1, ... */\nexport type ReorderSpan = { first: number; last: number; start: number }\n\nconst isRank = (value: unknown): value is number => typeof value === 'number' && Number.isInteger(value)\n\n/**\n * The shortest stretch that saves a move: `ranks` are the records' values in their new order, and `first` to `last`\n * the places that moved. The records before it keep their values, so they must already rise, and the stretch starts\n * just above them, or at 1; it then reaches on until the next record already ranks above it. When the values were\n * 1, 2, 3, ... that is the records that moved and nothing else, so a long list sends a few keys instead of all of them.\n */\nexport const reorderSpan = (ranks: readonly unknown[], first: number, last: number): ReorderSpan => {\n // How far from the start the values rise, and from where they rise to the end\n let rising = 0\n while (rising < first && isRank(ranks[rising]) && (rising === 0 || (ranks[rising] as number) > (ranks[rising - 1] as number))) rising += 1\n let tail = ranks.length\n while (tail - 1 > last && isRank(ranks[tail - 1]) && (tail === ranks.length || (ranks[tail - 1] as number) < (ranks[tail] as number))) tail -= 1\n\n const from = Math.min(first, rising)\n const start = from === 0 ? 1 : (ranks[from - 1] as number) + 1\n let to = Math.max(last, tail - 1)\n while (to + 1 < ranks.length && (ranks[to + 1] as number) <= start + (to - from)) to += 1\n return { first: from, last: to, start }\n}\n","import type { ResourceModel } from '@protobase/schema'\nimport { useLiveRows } from '../../live/use-live-rows'\nimport { useAdminMeta } from '../meta-gate'\nimport { columnFilter } from './board-columns'\nimport type { ListDisplay } from './display-context'\nimport { useDisplayRows } from './use-display-rows'\n\nexport type BoardColumnParams = {\n model: ResourceModel\n by: string\n value: string | null\n /** The fields the cards show, which the records' relations are labelled for. */\n fields: string[]\n /** The list's filter, its search included, and its order, as the list API takes them. */\n filter: string\n orderBy: string\n}\n\n/**\n * The records of one column of a board, page by page through the list API: the list's filter with the column's value\n * added, in the list's order, with how many there are. A change to the resource reloads them, as it does the table.\n */\nexport const useBoardColumn = ({ model, by, value, fields, filter, orderBy }: BoardColumnParams): ListDisplay => {\n const { resources, views } = useAdminMeta()\n const rows = useLiveRows({ resources, views, model, columns: fields, filter: columnFilter(filter, by, value), orderBy })\n return useDisplayRows(model, rows.page, rows.key, true)\n}\n","import { useDroppable } from '@dnd-kit/core'\nimport { SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable'\nimport type { ResourceModel, ViewModel } from '@protobase/schema'\nimport { cn } from '../../lib/cn'\nimport { humanize } from '../../live/naming'\nimport { Button } from '../../primitives/button'\nimport { Skeleton } from '../../primitives/skeleton'\nimport { ErrorBanner } from '../error-banner'\nimport { rowAllows } from '../permissions'\nimport { ValueBadge } from '../value-badge'\nimport { boardCard, type BoardColumn, type BoardDisplayModel } from './board-columns'\nimport { columnId } from './board-dnd'\nimport type { ListDisplayRow } from './list-displays'\nimport { RecordCard } from './record-card'\nimport { useBoardColumn } from './use-board-column'\nimport type { BoardMove } from './use-board-move'\nimport { formatTag } from '../../locale/active-locale'\nimport { text } from './messages'\n\ntype ColumnProps = {\n model: ResourceModel\n view: ViewModel | undefined\n display: BoardDisplayModel\n fields: string[]\n filter: string\n orderBy: string\n limit?: number\n column: BoardColumn\n moves: BoardMove[]\n /** Whether the user may move a card of this column to another, and whether to another place: that of the card it is dropped on. */\n movable: boolean\n placeable: boolean\n dragged: () => boolean\n}\n\n// The rows shown in the order a ranked drop on its way gives them, those it does not name after them\nconst inOrder = (rows: ListDisplayRow[], order: string[] | undefined) => {\n if (!order) return rows\n const byKey = new Map(rows.map((row) => [row.key, row]))\n const named = new Set(order)\n return [...order.flatMap((key) => byKey.get(key) ?? []), ...rows.filter((row) => !named.has(row.key))]\n}\n\n/**\n * One column of a board: its loaded records, those on their way out shown in their new column, and those on their way\n * in at its top, or on a ranked board at the place they were dropped.\n */\nexport const BoardColumnView = ({ model, view, display, column, fields, filter, orderBy, limit, moves, movable, placeable, dragged }: ColumnProps) => {\n const list = useBoardColumn({ model, by: display.by, value: column.value, fields, filter, orderBy })\n const card = boardCard(model, view, display)\n const loaded = new Set(list.rows.map((row) => row.key))\n const moving = new Map(moves.map((entry) => [entry.row.key, entry]))\n const leaving = list.rows.filter((row) => moving.has(row.key) && moving.get(row.key)!.to !== column.value)\n const arriving = moves.filter((entry) => entry.to === column.value && !loaded.has(entry.row.key)).map((entry) => entry.row)\n const staying = list.rows.filter((row) => !leaving.includes(row)).map((row) => (moving.has(row.key) ? moving.get(row.key)!.row : row))\n const placing = moves.findLast((entry) => entry.to === column.value && entry.order)\n const all = inOrder([...arriving, ...staying], placing?.order)\n const rows = all.slice(0, limit)\n // Cards below the last one shown, not loaded or cut off, so a drop after it does not know the card after it\n const more = list.more || all.length > rows.length\n const { setNodeRef, isOver } = useDroppable({ id: columnId(column.value), data: { column, rows, more } })\n const count = list.total - leaving.length + arriving.length\n // The column of records without a value shows only while some are in it\n if (column.value === null && !list.loading && count === 0 && !isOver) return null\n\n const plural = (view?.names?.plural ?? humanize(model.name)).toLowerCase()\n const hints = view?.fields[display.by]\n return (\n <section\n ref={setNodeRef}\n aria-label={`${column.label}, ${count}`}\n className={cn('flex w-72 shrink-0 snap-start flex-col gap-2 rounded-lg bg-surface p-2', isOver && 'ring-2 ring-primary/30')}\n >\n <header className=\"flex items-center justify-between gap-2 px-1 pt-0.5\">\n <h2 className=\"min-w-0 truncate text-body font-medium\">\n {column.value === null ? (\n <span className=\"text-muted-foreground\">{column.label}</span>\n ) : (\n <ValueBadge value={column.value} hints={hints}>\n {column.label}\n </ValueBadge>\n )}\n </h2>\n {!list.loading && <span className=\"text-xs tabular-nums text-muted-foreground\">{count.toLocaleString(formatTag())}</span>}\n </header>\n {list.loading ? (\n Array.from({ length: 3 }, (_, index) => <Skeleton key={index} className=\"h-20\" />)\n ) : list.error ? (\n <ErrorBanner title={text('couldNotLoadRows')} error={list.error} />\n ) : rows.length === 0 ? (\n <p className=\"px-1 py-4 text-center text-xs text-muted-foreground\">{text('noPlural', { plural })}</p>\n ) : (\n // Cards tile without gaps, so a pointer in the column is over a card or below the last one\n <SortableContext id={columnId(column.value)} items={rows.map((row) => row.key)} strategy={verticalListSortingStrategy}>\n <ul className=\"-mb-2 flex flex-col\">\n {rows.map((row) => (\n <BoardCard\n key={row.key}\n model={model}\n view={view}\n card={card}\n row={row}\n column={column}\n rows={rows}\n more={more}\n draggable={(movable || placeable) && rowAllows(row.record, 'update')}\n placeable={placeable}\n dragged={dragged}\n />\n ))}\n </ul>\n </SortableContext>\n )}\n {limit === undefined && list.more && (\n <Button size=\"sm\" variant=\"ghost\" onClick={list.loadMore}>\n {text('showMore')}\n </Button>\n )}\n </section>\n )\n}\n\ntype CardProps = {\n model: ResourceModel\n view: ViewModel | undefined\n card: ReturnType<typeof boardCard>\n row: ListDisplayRow\n column: BoardColumn\n rows: ListDisplayRow[]\n more: boolean\n draggable: boolean\n placeable: boolean\n dragged: () => boolean\n}\n\n/**\n * A record's card, picked up by dragging it or by Space on its link; one the user may not update stays put. Where the\n * user may change the order of a ranked board, a card is dropped on too: in its own column the cards make room as it\n * moves, in another a bar marks its place.\n */\nconst BoardCard = ({ model, view, card, row, column, rows, more, draggable, placeable, dragged }: CardProps) => {\n const { setNodeRef, setActivatorNodeRef, listeners, isDragging, isOver, active, transform, transition } = useSortable({\n id: row.key,\n data: { row, column, rows, more },\n disabled: { draggable: !draggable, droppable: !placeable },\n })\n const arriving = isOver && (active?.data.current?.column as BoardColumn | undefined)?.value !== column.value\n return (\n <li\n ref={(element) => {\n setNodeRef(element)\n // Space picks the card up from its link, which has the focus\n setActivatorNodeRef(element?.querySelector('a[data-card-link]') ?? element)\n }}\n {...listeners}\n // The card is a link, which the browser would drag as one\n onDragStart={(event) => event.preventDefault()}\n onClickCapture={(event) => {\n if (!dragged()) return\n event.preventDefault()\n event.stopPropagation()\n }}\n style={{ transform: transform ? `translate3d(${transform.x}px, ${transform.y}px, 0)` : undefined, transition }}\n className={cn(\n 'relative pb-2',\n draggable && 'cursor-grab touch-manipulation',\n isDragging && 'opacity-40',\n arriving && 'before:absolute before:inset-x-0 before:-top-1 before:h-0.5 before:rounded-full before:bg-primary',\n )}\n >\n <RecordCard model={model} view={view} display={card} row={row} swipe={false} />\n </li>\n )\n}\n","import { parseFilter, type FilterExpr } from '@protobase/schema'\nimport type { BoardColumn } from './board-columns'\n\nconst flatten = (expr: FilterExpr): FilterExpr[] => (expr.kind === 'and' ? expr.args.flatMap(flatten) : [expr])\n\nconst text = (value: { kind: string; value?: unknown }) => (value.kind === 'string' ? String(value.value) : undefined)\n\n// The values `by = \"v\"` or `in(by, ...)` allows, or none for any other clause\nconst allowedBy = (clause: FilterExpr, by: string): string[] | undefined => {\n if (clause.kind === 'compare' && clause.op === '=' && clause.field.path.join('.') === by) {\n const value = text(clause.value)\n return value === undefined ? undefined : [value]\n }\n if (clause.kind === 'in' && clause.field.path.join('.') === by) {\n const values = clause.values.map(text)\n return values.every((value) => value !== undefined) ? (values as string[]) : undefined\n }\n return undefined\n}\n\n/**\n * The columns of a board `filter` does not rule out: those its top-level `by = \"v\"` and `in(by, ...)` clauses allow. Any\n * other clause leaves every column, so a column is left out only when no record in it can match.\n */\nexport const columnsAllowed = (filter: string, by: string, columns: BoardColumn[]): BoardColumn[] => {\n const parsed = parseFilter(filter)\n if (!parsed.ok || !parsed.ast) return columns\n const clauses = flatten(parsed.ast).map((clause) => allowedBy(clause, by)).filter((values) => values !== undefined)\n return columns.filter((column) => clauses.every((values) => column.value !== null && values.includes(column.value)))\n}\n","import type { Client } from '@protobase/client'\nimport type { KeyValue } from '@protobase/schema'\n\n/** What a board drop's write gets: the card's record as listed, its key and ETag, the column it was dropped on, and the API. */\nexport type BoardDropContext = {\n resource: string\n record: Record<string, unknown>\n /** The record's key as the API takes it. */\n recordKey: KeyValue | readonly KeyValue[]\n etag: string\n /** The value of the column the card was dropped on. */\n to: string\n client: Client\n}\n\n/** What undoes a board drop's write, such as deleting the record it created. */\nexport type BoardDropUndo = () => Promise<void>\n\n/** A board drop's write for one column: what it saves in place of the record's `by`, and what undoes it, when it can be undone. */\nexport type BoardDropWrite = (context: BoardDropContext) => Promise<BoardDropUndo | void>\n\n/**\n * How cards move between a board's columns, a view's `drag.board` naming it: by the value of each column that takes a\n * card, what a drop there writes, such as creating a record of a related resource when `by` is computed from them. A\n * card in or dropped on any other column stays in its column, as does one dropped on the column of records without a\n * value.\n */\nexport type BoardDrop = Record<string, BoardDropWrite>\n\n/** The write a drop on the column of `value` performs, if that column takes cards. */\nexport const dropWrite = (drop: BoardDrop, value: string | null) => (value !== null && Object.hasOwn(drop, value) ? drop[value] : undefined)\n","import { arrayMove } from '@dnd-kit/sortable'\nimport type { BatchOp, BatchResult } from '@protobase/client'\nimport type { ResourceModel } from '@protobase/schema'\nimport { encodeKey } from '@protobase/schema/internal'\nimport { recordKey } from '../../live/model-helpers'\nimport { anchoredMove } from '../hand-order/anchored-move'\nimport { numberedBefore } from '../hand-order/numbered-before'\nimport type { DragWrite } from '../hand-order/undo-ops'\nimport { columnFilter, type BoardColumn } from './board-columns'\nimport type { ListDisplayRow } from './list-displays'\n\n/** Where a card is dropped: the column, its cards as shown before the drop, whether more follow them, and the place among them. */\nexport type BoardPlace = { column: BoardColumn; rows: ListDisplayRow[]; more: boolean; index: number }\n\n/**\n * The column's cards once `row` is dropped at `index`. In its own column it moves there, as a sortable list moves an\n * item; in another it goes in before the card at `index`, or last.\n */\nexport const placedRows = (rows: ListDisplayRow[], row: ListDisplayRow, index: number) => {\n const from = rows.findIndex((entry) => entry.key === row.key)\n if (from !== -1) return arrayMove(rows, from, index)\n return [...rows.slice(0, index), row, ...rows.slice(index)]\n}\n\n/** The column's cards once `row` is dropped at `index`, with the first and last place that changed. */\nexport const placing = (rows: ListDisplayRow[], row: ListDisplayRow, index: number) => {\n const from = rows.findIndex((entry) => entry.key === row.key)\n return { order: placedRows(rows, row, index), first: from === -1 ? index : Math.min(from, index), last: from === -1 ? index : Math.max(from, index) }\n}\n\n/**\n * The batch that saves a drop on a ranked board: in another column first the update of `by`, then a `move` of the card\n * to its place in `order`, the column's cards once dropped, anchored to the cards around it (see `anchoredMove`) in\n * the column `filter` reads, so it saves whatever else changed meanwhile; with `more` cards after `order`, unloaded. With `bump`, the card, last in the column,\n * first takes that rank in a `reorder` of its own, so it ranks above a record it depends on (see `rankedPlace`), and the\n * `move` then only checks its place. The update and the bump write any version, as the `move` decides the order.\n */\nexport const placeOps = (model: ResourceModel, by: string, rank: string, filter: string, row: ListDisplayRow, column: BoardColumn, order: ListDisplayRow[], more: boolean, bump?: number): BatchOp[] => {\n const key = recordKey(model, row.record)\n const index = order.findIndex((entry) => entry.key === row.key)\n const move = anchoredMove(model, rank, columnFilter(filter, by, column.value), order.map((entry) => entry.record), index, more)\n const bumped: BatchOp[] = bump === undefined ? [] : [{ op: 'reorder', resource: model.name, field: rank, keys: [key], start: bump, etags: { [encodeKey(key)]: '*' } }]\n const moving = (row.record[by] ?? null) !== column.value\n const update: BatchOp[] = moving ? [{ op: 'update', resource: model.name, key, data: { [by]: column.value }, etag: '*' }] : []\n return [...update, ...bumped, move]\n}\n\n/**\n * What the batch of a drop saved: each record it wrote, as it stored it last, with its values in `rows`, the column's\n * cards as listed before the drop, and its `rank` as the server had it before the batch, so the drop can be undone.\n */\nexport const boardWrites = (model: ResourceModel, rank: string, rows: ListDisplayRow[], result: BatchResult): DragWrite[] => {\n const keyOf = (record: Record<string, unknown>) => encodeKey(recordKey(model, record))\n const ranks = numberedBefore(result.results, keyOf)\n const before = new Map(rows.map((row) => {\n const key = keyOf(row.record)\n return [key, ranks.has(key) ? { ...row.record, [rank]: ranks.get(key) } : row.record]\n }))\n const stored = new Map<string, { record: Record<string, unknown>; etag: string }>()\n for (const entry of result.results) {\n const written = entry.op === 'reorder' || entry.op === 'move' ? entry.records : entry.op === 'update' ? [entry] : []\n for (const { record, etag } of written) stored.set(keyOf(record), { record, etag })\n }\n return [...stored].flatMap(([key, written]) => {\n const was = before.get(key)\n return was ? [{ before: was, ...written }] : []\n })\n}\n","import type { ResourceModel } from '@protobase/schema'\nimport { encodeKey } from '@protobase/schema/internal'\nimport { recordKey } from '../../live/model-helpers'\nimport { placing } from '../displays/board-place'\nimport type { ListDisplayRow } from '../displays/list-displays'\nimport { reorderSpan } from '@protobase/schema/internal'\nimport { text } from './messages'\nimport type { RankBound, RankBounds } from './rank-bounds'\n\n/** Where a dropped card lands: its place in the column, and the rank it takes there when that must be above its column's order. */\nexport type RankedPlace = { index: number; bump?: number }\n\ntype Request = { model: ResourceModel; rank: string; rows: ListDisplayRow[]; row: ListDisplayRow; index: number; bounds: RankBounds; title: string }\n\nconst isRank = (value: unknown) => value !== null && value !== undefined && value !== ''\n\n/**\n * Where a card of a ranked board dropped at `index` of a column, its cards `rows`, may land by `bounds`: at the first\n * place from there down where the ranks its `reorder` gives keep it below each record it depends on and above each that\n * depends on it, wherever those are. In the last place it may take a rank just above what it depends on, for a record\n * of another column that ranks above the whole column. With the reason it refused `index`; with no place, none.\n */\nexport const rankedPlace = ({ model, rank, rows, row, index, bounds, title }: Request): { place?: RankedPlace; reason?: string } => {\n const own = rows.some((entry) => entry.key === row.key)\n const end = own ? rows.length - 1 : rows.length\n let reason: string | undefined\n for (let at = index; at <= end; at++) {\n const { order, first, last } = placing(rows, row, at)\n const ranks = order.map((entry) => entry.record[rank])\n const span = reorderSpan(ranks, first, last)\n const ranked = new Map(order.map((entry, i) => [encodeKey(recordKey(model, entry.record)), i >= span.first && i <= span.last ? span.start + i - span.first : ranks[i]]))\n const rankOf = (bound: RankBound) => (ranked.has(bound.key) ? ranked.get(bound.key) : bound.rank)\n const mine = Number(ranked.get(encodeKey(recordKey(model, row.record))))\n const above = bounds.after.filter((bound) => isRank(rankOf(bound)) && Number(rankOf(bound)) >= mine)\n const below = bounds.before.find((bound) => isRank(rankOf(bound)) && Number(rankOf(bound)) <= mine)\n const refusal = below ? text('dependsOn', { record: below.title, other: title }) : above[0] && text('dependsOn', { record: title, other: above[0].title })\n if (!refusal) return { place: { index: at }, ...(reason !== undefined && { reason }) }\n reason ??= refusal\n if (at !== end || below) continue\n // Last in its column, nothing after it there keeps its rank down\n const bump = Math.max(...above.map((bound) => Number(rankOf(bound)))) + 1\n if (bounds.before.every((bound) => !isRank(rankOf(bound)) || Number(rankOf(bound)) > bump)) return { place: { index: at, bump }, reason }\n }\n return { reason: reason! }\n}\n","import { useMutation } from '@tanstack/react-query'\nimport { useRef, useState } from 'react'\nimport type { KeyValue, ResourceModel, ViewModel } from '@protobase/schema'\nimport { useClient } from '../../data/api-provider'\nimport { recordKey } from '../../live/model-helpers'\nimport { useToast } from '../../toasts'\nimport { text as orderText } from '../hand-order/messages'\nimport { moveRefusal } from '../hand-order/move-refusal'\nimport { undoOps, type DragWrite } from '../hand-order/undo-ops'\nimport { useRefreshResource } from '../pages/use-layout-data'\nimport { rankBounds } from '../rank-after/rank-bounds'\nimport { rankedPlace, type RankedPlace } from '../rank-after/ranked-place'\nimport type { BoardColumn } from './board-columns'\nimport { dropWrite, type BoardDrop } from './board-drop'\nimport { boardWrites, placeOps, placing, type BoardPlace } from './board-place'\nimport type { ListDisplayRow } from './list-displays'\nimport { text } from './messages'\n\n/**\n * A card on its way to another column or place: the record as it will be, shown there until the columns have reloaded,\n * and on a ranked board the keys of the column's cards in their new order.\n */\nexport type BoardMove = { row: ListDisplayRow; to: string | null; order?: string[] }\n\ntype Move = { row: ListDisplayRow; to: BoardColumn; place?: Omit<BoardPlace, 'column'> }\n\n// What a move saved: the column its record is in now, and what undoes it, when it can be undone; nothing when it stayed put\ntype Saved = { landed: string | null; undo?: () => Promise<unknown> } | undefined\n\ntype Options = {\n model: ResourceModel\n view: ViewModel | undefined\n by: string\n rank?: string | undefined\n /** The list's filter, its search included, which a column narrows to its records. */\n filter: string\n /** The board's own writes for a card dropped on another column, in place of saving `by`. */\n drop?: BoardDrop | undefined\n /** The heading of the column of a value. */\n labelOf: (value: string | null) => string\n /** The title a card shows. */\n titleOf: (row: ListDisplayRow) => string\n}\n\n/**\n * Moving a board's card to another column: one update of the record with the column's value and the ETag it was listed\n * with, as a named update action sends, so the resource's access rules and `validate` decide. On a ranked board a drop\n * at a place is one batch instead, that update when the column changes and a `move` by `rank` among the column's cards,\n * anchored to the card above where it was dropped (see `placeOps`).\n * With the board's `drop`, a card dropped on another column runs that column's write instead, and then reads the record\n * again to say which column it is in now. The card shows in its new place at once; a saved move says so with **Undo**,\n * which puts back the values it changed or runs the undo the drop's write gave, and a refusal puts it back and says why,\n * or that the board changed where it was dropped.\n * With the position's `after`, a card dropped above a record it depends on lands at the first place below that keeps\n * the order, or stays where it was, with a warning saying why (see `rankedPlace`).\n * Either way every list of the resource reloads, which puts the card where its record now is.\n */\nexport const useBoardMove = ({ model, view, by, rank, filter, drop, labelOf, titleOf }: Options) => {\n const client = useClient()\n const toast = useToast()\n const refresh = useRefreshResource()\n const [moves, setMoves] = useState<BoardMove[]>([])\n // Only the latest move can be undone, so its toast replaces the one before\n const undoToast = useRef<number>(undefined)\n const settle = (key: string) => setMoves((current) => current.filter((move) => move.row.key !== key))\n const fields = rank ? [by, rank] : [by]\n\n const undo = useMutation({\n mutationFn: (undoing: () => Promise<unknown>) => undoing(),\n onError: (error) => toast.show(moveRefusal(error, text('couldNotUndo'), { place: 'board' })),\n onSettled: () => refresh(model.name),\n })\n\n // A drop on a column of the board's `drop`: its write, then the record read again for the column it is in now\n const dropped = async (row: ListDisplayRow, to: BoardColumn): Promise<Saved> => {\n const write = drop && dropWrite(drop, to.value)\n if (!write) throw new Error(`The column ${to.label} takes no cards`)\n const key = recordKey(model, row.record) as KeyValue\n const etag = typeof row.record.etag === 'string' ? row.record.etag : '*'\n const undoing = await write({ resource: model.name, record: row.record, recordKey: key, etag, to: to.value!, client })\n const stored = await client.get(model.name, key)\n return { landed: (stored.record[by] ?? null) as string | null, ...(undoing && { undo: undoing }) }\n }\n\n // The values a move or placing saved, which its undo puts back\n const saved = (writes: DragWrite[], to: BoardColumn): Saved => ({ landed: to.value, undo: () => client.batchWrite(undoOps(model, writes, fields)) })\n\n // The card shown in its column, in `order` when it has a place there\n const show = (row: ListDisplayRow, to: BoardColumn, order?: ListDisplayRow[]) => {\n const moved = { ...row, record: { ...row.record, [by]: to.value } }\n const keys = order?.map((entry) => entry.key)\n setMoves((current) => [...current.filter((move) => move.row.key !== row.key), { row: moved, to: to.value, ...(keys && { order: keys }) }])\n }\n\n // Where the card lands by what its record depends on, saying so when that is not where it was dropped\n const allowed = async (row: ListDisplayRow, to: BoardColumn, place: NonNullable<Move['place']>): Promise<RankedPlace | undefined> => {\n if (!model.position?.after) return { index: place.index }\n const bounds = await rankBounds(client, model, view, row.record)\n const ranked = rankedPlace({ model, rank: rank!, rows: place.rows, row, index: place.index, bounds, title: titleOf(row) })\n // Back in its own place it stays as it was, unwritten\n const stays = !ranked.place || (ranked.place.bump === undefined && ranked.place.index === place.rows.findIndex((entry) => entry.key === row.key))\n if (ranked.reason !== undefined) toast.show({ state: 'warning', title: stays ? orderText('notMoved') : orderText('movedToPlace', { place: ranked.place!.index + 1 }), description: ranked.reason })\n if (stays) return undefined\n if (ranked.place!.index !== place.index) show(row, to, placing(place.rows, row, ranked.place!.index).order)\n return ranked.place\n }\n\n // A drop at a place: the card's move among the column's cards, with its update first when it changes column\n const placed = async (row: ListDisplayRow, to: BoardColumn, place: NonNullable<Move['place']>): Promise<Saved> => {\n const landing = await allowed(row, to, place)\n if (!landing) return undefined\n const { order } = placing(place.rows, row, landing.index)\n return saved(boardWrites(model, rank!, order, await client.batchWrite(placeOps(model, by, rank!, filter, row, to, order, place.more, landing.bump))), to)\n }\n\n const mutation = useMutation({\n mutationFn: async ({ row, to, place }: Move): Promise<Saved> => {\n if (place && !rank) throw new Error('A board places a card only by its rank')\n const from = (row.record[by] ?? null) as string | null\n if (drop && to.value !== from) return dropped(row, to)\n if (place) return placed(row, to, place)\n const etag = typeof row.record.etag === 'string' ? row.record.etag : '*'\n const stored = await client.update(model.name, recordKey(model, row.record) as KeyValue, { [by]: to.value }, etag)\n return saved([{ before: row.record, record: stored.record, etag: stored.etag }], to)\n },\n onMutate: ({ row, to, place }) => show(row, to, place && placing(place.rows, row, place.index).order),\n onSuccess: (result, { row, to }) => {\n if (!result) return\n const { landed, undo: undoing } = result\n if (undoToast.current !== undefined) toast.dismiss(undoToast.current)\n undoToast.current = undefined\n const from = row.record[by] ?? null\n const title = landed !== from ? text('movedTo', { column: labelOf(landed) }) : from === to.value ? text('orderChanged') : text('stayedIn', { column: labelOf(landed) })\n if (!undoing) {\n toast.show({ state: 'success', title })\n return\n }\n const id = toast.show({\n state: 'success',\n title,\n action: {\n label: text('undo'),\n onClick: () => {\n toast.dismiss(id)\n undoToast.current = undefined\n undo.mutate(undoing)\n },\n },\n })\n undoToast.current = id\n },\n onError: (error, { row, to }) => {\n settle(row.key)\n const title = (row.record[by] ?? null) === to.value ? text('couldNotReorder') : text('couldNotMoveTo', { to: to.label })\n toast.show(moveRefusal(error, title, { place: 'board', title: titleOf(row) }))\n },\n onSettled: async (_result, _error, { row }) => {\n await refresh(model.name)\n settle(row.key)\n },\n })\n\n return { moves, move: (row: ListDisplayRow, to: BoardColumn, place?: NonNullable<Move['place']>) => mutation.mutate({ row, to, ...(place && { place }) }) }\n}\n","import { DndContext, DragOverlay, KeyboardSensor, MouseSensor, TouchSensor, useSensor, useSensors, type Announcements, type DragEndEvent, type DragStartEvent, type Over } from '@dnd-kit/core'\nimport { useRef, useState } from 'react'\nimport type { ResourceModel, ViewModel } from '@protobase/schema'\nimport { listHandOrder } from '../hand-order/hand-order'\nimport { usePermissions } from '../meta-gate'\nimport { can } from '../permissions'\nimport { BoardColumnView } from './board-column'\nimport { columnsAllowed } from './board-allowed'\nimport { Problem } from '../pages/problem'\nimport { useProjectUi } from '../pages/project-ui'\nimport { boardCard, boardColumns, boardRank, type BoardColumn, type BoardDisplayModel } from './board-columns'\nimport { cardCoordinates, collision, columnId } from './board-dnd'\nimport { dropWrite } from './board-drop'\nimport type { BoardPlace } from './board-place'\nimport type { ListDisplayRow } from './list-displays'\nimport { RecordCard } from './record-card'\nimport { useBoardMove } from './use-board-move'\nimport { text } from './messages'\n\ntype BoardProps = {\n model: ResourceModel\n view: ViewModel | undefined\n display: BoardDisplayModel\n /** The fields the cards show, which the records' relations are labelled for. */\n fields: string[]\n /** The list's filter, its search included, and its order, as the list API takes them. */\n filter: string\n orderBy: string\n /** The most cards a column shows, without a button for more, as an embedded list shows them. */\n limit?: number\n}\n\n// Where a card over `over` would be dropped: before the card it is over, or after the last card of the column\nconst placeOver = (over: Over, row: ListDisplayRow): BoardPlace | undefined => {\n const data = over.data.current as { column?: BoardPlace['column']; rows?: ListDisplayRow[]; more?: boolean; sortable?: { index: number } } | undefined\n if (!data?.column || !data.rows) return undefined\n const more = data.more === true\n if (data.sortable) return { column: data.column, rows: data.rows, more, index: data.sortable.index }\n const own = data.rows.some((entry) => entry.key === row.key)\n return { column: data.column, rows: data.rows, more, index: own ? data.rows.length - 1 : data.rows.length }\n}\n\n/**\n * A column per value of the board's enum field, each loading its own records through the list API, with their count.\n * When the list's `drag.board` is on, a card dragged, or moved with the keyboard, to another column saves the record\n * with that column's value; when it names a board drop of the UI config, only between the columns it names, each\n * running its own write. When the resource has a position, its records ordered as one, the columns are in its order,\n * and when `drag.rank` is on a card is dropped at a place: the up and down arrow keys move it within its column, and\n * the drop renumbers the cards before it. Each change says so with **Undo**.\n */\nexport const BoardDisplay = ({ model, view, display, fields, filter, orderBy, limit }: BoardProps) => {\n const every = boardColumns(model, view, display)\n const columns = columnsAllowed(filter, display.by, every)\n const card = boardCard(model, view, display)\n const permissions = usePermissions(model.name)\n const { boardDrops } = useProjectUi()\n const drag = view?.list?.drag\n const dropName = typeof drag?.board === 'string' ? drag.board : undefined\n const drop = dropName === undefined ? undefined : boardDrops?.[dropName]\n // Whether a card moves in or out of a column: any with `board: true`, else those the named board drop lists\n const takes = (value: string | null) =>\n can(permissions, 'update') && (drag?.board === true ? !model.fields[display.by]?.readOnly : drop !== undefined && dropWrite(drop, value) !== undefined)\n const movable = columns.some((column) => takes(column.value))\n const rank = boardRank(model)\n // Changing the order takes the same right as sorting the list by hand\n const placeable = drag?.rank === true && rank !== undefined && listHandOrder(model, permissions) !== undefined\n const columnOrder = rank ? `${rank} asc` : orderBy\n const labelOf = (value: string | null) => every.find((column) => column.value === value)?.label ?? String(value)\n const title = (row: ListDisplayRow) => String(row.labels[card.title!] ?? row.record[card.title!] ?? row.key)\n const { moves, move } = useBoardMove({ model, view, by: display.by, rank, filter, drop, labelOf, titleOf: title })\n const [active, setActive] = useState<ListDisplayRow | undefined>()\n // The click that ends a drag with a mouse lands on the card's link, which must not open the record\n const dragged = useRef(false)\n const sensors = useSensors(\n useSensor(MouseSensor, { activationConstraint: { distance: 4 } }),\n useSensor(TouchSensor, { activationConstraint: { delay: 250, tolerance: 5 } }),\n // Enter opens the card's record, so only Space picks a card up\n useSensor(KeyboardSensor, { keyboardCodes: { start: ['Space'], cancel: ['Escape'], end: ['Space', 'Enter'] }, coordinateGetter: cardCoordinates }),\n )\n if (dropName !== undefined && !drop) return <Problem>{text.rich('noDrop', { drop: dropName })}</Problem>\n\n const columnOf = (id: unknown) => columns.find((column) => columnId(column.value) === id)\n const valueOf = (row: ListDisplayRow) => (row.record[display.by] ?? null) as string | null\n const crosses = (row: ListDisplayRow, to: BoardColumn) => takes(valueOf(row)) && takes(to.value)\n const announced = (row: ListDisplayRow, over: Over | null) => {\n if (!over) return { over: text('noColumn') }\n const place = placeable ? placeOver(over, row) : undefined\n if (!place) return { over: columnOf(over.id)?.label ?? text('noColumn') }\n const count = place.rows.some((entry) => entry.key === row.key) ? place.rows.length : place.rows.length + 1\n return { over: text('placeOf', { column: place.column.label, place: place.index + 1, count }), place: text('place', { column: place.column.label, place: place.index + 1 }) }\n }\n // Whether a drop on `over` takes the card to a column it may not move to\n const refused = (row: ListDisplayRow, over: Over) => {\n const target = (placeable ? placeOver(over, row)?.column : undefined) ?? columnOf(over.id)\n return target !== undefined && target.value !== valueOf(row) && !crosses(row, target)\n }\n const announcements: Announcements = {\n onDragStart: ({ active: picked }) => text('pickedUp', { title: title(picked.data.current!.row) }),\n onDragOver: ({ active: picked, over }) => text('isOver', { title: title(picked.data.current!.row), over: announced(picked.data.current!.row, over).over }),\n onDragEnd: ({ active: picked, over }) => {\n const row = picked.data.current!.row as ListDisplayRow\n if (!over || refused(row, over)) return text('putBack', { title: title(row) })\n const said = announced(row, over)\n return text('wasMovedTo', { title: title(row), to: said.place ?? said.over })\n },\n onDragCancel: ({ active: picked }) => text('cancelled', { title: title(picked.data.current!.row) }),\n }\n\n const start = ({ active: picked }: DragStartEvent) => {\n dragged.current = true\n setActive(picked.data.current!.row as ListDisplayRow)\n }\n const end = ({ active: picked, over }: DragEndEvent) => {\n setActive(undefined)\n setTimeout(() => (dragged.current = false))\n const row = picked.data.current!.row as ListDisplayRow\n if (!over) return\n const place = placeable ? placeOver(over, row) : undefined\n if (!place) {\n const target = columnOf(over.id)\n if (target && target.value !== valueOf(row) && crosses(row, target)) move(row, target)\n return\n }\n const from = place.rows.findIndex((entry) => entry.key === row.key)\n // A card the user may not move to another column goes back\n if (from === -1 && !crosses(row, place.column)) return\n // A board drop's write decides where the card lands in another column, so it has no place there\n if (from === -1 && drop) return move(row, place.column)\n if (from === place.index) return\n move(row, place.column, { rows: place.rows, more: place.more, index: place.index })\n }\n\n return (\n <DndContext\n sensors={sensors}\n collisionDetection={collision}\n onDragStart={start}\n onDragEnd={end}\n onDragCancel={() => {\n setActive(undefined)\n setTimeout(() => (dragged.current = false))\n }}\n accessibility={{\n announcements,\n screenReaderInstructions: {\n draggable: !placeable\n ? text('boardAcross')\n : movable\n ? text('boardAnywhere')\n : text('boardWithin'),\n },\n }}\n >\n {/* As tall as its longest column, scrolling with the page, and sideways when its columns are wider than the page; positioned, so what its cards place absolutely, such as their screen-reader labels, scrolls inside it instead of widening the page */}\n <div className=\"relative min-w-0 flex-1 overflow-x-auto\">\n <div className=\"flex snap-x items-start gap-3 pb-2\">\n {columns.map((column) => (\n <BoardColumnView\n key={columnId(column.value)}\n model={model}\n view={view}\n display={display}\n column={column}\n fields={fields}\n filter={filter}\n orderBy={columnOrder}\n limit={limit}\n moves={moves}\n movable={takes(column.value)}\n placeable={placeable}\n dragged={() => dragged.current}\n />\n ))}\n </div>\n </div>\n <DragOverlay>{active && <RecordCard model={model} view={view} display={card} row={active} swipe={false} />}</DragOverlay>\n </DndContext>\n )\n}\n"],"mappings":"gyCAGA,IAAMA,GAAU,GAAoC,OAAOoE,GAAU,UAAY,OAAO,UAAUA,CAAK,EAQ1FC,IAAe,EAA2B,EAAe,IAA8B,CAElG,IAAIC,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I,CAACnB,GAAQiB,EAAQhI,EAAK+G,CAAI,EAAG,OAAO/L,EAAK,UAAW,CAAE,MAAO+J,EAAM/E,CAAG,CAAE,CAAC,EAC7E,IAAMmI,EAAOJ,EAAU/H,EAAK+G,CAAI,EAChC,OAAO/L,EAAK,aAAc,CAAE,MAAO+J,EAAM/E,CAAG,EAAG,GAAImI,EAAK,OAASA,EAAK,IAAK,CAAC,CAC9E,EACA,cAAe,CAAE,OAAQD,KAAalN,EAAK,YAAa,CAAE,MAAO+J,EAAMmD,EAAO,KAAK,QAAS,GAAG,CAAE,CAAC,CAsC9F,EACA,yBAA0B,CACxB,UAGMlN,EAHM4G,EAERD,EACO,gBACA,cAHF,aAGe,CAC1B,CACF,EAlBF,SAAA,EAqBE,EAAA/B,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,0CACb,UAAA,EAAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,qCACZ,SAAAkD,EAAQ,IAAK,IACZ,EAAAlD,EAAA,IAAA,CAACO,GAAD,CAES,QACD,OACG,UACD,SACA,SACA,SACR,QAASqH,EACF,QACA,QACP,QAASD,EAAMjH,EAAO,KAAK,EAChB,YACX,YAAe6B,EAAQ,OACxB,EAbM5D,EAAS+B,EAAO,KAAK,CAa3B,CACF,CACE,CAAA,CACF,CAAA,GACL,EAAAV,EAAA,IAAA,CAACtC,EAAD,CAAA,SAAcwE,IAAU,EAAAlC,EAAA,IAAA,CAAC5C,EAAD,CAAmB,QAAa,OAAM,QAASuD,EAAM,IAAKuB,EAAQ,MAAO,EAAQ,CAAA,CAAe,CAAA,CAC9G,GAEhB","debugId":"d26b3aba-ee11-4cc7-9e42-68bd4ac498a8"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-display-C9M_BrdC.js","names":["useState","useRef","n","a","t","__toESM","require_react","require_jsx_runtime","formatDayRange","AppLink","Skeleton","cn","can","usePermissions","formatDate","dayIn","viewerZone","text","ErrorBanner","formatWeekday","formatWeekdayDate","formatMonth","rowAllows","useSensor","MouseSensor","useDroppable","KeyboardSensor","DragOverlay","TouchSensor","DndContext","useSensors","collision","rangeOf","EventChip","todayView","dayId","byDay","calendarView","CalendarEvent","PeriodControls","useCalendarMove","eventTitle","gridDays","useCalendarRows","dayCoordinates","movedRows","stepView","import_react","import_jsx_runtime","periodText","days","view","ms","day","CalendarControls","holdsToday","now","scaled","to","scale","CalendarDay","setNodeRef","count","week","inMonth","isOver","today","children","more","monthDayLimit","CalendarDisplay","local","setLocal","shown","linkTo","at","list","model","display","placed","moves","permissions","movable","name","active","setActive","dragged","sensors","dayText","id","title","picked","announcements","over","release","start","end","target","move","row","label","hidden","className","events","visible"],"sources":["../../../src/app/displays/calendar-controls.tsx","../../../src/app/displays/calendar-day.tsx","../../../src/app/displays/calendar-display.tsx"],"sourcesContent":["import type { AppAddress, CalendarView } from '@protobase/schema'\nimport { formatDayRange, formatMonth } from '../../format/date'\nimport { calendarView, gridDays, stepView, todayView } from './calendar-range'\nimport { dayIn, viewerZone } from '../../format/zone'\nimport { PeriodControls } from './period-controls'\nimport { text } from './messages'\n\ntype ControlsProps = {\n view: CalendarView\n now: number\n /** The address that shows the calendar at a view: the controls are links to it. */\n linkTo?: (view: CalendarView) => AppAddress\n /** Shows the calendar at a view, for a calendar without an address of its own: the controls are buttons. */\n onView?: (view: CalendarView) => void\n}\n\n/** The heading of the month or week a calendar shows. */\nexport const periodText = (view: CalendarView) => {\n const days = gridDays(view)\n const ms = (day: string) => Date.parse(`${day}T00:00:00Z`)\n return view.scale === 'month' ? formatMonth(ms(view.day)) : formatDayRange(ms(days[0]!), ms(days.at(-1)!))\n}\n\n/** The month or week a calendar shows, with the way to the one before, the one holding today, the one after, and the month or the week. */\nexport const CalendarControls = ({ view, now, linkTo, onView }: ControlsProps) => {\n // A month opens the week holding today when it holds today, else its first week; a week opens its month\n const holdsToday = view.scale === 'month' && dayIn(now, viewerZone()).startsWith(view.day.slice(0, 7))\n const scaled = (to: CalendarView['scale']) => (to === 'week' && holdsToday ? todayView('week', now) : calendarView({ scale: to, day: view.day }, now))\n const scale = (to: CalendarView['scale'], label: string) => ({ view: scaled(to), label, current: view.scale === to })\n return (\n <PeriodControls\n heading={periodText(view)}\n unit={view.scale === 'month' ? 'month' : 'week'}\n previous={stepView(view, -1)}\n today={todayView(view.scale, now)}\n next={stepView(view, 1)}\n scales={[scale('month', text('month')), scale('week', text('week'))]}\n scalesLabel={text('calendarScale')}\n linkTo={linkTo}\n onView={onView}\n />\n )\n}\n","import { useDroppable } from '@dnd-kit/core'\nimport type { ReactNode } from 'react'\nimport { formatWeekday, formatWeekdayDate } from '../../format/date'\nimport { cn } from '../../lib/cn'\nimport { dayId } from './calendar-dnd'\n\ntype DayProps = {\n day: string\n /** How many events are on it, the hidden ones included. */\n count: number\n /** Its events, as many as it shows. */\n children: ReactNode\n /** The link to the rest of its events, when it does not show them all. */\n more?: ReactNode\n /** Whether it lies in a month view's month, rather than the days around it. */\n inMonth: boolean\n today: boolean\n /** A week view's day, headed by its weekday and taller, rather than a month view's cell. */\n week: boolean\n}\n\n/** A day of a calendar, where an event is dropped: headed by its number, today marked, its events in start order. */\nexport const CalendarDay = ({ day, count, children, more, inMonth, today, week }: DayProps) => {\n const { setNodeRef, isOver } = useDroppable({ id: dayId(day) })\n const ms = Date.parse(`${day}T00:00:00Z`)\n return (\n <section\n ref={setNodeRef}\n aria-label={`${formatWeekdayDate(ms)}, ${count}`}\n className={cn('flex min-w-0 flex-col gap-1 bg-background p-1', week ? 'min-h-28 sm:min-h-64' : 'min-h-24', !inMonth && 'bg-surface', isOver && 'ring-2 ring-inset ring-primary/30')}\n >\n <header className={cn('flex items-center gap-1 px-0.5 text-xs', inMonth ? 'text-foreground' : 'text-muted-foreground')}>\n {week && <span className=\"text-muted-foreground\">{formatWeekday(ms)}</span>}\n <span aria-current={today ? 'date' : undefined} className={cn('inline-flex size-5 items-center justify-center rounded-full tabular-nums', today && 'bg-primary font-medium text-primary-foreground')}>\n {Number(day.slice(8))}\n </span>\n </header>\n {children}\n {more}\n </section>\n )\n}\n","import { DndContext, DragOverlay, KeyboardSensor, MouseSensor, TouchSensor, useSensor, useSensors, type Announcements, type DragEndEvent, type DragStartEvent } from '@dnd-kit/core'\nimport { useRef, useState } from 'react'\nimport type { AppAddress, CalendarView, ResourceModel, ViewModel } from '@protobase/schema'\nimport { formatDate, formatWeekday } from '../../format/date'\nimport { cn } from '../../lib/cn'\nimport { Skeleton } from '../../primitives/skeleton'\nimport { ErrorBanner } from '../error-banner'\nimport { usePermissions } from '../meta-gate'\nimport { can, rowAllows } from '../permissions'\nimport { AppLink } from '../use-app-address'\nimport { collision } from './board-dnd'\nimport { CalendarControls } from './calendar-controls'\nimport { CalendarDay } from './calendar-day'\nimport { dayCoordinates, dayId } from './calendar-dnd'\nimport { CalendarEvent, EventChip, eventTitle } from './calendar-event'\nimport { byDay, calendarView, gridDays, rangeOf, type CalendarDisplayModel } from './calendar-range'\nimport { dayIn, viewerZone } from '../../format/zone'\nimport type { ListDisplayRow } from './list-displays'\nimport { calendarLimit, useCalendarRows } from './use-calendar-rows'\nimport { movedRows, useCalendarMove } from './use-calendar-move'\nimport { text } from './messages'\n\ntype CalendarProps = {\n model: ResourceModel\n view: ViewModel | undefined\n display: CalendarDisplayModel\n /** The fields the events show, which the records' relations are labelled for. */\n fields: string[]\n /** The list's filter, its search included, as the list API takes it. */\n filter: string\n /** The month or week the address names; the month of today when it names none. */\n at?: CalendarView\n /** The address that shows the calendar at a view, for a calendar whose view is in the address; else it keeps its own. */\n linkTo?: (view: CalendarView) => AppAddress\n /** The time that is today, now unless a test fixes it. */\n now?: number\n}\n\n/** The events a month's day shows before a link to its week, which shows them all. */\nconst monthDayLimit = 3\n\n// What an event being moved is: the record, and the day it was picked up from\ntype Picked = { row: ListDisplayRow; day: string }\n\n/**\n * The list's records on the days of a month or a week, loaded for those days alone through the list API; an event\n * dragged, or moved with the keyboard, to another day saves the record with its dates moved by the same days.\n */\nexport const CalendarDisplay = ({ model, view, display, fields, filter, at, linkTo, now = Date.now() }: CalendarProps) => {\n const [local, setLocal] = useState<CalendarView | undefined>()\n const shown = calendarView(linkTo ? at : local, now)\n const days = gridDays(shown)\n const list = useCalendarRows({ model, display, range: rangeOf(shown), fields, filter })\n const { moves, move } = useCalendarMove(model, display)\n const placed = byDay(movedRows(list.rows, moves), display, model, days)\n const permissions = usePermissions(model.name)\n const movable = can(permissions, 'update') && [display.start, display.end].every((name) => name === undefined || !model.fields[name]?.readOnly)\n const [active, setActive] = useState<Picked | undefined>()\n // The click that ends a drag with a mouse lands on the event's link, which must not open the record\n const dragged = useRef(false)\n const sensors = useSensors(\n useSensor(MouseSensor, { activationConstraint: { distance: 4 } }),\n useSensor(TouchSensor, { activationConstraint: { delay: 250, tolerance: 5 } }),\n // Enter opens the event's record, so only Space picks an event up\n useSensor(KeyboardSensor, { keyboardCodes: { start: ['Space'], cancel: ['Escape'], end: ['Space', 'Enter'] }, coordinateGetter: dayCoordinates }),\n )\n\n const today = dayIn(now, viewerZone())\n const week = shown.scale === 'week'\n const dayText = (id: unknown) => formatDate(Date.parse(`${String(id).slice(dayId('').length)}T00:00:00Z`))\n const title = (picked: Picked) => eventTitle(model, view, display, picked.row)\n const announcements: Announcements = {\n onDragStart: ({ active: picked }) => text('pickedUp', { title: title(picked.data.current as Picked) }),\n onDragOver: ({ active: picked, over }) => text('isOver', { title: title(picked.data.current as Picked), over: over ? dayText(over.id) : text('noDay') }),\n onDragEnd: ({ active: picked, over }) => (over ? text('wasMovedTo', { title: title(picked.data.current as Picked), to: dayText(over.id) }) : text('putBack', { title: title(picked.data.current as Picked) })),\n onDragCancel: ({ active: picked }) => text('cancelled', { title: title(picked.data.current as Picked) }),\n }\n const release = () => {\n setActive(undefined)\n setTimeout(() => (dragged.current = false))\n }\n const start = ({ active: picked }: DragStartEvent) => {\n dragged.current = true\n setActive(picked.data.current as Picked)\n }\n const end = ({ active: picked, over }: DragEndEvent) => {\n release()\n const { row, day } = picked.data.current as Picked\n const target = over ? String(over.id).slice(dayId('').length) : undefined\n if (target && target !== day) move(row, day, target)\n }\n\n // A month's day with more events than it shows links to its week\n const more = (day: string, hidden: number) => {\n const to = calendarView({ scale: 'week', day }, now)\n const label = text('moreHidden', { count: hidden })\n const className = 'self-start rounded px-1 text-xs text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-primary'\n return linkTo ? (\n <AppLink to={linkTo(to)} className={className}>\n {label}\n </AppLink>\n ) : (\n <button type=\"button\" className={className} onClick={() => setLocal(to)}>\n {label}\n </button>\n )\n }\n\n return (\n <div className=\"flex min-w-0 flex-1 flex-col gap-3\">\n <CalendarControls view={shown} now={now} linkTo={linkTo} onView={setLocal} />\n {list.error && <ErrorBanner title={text('couldNotLoadRows')} error={list.error} />}\n {list.capped && (\n <p className=\"text-xs text-muted-foreground\">\n {text('capped', { limit: calendarLimit, unit: shown.scale })}\n </p>\n )}\n <DndContext\n sensors={sensors}\n collisionDetection={collision}\n onDragStart={start}\n onDragEnd={end}\n onDragCancel={release}\n accessibility={{\n announcements,\n screenReaderInstructions: {\n draggable: text('calendarInstructions'),\n },\n }}\n >\n {/* As tall as its fullest days, scrolling with the page */}\n <div className=\"overflow-hidden rounded-lg border border-border\">\n {!week && (\n <div aria-hidden className=\"grid grid-cols-7 gap-px border-b border-border bg-border\">\n {days.slice(0, 7).map((day) => (\n <span key={day} className=\"bg-surface px-1.5 py-1 text-xs font-medium text-muted-foreground\">\n {formatWeekday(Date.parse(`${day}T00:00:00Z`))}\n </span>\n ))}\n </div>\n )}\n <div className={cn('grid gap-px bg-border', week ? 'grid-cols-1 sm:grid-cols-7' : 'grid-cols-7')}>\n {days.map((day) => {\n const events = placed.get(day)!\n const visible = week ? events : events.slice(0, monthDayLimit)\n return (\n <CalendarDay\n key={day}\n day={day}\n count={events.length}\n inMonth={week || day.startsWith(shown.day.slice(0, 7))}\n today={day === today}\n week={week}\n more={visible.length < events.length && more(day, events.length - visible.length)}\n >\n {list.loading ? (\n <Skeleton className=\"h-4\" />\n ) : (\n visible.map((row) => (\n <CalendarEvent\n key={row.key}\n model={model}\n view={view}\n display={display}\n row={row}\n day={day}\n movable={movable && rowAllows(row.record, 'update')}\n dragged={() => dragged.current}\n />\n ))\n )}\n </CalendarDay>\n )\n })}\n </div>\n </div>\n <DragOverlay>{active && <EventChip model={model} view={view} display={display} row={active.row} day={active.day} />}</DragOverlay>\n </DndContext>\n </div>\n )\n}\n"],"mappings":"uhCAiBaiD,EAAc,GAAuB,CAChD,IAAMC,EAAOR,EAASS,CAAI,EACpBC,EAAM,GAAgB,KAAK,MAAM,GAAGC,EAAI,WAAW,EACzD,OAAOF,EAAK,QAAU,QAAU9B,EAAY+B,EAAGD,EAAK,GAAG,CAAC,EAAI3C,EAAe4C,EAAGF,EAAK,EAAG,EAAGE,EAAGF,EAAK,GAAG,EAAE,CAAE,CAAC,CAC3G,EAGaI,GAAoB,CAAE,OAAM,MAAK,SAAQ,YAA4B,CAEhF,IAAMC,EAAaJ,EAAK,QAAU,SAAWpC,EAAMyC,EAAKxC,EAAW,CAAC,CAAC,CAAC,WAAWmC,EAAK,IAAI,MAAM,EAAG,CAAC,CAAC,EAC/FM,EAAU,GAA+BC,IAAO,QAAUH,EAAarB,EAAU,OAAQsB,CAAG,EAAInB,EAAa,CAAE,MAAOqB,EAAI,IAAKP,EAAK,GAAI,EAAGK,CAAG,EAC9IG,GAAS,EAA2B,KAAmB,CAAE,KAAMF,EAAOC,CAAE,EAAG,QAAO,QAASP,EAAK,QAAUO,CAAG,GACnH,OACE,EAAAV,EAAA,IAAA,CAACT,EAAD,CACE,QAASU,EAAWE,CAAI,EACxB,KAAMA,EAAK,QAAU,QAAU,QAAU,OACzC,SAAUL,EAASK,EAAM,EAAE,EAC3B,MAAOjB,EAAUiB,EAAK,MAAOK,CAAG,EAChC,KAAMV,EAASK,EAAM,CAAC,EACtB,OAAQ,CAACQ,EAAM,QAAS1C,EAAK,OAAO,CAAC,EAAG0C,EAAM,O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WAAWoB,EAAM,IAAI,MAAM,EAAG,CAAC,CAAC,EACrD,MAAOpB,IAAQa,GACT,OACN,KAAMsC,EAAQ,OAASD,EAAO,QAAUnC,GAAKf,EAAKkD,EAAO,OAASC,EAAQ,MAAM,EAE/E,SAAA5B,EAAK,SACJ,EAAA5B,EAAA,IAAA,CAACtC,EAAD,CAAU,UAAU,KAAO,CAAA,EAE3B8F,EAAQ,IAAK,IACX,EAAAxD,EAAA,IAAA,CAACV,EAAD,CAES,QACD,OACG,UACJ,MACA,MACL,QAAS4C,IAAW5D,EAAU6E,EAAI,OAAQ,QAAQ,EAClD,YAAeb,EAAQ,OACxB,EARMa,EAAI,GAQV,CACF,CAEQ,EAxBN9C,CAwBM,CAEjB,CAAC,CACE,CAAA,CACF,CACL,CAAA,GAAA,EAAAL,EAAA,IAAA,CAACrB,GAAD,CAAA,SAAcyD,IAAU,EAAApC,EAAA,IAAA,CAACf,EAAD,CAAkB,QAAa,OAAe,UAAS,IAAKmD,EAAO,IAAK,IAAKA,EAAO,GAAM,CAAA,CAAe,CAAA,CACvH,GACT,GAET","debugId":"bd33f06b-742a-4f06-9985-52eb7909e9c3"}
|
|
1
|
+
{"version":3,"file":"calendar-display-CpqjM4oV.js","names":["useState","useRef","n","a","t","__toESM","require_react","require_jsx_runtime","formatDayRange","AppLink","Skeleton","cn","can","usePermissions","formatDate","dayIn","viewerZone","text","ErrorBanner","formatWeekday","formatWeekdayDate","formatMonth","rowAllows","useSensor","MouseSensor","useDroppable","KeyboardSensor","DragOverlay","TouchSensor","DndContext","useSensors","collision","rangeOf","EventChip","todayView","dayId","byDay","calendarView","CalendarEvent","PeriodControls","useCalendarMove","eventTitle","gridDays","useCalendarRows","dayCoordinates","movedRows","stepView","import_react","import_jsx_runtime","periodText","days","view","ms","day","CalendarControls","holdsToday","now","scaled","to","scale","CalendarDay","setNodeRef","count","week","inMonth","isOver","today","children","more","monthDayLimit","CalendarDisplay","local","setLocal","shown","linkTo","at","list","model","display","placed","moves","permissions","movable","name","active","setActive","dragged","sensors","dayText","id","title","picked","announcements","over","release","start","end","target","move","row","label","hidden","className","events","visible"],"sources":["../../../src/app/displays/calendar-controls.tsx","../../../src/app/displays/calendar-day.tsx","../../../src/app/displays/calendar-display.tsx"],"sourcesContent":["import type { AppAddress, CalendarView } from '@protobase/schema'\nimport { formatDayRange, formatMonth } from '../../format/date'\nimport { calendarView, gridDays, stepView, todayView } from './calendar-range'\nimport { dayIn, viewerZone } from '../../format/zone'\nimport { PeriodControls } from './period-controls'\nimport { text } from './messages'\n\ntype ControlsProps = {\n view: CalendarView\n now: number\n /** The address that shows the calendar at a view: the controls are links to it. */\n linkTo?: (view: CalendarView) => AppAddress\n /** Shows the calendar at a view, for a calendar without an address of its own: the controls are buttons. */\n onView?: (view: CalendarView) => void\n}\n\n/** The heading of the month or week a calendar shows. */\nexport const periodText = (view: CalendarView) => {\n const days = gridDays(view)\n const ms = (day: string) => Date.parse(`${day}T00:00:00Z`)\n return view.scale === 'month' ? formatMonth(ms(view.day)) : formatDayRange(ms(days[0]!), ms(days.at(-1)!))\n}\n\n/** The month or week a calendar shows, with the way to the one before, the one holding today, the one after, and the month or the week. */\nexport const CalendarControls = ({ view, now, linkTo, onView }: ControlsProps) => {\n // A month opens the week holding today when it holds today, else its first week; a week opens its month\n const holdsToday = view.scale === 'month' && dayIn(now, viewerZone()).startsWith(view.day.slice(0, 7))\n const scaled = (to: CalendarView['scale']) => (to === 'week' && holdsToday ? todayView('week', now) : calendarView({ scale: to, day: view.day }, now))\n const scale = (to: CalendarView['scale'], label: string) => ({ view: scaled(to), label, current: view.scale === to })\n return (\n <PeriodControls\n heading={periodText(view)}\n unit={view.scale === 'month' ? 'month' : 'week'}\n previous={stepView(view, -1)}\n today={todayView(view.scale, now)}\n next={stepView(view, 1)}\n scales={[scale('month', text('month')), scale('week', text('week'))]}\n scalesLabel={text('calendarScale')}\n linkTo={linkTo}\n onView={onView}\n />\n )\n}\n","import { useDroppable } from '@dnd-kit/core'\nimport type { ReactNode } from 'react'\nimport { formatWeekday, formatWeekdayDate } from '../../format/date'\nimport { cn } from '../../lib/cn'\nimport { dayId } from './calendar-dnd'\n\ntype DayProps = {\n day: string\n /** How many events are on it, the hidden ones included. */\n count: number\n /** Its events, as many as it shows. */\n children: ReactNode\n /** The link to the rest of its events, when it does not show them all. */\n more?: ReactNode\n /** Whether it lies in a month view's month, rather than the days around it. */\n inMonth: boolean\n today: boolean\n /** A week view's day, headed by its weekday and taller, rather than a month view's cell. */\n week: boolean\n}\n\n/** A day of a calendar, where an event is dropped: headed by its number, today marked, its events in start order. */\nexport const CalendarDay = ({ day, count, children, more, inMonth, today, week }: DayProps) => {\n const { setNodeRef, isOver } = useDroppable({ id: dayId(day) })\n const ms = Date.parse(`${day}T00:00:00Z`)\n return (\n <section\n ref={setNodeRef}\n aria-label={`${formatWeekdayDate(ms)}, ${count}`}\n className={cn('flex min-w-0 flex-col gap-1 bg-background p-1', week ? 'min-h-28 sm:min-h-64' : 'min-h-24', !inMonth && 'bg-surface', isOver && 'ring-2 ring-inset ring-primary/30')}\n >\n <header className={cn('flex items-center gap-1 px-0.5 text-xs', inMonth ? 'text-foreground' : 'text-muted-foreground')}>\n {week && <span className=\"text-muted-foreground\">{formatWeekday(ms)}</span>}\n <span aria-current={today ? 'date' : undefined} className={cn('inline-flex size-5 items-center justify-center rounded-full tabular-nums', today && 'bg-primary font-medium text-primary-foreground')}>\n {Number(day.slice(8))}\n </span>\n </header>\n {children}\n {more}\n </section>\n )\n}\n","import { DndContext, DragOverlay, KeyboardSensor, MouseSensor, TouchSensor, useSensor, useSensors, type Announcements, type DragEndEvent, type DragStartEvent } from '@dnd-kit/core'\nimport { useRef, useState } from 'react'\nimport type { AppAddress, CalendarView, ResourceModel, ViewModel } from '@protobase/schema'\nimport { formatDate, formatWeekday } from '../../format/date'\nimport { cn } from '../../lib/cn'\nimport { Skeleton } from '../../primitives/skeleton'\nimport { ErrorBanner } from '../error-banner'\nimport { usePermissions } from '../meta-gate'\nimport { can, rowAllows } from '../permissions'\nimport { AppLink } from '../use-app-address'\nimport { collision } from './board-dnd'\nimport { CalendarControls } from './calendar-controls'\nimport { CalendarDay } from './calendar-day'\nimport { dayCoordinates, dayId } from './calendar-dnd'\nimport { CalendarEvent, EventChip, eventTitle } from './calendar-event'\nimport { byDay, calendarView, gridDays, rangeOf, type CalendarDisplayModel } from './calendar-range'\nimport { dayIn, viewerZone } from '../../format/zone'\nimport type { ListDisplayRow } from './list-displays'\nimport { calendarLimit, useCalendarRows } from './use-calendar-rows'\nimport { movedRows, useCalendarMove } from './use-calendar-move'\nimport { text } from './messages'\n\ntype CalendarProps = {\n model: ResourceModel\n view: ViewModel | undefined\n display: CalendarDisplayModel\n /** The fields the events show, which the records' relations are labelled for. */\n fields: string[]\n /** The list's filter, its search included, as the list API takes it. */\n filter: string\n /** The month or week the address names; the month of today when it names none. */\n at?: CalendarView\n /** The address that shows the calendar at a view, for a calendar whose view is in the address; else it keeps its own. */\n linkTo?: (view: CalendarView) => AppAddress\n /** The time that is today, now unless a test fixes it. */\n now?: number\n}\n\n/** The events a month's day shows before a link to its week, which shows them all. */\nconst monthDayLimit = 3\n\n// What an event being moved is: the record, and the day it was picked up from\ntype Picked = { row: ListDisplayRow; day: string }\n\n/**\n * The list's records on the days of a month or a week, loaded for those days alone through the list API; an event\n * dragged, or moved with the keyboard, to another day saves the record with its dates moved by the same days.\n */\nexport const CalendarDisplay = ({ model, view, display, fields, filter, at, linkTo, now = Date.now() }: CalendarProps) => {\n const [local, setLocal] = useState<CalendarView | undefined>()\n const shown = calendarView(linkTo ? at : local, now)\n const days = gridDays(shown)\n const list = useCalendarRows({ model, display, range: rangeOf(shown), fields, filter })\n const { moves, move } = useCalendarMove(model, display)\n const placed = byDay(movedRows(list.rows, moves), display, model, days)\n const permissions = usePermissions(model.name)\n const movable = can(permissions, 'update') && [display.start, display.end].every((name) => name === undefined || !model.fields[name]?.readOnly)\n const [active, setActive] = useState<Picked | undefined>()\n // The click that ends a drag with a mouse lands on the event's link, which must not open the record\n const dragged = useRef(false)\n const sensors = useSensors(\n useSensor(MouseSensor, { activationConstraint: { distance: 4 } }),\n useSensor(TouchSensor, { activationConstraint: { delay: 250, tolerance: 5 } }),\n // Enter opens the event's record, so only Space picks an event up\n useSensor(KeyboardSensor, { keyboardCodes: { start: ['Space'], cancel: ['Escape'], end: ['Space', 'Enter'] }, coordinateGetter: dayCoordinates }),\n )\n\n const today = dayIn(now, viewerZone())\n const week = shown.scale === 'week'\n const dayText = (id: unknown) => formatDate(Date.parse(`${String(id).slice(dayId('').length)}T00:00:00Z`))\n const title = (picked: Picked) => eventTitle(model, view, display, picked.row)\n const announcements: Announcements = {\n onDragStart: ({ active: picked }) => text('pickedUp', { title: title(picked.data.current as Picked) }),\n onDragOver: ({ active: picked, over }) => text('isOver', { title: title(picked.data.current as Picked), over: over ? dayText(over.id) : text('noDay') }),\n onDragEnd: ({ active: picked, over }) => (over ? text('wasMovedTo', { title: title(picked.data.current as Picked), to: dayText(over.id) }) : text('putBack', { title: title(picked.data.current as Picked) })),\n onDragCancel: ({ active: picked }) => text('cancelled', { title: title(picked.data.current as Picked) }),\n }\n const release = () => {\n setActive(undefined)\n setTimeout(() => (dragged.current = false))\n }\n const start = ({ active: picked }: DragStartEvent) => {\n dragged.current = true\n setActive(picked.data.current as Picked)\n }\n const end = ({ active: picked, over }: DragEndEvent) => {\n release()\n const { row, day } = picked.data.current as Picked\n const target = over ? String(over.id).slice(dayId('').length) : undefined\n if (target && target !== day) move(row, day, target)\n }\n\n // A month's day with more events than it shows links to its week\n const more = (day: string, hidden: number) => {\n const to = calendarView({ scale: 'week', day }, now)\n const label = text('moreHidden', { count: hidden })\n const className = 'self-start rounded px-1 text-xs text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-primary'\n return linkTo ? (\n <AppLink to={linkTo(to)} className={className}>\n {label}\n </AppLink>\n ) : (\n <button type=\"button\" className={className} onClick={() => setLocal(to)}>\n {label}\n </button>\n )\n }\n\n return (\n <div className=\"flex min-w-0 flex-1 flex-col gap-3\">\n <CalendarControls view={shown} now={now} linkTo={linkTo} onView={setLocal} />\n {list.error && <ErrorBanner title={text('couldNotLoadRows')} error={list.error} />}\n {list.capped && (\n <p className=\"text-xs text-muted-foreground\">\n {text('capped', { limit: calendarLimit, unit: shown.scale })}\n </p>\n )}\n <DndContext\n sensors={sensors}\n collisionDetection={collision}\n onDragStart={start}\n onDragEnd={end}\n onDragCancel={release}\n accessibility={{\n announcements,\n screenReaderInstructions: {\n draggable: text('calendarInstructions'),\n },\n }}\n >\n {/* As tall as its fullest days, scrolling with the page */}\n <div className=\"overflow-hidden rounded-lg border border-border\">\n {!week && (\n <div aria-hidden className=\"grid grid-cols-7 gap-px border-b border-border bg-border\">\n {days.slice(0, 7).map((day) => (\n <span key={day} className=\"bg-surface px-1.5 py-1 text-xs font-medium text-muted-foreground\">\n {formatWeekday(Date.parse(`${day}T00:00:00Z`))}\n </span>\n ))}\n </div>\n )}\n <div className={cn('grid gap-px bg-border', week ? 'grid-cols-1 sm:grid-cols-7' : 'grid-cols-7')}>\n {days.map((day) => {\n const events = placed.get(day)!\n const visible = week ? events : events.slice(0, monthDayLimit)\n return (\n <CalendarDay\n key={day}\n day={day}\n count={events.length}\n inMonth={week || day.startsWith(shown.day.slice(0, 7))}\n today={day === today}\n week={week}\n more={visible.length < events.length && more(day, events.length - visible.length)}\n >\n {list.loading ? (\n <Skeleton className=\"h-4\" />\n ) : (\n visible.map((row) => (\n <CalendarEvent\n key={row.key}\n model={model}\n view={view}\n display={display}\n row={row}\n day={day}\n movable={movable && rowAllows(row.record, 'update')}\n dragged={() => dragged.current}\n />\n ))\n )}\n </CalendarDay>\n )\n })}\n </div>\n </div>\n <DragOverlay>{active && <EventChip model={model} view={view} display={display} row={active.row} day={active.day} />}</DragOverlay>\n </DndContext>\n </div>\n )\n}\n"],"mappings":"uhCAiBaiD,EAAc,GAAuB,CAChD,IAAMC,EAAOR,EAASS,CAAI,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U6E,EAAI,OAAQ,QAAQ,EAClD,YAAeb,EAAQ,OACxB,EARMa,EAAI,GAQV,CACF,CAEQ,EAxBN9C,CAwBM,CAEjB,CAAC,CACE,CAAA,CACF,CACL,CAAA,GAAA,EAAAL,EAAA,IAAA,CAACrB,GAAD,CAAA,SAAcyD,IAAU,EAAApC,EAAA,IAAA,CAACf,EAAD,CAAkB,QAAa,OAAe,UAAS,IAAKmD,EAAO,IAAK,IAAKA,EAAO,GAAM,CAAA,CAAe,CAAA,CACvH,GACT,GAET","debugId":"a9aa3338-a152-4c54-9fd5-b5aa3e66cb6e"}
|
package/dist/shell-source-maps/assets/{call-rings-TD7_HvNB.js.map → call-rings-DnL8InVq.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"call-rings-TD7_HvNB.js","names":["useState","useCallback","useRef","n","a","t","__toESM","require_react","useAppAddress","text","useToast","useClient","keys","useQueryClient","useMutation","useQuery","import_react","toneHz","ringMs","cycleMs","useRingTone","on","context","ring","gain","index","start","hz","oscillator","timer","ringsUntil","rings","readAt","ringingAt","ringing","now","useRings","client","queryClient","query","enabled","again","changes","change","setNow","next","hide","call","ringToast","decline","accept","CallRings","toast","shown","id","href","open","target","own"],"sources":["../../../src/calls/ring-tone.ts","../../../src/calls/ringing.ts","../../../src/calls/use-rings.ts","../../../src/calls/call-rings.tsx"],"sourcesContent":["import { useEffect } from 'react'\n\n// A phone's ring: two short tones, then a pause, again and again.\nconst toneHz = [440, 480]\nconst ringMs = 400\nconst cycleMs = 3000\n\n/**\n * Plays a ring while `on`, through Web Audio. A browser that has not let the page play sound yet, before the person\n * clicked or typed in it, keeps the context suspended and plays nothing: the ring still shows.\n */\nexport const useRingTone = (on: boolean) => {\n useEffect(() => {\n if (!on || typeof AudioContext === 'undefined') return\n const context = new AudioContext()\n const ring = () => {\n const gain = context.createGain()\n gain.gain.value = 0.08\n gain.connect(context.destination)\n for (const [index, start] of [0, (ringMs * 1.5) / 1000].entries()) {\n for (const hz of toneHz) {\n const oscillator = context.createOscillator()\n oscillator.frequency.value = hz\n oscillator.connect(gain)\n oscillator.start(context.currentTime + start)\n oscillator.stop(context.currentTime + start + ringMs / 1000 / (index + 1))\n }\n }\n }\n ring()\n const timer = setInterval(ring, cycleMs)\n return () => {\n clearInterval(timer)\n void context.close()\n }\n }, [on])\n}\n","import type { CallRing } from '@protobase/client'\n\n/** A ring as a page shows it: until when it rings by this browser's clock, from the server's time left when it was read. */\nexport type ShownRing = CallRing & { until: number }\n\n/** The rings as read at `readAt`, each with the time it stops ringing here. */\nexport const ringsUntil = (rings: readonly CallRing[], readAt: number): ShownRing[] => rings.map((ring) => ({ ...ring, until: readAt + ring.remaining_ms }))\n\n/** The rings still ringing at `now`, and the next time one stops, to look again then. */\nexport const ringingAt = (rings: readonly ShownRing[], now: number) => {\n const ringing = rings.filter((ring) => ring.until > now)\n const next = ringing.length === 0 ? undefined : Math.min(...ringing.map((ring) => ring.until))\n return { ringing, next }\n}\n","import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'\nimport { useCallback, useEffect, useState } from 'react'\nimport { ringNotice } from '@protobase/schema/internal'\nimport { useClient } from '../data/api-provider'\nimport { keys } from '../data/query-keys'\nimport { ringingAt, ringsUntil, type ShownRing } from './ringing'\n\n/**\n * The calls ringing the signed-in user now, while `enabled`: read on load, and again whenever the live stream the page\n * already holds says they changed, as when the user answers on another device, declines or the call ends; each stops\n * by itself once its time is up. `decline` stops one on every page of theirs, `hide` only on this one.\n */\nexport const useRings = (enabled: boolean) => {\n const client = useClient()\n const queryClient = useQueryClient()\n const query = useQuery({ queryKey: keys.rings, queryFn: async () => ringsUntil(await client.rings.list(), Date.now()), enabled })\n\n useEffect(() => {\n if (!enabled) return\n const again = () => void queryClient.invalidateQueries({ queryKey: keys.rings })\n return client.live({ onChanges: (changes) => changes.some((change) => change.resource === ringNotice) && again(), onResync: again })\n }, [client, queryClient, enabled])\n\n const [now, setNow] = useState(() => Date.now())\n const { ringing, next } = ringingAt(query.data ?? [], Math.max(now, query.dataUpdatedAt))\n useEffect(() => {\n if (next === undefined) return\n const timer = setTimeout(() => setNow(Date.now()), Math.max(0, next - Date.now()))\n return () => clearTimeout(timer)\n }, [next])\n\n // A ring answered here shows no more at once, before the server has the join that stops it.\n const hide = useCallback((call: string) => queryClient.setQueryData<ShownRing[]>(keys.rings, (rings) => rings?.filter((ring) => ring.call !== call)), [queryClient])\n const decline = useMutation({\n mutationFn: (call: string) => client.rings.decline(call),\n onMutate: hide,\n onSettled: () => queryClient.invalidateQueries({ queryKey: keys.rings }),\n })\n return { ringing, decline: decline.mutate, hide }\n}\n","import { useEffect, useRef } from 'react'\nimport { useAppAddress } from '../app/use-app-address'\nimport { useToast } from '../toasts'\nimport { text } from './messages'\nimport type { ShownRing } from './ringing'\nimport { useRingTone } from './ring-tone'\nimport { useRings } from './use-rings'\n\n/** A ring as a sticky toast: Decline, and Accept, a link to the record's page that joins its call on this device. */\nconst ringToast = (ring: ShownRing, accept: { href: string; onNavigate: (href: string) => void }, decline: (call: string) => void) => ({\n state: 'call' as const,\n sticky: true,\n title: ring.title,\n ...(ring.body !== null && { description: ring.body }),\n actions: [\n { label: text('decline'), onClick: () => decline(ring.call) },\n { label: text('accept'), ...accept },\n ],\n})\n\n/**\n * Rings the signed-in user on whatever page of the app they have open, over the live stream the page already holds:\n * each call ringing them is a toast with Decline and Accept, with a ring tone, until they answer, here or on another\n * device, decline, or the call ends or stops ringing. Accept opens the record's page, which joins the call after the\n * click on this device only. Someone on do not disturb is not rung; the call is in their bell.\n */\nexport const CallRings = () => {\n const { ringing, decline, hide } = useRings(true)\n const toast = useToast()\n const { href, open } = useAppAddress()\n const shown = useRef(new Map<string, number>())\n useRingTone(ringing.length > 0)\n\n useEffect(() => {\n const now = new Set(ringing.map((ring) => ring.call))\n for (const [call, id] of shown.current) {\n if (now.has(call)) continue\n toast.dismiss(id)\n shown.current.delete(call)\n }\n for (const ring of ringing) {\n if (shown.current.has(ring.call)) continue\n const accept = {\n href: href({ kind: 'record', resource: ring.resource, key: ring.key, call: 'join' }),\n onNavigate: (target: string) => {\n hide(ring.call)\n open(target)\n },\n }\n shown.current.set(ring.call, toast.show({ ...ringToast(ring, accept, decline), onClose: () => decline(ring.call) }))\n }\n }, [ringing, toast, href, open, decline, hide])\n\n useEffect(() => {\n const own = shown.current\n return () => {\n for (const id of own.values()) toast.dismiss(id)\n own.clear()\n }\n }, [toast])\n\n return null\n}\n"],"mappings":"+rBAGMiB,EAAS,CAAC,IAAK,GAAG,EAClBC,EAAS,IACTC,EAAU,IAMHC,EAAe,GAAgB,EAC1C,EAAAJ,EAAA,UAAA,KAAgB,CACd,GAAI,CAACK,GAAM,OAAO,aAAiB,IAAa,OAChD,IAAMC,EAAU,IAAI,aACdC,MAAa,CACjB,IAAMC,EAAOF,EAAQ,WAAW,EAChC,EAAK,KAAK,MAAQ,IAClBE,EAAK,QAAQF,EAAQ,WAAW,EAChC,IAAK,GAAM,CAACG,EAAOC,IAAU,CAAC,EAAIR,EAAS,IAAO,GAAI,CAAC,CAAC,QAAQ,EAC9D,IAAK,IAAMS,KAAMV,EAAQ,CACvB,IAAMW,EAAaN,EAAQ,iBAAiB,EAC5C,EAAW,UAAU,MAAQK,EAC7BC,EAAW,QAAQJ,CAAI,EACvBI,EAAW,MAAMN,EAAQ,YAAcI,CAAK,EAC5CE,EAAW,KAAKN,EAAQ,YAAcI,EAAQR,EAAS,KAAQO,EAAQ,EAAE,CAC3E,CAEJ,EACAF,EAAK,EACL,IAAMM,EAAQ,YAAYN,EAAMJ,CAAO,EACvC,UAAa,CACX,cAAcU,CAAK,EACnBP,EAAa,MAAM,CACrB,CACF,EAAG,CAACD,CAAE,CAAC,CACT,EC9BaS,GAAc,EAA4B,IAAgCC,EAAM,IAAK,IAAU,CAAE,GAAGR,EAAM,MAAOS,EAAST,EAAK,YAAa,EAAE,EAG9IU,GAAa,EAA6B,IAAgB,CACrE,IAAMC,EAAUH,EAAM,OAAQ,GAASR,EAA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J,EAAM,QAAQ,IAAI9B,EAAK,KAAM6B,EAAM,KAAK,CAAE,GAAGJ,EAAUzB,EAAM2B,EAAQD,CAAO,EAAG,YAAeA,EAAQ1B,EAAK,IAAI,CAAE,CAAC,CAAC,CACrH,CACF,EAAG,CAACW,EAASkB,EAAOG,EAAMC,EAAMP,EAASH,CAAI,CAAC,GAE9C,EAAA9B,EAAA,UAAA,KAAgB,CACd,IAAM0C,EAAML,EAAM,QAClB,UAAa,CACX,IAAK,IAAMC,KAAMI,EAAI,OAAO,EAAGN,EAAM,QAAQE,CAAE,EAC/CI,EAAI,MAAM,CACZ,CACF,EAAG,CAACN,CAAK,CAAC,EAEH,IACT","debugId":"130fbfc7-bcd0-4af2-8d46-c3b5aa50c4ed"}
|
|
1
|
+
{"version":3,"file":"call-rings-DnL8InVq.js","names":["useState","useCallback","useRef","n","a","t","__toESM","require_react","useAppAddress","text","useToast","useClient","keys","useQueryClient","useMutation","useQuery","import_react","toneHz","ringMs","cycleMs","useRingTone","on","context","ring","gain","index","start","hz","oscillator","timer","ringsUntil","rings","readAt","ringingAt","ringing","now","useRings","client","queryClient","query","enabled","again","changes","change","setNow","next","hide","call","ringToast","decline","accept","CallRings","toast","shown","id","href","open","target","own"],"sources":["../../../src/calls/ring-tone.ts","../../../src/calls/ringing.ts","../../../src/calls/use-rings.ts","../../../src/calls/call-rings.tsx"],"sourcesContent":["import { useEffect } from 'react'\n\n// A phone's ring: two short tones, then a pause, again and again.\nconst toneHz = [440, 480]\nconst ringMs = 400\nconst cycleMs = 3000\n\n/**\n * Plays a ring while `on`, through Web Audio. A browser that has not let the page play sound yet, before the person\n * clicked or typed in it, keeps the context suspended and plays nothing: the ring still shows.\n */\nexport const useRingTone = (on: boolean) => {\n useEffect(() => {\n if (!on || typeof AudioContext === 'undefined') return\n const context = new AudioContext()\n const ring = () => {\n const gain = context.createGain()\n gain.gain.value = 0.08\n gain.connect(context.destination)\n for (const [index, start] of [0, (ringMs * 1.5) / 1000].entries()) {\n for (const hz of toneHz) {\n const oscillator = context.createOscillator()\n oscillator.frequency.value = hz\n oscillator.connect(gain)\n oscillator.start(context.currentTime + start)\n oscillator.stop(context.currentTime + start + ringMs / 1000 / (index + 1))\n }\n }\n }\n ring()\n const timer = setInterval(ring, cycleMs)\n return () => {\n clearInterval(timer)\n void context.close()\n }\n }, [on])\n}\n","import type { CallRing } from '@protobase/client'\n\n/** A ring as a page shows it: until when it rings by this browser's clock, from the server's time left when it was read. */\nexport type ShownRing = CallRing & { until: number }\n\n/** The rings as read at `readAt`, each with the time it stops ringing here. */\nexport const ringsUntil = (rings: readonly CallRing[], readAt: number): ShownRing[] => rings.map((ring) => ({ ...ring, until: readAt + ring.remaining_ms }))\n\n/** The rings still ringing at `now`, and the next time one stops, to look again then. */\nexport const ringingAt = (rings: readonly ShownRing[], now: number) => {\n const ringing = rings.filter((ring) => ring.until > now)\n const next = ringing.length === 0 ? undefined : Math.min(...ringing.map((ring) => ring.until))\n return { ringing, next }\n}\n","import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'\nimport { useCallback, useEffect, useState } from 'react'\nimport { ringNotice } from '@protobase/schema/internal'\nimport { useClient } from '../data/api-provider'\nimport { keys } from '../data/query-keys'\nimport { ringingAt, ringsUntil, type ShownRing } from './ringing'\n\n/**\n * The calls ringing the signed-in user now, while `enabled`: read on load, and again whenever the live stream the page\n * already holds says they changed, as when the user answers on another device, declines or the call ends; each stops\n * by itself once its time is up. `decline` stops one on every page of theirs, `hide` only on this one.\n */\nexport const useRings = (enabled: boolean) => {\n const client = useClient()\n const queryClient = useQueryClient()\n const query = useQuery({ queryKey: keys.rings, queryFn: async () => ringsUntil(await client.rings.list(), Date.now()), enabled })\n\n useEffect(() => {\n if (!enabled) return\n const again = () => void queryClient.invalidateQueries({ queryKey: keys.rings })\n return client.live({ onChanges: (changes) => changes.some((change) => change.resource === ringNotice) && again(), onResync: again })\n }, [client, queryClient, enabled])\n\n const [now, setNow] = useState(() => Date.now())\n const { ringing, next } = ringingAt(query.data ?? [], Math.max(now, query.dataUpdatedAt))\n useEffect(() => {\n if (next === undefined) return\n const timer = setTimeout(() => setNow(Date.now()), Math.max(0, next - Date.now()))\n return () => clearTimeout(timer)\n }, [next])\n\n // A ring answered here shows no more at once, before the server has the join that stops it.\n const hide = useCallback((call: string) => queryClient.setQueryData<ShownRing[]>(keys.rings, (rings) => rings?.filter((ring) => ring.call !== call)), [queryClient])\n const decline = useMutation({\n mutationFn: (call: string) => client.rings.decline(call),\n onMutate: hide,\n onSettled: () => queryClient.invalidateQueries({ queryKey: keys.rings }),\n })\n return { ringing, decline: decline.mutate, hide }\n}\n","import { useEffect, useRef } from 'react'\nimport { useAppAddress } from '../app/use-app-address'\nimport { useToast } from '../toasts'\nimport { text } from './messages'\nimport type { ShownRing } from './ringing'\nimport { useRingTone } from './ring-tone'\nimport { useRings } from './use-rings'\n\n/** A ring as a sticky toast: Decline, and Accept, a link to the record's page that joins its call on this device. */\nconst ringToast = (ring: ShownRing, accept: { href: string; onNavigate: (href: string) => void }, decline: (call: string) => void) => ({\n state: 'call' as const,\n sticky: true,\n title: ring.title,\n ...(ring.body !== null && { description: ring.body }),\n actions: [\n { label: text('decline'), onClick: () => decline(ring.call) },\n { label: text('accept'), ...accept },\n ],\n})\n\n/**\n * Rings the signed-in user on whatever page of the app they have open, over the live stream the page already holds:\n * each call ringing them is a toast with Decline and Accept, with a ring tone, until they answer, here or on another\n * device, decline, or the call ends or stops ringing. Accept opens the record's page, which joins the call after the\n * click on this device only. Someone on do not disturb is not rung; the call is in their bell.\n */\nexport const CallRings = () => {\n const { ringing, decline, hide } = useRings(true)\n const toast = useToast()\n const { href, open } = useAppAddress()\n const shown = useRef(new Map<string, number>())\n useRingTone(ringing.length > 0)\n\n useEffect(() => {\n const now = new Set(ringing.map((ring) => ring.call))\n for (const [call, id] of shown.current) {\n if (now.has(call)) continue\n toast.dismiss(id)\n shown.current.delete(call)\n }\n for (const ring of ringing) {\n if (shown.current.has(ring.call)) continue\n const accept = {\n href: href({ kind: 'record', resource: ring.resource, key: ring.key, call: 'join' }),\n onNavigate: (target: string) => {\n hide(ring.call)\n open(target)\n },\n }\n shown.current.set(ring.call, toast.show({ ...ringToast(ring, accept, decline), onClose: () => decline(ring.call) }))\n }\n }, [ringing, toast, href, open, decline, hide])\n\n useEffect(() => {\n const own = shown.current\n return () => {\n for (const id of own.values()) toast.dismiss(id)\n own.clear()\n }\n }, [toast])\n\n return null\n}\n"],"mappings":"+rBAGMiB,EAAS,CAAC,IAAK,GAAG,EAClBC,EAAS,IACTC,EAAU,IAMHC,EAAe,GAAgB,EAC1C,EAAAJ,EAAA,UAAA,KAAgB,CACd,GAAI,CAACK,GAAM,OAAO,aAAiB,IAAa,OAChD,IAAMC,EAAU,IAAI,aACdC,MAAa,CACjB,IAAMC,EAAOF,EAAQ,WAAW,EAChC,EAAK,KAAK,MAAQ,IAClBE,EAAK,QAAQF,EAAQ,WAAW,EAChC,IAAK,GAAM,CAACG,EAAOC,IAAU,CAAC,EAAIR,EAAS,IAAO,GAAI,CAAC,CAAC,QAAQ,EAC9D,IAAK,IAAMS,KAAMV,EAAQ,CACvB,IAAMW,EAAaN,EAAQ,iBAAiB,EAC5C,EAAW,UAAU,MAAQK,EAC7BC,EAAW,QAAQJ,CAAI,EACvBI,EAAW,MAAMN,EAAQ,YAAcI,CAAK,EAC5CE,EAAW,KAAKN,EAAQ,YAAcI,EAAQR,EAAS,KAAQO,EAAQ,EAAE,CAC3E,CAEJ,EACAF,EAAK,EACL,IAAMM,EAAQ,YAAYN,EAAMJ,CAAO,EACvC,UAAa,CACX,cAAcU,CAAK,EACnBP,EAAa,MAAM,CACrB,CACF,EAAG,CAACD,CAAE,CAAC,CACT,EC9BaS,GAAc,EAA4B,IAAgCC,EAAM,IAAK,IAAU,CAAE,GAAGR,EAAM,MAAOS,EAAST,EAAK,YAAa,EAAE,EAG9IU,GAAa,EAA6B,IAAgB,CACrE,IAAMC,EAAUH,EAAM,OAAQ,GAASR,EA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