@protobase/ui 0.113.0 → 0.114.0
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/app.d.ts +4 -1
- package/dist/app/app.js +9 -7
- package/dist/app/change-confirm/messages.d.ts +2 -2
- package/dist/app/charts/messages.d.ts +2 -2
- package/dist/app/confirm-sign-in-messages.d.ts +2 -2
- package/dist/app/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/displays/virtual-cards.js +1 -0
- package/dist/app/embedded-list/messages.d.ts +2 -2
- package/dist/app/export/messages.d.ts +2 -2
- package/dist/app/field-messages.d.ts +2 -2
- package/dist/app/field-types/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/field-types/workflow-status/messages.d.ts +2 -2
- package/dist/app/file-viewers/messages.d.ts +2 -2
- package/dist/app/first-frame.d.ts +13 -0
- package/dist/app/first-frame.js +23 -0
- package/dist/app/focus/messages.d.ts +2 -2
- package/dist/app/gallery/gallery-layout.d.ts +2 -2
- package/dist/app/gallery/messages.d.ts +2 -2
- package/dist/app/hand-order/messages.d.ts +2 -2
- package/dist/app/import/messages.d.ts +2 -2
- package/dist/app/index.html +0 -17
- package/dist/app/list-messages.d.ts +2 -2
- package/dist/app/main.js +19 -7
- 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/record-row/messages.d.ts +2 -2
- package/dist/app/record-row/record-row.d.ts +3 -2
- package/dist/app/record-row/record-row.js +43 -27
- package/dist/app/record-row/row-window.d.ts +11 -0
- package/dist/app/record-row/row-window.js +15 -2
- package/dist/app/refresh-mark.d.ts +2 -1
- package/dist/app/refresh-mark.js +3 -1
- package/dist/app/related-cards/messages.d.ts +2 -2
- package/dist/app/reveal-when-loaded.d.ts +8 -2
- package/dist/app/reveal-when-loaded.js +12 -5
- 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/app/splash-hold.d.ts +0 -1
- package/dist/app/splash-hold.js +1 -1
- package/dist/app/start-screen.d.ts +0 -9
- package/dist/app/start-screen.js +1 -10
- package/dist/app/ui-ready.d.ts +11 -0
- package/dist/app/ui-ready.js +12 -0
- package/dist/app-shell/app-shell.js +3 -1
- package/dist/app-shell/close-sidebar.d.ts +10 -0
- package/dist/app-shell/close-sidebar.js +17 -0
- package/dist/app-shell/drawer.d.ts +7 -1
- package/dist/app-shell/drawer.js +26 -7
- package/dist/app-shell/index.d.ts +2 -1
- package/dist/app-shell/index.js +2 -1
- package/dist/app-shell/messages.d.ts +2 -2
- package/dist/app-shell/top-bar.js +4 -4
- package/dist/assistant-dock/messages.d.ts +2 -2
- package/dist/auth/messages.d.ts +2 -2
- package/dist/calls/messages.d.ts +2 -2
- package/dist/compact-table/messages.d.ts +2 -2
- package/dist/data/query-keys.d.ts +6 -0
- package/dist/data/query-keys.js +10 -0
- package/dist/data/start-cache/cached-plugins.d.ts +6 -0
- package/dist/data/start-cache/cached-plugins.js +10 -0
- package/dist/data-grid/column-spec.d.ts +1 -1
- package/dist/data-grid/data-grid.js +1 -0
- package/dist/data-grid/messages.d.ts +2 -2
- package/dist/data-grid/row-source.d.ts +5 -0
- package/dist/data-grid/use-paged-rows.d.ts +5 -3
- package/dist/data-grid/use-paged-rows.js +21 -6
- package/dist/filter-panel/messages.d.ts +2 -2
- package/dist/focus-page/messages.d.ts +2 -2
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/dist/invitations/messages.d.ts +2 -2
- package/dist/live/grid-loader.d.ts +1 -0
- package/dist/live/grid-loader.js +3 -1
- package/dist/live/use-live-rows.js +1 -0
- package/dist/mailbox/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/notifications/bell/messages.d.ts +2 -2
- package/dist/organizations/members-page.js +13 -7
- package/dist/organizations/messages.d.ts +2 -2
- package/dist/organizations/use-organizations.d.ts +4 -1
- package/dist/organizations/use-organizations.js +25 -19
- package/dist/package.js +1 -1
- package/dist/plugins/plugin-source.d.ts +24 -4
- package/dist/plugins/plugin-source.js +48 -14
- package/dist/plugins/use-plugin-loads.d.ts +3 -1
- package/dist/plugins/use-plugin-loads.js +24 -7
- package/dist/primitives/messages.d.ts +2 -2
- package/dist/primitives/skeleton.js +1 -0
- package/dist/record-view/messages.d.ts +2 -2
- package/dist/roles/use-active-role.d.ts +4 -1
- package/dist/roles/use-active-role.js +18 -13
- package/dist/shell/assets/api-provider-BJJrOoO4.js +2 -0
- package/dist/shell/assets/app-VoTi41IN.js +16 -0
- package/dist/shell/assets/badge-OU9hb6yQ.js +2 -0
- package/dist/shell/assets/checkbox-DFfK432Y.js +2 -0
- package/dist/shell/assets/createLucideIcon-DGm8SdFI.js +2 -0
- package/dist/shell/assets/display-value-CIH2qfgQ.js +2 -0
- package/dist/shell/assets/{field-badge-3QmjR1r3.js → field-badge-DX2Mc_fH.js} +2 -2
- package/dist/shell/assets/{graph-view-BcbWbnHO.js → graph-view-CY9LPr0B.js} +2 -2
- package/dist/shell/assets/{html-viewer-tGtSpy9M.js → html-viewer-BPGMH_GA.js} +2 -2
- package/dist/shell/assets/{in-place-form-B0EkP4B1.js → in-place-form-RWSQGEg4.js} +2 -2
- package/dist/shell/assets/index-Bzb-O7ER.js +2 -0
- package/dist/shell/assets/index-HnFovy2Q.css +2 -0
- package/dist/shell/assets/{intl-cache-bXVNV0Yq.js → intl-cache-D4doUjK1.js} +2 -2
- package/dist/shell/assets/{lib-d3-interpolate-Cl0dHO4f.js → lib-d3-interpolate-D3u38iyJ.js} +2 -2
- package/dist/shell/assets/{lib-d3-transition-DUHAGQ8z.js → lib-d3-transition-BUpPvFvt.js} +2 -2
- package/dist/shell/assets/{lib-d3-zoom-gQh2osrj.js → lib-d3-zoom-BF7SPKNh.js} +2 -2
- package/dist/shell/assets/{lib-vis.gl-react-maplibre-CU7gWYjg.js → lib-vis.gl-react-maplibre-C7-0xNFC.js} +2 -2
- package/dist/shell/assets/{lib-xyflow-react-DGg_5r7u.js → lib-xyflow-react-CKyW7szC.js} +2 -2
- package/dist/shell/assets/maplibre-9ViQO48S.js +2 -0
- package/dist/shell/assets/{markdown-content-DHKbAJjx.js → markdown-content-DTB9RQDs.js} +2 -2
- package/dist/shell/assets/{record-map-nGRmsk6x.js → record-map-CVqCWtfe.js} +2 -2
- package/dist/shell/assets/{records-map-D2flyaz3.js → records-map-ClYSxrVR.js} +2 -2
- package/dist/shell/assets/{run-trace-view-DfrAPeum.js → run-trace-view-CN16MiXg.js} +2 -2
- package/dist/shell/assets/search-picker-BGpvJQRD.js +2 -0
- package/dist/shell/assets/shared-protobase-ui-BC8LqGQB.js +2 -0
- package/dist/shell/assets/step-catalog-CZY0ZpCC.js +2 -0
- package/dist/shell/assets/step-panel-DhD80lsJ.js +2 -0
- package/dist/shell/assets/use-app-address-B4Uk3nWy.js +2 -0
- package/dist/shell/assets/{use-meta-BqEqOLNe.js → use-meta-D5kYywHm.js} +2 -2
- package/dist/shell/assets/{use-sibling-page-CiuiG-Tz.js → use-sibling-page-BJ81HcOP.js} +3 -3
- package/dist/shell/assets/value-badge-Dpd8dRqq.js +2 -0
- package/dist/shell/assets/{vendor-WWp_xlp2.js → vendor-3etemhgS.js} +4 -4
- package/dist/shell/assets/{workflow-canvas-DMP7SDWX.js → workflow-canvas-C1nGpi5w.js} +2 -2
- package/dist/shell/assets/{workflow-graph-editor-xpV8_qEl.js → workflow-graph-editor-DAJa4lq6.js} +2 -2
- package/dist/shell/assets/workflow-workbench-HramVZEJ.js +4 -0
- package/dist/shell/assets/{workflows-Bku4o2su.js → workflows-DlvOln9v.js} +2 -2
- package/dist/shell/assets/{workflows-start-kl7rSSay.js → workflows-start-QUKfwFqf.js} +2 -2
- package/dist/shell/index.html +16 -19
- package/dist/shell/protobase.shell.json +2 -2
- package/dist/shell/protobase.sw.js +2 -2
- package/dist/shell-source-maps/assets/api-provider-BJJrOoO4.js.map +1 -0
- package/dist/shell-source-maps/assets/app-VoTi41IN.js.map +1 -0
- package/dist/shell-source-maps/assets/{badge-ChHXC28D.js.map → badge-OU9hb6yQ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{checkbox-COOOlJPG.js.map → checkbox-DFfK432Y.js.map} +1 -1
- package/dist/shell-source-maps/assets/createLucideIcon-DGm8SdFI.js.map +1 -0
- package/dist/shell-source-maps/assets/display-value-CIH2qfgQ.js.map +1 -0
- package/dist/shell-source-maps/assets/{field-badge-3QmjR1r3.js.map → field-badge-DX2Mc_fH.js.map} +1 -1
- package/dist/shell-source-maps/assets/{graph-view-BcbWbnHO.js.map → graph-view-CY9LPr0B.js.map} +1 -1
- package/dist/shell-source-maps/assets/{html-viewer-tGtSpy9M.js.map → html-viewer-BPGMH_GA.js.map} +1 -1
- package/dist/shell-source-maps/assets/{in-place-form-B0EkP4B1.js.map → in-place-form-RWSQGEg4.js.map} +1 -1
- package/dist/shell-source-maps/assets/index-Bzb-O7ER.js.map +1 -0
- package/dist/shell-source-maps/assets/{intl-cache-bXVNV0Yq.js.map → intl-cache-D4doUjK1.js.map} +1 -1
- package/dist/shell-source-maps/assets/{lib-d3-interpolate-Cl0dHO4f.js.map → lib-d3-interpolate-D3u38iyJ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{lib-d3-transition-DUHAGQ8z.js.map → lib-d3-transition-BUpPvFvt.js.map} +1 -1
- package/dist/shell-source-maps/assets/{lib-d3-zoom-gQh2osrj.js.map → lib-d3-zoom-BF7SPKNh.js.map} +1 -1
- package/dist/shell-source-maps/assets/{lib-vis.gl-react-maplibre-CU7gWYjg.js.map → lib-vis.gl-react-maplibre-C7-0xNFC.js.map} +1 -1
- package/dist/shell-source-maps/assets/{lib-xyflow-react-DGg_5r7u.js.map → lib-xyflow-react-CKyW7szC.js.map} +1 -1
- package/dist/shell-source-maps/assets/{maplibre-Y7X50Jfk.js.map → maplibre-9ViQO48S.js.map} +1 -1
- package/dist/shell-source-maps/assets/{markdown-content-DHKbAJjx.js.map → markdown-content-DTB9RQDs.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-map-nGRmsk6x.js.map → record-map-CVqCWtfe.js.map} +1 -1
- package/dist/shell-source-maps/assets/{records-map-D2flyaz3.js.map → records-map-ClYSxrVR.js.map} +1 -1
- package/dist/shell-source-maps/assets/{run-trace-view-DfrAPeum.js.map → run-trace-view-CN16MiXg.js.map} +1 -1
- package/dist/shell-source-maps/assets/{search-picker-CJcJetBh.js.map → search-picker-BGpvJQRD.js.map} +1 -1
- package/dist/shell-source-maps/assets/shared-protobase-ui-BC8LqGQB.js.map +1 -0
- package/dist/shell-source-maps/assets/{step-catalog-ZvQOXfSh.js.map → step-catalog-CZY0ZpCC.js.map} +1 -1
- package/dist/shell-source-maps/assets/{step-panel-B1yHz7OC.js.map → step-panel-DhD80lsJ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-app-address-B6k3dkV0.js.map → use-app-address-B4Uk3nWy.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-meta-BqEqOLNe.js.map → use-meta-D5kYywHm.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-sibling-page-CiuiG-Tz.js.map → use-sibling-page-BJ81HcOP.js.map} +1 -1
- package/dist/shell-source-maps/assets/{value-badge-BKLV4otJ.js.map → value-badge-Dpd8dRqq.js.map} +1 -1
- package/dist/shell-source-maps/assets/{vendor-WWp_xlp2.js.map → vendor-3etemhgS.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-canvas-DMP7SDWX.js.map → workflow-canvas-C1nGpi5w.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-graph-editor-xpV8_qEl.js.map → workflow-graph-editor-DAJa4lq6.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-workbench-Djdd_ODh.js.map → workflow-workbench-HramVZEJ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflows-Bku4o2su.js.map → workflows-DlvOln9v.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflows-start-kl7rSSay.js.map → workflows-start-QUKfwFqf.js.map} +1 -1
- package/dist/status/messages.d.ts +2 -2
- package/dist/styles.css +14 -0
- package/dist/users/messages.d.ts +2 -2
- package/package.json +5 -5
- package/dist/app/hold-start-for-first-loads.d.ts +0 -12
- package/dist/app/hold-start-for-first-loads.js +0 -43
- package/dist/shell/assets/api-provider-CcDtTh0D.js +0 -2
- package/dist/shell/assets/app-DG30qs8Q.js +0 -16
- package/dist/shell/assets/badge-ChHXC28D.js +0 -2
- package/dist/shell/assets/checkbox-COOOlJPG.js +0 -2
- package/dist/shell/assets/display-value-fDiKbfJO.js +0 -2
- package/dist/shell/assets/index-BkCaPeOq.css +0 -2
- package/dist/shell/assets/index-CZ013UoE.js +0 -2
- package/dist/shell/assets/maplibre-Y7X50Jfk.js +0 -2
- package/dist/shell/assets/messages-ClKBpZlk.js +0 -2
- package/dist/shell/assets/search-picker-CJcJetBh.js +0 -2
- package/dist/shell/assets/shared-protobase-ui-CVwqj5Cp.js +0 -2
- package/dist/shell/assets/step-catalog-ZvQOXfSh.js +0 -2
- package/dist/shell/assets/step-panel-B1yHz7OC.js +0 -2
- package/dist/shell/assets/use-app-address-B6k3dkV0.js +0 -2
- package/dist/shell/assets/value-badge-BKLV4otJ.js +0 -2
- package/dist/shell/assets/workflow-workbench-Djdd_ODh.js +0 -4
- package/dist/shell-source-maps/assets/api-provider-CcDtTh0D.js.map +0 -1
- package/dist/shell-source-maps/assets/app-DG30qs8Q.js.map +0 -1
- package/dist/shell-source-maps/assets/display-value-fDiKbfJO.js.map +0 -1
- package/dist/shell-source-maps/assets/index-CZ013UoE.js.map +0 -1
- package/dist/shell-source-maps/assets/messages-ClKBpZlk.js.map +0 -1
- package/dist/shell-source-maps/assets/shared-protobase-ui-CVwqj5Cp.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display-value-CIH2qfgQ.js","names":["text","text","text","text","text","units","message","n","a","t","__toESM","formatTag","createLucideIcon","cn","cachedFormat","name","segments","pathSource","wholePath","placeholder","parseTemplatePath","text","variable","names","rest","up","templatePlaceholders","match","fillPlaceholders","value","path","wholePlaceholder","recordValueAt","parsed","key","record","resourceField","to","filterField","templated","resource","part","addressPlaceholders","textPlaceholders","hrefPlaceholders","fillText","valueText","fill","lookup","filterPlaceholder","comparedValue","afterComparison","fillFilter","filter","quote","quoted","bare","at","fillAddressFrom","fillAddress","bareFilterFields","quotedLiteral","wholeQuoted","embeddedFilterFields","literal","leavesApp","href","appHrefError","hrefField","hostPlaceholder","linkActionError","run","label","enumLabel","labels","__iconData","ChevronRight","import_jsx_runtime","require_jsx_runtime","Skeleton","skeletonMotion","className","revealLate","text$3","messages","inApp","event","Breadcrumb","parts","last","index","content","loading","current","above","onNavigate","RouteLink","newTab","onClick","onFollow","text$2","isLayoutNode","text$1","viewerZone","partsFormats","partsFormat","known","zone","format","wallClock","ms","zoneOffset","clock","pad","dayIn","instantAt","wall","startOfDayIn","day","zoneLabel","tag","dateFormat","options","dayShort","month","monthName","weekday","weekdayDate","formatDate","formatDayShort","zonedFormats","formatDateTime","formats","formatMonth","formatMonthName","formatMonthRange","from","formatWeekday","formatWeekdayDate","formatDayRange","formatTime","formatAgo","seconds","relative","units$1","formatRelativeTime","away","unit","size","isStoredFile","isFileDraft","fileShown","units","formatSize","bytes","isPreviewable","type","density","unbounded","covers","variant","box","area","shownImage","file","b","acceptOf","accept","field","filePatchValue","draft","fileDiffers","uri","stored","keyPart","model","recordId","recordKey","affixed","hints","displayValue","now","valueTitle"],"sources":["../../../../schema/src/template-path.ts","../../../../schema/src/address-template.ts","../../../../schema/src/enum-label.ts","../../../../../node_modules/.bun/lucide-react@1.52.0+0ac650c021fb1b59/node_modules/lucide-react/dist/esm/icons/chevron-right.mjs","../../../src/primitives/skeleton.tsx","../../../src/app-shell/messages.ts","../../../src/app-shell/breadcrumb.tsx","../../../src/primitives/route-link.tsx","../../../src/app/messages.ts","../../../../layout/src/node.ts","../../../src/format/messages.ts","../../../src/format/zone.ts","../../../src/format/date.ts","../../../src/live/messages.ts","../../../src/live/file-values.ts","../../../src/live/model-helpers.ts","../../../src/live/display-value.ts"],"sourcesContent":["// Handlebars path expressions, the subset a placeholder `{{path}}` and a layout's `source` take: no helpers,\n// subexpressions, literals or `@key`. https://handlebarsjs.com/guide/expressions.html#path-expressions\n\nconst name = '[A-Za-z_][A-Za-z0-9_]*'\nconst segments = `${name}(?:\\\\.${name})*`\nconst pathSource = `@(?:root|params)(?:\\\\.${segments})?|@index|@first|@last|(?:\\\\.\\\\./)*(?:this(?:\\\\.${segments})?|\\\\./${segments}|${segments})`\n\nconst wholePath = new RegExp(`^(?:${pathSource})$`)\n\n/** A `{{…}}` with anything inside but braces, so a placeholder that is no path is found and refused, not left as text. */\nconst placeholder = /\\{\\{\\s*([^{}]*?)\\s*\\}\\}/g\n\n/** A data variable the renderer supplies (`@root`, `@params`, `@index`, `@first`, `@last`), or a name in the context stack. */\nexport type TemplatePath =\n | { kind: 'data'; variable: 'root' | 'params' | 'index' | 'first' | 'last'; names: string[] }\n /**\n * `up` is how many `../` lead it; `explicit` is true for `this`, `./` and any `../`, which read one context only, where\n * a bare name searches the stack. `names` is empty for `this` alone.\n */\n | { kind: 'context'; up: number; explicit: boolean; names: string[] }\n\n/** The path `text` is, or `undefined` when it is none, such as `a b`, `@key` or `../@root`. */\nexport const parseTemplatePath = (text: string): TemplatePath | undefined => {\n if (!wholePath.test(text)) return\n if (text.startsWith('@')) {\n const [variable, ...names] = text.slice(1).split('.')\n return { kind: 'data', variable: variable as 'root' | 'params' | 'index' | 'first' | 'last', names }\n }\n let rest = text\n let up = 0\n while (rest.startsWith('../')) {\n rest = rest.slice(3)\n up += 1\n }\n if (rest === 'this') return { kind: 'context', up, explicit: true, names: [] }\n if (rest.startsWith('this.')) return { kind: 'context', up, explicit: true, names: rest.slice(5).split('.') }\n if (rest.startsWith('./')) return { kind: 'context', up, explicit: true, names: rest.slice(2).split('.') }\n return { kind: 'context', up, explicit: up > 0, names: rest.split('.') }\n}\n\n/** Each `{{…}}` in `text`, as written between the braces, in order and repeated as often as it is. */\nexport const templatePlaceholders = (text: string) => [...text.matchAll(placeholder)].map((match) => match[1]!)\n\n/** `text` with every `{{path}}` replaced by `value(path)`; a placeholder that is no path is replaced too, by what `value` gives it. */\nexport const fillPlaceholders = (text: string, value: (path: string) => string) => text.replace(placeholder, (_, path: string) => value(path))\n\n/** A placeholder holding only a path, such as `{{website}}`: the path, or `undefined` when `text` is more than that. */\nexport const wholePlaceholder = (text: string) => {\n const match = /^\\{\\{\\s*([^{}]*?)\\s*\\}\\}$/.exec(text)\n return match && parseTemplatePath(match[1]!) ? match[1] : undefined\n}\n\n/**\n * The value at `path` in one record, as Mustache reads a single context: the first name from the record, the rest from\n * that value only. Anything that needs another context (`../`, `@root`) has none here, so it is `undefined`.\n */\nexport const recordValueAt = (record: Record<string, unknown>, path: string): unknown => {\n const parsed = parseTemplatePath(path)\n if (!parsed || parsed.kind !== 'context' || parsed.up > 0) return\n return parsed.names.reduce<unknown>((value, key) => (typeof value === 'object' && value !== null && Object.hasOwn(value, key) ? (value as Record<string, unknown>)[key] : undefined), record)\n}\n","import type { AppAddress } from './model'\nimport { fillPlaceholders, recordValueAt, templatePlaceholders, wholePlaceholder } from './template-path'\n\n/** How a filler reads the value at a path, such as `recordValueAt` on one record, or a layout's stack of records. */\nexport type PathLookup = (path: string) => unknown\n\nconst names = templatePlaceholders\n\n/** The path a link's address takes its resource from, when its `resource` is only `{{path}}`, as `'{{name}}'`. */\nexport const resourceField = (to: AppAddress) => (to.kind === 'page' ? undefined : wholePlaceholder(to.resource))\n\n/** The path a list address takes its whole filter from, when its `filter` is only `{{path}}`, as `'{{lever_filter}}'`: the record holds the filter's text. */\nexport const filterField = (to: AppAddress) => (to.kind === 'list' && to.filter !== undefined ? wholePlaceholder(to.filter) : undefined)\n\n// The parts of an address a `{{path}}` may stand in: a page's tab and parameters, the resource, the record key, tab, run and panel, the list's filter and order, a create form's values.\nconst templated = (to: AppAddress): string[] => {\n if (to.kind === 'page') return [...(to.tab === undefined ? [] : [to.tab]), ...Object.values(to.params ?? {})]\n const resource = resourceField(to) === undefined ? [] : [to.resource]\n if (to.kind === 'record') return [...resource, ...(Array.isArray(to.key) ? to.key : [to.key]).filter((part): part is string => typeof part === 'string'), ...[to.tab, to.run, to.panel].filter((part) => part !== undefined)]\n if (to.kind === 'list') return [...resource, ...[to.filter, to.orderBy].filter((part): part is string => part !== undefined)]\n return [...resource, ...Object.values(to.values ?? {})]\n}\n\n/** The paths whose values a link's address takes from the record, from its `{{path}}` placeholders. */\nexport const addressPlaceholders = (to: AppAddress) => [...new Set(templated(to).flatMap(names))]\n\n/** The paths a text, such as an href or a label, takes from the record, from its `{{path}}` placeholders. */\nexport const textPlaceholders = (text: string) => [...new Set(names(text))]\n\n/** The paths an href takes from the record, from its `{{path}}` placeholders. */\nexport const hrefPlaceholders = textPlaceholders\n\n/** `text` with every `{{path}}` replaced by `value(path)`, such as a button's label by the row's values as shown. */\nexport const fillText = fillPlaceholders\n\n/** A value as a placeholder writes it: a missing one empty. */\nexport const valueText = (value: unknown) => (value === null || value === undefined ? '' : String(value))\n\nconst fill = (text: string, lookup: PathLookup) => fillText(text, (path) => valueText(lookup(path)))\n\nconst filterPlaceholder = /([\"'])\\{\\{\\s*([^{}]*?)\\s*\\}\\}\\1|\\{\\{\\s*([^{}]*?)\\s*\\}\\}/g\n\n// A bare placeholder that is a comparison's value, as a typed layout writes `f.title.eq(data.title)`, or a function's\n// argument after the first, as in `in(title, {{title}})`: one bare word, such\n// as a number, a key or true, as it is; text that would break into more, such as a name with a space, quoted, so it\n// stays one value. Any other bare placeholder, a whole filter or a duration, goes in as it is.\nconst comparedValue = (value: unknown) => (typeof value === 'string' && value !== '' && !/^[\\w.:+-]+$/.test(value) ? JSON.stringify(value) : valueText(value))\n\nconst afterComparison = /(?:[=<>:,]|!=)\\s*$/\n\n/**\n * `filter` with every `{{path}}` replaced by its value. A quoted `'{{path}}'` takes the value as a string, its\n * backslashes and quotes escaped, so any text stays one value; Handlebars escapes for HTML instead, where this lands in\n * a filter or condition. A bare `{{path}}` that is a comparison's value, as a typed layout writes `f.title.eq(data.title)`,\n * takes one bare word as it is, such as a number or a key, and text with spaces or quotes quoted; any other bare one,\n * such as a whole filter or a duration, goes in as it is.\n */\nexport const fillFilter = (filter: string, lookup: PathLookup) =>\n filter.replace(filterPlaceholder, (_, quote: string | undefined, quoted: string | undefined, bare: string | undefined, at: number) => {\n if (quote) return `${quote}${valueText(lookup(quoted!)).replace(/\\\\/g, '\\\\\\\\').replaceAll(quote, `\\\\${quote}`)}${quote}`\n const value = lookup(bare!)\n return afterComparison.test(filter.slice(0, at)) ? comparedValue(value) : valueText(value)\n })\n\n/**\n * `to` with every `{{path}}` in its page parameters, resource, key, tab, run, panel, filter, order or values replaced by the value\n * `lookup` gives; a missing value becomes empty, and one quoted in a filter is escaped.\n */\nexport const fillAddressFrom = (to: AppAddress, lookup: PathLookup): AppAddress => {\n if (to.kind === 'page') return { ...to, ...(to.tab !== undefined && { tab: fill(to.tab, lookup) }), ...(to.params && { params: Object.fromEntries(Object.entries(to.params).map(([name, value]) => [name, fill(value, lookup)])) }) }\n const resource = resourceField(to) === undefined ? to.resource : fill(to.resource, lookup)\n if (to.kind === 'record') {\n const part = (value: string | number) => (typeof value === 'string' ? fill(value, lookup) : value)\n return { ...to, resource, key: Array.isArray(to.key) ? to.key.map(part) : part(to.key as string | number), ...(to.tab !== undefined && { tab: fill(to.tab, lookup) }), ...(to.run !== undefined && { run: fill(to.run, lookup) }), ...(to.panel !== undefined && { panel: fill(to.panel, lookup) }) }\n }\n if (to.kind === 'create') return { ...to, resource, ...(to.values && { values: Object.fromEntries(Object.entries(to.values).map(([name, value]) => [name, fill(value, lookup)])) }) }\n return { ...to, resource, ...(to.filter !== undefined && { filter: fillFilter(to.filter, lookup) }), ...(to.orderBy !== undefined && { orderBy: fill(to.orderBy, lookup) }) }\n}\n\n/** `to` with every `{{path}}` replaced by the record's value at that path. */\nexport const fillAddress = (to: AppAddress, record: Record<string, unknown> = {}): AppAddress => fillAddressFrom(to, (path) => recordValueAt(record, path))\n\n/** The paths a list address's filter takes outside quotes, whose values go into the filter as they are, such as `{{task_id}}` in `task_id = {{task_id}}`. */\nexport const bareFilterFields = (to: AppAddress) =>\n to.kind === 'list' && to.filter !== undefined ? [...new Set([...to.filter.matchAll(filterPlaceholder)].flatMap((match) => (match[3] === undefined ? [] : [match[3]])))] : []\n\nconst quotedLiteral = /([\"'])(?:\\\\[\\s\\S]|(?!\\1)[^\\\\])*\\1/g\n\nconst wholeQuoted = /^([\"'])\\{\\{\\s*[^{}]*?\\s*\\}\\}\\1$/\n\n/**\n * The paths a filter takes inside a longer quoted value, such as `{{name}}` in `title = 'abc{{name}}'`; only a quoted\n * value that is the placeholder alone is escaped when filled, so these are refused.\n */\nexport const embeddedFilterFields = (filter: string) => [...new Set([...filter.matchAll(quotedLiteral)].flatMap(([literal]) => (wholeQuoted.test(literal) ? [] : names(literal))))]\n\n/**\n * Whether an href leaves the app: it starts with a scheme (`https:`, `mailto:`) or `//`. A path inside the app is an\n * address, given as `to`, so that it is written one way everywhere.\n */\nexport const leavesApp = (href: string) => /^([a-z][a-z0-9+.-]*:|\\/\\/)/i.test(href)\n\n/** Why an href cannot be a link's `href`: it points inside the app, which takes an address in `to`. */\nexport const appHrefError = (href: string) =>\n leavesApp(href) ? undefined : `href \"${href}\" points inside the app; give the link \\`to\\` instead, an address such as { kind: 'record', resource: 'orders', key: '{{order_id}}' }`\n\n/** The path an action's href is made of alone, `{{field}}`: the record's value is the whole URL, as it is stored. */\nexport const hrefField = wholePlaceholder\n\n/** What a link action's label writes for the host its target opens. */\nexport const hostPlaceholder = '{{host}}'\n\n/**\n * Why a link action cannot be built: an `href` that points inside the app (one that is a single `{{field}}`, the URL the\n * record holds, is fine), or `{{host}}` in the label of a link that goes `to` an address in the app, which has no host.\n */\nexport const linkActionError = (label: string, run: { to: AppAddress } | { href: string }) => {\n if ('href' in run) return hrefField(run.href) ? undefined : appHrefError(run.href)\n return label.includes(hostPlaceholder) ? `the label names ${hostPlaceholder}, which only a link with an href has` : undefined\n}\n","/** How an enum value reads: its label from the view's `valueLabels`, else the stored value unchanged (`co_signer`). */\nexport const enumLabel = (value: string, labels?: Record<string, string>) => labels?.[value] ?? value\n","/**\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: \"chevron-right\",\n size: 24,\n node: [[\"path\", { d: \"m9 18 6-6-6-6\", key: \"mthhwq\" }]]\n};\n__iconData.node;\nconst ChevronRight = createLucideIcon(__iconData);\n\nexport { __iconData, ChevronRight as default };\n//# sourceMappingURL=chevron-right.mjs.map\n","import type { CSSProperties } from 'react'\nimport { cn } from '../lib/cn'\n\n/**\n * A placeholder shaped like what is loading, which keeps that content's room. It stays blank for its first 180 ms, so a\n * load that quick shows no flash, then shimmers, or stays still when less motion is asked for.\n */\nexport const Skeleton = ({ className, style }: { className?: string; style?: CSSProperties }) => (\n <span data-placeholder className={cn('block h-3 rounded bg-muted', skeletonMotion, className)} style={style} />\n)\n\n/** Blank for the first 180 ms, for a loading notice such as a spinner, so a quick load never flashes it. */\nexport const revealLate = '[animation:pb-reveal_1ms_180ms_backwards]'\n\nconst skeletonMotion = '[animation:pb-reveal_1ms_180ms_backwards,pb-shimmer_1.4s_180ms_ease-in-out_infinite] motion-reduce:[animation:pb-reveal_1ms_180ms_backwards]'\n","import { messages } from '../locale/messages'\n\nexport const text = messages('app-shell')\n","import { ChevronRight } from 'lucide-react'\nimport type { MouseEvent } from 'react'\nimport { cn } from '../lib/cn'\nimport { Skeleton } from '../primitives/skeleton'\nimport { text } from './messages'\n\n/**\n * One step of the top bar's trail: plain text, or a link when it has a page of its own. A loading crumb shows a skeleton,\n * with its label for screen readers. A last crumb marked `above` is the page the shown one sits under, as a list is\n * above its record: it is not the current page, and on a phone the back button, which goes to it, shows its label.\n */\nexport type Crumb = string | { label: string; href?: string; loading?: boolean; above?: boolean }\n\nexport type BreadcrumbProps = {\n parts: Crumb[]\n /** Follows a crumb's link in the app; modified and middle clicks are left to the browser, so they open a new tab. */\n onNavigate?: (href: string) => void\n}\n\n/** A plain left click, which the app follows itself; others open a new tab. */\nexport const inApp = (event: MouseEvent) => event.button === 0 && !event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey\n\n/** The trail of where you are; the current page, the last crumb unless it is `above`, shows on phones too. */\nexport const Breadcrumb = ({ parts, onNavigate }: BreadcrumbProps) => (\n <nav aria-label={text('breadcrumb')} className=\"flex min-w-0 items-center gap-1.5\">\n {parts.map((part, index) => {\n const last = index === parts.length - 1\n const { label, href, loading, above } = typeof part === 'string' ? { label: part, href: undefined, loading: false, above: false } : part\n const content = loading ? <Skeleton className=\"w-24\" /> : label\n const current = last && !above\n const text = cn('truncate', current ? 'font-semibold' : 'text-muted-foreground')\n return (\n <span key={`${index}-${label}`} className={cn('min-w-0 items-center gap-1.5', current ? 'flex' : 'hidden md:flex')}>\n {index > 0 && <ChevronRight className=\"hidden size-3.5 shrink-0 text-faint-foreground md:block\" />}\n {href ? (\n <a\n href={href}\n aria-current={current ? 'page' : undefined}\n aria-label={loading ? label : undefined}\n aria-busy={loading || undefined}\n onClick={(event) => {\n if (!onNavigate || !inApp(event)) return\n event.preventDefault()\n onNavigate(href)\n }}\n className={cn(text, 'rounded-sm hover:text-foreground hover:underline')}\n >\n {content}\n </a>\n ) : (\n <span className={text} aria-label={loading ? label : undefined} aria-busy={loading || undefined}>\n {content}\n </span>\n )}\n </span>\n )\n })}\n </nav>\n)\n","import type { AnchorHTMLAttributes } from 'react'\nimport { inApp } from '../app-shell/breadcrumb'\n\n/**\n * Where a link goes: the `href` the browser shows and opens, and how the app follows it in place. One without\n * `onFollow`, a page outside the app, the browser follows itself, in a new tab without the app's window or address\n * with `newTab`.\n */\nexport type RouteTarget = { href: string; onFollow?: () => void; newTab?: boolean }\n\n/**\n * An ordinary anchor to `to.href`: a plain click follows it in place with `to.onFollow`, while a middle click or one\n * with Ctrl, Cmd, Shift or Alt opens it in a new tab or window, or saves it, as on any link. Every navigation a click\n * starts is one of these, never a button that moves the page, so the browser shows where it goes and can open it.\n */\nexport const RouteLink = ({ to, onClick, ...rest }: AnchorHTMLAttributes<HTMLAnchorElement> & { to: RouteTarget }) => {\n const { href, onFollow, newTab } = to\n return (\n <a\n href={href}\n {...(newTab && { target: '_blank', rel: 'noreferrer' })}\n onClick={(event) => {\n onClick?.(event)\n if (!onFollow || event.defaultPrevented || !inApp(event)) return\n event.preventDefault()\n onFollow()\n }}\n {...rest}\n />\n )\n}\n","import { messages } from '../locale/messages'\n\n// Texts the app's pages share: the notices of an address that leads nowhere, and an error without words of its own\nexport const text = messages('app')\n","/** A static value a layout prop may hold: what survives `JSON.stringify` unchanged, plus elements (also plain data). */\nexport type LayoutValue = string | number | boolean | null | LayoutValue[] | { [key: string]: LayoutValue }\n\n/**\n * Which props of a block that reads records name what it reads: the resource, its filter, its sort, the fields it\n * draws and how many records it reads, so a page's reads can be planned from the tree. A block without one reads\n * nothing of its own. `fields` is a prop, or several, each holding a field name or a list of them. `select` is the\n * prop naming the page parameter that holds the key of the record chosen among them, inside which its children draw.\n */\nexport type BlockReads = { resource: string; filter?: string; sort?: string; fields?: string | string[]; limit?: string; select?: string }\n\n/**\n * What a custom component reads: one read, or several, each named by the prop of its resource (`nodes`, `edges`), as\n * the page's plan names them.\n */\nexport type ComponentReads = BlockReads | BlockReads[]\n\n/** One element of a layout tree. Plain data: it is sent to the browser as JSON and rendered there. */\nexport type LayoutNode = {\n /** A built-in block (`Table`) or a custom component's registered name. */\n type: string\n props: Record<string, LayoutValue>\n children: LayoutChild[]\n /** Set on custom components, which the app renders with the React component registered under `type`. */\n custom?: true\n /**\n * What a client draws in place of a custom component it does not have, or that fails to draw: elements and text,\n * or none to draw nothing. Absent when the component declares no fallback.\n */\n fallback?: LayoutChild[]\n /** Which of a custom component's props name what it reads, as its `component()` declares, so the page's plan reads it. */\n reads?: ComponentReads\n}\n\nexport type LayoutChild = LayoutNode | string\n\n/** What JSX accepts as children; `null`, `undefined` and booleans render nothing, like in React. */\nexport type LayoutChildren = LayoutChild | number | boolean | null | undefined | LayoutChildren[]\n\n/** A block as JSX sees it: called by the runtime with its props, it describes one element. */\nexport type Block<P> = ((props: P) => LayoutNode) & { readonly blockName: string; readonly custom: boolean; readonly fallback?: LayoutChild[]; readonly reads?: ComponentReads }\n\nexport const isLayoutNode = (value: unknown): value is LayoutNode =>\n typeof value === 'object' && value !== null && !Array.isArray(value) && typeof (value as LayoutNode).type === 'string' && Array.isArray((value as LayoutNode).children)\n\n/** An element's props without the elements it holds (`actions={...}`), which are walked as elements of their own. */\nexport const dataProps = (node: LayoutNode) =>\n Object.fromEntries(Object.entries(node.props).filter(([, value]) => !isLayoutNode(value) && !(Array.isArray(value) && value.length > 0 && value.every(isLayoutNode))))\n","import { messages } from '../locale/messages'\n\nexport const text = messages('format')\n","import { cachedFormat } from './intl-cache'\n\n// Times show in the viewer's time zone, the browser's; dates (`YYYY-MM-DD`, no time) have no zone and never shift.\n\n/** The viewer's IANA time zone, such as `Europe/Amsterdam`. */\nexport const viewerZone = () => Intl.DateTimeFormat().resolvedOptions().timeZone\n\nconst partsFormats = new Map<string, Intl.DateTimeFormat>()\n\nconst partsFormat = (zone: string) => {\n const known = partsFormats.get(zone)\n if (known) return known\n const format = new Intl.DateTimeFormat('en-US', { timeZone: zone, hourCycle: 'h23', year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit' })\n partsFormats.set(zone, format)\n return format\n}\n\n// The wall clock of `zone` at `ms`, as numbers\nconst wallClock = (ms: number, zone: string) => {\n const parts = Object.fromEntries(partsFormat(zone).formatToParts(ms).map((part) => [part.type, part.value]))\n return { year: Number(parts.year), month: Number(parts.month), day: Number(parts.day), hour: Number(parts.hour), minute: Number(parts.minute), second: Number(parts.second) }\n}\n\n/** How far `zone`'s clock is ahead of UTC at `ms`, in milliseconds: 7 200 000 for Amsterdam in summer. */\nexport const zoneOffset = (ms: number, zone: string) => {\n const clock = wallClock(ms, zone)\n const asUtc = Date.UTC(clock.year, clock.month - 1, clock.day, clock.hour, clock.minute, clock.second)\n return asUtc - Math.floor(ms / 1000) * 1000\n}\n\nconst pad = (value: number) => String(value).padStart(2, '0')\n\n/** The day `ms` falls on in `zone`, as `YYYY-MM-DD`. */\nexport const dayIn = (ms: number, zone: string) => {\n const clock = wallClock(ms, zone)\n return `${clock.year}-${pad(clock.month)}-${pad(clock.day)}`\n}\n\n/** The instant `zone`'s clock reads `wall`, a wall-clock time written as if it were UTC milliseconds. */\nexport const instantAt = (wall: number, zone: string) => {\n // The offset at `wall` read as UTC is right unless the zone changes its clock in the hours between; a second pass fixes that\n const guess = wall - zoneOffset(wall, zone)\n return wall - zoneOffset(guess, zone)\n}\n\n/** The instant `day` (`YYYY-MM-DD`) starts in `zone`: its local midnight. */\nexport const startOfDayIn = (day: string, zone: string) => instantAt(Date.parse(`${day}T00:00:00Z`), zone)\n\n/** The zone a time is shown in, as its hover label says: \"Europe/Amsterdam (GMT+2)\", or \"UTC\". */\nexport const zoneLabel = (ms: number, zone: string) => {\n const named = cachedFormat(`zoneName:${zone}`, (tag) => new Intl.DateTimeFormat(tag, { timeZone: zone, timeZoneName: 'shortOffset' }))\n const name = named.formatToParts(ms).find((part) => part.type === 'timeZoneName')?.value ?? zone\n return zone === 'UTC' || zone === 'Etc/UTC' ? 'UTC' : `${zone} (${name})`\n}\n","import { cachedFormat } from './intl-cache'\nimport { text } from './messages'\nimport { viewerZone } from './zone'\n\n// Dates, months and weekdays are zone-free days, kept in UTC; times are the viewer's, in `zone`.\nconst dateFormat = (name: string, options: Intl.DateTimeFormatOptions) => () => cachedFormat(`date:${name}`, (tag) => new Intl.DateTimeFormat(tag, { ...options, timeZone: 'UTC' }))\nconst day = dateFormat('day', { day: 'numeric', month: 'short', year: 'numeric' })\nconst dayShort = dateFormat('dayShort', { day: 'numeric', month: 'short' })\nconst month = dateFormat('month', { month: 'long', year: 'numeric' })\nconst monthName = dateFormat('monthName', { month: 'long' })\nconst weekday = dateFormat('weekday', { weekday: 'short' })\nconst weekdayDate = dateFormat('weekdayDate', { weekday: 'long', day: 'numeric', month: 'short', year: 'numeric' })\n\nexport const formatDate = (ms: number) => day().format(ms)\n\nexport const formatDayShort = (ms: number) => dayShort().format(ms)\n\nconst zonedFormats = (zone: string) =>\n cachedFormat(`zoned:${zone}`, (tag) => ({\n day: new Intl.DateTimeFormat(tag, { day: 'numeric', month: 'short', year: 'numeric', timeZone: zone }),\n time: new Intl.DateTimeFormat(tag, { hour: '2-digit', minute: '2-digit', hour12: false, timeZone: zone }),\n }))\n\n/** \"6 Oct 2026, 16:32\": an instant on the clock of `zone`, the viewer's unless given. */\nexport const formatDateTime = (ms: number, zone = viewerZone()) => {\n const formats = zonedFormats(zone)\n return `${formats.day.format(ms)}, ${formats.time.format(ms)}`\n}\n\n/** \"October 2026\". */\nexport const formatMonth = (ms: number) => month().format(ms)\n\n/** \"October\". */\nexport const formatMonthName = (ms: number) => monthName().format(ms)\n\n/** \"October – December 2026\": the months from `from` to `to`, both included. */\nexport const formatMonthRange = (from: number, to: number) => month().formatRange(from, to)\n\n/** \"Mon\". */\nexport const formatWeekday = (ms: number) => weekday().format(ms)\n\n/** \"Monday, 12 Oct 2026\". */\nexport const formatWeekdayDate = (ms: number) => weekdayDate().format(ms)\n\n/** \"12–18 Oct 2026\", \"28 Dec 2026 – 3 Jan 2027\": the days from `from` to `to`, both included. */\nexport const formatDayRange = (from: number, to: number) => day().formatRange(from, to)\n\n/** \"09:30\": an instant's time on the clock of `zone`, the viewer's unless given. */\nexport const formatTime = (ms: number, zone = viewerZone()) => zonedFormats(zone).time.format(ms)\n\nexport const formatAgo = (seconds: number) => {\n if (seconds < 60) return text('secondsAgo', { count: seconds })\n if (seconds < 3600) return text('minutesAgo', { count: Math.floor(seconds / 60) })\n if (seconds < 86_400) return text('hoursAgo', { count: Math.floor(seconds / 3600) })\n return text('daysAgo', { count: Math.floor(seconds / 86_400) })\n}\n\nconst relative = () => cachedFormat('relative', (tag) => new Intl.RelativeTimeFormat(tag, { numeric: 'auto' }))\n\nconst units: Array<[Intl.RelativeTimeFormatUnit, number]> = [\n ['year', 31_536_000],\n ['month', 2_592_000],\n ['day', 86_400],\n ['hour', 3600],\n ['minute', 60],\n]\n\n/** \"5 minutes ago\", \"yesterday\", \"in 3 hours\"; `seconds` is how long ago it was, negative for a time to come. */\nexport const formatRelativeTime = (seconds: number) => {\n const away = Math.abs(seconds)\n const [unit, size] = units.find(([, size]) => away >= size) ?? ['second', 1]\n if (unit === 'second' && away < 45) return text('justNow')\n return relative().format(-Math.sign(seconds) * Math.floor(away / size), unit)\n}\n","import { messages } from '../locale/messages'\n\nexport const text = messages('live')\n","import type { StoredFile, UploadResult } from '@protobase/client'\nimport type { FieldModel } from '@protobase/schema'\nimport { text } from './messages'\n\n/** A file uploaded in the form and not yet saved: the ticket the save sends, and a local preview while there is one. */\nexport type FileDraft = { uploaded: UploadResult; preview?: string }\n\nexport const isStoredFile = (value: unknown): value is StoredFile =>\n typeof value === 'object' && value !== null && typeof (value as { uri?: unknown }).uri === 'string'\n\nexport const isFileDraft = (value: unknown): value is FileDraft =>\n typeof value === 'object' && value !== null && typeof (value as { uploaded?: { value?: unknown } }).uploaded?.value === 'string'\n\n/** What a file field shows: its name, type and size, whether stored or just uploaded; `undefined` when empty. */\nexport const fileShown = (value: unknown) => {\n if (isFileDraft(value)) return { ...value.uploaded.file, ...(value.preview && { url: value.preview }), corrected: value.uploaded.corrected }\n if (!isStoredFile(value)) return undefined\n if ('missing' in value) return { name: text('fileMissing'), type: '', missing: true as const }\n return value\n}\n\nconst units = ['bytes', 'kB', 'MB', 'GB']\n\n/** `48 kB`, `1.2 MB`: decimal units, like the field's `maxSize`. */\nexport const formatSize = (bytes: number) => {\n let size = bytes\n let unit = 0\n while (size >= 1000 && unit < units.length - 1) {\n size /= 1000\n unit += 1\n }\n return unit === 0 ? `${bytes} ${bytes === 1 ? 'byte' : 'bytes'}` : `${size < 10 ? size.toFixed(1) : Math.round(size)} ${units[unit]}`\n}\n\n/** Raster images the browser shows; SVG is never shown, since it can carry scripts. */\nexport const isPreviewable = (type: string) => type.startsWith('image/') && type !== 'image/svg+xml'\n\n/** Where a picture is drawn, in CSS pixels. */\nexport type ImageBox = { width: number; height: number }\n\n// An image for a box needs this many pixels per CSS pixel to stay sharp on a high-density screen.\nconst density = 2\n// A side a variant leaves unbounded counts as larger than any image.\nconst unbounded = 100_000\n\ntype Variant = { url: string; width?: number; height?: number }\n\nconst covers = (variant: Variant, box: ImageBox) =>\n (variant.width !== undefined || variant.height !== undefined) &&\n (variant.width ?? unbounded) >= box.width * density &&\n (variant.height ?? unbounded) >= box.height * density\n\nconst area = (variant: Variant) => (variant.width ?? unbounded) * (variant.height ?? unbounded)\n\n/**\n * The picture of a file for `box`: the link of its smallest variant large enough for it, else the file's own, with its\n * placeholder; `undefined` for a file that is no raster image with a link.\n */\nexport const shownImage = (value: unknown, box: ImageBox) => {\n const file = fileShown(value)\n if (!file || 'missing' in file || !file.url || !isPreviewable(file.type)) return undefined\n const variants: Variant[] = 'variants' in file && file.variants ? Object.values(file.variants) : []\n const best = variants.filter((variant) => covers(variant, box)).sort((a, b) => area(a) - area(b))[0]\n return { url: best?.url ?? file.url, ...('placeholder' in file && file.placeholder !== undefined && { placeholder: file.placeholder }) }\n}\n\n/** The file input's `accept`: the field's allowed types, or nothing when it takes any. */\nexport const acceptOf = (field: FieldModel) => {\n const accept = field.file?.accept ?? []\n return accept.length === 0 || accept.includes('*/*') ? undefined : accept.join(',')\n}\n\n/** What a save sends for a file field: the ticket of a new upload, `null` to clear it, the stored URI to keep it. */\nexport const filePatchValue = (draft: unknown) => {\n if (isFileDraft(draft)) return draft.uploaded.value\n if (isStoredFile(draft)) return draft.uri\n return null\n}\n\n/** Whether a file field's draft changes what is stored. */\nexport const fileDiffers = (draft: unknown, stored: unknown) => {\n if (isFileDraft(draft)) return true\n const uri = (value: unknown) => (isStoredFile(value) ? value.uri : null)\n return uri(draft) !== uri(stored)\n}\n","import type { ResourceModel } from '@protobase/schema'\n\nexport { labelFieldOf, recordTitle, recordTitleField } from '@protobase/schema/internal'\n\n// A key part of a record; a list row holds a relation as `{ id, name }`, so a relation key part is its `id`.\nconst keyPart = (model: ResourceModel, record: Record<string, unknown>, name: string) => {\n const value = record[name]\n const labelled = model.fields[name]?.type === 'relation' && typeof value === 'object' && value !== null && 'id' in value\n return (labelled ? value.id : value) as string | number\n}\n\nexport const recordId = (model: ResourceModel, record: Record<string, unknown>) =>\n model.primaryKey.map((name) => String(keyPart(model, record, name))).join(',')\n\n/** The key as the URL carries it, for `get` and `update`, from a stored record or a list row. */\nexport const recordKey = (model: ResourceModel, record: Record<string, unknown>) => {\n const parts = model.primaryKey.map((name) => keyPart(model, record, name))\n return parts.length === 1 ? parts[0]! : parts\n}\n","import { enumLabel, type FieldModel, type FieldViewModel } from '@protobase/schema'\nimport { formatDate, formatDateTime, formatRelativeTime } from '../format/date'\nimport { viewerZone, zoneLabel } from '../format/zone'\nimport { fileShown } from './file-values'\nimport { formatTag } from '../locale/active-locale'\nimport { text as message } from './messages'\n\n// A number with the view's prefix before it and suffix after it, such as `€1,200` or `120 m²`.\nconst affixed = (text: string, hints: FieldViewModel) => `${hints.prefix ?? ''}${text}${hints.suffix ?? ''}`\n\n/**\n * A read-only rendering of a stored value, following the view's prefix, suffix, decimals, format and value label hints; a\n * timestamp on the clock of `zone`, the viewer's unless given.\n */\nexport const displayValue = (field: FieldModel, value: unknown, hints: FieldViewModel = {}, zone = viewerZone(), now = Date.now()) => {\n if (value === null || value === undefined || value === '') return '—'\n switch (field.type) {\n case 'boolean':\n return value ? message('yes') : message('no')\n case 'file':\n return fileShown(value)?.name ?? '—'\n case 'enum':\n return enumLabel(String(value), hints.valueLabels)\n case 'timestamp': {\n const ms = Date.parse(String(value))\n return hints.format === 'relative' ? formatRelativeTime(Math.round((now - ms) / 1000)) : formatDateTime(ms, zone)\n }\n case 'date':\n return formatDate(Date.parse(String(value)))\n case 'decimal': {\n const text = hints.decimals === undefined ? String(value) : Number(value).toFixed(hints.decimals)\n if (hints.format === 'percent') return `${Number(value)}%`\n return affixed(Number(text).toLocaleString(formatTag(), { minimumFractionDigits: hints.decimals ?? 0, maximumFractionDigits: hints.decimals ?? 20 }), hints)\n }\n case 'integer':\n case 'bigint':\n return affixed(String(value), hints)\n default:\n return typeof value === 'object' ? JSON.stringify(value) : String(value)\n }\n}\n\n/** The hover label of a shown value: the time zone a timestamp is shown in, or its exact time when shown relative; nothing for other values. */\nexport const valueTitle = (field: FieldModel, value: unknown, zone = viewerZone(), hints: FieldViewModel = {}) => {\n if (field.type !== 'timestamp' || typeof value !== 'string') return undefined\n const ms = Date.parse(value)\n if (Number.isNaN(ms)) return undefined\n if (hints.format === 'relative') return formatDateTime(ms, zone)\n return message('shownIn', { zone: zoneLabel(ms, zone) })\n}\n"],"ignoreList":[3],"mappings":"2rBAGA,IAAMe,EAAO,yBACPC,EAAW,GAAGD,EAAK,QAAQA,EAAK,IAChCE,EAAa,yBAAyBD,EAAS,kDAAkDA,EAAS,SAASA,EAAS,GAAGA,EAAS,GAExIE,EAAgB,OAAO,OAAOD,EAAW,GAAG,EAG5CE,EAAc,2BAYPC,EAAqB,GAA2C,CAC3E,GAAI,CAACF,EAAU,KAAKG,CAAI,E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,EAAMvE,GAAM,GAAI,CAAC,EAAIqB,EAAerB,EAAIH,CAAI,CAClH,CACA,IAAK,OACH,OAAOqB,EAAW,KAAK,MAAM,OAAOnG,CAAK,CAAC,CAAC,EAC7C,IAAK,UAAW,CACd,IAAMR,EAAO8J,EAAM,WAAa,IAAA,GAAY,OAAOtJ,CAAK,EAAI,OAAOA,CAAK,CAAC,CAAC,QAAQsJ,EAAM,QAAQ,EAEhG,OADIA,EAAM,SAAW,UAAkB,GAAG,OAAOtJ,CAAK,EAAE,GACjDqJ,GAAQ,OAAO7J,CAAI,CAAC,CAAC,eAAeV,EAAU,EAAG,CAAE,sBAAuBwK,EAAM,UAAY,EAAG,sBAAuBA,EAAM,UAAY,EAAG,CAAC,EAAGA,CAAK,CAC7J,CACA,IAAK,UACL,IAAK,SACH,OAAOD,GAAQ,OAAOrJ,CAAK,EAAGsJ,CAAK,EACrC,QACE,OAAO,OAAOtJ,GAAU,SAAW,KAAK,UAAUA,CAAK,EAAI,OAAOA,CAAK,CAC3E,CACF,EAGayJ,IAAc,EAAmB,EAAgB,EAAO/E,EAAW,EAAG,EAAwB,CAAC,IAAM,CAChH,GAAIiE,EAAM,OAAS,aAAe,OAAO3I,GAAU,SAAU,OAC7D,IAAMiF,EAAK,KAAK,MAAMjF,CAAK,EAC3B,GAAI,QAAO,MAAMiF,CAAE,EAEnB,OADIqE,EAAM,SAAW,WAAmBhD,EAAerB,EAAIH,CAAI,EACxDrG,EAAQ,UAAW,CAAE,KAAMiH,EAAUT,EAAIH,CAAI,CAAE,CAAC,CACzD","debugId":"881f6a9f-8100-4c9b-920d-aa8db1abba57"}
|
package/dist/shell-source-maps/assets/{field-badge-3QmjR1r3.js.map → field-badge-DX2Mc_fH.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-badge-
|
|
1
|
+
{"version":3,"file":"field-badge-DX2Mc_fH.js","names":["n","a","t","__toESM","displayValue","ValueBadge","import_jsx_runtime","require_jsx_runtime","FieldBadge","declared","model","field","value","record","hints","view"],"sources":["../../../src/app/field-badge.tsx"],"sourcesContent":["import type { ResourceModel, ViewModel } from '@protobase/schema'\nimport { displayValue } from '../live/display-value'\nimport { ValueBadge } from './value-badge'\n\n/**\n * A record's value of `field` as a badge, in the words and colour its view gives the value, with the field's label for\n * screen readers; nothing for a field the model does not have or an empty value.\n */\nexport const FieldBadge = ({ model, view, field, record }: { model: ResourceModel; view: ViewModel | undefined; field: string; record: Record<string, unknown> }) => {\n const declared = model.fields[field]\n const value = record[field]\n if (!declared || value === null || value === undefined) return null\n const hints = view?.fields[field]\n return (\n <ValueBadge value={value} hints={hints}>\n <span className=\"sr-only\">{hints?.label ?? field}: </span>\n {displayValue(declared, value, hints)}\n </ValueBadge>\n )\n}\n"],"mappings":"0pBAQaQ,GAAc,CAAE,QAAO,OAAM,QAAO,YAAoH,CACnK,IAAMC,EAAWC,EAAM,OAAOC,GACxBC,EAAQC,EAAOF,GACrB,GAAI,CAACF,GAAYG,GAAU,KAA6B,OAAO,KAC/D,IAAME,EAAQC,GAAM,OAAOJ,GAC3B,OACE,EAAAL,EAAA,KAAA,CAACD,EAAD,CAAmB,QAAc,QAAjC,SAAA,EACE,EAAAC,EAAA,KAAA,CAAC,OAAD,CAAM,UAAU,UAAhB,SAAA,CAA2BQ,GAAO,OAASH,EAAM,IAAQ,CACxD,CAAA,EAAAP,EAAaK,EAAUG,EAAOE,CAAK,CAC1B,GAEhB","debugId":"d7d8c73f-7c7e-4258-8b58-293f34ca248d"}
|
package/dist/shell-source-maps/assets/{graph-view-BcbWbnHO.js.map → graph-view-CY9LPr0B.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-view-BcbWbnHO.js","names":["_Fragment","useMemo","useState","useState","useMemo","ReactFlow","n","a","t","__toESM","require_react","require_jsx_runtime","ToneEdge","RecordScope","evaluateCondition","parseCondition","scopeValue","RouteLink","valueColor","valueTone","scopeOf","FieldBadge","ReactFlowProvider","useReactFlow","MarkerType","Position","Controls","index","Handle","useElk","slotPattern","sampleSlots","slots","text","last","match","source","quoted","edgeConditions","edgeCondition","when","import_react","toneStrokes","dashes","edgeConditionsOf","props","name","holds","parsed","scope","row","path","edgeLook","status","colors","view","value","edge","stroke","dash","conditions","labelValue","labels","label","nodeSize","padding","elkPadding","placedGap","groupId","id","nodeId","algorithmOptions","input","unplaced","shape","node","graphElk","nodes","options","box","groups","members","group","loose","laid","edges","boundsOf","boxes","x","y","placeGraph","placed","position","engine","visit","child","parent","at","laidOut","above","below","shift","whole","moved","import_jsx_runtime","handle","Handles","sides","frame","chosen","RecordNode","data","fields","content","to","model","GroupNode","useGraphLayout","elk","signature","placedOnly","setLaidOut","failure","setFailure","current","result","error","nodeTypes","minHeight","maxHeight","fitViewOptions","themed","number","flowNodes","read","drawn","layout","select","flowEdges","look","straight","FitOnLayout","flow","Flow","measured","setMeasured","sizes","positions","layoutName","direction","ready","measure","heights","changes","change","next","before","size","GraphView"],"sources":["../../../../layout/src/filter-slots.ts","../../../../layout/src/graph-edges.ts","../../../src/app/pages/blocks/graph/graph-edges.ts","../../../src/app/pages/blocks/graph/graph-layout.ts","../../../src/app/pages/blocks/graph/graph-nodes.tsx","../../../src/app/pages/blocks/graph/use-graph-layout.ts","../../../src/app/pages/blocks/graph/graph-view.tsx"],"sourcesContent":["import { parseFilter, type Expr } from 'aip-parsers/filter'\n\n// A filter or condition with `{{path}}` slots only parses once each slot stands in for a value: a quoted one for a\n// word, any other for a number. Each slot's place in that text then finds it in the syntax tree.\n\n/** One `{{path}}` of a filter, where its stand-in starts, and whether it sits in quotes as a whole value. */\nexport type FilterSlot = { path: string; start: number; quoted: boolean }\n\nconst slotPattern = /([\"'])\\{\\{\\s*([^{}]*?)\\s*\\}\\}\\1|\\{\\{\\s*([^{}]*?)\\s*\\}\\}/g\n\n/** `source` with every slot replaced by a stand-in value, and the slots in order. */\nexport const sampleSlots = (source: string): { text: string; slots: FilterSlot[] } => {\n const slots: FilterSlot[] = []\n let text = ''\n let last = 0\n for (const match of source.matchAll(slotPattern)) {\n text += source.slice(last, match.index)\n const quoted = match[1] !== undefined\n slots.push({ path: (quoted ? match[2] : match[3])!, start: text.length, quoted })\n text += quoted ? `${match[1]}x${match[1]}` : '0'\n last = match.index + match[0].length\n }\n return { text: text + source.slice(last), slots }\n}\n\ntype Node = { kind: string; span?: { start: number }; [key: string]: unknown }\n\n// The conjuncts of the top level: `a AND b c` is three.\nconst conjuncts = (expr: Expr): Expr[] => (expr.kind === 'and' || expr.kind === 'sequence' ? expr.args.flatMap(conjuncts) : [expr])\n\nconst isLiteralAt = (node: Node, start: number) => (node.kind === 'string' || node.kind === 'number') && node.span?.start === start\n\n/**\n * The slots that are one side of a top-level AND equality with a field on the other, `field = {{path}}`, the one shape\n * a read can split per row without waiting for the rows it depends on; `undefined` when the filter does not parse.\n */\nexport const equalitySlots = (source: string): { slots: FilterSlot[]; split: Set<FilterSlot> } | undefined => {\n const { text, slots } = sampleSlots(source)\n const parsed = parseFilter(text)\n if (!parsed.ok) return\n const split = new Set<FilterSlot>()\n for (const conjunct of parsed.ast ? conjuncts(parsed.ast) : []) {\n if (conjunct.kind !== 'compare' || conjunct.op !== '=') continue\n const [left, right] = [conjunct.left as Node, conjunct.right as Node]\n for (const slot of slots) {\n if ((left.kind === 'member' && isLiteralAt(right, slot.start)) || (right.kind === 'member' && isLiteralAt(left, slot.start))) split.add(slot)\n }\n }\n return { slots, split }\n}\n","import { parseCondition } from './condition'\nimport { sampleSlots } from './filter-slots'\nimport type { LayoutNode } from './node'\n\n/** The conditions on a graph's edge, each evaluated per edge as the graph draws. */\nexport const edgeConditions = ['animated', 'dashed', 'dotted'] as const\n\nconst text = (value: unknown) => (typeof value === 'string' ? value : undefined)\n\n/** A condition on an edge: its `{{path}}`s are the scope's around the graph, filled before it draws; its fields the edge's. */\nexport const edgeCondition = (when: string) => parseCondition(sampleSlots(when).text)\n\n/** The fields of an edge a graph's conditions compare, which its read asks for. */\nexport const edgeConditionFields = (node: LayoutNode): string[] =>\n edgeConditions.flatMap((name) => {\n const when = text(node.props[name])\n const parsed = when === undefined ? undefined : edgeCondition(when)\n return parsed?.ok ? parsed.paths.map((path) => path.split('.')[0]!) : []\n })\n","import { edgeCondition, edgeConditions, evaluateCondition, scopeValue, type GraphProps, type ShapeEdge } from '@protobase/layout'\nimport type { BadgeTone, ViewModel } from '@protobase/schema'\nimport { valueColor, valueTone } from '../../../../live/value-color'\n\n/** How an edge draws: its line's colour, whether it moves, its dashes, and the text on its middle. */\nexport type EdgeLook = { stroke: string; animated: boolean; dash?: string; label?: string }\n\n// A line in the colour its value's badge has, the app's border colour without one\nconst toneStrokes: Record<BadgeTone, string> = {\n neutral: 'var(--color-border-strong)',\n blue: 'var(--color-primary)',\n green: 'var(--color-success)',\n amber: 'var(--color-warning)',\n red: 'var(--color-danger)',\n violet: 'var(--color-violet)',\n}\n\nconst dashes = { dashed: '6 4', dotted: '1.5 4' }\n\ntype Parsed = Partial<Record<(typeof edgeConditions)[number], ReturnType<typeof edgeCondition>>>\n\n/** The graph's conditions on an edge, parsed once: a condition that does not parse never holds. */\nexport const edgeConditionsOf = (props: Pick<GraphProps, (typeof edgeConditions)[number]>): Parsed =>\n Object.fromEntries(edgeConditions.flatMap((name) => (typeof props[name] === 'string' ? [[name, edgeCondition(props[name])]] : [])))\n\nconst holds = (parsed: ReturnType<typeof edgeCondition> | undefined, row: Record<string, unknown>) => {\n if (!parsed?.ok) return false\n const scope = { stack: [{ record: row }] }\n return evaluateCondition(parsed, Object.fromEntries(parsed.paths.map((path) => [path, scopeValue(scope, path)])))\n}\n\n/** How `edge` draws by the graph's `edgeStatus`, `edgeLabel` and conditions, its colours and value labels the edges view's. */\nexport const edgeLook = (edge: ShapeEdge, props: Pick<GraphProps, 'edgeLabel' | 'edgeStatus'>, conditions: Parsed, view: ViewModel | undefined): EdgeLook => {\n const status = props.edgeStatus\n const colors = status === undefined ? undefined : view?.fields[status]?.valueColors\n const value = status === undefined ? undefined : edge.row[status]\n const stroke = status === undefined || value == null ? toneStrokes.neutral : (valueColor(colors, value) ?? toneStrokes[valueTone(colors, value)])\n const dash = holds(conditions.dotted, edge.row) ? dashes.dotted : holds(conditions.dashed, edge.row) ? dashes.dashed : undefined\n const labelValue = props.edgeLabel === undefined ? undefined : edge.row[props.edgeLabel]\n const labels = props.edgeLabel === undefined ? undefined : view?.fields[props.edgeLabel]?.valueLabels\n const label = labelValue == null || labelValue === '' ? undefined : (labels?.[String(labelValue)] ?? String(labelValue))\n return { stroke, animated: holds(conditions.animated, edge.row), ...(dash && { dash }), ...(label !== undefined && { label }) }\n}\n","import type { ElkNode } from 'elkjs/lib/elk-api'\nimport type { GraphLayoutName, GraphShape } from '@protobase/layout'\n\n/** A node's size: room for its label on one or two lines and its status badge, the width a node's own contents get. */\nexport const nodeSize = { width: 200, height: 64 }\n\n/** The width of a node that draws contents of its own, whose height they decide. */\nexport const contentWidth = 224\n\n/** A box at its top-left corner, in the graph's own coordinates. */\nexport type Box = { x: number; y: number; width: number; height: number }\n\nexport type Size = { width: number; height: number }\n\n/** Where each group and node of a graph sits, each group a region around its nodes, and the size of the whole. */\nexport type GraphLayout = { groups: Map<string, Box>; nodes: Map<string, Box>; width: number; height: number }\n\n/** How a graph is laid out: its algorithm, which way a layered one runs, each node's size, and the nodes placed by their records. */\nexport type LayoutInput = { layout: GraphLayoutName; direction: 'down' | 'right'; sizes: ReadonlyMap<string, Size>; positions: ReadonlyMap<string, { x: number; y: number }> }\n\n// Room in a region around its nodes, more on top for its value\nconst padding = { top: 32, side: 16, bottom: 16 }\nconst elkPadding = `[top=${padding.top},left=${padding.side},bottom=${padding.bottom},right=${padding.side}]`\n\n// The space between the nodes the engine lays out and the ones placed above them\nconst placedGap = 48\n\nconst groupId = (id: string) => `group:${id}`\nconst nodeId = (id: string) => `node:${id}`\n\nconst algorithmOptions = (input: LayoutInput): Record<string, string> =>\n input.layout === 'force'\n ? // Its seed is fixed, so the same records always make the same picture\n { 'elk.algorithm': 'force', 'elk.randomSeed': '1', 'elk.spacing.nodeNode': '40' }\n : { 'elk.algorithm': 'layered', 'elk.direction': input.direction === 'right' ? 'RIGHT' : 'DOWN', 'elk.layered.spacing.nodeNodeBetweenLayers': '56', 'elk.spacing.nodeNode': '32' }\n\n/** The nodes the engine places: those without a position of their own. */\nconst unplaced = (shape: GraphShape, input: LayoutInput) => shape.nodes.filter((node) => !input.positions.has(node.id))\n\n/**\n * The graph ELK lays out: each node without a position as a box of its size, inside a box of its group, and each edge\n * between two of them. A layered graph lays its groups out with the rest (hierarchy INCLUDE_CHILDREN); a force one\n * lays each group out inside its box, then the boxes as nodes. `undefined` when every node has a position.\n */\nexport const graphElk = (shape: GraphShape, input: LayoutInput): ElkNode | undefined => {\n const nodes = unplaced(shape, input)\n if (nodes.length === 0) return undefined\n const options = algorithmOptions(input)\n const box = (id: string): ElkNode => ({ id: nodeId(id), ...(input.sizes.get(id) ?? nodeSize) })\n const groups = shape.groups.flatMap((group): ElkNode[] => {\n const members = nodes.filter((node) => node.group === group.id)\n return members.length === 0 ? [] : [{ id: groupId(group.id), layoutOptions: { ...options, 'elk.padding': elkPadding }, children: members.map((node) => box(node.id)) }]\n })\n const loose = nodes.filter((node) => node.group === undefined).map((node) => box(node.id))\n const laid = new Set(nodes.map((node) => node.id))\n const edges = shape.edges.filter((edge) => laid.has(edge.source) && laid.has(edge.target) && edge.source !== edge.target).map((edge) => ({ id: `edge:${edge.id}`, sources: [nodeId(edge.source)], targets: [nodeId(edge.target)] }))\n return { id: 'root', layoutOptions: { ...options, ...(input.layout === 'layered' && { 'elk.hierarchyHandling': 'INCLUDE_CHILDREN' }) }, children: [...groups, ...loose], edges }\n}\n\nconst boundsOf = (boxes: Box[]): Box | undefined => {\n if (boxes.length === 0) return undefined\n const x = Math.min(...boxes.map((box) => box.x))\n const y = Math.min(...boxes.map((box) => box.y))\n return { x, y, width: Math.max(...boxes.map((box) => box.x + box.width)) - x, height: Math.max(...boxes.map((box) => box.y + box.height)) - y }\n}\n\n/**\n * Where everything sits: each placed node at its position, the nodes the engine laid out (`laidOut`, from `graphElk`)\n * under them, each group a region around its nodes, the whole moved so it starts at 0, 0.\n */\nexport const placeGraph = (shape: GraphShape, input: LayoutInput, laidOut?: ElkNode): GraphLayout => {\n const placed = new Map<string, Box>()\n for (const node of shape.nodes) {\n const position = input.positions.get(node.id)\n if (position) placed.set(node.id, { ...position, ...(input.sizes.get(node.id) ?? nodeSize) })\n }\n // ELK gives each child its place inside its parent\n const engine = new Map<string, Box>()\n const visit = (parent: ElkNode, x: number, y: number) => {\n for (const child of parent.children ?? []) {\n const at = { x: x + (child.x ?? 0), y: y + (child.y ?? 0) }\n if (child.id.startsWith('node:')) engine.set(child.id.slice('node:'.length), { ...at, width: child.width ?? nodeSize.width, height: child.height ?? nodeSize.height })\n else visit(child, at.x, at.y)\n }\n }\n if (laidOut) visit(laidOut, 0, 0)\n const above = boundsOf([...placed.values()])\n const below = boundsOf([...engine.values()])\n const shift = above && below ? { x: above.x - below.x, y: above.y + above.height + placedGap - below.y } : { x: 0, y: 0 }\n for (const [id, box] of engine) placed.set(id, { ...box, x: box.x + shift.x, y: box.y + shift.y })\n const groups = new Map<string, Box>()\n for (const group of shape.groups) {\n const members = boundsOf(shape.nodes.filter((node) => node.group === group.id && placed.has(node.id)).map((node) => placed.get(node.id)!))\n if (members) groups.set(group.id, { x: members.x - padding.side, y: members.y - padding.top, width: members.width + 2 * padding.side, height: members.height + padding.top + padding.bottom })\n }\n const whole = boundsOf([...placed.values(), ...groups.values()]) ?? { x: 0, y: 0, width: 0, height: 0 }\n const moved = (box: Box): Box => ({ ...box, x: box.x - whole.x, y: box.y - whole.y })\n return {\n nodes: new Map([...placed].map(([id, box]) => [id, moved(box)])),\n groups: new Map([...groups].map(([id, box]) => [id, moved(box)])),\n width: whole.width,\n height: whole.height,\n }\n}\n","import type { GraphFields } from '@protobase/layout'\nimport type { ResourceModel, ViewModel } from '@protobase/schema'\nimport { Handle, Position, type Node, type NodeProps } from '@xyflow/react'\nimport type { ReactNode } from 'react'\nimport { RouteLink, type RouteTarget } from '../../../../primitives/route-link'\nimport { FieldBadge } from '../../../field-badge'\nimport { ToneEdge } from '../../../related-cards/tone-edge'\nimport { RecordScope } from '../../record-scope'\nimport { scopeOf } from '../../use-layout-data'\n\ntype Drawn = { model: ResourceModel; view: ViewModel | undefined; fields: GraphFields }\n\n/** Which sides a node's edges meet it on: the top and bottom for a graph that runs down, else the left and right. */\nexport type Sides = 'vertical' | 'horizontal'\n\n/**\n * A node as it draws: its record, what the graph draws in each node, the link that chooses it when the graph has\n * `select`, whether it is chosen, and which sides its edges meet.\n */\nexport type RecordNodeData = Drawn & { row: Record<string, unknown>; content?: ReactNode; to?: RouteTarget; chosen: boolean; sides: Sides }\n\n/** A group as it draws: the record of one of its nodes, whose `group` value it shows. */\nexport type GroupNodeData = Drawn & { row: Record<string, unknown> }\n\n// The handles take no part in the drawing, since the graph cannot be edited\nconst handle = 'pointer-events-none !min-h-0 !min-w-0 !border-0 !bg-transparent'\n\nconst Handles = ({ sides }: { sides: Sides }) => (\n <>\n <Handle type=\"target\" position={sides === 'vertical' ? Position.Top : Position.Left} isConnectable={false} className={handle} />\n <Handle type=\"source\" position={sides === 'vertical' ? Position.Bottom : Position.Right} isConnectable={false} className={handle} />\n </>\n)\n\nconst frame = (chosen: boolean) => `relative rounded-lg border bg-surface text-body ${chosen ? 'border-primary ring-2 ring-primary/40' : 'border-border'}`\n\n/**\n * A node: with contents of the graph's own, those, drawn inside its record, the whole node a link that chooses it; else\n * its label, linking to the page with it chosen, over its status badge. Its status colours its left edge.\n */\nexport const RecordNode = ({ data }: NodeProps<Node<RecordNodeData, 'record'>>) => {\n const { model, view, fields, row, content, to, chosen, sides } = data\n const label = String(row[fields.label] ?? '')\n const edge = fields.status && <ToneEdge view={view} field={fields.status} record={row} />\n if (content !== undefined) {\n return (\n <div data-chosen={chosen || undefined} className={`${frame(chosen)} flex w-full flex-col gap-1 px-3 py-2`}>\n <Handles sides={sides} />\n {edge}\n {/* A link over the whole node chooses it, under the contents, whose own links stay theirs; React Flow turns\n pointer events off on a node that cannot be dragged or selected, so each takes them back */}\n {to && <RouteLink to={to} aria-label={label} aria-current={chosen || undefined} className=\"pointer-events-auto absolute inset-0 rounded-lg hover:bg-muted/40\" />}\n <div className=\"relative min-w-0 [overflow-wrap:anywhere] [&_a]:pointer-events-auto\">\n <RecordScope value={scopeOf(model, row)}>{content}</RecordScope>\n </div>\n </div>\n )\n }\n return (\n <div data-chosen={chosen || undefined} className={`${frame(chosen)} flex size-full flex-col justify-center gap-1 px-3 py-2`}>\n <Handles sides={sides} />\n {edge}\n {to ? (\n <RouteLink to={to} aria-current={chosen || undefined} className=\"pointer-events-auto line-clamp-2 min-w-0 font-medium [overflow-wrap:anywhere] text-primary-text hover:underline\">\n {label}\n </RouteLink>\n ) : (\n <span className=\"line-clamp-2 min-w-0 font-medium [overflow-wrap:anywhere]\">{label}</span>\n )}\n {fields.status && (\n <div className=\"flex\">\n <FieldBadge model={model} view={view} field={fields.status} record={row} />\n </div>\n )}\n </div>\n )\n}\n\n/** A group: a region around its nodes, its `group` value at its top. */\nexport const GroupNode = ({ data }: NodeProps<Node<GroupNodeData, 'group-box'>>) => (\n <div className=\"size-full rounded-xl border border-dashed border-border-strong bg-muted/40\">\n {data.fields.group && (\n <div className=\"flex px-2 pt-1 text-xs\">\n <FieldBadge model={data.model} view={data.view} field={data.fields.group} record={data.row} />\n </div>\n )}\n </div>\n)\n","import { useEffect, useMemo, useState } from 'react'\nimport type { GraphShape } from '@protobase/layout'\nimport { useElk } from '../../../../lib/elk/use-elk'\nimport { graphElk, placeGraph, type GraphLayout, type LayoutInput } from './graph-layout'\n\n/**\n * Where the graph's groups and nodes sit, laid out again when its nodes, edges, sizes or positions change; undefined\n * until the first layout is done. A layout that a newer one overtook is dropped. Without a node to lay out, the engine\n * is never asked. A layout that fails throws, for the block's fallback or the page's error boundary to draw.\n */\nexport const useGraphLayout = (shape: GraphShape, input: LayoutInput): GraphLayout | undefined => {\n const elk = graphElk(shape, input)\n const engine = useElk()\n // One text for what the layout is made from, so a new shape of the same records lays nothing out again\n const signature = JSON.stringify([elk, shape.nodes.map((node) => node.id), shape.groups.map((group) => group.id), [...input.positions], [...input.sizes]])\n const placedOnly = useMemo(() => (elk ? undefined : placeGraph(shape, input)), [signature])\n const [laidOut, setLaidOut] = useState<{ signature: string; layout: GraphLayout }>()\n const [failure, setFailure] = useState<Error>()\n useEffect(() => {\n if (!engine || !elk) return\n let current = true\n engine.layout(elk).then(\n (result) => {\n if (current) setLaidOut({ signature, layout: placeGraph(shape, input, result) })\n },\n (error: unknown) => {\n if (current) setFailure(error instanceof Error ? error : new Error(String(error)))\n },\n )\n return () => {\n current = false\n }\n }, [engine, signature])\n // A layout that failed, such as a worker that cannot load, draws the graph's fallback or its error, not a blank box\n if (failure) throw failure\n if (placedOnly) return placedOnly\n // The last layout stands while the next one is made, so a live update does not blank the graph\n return laidOut?.layout\n}\n","import { Controls, MarkerType, ReactFlow, ReactFlowProvider, useReactFlow, type Edge, type Node, type NodeChange } from '@xyflow/react'\nimport type { GraphFields, GraphProps, GraphShape } from '@protobase/layout'\nimport { useEffect, useMemo, useState, type CSSProperties, type ReactNode } from 'react'\nimport type { ComponentRead, ComponentSelect } from '../../component-reads'\nimport { edgeConditionsOf, edgeLook } from './graph-edges'\nimport { contentWidth, nodeSize, type GraphLayout, type Size } from './graph-layout'\nimport { GroupNode, RecordNode, type GroupNodeData, type RecordNodeData, type Sides } from './graph-nodes'\nimport { useGraphLayout } from './use-graph-layout'\nimport '@xyflow/react/dist/style.css'\n\nconst nodeTypes = { record: RecordNode, 'group-box': GroupNode }\n\n// The box's height follows the graph's shape at the box's width, within bounds, so the page scrolls past it\nconst minHeight = 256\nconst maxHeight = 'min(40rem, 70vh)'\n\n// A graph wider than the box, as on a phone, stays readable and pans; the fit button shows all of it\nconst fitViewOptions = { minZoom: 0.6, maxZoom: 1 }\n\n// The library's lines and controls in the app's tokens, over the page's own background: the variables it reads over\n// its own defaults\nconst themed = {\n '--xy-edge-stroke': 'var(--color-border-strong)',\n '--xy-edge-stroke-width': '1.5',\n '--xy-background-color': 'transparent',\n '--xy-edge-label-background-color': 'var(--color-surface)',\n '--xy-edge-label-color': 'var(--color-muted-foreground)',\n '--xy-controls-button-background-color': 'var(--color-surface)',\n '--xy-controls-button-background-color-hover': 'var(--color-muted)',\n '--xy-controls-button-color': 'var(--color-foreground)',\n '--xy-controls-button-color-hover': 'var(--color-foreground)',\n '--xy-controls-button-border-color': 'var(--color-border)',\n '--xy-attribution-background-color': 'transparent',\n} as CSSProperties\n\nexport type GraphViewProps = {\n shape: GraphShape\n nodes: Pick<ComponentRead, 'model' | 'view'>\n edges: Pick<ComponentRead, 'model' | 'view'>\n fields: GraphFields\n props: Pick<GraphProps, 'layout' | 'direction' | 'x' | 'y' | 'edgeLabel' | 'edgeStatus' | 'animated' | 'dashed' | 'dotted'>\n select?: ComponentSelect\n /** What each node draws, inside its record, the graph's `node`; its label and status without it. */\n content?: ReactNode\n}\n\nconst number = (value: unknown) => (typeof value === 'number' && Number.isFinite(value) ? value : typeof value === 'string' && value.trim() !== '' && Number.isFinite(Number(value)) ? Number(value) : undefined)\n\n// The nodes React Flow draws: each group's region under the nodes, each node at its box, one with contents of its own\n// as wide as they are given and as tall as they draw, which it measures\nconst flowNodes = ({ shape, nodes: read, fields, select, content }: GraphViewProps, layout: GraphLayout | undefined, sides: Sides): Node[] => {\n const drawn = { model: read.model, view: read.view, fields }\n const groups = shape.groups.flatMap((group): Node<GroupNodeData>[] => {\n const box = layout?.groups.get(group.id)\n const row = shape.nodes.find((node) => node.group === group.id)!.row\n return box ? [{ id: `group:${group.id}`, type: 'group-box', position: { x: box.x, y: box.y }, width: box.width, height: box.height, zIndex: -1, data: { ...drawn, row }, draggable: false, selectable: false, focusable: false }] : []\n })\n const nodes = shape.nodes.map((node): Node<RecordNodeData> => {\n const box = layout?.nodes.get(node.id)\n const chosen = select?.chosen === node.id\n return {\n id: `node:${node.id}`,\n type: 'record',\n position: box ? { x: box.x, y: box.y } : { x: 0, y: 0 },\n ...(content === undefined ? { width: nodeSize.width, height: nodeSize.height } : { style: { width: contentWidth } }),\n data: { ...drawn, row: node.row, chosen, sides, ...(content !== undefined && { content }), ...(select && { to: select.linkTo(node.id) }) },\n draggable: false,\n selectable: false,\n }\n })\n return [...groups, ...nodes]\n}\n\nconst flowEdges = ({ shape, edges: read, props }: GraphViewProps, straight: boolean): Edge[] => {\n const conditions = edgeConditionsOf(props)\n return shape.edges.map((edge) => {\n const look = edgeLook(edge, props, conditions, read.view)\n return {\n id: `edge:${edge.id}`,\n source: `node:${edge.source}`,\n target: `node:${edge.target}`,\n ...(straight && { type: 'straight' }),\n markerEnd: { type: MarkerType.ArrowClosed, color: look.stroke },\n style: { stroke: look.stroke, ...(look.dash && { strokeDasharray: look.dash }) },\n animated: look.animated,\n ...(look.label !== undefined && { label: look.label, labelBgPadding: [4, 2] as [number, number], labelBgBorderRadius: 4 }),\n focusable: false,\n selectable: false,\n }\n })\n}\n\n// Fits the graph to its box each time it is laid out anew, as its first fit does, a frame later, once the nodes stand\n// where the layout put them\nconst FitOnLayout = ({ layout }: { layout: GraphLayout | undefined }) => {\n const flow = useReactFlow()\n useEffect(() => {\n if (!layout) return\n const frame = requestAnimationFrame(() => void flow.fitView(fitViewOptions))\n return () => cancelAnimationFrame(frame)\n }, [flow, layout])\n return null\n}\n\nconst Flow = (props: GraphViewProps) => {\n const { shape, content } = props\n const [measured, setMeasured] = useState<ReadonlyMap<string, Size>>(new Map())\n const sizes = useMemo(() => new Map(shape.nodes.map((node) => [node.id, content === undefined ? nodeSize : { width: contentWidth, height: measured.get(node.id)?.height ?? nodeSize.height }])), [shape, content, measured])\n const positions = useMemo(() => {\n const { x, y } = props.props\n if (x === undefined || y === undefined) return new Map<string, { x: number; y: number }>()\n return new Map(shape.nodes.flatMap((node) => {\n const at = { x: number(node.row[x]), y: number(node.row[y]) }\n return at.x === undefined || at.y === undefined ? [] : [[node.id, at as { x: number; y: number }]]\n }))\n }, [shape, props.props.x, props.props.y])\n const layoutName = props.props.layout ?? 'layered'\n const direction = props.props.direction ?? 'down'\n const layout = useGraphLayout(shape, { layout: layoutName, direction, sizes, positions })\n // A node with contents of its own is laid out at the height it draws at, so until each has drawn once the graph is\n // see-through: React Flow shows each node itself, so hiding the box would not hide them\n const ready = layout !== undefined && (content === undefined || shape.nodes.every((node) => measured.has(node.id)))\n const sides: Sides = layoutName === 'layered' && direction === 'right' ? 'horizontal' : 'vertical'\n const nodes = flowNodes(props, layout, sides)\n const edges = useMemo(() => flowEdges(props, layoutName === 'force'), [shape, props.edges.view, props.props, layoutName])\n const measure = (changes: NodeChange[]) => {\n const heights = changes.flatMap((change) => (change.type === 'dimensions' && change.dimensions && change.id.startsWith('node:') ? [[change.id.slice('node:'.length), change.dimensions] as const] : []))\n if (heights.length === 0) return\n setMeasured((before) => {\n const next = new Map(before)\n for (const [id, size] of heights) next.set(id, { width: Math.round(size.width), height: Math.round(size.height) })\n const same = next.size === before.size && [...next].every(([id, size]) => before.get(id)?.height === size.height)\n return same ? before : next\n })\n }\n return (\n <div className=\"w-full\" style={{ ...themed, aspectRatio: layout ? `${Math.max(layout.width, 1)} / ${Math.max(layout.height, 1)}` : undefined, minHeight, maxHeight, ...(!ready && { opacity: 0 }) }}>\n <ReactFlow\n nodes={nodes}\n edges={edges}\n nodeTypes={nodeTypes}\n onNodesChange={content === undefined ? undefined : measure}\n fitView\n fitViewOptions={fitViewOptions}\n minZoom={0.1}\n nodesDraggable={false}\n nodesConnectable={false}\n elementsSelectable={false}\n edgesFocusable={false}\n zoomOnScroll={false}\n zoomOnDoubleClick={false}\n preventScrolling={false}\n zoomOnPinch\n panOnDrag\n >\n <FitOnLayout layout={ready ? layout : undefined} />\n <Controls showInteractive={false} />\n </ReactFlow>\n </div>\n )\n}\n\n/**\n * The graph in a box as wide as the page and as tall as its shape asks, within bounds, fitted to it unless that would\n * shrink it past reading: pinch or the zoom buttons zoom it, dragging pans it, and the wheel scrolls the page past it.\n * Read-only: nothing moves, connects or is deleted.\n */\nexport const GraphView = (props: GraphViewProps) => (\n <ReactFlowProvider>\n <Flow {...props} />\n </ReactFlowProvider>\n)\n"],"mappings":"g6BAQA,IAAM8B,EAAc,2DAGPC,EAAe,GAA0D,CACpF,IAAMC,EAAsB,CAAC,EACzBC,EAAO,GACPC,EAAO,EACX,IAAK,IAAMC,KAASC,EAAO,SAASN,CAAW,EAAG,CAChD,GAAQM,EAAO,MAAMF,EAAMC,EAAM,KAAK,EACtC,IAAME,EAASF,EAAM,KAAO,IAAA,GAC5BH,EAAM,KAAK,CAAE,KAAOK,EAASF,EAAM,GAAKA,EAAM,GAAM,MAAOF,EAAK,OAAQ,QAAO,CAAC,EAChF,GAAQI,EAAS,GAAGF,EAAM,GAAG,GAAGA,EAAM,KAAO,IAC7C,EAAOA,EAAM,MAAQA,EAAM,EAAE,CAAC,MAChC,CACA,MAAO,CAAE,KAAMF,EAAOG,EAAO,MAAMF,CAAI,EAAG,OAAM,CAClD,EClBaI,EAAiB,CAAC,WAAY,SAAU,QAAQ,EAKhDC,EAAiB,GAAiBxB,EAAegB,EAAYS,CAAI,CAAC,CAAC,IAAI,aCF9EE,EAAyC,CAC7C,QAAS,6BACT,KAAM,uBACN,MAAO,uBACP,MAAO,uBACP,IAAK,sBACL,OAAQ,qBACV,EAEMC,EAAS,CAAE,OAAQ,MAAO,OAAQ,OAAQ,EAKnCC,EAAoB,GAC/B,OAAO,YAAYN,EAAe,QAAS,GAAU,OAAOO,EAAMC,IAAU,SAAW,CAAC,CAACA,EAAMP,EAAcM,EAAMC,EAAK,CAAC,CAAC,EAAI,CAAC,CAAE,CAAC,EAE9HC,GAAS,EAAsD,IAAiC,CACpG,GAAI,CAACC,GAAQ,GAAI,MAAO,GACxB,IAAMC,EAAQ,CAAE,MAAO,CAAC,CAAE,OAAQC,CAAI,CAAC,CAAE,EACzC,OAA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B,GAChB,aAAc,GACd,kBAAmB,GACnB,iBAAkB,GAClB,YAAA,GACA,UAAA,GAhBF,SAAA,EAkBE,EAAA/C,EAAA,IAAA,CAACqC,GAAD,CAAa,OAAQS,EAAQd,EAAS,IAAA,EAAY,CAAA,GAClD,EAAAhC,EAAA,IAAA,CAAC9E,EAAD,CAAU,gBAAiB,EAAQ,CAAA,CAC1B,GACR,CAAA,CAET,EAOaoI,GAAa,IACxB,EAAAtD,EAAA,IAAA,CAAClF,EAAD,CAAA,UACE,EAAAkF,EAAA,IAAA,CAACuC,GAAD,CAAM,GAAIlG,CAAQ,CAAA,CACD,CAAA","debugId":"5c6d66e7-1ce6-4b70-a3ee-46695411f90d"}
|
|
1
|
+
{"version":3,"file":"graph-view-CY9LPr0B.js","names":["_Fragment","useMemo","useState","useState","useMemo","ReactFlow","n","a","t","__toESM","require_react","require_jsx_runtime","parseCondition","scopeValue","ToneEdge","evaluateCondition","RecordScope","RouteLink","valueColor","valueTone","scopeOf","FieldBadge","ReactFlowProvider","useReactFlow","MarkerType","Position","Controls","index","Handle","useElk","slotPattern","sampleSlots","slots","text","last","match","source","quoted","edgeConditions","edgeCondition","when","import_react","toneStrokes","dashes","edgeConditionsOf","props","name","holds","parsed","scope","row","path","edgeLook","status","colors","view","value","edge","stroke","dash","conditions","labelValue","labels","label","nodeSize","padding","elkPadding","placedGap","groupId","id","nodeId","algorithmOptions","input","unplaced","shape","node","graphElk","nodes","options","box","groups","members","group","loose","laid","edges","boundsOf","boxes","x","y","placeGraph","placed","position","engine","visit","child","parent","at","laidOut","above","below","shift","whole","moved","import_jsx_runtime","handle","Handles","sides","frame","chosen","RecordNode","data","fields","content","to","model","GroupNode","useGraphLayout","elk","signature","placedOnly","setLaidOut","failure","setFailure","current","result","error","nodeTypes","minHeight","maxHeight","fitViewOptions","themed","number","flowNodes","read","drawn","layout","select","flowEdges","look","straight","FitOnLayout","flow","Flow","measured","setMeasured","sizes","positions","layoutName","direction","ready","measure","heights","changes","change","next","before","size","GraphView"],"sources":["../../../../layout/src/filter-slots.ts","../../../../layout/src/graph-edges.ts","../../../src/app/pages/blocks/graph/graph-edges.ts","../../../src/app/pages/blocks/graph/graph-layout.ts","../../../src/app/pages/blocks/graph/graph-nodes.tsx","../../../src/app/pages/blocks/graph/use-graph-layout.ts","../../../src/app/pages/blocks/graph/graph-view.tsx"],"sourcesContent":["import { parseFilter, type Expr } from 'aip-parsers/filter'\n\n// A filter or condition with `{{path}}` slots only parses once each slot stands in for a value: a quoted one for a\n// word, any other for a number. Each slot's place in that text then finds it in the syntax tree.\n\n/** One `{{path}}` of a filter, where its stand-in starts, and whether it sits in quotes as a whole value. */\nexport type FilterSlot = { path: string; start: number; quoted: boolean }\n\nconst slotPattern = /([\"'])\\{\\{\\s*([^{}]*?)\\s*\\}\\}\\1|\\{\\{\\s*([^{}]*?)\\s*\\}\\}/g\n\n/** `source` with every slot replaced by a stand-in value, and the slots in order. */\nexport const sampleSlots = (source: string): { text: string; slots: FilterSlot[] } => {\n const slots: FilterSlot[] = []\n let text = ''\n let last = 0\n for (const match of source.matchAll(slotPattern)) {\n text += source.slice(last, match.index)\n const quoted = match[1] !== undefined\n slots.push({ path: (quoted ? match[2] : match[3])!, start: text.length, quoted })\n text += quoted ? `${match[1]}x${match[1]}` : '0'\n last = match.index + match[0].length\n }\n return { text: text + source.slice(last), slots }\n}\n\ntype Node = { kind: string; span?: { start: number }; [key: string]: unknown }\n\n// The conjuncts of the top level: `a AND b c` is three.\nconst conjuncts = (expr: Expr): Expr[] => (expr.kind === 'and' || expr.kind === 'sequence' ? expr.args.flatMap(conjuncts) : [expr])\n\nconst isLiteralAt = (node: Node, start: number) => (node.kind === 'string' || node.kind === 'number') && node.span?.start === start\n\n/**\n * The slots that are one side of a top-level AND equality with a field on the other, `field = {{path}}`, the one shape\n * a read can split per row without waiting for the rows it depends on; `undefined` when the filter does not parse.\n */\nexport const equalitySlots = (source: string): { slots: FilterSlot[]; split: Set<FilterSlot> } | undefined => {\n const { text, slots } = sampleSlots(source)\n const parsed = parseFilter(text)\n if (!parsed.ok) return\n const split = new Set<FilterSlot>()\n for (const conjunct of parsed.ast ? conjuncts(parsed.ast) : []) {\n if (conjunct.kind !== 'compare' || conjunct.op !== '=') continue\n const [left, right] = [conjunct.left as Node, conjunct.right as Node]\n for (const slot of slots) {\n if ((left.kind === 'member' && isLiteralAt(right, slot.start)) || (right.kind === 'member' && isLiteralAt(left, slot.start))) split.add(slot)\n }\n }\n return { slots, split }\n}\n","import { parseCondition } from './condition'\nimport { sampleSlots } from './filter-slots'\nimport type { LayoutNode } from './node'\n\n/** The conditions on a graph's edge, each evaluated per edge as the graph draws. */\nexport const edgeConditions = ['animated', 'dashed', 'dotted'] as const\n\nconst text = (value: unknown) => (typeof value === 'string' ? value : undefined)\n\n/** A condition on an edge: its `{{path}}`s are the scope's around the graph, filled before it draws; its fields the edge's. */\nexport const edgeCondition = (when: string) => parseCondition(sampleSlots(when).text)\n\n/** The fields of an edge a graph's conditions compare, which its read asks for. */\nexport const edgeConditionFields = (node: LayoutNode): string[] =>\n edgeConditions.flatMap((name) => {\n const when = text(node.props[name])\n const parsed = when === undefined ? undefined : edgeCondition(when)\n return parsed?.ok ? parsed.paths.map((path) => path.split('.')[0]!) : []\n })\n","import { edgeCondition, edgeConditions, evaluateCondition, scopeValue, type GraphProps, type ShapeEdge } from '@protobase/layout'\nimport type { BadgeTone, ViewModel } from '@protobase/schema'\nimport { valueColor, valueTone } from '../../../../live/value-color'\n\n/** How an edge draws: its line's colour, whether it moves, its dashes, and the text on its middle. */\nexport type EdgeLook = { stroke: string; animated: boolean; dash?: string; label?: string }\n\n// A line in the colour its value's badge has, the app's border colour without one\nconst toneStrokes: Record<BadgeTone, string> = {\n neutral: 'var(--color-border-strong)',\n blue: 'var(--color-primary)',\n green: 'var(--color-success)',\n amber: 'var(--color-warning)',\n red: 'var(--color-danger)',\n violet: 'var(--color-violet)',\n}\n\nconst dashes = { dashed: '6 4', dotted: '1.5 4' }\n\ntype Parsed = Partial<Record<(typeof edgeConditions)[number], ReturnType<typeof edgeCondition>>>\n\n/** The graph's conditions on an edge, parsed once: a condition that does not parse never holds. */\nexport const edgeConditionsOf = (props: Pick<GraphProps, (typeof edgeConditions)[number]>): Parsed =>\n Object.fromEntries(edgeConditions.flatMap((name) => (typeof props[name] === 'string' ? [[name, edgeCondition(props[name])]] : [])))\n\nconst holds = (parsed: ReturnType<typeof edgeCondition> | undefined, row: Record<string, unknown>) => {\n if (!parsed?.ok) return false\n const scope = { stack: [{ record: row }] }\n return evaluateCondition(parsed, Object.fromEntries(parsed.paths.map((path) => [path, scopeValue(scope, path)])))\n}\n\n/** How `edge` draws by the graph's `edgeStatus`, `edgeLabel` and conditions, its colours and value labels the edges view's. */\nexport const edgeLook = (edge: ShapeEdge, props: Pick<GraphProps, 'edgeLabel' | 'edgeStatus'>, conditions: Parsed, view: ViewModel | undefined): EdgeLook => {\n const status = props.edgeStatus\n const colors = status === undefined ? undefined : view?.fields[status]?.valueColors\n const value = status === undefined ? undefined : edge.row[status]\n const stroke = status === undefined || value == null ? toneStrokes.neutral : (valueColor(colors, value) ?? toneStrokes[valueTone(colors, value)])\n const dash = holds(conditions.dotted, edge.row) ? dashes.dotted : holds(conditions.dashed, edge.row) ? dashes.dashed : undefined\n const labelValue = props.edgeLabel === undefined ? undefined : edge.row[props.edgeLabel]\n const labels = props.edgeLabel === undefined ? undefined : view?.fields[props.edgeLabel]?.valueLabels\n const label = labelValue == null || labelValue === '' ? undefined : (labels?.[String(labelValue)] ?? String(labelValue))\n return { stroke, animated: holds(conditions.animated, edge.row), ...(dash && { dash }), ...(label !== undefined && { label }) }\n}\n","import type { ElkNode } from 'elkjs/lib/elk-api'\nimport type { GraphLayoutName, GraphShape } from '@protobase/layout'\n\n/** A node's size: room for its label on one or two lines and its status badge, the width a node's own contents get. */\nexport const nodeSize = { width: 200, height: 64 }\n\n/** The width of a node that draws contents of its own, whose height they decide. */\nexport const contentWidth = 224\n\n/** A box at its top-left corner, in the graph's own coordinates. */\nexport type Box = { x: number; y: number; width: number; height: number }\n\nexport type Size = { width: number; height: number }\n\n/** Where each group and node of a graph sits, each group a region around its nodes, and the size of the whole. */\nexport type GraphLayout = { groups: Map<string, Box>; nodes: Map<string, Box>; width: number; height: number }\n\n/** How a graph is laid out: its algorithm, which way a layered one runs, each node's size, and the nodes placed by their records. */\nexport type LayoutInput = { layout: GraphLayoutName; direction: 'down' | 'right'; sizes: ReadonlyMap<string, Size>; positions: ReadonlyMap<string, { x: number; y: number }> }\n\n// Room in a region around its nodes, more on top for its value\nconst padding = { top: 32, side: 16, bottom: 16 }\nconst elkPadding = `[top=${padding.top},left=${padding.side},bottom=${padding.bottom},right=${padding.side}]`\n\n// The space between the nodes the engine lays out and the ones placed above them\nconst placedGap = 48\n\nconst groupId = (id: string) => `group:${id}`\nconst nodeId = (id: string) => `node:${id}`\n\nconst algorithmOptions = (input: LayoutInput): Record<string, string> =>\n input.layout === 'force'\n ? // Its seed is fixed, so the same records always make the same picture\n { 'elk.algorithm': 'force', 'elk.randomSeed': '1', 'elk.spacing.nodeNode': '40' }\n : { 'elk.algorithm': 'layered', 'elk.direction': input.direction === 'right' ? 'RIGHT' : 'DOWN', 'elk.layered.spacing.nodeNodeBetweenLayers': '56', 'elk.spacing.nodeNode': '32' }\n\n/** The nodes the engine places: those without a position of their own. */\nconst unplaced = (shape: GraphShape, input: LayoutInput) => shape.nodes.filter((node) => !input.positions.has(node.id))\n\n/**\n * The graph ELK lays out: each node without a position as a box of its size, inside a box of its group, and each edge\n * between two of them. A layered graph lays its groups out with the rest (hierarchy INCLUDE_CHILDREN); a force one\n * lays each group out inside its box, then the boxes as nodes. `undefined` when every node has a position.\n */\nexport const graphElk = (shape: GraphShape, input: LayoutInput): ElkNode | undefined => {\n const nodes = unplaced(shape, input)\n if (nodes.length === 0) return undefined\n const options = algorithmOptions(input)\n const box = (id: string): ElkNode => ({ id: nodeId(id), ...(input.sizes.get(id) ?? nodeSize) })\n const groups = shape.groups.flatMap((group): ElkNode[] => {\n const members = nodes.filter((node) => node.group === group.id)\n return members.length === 0 ? [] : [{ id: groupId(group.id), layoutOptions: { ...options, 'elk.padding': elkPadding }, children: members.map((node) => box(node.id)) }]\n })\n const loose = nodes.filter((node) => node.group === undefined).map((node) => box(node.id))\n const laid = new Set(nodes.map((node) => node.id))\n const edges = shape.edges.filter((edge) => laid.has(edge.source) && laid.has(edge.target) && edge.source !== edge.target).map((edge) => ({ id: `edge:${edge.id}`, sources: [nodeId(edge.source)], targets: [nodeId(edge.target)] }))\n return { id: 'root', layoutOptions: { ...options, ...(input.layout === 'layered' && { 'elk.hierarchyHandling': 'INCLUDE_CHILDREN' }) }, children: [...groups, ...loose], edges }\n}\n\nconst boundsOf = (boxes: Box[]): Box | undefined => {\n if (boxes.length === 0) return undefined\n const x = Math.min(...boxes.map((box) => box.x))\n const y = Math.min(...boxes.map((box) => box.y))\n return { x, y, width: Math.max(...boxes.map((box) => box.x + box.width)) - x, height: Math.max(...boxes.map((box) => box.y + box.height)) - y }\n}\n\n/**\n * Where everything sits: each placed node at its position, the nodes the engine laid out (`laidOut`, from `graphElk`)\n * under them, each group a region around its nodes, the whole moved so it starts at 0, 0.\n */\nexport const placeGraph = (shape: GraphShape, input: LayoutInput, laidOut?: ElkNode): GraphLayout => {\n const placed = new Map<string, Box>()\n for (const node of shape.nodes) {\n const position = input.positions.get(node.id)\n if (position) placed.set(node.id, { ...position, ...(input.sizes.get(node.id) ?? nodeSize) })\n }\n // ELK gives each child its place inside its parent\n const engine = new Map<string, Box>()\n const visit = (parent: ElkNode, x: number, y: number) => {\n for (const child of parent.children ?? []) {\n const at = { x: x + (child.x ?? 0), y: y + (child.y ?? 0) }\n if (child.id.startsWith('node:')) engine.set(child.id.slice('node:'.length), { ...at, width: child.width ?? nodeSize.width, height: child.height ?? nodeSize.height })\n else visit(child, at.x, at.y)\n }\n }\n if (laidOut) visit(laidOut, 0, 0)\n const above = boundsOf([...placed.values()])\n const below = boundsOf([...engine.values()])\n const shift = above && below ? { x: above.x - below.x, y: above.y + above.height + placedGap - below.y } : { x: 0, y: 0 }\n for (const [id, box] of engine) placed.set(id, { ...box, x: box.x + shift.x, y: box.y + shift.y })\n const groups = new Map<string, Box>()\n for (const group of shape.groups) {\n const members = boundsOf(shape.nodes.filter((node) => node.group === group.id && placed.has(node.id)).map((node) => placed.get(node.id)!))\n if (members) groups.set(group.id, { x: members.x - padding.side, y: members.y - padding.top, width: members.width + 2 * padding.side, height: members.height + padding.top + padding.bottom })\n }\n const whole = boundsOf([...placed.values(), ...groups.values()]) ?? { x: 0, y: 0, width: 0, height: 0 }\n const moved = (box: Box): Box => ({ ...box, x: box.x - whole.x, y: box.y - whole.y })\n return {\n nodes: new Map([...placed].map(([id, box]) => [id, moved(box)])),\n groups: new Map([...groups].map(([id, box]) => [id, moved(box)])),\n width: whole.width,\n height: whole.height,\n }\n}\n","import type { GraphFields } from '@protobase/layout'\nimport type { ResourceModel, ViewModel } from '@protobase/schema'\nimport { Handle, Position, type Node, type NodeProps } from '@xyflow/react'\nimport type { ReactNode } from 'react'\nimport { RouteLink, type RouteTarget } from '../../../../primitives/route-link'\nimport { FieldBadge } from '../../../field-badge'\nimport { ToneEdge } from '../../../related-cards/tone-edge'\nimport { RecordScope } from '../../record-scope'\nimport { scopeOf } from '../../use-layout-data'\n\ntype Drawn = { model: ResourceModel; view: ViewModel | undefined; fields: GraphFields }\n\n/** Which sides a node's edges meet it on: the top and bottom for a graph that runs down, else the left and right. */\nexport type Sides = 'vertical' | 'horizontal'\n\n/**\n * A node as it draws: its record, what the graph draws in each node, the link that chooses it when the graph has\n * `select`, whether it is chosen, and which sides its edges meet.\n */\nexport type RecordNodeData = Drawn & { row: Record<string, unknown>; content?: ReactNode; to?: RouteTarget; chosen: boolean; sides: Sides }\n\n/** A group as it draws: the record of one of its nodes, whose `group` value it shows. */\nexport type GroupNodeData = Drawn & { row: Record<string, unknown> }\n\n// The handles take no part in the drawing, since the graph cannot be edited\nconst handle = 'pointer-events-none !min-h-0 !min-w-0 !border-0 !bg-transparent'\n\nconst Handles = ({ sides }: { sides: Sides }) => (\n <>\n <Handle type=\"target\" position={sides === 'vertical' ? Position.Top : Position.Left} isConnectable={false} className={handle} />\n <Handle type=\"source\" position={sides === 'vertical' ? Position.Bottom : Position.Right} isConnectable={false} className={handle} />\n </>\n)\n\nconst frame = (chosen: boolean) => `relative rounded-lg border bg-surface text-body ${chosen ? 'border-primary ring-2 ring-primary/40' : 'border-border'}`\n\n/**\n * A node: with contents of the graph's own, those, drawn inside its record, the whole node a link that chooses it; else\n * its label, linking to the page with it chosen, over its status badge. Its status colours its left edge.\n */\nexport const RecordNode = ({ data }: NodeProps<Node<RecordNodeData, 'record'>>) => {\n const { model, view, fields, row, content, to, chosen, sides } = data\n const label = String(row[fields.label] ?? '')\n const edge = fields.status && <ToneEdge view={view} field={fields.status} record={row} />\n if (content !== undefined) {\n return (\n <div data-chosen={chosen || undefined} className={`${frame(chosen)} flex w-full flex-col gap-1 px-3 py-2`}>\n <Handles sides={sides} />\n {edge}\n {/* A link over the whole node chooses it, under the contents, whose own links stay theirs; React Flow turns\n pointer events off on a node that cannot be dragged or selected, so each takes them back */}\n {to && <RouteLink to={to} aria-label={label} aria-current={chosen || undefined} className=\"pointer-events-auto absolute inset-0 rounded-lg hover:bg-muted/40\" />}\n <div className=\"relative min-w-0 [overflow-wrap:anywhere] [&_a]:pointer-events-auto\">\n <RecordScope value={scopeOf(model, row)}>{content}</RecordScope>\n </div>\n </div>\n )\n }\n return (\n <div data-chosen={chosen || undefined} className={`${frame(chosen)} flex size-full flex-col justify-center gap-1 px-3 py-2`}>\n <Handles sides={sides} />\n {edge}\n {to ? (\n <RouteLink to={to} aria-current={chosen || undefined} className=\"pointer-events-auto line-clamp-2 min-w-0 font-medium [overflow-wrap:anywhere] text-primary-text hover:underline\">\n {label}\n </RouteLink>\n ) : (\n <span className=\"line-clamp-2 min-w-0 font-medium [overflow-wrap:anywhere]\">{label}</span>\n )}\n {fields.status && (\n <div className=\"flex\">\n <FieldBadge model={model} view={view} field={fields.status} record={row} />\n </div>\n )}\n </div>\n )\n}\n\n/** A group: a region around its nodes, its `group` value at its top. */\nexport const GroupNode = ({ data }: NodeProps<Node<GroupNodeData, 'group-box'>>) => (\n <div className=\"size-full rounded-xl border border-dashed border-border-strong bg-muted/40\">\n {data.fields.group && (\n <div className=\"flex px-2 pt-1 text-xs\">\n <FieldBadge model={data.model} view={data.view} field={data.fields.group} record={data.row} />\n </div>\n )}\n </div>\n)\n","import { useEffect, useMemo, useState } from 'react'\nimport type { GraphShape } from '@protobase/layout'\nimport { useElk } from '../../../../lib/elk/use-elk'\nimport { graphElk, placeGraph, type GraphLayout, type LayoutInput } from './graph-layout'\n\n/**\n * Where the graph's groups and nodes sit, laid out again when its nodes, edges, sizes or positions change; undefined\n * until the first layout is done. A layout that a newer one overtook is dropped. Without a node to lay out, the engine\n * is never asked. A layout that fails throws, for the block's fallback or the page's error boundary to draw.\n */\nexport const useGraphLayout = (shape: GraphShape, input: LayoutInput): GraphLayout | undefined => {\n const elk = graphElk(shape, input)\n const engine = useElk()\n // One text for what the layout is made from, so a new shape of the same records lays nothing out again\n const signature = JSON.stringify([elk, shape.nodes.map((node) => node.id), shape.groups.map((group) => group.id), [...input.positions], [...input.sizes]])\n const placedOnly = useMemo(() => (elk ? undefined : placeGraph(shape, input)), [signature])\n const [laidOut, setLaidOut] = useState<{ signature: string; layout: GraphLayout }>()\n const [failure, setFailure] = useState<Error>()\n useEffect(() => {\n if (!engine || !elk) return\n let current = true\n engine.layout(elk).then(\n (result) => {\n if (current) setLaidOut({ signature, layout: placeGraph(shape, input, result) })\n },\n (error: unknown) => {\n if (current) setFailure(error instanceof Error ? error : new Error(String(error)))\n },\n )\n return () => {\n current = false\n }\n }, [engine, signature])\n // A layout that failed, such as a worker that cannot load, draws the graph's fallback or its error, not a blank box\n if (failure) throw failure\n if (placedOnly) return placedOnly\n // The last layout stands while the next one is made, so a live update does not blank the graph\n return laidOut?.layout\n}\n","import { Controls, MarkerType, ReactFlow, ReactFlowProvider, useReactFlow, type Edge, type Node, type NodeChange } from '@xyflow/react'\nimport type { GraphFields, GraphProps, GraphShape } from '@protobase/layout'\nimport { useEffect, useMemo, useState, type CSSProperties, type ReactNode } from 'react'\nimport type { ComponentRead, ComponentSelect } from '../../component-reads'\nimport { edgeConditionsOf, edgeLook } from './graph-edges'\nimport { contentWidth, nodeSize, type GraphLayout, type Size } from './graph-layout'\nimport { GroupNode, RecordNode, type GroupNodeData, type RecordNodeData, type Sides } from './graph-nodes'\nimport { useGraphLayout } from './use-graph-layout'\nimport '@xyflow/react/dist/style.css'\n\nconst nodeTypes = { record: RecordNode, 'group-box': GroupNode }\n\n// The box's height follows the graph's shape at the box's width, within bounds, so the page scrolls past it\nconst minHeight = 256\nconst maxHeight = 'min(40rem, 70vh)'\n\n// A graph wider than the box, as on a phone, stays readable and pans; the fit button shows all of it\nconst fitViewOptions = { minZoom: 0.6, maxZoom: 1 }\n\n// The library's lines and controls in the app's tokens, over the page's own background: the variables it reads over\n// its own defaults\nconst themed = {\n '--xy-edge-stroke': 'var(--color-border-strong)',\n '--xy-edge-stroke-width': '1.5',\n '--xy-background-color': 'transparent',\n '--xy-edge-label-background-color': 'var(--color-surface)',\n '--xy-edge-label-color': 'var(--color-muted-foreground)',\n '--xy-controls-button-background-color': 'var(--color-surface)',\n '--xy-controls-button-background-color-hover': 'var(--color-muted)',\n '--xy-controls-button-color': 'var(--color-foreground)',\n '--xy-controls-button-color-hover': 'var(--color-foreground)',\n '--xy-controls-button-border-color': 'var(--color-border)',\n '--xy-attribution-background-color': 'transparent',\n} as CSSProperties\n\nexport type GraphViewProps = {\n shape: GraphShape\n nodes: Pick<ComponentRead, 'model' | 'view'>\n edges: Pick<ComponentRead, 'model' | 'view'>\n fields: GraphFields\n props: Pick<GraphProps, 'layout' | 'direction' | 'x' | 'y' | 'edgeLabel' | 'edgeStatus' | 'animated' | 'dashed' | 'dotted'>\n select?: ComponentSelect\n /** What each node draws, inside its record, the graph's `node`; its label and status without it. */\n content?: ReactNode\n}\n\nconst number = (value: unknown) => (typeof value === 'number' && Number.isFinite(value) ? value : typeof value === 'string' && value.trim() !== '' && Number.isFinite(Number(value)) ? Number(value) : undefined)\n\n// The nodes React Flow draws: each group's region under the nodes, each node at its box, one with contents of its own\n// as wide as they are given and as tall as they draw, which it measures\nconst flowNodes = ({ shape, nodes: read, fields, select, content }: GraphViewProps, layout: GraphLayout | undefined, sides: Sides): Node[] => {\n const drawn = { model: read.model, view: read.view, fields }\n const groups = shape.groups.flatMap((group): Node<GroupNodeData>[] => {\n const box = layout?.groups.get(group.id)\n const row = shape.nodes.find((node) => node.group === group.id)!.row\n return box ? [{ id: `group:${group.id}`, type: 'group-box', position: { x: box.x, y: box.y }, width: box.width, height: box.height, zIndex: -1, data: { ...drawn, row }, draggable: false, selectable: false, focusable: false }] : []\n })\n const nodes = shape.nodes.map((node): Node<RecordNodeData> => {\n const box = layout?.nodes.get(node.id)\n const chosen = select?.chosen === node.id\n return {\n id: `node:${node.id}`,\n type: 'record',\n position: box ? { x: box.x, y: box.y } : { x: 0, y: 0 },\n ...(content === undefined ? { width: nodeSize.width, height: nodeSize.height } : { style: { width: contentWidth } }),\n data: { ...drawn, row: node.row, chosen, sides, ...(content !== undefined && { content }), ...(select && { to: select.linkTo(node.id) }) },\n draggable: false,\n selectable: false,\n }\n })\n return [...groups, ...nodes]\n}\n\nconst flowEdges = ({ shape, edges: read, props }: GraphViewProps, straight: boolean): Edge[] => {\n const conditions = edgeConditionsOf(props)\n return shape.edges.map((edge) => {\n const look = edgeLook(edge, props, conditions, read.view)\n return {\n id: `edge:${edge.id}`,\n source: `node:${edge.source}`,\n target: `node:${edge.target}`,\n ...(straight && { type: 'straight' }),\n markerEnd: { type: MarkerType.ArrowClosed, color: look.stroke },\n style: { stroke: look.stroke, ...(look.dash && { strokeDasharray: look.dash }) },\n animated: look.animated,\n ...(look.label !== undefined && { label: look.label, labelBgPadding: [4, 2] as [number, number], labelBgBorderRadius: 4 }),\n focusable: false,\n selectable: false,\n }\n })\n}\n\n// Fits the graph to its box each time it is laid out anew, as its first fit does, a frame later, once the nodes stand\n// where the layout put them\nconst FitOnLayout = ({ layout }: { layout: GraphLayout | undefined }) => {\n const flow = useReactFlow()\n useEffect(() => {\n if (!layout) return\n const frame = requestAnimationFrame(() => void flow.fitView(fitViewOptions))\n return () => cancelAnimationFrame(frame)\n }, [flow, layout])\n return null\n}\n\nconst Flow = (props: GraphViewProps) => {\n const { shape, content } = props\n const [measured, setMeasured] = useState<ReadonlyMap<string, Size>>(new Map())\n const sizes = useMemo(() => new Map(shape.nodes.map((node) => [node.id, content === undefined ? nodeSize : { width: contentWidth, height: measured.get(node.id)?.height ?? nodeSize.height }])), [shape, content, measured])\n const positions = useMemo(() => {\n const { x, y } = props.props\n if (x === undefined || y === undefined) return new Map<string, { x: number; y: number }>()\n return new Map(shape.nodes.flatMap((node) => {\n const at = { x: number(node.row[x]), y: number(node.row[y]) }\n return at.x === undefined || at.y === undefined ? [] : [[node.id, at as { x: number; y: number }]]\n }))\n }, [shape, props.props.x, props.props.y])\n const layoutName = props.props.layout ?? 'layered'\n const direction = props.props.direction ?? 'down'\n const layout = useGraphLayout(shape, { layout: layoutName, direction, sizes, positions })\n // A node with contents of its own is laid out at the height it draws at, so until each has drawn once the graph is\n // see-through: React Flow shows each node itself, so hiding the box would not hide them\n const ready = layout !== undefined && (content === undefined || shape.nodes.every((node) => measured.has(node.id)))\n const sides: Sides = layoutName === 'layered' && direction === 'right' ? 'horizontal' : 'vertical'\n const nodes = flowNodes(props, layout, sides)\n const edges = useMemo(() => flowEdges(props, layoutName === 'force'), [shape, props.edges.view, props.props, layoutName])\n const measure = (changes: NodeChange[]) => {\n const heights = changes.flatMap((change) => (change.type === 'dimensions' && change.dimensions && change.id.startsWith('node:') ? [[change.id.slice('node:'.length), change.dimensions] as const] : []))\n if (heights.length === 0) return\n setMeasured((before) => {\n const next = new Map(before)\n for (const [id, size] of heights) next.set(id, { width: Math.round(size.width), height: Math.round(size.height) })\n const same = next.size === before.size && [...next].every(([id, size]) => before.get(id)?.height === size.height)\n return same ? before : next\n })\n }\n return (\n <div className=\"w-full\" style={{ ...themed, aspectRatio: layout ? `${Math.max(layout.width, 1)} / ${Math.max(layout.height, 1)}` : undefined, minHeight, maxHeight, ...(!ready && { opacity: 0 }) }}>\n <ReactFlow\n nodes={nodes}\n edges={edges}\n nodeTypes={nodeTypes}\n onNodesChange={content === undefined ? undefined : measure}\n fitView\n fitViewOptions={fitViewOptions}\n minZoom={0.1}\n nodesDraggable={false}\n nodesConnectable={false}\n elementsSelectable={false}\n edgesFocusable={false}\n zoomOnScroll={false}\n zoomOnDoubleClick={false}\n preventScrolling={false}\n zoomOnPinch\n panOnDrag\n >\n <FitOnLayout layout={ready ? layout : undefined} />\n <Controls showInteractive={false} />\n </ReactFlow>\n </div>\n )\n}\n\n/**\n * The graph in a box as wide as the page and as tall as its shape asks, within bounds, fitted to it unless that would\n * shrink it past reading: pinch or the zoom buttons zoom it, dragging pans it, and the wheel scrolls the page past it.\n * Read-only: nothing moves, connects or is deleted.\n */\nexport const GraphView = (props: GraphViewProps) => (\n <ReactFlowProvider>\n <Flow {...props} />\n </ReactFlowProvider>\n)\n"],"mappings":"g6BAQA,IAAM8B,EAAc,2DAGPC,EAAe,GAA0D,CACpF,IAAMC,EAAsB,CAAC,EACzBC,EAAO,GACPC,EAAO,EACX,IAAK,IAAMC,KAASC,EAAO,SAASN,CAAW,EAAG,CAChD,GAAQM,EAAO,MAAMF,EAAMC,EAAM,KAAK,EACtC,IAAME,EAASF,EAAM,KAAO,IAAA,GAC5BH,EAAM,KAAK,CAAE,KAAOK,EAASF,EAAM,GAAKA,EAAM,GAAM,MAAOF,EAAK,OAAQ,QAAO,CAAC,EAChF,GAAQI,EAAS,GAAGF,EAAM,GAAG,GAAGA,EAAM,KAAO,IAC7C,EAAOA,EAAM,MAAQA,EAAM,EA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CAAC,EAEjH,OADaF,EAAK,OAASC,EAAO,MAAQ,CAAC,GAAGD,CAAI,CAAC,CAAC,OAAO,CAACtF,EAAIwF,KAAUD,EAAO,IAAIvF,CAAE,CAAC,EAAE,SAAWwF,EAAK,MAAM,EAClGD,EAASD,CACzB,CAAC,CACH,EACA,OACE,EAAAnD,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,SAAS,MAAO,CAAE,GAAG2B,EAAQ,YAAaK,EAAS,GAAG,KAAK,IAAIA,EAAO,MAAO,CAAC,EAAE,KAAK,KAAK,IAAIA,EAAO,OAAQ,CAAC,IAAM,IAAA,GAAW,YAAW,YAAW,GAAI,CAACc,GAAS,CAAE,QAAS,CAAE,CAAG,EAChM,UAAA,EAAA9C,EAAA,KAAA,CAACnG,EAAD,CACS,QACA,QACI,YACX,cAAe4G,IAAY,IAAA,GAAY,IAAA,GAAYsC,EACnD,QAAA,GACgB,iBAChB,QAAS,GACT,eAAgB,GAChB,iBAAkB,GAClB,mBAAoB,GACpB,eAAgB,GAChB,aAAc,GACd,kBAAmB,GACnB,iBAAkB,GAClB,YAAA,GACA,UAAA,GAhBF,SAAA,EAkBE,EAAA/C,EAAA,IAAA,CAACqC,GAAD,CAAa,OAAQS,EAAQd,EAAS,IAAA,EAAY,CAAA,GAClD,EAAAhC,EAAA,IAAA,CAAC9E,EAAD,CAAU,gBAAiB,EAAQ,CAAA,CAC1B,GACR,CAAA,CAET,EAOaoI,GAAa,IACxB,EAAAtD,EAAA,IAAA,CAAClF,EAAD,CAAA,UACE,EAAAkF,EAAA,IAAA,CAACuC,GAAD,CAAM,GAAIlG,CAAQ,CAAA,CACD,CAAA","debugId":"98f4b3eb-d015-4747-8160-689ff8e05a2c"}
|
package/dist/shell-source-maps/assets/{html-viewer-tGtSpy9M.js.map → html-viewer-BPGMH_GA.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-viewer-
|
|
1
|
+
{"version":3,"file":"html-viewer-BPGMH_GA.js","names":["useCallback","n","a","t","__toESM","require_react","require_jsx_runtime","useAppAddress","PageSkeleton","useViewedResource","HtmlFrame","useFileText","useSiblingPage","import_react","openTab","url","useFrameLinks","resource","fileAddress","file","link","href","to","newTab","go","import_jsx_runtime","HtmlViewer","read","page","siblings","address","follow"],"sources":["../../../src/app/file-viewers/use-frame-links.ts","../../../src/app/file-viewers/html-viewer.tsx"],"sourcesContent":["import { useCallback } from 'react'\nimport { useAppAddress } from '../use-app-address'\nimport type { SiblingFile } from './file-viewer'\nimport type { FrameLink } from './sibling-page'\nimport { useViewedResource } from './viewed-resource'\n\nconst openTab = (url: string) => window.open(url, '_blank', 'noopener,noreferrer')\n\n/**\n * The links of a sibling page in a file viewer. A sibling opens on its record's address with `?file=<field>`, which its\n * link shows, in this tab or a new one: in its viewer, or beside its download when it has none. An outside address\n * opens in a new tab that cannot reach back to the app.\n */\nexport const useFrameLinks = () => {\n const resource = useViewedResource()\n const { go, href } = useAppAddress()\n\n const fileAddress = useCallback((file: SiblingFile) => ({ kind: 'record', resource, key: file.key, file: file.field }) as const, [resource])\n\n const address = useCallback(\n (link: FrameLink<SiblingFile>) => (link.kind === 'external' ? link.url : new URL(href(fileAddress(link.file)), window.location.href).href),\n [fileAddress, href],\n )\n\n const follow = useCallback(\n (link: FrameLink<SiblingFile>, { newTab }: { newTab: boolean }) => {\n if (link.kind === 'external') {\n openTab(link.url)\n return\n }\n const to = fileAddress(link.file)\n if (newTab) {\n openTab(href(to))\n return\n }\n go(to)\n },\n [fileAddress, go, href],\n )\n\n return { address, follow }\n}\n","import { PageSkeleton } from './page-skeleton'\nimport type { FileViewerProps } from './file-viewer'\nimport { HtmlFrame } from './html-frame'\nimport { useFileText } from './use-file-text'\nimport { useFrameLinks } from './use-frame-links'\nimport { useSiblingPage } from './use-sibling-page'\n\n/**\n * Protobase's viewer for HTML files: the page in an `HtmlFrame` that runs none of its scripts, with its images, videos\n * and links resolved to its siblings. A file it cannot read throws, so the viewer page offers the download instead.\n */\nexport const HtmlViewer = ({ file, siblings }: FileViewerProps) => {\n const read = useFileText(file)\n const { address, follow } = useFrameLinks()\n const page = useSiblingPage(read.data, siblings, address)\n if (read.error) throw read.error\n if (!page) return <PageSkeleton name={file.name} />\n return <HtmlFrame html={page.html} title={file.name} links={page.links} onLink={follow} />\n}\n"],"mappings":"0uBAMMc,EAAW,GAAgB,OAAO,KAAKC,EAAK,SAAU,qBAAqB,EAOpEC,MAAsB,CACjC,IAAMC,EAAWR,EAAkB,EAC7B,CAAE,KAAI,QAASF,EAAc,EAE7BW,GAAA,EAAclB,EAAAA,YAAAA,CAAa,IAAuB,CAAE,KAAM,SAAU,WAAU,IAAKmB,EAAK,IAAK,KAAMA,EAAK,KAAM,GAAa,CAACF,CAAQ,CAAC,EAuB3I,MAAO,CAAE,SAAA,EArBOjB,EAAAA,YAAAA,CACb,GAAkCoB,EAAK,OAAS,WAAaA,EAAK,IAAM,IAAI,IAAIC,EAAKH,EAAYE,EAAK,IAAI,CAAC,EAAG,OAAO,SAAS,IAAI,CAAC,CAAC,KACrI,CAACF,EAAaG,CAAI,CAmBX,EAAS,QAAA,EAhBHrB,EAAAA,YAAAA,EACZ,EAA8B,CAAE,YAAkC,CACjE,GAAIoB,EAAK,OAAS,WAAY,CAC5BN,EAAQM,EAAK,GAAG,EAChB,MACF,CACA,IAAME,EAAKJ,EAAYE,EAAK,IAAI,EAChC,GAAIG,EAAQ,CACVT,EAAQO,EAAKC,CAAE,CAAC,EAChB,MACF,CACAE,EAAGF,CAAE,CACP,EACA,CAACJ,EAAaM,EAAIH,CAAI,CAGN,CAAO,CAC3B,aC9BaK,GAAc,CAAE,OAAM,cAAgC,CACjE,IAAMC,EAAOhB,EAAYQ,CAAI,EACvB,CAAE,UAAS,UAAWH,EAAc,EACpCY,EAAOhB,EAAee,EAAK,KAAME,EAAUC,CAAO,EACxD,GAAIH,EAAK,MAAO,MAAMA,EAAK,MAE3B,OADKC,GACE,EAAAH,EAAA,IAAA,CAACf,EAAD,CAAW,KAAMkB,EAAK,KAAM,MAAOT,EAAK,KAAM,MAAOS,EAAK,MAAO,OAAQG,CAAS,CAAA,GADvE,EAAAN,EAAA,IAAA,CAACjB,EAAD,CAAc,KAAMW,EAAK,IAAO,CAAA,CAEpD","debugId":"4f18c1ff-180b-4373-a63d-9e0339462e34"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-place-form-
|
|
1
|
+
{"version":3,"file":"in-place-form-RWSQGEg4.js","names":["n","a","t","__toESM","Button","ErrorBanner","Field","text","import_jsx_runtime","require_jsx_runtime","InPlaceForm","shown","form","section","fields","field","event","onSubmit","children","submit"],"sources":["../../../src/app/create/in-place-form.tsx"],"sourcesContent":["import type { FormEvent, ReactNode } from 'react'\nimport { Field } from '../../record-view/field'\nimport { Button } from '../../primitives/button'\nimport { ErrorBanner } from '../error-banner'\nimport type { CreateForm } from './use-create-form'\nimport { text } from './messages'\n\nexport type InPlaceFormProps = {\n form: CreateForm\n /** The fields to show, by name, of the form's; the others keep what the form was given. */\n fields: readonly string[]\n /** The submit button's label. */\n submit: string\n /** The submit button cannot be pressed. */\n disabled?: boolean\n /** Sends the form; `form.submit()` when omitted. */\n onSubmit?: () => void\n /** What the form says above its fields, or inputs of the caller's own. */\n children?: ReactNode\n}\n\n/**\n * A create form that stays where it is, for a focus page's panel or a dialog: the named fields of `useCreateForm`, its\n * failure and its submit button, so an action is done beside what it acts on, with no page of its own. `onCreated`\n * says what comes next.\n */\nexport const InPlaceForm = ({ form, fields, submit, disabled, onSubmit, children }: InPlaceFormProps) => {\n const shown = form.sections.flatMap((section) => section.fields).filter((field) => fields.includes(field.name))\n const send = (event: FormEvent) => {\n event.preventDefault()\n if (onSubmit) onSubmit()\n else void form.submit()\n }\n return (\n <form ref={form.ref} className=\"flex flex-col gap-4\" onSubmit={send}>\n {form.message && <ErrorBanner title={text('notCreated')} error={new Error(form.message)} />}\n {children}\n {shown.map((field) => (\n <Field key={field.name} name={field.name} label={field.label} required={field.required} help={field.help} error={field.error} wide={field.wide}>\n {field.editor}\n </Field>\n ))}\n <Button variant=\"primary\" type=\"submit\" className=\"max-md:min-h-11\" loading={form.saving} disabled={disabled}>\n {submit}\n </Button>\n </form>\n )\n}\n"],"mappings":"kqBA0BaU,GAAe,CAAE,OAAM,SAAQ,SAAQ,WAAU,WAAU,cAAiC,CACvG,IAAMC,EAAQC,EAAK,SAAS,QAAS,GAAYC,EAAQ,MAAM,CAAC,CAAC,OAAQ,GAAUC,EAAO,SAASC,EAAM,IAAI,CAAC,EAM9G,OACE,EAAAP,EAAA,KAAA,CAAC,OAAD,CAAM,IAAKI,EAAK,IAAK,UAAU,sBAAsB,SANzC,GAAqB,CACjCI,EAAM,eAAe,EACjBC,EAAUA,EAAS,EAClBL,EAAU,OAAO,CACxB,EAEE,SAAA,CACGA,EAAK,UAAW,EAAAJ,EAAA,IAAA,CAACH,EAAD,CAAa,MAAOE,EAAK,YAAY,EAAG,MAAW,MAAMK,EAAK,OAAO,CAAI,CAAA,EACzFM,EACAP,EAAM,IAAK,IACV,EAAAH,EAAA,IAAA,CAACF,EAAD,CAAwB,KAAMS,EAAM,KAAM,MAAOA,EAAM,MAAO,SAAUA,EAAM,SAAU,KAAMA,EAAM,KAAM,MAAOA,EAAM,MAAO,KAAMA,EAAM,KACvI,SAAAA,EAAM,MACF,EAFKA,EAAM,IAEX,CACR,GACD,EAAAP,EAAA,IAAA,CAACJ,EAAD,CAAQ,QAAQ,UAAU,KAAK,SAAS,UAAU,kBAAkB,QAASQ,EAAK,OAAkB,WACjG,SAAAO,CACK,CAAA,CACJ,GAEV","debugId":"11592406-120e-4633-8357-35b2a3a524c0"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Bzb-O7ER.js","names":["createRoot","StrictMode","projectUi","n","a","t","__toESM","__exportAll","require_react","require_client","require_react_dom","require_jsx_runtime","guarded","keys","restorePage","uiFromModule","loadStartCache","browserLoader","pluginWaitMs","protobaseVersion","nativeBridgeOf","preloadPlugins","createPluginSource","App","browserLocale","relList","link","processPreload","mutation","mutations","node","getFetchOpts","fetchOpts","import_react","import_client","_virtual_protobase_project_ui_exports","_virtual_protobase_project_ui_default","listenForPresses","doc","noop","apiOriginMeta","cachedPlugins","session","cache","query","databaseName","storeName","indexedDbStartCacheStore","opened","open","request","factory","reject","resolve","run","db","transaction","mode","act","store","key","value","openStartCache","error","import_react_dom","firstFrameFlag","judgesFirstFrame","page","showFirstFrame","root","container","app","frozen","\"firstFrame\"","showKeyboardAccessoryBar","bridge","applyNativeTextSize","platform","nativeViewport","content","part","applyNativeViewport","meta","apiOriginOf","contents","url","pageApiOrigin","import_jsx_runtime","nativeBridge","storage","plugins","startCache"],"sources":["../../../src/lib/press-feedback.ts","../../../../schema/src/api-origin-meta.ts","../../../src/data/start-cache/cached-plugins.ts","../../../src/data/start-cache/start-cache-store.ts","../../../src/data/start-cache/open-start-cache.ts","../../../src/app/first-frame.ts","../../../src/app/native-keyboard.ts","../../../src/app/native-text-size.ts","../../../src/app/native-viewport.ts","../../../src/app/page-api-origin.ts","../../../src/app/main.tsx"],"sourcesContent":["/**\n * Lets the pressed look in `press.css` show on iOS, whose WebKit applies `:active` on touch only while a touch listener\n * is on the page. The listener does nothing and is passive, so scrolling never waits for it.\n */\nexport const listenForPresses = (doc: Document) => doc.addEventListener('touchstart', noop, { passive: true })\n\nconst noop = () => {}\n","/**\n * The `<meta name>` whose `content` names the origin of the API the shell calls, such as `https://shop.example.com`, for\n * a page served from elsewhere: `protobase mobile` writes it into the app's `index.html`. Without it, the shell calls\n * the API on its own origin.\n */\nexport const apiOriginMeta = 'protobase-api-origin'\n","import type { PluginRef } from '@protobase/client'\nimport type { MetaData } from '../meta-data'\nimport { keys } from '../query-keys'\nimport type { StartCache } from './start-cache'\n\n/** The plugins the start cache's `/meta` names, for the signed-in person it was kept for: the app loads them before it draws. */\nexport const cachedPlugins = (cache: StartCache | undefined): PluginRef[] => {\n const session = cache?.session()\n if (!session) return []\n const meta = cache?.queries(`user:${session.user.id}`)?.state.queries.find((query) => JSON.stringify(query.queryKey) === JSON.stringify(keys.meta))\n return (meta?.state.data as MetaData | undefined)?.plugins ?? []\n}\n","/** Where the start cache keeps its records: a few values by key, structured-cloned as IndexedDB stores them. */\nexport type StartCacheStore = {\n read: (key: string) => Promise<unknown>\n write: (key: string, value: unknown) => Promise<void>\n remove: (keys: readonly string[]) => Promise<void>\n}\n\nconst databaseName = 'protobase-start-cache'\nconst storeName = 'records'\n\n/**\n * The start cache in this origin's IndexedDB: in the iOS and Android app the web view's storage inside the app's\n * sandbox, which a fresh install's purge removes. One connection serves the page. Each call is a transaction of its own,\n * and IndexedDB runs them in the order they were made, so a removal after a write always wins.\n */\nexport const indexedDbStartCacheStore = (factory: IDBFactory = indexedDB): StartCacheStore => {\n let opened: Promise<IDBDatabase> | undefined\n const open = () =>\n (opened ??= new Promise<IDBDatabase>((resolve, reject) => {\n const request = factory.open(databaseName, 1)\n request.onupgradeneeded = () => request.result.createObjectStore(storeName)\n request.onerror = () => reject(request.error)\n request.onsuccess = () => resolve(request.result)\n }))\n const run = async <T>(mode: IDBTransactionMode, act: (store: IDBObjectStore) => IDBRequest<T> | undefined) => {\n const db = await open()\n return new Promise<T | undefined>((resolve, reject) => {\n const transaction = db.transaction(storeName, mode)\n const request = act(transaction.objectStore(storeName))\n // A failed request aborts its transaction, which then holds the error; the error event comes before it has it\n transaction.oncomplete = () => resolve(request?.result)\n transaction.onabort = () => reject(transaction.error ?? new DOMException('The start cache transaction was aborted', 'AbortError'))\n })\n }\n return {\n read: (key) => run('readonly', (store) => store.get(key)),\n write: async (key, value) => void (await run('readwrite', (store) => store.put(value, key))),\n remove: async (keys) =>\n void (await run('readwrite', (store) => {\n for (const key of keys) store.delete(key)\n return undefined\n })),\n }\n}\n","import { protobaseVersion } from '../../plugins/plugin-api'\nimport { loadStartCache } from './start-cache'\nimport { indexedDbStartCacheStore } from './start-cache-store'\n\n/**\n * The page's start cache in IndexedDB, for this shell's Protobase version. A browser that keeps no IndexedDB, or refuses\n * to open it, such as some private windows, starts without one.\n */\nexport const openStartCache = async () => {\n if (typeof indexedDB === 'undefined') return\n try {\n return await loadStartCache(indexedDbStartCacheStore(), protobaseVersion)\n } catch (error) {\n if (error instanceof DOMException) return\n throw error\n }\n}\n","import type { ReactNode } from 'react'\nimport { flushSync } from 'react-dom'\nimport { createRoot } from 'react-dom/client'\nimport { guarded } from '../lib/guarded'\n\n/** The session flag that makes the app show its first frame and stop there, for the one-frame test. */\nexport const firstFrameFlag = 'protobase:first-frame'\n\n/** Whether this tab asked for its first frame alone (`firstFrameFlag` in its session storage). */\nexport const judgesFirstFrame = (page: Pick<Window, 'sessionStorage'>) => guarded(() => page.sessionStorage.getItem(firstFrameFlag) === '1', false)\n\n/**\n * The first frame the app draws, frozen: one synchronous render and commit, its markup kept, the app unmounted, which\n * ends its timers, subscriptions and pending updates, and the markup put back. What shows is all the first commit drew\n * from what the app had before it rendered, such as the start cache.\n */\nexport const showFirstFrame = (container: HTMLElement, app: ReactNode) => {\n const root = createRoot(container)\n flushSync(() => root.render(app))\n const frozen = container.innerHTML\n root.unmount()\n container.innerHTML = frozen\n container.dataset['firstFrame'] = 'frozen'\n}\n","import type { NativeBridge } from './native-auth-fetch'\n\n/**\n * Gives the iOS app's keyboard back the bar above it, with the arrows to the previous and next field and Done, which\n * Capacitor's keyboard plugin hides when it loads and has no setting for. A binary built before it had the plugin,\n * and Android, which has no such bar, are left as they are.\n */\nexport const showKeyboardAccessoryBar = async (bridge: NativeBridge) => {\n if (bridge.getPlatform() !== 'ios' || !bridge.isPluginAvailable('Keyboard')) return\n await bridge.nativePromise('Keyboard', 'setAccessoryBarVisible', { isVisible: true })\n}\n","/**\n * Marks the iOS app's document, whose root text size then follows the phone's text size (Dynamic Type) through\n * `styles.css`. Android's WebView follows it by its text zoom, which the shell sets, and a browser by its own setting.\n */\nexport const applyNativeTextSize = (root: Pick<HTMLElement, 'dataset'>, platform: string) => {\n if (platform !== 'ios') return\n root.dataset.pbTextSize = 'system'\n}\n","/**\n * The viewport of the iOS and Android app: as the page's, at a scale of one. Safari on iOS zooms into an input whose\n * text is smaller than 16px when it is focused, and in the app the page then stays zoomed with its right side cut off;\n * an app does not zoom, so its viewport stays at that scale, under a pinch too. The page in a browser keeps its zoom.\n */\nexport const nativeViewport = (content: string) => {\n const kept = content.split(',').map((part) => part.trim()).filter((part) => part && !/^maximum-scale\\s*=/.test(part))\n return [...kept, 'maximum-scale=1'].join(', ')\n}\n\n/** Gives the document's viewport the app's scale; a document without a viewport tag needs none. */\nexport const applyNativeViewport = (doc: Document) => {\n const meta = doc.querySelector('meta[name=\"viewport\"]')\n if (!meta) return\n meta.setAttribute('content', nativeViewport(meta.getAttribute('content') ?? ''))\n}\n","import { apiOriginMeta } from '@protobase/schema/internal'\n\n/**\n * The API origin the page's `<meta name=\"protobase-api-origin\">` tags name: `undefined` without one. Anything but one\n * tag holding exactly an http or https origin, such as `https://shop.example.com`, is an error.\n */\nexport const apiOriginOf = (contents: string[]) => {\n if (contents.length === 0) return undefined\n if (contents.length > 1) throw new Error(`The page has ${contents.length} ${apiOriginMeta} meta tags; it may have one`)\n const value = contents[0]!\n const url = URL.canParse(value) ? new URL(value) : undefined\n if (!url || (url.protocol !== 'http:' && url.protocol !== 'https:') || url.origin !== value) {\n throw new Error(`The page's ${apiOriginMeta} meta tag holds \"${value}\", which is not an http or https origin such as https://shop.example.com`)\n }\n return value\n}\n\n/** The API origin this page names in its `<meta name=\"protobase-api-origin\">` (see `apiOriginOf`). */\nexport const pageApiOrigin = () =>\n apiOriginOf([...document.querySelectorAll<HTMLMetaElement>(`meta[name=\"${apiOriginMeta}\"]`)].map((meta) => meta.content))\n","import { StrictMode } from 'react'\nimport { createRoot } from 'react-dom/client'\nimport * as projectUi from 'virtual:protobase-project-ui'\nimport '../styles.css'\nimport { guarded } from '../lib/guarded'\nimport { listenForPresses } from '../lib/press-feedback'\nimport { browserLocale } from '../locale/active-locale'\nimport { cachedPlugins } from '../data/start-cache/cached-plugins'\nimport { openStartCache } from '../data/start-cache/open-start-cache'\nimport { browserLoader } from '../plugins/load-plugin'\nimport { createPluginSource, preloadPlugins } from '../plugins/plugin-source'\nimport { pluginWaitMs } from '../plugins/use-plugin-loads'\nimport { App } from './app'\nimport { judgesFirstFrame, showFirstFrame } from './first-frame'\nimport { restorePage } from './live-update/kept-page'\nimport { nativeBridgeOf, type NativeBridge } from './native-auth-fetch'\nimport { showKeyboardAccessoryBar } from './native-keyboard'\nimport { applyNativeTextSize } from './native-text-size'\nimport { applyNativeViewport } from './native-viewport'\nimport { pageApiOrigin } from './page-api-origin'\nimport { uiFromModule } from './pages/ui-from-module'\n\nconst root = document.getElementById('root')\nif (!root) throw new Error('index.html needs an element with id \"root\"')\n\nlistenForPresses(document)\n\nconst nativeBridge = nativeBridgeOf(window as { Capacitor?: NativeBridge })\nif (nativeBridge) {\n applyNativeViewport(document)\n applyNativeTextSize(document.documentElement, nativeBridge.getPlatform())\n void showKeyboardAccessoryBar(nativeBridge)\n // Back on the page the app showed before a live update reloaded it\n const storage = guarded(() => window.sessionStorage, undefined)\n if (storage) restorePage(storage, window.history)\n}\n\n// The first render already has what the app showed last time, read from the start cache, with the plugins it names\nconst plugins = createPluginSource(browserLoader)\nvoid openStartCache().then(async (startCache) => {\n await preloadPlugins(plugins, cachedPlugins(startCache), pluginWaitMs)\n const app = (\n <StrictMode>\n <App baseUrl={`${pageApiOrigin() ?? ''}/api/v1`} ui={uiFromModule(projectUi)} locale={browserLocale()} nativeBridge={nativeBridge} startCache={startCache} pluginSource={plugins} />\n </StrictMode>\n )\n if (judgesFirstFrame(window)) return showFirstFrame(root, app)\n createRoot(root).render(app)\n})\n"],"mappings":"qhDAIaqC,EAAoB,GAAkBC,EAAI,iBAAiB,aAAcC,EAAM,CAAE,QAAS,EAAK,CAAC,EAEvGA,MAAa,CAAC,ECDPC,EAAgB,uBCChBC,EAAiB,GAA+C,CAC3E,IAAMC,EAAUC,G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7d"}
|
package/dist/shell-source-maps/assets/{intl-cache-bXVNV0Yq.js.map → intl-cache-D4doUjK1.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intl-cache-
|
|
1
|
+
{"version":3,"file":"intl-cache-D4doUjK1.js","names":["n","a","t","formatTag","cache","cachedFormat","tag","id","key","make"],"sources":["../../../src/format/intl-cache.ts"],"sourcesContent":["import { formatTag } from '../locale/active-locale'\n\nconst cache = new Map<string, unknown>()\n\n/** One `Intl` formatter per language tag and `key`, made with `make` for the active locale's tag the first time. */\nexport const cachedFormat = <T>(key: string, make: (tag: string) => T): T => {\n const tag = formatTag()\n const id = `${tag}|${key}`\n if (!cache.has(id)) cache.set(id, make(tag))\n return cache.get(id) as T\n}\n"],"mappings":"0gBAEA,IAAMI,EAAQ,IAAI,IAGLC,GAAmB,EAAa,IAAgC,CAC3E,IAAMC,EAAMH,EAAU,EAChBI,EAAK,GAAGD,EAAI,GAAGE,IAErB,OADKJ,EAAM,IAAIG,CAAE,GAAGH,EAAM,IAAIG,EAAIE,EAAKH,CAAG,CAAC,EACpCF,EAAM,IAAIG,CAAE,CACrB","debugId":"f8768523-2b53-4999-bab4-7989b27b1843"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib-d3-interpolate-Cl0dHO4f.js","names":["decompose","number","n","a","t","number_default","degrees","identity","decompose_default","scaleX","scaleY","skewX","b","c","d","e","f","svgNode","parseCss","m","value","parseSvg","interpolateTransform","pop","s","translate","xa","xb","ya","yb","i","pxComma","pxParen","q","rotate","degParen","scale","parse","o","interpolateTransformCss","interpolateTransformSvg","epsilon2","cosh","x","sinh","tanh","zoom_default","zoomRho","zoom","ux0","p0","uy0","w0","ux1","p1","uy1","w1","dx","dy","d2","S","rho","d1","b0","rho4","rho2","b1","r0","coshr0","u","_1","_","_2"],"sources":["../../../../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/decompose.js","../../../../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/parse.js","../../../../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/index.js","../../../../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/zoom.js"],"sourcesContent":["var degrees = 180 / Math.PI;\n\nexport var identity = {\n translateX: 0,\n translateY: 0,\n rotate: 0,\n skewX: 0,\n scaleX: 1,\n scaleY: 1\n};\n\nexport default function(a, b, c, d, e, f) {\n var scaleX, scaleY, skewX;\n if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;\n if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;\n if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;\n if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;\n return {\n translateX: e,\n translateY: f,\n rotate: Math.atan2(b, a) * degrees,\n skewX: Math.atan(skewX) * degrees,\n scaleX: scaleX,\n scaleY: scaleY\n };\n}\n","import decompose, {identity} from \"./decompose.js\";\n\nvar svgNode;\n\n/* eslint-disable no-undef */\nexport function parseCss(value) {\n const m = new (typeof DOMMatrix === \"function\" ? DOMMatrix : WebKitCSSMatrix)(value + \"\");\n return m.isIdentity ? identity : decompose(m.a, m.b, m.c, m.d, m.e, m.f);\n}\n\nexport function parseSvg(value) {\n if (value == null) return identity;\n if (!svgNode) svgNode = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\n svgNode.setAttribute(\"transform\", value);\n if (!(value = svgNode.transform.baseVal.consolidate())) return identity;\n value = value.matrix;\n return decompose(value.a, value.b, value.c, value.d, value.e, value.f);\n}\n","import number from \"../number.js\";\nimport {parseCss, parseSvg} from \"./parse.js\";\n\nfunction interpolateTransform(parse, pxComma, pxParen, degParen) {\n\n function pop(s) {\n return s.length ? s.pop() + \" \" : \"\";\n }\n\n function translate(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(\"translate(\", null, pxComma, null, pxParen);\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb || yb) {\n s.push(\"translate(\" + xb + pxComma + yb + pxParen);\n }\n }\n\n function rotate(a, b, s, q) {\n if (a !== b) {\n if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path\n q.push({i: s.push(pop(s) + \"rotate(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"rotate(\" + b + degParen);\n }\n }\n\n function skewX(a, b, s, q) {\n if (a !== b) {\n q.push({i: s.push(pop(s) + \"skewX(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"skewX(\" + b + degParen);\n }\n }\n\n function scale(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(pop(s) + \"scale(\", null, \",\", null, \")\");\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb !== 1 || yb !== 1) {\n s.push(pop(s) + \"scale(\" + xb + \",\" + yb + \")\");\n }\n }\n\n return function(a, b) {\n var s = [], // string constants and placeholders\n q = []; // number interpolators\n a = parse(a), b = parse(b);\n translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);\n rotate(a.rotate, b.rotate, s, q);\n skewX(a.skewX, b.skewX, s, q);\n scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);\n a = b = null; // gc\n return function(t) {\n var i = -1, n = q.length, o;\n while (++i < n) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n };\n };\n}\n\nexport var interpolateTransformCss = interpolateTransform(parseCss, \"px, \", \"px)\", \"deg)\");\nexport var interpolateTransformSvg = interpolateTransform(parseSvg, \", \", \")\", \")\");\n","var epsilon2 = 1e-12;\n\nfunction cosh(x) {\n return ((x = Math.exp(x)) + 1 / x) / 2;\n}\n\nfunction sinh(x) {\n return ((x = Math.exp(x)) - 1 / x) / 2;\n}\n\nfunction tanh(x) {\n return ((x = Math.exp(2 * x)) - 1) / (x + 1);\n}\n\nexport default (function zoomRho(rho, rho2, rho4) {\n\n // p0 = [ux0, uy0, w0]\n // p1 = [ux1, uy1, w1]\n function zoom(p0, p1) {\n var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],\n ux1 = p1[0], uy1 = p1[1], w1 = p1[2],\n dx = ux1 - ux0,\n dy = uy1 - uy0,\n d2 = dx * dx + dy * dy,\n i,\n S;\n\n // Special case for u0 ≅ u1.\n if (d2 < epsilon2) {\n S = Math.log(w1 / w0) / rho;\n i = function(t) {\n return [\n ux0 + t * dx,\n uy0 + t * dy,\n w0 * Math.exp(rho * t * S)\n ];\n }\n }\n\n // General case.\n else {\n var d1 = Math.sqrt(d2),\n b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),\n b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),\n r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),\n r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);\n S = (r1 - r0) / rho;\n i = function(t) {\n var s = t * S,\n coshr0 = cosh(r0),\n u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));\n return [\n ux0 + u * dx,\n uy0 + u * dy,\n w0 * coshr0 / cosh(rho * s + r0)\n ];\n }\n }\n\n i.duration = S * 1000 * rho / Math.SQRT2;\n\n return i;\n }\n\n zoom.rho = function(_) {\n var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2;\n return zoomRho(_1, _2, _4);\n };\n\n return zoom;\n})(Math.SQRT2, 2, 4);\n"],"ignoreList":[0,1,2,3],"mappings":"ggBAAA,IAAIM,EAAU,IAAM,KAAK,GAEdC,EAAW,CACpB,WAAY,EACZ,WAAY,EACZ,OAAQ,EACR,MAAO,EACP,OAAQ,EACR,OAAQ,CACV,EAEA,SAAAC,EAAwB,EAAG,EAAG,EAAG,EAAG,EAAG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GAAK,IAAM,SAAS,EAAG,CACrB,IAAIwC,EAAK,KAAK,IAAI,KAAM,CAACC,CAAC,EAAGC,EAAKF,EAAKA,EACvC,OAAOvB,EAAQuB,EAAIE,EAD6BA,EAAKA,CAC5B,CAC3B,EAEOxB,CACT,EAAA,CAAG,KAAK,MAAO,EAAG,CAAC","debugId":"a5d1d1ce-e1f6-4807-8448-e4dd55f33ff7"}
|
|
1
|
+
{"version":3,"file":"lib-d3-interpolate-D3u38iyJ.js","names":["decompose","number","n","a","t","number_default","degrees","identity","decompose_default","scaleX","scaleY","skewX","b","c","d","e","f","svgNode","parseCss","m","value","parseSvg","interpolateTransform","pop","s","translate","xa","xb","ya","yb","i","pxComma","pxParen","q","rotate","degParen","scale","parse","o","interpolateTransformCss","interpolateTransformSvg","epsilon2","cosh","x","sinh","tanh","zoom_default","zoomRho","zoom","ux0","p0","uy0","w0","ux1","p1","uy1","w1","dx","dy","d2","S","rho","d1","b0","rho4","rho2","b1","r0","coshr0","u","_1","_","_2"],"sources":["../../../../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/decompose.js","../../../../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/parse.js","../../../../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/index.js","../../../../../node_modules/.bun/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/zoom.js"],"sourcesContent":["var degrees = 180 / Math.PI;\n\nexport var identity = {\n translateX: 0,\n translateY: 0,\n rotate: 0,\n skewX: 0,\n scaleX: 1,\n scaleY: 1\n};\n\nexport default function(a, b, c, d, e, f) {\n var scaleX, scaleY, skewX;\n if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;\n if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;\n if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;\n if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;\n return {\n translateX: e,\n translateY: f,\n rotate: Math.atan2(b, a) * degrees,\n skewX: Math.atan(skewX) * degrees,\n scaleX: scaleX,\n scaleY: scaleY\n };\n}\n","import decompose, {identity} from \"./decompose.js\";\n\nvar svgNode;\n\n/* eslint-disable no-undef */\nexport function parseCss(value) {\n const m = new (typeof DOMMatrix === \"function\" ? DOMMatrix : WebKitCSSMatrix)(value + \"\");\n return m.isIdentity ? identity : decompose(m.a, m.b, m.c, m.d, m.e, m.f);\n}\n\nexport function parseSvg(value) {\n if (value == null) return identity;\n if (!svgNode) svgNode = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\n svgNode.setAttribute(\"transform\", value);\n if (!(value = svgNode.transform.baseVal.consolidate())) return identity;\n value = value.matrix;\n return decompose(value.a, value.b, value.c, value.d, value.e, value.f);\n}\n","import number from \"../number.js\";\nimport {parseCss, parseSvg} from \"./parse.js\";\n\nfunction interpolateTransform(parse, pxComma, pxParen, degParen) {\n\n function pop(s) {\n return s.length ? s.pop() + \" \" : \"\";\n }\n\n function translate(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(\"translate(\", null, pxComma, null, pxParen);\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb || yb) {\n s.push(\"translate(\" + xb + pxComma + yb + pxParen);\n }\n }\n\n function rotate(a, b, s, q) {\n if (a !== b) {\n if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path\n q.push({i: s.push(pop(s) + \"rotate(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"rotate(\" + b + degParen);\n }\n }\n\n function skewX(a, b, s, q) {\n if (a !== b) {\n q.push({i: s.push(pop(s) + \"skewX(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"skewX(\" + b + degParen);\n }\n }\n\n function scale(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(pop(s) + \"scale(\", null, \",\", null, \")\");\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb !== 1 || yb !== 1) {\n s.push(pop(s) + \"scale(\" + xb + \",\" + yb + \")\");\n }\n }\n\n return function(a, b) {\n var s = [], // string constants and placeholders\n q = []; // number interpolators\n a = parse(a), b = parse(b);\n translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);\n rotate(a.rotate, b.rotate, s, q);\n skewX(a.skewX, b.skewX, s, q);\n scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);\n a = b = null; // gc\n return function(t) {\n var i = -1, n = q.length, o;\n while (++i < n) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n };\n };\n}\n\nexport var interpolateTransformCss = interpolateTransform(parseCss, \"px, \", \"px)\", \"deg)\");\nexport var interpolateTransformSvg = interpolateTransform(parseSvg, \", \", \")\", \")\");\n","var epsilon2 = 1e-12;\n\nfunction cosh(x) {\n return ((x = Math.exp(x)) + 1 / x) / 2;\n}\n\nfunction sinh(x) {\n return ((x = Math.exp(x)) - 1 / x) / 2;\n}\n\nfunction tanh(x) {\n return ((x = Math.exp(2 * x)) - 1) / (x + 1);\n}\n\nexport default (function zoomRho(rho, rho2, rho4) {\n\n // p0 = [ux0, uy0, w0]\n // p1 = [ux1, uy1, w1]\n function zoom(p0, p1) {\n var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],\n ux1 = p1[0], uy1 = p1[1], w1 = p1[2],\n dx = ux1 - ux0,\n dy = uy1 - uy0,\n d2 = dx * dx + dy * dy,\n i,\n S;\n\n // Special case for u0 ≅ u1.\n if (d2 < epsilon2) {\n S = Math.log(w1 / w0) / rho;\n i = function(t) {\n return [\n ux0 + t * dx,\n uy0 + t * dy,\n w0 * Math.exp(rho * t * S)\n ];\n }\n }\n\n // General case.\n else {\n var d1 = Math.sqrt(d2),\n b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),\n b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),\n r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),\n r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);\n S = (r1 - r0) / rho;\n i = function(t) {\n var s = t * S,\n coshr0 = cosh(r0),\n u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));\n return [\n ux0 + u * dx,\n uy0 + u * dy,\n w0 * coshr0 / cosh(rho * s + r0)\n ];\n }\n }\n\n i.duration = S * 1000 * rho / Math.SQRT2;\n\n return i;\n }\n\n zoom.rho = function(_) {\n var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2;\n return zoomRho(_1, _2, _4);\n };\n\n return zoom;\n})(Math.SQRT2, 2, 4);\n"],"ignoreList":[0,1,2,3],"mappings":"ggBAAA,IAAIM,EAAU,IAAM,KAAK,GAEdC,EAAW,CACpB,WAAY,EACZ,WAAY,EACZ,OAAQ,EACR,MAAO,EACP,OAAQ,EACR,OAAQ,CACV,EAEA,SAAAC,EAAwB,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,CACxC,IAAIC,EAAQC,EAAQC,EAKpB,OAJI,EAAS,KAAK,KAAKR,EAAIA,EAAIS,EAAIA,CAAC,KAAG,GAAKH,EAAQ,GAAKA,IACrD,EAAQN,EAAIU,EAAID,EAAIE,KAAG,GAAKX,EAAIQ,EAAO,GAAKC,EAAID,IAChD,EAAS,KAAK,KAAKE,EAAIA,EAAIC,EAAIA,CAAC,KAAG,GAAKJ,EAAQ,GAAKA,EAAQ,GAASA,GACtEP,EAAIW,EAAIF,EAAIC,IAAG,EAAI,CAACV,EAAG,EAAI,CAACS,EAAG,EAAQ,CAACD,EAAO,EAAS,CAACF,GACtD,CACL,WAAYM,EACZ,WAAYC,EACZ,OAAQ,KAAK,MAAMJ,EAAGT,CAAC,EAAIG,EAC3B,MAAO,KAAK,KAAKK,CAAK,EAAIL,EAClB,SACA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