@protobase/ui 0.119.1 → 0.119.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/charts/messages.d.ts +2 -2
- package/dist/app/create/messages.d.ts +2 -2
- package/dist/app/delete/messages.d.ts +2 -2
- package/dist/app/displays/messages.d.ts +2 -2
- package/dist/app/export/messages.d.ts +2 -2
- package/dist/app/field-types/runner-install/messages.d.ts +2 -2
- package/dist/app/field-types/workflow/messages.d.ts +2 -2
- package/dist/app/field-types/workflow-page/messages.d.ts +2 -2
- package/dist/app/field-types/workflow-run/messages.d.ts +2 -2
- package/dist/app/file-viewers/messages.d.ts +2 -2
- package/dist/app/focus/messages.d.ts +2 -2
- package/dist/app/history/messages.d.ts +2 -2
- package/dist/app/import/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/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/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/searches/messages.d.ts +2 -2
- package/dist/auth/messages.d.ts +2 -2
- package/dist/data-grid/messages.d.ts +2 -2
- package/dist/filter-panel/messages.d.ts +2 -2
- package/dist/mocks/customers.d.ts +1 -1
- package/dist/mocks/invoices.d.ts +1 -1
- package/dist/mocks/orders.d.ts +3 -3
- package/dist/organizations/messages.d.ts +2 -2
- package/dist/package.js +1 -1
- package/dist/plugins/messages.d.ts +2 -2
- package/dist/shell/assets/{account-page-BXnceUQo.js → account-page-CAJ1kqbM.js} +2 -2
- package/dist/shell/assets/{app-D3BCcbgE.js → app-CJRcPkz6.js} +5 -5
- package/dist/shell/assets/{assistant-shell-DKf9TfL2.js → assistant-shell-BfbbDVaC.js} +2 -2
- package/dist/shell/assets/{board-display-DJkQwIfT.js → board-display-NQNgdfOF.js} +2 -2
- package/dist/shell/assets/{calendar-display-BKyuHAAF.js → calendar-display-CFPrjZFk.js} +2 -2
- package/dist/shell/assets/{call-rings-D_kQbFd3.js → call-rings-B8E1WcyM.js} +2 -2
- package/dist/shell/assets/{calls-D6jSGMCo.js → calls-CdQzy7k0.js} +2 -2
- package/dist/shell/assets/{circle-alert-ytReRN_c.js → circle-alert-d8QhxvKR.js} +2 -2
- package/dist/shell/assets/{composed-page-CbNBBioS.js → composed-page-DMVnOjIP.js} +2 -2
- package/dist/shell/assets/{composer-section-cg-cdFZx.js → composer-section-DnZcEvIv.js} +2 -2
- package/dist/shell/assets/{connect-route-hMUPiAft.js → connect-route-4mPmCyC4.js} +2 -2
- package/dist/shell/assets/{copy-field-BoXXafL7.js → copy-field-BERLdksL.js} +2 -2
- package/dist/shell/assets/{create-route-BePHRkTZ.js → create-route-GDRDDl56.js} +2 -2
- package/dist/shell/assets/{custom-step-container-field-B3bsPeCV.js → custom-step-container-field-CdOcEE3E.js} +2 -2
- package/dist/shell/assets/{embedded-list-6lQyJozS.js → embedded-list-BfLZckNm.js} +3 -3
- package/dist/shell/assets/{export-dialog-BUbdSkkU.js → export-dialog-D4o9o8bz.js} +2 -2
- package/dist/shell/assets/{first-organization-page-BhQOFT5P.js → first-organization-page-B3iq4sHy.js} +2 -2
- package/dist/shell/assets/{graph-view-DZHMI-UQ.js → graph-view-Df89qpKC.js} +2 -2
- package/dist/shell/assets/{group-donut-Cu5Ny3gq.js → group-donut-CrztmwCW.js} +2 -2
- package/dist/shell/assets/{guest-call-page-DlAkbaRH.js → guest-call-page-BBIOrY9i.js} +3 -3
- package/dist/shell/assets/{html-viewer-DrSS-WnU.js → html-viewer--TQtevzN.js} +2 -2
- package/dist/shell/assets/{import-dialog-Dk_31-PT.js → import-dialog-BWTCBbXg.js} +2 -2
- package/dist/shell/assets/{import-table-dialog-vL-juOMH.js → import-table-dialog-DPkK6vH5.js} +2 -2
- package/dist/shell/assets/{index-CTmZ8-B4.js → index-Bh5wY9w1.js} +1 -1
- package/dist/shell/assets/{invitations-page-CfTEdorg.js → invitations-page-B9lumTnF.js} +2 -2
- package/dist/shell/assets/{layout-grid-CTlIrnH5.js → layout-grid-9bzmoNfC.js} +2 -2
- package/dist/shell/assets/{legend-item-CqkLpsWb.js → legend-item-CMOXfVzG.js} +2 -2
- package/dist/shell/assets/{list-page-Czg2Jaxx.js → list-page-DKvupZUF.js} +4 -4
- package/dist/shell/assets/{maplibre-Bd79IbdT.js → maplibre-BSd2GULM.js} +2 -2
- package/dist/shell/assets/{markdown-content-BGl9PFVi.js → markdown-content-CJbhy8aC.js} +2 -2
- package/dist/shell/assets/{members-page-CEB-Wkl8.js → members-page-q2id0vrY.js} +2 -2
- package/dist/shell/assets/{messages-Ce8dRRRN.js → messages-ZPG4Y__r.js} +2 -2
- package/dist/shell/assets/{organization-page-CTxtblmm.js → organization-page-DqYnaJRl.js} +2 -2
- package/dist/shell/assets/{organizations-page-DeNhUQDU.js → organizations-page-Dm5Y0fGB.js} +2 -2
- package/dist/shell/assets/{pending-invitation-row-BMp0ZxE8.js → pending-invitation-row-Ce5VDMYl.js} +2 -2
- package/dist/shell/assets/{period-chart-BDqtO8mc.js → period-chart-D3lbH2Ni.js} +2 -2
- package/dist/shell/assets/{person-row-DRqtbPma.js → person-row-D5tS8OTp.js} +2 -2
- package/dist/shell/assets/{public-form-page-XgK3-Nzh.js → public-form-page-aK2MyEzM.js} +2 -2
- package/dist/shell/assets/{record-lines-DdN5hlI_.js → record-lines-BVk1yL7T.js} +2 -2
- package/dist/shell/assets/{record-map-sOmjX80D.js → record-map-CQG_MBk2.js} +2 -2
- package/dist/shell/assets/{record-opens-DLfbC3xo.js → record-opens-583Ej1N1.js} +2 -2
- package/dist/shell/assets/{record-page-BntRofCL.js → record-page-CCop2gY_.js} +3 -3
- package/dist/shell/assets/{record-preview-QMV2lW2j.js → record-preview-DA3ekFy9.js} +2 -2
- package/dist/shell/assets/{records-map-DgTxGcbC.js → records-map-eORDbX4I.js} +2 -2
- package/dist/shell/assets/{render-node-CkL5Sgl_.js → render-node-DYlEB-c6.js} +3 -3
- package/dist/shell/assets/{reorder-button-8yWv8J72.js → reorder-button-CBM6uNGv.js} +2 -2
- package/dist/shell/assets/{run-trace-view-BPvPw3Ko.js → run-trace-view-Bc39GS76.js} +2 -2
- package/dist/shell/assets/{runner-install-field-CKP8E9ZO.js → runner-install-field-1DavXWJz.js} +2 -2
- package/dist/shell/assets/{runtime-update-DGbf2Nmm.js → runtime-update-BmJNn1bb.js} +2 -2
- package/dist/shell/assets/{shared-protobase-ui-DN-uvpOy.js → shared-protobase-ui-CYjgvFkX.js} +1 -1
- package/dist/shell/assets/{sheet-source-cKJfUaud.js → sheet-source-DRkb3sPj.js} +2 -2
- package/dist/shell/assets/{sign-in-policy-page-Bty4Ih1x.js → sign-in-policy-page-J-Gl8EDX.js} +2 -2
- package/dist/shell/assets/{start-block-queries-x-gNbPt1.js → start-block-queries-Db9-BBtv.js} +2 -2
- package/dist/shell/assets/{step-catalog-CCAXc8kn.js → step-catalog-Dx8trv3T.js} +2 -2
- package/dist/shell/assets/{step-panel-jmfh86YA.js → step-panel-CollAT6S.js} +2 -2
- package/dist/shell/assets/{timeline-display-CtxOHPoJ.js → timeline-display-Db0NWucC.js} +2 -2
- package/dist/shell/assets/{trash-CFCBxAWq.js → trash-BgljKjXT.js} +2 -2
- package/dist/shell/assets/{update-set-BYNQUWVp.js → update-set-SMllxKkh.js} +2 -2
- package/dist/shell/assets/{use-calendar-move-BytgRG51.js → use-calendar-move-BcrMLvrG.js} +2 -2
- package/dist/shell/assets/{use-display-rows-DGw9J73C.js → use-display-rows-DT7QTMsG.js} +2 -2
- package/dist/shell/assets/{use-my-invitations-BcMFAcXl.js → use-my-invitations-oCZ6ZQ-U.js} +2 -2
- package/dist/shell/assets/{use-paged-search-CKcKKO6y.js → use-paged-search-BlDRyMbE.js} +2 -2
- package/dist/shell/assets/{use-run-trace-BRwbwZcf.js → use-run-trace-D_6T2CH7.js} +2 -2
- package/dist/shell/assets/{use-workflow-page-DsD276W-.js → use-workflow-page-CBp2KwrR.js} +2 -2
- package/dist/shell/assets/{use-workflow-types-Bn24Chp-.js → use-workflow-types-ygVBJ9Yg.js} +2 -2
- package/dist/shell/assets/{workflow-canvas-BKd_Yd0v.js → workflow-canvas-BC2ifgGd.js} +2 -2
- package/dist/shell/assets/{workflow-field-DyBaV6m5.js → workflow-field-D_yT-vSa.js} +3 -3
- package/dist/shell/assets/{workflow-graph-editor-B8RJ52_E.js → workflow-graph-editor-BSTyuKLQ.js} +2 -2
- package/dist/shell/assets/{workflow-run-field-CzluYhjs.js → workflow-run-field-CKXk25MP.js} +3 -3
- package/dist/shell/assets/{workflow-status-field-_umgNjK4.js → workflow-status-field-BQDIaBJw.js} +2 -2
- package/dist/shell/assets/{workflow-workbench-CqOI36Oy.js → workflow-workbench-CHPH8qPu.js} +2 -2
- package/dist/shell/index.html +3 -3
- package/dist/shell/protobase.shell.json +2 -2
- package/dist/shell/protobase.sw.js +2 -2
- package/dist/shell-source-maps/assets/{account-page-BXnceUQo.js.map → account-page-CAJ1kqbM.js.map} +1 -1
- package/dist/shell-source-maps/assets/{app-D3BCcbgE.js.map → app-CJRcPkz6.js.map} +1 -1
- package/dist/shell-source-maps/assets/{assistant-shell-DKf9TfL2.js.map → assistant-shell-BfbbDVaC.js.map} +1 -1
- package/dist/shell-source-maps/assets/{board-display-DJkQwIfT.js.map → board-display-NQNgdfOF.js.map} +1 -1
- package/dist/shell-source-maps/assets/{calendar-display-BKyuHAAF.js.map → calendar-display-CFPrjZFk.js.map} +1 -1
- package/dist/shell-source-maps/assets/{call-rings-D_kQbFd3.js.map → call-rings-B8E1WcyM.js.map} +1 -1
- package/dist/shell-source-maps/assets/{calls-D6jSGMCo.js.map → calls-CdQzy7k0.js.map} +1 -1
- package/dist/shell-source-maps/assets/{circle-alert-ytReRN_c.js.map → circle-alert-d8QhxvKR.js.map} +1 -1
- package/dist/shell-source-maps/assets/{composed-page-CbNBBioS.js.map → composed-page-DMVnOjIP.js.map} +1 -1
- package/dist/shell-source-maps/assets/{composer-section-cg-cdFZx.js.map → composer-section-DnZcEvIv.js.map} +1 -1
- package/dist/shell-source-maps/assets/{connect-route-hMUPiAft.js.map → connect-route-4mPmCyC4.js.map} +1 -1
- package/dist/shell-source-maps/assets/{copy-field-BoXXafL7.js.map → copy-field-BERLdksL.js.map} +1 -1
- package/dist/shell-source-maps/assets/{create-route-BePHRkTZ.js.map → create-route-GDRDDl56.js.map} +1 -1
- package/dist/shell-source-maps/assets/{custom-step-container-field-B3bsPeCV.js.map → custom-step-container-field-CdOcEE3E.js.map} +1 -1
- package/dist/shell-source-maps/assets/{embedded-list-6lQyJozS.js.map → embedded-list-BfLZckNm.js.map} +1 -1
- package/dist/shell-source-maps/assets/{export-dialog-BUbdSkkU.js.map → export-dialog-D4o9o8bz.js.map} +1 -1
- package/dist/shell-source-maps/assets/{first-organization-page-BhQOFT5P.js.map → first-organization-page-B3iq4sHy.js.map} +1 -1
- package/dist/shell-source-maps/assets/{graph-view-DZHMI-UQ.js.map → graph-view-Df89qpKC.js.map} +1 -1
- package/dist/shell-source-maps/assets/{group-donut-Cu5Ny3gq.js.map → group-donut-CrztmwCW.js.map} +1 -1
- package/dist/shell-source-maps/assets/{guest-call-page-DlAkbaRH.js.map → guest-call-page-BBIOrY9i.js.map} +1 -1
- package/dist/shell-source-maps/assets/{html-viewer-DrSS-WnU.js.map → html-viewer--TQtevzN.js.map} +1 -1
- package/dist/shell-source-maps/assets/{import-dialog-Dk_31-PT.js.map → import-dialog-BWTCBbXg.js.map} +1 -1
- package/dist/shell-source-maps/assets/{import-table-dialog-vL-juOMH.js.map → import-table-dialog-DPkK6vH5.js.map} +1 -1
- package/dist/shell-source-maps/assets/{invitations-page-CfTEdorg.js.map → invitations-page-B9lumTnF.js.map} +1 -1
- package/dist/shell-source-maps/assets/{layout-grid-CTlIrnH5.js.map → layout-grid-9bzmoNfC.js.map} +1 -1
- package/dist/shell-source-maps/assets/{legend-item-CqkLpsWb.js.map → legend-item-CMOXfVzG.js.map} +1 -1
- package/dist/shell-source-maps/assets/{list-page-Czg2Jaxx.js.map → list-page-DKvupZUF.js.map} +1 -1
- package/dist/shell-source-maps/assets/{maplibre-Bd79IbdT.js.map → maplibre-BSd2GULM.js.map} +1 -1
- package/dist/shell-source-maps/assets/{markdown-content-BGl9PFVi.js.map → markdown-content-CJbhy8aC.js.map} +1 -1
- package/dist/shell-source-maps/assets/{members-page-CEB-Wkl8.js.map → members-page-q2id0vrY.js.map} +1 -1
- package/dist/shell-source-maps/assets/{messages-Ce8dRRRN.js.map → messages-ZPG4Y__r.js.map} +1 -1
- package/dist/shell-source-maps/assets/{organization-page-CTxtblmm.js.map → organization-page-DqYnaJRl.js.map} +1 -1
- package/dist/shell-source-maps/assets/{organizations-page-DeNhUQDU.js.map → organizations-page-Dm5Y0fGB.js.map} +1 -1
- package/dist/shell-source-maps/assets/{pending-invitation-row-BMp0ZxE8.js.map → pending-invitation-row-Ce5VDMYl.js.map} +1 -1
- package/dist/shell-source-maps/assets/{period-chart-BDqtO8mc.js.map → period-chart-D3lbH2Ni.js.map} +1 -1
- package/dist/shell-source-maps/assets/{person-row-DRqtbPma.js.map → person-row-D5tS8OTp.js.map} +1 -1
- package/dist/shell-source-maps/assets/{public-form-page-XgK3-Nzh.js.map → public-form-page-aK2MyEzM.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-lines-DdN5hlI_.js.map → record-lines-BVk1yL7T.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-map-sOmjX80D.js.map → record-map-CQG_MBk2.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-opens-DLfbC3xo.js.map → record-opens-583Ej1N1.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-page-BntRofCL.js.map → record-page-CCop2gY_.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-preview-QMV2lW2j.js.map → record-preview-DA3ekFy9.js.map} +1 -1
- package/dist/shell-source-maps/assets/{records-map-DgTxGcbC.js.map → records-map-eORDbX4I.js.map} +1 -1
- package/dist/shell-source-maps/assets/{render-node-CkL5Sgl_.js.map → render-node-DYlEB-c6.js.map} +1 -1
- package/dist/shell-source-maps/assets/{reorder-button-8yWv8J72.js.map → reorder-button-CBM6uNGv.js.map} +1 -1
- package/dist/shell-source-maps/assets/{run-trace-view-BPvPw3Ko.js.map → run-trace-view-Bc39GS76.js.map} +1 -1
- package/dist/shell-source-maps/assets/{runner-install-field-CKP8E9ZO.js.map → runner-install-field-1DavXWJz.js.map} +1 -1
- package/dist/shell-source-maps/assets/{runtime-update-DGbf2Nmm.js.map → runtime-update-BmJNn1bb.js.map} +1 -1
- package/dist/shell-source-maps/assets/{sheet-source-cKJfUaud.js.map → sheet-source-DRkb3sPj.js.map} +1 -1
- package/dist/shell-source-maps/assets/{sign-in-policy-page-Bty4Ih1x.js.map → sign-in-policy-page-J-Gl8EDX.js.map} +1 -1
- package/dist/shell-source-maps/assets/{start-block-queries-x-gNbPt1.js.map → start-block-queries-Db9-BBtv.js.map} +1 -1
- package/dist/shell-source-maps/assets/{step-catalog-CCAXc8kn.js.map → step-catalog-Dx8trv3T.js.map} +1 -1
- package/dist/shell-source-maps/assets/{step-panel-jmfh86YA.js.map → step-panel-CollAT6S.js.map} +1 -1
- package/dist/shell-source-maps/assets/{timeline-display-CtxOHPoJ.js.map → timeline-display-Db0NWucC.js.map} +1 -1
- package/dist/shell-source-maps/assets/{trash-CFCBxAWq.js.map → trash-BgljKjXT.js.map} +1 -1
- package/dist/shell-source-maps/assets/{update-set-BYNQUWVp.js.map → update-set-SMllxKkh.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-calendar-move-BytgRG51.js.map → use-calendar-move-BcrMLvrG.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-display-rows-DGw9J73C.js.map → use-display-rows-DT7QTMsG.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-my-invitations-BcMFAcXl.js.map → use-my-invitations-oCZ6ZQ-U.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-paged-search-CKcKKO6y.js.map → use-paged-search-BlDRyMbE.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-run-trace-BRwbwZcf.js.map → use-run-trace-D_6T2CH7.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-workflow-page-DsD276W-.js.map → use-workflow-page-CBp2KwrR.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-workflow-types-Bn24Chp-.js.map → use-workflow-types-ygVBJ9Yg.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-canvas-BKd_Yd0v.js.map → workflow-canvas-BC2ifgGd.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-field-DyBaV6m5.js.map → workflow-field-D_yT-vSa.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-graph-editor-B8RJ52_E.js.map → workflow-graph-editor-BSTyuKLQ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-run-field-CzluYhjs.js.map → workflow-run-field-CKXk25MP.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-status-field-_umgNjK4.js.map → workflow-status-field-BQDIaBJw.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-workbench-CqOI36Oy.js.map → workflow-workbench-CHPH8qPu.js.map} +1 -1
- package/dist/users/messages.d.ts +2 -2
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maplibre-
|
|
1
|
+
{"version":3,"file":"maplibre-BSd2GULM.js","names":["useState","_Fragment","maplibre.setWorkerUrl","workerUrl","maplibre.addProtocol","Protocol","maplibre","n","a","t","__toESM","require_react","require_jsx_runtime","guarded","createLucideIcon","messages","Segmented","maplibre_gl_exports","An","UF","maplibre_gl_worker_default","Source","useMap","Layer","B","__iconData","MapPin","import_react","mapLayerStorageKey","chosenMapLayer","layers","layer","id","readMapLayer","storage","writeMapLayer","text","import_jsx_runtime","styleValue","MapLayerSwitch","chosenId","setChosenId","map","chosen","choose","value","beforeId","below","mapLib"],"sources":["../../../../../node_modules/.bun/lucide-react@1.52.0+0ac650c021fb1b59/node_modules/lucide-react/dist/esm/icons/map-pin.mjs","../../../src/app/map/map-layer-choice.ts","../../../src/app/map/messages.ts","../../../src/app/map/map-layer-switch.tsx","../../../src/app/map/maplibre.ts"],"sourcesContent":["/**\n * @license lucide-react v1.52.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"map-pin\",\n size: 24,\n node: [\n [\n \"path\",\n {\n d: \"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0\",\n key: \"1r0f0z\"\n }\n ],\n [\"circle\", { cx: \"12\", cy: \"10\", r: \"3\", key: \"ilqhr7\" }]\n ]\n};\n__iconData.node;\nconst MapPin = createLucideIcon(__iconData);\n\nexport { __iconData, MapPin as default };\n//# sourceMappingURL=map-pin.mjs.map\n","import type { MapLayerModel } from '@protobase/client'\nimport { guarded } from '../../lib/guarded'\n\nexport const mapLayerStorageKey = 'protobase:map-layer'\n\n/** The layer the browser last chose, if the app still offers it: else the style's own map, which is the default. */\nexport const chosenMapLayer = (layers: MapLayerModel[], id: string | null | undefined) => layers.find((layer) => layer.id === id)\n\n/** The id of the layer chosen in this browser, if any; unavailable storage reads as the default map. */\nexport const readMapLayer = (storage: Pick<Storage, 'getItem'>) => guarded(() => storage.getItem(mapLayerStorageKey), null)\n\n/** Remembers a layer by its id, and the default map by forgetting the choice, so the default costs no storage. */\nexport const writeMapLayer = (storage: Pick<Storage, 'setItem' | 'removeItem'>, id: string | undefined) =>\n guarded(() => (id === undefined ? storage.removeItem(mapLayerStorageKey) : storage.setItem(mapLayerStorageKey, id)), undefined)\n","import { messages } from '../../locale/messages'\n\nexport const text = messages('app/map')\n","import { useState } from 'react'\nimport { Layer, Source, useMap } from 'react-map-gl/maplibre'\nimport type { MapLayerModel } from '@protobase/client'\nimport { Segmented } from '../../primitives/segmented'\nimport { chosenMapLayer, readMapLayer, writeMapLayer } from './map-layer-choice'\nimport { text } from './messages'\n\n// The default map's value in the switch: no layer id can be empty.\nconst styleValue = ''\n\n/**\n * Inside a map, a switch in its top left corner between the style's map and each of `layers`, and the chosen layer's\n * tiles drawn over the style's, under `below` when the map has that layer, such as the areas around records. The\n * layer's credit joins the map's attribution while it shows. Outside its bounds the style's map shows through. The\n * choice is remembered in this browser, for every map. Nothing without layers.\n */\nexport const MapLayerSwitch = ({ layers, below }: { layers: MapLayerModel[] | undefined; below?: string }) => {\n const [chosenId, setChosenId] = useState(() => readMapLayer(localStorage))\n const { current: map } = useMap()\n if (!layers || layers.length === 0) return null\n const chosen = chosenMapLayer(layers, chosenId)\n const choose = (value: string) => {\n const id = value === styleValue ? undefined : value\n writeMapLayer(localStorage, id)\n setChosenId(id ?? null)\n }\n const beforeId = below && map?.getLayer(below) ? below : undefined\n return (\n <>\n {chosen && (\n <Source key={chosen.id} id={`map-layer-${chosen.id}`} type=\"raster\" tiles={[chosen.tiles]} tileSize={256} attribution={chosen.attribution} maxzoom={chosen.maxzoom ?? 22} {...(chosen.bounds && { bounds: chosen.bounds })}>\n <Layer id={`map-layer-${chosen.id}`} type=\"raster\" {...(beforeId && { beforeId })} />\n </Source>\n )}\n <div className=\"absolute left-2.5 top-2.5 z-10 rounded-md shadow\">\n <Segmented label={text('mapLayer')} value={chosen?.id ?? styleValue} onChange={choose} options={[{ value: styleValue, label: text('map') }, ...layers.map((layer) => ({ value: layer.id, label: layer.label }))]} />\n </div>\n </>\n )\n}\n","import * as maplibre from 'maplibre-gl'\nimport workerUrl from 'maplibre-gl/dist/maplibre-gl-worker.mjs?worker&url'\nimport 'maplibre-gl/dist/maplibre-gl.css'\nimport { Protocol } from 'pmtiles'\n\n// This module loads the first time a map is drawn, and once: MapLibre runs its worker from the bundled file, as its\n// docs say for Vite, and reads `pmtiles://` sources in a style by range requests to the one archive. A map takes\n// MapLibre from here, so a build that drops modules imported only for their effects keeps this one.\nmaplibre.setWorkerUrl(workerUrl)\nmaplibre.addProtocol('pmtiles', new Protocol().tile)\n\n/** MapLibre, set up to run its worker and read PMTiles archives: what a map draws with. */\nexport const mapLib = maplibre\n"],"ignoreList":[0],"mappings":"uzBASA,IAAMyB,EAAa,CACjB,KAAM,UACN,KAAM,GACN,KAAM,CACJ,CACE,OACA,CACE,EAAG,uGACH,IAAK,QACP,CACF,EACA,CAAC,SAAU,CAAE,GAAI,KAAM,GAAI,KAAM,EAAG,IAAK,IAAK,QAAS,CAAC,CAC1D,CACF,EACAA,EAAW,KACX,IAAMC,EAASZ,EAAiBW,CAAU,aCrB7BG,EAAqB,sBAGrBC,GAAkB,EAAyB,IAAkCC,EAAO,KAAM,GAAUC,EAAM,KAAOC,CAAE,EAGnHC,EAAgB,GAAsCpB,MAAcqB,EAAQ,QAAQN,CAAkB,EAAG,IAAI,EAG7GO,GAAiB,EAAkD,IAC9EtB,MAAemB,IAAO,IAAA,GAAYE,EAAQ,WAAWN,CAAkB,EAAIM,EAAQ,QAAQN,EAAoBI,CAAE,EAAI,IAAA,EAAS,ECXnHI,EAAOrB,EAAS,SAAS,aCMhCuB,EAAa,GAQNC,GAAkB,CAAE,SAAQ,WAAqE,CAC5G,GAAM,CAACC,EAAUC,IAAA,EAAezC,EAAAA,SAAAA,KAAeiC,EAAa,YAAY,CAAC,EACnE,CAAE,QAASS,GAAQpB,EAAO,EAChC,GAAI,CAACQ,GAAUA,EAAO,SAAW,EAAG,OAAO,KAC3C,IAAMa,EAASd,EAAeC,EAAQU,CAAQ,EACxCI,EAAU,GAAkB,CAChC,IAAMZ,EAAKa,IAAUP,EAAa,IAAA,GAAYO,EAC9CV,EAAc,aAAcH,CAAE,EAC9BS,EAAYT,GAAM,IAAI,CACxB,EACMc,EAAWC,GAASL,GAAK,SAASK,CAAK,EAAIA,EAAQ,IAAA,GACzD,OACE,EAAAV,EAAA,KAAA,CAAApC,EAAAA,SAAA,CAAA,SAAA,CACG0C,IACC,EAAAN,EAAA,IAAA,CAAChB,EAAD,CAAwB,GAAI,aAAasB,EAAO,KAAM,KAAK,SAAS,MAAO,CAACA,EAAO,KAAK,EAAG,SAAU,IAAK,YAAaA,EAAO,YAAa,QAASA,EAAO,SAAW,GAAI,GAAKA,EAAO,QAAU,CAAE,OAAQA,EAAO,MAAO,EACtN,UAAA,EAAAN,EAAA,IAAA,CAACd,EAAD,CAAO,GAAI,aAAaoB,EAAO,KAAM,KAAK,SAAS,GAAKG,GAAY,CAAE,UAAS,CAAK,CAAA,CAC9E,EAFKH,EAAO,EAEZ,GAEV,EAAAN,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,mDACb,UAAA,EAAAA,EAAA,IAAA,CAACrB,EAAD,CAAW,MAAOoB,EAAK,UAAU,EAAG,MAAOO,GAAQ,IAAML,EAAY,SAAUM,EAAQ,QAAS,CAAC,CAAE,MAAON,EAAY,MAAOF,EAAK,KAAK,CAAE,EAAG,GAAGN,EAAO,IAAK,IAAW,CAAE,MAAOC,EAAM,GAAI,MAAOA,EAAM,KAAM,EAAE,CAAC,CAAI,CAAA,CAChN,CAAA,CACL,CAAA,CAAA,CAEN,EC/BA7B,EAAsBC,CAAS,EAC/BC,EAAqB,UAAW,IAAIC,EAAS,CAAC,CAAC,IAAI,EAGnD,IAAa2C,EAAS1C","debugId":"52776194-2ccc-40a9-83af-c941585c1090"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-content-
|
|
1
|
+
{"version":3,"file":"markdown-content-CJbhy8aC.js","names":["Marked","useMemo","DOMPurify","n","a","t","__toESM","require_react","require_jsx_runtime","cn","useHeadingLevel","purify_default","U","import_react","nestedHeadingLevel","under","depth","escapes","escapeHtml","text","char","scheme","linkSchemes","imageSchemes","ignoredByBrowsers","safeAddress","named","href","schemes","error","titled","title","parser","block","tokens","address","inLink","parsers","markdownHtml","markdown","source","token","headingsUnder","import_jsx_runtime","page","MarkdownContent","insideLink","html","className"],"sources":["../../../src/markdown/nested-heading-level.ts","../../../src/markdown/markdown-html.ts","../../../src/markdown/markdown-content.tsx"],"sourcesContent":["/**\n * The level a markdown heading of `depth` takes under a heading of level `under`: one below it at the least, so `#` and\n * `##` both become the level under it and `###` the one after, and never past h6. With nothing above it, `depth` stays.\n */\nexport const nestedHeadingLevel = (depth: number, under: number) => {\n if (under === 0) return depth\n return Math.min(6, Math.max(under + 1, depth + under - 1))\n}\n","import { Marked, type Tokens } from 'marked'\nimport { nestedHeadingLevel } from './nested-heading-level'\n\nexport type MarkdownHtmlOptions = {\n /** The HTML goes inside a link, such as a card: its links become their text and its images their alt text. */\n inLink?: boolean\n /** The level of the heading the HTML sits under, whose level its own headings go below; 0, the default, keeps them. */\n headingsUnder?: number\n}\n\nconst escapes: Record<string, string> = { '&': '&', '<': '<', '>': '>', '\"': '"', \"'\": ''' }\nconst escapeHtml = (text: string) => text.replace(/[&<>\"']/g, (char) => escapes[char]!)\n\nconst scheme = /^([a-z][a-z0-9+.-]*):/i\nconst linkSchemes = new Set(['http', 'https', 'mailto', 'tel'])\nconst imageSchemes = new Set(['http', 'https'])\n\n// The browser drops these from an address, so `java\\tscript:` is still a script\nconst ignoredByBrowsers = /[\\u0000-\\u0020\\u007f]/g\n\n// An address percent-encoded as marked does, or null when it leaves the allowed schemes, such as `javascript:`.\nconst safeAddress = (href: string, schemes: ReadonlySet<string>) => {\n const named = scheme.exec(href.replace(ignoredByBrowsers, ''))?.[1]?.toLowerCase()\n if (named !== undefined && !schemes.has(named)) return null\n try {\n return encodeURI(href).replace(/%25/g, '%')\n } catch (error) {\n if (error instanceof URIError) return null\n throw error\n }\n}\n\nconst titled = (title: string | null | undefined) => (title ? ` title=\"${escapeHtml(title)}\"` : '')\n\nconst parser = ({ inLink = false }: MarkdownHtmlOptions) =>\n new Marked({\n gfm: true,\n // A line break in the text is one on the page, as in a comment on GitHub\n breaks: true,\n renderer: {\n // Raw HTML shows as the text it is, never as markup\n html: ({ text, block }: Tokens.HTML | Tokens.Tag) => (block ? `<p>${escapeHtml(text)}</p>` : escapeHtml(text)),\n link({ href, title, tokens }: Tokens.Link) {\n const text = this.parser.parseInline(tokens)\n const address = inLink ? null : safeAddress(href, linkSchemes)\n if (address === null) return text\n return `<a href=\"${escapeHtml(address)}\"${titled(title)} target=\"_blank\" rel=\"noopener noreferrer nofollow\">${text}</a>`\n },\n image({ href, title, text }: Tokens.Image) {\n const address = inLink ? null : safeAddress(href, imageSchemes)\n if (address === null) return escapeHtml(text)\n return `<img src=\"${escapeHtml(address)}\" alt=\"${escapeHtml(text)}\"${titled(title)} loading=\"lazy\">`\n },\n },\n })\n\nconst parsers = { inLink: parser({ inLink: true }), page: parser({}) }\n\n/**\n * Markdown as HTML (GitHub's flavour, line breaks kept): raw HTML escaped, links and images only to http(s), mailto and\n * tel addresses or relative ones, links opening in a new tab and headings below `headingsUnder`. The page sanitises the\n * result again before showing it.\n */\nexport const markdownHtml = (source: string, { inLink = false, headingsUnder = 0 }: MarkdownHtmlOptions = {}) => {\n const markdown = inLink ? parsers.inLink : parsers.page\n const tokens = markdown.lexer(source)\n markdown.walkTokens(tokens, (token) => {\n if (token.type === 'heading') token.depth = nestedHeadingLevel(token.depth, headingsUnder)\n })\n return markdown.parser(tokens)\n}\n","import { useMemo } from 'react'\nimport DOMPurify from 'dompurify'\nimport { cn } from '../lib/cn'\nimport { useHeadingLevel } from '../lib/heading-level'\nimport { markdownHtml } from './markdown-html'\n\n// The parts markdown makes, in the theme's colours; code and tables wrap rather than scroll inside\nconst page = cn(\n 'break-words [&>*:first-child]:mt-0 [&>*:last-child]:mb-0',\n '[&_p]:my-2 [&_ul]:my-2 [&_ol]:my-2 [&_pre]:my-2 [&_blockquote]:my-2 [&_table]:my-2 [&_hr]:my-3',\n '[&_h1]:mt-4 [&_h1]:mb-2 [&_h1]:text-lg [&_h1]:font-semibold [&_h2]:mt-4 [&_h2]:mb-2 [&_h2]:text-base [&_h2]:font-semibold',\n '[&_h3]:mt-3 [&_h3]:mb-1 [&_h3]:font-semibold [&_h4]:mt-3 [&_h4]:mb-1 [&_h4]:font-semibold [&_h5]:font-semibold [&_h6]:font-semibold',\n '[&_ul]:list-disc [&_ul]:pl-5 [&_ol]:list-decimal [&_ol]:pl-5 [&_li:has(>input)]:list-none [&_li>input]:mr-1.5 [&_li>input]:-ml-5 [&_li>input]:align-middle',\n '[&_a]:text-primary-text [&_a]:underline [&_a]:underline-offset-2 hover:[&_a]:text-primary-hover',\n '[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.9em]',\n '[&_pre]:whitespace-pre-wrap [&_pre]:rounded-md [&_pre]:bg-muted [&_pre]:p-3 [&_pre_code]:bg-transparent [&_pre_code]:p-0',\n '[&_blockquote]:border-l-2 [&_blockquote]:border-border-strong [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground',\n '[&_table]:w-full [&_table]:border-collapse [&_th]:border [&_th]:border-border [&_th]:bg-surface [&_th]:px-2 [&_th]:py-1 [&_th]:text-left [&_th]:font-semibold',\n '[&_td]:border [&_td]:border-border [&_td]:px-2 [&_td]:py-1 [&_td]:[overflow-wrap:anywhere]',\n '[&_hr]:border-border [&_img]:inline [&_img]:max-w-full [&_img]:rounded [&_del]:text-muted-foreground',\n)\n\n// Inside a link, such as a card, it reads as running text: no gaps between blocks and headings no larger\nconst inLink = cn('[&_*]:my-0 [&_h1]:font-semibold [&_h2]:font-semibold [&_h3]:font-semibold [&_ul]:list-inside [&_ol]:list-inside [&_pre]:whitespace-pre-wrap [&_code]:font-mono [&_code]:text-[0.9em]')\n\nexport type MarkdownContentProps = {\n source: string\n /** It is shown inside a link, such as a card: its own links and images show as their text. */\n inLink?: boolean\n className?: string\n}\n\n/**\n * Markdown rendered, sanitised before it reaches the page: raw HTML shows as text, links open in a new tab and headings\n * sit below the heading the markdown is under, such as a record page section's.\n */\nexport const MarkdownContent = ({ source, inLink: insideLink = false, className }: MarkdownContentProps) => {\n const headingsUnder = useHeadingLevel()\n const html = useMemo(() => DOMPurify.sanitize(markdownHtml(source, { inLink: insideLink, headingsUnder }), { ADD_ATTR: ['target'] }), [source, insideLink, headingsUnder])\n return <div className={cn(insideLink ? inLink : page, className)} dangerouslySetInnerHTML={{ __html: html }} />\n}\n"],"mappings":"mtBAIac,GAAsB,EAAe,IAC5CC,IAAU,EAAUC,EACjB,KAAK,IAAI,EAAG,KAAK,IAAID,EAAQ,EAAGC,EAAQD,EAAQ,CAAC,CAAC,ECIrDE,EAAkC,CAAE,IAAK,QAAS,IAAK,OAAQ,IAAK,OAAQ,IAAK,SAAU,IAAK,OAAQ,EACxGC,EAAc,GAAiBC,EAAK,QAAQ,WAAa,GAASF,EAAQG,EAAM,EAEhFC,EAAS,yBACTC,EAAc,IAAI,IAAI,CAAC,OAAQ,QAAS,SAAU,KAAK,CAAC,EACxDC,EAAe,IAAI,IAAI,CAAC,OAAQ,OAAO,CAAC,EAGxCC,EAAoB,yBAGpBC,GAAe,EAAc,IAAiC,CAClE,IAAMC,EAAQL,EAAO,KAAKM,EAAK,QAAQH,EAAmB,EAAE,CAAC,CAAC,GAAG,EAAE,EAAE,YAAY,EACjF,GAAIE,IAAU,IAAA,IAAa,CAACE,EAAQ,IAAIF,CAAK,EAAG,OAAO,KACvD,GAAI,CACF,OAAO,UAAUC,CAAI,CAAC,CAAC,QAAQ,OAAQ,GAAG,CAC5C,OAASE,EAAO,CACd,GAAIA,aAAiB,SAAU,OAAO,KACtC,MAAMA,CACR,CACF,EAEMC,EAAU,GAAsCC,EAAQ,WAAWb,EAAWa,CAAK,EAAE,GAAK,GAE1FC,GAAU,CAAE,SAAS,MACzB,IAAIhC,EAAO,CACT,IAAK,GAEL,OAAQ,GACR,SAAU,CAER,MAAO,CAAE,OAAM,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CAAE,OAAQM,EAAY,eAAc,CAAC,EAAG,CAAE,SAAU,CAAC,QAAQ,CAAE,CAAC,EAAG,CAACN,EAAQM,EAAYJ,CAAa,CAAC,EACzK,OAAO,EAAAC,EAAA,IAAA,CAAC,MAAD,CAAK,UAAWlC,EAAGqC,EAAaV,EAASQ,EAAMI,CAAS,EAAG,wBAAyB,CAAE,OAAQD,CAAK,CAAI,CAAA,CAChH","debugId":"896e1cbc-6823-4fb8-9d02-94c7f7190070"}
|
package/dist/shell-source-maps/assets/{members-page-CEB-Wkl8.js.map → members-page-q2id0vrY.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"members-page-
|
|
1
|
+
{"version":3,"file":"members-page-q2id0vrY.js","names":["_Fragment","useCallback","n","a","t","__toESM","require_react","require_jsx_runtime","authMessage","AccountSection","useAction","presenceOf","useOrganizationText","AuthError","grantableRoles","keys","SectionError","organizationRoleLabel","text","StatusMark","Spinner","Button","useAuth","useQuery","PageHeader","AppRolesPicker","PersonRow","import_react","import_jsx_runtime","assignableOrganizationRoles","current","MemberRow","organizationId","roles","organizations","self","member","organizationRoles","roleLocked","membershipRoles","role","status","presence","busy","run","session","event","onChanged","selected","MembersPage","query","members","error","load","refetch","statuses"],"sources":["../../../src/organizations/members-page.tsx"],"sourcesContent":["import { useQuery } from '@tanstack/react-query'\nimport { useCallback, useState } from 'react'\nimport { keys } from '../data/query-keys'\nimport { AuthError, type CurrentOrganization, type OrganizationMember, type OrganizationRole, type PersonStatus } from '@protobase/client'\nimport { AccountSection, SectionError } from '../account/account-section'\nimport { PageHeader } from '../app-shell'\nimport { authMessage } from '../auth/auth-messages'\nimport { useAuth } from '../auth/auth-provider'\nimport { PersonRow } from '../people/person-row'\nimport { presenceOf, type Presence, type PresenceByUser } from '../presence/presence'\nimport { StatusMark } from '../status/status-mark'\nimport { Button } from '../primitives/button'\nimport { Spinner } from '../primitives/spinner'\nimport { AppRolesPicker } from './app-roles-picker'\nimport { grantableRoles, organizationRoleLabel } from './organization-paths'\nimport { useAction } from './use-action'\nimport { text } from './messages'\nimport { useOrganizationText } from './organization-word'\n\n/** The organization roles the person may set: owners every one, admins those below owner. */\nexport const assignableOrganizationRoles = (current?: CurrentOrganization): OrganizationRole[] => (current?.role === 'owner' ? ['owner', 'admin', 'member'] : ['admin', 'member'])\n\nconst MemberRow = ({ member, current, status, presence, onChanged }: { member: OrganizationMember; current: CurrentOrganization; status?: PersonStatus | undefined; presence?: Presence | undefined; onChanged: () => void }) => {\n const { session, organizations } = useAuth()\n const t = useOrganizationText()\n const organizationId = current.organization!.id\n const { busy, error, run } = useAction()\n const roles = organizations?.roles ?? []\n const self = member.id === current.memberId\n const organizationRoles = assignableOrganizationRoles(current)\n // Only an owner changes an owner, as the server checks too.\n const roleLocked = member.role === 'owner' && current.role !== 'owner'\n const membershipRoles = roles.filter((role) => role.membership)\n return (\n <PersonRow\n name={member.name}\n email={member.email}\n self={self}\n error={error}\n {...((status || presence) && { status: <StatusMark status={status} presence={presence} /> })}\n actions={\n <>\n <select\n aria-label={t('roleOf', { name: member.name })}\n value={member.role}\n disabled={busy || roleLocked}\n onChange={(event) => void run(async () => { await session.organizations.setRole(organizationId, member.id, event.target.value as OrganizationRole); onChanged() })}\n className=\"h-7 rounded-md border border-border-strong bg-background px-2 text-body\"\n >\n {(roleLocked ? [member.role] : organizationRoles).map((role) => <option key={role} value={role}>{organizationRoleLabel(role)}</option>)}\n </select>\n {!self && (\n <Button size=\"sm\" variant=\"danger\" loading={busy} disabled={roleLocked} onClick={() => void run(async () => { await session.organizations.removeMember(organizationId, member.id); onChanged() })}>\n {text('remove')}\n </Button>\n )}\n </>\n }\n >\n <AppRolesPicker roles={membershipRoles} selected={member.appRoles} grantable={grantableRoles(roles, current)} disabled={busy} onChange={(selected) => void run(async () => { await session.organizations.setAppRoles(member.id, selected); onChanged() })} />\n </PersonRow>\n )\n}\n\n/**\n * The members of the organization one works in, for its owners and admins: organization roles, which decide who\n * manages it, and app roles, which decide what each sees and does; only roles the person may give can change. In an\n * app with status, `statuses` puts each member's beside their name (see `useStatuses`), and `presence`, the app's, puts\n * whether they are online or away before it (see `usePresence`).\n */\nexport const MembersPage = ({ current, statuses, presence }: { current?: CurrentOrganization; statuses?: readonly PersonStatus[] | undefined; presence?: PresenceByUser | undefined }) => {\n const { session } = useAuth()\n const t = useOrganizationText()\n const organizationId = current?.organization?.id\n // A query, so the start cache keeps the members and the page's first frame lists them\n const query = useQuery({ queryKey: keys.organizationMembers(organizationId ?? ''), queryFn: () => session.organizations.members(organizationId!), enabled: Boolean(organizationId), retry: false })\n const members = query.data\n const error = query.error ? (query.error instanceof AuthError ? authMessage(query.error) : text('couldNotReadMembers')) : undefined\n const { refetch } = query\n const load = useCallback(() => void refetch(), [refetch])\n if (!current?.organization) return null\n return (\n <div className=\"mx-auto flex w-full max-w-3xl flex-col gap-4 px-4 py-6 md:px-6\">\n <PageHeader title={text('members')} subtitle={text('whoWorks', { organization: current.organization.name })} />\n <AccountSection title={text('members')} description={t('membersDescription')}>\n <SectionError message={error} />\n {members ? (\n <ul className=\"divide-y rounded-md border\">\n {members.map((member) => <MemberRow key={`${member.id}/${member.role}/${member.appRoles.join()}`} member={member} current={current} status={statuses?.find((status) => status.userId === member.userId)} presence={presenceOf(presence, member.userId)} onChanged={load} />)}\n </ul>\n ) : (\n !error && <div className=\"flex items-center gap-2 text-muted-foreground\"><Spinner /> {text('loading')}</div>\n )}\n </AccountSection>\n </div>\n )\n}\n"],"mappings":"q3BAoBa6B,EAA+B,GAAuDC,GAAS,OAAS,QAAU,CAAC,QAAS,QAAS,QAAQ,EAAI,CAAC,QAAS,QAAQ,EAE1KC,GAAa,CAAE,SAAQ,UAAS,SAAQ,WAAU,eAAyK,CAC/N,GAAM,CAAE,UAAS,iBAAkBT,EAAQ,EACrClB,EAAIQ,EAAoB,EACxBoB,EAAiBF,EAAQ,aAAc,GACvC,CAAE,OAAM,QAAO,OAAQpB,EAAU,EACjCuB,EAAQC,GA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D,CAAiF,SAAiB,UAAS,OAAQwB,GAAU,KAAM,GAAWd,EAAO,SAAWL,EAAO,MAAM,EAAG,SAAUzB,EAAW+B,EAAUN,EAAO,MAAM,EAAG,UAAWiB,CAAO,EAAjO,GAAGjB,EAAO,GAAG,GAAGA,EAAO,KAAK,GAAGA,EAAO,SAAS,KAAK,GAA6K,CAAC,CACzQ,CAAA,EAEJ,CAACgB,IAAS,EAAAxB,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,gDAAf,SAAA,EAA+D,EAAAA,EAAA,IAAA,CAACR,EAAD,CAAU,CAAA,EAAC,IAAEF,EAAK,SAAS,CAAO,CAE/F,CAAA,CAAA,CACb,CAAA,CAAA,IAd4B,IAgBrC","debugId":"2ada2774-beb6-4ae6-831a-3f85736480e7"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages-Ce8dRRRN.js","names":["text","text","n","a","t","where","printFilter","isApiError","messages","recordTitle","encodeKey","refusalReason","parseSort","can","recordKey","writablePosition","position","model","permissions","field","listHandOrder","relatedHandOrder","item","dragsRank","view","filter","sort","orderBy","text$1","moveRefusal","error","fallback","title","undoOps","writes","changed","fields","before","record","everyRecord","records","pageToken","page","client","resource","narrowed","extra","rankBounds","after","id","self","encoded","value","links","other","link","from","to","dependsOn","dependents","pending","waiting","bound","key","found","selfPending","anchoredMove","keyAt","order","at","unknown","more","index","numberedBefore","written","results","entry","idOf","text"],"sources":["../../../src/app/hand-order/hand-order.ts","../../../src/app/hand-order/messages.ts","../../../src/app/hand-order/move-refusal.ts","../../../src/app/hand-order/undo-ops.ts","../../../src/app/rank-after/rank-bounds.ts","../../../src/app/hand-order/anchored-move.ts","../../../src/app/hand-order/numbered-before.ts","../../../src/app/rank-after/messages.ts"],"sourcesContent":["import type { ResourcePermissions } from '@protobase/client'\nimport type { RelatedModel, ResourceModel, ViewModel } from '@protobase/schema'\nimport { parseSort } from '../list-order'\nimport { can } from '../permissions'\n\n/** The records loaded per request to reorder them by hand, the list API's largest page; all pages load. */\nexport const handOrderPage = 500\n\n/** The field a user may sort `model`'s records by hand in: its `position`, when they may update it. */\nconst writablePosition = (model: ResourceModel, permissions: ResourcePermissions) => {\n const position = model.position\n if (!position || !can(permissions, 'update')) return undefined\n const field = model.fields[position.field]\n return field && !field.readOnly ? position.field : undefined\n}\n\n/**\n * The field the list page sorts all of `model`'s records by hand in. A resource whose records are ordered within a\n * parent is sorted in the parent's related section instead, since its list mixes the parents.\n */\nexport const listHandOrder = (model: ResourceModel, permissions: ResourcePermissions) =>\n model.position?.within === undefined ? writablePosition(model, permissions) : undefined\n\n/**\n * The field a related section sorts its records by hand in: those of one parent, when the section lists every record\n * whose `within` relation points at the page's record, no filter or join resource leaving some out.\n */\nexport const relatedHandOrder = (item: RelatedModel, model: ResourceModel, permissions: ResourcePermissions) =>\n model.position?.within !== undefined && item.field === model.position.within && !item.through && !item.from && !item.filter ? writablePosition(model, permissions) : undefined\n\n/**\n * Whether the list page's table moves its rows by dragging at any time, without **Reorder**: its list turns\n * `drag.rank` on, and it shows every record in the order of `field`, from `listHandOrder`, without a filter or search.\n */\nexport const dragsRank = (view: ViewModel | undefined, field: string | undefined, orderBy: string, filter: string) => {\n if (field === undefined || view?.list?.drag?.rank !== true || filter !== '') return false\n const sort = parseSort(orderBy)\n return sort.columnId === field && sort.direction === 'asc'\n}\n","import { messages } from '../../locale/messages'\n\nexport const text = messages('app/hand-order')\n","import { isApiError } from '@protobase/client'\nimport { refusalReason } from '../displays/board-columns'\nimport { text } from './messages'\n\n/** What was refused: a move of the record titled `title`, or an undo (no title), on a list or a board. */\nexport type Refused = { title?: string | undefined; place: 'list' | 'board' }\n\n/**\n * The toast of a refused move or undo. When the order changed where it was dropped (412), a warning that it was not\n * saved and that the list, which reloads by itself, shows the current order; otherwise an error with `fallback` and the\n * server's reason.\n */\nexport const moveRefusal = (error: unknown, fallback: string, { title, place }: Refused) => {\n if (!isApiError(error) || error.status !== 412) return { state: 'error' as const, title: fallback, description: refusalReason(error) }\n if (title === undefined) return { state: 'warning' as const, title: fallback, description: text('orderChangedSince', { place }) }\n return { state: 'warning' as const, title: text('notSaved', { title }), description: text('orderChangedThere', { place }) }\n}\n","import type { BatchOp } from '@protobase/client'\nimport type { ResourceModel } from '@protobase/schema'\nimport { recordKey } from '../../live/model-helpers'\n\n/** A record a drag saved: its values before the drag, and the record and ETag the server gave back. */\nexport type DragWrite = { before: Record<string, unknown>; record: Record<string, unknown>; etag: string }\n\n/**\n * The batch that undoes a drag: an update of each record it saved putting back those of `fields` it changed, with the\n * ETag the save gave it, so a record changed again since is refused rather than overwritten.\n */\nexport const undoOps = (model: ResourceModel, writes: DragWrite[], fields: string[]): BatchOp[] =>\n writes.flatMap(({ before, record, etag }) => {\n const changed = fields.filter((field) => Object.hasOwn(before, field) && before[field] !== record[field])\n if (changed.length === 0) return []\n return [{ op: 'update', resource: model.name, key: recordKey(model, record), data: Object.fromEntries(changed.map((field) => [field, before[field]])), etag }]\n })\n","import type { Client } from '@protobase/client'\nimport { printFilter, where, type ResourceModel, type ViewModel } from '@protobase/schema'\nimport { encodeKey } from '@protobase/schema/internal'\nimport { recordKey, recordTitle } from '../../live/model-helpers'\n\n/** A record a re-ranked record must stay below or above: its key as the API encodes it, its rank and its title. */\nexport type RankBound = { key: string; rank: unknown; title: string }\n\n/**\n * What a re-ranked record must keep to, by its position's `after`: `after`, the pending records it depends on, which it\n * must rank below; `before`, the records that depend on it while it is pending, which must rank below it.\n */\nexport type RankBounds = { after: RankBound[]; before: RankBound[] }\n\n// A record's dependencies are few, but all of them count\nconst everyRecord = async (client: Client, resource: string, filter: string) => {\n const records: Record<string, unknown>[] = []\n let pageToken = ''\n do {\n const page = await client.search(resource, { filter, pageSize: 100, ...(pageToken && { pageToken }) })\n records.push(...page.items)\n pageToken = page.nextPageToken\n } while (pageToken)\n return records\n}\n\nconst narrowed = (filter: string, extra: string | undefined) => (extra === undefined ? filter : `(${filter}) AND (${extra})`)\n\n/**\n * The records `record` must rank between, through the list API: the join records that hold its key on either side,\n * then the records they name, those it depends on narrowed to the pending ones. Without `after` on the resource's\n * position there are none.\n */\nexport const rankBounds = async (client: Client, model: ResourceModel, view: ViewModel | undefined, record: Record<string, unknown>): Promise<RankBounds> => {\n const after = model.position?.after\n if (!after) return { after: [], before: [] }\n const id = model.primaryKey[0]!\n // `after` takes a key of one field\n const self = recordKey(model, record) as string | number\n const encoded = (value: unknown) => encodeKey([value as string | number])\n const links = await everyRecord(client, after.resource, narrowed(printFilter(where.or(where.eq(after.field, self), where.eq(after.key, self))), after.filter))\n const other = (from: string, to: string) => links.flatMap((link) => (encoded(link[from]) === encoded(self) && encoded(link[to]) !== encoded(self) ? [link[to] as string | number] : []))\n const dependsOn = other(after.field, after.key)\n const dependents = other(after.key, after.field)\n\n const [pending, waiting] = await Promise.all([\n everyRecord(client, model.name, narrowed(printFilter(where.in(id, [self, ...dependsOn])), after.while)),\n dependents.length === 0 ? [] : everyRecord(client, model.name, printFilter(where.in(id, dependents))),\n ])\n const bound = (found: Record<string, unknown>): RankBound => {\n const key = encodeKey(recordKey(model, found))\n return { key, rank: found[model.position!.field], title: recordTitle(model, view, found, key) }\n }\n const selfPending = pending.some((found) => encoded(found[id]) === encoded(self))\n return { after: pending.filter((found) => encoded(found[id]) !== encoded(self)).map(bound), before: selfPending ? waiting.map(bound) : [] }\n}\n","import type { BatchOp } from '@protobase/client'\nimport type { ResourceModel } from '@protobase/schema'\nimport { recordKey } from '../../live/model-helpers'\n\n/**\n * The `move` that saves the record at `index` of `order`, the list as shown once it was dropped: anchored to the record\n * above it and the one below, so it saves while the record after that anchor is still the one below, whatever else\n * changed. `filter` is the list's, so the server reads the same list. With `more` records after `order` not loaded, a\n * record dropped last does not know the one below it, so only its anchor is checked.\n */\nexport const anchoredMove = (model: ResourceModel, field: string, filter: string, order: Record<string, unknown>[], index: number, more = false): BatchOp => {\n const keyAt = (at: number) => (order[at] ? recordKey(model, order[at]) : null)\n const unknown = more && index === order.length - 1\n return { op: 'move', resource: model.name, field, key: recordKey(model, order[index]!), after: keyAt(index - 1), ...(!unknown && { before: keyAt(index + 1) }), ...(filter && { filter }) }\n}\n","import type { BatchResult } from '@protobase/client'\n\n/**\n * The value of the order field each record numbered by a batch's `reorder` and `move` operations had before the first\n * of them, as the server had it, by `idOf` the record: what an undo puts back, rather than the order the list loaded with.\n */\nexport const numberedBefore = (results: BatchResult['results'], idOf: (record: Record<string, unknown>) => string) => {\n const before = new Map<string, unknown>()\n for (const written of results) {\n if (written.op !== 'reorder' && written.op !== 'move') continue\n for (const entry of written.records) {\n const id = idOf(entry.record)\n if (!before.has(id)) before.set(id, entry.previous)\n }\n }\n return before\n}\n","import { messages } from '../../locale/messages'\n\nexport const text = messages('app/rank-after')\n"],"mappings":"skBASA,IAAMe,GAAoB,EAAsB,IAAqC,CACnF,IAAMC,EAAWC,EAAM,SACvB,GAAI,CAACD,GAAY,CAACH,EAAIK,EAAa,QAAQ,EAAG,OAC9C,IAAMC,EAAQF,EAAM,OAAOD,EAAS,OACpC,OAAOG,GAAS,CAACA,EAAM,SAAWH,EAAS,MAAQ,IAAA,EACrD,EAMaI,GAAiB,EAAsB,IAClDH,EAAM,UAAU,SAAW,IAAA,GAAYF,EAAiBE,EAAOC,CAAW,EAAI,IAAA,GAMnEG,GAAoB,EAAoB,EAAsB,IACzEJ,EAAM,UAAU,SAAW,IAAA,IAAaK,EAAK,QAAUL,EAAM,SAAS,QAAU,CAACK,EAAK,SAAW,CAACA,EAAK,MAAQ,CAACA,EAAK,OAASP,EAAiBE,EAAOC,CAAW,EAAI,IAAA,GAM1JK,GAAa,EAA6B,EAA2B,EAAiB,IAAmB,CACpH,GAAIJ,IAAU,IAAA,IAAaK,GAAM,MAAM,MAAM,OAAS,IAAQC,IAAW,GAAI,MAAO,GACpF,IAAMC,EAAOd,EAAUe,CAAO,EAC9B,OAAOD,EAAK,WAAaP,GAASO,EAAK,YAAc,KACvD,ECpCa1B,EAAOQ,EAAS,gBAAgB,ECUhCqB,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Mf,EAAG,IAAME,EAAQD,CAAI,CAAC,EAChF,MAAO,CAAE,MAAOU,EAAQ,OAAQ,GAAUT,EAAQa,EAAMf,EAAG,IAAME,EAAQD,CAAI,CAAC,CAAC,CAAC,IAAIY,CAAK,EAAG,OAAQG,EAAcJ,EAAQ,IAAIC,CAAK,EAAI,CAAC,CAAE,CAC5I,EC7CaI,GAAgB,EAAsB,EAAe,EAAgB,EAAkC,EAAe,EAAO,KAAmB,CAC3J,IAAMC,EAAS,GAAgBC,EAAMC,GAAMvD,EAAUG,EAAOmD,EAAMC,EAAG,EAAI,KACnEC,EAAUC,GAAQC,IAAUJ,EAAM,OAAS,EACjD,MAAO,CAAE,GAAI,OAAQ,SAAUnD,EAAM,KAAM,QAAO,IAAKH,EAAUG,EAAOmD,EAAMI,EAAO,EAAG,MAAOL,EAAMK,EAAQ,CAAC,EAAG,GAAI,CAACF,GAAW,CAAE,OAAQH,EAAMK,EAAQ,CAAC,CAAE,EAAI,GAAI/C,GAAU,CAAE,QAAO,CAAG,CAC5L,ECRagD,GAAkB,EAAiC,IAAsD,CACpH,IAAMpC,EAAS,IAAI,IACnB,IAAK,IAAMqC,KAAWC,EACpB,GAAID,EAAQ,KAAO,WAAaA,EAAQ,KAAO,OAC/C,IAAK,IAAME,KAASF,EAAQ,QAAS,CACnC,IAAMzB,EAAK4B,EAAKD,EAAM,MAAM,EACvBvC,EAAO,IAAIY,CAAE,GAAGZ,EAAO,IAAIY,EAAI2B,EAAM,QAAQ,CACpD,CAEF,OAAOvC,CACT,ECdayC,EAAOtE,EAAS,gBAAgB","debugId":"9ef1d451-44d2-4d02-9895-beafe692bc0a"}
|
|
1
|
+
{"version":3,"file":"messages-ZPG4Y__r.js","names":["text","text","n","a","t","where","printFilter","isApiError","messages","recordTitle","encodeKey","refusalReason","parseSort","can","recordKey","writablePosition","position","model","permissions","field","listHandOrder","relatedHandOrder","item","dragsRank","view","filter","sort","orderBy","text$1","moveRefusal","error","fallback","title","undoOps","writes","changed","fields","before","record","everyRecord","records","pageToken","page","client","resource","narrowed","extra","rankBounds","after","id","self","encoded","value","links","other","link","from","to","dependsOn","dependents","pending","waiting","bound","key","found","selfPending","anchoredMove","keyAt","order","at","unknown","more","index","numberedBefore","written","results","entry","idOf","text"],"sources":["../../../src/app/hand-order/hand-order.ts","../../../src/app/hand-order/messages.ts","../../../src/app/hand-order/move-refusal.ts","../../../src/app/hand-order/undo-ops.ts","../../../src/app/rank-after/rank-bounds.ts","../../../src/app/hand-order/anchored-move.ts","../../../src/app/hand-order/numbered-before.ts","../../../src/app/rank-after/messages.ts"],"sourcesContent":["import type { ResourcePermissions } from '@protobase/client'\nimport type { RelatedModel, ResourceModel, ViewModel } from '@protobase/schema'\nimport { parseSort } from '../list-order'\nimport { can } from '../permissions'\n\n/** The records loaded per request to reorder them by hand, the list API's largest page; all pages load. */\nexport const handOrderPage = 500\n\n/** The field a user may sort `model`'s records by hand in: its `position`, when they may update it. */\nconst writablePosition = (model: ResourceModel, permissions: ResourcePermissions) => {\n const position = model.position\n if (!position || !can(permissions, 'update')) return undefined\n const field = model.fields[position.field]\n return field && !field.readOnly ? position.field : undefined\n}\n\n/**\n * The field the list page sorts all of `model`'s records by hand in. A resource whose records are ordered within a\n * parent is sorted in the parent's related section instead, since its list mixes the parents.\n */\nexport const listHandOrder = (model: ResourceModel, permissions: ResourcePermissions) =>\n model.position?.within === undefined ? writablePosition(model, permissions) : undefined\n\n/**\n * The field a related section sorts its records by hand in: those of one parent, when the section lists every record\n * whose `within` relation points at the page's record, no filter or join resource leaving some out.\n */\nexport const relatedHandOrder = (item: RelatedModel, model: ResourceModel, permissions: ResourcePermissions) =>\n model.position?.within !== undefined && item.field === model.position.within && !item.through && !item.from && !item.filter ? writablePosition(model, permissions) : undefined\n\n/**\n * Whether the list page's table moves its rows by dragging at any time, without **Reorder**: its list turns\n * `drag.rank` on, and it shows every record in the order of `field`, from `listHandOrder`, without a filter or search.\n */\nexport const dragsRank = (view: ViewModel | undefined, field: string | undefined, orderBy: string, filter: string) => {\n if (field === undefined || view?.list?.drag?.rank !== true || filter !== '') return false\n const sort = parseSort(orderBy)\n return sort.columnId === field && sort.direction === 'asc'\n}\n","import { messages } from '../../locale/messages'\n\nexport const text = messages('app/hand-order')\n","import { isApiError } from '@protobase/client'\nimport { refusalReason } from '../displays/board-columns'\nimport { text } from './messages'\n\n/** What was refused: a move of the record titled `title`, or an undo (no title), on a list or a board. */\nexport type Refused = { title?: string | undefined; place: 'list' | 'board' }\n\n/**\n * The toast of a refused move or undo. When the order changed where it was dropped (412), a warning that it was not\n * saved and that the list, which reloads by itself, shows the current order; otherwise an error with `fallback` and the\n * server's reason.\n */\nexport const moveRefusal = (error: unknown, fallback: string, { title, place }: Refused) => {\n if (!isApiError(error) || error.status !== 412) return { state: 'error' as const, title: fallback, description: refusalReason(error) }\n if (title === undefined) return { state: 'warning' as const, title: fallback, description: text('orderChangedSince', { place }) }\n return { state: 'warning' as const, title: text('notSaved', { title }), description: text('orderChangedThere', { place }) }\n}\n","import type { BatchOp } from '@protobase/client'\nimport type { ResourceModel } from '@protobase/schema'\nimport { recordKey } from '../../live/model-helpers'\n\n/** A record a drag saved: its values before the drag, and the record and ETag the server gave back. */\nexport type DragWrite = { before: Record<string, unknown>; record: Record<string, unknown>; etag: string }\n\n/**\n * The batch that undoes a drag: an update of each record it saved putting back those of `fields` it changed, with the\n * ETag the save gave it, so a record changed again since is refused rather than overwritten.\n */\nexport const undoOps = (model: ResourceModel, writes: DragWrite[], fields: string[]): BatchOp[] =>\n writes.flatMap(({ before, record, etag }) => {\n const changed = fields.filter((field) => Object.hasOwn(before, field) && before[field] !== record[field])\n if (changed.length === 0) return []\n return [{ op: 'update', resource: model.name, key: recordKey(model, record), data: Object.fromEntries(changed.map((field) => [field, before[field]])), etag }]\n })\n","import type { Client } from '@protobase/client'\nimport { printFilter, where, type ResourceModel, type ViewModel } from '@protobase/schema'\nimport { encodeKey } from '@protobase/schema/internal'\nimport { recordKey, recordTitle } from '../../live/model-helpers'\n\n/** A record a re-ranked record must stay below or above: its key as the API encodes it, its rank and its title. */\nexport type RankBound = { key: string; rank: unknown; title: string }\n\n/**\n * What a re-ranked record must keep to, by its position's `after`: `after`, the pending records it depends on, which it\n * must rank below; `before`, the records that depend on it while it is pending, which must rank below it.\n */\nexport type RankBounds = { after: RankBound[]; before: RankBound[] }\n\n// A record's dependencies are few, but all of them count\nconst everyRecord = async (client: Client, resource: string, filter: string) => {\n const records: Record<string, unknown>[] = []\n let pageToken = ''\n do {\n const page = await client.search(resource, { filter, pageSize: 100, ...(pageToken && { pageToken }) })\n records.push(...page.items)\n pageToken = page.nextPageToken\n } while (pageToken)\n return records\n}\n\nconst narrowed = (filter: string, extra: string | undefined) => (extra === undefined ? filter : `(${filter}) AND (${extra})`)\n\n/**\n * The records `record` must rank between, through the list API: the join records that hold its key on either side,\n * then the records they name, those it depends on narrowed to the pending ones. Without `after` on the resource's\n * position there are none.\n */\nexport const rankBounds = async (client: Client, model: ResourceModel, view: ViewModel | undefined, record: Record<string, unknown>): Promise<RankBounds> => {\n const after = model.position?.after\n if (!after) return { after: [], before: [] }\n const id = model.primaryKey[0]!\n // `after` takes a key of one field\n const self = recordKey(model, record) as string | number\n const encoded = (value: unknown) => encodeKey([value as string | number])\n const links = await everyRecord(client, after.resource, narrowed(printFilter(where.or(where.eq(after.field, self), where.eq(after.key, self))), after.filter))\n const other = (from: string, to: string) => links.flatMap((link) => (encoded(link[from]) === encoded(self) && encoded(link[to]) !== encoded(self) ? [link[to] as string | number] : []))\n const dependsOn = other(after.field, after.key)\n const dependents = other(after.key, after.field)\n\n const [pending, waiting] = await Promise.all([\n everyRecord(client, model.name, narrowed(printFilter(where.in(id, [self, ...dependsOn])), after.while)),\n dependents.length === 0 ? [] : everyRecord(client, model.name, printFilter(where.in(id, dependents))),\n ])\n const bound = (found: Record<string, unknown>): RankBound => {\n const key = encodeKey(recordKey(model, found))\n return { key, rank: found[model.position!.field], title: recordTitle(model, view, found, key) }\n }\n const selfPending = pending.some((found) => encoded(found[id]) === encoded(self))\n return { after: pending.filter((found) => encoded(found[id]) !== encoded(self)).map(bound), before: selfPending ? waiting.map(bound) : [] }\n}\n","import type { BatchOp } from '@protobase/client'\nimport type { ResourceModel } from '@protobase/schema'\nimport { recordKey } from '../../live/model-helpers'\n\n/**\n * The `move` that saves the record at `index` of `order`, the list as shown once it was dropped: anchored to the record\n * above it and the one below, so it saves while the record after that anchor is still the one below, whatever else\n * changed. `filter` is the list's, so the server reads the same list. With `more` records after `order` not loaded, a\n * record dropped last does not know the one below it, so only its anchor is checked.\n */\nexport const anchoredMove = (model: ResourceModel, field: string, filter: string, order: Record<string, unknown>[], index: number, more = false): BatchOp => {\n const keyAt = (at: number) => (order[at] ? recordKey(model, order[at]) : null)\n const unknown = more && index === order.length - 1\n return { op: 'move', resource: model.name, field, key: recordKey(model, order[index]!), after: keyAt(index - 1), ...(!unknown && { before: keyAt(index + 1) }), ...(filter && { filter }) }\n}\n","import type { BatchResult } from '@protobase/client'\n\n/**\n * The value of the order field each record numbered by a batch's `reorder` and `move` operations had before the first\n * of them, as the server had it, by `idOf` the record: what an undo puts back, rather than the order the list loaded with.\n */\nexport const numberedBefore = (results: BatchResult['results'], idOf: (record: Record<string, unknown>) => string) => {\n const before = new Map<string, unknown>()\n for (const written of results) {\n if (written.op !== 'reorder' && written.op !== 'move') continue\n for (const entry of written.records) {\n const id = idOf(entry.record)\n if (!before.has(id)) before.set(id, entry.previous)\n }\n }\n return before\n}\n","import { messages } from '../../locale/messages'\n\nexport const text = messages('app/rank-after')\n"],"mappings":"skBASA,IAAMe,GAAoB,EAAsB,IAAqC,CACnF,IAAMC,EAAWC,EAAM,SACvB,GAAI,CAACD,GAAY,CAACH,EAAIK,EAAa,QAAQ,EAAG,OAC9C,IAAMC,EAAQF,EAAM,OAAOD,EAAS,OACpC,OAAOG,GAAS,CAACA,EAAM,SAAWH,EAAS,MAAQ,IAAA,EACrD,EAMaI,GAAiB,EAAsB,IAClDH,E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EACpB,GAAID,EAAQ,KAAO,WAAaA,EAAQ,KAAO,OAC/C,IAAK,IAAME,KAASF,EAAQ,QAAS,CACnC,IAAMzB,EAAK4B,EAAKD,EAAM,MAAM,EACvBvC,EAAO,IAAIY,CAAE,GAAGZ,EAAO,IAAIY,EAAI2B,EAAM,QAAQ,CACpD,CAEF,OAAOvC,CACT,ECdayC,EAAOtE,EAAS,gBAAgB","debugId":"193c6e18-fffa-42dd-8241-95ec2e9117db"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organization-page-CTxtblmm.js","names":["useState","_Fragment","n","a","t","__toESM","require_react","require_jsx_runtime","reopenIn","Input","AccountSection","useAction","Switch","useOrganizationText","managesOrganization","SectionError","organizationRoleLabel","Dialog","text","useClient","Button","useMeta","useAuth","PageHeader","import_react","import_jsx_runtime","Details","name","setName","organization","slug","setSlug","changed","editable","error","event","run","session","onSaved","busy","HandOver","members","setMembers","target","setTarget","list","member","memberId","Delete","confirming","setConfirming","typed","setTyped","remove","basePath","GuestLinks","client","allowed","setAllowed","next","Leave","owner","OrganizationPage","calls","current","onChanged"],"sources":["../../../src/organizations/organization-page.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport type { CurrentOrganization, OrganizationMember } from '@protobase/client'\nimport { AccountSection, SectionError } from '../account/account-section'\nimport { PageHeader } from '../app-shell'\nimport { useAuth } from '../auth/auth-provider'\nimport { Button } from '../primitives/button'\nimport { Dialog } from '../primitives/dialog'\nimport { Input } from '../primitives/input'\nimport { Switch } from '../primitives/switch'\nimport { useClient } from '../data/api-provider'\nimport { useMeta } from '../data/use-meta'\nimport { managesOrganization, organizationRoleLabel } from './organization-paths'\nimport { useAction } from './use-action'\nimport { reopenIn } from './use-organizations'\nimport { text } from './messages'\nimport { useOrganizationText } from './organization-word'\n\ntype Organization = NonNullable<CurrentOrganization['organization']>\n\nconst Details = ({ organization, editable, onSaved }: { organization: Organization; editable: boolean; onSaved: () => void }) => {\n const { session } = useAuth()\n const [name, setName] = useState(organization.name)\n const [slug, setSlug] = useState(organization.slug)\n const { busy, error, run } = useAction()\n const changed = name.trim() !== organization.name || slug !== organization.slug\n return (\n <AccountSection title={text('details')} description={editable ? text('detailsEditable') : text('detailsReadOnly')}>\n <SectionError message={error} />\n <form className=\"flex flex-col gap-2 sm:flex-row\" onSubmit={(event) => { event.preventDefault(); void run(async () => { await session.organizations.rename(organization.id, { name: name.trim(), slug }); onSaved() }) }}>\n <Input aria-label={text('name')} value={name} disabled={!editable} onChange={(event) => setName(event.target.value)} wrapperClassName=\"flex-1\" />\n <Input aria-label={text('slug')} value={slug} disabled={!editable} onChange={(event) => setSlug(event.target.value)} wrapperClassName=\"sm:w-48\" />\n {editable && <Button type=\"submit\" variant=\"primary\" loading={busy} disabled={!changed || !name.trim()}>{text('save')}</Button>}\n </form>\n </AccountSection>\n )\n}\n\nconst HandOver = ({ organization, memberId }: { organization: Organization; memberId: string }) => {\n const { session } = useAuth()\n const [members, setMembers] = useState<OrganizationMember[]>([])\n const [target, setTarget] = useState('')\n const { busy, error, run } = useAction()\n useEffect(() => {\n void session.organizations.members(organization.id).then((list) => setMembers(list.filter((member) => member.id !== memberId)), () => setMembers([]))\n }, [session, organization.id, memberId])\n return (\n <AccountSection title={text('handOver')} description={text('handOverDescription')}>\n <SectionError message={error} />\n <div className=\"flex flex-col gap-2 sm:flex-row\">\n <select aria-label={text('newOwner')} value={target} onChange={(event) => setTarget(event.target.value)} className=\"h-8 flex-1 rounded-md border border-border-strong bg-background px-2\">\n <option value=\"\">{text('chooseMember')}</option>\n {members.map((member) => <option key={member.id} value={member.id}>{member.name} ({member.email})</option>)}\n </select>\n <Button loading={busy} disabled={!target} onClick={() => void run(async () => { await session.organizations.transferOwnership(target); window.location.reload() })}>{text('handOver')}</Button>\n </div>\n </AccountSection>\n )\n}\n\nconst Delete = ({ organization, basePath }: { organization: Organization; basePath: string }) => {\n const { session } = useAuth()\n const [confirming, setConfirming] = useState(false)\n const [typed, setTyped] = useState('')\n const { busy, error, run } = useAction()\n const t = useOrganizationText()\n const remove = () => run(async () => { await session.organizations.remove(organization.id); reopenIn(basePath) })\n return (\n <AccountSection title={t('deleteOrganization')} description={t('deleteDescription')}>\n <SectionError message={confirming ? undefined : error} />\n <Button variant=\"danger\" onClick={() => setConfirming(true)}>{t('deleteOrganization')}</Button>\n {confirming && (\n <Dialog\n title={text('deleteTitle', { name: organization.name })}\n description={text('deleteConfirm')}\n onClose={() => setConfirming(false)}\n actions={\n <>\n <Button onClick={() => setConfirming(false)}>{text('cancel')}</Button>\n <Button variant=\"danger\" loading={busy} disabled={typed !== organization.name} onClick={() => void remove()}>{text('delete')}</Button>\n </>\n }\n >\n <SectionError message={error} />\n <Input aria-label={t('organizationName')} value={typed} onChange={(event) => setTyped(event.target.value)} />\n </Dialog>\n )}\n </AccountSection>\n )\n}\n\n// Whether the organization's calls take guests, which its owner and admins turn on and off; only in an app with calls.\nconst GuestLinks = ({ editable }: { editable: boolean }) => {\n const client = useClient()\n const [allowed, setAllowed] = useState<boolean>()\n const { busy, error, run } = useAction()\n useEffect(() => {\n void client.callGuests.allowed().then(setAllowed)\n }, [client])\n if (allowed === undefined) return null\n return (\n <AccountSection title={text('guestLinks')} description={text('guestLinksDescription')}>\n <SectionError message={error} />\n <label className=\"flex items-center gap-2 text-sm text-foreground\">\n <Switch\n checked={allowed}\n label={text('guestLinksAllowed')}\n {...(editable && !busy && { onChange: (next: boolean) => void run(async () => { await client.callGuests.setAllowed(next); setAllowed(next) }) })}\n />\n {text('guestLinksAllowed')}\n </label>\n </AccountSection>\n )\n}\n\nconst Leave = ({ organization, basePath, owner }: { organization: Organization; basePath: string; owner: boolean }) => {\n const { session } = useAuth()\n const { busy, error, run } = useAction()\n return (\n <AccountSection title={text('leave')} description={owner ? text('leaveOwner') : text('leaveMember')}>\n <SectionError message={error} />\n <Button loading={busy} onClick={() => void run(async () => { await session.organizations.leave(organization.id); reopenIn(basePath) })}>{text('leaveName', { name: organization.name })}</Button>\n </AccountSection>\n )\n}\n\n/**\n * The organization one works in: its details, whether its calls take guests, and handing it over, leaving and deleting\n * it, as one's role allows.\n */\nexport const OrganizationPage = ({ current, basePath, onChanged }: { current?: CurrentOrganization; basePath: string; onChanged: () => void }) => {\n const calls = useMeta().data?.calls === true\n const t = useOrganizationText()\n const organization = current?.organization\n if (!organization) {\n return (\n <div className=\"mx-auto w-full max-w-3xl px-4 py-6 md:px-6\">\n <PageHeader title={t('organization')} subtitle={t('noOrganization')} />\n </div>\n )\n }\n const owner = current.role === 'owner'\n return (\n <div className=\"mx-auto flex w-full max-w-3xl flex-col gap-4 px-4 py-6 md:px-6\">\n <PageHeader title={organization.name} subtitle={current.role ? text('youAre', { role: organizationRoleLabel(current.role).toLowerCase() }) : text('throughGlobalRoles')} />\n <Details key={`${organization.name}/${organization.slug}`} organization={organization} editable={managesOrganization(current)} onSaved={onChanged} />\n {calls && current.role && <GuestLinks editable={managesOrganization(current)} />}\n {owner && current.memberId && <HandOver organization={organization} memberId={current.memberId} />}\n {current.role && <Leave organization={organization} basePath={basePath} owner={owner} />}\n {owner && <Delete organization={organization} basePath={basePath} />}\n </div>\n )\n}\n"],"mappings":"uxBAmBM0B,GAAW,CAAE,eAAc,WAAU,aAAsF,CAC/H,GAAM,CAAE,WAAYJ,EAAQ,EACtB,CAACK,EAAMC,IAAA,EAAW5B,EAAAA,SAAAA,CAAS6B,EAAa,IAAI,EAC5C,CAACC,EAAMC,IAAA,EAAW/B,EAAAA,SAAAA,CAAS6B,EAAa,IAAI,EAC5C,CAAE,OAAM,QAAO,OAAQlB,EAAU,EACjCqB,EAAUL,EAAK,KAAK,IAAME,EAAa,MAAQC,IAASD,EAAa,KAC3E,OACE,EAAAJ,EAAA,KAAA,CAACf,EAAD,CAAgB,MAAOQ,EAAK,SAAS,EAAG,YAAwBA,EAAXe,EAAgB,kBAA0B,iBAAiB,EAAhH,SAAA,EACE,EAAAR,EAAA,IAAA,CAACV,EAAD,CAAc,QAASmB,CAAQ,CAA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,"file":"organization-page-DqYnaJRl.js","names":["useState","_Fragment","n","a","t","__toESM","require_react","require_jsx_runtime","reopenIn","Input","AccountSection","useAction","Switch","useOrganizationText","managesOrganization","SectionError","organizationRoleLabel","Dialog","text","useClient","Button","useMeta","useAuth","PageHeader","import_react","import_jsx_runtime","Details","name","setName","organization","slug","setSlug","changed","editable","error","event","run","session","onSaved","busy","HandOver","members","setMembers","target","setTarget","list","member","memberId","Delete","confirming","setConfirming","typed","setTyped","remove","basePath","GuestLinks","client","allowed","setAllowed","next","Leave","owner","OrganizationPage","calls","current","onChanged"],"sources":["../../../src/organizations/organization-page.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport type { CurrentOrganization, OrganizationMember } from '@protobase/client'\nimport { AccountSection, SectionError } from '../account/account-section'\nimport { PageHeader } from '../app-shell'\nimport { useAuth } from '../auth/auth-provider'\nimport { Button } from '../primitives/button'\nimport { Dialog } from '../primitives/dialog'\nimport { Input } from '../primitives/input'\nimport { Switch } from '../primitives/switch'\nimport { useClient } from '../data/api-provider'\nimport { useMeta } from '../data/use-meta'\nimport { managesOrganization, organizationRoleLabel } from './organization-paths'\nimport { useAction } from './use-action'\nimport { reopenIn } from './use-organizations'\nimport { text } from './messages'\nimport { useOrganizationText } from './organization-word'\n\ntype Organization = NonNullable<CurrentOrganization['organization']>\n\nconst Details = ({ organization, editable, onSaved }: { organization: Organization; editable: boolean; onSaved: () => void }) => {\n const { session } = useAuth()\n const [name, setName] = useState(organization.name)\n const [slug, setSlug] = useState(organization.slug)\n const { busy, error, run } = useAction()\n const changed = name.trim() !== organization.name || slug !== organization.slug\n return (\n <AccountSection title={text('details')} description={editable ? text('detailsEditable') : text('detailsReadOnly')}>\n <SectionError message={error} />\n <form className=\"flex flex-col gap-2 sm:flex-row\" onSubmit={(event) => { event.preventDefault(); void run(async () => { await session.organizations.rename(organization.id, { name: name.trim(), slug }); onSaved() }) }}>\n <Input aria-label={text('name')} value={name} disabled={!editable} onChange={(event) => setName(event.target.value)} wrapperClassName=\"flex-1\" />\n <Input aria-label={text('slug')} value={slug} disabled={!editable} onChange={(event) => setSlug(event.target.value)} wrapperClassName=\"sm:w-48\" />\n {editable && <Button type=\"submit\" variant=\"primary\" loading={busy} disabled={!changed || !name.trim()}>{text('save')}</Button>}\n </form>\n </AccountSection>\n )\n}\n\nconst HandOver = ({ organization, memberId }: { organization: Organization; memberId: string }) => {\n const { session } = useAuth()\n const [members, setMembers] = useState<OrganizationMember[]>([])\n const [target, setTarget] = useState('')\n const { busy, error, run } = useAction()\n useEffect(() => {\n void session.organizations.members(organization.id).then((list) => setMembers(list.filter((member) => member.id !== memberId)), () => setMembers([]))\n }, [session, organization.id, memberId])\n return (\n <AccountSection title={text('handOver')} description={text('handOverDescription')}>\n <SectionError message={error} />\n <div className=\"flex flex-col gap-2 sm:flex-row\">\n <select aria-label={text('newOwner')} value={target} onChange={(event) => setTarget(event.target.value)} className=\"h-8 flex-1 rounded-md border border-border-strong bg-background px-2\">\n <option value=\"\">{text('chooseMember')}</option>\n {members.map((member) => <option key={member.id} value={member.id}>{member.name} ({member.email})</option>)}\n </select>\n <Button loading={busy} disabled={!target} onClick={() => void run(async () => { await session.organizations.transferOwnership(target); window.location.reload() })}>{text('handOver')}</Button>\n </div>\n </AccountSection>\n )\n}\n\nconst Delete = ({ organization, basePath }: { organization: Organization; basePath: string }) => {\n const { session } = useAuth()\n const [confirming, setConfirming] = useState(false)\n const [typed, setTyped] = useState('')\n const { busy, error, run } = useAction()\n const t = useOrganizationText()\n const remove = () => run(async () => { await session.organizations.remove(organization.id); reopenIn(basePath) })\n return (\n <AccountSection title={t('deleteOrganization')} description={t('deleteDescription')}>\n <SectionError message={confirming ? undefined : error} />\n <Button variant=\"danger\" onClick={() => setConfirming(true)}>{t('deleteOrganization')}</Button>\n {confirming && (\n <Dialog\n title={text('deleteTitle', { name: organization.name })}\n description={text('deleteConfirm')}\n onClose={() => setConfirming(false)}\n actions={\n <>\n <Button onClick={() => setConfirming(false)}>{text('cancel')}</Button>\n <Button variant=\"danger\" loading={busy} disabled={typed !== organization.name} onClick={() => void remove()}>{text('delete')}</Button>\n </>\n }\n >\n <SectionError message={error} />\n <Input aria-label={t('organizationName')} value={typed} onChange={(event) => setTyped(event.target.value)} />\n </Dialog>\n )}\n </AccountSection>\n )\n}\n\n// Whether the organization's calls take guests, which its owner and admins turn on and off; only in an app with calls.\nconst GuestLinks = ({ editable }: { editable: boolean }) => {\n const client = useClient()\n const [allowed, setAllowed] = useState<boolean>()\n const { busy, error, run } = useAction()\n useEffect(() => {\n void client.callGuests.allowed().then(setAllowed)\n }, [client])\n if (allowed === undefined) return null\n return (\n <AccountSection title={text('guestLinks')} description={text('guestLinksDescription')}>\n <SectionError message={error} />\n <label className=\"flex items-center gap-2 text-sm text-foreground\">\n <Switch\n checked={allowed}\n label={text('guestLinksAllowed')}\n {...(editable && !busy && { onChange: (next: boolean) => void run(async () => { await client.callGuests.setAllowed(next); setAllowed(next) }) })}\n />\n {text('guestLinksAllowed')}\n </label>\n </AccountSection>\n )\n}\n\nconst Leave = ({ organization, basePath, owner }: { organization: Organization; basePath: string; owner: boolean }) => {\n const { session } = useAuth()\n const { busy, error, run } = useAction()\n return (\n <AccountSection title={text('leave')} description={owner ? text('leaveOwner') : text('leaveMember')}>\n <SectionError message={error} />\n <Button loading={busy} onClick={() => void run(async () => { await session.organizations.leave(organization.id); reopenIn(basePath) })}>{text('leaveName', { name: organization.name })}</Button>\n </AccountSection>\n )\n}\n\n/**\n * The organization one works in: its details, whether its calls take guests, and handing it over, leaving and deleting\n * it, as one's role allows.\n */\nexport const OrganizationPage = ({ current, basePath, onChanged }: { current?: CurrentOrganization; basePath: string; onChanged: () => void }) => {\n const calls = useMeta().data?.calls === true\n const t = useOrganizationText()\n const organization = current?.organization\n if (!organization) {\n return (\n <div className=\"mx-auto w-full max-w-3xl px-4 py-6 md:px-6\">\n <PageHeader title={t('organization')} subtitle={t('noOrganization')} />\n </div>\n )\n }\n const owner = current.role === 'owner'\n return (\n <div className=\"mx-auto flex w-full max-w-3xl flex-col gap-4 px-4 py-6 md:px-6\">\n <PageHeader title={organization.name} subtitle={current.role ? text('youAre', { role: organizationRoleLabel(current.role).toLowerCase() }) : text('throughGlobalRoles')} />\n <Details key={`${organization.name}/${organization.slug}`} organization={organization} editable={managesOrganization(current)} onSaved={onChanged} />\n {calls && current.role && <GuestLinks editable={managesOrganization(current)} />}\n {owner && current.memberId && <HandOver organization={organization} memberId={current.memberId} />}\n {current.role && <Leave organization={organization} basePath={basePath} owner={owner} />}\n {owner && <Delete organization={organization} basePath={basePath} />}\n </div>\n )\n}\n"],"mappings":"uxBAmBM0B,GAAW,CAAE,eAAc,WAAU,aAAsF,CAC/H,GAAM,CAAE,WAAYJ,EAAQ,EACtB,CAACK,EAAMC,IAAA,EAAW5B,EAAAA,SAAAA,CAAS6B,EAAa,IAAI,EAC5C,CAACC,EAAMC,IAAA,EAAW/B,EAAAA,SAAAA,CAAS6B,EAAa,IAAI,EAC5C,CAAE,OAAM,QAAO,OAAQlB,EAAU,EACjCqB,EAAUL,EAAK,KAAK,IAAME,EAAa,MAAQC,IAASD,EAAa,KAC3E,OACE,EAAAJ,EAAA,KAAA,CAACf,EAAD,CAAgB,MAAOQ,EAAK,SAAS,EAAG,YAAwBA,EAAXe,EAAgB,kBAA0B,iBAAiB,EAAhH,SAAA,EACE,EAAAR,EAAA,IAAA,CAACV,EAAD,CAAc,QAASmB,CAAQ,CAAA,GAC/B,EAAAT,EAAA,KAAA,CAAC,OAAD,CAAM,UAAU,kCAAkC,SAAW,GAAU,CAAEU,EAAM,eAAe,EAAGC,EAAS,SAAY,CAAE,MAAMC,EAAQ,cAAc,OAAOR,EAAa,GAAI,CAAE,KAAMF,EAAK,KAAK,EAAG,MAAK,CAAC,EAAGW,EAAQ,CAAE,CAAC,CAAE,EAAvN,SAAA,EACE,EAAAb,EAAA,IAAA,CAAChB,EAAD,CAAO,aAAYS,EAAK,MAAM,EAAG,MAAOS,EAAM,SA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AA,CACnE,CAAA,EAGT,IAAMyD,EAAQG,EAAQ,OAAS,QAC/B,OACE,EAAAvC,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,iEAAf,SAAA,EACE,EAAAA,EAAA,IAAA,CAACF,EAAD,CAAY,MAAOM,EAAa,KAAM,SAAUmC,EAAQ,KAAO9C,EAAK,SAAU,CAAE,KAAMF,EAAsBgD,EAAQ,IAAI,CAAC,CAAC,YAAY,CAAE,CAAC,EAAI9C,EAAK,oBAAoB,CAAI,CAAA,GAC1K,EAAAO,EAAA,IAAA,CAACC,EAAD,CAAyE,eAAc,SAAUZ,EAAoBkD,CAAO,EAAG,QAASC,CAAY,EAAtI,GAAGpC,EAAa,KAAK,GAAGA,EAAa,MAAiG,EACnJkC,GAASC,EAAQ,OAAQ,EAAAvC,EAAA,IAAA,CAAC8B,EAAD,CAAY,SAAUzC,EAAoBkD,CAAO,CAAI,CAAA,EAC9EH,GAASG,EAAQ,WAAY,EAAAvC,EAAA,IAAA,CAACe,EAAD,CAAwB,eAAc,SAAUwB,EAAQ,QAAW,CAAA,EAChGA,EAAQ,OAAQ,EAAAvC,EAAA,IAAA,CAACmC,EAAD,CAAqB,eAAwB,WAAiB,OAAQ,CAAA,EACtFC,IAAS,EAAApC,EAAA,IAAA,CAACuB,EAAD,CAAsB,eAAwB,UAAW,CAAA,CAChE,GAET","debugId":"ea627689-4652-4924-9f1a-caec4fc09aef"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organizations-page-DeNhUQDU.js","names":["useState","useCallback","n","a","t","__toESM","require_react","require_jsx_runtime","reopenIn","isAdmin","AccountSection","useAction","useOrganizationText","SectionError","Badge","text","Button","useAuth","PageHeader","PagedSearchList","usePagedSearch","MyInvitationRow","useJoinInvitation","NewOrganizationForm","useMyInvitations","import_react","import_jsx_runtime","OrganizationRow","organization","current","busy","onOpen","AllOrganizations","query","setQuery","search","session","term","offset","page","list","currentId","run","basePath","YourInvitations","read","invitations","error","joining","invitation","join","OrganizationsPage","settings","auth","user","mayCreate","state"],"sources":["../../../src/organizations/organization-row.tsx","../../../src/organizations/all-organizations.tsx","../../../src/organizations/organizations-page.tsx"],"sourcesContent":["import type { Organization } from '@protobase/client'\nimport { Badge } from '../primitives/badge'\nimport { Button } from '../primitives/button'\nimport { text } from './messages'\n\n/** An organization with Open, or a Current badge when the person works in it. */\nexport const OrganizationRow = ({ organization, current, busy, onOpen }: { organization: Organization; current: boolean; busy: boolean; onOpen: () => void }) => (\n <li className=\"flex items-center gap-3 px-3 py-2.5\">\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-medium\">{organization.name}</span>\n <span className=\"block text-xs text-muted-foreground\">{organization.slug}</span>\n </span>\n {current ? <Badge tone=\"green\">{text('current')}</Badge> : <Button size=\"sm\" loading={busy} onClick={onOpen}>{text('open')}</Button>}\n </li>\n)\n","import { useCallback, useState } from 'react'\nimport { useAuth } from '../auth/auth-provider'\nimport { PagedSearchList } from '../lists/paged-search-list'\nimport { usePagedSearch } from '../lists/use-paged-search'\nimport { OrganizationRow } from './organization-row'\nimport { useAction } from './use-action'\nimport { reopenIn } from './use-organizations'\nimport { text } from './messages'\nimport { useOrganizationText } from './organization-word'\n\n/** Every organization in the app for people with a global role, who may work in any of them. */\nexport const AllOrganizations = ({ basePath, currentId }: { basePath: string; currentId?: string }) => {\n const { session } = useAuth()\n const t = useOrganizationText()\n const [query, setQuery] = useState('')\n const search = useCallback((term: string, offset: number) => session.organizations.search(term, offset).then((page) => ({ items: page.organizations, total: page.total })), [session])\n const list = usePagedSearch(search, query)\n const { busy, error, run } = useAction()\n return (\n <PagedSearchList\n title={t('allOrganizations')}\n description={t('allOrganizationsDescription')}\n searchLabel={t('findOrganization')}\n placeholder={text('nameOrSlug')}\n query={query}\n onQuery={setQuery}\n list={list}\n error={error}\n renderRow={(organization) => (\n <OrganizationRow key={organization.id} organization={organization} current={organization.id === currentId} busy={busy} onOpen={() => void run(async () => { await session.organizations.switchTo(organization.id); reopenIn(basePath) })} />\n )}\n />\n )\n}\n","import { AccountSection, SectionError } from '../account/account-section'\nimport { PageHeader } from '../app-shell'\nimport { useAuth } from '../auth/auth-provider'\nimport { isAdmin } from '../auth/user-to-shell'\nimport { AllOrganizations } from './all-organizations'\nimport { MyInvitationRow } from './my-invitation-row'\nimport { NewOrganizationForm } from './new-organization-form'\nimport { OrganizationRow } from './organization-row'\nimport { useOrganizationText } from './organization-word'\nimport { useAction } from './use-action'\nimport { useJoinInvitation } from './use-join-invitation'\nimport { useMyInvitations } from './use-my-invitations'\nimport { reopenIn, type OrganizationsState } from './use-organizations'\n\n/** The invitations for the person's own address, each to join, which opens the app in its organization. */\nconst YourInvitations = ({ basePath }: { basePath: string }) => {\n const t = useOrganizationText()\n const read = useMyInvitations()\n const invitations = read.state === 'ready' ? read.invitations : undefined\n const { busy, error, joining, join } = useJoinInvitation(() => reopenIn(basePath))\n if (!invitations || invitations.length === 0) return null\n return (\n <AccountSection title={t('invitationsForYou')} description={t('invitationsForYouDescription')}>\n <SectionError message={error} />\n <ul className=\"divide-y rounded-md border\">\n {invitations.map((invitation) => (\n <MyInvitationRow key={invitation.id} invitation={invitation} t={t} busy={busy} joining={joining === invitation.id} onJoin={() => join(invitation.id)} />\n ))}\n </ul>\n </AccountSection>\n )\n}\n\n/**\n * The person's organizations: switching between them, making a new one when the app allows it, and for people with a\n * global role every organization. Someone in none sees their invitations here.\n */\nexport const OrganizationsPage = ({ state, basePath }: { state: OrganizationsState; basePath: string }) => {\n const { session, organizations: settings, state: auth } = useAuth()\n const t = useOrganizationText()\n const { busy, error, run } = useAction()\n const user = auth.kind === 'signed-in' ? auth.user : undefined\n const mayCreate = settings?.create === 'everyone' || (user !== undefined && isAdmin(user))\n const currentId = state.current?.organization?.id\n return (\n <div className=\"mx-auto flex w-full max-w-3xl flex-col gap-4 px-4 py-6 md:px-6\">\n <PageHeader title={t('organizations')} subtitle={t('organizationsSubtitle')} />\n <AccountSection title={t('yourOrganizations')} description={state.organizations.length > 0 ? t('memberOf') : t('notMember')}>\n <SectionError message={error ?? state.error} />\n {state.organizations.length > 0 && (\n <ul className=\"divide-y rounded-md border\">\n {state.organizations.map((organization) => (\n <OrganizationRow key={organization.id} organization={organization} current={organization.id === currentId} busy={busy} onOpen={() => void run(async () => { await session.organizations.switchTo(organization.id); reopenIn(basePath) })} />\n ))}\n </ul>\n )}\n </AccountSection>\n <YourInvitations basePath={basePath} />\n {mayCreate && (\n <AccountSection title={t('newOrganization')} description={t('newOrganizationDescription')}>\n <NewOrganizationForm onCreated={() => reopenIn(basePath)} />\n </AccountSection>\n )}\n {(state.current?.globalRoles.length ?? 0) > 0 && <AllOrganizations basePath={basePath} currentId={currentId} />}\n </div>\n )\n}\n"],"mappings":"o3BAMa2B,GAAmB,CAAE,eAAc,UAAS,OAAM,aAC7D,EAAAD,EAAA,KAAA,CAAC,KAAD,CAAI,UAAU,sCAAd,SAAA,EACE,EAAAA,EAAA,KAAA,CAAC,OAAD,CAAM,UAAU,iBAAhB,SAAA,EACE,EAAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,6BAA8B,SAAAE,EAAa,IAAW,CAAA,GACtE,EAAAF,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,sCAAuC,SAAAE,EAAa,IAAW,CAAA,CAC3E,CACL,CAAA,EAAAC,GAAU,EAAAH,EAAA,IAAA,CAACZ,EAAD,CAAO,KAAK,QAAS,SAAAC,EAAK,SAAS,CAAS,CAAA,GAAI,EAAAW,EAAA,IAAA,CAACV,EAAD,CAAQ,KAAK,KAAK,QAASc,EAAM,QAASC,EAAS,SAAAhB,EAAK,MAAM,CAAU,CAAA,CACjI,ICFOiB,GAAoB,CAAE,WAAU,eAA0D,CACrG,GAAM,CAAE,WAAYf,EAAQ,EACtBb,EAAIQ,EAAoB,EACxB,CAACqB,EAAOC,IAAA,EAAYlC,EAAAA,SAAAA,CAAS,EAAE,EAC/BmC,GAAA,EAASlC,EAAAA,YAAAA,EAAa,EAAc,IAAmB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D,CAAgB,MAAON,EAAE,iBAAiB,EAAG,YAAaA,EAAE,4BAA4B,EACtF,UAAA,EAAAsB,EAAA,IAAA,CAACH,EAAD,CAAqB,cAAiBf,EAASmC,CAAQ,CAAI,CAAA,CAC7C,CAAA,GAEhBa,EAAM,SAAS,YAAY,QAAU,GAAK,IAAK,EAAA9B,EAAA,IAAA,CAACM,EAAD,CAA4B,WAAqB,WAAY,CAAA,CAC3G,GAET","debugId":"de361510-0d4c-48ba-b46e-86f8cfdb3fce"}
|
|
1
|
+
{"version":3,"file":"organizations-page-Dm5Y0fGB.js","names":["useState","useCallback","n","a","t","__toESM","require_react","require_jsx_runtime","reopenIn","isAdmin","AccountSection","useAction","useOrganizationText","SectionError","Badge","text","Button","useAuth","PageHeader","PagedSearchList","usePagedSearch","MyInvitationRow","useJoinInvitation","NewOrganizationForm","useMyInvitations","import_react","import_jsx_runtime","OrganizationRow","organization","current","busy","onOpen","AllOrganizations","query","setQuery","search","session","term","offset","page","list","currentId","run","basePath","YourInvitations","read","invitations","error","joining","invitation","join","OrganizationsPage","settings","auth","user","mayCreate","state"],"sources":["../../../src/organizations/organization-row.tsx","../../../src/organizations/all-organizations.tsx","../../../src/organizations/organizations-page.tsx"],"sourcesContent":["import type { Organization } from '@protobase/client'\nimport { Badge } from '../primitives/badge'\nimport { Button } from '../primitives/button'\nimport { text } from './messages'\n\n/** An organization with Open, or a Current badge when the person works in it. */\nexport const OrganizationRow = ({ organization, current, busy, onOpen }: { organization: Organization; current: boolean; busy: boolean; onOpen: () => void }) => (\n <li className=\"flex items-center gap-3 px-3 py-2.5\">\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-medium\">{organization.name}</span>\n <span className=\"block text-xs text-muted-foreground\">{organization.slug}</span>\n </span>\n {current ? <Badge tone=\"green\">{text('current')}</Badge> : <Button size=\"sm\" loading={busy} onClick={onOpen}>{text('open')}</Button>}\n </li>\n)\n","import { useCallback, useState } from 'react'\nimport { useAuth } from '../auth/auth-provider'\nimport { PagedSearchList } from '../lists/paged-search-list'\nimport { usePagedSearch } from '../lists/use-paged-search'\nimport { OrganizationRow } from './organization-row'\nimport { useAction } from './use-action'\nimport { reopenIn } from './use-organizations'\nimport { text } from './messages'\nimport { useOrganizationText } from './organization-word'\n\n/** Every organization in the app for people with a global role, who may work in any of them. */\nexport const AllOrganizations = ({ basePath, currentId }: { basePath: string; currentId?: string }) => {\n const { session } = useAuth()\n const t = useOrganizationText()\n const [query, setQuery] = useState('')\n const search = useCallback((term: string, offset: number) => session.organizations.search(term, offset).then((page) => ({ items: page.organizations, total: page.total })), [session])\n const list = usePagedSearch(search, query)\n const { busy, error, run } = useAction()\n return (\n <PagedSearchList\n title={t('allOrganizations')}\n description={t('allOrganizationsDescription')}\n searchLabel={t('findOrganization')}\n placeholder={text('nameOrSlug')}\n query={query}\n onQuery={setQuery}\n list={list}\n error={error}\n renderRow={(organization) => (\n <OrganizationRow key={organization.id} organization={organization} current={organization.id === currentId} busy={busy} onOpen={() => void run(async () => { await session.organizations.switchTo(organization.id); reopenIn(basePath) })} />\n )}\n />\n )\n}\n","import { AccountSection, SectionError } from '../account/account-section'\nimport { PageHeader } from '../app-shell'\nimport { useAuth } from '../auth/auth-provider'\nimport { isAdmin } from '../auth/user-to-shell'\nimport { AllOrganizations } from './all-organizations'\nimport { MyInvitationRow } from './my-invitation-row'\nimport { NewOrganizationForm } from './new-organization-form'\nimport { OrganizationRow } from './organization-row'\nimport { useOrganizationText } from './organization-word'\nimport { useAction } from './use-action'\nimport { useJoinInvitation } from './use-join-invitation'\nimport { useMyInvitations } from './use-my-invitations'\nimport { reopenIn, type OrganizationsState } from './use-organizations'\n\n/** The invitations for the person's own address, each to join, which opens the app in its organization. */\nconst YourInvitations = ({ basePath }: { basePath: string }) => {\n const t = useOrganizationText()\n const read = useMyInvitations()\n const invitations = read.state === 'ready' ? read.invitations : undefined\n const { busy, error, joining, join } = useJoinInvitation(() => reopenIn(basePath))\n if (!invitations || invitations.length === 0) return null\n return (\n <AccountSection title={t('invitationsForYou')} description={t('invitationsForYouDescription')}>\n <SectionError message={error} />\n <ul className=\"divide-y rounded-md border\">\n {invitations.map((invitation) => (\n <MyInvitationRow key={invitation.id} invitation={invitation} t={t} busy={busy} joining={joining === invitation.id} onJoin={() => join(invitation.id)} />\n ))}\n </ul>\n </AccountSection>\n )\n}\n\n/**\n * The person's organizations: switching between them, making a new one when the app allows it, and for people with a\n * global role every organization. Someone in none sees their invitations here.\n */\nexport const OrganizationsPage = ({ state, basePath }: { state: OrganizationsState; basePath: string }) => {\n const { session, organizations: settings, state: auth } = useAuth()\n const t = useOrganizationText()\n const { busy, error, run } = useAction()\n const user = auth.kind === 'signed-in' ? auth.user : undefined\n const mayCreate = settings?.create === 'everyone' || (user !== undefined && isAdmin(user))\n const currentId = state.current?.organization?.id\n return (\n <div className=\"mx-auto flex w-full max-w-3xl flex-col gap-4 px-4 py-6 md:px-6\">\n <PageHeader title={t('organizations')} subtitle={t('organizationsSubtitle')} />\n <AccountSection title={t('yourOrganizations')} description={state.organizations.length > 0 ? t('memberOf') : t('notMember')}>\n <SectionError message={error ?? state.error} />\n {state.organizations.length > 0 && (\n <ul className=\"divide-y rounded-md border\">\n {state.organizations.map((organization) => (\n <OrganizationRow key={organization.id} organization={organization} current={organization.id === currentId} busy={busy} onOpen={() => void run(async () => { await session.organizations.switchTo(organization.id); reopenIn(basePath) })} />\n ))}\n </ul>\n )}\n </AccountSection>\n <YourInvitations basePath={basePath} />\n {mayCreate && (\n <AccountSection title={t('newOrganization')} description={t('newOrganizationDescription')}>\n <NewOrganizationForm onCreated={() => reopenIn(basePath)} />\n </AccountSection>\n )}\n {(state.current?.globalRoles.length ?? 0) > 0 && <AllOrganizations basePath={basePath} currentId={currentId} />}\n </div>\n )\n}\n"],"mappings":"o3BAMa2B,GAAmB,CAAE,eAAc,UAAS,OAAM,aAC7D,EAAAD,EAAA,KAAA,CAAC,KAAD,CAAI,UAAU,sCAAd,SAAA,EACE,EAAAA,EAAA,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,EAAD,CAAgB,MAAON,EAAE,mBAAmB,EAAG,YAAaoD,EAAM,cAAc,OAAS,EAAIpD,EAAE,UAAU,EAAIA,EAAE,WAAW,EAA1H,SAAA,EACE,EAAAsB,EAAA,IAAA,CAACb,EAAD,CAAc,QAASkC,GAASS,EAAM,KAAQ,CAAA,EAC7CA,EAAM,cAAc,OAAS,IAC5B,EAAA9B,EAAA,IAAA,CAAC,KAAD,CAAI,UAAU,6BACX,SAAA8B,EAAM,cAAc,IAAK,IACxB,EAAA9B,EAAA,IAAA,CAACC,EAAD,CAAqD,eAAc,QAASC,EAAa,KAAOa,EAAiB,OAAM,WAAc,KAAKC,EAAI,SAAY,CAAE,MAAMN,EAAQ,cAAc,SAASR,EAAa,EAAE,EAAGpB,EAASmC,CAAQ,CAAE,CAAC,CAAI,EAArNf,EAAa,EAAwM,CAC5O,CACC,CAAA,CAEQ,KAChB,EAAAF,EAAA,IAAA,CAACkB,EAAD,CAA2B,UAAW,CAAA,EACrCW,IACC,EAAA7B,EAAA,IAAA,CAAChB,EAAD,CAAgB,MAAON,EAAE,iBAAiB,EAAG,YAAaA,EAAE,4BAA4B,EACtF,UAAA,EAAAsB,EAAA,IAAA,CAACH,EAAD,CAAqB,cAAiBf,EAASmC,CAAQ,CAAI,CAAA,CAC7C,CAAA,GAEhBa,EAAM,SAAS,YAAY,QAAU,GAAK,IAAK,EAAA9B,EAAA,IAAA,CAACM,EAAD,CAA4B,WAAqB,WAAY,CAAA,CAC3G,GAET","debugId":"e6e58d1f-1816-4021-afad-51588660b2d5"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pending-invitation-row-
|
|
1
|
+
{"version":3,"file":"pending-invitation-row-Ce5VDMYl.js","names":["useState","useState","n","a","t","__toESM","require_react","require_jsx_runtime","formatTag","Input","AccountSection","useAction","messages","SectionError","Button","import_react","text","import_jsx_runtime","LinkNotice","link","InviteForm","email","setEmail","setLink","invite","run","onInvite","error","event","beside","busy","incomplete","children","PendingInvitationRow","expired","expiresAt","gives","onResend","onRevoke"],"sources":["../../../src/invitations/messages.ts","../../../src/invitations/link-notice.tsx","../../../src/invitations/invite-form.tsx","../../../src/invitations/pending-invitation-row.tsx"],"sourcesContent":["import { messages } from '../locale/messages'\n\nexport const text = messages('invitations')\n","import { text } from './messages'\n\n/** The invitation link to pass on, when the app cannot email it. */\nexport const LinkNotice = ({ link }: { link?: string }) =>\n link ? (\n <p className=\"mt-3 break-all rounded-md border bg-muted px-3 py-2 text-xs\">\n {text.rich('passLinkOn', { link: <span className=\"font-mono\">{link}</span> })}\n </p>\n ) : null\n","import { useState, type ReactNode } from 'react'\nimport { AccountSection, SectionError } from '../account/account-section'\nimport { useAction } from '../organizations/use-action'\nimport { Button } from '../primitives/button'\nimport { Input } from '../primitives/input'\nimport { LinkNotice } from './link-notice'\nimport { text } from './messages'\n\nexport type InviteFormProps = {\n title: string\n description: string\n /** Sends the invitation, with the roles the form's controls hold; answers its link when the app cannot email it. */\n onInvite: (email: string) => Promise<{ link?: string }>\n /** Controls on the line of the address, before Invite, such as a role to choose. */\n beside?: ReactNode\n /** The lines under it, such as the roles to give. */\n children?: ReactNode\n /** Keeps Invite off while the controls do not say enough yet, such as no role chosen. */\n incomplete?: boolean\n}\n\n/** Inviting an address: the address, the controls for what the invitation gives, Invite, and the link without mail. */\nexport const InviteForm = ({ title, description, onInvite, beside, children, incomplete = false }: InviteFormProps) => {\n const [email, setEmail] = useState('')\n const [link, setLink] = useState<string>()\n const { busy, error, run } = useAction()\n const invite = () =>\n run(async () => {\n setLink((await onInvite(email.trim())).link)\n setEmail('')\n })\n return (\n <AccountSection title={title} description={description}>\n <SectionError message={error} />\n <form className=\"flex flex-col gap-3\" onSubmit={(event) => { event.preventDefault(); void invite() }}>\n <div className=\"flex flex-col gap-2 sm:flex-row\">\n <Input aria-label={text('email')} type=\"email\" placeholder=\"name@example.com\" value={email} onChange={(event) => setEmail(event.target.value)} wrapperClassName=\"flex-1\" />\n {beside}\n <Button type=\"submit\" variant=\"primary\" loading={busy} disabled={!email.trim() || incomplete}>{text('invite')}</Button>\n </div>\n {children}\n </form>\n <LinkNotice link={link} />\n </AccountSection>\n )\n}\n","import { useState } from 'react'\nimport { SectionError } from '../account/account-section'\nimport { useAction } from '../organizations/use-action'\nimport { Button } from '../primitives/button'\nimport { LinkNotice } from './link-notice'\nimport { formatTag } from '../locale/active-locale'\nimport { text } from './messages'\n\nexport type PendingInvitationRowProps = {\n email: string\n /** What the invitation gives, in words: its roles. */\n gives: string\n expiresAt: string\n /** Sends it again with a new link, which replaces the earlier one; answers the link when the app cannot email it. */\n onResend: () => Promise<{ link?: string }>\n onRevoke: () => Promise<void>\n}\n\n/** An invitation not accepted yet: to whom, what it gives and until when, with Send again and Revoke. */\nexport const PendingInvitationRow = ({ email, gives, expiresAt, onResend, onRevoke }: PendingInvitationRowProps) => {\n const [link, setLink] = useState<string>()\n const { busy, error, run } = useAction()\n const expired = new Date(expiresAt).getTime() < Date.now()\n return (\n <li className=\"px-3 py-2.5\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-medium\">{email}</span>\n <span className=\"block text-xs text-muted-foreground\">\n {gives} · {expired ? text('expired') : text('until', { date: new Date(expiresAt).toLocaleDateString(formatTag()) })}\n </span>\n </span>\n <Button size=\"sm\" loading={busy} onClick={() => void run(async () => setLink((await onResend()).link))}>{text('sendAgain')}</Button>\n <Button size=\"sm\" variant=\"danger\" loading={busy} onClick={() => void run(onRevoke)}>{text('revoke')}</Button>\n </div>\n <SectionError message={error} />\n <LinkNotice link={link} />\n </li>\n )\n}\n"],"mappings":"+pBAEagB,EAAOJ,EAAS,aAAa,aCC7BM,GAAc,CAAE,UAC3BC,GACE,EAAAF,EAAA,IAAA,CAAC,IAAD,CAAG,UAAU,8DACV,SAAAD,EAAK,KAAK,aAAc,CAAE,MAAM,EAAAC,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,YAAa,SAAAE,CAAW,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version":3,"file":"period-chart-BDqtO8mc.js","names":["dayMs","dayAndClock","useState","n","a","t","__toESM","require_react","require_jsx_runtime","formatTag","useMediaQuery","viewerZone","zoneOffset","cachedFormat","text","measureText","XAxis","CartesianGrid","Tooltip","ResponsiveContainer","YAxis","BarChart","Bar","LineChart","Line","Cell","LegendItem","import_react","dayMs$1","dayAndClock$1","date","dayAndMonth","pointFormats","formatOf","options","tag","periodEnd","start","at","bucket","isCurrent","end","now","periodText","sameYear","point","import_jsx_runtime","PeriodTable","parts","series","total","measure","part","points","clock","dayAndClock","formats","formatterOf","format","ms","axisTick","dayMs","withinDay","tickFormat","span","wallNow","PointTooltip","payload","active","currentBar","color","focusRing","PeriodChart","wide","closed","setClosed","current","tick","grid","x","y","value","tooltip","type","dot","cx","cy","index","onKeyDown","event","open","surface","chart","compact","resource"],"sources":["../../../src/app/charts/period-text.ts","../../../src/app/charts/period-table.tsx","../../../src/app/charts/period-chart.tsx"],"sourcesContent":["import { cachedFormat } from '../../format/intl-cache'\nimport type { PeriodBucket } from './period-types'\nimport { text } from './messages'\n\nconst dayMs = 86_400_000\n\nconst clock = { hour: '2-digit', minute: '2-digit', hour12: false } as const\nconst dayAndClock = { day: 'numeric', month: 'short', ...clock } as const\nconst date = { day: 'numeric', month: 'short', year: 'numeric' } as const\nconst dayAndMonth = { day: 'numeric', month: 'short' } as const\n\n// What a bucket that is one moment or one day names: its start\nconst pointFormats: Partial<Record<PeriodBucket, Intl.DateTimeFormatOptions>> = {\n minute: dayAndClock,\n '5_minutes': dayAndClock,\n '15_minutes': dayAndClock,\n hour: dayAndClock,\n day: date,\n year: { year: 'numeric' },\n}\n\nconst formatOf = (options: Intl.DateTimeFormatOptions) => cachedFormat(`period:${JSON.stringify(options)}`, (tag) => new Intl.DateTimeFormat(tag, { ...options, timeZone: 'UTC' }))\n\n/** When the bucket starting at `at` ends, the start of the next one; a bucket shorter than a day, a moment, has none. */\nexport const periodEnd = (at: number, bucket: PeriodBucket) => {\n const start = new Date(at)\n if (bucket === 'day') return at + dayMs\n if (bucket === 'week') return at + 7 * dayMs\n if (bucket === 'month') return Date.UTC(start.getUTCFullYear(), start.getUTCMonth() + 1, 1)\n if (bucket === 'year') return Date.UTC(start.getUTCFullYear() + 1, 0, 1)\n return\n}\n\n/** Whether the bucket starting at `at` is still running at `now`: the period it covers has not ended yet. */\nexport const isCurrent = (at: number, bucket: PeriodBucket, now: number) => {\n const end = periodEnd(at, bucket)\n return at <= now && (end === undefined ? false : now < end)\n}\n\n/**\n * What a chart's bucket covers, as its tooltip and table name it: a week or month from its first to its last day, such\n * as \"24 – 30 Aug 2026\", and the one still running up to today, \"9 Nov to today\"; a year its number until it runs, a\n * day its date until it is today, and a shorter bucket its start. `at` and `now` are wall-clock times written as UTC milliseconds, as the points are.\n */\nexport const periodText = (at: number, bucket: PeriodBucket, now: number) => {\n if (isCurrent(at, bucket, now)) {\n if (bucket === 'day') return text('today')\n const sameYear = new Date(at).getUTCFullYear() === new Date(now).getUTCFullYear()\n return text('toToday', { start: formatOf(sameYear ? dayAndMonth : date).format(at) })\n }\n const point = pointFormats[bucket]\n if (point) return formatOf(point).format(at)\n const end = periodEnd(at, bucket)\n if (end === undefined) throw new Error(`A ${bucket} bucket has no period to name`)\n return formatOf(date).formatRange(at, end - dayMs)\n}\n","import { measureText, type ChartMeasure } from './chart-groups'\nimport { text } from './messages'\nimport type { PeriodBucket, Point } from './period-types'\nimport { periodText } from './period-text'\nimport type { ChartSeries } from './split-points'\n\n/**\n * A chart's buckets and their numbers as a table only a screen reader reads: per bucket its period and what its tooltip\n * shows, each part of a split and the total where the parts add up to one.\n */\nexport const PeriodTable = ({ points, measure, bucket, now, series }: { points: Point[]; measure: ChartMeasure; bucket: PeriodBucket; now: number; series?: ChartSeries[] }) => {\n const parts = series ?? []\n const total = !series || measure.kind === 'count' || measure.kind === 'sum'\n // A table sizes to its content whatever its width, so the box that hides it is a block around it\n return (\n <div className=\"sr-only\">\n <table>\n <thead>\n <tr>\n <th scope=\"col\">{text('period')}</th>\n {parts.map((part) => (\n <th key={part.key} scope=\"col\">\n {part.label}\n </th>\n ))}\n {total && <th scope=\"col\">{text(measure.kind)}</th>}\n </tr>\n </thead>\n <tbody>\n {points.map((point) => (\n <tr key={point.at}>\n <th scope=\"row\">{periodText(point.at, bucket, now)}</th>\n {parts.map((part) => (\n <td key={part.key}>{measureText(point[part.key] ?? null, part.measure ?? measure)}</td>\n ))}\n {total && <td>{measureText(point.value, measure)}</td>}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )\n}\n","import { useState, type KeyboardEvent } from 'react'\nimport { Bar, BarChart, CartesianGrid, Cell, Line, LineChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts'\nimport { useMediaQuery } from '../../lib/use-media-query'\nimport type { ViewModel } from '@protobase/schema'\nimport { measureText, type ChartMeasure } from './chart-groups'\nimport { LegendItem } from './legend-item'\nimport type { ChartSeries } from './split-points'\nimport { formatTag } from '../../locale/active-locale'\nimport { viewerZone, zoneOffset } from '../../format/zone'\nimport { text } from './messages'\nimport { PeriodTable } from './period-table'\nimport { isCurrent, periodText } from './period-text'\nimport type { PeriodBucket, Point } from './period-types'\n\nconst clock = { hour: '2-digit', minute: '2-digit', hour12: false } as const\nconst dayAndClock = { day: 'numeric', month: 'short', ...clock } as const\n\nconst formats: Record<PeriodBucket, Intl.DateTimeFormatOptions> = {\n minute: clock,\n '5_minutes': clock,\n '15_minutes': clock,\n hour: clock,\n day: { day: 'numeric', month: 'short' },\n week: { day: 'numeric', month: 'short' },\n month: { month: 'short', year: '2-digit' },\n year: { year: 'numeric' },\n}\n\nconst formatterOf = (options: Intl.DateTimeFormatOptions) => {\n const format = new Intl.DateTimeFormat(formatTag(), { ...options, timeZone: 'UTC' })\n return (ms: number) => format.format(ms)\n}\n\nconst axisTick = { fontSize: '0.6875rem', fill: 'var(--muted-foreground)' }\n\nconst dayMs = 86_400_000\nconst withinDay: ReadonlySet<PeriodBucket> = new Set(['minute', '5_minutes', '15_minutes', 'hour'])\n\n// Buckets shorter than a day name their time, and their day too once the points span more than one\nconst tickFormat = (bucket: PeriodBucket, points: Point[]) => {\n const span = points.length > 1 ? points.at(-1)!.at - points[0]!.at : 0\n return withinDay.has(bucket) && span >= dayMs ? dayAndClock : formats[bucket]\n}\n\n// Now on the viewer's wall clock, written as UTC milliseconds as the points' bucket starts are\nconst wallNow = () => {\n const now = Date.now()\n return now + zoneOffset(now, viewerZone())\n}\n\nconst PointTooltip = ({ active, payload, measure, bucket, now, series }: { active?: boolean; payload?: Array<{ payload: Point }>; measure: ChartMeasure; bucket: PeriodBucket; now: number; series?: ChartSeries[] }) => {\n const point = payload?.[0]?.payload\n if (!active || !point) return null\n return (\n <div className=\"rounded-md border bg-background px-2.5 py-1.5 text-xs shadow-pop\">\n <div className=\"text-muted-foreground\">{periodText(point.at, bucket, now)}</div>\n {series?.map((part) => (\n <div key={part.key} className=\"flex items-center gap-2\">\n <span className=\"size-2 shrink-0 rounded-full\" style={{ background: part.color }} aria-hidden />\n <span className=\"flex-1\">{part.label}</span>\n <span className=\"font-semibold tabular-nums\">{measureText(point[part.key] ?? null, part.measure ?? measure)}</span>\n </div>\n ))}\n {series && (measure.kind === 'count' || measure.kind === 'sum') && <div className=\"mt-0.5 border-t pt-0.5 font-semibold tabular-nums\">{measureText(point.value, measure)}</div>}\n {!series && <div className=\"font-semibold tabular-nums\">{measureText(point.value, measure)}</div>}\n </div>\n )\n}\n\n// The current bucket's bar, still filling up: outlined with a dash and filled faintly, so it does not read as a drop\nconst currentBar = (color: string) => ({ fillOpacity: 0.35, stroke: color, strokeWidth: 1.5, strokeDasharray: '3 2' })\n\n// The surface the keyboard reads, with the focus ring every control shows\nconst focusRing = '[&_.recharts-surface]:rounded-sm [&_.recharts-surface:focus-visible]:outline-2 [&_.recharts-surface:focus-visible]:outline-offset-2 [&_.recharts-surface:focus-visible]:outline-primary'\n\n/**\n * A date field's buckets over time, as bars or a line; a bucket without a value to add up is a gap. The bucket still\n * running is drawn hollow. The chart takes focus: the arrow keys move its tooltip from bucket to bucket and Escape\n * closes it, and a table only a screen reader reads holds the same numbers. A compact chart is lower, for a list's header.\n */\nexport const PeriodChart = ({ points, measure, bucket, type, series, resource, view, compact }: { points: Point[]; measure: ChartMeasure; bucket: PeriodBucket; type: 'bar' | 'line'; series?: ChartSeries[]; resource?: string; view?: ViewModel; compact?: boolean }) => {\n const wide = useMediaQuery('(min-width: 640px)')\n const [closed, setClosed] = useState(false)\n const now = wallNow()\n const current = points.findIndex((point) => isCurrent(point.at, bucket, now))\n const tick = formatterOf(tickFormat(bucket, points))\n const grid = <CartesianGrid vertical={false} stroke=\"var(--border)\" />\n const x = <XAxis dataKey=\"at\" tickFormatter={tick} tick={axisTick} axisLine={false} tickLine={false} minTickGap={wide ? 24 : 40} height={18} />\n const y = <YAxis width={wide ? 48 : 36} tick={axisTick} axisLine={false} tickLine={false} tickCount={3} tickFormatter={(value: number) => value.toLocaleString(formatTag(), { notation: 'compact' })} />\n const tooltip = <Tooltip {...(closed && { active: false })} cursor={type === 'bar' ? { fill: 'var(--muted)' } : { stroke: 'var(--border-strong)' }} content={<PointTooltip measure={measure} bucket={bucket} now={now} {...(series && { series })} />} isAnimationActive={false} />\n const parts = series ?? [{ key: 'value', label: '', color: 'var(--chart-1)' }]\n const dot = (color: string) => ({ cx, cy, index }: { cx?: number; cy?: number; index: number }) => {\n if (cx === undefined || cy === undefined) return null\n if (index === current) return <circle cx={cx} cy={cy} r={3.5} fill=\"var(--background)\" stroke={color} strokeWidth={2} />\n return points.length <= 31 ? <circle cx={cx} cy={cy} r={3} fill={color} /> : null\n }\n // Escape closes the tooltip the arrow keys opened; a key that moves it or a pointer opens it again\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => setClosed(event.key === 'Escape')\n const open = () => setClosed(false)\n const surface = { 'aria-label': text('chartKeys') }\n const chart = (\n <div className={`${compact ? 'h-24' : 'h-40'} ${focusRing}`} onKeyDown={onKeyDown} onPointerMove={open} onFocus={open}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n {type === 'line' ? (\n <LineChart data={points} margin={{ top: 6, right: 6, bottom: 0, left: 0 }} {...surface}>\n {grid}\n {x}\n {y}\n {tooltip}\n {parts.map((part) => (\n <Line key={part.key} dataKey={part.key} stroke={part.color} strokeWidth={2} dot={dot(part.color)} activeDot={{ r: 4, stroke: 'var(--background)', strokeWidth: 2 }} isAnimationActive={false} />\n ))}\n </LineChart>\n ) : (\n <BarChart data={points} margin={{ top: 6, right: 0, bottom: 0, left: 0 }} barCategoryGap=\"22%\" {...surface}>\n {grid}\n {x}\n {y}\n {tooltip}\n {parts.map((part, index) => (\n <Bar key={part.key} dataKey={part.key} fill={part.color} {...(series && { stackId: 'split' })} radius={index === parts.length - 1 ? [4, 4, 0, 0] : 0} isAnimationActive={false}>\n {points.map((point, at) => (\n <Cell key={point.at} {...(at === current && currentBar(part.color))} />\n ))}\n </Bar>\n ))}\n </BarChart>\n )}\n </ResponsiveContainer>\n <PeriodTable points={points} measure={measure} bucket={bucket} now={now} {...(series && { series })} />\n </div>\n )\n if (!series || resource === undefined) return chart\n return (\n <div className=\"flex flex-col gap-2\">\n {chart}\n <ul className=\"flex flex-wrap gap-x-3 gap-y-0.5 text-sm\">\n {series.map((part) => (\n <LegendItem key={part.key} resource={resource} view={view} color={part.color} label={part.label} {...(part.filter !== undefined && { filter: part.filter })} />\n ))}\n </ul>\n </div>\n )\n}\n"],"mappings":"o2BAIMA,EAAQ,MAGRC,EAAc,CAAE,IAAK,UAAW,MAAO,QAD7B,KAAM,UAAW,OAAQ,UAAW,OAAQ,EACG,EACzD6B,EAAO,CAAE,IAAK,UAAW,MAAO,QAAS,KAAM,SAAU,EACzDC,EAAc,CAAE,IAAK,UAAW,MAAO,OAAQ,EAG/CC,EAA0E,CAC9E,OAAQ/B,EACR,YAAaA,EACb,aAAcA,EACd,KAAMA,EACN,IAAK6B,EACL,KAAM,CAAE,KAAM,SAAU,CAC1B,EAEMG,EAAY,G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EAAM,EAAqD,CACvE,CACE,EAJKO,EAAK,GAIV,CACN,CACO,GAEO,CAAA,GACrB,EAAAN,EAAA,IAAA,CAACC,EAAD,CAAqB,SAAiB,UAAiB,SAAa,MAAK,GAAKE,GAAU,CAAE,QAAO,CAAK,CAAA,CACnG,IAGP,MADI,CAACA,GAAU6C,IAAa,IAAA,GAAkBF,GAE5C,EAAA9C,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,sBAAf,SAAA,CACG8C,GACD,EAAA9C,EAAA,IAAA,CAAC,KAAD,CAAI,UAAU,2CACX,SAAAG,EAAO,IAAK,IACX,EAAAH,EAAA,IAAA,CAACpB,EAAD,CAAqC,WAAgB,OAAM,MAAO0B,EAAK,MAAO,MAAOA,EAAK,MAAO,GAAKA,EAAK,SAAW,IAAA,IAAa,CAAE,OAAQA,EAAK,MAAO,CAAK,EAA7IA,EAAK,GAAwI,CAC/J,CACC,CAAA,CACD,GAET","debugId":"43aad3bc-99cd-4756-b0f7-b3f59b85bff6"}
|
|
1
|
+
{"version":3,"file":"period-chart-D3lbH2Ni.js","names":["dayMs","dayAndClock","useState","n","a","t","__toESM","require_react","require_jsx_runtime","formatTag","useMediaQuery","viewerZone","zoneOffset","cachedFormat","text","measureText","XAxis","CartesianGrid","Tooltip","ResponsiveContainer","YAxis","BarChart","Bar","LineChart","Line","Cell","LegendItem","import_react","dayMs$1","dayAndClock$1","date","dayAndMonth","pointFormats","formatOf","options","tag","periodEnd","start","at","bucket","isCurrent","end","now","periodText","sameYear","point","import_jsx_runtime","PeriodTable","parts","series","total","measure","part","points","clock","dayAndClock","formats","formatterOf","format","ms","axisTick","dayMs","withinDay","tickFormat","span","wallNow","PointTooltip","payload","active","currentBar","color","focusRing","PeriodChart","wide","closed","setClosed","current","tick","grid","x","y","value","tooltip","type","dot","cx","cy","index","onKeyDown","event","open","surface","chart","compact","resource"],"sources":["../../../src/app/charts/period-text.ts","../../../src/app/charts/period-table.tsx","../../../src/app/charts/period-chart.tsx"],"sourcesContent":["import { cachedFormat } from '../../format/intl-cache'\nimport type { PeriodBucket } from './period-types'\nimport { text } from './messages'\n\nconst dayMs = 86_400_000\n\nconst clock = { hour: '2-digit', minute: '2-digit', hour12: false } as const\nconst dayAndClock = { day: 'numeric', month: 'short', ...clock } as const\nconst date = { day: 'numeric', month: 'short', year: 'numeric' } as const\nconst dayAndMonth = { day: 'numeric', month: 'short' } as const\n\n// What a bucket that is one moment or one day names: its start\nconst pointFormats: Partial<Record<PeriodBucket, Intl.DateTimeFormatOptions>> = {\n minute: dayAndClock,\n '5_minutes': dayAndClock,\n '15_minutes': dayAndClock,\n hour: dayAndClock,\n day: date,\n year: { year: 'numeric' },\n}\n\nconst formatOf = (options: Intl.DateTimeFormatOptions) => cachedFormat(`period:${JSON.stringify(options)}`, (tag) => new Intl.DateTimeFormat(tag, { ...options, timeZone: 'UTC' }))\n\n/** When the bucket starting at `at` ends, the start of the next one; a bucket shorter than a day, a moment, has none. */\nexport const periodEnd = (at: number, bucket: PeriodBucket) => {\n const start = new Date(at)\n if (bucket === 'day') return at + dayMs\n if (bucket === 'week') return at + 7 * dayMs\n if (bucket === 'month') return Date.UTC(start.getUTCFullYear(), start.getUTCMonth() + 1, 1)\n if (bucket === 'year') return Date.UTC(start.getUTCFullYear() + 1, 0, 1)\n return\n}\n\n/** Whether the bucket starting at `at` is still running at `now`: the period it covers has not ended yet. */\nexport const isCurrent = (at: number, bucket: PeriodBucket, now: number) => {\n const end = periodEnd(at, bucket)\n return at <= now && (end === undefined ? false : now < end)\n}\n\n/**\n * What a chart's bucket covers, as its tooltip and table name it: a week or month from its first to its last day, such\n * as \"24 – 30 Aug 2026\", and the one still running up to today, \"9 Nov to today\"; a year its number until it runs, a\n * day its date until it is today, and a shorter bucket its start. `at` and `now` are wall-clock times written as UTC milliseconds, as the points are.\n */\nexport const periodText = (at: number, bucket: PeriodBucket, now: number) => {\n if (isCurrent(at, bucket, now)) {\n if (bucket === 'day') return text('today')\n const sameYear = new Date(at).getUTCFullYear() === new Date(now).getUTCFullYear()\n return text('toToday', { start: formatOf(sameYear ? dayAndMonth : date).format(at) })\n }\n const point = pointFormats[bucket]\n if (point) return formatOf(point).format(at)\n const end = periodEnd(at, bucket)\n if (end === undefined) throw new Error(`A ${bucket} bucket has no period to name`)\n return formatOf(date).formatRange(at, end - dayMs)\n}\n","import { measureText, type ChartMeasure } from './chart-groups'\nimport { text } from './messages'\nimport type { PeriodBucket, Point } from './period-types'\nimport { periodText } from './period-text'\nimport type { ChartSeries } from './split-points'\n\n/**\n * A chart's buckets and their numbers as a table only a screen reader reads: per bucket its period and what its tooltip\n * shows, each part of a split and the total where the parts add up to one.\n */\nexport const PeriodTable = ({ points, measure, bucket, now, series }: { points: Point[]; measure: ChartMeasure; bucket: PeriodBucket; now: number; series?: ChartSeries[] }) => {\n const parts = series ?? []\n const total = !series || measure.kind === 'count' || measure.kind === 'sum'\n // A table sizes to its content whatever its width, so the box that hides it is a block around it\n return (\n <div className=\"sr-only\">\n <table>\n <thead>\n <tr>\n <th scope=\"col\">{text('period')}</th>\n {parts.map((part) => (\n <th key={part.key} scope=\"col\">\n {part.label}\n </th>\n ))}\n {total && <th scope=\"col\">{text(measure.kind)}</th>}\n </tr>\n </thead>\n <tbody>\n {points.map((point) => (\n <tr key={point.at}>\n <th scope=\"row\">{periodText(point.at, bucket, now)}</th>\n {parts.map((part) => (\n <td key={part.key}>{measureText(point[part.key] ?? null, part.measure ?? measure)}</td>\n ))}\n {total && <td>{measureText(point.value, measure)}</td>}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )\n}\n","import { useState, type KeyboardEvent } from 'react'\nimport { Bar, BarChart, CartesianGrid, Cell, Line, LineChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts'\nimport { useMediaQuery } from '../../lib/use-media-query'\nimport type { ViewModel } from '@protobase/schema'\nimport { measureText, type ChartMeasure } from './chart-groups'\nimport { LegendItem } from './legend-item'\nimport type { ChartSeries } from './split-points'\nimport { formatTag } from '../../locale/active-locale'\nimport { viewerZone, zoneOffset } from '../../format/zone'\nimport { text } from './messages'\nimport { PeriodTable } from './period-table'\nimport { isCurrent, periodText } from './period-text'\nimport type { PeriodBucket, Point } from './period-types'\n\nconst clock = { hour: '2-digit', minute: '2-digit', hour12: false } as const\nconst dayAndClock = { day: 'numeric', month: 'short', ...clock } as const\n\nconst formats: Record<PeriodBucket, Intl.DateTimeFormatOptions> = {\n minute: clock,\n '5_minutes': clock,\n '15_minutes': clock,\n hour: clock,\n day: { day: 'numeric', month: 'short' },\n week: { day: 'numeric', month: 'short' },\n month: { month: 'short', year: '2-digit' },\n year: { year: 'numeric' },\n}\n\nconst formatterOf = (options: Intl.DateTimeFormatOptions) => {\n const format = new Intl.DateTimeFormat(formatTag(), { ...options, timeZone: 'UTC' })\n return (ms: number) => format.format(ms)\n}\n\nconst axisTick = { fontSize: '0.6875rem', fill: 'var(--muted-foreground)' }\n\nconst dayMs = 86_400_000\nconst withinDay: ReadonlySet<PeriodBucket> = new Set(['minute', '5_minutes', '15_minutes', 'hour'])\n\n// Buckets shorter than a day name their time, and their day too once the points span more than one\nconst tickFormat = (bucket: PeriodBucket, points: Point[]) => {\n const span = points.length > 1 ? points.at(-1)!.at - points[0]!.at : 0\n return withinDay.has(bucket) && span >= dayMs ? dayAndClock : formats[bucket]\n}\n\n// Now on the viewer's wall clock, written as UTC milliseconds as the points' bucket starts are\nconst wallNow = () => {\n const now = Date.now()\n return now + zoneOffset(now, viewerZone())\n}\n\nconst PointTooltip = ({ active, payload, measure, bucket, now, series }: { active?: boolean; payload?: Array<{ payload: Point }>; measure: ChartMeasure; bucket: PeriodBucket; now: number; series?: ChartSeries[] }) => {\n const point = payload?.[0]?.payload\n if (!active || !point) return null\n return (\n <div className=\"rounded-md border bg-background px-2.5 py-1.5 text-xs shadow-pop\">\n <div className=\"text-muted-foreground\">{periodText(point.at, bucket, now)}</div>\n {series?.map((part) => (\n <div key={part.key} className=\"flex items-center gap-2\">\n <span className=\"size-2 shrink-0 rounded-full\" style={{ background: part.color }} aria-hidden />\n <span className=\"flex-1\">{part.label}</span>\n <span className=\"font-semibold tabular-nums\">{measureText(point[part.key] ?? null, part.measure ?? measure)}</span>\n </div>\n ))}\n {series && (measure.kind === 'count' || measure.kind === 'sum') && <div className=\"mt-0.5 border-t pt-0.5 font-semibold tabular-nums\">{measureText(point.value, measure)}</div>}\n {!series && <div className=\"font-semibold tabular-nums\">{measureText(point.value, measure)}</div>}\n </div>\n )\n}\n\n// The current bucket's bar, still filling up: outlined with a dash and filled faintly, so it does not read as a drop\nconst currentBar = (color: string) => ({ fillOpacity: 0.35, stroke: color, strokeWidth: 1.5, strokeDasharray: '3 2' })\n\n// The surface the keyboard reads, with the focus ring every control shows\nconst focusRing = '[&_.recharts-surface]:rounded-sm [&_.recharts-surface:focus-visible]:outline-2 [&_.recharts-surface:focus-visible]:outline-offset-2 [&_.recharts-surface:focus-visible]:outline-primary'\n\n/**\n * A date field's buckets over time, as bars or a line; a bucket without a value to add up is a gap. The bucket still\n * running is drawn hollow. The chart takes focus: the arrow keys move its tooltip from bucket to bucket and Escape\n * closes it, and a table only a screen reader reads holds the same numbers. A compact chart is lower, for a list's header.\n */\nexport const PeriodChart = ({ points, measure, bucket, type, series, resource, view, compact }: { points: Point[]; measure: ChartMeasure; bucket: PeriodBucket; type: 'bar' | 'line'; series?: ChartSeries[]; resource?: string; view?: ViewModel; compact?: boolean }) => {\n const wide = useMediaQuery('(min-width: 640px)')\n const [closed, setClosed] = useState(false)\n const now = wallNow()\n const current = points.findIndex((point) => isCurrent(point.at, bucket, now))\n const tick = formatterOf(tickFormat(bucket, points))\n const grid = <CartesianGrid vertical={false} stroke=\"var(--border)\" />\n const x = <XAxis dataKey=\"at\" tickFormatter={tick} tick={axisTick} axisLine={false} tickLine={false} minTickGap={wide ? 24 : 40} height={18} />\n const y = <YAxis width={wide ? 48 : 36} tick={axisTick} axisLine={false} tickLine={false} tickCount={3} tickFormatter={(value: number) => value.toLocaleString(formatTag(), { notation: 'compact' })} />\n const tooltip = <Tooltip {...(closed && { active: false })} cursor={type === 'bar' ? { fill: 'var(--muted)' } : { stroke: 'var(--border-strong)' }} content={<PointTooltip measure={measure} bucket={bucket} now={now} {...(series && { series })} />} isAnimationActive={false} />\n const parts = series ?? [{ key: 'value', label: '', color: 'var(--chart-1)' }]\n const dot = (color: string) => ({ cx, cy, index }: { cx?: number; cy?: number; index: number }) => {\n if (cx === undefined || cy === undefined) return null\n if (index === current) return <circle cx={cx} cy={cy} r={3.5} fill=\"var(--background)\" stroke={color} strokeWidth={2} />\n return points.length <= 31 ? <circle cx={cx} cy={cy} r={3} fill={color} /> : null\n }\n // Escape closes the tooltip the arrow keys opened; a key that moves it or a pointer opens it again\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => setClosed(event.key === 'Escape')\n const open = () => setClosed(false)\n const surface = { 'aria-label': text('chartKeys') }\n const chart = (\n <div className={`${compact ? 'h-24' : 'h-40'} ${focusRing}`} onKeyDown={onKeyDown} onPointerMove={open} onFocus={open}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n {type === 'line' ? (\n <LineChart data={points} margin={{ top: 6, right: 6, bottom: 0, left: 0 }} {...surface}>\n {grid}\n {x}\n {y}\n {tooltip}\n {parts.map((part) => (\n <Line key={part.key} dataKey={part.key} stroke={part.color} strokeWidth={2} dot={dot(part.color)} activeDot={{ r: 4, stroke: 'var(--background)', strokeWidth: 2 }} isAnimationActive={false} />\n ))}\n </LineChart>\n ) : (\n <BarChart data={points} margin={{ top: 6, right: 0, bottom: 0, left: 0 }} barCategoryGap=\"22%\" {...surface}>\n {grid}\n {x}\n {y}\n {tooltip}\n {parts.map((part, index) => (\n <Bar key={part.key} dataKey={part.key} fill={part.color} {...(series && { stackId: 'split' })} radius={index === parts.length - 1 ? [4, 4, 0, 0] : 0} isAnimationActive={false}>\n {points.map((point, at) => (\n <Cell key={point.at} {...(at === current && currentBar(part.color))} />\n ))}\n </Bar>\n ))}\n </BarChart>\n )}\n </ResponsiveContainer>\n <PeriodTable points={points} measure={measure} bucket={bucket} now={now} {...(series && { series })} />\n </div>\n )\n if (!series || resource === undefined) return chart\n return (\n <div className=\"flex flex-col gap-2\">\n {chart}\n <ul className=\"flex flex-wrap gap-x-3 gap-y-0.5 text-sm\">\n {series.map((part) => (\n <LegendItem key={part.key} resource={resource} view={view} color={part.color} label={part.label} {...(part.filter !== undefined && { filter: part.filter })} />\n ))}\n </ul>\n </div>\n )\n}\n"],"mappings":"o2BAIMA,EAAQ,MAGRC,EAAc,CAAE,IAAK,UAAW,MAAO,QAD7B,KAAM,UAAW,OAAQ,UAAW,OAAQ,EACG,EACzD6B,EAAO,CAAE,IAAK,UAAW,MAAO,QAAS,KAAM,SAAU,EACzDC,EAAc,CAAE,IAAK,UAAW,MAAO,OAAQ,EAG/CC,EAA0E,CAC9E,OAAQ/B,EACR,YAAaA,EACb,aAAcA,EACd,KAAMA,EACN,IAAK6B,EACL,KAAM,CAAE,KAAM,SAAU,CAC1B,EAEMG,EAAY,GAAwCpB,EAAa,UAAU,KAAK,UAAUqB,CAAO,IAAM,GAAQ,IAAI,KAAK,eAAeC,EAAK,CAAE,GAAGD,EAAS,SAAU,KAAM,CAAC,CAAC,EAGrKE,GAAa,EAAY,IAAyB,CAC7D,IAAMC,EAAQ,IAAI,KAAKC,CAAE,EACzB,GAAIC,IAAW,MAAO,OAAOD,EAAKtC,EAClC,GAAIuC,IAAW,OAAQ,OAAOD,EAAK,EAAItC,EACvC,GAAIuC,IAAW,QAAS,OAAO,KAAK,IAAIF,EAAM,eAAe,EAAGA,EAAM,YAAY,EAAI,EAAG,CAAC,EAC1F,GAAIE,IAAW,OAAQ,OAAO,KAAK,IAAIF,EAAM,eAAe,EAAI,EAAG,EAAG,CAAC,CAEzE,EAGaG,GAAa,EAAY,EAAsB,IAAgB,CAC1E,IAAMC,EAAML,EAAUE,EAAIC,CAAM,EAChC,OAAOD,GAAMI,GAAQD,IAAQ,IAAA,IAAoBC,EA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f6-3622-4b1d-b517-314d51bdb92d"}
|
package/dist/shell-source-maps/assets/{person-row-DRqtbPma.js.map → person-row-D5tS8OTp.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"person-row-
|
|
1
|
+
{"version":3,"file":"person-row-D5tS8OTp.js","names":["n","a","t","__toESM","cn","SectionError","text","Checkbox","import_jsx_runtime","require_jsx_runtime","AppRolesPicker","roles","held","selected","role","locked","disabled","grantable","onChange","checked","name","PersonRow","status","self","email","actions","children","error"],"sources":["../../../src/organizations/app-roles-picker.tsx","../../../src/people/person-row.tsx"],"sourcesContent":["import type { RoleLabel } from '@protobase/client'\nimport { Checkbox } from '../primitives/checkbox'\nimport { cn } from '../lib/cn'\nimport { text } from './messages'\n\nexport type AppRolesPickerProps = {\n roles: readonly RoleLabel[]\n selected: readonly string[]\n /** The roles the person may give or take away; the others show as they are. */\n grantable: ReadonlySet<string>\n disabled?: boolean\n onChange: (selected: string[]) => void\n}\n\n/**\n * The roles given, ticked when held; only those the person may give or take away can change. Organization pages pass\n * the roles a member can hold (`membership`), the Users page every role.\n */\nexport const AppRolesPicker = ({ roles, selected, grantable, disabled, onChange }: AppRolesPickerProps) => (\n <div className=\"flex flex-wrap gap-x-4 gap-y-2\">\n {roles.map((role) => {\n const held = selected.includes(role.name)\n const locked = disabled || !grantable.has(role.name)\n return (\n <label key={role.name} title={locked && !disabled ? text('cannotChangeRole') : undefined} className={cn('inline-flex items-center gap-1.5', locked && 'text-muted-foreground')}>\n <Checkbox\n checked={held}\n label={role.label}\n onChange={locked ? undefined : (checked) => onChange(checked ? [...selected, role.name] : selected.filter((name) => name !== role.name))}\n className={cn(locked && 'cursor-default opacity-60')}\n />\n {role.label}\n </label>\n )\n })}\n </div>\n)\n","import type { ReactNode } from 'react'\nimport { SectionError } from '../account/account-section'\n\nexport type PersonRowProps = {\n name: string\n email: string\n /** The row is the signed-in person's own. */\n self: boolean\n /** On the line of the name, such as a role to choose or Remove. */\n actions?: ReactNode\n /** The lines under it, such as the roles held. */\n children?: ReactNode\n /** Why the last change to this person did not go through. */\n error?: string\n /** Beside the name, such as their status (see `StatusMark`). */\n status?: ReactNode\n}\n\n/** Someone in a list of people: their name, \" (you)\" on one's own row, their address, what can be done and their roles. */\nexport const PersonRow = ({ name, email, self, actions, children, error, status }: PersonRowProps) => (\n <li className=\"flex flex-col gap-2 px-3 py-3\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <span className=\"min-w-0 flex-1\">\n {status ? (\n <span className=\"flex min-w-0 items-center gap-1.5\">\n <span className=\"truncate font-medium\">{name}{self && ' (you)'}</span>\n {status}\n </span>\n ) : (\n <span className=\"block truncate font-medium\">{name}{self && ' (you)'}</span>\n )}\n <span className=\"block truncate text-xs text-muted-foreground\">{email}</span>\n </span>\n {actions}\n </div>\n {children}\n <SectionError message={error} />\n </li>\n)\n"],"mappings":"2nBAkBaU,GAAkB,CAAE,QAAO,WAAU,YAAW,WAAU,eACrE,EAAAF,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,iCACZ,SAAAG,EAAM,IAAK,GAAS,CACnB,IAAMC,EAAOC,EAAS,SAASC,EAAK,IAAI,EAClCC,EAASC,GAAY,CAACC,EAAU,IAAIH,EAAK,IAAI,EACnD,OACE,EAAAN,EAAA,KAAA,CAAC,QAAD,CAAuB,MAAOO,GAAU,CAACC,EAAWV,EAAK,kBAAkB,EAAI,IAAA,GAAW,UAAWF,EAAG,mCAAoCW,GAAU,uBAAuB,EAA7K,SAAA,EACE,EAAAP,EAAA,IAAA,CAACD,EAAD,CACE,QAASK,EACT,MAAOE,EAAK,MACZ,SAAUC,EAAS,IAAA,GAAa,GAAYG,EAASC,EAAU,CAAC,GAAGN,EAAUC,EAAK,IAAI,EAAID,EAAS,OAAQ,GAASO,IAASN,EAAK,IAAI,CAAC,EACvI,UAAWV,EAAGW,GAAU,2BAA2B,CACpD,CAAA,EACAD,EAAK,KACD,CARK,EAAAA,EAAK,IAQV,CAEX,CAAC,CACE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