@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.
Files changed (206) hide show
  1. package/dist/account/messages.d.ts +2 -2
  2. package/dist/app/app.d.ts +4 -1
  3. package/dist/app/app.js +9 -7
  4. package/dist/app/change-confirm/messages.d.ts +2 -2
  5. package/dist/app/charts/messages.d.ts +2 -2
  6. package/dist/app/confirm-sign-in-messages.d.ts +2 -2
  7. package/dist/app/create/messages.d.ts +2 -2
  8. package/dist/app/delete/messages.d.ts +2 -2
  9. package/dist/app/displays/messages.d.ts +2 -2
  10. package/dist/app/displays/virtual-cards.js +1 -0
  11. package/dist/app/embedded-list/messages.d.ts +2 -2
  12. package/dist/app/export/messages.d.ts +2 -2
  13. package/dist/app/field-messages.d.ts +2 -2
  14. package/dist/app/field-types/workflow/messages.d.ts +2 -2
  15. package/dist/app/field-types/workflow-page/messages.d.ts +2 -2
  16. package/dist/app/field-types/workflow-run/messages.d.ts +2 -2
  17. package/dist/app/field-types/workflow-status/messages.d.ts +2 -2
  18. package/dist/app/file-viewers/messages.d.ts +2 -2
  19. package/dist/app/first-frame.d.ts +13 -0
  20. package/dist/app/first-frame.js +23 -0
  21. package/dist/app/focus/messages.d.ts +2 -2
  22. package/dist/app/gallery/gallery-layout.d.ts +2 -2
  23. package/dist/app/gallery/messages.d.ts +2 -2
  24. package/dist/app/hand-order/messages.d.ts +2 -2
  25. package/dist/app/import/messages.d.ts +2 -2
  26. package/dist/app/index.html +0 -17
  27. package/dist/app/list-messages.d.ts +2 -2
  28. package/dist/app/main.js +19 -7
  29. package/dist/app/messages.d.ts +2 -2
  30. package/dist/app/pages/messages.d.ts +2 -2
  31. package/dist/app/record-chart/messages.d.ts +2 -2
  32. package/dist/app/record-messages.d.ts +2 -2
  33. package/dist/app/record-mode/shown-layout.d.ts +1 -1
  34. package/dist/app/record-row/messages.d.ts +2 -2
  35. package/dist/app/record-row/record-row.d.ts +3 -2
  36. package/dist/app/record-row/record-row.js +43 -27
  37. package/dist/app/record-row/row-window.d.ts +11 -0
  38. package/dist/app/record-row/row-window.js +15 -2
  39. package/dist/app/refresh-mark.d.ts +2 -1
  40. package/dist/app/refresh-mark.js +3 -1
  41. package/dist/app/related-cards/messages.d.ts +2 -2
  42. package/dist/app/reveal-when-loaded.d.ts +8 -2
  43. package/dist/app/reveal-when-loaded.js +12 -5
  44. package/dist/app/runtime/messages.d.ts +2 -2
  45. package/dist/app/saved/messages.d.ts +2 -2
  46. package/dist/app/searches/messages.d.ts +2 -2
  47. package/dist/app/splash-hold.d.ts +0 -1
  48. package/dist/app/splash-hold.js +1 -1
  49. package/dist/app/start-screen.d.ts +0 -9
  50. package/dist/app/start-screen.js +1 -10
  51. package/dist/app/ui-ready.d.ts +11 -0
  52. package/dist/app/ui-ready.js +12 -0
  53. package/dist/app-shell/app-shell.js +3 -1
  54. package/dist/app-shell/close-sidebar.d.ts +10 -0
  55. package/dist/app-shell/close-sidebar.js +17 -0
  56. package/dist/app-shell/drawer.d.ts +7 -1
  57. package/dist/app-shell/drawer.js +26 -7
  58. package/dist/app-shell/index.d.ts +2 -1
  59. package/dist/app-shell/index.js +2 -1
  60. package/dist/app-shell/messages.d.ts +2 -2
  61. package/dist/app-shell/top-bar.js +4 -4
  62. package/dist/assistant-dock/messages.d.ts +2 -2
  63. package/dist/auth/messages.d.ts +2 -2
  64. package/dist/calls/messages.d.ts +2 -2
  65. package/dist/compact-table/messages.d.ts +2 -2
  66. package/dist/data/query-keys.d.ts +6 -0
  67. package/dist/data/query-keys.js +10 -0
  68. package/dist/data/start-cache/cached-plugins.d.ts +6 -0
  69. package/dist/data/start-cache/cached-plugins.js +10 -0
  70. package/dist/data-grid/column-spec.d.ts +1 -1
  71. package/dist/data-grid/data-grid.js +1 -0
  72. package/dist/data-grid/messages.d.ts +2 -2
  73. package/dist/data-grid/row-source.d.ts +5 -0
  74. package/dist/data-grid/use-paged-rows.d.ts +5 -3
  75. package/dist/data-grid/use-paged-rows.js +21 -6
  76. package/dist/filter-panel/messages.d.ts +2 -2
  77. package/dist/focus-page/messages.d.ts +2 -2
  78. package/dist/index.d.ts +4 -1
  79. package/dist/index.js +4 -1
  80. package/dist/invitations/messages.d.ts +2 -2
  81. package/dist/live/grid-loader.d.ts +1 -0
  82. package/dist/live/grid-loader.js +3 -1
  83. package/dist/live/use-live-rows.js +1 -0
  84. package/dist/mailbox/messages.d.ts +2 -2
  85. package/dist/mocks/customers.d.ts +1 -1
  86. package/dist/mocks/invoices.d.ts +1 -1
  87. package/dist/mocks/orders.d.ts +3 -3
  88. package/dist/notifications/bell/messages.d.ts +2 -2
  89. package/dist/organizations/members-page.js +13 -7
  90. package/dist/organizations/messages.d.ts +2 -2
  91. package/dist/organizations/use-organizations.d.ts +4 -1
  92. package/dist/organizations/use-organizations.js +25 -19
  93. package/dist/package.js +1 -1
  94. package/dist/plugins/plugin-source.d.ts +24 -4
  95. package/dist/plugins/plugin-source.js +48 -14
  96. package/dist/plugins/use-plugin-loads.d.ts +3 -1
  97. package/dist/plugins/use-plugin-loads.js +24 -7
  98. package/dist/primitives/messages.d.ts +2 -2
  99. package/dist/primitives/skeleton.js +1 -0
  100. package/dist/record-view/messages.d.ts +2 -2
  101. package/dist/roles/use-active-role.d.ts +4 -1
  102. package/dist/roles/use-active-role.js +18 -13
  103. package/dist/shell/assets/api-provider-BJJrOoO4.js +2 -0
  104. package/dist/shell/assets/app-VoTi41IN.js +16 -0
  105. package/dist/shell/assets/badge-OU9hb6yQ.js +2 -0
  106. package/dist/shell/assets/checkbox-DFfK432Y.js +2 -0
  107. package/dist/shell/assets/createLucideIcon-DGm8SdFI.js +2 -0
  108. package/dist/shell/assets/display-value-CIH2qfgQ.js +2 -0
  109. package/dist/shell/assets/{field-badge-3QmjR1r3.js → field-badge-DX2Mc_fH.js} +2 -2
  110. package/dist/shell/assets/{graph-view-BcbWbnHO.js → graph-view-CY9LPr0B.js} +2 -2
  111. package/dist/shell/assets/{html-viewer-tGtSpy9M.js → html-viewer-BPGMH_GA.js} +2 -2
  112. package/dist/shell/assets/{in-place-form-B0EkP4B1.js → in-place-form-RWSQGEg4.js} +2 -2
  113. package/dist/shell/assets/index-Bzb-O7ER.js +2 -0
  114. package/dist/shell/assets/index-HnFovy2Q.css +2 -0
  115. package/dist/shell/assets/{intl-cache-bXVNV0Yq.js → intl-cache-D4doUjK1.js} +2 -2
  116. package/dist/shell/assets/{lib-d3-interpolate-Cl0dHO4f.js → lib-d3-interpolate-D3u38iyJ.js} +2 -2
  117. package/dist/shell/assets/{lib-d3-transition-DUHAGQ8z.js → lib-d3-transition-BUpPvFvt.js} +2 -2
  118. package/dist/shell/assets/{lib-d3-zoom-gQh2osrj.js → lib-d3-zoom-BF7SPKNh.js} +2 -2
  119. package/dist/shell/assets/{lib-vis.gl-react-maplibre-CU7gWYjg.js → lib-vis.gl-react-maplibre-C7-0xNFC.js} +2 -2
  120. package/dist/shell/assets/{lib-xyflow-react-DGg_5r7u.js → lib-xyflow-react-CKyW7szC.js} +2 -2
  121. package/dist/shell/assets/maplibre-9ViQO48S.js +2 -0
  122. package/dist/shell/assets/{markdown-content-DHKbAJjx.js → markdown-content-DTB9RQDs.js} +2 -2
  123. package/dist/shell/assets/{record-map-nGRmsk6x.js → record-map-CVqCWtfe.js} +2 -2
  124. package/dist/shell/assets/{records-map-D2flyaz3.js → records-map-ClYSxrVR.js} +2 -2
  125. package/dist/shell/assets/{run-trace-view-DfrAPeum.js → run-trace-view-CN16MiXg.js} +2 -2
  126. package/dist/shell/assets/search-picker-BGpvJQRD.js +2 -0
  127. package/dist/shell/assets/shared-protobase-ui-BC8LqGQB.js +2 -0
  128. package/dist/shell/assets/step-catalog-CZY0ZpCC.js +2 -0
  129. package/dist/shell/assets/step-panel-DhD80lsJ.js +2 -0
  130. package/dist/shell/assets/use-app-address-B4Uk3nWy.js +2 -0
  131. package/dist/shell/assets/{use-meta-BqEqOLNe.js → use-meta-D5kYywHm.js} +2 -2
  132. package/dist/shell/assets/{use-sibling-page-CiuiG-Tz.js → use-sibling-page-BJ81HcOP.js} +3 -3
  133. package/dist/shell/assets/value-badge-Dpd8dRqq.js +2 -0
  134. package/dist/shell/assets/{vendor-WWp_xlp2.js → vendor-3etemhgS.js} +4 -4
  135. package/dist/shell/assets/{workflow-canvas-DMP7SDWX.js → workflow-canvas-C1nGpi5w.js} +2 -2
  136. package/dist/shell/assets/{workflow-graph-editor-xpV8_qEl.js → workflow-graph-editor-DAJa4lq6.js} +2 -2
  137. package/dist/shell/assets/workflow-workbench-HramVZEJ.js +4 -0
  138. package/dist/shell/assets/{workflows-Bku4o2su.js → workflows-DlvOln9v.js} +2 -2
  139. package/dist/shell/assets/{workflows-start-kl7rSSay.js → workflows-start-QUKfwFqf.js} +2 -2
  140. package/dist/shell/index.html +16 -19
  141. package/dist/shell/protobase.shell.json +2 -2
  142. package/dist/shell/protobase.sw.js +2 -2
  143. package/dist/shell-source-maps/assets/api-provider-BJJrOoO4.js.map +1 -0
  144. package/dist/shell-source-maps/assets/app-VoTi41IN.js.map +1 -0
  145. package/dist/shell-source-maps/assets/{badge-ChHXC28D.js.map → badge-OU9hb6yQ.js.map} +1 -1
  146. package/dist/shell-source-maps/assets/{checkbox-COOOlJPG.js.map → checkbox-DFfK432Y.js.map} +1 -1
  147. package/dist/shell-source-maps/assets/createLucideIcon-DGm8SdFI.js.map +1 -0
  148. package/dist/shell-source-maps/assets/display-value-CIH2qfgQ.js.map +1 -0
  149. package/dist/shell-source-maps/assets/{field-badge-3QmjR1r3.js.map → field-badge-DX2Mc_fH.js.map} +1 -1
  150. package/dist/shell-source-maps/assets/{graph-view-BcbWbnHO.js.map → graph-view-CY9LPr0B.js.map} +1 -1
  151. package/dist/shell-source-maps/assets/{html-viewer-tGtSpy9M.js.map → html-viewer-BPGMH_GA.js.map} +1 -1
  152. package/dist/shell-source-maps/assets/{in-place-form-B0EkP4B1.js.map → in-place-form-RWSQGEg4.js.map} +1 -1
  153. package/dist/shell-source-maps/assets/index-Bzb-O7ER.js.map +1 -0
  154. package/dist/shell-source-maps/assets/{intl-cache-bXVNV0Yq.js.map → intl-cache-D4doUjK1.js.map} +1 -1
  155. package/dist/shell-source-maps/assets/{lib-d3-interpolate-Cl0dHO4f.js.map → lib-d3-interpolate-D3u38iyJ.js.map} +1 -1
  156. package/dist/shell-source-maps/assets/{lib-d3-transition-DUHAGQ8z.js.map → lib-d3-transition-BUpPvFvt.js.map} +1 -1
  157. package/dist/shell-source-maps/assets/{lib-d3-zoom-gQh2osrj.js.map → lib-d3-zoom-BF7SPKNh.js.map} +1 -1
  158. 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
  159. package/dist/shell-source-maps/assets/{lib-xyflow-react-DGg_5r7u.js.map → lib-xyflow-react-CKyW7szC.js.map} +1 -1
  160. package/dist/shell-source-maps/assets/{maplibre-Y7X50Jfk.js.map → maplibre-9ViQO48S.js.map} +1 -1
  161. package/dist/shell-source-maps/assets/{markdown-content-DHKbAJjx.js.map → markdown-content-DTB9RQDs.js.map} +1 -1
  162. package/dist/shell-source-maps/assets/{record-map-nGRmsk6x.js.map → record-map-CVqCWtfe.js.map} +1 -1
  163. package/dist/shell-source-maps/assets/{records-map-D2flyaz3.js.map → records-map-ClYSxrVR.js.map} +1 -1
  164. package/dist/shell-source-maps/assets/{run-trace-view-DfrAPeum.js.map → run-trace-view-CN16MiXg.js.map} +1 -1
  165. package/dist/shell-source-maps/assets/{search-picker-CJcJetBh.js.map → search-picker-BGpvJQRD.js.map} +1 -1
  166. package/dist/shell-source-maps/assets/shared-protobase-ui-BC8LqGQB.js.map +1 -0
  167. package/dist/shell-source-maps/assets/{step-catalog-ZvQOXfSh.js.map → step-catalog-CZY0ZpCC.js.map} +1 -1
  168. package/dist/shell-source-maps/assets/{step-panel-B1yHz7OC.js.map → step-panel-DhD80lsJ.js.map} +1 -1
  169. package/dist/shell-source-maps/assets/{use-app-address-B6k3dkV0.js.map → use-app-address-B4Uk3nWy.js.map} +1 -1
  170. package/dist/shell-source-maps/assets/{use-meta-BqEqOLNe.js.map → use-meta-D5kYywHm.js.map} +1 -1
  171. package/dist/shell-source-maps/assets/{use-sibling-page-CiuiG-Tz.js.map → use-sibling-page-BJ81HcOP.js.map} +1 -1
  172. package/dist/shell-source-maps/assets/{value-badge-BKLV4otJ.js.map → value-badge-Dpd8dRqq.js.map} +1 -1
  173. package/dist/shell-source-maps/assets/{vendor-WWp_xlp2.js.map → vendor-3etemhgS.js.map} +1 -1
  174. package/dist/shell-source-maps/assets/{workflow-canvas-DMP7SDWX.js.map → workflow-canvas-C1nGpi5w.js.map} +1 -1
  175. package/dist/shell-source-maps/assets/{workflow-graph-editor-xpV8_qEl.js.map → workflow-graph-editor-DAJa4lq6.js.map} +1 -1
  176. package/dist/shell-source-maps/assets/{workflow-workbench-Djdd_ODh.js.map → workflow-workbench-HramVZEJ.js.map} +1 -1
  177. package/dist/shell-source-maps/assets/{workflows-Bku4o2su.js.map → workflows-DlvOln9v.js.map} +1 -1
  178. package/dist/shell-source-maps/assets/{workflows-start-kl7rSSay.js.map → workflows-start-QUKfwFqf.js.map} +1 -1
  179. package/dist/status/messages.d.ts +2 -2
  180. package/dist/styles.css +14 -0
  181. package/dist/users/messages.d.ts +2 -2
  182. package/package.json +5 -5
  183. package/dist/app/hold-start-for-first-loads.d.ts +0 -12
  184. package/dist/app/hold-start-for-first-loads.js +0 -43
  185. package/dist/shell/assets/api-provider-CcDtTh0D.js +0 -2
  186. package/dist/shell/assets/app-DG30qs8Q.js +0 -16
  187. package/dist/shell/assets/badge-ChHXC28D.js +0 -2
  188. package/dist/shell/assets/checkbox-COOOlJPG.js +0 -2
  189. package/dist/shell/assets/display-value-fDiKbfJO.js +0 -2
  190. package/dist/shell/assets/index-BkCaPeOq.css +0 -2
  191. package/dist/shell/assets/index-CZ013UoE.js +0 -2
  192. package/dist/shell/assets/maplibre-Y7X50Jfk.js +0 -2
  193. package/dist/shell/assets/messages-ClKBpZlk.js +0 -2
  194. package/dist/shell/assets/search-picker-CJcJetBh.js +0 -2
  195. package/dist/shell/assets/shared-protobase-ui-CVwqj5Cp.js +0 -2
  196. package/dist/shell/assets/step-catalog-ZvQOXfSh.js +0 -2
  197. package/dist/shell/assets/step-panel-B1yHz7OC.js +0 -2
  198. package/dist/shell/assets/use-app-address-B6k3dkV0.js +0 -2
  199. package/dist/shell/assets/value-badge-BKLV4otJ.js +0 -2
  200. package/dist/shell/assets/workflow-workbench-Djdd_ODh.js +0 -4
  201. package/dist/shell-source-maps/assets/api-provider-CcDtTh0D.js.map +0 -1
  202. package/dist/shell-source-maps/assets/app-DG30qs8Q.js.map +0 -1
  203. package/dist/shell-source-maps/assets/display-value-fDiKbfJO.js.map +0 -1
  204. package/dist/shell-source-maps/assets/index-CZ013UoE.js.map +0 -1
  205. package/dist/shell-source-maps/assets/messages-ClKBpZlk.js.map +0 -1
  206. package/dist/shell-source-maps/assets/shared-protobase-ui-CVwqj5Cp.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"badge-ChHXC28D.js","names":["n","a","t","__toESM","createLucideIcon","cn","__iconData","TriangleAlert","luminance","digits","hex","full","digit","g","b","channel","at","light","dark","readableOn","shade","background","import_jsx_runtime","require_jsx_runtime","tones","toneDots","arrow","Badge","color","shape","tone","className","dot","children"],"sources":["../../../../../node_modules/.bun/lucide-react@1.52.0+0ac650c021fb1b59/node_modules/lucide-react/dist/esm/icons/triangle-alert.mjs","../../../src/lib/readable-text.ts","../../../src/primitives/badge.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.52.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"triangle-alert\",\n size: 24,\n node: [\n [\n \"path\",\n {\n d: \"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\",\n key: \"wmoenq\"\n }\n ],\n [\"path\", { d: \"M12 9v4\", key: \"juzpu7\" }],\n [\"path\", { d: \"M12 17h.01\", key: \"p32p05\" }]\n ],\n aliases: [\"alert-triangle\"]\n};\n__iconData.node;\nconst TriangleAlert = createLucideIcon(__iconData);\n\nexport { __iconData, TriangleAlert as default };\n//# sourceMappingURL=triangle-alert.mjs.map\n","// WCAG relative luminance of a `#rgb` or `#rrggbb` colour.\nconst luminance = (hex: string) => {\n const digits = hex.slice(1)\n const full = digits.length === 3 ? [...digits].map((digit) => digit + digit).join('') : digits\n const [r, g, b] = [0, 2, 4].map((at) => {\n const channel = Number.parseInt(full.slice(at, at + 2), 16) / 255\n return channel <= 0.03928 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4\n })\n return 0.2126 * r! + 0.7152 * g! + 0.0722 * b!\n}\n\nconst light = '#ffffff'\nconst dark = '#111827'\n\n/** The text colour, white or near black, that reads best on a hex background. */\nexport const readableOn = (background: string) => {\n const shade = luminance(background)\n return (1.05 / (shade + 0.05) >= (shade + 0.05) / (luminance(dark) + 0.05) ? light : dark)\n}\n","import type { ReactNode } from 'react'\nimport type { BadgeTone } from '@protobase/schema'\nimport { cn } from '../lib/cn'\nimport { readableOn } from '../lib/readable-text'\n\nexport type { BadgeTone }\n\nconst tones: Record<BadgeTone, string> = {\n neutral: 'bg-muted text-muted-foreground',\n blue: 'bg-primary-soft text-primary-text',\n green: 'bg-success-soft text-success-text',\n amber: 'bg-warning-soft text-warning-text',\n red: 'bg-danger-soft text-danger-text',\n violet: 'bg-violet-soft text-violet-text',\n}\n\n/** The dot of a badge in each tone, for a status drawn as a dot alone. */\nexport const toneDots: Record<BadgeTone, string> = {\n neutral: 'bg-faint-foreground',\n blue: 'bg-primary',\n green: 'bg-success',\n amber: 'bg-warning',\n red: 'bg-danger',\n violet: 'bg-violet',\n}\n\n// An arrow pointing right, its point as deep as half the badge is high.\nconst arrow = 'polygon(0 0, calc(100% - 0.625rem) 0, 100% 50%, calc(100% - 0.625rem) 100%, 0 100%)'\n\ntype BadgeProps = {\n tone?: BadgeTone\n dot?: boolean\n /** A hex colour that fills the badge instead of its tone, its text white or near black, whichever reads. */\n color?: string\n /** `arrow` points the badge right, as on a rating scale. */\n shape?: 'arrow'\n children: ReactNode\n className?: string\n}\n\nexport const Badge = ({ tone = 'neutral', dot = true, color, shape, children, className }: BadgeProps) => (\n <span\n style={{ ...(color !== undefined && { backgroundColor: color, color: readableOn(color) }), ...(shape === 'arrow' && { clipPath: arrow }) }}\n className={cn(\n shape === 'arrow' ? 'inline-flex h-5 items-center gap-1.5 rounded-l-sm pr-4 pl-2 text-xs font-semibold whitespace-nowrap' : 'inline-flex h-5 items-center gap-1.5 rounded-full px-2 text-xs font-medium whitespace-nowrap',\n color === undefined && tones[tone],\n className,\n )}\n >\n {dot && color === undefined && shape === undefined && <span className={cn('size-1.5 rounded-full', toneDots[tone])} />}\n {children}\n </span>\n)\n"],"ignoreList":[0],"mappings":"6nBASA,IAAMM,EAAa,CACjB,KAAM,iBACN,KAAM,GACN,KAAM,CACJ,CACE,OACA,CACE,EAAG,2EACH,IAAK,QACP,CACF,EACA,CAAC,OAAQ,CAAE,EAAG,UAAW,IAAK,QAAS,CAAC,EACxC,CAAC,OAAQ,CAAE,EAAG,aAAc,IAAK,QAAS,CAAC,CAC7C,EACA,QAAS,CAAC,gBAAgB,CAC5B,EACAA,EAAW,KACX,IAAMC,EAAgBH,EAAiBE,CAAU,ECzB3CE,EAAa,GAAgB,CACjC,IAAMC,EAASC,EAAI,MAAM,CAAC,EACpBC,EAAOF,EAAO,SAAW,EAAI,CAAC,GAAGA,CAAM,CAAC,CAAC,IAAK,GAAUG,EAAQA,CAAK,CAAC,CAAC,KAAK,EAAE,EAAIH,EAClF,CAAC,EAAGI,EAAGC,GAAK,CAAC,EAAG,EAAG,CAAC,CAAC,CAAC,IAAK,GAAO,CACtC,IAAMC,EAAU,OAAO,SAASJ,EAAK,MAAMK,EAAIA,EAAK,CAAC,EAAG,EAAE,EAAI,IAC9D,OAAOD,GAAW,OAAUA,EAAU,QAAUA,EAAU,MAAS,QAAU,GAC/E,CAAC,EACD,MAAO,OAAS,EAAK,MAASF,EAAK,MAASC,CAC9C,EAEMG,EAAQ,UACRC,EAAO,UAGAC,EAAc,GAAuB,CAChD,IAAMC,EAAQZ,EAAUa,CAAU,EAClC,MAAQ,OAAQD,EAAQ,OAAUA,EAAQ,MAASZ,EAAUU,CAAI,EAAI,KAAQD,EAAQC,CACvF,aCXMM,EAAmC,CACvC,QAAS,iCACT,KAAM,oCACN,MAAO,oCACP,MAAO,oCACP,IAAK,kCACL,OAAQ,iCACV,EAGaC,EAAsC,CACjD,QAAS,sBACT,KAAM,aACN,MAAO,aACP,MAAO,aACP,IAAK,YACL,OAAQ,WACV,EAGMC,EAAQ,sFAaDC,GAAS,CAAE,OAAO,UAAW,MAAM,GAAM,QAAO,QAAO,WAAU,gBAC5E,EAAAL,EAAA,KAAA,CAAC,OAAD,CACE,MAAO,CAAE,GAAIM,IAAU,IAAA,IAAa,CAAE,gBAAiBA,EAAO,MAAOT,EAAWS,CAAK,CAAE,EAAI,GAAIC,IAAU,SAAW,CAAE,SAAUH,CAAM,CAAG,EACzI,UAAWrB,EACTwB,IAAU,QAAU,sGAAwG,+FAC5HD,IAAU,IAAA,IAAaJ,EAAMM,GAC7BC,CACF,EANF,SAAA,CAQGC,GAAOJ,IAAU,IAAA,IAAaC,IAAU,IAAA,KAAa,EAAAP,EAAA,IAAA,CAAC,OAAD,CAAM,UAAWjB,EAAG,wBAAyBoB,EAASK,EAAK,CAAI,CAAA,EACpHG,CACG","debugId":"a11d70b6-f039-4c65-b285-8c6cc7c28c2f"}
1
+ {"version":3,"file":"badge-OU9hb6yQ.js","names":["n","a","t","__toESM","createLucideIcon","cn","__iconData","TriangleAlert","luminance","digits","hex","full","digit","g","b","channel","at","light","dark","readableOn","shade","background","import_jsx_runtime","require_jsx_runtime","tones","toneDots","arrow","Badge","color","shape","tone","className","dot","children"],"sources":["../../../../../node_modules/.bun/lucide-react@1.52.0+0ac650c021fb1b59/node_modules/lucide-react/dist/esm/icons/triangle-alert.mjs","../../../src/lib/readable-text.ts","../../../src/primitives/badge.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.52.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"triangle-alert\",\n size: 24,\n node: [\n [\n \"path\",\n {\n d: \"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\",\n key: \"wmoenq\"\n }\n ],\n [\"path\", { d: \"M12 9v4\", key: \"juzpu7\" }],\n [\"path\", { d: \"M12 17h.01\", key: \"p32p05\" }]\n ],\n aliases: [\"alert-triangle\"]\n};\n__iconData.node;\nconst TriangleAlert = createLucideIcon(__iconData);\n\nexport { __iconData, TriangleAlert as default };\n//# sourceMappingURL=triangle-alert.mjs.map\n","// WCAG relative luminance of a `#rgb` or `#rrggbb` colour.\nconst luminance = (hex: string) => {\n const digits = hex.slice(1)\n const full = digits.length === 3 ? [...digits].map((digit) => digit + digit).join('') : digits\n const [r, g, b] = [0, 2, 4].map((at) => {\n const channel = Number.parseInt(full.slice(at, at + 2), 16) / 255\n return channel <= 0.03928 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4\n })\n return 0.2126 * r! + 0.7152 * g! + 0.0722 * b!\n}\n\nconst light = '#ffffff'\nconst dark = '#111827'\n\n/** The text colour, white or near black, that reads best on a hex background. */\nexport const readableOn = (background: string) => {\n const shade = luminance(background)\n return (1.05 / (shade + 0.05) >= (shade + 0.05) / (luminance(dark) + 0.05) ? light : dark)\n}\n","import type { ReactNode } from 'react'\nimport type { BadgeTone } from '@protobase/schema'\nimport { cn } from '../lib/cn'\nimport { readableOn } from '../lib/readable-text'\n\nexport type { BadgeTone }\n\nconst tones: Record<BadgeTone, string> = {\n neutral: 'bg-muted text-muted-foreground',\n blue: 'bg-primary-soft text-primary-text',\n green: 'bg-success-soft text-success-text',\n amber: 'bg-warning-soft text-warning-text',\n red: 'bg-danger-soft text-danger-text',\n violet: 'bg-violet-soft text-violet-text',\n}\n\n/** The dot of a badge in each tone, for a status drawn as a dot alone. */\nexport const toneDots: Record<BadgeTone, string> = {\n neutral: 'bg-faint-foreground',\n blue: 'bg-primary',\n green: 'bg-success',\n amber: 'bg-warning',\n red: 'bg-danger',\n violet: 'bg-violet',\n}\n\n// An arrow pointing right, its point as deep as half the badge is high.\nconst arrow = 'polygon(0 0, calc(100% - 0.625rem) 0, 100% 50%, calc(100% - 0.625rem) 100%, 0 100%)'\n\ntype BadgeProps = {\n tone?: BadgeTone\n dot?: boolean\n /** A hex colour that fills the badge instead of its tone, its text white or near black, whichever reads. */\n color?: string\n /** `arrow` points the badge right, as on a rating scale. */\n shape?: 'arrow'\n children: ReactNode\n className?: string\n}\n\nexport const Badge = ({ tone = 'neutral', dot = true, color, shape, children, className }: BadgeProps) => (\n <span\n style={{ ...(color !== undefined && { backgroundColor: color, color: readableOn(color) }), ...(shape === 'arrow' && { clipPath: arrow }) }}\n className={cn(\n shape === 'arrow' ? 'inline-flex h-5 items-center gap-1.5 rounded-l-sm pr-4 pl-2 text-xs font-semibold whitespace-nowrap' : 'inline-flex h-5 items-center gap-1.5 rounded-full px-2 text-xs font-medium whitespace-nowrap',\n color === undefined && tones[tone],\n className,\n )}\n >\n {dot && color === undefined && shape === undefined && <span className={cn('size-1.5 rounded-full', toneDots[tone])} />}\n {children}\n </span>\n)\n"],"ignoreList":[0],"mappings":"qoBASA,IAAMM,EAAa,CACjB,KAAM,iBACN,KAAM,GACN,KAAM,CACJ,CACE,OACA,CACE,EAAG,2EACH,IAAK,QACP,CACF,EACA,CAAC,OAAQ,CAAE,EAAG,UAAW,IAAK,QAAS,CAAC,EACxC,CAAC,OAAQ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U,sGAAwG,+FAC5HD,IAAU,IAAA,IAAaJ,EAAMM,GAC7BC,CACF,EANF,SAAA,CAQGC,GAAOJ,IAAU,IAAA,IAAaC,IAAU,IAAA,KAAa,EAAAP,EAAA,IAAA,CAAC,OAAD,CAAM,UAAWjB,EAAG,wBAAyBoB,EAASK,EAAK,CAAI,CAAA,EACpHG,CACG","debugId":"0e53d85b-eb24-45d1-9f06-8296113855e4"}
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox-COOOlJPG.js","names":["__iconData","__iconData","__iconData","__iconData","createContext","useContext","isObject","n","a","t","__toESM","require_react","require_jsx_runtime","messages","createLucideIcon","cn","expressionSource","innerMachine","triggerSchema","orderOf","pinType","inputSchema","stepStatusSchema","resultSchema","parseReference","schemaAt","__iconData$4","Check","__iconData$3","CircleAlert","__iconData$2","LayoutGrid","__iconData$1","Minus","__iconData","X","import_react","FieldControlContext","useFieldControl","control","import_jsx_runtime","Input","rest","invalid","wrapperClassName","leading","className","trailing","Select","emptyDefinition","definitionOf","value","given","machine","States","start","recordDefinition","record","definitionRecord","_","withoutStart","definition","pathNames","path","pathOf","scope","name","splitPath","names","machineAt","stateAt","allNames","state","inner","pathOfName","other","found","holdsSteps","isObject$1","propertiesOf","schema","branches","own","entry","merged","field","branch","known","fields","fieldsOf","inputState","argumentsOf","inputPin","options","option","inputPins","schemas","required","args","key","outputsOf","stepOutputs","triggerOutputs","statusKey","conditionKey","statusPin","conditionPin","givenSchema","triggerLayoutKey","isObject","isPoint","pointsOf","point","workflowLayoutOf","views","keyPart","part","nameOf","id","pathPart","layoutKey","pure","withoutKey","layout","spacing","padding","overlaps","b","placedBoxes","moved","laidOut","boxes","box","children","parentOf","depth","parent","grown","ids","placed","others","under","group","width","height","text","Checkbox","indeterminate","checked","label","onChange"],"sources":["../../../../../node_modules/.bun/lucide-react@1.52.0+0ac650c021fb1b59/node_modules/lucide-react/dist/esm/icons/check.mjs","../../../../../node_modules/.bun/lucide-react@1.52.0+0ac650c021fb1b59/node_modules/lucide-react/dist/esm/icons/circle-alert.mjs","../../../../../node_modules/.bun/lucide-react@1.52.0+0ac650c021fb1b59/node_modules/lucide-react/dist/esm/icons/layout-grid.mjs","../../../../../node_modules/.bun/lucide-react@1.52.0+0ac650c021fb1b59/node_modules/lucide-react/dist/esm/icons/minus.mjs","../../../../../node_modules/.bun/lucide-react@1.52.0+0ac650c021fb1b59/node_modules/lucide-react/dist/esm/icons/x.mjs","../../../src/primitives/field-control.ts","../../../src/primitives/input.tsx","../../../src/primitives/select.tsx","../../../src/app/field-types/workflow/definition.ts","../../../src/app/field-types/workflow/pins/node-pins.ts","../../../src/app/field-types/workflow/manual-layout.ts","../../../src/app/field-types/workflow/messages.ts","../../../src/primitives/checkbox.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.52.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"check\",\n size: 24,\n node: [[\"path\", { d: \"M20 6 9 17l-5-5\", key: \"1gmf2c\" }]]\n};\n__iconData.node;\nconst Check = createLucideIcon(__iconData);\n\nexport { __iconData, Check as default };\n//# sourceMappingURL=check.mjs.map\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: \"circle-alert\",\n size: 24,\n node: [\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"10\", key: \"1mglay\" }],\n [\"line\", { x1: \"12\", x2: \"12\", y1: \"8\", y2: \"12\", key: \"1pkeuh\" }],\n [\"line\", { x1: \"12\", x2: \"12.01\", y1: \"16\", y2: \"16\", key: \"4dfq90\" }]\n ],\n aliases: [\"alert-circle\"]\n};\n__iconData.node;\nconst CircleAlert = createLucideIcon(__iconData);\n\nexport { __iconData, CircleAlert as default };\n//# sourceMappingURL=circle-alert.mjs.map\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: \"layout-grid\",\n size: 24,\n node: [\n [\"rect\", { width: \"7\", height: \"7\", x: \"3\", y: \"3\", rx: \"1\", key: \"1g98yp\" }],\n [\"rect\", { width: \"7\", height: \"7\", x: \"14\", y: \"3\", rx: \"1\", key: \"6d4xhi\" }],\n [\"rect\", { width: \"7\", height: \"7\", x: \"14\", y: \"14\", rx: \"1\", key: \"nxv5o0\" }],\n [\"rect\", { width: \"7\", height: \"7\", x: \"3\", y: \"14\", rx: \"1\", key: \"1bb6yr\" }]\n ]\n};\n__iconData.node;\nconst LayoutGrid = createLucideIcon(__iconData);\n\nexport { __iconData, LayoutGrid as default };\n//# sourceMappingURL=layout-grid.mjs.map\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: \"minus\",\n size: 24,\n node: [[\"path\", { d: \"M5 12h14\", key: \"1ays0h\" }]]\n};\n__iconData.node;\nconst Minus = createLucideIcon(__iconData);\n\nexport { __iconData, Minus as default };\n//# sourceMappingURL=minus.mjs.map\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: \"x\",\n size: 24,\n node: [\n [\"path\", { d: \"M18 6 6 18\", key: \"1bl5f8\" }],\n [\"path\", { d: \"m6 6 12 12\", key: \"d8bk6v\" }]\n ]\n};\n__iconData.node;\nconst X = createLucideIcon(__iconData);\n\nexport { __iconData, X as default };\n//# sourceMappingURL=x.mjs.map\n","import { createContext, useContext } from 'react'\n\nexport type FieldControl = {\n id: string\n /** The form field's name, for the browser's autofill. */\n name?: string\n /** The ids of the help, example and error under the field. */\n describedBy?: string\n invalid: boolean\n required: boolean\n}\n\n/** Set by a form's `Field` for the control inside it. */\nexport const FieldControlContext = createContext<FieldControl | undefined>(undefined)\n\n/**\n * The attributes that tie a control to the `Field` around it: the id its label points at, its name, the help and error\n * that describe it, and whether it is invalid or required. None outside a `Field`.\n */\nexport const useFieldControl = () => {\n const control = useContext(FieldControlContext)\n if (!control) return {}\n return {\n id: control.id,\n name: control.name,\n 'aria-describedby': control.describedBy,\n 'aria-invalid': control.invalid || undefined,\n 'aria-required': control.required || undefined,\n }\n}\n","import type { InputHTMLAttributes, ReactNode, Ref } from 'react'\nimport { cn } from '../lib/cn'\nimport { useFieldControl } from './field-control'\n\nexport type InputProps = InputHTMLAttributes<HTMLInputElement> & { ref?: Ref<HTMLInputElement>; leading?: ReactNode; trailing?: ReactNode; invalid?: boolean; wrapperClassName?: string }\n\nexport const Input = ({ leading, trailing, invalid, className, wrapperClassName, ...rest }: InputProps) => {\n const control = useFieldControl()\n return (\n <span\n className={cn(\n 'flex h-8 items-center gap-2 rounded-md border bg-background px-2.5 text-muted-foreground shadow-sm focus-within:border-primary focus-within:ring-2 focus-within:ring-primary/20',\n invalid ? 'border-danger' : 'border-border-strong',\n wrapperClassName,\n )}\n >\n {leading}\n <input className={cn('min-w-0 flex-1 bg-transparent text-body text-foreground outline-none placeholder:text-faint-foreground', className)} {...control} {...(invalid && { 'aria-invalid': true })} {...rest} />\n {trailing}\n </span>\n )\n}\n","import type { Ref, SelectHTMLAttributes } from 'react'\nimport { cn } from '../lib/cn'\nimport { useFieldControl } from './field-control'\n\nexport type SelectProps = SelectHTMLAttributes<HTMLSelectElement> & { invalid?: boolean; ref?: Ref<HTMLSelectElement> }\n\n/** A native select as the field editors draw theirs; inside a `Field` it takes its label, help and error from it. */\nexport const Select = ({ invalid, className, children, ...rest }: SelectProps) => {\n const control = useFieldControl()\n return (\n <select\n {...control}\n {...(invalid && { 'aria-invalid': true })}\n className={cn('h-8 w-full min-w-0 rounded-md border bg-background px-2 shadow-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/20', invalid ? 'border-danger' : 'border-border-strong', className)}\n {...rest}\n >\n {children}\n </select>\n )\n}\n","import { innerMachine, orderOf, type Definition, type Machine, type State } from '@protobase/workflows'\n\n/** A state's path: its name, after the names of the Maps and Blocks it is inside, joined by `/` as the definition check names it. */\nexport type StatePath = string\n\n/** The node of the workflow's trigger, which leads to the first state; no state path is empty. */\nexport const triggerId = ''\n\n/** What a workflow without a definition starts from: run by hand, and no state yet. */\nexport const emptyDefinition = (): Definition => ({ trigger: { manual: {} }, stateMachine: { QueryLanguage: 'JSONata', StartAt: '', States: {} } })\n\n/** The value as a definition to draw and edit: a workflow without one starts empty. */\nexport const definitionOf = (value: unknown): Definition => {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) return emptyDefinition()\n const given = value as Partial<Definition>\n const machine = given.stateMachine\n const States = typeof machine?.States === 'object' && machine.States !== null && !Array.isArray(machine.States) ? machine.States : {}\n // In data order a machine has no start, as it is saved\n const start = given.order === 'data' ? {} : { StartAt: machine?.StartAt ?? '' }\n return { ...given, trigger: given.trigger ?? { manual: {} }, stateMachine: { ...machine, QueryLanguage: 'JSONata', ...start, States } } as Definition\n}\n\n/**\n * A workflow's or a version's record as the definition to draw and edit, from the fields it keeps it in: its state\n * machine, trigger, execution order, connections and trace. One in data order is drawn with an empty `StartAt`, which\n * it is saved without.\n */\nexport const recordDefinition = (record: Record<string, unknown>): Definition =>\n definitionOf({\n trigger: record.trigger,\n order: record.execution_order ?? 'sequence',\n stateMachine: record.state_machine,\n ...(record.connections ? { connections: record.connections } : {}),\n ...(record.trace ? { trace: record.trace } : {}),\n })\n\n/** The fields a definition is saved in, as `recordDefinition` reads them: a state machine in data order has no `StartAt`. */\nexport const definitionRecord = (definition: Definition) => {\n const { StartAt: _, ...withoutStart } = definition.stateMachine\n return {\n state_machine: orderOf(definition) === 'data' ? withoutStart : definition.stateMachine,\n trigger: definition.trigger,\n execution_order: orderOf(definition),\n connections: definition.connections ?? null,\n trace: definition.trace ?? null,\n }\n}\n\n/** The names of a path, outermost first. */\nexport const pathNames = (path: StatePath) => path.split('/')\n\n/** The path of a state named `name` in the machine at `scope`, the path of a Map or Block or [] for the whole workflow. */\nexport const pathOf = (scope: readonly string[], name: string): StatePath => [...scope, name].join('/')\n\n/** The Maps and Blocks a path is inside, outermost first, and its own name. */\nexport const splitPath = (path: StatePath) => {\n const names = pathNames(path)\n return { scope: names.slice(0, -1), name: names.at(-1)! }\n}\n\n/** The machine at `scope`: the whole workflow's for [], else the steps of the Map or Block at that path. */\nexport const machineAt = (definition: Definition, scope: readonly string[]): Machine | undefined => {\n let machine: Machine | undefined = definition.stateMachine\n for (const name of scope) machine = innerMachine(machine?.States[name])\n return machine\n}\n\n/** The state at a path, when there is one. */\nexport const stateAt = (definition: Definition, path: StatePath): State | undefined => {\n const { scope, name } = splitPath(path)\n return machineAt(definition, scope)?.States[name]\n}\n\n/** Every state name, the ones inside Maps and Blocks too, which are unique across the whole definition. */\nexport const allNames = (machine: Machine): string[] =>\n Object.entries(machine.States).flatMap(([name, state]) => {\n const inner = innerMachine(state)\n return [name, ...(inner?.States ? allNames(inner) : [])]\n })\n\n/** The path of the state named `name`, wherever it is in the definition: names are unique across it. */\nexport const pathOfName = (machine: Machine, name: string, scope: readonly string[] = []): string[] | undefined => {\n if (Object.hasOwn(machine.States, name)) return [...scope, name]\n for (const [other, state] of Object.entries(machine.States)) {\n const inner = innerMachine(state)\n const found = inner?.States && pathOfName(inner, name, [...scope, other])\n if (found) return found\n }\n return\n}\n\n/** Whether a state holds steps of its own, drawn inside it: a Map's or a Block's. */\nexport const holdsSteps = (state: State | undefined) => state?.Type === 'Map' || state?.Type === 'Block'\n","import { expressionSource, inputSchema, parseReference, pinType, resultSchema, schemaAt, stepStatusSchema, triggerSchema, type Definition, type PinSchemas, type PinType, type State } from '@protobase/workflows'\n\ntype JsonSchema = Record<string, unknown>\n\n/**\n * What an input holds: nothing; a value of its own; an expression that computes; one read by name, drawn as a wire;\n * or an object whose fields read values, drawn as a Make node.\n */\nexport type InputState = 'empty' | 'literal' | 'expression' | 'wired' | 'made'\n\n/**\n * A pin on the left of a step: an argument of its type, with its type, whether the type needs it, and what it holds;\n * `statuses`: its options are what a step's status can be, shown by their names.\n */\nexport type InputPin = { key: string; type: PinType; required: boolean; value: unknown; state: InputState; options?: readonly string[]; statuses?: true }\n\n/** A pin on the right of a node: the value at `path` in what it gives, with its type. */\nexport type OutputPin = { path: string[]; type: PinType }\n\nconst isObject = (value: unknown): value is Record<string, unknown> => typeof value === 'object' && value !== null && !Array.isArray(value)\n\n// The fields of an object a schema describes, or of the branches of its anyOf or oneOf, each name once: a field that\n// several branches declare takes any of their schemas.\nconst propertiesOf = (schema: JsonSchema | undefined): [string, JsonSchema][] => {\n if (!schema) return []\n const branches = [schema.anyOf, schema.oneOf].find(Array.isArray) as unknown[] | undefined\n const own = isObject(schema.properties) ? Object.entries(schema.properties).filter((entry): entry is [string, JsonSchema] => isObject(entry[1])) : []\n if (!branches) return own\n // The schema's own fields first, then each the branches add\n const merged = new Map<string, JsonSchema[]>(own.map(([name, field]) => [name, [field]]))\n for (const [name, field] of branches.filter(isObject).flatMap((branch) => propertiesOf(branch as JsonSchema))) if (!own.some(([known]) => known === name)) merged.set(name, [...(merged.get(name) ?? []), field])\n return [...merged].map(([name, fields]) => [name, fields.length === 1 ? fields[0]! : { anyOf: fields }])\n}\n\n/** The fields of an object a schema describes, each with its schema; none when it names none. */\nexport const fieldsOf = (schema: JsonSchema | undefined) => propertiesOf(schema)\n\n/** What an input's value is, as its pin shows it. */\nexport const inputState = (value: unknown): InputState => {\n if (value === undefined || value === '') return 'empty'\n if (parseReference(value)) return 'wired'\n if (expressionSource(value) !== undefined) return 'expression'\n // An object whose fields read values, by name alone or in an expression, is built by a Make node\n if (isObject(value) && Object.values(value).some((field) => expressionSource(field) !== undefined)) return 'made'\n return 'literal'\n}\n\nconst argumentsOf = (state: State): Record<string, unknown> => ('Arguments' in state && isObject(state.Arguments) ? state.Arguments : {})\n\n/** An input pin for the value at `key`, typed by its schema, with the choices an enum offers. */\nexport const inputPin = (key: string, schema: JsonSchema, value: unknown, required: boolean): InputPin => {\n const options = Array.isArray(schema.enum) && schema.enum.every((option) => typeof option === 'string') ? (schema.enum as string[]) : undefined\n return { key, type: pinType(schema), required, value, state: inputState(value), ...(options && { options }) }\n}\n\n/** A step's input pins: one per argument its type takes, in the order its schema declares them. */\nexport const inputPins = (state: State, schemas: PinSchemas): InputPin[] => {\n const schema = inputSchema(state, schemas)\n if (!schema) return []\n const required = Array.isArray(schema.required) ? (schema.required as string[]) : []\n const args = argumentsOf(state)\n return fieldsOf(schema).map(([key, field]) => inputPin(key, field, args[key], required.includes(key)))\n}\n\n// The pins of what a node gives: one per value it returns, as the fields of an untitled object, as a Blueprint's\n// function gives each output its own pin; one for the whole of a titled object, such as a record, which a Break takes apart.\nconst outputsOf = (schema: JsonSchema | undefined): OutputPin[] => {\n const fields = typeof schema?.title === 'string' ? [] : fieldsOf(schema)\n if (fields.length === 0) return [{ path: [], type: pinType(schema) }]\n return fields.map(([key, field]) => ({ path: [key], type: pinType(field) }))\n}\n\n/** What a step gives later steps by name: a Task's result by its type, a Map's or a Block's whole; nothing for the others. */\nexport const stepOutputs = (state: State, schemas: PinSchemas): OutputPin[] => {\n if (state.Type === 'Task') return outputsOf(resultSchema(state, schemas))\n if (state.Type === 'Map') return [{ path: [], type: pinType({ type: 'array' }) }]\n if (state.Type === 'Block') return [{ path: [], type: pinType(undefined) }]\n return []\n}\n\n/** What the trigger gives as the run's input: its fields by its type, or the whole input of a manual workflow. */\nexport const triggerOutputs = (definition: Definition, schemas: PinSchemas): OutputPin[] => outputsOf(triggerSchema(definition, schemas))\n\n/** In data order, the pin a state's status comes out of, and the one its Condition takes, which other values' pins never are. */\nexport const statusKey = '#status'\nexport const conditionKey = '#condition'\n\n/** A state's status pin, in data order: `$states.context.Steps.<name>`. */\nexport const statusPin: OutputPin = { path: [statusKey], type: pinType(stepStatusSchema) }\n\n/** A state's Only when pin, in data order: its Condition, true or false. */\nexport const conditionPin = (state: State): InputPin => ({ key: conditionKey, type: { kinds: ['boolean'] }, required: false, value: state.Condition, state: inputState(state.Condition) })\n\n/** The schema of the value at `path` of what a node gives, for its Break nodes: a Task's result, the run's input, or a state's status. */\nexport const givenSchema = (definition: Definition, state: State | undefined, schemas: PinSchemas, path: readonly string[]) => {\n if (path[0] === statusKey) return schemaAt(stepStatusSchema, path.slice(1))\n return schemaAt(state ? resultSchema(state, schemas) : triggerSchema(definition, schemas), path)\n}\n","import { splitPath, triggerId } from './definition'\nimport type { Box } from './graph-layout'\nimport type { PureNode } from './pins/data-graph'\nimport type { GraphView } from './pins/graph-view'\nimport { statusKey } from './pins/node-pins'\n\n/** Where a node's top left corner is, within the Map or Block it is inside or else the canvas. */\nexport type Point = { x: number; y: number }\n\n/** Where nodes were moved by hand in one view of the graph, by their layout keys: ELK lays out every node it does not name. */\nexport type ManualLayout = Readonly<Record<string, Point>>\n\n/**\n * A workflow's `layout` field, kept for everyone who edits it: the nodes moved by hand in each view of the graph, Pins\n * and Simple, each view's its own, so moving a node in one leaves it where it is in the other.\n */\nexport type WorkflowLayout = Readonly<Record<GraphView, ManualLayout>>\n\n/** The views a layout keeps, as its field holds them. */\nexport const layoutViews: readonly GraphView[] = ['pins', 'simple']\n\n/** The key of the trigger's node, and before the fields of the run's input that Break nodes take apart; no state's name. */\nexport const triggerLayoutKey = '$trigger'\n\nconst isObject = (value: unknown): value is Record<string, unknown> => typeof value === 'object' && value !== null && !Array.isArray(value)\n\nconst isPoint = (value: unknown): value is Point => isObject(value) && Number.isFinite(value.x) && Number.isFinite(value.y)\n\nconst pointsOf = (value: unknown): ManualLayout => (isObject(value) ? Object.fromEntries(Object.entries(value).flatMap(([key, point]) => (isPoint(point) ? [[key, { x: point.x, y: point.y }]] : []))) : {})\n\n/**\n * The layout a workflow's field holds, as its value or the JSON text a draft keeps it as: in each view, each position\n * with a finite `x` and `y`, read as those two alone, and nothing of what else it holds.\n */\nexport const workflowLayoutOf = (value: unknown): WorkflowLayout => {\n let given = value\n if (typeof value === 'string') {\n try {\n given = JSON.parse(value)\n } catch {\n given = undefined\n }\n }\n const views = isObject(given) ? given : {}\n return { pins: pointsOf(views.pins), simple: pointsOf(views.simple) }\n}\n\n/**\n * A name or a field as a part of a key: `%`, `.` and a leading `#` or `$` written as `%25`, `%2E`, `%23` and `%24`, so\n * a part is never read as two, and no part is taken for the trigger's key or a node's kind, which `#` starts.\n */\nexport const keyPart = (part: string) => part.replaceAll('%', '%25').replaceAll('.', '%2E').replace(/^#/, '%23').replace(/^\\$/, '%24')\n\n// A node's part of a key: a state's name, which is unique across the workflow, or the trigger's key\nconst nameOf = (id: string) => (id === triggerId ? triggerLayoutKey : keyPart(splitPath(id).name))\n\n// Where a value is in what a node gives, a status by its pin's own `#status`\nconst pathPart = (path: readonly string[]) => path.map((field) => (field === statusKey ? statusKey : keyPart(field)))\n\n/**\n * The key a node's position is kept under: a state's name; the trigger's key; a Break's the value it takes apart, such\n * as `Save.record`, or `Save.#break` for the whole of what a step gives; a Make's the argument it builds, such as\n * `Save.#make.data`; a Select's the argument it chooses, such as `Notify.#select.to`; and a condition node's its place among its step's Condition's nodes, such as `Tell.#when` for the\n * one wired to Only when and `Tell.#when.1` for the one at its second side. Every key but the trigger's starts with its\n * state's name, so a save drops those of a state removed.\n */\nexport const layoutKey = (id: string, pure?: PureNode) => {\n if (pure?.kind === 'break') return [nameOf(pure.source), ...(pure.path.length === 0 ? ['#break'] : pathPart(pure.path))].join('.')\n if (pure?.kind === 'make') return [nameOf(pure.target), '#make', keyPart(pure.key)].join('.')\n if (pure?.kind === 'select') return [nameOf(pure.target), '#select', keyPart(pure.key)].join('.')\n if (pure?.kind === 'condition') return [nameOf(pure.target), '#when', ...pure.at.map(String)].join('.')\n return nameOf(id)\n}\n\n/** The layout without a node's position, which ELK then lays out again. */\nexport const withoutKey = (layout: ManualLayout, key: string): ManualLayout => Object.fromEntries(Object.entries(layout).filter(([other]) => other !== key))\n\n// As ELK spaces nodes, and pads a Map or Block on its right and below\nconst spacing = 32\nconst padding = { right: 24, bottom: 24 }\n\nconst overlaps = (a: Box, b: Box) => a.x < b.x + b.width && b.x < a.x + a.width && a.y < b.y + b.height && b.y < a.y + a.height\n\n/**\n * The boxes ELK laid out, with the nodes moved by hand at their places: within each Map or Block, and on the canvas, a\n * node ELK laid out over one that was moved, or over a Map grown around it, goes down below it, and a Map or Block grows\n * around what was moved inside it. Without a node moved, ELK's boxes as they are.\n */\nexport const placedBoxes = (laidOut: ReadonlyMap<string, Box>, moved: ReadonlyMap<string, Point>, parentOf: (id: string) => string | undefined): ReadonlyMap<string, Box> => {\n if (![...moved.keys()].some((id) => laidOut.has(id))) return laidOut\n const boxes = new Map([...laidOut].map(([id, box]) => [id, { ...box, ...moved.get(id) }]))\n const children = new Map<string | undefined, string[]>()\n for (const id of boxes.keys()) children.set(parentOf(id), [...(children.get(parentOf(id)) ?? []), id])\n const depth = (parent: string | undefined): number => (parent === undefined ? 0 : depth(parentOf(parent)) + 1)\n const grown = new Set<string>()\n // The innermost first, so a Map grown inside another is placed at its new size\n for (const parent of [...children.keys()].sort((a, b) => depth(b) - depth(a))) {\n const ids = children.get(parent)!\n if (ids.some((id) => moved.has(id) || grown.has(id))) {\n const placed = ids.filter((id) => moved.has(id)).map((id) => boxes.get(id)!)\n const others = ids.filter((id) => !moved.has(id)).map((id) => boxes.get(id)!).sort((a, b) => a.y - b.y || a.x - b.x)\n for (const box of others) {\n let under = placed.find((other) => overlaps(box, other))\n while (under) {\n box.y = under.y + under.height + spacing\n under = placed.find((other) => overlaps(box, other))\n }\n placed.push(box)\n }\n }\n const group = parent === undefined ? undefined : boxes.get(parent)\n if (!group) continue\n const width = Math.max(group.width, ...ids.map((id) => boxes.get(id)!).map((box) => box.x + box.width + padding.right))\n const height = Math.max(group.height, ...ids.map((id) => boxes.get(id)!).map((box) => box.y + box.height + padding.bottom))\n if (width === group.width && height === group.height) continue\n Object.assign(group, { width, height })\n grown.add(parent!)\n }\n return boxes\n}\n","import { messages } from '../../../locale/messages'\n\nexport const text = messages('app/field-types/workflow')\n","import { Check, Minus } from 'lucide-react'\nimport { cn } from '../lib/cn'\n\nexport type CheckboxProps = { checked: boolean; indeterminate?: boolean; onChange?: (checked: boolean) => void; label?: string; disabled?: boolean; className?: string }\n\nexport const Checkbox = ({ checked, indeterminate, onChange, label, disabled, className }: CheckboxProps) => (\n <button\n type=\"button\"\n role=\"checkbox\"\n aria-checked={indeterminate ? 'mixed' : checked}\n aria-label={label}\n disabled={disabled}\n onClick={() => onChange?.(!checked)}\n className={cn(\n 'relative inline-flex size-4 shrink-0 items-center justify-center rounded border transition-colors after:absolute after:-inset-1 after:content-[\"\"] pointer-coarse:after:-inset-3.5',\n checked || indeterminate ? 'border-primary bg-primary text-primary-foreground' : 'border-border-strong bg-background hover:border-faint-foreground',\n className,\n )}\n >\n {indeterminate ? <Minus className=\"size-3\" strokeWidth={3} /> : checked && <Check className=\"size-3\" strokeWidth={3} />}\n </button>\n)\n"],"ignoreList":[0,1,2,3,4],"mappings":"mwBASA,IAAMA,EAAa,CACjB,KAAM,QACN,KAAM,GACN,KAAM,CAAC,CAAC,OAAQ,CAAE,EAAG,kBAAmB,IAAK,QAAS,CAAC,CAAC,CAC1D,EACAA,EAAW,KACX,IAAM2B,EAAQb,EAAiBd,CAAU,ECNnCC,EAAa,CACjB,KAAM,eACN,KAAM,GACN,KAAM,CACJ,CAAC,SAAU,CAAE,GAAI,KAAM,GAAI,KAAM,EAAG,KAAM,IAAK,QAAS,CAAC,EACzD,CAAC,OAAQ,CAAE,GAAI,KAAM,GAAI,KAAM,GAAI,IAAK,GAAI,KAAM,IAAK,QAAS,CAAC,EACjE,CAAC,OAAQ,CAAE,GAAI,KAAM,GAAI,QAAS,GAAI,KAAM,GAAI,KAAM,IAAK,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EAAI,EAAIA,EAAI,OAASP,EAAQ,MAAM,CAAC,GACtHkB,IAAUD,EAAM,OAASE,IAAWF,EAAM,UAC9C,OAAO,OAAOA,EAAO,CAAE,QAAO,QAAO,CAAC,EACtCL,EAAM,IAAID,CAAO,EACnB,CACA,OAAOL,CACT,ECrHac,GAAOpI,EAAS,0BAA0B,ECG1CqI,IAAY,CAAE,UAAS,gBAAe,WAAU,QAAO,WAAU,gBAC5E,EAAA1G,EAAA,IAAA,CAAC,SAAD,CACE,KAAK,SACL,KAAK,WACL,eAAc2G,EAAgB,QAAUC,EACxC,aAAYC,EACF,WACV,YAAeC,IAAW,CAACF,CAAO,EAClC,UAAWrI,EACT,qLACAqI,GAAWD,EAAgB,oDAAsD,mEACjFrG,CACF,EAEC,SAAAqG,GAAgB,EAAA3G,EAAA,IAAA,CAACP,EAAD,CAAO,UAAU,SAAS,YAAa,CAAI,CAAA,EAAImH,IAAW,EAAA5G,EAAA,IAAA,CAACb,EAAD,CAAO,UAAU,SAAS,YAAa,CAAI,CAAA,CAChH,CAAA","debugId":"8e38e949-3c69-413f-9f72-2ceee754b768"}
1
+ {"version":3,"file":"checkbox-DFfK432Y.js","names":["__iconData","__iconData","__iconData","__iconData","createContext","useContext","isObject","n","a","t","__toESM","require_react","require_jsx_runtime","createLucideIcon","cn","expressionSource","innerMachine","triggerSchema","orderOf","pinType","inputSchema","stepStatusSchema","resultSchema","parseReference","schemaAt","__iconData$4","Check","__iconData$3","CircleAlert","__iconData$2","LayoutGrid","__iconData$1","Minus","__iconData","X","import_react","FieldControlContext","useFieldControl","control","import_jsx_runtime","Input","rest","invalid","wrapperClassName","leading","className","trailing","Select","emptyDefinition","definitionOf","value","given","machine","States","start","recordDefinition","record","definitionRecord","_","withoutStart","definition","pathNames","path","pathOf","scope","name","splitPath","names","machineAt","stateAt","allNames","state","inner","pathOfName","other","found","holdsSteps","isObject$1","propertiesOf","schema","branches","own","entry","merged","field","branch","known","fields","fieldsOf","inputState","argumentsOf","inputPin","options","option","inputPins","schemas","required","args","key","outputsOf","stepOutputs","triggerOutputs","statusKey","conditionKey","statusPin","conditionPin","givenSchema","triggerLayoutKey","isObject","isPoint","pointsOf","point","workflowLayoutOf","views","keyPart","part","nameOf","id","pathPart","layoutKey","pure","withoutKey","layout","spacing","padding","overlaps","b","placedBoxes","moved","laidOut","boxes","box","children","parentOf","depth","parent","grown","ids","placed","others","under","group","width","height","text","messages","Checkbox","indeterminate","checked","label","onChange"],"sources":["../../../../../node_modules/.bun/lucide-react@1.52.0+0ac650c021fb1b59/node_modules/lucide-react/dist/esm/icons/check.mjs","../../../../../node_modules/.bun/lucide-react@1.52.0+0ac650c021fb1b59/node_modules/lucide-react/dist/esm/icons/circle-alert.mjs","../../../../../node_modules/.bun/lucide-react@1.52.0+0ac650c021fb1b59/node_modules/lucide-react/dist/esm/icons/layout-grid.mjs","../../../../../node_modules/.bun/lucide-react@1.52.0+0ac650c021fb1b59/node_modules/lucide-react/dist/esm/icons/minus.mjs","../../../../../node_modules/.bun/lucide-react@1.52.0+0ac650c021fb1b59/node_modules/lucide-react/dist/esm/icons/x.mjs","../../../src/primitives/field-control.ts","../../../src/primitives/input.tsx","../../../src/primitives/select.tsx","../../../src/app/field-types/workflow/definition.ts","../../../src/app/field-types/workflow/pins/node-pins.ts","../../../src/app/field-types/workflow/manual-layout.ts","../../../src/app/field-types/workflow/messages.ts","../../../src/primitives/checkbox.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.52.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"check\",\n size: 24,\n node: [[\"path\", { d: \"M20 6 9 17l-5-5\", key: \"1gmf2c\" }]]\n};\n__iconData.node;\nconst Check = createLucideIcon(__iconData);\n\nexport { __iconData, Check as default };\n//# sourceMappingURL=check.mjs.map\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: \"circle-alert\",\n size: 24,\n node: [\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"10\", key: \"1mglay\" }],\n [\"line\", { x1: \"12\", x2: \"12\", y1: \"8\", y2: \"12\", key: \"1pkeuh\" }],\n [\"line\", { x1: \"12\", x2: \"12.01\", y1: \"16\", y2: \"16\", key: \"4dfq90\" }]\n ],\n aliases: [\"alert-circle\"]\n};\n__iconData.node;\nconst CircleAlert = createLucideIcon(__iconData);\n\nexport { __iconData, CircleAlert as default };\n//# sourceMappingURL=circle-alert.mjs.map\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: \"layout-grid\",\n size: 24,\n node: [\n [\"rect\", { width: \"7\", height: \"7\", x: \"3\", y: \"3\", rx: \"1\", key: \"1g98yp\" }],\n [\"rect\", { width: \"7\", height: \"7\", x: \"14\", y: \"3\", rx: \"1\", key: \"6d4xhi\" }],\n [\"rect\", { width: \"7\", height: \"7\", x: \"14\", y: \"14\", rx: \"1\", key: \"nxv5o0\" }],\n [\"rect\", { width: \"7\", height: \"7\", x: \"3\", y: \"14\", rx: \"1\", key: \"1bb6yr\" }]\n ]\n};\n__iconData.node;\nconst LayoutGrid = createLucideIcon(__iconData);\n\nexport { __iconData, LayoutGrid as default };\n//# sourceMappingURL=layout-grid.mjs.map\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: \"minus\",\n size: 24,\n node: [[\"path\", { d: \"M5 12h14\", key: \"1ays0h\" }]]\n};\n__iconData.node;\nconst Minus = createLucideIcon(__iconData);\n\nexport { __iconData, Minus as default };\n//# sourceMappingURL=minus.mjs.map\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: \"x\",\n size: 24,\n node: [\n [\"path\", { d: \"M18 6 6 18\", key: \"1bl5f8\" }],\n [\"path\", { d: \"m6 6 12 12\", key: \"d8bk6v\" }]\n ]\n};\n__iconData.node;\nconst X = createLucideIcon(__iconData);\n\nexport { __iconData, X as default };\n//# sourceMappingURL=x.mjs.map\n","import { createContext, useContext } from 'react'\n\nexport type FieldControl = {\n id: string\n /** The form field's name, for the browser's autofill. */\n name?: string\n /** The ids of the help, example and error under the field. */\n describedBy?: string\n invalid: boolean\n required: boolean\n}\n\n/** Set by a form's `Field` for the control inside it. */\nexport const FieldControlContext = createContext<FieldControl | undefined>(undefined)\n\n/**\n * The attributes that tie a control to the `Field` around it: the id its label points at, its name, the help and error\n * that describe it, and whether it is invalid or required. None outside a `Field`.\n */\nexport const useFieldControl = () => {\n const control = useContext(FieldControlContext)\n if (!control) return {}\n return {\n id: control.id,\n name: control.name,\n 'aria-describedby': control.describedBy,\n 'aria-invalid': control.invalid || undefined,\n 'aria-required': control.required || undefined,\n }\n}\n","import type { InputHTMLAttributes, ReactNode, Ref } from 'react'\nimport { cn } from '../lib/cn'\nimport { useFieldControl } from './field-control'\n\nexport type InputProps = InputHTMLAttributes<HTMLInputElement> & { ref?: Ref<HTMLInputElement>; leading?: ReactNode; trailing?: ReactNode; invalid?: boolean; wrapperClassName?: string }\n\nexport const Input = ({ leading, trailing, invalid, className, wrapperClassName, ...rest }: InputProps) => {\n const control = useFieldControl()\n return (\n <span\n className={cn(\n 'flex h-8 items-center gap-2 rounded-md border bg-background px-2.5 text-muted-foreground shadow-sm focus-within:border-primary focus-within:ring-2 focus-within:ring-primary/20',\n invalid ? 'border-danger' : 'border-border-strong',\n wrapperClassName,\n )}\n >\n {leading}\n <input className={cn('min-w-0 flex-1 bg-transparent text-body text-foreground outline-none placeholder:text-faint-foreground', className)} {...control} {...(invalid && { 'aria-invalid': true })} {...rest} />\n {trailing}\n </span>\n )\n}\n","import type { Ref, SelectHTMLAttributes } from 'react'\nimport { cn } from '../lib/cn'\nimport { useFieldControl } from './field-control'\n\nexport type SelectProps = SelectHTMLAttributes<HTMLSelectElement> & { invalid?: boolean; ref?: Ref<HTMLSelectElement> }\n\n/** A native select as the field editors draw theirs; inside a `Field` it takes its label, help and error from it. */\nexport const Select = ({ invalid, className, children, ...rest }: SelectProps) => {\n const control = useFieldControl()\n return (\n <select\n {...control}\n {...(invalid && { 'aria-invalid': true })}\n className={cn('h-8 w-full min-w-0 rounded-md border bg-background px-2 shadow-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/20', invalid ? 'border-danger' : 'border-border-strong', className)}\n {...rest}\n >\n {children}\n </select>\n )\n}\n","import { innerMachine, orderOf, type Definition, type Machine, type State } from '@protobase/workflows'\n\n/** A state's path: its name, after the names of the Maps and Blocks it is inside, joined by `/` as the definition check names it. */\nexport type StatePath = string\n\n/** The node of the workflow's trigger, which leads to the first state; no state path is empty. */\nexport const triggerId = ''\n\n/** What a workflow without a definition starts from: run by hand, and no state yet. */\nexport const emptyDefinition = (): Definition => ({ trigger: { manual: {} }, stateMachine: { QueryLanguage: 'JSONata', StartAt: '', States: {} } })\n\n/** The value as a definition to draw and edit: a workflow without one starts empty. */\nexport const definitionOf = (value: unknown): Definition => {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) return emptyDefinition()\n const given = value as Partial<Definition>\n const machine = given.stateMachine\n const States = typeof machine?.States === 'object' && machine.States !== null && !Array.isArray(machine.States) ? machine.States : {}\n // In data order a machine has no start, as it is saved\n const start = given.order === 'data' ? {} : { StartAt: machine?.StartAt ?? '' }\n return { ...given, trigger: given.trigger ?? { manual: {} }, stateMachine: { ...machine, QueryLanguage: 'JSONata', ...start, States } } as Definition\n}\n\n/**\n * A workflow's or a version's record as the definition to draw and edit, from the fields it keeps it in: its state\n * machine, trigger, execution order, connections and trace. One in data order is drawn with an empty `StartAt`, which\n * it is saved without.\n */\nexport const recordDefinition = (record: Record<string, unknown>): Definition =>\n definitionOf({\n trigger: record.trigger,\n order: record.execution_order ?? 'sequence',\n stateMachine: record.state_machine,\n ...(record.connections ? { connections: record.connections } : {}),\n ...(record.trace ? { trace: record.trace } : {}),\n })\n\n/** The fields a definition is saved in, as `recordDefinition` reads them: a state machine in data order has no `StartAt`. */\nexport const definitionRecord = (definition: Definition) => {\n const { StartAt: _, ...withoutStart } = definition.stateMachine\n return {\n state_machine: orderOf(definition) === 'data' ? withoutStart : definition.stateMachine,\n trigger: definition.trigger,\n execution_order: orderOf(definition),\n connections: definition.connections ?? null,\n trace: definition.trace ?? null,\n }\n}\n\n/** The names of a path, outermost first. */\nexport const pathNames = (path: StatePath) => path.split('/')\n\n/** The path of a state named `name` in the machine at `scope`, the path of a Map or Block or [] for the whole workflow. */\nexport const pathOf = (scope: readonly string[], name: string): StatePath => [...scope, name].join('/')\n\n/** The Maps and Blocks a path is inside, outermost first, and its own name. */\nexport const splitPath = (path: StatePath) => {\n const names = pathNames(path)\n return { scope: names.slice(0, -1), name: names.at(-1)! }\n}\n\n/** The machine at `scope`: the whole workflow's for [], else the steps of the Map or Block at that path. */\nexport const machineAt = (definition: Definition, scope: readonly string[]): Machine | undefined => {\n let machine: Machine | undefined = definition.stateMachine\n for (const name of scope) machine = innerMachine(machine?.States[name])\n return machine\n}\n\n/** The state at a path, when there is one. */\nexport const stateAt = (definition: Definition, path: StatePath): State | undefined => {\n const { scope, name } = splitPath(path)\n return machineAt(definition, scope)?.States[name]\n}\n\n/** Every state name, the ones inside Maps and Blocks too, which are unique across the whole definition. */\nexport const allNames = (machine: Machine): string[] =>\n Object.entries(machine.States).flatMap(([name, state]) => {\n const inner = innerMachine(state)\n return [name, ...(inner?.States ? allNames(inner) : [])]\n })\n\n/** The path of the state named `name`, wherever it is in the definition: names are unique across it. */\nexport const pathOfName = (machine: Machine, name: string, scope: readonly string[] = []): string[] | undefined => {\n if (Object.hasOwn(machine.States, name)) return [...scope, name]\n for (const [other, state] of Object.entries(machine.States)) {\n const inner = innerMachine(state)\n const found = inner?.States && pathOfName(inner, name, [...scope, other])\n if (found) return found\n }\n return\n}\n\n/** Whether a state holds steps of its own, drawn inside it: a Map's or a Block's. */\nexport const holdsSteps = (state: State | undefined) => state?.Type === 'Map' || state?.Type === 'Block'\n","import { expressionSource, inputSchema, parseReference, pinType, resultSchema, schemaAt, stepStatusSchema, triggerSchema, type Definition, type PinSchemas, type PinType, type State } from '@protobase/workflows'\n\ntype JsonSchema = Record<string, unknown>\n\n/**\n * What an input holds: nothing; a value of its own; an expression that computes; one read by name, drawn as a wire;\n * or an object whose fields read values, drawn as a Make node.\n */\nexport type InputState = 'empty' | 'literal' | 'expression' | 'wired' | 'made'\n\n/**\n * A pin on the left of a step: an argument of its type, with its type, whether the type needs it, and what it holds;\n * `statuses`: its options are what a step's status can be, shown by their names.\n */\nexport type InputPin = { key: string; type: PinType; required: boolean; value: unknown; state: InputState; options?: readonly string[]; statuses?: true }\n\n/** A pin on the right of a node: the value at `path` in what it gives, with its type. */\nexport type OutputPin = { path: string[]; type: PinType }\n\nconst isObject = (value: unknown): value is Record<string, unknown> => typeof value === 'object' && value !== null && !Array.isArray(value)\n\n// The fields of an object a schema describes, or of the branches of its anyOf or oneOf, each name once: a field that\n// several branches declare takes any of their schemas.\nconst propertiesOf = (schema: JsonSchema | undefined): [string, JsonSchema][] => {\n if (!schema) return []\n const branches = [schema.anyOf, schema.oneOf].find(Array.isArray) as unknown[] | undefined\n const own = isObject(schema.properties) ? Object.entries(schema.properties).filter((entry): entry is [string, JsonSchema] => isObject(entry[1])) : []\n if (!branches) return own\n // The schema's own fields first, then each the branches add\n const merged = new Map<string, JsonSchema[]>(own.map(([name, field]) => [name, [field]]))\n for (const [name, field] of branches.filter(isObject).flatMap((branch) => propertiesOf(branch as JsonSchema))) if (!own.some(([known]) => known === name)) merged.set(name, [...(merged.get(name) ?? []), field])\n return [...merged].map(([name, fields]) => [name, fields.length === 1 ? fields[0]! : { anyOf: fields }])\n}\n\n/** The fields of an object a schema describes, each with its schema; none when it names none. */\nexport const fieldsOf = (schema: JsonSchema | undefined) => propertiesOf(schema)\n\n/** What an input's value is, as its pin shows it. */\nexport const inputState = (value: unknown): InputState => {\n if (value === undefined || value === '') return 'empty'\n if (parseReference(value)) return 'wired'\n if (expressionSource(value) !== undefined) return 'expression'\n // An object whose fields read values, by name alone or in an expression, is built by a Make node\n if (isObject(value) && Object.values(value).some((field) => expressionSource(field) !== undefined)) return 'made'\n return 'literal'\n}\n\nconst argumentsOf = (state: State): Record<string, unknown> => ('Arguments' in state && isObject(state.Arguments) ? state.Arguments : {})\n\n/** An input pin for the value at `key`, typed by its schema, with the choices an enum offers. */\nexport const inputPin = (key: string, schema: JsonSchema, value: unknown, required: boolean): InputPin => {\n const options = Array.isArray(schema.enum) && schema.enum.every((option) => typeof option === 'string') ? (schema.enum as string[]) : undefined\n return { key, type: pinType(schema), required, value, state: inputState(value), ...(options && { options }) }\n}\n\n/** A step's input pins: one per argument its type takes, in the order its schema declares them. */\nexport const inputPins = (state: State, schemas: PinSchemas): InputPin[] => {\n const schema = inputSchema(state, schemas)\n if (!schema) return []\n const required = Array.isArray(schema.required) ? (schema.required as string[]) : []\n const args = argumentsOf(state)\n return fieldsOf(schema).map(([key, field]) => inputPin(key, field, args[key], required.includes(key)))\n}\n\n// The pins of what a node gives: one per value it returns, as the fields of an untitled object, as a Blueprint's\n// function gives each output its own pin; one for the whole of a titled object, such as a record, which a Break takes apart.\nconst outputsOf = (schema: JsonSchema | undefined): OutputPin[] => {\n const fields = typeof schema?.title === 'string' ? [] : fieldsOf(schema)\n if (fields.length === 0) return [{ path: [], type: pinType(schema) }]\n return fields.map(([key, field]) => ({ path: [key], type: pinType(field) }))\n}\n\n/** What a step gives later steps by name: a Task's result by its type, a Map's or a Block's whole; nothing for the others. */\nexport const stepOutputs = (state: State, schemas: PinSchemas): OutputPin[] => {\n if (state.Type === 'Task') return outputsOf(resultSchema(state, schemas))\n if (state.Type === 'Map') return [{ path: [], type: pinType({ type: 'array' }) }]\n if (state.Type === 'Block') return [{ path: [], type: pinType(undefined) }]\n return []\n}\n\n/** What the trigger gives as the run's input: its fields by its type, or the whole input of a manual workflow. */\nexport const triggerOutputs = (definition: Definition, schemas: PinSchemas): OutputPin[] => outputsOf(triggerSchema(definition, schemas))\n\n/** In data order, the pin a state's status comes out of, and the one its Condition takes, which other values' pins never are. */\nexport const statusKey = '#status'\nexport const conditionKey = '#condition'\n\n/** A state's status pin, in data order: `$states.context.Steps.<name>`. */\nexport const statusPin: OutputPin = { path: [statusKey], type: pinType(stepStatusSchema) }\n\n/** A state's Only when pin, in data order: its Condition, true or false. */\nexport const conditionPin = (state: State): InputPin => ({ key: conditionKey, type: { kinds: ['boolean'] }, required: false, value: state.Condition, state: inputState(state.Condition) })\n\n/** The schema of the value at `path` of what a node gives, for its Break nodes: a Task's result, the run's input, or a state's status. */\nexport const givenSchema = (definition: Definition, state: State | undefined, schemas: PinSchemas, path: readonly string[]) => {\n if (path[0] === statusKey) return schemaAt(stepStatusSchema, path.slice(1))\n return schemaAt(state ? resultSchema(state, schemas) : triggerSchema(definition, schemas), path)\n}\n","import { splitPath, triggerId } from './definition'\nimport type { Box } from './graph-layout'\nimport type { PureNode } from './pins/data-graph'\nimport type { GraphView } from './pins/graph-view'\nimport { statusKey } from './pins/node-pins'\n\n/** Where a node's top left corner is, within the Map or Block it is inside or else the canvas. */\nexport type Point = { x: number; y: number }\n\n/** Where nodes were moved by hand in one view of the graph, by their layout keys: ELK lays out every node it does not name. */\nexport type ManualLayout = Readonly<Record<string, Point>>\n\n/**\n * A workflow's `layout` field, kept for everyone who edits it: the nodes moved by hand in each view of the graph, Pins\n * and Simple, each view's its own, so moving a node in one leaves it where it is in the other.\n */\nexport type WorkflowLayout = Readonly<Record<GraphView, ManualLayout>>\n\n/** The views a layout keeps, as its field holds them. */\nexport const layoutViews: readonly GraphView[] = ['pins', 'simple']\n\n/** The key of the trigger's node, and before the fields of the run's input that Break nodes take apart; no state's name. */\nexport const triggerLayoutKey = '$trigger'\n\nconst isObject = (value: unknown): value is Record<string, unknown> => typeof value === 'object' && value !== null && !Array.isArray(value)\n\nconst isPoint = (value: unknown): value is Point => isObject(value) && Number.isFinite(value.x) && Number.isFinite(value.y)\n\nconst pointsOf = (value: unknown): ManualLayout => (isObject(value) ? Object.fromEntries(Object.entries(value).flatMap(([key, point]) => (isPoint(point) ? [[key, { x: point.x, y: point.y }]] : []))) : {})\n\n/**\n * The layout a workflow's field holds, as its value or the JSON text a draft keeps it as: in each view, each position\n * with a finite `x` and `y`, read as those two alone, and nothing of what else it holds.\n */\nexport const workflowLayoutOf = (value: unknown): WorkflowLayout => {\n let given = value\n if (typeof value === 'string') {\n try {\n given = JSON.parse(value)\n } catch {\n given = undefined\n }\n }\n const views = isObject(given) ? given : {}\n return { pins: pointsOf(views.pins), simple: pointsOf(views.simple) }\n}\n\n/**\n * A name or a field as a part of a key: `%`, `.` and a leading `#` or `$` written as `%25`, `%2E`, `%23` and `%24`, so\n * a part is never read as two, and no part is taken for the trigger's key or a node's kind, which `#` starts.\n */\nexport const keyPart = (part: string) => part.replaceAll('%', '%25').replaceAll('.', '%2E').replace(/^#/, '%23').replace(/^\\$/, '%24')\n\n// A node's part of a key: a state's name, which is unique across the workflow, or the trigger's key\nconst nameOf = (id: string) => (id === triggerId ? triggerLayoutKey : keyPart(splitPath(id).name))\n\n// Where a value is in what a node gives, a status by its pin's own `#status`\nconst pathPart = (path: readonly string[]) => path.map((field) => (field === statusKey ? statusKey : keyPart(field)))\n\n/**\n * The key a node's position is kept under: a state's name; the trigger's key; a Break's the value it takes apart, such\n * as `Save.record`, or `Save.#break` for the whole of what a step gives; a Make's the argument it builds, such as\n * `Save.#make.data`; a Select's the argument it chooses, such as `Notify.#select.to`; and a condition node's its place among its step's Condition's nodes, such as `Tell.#when` for the\n * one wired to Only when and `Tell.#when.1` for the one at its second side. Every key but the trigger's starts with its\n * state's name, so a save drops those of a state removed.\n */\nexport const layoutKey = (id: string, pure?: PureNode) => {\n if (pure?.kind === 'break') return [nameOf(pure.source), ...(pure.path.length === 0 ? ['#break'] : pathPart(pure.path))].join('.')\n if (pure?.kind === 'make') return [nameOf(pure.target), '#make', keyPart(pure.key)].join('.')\n if (pure?.kind === 'select') return [nameOf(pure.target), '#select', keyPart(pure.key)].join('.')\n if (pure?.kind === 'condition') return [nameOf(pure.target), '#when', ...pure.at.map(String)].join('.')\n return nameOf(id)\n}\n\n/** The layout without a node's position, which ELK then lays out again. */\nexport const withoutKey = (layout: ManualLayout, key: string): ManualLayout => Object.fromEntries(Object.entries(layout).filter(([other]) => other !== key))\n\n// As ELK spaces nodes, and pads a Map or Block on its right and below\nconst spacing = 32\nconst padding = { right: 24, bottom: 24 }\n\nconst overlaps = (a: Box, b: Box) => a.x < b.x + b.width && b.x < a.x + a.width && a.y < b.y + b.height && b.y < a.y + a.height\n\n/**\n * The boxes ELK laid out, with the nodes moved by hand at their places: within each Map or Block, and on the canvas, a\n * node ELK laid out over one that was moved, or over a Map grown around it, goes down below it, and a Map or Block grows\n * around what was moved inside it. Without a node moved, ELK's boxes as they are.\n */\nexport const placedBoxes = (laidOut: ReadonlyMap<string, Box>, moved: ReadonlyMap<string, Point>, parentOf: (id: string) => string | undefined): ReadonlyMap<string, Box> => {\n if (![...moved.keys()].some((id) => laidOut.has(id))) return laidOut\n const boxes = new Map([...laidOut].map(([id, box]) => [id, { ...box, ...moved.get(id) }]))\n const children = new Map<string | undefined, string[]>()\n for (const id of boxes.keys()) children.set(parentOf(id), [...(children.get(parentOf(id)) ?? []), id])\n const depth = (parent: string | undefined): number => (parent === undefined ? 0 : depth(parentOf(parent)) + 1)\n const grown = new Set<string>()\n // The innermost first, so a Map grown inside another is placed at its new size\n for (const parent of [...children.keys()].sort((a, b) => depth(b) - depth(a))) {\n const ids = children.get(parent)!\n if (ids.some((id) => moved.has(id) || grown.has(id))) {\n const placed = ids.filter((id) => moved.has(id)).map((id) => boxes.get(id)!)\n const others = ids.filter((id) => !moved.has(id)).map((id) => boxes.get(id)!).sort((a, b) => a.y - b.y || a.x - b.x)\n for (const box of others) {\n let under = placed.find((other) => overlaps(box, other))\n while (under) {\n box.y = under.y + under.height + spacing\n under = placed.find((other) => overlaps(box, other))\n }\n placed.push(box)\n }\n }\n const group = parent === undefined ? undefined : boxes.get(parent)\n if (!group) continue\n const width = Math.max(group.width, ...ids.map((id) => boxes.get(id)!).map((box) => box.x + box.width + padding.right))\n const height = Math.max(group.height, ...ids.map((id) => boxes.get(id)!).map((box) => box.y + box.height + padding.bottom))\n if (width === group.width && height === group.height) continue\n Object.assign(group, { width, height })\n grown.add(parent!)\n }\n return boxes\n}\n","import { messages } from '../../../locale/messages'\n\nexport const text = messages('app/field-types/workflow')\n","import { Check, Minus } from 'lucide-react'\nimport { cn } from '../lib/cn'\n\nexport type CheckboxProps = { checked: boolean; indeterminate?: boolean; onChange?: (checked: boolean) => void; label?: string; disabled?: boolean; className?: string }\n\nexport const Checkbox = ({ checked, indeterminate, onChange, label, disabled, className }: CheckboxProps) => (\n <button\n type=\"button\"\n role=\"checkbox\"\n aria-checked={indeterminate ? 'mixed' : checked}\n aria-label={label}\n disabled={disabled}\n onClick={() => onChange?.(!checked)}\n className={cn(\n 'relative inline-flex size-4 shrink-0 items-center justify-center rounded border transition-colors after:absolute after:-inset-1 after:content-[\"\"] pointer-coarse:after:-inset-3.5',\n checked || indeterminate ? 'border-primary bg-primary text-primary-foreground' : 'border-border-strong bg-background hover:border-faint-foreground',\n className,\n )}\n >\n {indeterminate ? <Minus className=\"size-3\" strokeWidth={3} /> : checked && <Check className=\"size-3\" strokeWidth={3} />}\n </button>\n)\n"],"ignoreList":[0,1,2,3,4],"mappings":"swBASA,IAAMA,EAAa,CACjB,KAAM,QACN,KAAM,GACN,KAAM,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