@vireo-ai/trellis-ui 0.1.25 → 0.1.29
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/package.json +6 -1
- package/packages/client/src/components/checkbox/styles.css +7 -0
- package/packages/client/src/components/radio/styles.css +2 -8
- package/packages/client/src/styles/components.css +1 -0
- package/packages/client/src/styles/generated/theme-fonts.css +1 -1
- package/packages/client/src/styles/generated/theme-palette.css +7 -4
- package/packages/client/src/styles/generated/theme-runtime.css +1791 -452
- package/packages/client/src/styles/generated-sources.css +1 -1
- package/packages/client/src/styles/theme.css +161 -43
- package/packages/client/types/assets/full-runtime.generated.d.ts +1 -1
- package/packages/client/types/capabilities/motion.entry.generated.d.ts +3 -0
- package/packages/client/types/capabilities/resizable.entry.generated.d.ts +3 -0
- package/packages/client/types/capabilities/sortable.entry.generated.d.ts +3 -0
- package/packages/client/types/component-api.d.ts +10 -10
- package/packages/client/types/components/accordion/index.d.ts +7 -4
- package/packages/client/types/components/accordion/machine.d.ts +51 -57
- package/packages/client/types/components/card/contract.d.ts +9 -3
- package/packages/client/types/components/checkbox/contract.d.ts +20 -10
- package/packages/client/types/components/common.d.ts +6 -1
- package/packages/client/types/components/date-picker/index.d.ts +7 -4
- package/packages/client/types/components/date-picker/machine.d.ts +46 -362
- package/packages/client/types/components/dropdown/index.d.ts +7 -4
- package/packages/client/types/components/dropdown/machine.d.ts +5 -67
- package/packages/client/types/components/field/index.d.ts +1 -2
- package/packages/client/types/components/file-upload/index.d.ts +7 -4
- package/packages/client/types/components/file-upload/machine.d.ts +17 -39
- package/packages/client/types/components/input/index.d.ts +1 -2
- package/packages/client/types/components/modal/index.d.ts +6 -2
- package/packages/client/types/components/modal/machine.d.ts +5 -103
- package/packages/client/types/components/panels/index.d.ts +6 -2
- package/packages/client/types/components/panels/machine.d.ts +59 -81
- package/packages/client/types/components/radio/contract.d.ts +10 -2
- package/packages/client/types/components/runtime.d.ts +10 -10
- package/packages/client/types/components/scroll-area/index.d.ts +1 -2
- package/packages/client/types/components/select/index.d.ts +7 -4
- package/packages/client/types/components/select/machine.d.ts +37 -331
- package/packages/client/types/components/sidebar/index.d.ts +6 -2
- package/packages/client/types/components/sidebar/machine.d.ts +11 -47
- package/packages/client/types/components/slider/index.d.ts +1 -2
- package/packages/client/types/components/switch/index.d.ts +1 -2
- package/packages/client/types/components/tabs/contract.d.ts +6 -2
- package/packages/client/types/components/tabs/index.d.ts +7 -4
- package/packages/client/types/components/tabs/machine.d.ts +11 -29
- package/packages/client/types/components/toast/index.d.ts +6 -2
- package/packages/client/types/components/toast/machine.d.ts +7 -66
- package/packages/client/types/core.d.ts +2 -2
- package/packages/client/types/runtime/alpine-data.d.ts +6 -0
- package/packages/client/types/runtime/alpine-machine.d.ts +3 -8
- package/packages/client/types/runtime/engine/request.d.ts +1 -0
- package/packages/client/types/runtime/index.d.ts +7 -3
- package/packages/client/types/runtime/transition-coordinator.d.ts +41 -7
- package/packages/server/trellis_ui/static/trellis_ui/assets/css/trellis.css +2226 -512
- package/packages/server/trellis_ui/static/trellis_ui/assets/css/trellis.min.css +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/build-metadata.json +488 -372
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/motion.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/motion.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/resizable.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/resizable.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/sortable.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/sortable.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/alpine-data-DZ17j0jc.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/alpine-data-DZ17j0jc.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/alpine-machine-D0Kqjm-1.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/alpine-machine-D0Kqjm-1.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/capability-motion-Cog7tKk0.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/capability-motion-Cog7tKk0.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/capability-resizable-C6LKIbpv.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/capability-resizable-C6LKIbpv.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/capability-sortable-k107A8WE.js +3 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/capability-sortable-k107A8WE.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{common-DAxHCzB-.js → common-BOd_thC-.js} +2 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{common-DAxHCzB-.js.map → common-BOd_thC-.js.map} +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/core-vW9Cglw8.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{core-DjoX4J-6.js.map → core-vW9Cglw8.js.map} +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/drag-and-drop-BV6kB47L.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/drag-and-drop-BV6kB47L.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-Bbm6qhVl.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-Bbm6qhVl.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-BgnZZd0A.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-BgnZZd0A.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-BhPEF6oz.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{entry.generated-xcXw-cEl.js.map → entry.generated-BhPEF6oz.js.map} +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-Bhvs_TUM.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-Bhvs_TUM.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-CGgRCeB5.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-CGgRCeB5.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-CgO0b8V6.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-CgO0b8V6.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-Cvgc61x9.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-Cvgc61x9.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DFITIl56.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DFITIl56.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DMK37KS0.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DMK37KS0.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DMre0DbH.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DMre0DbH.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DOV8BDMY.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DOV8BDMY.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DT70Lo44.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DT70Lo44.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DVPnOfPb.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DVPnOfPb.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DiG5fS1F.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DiG5fS1F.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DnSxEcns.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DnSxEcns.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-JnbQA47P.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-JnbQA47P.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-byAFfb_v.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-byAFfb_v.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-dTc38DPe.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-dTc38DPe.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/machine-Dqut4h89.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/machine-Dqut4h89.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/motion-BRaHJwNf.js +3 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/motion-BRaHJwNf.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/semantic-observer-DS2ew4dT.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{semantic-observer-9VxzbQBi.js.map → semantic-observer-DS2ew4dT.js.map} +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/stream-uyKKe0QF.js +4 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/stream-uyKKe0QF.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/ui-H3t7UHMs.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/ui-H3t7UHMs.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/accordion.js +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/checkbox.js +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/date-picker.js +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/dropdown.js +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/field.js +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/file-upload.js +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/index.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/index.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/input.js +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/modal.js +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/panels.js +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/radio.js +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/scroll-area.js +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/select.js +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/sidebar.js +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/slider.js +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/switch.js +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/table.js +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/tabs.js +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/toast.js +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/core.js +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/index.js +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/index.js.map +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/logical-entry-manifest.json +232 -127
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/trellis.js +9 -9
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/trellis.min.js +9 -9
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/core-DjoX4J-6.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-5kNpQFGr.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-5kNpQFGr.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-B85L90Qp.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-B85L90Qp.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-BGCM6LAW.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-BGCM6LAW.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-Bc-uE56r.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-Bc-uE56r.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-C6ldtrmy.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-C6ldtrmy.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-CPWoMIwn.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-CPWoMIwn.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-Co0bLLZE.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-Co0bLLZE.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-CtyXH8zf.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-CtyXH8zf.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DGrOItIx.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DGrOItIx.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DHMRhcYF.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DHMRhcYF.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-De12QrT5.js +0 -3
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-De12QrT5.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DgmqZx_W.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DgmqZx_W.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-Dn6MRCe0.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-Dn6MRCe0.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DoOgk6l4.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DoOgk6l4.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DxUOcPkU.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DxUOcPkU.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DyIjCOhT.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DyIjCOhT.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-K6qKowpw.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-K6qKowpw.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-oAIExc1V.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-oAIExc1V.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-xcXw-cEl.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/machine-CX3wFSoV.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/machine-CX3wFSoV.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/motion-Bpttk6iZ.js +0 -3
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/motion-Bpttk6iZ.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/resizable-BixtYF9M.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/resizable-BixtYF9M.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/semantic-observer-9VxzbQBi.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/ui-xTjuF3uC.js +0 -4
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/ui-xTjuF3uC.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entry.generated-DyIjCOhT.js","names":[],"sources":["../../../../../../../../../node_modules/.pnpm/@atlaskit+pragmatic-drag-and-drop@2.0.1/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/external/file.js","../../../../../../../../../node_modules/.pnpm/@atlaskit+pragmatic-drag-and-drop@2.0.1/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/is-entering-window.js","../../../../../../../../../node_modules/.pnpm/@atlaskit+pragmatic-drag-and-drop@2.0.1/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/adapter/external-adapter.js","../../../../../../../../client/src/components/file-upload/contract.ts","../../../../../../../../client/src/components/file-upload/machine.ts","../../../../../../../../client/src/components/file-upload/styles.ts","../../../../../../../../client/src/components/file-upload/index.ts","../../../../../../../../client/src/components/file-upload/entry.generated.ts"],"sourcesContent":["export function containsFiles(_ref) {\n var source = _ref.source;\n return source.types.includes('Files');\n}\n\n/** Obtain an array of the dragged `File`s */\n// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports\nexport function getFiles(_ref2) {\n var source = _ref2.source;\n return source.items\n // unlike other media types, for files:\n // item.kind is 'file'\n // item.type is the type of file eg 'image/jpg'\n // for other media types, item.type is the mime format\n .filter(function (item) {\n return item.kind === 'file';\n }).map(function (item) {\n return item.getAsFile();\n }).filter(function (file) {\n return file != null;\n });\n}","import { isFirefox } from '../is-firefox';\nimport { isSafari } from '../is-safari';\nimport { isEnteringWindowInSafari } from './count-events-for-safari';\nimport { isFromAnotherWindow } from './is-from-another-window';\nexport function isEnteringWindow(_ref) {\n var dragEnter = _ref.dragEnter;\n var type = dragEnter.type,\n relatedTarget = dragEnter.relatedTarget;\n if (type !== 'dragenter') {\n return false;\n }\n if (isSafari()) {\n return isEnteringWindowInSafari({\n dragEnter: dragEnter\n });\n }\n\n // standard check\n if (relatedTarget == null) {\n return true;\n }\n\n /**\n * 🦊 Exception: `iframe` in Firefox (`125.0`)\n *\n * Case 1: parent `window` → child `iframe`\n * `relatedTarget` is the `iframe` element in the parent `window`\n * (foreign element)\n *\n * Case 2: child `iframe` → parent `window`\n * `relatedTarget` is an element inside the child `iframe`\n * (foreign element)\n */\n\n if (isFirefox()) {\n return isFromAnotherWindow(relatedTarget);\n }\n\n /**\n * 🌏 Exception: `iframe` in Chrome (`124.0`)\n *\n * Case 1: parent `window` → child `iframe`\n * `relatedTarget` is `null` *(standard check)*\n *\n * Case 2: child `iframe` → parent `window`\n * `relatedTarget` is the `iframe` element in the parent `window`\n */\n\n // Case 2\n // Using `instanceof` check as the element will be in the same `window`\n return relatedTarget instanceof HTMLIFrameElement;\n}","import _toConsumableArray from \"@babel/runtime/helpers/toConsumableArray\";\nimport { bind, bindAll } from 'bind-event-listener';\nimport { makeAdapter } from '../make-adapter/make-adapter';\nimport { androidFallbackText } from '../util/android';\nimport { isEnteringWindow } from '../util/changing-window/is-entering-window';\nimport { getBindingsForBrokenDrags } from '../util/detect-broken-drag';\nimport { textMediaType } from '../util/media-types/text-media-type';\nimport { elementAdapterNativeDataKey } from './element-adapter-native-data-key';\nexport function isAnAvailableType(_ref) {\n var type = _ref.type,\n value = _ref.value;\n // We don't want to expose our private elementAdapter key / value\n if (type === elementAdapterNativeDataKey) {\n return false;\n }\n // Not exposing \"text/plain\" if it contains the android fallback text\n // We _could_ add an `isAndroid()` check, but it's probably safest\n // to trim this data out, regardless of what OS we see it on.\n if (type === textMediaType && value === androidFallbackText) {\n return false;\n }\n return true;\n}\n\n// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports\nexport function getAvailableTypes(transfer) {\n return Array.from(transfer.types).filter(function (type) {\n return isAnAvailableType({\n type: type,\n value: transfer.getData(type)\n });\n });\n}\n\n// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports\nexport function getAvailableItems(dataTransfer) {\n // item.kind is 'string' | 'file'\n // For 'string' item.type is the mimeType (eg 'text/plain')\n // For 'file' item.type is the file type (eg 'image/jpg')\n\n return Array.from(dataTransfer.items).filter(function (item) {\n return item.kind === 'file' || isAnAvailableType({\n type: item.type,\n value: dataTransfer.getData(item.type)\n });\n });\n}\nvar didDragStartLocally = false;\nvar adapter = makeAdapter({\n typeKey: 'external',\n // for external drags, we are generally making a copy of something that is being dragged\n defaultDropEffect: 'copy',\n mount: function mount(api) {\n // Binding to the `window` so that the element adapter\n // has a chance to get in first on the`document`.\n // We are giving preference to the element adapter.\n return bind(window, {\n type: 'dragenter',\n listener: function listener(event) {\n // drag operation was started within the document, it won't be an \"external\" drag\n if (didDragStartLocally) {\n return;\n }\n\n // Note: not checking if event was cancelled (`event.defaultPrevented`) as\n // cancelling a \"dragenter\" accepts the drag operation (not prevent it)\n\n // Something has gone wrong with our drag event\n if (!event.dataTransfer) {\n // Including this code on \"test\" and \"development\" environments:\n // - Browser tests commonly run against \"development\" builds\n // - Unit tests commonly run in \"test\"\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn(\"\\n It appears as though you have are not testing DragEvents correctly.\\n\\n - If you are unit testing, ensure you have polyfilled DragEvent.\\n - If you are browser testing, ensure you are dispatching drag events correctly.\\n\\n Please see our testing guides for more information:\\n https://atlassian.design/components/pragmatic-drag-and-drop/core-package/testing\\n \".replace(/ {2}/g, ''));\n }\n return;\n }\n if (!api.canStart(event)) {\n return;\n }\n if (!isEnteringWindow({\n dragEnter: event\n })) {\n return;\n }\n\n // Note: not checking types for `elementAdapterNativeDataKey` as we expect to see that\n // key when pdnd started the drag in another document\n var types = getAvailableTypes(event.dataTransfer);\n if (!types.length) {\n return;\n }\n var locked = {\n types: types,\n items: [],\n getStringData: function getStringData() {\n return null;\n }\n };\n api.start({\n event: event,\n dragType: {\n type: 'external',\n startedFrom: 'external',\n payload: locked,\n getDropPayload: function getDropPayload(event) {\n // this would be a platform error\n // trying to handle it gracefully rather than throwing (for now)\n if (!event.dataTransfer) {\n return locked;\n }\n var items = getAvailableItems(event.dataTransfer);\n // need to use `.bind` as `getData` is required\n // to be run with `event.dataTransfer` as the \"this\" context\n var nativeGetData = event.dataTransfer.getData.bind(event.dataTransfer);\n return {\n types: types,\n items: items,\n // return `null` if there is no result, otherwise string\n getStringData: function getStringData(mediaType) {\n // not dragging the requested type\n // return `null` (no result)\n if (!types.includes(mediaType)) {\n return null;\n }\n\n // nativeGetData will return `\"\"` when there is no value,\n // but at this point we know we will only get explicitly set\n // values back as we have checked the `types`.\n // `\"\"` can be an explicitly set value.\n var value = nativeGetData(mediaType);\n\n // not exposing data for unavailable types\n if (!isAnAvailableType({\n type: mediaType,\n value: value\n })) {\n return null;\n }\n return value;\n }\n };\n }\n }\n });\n }\n });\n }\n});\n\n/**\n * Some events don't make sense for the external adapter\n *\n * `onGenerateDragPreview`\n * The browser creates the drag preview for external drags, so we don't\n * need an event to generate the preview for _monitors_ or the _dropTarget_\n *\n * `onDragStart`\n * An external drag can never start from in the `window`, so _dropTarget_'s\n * don't need `onDragStart`\n */\n\n// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports\nexport function dropTargetForExternal(args) {\n // not removing unused events, just leaning on the type system\n return adapter.dropTarget(args);\n}\n\n// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports\nexport function monitorForExternal(args) {\n // not removing unused events, just leaning on the type system\n return adapter.monitor(args);\n}\n(function startup() {\n // server side rendering check\n if (typeof window === 'undefined') {\n return;\n }\n\n // A shared single usage registration as we want to capture\n // all external drag operations, even if there are no drop targets\n // on the page yet\n adapter.registerUsage();\n // independent of pdnd, we need to keep track of\n // all drag operations so that we can know if a drag operation\n // has started locally\n\n var idle = {\n type: 'idle'\n };\n var state = idle;\n function clear() {\n if (state.type !== 'dragging') {\n return;\n }\n didDragStartLocally = false;\n state.cleanup();\n state = idle;\n }\n function bindEndEvents() {\n return bindAll(window, [{\n type: 'dragend',\n listener: clear\n }].concat(_toConsumableArray(getBindingsForBrokenDrags({\n onDragEnd: clear\n }))),\n // we want to make sure we get all the events,\n // and this helps avoid not seeing events when folks stop\n // them later on the event path\n {\n capture: true\n });\n }\n\n // we always keep this event listener active\n bind(window, {\n type: 'dragstart',\n listener: function listener() {\n // something bad has happened if this is true!\n if (state.type !== 'idle') {\n return;\n }\n // set our global flag\n didDragStartLocally = true;\n state = {\n type: 'dragging',\n cleanup: bindEndEvents()\n };\n },\n // binding in the capture phase so these listeners are called\n // before our listeners in the adapters `mount` function\n options: {\n capture: true\n }\n });\n})();\n\n/** Common event payload for all events */\n\n/** A map containing payloads for all events */\n\n/** Common event payload for all drop target events */\n\n/** A map containing payloads for all events on drop targets */\n\n/** Arguments given to all feedback functions (eg `canDrop()`) on a `dropTargetForExternal` */\n\n/** Arguments given to all monitor feedback functions (eg `canMonitor()`) for a `monitorForExternal` */","import {bool, number, oneOf, string, type SchemaToProps} from '../../runtime';\n\nconst FILE_UPLOAD_LAYOUTS = ['stack', 'inline'] as const;\nconst FILE_UPLOAD_PREVIEWS = ['auto', 'image', 'none'] as const;\nconst FILE_UPLOAD_SIZES = ['sm', 'md', 'lg'] as const;\nconst FILE_UPLOAD_TRANSPORTS = ['native', 'direct'] as const;\n\ntype FileUploadLayout = (typeof FILE_UPLOAD_LAYOUTS)[number];\ntype FileUploadPreview = (typeof FILE_UPLOAD_PREVIEWS)[number];\ntype FileUploadSize = (typeof FILE_UPLOAD_SIZES)[number];\ntype FileUploadTransport = (typeof FILE_UPLOAD_TRANSPORTS)[number];\n\nconst fileUploadSchema = {\n name: string,\n accept: string,\n capture: string,\n multiple: bool,\n required: bool,\n disabled: bool,\n invalid: bool,\n preview: oneOf(FILE_UPLOAD_PREVIEWS, 'auto' as FileUploadPreview),\n layout: oneOf(FILE_UPLOAD_LAYOUTS, 'stack' as FileUploadLayout),\n size: oneOf(FILE_UPLOAD_SIZES, 'md' as FileUploadSize),\n heading: string.default('Drop files here or browse'),\n text: string,\n browseLabel: string,\n empty: string,\n maxItems: number.min(0).default(0),\n clearable: bool.default(true),\n transport: oneOf(FILE_UPLOAD_TRANSPORTS, 'native' as FileUploadTransport),\n rootClass: string,\n dropzoneClass: string,\n listClass: string,\n itemClass: string,\n class: string,\n};\n\nconst fileUploadDropzoneSchema = {\n heading: string.default('Drop files here or browse'),\n text: string,\n icon: string.default('cloud__upload'),\n layout: oneOf(FILE_UPLOAD_LAYOUTS, 'stack' as FileUploadLayout),\n size: oneOf(FILE_UPLOAD_SIZES, 'md' as FileUploadSize),\n disabled: bool,\n invalid: bool,\n class: string,\n};\n\nconst fileUploadListSchema = {\n class: string,\n};\n\nconst fileUploadItemSchema = {\n filename: string,\n filesize: string,\n mime: string,\n preview: string,\n icon: string.default('document__blank'),\n invalid: bool,\n error: string,\n class: string,\n};\n\nconst fileUploadRemoveSchema = {\n label: string.default('Remove file'),\n class: string,\n};\n\ntype FileUploadProps = SchemaToProps<typeof fileUploadSchema>;\n\nexport {\n FILE_UPLOAD_LAYOUTS,\n FILE_UPLOAD_PREVIEWS,\n FILE_UPLOAD_SIZES,\n FILE_UPLOAD_TRANSPORTS,\n fileUploadDropzoneSchema,\n fileUploadItemSchema,\n fileUploadListSchema,\n fileUploadRemoveSchema,\n fileUploadSchema,\n};\nexport type {\n FileUploadLayout,\n FileUploadPreview,\n FileUploadProps,\n FileUploadSize,\n FileUploadTransport,\n};\n","import {\n createMachine,\n type Machine,\n type MachineEventObject,\n type MachineScope,\n} from '../../runtime/state-machine';\nimport {defineHook} from '../../runtime/transition-coordinator';\nimport type {FileUploadProps} from './contract';\n\ntype FileSelectionSource = 'picker' | 'drop' | 'remove' | 'props' | 'clear';\ntype FileTransferStatus = 'selected' | 'uploading' | 'complete' | 'failed' | 'canceled';\n\ntype FileUploadMetadata = {\n id: string;\n name: string;\n bytes: number;\n size: string;\n type: string;\n};\n\ntype FileUploadRecord = FileUploadMetadata & {\n status: FileTransferStatus;\n progress: number;\n};\n\ntype FileUploadContext = {\n selection: {\n files: FileUploadMetadata[];\n limitReached: boolean;\n rejectedCount: number;\n limitRejectedCount: number;\n source: FileSelectionSource;\n };\n existing: {present: boolean; cleared: boolean};\n transfer: {\n status: 'native' | 'idle' | 'uploading' | 'complete' | 'failed' | 'canceled';\n activeIds: string[];\n progress: Record<string, number>;\n results: Record<string, Exclude<FileTransferStatus, 'selected' | 'uploading'>>;\n error: string;\n };\n};\n\ntype FileUploadMachineEffects = {\n commitSelection(scope: MachineScope<FileUploadContext, FileUploadProps>): void;\n resetSelection(scope: MachineScope<FileUploadContext, FileUploadProps>): void;\n syncProps(scope: MachineScope<FileUploadContext, FileUploadProps>): void;\n syncDragging(scope: MachineScope<FileUploadContext, FileUploadProps>): void;\n clearExisting(scope: MachineScope<FileUploadContext, FileUploadProps>): void;\n syncTransfer(scope: MachineScope<FileUploadContext, FileUploadProps>): void;\n emitComplete(scope: MachineScope<FileUploadContext, FileUploadProps>): void;\n emitError(scope: MachineScope<FileUploadContext, FileUploadProps>): void;\n emitCancel(scope: MachineScope<FileUploadContext, FileUploadProps>): void;\n};\n\ntype CreateFileUploadMachineOptions = {\n props: FileUploadProps;\n context: FileUploadContext;\n effects: FileUploadMachineEffects;\n};\n\ntype FileRecordsEvent = MachineEventObject & {\n records: FileUploadMetadata[];\n append?: boolean;\n source?: FileSelectionSource;\n};\n\nconst uploadingHook = defineHook<FileUploadContext, FileUploadProps, {files: FileUploadMetadata[]}, 'uploading'>({\n name: 'uploading',\n state: 'transfer.direct.uploading',\n project: (snapshot) => ({\n files: snapshot.context.selection.files.filter(({id}) => snapshot.context.transfer.activeIds.includes(id)),\n }),\n onDone: 'UPLOADING_DONE',\n onError: 'UPLOADING_ERROR',\n required: true,\n sends: {\n progress: (id: string, loaded: number, total: number) => ({type: 'UPLOAD_PROGRESS', id, loaded, total}),\n cancel: () => ({type: 'CANCEL_UPLOAD'}),\n },\n});\n\nconst fileUploadHooks = [uploadingHook] as const;\n\nconst recordsEvent = (event: MachineEventObject): FileRecordsEvent => event as FileRecordsEvent;\nconst eventSource = (event: MachineEventObject): FileSelectionSource => {\n const source = event.source;\n return source === 'picker' || source === 'drop' || source === 'remove' || source === 'props' ? source : 'clear';\n};\n\nconst acceptedByAccept = (file: FileUploadMetadata, accept: string): boolean => {\n const tokens = accept.split(',').map((token) => token.trim().toLowerCase()).filter(Boolean);\n if (tokens.length === 0) return true;\n const name = file.name.toLowerCase();\n const type = file.type.toLowerCase();\n return tokens.some((token) => {\n if (token.startsWith('.')) return name.endsWith(token);\n if (token.endsWith('/*')) return type.startsWith(token.slice(0, -1));\n return token.includes('/') && type === token;\n });\n};\n\nconst selectionPlan = (\n context: Readonly<FileUploadContext>,\n props: Readonly<FileUploadProps>,\n event: MachineEventObject,\n): FileUploadContext['selection'] => {\n const candidate = recordsEvent(event).records ?? [];\n const accepted = candidate.filter((file) => acceptedByAccept(file, props.accept));\n const base = recordsEvent(event).append && props.multiple ? [...context.selection.files] : [];\n const combined = props.multiple ? [...base, ...accepted] : accepted.slice(0, 1);\n const files = props.maxItems > 0 ? combined.slice(0, props.maxItems) : combined;\n return {\n files,\n limitReached: props.maxItems > 0 && files.length >= props.maxItems,\n rejectedCount: candidate.length - accepted.length + combined.length - files.length,\n limitRejectedCount: combined.length - files.length,\n source: eventSource(event),\n };\n};\n\nconst plannedFiles = ({context, props, event}: MachineScope<FileUploadContext, FileUploadProps>): FileUploadMetadata[] => (\n selectionPlan(context, props, event).files\n);\nconst planIsEmpty = (scope: MachineScope<FileUploadContext, FileUploadProps>): boolean => plannedFiles(scope).length === 0;\nconst planIsCapped = ({context, props, event}: MachineScope<FileUploadContext, FileUploadProps>): boolean => (\n selectionPlan(context, props, event).limitReached\n);\nconst canMutate = ({context, props}: MachineScope<FileUploadContext, FileUploadProps>): boolean => (\n !props.disabled && context.transfer.status !== 'uploading'\n);\nconst isDirect = ({props}: MachineScope<FileUploadContext, FileUploadProps>): boolean => props.transport === 'direct';\nconst isNative = ({props}: MachineScope<FileUploadContext, FileUploadProps>): boolean => props.transport === 'native';\nconst shouldUpload = (scope: MachineScope<FileUploadContext, FileUploadProps>): boolean => (\n isDirect(scope)\n && (eventSource(scope.event) === 'picker' || eventSource(scope.event) === 'drop')\n && plannedFiles(scope).length > 0\n);\n\nconst planSelection = ({context, props, event}: MachineScope<FileUploadContext, FileUploadProps>) => ({\n context: {selection: selectionPlan(context, props, event)},\n});\nconst clearSelection = ({context}: MachineScope<FileUploadContext, FileUploadProps>) => ({\n context: {selection: {...context.selection, files: [], limitReached: false, rejectedCount: 0, limitRejectedCount: 0, source: 'clear' as const}},\n});\nconst beginUpload = ({context, props, event}: MachineScope<FileUploadContext, FileUploadProps>) => {\n const files = selectionPlan(context, props, event).files;\n const previousIds = new Set(context.selection.files.map(({id}) => id));\n const activeIds = recordsEvent(event).append ? files.filter(({id}) => !previousIds.has(id)).map(({id}) => id) : files.map(({id}) => id);\n return {context: {transfer: {\n ...context.transfer,\n status: 'uploading' as const,\n activeIds,\n progress: {...context.transfer.progress, ...Object.fromEntries(activeIds.map((id) => [id, 0]))},\n error: '',\n }}};\n};\nconst setTransferStatus = (\n context: Readonly<FileUploadContext>,\n status: 'native' | 'idle' | 'complete' | 'failed' | 'canceled',\n error = '',\n): FileUploadContext['transfer'] => ({...context.transfer, status, error});\nconst finishUpload = ({context}: MachineScope<FileUploadContext, FileUploadProps>) => ({context: {transfer: {\n ...setTransferStatus(context, 'complete'),\n progress: {...context.transfer.progress, ...Object.fromEntries(context.transfer.activeIds.map((id) => [id, 1]))},\n results: {...context.transfer.results, ...Object.fromEntries(context.transfer.activeIds.map((id) => [id, 'complete' as const]))},\n}}});\nconst failUpload = ({context, event}: MachineScope<FileUploadContext, FileUploadProps>) => ({context: {transfer: {\n ...setTransferStatus(context, 'failed', event.error instanceof Error ? event.error.message : String(event.error ?? 'Upload failed.')),\n results: {...context.transfer.results, ...Object.fromEntries(context.transfer.activeIds.map((id) => [id, 'failed' as const]))},\n}}});\nconst cancelUpload = ({context}: MachineScope<FileUploadContext, FileUploadProps>) => ({context: {transfer: {\n ...setTransferStatus(context, 'canceled'),\n results: {...context.transfer.results, ...Object.fromEntries(context.transfer.activeIds.map((id) => [id, 'canceled' as const]))},\n}}});\nconst updateProgress = ({context, event}: MachineScope<FileUploadContext, FileUploadProps>) => {\n const id = typeof event.id === 'string' ? event.id : '';\n if (!context.transfer.activeIds.includes(id)) return;\n const loaded = Number(event.loaded);\n const total = Number(event.total);\n const progress = Number.isFinite(loaded) && Number.isFinite(total) && total > 0 ? Math.min(1, Math.max(0, loaded / total)) : 0;\n return {context: {transfer: {...context.transfer, progress: {...context.transfer.progress, [id]: progress}}}};\n};\n\nconst canMutateToEmpty = (scope: MachineScope<FileUploadContext, FileUploadProps>): boolean => canMutate(scope) && planIsEmpty(scope);\nconst canMutateToCapped = (scope: MachineScope<FileUploadContext, FileUploadProps>): boolean => canMutate(scope) && planIsCapped(scope);\n\nconst inventoryTransitions = [\n {target: '#inventory-empty', guard: canMutateToEmpty, reduce: 'planSelection', effects: 'commitSelection'},\n {target: '#inventory-capped', guard: canMutateToCapped, reduce: 'planSelection', effects: 'commitSelection'},\n {target: '#inventory-populated', guard: canMutate, reduce: 'planSelection', effects: 'commitSelection'},\n];\n\nconst createFileUploadMachine = ({props, context, effects}: CreateFileUploadMachineOptions): Machine<FileUploadContext, FileUploadProps> => createMachine<FileUploadContext, FileUploadProps>({\n type: 'parallel',\n on: {PROPS_CHANGED: {reduce: 'replaceProps', effects: 'syncProps'}},\n states: {\n interaction: {\n initial: 'idle',\n states: {\n idle: {on: {DRAG_ENTER: {target: 'dragging', guard: canMutate, effects: 'syncDragging'}}},\n dragging: {tags: ['dragging'], on: {\n DRAG_LEAVE: {target: 'idle', effects: 'syncDragging'},\n DROP: {target: 'idle', effects: 'syncDragging'},\n RECONCILE: {target: 'idle', guard: ({props: currentProps}) => currentProps.disabled, effects: 'syncDragging'},\n }},\n },\n },\n inventory: {\n initial: 'empty',\n on: {\n FILES_CHANGED: inventoryTransitions,\n RECONCILE: inventoryTransitions,\n FILES_RESET: {target: '#inventory-empty', guard: canMutate, reduce: 'clearSelection', effects: 'resetSelection'},\n CLEAR_EXISTING: {guard: canMutate, reduce: 'clearExisting', effects: 'clearExisting'},\n },\n states: {\n empty: {id: 'inventory-empty', tags: ['empty']},\n populated: {id: 'inventory-populated', tags: ['has-files']},\n capped: {id: 'inventory-capped', tags: ['has-files', 'limit-reached']},\n },\n },\n transfer: {\n initial: 'inactive',\n states: {\n inactive: {on: {\n RECONCILE: [{target: '#transfer-direct-idle', guard: isDirect, reduce: 'setDirectIdle', effects: 'syncTransfer'}, {target: '#transfer-native', reduce: 'setNative', effects: 'syncTransfer'}],\n }},\n native: {id: 'transfer-native', on: {\n RECONCILE: {target: '#transfer-direct-idle', guard: isDirect, reduce: 'setDirectIdle', effects: 'syncTransfer'},\n }},\n direct: {\n initial: 'idle',\n on: {RECONCILE: {target: '#transfer-native', guard: isNative, reduce: 'setNative', effects: 'syncTransfer'}},\n states: {\n idle: {id: 'transfer-direct-idle', on: {FILES_CHANGED: {target: 'uploading', guard: shouldUpload, reduce: 'beginUpload', effects: 'syncTransfer'}}},\n uploading: {id: 'transfer-uploading', tags: ['uploading'], on: {\n UPLOAD_PROGRESS: {reduce: 'updateProgress', effects: 'syncTransfer'},\n UPLOADING_DONE: {target: 'complete', reduce: 'finishUpload', effects: ['syncTransfer', 'emitComplete']},\n UPLOADING_ERROR: {target: 'failed', reduce: 'failUpload', effects: ['syncTransfer', 'emitError']},\n CANCEL_UPLOAD: {target: 'canceled', reduce: 'cancelUpload', effects: ['syncTransfer', 'emitCancel']},\n RECONCILE: {target: 'canceled', guard: ({props: currentProps}) => currentProps.disabled || currentProps.transport !== 'direct', reduce: 'cancelUpload', effects: ['syncTransfer', 'emitCancel']},\n }},\n complete: {on: {FILES_CHANGED: {target: 'uploading', guard: shouldUpload, reduce: 'beginUpload', effects: 'syncTransfer'}}},\n failed: {tags: ['upload-failed'], on: {\n RETRY_UPLOAD: {target: 'uploading', reduce: 'retryUpload', effects: 'syncTransfer'},\n FILES_CHANGED: {target: 'uploading', guard: shouldUpload, reduce: 'beginUpload', effects: 'syncTransfer'},\n }},\n canceled: {on: {\n RETRY_UPLOAD: {target: 'uploading', reduce: 'retryUpload', effects: 'syncTransfer'},\n FILES_CHANGED: {target: 'uploading', guard: shouldUpload, reduce: 'beginUpload', effects: 'syncTransfer'},\n }},\n },\n },\n },\n },\n },\n}, {\n context,\n props,\n reducers: {\n replaceProps: ({event, props: currentProps}) => ({props: event.props as FileUploadProps ?? currentProps}),\n planSelection,\n clearSelection,\n clearExisting: ({context: current}) => ({context: {existing: {...current.existing, cleared: true}}}),\n beginUpload,\n retryUpload: ({context: current}) => ({context: {transfer: {...current.transfer, status: 'uploading', error: '', activeIds: current.selection.files.filter(({id}) => current.transfer.results[id] !== 'complete').map(({id}) => id)}}}),\n finishUpload,\n failUpload,\n cancelUpload,\n updateProgress,\n setNative: ({context: current}) => ({context: {transfer: setTransferStatus(current, 'native')}}),\n setDirectIdle: ({context: current}) => ({context: {transfer: setTransferStatus(current, 'idle')}}),\n },\n effects: {\n commitSelection: effects.commitSelection,\n resetSelection: effects.resetSelection,\n syncProps: effects.syncProps,\n syncDragging: effects.syncDragging,\n clearExisting: effects.clearExisting,\n syncTransfer: effects.syncTransfer,\n emitComplete: effects.emitComplete,\n emitError: effects.emitError,\n emitCancel: effects.emitCancel,\n },\n});\n\nconst recordsFromSnapshot = (context: Readonly<FileUploadContext>): FileUploadRecord[] => context.selection.files.map((file) => ({\n ...file,\n status: context.transfer.activeIds.includes(file.id) && context.transfer.status === 'uploading'\n ? 'uploading'\n : context.transfer.results[file.id] ?? 'selected',\n progress: context.transfer.progress[file.id] ?? 0,\n}));\n\nexport {createFileUploadMachine, fileUploadHooks, recordsFromSnapshot};\nexport type {\n CreateFileUploadMachineOptions,\n FileSelectionSource,\n FileTransferStatus,\n FileUploadContext,\n FileUploadMachineEffects,\n FileUploadMetadata,\n FileUploadRecord,\n};\n","import {defineStyles} from '../../runtime';\n\nconst fileUploadStyles = defineStyles({definition: {\n component: 'ui.file-upload',\n parts: {\n root: {\n base: [\n 'grid w-full min-w-0 gap-3',\n ],\n },\n control: {\n base: 'relative grid min-w-0 gap-3',\n },\n input: {\n base: 'sr-only',\n },\n dropzone: {\n base: [\n 'relative grid min-w-0 overflow-hidden rounded-surface-md text-inherit outline-none',\n ],\n variants: {\n layout: {\n stack: 'justify-items-center text-center',\n inline: 'grid-cols-[auto_minmax(0,1fr)_auto] items-center text-left',\n },\n size: {\n sm: 'gap-2 p-3',\n md: 'gap-3 p-4',\n lg: 'gap-3 p-5',\n },\n },\n defaults: {\n layout: 'stack',\n size: 'md',\n },\n },\n icon: {\n base: 'size-icon-lg shrink-0 fill-current text-surface-ink-muted',\n },\n body: {\n base: 'grid min-w-0 gap-1',\n },\n heading: {\n base: 'text-sm font-medium text-inherit',\n },\n text: {\n base: 'text-xs font-normal text-surface-ink-muted',\n },\n browse: {\n base: [\n 'inline-flex min-w-0 items-center justify-center rounded-control-md px-2 py-1 text-xs font-medium',\n ],\n },\n list: {\n base: 'grid min-w-0 gap-2',\n },\n empty: {\n base: 'text-xs text-surface-ink-muted',\n },\n item: {\n base: [\n 'grid min-w-0 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 rounded-surface-sm px-3 py-2',\n ],\n },\n preview: {\n base: 'flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-surface-xs bg-interaction-hover text-surface-ink-muted',\n },\n previewImage: {\n base: 'size-full',\n },\n itemIcon: {\n base: 'size-icon fill-current',\n },\n itemBody: {\n base: 'grid min-w-0 gap-0.5',\n },\n itemName: {\n base: 'truncate text-sm font-medium text-inherit',\n },\n itemMeta: {\n base: 'truncate text-xs font-normal text-surface-ink-muted',\n },\n itemError: {\n base: 'truncate text-xs font-normal text-intent-danger-text',\n },\n remove: {\n base: [\n 'relative z-20 inline-flex size-control-sm shrink-0 items-center justify-center rounded-control-md border-0 bg-transparent',\n 'text-surface-ink-muted outline-none',\n ],\n },\n removeIcon: {\n base: 'size-icon-xs fill-current leading-none',\n },\n clear: {\n base: 'sr-only',\n },\n },\n}});\n\nexport {fileUploadStyles};\n","import {containsFiles, getFiles} from '@atlaskit/pragmatic-drag-and-drop/external/file';\nimport {dropTargetForExternal, monitorForExternal, type ExternalDropTargetEventPayloadMap} from '@atlaskit/pragmatic-drag-and-drop/external/adapter';\nimport type Alpine from 'alpinejs';\n\nimport {createAlpineMachine, type AlpineMachine, type TrellisAlpineComponent} from '@client/runtime';\nimport {syncControlPresence, syncNativeControl} from '@client/runtime/form-control';\nimport {resolveStyle} from '@client/runtime/styles';\nimport {addListener, dispatch, setPresence, type CleanupStack} from '@client/utils';\nimport {fileUploadSchema, type FileUploadProps} from './contract';\nimport {\n createFileUploadMachine,\n fileUploadHooks,\n recordsFromSnapshot,\n type FileSelectionSource,\n type FileTransferStatus,\n type FileUploadContext,\n type FileUploadMetadata,\n type FileUploadRecord,\n} from './machine';\nimport {fileUploadStyles} from './styles';\n\n/**\n * Public Alpine API for `ui.file-upload`.\n *\n * @public\n */\ninterface UiFileUploadApi {\n /** Serializable metadata for the current pending or transferred files. */\n readonly files: readonly FileUploadRecord[];\n /** Whether pending or existing file content is present. */\n readonly hasFiles: boolean;\n /** Whether an external file is over the drop target. */\n readonly isDragging: boolean;\n /** Whether the direct transport hook is pending. */\n readonly isUploading: boolean;\n /** Whether the configured client-side item limit is full. */\n readonly isLimitReached: boolean;\n /** Opens the native file picker when interaction is available. */\n browse(): void;\n /** Removes a pending file by its stable record id. */\n remove(id: string): void;\n /** Retries failed or canceled direct-upload records. */\n retry(): void;\n /** Cancels the active direct-upload batch. */\n cancel(): void;\n /** Returns the original browser File for transport code without cloning it. */\n file(id: string): File | null;\n}\n\ntype FileUploadData = AlpineMachine<FileUploadContext, FileUploadProps, typeof fileUploadHooks> & UiFileUploadApi & {\n init(): void;\n destroy(): void;\n};\n\nconst formatBytes = (bytes: number): string => {\n if (bytes === 0) return '0 B';\n const units = ['B', 'KB', 'MB', 'GB'];\n const unitIndex = Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), units.length - 1);\n const value = bytes / (1024 ** unitIndex);\n const display = value >= 10 || unitIndex === 0 ? Math.round(value) : Number(value.toFixed(1));\n return `${display} ${units[unitIndex]}`;\n};\n\nconst filesFromList = (list: FileList | null): File[] => list ? Array.from(list) : [];\nconst isImageFile = (file: File): boolean => file.type.startsWith('image/');\nconst canPreviewFile = (file: File, preview: FileUploadProps['preview']): boolean => preview !== 'none' && (preview === 'image' || isImageFile(file));\n\nconst toFileList = (files: File[]): FileList | null => {\n if (typeof DataTransfer === 'undefined') return null;\n const transfer = new DataTransfer();\n files.forEach((file) => transfer.items.add(file));\n return transfer.files;\n};\n\nconst setInputFiles = (input: HTMLInputElement, files: File[]): boolean => {\n const list = toFileList(files);\n if (!list) return false;\n try {\n input.files = list;\n return true;\n } catch {\n return false;\n }\n};\n\nconst iconSvg = (pathData: string, className: string): SVGSVGElement => {\n const namespace = 'http://www.w3.org/2000/svg';\n const icon = document.createElementNS(namespace, 'svg');\n const path = document.createElementNS(namespace, 'path');\n icon.setAttribute('viewBox', '0 0 32 32');\n icon.setAttribute('aria-hidden', 'true');\n icon.setAttribute('class', className);\n path.setAttribute('d', pathData);\n icon.append(path);\n return icon;\n};\n\nconst closeIcon = (className: string): SVGSVGElement => {\n const namespace = 'http://www.w3.org/2000/svg';\n const icon = document.createElementNS(namespace, 'svg');\n const polygon = document.createElementNS(namespace, 'polygon');\n icon.setAttribute('viewBox', '0 0 32 32');\n icon.setAttribute('aria-hidden', 'true');\n icon.setAttribute('class', className);\n polygon.setAttribute('points', '17.4141 16 24 9.4141 22.5859 8 16 14.5859 9.4143 8 8 9.4141 14.5859 16 8 22.5859 9.4143 24 16 17.4141 22.5859 24 24 22.5859 17.4141 16');\n icon.append(polygon);\n return icon;\n};\n\nconst UiFileUpload = (): TrellisAlpineComponent<FileUploadData> => {\n let rootEl: (HTMLElement & Alpine.ElementWithXAttributes) | null = null;\n let cleanup: CleanupStack = [];\n let ignoreNativeChange = false;\n let fileSequence = 0;\n const rawFiles = new Map<string, File>();\n const previewUrls = new Map<string, string>();\n\n const root = (): HTMLElement => {\n if (!rootEl) throw new Error('File upload has not been initialized.');\n return rootEl;\n };\n const input = (): HTMLInputElement => {\n const control = root().querySelector<HTMLInputElement>('[data-ui-file-upload-input]');\n if (!control) throw new Error('File upload requires a native file input.');\n return control;\n };\n const dropzone = (): HTMLElement | null => root().querySelector<HTMLElement>('[data-ui-file-upload-dropzone]');\n const list = (): HTMLElement | null => root().querySelector<HTMLElement>('[data-ui-file-upload-list]');\n const currentProps = (): Readonly<FileUploadProps> => bridge.getSnapshot().props;\n const currentContext = (): Readonly<FileUploadContext> => bridge.getSnapshot().context;\n\n const metadataFor = (file: File): FileUploadMetadata => ({\n id: `file-${++fileSequence}`,\n name: file.name,\n bytes: file.size,\n size: formatBytes(file.size),\n type: file.type || 'File',\n });\n const registerFiles = (files: File[]): FileUploadMetadata[] => files.map((file) => {\n const metadata = metadataFor(file);\n rawFiles.set(metadata.id, file);\n return metadata;\n });\n const revokePreview = (id: string): void => {\n const url = previewUrls.get(id);\n if (url) URL.revokeObjectURL(url);\n previewUrls.delete(id);\n };\n const dispatchNativeChange = (): void => {\n ignoreNativeChange = true;\n input().dispatchEvent(new Event('input', {bubbles: true}));\n input().dispatchEvent(new Event('change', {bubbles: true}));\n };\n const sendFiles = (records: FileUploadMetadata[], source: FileSelectionSource, append = false): void => {\n if (currentProps().disabled || bridge.hasTag('uploading')) return;\n bridge.send({type: 'FILES_CHANGED', records, source, append});\n };\n\n const renderFiles = (context: Readonly<FileUploadContext>, props: Readonly<FileUploadProps>): void => {\n const container = list();\n if (!container) return;\n container.querySelectorAll('[data-ui-file-upload-pending]').forEach((item) => item.remove());\n const records = recordsFromSnapshot(context);\n const selectedIds = new Set(records.map(({id}) => id));\n [...previewUrls.keys()].filter((id) => !selectedIds.has(id)).forEach(revokePreview);\n [...rawFiles.keys()].filter((id) => !selectedIds.has(id)).forEach((id) => rawFiles.delete(id));\n const existing = container.querySelector<HTMLElement>('[data-existing-file]:not([hidden])');\n const empty = container.querySelector<HTMLElement>('[data-ui-file-upload-empty]');\n if (empty) empty.hidden = records.length > 0 || Boolean(existing);\n\n const itemClass = resolveStyle({part: fileUploadStyles.parts.item, className: props.itemClass});\n const previewClass = resolveStyle({part: fileUploadStyles.parts.preview});\n const imageClass = resolveStyle({part: fileUploadStyles.parts.previewImage});\n const bodyClass = resolveStyle({part: fileUploadStyles.parts.itemBody});\n const nameClass = resolveStyle({part: fileUploadStyles.parts.itemName});\n const metaClass = resolveStyle({part: fileUploadStyles.parts.itemMeta});\n const removeClass = resolveStyle({part: fileUploadStyles.parts.remove});\n const removeIconClass = resolveStyle({part: fileUploadStyles.parts.removeIcon});\n const itemIconClass = resolveStyle({part: fileUploadStyles.parts.itemIcon});\n\n records.forEach((record) => {\n const item = document.createElement('li');\n item.dataset.uiFileUploadItem = '';\n item.dataset.uiFileUploadPending = '';\n item.dataset.fileId = record.id;\n item.dataset.status = record.status;\n item.dataset.progress = String(record.progress);\n item.className = itemClass;\n\n const preview = document.createElement('span');\n preview.dataset.uiFileUploadPreview = '';\n preview.className = previewClass;\n preview.setAttribute('aria-hidden', 'true');\n const file = rawFiles.get(record.id);\n if (file && canPreviewFile(file, props.preview)) {\n let url = previewUrls.get(record.id);\n if (!url) {\n url = URL.createObjectURL(file);\n previewUrls.set(record.id, url);\n }\n const image = document.createElement('img');\n image.src = url;\n image.alt = '';\n image.loading = 'lazy';\n image.decoding = 'async';\n image.className = `outline outline-1 -outline-offset-1 outline-black/10 dark:outline-white/10 block size-full object-cover ${imageClass}`;\n preview.append(image);\n } else {\n preview.append(iconSvg('M25.7,9.3l-7-7A.9078.9078,0,0,0,18,2H8A2.0059,2.0059,0,0,0,6,4V28a2.0059,2.0059,0,0,0,2,2H24a2.0059,2.0059,0,0,0,2-2V10A.9078.9078,0,0,0,25.7,9.3ZM18,4.4,23.6,10H18ZM24,28H8V4h8v6a2.0059,2.0059,0,0,0,2,2h6Z', itemIconClass));\n }\n\n const body = document.createElement('span');\n body.className = bodyClass;\n const name = document.createElement('span');\n name.dataset.uiFileUploadItemName = '';\n name.className = nameClass;\n name.textContent = record.name;\n const meta = document.createElement('span');\n meta.dataset.uiFileUploadItemMeta = '';\n meta.className = metaClass;\n meta.textContent = [record.size, record.type].filter(Boolean).join(' · ');\n body.append(name, meta);\n\n const remove = document.createElement('button');\n remove.type = 'button';\n remove.dataset.uiFileUploadRemove = '';\n remove.dataset.fileId = record.id;\n remove.className = removeClass;\n remove.disabled = bridge.hasTag('uploading');\n remove.setAttribute('aria-label', `Remove ${record.name}`);\n remove.append(closeIcon(removeIconClass));\n item.append(preview, body, remove);\n container.append(item);\n });\n };\n\n const syncDom = (\n context: Readonly<FileUploadContext> = currentContext(),\n props: Readonly<FileUploadProps> = currentProps(),\n ): void => {\n const records = recordsFromSnapshot(context);\n const existing = context.existing.present && !context.existing.cleared;\n const hasFiles = records.length > 0 || existing;\n const unavailable = props.disabled || context.selection.limitReached || context.transfer.status === 'uploading';\n const control = input();\n syncNativeControl({input: control, state: {disabled: props.disabled, required: props.required, invalid: props.invalid}});\n if (props.transport === 'native' && props.name) control.name = props.name;\n else control.removeAttribute('name');\n control.multiple = props.multiple;\n props.accept ? control.setAttribute('accept', props.accept) : control.removeAttribute('accept');\n props.capture ? control.setAttribute('capture', props.capture) : control.removeAttribute('capture');\n if (unavailable && !props.disabled) {\n control.setAttribute('aria-disabled', 'true');\n control.tabIndex = -1;\n } else if (!props.disabled) {\n control.removeAttribute('aria-disabled');\n control.removeAttribute('tabindex');\n }\n if (control.form) control.form.enctype = 'multipart/form-data';\n\n syncControlPresence({el: root(), state: props, value: 'true'});\n setPresence({el: root(), attr: 'data-empty', present: !hasFiles, value: 'true'});\n setPresence({el: root(), attr: 'data-has-files', present: hasFiles, value: 'true'});\n setPresence({el: root(), attr: 'data-multiple', present: props.multiple, value: 'true'});\n setPresence({el: root(), attr: 'data-max-items-reached', present: context.selection.limitReached, value: 'true'});\n setPresence({el: root(), attr: 'data-has-existing-file', present: existing, value: 'true'});\n root().dataset.transport = props.transport;\n root().dataset.transferState = context.transfer.status;\n const zone = dropzone();\n if (zone) {\n syncControlPresence({el: zone, state: {disabled: unavailable, invalid: props.invalid}, value: 'true'});\n setPresence({el: zone, attr: 'data-multiple', present: props.multiple, value: 'true'});\n setPresence({el: zone, attr: 'data-has-files', present: hasFiles, value: 'true'});\n setPresence({el: zone, attr: 'data-max-items-reached', present: context.selection.limitReached, value: 'true'});\n }\n renderFiles(context, props);\n };\n\n const initialContext = (props: FileUploadProps): FileUploadContext => ({\n selection: {files: [], limitReached: false, rejectedCount: 0, limitRejectedCount: 0, source: 'clear'},\n existing: {present: Boolean(root().querySelector('[data-ui-file-upload-item][data-existing-file]')), cleared: false},\n transfer: {status: props.transport === 'native' ? 'native' : 'idle', activeIds: [], progress: {}, results: {}, error: ''},\n });\n\n const bridge = createAlpineMachine({\n schema: fileUploadSchema,\n hooks: fileUploadHooks,\n createMachine: ({props}) => createFileUploadMachine({\n props,\n context: initialContext(props),\n effects: {\n commitSelection: (scope) => {\n const selected = scope.context.selection.files;\n const selectedFiles = selected.flatMap(({id}) => rawFiles.get(id) ?? []);\n if (!setInputFiles(input(), selectedFiles)) {\n input().value = '';\n bridge.send('FILES_RESET');\n return;\n }\n syncDom(scope.context, scope.props);\n if (scope.context.selection.limitRejectedCount > 0) {\n dispatch({el: root(), name: 'ui:file-upload-limit', detail: {rejectedCount: scope.context.selection.limitRejectedCount}});\n }\n if (scope.context.selection.source !== 'picker') dispatchNativeChange();\n dispatch({el: root(), name: 'ui:file-upload-change', detail: {files: recordsFromSnapshot(scope.context)}});\n },\n resetSelection: (scope) => { input().value = ''; syncDom(scope.context, scope.props); },\n syncProps: (scope) => {\n syncDom(scope.context, scope.props);\n bridge.send({type: 'RECONCILE', records: scope.context.selection.files, source: 'props'});\n },\n syncDragging: (scope) => {\n const dragging = scope.snapshot.tags.includes('dragging');\n setPresence({el: root(), attr: 'data-dragging', present: dragging, value: 'true'});\n const zone = dropzone();\n if (zone) setPresence({el: zone, attr: 'data-dragging', present: dragging, value: 'true'});\n },\n clearExisting: (scope) => {\n const clear = root().querySelector<HTMLInputElement>('[data-ui-file-upload-clear]');\n if (clear) {\n clear.checked = true;\n clear.dispatchEvent(new Event('change', {bubbles: true}));\n }\n const existing = root().querySelector<HTMLElement>('[data-ui-file-upload-item][data-existing-file]');\n if (existing) existing.hidden = true;\n syncDom(scope.context, scope.props);\n dispatch({el: root(), name: 'ui:file-upload-change', detail: {files: recordsFromSnapshot(scope.context)}});\n },\n syncTransfer: (scope) => syncDom(scope.context, scope.props),\n emitComplete: (scope) => dispatch({el: root(), name: 'ui:file-upload-complete', detail: {files: recordsFromSnapshot(scope.context)}}),\n emitError: (scope) => dispatch({el: root(), name: 'ui:file-upload-error', detail: {files: recordsFromSnapshot(scope.context), error: scope.context.transfer.error}}),\n emitCancel: (scope) => dispatch({el: root(), name: 'ui:file-upload-cancel', detail: {files: recordsFromSnapshot(scope.context)}}),\n },\n }),\n });\n\n const component: TrellisAlpineComponent<FileUploadData> = {\n ...bridge,\n get files() { return this.snapshot.current ? recordsFromSnapshot(this.snapshot.current.context) : []; },\n get hasFiles() { return (this.snapshot.current?.context.selection.files.length ?? 0) > 0 || Boolean(this.snapshot.current?.context.existing.present && !this.snapshot.current.context.existing.cleared); },\n get isDragging() { return this.snapshot.current?.tags.includes('dragging') ?? false; },\n get isUploading() { return this.snapshot.current?.tags.includes('uploading') ?? false; },\n get isLimitReached() { return this.snapshot.current?.context.selection.limitReached ?? false; },\n init() {\n rootEl = this.$el;\n bridge.connect(this.$el, this.snapshot);\n const control = input();\n addListener({target: control, event: 'change', handler: () => {\n if (ignoreNativeChange) { ignoreNativeChange = false; return; }\n sendFiles(registerFiles(filesFromList(control.files)), 'picker');\n }, cleanup});\n addListener({target: root(), event: 'click', handler: (event) => {\n const target = event.target;\n if (!(target instanceof Element)) return;\n const remove = target.closest<HTMLElement>('[data-ui-file-upload-remove][data-file-id]');\n if (remove?.dataset.fileId) { event.preventDefault(); component.remove(remove.dataset.fileId); return; }\n const existing = target.closest('[data-ui-file-upload-remove][data-existing-file]');\n if (existing) { event.preventDefault(); bridge.send('CLEAR_EXISTING'); }\n }, cleanup});\n const zone = dropzone();\n if (zone) {\n cleanup.push(dropTargetForExternal({\n element: zone,\n canDrop: ({source}) => !currentProps().disabled && !bridge.hasTag('uploading') && containsFiles({source}),\n getDropEffect: () => 'copy',\n onDragEnter: () => bridge.send('DRAG_ENTER'),\n onDragLeave: () => bridge.send('DRAG_LEAVE'),\n onDrop: ({source}: ExternalDropTargetEventPayloadMap['onDrop']) => {\n bridge.send('DROP');\n if (!containsFiles({source})) return;\n sendFiles(registerFiles(getFiles({source})), 'drop', currentProps().multiple);\n },\n }));\n cleanup.push(monitorForExternal({canMonitor: ({source}) => containsFiles({source}), onDrop: () => bridge.send('DRAG_LEAVE')}));\n }\n syncDom();\n bridge.send({type: 'RECONCILE', records: [], source: 'props'});\n },\n destroy() {\n cleanup.forEach((dispose) => dispose());\n cleanup = [];\n previewUrls.forEach((url) => URL.revokeObjectURL(url));\n previewUrls.clear();\n rawFiles.clear();\n bridge.disconnect();\n rootEl = null;\n },\n browse() { if (!currentProps().disabled && !bridge.hasTag('uploading')) input().click(); },\n remove(id) {\n if (currentProps().disabled || bridge.hasTag('uploading') || !rawFiles.has(id)) return;\n const records = currentContext().selection.files.filter((record) => record.id !== id);\n sendFiles(records, 'remove');\n },\n retry() { bridge.send('RETRY_UPLOAD'); },\n cancel() { bridge.send('CANCEL_UPLOAD'); },\n file(id) { return rawFiles.get(id) ?? null; },\n };\n return component;\n};\n\nconst registerFileUpload = (AlpineInstance: Alpine.Alpine): void => {\n AlpineInstance.data('UiFileUpload', () => UiFileUpload());\n};\n\nexport {registerFileUpload, UiFileUpload};\nexport type {FileTransferStatus, FileUploadData, FileUploadMetadata, FileUploadRecord, UiFileUploadApi};\n","// Generated by scripts/generate_component_entries.mjs from packages/client/component-entries.json.\n// Do not edit by hand.\nimport type {Alpine as AlpineType} from 'alpinejs';\n\nimport {registerFileUpload as registerComponent} from './index';\n\nconst registered = new WeakSet<AlpineType>();\n\nconst registerFileUpload = (AlpineInstance: AlpineType): void => {\n if (registered.has(AlpineInstance)) return;\n registered.add(AlpineInstance);\n\n registerComponent(AlpineInstance);\n};\n\nexport {registerFileUpload};\nexport default registerFileUpload;\nexport * from './index';\n"],"x_google_ignoreList":[0,1,2],"mappings":"8XAAA,SAAgB,EAAc,EAAM,CAElC,OADa,EAAK,OACJ,MAAM,SAAS,OAAO,CACtC,CAIA,SAAgB,GAAS,EAAO,CAE9B,OADa,EAAM,OACL,MAKb,OAAO,SAAU,EAAM,CACtB,OAAO,EAAK,OAAS,MACvB,CAAC,EAAE,IAAI,SAAU,EAAM,CACrB,OAAO,EAAK,UAAU,CACxB,CAAC,EAAE,OAAO,SAAU,EAAM,CACxB,OAAO,GAAQ,IACjB,CAAC,CACH,WCjBA,SAAA,EAAA,EAAA,+IA+CA,CC3CA,SAAgB,EAAkB,EAAM,CACtC,IAAI,EAAO,EAAK,KACd,EAAQ,EAAK,MAWf,MAHA,EANI,IAAA,wBAMA,IAAA,cAA0B,IAAA,wBAIhC,CAGA,SAAgB,EAAkB,EAAU,CAC1C,OAAO,MAAM,KAAK,EAAS,KAAK,EAAE,OAAO,SAAU,EAAM,CACvD,OAAO,EAAkB,CACjB,OACN,MAA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,CAAc,IACjC,EAAW,IAAI,CAAc,EAE7B,GAAkB,CAAc,EACpC"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{f as e,l as t,n}from"./codecs-Cb1ns_47.js";import{s as r,t as i}from"./dom-qAeVl7dc.js";import{n as a,t as o}from"./machine-CX3wFSoV.js";import{n as s}from"./props-change-2xfsIAEN.js";import{n as c,r as l}from"./form-control-BkVb2Qed.js";import{g as u,o as d,r as f,s as p}from"./common-DAxHCzB-.js";var m=d,h=p,g=f,_=u,v={type:e.default(`text`),name:e,value:e,placeholder:e,size:t(m,`lg`),variant:t(h,`outline`),radius:t(g,`md`),disabled:n,readonly:n,required:n,invalid:n,icon:e,iconTrailing:e,iconVariant:t(_,`outline`),clearable:n,copyable:n,kbd:e,prefix:e,suffix:e,rootClass:e,controlClass:e,class:e};t(m,`lg`),t(h,`outline`),t(g,`md`);var y=[],b=e=>typeof e.value==`string`?e.value:``,x=e=>({context:{value:b(e.event)}}),S=()=>({context:{value:``}}),C=e=>{let t=s(e.event);if(!t)return;let n=t.changes.some(({key:e})=>e===`value`);return{props:t.props,context:n?{value:t.props.value}:e.context}},w=({props:e,effects:t})=>o({initial:`idle`,on:{VALUE_CHANGED:{reduce:`setValue`,effects:`sync`},CLEAR:{target:`idle`,reduce:`clearValue`,effects:[`sync`,`emitInput`,`emitChange`,`focus`]},COPY:{target:`copying`,effects:`copy`},PROPS_CHANGED:{reduce:`reconcileProps`,effects:`sync`}},states:{idle:{},copying:{on:{COPY_DONE:{target:`copied`,effects:[`sync`,`startCopiedTimer`]},COPY_ERROR:{target:`idle`,effects:`sync`}}},copied:{tags:[`copied`],on:{COPY:{target:`copying`,effects:`copy`},COPIED_TIMEOUT:{target:`idle`,effects:`sync`}}}}},{context:{value:e.value},props:e,reducers:{setValue:x,clearValue:S,reconcileProps:C},effects:t}),T=()=>{let e=null,t=null,n=[],o=null,s=!1,u=()=>{if(!e)throw Error(`Input has not been initialized.`);return e},d=()=>{if(!t)throw Error(`Input requires a native input element.`);return t},f=()=>h.getCommittedSnapshot(),p=()=>{let e=f(),t=e.props,n=d();n.value!==e.context.value&&(n.value=e.context.value),n.type=t.type,t.placeholder?n.placeholder=t.placeholder:n.removeAttribute(`placeholder`),l({input:n,state:{name:t.name,disabled:t.disabled,readonly:t.readonly,required:t.required,invalid:t.invalid}}),c({el:u(),state:t,value:`true`});let i=u().querySelector(`[data-ui-input-control]`);i&&c({el:i,state:{disabled:t.disabled,invalid:t.invalid},value:`true`}),u().querySelectorAll(`[data-ui-input-clear]`).forEach(n=>{n.hidden=e.context.value.length===0,n instanceof HTMLButtonElement&&(n.disabled=t.disabled||t.readonly)}),u().querySelectorAll(`[data-ui-input-copy]`).forEach(n=>{n instanceof HTMLButtonElement&&(n.disabled=t.disabled),r({el:n,attr:`data-copied`,present:e.tags.includes(`copied`),value:`true`})}),r({el:u(),attr:`data-copied`,present:e.tags.includes(`copied`),value:`true`})},m=e=>{s=!0;try{d().dispatchEvent(new Event(e,{bubbles:!0}))}finally{s=!1}},h=a({schema:v,hooks:y,createMachine:({props:e})=>w({props:e,effects:{sync:p,copy:e=>{(navigator.clipboard?.writeText(e.context.value)??Promise.resolve()).then(()=>h.send(`COPY_DONE`)).catch(()=>h.send(`COPY_ERROR`))},emitInput:()=>m(`input`),emitChange:()=>m(`change`),focus:()=>d().focus({preventScroll:!0}),startCopiedTimer:()=>{o!==null&&window.clearTimeout(o),o=window.setTimeout(()=>h.send(`COPIED_TIMEOUT`),1200)}}})});return{...h,init(){if(e=this.$el,t=u().querySelector(`[data-ui-input]`),!t)throw Error(`Input requires a native input element.`);h.connect(e,this.snapshot),i({target:t,event:`input`,handler:()=>{s||h.send({type:`VALUE_CHANGED`,value:d().value})},cleanup:n}),i({target:e,event:`click`,handler:e=>{let t=e.target;t instanceof Element&&(t.closest(`[data-ui-input-clear]`)?(e.preventDefault(),h.send(`CLEAR`)):t.closest(`[data-ui-input-copy]`)&&(e.preventDefault(),h.send(`COPY`)))},cleanup:n}),p()},destroy(){o!==null&&window.clearTimeout(o),o=null,n.splice(0).reverse().forEach(e=>e()),h.disconnect(),e=null,t=null},get value(){return h.getCommittedSnapshot().context.value},clear(){!d().disabled&&!d().readOnly&&h.send(`CLEAR`)},copy(){d().disabled||h.send(`COPY`)}}},E=e=>{e.data(`UiInput`,()=>T())},D=new WeakSet,O=e=>{D.has(e)||(D.add(e),E(e))};export{T as n,O as t};
|
|
2
|
-
//# sourceMappingURL=entry.generated-K6qKowpw.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entry.generated-K6qKowpw.js","names":[],"sources":["../../../../../../../../client/src/components/input/contract.ts","../../../../../../../../client/src/components/input/machine.ts","../../../../../../../../client/src/components/input/index.ts","../../../../../../../../client/src/components/input/entry.generated.ts"],"sourcesContent":["import {bool, oneOf, string, type SchemaToProps} from '../../runtime';\nimport {\n CONTROL_SIZES,\n CONTROL_VARIANTS,\n COMPONENT_RADII,\n ICON_VARIANTS,\n type ComponentRadius,\n type ControlSize,\n type ControlVariant,\n type IconVariant,\n} from '../common';\n\nconst INPUT_SIZES = CONTROL_SIZES;\nconst INPUT_VARIANTS = CONTROL_VARIANTS;\nconst INPUT_RADII = COMPONENT_RADII;\nconst INPUT_ICON_VARIANTS = ICON_VARIANTS;\n\ntype InputSize = ControlSize;\ntype InputVariant = ControlVariant;\ntype InputRadius = ComponentRadius;\ntype InputIconVariant = IconVariant;\n\nconst inputSchema = {\n type: string.default('text'),\n name: string,\n value: string,\n placeholder: string,\n size: oneOf(INPUT_SIZES, 'lg' as InputSize),\n variant: oneOf(INPUT_VARIANTS, 'outline' as InputVariant),\n radius: oneOf(INPUT_RADII, 'md' as InputRadius),\n disabled: bool,\n readonly: bool,\n required: bool,\n invalid: bool,\n icon: string,\n iconTrailing: string,\n iconVariant: oneOf(INPUT_ICON_VARIANTS, 'outline' as InputIconVariant),\n clearable: bool,\n copyable: bool,\n kbd: string,\n prefix: string,\n suffix: string,\n rootClass: string,\n controlClass: string,\n class: string,\n};\n\nconst inputGroupSchema = {\n size: oneOf(INPUT_SIZES, 'lg' as InputSize),\n variant: oneOf(INPUT_VARIANTS, 'outline' as InputVariant),\n radius: oneOf(INPUT_RADII, 'md' as InputRadius),\n label: string,\n description: string,\n descriptionTrailing: string,\n error: string,\n errors: string,\n badge: string,\n fieldClass: string,\n class: string,\n};\n\nconst inputAffixSchema = {\n class: string,\n};\n\ntype InputProps = SchemaToProps<typeof inputSchema>;\n\nexport {INPUT_ICON_VARIANTS, INPUT_RADII, INPUT_SIZES, INPUT_VARIANTS, inputAffixSchema, inputGroupSchema, inputSchema};\nexport type {InputIconVariant, InputProps, InputRadius, InputSize, InputVariant};\n","import {createMachine, propsChangedEvent, type Machine, type MachineEventObject, type MachineScope} from '../../runtime/state-machine';\nimport type {InputProps} from './contract';\n\ntype InputContext = {value: string};\ntype InputEffects = {\n sync(scope: MachineScope<InputContext, InputProps>): void;\n copy(scope: MachineScope<InputContext, InputProps>): void;\n emitInput(scope: MachineScope<InputContext, InputProps>): void;\n emitChange(scope: MachineScope<InputContext, InputProps>): void;\n focus(scope: MachineScope<InputContext, InputProps>): void;\n startCopiedTimer(scope: MachineScope<InputContext, InputProps>): void;\n};\nconst inputHooks = [] as const;\nconst eventValue = (event: MachineEventObject): string => typeof event.value === 'string' ? event.value : '';\nconst setValue = (scope: MachineScope<InputContext, InputProps>) => ({context: {value: eventValue(scope.event)}});\nconst clearValue = () => ({context: {value: ''}});\nconst reconcileProps = (scope: MachineScope<InputContext, InputProps>) => {\n const event = propsChangedEvent<InputProps>(scope.event);\n if (!event) return;\n const valueChanged = event.changes.some(({key}) => key === 'value');\n return {props: event.props, context: valueChanged ? {value: event.props.value} : scope.context};\n};\n\nconst createInputMachine = ({props, effects}: {props: InputProps; effects: InputEffects}): Machine<InputContext, InputProps> => createMachine<InputContext, InputProps>({\n initial: 'idle',\n on: {\n VALUE_CHANGED: {reduce: 'setValue', effects: 'sync'},\n CLEAR: {target: 'idle', reduce: 'clearValue', effects: ['sync', 'emitInput', 'emitChange', 'focus']},\n COPY: {target: 'copying', effects: 'copy'},\n PROPS_CHANGED: {reduce: 'reconcileProps', effects: 'sync'},\n },\n states: {\n idle: {},\n copying: {on: {\n COPY_DONE: {target: 'copied', effects: ['sync', 'startCopiedTimer']},\n COPY_ERROR: {target: 'idle', effects: 'sync'},\n }},\n copied: {tags: ['copied'], on: {\n COPY: {target: 'copying', effects: 'copy'},\n COPIED_TIMEOUT: {target: 'idle', effects: 'sync'},\n }},\n },\n}, {\n context: {value: props.value},\n props,\n reducers: {setValue, clearValue, reconcileProps},\n effects,\n});\n\nexport {createInputMachine, inputHooks};\nexport type {InputContext, InputEffects};\n","import type Alpine from 'alpinejs';\n\nimport {type AlpineMachine, createAlpineMachine, type MachineSnapshot, type TrellisAlpineComponent} from '@client/runtime';\nimport {syncControlPresence, syncNativeControl} from '@client/runtime/form-control';\nimport {addListener, setPresence, type CleanupStack} from '@client/utils';\nimport {inputSchema, type InputProps} from './contract';\nimport {createInputMachine, inputHooks, type InputContext} from './machine';\n\n/** Public Alpine API for `ui.input` and `ui.input.control`. @public */\ninterface UiInputApi {\n /** Current native input value. */\n readonly value: string;\n /** Clear the input, emit native input/change events, and restore focus. */\n clear(): void;\n /** Copy the current value to the clipboard. */\n copy(): void;\n}\n\ntype InputData = AlpineMachine<InputContext, InputProps, typeof inputHooks> & UiInputApi & {\n init(): void;\n destroy(): void;\n};\n\nconst UiInput = (): TrellisAlpineComponent<InputData> => {\n let rootEl: (HTMLElement & Alpine.ElementWithXAttributes) | null = null;\n let inputEl: HTMLInputElement | null = null;\n let listeners: CleanupStack = [];\n let copiedTimer: number | null = null;\n let dispatching = false;\n\n const root = (): HTMLElement => {\n if (!rootEl) throw new Error('Input has not been initialized.');\n return rootEl;\n };\n const input = (): HTMLInputElement => {\n if (!inputEl) throw new Error('Input requires a native input element.');\n return inputEl;\n };\n const snapshot = (): MachineSnapshot<InputContext, InputProps> => bridge.getCommittedSnapshot();\n const syncDom = (): void => {\n const current = snapshot();\n const props = current.props;\n const native = input();\n if (native.value !== current.context.value) native.value = current.context.value;\n native.type = props.type;\n if (props.placeholder) native.placeholder = props.placeholder;\n else native.removeAttribute('placeholder');\n syncNativeControl({input: native, state: {\n name: props.name,\n disabled: props.disabled,\n readonly: props.readonly,\n required: props.required,\n invalid: props.invalid,\n }});\n syncControlPresence({el: root(), state: props, value: 'true'});\n const control = root().querySelector<HTMLElement>('[data-ui-input-control]');\n if (control) syncControlPresence({el: control, state: {disabled: props.disabled, invalid: props.invalid}, value: 'true'});\n root().querySelectorAll<HTMLElement>('[data-ui-input-clear]').forEach((button) => {\n button.hidden = current.context.value.length === 0;\n if (button instanceof HTMLButtonElement) button.disabled = props.disabled || props.readonly;\n });\n root().querySelectorAll<HTMLElement>('[data-ui-input-copy]').forEach((button) => {\n if (button instanceof HTMLButtonElement) button.disabled = props.disabled;\n setPresence({el: button, attr: 'data-copied', present: current.tags.includes('copied'), value: 'true'});\n });\n setPresence({el: root(), attr: 'data-copied', present: current.tags.includes('copied'), value: 'true'});\n };\n const dispatchNative = (type: 'input' | 'change'): void => {\n dispatching = true;\n try { input().dispatchEvent(new Event(type, {bubbles: true})); } finally { dispatching = false; }\n };\n const bridge = createAlpineMachine({\n schema: inputSchema,\n hooks: inputHooks,\n createMachine: ({props}) => createInputMachine({props, effects: {\n sync: syncDom,\n copy: (scope) => {\n const write = navigator.clipboard?.writeText(scope.context.value) ?? Promise.resolve();\n void write.then(() => bridge.send('COPY_DONE')).catch(() => bridge.send('COPY_ERROR'));\n },\n emitInput: () => dispatchNative('input'),\n emitChange: () => dispatchNative('change'),\n focus: () => input().focus({preventScroll: true}),\n startCopiedTimer: () => {\n if (copiedTimer !== null) window.clearTimeout(copiedTimer);\n copiedTimer = window.setTimeout(() => bridge.send('COPIED_TIMEOUT'), 1200);\n },\n }}),\n });\n\n return {\n ...bridge,\n init(): void {\n rootEl = this.$el;\n inputEl = root().querySelector<HTMLInputElement>('[data-ui-input]');\n if (!inputEl) throw new Error('Input requires a native input element.');\n bridge.connect(rootEl, this.snapshot);\n addListener({target: inputEl, event: 'input', handler: () => {\n if (!dispatching) bridge.send({type: 'VALUE_CHANGED', value: input().value});\n }, cleanup: listeners});\n addListener({target: rootEl, event: 'click', handler: (event) => {\n const target = event.target;\n if (!(target instanceof Element)) return;\n if (target.closest('[data-ui-input-clear]')) {\n event.preventDefault();\n bridge.send('CLEAR');\n } else if (target.closest('[data-ui-input-copy]')) {\n event.preventDefault();\n bridge.send('COPY');\n }\n }, cleanup: listeners});\n syncDom();\n },\n destroy(): void {\n if (copiedTimer !== null) window.clearTimeout(copiedTimer);\n copiedTimer = null;\n listeners.splice(0).reverse().forEach((cleanup) => cleanup());\n bridge.disconnect();\n rootEl = null;\n inputEl = null;\n },\n get value(): string {\n return bridge.getCommittedSnapshot().context.value;\n },\n clear(): void {\n if (!input().disabled && !input().readOnly) bridge.send('CLEAR');\n },\n copy(): void {\n if (!input().disabled) bridge.send('COPY');\n },\n };\n};\n\nconst registerInput = (AlpineInstance: Alpine.Alpine): void => {\n AlpineInstance.data('UiInput', () => UiInput());\n};\n\nexport {registerInput, UiInput};\nexport type {InputData, UiInputApi};\n","// Generated by scripts/generate_component_entries.mjs from packages/client/component-entries.json.\n// Do not edit by hand.\nimport type {Alpine as AlpineType} from 'alpinejs';\n\nimport {registerInput as registerComponent} from './index';\n\nconst registered = new WeakSet<AlpineType>();\n\nconst registerInput = (AlpineInstance: AlpineType): void => {\n if (registered.has(AlpineInstance)) return;\n registered.add(AlpineInstance);\n\n registerComponent(AlpineInstance);\n};\n\nexport {registerInput};\nexport default registerInput;\nexport * from './index';\n"],"mappings":"mTAYA,IAAM,EAAc,EACd,EAAiB,EACjB,EAAc,EACd,EAAsB,EAOtB,EAAc,CAChB,KAAM,EAAO,QAAQ,MAAM,EAC3B,KAAM,EACN,MAAO,EACP,YAAa,EACb,KAAM,EAAM,EAAa,IAAiB,EAC1C,QAAS,EAAM,EAAgB,SAAy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,OAAQ,EAAS,MAAO,QAAS,YAAe,CACpD,GAAa,EAAO,KAAK,CAAC,KAAM,gBAAiB,MAAO,EAAM,EAAE,KAAK,CAAC,CAC/E,EAAG,QAAS,CAAS,CAAC,EACtB,EAAY,CAAC,OAAQ,EAAQ,MAAO,QAAS,QAAU,GAAU,CAC7D,IAAM,EAAS,EAAM,OACf,aAAkB,UACpB,EAAO,QAAQ,uBAAuB,GACtC,EAAM,eAAe,EACrB,EAAO,KAAK,OAAO,GACZ,EAAO,QAAQ,sBAAsB,IAC5C,EAAM,eAAe,EACrB,EAAO,KAAK,MAAM,GAE1B,EAAG,QAAS,CAAS,CAAC,EACtB,EAAQ,CACZ,EACA,SAAgB,CACR,IAAgB,MAAM,OAAO,aAAa,CAAW,EACzD,EAAc,KACd,EAAU,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAS,GAAY,EAAQ,CAAC,EAC5D,EAAO,WAAW,EAClB,EAAS,KACT,EAAU,IACd,EACA,IAAI,OAAgB,CAChB,OAAO,EAAO,qBAAqB,EAAE,QAAQ,KACjD,EACA,OAAc,CACN,CAAC,EAAM,EAAE,UAAY,CAAC,EAAM,EAAE,UAAU,EAAO,KAAK,OAAO,CACnE,EACA,MAAa,CACJ,EAAM,EAAE,UAAU,EAAO,KAAK,MAAM,CAC7C,CACJ,CACJ,EAEM,EAAiB,GAAwC,CAC3D,EAAe,KAAK,cAAiB,EAAQ,CAAC,CAClD,ECjIM,EAAa,IAAI,QAEjB,EAAiB,GAAqC,CACpD,EAAW,IAAI,CAAc,IACjC,EAAW,IAAI,CAAc,EAE7B,EAAkB,CAAc,EACpC"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{f as e,l as t,n}from"./codecs-Cb1ns_47.js";import{i as r,o as i,s as a,t as o}from"./dom-qAeVl7dc.js";import{n as s,t as c}from"./machine-CX3wFSoV.js";import{t as l}from"./number-BCZdoG0B.js";import{n as u,t as d}from"./styles-TfvwVPGw.js";import{t as f}from"./merge-bindings-C8ewA_FD.js";import{n as p}from"./props-change-2xfsIAEN.js";var m={orientation:t([`vertical`,`horizontal`,`both`],`vertical`),type:t([`hover`,`always`,`scroll`],`hover`),fill:n,hideNative:n.default(!0),disabled:n,class:e,viewportClass:e,scrollbarClass:e,thumbClass:e,cornerClass:e},h=e=>({event:t})=>t.axis===e,g=[],_=({props:e,context:t,effects:n})=>c({type:`parallel`,on:{PROPS_CHANGED:{reduce:`replaceProps`,effects:`sync`},MEASURED:{reduce:`setOverflow`,effects:`sync`}},states:{pointer:{initial:`outside`,states:{outside:{on:{POINTER_ENTERED:{target:`inside`,effects:`sync`}}},inside:{tags:[`hovered`],on:{POINTER_LEFT:{target:`outside`,effects:`sync`}}}}},focus:{initial:`outside`,states:{outside:{on:{FOCUS_ENTERED:{target:`inside`,effects:`sync`}}},inside:{tags:[`focused`],on:{FOCUS_LEFT:{target:`outside`,effects:`sync`}}}}},scrolling:{initial:`idle`,states:{idle:{on:{SCROLLED:{target:`active`,effects:`sync`}}},active:{tags:[`scrolling`],on:{SCROLL_SETTLED:{target:`idle`,effects:`sync`}}}}},dragging:{initial:`idle`,states:{idle:{on:{DRAG_STARTED:[{target:`vertical`,guard:h(`y`),effects:`sync`},{target:`horizontal`,guard:h(`x`),effects:`sync`}]}},vertical:{tags:[`dragging`,`dragging-y`],on:{DRAG_ENDED:{target:`idle`,effects:`sync`}}},horizontal:{tags:[`dragging`,`dragging-x`],on:{DRAG_ENDED:{target:`idle`,effects:`sync`}}}}}}},{context:t,props:e,reducers:{replaceProps:({event:e})=>{let t=p(e);return t?{props:t.props}:{}},setOverflow:({context:e,event:t})=>({context:{...e,overflow:{x:t.overflowX===!0,y:t.overflowY===!0}}})},effects:{sync:n.sync}}),v=d({definition:{component:`ui.scroll-area`,parts:{root:{base:[`relative min-w-0 overflow-hidden text-surface-ink`,`data-disabled:opacity-60`],variants:{fill:{true:`flex min-h-0 flex-1 flex-col`,false:``}},defaults:{fill:!1}},viewport:{base:[`min-h-0 min-w-0 outline-none`,`focus-visible:ui-focus-ring`],variants:{orientation:{vertical:`h-full w-full overflow-x-hidden overflow-y-auto`,horizontal:`h-full w-full overflow-x-auto overflow-y-hidden`,both:`size-full overflow-auto`},fill:{true:`flex-1`,false:``}},defaults:{orientation:`vertical`,fill:!1}},content:{base:`min-w-0`,variants:{orientation:{vertical:``,horizontal:`w-max min-w-full`,both:`min-w-full`}},defaults:{orientation:`vertical`}},scrollbar:{base:[`pointer-events-none absolute z-10 rounded-scrollbar-thumb opacity-0`,`data-visible:pointer-events-auto data-visible:opacity-100 data-disabled:pointer-events-none`],variants:{orientation:{vertical:`bottom-scrollbar-inset right-scrollbar-inset top-scrollbar-inset w-scrollbar`,horizontal:`bottom-scrollbar-inset left-scrollbar-inset right-scrollbar-inset h-scrollbar`}},defaults:{orientation:`vertical`}},thumb:{base:[`absolute rounded-scrollbar-thumb bg-scrollbar-thumb`,`hover:bg-scrollbar-thumb-hover data-dragging:bg-scrollbar-thumb-hover`],variants:{orientation:{vertical:`left-0 top-0 w-full`,horizontal:`left-0 top-0 h-full`}},defaults:{orientation:`vertical`}},corner:{base:[`pointer-events-none absolute bottom-scrollbar-inset right-scrollbar-inset z-10 size-scrollbar rounded-scrollbar-thumb`,`bg-transparent opacity-0`,`data-visible:opacity-100`]}}}}),y=18,b=1e3,x=null,S=(e,t)=>e===`both`||e===`horizontal`&&t===`x`||e===`vertical`&&t===`y`,C=()=>{if(x)return x;let e=document.createElement(`div`),t=document.createElement(`div`);return e.dir=`rtl`,e.style.cssText=`position:absolute;left:-9999px;width:4px;height:1px;overflow:scroll;`,t.style.cssText=`width:8px;height:1px;`,e.append(t),document.body.append(e),e.scrollLeft=1,e.scrollLeft===0?x=`negative`:(e.scrollLeft=0,x=e.scrollLeft===0?`reverse`:`default`),e.remove(),x},w=e=>{let t=Math.max(0,e.scrollWidth-e.clientWidth);if(!r({el:e}))return e.scrollLeft;let n=C();return n===`negative`?-e.scrollLeft:n===`reverse`?t-e.scrollLeft:e.scrollLeft},T=(e,t)=>{let n=Math.max(0,e.scrollWidth-e.clientWidth),i=l(t,0,n);if(!r({el:e})){e.scrollLeft=i;return}let a=C();a===`negative`?e.scrollLeft=-i:a===`reverse`?e.scrollLeft=n-i:e.scrollLeft=i},E=e=>e.dataset.orientation===`horizontal`?`x`:`y`,D=e=>e instanceof HTMLElement,O=(e,t)=>{let n=e.querySelector(`:scope > ${t}`);return D(n)?n:null},k=()=>{let e=null,t=[],n=null,r=null,c=0,d=0,p=0,h=null,x=null,C=null,D=()=>{if(!e)throw Error(`Scroll Area has not been initialized.`);return e},k=()=>K.getCommittedSnapshot(),A=()=>k().props,j=e=>k().tags.includes(e),M=()=>{let e=D(),t=O(e,`[data-ui-scroll-area-viewport]`)??e;return{root:e,viewport:t,content:O(t,`[data-ui-scroll-area-content]`),verticalScrollbar:O(e,`[data-ui-scroll-area-scrollbar][data-orientation="vertical"]`),horizontalScrollbar:O(e,`[data-ui-scroll-area-scrollbar][data-orientation="horizontal"]`),verticalThumb:O(e,`[data-ui-scroll-area-scrollbar][data-orientation="vertical"] > [data-ui-scroll-area-thumb][data-orientation="vertical"]`),horizontalThumb:O(e,`[data-ui-scroll-area-scrollbar][data-orientation="horizontal"] > [data-ui-scroll-area-thumb][data-orientation="horizontal"]`),corner:O(e,`[data-ui-scroll-area-corner]`)}},N=()=>{p&&=(window.clearTimeout(p),0)},P=()=>{N(),p=window.setTimeout(()=>{p=0,K.send(`SCROLL_SETTLED`)},b)},F=(e=M())=>{let{viewport:t}=e;if(e.verticalThumb&&x){let n=x.maxOffset*l(t.scrollTop/x.maxScroll,0,1);e.verticalThumb.style.transform=`translate3d(0, ${n}px, 0)`}if(e.horizontalThumb&&C){let n=C.maxOffset*l(w(t)/C.maxScroll,0,1);e.horizontalThumb.style.transform=`translate3d(${n}px, 0, 0)`}},I=e=>{let{viewport:t}=e,n=(e,n,r,i)=>{if(!n||!r||!i)return r&&(r.style.width=``,r.style.height=``,r.style.transform=``),null;let a=e===`y`?n.clientHeight:n.clientWidth,o=e===`y`?t.clientHeight:t.clientWidth,s=e===`y`?t.scrollHeight:t.scrollWidth,c=Math.max(1,s-o),l=Math.min(a,Math.max(y,o/s*a)),u=Math.max(0,a-l);return e===`y`?(r.style.height=`${l}px`,r.style.width=``):(r.style.width=`${l}px`,r.style.height=``),{trackLength:a,thumbLength:l,maxOffset:u,maxScroll:c}},{overflow:r}=k().context;x=n(`y`,e.verticalScrollbar,e.verticalThumb,r.y),C=n(`x`,e.horizontalScrollbar,e.horizontalThumb,r.x),F(e)},L=e=>{let t=A(),{overflow:n}=k().context,r=j(`hovered`)||j(`focused`)||j(`scrolling`)||j(`dragging`),i=e=>e?t.type===`always`?!0:t.type===`scroll`?j(`scrolling`)||j(`dragging`):r:!1,o=i(n.y),s=i(n.x);[e.verticalScrollbar,e.verticalThumb].forEach(e=>{e&&a({el:e,attr:`data-visible`,present:o})}),[e.horizontalScrollbar,e.horizontalThumb].forEach(e=>{e&&a({el:e,attr:`data-visible`,present:s})}),[e.verticalScrollbar,e.horizontalScrollbar].forEach(e=>{e&&a({el:e,attr:`data-disabled`,present:t.disabled})}),e.verticalThumb&&a({el:e.verticalThumb,attr:`data-dragging`,present:j(`dragging-y`)}),e.horizontalThumb&&a({el:e.horizontalThumb,attr:`data-dragging`,present:j(`dragging-x`)}),e.corner&&a({el:e.corner,attr:`data-visible`,present:o&&s})},R=()=>{if(!h)return;let e=h;h=null;let t=M(),n=e.axis===`y`?t.verticalThumb:t.horizontalThumb;try{n?.releasePointerCapture?.(e.pointerId)}catch{}K.send({type:`DRAG_ENDED`,axis:e.axis})},z=()=>{let e=M(),t=A(),{overflow:n}=k().context;t.disabled&&h&&R(),a({el:e.root,attr:`data-overflow-x`,present:n.x}),a({el:e.root,attr:`data-overflow-y`,present:n.y}),a({el:e.root,attr:`data-scrolling`,present:j(`scrolling`)}),a({el:e.root,attr:`data-dragging`,present:j(`dragging`)}),a({el:e.root,attr:`data-disabled`,present:t.disabled}),i({el:e.viewport,attr:`data-orientation`,value:t.orientation}),a({el:e.viewport,attr:`data-hide-native`,present:t.hideNative}),I(e),L(e)},B=()=>{c||=requestAnimationFrame(()=>{c=0;let e=M(),t=A(),n=S(t.orientation,`x`)&&e.viewport.scrollWidth>e.viewport.clientWidth+1,r=S(t.orientation,`y`)&&e.viewport.scrollHeight>e.viewport.clientHeight+1,i=k().context.overflow;n!==i.x||r!==i.y?K.send({type:`MEASURED`,overflowX:n,overflowY:r}):(I(e),L(e))})},V=()=>{d||=requestAnimationFrame(()=>{d=0,F()})},H=()=>{V(),j(`scrolling`)||K.send(`SCROLLED`),(k().context.overflow.y&&!x||k().context.overflow.x&&!C)&&B(),P()},U=(e,t)=>{if(A().disabled)return;let n=M(),r=n.viewport,i=t===`y`?n.verticalScrollbar:n.horizontalScrollbar,a=t===`y`?n.verticalThumb:n.horizontalThumb,o=t===`y`?k().context.overflow.y:k().context.overflow.x;if(!i||!a||!o)return;let s=t===`y`?i.clientHeight:i.clientWidth,c=t===`y`?a.offsetHeight:a.offsetWidth,l=t===`y`?Math.max(0,r.scrollHeight-r.clientHeight):Math.max(0,r.scrollWidth-r.clientWidth);h={axis:t,pointerId:e.pointerId,startPointer:t===`y`?e.clientY:e.clientX,startScroll:t===`y`?r.scrollTop:w(r),trackLength:s,thumbLength:c,maxScroll:l};try{a.setPointerCapture?.(e.pointerId)}catch{h=null;return}N(),K.send({type:`DRAG_STARTED`,axis:t})},W=e=>{if(!h||h.pointerId!==e.pointerId)return;e.preventDefault();let{viewport:t}=M(),n=(h.axis===`y`?e.clientY:e.clientX)-h.startPointer,r=Math.max(1,h.trackLength-h.thumbLength),i=h.startScroll+n/r*h.maxScroll;h.axis===`y`?t.scrollTop=l(i,0,h.maxScroll):T(t,i),V()},G=e=>{!h||h.pointerId!==e.pointerId||(R(),P())},K=s({schema:m,hooks:g,createMachine:({props:e})=>_({props:e,context:{overflow:{x:!1,y:!1}},effects:{sync:z}})}),q;return q={...K,get overflowX(){return this.snapshot.current?.context.overflow.x??!1},get overflowY(){return this.snapshot.current?.context.overflow.y??!1},get isScrolling(){return this.snapshot.current?.tags.includes(`scrolling`)??!1},get isDragging(){return this.snapshot.current?.tags.includes(`dragging`)??!1},init(){e=this.$el,K.connect(this.$el,this.snapshot);let i=M();n=new ResizeObserver(B),n.observe(i.viewport),i.content&&n.observe(i.content),r=new MutationObserver(B),i.content&&r.observe(i.content,{childList:!0,subtree:!0,characterData:!0}),o({target:i.viewport,event:`scroll`,handler:H,cleanup:t,options:{passive:!0}}),o({target:document,event:`pointermove`,handler:e=>W(e),cleanup:t}),o({target:document,event:`pointerup`,handler:e=>G(e),cleanup:t}),o({target:document,event:`pointercancel`,handler:e=>G(e),cleanup:t}),B()},destroy(){R(),N(),c&&cancelAnimationFrame(c),d&&cancelAnimationFrame(d),c=0,d=0,n?.disconnect(),r?.disconnect(),n=null,r=null,t.splice(0).forEach(e=>e()),K.disconnect(),e=null},get root(){let e=this.snapshot.current?.props??A();return f({inputs:[u({part:v.parts.root,props:e,className:e.class}),{"data-ui-scroll-area":``,":data-orientation":()=>A().orientation,":data-type":()=>A().type,":data-fill":()=>A().fill?``:void 0,":data-disabled":()=>A().disabled?``:void 0,"@pointerenter":()=>K.send(`POINTER_ENTERED`),"@pointerleave":()=>K.send(`POINTER_LEFT`),"@focusin":()=>K.send(`FOCUS_ENTERED`),"@focusout":e=>{(!(e.relatedTarget instanceof Node)||!D().contains(e.relatedTarget))&&K.send(`FOCUS_LEFT`)}}]})},viewport(e){return f({inputs:[u({part:v.parts.viewport,props:{orientation:A().orientation,fill:A().fill},className:e.dataset.class}),{tabindex:`0`,"data-ui-scroll-area-viewport":``,":data-orientation":()=>A().orientation,":data-hide-native":()=>A().hideNative?``:void 0}]})},scrollbar(e){let t=E(e)===`x`?`horizontal`:`vertical`;return f({inputs:[u({part:v.parts.scrollbar,props:{orientation:t},className:e.dataset.class}),{"data-ui-scroll-area-scrollbar":``,"aria-hidden":`true`,":data-disabled":()=>A().disabled?``:void 0}]})},thumb(e){let t=E(e),n=t===`x`?`horizontal`:`vertical`;return f({inputs:[u({part:v.parts.thumb,props:{orientation:n},className:e.dataset.class}),{"data-ui-scroll-area-thumb":``,"aria-hidden":`true`,"@pointerdown.prevent":e=>U(e,t),":data-dragging":()=>j(t===`x`?`dragging-x`:`dragging-y`)?``:void 0}]})},corner(e){return f({inputs:[u({part:v.parts.corner,className:e.dataset.class}),{"data-ui-scroll-area-corner":``,"aria-hidden":`true`}]})}},q},A=e=>{e.data(`UiScrollArea`,()=>k())},j=new WeakSet,M=e=>{j.has(e)||(j.add(e),A(e))};export{k as n,M as t};
|
|
2
|
-
//# sourceMappingURL=entry.generated-oAIExc1V.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entry.generated-oAIExc1V.js","names":[],"sources":["../../../../../../../../client/src/components/scroll-area/contract.ts","../../../../../../../../client/src/components/scroll-area/machine.ts","../../../../../../../../client/src/components/scroll-area/styles.ts","../../../../../../../../client/src/components/scroll-area/index.ts","../../../../../../../../client/src/components/scroll-area/entry.generated.ts"],"sourcesContent":["import {bool, oneOf, string, type SchemaToProps} from '../../runtime';\n\nconst SCROLL_AREA_ORIENTATIONS = ['vertical', 'horizontal', 'both'] as const;\nconst SCROLL_AREA_TYPES = ['hover', 'always', 'scroll'] as const;\nconst scrollAreaSchema = {\n orientation: oneOf(SCROLL_AREA_ORIENTATIONS, 'vertical'),\n type: oneOf(SCROLL_AREA_TYPES, 'hover'),\n fill: bool,\n hideNative: bool.default(true),\n disabled: bool,\n class: string,\n viewportClass: string,\n scrollbarClass: string,\n thumbClass: string,\n cornerClass: string,\n};\n\ntype ScrollAreaOrientation = typeof SCROLL_AREA_ORIENTATIONS[number];\ntype ScrollAreaType = typeof SCROLL_AREA_TYPES[number];\ntype ScrollAreaProps = SchemaToProps<typeof scrollAreaSchema>;\n\nexport {\n SCROLL_AREA_ORIENTATIONS,\n SCROLL_AREA_TYPES,\n scrollAreaSchema,\n};\nexport type {\n ScrollAreaOrientation,\n ScrollAreaProps,\n ScrollAreaType,\n};\n","import {\n createMachine,\n propsChangedEvent,\n type Machine,\n type MachineEventObject,\n type MachineScope,\n} from '../../runtime/state-machine';\nimport type {ScrollAreaProps} from './contract';\n\ntype ScrollAxis = 'x' | 'y';\n\ntype ScrollAreaContext = {\n overflow: {x: boolean; y: boolean};\n};\n\ntype ScrollAreaMachineEffects = {\n sync(scope: MachineScope<ScrollAreaContext, ScrollAreaProps>): void;\n};\n\ntype CreateScrollAreaMachineOptions = {\n props: ScrollAreaProps;\n context: ScrollAreaContext;\n effects: ScrollAreaMachineEffects;\n};\n\n\nconst axisIs = (axis: ScrollAxis) => ({event}: MachineScope<ScrollAreaContext, ScrollAreaProps>): boolean => (\n event.axis === axis\n);\n\nconst scrollAreaHooks = [] as const;\n\nconst createScrollAreaMachine = ({\n props,\n context,\n effects,\n}: CreateScrollAreaMachineOptions): Machine<ScrollAreaContext, ScrollAreaProps> => createMachine<ScrollAreaContext, ScrollAreaProps>({\n type: 'parallel',\n on: {\n PROPS_CHANGED: {reduce: 'replaceProps', effects: 'sync'},\n MEASURED: {reduce: 'setOverflow', effects: 'sync'},\n },\n states: {\n pointer: {\n initial: 'outside',\n states: {\n outside: {on: {POINTER_ENTERED: {target: 'inside', effects: 'sync'}}},\n inside: {tags: ['hovered'], on: {POINTER_LEFT: {target: 'outside', effects: 'sync'}}},\n },\n },\n focus: {\n initial: 'outside',\n states: {\n outside: {on: {FOCUS_ENTERED: {target: 'inside', effects: 'sync'}}},\n inside: {tags: ['focused'], on: {FOCUS_LEFT: {target: 'outside', effects: 'sync'}}},\n },\n },\n scrolling: {\n initial: 'idle',\n states: {\n idle: {on: {SCROLLED: {target: 'active', effects: 'sync'}}},\n active: {tags: ['scrolling'], on: {SCROLL_SETTLED: {target: 'idle', effects: 'sync'}}},\n },\n },\n dragging: {\n initial: 'idle',\n states: {\n idle: {\n on: {\n DRAG_STARTED: [\n {target: 'vertical', guard: axisIs('y'), effects: 'sync'},\n {target: 'horizontal', guard: axisIs('x'), effects: 'sync'},\n ],\n },\n },\n vertical: {tags: ['dragging', 'dragging-y'], on: {DRAG_ENDED: {target: 'idle', effects: 'sync'}}},\n horizontal: {tags: ['dragging', 'dragging-x'], on: {DRAG_ENDED: {target: 'idle', effects: 'sync'}}},\n },\n },\n },\n}, {\n context,\n props,\n reducers: {\n replaceProps: ({event}) => {\n const next = propsChangedEvent<ScrollAreaProps>(event);\n return next ? {props: next.props} : {};\n },\n setOverflow: ({context, event}) => ({\n context: {\n ...context,\n overflow: {\n x: event.overflowX === true,\n y: event.overflowY === true,\n },\n },\n }),\n },\n effects: {sync: effects.sync},\n});\n\nexport {createScrollAreaMachine, scrollAreaHooks};\nexport type {\n CreateScrollAreaMachineOptions,\n ScrollAreaContext,\n ScrollAreaMachineEffects,\n ScrollAxis,\n};\n","import {defineStyles} from '../../runtime';\n\nconst scrollAreaStyles = defineStyles({definition: {\n component: 'ui.scroll-area',\n parts: {\n root: {\n base: [\n 'relative min-w-0 overflow-hidden text-surface-ink',\n 'data-disabled:opacity-60',\n ],\n variants: {\n fill: {\n true: 'flex min-h-0 flex-1 flex-col',\n false: '',\n },\n },\n defaults: {\n fill: false,\n },\n },\n viewport: {\n base: [\n 'min-h-0 min-w-0 outline-none',\n 'focus-visible:ui-focus-ring',\n ],\n variants: {\n orientation: {\n vertical: 'h-full w-full overflow-x-hidden overflow-y-auto',\n horizontal: 'h-full w-full overflow-x-auto overflow-y-hidden',\n both: 'size-full overflow-auto',\n },\n fill: {\n true: 'flex-1',\n false: '',\n },\n },\n defaults: {\n orientation: 'vertical',\n fill: false,\n },\n },\n content: {\n base: 'min-w-0',\n variants: {\n orientation: {\n vertical: '',\n horizontal: 'w-max min-w-full',\n both: 'min-w-full',\n },\n },\n defaults: {\n orientation: 'vertical',\n },\n },\n scrollbar: {\n base: [\n 'pointer-events-none absolute z-10 rounded-scrollbar-thumb opacity-0',\n 'data-visible:pointer-events-auto data-visible:opacity-100 data-disabled:pointer-events-none',\n ],\n variants: {\n orientation: {\n vertical: 'bottom-scrollbar-inset right-scrollbar-inset top-scrollbar-inset w-scrollbar',\n horizontal: 'bottom-scrollbar-inset left-scrollbar-inset right-scrollbar-inset h-scrollbar',\n },\n },\n defaults: {\n orientation: 'vertical',\n },\n },\n thumb: {\n base: [\n 'absolute rounded-scrollbar-thumb bg-scrollbar-thumb',\n 'hover:bg-scrollbar-thumb-hover data-dragging:bg-scrollbar-thumb-hover',\n ],\n variants: {\n orientation: {\n vertical: 'left-0 top-0 w-full',\n horizontal: 'left-0 top-0 h-full',\n },\n },\n defaults: {\n orientation: 'vertical',\n },\n },\n corner: {\n base: [\n 'pointer-events-none absolute bottom-scrollbar-inset right-scrollbar-inset z-10 size-scrollbar rounded-scrollbar-thumb',\n 'bg-transparent opacity-0',\n 'data-visible:opacity-100',\n ],\n },\n },\n}});\n\nexport {scrollAreaStyles};\n","import type Alpine from 'alpinejs';\n\nimport {\n type AlpineMachine,\n createAlpineMachine,\n mergeBindings,\n type BindingObject,\n type MachineSnapshot,\n resolveStyle,\n type TrellisAlpineComponent,\n} from '@client/runtime';\nimport {addListener, clamp, isRtl, setAttribute, setPresence, type CleanupStack} from '@client/utils';\nimport {scrollAreaSchema, type ScrollAreaOrientation, type ScrollAreaProps} from './contract';\nimport {\n createScrollAreaMachine,\n type ScrollAreaContext,\n scrollAreaHooks,\n type ScrollAxis,\n} from './machine';\nimport {scrollAreaStyles} from './styles';\n\ntype DragState = {\n axis: ScrollAxis;\n pointerId: number;\n startPointer: number;\n startScroll: number;\n trackLength: number;\n thumbLength: number;\n maxScroll: number;\n};\n\ntype ScrollAreaElements = {\n root: HTMLElement;\n viewport: HTMLElement;\n content: HTMLElement | null;\n verticalScrollbar: HTMLElement | null;\n horizontalScrollbar: HTMLElement | null;\n verticalThumb: HTMLElement | null;\n horizontalThumb: HTMLElement | null;\n corner: HTMLElement | null;\n};\n\ntype AxisGeometry = {\n trackLength: number;\n thumbLength: number;\n maxOffset: number;\n maxScroll: number;\n};\n\n/**\n * Public Alpine API for `ui.scroll-area`.\n *\n * @public\n */\ninterface UiScrollAreaApi {\n /** Whether content currently overflows the horizontal axis. */\n readonly overflowX: boolean;\n /** Whether content currently overflows the vertical axis. */\n readonly overflowY: boolean;\n /** Whether the native viewport is in an active scroll session. */\n readonly isScrolling: boolean;\n /** Whether a custom scrollbar thumb is being dragged. */\n readonly isDragging: boolean;\n}\n\ntype ScrollAreaData = AlpineMachine<ScrollAreaContext, ScrollAreaProps, typeof scrollAreaHooks> & UiScrollAreaApi & {\n readonly root: BindingObject;\n init(): void;\n destroy(): void;\n viewport(el: HTMLElement): BindingObject;\n scrollbar(el: HTMLElement): BindingObject;\n thumb(el: HTMLElement): BindingObject;\n corner(el: HTMLElement): BindingObject;\n};\n\nconst MIN_THUMB_SIZE = 18;\nconst SCROLL_CHROME_FADE_DELAY = 1000;\n\nlet rtlScrollType: 'negative' | 'reverse' | 'default' | null = null;\n\nconst includesAxis = (orientation: ScrollAreaOrientation, axis: ScrollAxis): boolean => (\n orientation === 'both' || (orientation === 'horizontal' && axis === 'x') || (orientation === 'vertical' && axis === 'y')\n);\n\nconst detectRtlScrollType = (): 'negative' | 'reverse' | 'default' => {\n if (rtlScrollType) return rtlScrollType;\n\n const outer = document.createElement('div');\n const inner = document.createElement('div');\n outer.dir = 'rtl';\n outer.style.cssText = 'position:absolute;left:-9999px;width:4px;height:1px;overflow:scroll;';\n inner.style.cssText = 'width:8px;height:1px;';\n outer.append(inner);\n document.body.append(outer);\n\n outer.scrollLeft = 1;\n if (outer.scrollLeft === 0) rtlScrollType = 'negative';\n else {\n outer.scrollLeft = 0;\n rtlScrollType = outer.scrollLeft === 0 ? 'reverse' : 'default';\n }\n\n outer.remove();\n return rtlScrollType;\n};\n\nconst horizontalScrollPosition = (viewport: HTMLElement): number => {\n const max = Math.max(0, viewport.scrollWidth - viewport.clientWidth);\n if (!isRtl({el: viewport})) return viewport.scrollLeft;\n\n const type = detectRtlScrollType();\n if (type === 'negative') return -viewport.scrollLeft;\n if (type === 'reverse') return max - viewport.scrollLeft;\n return viewport.scrollLeft;\n};\n\nconst setHorizontalScrollPosition = (viewport: HTMLElement, value: number): void => {\n const max = Math.max(0, viewport.scrollWidth - viewport.clientWidth);\n const next = clamp(value, 0, max);\n if (!isRtl({el: viewport})) {\n viewport.scrollLeft = next;\n return;\n }\n\n const type = detectRtlScrollType();\n if (type === 'negative') viewport.scrollLeft = -next;\n else if (type === 'reverse') viewport.scrollLeft = max - next;\n else viewport.scrollLeft = next;\n};\n\nconst axisFromOrientation = (el: HTMLElement): ScrollAxis => (\n el.dataset.orientation === 'horizontal' ? 'x' : 'y'\n);\n\nconst isHTMLElement = (value: Element | null): value is HTMLElement => value instanceof HTMLElement;\n\nconst queryDirectPart = (root: HTMLElement, selector: string): HTMLElement | null => {\n const el = root.querySelector(`:scope > ${selector}`);\n return isHTMLElement(el) ? el : null;\n};\n\nconst UiScrollArea = (): TrellisAlpineComponent<ScrollAreaData> => {\n let rootEl: (HTMLElement & Alpine.ElementWithXAttributes) | null = null;\n let listeners: CleanupStack = [];\n let resizeObserver: ResizeObserver | null = null;\n let mutationObserver: MutationObserver | null = null;\n let measureFrame = 0;\n let positionFrame = 0;\n let fadeTimer = 0;\n let dragging: DragState | null = null;\n let verticalGeometry: AxisGeometry | null = null;\n let horizontalGeometry: AxisGeometry | null = null;\n\n const root = (): HTMLElement => {\n if (!rootEl) throw new Error('Scroll Area has not been initialized.');\n return rootEl;\n };\n const currentSnapshot = (): MachineSnapshot<ScrollAreaContext, ScrollAreaProps> => (\n bridge.getCommittedSnapshot()\n );\n const currentProps = (): Readonly<ScrollAreaProps> => currentSnapshot().props;\n const hasTag = (tag: string): boolean => currentSnapshot().tags.includes(tag);\n const elements = (): ScrollAreaElements => {\n const rootElement = root();\n const viewport = queryDirectPart(rootElement, '[data-ui-scroll-area-viewport]') ?? rootElement;\n return {\n root: rootElement,\n viewport,\n content: queryDirectPart(viewport, '[data-ui-scroll-area-content]'),\n verticalScrollbar: queryDirectPart(rootElement, '[data-ui-scroll-area-scrollbar][data-orientation=\"vertical\"]'),\n horizontalScrollbar: queryDirectPart(rootElement, '[data-ui-scroll-area-scrollbar][data-orientation=\"horizontal\"]'),\n verticalThumb: queryDirectPart(rootElement, '[data-ui-scroll-area-scrollbar][data-orientation=\"vertical\"] > [data-ui-scroll-area-thumb][data-orientation=\"vertical\"]'),\n horizontalThumb: queryDirectPart(rootElement, '[data-ui-scroll-area-scrollbar][data-orientation=\"horizontal\"] > [data-ui-scroll-area-thumb][data-orientation=\"horizontal\"]'),\n corner: queryDirectPart(rootElement, '[data-ui-scroll-area-corner]'),\n };\n };\n\n const clearFadeTimer = (): void => {\n if (!fadeTimer) return;\n window.clearTimeout(fadeTimer);\n fadeTimer = 0;\n };\n const startFadeTimer = (): void => {\n clearFadeTimer();\n fadeTimer = window.setTimeout(() => {\n fadeTimer = 0;\n bridge.send('SCROLL_SETTLED');\n }, SCROLL_CHROME_FADE_DELAY);\n };\n\n const updateThumbPositions = (parts = elements()): void => {\n const {viewport} = parts;\n if (parts.verticalThumb && verticalGeometry) {\n const offset = verticalGeometry.maxOffset * clamp(viewport.scrollTop / verticalGeometry.maxScroll, 0, 1);\n parts.verticalThumb.style.transform = `translate3d(0, ${offset}px, 0)`;\n }\n if (parts.horizontalThumb && horizontalGeometry) {\n const offset = horizontalGeometry.maxOffset * clamp(\n horizontalScrollPosition(viewport) / horizontalGeometry.maxScroll,\n 0,\n 1,\n );\n parts.horizontalThumb.style.transform = `translate3d(${offset}px, 0, 0)`;\n }\n };\n\n const updateGeometry = (parts: ScrollAreaElements): void => {\n const {viewport} = parts;\n const updateAxis = (\n axis: ScrollAxis,\n scrollbar: HTMLElement | null,\n thumb: HTMLElement | null,\n overflow: boolean,\n ): AxisGeometry | null => {\n if (!scrollbar || !thumb || !overflow) {\n if (thumb) {\n thumb.style.width = '';\n thumb.style.height = '';\n thumb.style.transform = '';\n }\n return null;\n }\n\n const trackLength = axis === 'y' ? scrollbar.clientHeight : scrollbar.clientWidth;\n const viewportLength = axis === 'y' ? viewport.clientHeight : viewport.clientWidth;\n const scrollLength = axis === 'y' ? viewport.scrollHeight : viewport.scrollWidth;\n const maxScroll = Math.max(1, scrollLength - viewportLength);\n const thumbLength = Math.min(\n trackLength,\n Math.max(MIN_THUMB_SIZE, (viewportLength / scrollLength) * trackLength),\n );\n const maxOffset = Math.max(0, trackLength - thumbLength);\n\n if (axis === 'y') {\n thumb.style.height = `${thumbLength}px`;\n thumb.style.width = '';\n } else {\n thumb.style.width = `${thumbLength}px`;\n thumb.style.height = '';\n }\n return {trackLength, thumbLength, maxOffset, maxScroll};\n };\n\n const {overflow} = currentSnapshot().context;\n verticalGeometry = updateAxis('y', parts.verticalScrollbar, parts.verticalThumb, overflow.y);\n horizontalGeometry = updateAxis('x', parts.horizontalScrollbar, parts.horizontalThumb, overflow.x);\n updateThumbPositions(parts);\n };\n\n const updateVisibility = (parts: ScrollAreaElements): void => {\n const props = currentProps();\n const {overflow} = currentSnapshot().context;\n const interacting = hasTag('hovered') || hasTag('focused') || hasTag('scrolling') || hasTag('dragging');\n const visibleFor = (axisOverflows: boolean): boolean => {\n if (!axisOverflows) return false;\n if (props.type === 'always') return true;\n if (props.type === 'scroll') return hasTag('scrolling') || hasTag('dragging');\n return interacting;\n };\n const verticalVisible = visibleFor(overflow.y);\n const horizontalVisible = visibleFor(overflow.x);\n\n [parts.verticalScrollbar, parts.verticalThumb].forEach((el) => {\n if (el) setPresence({el, attr: 'data-visible', present: verticalVisible});\n });\n [parts.horizontalScrollbar, parts.horizontalThumb].forEach((el) => {\n if (el) setPresence({el, attr: 'data-visible', present: horizontalVisible});\n });\n [parts.verticalScrollbar, parts.horizontalScrollbar].forEach((el) => {\n if (el) setPresence({el, attr: 'data-disabled', present: props.disabled});\n });\n if (parts.verticalThumb) setPresence({el: parts.verticalThumb, attr: 'data-dragging', present: hasTag('dragging-y')});\n if (parts.horizontalThumb) setPresence({el: parts.horizontalThumb, attr: 'data-dragging', present: hasTag('dragging-x')});\n if (parts.corner) setPresence({el: parts.corner, attr: 'data-visible', present: verticalVisible && horizontalVisible});\n };\n\n const releaseDrag = (): void => {\n if (!dragging) return;\n const active = dragging;\n dragging = null;\n const parts = elements();\n const thumb = active.axis === 'y' ? parts.verticalThumb : parts.horizontalThumb;\n try {\n thumb?.releasePointerCapture?.(active.pointerId);\n } catch {\n // Pointer capture cleanup is best-effort after interrupted gestures.\n }\n bridge.send({type: 'DRAG_ENDED', axis: active.axis});\n };\n\n const syncDom = (): void => {\n const parts = elements();\n const props = currentProps();\n const {overflow} = currentSnapshot().context;\n if (props.disabled && dragging) releaseDrag();\n\n setPresence({el: parts.root, attr: 'data-overflow-x', present: overflow.x});\n setPresence({el: parts.root, attr: 'data-overflow-y', present: overflow.y});\n setPresence({el: parts.root, attr: 'data-scrolling', present: hasTag('scrolling')});\n setPresence({el: parts.root, attr: 'data-dragging', present: hasTag('dragging')});\n setPresence({el: parts.root, attr: 'data-disabled', present: props.disabled});\n setAttribute({el: parts.viewport, attr: 'data-orientation', value: props.orientation});\n setPresence({el: parts.viewport, attr: 'data-hide-native', present: props.hideNative});\n updateGeometry(parts);\n updateVisibility(parts);\n };\n\n const scheduleMeasure = (): void => {\n if (measureFrame) return;\n measureFrame = requestAnimationFrame(() => {\n measureFrame = 0;\n const parts = elements();\n const props = currentProps();\n const overflowX = includesAxis(props.orientation, 'x') && parts.viewport.scrollWidth > parts.viewport.clientWidth + 1;\n const overflowY = includesAxis(props.orientation, 'y') && parts.viewport.scrollHeight > parts.viewport.clientHeight + 1;\n const current = currentSnapshot().context.overflow;\n if (overflowX !== current.x || overflowY !== current.y) {\n bridge.send({type: 'MEASURED', overflowX, overflowY});\n } else {\n updateGeometry(parts);\n updateVisibility(parts);\n }\n });\n };\n const schedulePosition = (): void => {\n if (positionFrame) return;\n positionFrame = requestAnimationFrame(() => {\n positionFrame = 0;\n updateThumbPositions();\n });\n };\n\n const onScroll = (): void => {\n schedulePosition();\n if (!hasTag('scrolling')) bridge.send('SCROLLED');\n if ((currentSnapshot().context.overflow.y && !verticalGeometry)\n || (currentSnapshot().context.overflow.x && !horizontalGeometry)) scheduleMeasure();\n startFadeTimer();\n };\n\n const startDrag = (event: PointerEvent, axis: ScrollAxis): void => {\n if (currentProps().disabled) return;\n const parts = elements();\n const viewport = parts.viewport;\n const scrollbar = axis === 'y' ? parts.verticalScrollbar : parts.horizontalScrollbar;\n const thumb = axis === 'y' ? parts.verticalThumb : parts.horizontalThumb;\n const overflow = axis === 'y' ? currentSnapshot().context.overflow.y : currentSnapshot().context.overflow.x;\n if (!scrollbar || !thumb || !overflow) return;\n\n const trackLength = axis === 'y' ? scrollbar.clientHeight : scrollbar.clientWidth;\n const thumbLength = axis === 'y' ? thumb.offsetHeight : thumb.offsetWidth;\n const maxScroll = axis === 'y'\n ? Math.max(0, viewport.scrollHeight - viewport.clientHeight)\n : Math.max(0, viewport.scrollWidth - viewport.clientWidth);\n dragging = {\n axis,\n pointerId: event.pointerId,\n startPointer: axis === 'y' ? event.clientY : event.clientX,\n startScroll: axis === 'y' ? viewport.scrollTop : horizontalScrollPosition(viewport),\n trackLength,\n thumbLength,\n maxScroll,\n };\n try {\n thumb.setPointerCapture?.(event.pointerId);\n } catch {\n dragging = null;\n return;\n }\n clearFadeTimer();\n bridge.send({type: 'DRAG_STARTED', axis});\n };\n\n const moveDrag = (event: PointerEvent): void => {\n if (!dragging || dragging.pointerId !== event.pointerId) return;\n event.preventDefault();\n const {viewport} = elements();\n const pointer = dragging.axis === 'y' ? event.clientY : event.clientX;\n const delta = pointer - dragging.startPointer;\n const maxOffset = Math.max(1, dragging.trackLength - dragging.thumbLength);\n const nextScroll = dragging.startScroll + (delta / maxOffset) * dragging.maxScroll;\n if (dragging.axis === 'y') viewport.scrollTop = clamp(nextScroll, 0, dragging.maxScroll);\n else setHorizontalScrollPosition(viewport, nextScroll);\n schedulePosition();\n };\n\n const endDrag = (event: PointerEvent): void => {\n if (!dragging || dragging.pointerId !== event.pointerId) return;\n releaseDrag();\n startFadeTimer();\n };\n\n const bridge = createAlpineMachine({\n schema: scrollAreaSchema,\n hooks: scrollAreaHooks,\n createMachine: ({props}) => createScrollAreaMachine({\n props,\n context: {overflow: {x: false, y: false}},\n effects: {\n sync: syncDom,\n },\n }),\n });\n\n let component!: TrellisAlpineComponent<ScrollAreaData>;\n component = {\n ...bridge,\n get overflowX(): boolean {\n return this.snapshot.current?.context.overflow.x ?? false;\n },\n get overflowY(): boolean {\n return this.snapshot.current?.context.overflow.y ?? false;\n },\n get isScrolling(): boolean {\n return this.snapshot.current?.tags.includes('scrolling') ?? false;\n },\n get isDragging(): boolean {\n return this.snapshot.current?.tags.includes('dragging') ?? false;\n },\n init(): void {\n rootEl = this.$el;\n bridge.connect(this.$el, this.snapshot);\n const parts = elements();\n resizeObserver = new ResizeObserver(scheduleMeasure);\n resizeObserver.observe(parts.viewport);\n if (parts.content) resizeObserver.observe(parts.content);\n mutationObserver = new MutationObserver(scheduleMeasure);\n if (parts.content) mutationObserver.observe(parts.content, {childList: true, subtree: true, characterData: true});\n\n addListener({target: parts.viewport, event: 'scroll', handler: onScroll, cleanup: listeners, options: {passive: true}});\n addListener({target: document, event: 'pointermove', handler: (event) => moveDrag(event as PointerEvent), cleanup: listeners});\n addListener({target: document, event: 'pointerup', handler: (event) => endDrag(event as PointerEvent), cleanup: listeners});\n addListener({target: document, event: 'pointercancel', handler: (event) => endDrag(event as PointerEvent), cleanup: listeners});\n scheduleMeasure();\n },\n destroy(): void {\n releaseDrag();\n clearFadeTimer();\n if (measureFrame) cancelAnimationFrame(measureFrame);\n if (positionFrame) cancelAnimationFrame(positionFrame);\n measureFrame = 0;\n positionFrame = 0;\n resizeObserver?.disconnect();\n mutationObserver?.disconnect();\n resizeObserver = null;\n mutationObserver = null;\n listeners.splice(0).forEach((cleanup) => cleanup());\n bridge.disconnect();\n rootEl = null;\n },\n get root(): BindingObject {\n const props = this.snapshot.current?.props ?? currentProps();\n return mergeBindings({inputs: [\n resolveStyle({part: scrollAreaStyles.parts.root, props, className: props.class}),\n {\n 'data-ui-scroll-area': '',\n ':data-orientation': () => currentProps().orientation,\n ':data-type': () => currentProps().type,\n ':data-fill': () => currentProps().fill ? '' : undefined,\n ':data-disabled': () => currentProps().disabled ? '' : undefined,\n '@pointerenter': () => bridge.send('POINTER_ENTERED'),\n '@pointerleave': () => bridge.send('POINTER_LEFT'),\n '@focusin': () => bridge.send('FOCUS_ENTERED'),\n '@focusout': (event: FocusEvent) => {\n if (!(event.relatedTarget instanceof Node) || !root().contains(event.relatedTarget)) {\n bridge.send('FOCUS_LEFT');\n }\n },\n },\n ]});\n },\n viewport(el: HTMLElement): BindingObject {\n return mergeBindings({inputs: [\n resolveStyle({\n part: scrollAreaStyles.parts.viewport,\n props: {orientation: currentProps().orientation, fill: currentProps().fill},\n className: el.dataset.class,\n }),\n {\n tabindex: '0',\n 'data-ui-scroll-area-viewport': '',\n ':data-orientation': () => currentProps().orientation,\n ':data-hide-native': () => currentProps().hideNative ? '' : undefined,\n },\n ]});\n },\n scrollbar(el: HTMLElement): BindingObject {\n const orientation = axisFromOrientation(el) === 'x' ? 'horizontal' : 'vertical';\n return mergeBindings({inputs: [\n resolveStyle({part: scrollAreaStyles.parts.scrollbar, props: {orientation}, className: el.dataset.class}),\n {\n 'data-ui-scroll-area-scrollbar': '',\n 'aria-hidden': 'true',\n ':data-disabled': () => currentProps().disabled ? '' : undefined,\n },\n ]});\n },\n thumb(el: HTMLElement): BindingObject {\n const axis = axisFromOrientation(el);\n const orientation = axis === 'x' ? 'horizontal' : 'vertical';\n return mergeBindings({inputs: [\n resolveStyle({part: scrollAreaStyles.parts.thumb, props: {orientation}, className: el.dataset.class}),\n {\n 'data-ui-scroll-area-thumb': '',\n 'aria-hidden': 'true',\n '@pointerdown.prevent': (event: PointerEvent) => startDrag(event, axis),\n ':data-dragging': () => hasTag(axis === 'x' ? 'dragging-x' : 'dragging-y') ? '' : undefined,\n },\n ]});\n },\n corner(el: HTMLElement): BindingObject {\n return mergeBindings({inputs: [\n resolveStyle({part: scrollAreaStyles.parts.corner, className: el.dataset.class}),\n {'data-ui-scroll-area-corner': '', 'aria-hidden': 'true'},\n ]});\n },\n };\n\n return component;\n};\n\nconst registerScrollArea = (AlpineInstance: Alpine.Alpine): void => {\n AlpineInstance.data('UiScrollArea', () => UiScrollArea());\n};\n\nexport {registerScrollArea, UiScrollArea};\nexport type {ScrollAreaData, ScrollAreaElements, UiScrollAreaApi};\n","// Generated by scripts/generate_component_entries.mjs from packages/client/component-entries.json.\n// Do not edit by hand.\nimport type {Alpine as AlpineType} from 'alpinejs';\n\nimport {registerScrollArea as registerComponent} from './index';\n\nconst registered = new WeakSet<AlpineType>();\n\nconst registerScrollArea = (AlpineInstance: AlpineType): void => {\n if (registered.has(AlpineInstance)) return;\n registered.add(AlpineInstance);\n\n registerComponent(AlpineInstance);\n};\n\nexport {registerScrollArea};\nexport default registerScrollArea;\nexport * from './index';\n"],"mappings":"uVAIA,IAAM,EAAmB,CACrB,YAAa,EAAM,CAHW,WAAY,aAAc,MAGrC,EAA0B,UAAU,EACvD,KAAM,EAAM,CAHW,QAAS,SAAU,QAG9B,EAAmB,OAAO,EACtC,KAAM,EACN,WAAY,EAAK,QAAQ,EAAI,EAC7B,SAAU,EACV,MAAO,EACP,cAAe,EACf,eAAgB,EAChB,WAAY,EACZ,YAAa,CACjB,ECWM,EAAU,IAAsB,CAAC,WACnC,EAAM,OAAS,EAGb,EAAkB,CAAC,EAEnB,GAA2B,CAC7B,QACA,UACA,aAC+E,EAAkD,CACjI,KAAM,WACN,GAAI,CACA,cAAe,CAAC,OAAQ,eAAgB,QAAS,MAAM,EACvD,SAAU,CAAC,OAAQ,cAAe,QAAS,MAAM,CACrD,EACA,OAAQ,CACJ,QAAS,CACL,QAAS,UACT,OAAQ,CACJ,QAAS,CAAC,GAAI,CAAC,gBAAiB,CAAC,OAAQ,SAAU,QAAS,MAAM,CAAC,CAAC,E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AK,IAAA,EAC3D,CACJ,CAAC,CAAC,CACN,EACA,MAAM,EAAgC,CAClC,IAAM,EAAO,EAAoB,CAAE,EAC7B,EAAc,IAAS,IAAM,aAAe,WAClD,OAAO,EAAc,CAAC,OAAQ,CAC1B,EAAa,CAAC,KAAM,EAAiB,MAAM,MAAO,MAAO,CAAC,aAAW,EAAG,UAAW,EAAG,QAAQ,KAAK,CAAC,EACpG,CACI,4BAA6B,GAC7B,cAAe,OACf,uBAAyB,GAAwB,EAAU,EAAO,CAAI,EACtE,qBAAwB,EAAO,IAAS,IAAM,aAAe,YAAY,EAAI,GAAK,IAAA,EACtF,CACJ,CAAC,CAAC,CACN,EACA,OAAO,EAAgC,CACnC,OAAO,EAAc,CAAC,OAAQ,CAC1B,EAAa,CAAC,KAAM,EAAiB,MAAM,OAAQ,UAAW,EAAG,QAAQ,KAAK,CAAC,EAC/E,CAAC,6BAA8B,GAAI,cAAe,MAAM,CAC5D,CAAC,CAAC,CACN,CACJ,EAEO,CACX,EAEM,EAAsB,GAAwC,CAChE,EAAe,KAAK,mBAAsB,EAAa,CAAC,CAC5D,ECrgBM,EAAa,IAAI,QAEjB,EAAsB,GAAqC,CACzD,EAAW,IAAI,CAAc,IACjC,EAAW,IAAI,CAAc,EAE7B,EAAkB,CAAc,EACpC"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{f as e,l as t,n}from"./codecs-Cb1ns_47.js";import{t as r}from"./resizable-BixtYF9M.js";var i=[`auto`,`fixed`],a=[`compact`,`default`,`comfortable`],o=[`ghost`,`surface`],s=[`none`,`row`,`grid`],c=[`auto`,`full`],l=[`start`,`center`,`end`],u=[`top`,`middle`,`bottom`,`baseline`],d=[`none`,`ascending`,`descending`,`other`],f=[`col`,`colgroup`],p=[`row`,`rowgroup`],m=[`div`,`form`],h={layout:t(i,`auto`),density:t(a,`default`),variant:t(o,`ghost`),border:t(s,`none`),flush:n,zebra:n,hover:n.default(!0),stickyHeader:n,nowrap:n.default(!0),width:t(c,`full`),class:e,tableClass:e},g={side:t([`top`,`bottom`],`bottom`),class:e},_={class:e},v={selected:n,current:n,disabled:n,interactive:n,class:e},y={align:t(l,`start`),valign:t(u,`middle`),key:e,target:e,width:e,resizable:n,minWidth:e.default(`4rem`),maxWidth:e,sortable:n,sort:t(d,`none`),abbr:e,scope:t(f,`col`),class:e,contentClass:e,resizeHandleClass:e},b={as:t(m,`div`),id:e,class:e},x={align:t(l,`start`),valign:t(u,`middle`),scope:t(p,`row`),class:e},S={align:t(l,`start`),valign:t(u,`middle`),class:e},C={colspan:e.default(`1`),class:e,cellClass:e},w=new WeakSet,T=e=>{w.has(e)||(w.add(e),r(e))};export{C as _,a,h as b,p as c,o as d,c as f,y as g,b as h,f as i,d as l,S as m,l as n,m as o,g as p,s as r,i as s,T as t,u,x as v,_ as x,v as y};
|
|
2
|
-
//# sourceMappingURL=entry.generated-xcXw-cEl.js.map
|
package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/machine-CX3wFSoV.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e,i as t}from"./codecs-Cb1ns_47.js";var n=e=>typeof e==`object`&&!!e&&!(e instanceof FormData)&&!(e instanceof URLSearchParams)&&!(e instanceof HTMLFormElement)&&!(e instanceof Blob)&&!(e instanceof ArrayBuffer),r=e=>structuredClone(e),i=(e,t)=>{if(Object.is(e,t))return!0;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>i(e,t[n]));if(!n(e)||!n(t))return!1;let r=Object.keys(e),a=Object.keys(t);return r.length===a.length&&r.every(n=>Object.hasOwn(t,n)&&i(e[n],t[n]))},a=e=>e!==null&&(typeof e==`object`||typeof e==`function`)&&`then`in e&&typeof e.then==`function`,o=e=>{if(e.project===void 0==(e.projectEach===void 0))throw Error(`Transition hook ${e.name} requires exactly one projection.`);return Object.freeze(e)},s=e=>typeof e==`string`?[e]:e,c=(e,t)=>{let n=e.split(`.`),r=t.split(`.`),i=0;for(;n[i]!==void 0&&n[i]===r[i];)i+=1;return i},l=(e,t)=>[...s(e)].sort((e,n)=>c(n,t)-c(e,t))[0]??t,u=({machine:e,hooks:t,root:n,resolveElement:i})=>{let o=new Map(t.map(e=>[e.name,e])),s=new Map,c=new Map,u=new Set,d=!1;if(o.size!==t.length)throw Error(`Transition hook names must be unique.`);t.forEach(e=>{let t=s.get(e.state)??[],n=t[0];if(n&&(n.onDone!==e.onDone||n.onError!==e.onError))throw Error(`Transition hooks sharing ${e.state} must use the same continuations.`);t.push(e),s.set(e.state,t)});let f=t=>!d&&e.getSnapshot().generations[t.path]===t.generation,p=(t,n,r={})=>{e.send({type:n,...r,__state:t.path,__generation:t.generation})},m=(e,t)=>e.projectEach?.(t)??[e.project?.(t)],h=(t,o,s,c,u,d=0)=>{for(let p=d;p<c.length;p+=1){if(!f(t))return;let d=c[p],m=n??d.el,g=i?.({name:o.name,data:s,root:m,registrationEl:d.el});if(g===null)return;let _=g??d.el,v=e.send.bind(e);Object.entries(o.sends??{}).forEach(([t,n])=>{v[t]=(...t)=>e.send(n(...t))});let y=Object.freeze({el:_,root:m,from:l(t.from,t.path),to:t.path,event:Object.freeze({...t.event}),props:r(t.snapshot.props),data:r(s),send:v,signal:u}),b=d.callback(y);if(a(b))return Promise.resolve(b).then(()=>h(t,o,s,c,u,p+1))}},g=e=>{let t=s.get(e.path);if(!t)return;let n=[],r=[],i=new AbortController,o={entry:e,controller:i};u.add(o),t.forEach(t=>{let a=[...c.get(t.name)??[]];if(a.length===0){t.required&&r.push(Error(`Transition hook ${t.name} requires a registered callback.`));return}m(t,e.snapshot).forEach(o=>{try{n.push(h(e,t,o,a,i.signal))}catch(e){r.push(e)}})});let l=t[0],d=(t=[])=>{if(u.delete(o),!f(e))return;let n=[...r,...t][0];n===void 0?p(e,l.onDone):p(e,l.onError,{error:n})},g=n.filter(a);if(g.length===0){d();return}Promise.allSettled(g).then(e=>d(e.flatMap(e=>e.status===`rejected`?[e.reason]:[])))},_=e.subscribeEntries(e=>{g(e)}),v=e.subscribe(()=>{u.forEach(e=>{f(e.entry)||(e.controller.abort(),u.delete(e))})});return{register({name:e,el:t,callback:n}){if(d)throw Error(`Transition coordinator has been destroyed.`);if(!o.has(e))throw Error(`Unknown transition hook: ${e}`);let r={name:e,el:t,callback:n},i=c.get(e)??[];return i.push(r),c.set(e,i),()=>{let t=c.get(e);if(!t)return;let n=t.indexOf(r);n>=0&&t.splice(n,1),t.length===0&&c.delete(e)}},destroy(){d||(d=!0,_(),v(),u.forEach(e=>e.controller.abort()),u.clear(),c.clear())}}},d=new WeakMap,f=(e,t)=>{let n=e.findClosest(t,e=>d.has(e));return n?d.get(n):void 0},p=({schema:n,hooks:r,createMachine:a,resolveTransitionElement:o})=>{let s={current:null},c=s,l=[],f=null,p=null,m=null,h=null,g=null,_=!1,v=()=>{if(!p)throw Error(`Alpine machine has not been initialized.`);return p},y=e=>{!m||!f||!e.active||(e.unregister=m.register({name:e.name,el:e.el??f,callback:e.callback}))},b={snapshot:s,invalidateDom(){_||!p||p.send(`DOM_INVALIDATED`)},connect(v,x=s){if(_)throw Error(`Alpine machine has been destroyed.`);if(p)return;f=v,c=x;let S=e({el:f,schema:n}),C=a({el:f,props:S}),w;try{w=u({machine:C,hooks:r,root:f,...o?{resolveElement:o}:{}})}catch(e){throw C.stop(),f=null,e}p=C,m=w,c.current=p.getSnapshot(),g=p.subscribe(e=>{c.current=e}),d.set(f,b),l.forEach(y);let T=new Map(Object.entries(n).flatMap(([e,n])=>n.meta.attribute?[[t(e,n),e]]:[]));h=new MutationObserver(t=>{if(!f||!p)return;let r=new Set(t.flatMap(({attributeName:e})=>{let t=e?T.get(e):void 0;return t?[t]:[]})),a=e({el:f,schema:n}),o=Object.keys(a).flatMap(e=>{let t=e;return!r.has(t)&&i(S[t],a[t])?[]:[{key:t,previous:S[t],value:a[t],source:`attribute`}]});o.length!==0&&(S=a,p.send({type:`PROPS_CHANGED`,props:a,changes:o}))}),h.observe(f,{attributes:!0,attributeFilter:Object.entries(n).map(([e,n])=>t(e,n))})},disconnect(){_||(_=!0,h?.disconnect(),h=null,g?.(),g=null,m?.destroy(),m=null,p?.stop(),p=null,f&&d.delete(f),f=null,l.splice(0).forEach(e=>e.unregister?.()),c.current=null,c=s)},getSnapshot(){let e=c.current;if(!e)throw Error(`Alpine machine has not been initialized.`);return e},getCommittedSnapshot(){return v().getSnapshot()},send(e){v().send(e)},matches(e){return v().matches(e)},hasTag(e){return v().hasTag(e)},onTransition(e,t,n){if(_)throw Error(`Alpine machine has been destroyed.`);let r={name:e,callback:t,active:!0};return n&&(r.el=n),l.push(r),y(r),()=>{if(!r.active)return;r.active=!1,r.unregister?.(),delete r.unregister;let e=l.indexOf(r);e>=0&&l.splice(e,1)}}};return b},m=`$`,h={type:`@@init`},g=e=>typeof e==`string`?{type:e}:e,_=e=>e===void 0?[]:Array.isArray(e)?e:[e],v=e=>typeof e==`string`?{target:e}:e,y=(e,t)=>t===m||e===t||e.startsWith(`${t}.`),b=(e,t)=>{let n=new Map,r=new Map,i=new Set,a=new Set,o=new Map,s=new Map,c=new Map,l=[],u=!1,d=!1,f=0,p=(e,t)=>Object.entries(e).map(([e,i])=>{let a=t===m?e:`${t}.${e}`,o=i.states?p(i.states,a):[],s=i.type??(o.length>0?`compound`:`final`),c={key:e,path:a,order:f++,type:s,children:o,tags:i.tags??[],reduce:_(i.reduce),entry:_(i.entry),exit:_(i.exit),on:i.on??{}};return i.id&&(c.id=i.id),t!==m&&(c.parent=t),i.initial&&(c.initial=i.initial),n.set(a,c),c.id&&r.set(c.id,a),a}),b=p(e.states,m),x={key:m,path:m,order:-1,type:e.type??`compound`,children:b,tags:e.tags??[],reduce:_(e.reduce),entry:_(e.entry),exit:_(e.exit),on:e.on??{}};e.id&&(x.id=e.id),e.initial&&(x.initial=e.initial),n.set(m,x),x.id&&r.set(x.id,m);let S=e=>{let t=n.get(e);if(!t)throw Error(`Unknown machine state: ${e}`);return t},C=e=>{let t=[],n=e;for(;n;){let e=S(n);t.push(e),n=e.parent??(n===m?void 0:m)}return t},w=e=>{let t=new Set;return e.forEach(e=>C(e).forEach(e=>t.add(e.path))),Array.from(t).map(S).sort((e,t)=>e.order-t.order)},T=e=>{let t=S(e);if(t.children.length===0||t.type===`final`)return e===m?[]:[e];if(t.type===`parallel`)return t.children.flatMap(T);if(!t.initial)throw Error(`Machine state requires an initial child: ${e}`);let r=e===m?t.initial:`${e}.${t.initial}`;return T(n.has(r)?r:t.initial)},E=(e,t)=>{if(e.startsWith(`#`)){let t=r.get(e.slice(1));if(!t)throw Error(`Unknown machine state id: ${e}`);return t}if(e===m||n.has(e))return e;if(t.parent){let r=`${t.parent}.${e}`;if(n.has(r))return r}if(n.has(e))return e;throw Error(`Unknown machine state: ${e}`)},D=e=>e.length===1?e[0]:Object.freeze([...e]),O=e=>Object.freeze(Array.from(new Set(w(e).flatMap(e=>e.tags)))),k=()=>Object.freeze(Object.fromEntries(s)),A=T(m),j=Object.freeze({value:D(A),tags:O(A),context:Object.freeze({...t.context}),props:Object.freeze({...t.props??{}}),generations:Object.freeze({})}),M=(e,t=j)=>({snapshot:t,context:t.context,props:t.props,event:e,state:t.value}),N=e=>`${e}:${s.get(e)??0}`,P=(e,t)=>{if(typeof t!=`function`)return;let n=N(e),r=c.get(n)??[];r.push(t),c.set(n,r)},F=e=>{let t=N(e),n=c.get(t);n&&(n.splice(0).reverse().forEach(e=>e()),c.delete(t))},I=e=>typeof e==`function`?e:t.effects?.[e],L=(e,t,n,r=!0)=>{e.forEach(e=>{let i=I(e);if(!i)throw Error(`Unknown machine effect: ${String(e)}`);let a=i(M(t));r&&P(n,a)})},R=e=>typeof e==`function`?e:t.reducers?.[e],z=(e,t,n)=>{let r={},i={},a=new Set,o=new Set;return e.forEach(e=>{let s=R(e);if(!s)throw Error(`Unknown machine reducer: ${String(e)}`);let c=s(M(t,n));c&&(Reflect.ownKeys(c.context??{}).forEach(e=>{if(a.has(e))throw Error(`Conflicting machine context update: ${String(e)}`);a.add(e),Reflect.set(r,e,Reflect.get(c.context,e))}),Reflect.ownKeys(c.props??{}).forEach(e=>{if(o.has(e))throw Error(`Conflicting machine prop update: ${String(e)}`);o.add(e),Reflect.set(i,e,Reflect.get(c.props,e))}))}),{context:Object.freeze({...n.context,...r}),props:Object.freeze({...n.props,...i})}},B=(e,n,r)=>{if(!e)return!0;let i=typeof e==`function`?e:t.guards?.[e];if(!i)throw Error(`Unknown machine guard: ${String(e)}`);return i(M(n,r))},V=(e,t)=>{let n=new Map;A.forEach(r=>{for(let i of C(r)){let r=_(i.on[e.type]).map(v).find(n=>B(n.guard,e,t));r&&n.set(i.path,{source:i,definition:r})}});let r=Array.from(n.values());return r.filter(e=>!r.some(t=>t!==e&&y(e.source.path,t.source.path))).sort((e,t)=>e.source.order-t.source.order)},H=(e,t)=>{let n=new Set(C(t).map(e=>e.path));return C(e).find(e=>n.has(e.path))?.path??m},U=(e,t)=>{let n=H(e,t);if(e===t||n===e)return e;let r=C(e),i=r.findIndex(e=>e.path===n);return r[Math.max(0,i-1)]?.path??e},W=e=>{let t=[...A];return e.forEach(({source:e,definition:n})=>{if(!n.target)return;let r=E(n.target,e),i=U(e.path,r);t=t.filter(e=>!y(e,i)),t.push(...T(r))}),Array.from(new Set(t)).sort((e,t)=>S(e).order-S(t).order)},G=e=>{if(typeof e.__state==`string`&&typeof e.__generation==`number`&&s.get(e.__state)!==e.__generation)return;let t=j,n=V(e,t);if(n.length===0)return;let r=W(n),c=w(A),l=w(r),u=new Set(c.map(e=>e.path)),d=new Set(l.map(e=>e.path)),f=n.flatMap(({source:e,definition:t})=>t.target&&E(t.target,e)===e.path?c.filter(t=>y(t.path,e.path)).map(e=>e.path):[]),p=new Set(f),m=c.filter(e=>!d.has(e.path)||p.has(e.path)).sort((e,t)=>t.path.split(`.`).length-e.path.split(`.`).length||t.order-e.order),h=l.filter(e=>!u.has(e.path)||p.has(e.path)).sort((e,t)=>e.path.split(`.`).length-t.path.split(`.`).length||e.order-t.order);m.forEach(t=>{F(t.path),L(t.exit,e,t.path,!1),s.delete(t.path)});let g=z([...n.flatMap(({definition:e})=>_(e.reduce)),...h.flatMap(e=>e.reduce)],e,t);h.forEach(e=>{let t=(o.get(e.path)??0)+1;o.set(e.path,t),s.set(e.path,t)}),A=r,j=Object.freeze({value:D(A),tags:O(A),context:g.context,props:g.props,generations:k()}),n.forEach(({source:t,definition:n})=>L(_(n.effects),e,t.path)),h.forEach(t=>L(t.entry,e,t.path)),i.forEach(e=>e(j)),h.forEach(n=>{let r=s.get(n.path);if(r===void 0)return;let i=Object.freeze({path:n.path,generation:r,from:t.value,to:j.value,event:e,snapshot:j});a.forEach(e=>e(i))})},K={get state(){return j.value},get context(){return j.context},get props(){return j.props},getSnapshot(){return j},send(e){if(!d&&(l.push(g(e)),!u)){u=!0;try{for(;l.length>0&&!d;)G(l.shift())}finally{u=!1}}},subscribe(e){return d?()=>{}:(i.add(e),()=>i.delete(e))},subscribeEntries(e){return d?()=>{}:(a.add(e),()=>a.delete(e))},matches(e){return A.some(t=>t===e||t.split(`.`).at(-1)===e||y(t,e))},hasTag(e){return j.tags.includes(e)},stop(){d||=(w(A).sort((e,t)=>t.path.split(`.`).length-e.path.split(`.`).length||t.order-e.order).forEach(e=>F(e.path)),i.clear(),a.clear(),l.splice(0),s.clear(),!0)}};w(A).forEach(e=>{let t=(o.get(e.path)??0)+1;o.set(e.path,t),s.set(e.path,t)});let q=z(w(A).flatMap(e=>e.reduce),h,j);return j=Object.freeze({value:D(A),tags:O(A),context:q.context,props:q.props,generations:k()}),w(A).forEach(e=>L(e.entry,h,e.path)),K};export{o as a,u as i,p as n,n as o,f as r,i as s,b as t};
|
|
2
|
-
//# sourceMappingURL=machine-CX3wFSoV.js.map
|
package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/machine-CX3wFSoV.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"machine-CX3wFSoV.js","names":[],"sources":["../../../../../../../../client/src/utils/object.ts","../../../../../../../../client/src/runtime/transition-coordinator.ts","../../../../../../../../client/src/runtime/alpine-machine.ts","../../../../../../../../client/src/runtime/state-machine/machine.ts"],"sourcesContent":["const isRecord = (value: unknown): value is Record<string, unknown> => (\n typeof value === 'object'\n && value !== null\n && !(value instanceof FormData)\n && !(value instanceof URLSearchParams)\n && !(value instanceof HTMLFormElement)\n && !(value instanceof Blob)\n && !(value instanceof ArrayBuffer)\n);\n\nconst cloneSerializable = <T>(value: T): T => structuredClone(value);\n\nconst isSerializableEqual = (left: unknown, right: unknown): boolean => {\n if (Object.is(left, right)) return true;\n if (Array.isArray(left) || Array.isArray(right)) {\n return Array.isArray(left)\n && Array.isArray(right)\n && left.length === right.length\n && left.every((value, index) => isSerializableEqual(value, right[index]));\n }\n if (!isRecord(left) || !isRecord(right)) return false;\n const leftKeys = Object.keys(left);\n const rightKeys = Object.keys(right);\n return leftKeys.length === rightKeys.length\n && leftKeys.every((key) => Object.hasOwn(right, key) && isSerializableEqual(left[key], right[key]));\n};\n\nconst isPromiseLike = (value: unknown): value is PromiseLike<unknown> => (\n value !== null\n && (typeof value === 'object' || typeof value === 'function')\n && 'then' in value\n && typeof value.then === 'function'\n);\n\nexport {cloneSerializable, isPromiseLike, isRecord, isSerializableEqual};\n","import type {\n Machine,\n MachineEntry,\n MachineEvent,\n MachineEventObject,\n MachineSnapshot,\n MachineStateValue,\n} from './state-machine';\nimport {cloneSerializable, isPromiseLike} from '../utils';\n\ntype TransitionEventCreator = (...args: never[]) => MachineEvent;\ntype TransitionSend = ((event: MachineEvent) => void) & {[name: string]: ((...args: unknown[]) => void) | undefined};\n\ntype TransitionHookDefinition<\n TContext,\n TProps,\n TData,\n TName extends string = string,\n TSends extends Record<string, TransitionEventCreator> = Record<string, TransitionEventCreator>,\n> = Readonly<{\n name: TName;\n state: string;\n onDone: string;\n onError: string;\n required?: boolean;\n sends?: TSends;\n project?: (snapshot: MachineSnapshot<TContext, TProps>) => TData;\n projectEach?: (snapshot: MachineSnapshot<TContext, TProps>) => readonly TData[];\n}>;\n\ntype AnyTransitionHook<TContext, TProps> = TransitionHookDefinition<TContext, TProps, unknown>;\n\ntype TransitionContext<TProps, TData, TElement = unknown> = Readonly<{\n el: TElement;\n root: TElement;\n from: string;\n to: string;\n event: MachineEventObject;\n props: TProps;\n data: TData;\n send: TransitionSend;\n signal: AbortSignal;\n}>;\n\ntype TransitionCallback<TProps, TData, TElement = unknown> = (\n transition: TransitionContext<TProps, TData, TElement>,\n) => unknown | Promise<unknown>;\n\ntype TransitionRegistration<TProps, TElement> = {\n name: string;\n el: TElement;\n callback: TransitionCallback<TProps, unknown, TElement>;\n};\n\ntype TransitionCoordinatorOptions<TContext, TProps, TElement> = {\n machine: Machine<TContext, TProps>;\n hooks: readonly AnyTransitionHook<TContext, TProps>[];\n root?: TElement;\n resolveElement?: TransitionElementResolver<TElement>;\n};\n\ntype TransitionElementResolver<TElement> = (scope: Readonly<{\n name: string;\n data: unknown;\n root: TElement;\n registrationEl: TElement;\n}>) => TElement | null | undefined;\n\ntype TransitionCoordinator<TProps, TElement = unknown> = {\n register<TData>(registration: {\n name: string;\n el: TElement;\n callback: TransitionCallback<TProps, TData, TElement>;\n }): () => void;\n destroy(): void;\n};\n\nconst defineHook = <\n TContext,\n TProps,\n TData,\n const TName extends string,\n const TSends extends Record<string, TransitionEventCreator> = Record<string, TransitionEventCreator>,\n>(definition: TransitionHookDefinition<TContext, TProps, TData, TName, TSends>): typeof definition => {\n if ((definition.project === undefined) === (definition.projectEach === undefined)) {\n throw new Error(`Transition hook ${definition.name} requires exactly one projection.`);\n }\n return Object.freeze(definition);\n};\n\nconst statePaths = (value: MachineStateValue): readonly string[] => (\n typeof value === 'string' ? [value] : value\n);\n\nconst commonPrefixLength = (left: string, right: string): number => {\n const leftParts = left.split('.');\n const rightParts = right.split('.');\n let index = 0;\n while (leftParts[index] !== undefined && leftParts[index] === rightParts[index]) index += 1;\n return index;\n};\n\nconst closestStatePath = (value: MachineStateValue, enteredPath: string): string => {\n const paths = statePaths(value);\n return [...paths].sort((left, right) => (\n commonPrefixLength(right, enteredPath) - commonPrefixLength(left, enteredPath)\n ))[0] ?? enteredPath;\n};\n\nconst createTransitionCoordinator = <TContext, TProps, TElement = unknown>({\n machine,\n hooks,\n root: ownerRoot,\n resolveElement,\n}: TransitionCoordinatorOptions<TContext, TProps, TElement>): TransitionCoordinator<TProps, TElement> => {\n const hooksByName = new Map(hooks.map((hook) => [hook.name, hook]));\n const hooksByState = new Map<string, AnyTransitionHook<TContext, TProps>[]>();\n const registrations = new Map<string, TransitionRegistration<TProps, TElement>[]>();\n const activeRuns = new Set<{entry: MachineEntry<TContext, TProps>; controller: AbortController}>();\n let destroyed = false;\n\n if (hooksByName.size !== hooks.length) throw new Error('Transition hook names must be unique.');\n hooks.forEach((hook) => {\n const grouped = hooksByState.get(hook.state) ?? [];\n const first = grouped[0];\n if (first && (first.onDone !== hook.onDone || first.onError !== hook.onError)) {\n throw new Error(`Transition hooks sharing ${hook.state} must use the same continuations.`);\n }\n grouped.push(hook);\n hooksByState.set(hook.state, grouped);\n });\n\n const isActive = (entry: MachineEntry<TContext, TProps>): boolean => (\n !destroyed && machine.getSnapshot().generations[entry.path] === entry.generation\n );\n\n const continuation = (\n entry: MachineEntry<TContext, TProps>,\n type: string,\n detail: Record<string, unknown> = {},\n ): void => {\n machine.send({\n type,\n ...detail,\n __state: entry.path,\n __generation: entry.generation,\n });\n };\n\n const projections = (\n hook: AnyTransitionHook<TContext, TProps>,\n snapshot: MachineSnapshot<TContext, TProps>,\n ): readonly unknown[] => hook.projectEach?.(snapshot) ?? [hook.project?.(snapshot)];\n\n const runQueue = (\n entry: MachineEntry<TContext, TProps>,\n hook: AnyTransitionHook<TContext, TProps>,\n data: unknown,\n queue: TransitionRegistration<TProps, TElement>[],\n signal: AbortSignal,\n index = 0,\n ): void | Promise<void> => {\n for (let cursor = index; cursor < queue.length; cursor += 1) {\n if (!isActive(entry)) return;\n const registration = queue[cursor] as TransitionRegistration<TProps, TElement>;\n const root = ownerRoot ?? registration.el;\n const resolved = resolveElement?.({\n name: hook.name,\n data,\n root,\n registrationEl: registration.el,\n });\n if (resolved === null) return;\n const el = resolved ?? registration.el;\n const send = machine.send.bind(machine) as TransitionSend;\n Object.entries(hook.sends ?? {}).forEach(([name, createEvent]) => {\n send[name] = (...args: unknown[]) => machine.send(createEvent(...args as never[]));\n });\n const transition = Object.freeze({\n el,\n root,\n from: closestStatePath(entry.from, entry.path),\n to: entry.path,\n event: Object.freeze({...entry.event}),\n props: cloneSerializable(entry.snapshot.props),\n data: cloneSerializable(data),\n send,\n signal,\n }) as TransitionContext<TProps, unknown, TElement>;\n const result = registration.callback(transition);\n if (isPromiseLike(result)) {\n return Promise.resolve(result).then(() => runQueue(entry, hook, data, queue, signal, cursor + 1));\n }\n }\n };\n\n const runEntry = (entry: MachineEntry<TContext, TProps>): void => {\n const groupedHooks = hooksByState.get(entry.path);\n if (!groupedHooks) return;\n const results: Array<void | Promise<void>> = [];\n const errors: unknown[] = [];\n const controller = new AbortController();\n const activeRun = {entry, controller};\n activeRuns.add(activeRun);\n\n groupedHooks.forEach((hook) => {\n const queue = [...registrations.get(hook.name) ?? []];\n if (queue.length === 0) {\n if (hook.required) errors.push(new Error(`Transition hook ${hook.name} requires a registered callback.`));\n return;\n }\n projections(hook, entry.snapshot).forEach((data) => {\n try {\n results.push(runQueue(entry, hook, data, queue, controller.signal));\n } catch (error) {\n errors.push(error);\n }\n });\n });\n\n const first = groupedHooks[0] as AnyTransitionHook<TContext, TProps>;\n const finish = (asyncErrors: unknown[] = []): void => {\n activeRuns.delete(activeRun);\n if (!isActive(entry)) return;\n const failure = [...errors, ...asyncErrors][0];\n if (failure !== undefined) {\n continuation(entry, first.onError, {error: failure});\n } else {\n continuation(entry, first.onDone);\n }\n };\n const pending = results.filter(isPromiseLike);\n if (pending.length === 0) {\n finish();\n return;\n }\n void Promise.allSettled(pending).then((settled) => finish(settled.flatMap((result) => (\n result.status === 'rejected' ? [result.reason] : []\n ))));\n };\n\n const unsubscribe = machine.subscribeEntries((entry) => {\n runEntry(entry);\n });\n const unsubscribeSnapshot = machine.subscribe(() => {\n activeRuns.forEach((run) => {\n if (isActive(run.entry)) return;\n run.controller.abort();\n activeRuns.delete(run);\n });\n });\n\n return {\n register<TData>({name, el, callback}: {\n name: string;\n el: TElement;\n callback: TransitionCallback<TProps, TData, TElement>;\n }): () => void {\n if (destroyed) throw new Error('Transition coordinator has been destroyed.');\n if (!hooksByName.has(name)) throw new Error(`Unknown transition hook: ${name}`);\n\n const registration: TransitionRegistration<TProps, TElement> = {\n name,\n el,\n callback: callback as TransitionCallback<TProps, unknown, TElement>,\n };\n const queue = registrations.get(name) ?? [];\n queue.push(registration);\n registrations.set(name, queue);\n\n return () => {\n const current = registrations.get(name);\n if (!current) return;\n const index = current.indexOf(registration);\n if (index >= 0) current.splice(index, 1);\n if (current.length === 0) registrations.delete(name);\n };\n },\n destroy(): void {\n if (destroyed) return;\n destroyed = true;\n unsubscribe();\n unsubscribeSnapshot();\n activeRuns.forEach((run) => run.controller.abort());\n activeRuns.clear();\n registrations.clear();\n },\n };\n};\n\nexport {createTransitionCoordinator, defineHook};\nexport type {\n AnyTransitionHook,\n TransitionCallback,\n TransitionContext,\n TransitionCoordinator,\n TransitionCoordinatorOptions,\n TransitionEventCreator,\n TransitionSend,\n TransitionElementResolver,\n TransitionHookDefinition,\n};\n","import type Alpine from 'alpinejs';\n\nimport {\n decodeProps,\n dataAttributeForSchemaProp,\n type CodecFn,\n type PropChange,\n type SchemaToProps,\n} from './codecs';\nimport {\n createTransitionCoordinator,\n type AnyTransitionHook,\n type TransitionCallback,\n type TransitionCoordinator,\n} from './transition-coordinator';\nimport type {Machine, MachineEvent, MachineSnapshot} from './state-machine';\nimport {isSerializableEqual} from '../utils';\n\ntype MachineElement = HTMLElement & Alpine.ElementWithXAttributes;\ntype MachineSchema = Record<string, CodecFn<unknown>>;\ntype MachineProps<TSchema extends MachineSchema> = SchemaToProps<TSchema>;\ntype TransitionHookLike = {\n name: string;\n state: string;\n project?: (...args: never[]) => unknown;\n projectEach?: (...args: never[]) => readonly unknown[];\n onDone: string;\n onError: string;\n};\ntype HookName<THooks extends readonly {name: string}[]> = THooks[number]['name'];\ntype HookData<THook> = THook extends {project: (...args: never[]) => infer TData}\n ? TData\n : THook extends {projectEach: (...args: never[]) => readonly (infer TData)[]}\n ? TData\n : never;\ntype HookForName<THooks, TName> = Extract<THooks extends readonly unknown[] ? THooks[number] : never, {name: TName}>;\n\ntype AlpinePropsChangedEvent<TSchema extends MachineSchema> = {\n type: 'PROPS_CHANGED';\n props: MachineProps<TSchema>;\n changes: Array<PropChange<TSchema>>;\n};\n\ntype MachineFactoryScope<TSchema extends MachineSchema> = {\n el: MachineElement;\n props: MachineProps<TSchema>;\n};\n\ntype CreateAlpineMachineOptions<\n TContext,\n TSchema extends MachineSchema,\n THooks extends readonly TransitionHookLike[],\n> = {\n schema: TSchema;\n hooks: THooks;\n createMachine(scope: MachineFactoryScope<TSchema>): Machine<TContext, MachineProps<TSchema>>;\n resolveTransitionElement?(scope: Readonly<{\n name: string;\n data: unknown;\n root: MachineElement;\n registrationEl: MachineElement;\n }>): MachineElement | null | undefined;\n};\n\ntype AlpineMachineOwner<TProps = unknown> = {\n invalidateDom(): void;\n onTransition<TData>(\n name: string,\n callback: TransitionCallback<TProps, TData, MachineElement>,\n el?: MachineElement,\n ): () => void;\n};\n\ntype AlpineMachine<\n TContext,\n TProps,\n THooks extends readonly TransitionHookLike[],\n> = AlpineMachineOwner<TProps> & {\n snapshot: {current: MachineSnapshot<TContext, TProps> | null};\n connect(\n el: MachineElement,\n snapshot?: {current: MachineSnapshot<TContext, TProps> | null},\n ): void;\n disconnect(): void;\n getSnapshot(): MachineSnapshot<TContext, TProps>;\n getCommittedSnapshot(): MachineSnapshot<TContext, TProps>;\n send(event: MachineEvent): void;\n matches(state: string): boolean;\n hasTag(tag: string): boolean;\n onTransition<\n TName extends HookName<THooks>,\n TData = HookData<HookForName<THooks, TName>>,\n >(\n name: TName,\n callback: TransitionCallback<TProps, TData, MachineElement>,\n el?: MachineElement,\n ): () => void;\n};\n\ntype PendingTransition<TProps> = {\n name: string;\n callback: TransitionCallback<TProps, unknown, MachineElement>;\n el?: MachineElement;\n unregister?: () => void;\n active: boolean;\n};\n\nconst owners = new WeakMap<Element, AlpineMachineOwner>();\n\nconst findAlpineMachineOwner = (\n AlpineInstance: Alpine.Alpine,\n el: Element,\n): AlpineMachineOwner | undefined => {\n const owner = AlpineInstance.findClosest(el, (candidate) => owners.has(candidate));\n return owner ? owners.get(owner) : undefined;\n};\n\nconst createAlpineMachine = <\n TContext,\n TSchema extends MachineSchema,\n const THooks extends readonly TransitionHookLike[],\n>({\n schema,\n hooks,\n createMachine: machineFactory,\n resolveTransitionElement,\n}: CreateAlpineMachineOptions<TContext, TSchema, THooks>): AlpineMachine<TContext, MachineProps<TSchema>, THooks> => {\n type TProps = MachineProps<TSchema>;\n\n const snapshot: {current: MachineSnapshot<TContext, TProps> | null} = {current: null};\n let snapshotMirror = snapshot;\n const pending: PendingTransition<TProps>[] = [];\n let root: MachineElement | null = null;\n let machine: Machine<TContext, TProps> | null = null;\n let coordinator: TransitionCoordinator<TProps, MachineElement> | null = null;\n let observer: MutationObserver | null = null;\n let unsubscribeSnapshot: (() => void) | null = null;\n let destroyed = false;\n\n const requireMachine = (): Machine<TContext, TProps> => {\n if (!machine) throw new Error('Alpine machine has not been initialized.');\n return machine;\n };\n\n const registerPending = (registration: PendingTransition<TProps>): void => {\n if (!coordinator || !root || !registration.active) return;\n registration.unregister = coordinator.register({\n name: registration.name,\n el: registration.el ?? root,\n callback: registration.callback,\n });\n };\n\n const component: AlpineMachine<TContext, TProps, THooks> = {\n snapshot,\n invalidateDom(): void {\n if (destroyed || !machine) return;\n machine.send('DOM_INVALIDATED');\n },\n connect(el, reactiveSnapshot = snapshot): void {\n if (destroyed) throw new Error('Alpine machine has been destroyed.');\n if (machine) return;\n\n root = el;\n snapshotMirror = reactiveSnapshot;\n let props = decodeProps({el: root, schema});\n const createdMachine = machineFactory({el: root, props});\n let createdCoordinator: TransitionCoordinator<TProps, MachineElement>;\n try {\n createdCoordinator = createTransitionCoordinator<TContext, TProps, MachineElement>({\n machine: createdMachine,\n hooks: hooks as unknown as readonly AnyTransitionHook<TContext, TProps>[],\n root,\n ...(resolveTransitionElement ? {resolveElement: resolveTransitionElement} : {}),\n });\n } catch (error) {\n createdMachine.stop();\n root = null;\n throw error;\n }\n machine = createdMachine;\n coordinator = createdCoordinator;\n snapshotMirror.current = machine.getSnapshot();\n unsubscribeSnapshot = machine.subscribe((nextSnapshot) => {\n snapshotMirror.current = nextSnapshot;\n });\n owners.set(root, component);\n pending.forEach(registerPending);\n\n const authoritativePropByAttribute = new Map(Object.entries(schema).flatMap(([key, codec]) => codec.meta.attribute ? [[\n dataAttributeForSchemaProp(key, codec),\n key as keyof TProps & string,\n ] as const] : []));\n observer = new MutationObserver((mutations) => {\n if (!root || !machine) return;\n const touched = new Set(mutations.flatMap(({attributeName}) => {\n const key = attributeName ? authoritativePropByAttribute.get(attributeName) : undefined;\n return key ? [key] : [];\n }));\n const nextProps = decodeProps({el: root, schema});\n const changes = Object.keys(nextProps).flatMap((key) => {\n const typedKey = key as keyof TProps & string;\n if (!touched.has(typedKey) && isSerializableEqual(props[typedKey], nextProps[typedKey])) return [];\n return [{\n key: typedKey,\n previous: props[typedKey],\n value: nextProps[typedKey],\n source: 'attribute' as const,\n } as PropChange<TSchema>];\n });\n if (changes.length === 0) return;\n props = nextProps;\n machine.send({type: 'PROPS_CHANGED', props: nextProps, changes});\n });\n observer.observe(root, {\n attributes: true,\n attributeFilter: Object.entries(schema).map(([key, codec]) => dataAttributeForSchemaProp(key, codec)),\n });\n },\n disconnect(): void {\n if (destroyed) return;\n destroyed = true;\n observer?.disconnect();\n observer = null;\n unsubscribeSnapshot?.();\n unsubscribeSnapshot = null;\n coordinator?.destroy();\n coordinator = null;\n machine?.stop();\n machine = null;\n if (root) owners.delete(root);\n root = null;\n pending.splice(0).forEach((registration) => registration.unregister?.());\n snapshotMirror.current = null;\n snapshotMirror = snapshot;\n },\n getSnapshot(): MachineSnapshot<TContext, TProps> {\n const current = snapshotMirror.current;\n if (!current) throw new Error('Alpine machine has not been initialized.');\n return current;\n },\n getCommittedSnapshot(): MachineSnapshot<TContext, TProps> {\n return requireMachine().getSnapshot();\n },\n send(event): void {\n requireMachine().send(event);\n },\n matches(state): boolean {\n return requireMachine().matches(state);\n },\n hasTag(tag): boolean {\n return requireMachine().hasTag(tag);\n },\n onTransition<TData>(\n name: HookName<THooks>,\n callback: TransitionCallback<TProps, TData, MachineElement>,\n el?: MachineElement,\n ): () => void {\n if (destroyed) throw new Error('Alpine machine has been destroyed.');\n const registration: PendingTransition<TProps> = {\n name,\n callback: callback as TransitionCallback<TProps, unknown, MachineElement>,\n active: true,\n };\n if (el) registration.el = el;\n pending.push(registration);\n registerPending(registration);\n\n return () => {\n if (!registration.active) return;\n registration.active = false;\n registration.unregister?.();\n delete registration.unregister;\n const index = pending.indexOf(registration);\n if (index >= 0) pending.splice(index, 1);\n };\n },\n };\n\n return component;\n};\n\nexport {createAlpineMachine, findAlpineMachineOwner};\nexport type {\n AlpineMachine,\n AlpineMachineOwner,\n AlpinePropsChangedEvent,\n CreateAlpineMachineOptions,\n MachineFactoryScope,\n};\n","type MachineEventObject = {\n type: string;\n [key: string]: unknown;\n};\n\ntype MachineEvent = string | MachineEventObject;\ntype MachineStateValue = string | readonly string[];\n\ntype MachineSnapshot<TContext, TProps> = Readonly<{\n value: MachineStateValue;\n tags: readonly string[];\n context: Readonly<TContext>;\n props: Readonly<TProps>;\n generations: Readonly<Record<string, number>>;\n}>;\n\ntype MachineEntry<TContext, TProps> = Readonly<{\n path: string;\n generation: number;\n from: MachineStateValue;\n to: MachineStateValue;\n event: MachineEventObject;\n snapshot: MachineSnapshot<TContext, TProps>;\n}>;\n\ntype MachineScope<TContext, TProps> = {\n snapshot: MachineSnapshot<TContext, TProps>;\n context: Readonly<TContext>;\n props: Readonly<TProps>;\n event: MachineEventObject;\n state: MachineStateValue;\n};\n\ntype MachineGuard<TContext = unknown, TProps = Record<string, never>> = (\n scope: MachineScope<TContext, TProps>,\n) => boolean;\n\ntype MachineUpdate<TContext, TProps> = {\n context?: Partial<TContext>;\n props?: Partial<TProps>;\n};\n\ntype MachineReducer<TContext = unknown, TProps = Record<string, never>> = (\n scope: MachineScope<TContext, TProps>,\n) => MachineUpdate<TContext, TProps> | void;\n\ntype MachineEffect<TContext = unknown, TProps = Record<string, never>> = (\n scope: MachineScope<TContext, TProps>,\n) => void | (() => void);\n\ntype MachineReducerRef<TContext, TProps> = string | MachineReducer<TContext, TProps>;\ntype MachineEffectRef<TContext, TProps> = string | MachineEffect<TContext, TProps>;\ntype MachineReducerList<TContext, TProps> = MachineReducerRef<TContext, TProps> | MachineReducerRef<TContext, TProps>[];\ntype MachineEffectList<TContext, TProps> = MachineEffectRef<TContext, TProps> | MachineEffectRef<TContext, TProps>[];\n\ntype MachineTransitionDefinition<TContext, TProps> = {\n target?: string;\n guard?: string | MachineGuard<TContext, TProps>;\n reduce?: MachineReducerList<TContext, TProps>;\n effects?: MachineEffectList<TContext, TProps>;\n};\n\ntype MachineTransition<TContext, TProps = Record<string, never>> = string | MachineTransitionDefinition<TContext, TProps>;\n\ntype MachineStateConfig<TContext, TProps = Record<string, never>> = {\n id?: string;\n type?: 'compound' | 'parallel' | 'final';\n initial?: string;\n tags?: string[];\n reduce?: MachineReducerList<TContext, TProps>;\n entry?: MachineEffectList<TContext, TProps>;\n exit?: MachineEffectList<TContext, TProps>;\n on?: Record<string, MachineTransition<TContext, TProps> | Array<MachineTransition<TContext, TProps>>>;\n states?: Record<string, MachineStateConfig<TContext, TProps>>;\n};\n\ntype MachineConfig<TContext, TProps = Record<string, never>> = MachineStateConfig<TContext, TProps> & {\n initial?: string;\n states: Record<string, MachineStateConfig<TContext, TProps>>;\n};\n\ntype MachineOptions<TContext, TProps = Record<string, never>> = {\n context: TContext;\n props?: TProps;\n reducers?: Record<string, MachineReducer<TContext, TProps>>;\n guards?: Record<string, MachineGuard<TContext, TProps>>;\n effects?: Record<string, MachineEffect<TContext, TProps>>;\n};\n\ntype Machine<TContext, TProps = Record<string, never>> = {\n readonly state: MachineStateValue;\n readonly context: Readonly<TContext>;\n readonly props: Readonly<TProps>;\n getSnapshot(): MachineSnapshot<TContext, TProps>;\n send(event: MachineEvent): void;\n subscribe(listener: (snapshot: MachineSnapshot<TContext, TProps>) => void): () => void;\n subscribeEntries(listener: (entry: MachineEntry<TContext, TProps>) => void): () => void;\n matches(state: string): boolean;\n hasTag(tag: string): boolean;\n stop(): void;\n};\n\ntype RuntimeNode<TContext, TProps> = {\n key: string;\n path: string;\n order: number;\n id?: string;\n parent?: string;\n type: 'compound' | 'parallel' | 'final';\n initial?: string;\n children: string[];\n tags: string[];\n reduce: MachineReducerRef<TContext, TProps>[];\n entry: MachineEffectRef<TContext, TProps>[];\n exit: MachineEffectRef<TContext, TProps>[];\n on: Record<string, MachineTransition<TContext, TProps> | Array<MachineTransition<TContext, TProps>>>;\n};\n\ntype SelectedTransition<TContext, TProps> = {\n source: RuntimeNode<TContext, TProps>;\n definition: MachineTransitionDefinition<TContext, TProps>;\n};\n\nconst ROOT_PATH = '$';\nconst INIT_EVENT: MachineEventObject = {type: '@@init'};\n\nconst toEventObject = (event: MachineEvent): MachineEventObject => (\n typeof event === 'string' ? {type: event} : event\n);\n\nconst toArray = <T>(value: T | T[] | undefined): T[] => {\n if (value === undefined) return [];\n return Array.isArray(value) ? value : [value];\n};\n\nconst asDefinition = <TContext, TProps>(\n transition: MachineTransition<TContext, TProps>,\n): MachineTransitionDefinition<TContext, TProps> => (\n typeof transition === 'string' ? {target: transition} : transition\n);\n\nconst isDescendant = (path: string, ancestor: string): boolean => (\n ancestor === ROOT_PATH || path === ancestor || path.startsWith(`${ancestor}.`)\n);\n\nconst createMachine = <TContext, TProps = Record<string, never>>(\n config: MachineConfig<TContext, TProps>,\n options: MachineOptions<TContext, TProps>,\n): Machine<TContext, TProps> => {\n const nodes = new Map<string, RuntimeNode<TContext, TProps>>();\n const ids = new Map<string, string>();\n const listeners = new Set<(snapshot: MachineSnapshot<TContext, TProps>) => void>();\n const entryListeners = new Set<(entry: MachineEntry<TContext, TProps>) => void>();\n const generationCounters = new Map<string, number>();\n const activeGenerations = new Map<string, number>();\n const cleanups = new Map<string, Array<() => void>>();\n const queue: MachineEventObject[] = [];\n let processing = false;\n let stopped = false;\n let order = 0;\n\n const visit = (\n states: Record<string, MachineStateConfig<TContext, TProps>>,\n parent: string,\n ): string[] => Object.entries(states).map(([key, stateConfig]) => {\n const path = parent === ROOT_PATH ? key : `${parent}.${key}`;\n const children = stateConfig.states ? visit(stateConfig.states, path) : [];\n const type = stateConfig.type ?? (children.length > 0 ? 'compound' : 'final');\n const node: RuntimeNode<TContext, TProps> = {\n key,\n path,\n order: order++,\n type,\n children,\n tags: stateConfig.tags ?? [],\n reduce: toArray(stateConfig.reduce),\n entry: toArray(stateConfig.entry),\n exit: toArray(stateConfig.exit),\n on: stateConfig.on ?? {},\n };\n if (stateConfig.id) node.id = stateConfig.id;\n if (parent !== ROOT_PATH) node.parent = parent;\n if (stateConfig.initial) node.initial = stateConfig.initial;\n nodes.set(path, node);\n if (node.id) ids.set(node.id, path);\n return path;\n });\n\n const rootChildren = visit(config.states, ROOT_PATH);\n const root: RuntimeNode<TContext, TProps> = {\n key: ROOT_PATH,\n path: ROOT_PATH,\n order: -1,\n type: config.type ?? 'compound',\n children: rootChildren,\n tags: config.tags ?? [],\n reduce: toArray(config.reduce),\n entry: toArray(config.entry),\n exit: toArray(config.exit),\n on: config.on ?? {},\n };\n if (config.id) root.id = config.id;\n if (config.initial) root.initial = config.initial;\n nodes.set(ROOT_PATH, root);\n if (root.id) ids.set(root.id, ROOT_PATH);\n\n const nodeFor = (path: string): RuntimeNode<TContext, TProps> => {\n const node = nodes.get(path);\n if (!node) throw new Error(`Unknown machine state: ${path}`);\n return node;\n };\n\n const ancestry = (path: string): RuntimeNode<TContext, TProps>[] => {\n const result: RuntimeNode<TContext, TProps>[] = [];\n let cursor: string | undefined = path;\n while (cursor) {\n const node = nodeFor(cursor);\n result.push(node);\n cursor = node.parent ?? (cursor === ROOT_PATH ? undefined : ROOT_PATH);\n }\n return result;\n };\n\n const activeNodesFor = (leaves: readonly string[]): RuntimeNode<TContext, TProps>[] => {\n const paths = new Set<string>();\n leaves.forEach((leaf) => ancestry(leaf).forEach((node) => paths.add(node.path)));\n return Array.from(paths).map(nodeFor).sort((left, right) => left.order - right.order);\n };\n\n const resolveInitialLeaves = (path: string): string[] => {\n const node = nodeFor(path);\n if (node.children.length === 0 || node.type === 'final') return path === ROOT_PATH ? [] : [path];\n if (node.type === 'parallel') return node.children.flatMap(resolveInitialLeaves);\n\n if (!node.initial) throw new Error(`Machine state requires an initial child: ${path}`);\n const explicitPath = path === ROOT_PATH ? node.initial : `${path}.${node.initial}`;\n const initialPath = nodes.has(explicitPath) ? explicitPath : node.initial;\n return resolveInitialLeaves(initialPath);\n };\n\n const resolveTargetPath = (target: string, source: RuntimeNode<TContext, TProps>): string => {\n if (target.startsWith('#')) {\n const byId = ids.get(target.slice(1));\n if (!byId) throw new Error(`Unknown machine state id: ${target}`);\n return byId;\n }\n if (target === ROOT_PATH || nodes.has(target)) return target;\n if (source.parent) {\n const sibling = `${source.parent}.${target}`;\n if (nodes.has(sibling)) return sibling;\n }\n if (nodes.has(target)) return target;\n throw new Error(`Unknown machine state: ${target}`);\n };\n\n const stateValueFor = (leaves: readonly string[]): MachineStateValue => (\n leaves.length === 1 ? leaves[0] as string : Object.freeze([...leaves])\n );\n\n const tagsFor = (leaves: readonly string[]): readonly string[] => Object.freeze(Array.from(new Set(\n activeNodesFor(leaves).flatMap((node) => node.tags),\n )));\n\n const generationsFor = (): Readonly<Record<string, number>> => Object.freeze(Object.fromEntries(activeGenerations));\n\n let activeLeaves = resolveInitialLeaves(ROOT_PATH);\n let snapshot: MachineSnapshot<TContext, TProps> = Object.freeze({\n value: stateValueFor(activeLeaves),\n tags: tagsFor(activeLeaves),\n context: Object.freeze({...options.context}) as Readonly<TContext>,\n props: Object.freeze({...options.props ?? {}}) as Readonly<TProps>,\n generations: Object.freeze({}),\n });\n\n const makeScope = (\n event: MachineEventObject,\n currentSnapshot: MachineSnapshot<TContext, TProps> = snapshot,\n ): MachineScope<TContext, TProps> => ({\n snapshot: currentSnapshot,\n context: currentSnapshot.context,\n props: currentSnapshot.props,\n event,\n state: currentSnapshot.value,\n });\n\n const cleanupKey = (path: string): string => `${path}:${activeGenerations.get(path) ?? 0}`;\n\n const rememberCleanup = (path: string, cleanup: void | (() => void)): void => {\n if (typeof cleanup !== 'function') return;\n const key = cleanupKey(path);\n const stack = cleanups.get(key) ?? [];\n stack.push(cleanup);\n cleanups.set(key, stack);\n };\n\n const runCleanups = (path: string): void => {\n const key = cleanupKey(path);\n const stack = cleanups.get(key);\n if (!stack) return;\n stack.splice(0).reverse().forEach((cleanup) => cleanup());\n cleanups.delete(key);\n };\n\n const effectFor = (ref: MachineEffectRef<TContext, TProps>): MachineEffect<TContext, TProps> | undefined => (\n typeof ref === 'function' ? ref : options.effects?.[ref]\n );\n\n const runEffects = (\n refs: MachineEffectRef<TContext, TProps>[],\n event: MachineEventObject,\n path: string,\n remember = true,\n ): void => {\n refs.forEach((ref) => {\n const effect = effectFor(ref);\n if (!effect) throw new Error(`Unknown machine effect: ${String(ref)}`);\n const cleanup = effect(makeScope(event));\n if (remember) rememberCleanup(path, cleanup);\n });\n };\n\n const reducerFor = (ref: MachineReducerRef<TContext, TProps>): MachineReducer<TContext, TProps> | undefined => (\n typeof ref === 'function' ? ref : options.reducers?.[ref]\n );\n\n const applyReducers = (\n refs: MachineReducerRef<TContext, TProps>[],\n event: MachineEventObject,\n base: MachineSnapshot<TContext, TProps>,\n ): Pick<MachineSnapshot<TContext, TProps>, 'context' | 'props'> => {\n const contextUpdates: Partial<TContext> = {};\n const propUpdates: Partial<TProps> = {};\n const contextKeys = new Set<PropertyKey>();\n const propKeys = new Set<PropertyKey>();\n\n refs.forEach((ref) => {\n const reducer = reducerFor(ref);\n if (!reducer) throw new Error(`Unknown machine reducer: ${String(ref)}`);\n const update = reducer(makeScope(event, base));\n if (!update) return;\n\n Reflect.ownKeys(update.context ?? {}).forEach((key) => {\n if (contextKeys.has(key)) throw new Error(`Conflicting machine context update: ${String(key)}`);\n contextKeys.add(key);\n Reflect.set(contextUpdates as object, key, Reflect.get(update.context as object, key));\n });\n Reflect.ownKeys(update.props ?? {}).forEach((key) => {\n if (propKeys.has(key)) throw new Error(`Conflicting machine prop update: ${String(key)}`);\n propKeys.add(key);\n Reflect.set(propUpdates as object, key, Reflect.get(update.props as object, key));\n });\n });\n\n return {\n context: Object.freeze({...base.context, ...contextUpdates}) as Readonly<TContext>,\n props: Object.freeze({...base.props, ...propUpdates}) as Readonly<TProps>,\n };\n };\n\n const guardAllows = (\n guard: MachineTransitionDefinition<TContext, TProps>['guard'],\n event: MachineEventObject,\n base: MachineSnapshot<TContext, TProps>,\n ): boolean => {\n if (!guard) return true;\n const resolved = typeof guard === 'function' ? guard : options.guards?.[guard];\n if (!resolved) throw new Error(`Unknown machine guard: ${String(guard)}`);\n return resolved(makeScope(event, base));\n };\n\n const selectTransitions = (\n event: MachineEventObject,\n base: MachineSnapshot<TContext, TProps>,\n ): SelectedTransition<TContext, TProps>[] => {\n const selectedBySource = new Map<string, SelectedTransition<TContext, TProps>>();\n\n activeLeaves.forEach((leaf) => {\n for (const source of ancestry(leaf)) {\n const candidate = toArray(source.on[event.type])\n .map(asDefinition<TContext, TProps>)\n .find((definition) => guardAllows(definition.guard, event, base));\n if (candidate) selectedBySource.set(source.path, {source, definition: candidate});\n }\n });\n\n const selected = Array.from(selectedBySource.values());\n return selected.filter((candidate) => !selected.some((other) => (\n other !== candidate && isDescendant(candidate.source.path, other.source.path)\n ))).sort((left, right) => left.source.order - right.source.order);\n };\n\n const commonAncestor = (left: string, right: string): string => {\n const rightPaths = new Set(ancestry(right).map((node) => node.path));\n return ancestry(left).find((node) => rightPaths.has(node.path))?.path ?? ROOT_PATH;\n };\n\n const transitionBoundary = (source: string, target: string): string => {\n const lca = commonAncestor(source, target);\n if (source === target || lca === source) return source;\n const sourceAncestry = ancestry(source);\n const lcaIndex = sourceAncestry.findIndex((node) => node.path === lca);\n return sourceAncestry[Math.max(0, lcaIndex - 1)]?.path ?? source;\n };\n\n const nextLeavesFor = (selected: SelectedTransition<TContext, TProps>[]): string[] => {\n let next = [...activeLeaves];\n selected.forEach(({source, definition}) => {\n if (!definition.target) return;\n const targetPath = resolveTargetPath(definition.target, source);\n const boundary = transitionBoundary(source.path, targetPath);\n next = next.filter((leaf) => !isDescendant(leaf, boundary));\n next.push(...resolveInitialLeaves(targetPath));\n });\n return Array.from(new Set(next)).sort((left, right) => nodeFor(left).order - nodeFor(right).order);\n };\n\n const processEvent = (event: MachineEventObject): void => {\n if (\n typeof event.__state === 'string'\n && typeof event.__generation === 'number'\n && activeGenerations.get(event.__state) !== event.__generation\n ) return;\n\n const previous = snapshot;\n const selected = selectTransitions(event, previous);\n if (selected.length === 0) return;\n\n const nextLeaves = nextLeavesFor(selected);\n const previousNodes = activeNodesFor(activeLeaves);\n const nextNodes = activeNodesFor(nextLeaves);\n const previousPaths = new Set(previousNodes.map((node) => node.path));\n const nextPaths = new Set(nextNodes.map((node) => node.path));\n const reentryPaths = selected.flatMap(({source, definition}) => {\n if (!definition.target) return [];\n const target = resolveTargetPath(definition.target, source);\n return target === source.path ? previousNodes.filter((node) => isDescendant(node.path, source.path)).map((node) => node.path) : [];\n });\n const forcedReentry = new Set(reentryPaths);\n const exitNodes = previousNodes\n .filter((node) => !nextPaths.has(node.path) || forcedReentry.has(node.path))\n .sort((left, right) => right.path.split('.').length - left.path.split('.').length || right.order - left.order);\n const entryNodes = nextNodes\n .filter((node) => !previousPaths.has(node.path) || forcedReentry.has(node.path))\n .sort((left, right) => left.path.split('.').length - right.path.split('.').length || left.order - right.order);\n\n exitNodes.forEach((node) => {\n runCleanups(node.path);\n runEffects(node.exit, event, node.path, false);\n activeGenerations.delete(node.path);\n });\n\n const reducerRefs = [\n ...selected.flatMap(({definition}) => toArray(definition.reduce)),\n ...entryNodes.flatMap((node) => node.reduce),\n ];\n const reduced = applyReducers(reducerRefs, event, previous);\n\n entryNodes.forEach((node) => {\n const generation = (generationCounters.get(node.path) ?? 0) + 1;\n generationCounters.set(node.path, generation);\n activeGenerations.set(node.path, generation);\n });\n\n activeLeaves = nextLeaves;\n snapshot = Object.freeze({\n value: stateValueFor(activeLeaves),\n tags: tagsFor(activeLeaves),\n context: reduced.context,\n props: reduced.props,\n generations: generationsFor(),\n });\n\n selected.forEach(({source, definition}) => runEffects(\n toArray(definition.effects),\n event,\n source.path,\n ));\n entryNodes.forEach((node) => runEffects(node.entry, event, node.path));\n listeners.forEach((listener) => listener(snapshot));\n entryNodes.forEach((node) => {\n const generation = activeGenerations.get(node.path);\n if (generation === undefined) return;\n const entry: MachineEntry<TContext, TProps> = Object.freeze({\n path: node.path,\n generation,\n from: previous.value,\n to: snapshot.value,\n event,\n snapshot,\n });\n entryListeners.forEach((listener) => listener(entry));\n });\n };\n\n const machine: Machine<TContext, TProps> = {\n get state() {\n return snapshot.value;\n },\n get context() {\n return snapshot.context;\n },\n get props() {\n return snapshot.props;\n },\n getSnapshot() {\n return snapshot;\n },\n send(event) {\n if (stopped) return;\n queue.push(toEventObject(event));\n if (processing) return;\n\n processing = true;\n try {\n while (queue.length > 0 && !stopped) processEvent(queue.shift() as MachineEventObject);\n } finally {\n processing = false;\n }\n },\n subscribe(listener) {\n if (stopped) return () => {};\n listeners.add(listener);\n return () => listeners.delete(listener);\n },\n subscribeEntries(listener) {\n if (stopped) return () => {};\n entryListeners.add(listener);\n return () => entryListeners.delete(listener);\n },\n matches(state) {\n return activeLeaves.some((leaf) => leaf === state || leaf.split('.').at(-1) === state || isDescendant(leaf, state));\n },\n hasTag(tag) {\n return snapshot.tags.includes(tag);\n },\n stop() {\n if (stopped) return;\n activeNodesFor(activeLeaves)\n .sort((left, right) => right.path.split('.').length - left.path.split('.').length || right.order - left.order)\n .forEach((node) => runCleanups(node.path));\n listeners.clear();\n entryListeners.clear();\n queue.splice(0);\n activeGenerations.clear();\n stopped = true;\n },\n };\n\n activeNodesFor(activeLeaves).forEach((node) => {\n const generation = (generationCounters.get(node.path) ?? 0) + 1;\n generationCounters.set(node.path, generation);\n activeGenerations.set(node.path, generation);\n });\n const initialReducers = activeNodesFor(activeLeaves).flatMap((node) => node.reduce);\n const initialReduced = applyReducers(initialReducers, INIT_EVENT, snapshot);\n snapshot = Object.freeze({\n value: stateValueFor(activeLeaves),\n tags: tagsFor(activeLeaves),\n context: initialReduced.context,\n props: initialReduced.props,\n generations: generationsFor(),\n });\n activeNodesFor(activeLeaves).forEach((node) => runEffects(node.entry, INIT_EVENT, node.path));\n\n return machine;\n};\n\nexport {createMachine};\nexport type {\n Machine,\n MachineConfig,\n MachineEffect,\n MachineEffectList,\n MachineEffectRef,\n MachineEntry,\n MachineEvent,\n MachineEventObject,\n MachineGuard,\n MachineOptions,\n MachineReducer,\n MachineReducerList,\n MachineReducerRef,\n MachineScope,\n MachineSnapshot,\n MachineStateConfig,\n MachineStateValue,\n MachineTransition,\n MachineTransitionDefinition,\n MachineUpdate,\n};\n"],"mappings":"gDAAA,IAAM,EAAY,GACd,OAAO,GAAU,YACd,GACA,EAAE,aAAiB,WACnB,EAAE,aAAiB,kBACnB,EAAE,aAAiB,kBACnB,EAAE,aAAiB,OACnB,EAAE,aAAiB,aAGpB,EAAwB,GAAgB,gBAAgB,CAAK,EAE7D,GAAuB,EAAe,IAA4B,CACpE,GAAI,OAAO,GAAG,EAAM,CAAK,EAAG,MAAO,GACnC,GAAI,MAAM,QAAQ,CAAI,GAAK,MAAM,QAAQ,CAAK,EAC1C,OAAO,MAAM,QAAQ,CAAI,GAClB,MA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