@lostgradient/cinder 0.8.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/README.md +2 -2
- package/components.json +140 -18
- package/dist/components/_internal/command-list-context.d.ts +3 -3
- package/dist/components/_internal/create-command-list-state.svelte.d.ts +11 -11
- package/dist/components/access-gate/index.js +435 -218
- package/dist/components/approval-card/approval-card-actions.svelte.d.ts +16 -0
- package/dist/components/approval-card/approval-card-state.d.ts +65 -0
- package/dist/components/approval-card/approval-card.css +269 -92
- package/dist/components/approval-card/approval-card.schema.js +10 -31
- package/dist/components/approval-card/approval-card.svelte.d.ts +3 -3
- package/dist/components/approval-card/approval-card.types.d.ts +14 -28
- package/dist/components/approval-card/index.d.ts +1 -1
- package/dist/components/approval-card/index.js +4268 -2884
- package/dist/components/card/card.css +5 -0
- package/dist/components/card/card.schema.js +2 -2
- package/dist/components/card/card.types.d.ts +2 -2
- package/dist/components/card/index.js +2 -1
- package/dist/components/chat/builders.d.ts +17 -8
- package/dist/components/chat/chat.schema.js +44 -2
- package/dist/components/chat/chat.svelte.d.ts +4 -2
- package/dist/components/chat/chat.types.d.ts +34 -3
- package/dist/components/chat/container/chat.svelte.d.ts +4 -2
- package/dist/components/chat/conversation-model.d.ts +1 -1
- package/dist/components/chat/index.d.ts +4 -4
- package/dist/components/chat/index.js +2767 -6278
- package/dist/components/chat/input/chat-attachment-serialization.d.ts +9 -0
- package/dist/components/chat/input/chat-input.svelte.d.ts +22 -1
- package/dist/components/chat/input/index.d.ts +1 -0
- package/dist/components/chat/utilities/conversation.d.ts +6 -6
- package/dist/components/chat-composer-popover/chat-composer-popover-filter.d.ts +11 -0
- package/dist/components/chat-composer-popover/chat-composer-popover.css +7 -0
- package/dist/components/chat-composer-popover/chat-composer-popover.css.d.ts +1 -0
- package/dist/components/chat-composer-popover/chat-composer-popover.schema.d.ts +3 -0
- package/dist/components/chat-composer-popover/chat-composer-popover.schema.js +150 -0
- package/dist/components/chat-composer-popover/chat-composer-popover.svelte.d.ts +46 -0
- package/dist/components/chat-composer-popover/chat-composer-popover.types.d.ts +77 -0
- package/dist/components/chat-composer-popover/chat-composer-popover.variables.d.ts +2 -0
- package/dist/components/chat-composer-popover/chat-composer-popover.variables.js +61 -0
- package/dist/components/chat-composer-popover/index.d.ts +6 -0
- package/dist/components/chat-composer-popover/index.js +3285 -0
- package/dist/components/chat-conversation-header/index.js +577 -4537
- package/dist/components/chat-conversation-list/index.js +24 -3984
- package/dist/components/code-block/code-block.schema.js +5 -1
- package/dist/components/code-block/code-block.types.d.ts +6 -0
- package/dist/components/code-block/index.js +4 -4
- package/dist/components/command-item/index.js +7 -6
- package/dist/components/command-menu/command-menu.schema.js +5 -1
- package/dist/components/command-menu/command-menu.types.d.ts +2 -0
- package/dist/components/command-menu/index.js +48 -19
- package/dist/components/command-palette/index.js +40 -14
- package/dist/components/connection-indicator/connection-indicator.css +136 -0
- package/dist/components/connection-indicator/connection-indicator.css.d.ts +1 -0
- package/dist/components/connection-indicator/connection-indicator.schema.d.ts +3 -0
- package/dist/components/connection-indicator/connection-indicator.schema.js +89 -0
- package/dist/components/connection-indicator/connection-indicator.svelte.d.ts +21 -0
- package/dist/components/connection-indicator/connection-indicator.types.d.ts +46 -0
- package/dist/components/connection-indicator/connection-indicator.variables.d.ts +2 -0
- package/dist/components/connection-indicator/connection-indicator.variables.js +61 -0
- package/dist/components/connection-indicator/index.d.ts +5 -0
- package/dist/components/connection-indicator/index.js +409 -0
- package/dist/components/container/container.schema.js +4 -4
- package/dist/components/event-stream-viewer/index.js +44 -44
- package/dist/components/experimental/json-viewer/index.js +44 -44
- package/dist/components/invocation-rule-builder/index.d.ts +1 -1
- package/dist/components/invocation-rule-builder/index.js +305 -150
- package/dist/components/invocation-rule-builder/invocation-rule-builder.css +28 -0
- package/dist/components/invocation-rule-builder/invocation-rule-builder.schema.js +89 -5
- package/dist/components/invocation-rule-builder/invocation-rule-builder.svelte.d.ts +2 -1
- package/dist/components/invocation-rule-builder/invocation-rule-builder.types.d.ts +114 -16
- package/dist/components/json-schema-editor/index.js +5 -2
- package/dist/components/json-viewer/index.js +44 -44
- package/dist/components/json-viewer/json-viewer.css +10 -6
- package/dist/components/payload-inspector/index.d.ts +1 -1
- package/dist/components/payload-inspector/index.js +306 -1422
- package/dist/components/payload-inspector/payload-inspector.css +15 -75
- package/dist/components/payload-inspector/payload-inspector.schema.js +5 -41
- package/dist/components/payload-inspector/payload-inspector.svelte.d.ts +5 -5
- package/dist/components/payload-inspector/payload-inspector.types.d.ts +10 -56
- package/dist/components/run-step-timeline/index.d.ts +1 -1
- package/dist/components/run-step-timeline/index.js +992 -559
- package/dist/components/run-step-timeline/run-step-branch-disclosure.svelte.d.ts +17 -0
- package/dist/components/run-step-timeline/run-step-timeline.css +124 -0
- package/dist/components/run-step-timeline/run-step-timeline.schema.js +873 -350
- package/dist/components/run-step-timeline/run-step-timeline.svelte.d.ts +1 -15
- package/dist/components/run-step-timeline/run-step-timeline.types.d.ts +182 -5
- package/dist/components/run-step-timeline/run-step-timeline.utilities.d.ts +52 -0
- package/dist/components/schedule-builder/index.d.ts +5 -0
- package/dist/components/schedule-builder/index.js +3176 -0
- package/dist/components/schedule-builder/schedule-builder.css +121 -0
- package/dist/components/schedule-builder/schedule-builder.css.d.ts +1 -0
- package/dist/components/schedule-builder/schedule-builder.schema.d.ts +3 -0
- package/dist/components/schedule-builder/schedule-builder.schema.js +141 -0
- package/dist/components/schedule-builder/schedule-builder.svelte.d.ts +22 -0
- package/dist/components/schedule-builder/schedule-builder.types.d.ts +130 -0
- package/dist/components/schedule-builder/schedule-builder.utilities.d.ts +78 -0
- package/dist/components/schedule-builder/schedule-builder.variables.d.ts +2 -0
- package/dist/components/schedule-builder/schedule-builder.variables.js +61 -0
- package/dist/components/tab/index.js +5 -2
- package/dist/components/tab/tab.schema.js +7 -3
- package/dist/components/tab/tab.svelte.d.ts +2 -1
- package/dist/components/tab/tab.types.d.ts +8 -2
- package/dist/components/tabs/index.js +5 -2
- package/dist/components/tag-input/index.js +22 -4
- package/dist/components/tag-input/tag-input.schema.js +5 -1
- package/dist/components/tag-input/tag-input.types.d.ts +4 -0
- package/dist/components/team-section/index.js +2 -1
- package/dist/components/testimonial-section/index.js +2 -1
- package/dist/index.d.ts +10 -4
- package/dist/index.js +28577 -30168
- package/dist/server/components/access-gate/index.js +3 -1
- package/dist/server/components/accordion/index.js +2 -2
- package/dist/server/components/alert-dialog/index.js +2 -2
- package/dist/server/components/approval-card/index.js +15 -19
- package/dist/server/components/autocomplete/index.js +7 -7
- package/dist/server/components/avatar-group/index.js +5 -5
- package/dist/server/components/button-group/index.js +3 -5
- package/dist/server/components/card/index.js +2 -2
- package/dist/server/components/chat/index.js +15 -12
- package/dist/server/components/chat-composer-popover/index.js +26 -0
- package/dist/server/components/chat-conversation-header/index.js +10 -11
- package/dist/server/components/chat-conversation-list/index.js +4 -5
- package/dist/server/components/checkbox/index.js +3 -3
- package/dist/server/components/choice-grid/index.js +2 -2
- package/dist/server/components/code-block/index.js +2 -2
- package/dist/server/components/color-field/index.js +3 -3
- package/dist/server/components/combobox/index.js +6 -6
- package/dist/server/components/command-item/index.js +5 -3
- package/dist/server/components/command-menu/index.js +6 -4
- package/dist/server/components/command-palette/index.js +2 -2
- package/dist/server/components/confirm-dialog/index.js +2 -2
- package/dist/server/components/connection-indicator/index.js +16 -0
- package/dist/server/components/context-menu/index.js +5 -5
- package/dist/server/components/data-table/index.js +5 -5
- package/dist/server/components/date-picker/index.js +6 -6
- package/dist/server/components/date-range-field/index.js +7 -7
- package/dist/server/components/description-list/index.js +3 -5
- package/dist/server/components/diff-viewer/index.js +9 -8
- package/dist/server/components/drawer/index.js +3 -3
- package/dist/server/components/dropdown/index.js +4 -4
- package/dist/server/components/event-stream-viewer/index.js +2 -2
- package/dist/server/components/experimental/json-viewer/index.js +2 -2
- package/dist/server/components/faceted-filter-bar/index.js +1 -1
- package/dist/server/components/hover-card/index.js +1 -1
- package/dist/server/components/input/index.js +3 -3
- package/dist/server/components/invocation-rule-builder/index.js +1 -1
- package/dist/server/components/json-schema-editor/index.js +24 -23
- package/dist/server/components/json-viewer/index.js +2 -2
- package/dist/server/components/markdown-editor/index.js +13 -13
- package/dist/server/components/modal/index.js +1 -1
- package/dist/server/components/multi-select/index.js +1 -1
- package/dist/server/components/newsletter-section/index.js +3 -3
- package/dist/server/components/payload-inspector/index.js +4 -16
- package/dist/server/components/popover/index.js +5 -5
- package/dist/server/components/review-editor/index.js +27 -26
- package/dist/server/components/run-step-timeline/index.js +2 -2
- package/dist/server/components/schedule-builder/index.js +30 -0
- package/dist/server/components/schema-form/index.js +4 -4
- package/dist/server/components/secret-value-field/index.js +3 -5
- package/dist/server/components/segment/index.js +3 -3
- package/dist/server/components/segmented-control/index.js +4 -4
- package/dist/server/components/selection-popover/index.js +4 -4
- package/dist/server/components/sheet/index.js +2 -2
- package/dist/server/components/side-navigation/index.js +2 -2
- package/dist/server/components/sidebar/index.js +3 -3
- package/dist/server/components/tab/index.js +2 -2
- package/dist/server/components/table/index.js +3 -3
- package/dist/server/components/tabs/index.js +4 -4
- package/dist/server/components/tag-input/index.js +3 -3
- package/dist/server/components/team-section/index.js +8 -8
- package/dist/server/components/testimonial-section/index.js +2 -2
- package/dist/server/components/time-field/index.js +5 -3
- package/dist/server/components/toggle/index.js +2 -2
- package/dist/server/components/tooltip/index.js +1 -1
- package/dist/server/index.js +235 -211
- package/dist/server/{index.server-20y4mdhm.js → index.server-0chhpkg7.js} +40 -14
- package/dist/server/index.server-0sx92swg.js +9 -0
- package/dist/server/{index.server-ecm1vs3g.js → index.server-1nq7z1qw.js} +1 -1
- package/dist/server/{index.server-s9khh4ry.js → index.server-2bbwajb2.js} +3 -5
- package/dist/server/index.server-2hqrv7ca.js +9 -0
- package/dist/server/{index.server-69epaape.js → index.server-2qj6s2mh.js} +1 -1
- package/dist/server/{index.server-gxf0d1p5.js → index.server-2s5h1d05.js} +2 -2
- package/dist/server/{index.server-qfa2rxzx.js → index.server-2zdbz3rj.js} +3 -5
- package/dist/server/{index.server-pt8b65mt.js → index.server-38aywdk1.js} +1 -1
- package/dist/server/{index.server-0jhra85x.js → index.server-3w72dxz7.js} +4 -4
- package/dist/server/{index.server-rermas0k.js → index.server-47v2fhp4.js} +4 -4
- package/dist/server/{index.server-v4zabrsx.js → index.server-4x4hgvqe.js} +434 -26
- package/dist/server/{index.server-9j5sym59.js → index.server-4x91gzy1.js} +2 -2
- package/dist/server/{index.server-q48q15g7.js → index.server-4y2jtvv1.js} +4 -2
- package/dist/server/{index.server-j3ddzcaa.js → index.server-5gzyqv78.js} +6 -6
- package/dist/server/index.server-67qgdypc.js +9 -0
- package/dist/server/index.server-6hnfzc7f.js +263 -0
- package/dist/server/{index.server-9jete4xx.js → index.server-6sh11ap6.js} +4 -4
- package/dist/server/{index.server-4ztq565m.js → index.server-85p4ydph.js} +1 -1
- package/dist/server/{index.server-4nk7gy0q.js → index.server-894t97kv.js} +1 -1
- package/dist/server/{index.server-1vscnped.js → index.server-8dt36sdm.js} +2 -1
- package/dist/server/{index.server-bfsbp9dz.js → index.server-8xvc73zh.js} +4 -4
- package/dist/server/{index.server-cvnw3hw9.js → index.server-9kz37z89.js} +1 -1
- package/dist/server/{index.server-kc1k02tk.js → index.server-9ykk1kbg.js} +1 -1
- package/dist/server/{index.server-g789yep6.js → index.server-aqethy0w.js} +2 -2
- package/dist/server/index.server-be9bpqeh.js +93 -0
- package/dist/server/{index.server-wc9aggfz.js → index.server-bmxbsk4y.js} +7 -7
- package/dist/server/{index.server-f3z7tpxr.js → index.server-c42b462p.js} +2 -4
- package/dist/server/{index.server-7vyzen5x.js → index.server-c5qv3p61.js} +171 -63
- package/dist/server/index.server-cch0eed5.js +144 -0
- package/dist/server/{index.server-q89dz8h1.js → index.server-d3pqthtp.js} +4 -3
- package/dist/server/{index.server-jk4rx4aa.js → index.server-dmmvwy6p.js} +1 -1
- package/dist/server/{index.server-hcfnae5y.js → index.server-dwwqssey.js} +4 -4
- package/dist/server/{index.server-e8x1hgw6.js → index.server-dz1r9xw5.js} +4 -4
- package/dist/server/{index.server-wm7mk5kw.js → index.server-ez5hp0ya.js} +1 -1
- package/dist/server/{index.server-wc8dbm5e.js → index.server-g95bk8rc.js} +4 -2
- package/dist/server/index.server-gkazv439.js +576 -0
- package/dist/server/index.server-gmh5ar16.js +2 -0
- package/dist/server/{index.server-dp9j2kkr.js → index.server-h0cvwvhy.js} +1 -1
- package/dist/server/{index.server-cbtg8rq5.js → index.server-h89zk5ev.js} +8 -8
- package/dist/server/{index.server-pacrqvyz.js → index.server-h90pjrez.js} +1 -1
- package/dist/server/{index.server-p8d04em5.js → index.server-hcsd5gdb.js} +6 -2
- package/dist/server/{index.server-n39drzes.js → index.server-hpeavvnq.js} +1 -1
- package/dist/server/{index.server-1p3patnj.js → index.server-hx91ng7z.js} +1 -1
- package/dist/server/{index.server-mehav5vs.js → index.server-jdcq5zza.js} +7 -7
- package/dist/server/{index.server-jync915v.js → index.server-jfrssta6.js} +25 -25
- package/dist/server/{index.server-jtj3r53y.js → index.server-jgb8yh5k.js} +1 -1
- package/dist/server/{index.server-ejyf7e48.js → index.server-jj76374p.js} +1 -1
- package/dist/server/{index.server-w1g5q9j9.js → index.server-jtgw9d23.js} +4 -2
- package/dist/server/{index.server-hd8gpehd.js → index.server-jxseyx33.js} +1 -1
- package/dist/server/{index.server-kg2sepsr.js → index.server-krqvnt6p.js} +14 -15
- package/dist/server/{index.server-0e1m3agz.js → index.server-ks49bprh.js} +1 -1
- package/dist/server/{index.server-f0hma3jp.js → index.server-kt0ncrqs.js} +1 -1
- package/dist/server/index.server-m0ezemav.js +170 -0
- package/dist/server/index.server-m191rm44.js +79 -0
- package/dist/server/{index.server-z721a5gp.js → index.server-n82rcv0m.js} +4 -4
- package/dist/server/{index.server-rhhmdxtz.js → index.server-np3c7kx0.js} +4 -4
- package/dist/server/{index.server-hpcs7tmh.js → index.server-p56xxef1.js} +1 -1
- package/dist/server/{index.server-w83kmcrx.js → index.server-pag862vz.js} +10 -10
- package/dist/server/index.server-qbkxz7r2.js +750 -0
- package/dist/server/{index.server-sh2rxejg.js → index.server-qke3ekjt.js} +1 -1
- package/dist/server/{index.server-73x2d3j3.js → index.server-rbpvcrr3.js} +1 -1
- package/dist/server/{index.server-8cxs4kya.js → index.server-rga8sc7j.js} +41 -44
- package/dist/server/{index.server-e3fnv1g6.js → index.server-sedjxt36.js} +5 -5
- package/dist/server/{index.server-pen9pxt6.js → index.server-sf3nk3j2.js} +2 -2
- package/dist/server/{index.server-f23vtaw4.js → index.server-tcay903b.js} +8 -7
- package/dist/server/{index.server-7fp0epev.js → index.server-veastatv.js} +4 -4
- package/dist/server/{index.server-jeqg2d22.js → index.server-xeqtpv61.js} +1 -1
- package/dist/server/{index.server-9s4na701.js → index.server-xjnge1yw.js} +4 -4
- package/dist/server/index.server-xtjjmsyq.js +315 -0
- package/dist/server/{index.server-hhxjaeen.js → index.server-xz99aed4.js} +4 -4
- package/dist/server/{index.server-vne4rzfa.js → index.server-y4n8vc08.js} +1 -1
- package/dist/server/{index.server-5d01cn4f.js → index.server-y83kqayt.js} +4 -4
- package/dist/server/{index.server-1nh09ck7.js → index.server-yhzydqxe.js} +5 -5
- package/dist/server/index.server-z38bxms8.js +734 -0
- package/dist/server/{index.server-atjc1qcq.js → index.server-z7hxtqs1.js} +1 -1
- package/dist/server/{index.server-w6k62afr.js → index.server-ze1ymmbw.js} +2 -2
- package/dist/server/{index.server-914v805w.js → index.server-zgd1g8mk.js} +1 -1
- package/dist/server/{index.server-aeexcxdp.js → index.server-zh3r8vfd.js} +1 -1
- package/dist/server/{index.server-10jb2jzm.js → index.server-zsjf8enc.js} +4 -4
- package/package.json +102 -5
- package/src/components/_internal/command-list-context.ts +3 -3
- package/src/components/_internal/create-command-list-state.svelte.ts +39 -13
- package/src/components/approval-card/approval-card-actions.svelte +168 -0
- package/src/components/approval-card/approval-card-state.ts +152 -1
- package/src/components/approval-card/approval-card.css +269 -92
- package/src/components/approval-card/approval-card.examples.json +3 -3
- package/src/components/approval-card/approval-card.schema.json +9 -30
- package/src/components/approval-card/approval-card.schema.ts +13 -31
- package/src/components/approval-card/approval-card.svelte +176 -470
- package/src/components/approval-card/approval-card.types.ts +15 -28
- package/src/components/approval-card/index.ts +1 -0
- package/src/components/card/card.css +5 -0
- package/src/components/card/card.schema.json +1 -1
- package/src/components/card/card.schema.ts +1 -1
- package/src/components/card/card.svelte +1 -0
- package/src/components/card/card.types.ts +2 -2
- package/src/components/chat/builders.ts +445 -14
- package/src/components/chat/chat.schema.json +36 -1
- package/src/components/chat/chat.schema.ts +44 -1
- package/src/components/chat/chat.svelte +12 -0
- package/src/components/chat/chat.types.ts +35 -3
- package/src/components/chat/container/chat.svelte +73 -3
- package/src/components/chat/conversation-model.ts +1 -0
- package/src/components/chat/index.ts +16 -3
- package/src/components/chat/input/chat-attachment-serialization.ts +63 -0
- package/src/components/chat/input/chat-input.svelte +22 -5
- package/src/components/chat/input/index.ts +5 -0
- package/src/components/chat/utilities/conversation.ts +33 -15
- package/src/components/chat-composer-popover/chat-composer-popover-filter.ts +68 -0
- package/src/components/chat-composer-popover/chat-composer-popover.css +7 -0
- package/src/components/chat-composer-popover/chat-composer-popover.examples.json +13 -0
- package/src/components/chat-composer-popover/chat-composer-popover.schema.json +90 -0
- package/src/components/chat-composer-popover/chat-composer-popover.schema.ts +95 -0
- package/src/components/chat-composer-popover/chat-composer-popover.svelte +234 -0
- package/src/components/chat-composer-popover/chat-composer-popover.types.ts +88 -0
- package/src/components/chat-composer-popover/chat-composer-popover.variables.json +1 -0
- package/src/components/chat-composer-popover/chat-composer-popover.variables.ts +3 -0
- package/src/components/chat-composer-popover/index.ts +19 -0
- package/src/components/code-block/code-block.schema.json +4 -0
- package/src/components/code-block/code-block.schema.ts +5 -0
- package/src/components/code-block/code-block.svelte +3 -3
- package/src/components/code-block/code-block.types.ts +6 -0
- package/src/components/command-item/command-item.svelte +7 -6
- package/src/components/command-menu/command-menu.schema.json +4 -0
- package/src/components/command-menu/command-menu.schema.ts +4 -0
- package/src/components/command-menu/command-menu.svelte +16 -5
- package/src/components/command-menu/command-menu.types.ts +2 -0
- package/src/components/connection-indicator/connection-indicator.css +136 -0
- package/src/components/connection-indicator/connection-indicator.examples.json +31 -0
- package/src/components/connection-indicator/connection-indicator.schema.json +29 -0
- package/src/components/connection-indicator/connection-indicator.schema.ts +36 -0
- package/src/components/connection-indicator/connection-indicator.svelte +63 -0
- package/src/components/connection-indicator/connection-indicator.types.ts +58 -0
- package/src/components/connection-indicator/connection-indicator.variables.json +1 -0
- package/src/components/connection-indicator/connection-indicator.variables.ts +3 -0
- package/src/components/connection-indicator/index.ts +10 -0
- package/src/components/container/container.schema.json +3 -3
- package/src/components/container/container.schema.ts +3 -3
- package/src/components/invocation-rule-builder/index.ts +4 -0
- package/src/components/invocation-rule-builder/invocation-rule-builder.css +28 -0
- package/src/components/invocation-rule-builder/invocation-rule-builder.examples.json +6 -0
- package/src/components/invocation-rule-builder/invocation-rule-builder.schema.json +76 -3
- package/src/components/invocation-rule-builder/invocation-rule-builder.schema.ts +83 -3
- package/src/components/invocation-rule-builder/invocation-rule-builder.svelte +326 -113
- package/src/components/invocation-rule-builder/invocation-rule-builder.types.ts +157 -43
- package/src/components/json-viewer/_json-viewer-node.svelte +15 -1
- package/src/components/json-viewer/json-viewer.css +10 -6
- package/src/components/payload-inspector/index.ts +0 -2
- package/src/components/payload-inspector/payload-inspector.css +15 -75
- package/src/components/payload-inspector/payload-inspector.examples.json +5 -5
- package/src/components/payload-inspector/payload-inspector.schema.json +3 -31
- package/src/components/payload-inspector/payload-inspector.schema.ts +3 -36
- package/src/components/payload-inspector/payload-inspector.svelte +46 -239
- package/src/components/payload-inspector/payload-inspector.types.ts +10 -58
- package/src/components/run-step-timeline/index.ts +8 -0
- package/src/components/run-step-timeline/run-step-branch-disclosure.svelte +16 -0
- package/src/components/run-step-timeline/run-step-timeline.css +124 -0
- package/src/components/run-step-timeline/run-step-timeline.examples.json +18 -0
- package/src/components/run-step-timeline/run-step-timeline.schema.json +872 -349
- package/src/components/run-step-timeline/run-step-timeline.schema.ts +931 -349
- package/src/components/run-step-timeline/run-step-timeline.svelte +387 -268
- package/src/components/run-step-timeline/run-step-timeline.types.ts +192 -5
- package/src/components/run-step-timeline/run-step-timeline.utilities.ts +242 -0
- package/src/components/schedule-builder/index.ts +14 -0
- package/src/components/schedule-builder/schedule-builder.css +121 -0
- package/src/components/schedule-builder/schedule-builder.examples.json +31 -0
- package/src/components/schedule-builder/schedule-builder.schema.json +78 -0
- package/src/components/schedule-builder/schedule-builder.schema.ts +86 -0
- package/src/components/schedule-builder/schedule-builder.svelte +629 -0
- package/src/components/schedule-builder/schedule-builder.types.ts +137 -0
- package/src/components/schedule-builder/schedule-builder.utilities.ts +344 -0
- package/src/components/schedule-builder/schedule-builder.variables.json +1 -0
- package/src/components/schedule-builder/schedule-builder.variables.ts +3 -0
- package/src/components/tab/tab.schema.json +6 -2
- package/src/components/tab/tab.schema.ts +8 -2
- package/src/components/tab/tab.svelte +9 -5
- package/src/components/tab/tab.types.ts +8 -2
- package/src/components/tag-input/tag-input.schema.json +4 -0
- package/src/components/tag-input/tag-input.schema.ts +4 -0
- package/src/components/tag-input/tag-input.svelte +20 -3
- package/src/components/tag-input/tag-input.types.ts +4 -0
- package/src/index.ts +41 -5
- package/src/styles/components.css +3 -0
- package/dist/server/index-49we2xfs.js +0 -344
- package/dist/server/index-8fhvxk30.js +0 -265
- package/dist/server/index-x2ysg8ds.js +0 -388
- package/dist/server/index.server-20j0jh30.js +0 -9
- package/dist/server/index.server-dc35kh7d.js +0 -1835
- package/dist/server/index.server-kd4b0342.js +0 -607
- package/dist/server/index.server-n5cdmsz4.js +0 -30
- package/dist/server/index.server-pxg74pyp.js +0 -393
- package/dist/server/index.server-rjap4k7y.js +0 -1389
- package/dist/server/index.server-vt6sn9y4.js +0 -447
- package/dist/server/index.server-w63n618v.js +0 -9
- package/dist/server/index.server-y2pa1k46.js +0 -9
|
@@ -0,0 +1,3176 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
function __accessProp(key) {
|
|
7
|
+
return this[key];
|
|
8
|
+
}
|
|
9
|
+
var __toESMCache_node;
|
|
10
|
+
var __toESMCache_esm;
|
|
11
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
12
|
+
var canCache = mod != null && typeof mod === "object";
|
|
13
|
+
if (canCache) {
|
|
14
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
15
|
+
var cached = cache.get(mod);
|
|
16
|
+
if (cached)
|
|
17
|
+
return cached;
|
|
18
|
+
}
|
|
19
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
20
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
21
|
+
for (let key of __getOwnPropNames(mod))
|
|
22
|
+
if (!__hasOwnProp.call(to, key))
|
|
23
|
+
__defProp(to, key, {
|
|
24
|
+
get: __accessProp.bind(mod, key),
|
|
25
|
+
enumerable: true
|
|
26
|
+
});
|
|
27
|
+
if (canCache)
|
|
28
|
+
cache.set(mod, to);
|
|
29
|
+
return to;
|
|
30
|
+
};
|
|
31
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
32
|
+
var __returnValue = (v) => v;
|
|
33
|
+
function __exportSetter(name, newValue) {
|
|
34
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
35
|
+
}
|
|
36
|
+
var __export = (target, all) => {
|
|
37
|
+
for (var name in all)
|
|
38
|
+
__defProp(target, name, {
|
|
39
|
+
get: all[name],
|
|
40
|
+
enumerable: true,
|
|
41
|
+
configurable: true,
|
|
42
|
+
set: __exportSetter.bind(all, name)
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
46
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
47
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
48
|
+
}) : x)(function(x) {
|
|
49
|
+
if (typeof require !== "undefined")
|
|
50
|
+
return require.apply(this, arguments);
|
|
51
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// src/components/schedule-builder/index.ts
|
|
55
|
+
import"@lostgradient/cinder/schedule-builder/styles";
|
|
56
|
+
|
|
57
|
+
// src/components/schedule-builder/schedule-builder.svelte
|
|
58
|
+
import"svelte/internal/disclose-version";
|
|
59
|
+
import * as $9 from "svelte/internal/client";
|
|
60
|
+
|
|
61
|
+
// src/utilities/class-names.ts
|
|
62
|
+
function classNames(...parts) {
|
|
63
|
+
return parts.filter((part) => typeof part === "string" && part.length > 0).join(" ");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// src/components/chip/chip.svelte
|
|
67
|
+
import"svelte/internal/disclose-version";
|
|
68
|
+
import * as $ from "svelte/internal/client";
|
|
69
|
+
var rest_excludes = new Set(["$$slots", "$$events", "$$legacy"]);
|
|
70
|
+
var root = $.from_html(`<span class="cinder-chip__icon" aria-hidden="true"><!></span>`);
|
|
71
|
+
var root_1 = $.from_html(`<button><!> <span class="cinder-chip__label"> </span></button>`);
|
|
72
|
+
var root_2 = $.from_html(`<span><!> <span class="cinder-chip__label"> </span> <button type="button" class="cinder-chip__remove"><span aria-hidden="true">×</span></button></span>`);
|
|
73
|
+
var root_3 = $.from_html(`<span><!> <span class="cinder-chip__label"> </span></span>`);
|
|
74
|
+
function Chip($$anchor, $$props) {
|
|
75
|
+
$.push($$props, true);
|
|
76
|
+
let props = $.rest_props($$props, rest_excludes);
|
|
77
|
+
const mode = $.derived(() => $$props.mode ?? "display");
|
|
78
|
+
const label = $.derived(() => $$props.label);
|
|
79
|
+
const variant = $.derived(() => $$props.variant ?? "neutral");
|
|
80
|
+
const size = $.derived(() => $$props.size ?? "md");
|
|
81
|
+
const density = $.derived(() => $$props.density);
|
|
82
|
+
const customClassName = $.derived(() => $$props.class);
|
|
83
|
+
const leadingIcon = $.derived(() => $$props.leadingIcon);
|
|
84
|
+
const pressed = $.derived(() => $.get(mode) === "toggle" ? $$props.pressed : false);
|
|
85
|
+
const onpressedchange = $.derived(() => $.get(mode) === "toggle" ? $$props.onpressedchange : undefined);
|
|
86
|
+
const disabled = $.derived(() => $.get(mode) !== "display" ? $$props.disabled : undefined);
|
|
87
|
+
const consumerOnClick = $.derived(() => $.get(mode) === "toggle" ? $$props.onclick : undefined);
|
|
88
|
+
const ariaLabelRaw = $.derived(() => $.get(mode) === "toggle" ? props["aria-label"] : undefined);
|
|
89
|
+
const ariaLabel = $.derived(() => typeof $.get(ariaLabelRaw) === "string" && $.get(ariaLabelRaw).trim().length > 0 ? $.get(ariaLabelRaw) : undefined);
|
|
90
|
+
const onremove = $.derived(() => $.get(mode) === "removable" ? $$props.onremove : undefined);
|
|
91
|
+
const removeAriaLabel = $.derived(() => {
|
|
92
|
+
if ($.get(mode) !== "removable")
|
|
93
|
+
return;
|
|
94
|
+
const raw = $$props.removeAriaLabel;
|
|
95
|
+
return typeof raw === "string" && raw.trim().length > 0 ? raw : undefined;
|
|
96
|
+
});
|
|
97
|
+
const BESPOKE_KEYS = new Set([
|
|
98
|
+
"mode",
|
|
99
|
+
"label",
|
|
100
|
+
"variant",
|
|
101
|
+
"size",
|
|
102
|
+
"density",
|
|
103
|
+
"leadingIcon",
|
|
104
|
+
"class",
|
|
105
|
+
"pressed",
|
|
106
|
+
"onpressedchange",
|
|
107
|
+
"disabled",
|
|
108
|
+
"onremove",
|
|
109
|
+
"removeAriaLabel"
|
|
110
|
+
]);
|
|
111
|
+
const rest = $.derived(() => {
|
|
112
|
+
const result = {};
|
|
113
|
+
for (const [key, value] of Object.entries(props)) {
|
|
114
|
+
if (!BESPOKE_KEYS.has(key)) {
|
|
115
|
+
result[key] = value;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return result;
|
|
119
|
+
});
|
|
120
|
+
const removableAriaLabel = $.derived(() => {
|
|
121
|
+
const forwarded = $.get(rest)["aria-label"];
|
|
122
|
+
return typeof forwarded === "string" && forwarded.trim().length > 0 ? forwarded : $.get(label);
|
|
123
|
+
});
|
|
124
|
+
var fragment = $.comment();
|
|
125
|
+
var node = $.first_child(fragment);
|
|
126
|
+
{
|
|
127
|
+
var consequent_1 = ($$anchor2) => {
|
|
128
|
+
var button = root_1();
|
|
129
|
+
var event_handler = (event) => {
|
|
130
|
+
if ($.get(disabled))
|
|
131
|
+
return;
|
|
132
|
+
$.get(consumerOnClick)?.(event);
|
|
133
|
+
if (!event.defaultPrevented) {
|
|
134
|
+
$.get(onpressedchange)?.(!$.get(pressed));
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
$.attribute_effect(button, ($0) => ({
|
|
138
|
+
...$.get(rest),
|
|
139
|
+
type: "button",
|
|
140
|
+
"data-cinder-mode": "toggle",
|
|
141
|
+
"data-cinder-variant": $.get(variant),
|
|
142
|
+
"data-cinder-size": $.get(size),
|
|
143
|
+
"data-cinder-density": $.get(density) === "toolbar" ? "toolbar" : undefined,
|
|
144
|
+
class: $0,
|
|
145
|
+
"aria-pressed": $.get(pressed),
|
|
146
|
+
"aria-label": $.get(ariaLabel),
|
|
147
|
+
disabled: $.get(disabled),
|
|
148
|
+
onclick: event_handler
|
|
149
|
+
}), [() => classNames("cinder-chip", $.get(customClassName))]);
|
|
150
|
+
var node_1 = $.child(button);
|
|
151
|
+
{
|
|
152
|
+
var consequent = ($$anchor3) => {
|
|
153
|
+
var span = root();
|
|
154
|
+
var node_2 = $.child(span);
|
|
155
|
+
$.snippet(node_2, () => $.get(leadingIcon));
|
|
156
|
+
$.reset(span);
|
|
157
|
+
$.append($$anchor3, span);
|
|
158
|
+
};
|
|
159
|
+
$.if(node_1, ($$render) => {
|
|
160
|
+
if ($.get(leadingIcon))
|
|
161
|
+
$$render(consequent);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
var span_1 = $.sibling(node_1, 2);
|
|
165
|
+
var text = $.child(span_1, true);
|
|
166
|
+
$.reset(span_1);
|
|
167
|
+
$.reset(button);
|
|
168
|
+
$.template_effect(() => $.set_text(text, $.get(label)));
|
|
169
|
+
$.append($$anchor2, button);
|
|
170
|
+
};
|
|
171
|
+
var consequent_3 = ($$anchor2) => {
|
|
172
|
+
var span_2 = root_2();
|
|
173
|
+
$.attribute_effect(span_2, ($0) => ({
|
|
174
|
+
...$.get(rest),
|
|
175
|
+
role: "group",
|
|
176
|
+
"aria-label": $.get(removableAriaLabel),
|
|
177
|
+
"data-cinder-mode": "removable",
|
|
178
|
+
"data-cinder-variant": $.get(variant),
|
|
179
|
+
"data-cinder-size": $.get(size),
|
|
180
|
+
"data-cinder-density": $.get(density) === "toolbar" ? "toolbar" : undefined,
|
|
181
|
+
"data-cinder-disabled": $.get(disabled) || undefined,
|
|
182
|
+
"aria-disabled": $.get(disabled) || undefined,
|
|
183
|
+
class: $0
|
|
184
|
+
}), [() => classNames("cinder-chip", $.get(customClassName))]);
|
|
185
|
+
var node_3 = $.child(span_2);
|
|
186
|
+
{
|
|
187
|
+
var consequent_2 = ($$anchor3) => {
|
|
188
|
+
var span_3 = root();
|
|
189
|
+
var node_4 = $.child(span_3);
|
|
190
|
+
$.snippet(node_4, () => $.get(leadingIcon));
|
|
191
|
+
$.reset(span_3);
|
|
192
|
+
$.append($$anchor3, span_3);
|
|
193
|
+
};
|
|
194
|
+
$.if(node_3, ($$render) => {
|
|
195
|
+
if ($.get(leadingIcon))
|
|
196
|
+
$$render(consequent_2);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
var span_4 = $.sibling(node_3, 2);
|
|
200
|
+
var text_1 = $.child(span_4, true);
|
|
201
|
+
$.reset(span_4);
|
|
202
|
+
var button_1 = $.sibling(span_4, 2);
|
|
203
|
+
$.reset(span_2);
|
|
204
|
+
$.template_effect(() => {
|
|
205
|
+
$.set_text(text_1, $.get(label));
|
|
206
|
+
$.set_attribute(button_1, "aria-label", $.get(removeAriaLabel) ?? `Remove ${$.get(label)}`);
|
|
207
|
+
button_1.disabled = $.get(disabled);
|
|
208
|
+
});
|
|
209
|
+
$.delegated("click", button_1, () => {
|
|
210
|
+
if (!$.get(disabled))
|
|
211
|
+
$.get(onremove)?.();
|
|
212
|
+
});
|
|
213
|
+
$.append($$anchor2, span_2);
|
|
214
|
+
};
|
|
215
|
+
var alternate = ($$anchor2) => {
|
|
216
|
+
var span_5 = root_3();
|
|
217
|
+
$.attribute_effect(span_5, ($0) => ({
|
|
218
|
+
...$.get(rest),
|
|
219
|
+
"data-cinder-mode": "display",
|
|
220
|
+
"data-cinder-variant": $.get(variant),
|
|
221
|
+
"data-cinder-size": $.get(size),
|
|
222
|
+
"data-cinder-density": $.get(density) === "toolbar" ? "toolbar" : undefined,
|
|
223
|
+
class: $0
|
|
224
|
+
}), [() => classNames("cinder-chip", $.get(customClassName))]);
|
|
225
|
+
var node_5 = $.child(span_5);
|
|
226
|
+
{
|
|
227
|
+
var consequent_4 = ($$anchor3) => {
|
|
228
|
+
var span_6 = root();
|
|
229
|
+
var node_6 = $.child(span_6);
|
|
230
|
+
$.snippet(node_6, () => $.get(leadingIcon));
|
|
231
|
+
$.reset(span_6);
|
|
232
|
+
$.append($$anchor3, span_6);
|
|
233
|
+
};
|
|
234
|
+
$.if(node_5, ($$render) => {
|
|
235
|
+
if ($.get(leadingIcon))
|
|
236
|
+
$$render(consequent_4);
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
var span_7 = $.sibling(node_5, 2);
|
|
240
|
+
var text_2 = $.child(span_7, true);
|
|
241
|
+
$.reset(span_7);
|
|
242
|
+
$.reset(span_5);
|
|
243
|
+
$.template_effect(() => $.set_text(text_2, $.get(label)));
|
|
244
|
+
$.append($$anchor2, span_5);
|
|
245
|
+
};
|
|
246
|
+
$.if(node, ($$render) => {
|
|
247
|
+
if ($.get(mode) === "toggle")
|
|
248
|
+
$$render(consequent_1);
|
|
249
|
+
else if ($.get(mode) === "removable")
|
|
250
|
+
$$render(consequent_3, 1);
|
|
251
|
+
else
|
|
252
|
+
$$render(alternate, -1);
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
$.append($$anchor, fragment);
|
|
256
|
+
$.pop();
|
|
257
|
+
}
|
|
258
|
+
$.delegate(["click"]);
|
|
259
|
+
|
|
260
|
+
// src/components/input/input.svelte
|
|
261
|
+
import"svelte/internal/disclose-version";
|
|
262
|
+
import * as $2 from "svelte/internal/client";
|
|
263
|
+
|
|
264
|
+
// src/_internal/field-control.ts
|
|
265
|
+
function describeId(fieldId, hasDescription) {
|
|
266
|
+
return hasDescription ? `${fieldId}-description` : undefined;
|
|
267
|
+
}
|
|
268
|
+
function errorId(fieldId, hasError) {
|
|
269
|
+
return hasError ? `${fieldId}-error` : undefined;
|
|
270
|
+
}
|
|
271
|
+
function composeDescribedBy(...ids) {
|
|
272
|
+
const filtered = ids.flatMap((id) => typeof id === "string" ? id.trim().split(/\s+/).filter(Boolean) : []);
|
|
273
|
+
const unique = Array.from(new Set(filtered));
|
|
274
|
+
return unique.length > 0 ? unique.join(" ") : undefined;
|
|
275
|
+
}
|
|
276
|
+
function ariaInvalid(hasError) {
|
|
277
|
+
return hasError ? "true" : undefined;
|
|
278
|
+
}
|
|
279
|
+
function resolveFieldControl(input) {
|
|
280
|
+
const resolvedId = input.id ?? input.context?.controlId ?? input.generatedId;
|
|
281
|
+
const defaultDescriptionId = describeId(resolvedId, input.hasDescription ?? false);
|
|
282
|
+
const defaultErrorId = errorId(resolvedId, input.hasError ?? false);
|
|
283
|
+
const ownDescriptionId = defaultDescriptionId && defaultDescriptionId === input.context?.descriptionId && input.localIdNamespace ? `${resolvedId}-${input.localIdNamespace}-description` : defaultDescriptionId;
|
|
284
|
+
const ownErrorId = defaultErrorId && defaultErrorId === input.context?.errorId && input.localIdNamespace ? `${resolvedId}-${input.localIdNamespace}-error` : defaultErrorId;
|
|
285
|
+
const descriptionId = ownDescriptionId ?? input.context?.descriptionId;
|
|
286
|
+
const resolvedErrorId = ownErrorId ?? input.context?.errorId;
|
|
287
|
+
const explicitInvalid = ariaInvalid(input.hasError ?? false);
|
|
288
|
+
const consumerInvalid = input.consumerInvalid === true ? "true" : input.consumerInvalid === false ? undefined : input.consumerInvalid ?? undefined;
|
|
289
|
+
return {
|
|
290
|
+
id: resolvedId,
|
|
291
|
+
ownDescriptionId,
|
|
292
|
+
ownErrorId,
|
|
293
|
+
descriptionId,
|
|
294
|
+
errorId: resolvedErrorId,
|
|
295
|
+
describedBy: composeDescribedBy(descriptionId, ...input.additionalDescribedBy ?? [], resolvedErrorId, input.context?.describedBy, input.consumerDescribedBy),
|
|
296
|
+
ariaInvalid: explicitInvalid ?? input.context?.invalid ?? consumerInvalid,
|
|
297
|
+
required: input.required ?? input.context?.required ?? false,
|
|
298
|
+
disabled: input.disabled ?? input.context?.disabled ?? false
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// src/_internal/form-field-context.ts
|
|
303
|
+
import { createContext } from "svelte";
|
|
304
|
+
|
|
305
|
+
// src/_internal/optional-context.ts
|
|
306
|
+
function optionalContext(getStrict) {
|
|
307
|
+
return () => {
|
|
308
|
+
try {
|
|
309
|
+
return getStrict();
|
|
310
|
+
} catch {
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// src/_internal/form-field-context.ts
|
|
317
|
+
var [getFormFieldContextStrict, setFormFieldContextRaw] = createContext();
|
|
318
|
+
function setFormFieldContext(context) {
|
|
319
|
+
setFormFieldContextRaw(context);
|
|
320
|
+
}
|
|
321
|
+
var getFormFieldContext = optionalContext(getFormFieldContextStrict);
|
|
322
|
+
|
|
323
|
+
// ../../node_modules/esm-env/true.js
|
|
324
|
+
var true_default = true;
|
|
325
|
+
// src/utilities/dev-warn.ts
|
|
326
|
+
function devWarn(message, ...args) {
|
|
327
|
+
if (!true_default)
|
|
328
|
+
return;
|
|
329
|
+
console.warn(message, ...args);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// src/utilities/value-change.ts
|
|
333
|
+
function commitValue(proposed, onValueChange, setValue) {
|
|
334
|
+
const committed = onValueChange?.(proposed) ?? proposed;
|
|
335
|
+
setValue(committed);
|
|
336
|
+
return committed;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// src/components/input/input.svelte
|
|
340
|
+
var calendarIcon = ($$anchor) => {
|
|
341
|
+
var svg = root2();
|
|
342
|
+
$2.append($$anchor, svg);
|
|
343
|
+
};
|
|
344
|
+
var rest_excludes2 = new Set([
|
|
345
|
+
"$$slots",
|
|
346
|
+
"$$events",
|
|
347
|
+
"$$legacy",
|
|
348
|
+
"id",
|
|
349
|
+
"value",
|
|
350
|
+
"onValueChange",
|
|
351
|
+
"label",
|
|
352
|
+
"hideLabel",
|
|
353
|
+
"description",
|
|
354
|
+
"error",
|
|
355
|
+
"disabled",
|
|
356
|
+
"required",
|
|
357
|
+
"type",
|
|
358
|
+
"class",
|
|
359
|
+
"leading",
|
|
360
|
+
"trailing",
|
|
361
|
+
"leadingInteractive",
|
|
362
|
+
"trailingInteractive",
|
|
363
|
+
"aria-describedby",
|
|
364
|
+
"aria-invalid",
|
|
365
|
+
"oninput"
|
|
366
|
+
]);
|
|
367
|
+
var root2 = $2.from_svg(`<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>`);
|
|
368
|
+
var root_12 = $2.from_html(`<input/>`);
|
|
369
|
+
var root_22 = $2.from_html(`<span class="cinder-_required-marker" aria-hidden="true">*</span>`);
|
|
370
|
+
var root_32 = $2.from_html(`<label> <!></label>`);
|
|
371
|
+
var root_4 = $2.from_html(`<span class="cinder-input-group__leading cinder-_truncate"><!></span>`);
|
|
372
|
+
var root_5 = $2.from_html(`<span class="cinder-input-group__trailing cinder-_truncate"><!></span>`);
|
|
373
|
+
var root_6 = $2.from_html(`<span class="cinder-input-group__trailing cinder-input-group__date-icon cinder-_truncate" aria-hidden="true"><!></span>`);
|
|
374
|
+
var root_7 = $2.from_html(`<div class="cinder-input-group"><!> <!> <!></div>`);
|
|
375
|
+
var root_8 = $2.from_html(`<p class="cinder-input-field__description"> </p>`);
|
|
376
|
+
var root_9 = $2.from_html(`<p class="cinder-input-field__error" aria-live="polite"> </p>`);
|
|
377
|
+
var root_10 = $2.from_html(`<div class="cinder-input-field"><!> <!> <!> <!></div>`);
|
|
378
|
+
function Input($$anchor, $$props) {
|
|
379
|
+
$2.push($$props, true);
|
|
380
|
+
const inputElement = ($$anchor2) => {
|
|
381
|
+
var input = root_12();
|
|
382
|
+
$2.attribute_effect(input, ($0) => ({
|
|
383
|
+
id: $$props.id,
|
|
384
|
+
type: type(),
|
|
385
|
+
...rest,
|
|
386
|
+
disabled: $2.get(resolvedDisabled),
|
|
387
|
+
required: $2.get(resolvedRequired),
|
|
388
|
+
value: value(),
|
|
389
|
+
oninput: handleInput,
|
|
390
|
+
class: $0,
|
|
391
|
+
"data-cinder-native-date": $2.get(rendersNativeDateIcon) ? "" : undefined,
|
|
392
|
+
"aria-invalid": $2.get(resolvedAriaInvalid),
|
|
393
|
+
"aria-describedby": $2.get(describedBy)
|
|
394
|
+
}), [() => classNames("cinder-input", $$props.class)], undefined, undefined, undefined, true);
|
|
395
|
+
$2.bind_this(input, ($$value) => $2.set(inputNode, $$value), () => $2.get(inputNode));
|
|
396
|
+
$2.append($$anchor2, input);
|
|
397
|
+
};
|
|
398
|
+
let value = $2.prop($$props, "value", 15, ""), hideLabel = $2.prop($$props, "hideLabel", 3, false), type = $2.prop($$props, "type", 3, "text"), leadingInteractive = $2.prop($$props, "leadingInteractive", 3, false), trailingInteractive = $2.prop($$props, "trailingInteractive", 3, false), rest = $2.rest_props($$props, rest_excludes2);
|
|
399
|
+
const context = getFormFieldContext();
|
|
400
|
+
$2.user_effect(() => {
|
|
401
|
+
if (context && context.controlId !== $$props.id) {
|
|
402
|
+
devWarn(`[cinder/Input] id mismatch: Input id="${$$props.id}" but wrapping FormField expects controlId="${context.controlId}". Set the same id on both.`);
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
const field = $2.derived(() => resolveFieldControl({
|
|
406
|
+
id: $$props.id,
|
|
407
|
+
generatedId: $$props.id,
|
|
408
|
+
context,
|
|
409
|
+
hasDescription: !!$$props.description,
|
|
410
|
+
hasError: !!$$props.error,
|
|
411
|
+
localIdNamespace: "input",
|
|
412
|
+
consumerDescribedBy: $$props["aria-describedby"],
|
|
413
|
+
consumerInvalid: $$props["aria-invalid"],
|
|
414
|
+
required: $$props.required,
|
|
415
|
+
disabled: $$props.disabled
|
|
416
|
+
}));
|
|
417
|
+
const ownDescriptionId = $2.derived(() => $2.get(field).ownDescriptionId);
|
|
418
|
+
const ownErrorId = $2.derived(() => $2.get(field).ownErrorId);
|
|
419
|
+
const describedBy = $2.derived(() => $2.get(field).describedBy);
|
|
420
|
+
const resolvedAriaInvalid = $2.derived(() => $2.get(field).ariaInvalid);
|
|
421
|
+
const resolvedRequired = $2.derived(() => $2.get(field).required);
|
|
422
|
+
const resolvedDisabled = $2.derived(() => $2.get(field).disabled);
|
|
423
|
+
const isNativeDateInput = $2.derived(() => type() === "date");
|
|
424
|
+
const rendersNativeDateIcon = $2.derived(() => $2.get(isNativeDateInput) && !$$props.trailing);
|
|
425
|
+
const hasTrailing = $2.derived(() => !!$$props.trailing || $2.get(isNativeDateInput));
|
|
426
|
+
const hasGroupWrapper = $2.derived(() => !!$$props.leading || $2.get(hasTrailing));
|
|
427
|
+
const isInvalid = $2.derived(() => $2.get(resolvedAriaInvalid) === "true");
|
|
428
|
+
let inputNode = $2.state(undefined);
|
|
429
|
+
let resetSyncTimeout;
|
|
430
|
+
function syncValueAfterFormReset() {
|
|
431
|
+
if (resetSyncTimeout !== undefined)
|
|
432
|
+
clearTimeout(resetSyncTimeout);
|
|
433
|
+
resetSyncTimeout = setTimeout(() => {
|
|
434
|
+
resetSyncTimeout = undefined;
|
|
435
|
+
if ($2.get(inputNode))
|
|
436
|
+
value($2.get(inputNode).value);
|
|
437
|
+
}, 0);
|
|
438
|
+
}
|
|
439
|
+
$2.user_effect(() => {
|
|
440
|
+
const form = $2.get(inputNode)?.form;
|
|
441
|
+
if (!form)
|
|
442
|
+
return;
|
|
443
|
+
form.addEventListener("reset", syncValueAfterFormReset);
|
|
444
|
+
return () => {
|
|
445
|
+
form.removeEventListener("reset", syncValueAfterFormReset);
|
|
446
|
+
if (resetSyncTimeout !== undefined) {
|
|
447
|
+
clearTimeout(resetSyncTimeout);
|
|
448
|
+
resetSyncTimeout = undefined;
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
});
|
|
452
|
+
function handleInput(event) {
|
|
453
|
+
const target = event.currentTarget;
|
|
454
|
+
const committed = commitValue(target.value, $$props.onValueChange, (next) => {
|
|
455
|
+
value(next);
|
|
456
|
+
});
|
|
457
|
+
target.value = committed;
|
|
458
|
+
$$props.oninput?.(event);
|
|
459
|
+
}
|
|
460
|
+
var div = root_10();
|
|
461
|
+
var node = $2.child(div);
|
|
462
|
+
{
|
|
463
|
+
var consequent_1 = ($$anchor2) => {
|
|
464
|
+
var label_1 = root_32();
|
|
465
|
+
var text = $2.child(label_1);
|
|
466
|
+
var node_1 = $2.sibling(text);
|
|
467
|
+
{
|
|
468
|
+
var consequent = ($$anchor3) => {
|
|
469
|
+
var span = root_22();
|
|
470
|
+
$2.append($$anchor3, span);
|
|
471
|
+
};
|
|
472
|
+
$2.if(node_1, ($$render) => {
|
|
473
|
+
if ($2.get(resolvedRequired))
|
|
474
|
+
$$render(consequent);
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
$2.reset(label_1);
|
|
478
|
+
$2.template_effect(($0) => {
|
|
479
|
+
$2.set_attribute(label_1, "for", $$props.id);
|
|
480
|
+
$2.set_class(label_1, 1, $0);
|
|
481
|
+
$2.set_attribute(label_1, "data-disabled", $2.get(resolvedDisabled) || undefined);
|
|
482
|
+
$2.set_text(text, `${$$props.label ?? ""} `);
|
|
483
|
+
}, [
|
|
484
|
+
() => $2.clsx(classNames("cinder-input-field__label", hideLabel() && "cinder-sr-only"))
|
|
485
|
+
]);
|
|
486
|
+
$2.append($$anchor2, label_1);
|
|
487
|
+
};
|
|
488
|
+
$2.if(node, ($$render) => {
|
|
489
|
+
if ($$props.label)
|
|
490
|
+
$$render(consequent_1);
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
var node_2 = $2.sibling(node, 2);
|
|
494
|
+
{
|
|
495
|
+
var consequent_5 = ($$anchor2) => {
|
|
496
|
+
var div_1 = root_7();
|
|
497
|
+
var node_3 = $2.child(div_1);
|
|
498
|
+
{
|
|
499
|
+
var consequent_2 = ($$anchor3) => {
|
|
500
|
+
var span_1 = root_4();
|
|
501
|
+
var node_4 = $2.child(span_1);
|
|
502
|
+
$2.snippet(node_4, () => $$props.leading);
|
|
503
|
+
$2.reset(span_1);
|
|
504
|
+
$2.template_effect(() => $2.set_attribute(span_1, "aria-hidden", leadingInteractive() ? undefined : "true"));
|
|
505
|
+
$2.append($$anchor3, span_1);
|
|
506
|
+
};
|
|
507
|
+
$2.if(node_3, ($$render) => {
|
|
508
|
+
if ($$props.leading)
|
|
509
|
+
$$render(consequent_2);
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
var node_5 = $2.sibling(node_3, 2);
|
|
513
|
+
inputElement(node_5);
|
|
514
|
+
var node_6 = $2.sibling(node_5, 2);
|
|
515
|
+
{
|
|
516
|
+
var consequent_3 = ($$anchor3) => {
|
|
517
|
+
var span_2 = root_5();
|
|
518
|
+
var node_7 = $2.child(span_2);
|
|
519
|
+
$2.snippet(node_7, () => $$props.trailing);
|
|
520
|
+
$2.reset(span_2);
|
|
521
|
+
$2.template_effect(() => $2.set_attribute(span_2, "aria-hidden", trailingInteractive() ? undefined : "true"));
|
|
522
|
+
$2.append($$anchor3, span_2);
|
|
523
|
+
};
|
|
524
|
+
var consequent_4 = ($$anchor3) => {
|
|
525
|
+
var span_3 = root_6();
|
|
526
|
+
var node_8 = $2.child(span_3);
|
|
527
|
+
calendarIcon(node_8);
|
|
528
|
+
$2.reset(span_3);
|
|
529
|
+
$2.append($$anchor3, span_3);
|
|
530
|
+
};
|
|
531
|
+
$2.if(node_6, ($$render) => {
|
|
532
|
+
if ($$props.trailing)
|
|
533
|
+
$$render(consequent_3);
|
|
534
|
+
else if ($2.get(rendersNativeDateIcon))
|
|
535
|
+
$$render(consequent_4, 1);
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
$2.reset(div_1);
|
|
539
|
+
$2.template_effect(() => {
|
|
540
|
+
$2.set_attribute(div_1, "data-leading", $$props.leading ? "" : undefined);
|
|
541
|
+
$2.set_attribute(div_1, "data-trailing", $2.get(hasTrailing) ? "" : undefined);
|
|
542
|
+
$2.set_attribute(div_1, "data-native-date", $2.get(rendersNativeDateIcon) ? "" : undefined);
|
|
543
|
+
$2.set_attribute(div_1, "data-disabled", $2.get(resolvedDisabled) ? "" : undefined);
|
|
544
|
+
$2.set_attribute(div_1, "data-invalid", $2.get(isInvalid) ? "" : undefined);
|
|
545
|
+
});
|
|
546
|
+
$2.append($$anchor2, div_1);
|
|
547
|
+
};
|
|
548
|
+
var alternate = ($$anchor2) => {
|
|
549
|
+
inputElement($$anchor2);
|
|
550
|
+
};
|
|
551
|
+
$2.if(node_2, ($$render) => {
|
|
552
|
+
if ($2.get(hasGroupWrapper))
|
|
553
|
+
$$render(consequent_5);
|
|
554
|
+
else
|
|
555
|
+
$$render(alternate, -1);
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
var node_9 = $2.sibling(node_2, 2);
|
|
559
|
+
{
|
|
560
|
+
var consequent_6 = ($$anchor2) => {
|
|
561
|
+
var p = root_8();
|
|
562
|
+
var text_1 = $2.child(p, true);
|
|
563
|
+
$2.reset(p);
|
|
564
|
+
$2.template_effect(() => {
|
|
565
|
+
$2.set_attribute(p, "id", $2.get(ownDescriptionId));
|
|
566
|
+
$2.set_text(text_1, $$props.description);
|
|
567
|
+
});
|
|
568
|
+
$2.append($$anchor2, p);
|
|
569
|
+
};
|
|
570
|
+
$2.if(node_9, ($$render) => {
|
|
571
|
+
if ($$props.description)
|
|
572
|
+
$$render(consequent_6);
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
var node_10 = $2.sibling(node_9, 2);
|
|
576
|
+
{
|
|
577
|
+
var consequent_7 = ($$anchor2) => {
|
|
578
|
+
var p_1 = root_9();
|
|
579
|
+
var text_2 = $2.child(p_1, true);
|
|
580
|
+
$2.reset(p_1);
|
|
581
|
+
$2.template_effect(() => {
|
|
582
|
+
$2.set_attribute(p_1, "id", $2.get(ownErrorId));
|
|
583
|
+
$2.set_text(text_2, $$props.error);
|
|
584
|
+
});
|
|
585
|
+
$2.append($$anchor2, p_1);
|
|
586
|
+
};
|
|
587
|
+
$2.if(node_10, ($$render) => {
|
|
588
|
+
if ($$props.error)
|
|
589
|
+
$$render(consequent_7);
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
$2.reset(div);
|
|
593
|
+
$2.append($$anchor, div);
|
|
594
|
+
$2.pop();
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
// src/components/number-input/number-input.svelte
|
|
598
|
+
import"svelte/internal/disclose-version";
|
|
599
|
+
import * as $3 from "svelte/internal/client";
|
|
600
|
+
import { untrack } from "svelte";
|
|
601
|
+
|
|
602
|
+
// src/_internal/locale-context.ts
|
|
603
|
+
import { createContext as createContext2 } from "svelte";
|
|
604
|
+
var [getLocaleContextStrict, setLocaleContextRaw] = createContext2();
|
|
605
|
+
function setLocaleContext(context) {
|
|
606
|
+
setLocaleContextRaw(context);
|
|
607
|
+
}
|
|
608
|
+
var getLocaleContext = optionalContext(getLocaleContextStrict);
|
|
609
|
+
|
|
610
|
+
// src/utilities/format-number.ts
|
|
611
|
+
function formatNumber(value, locale = "en-US", options) {
|
|
612
|
+
return new Intl.NumberFormat(locale, options).format(value);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
// src/utilities/parse-locale-number.ts
|
|
616
|
+
function escapeRegex(s) {
|
|
617
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
618
|
+
}
|
|
619
|
+
function parseLocaleNumber(text, locale, format) {
|
|
620
|
+
if (text.trim() === "")
|
|
621
|
+
return { value: null, status: "empty" };
|
|
622
|
+
let working = text;
|
|
623
|
+
const digitFormatter = new Intl.NumberFormat(locale, {
|
|
624
|
+
useGrouping: false,
|
|
625
|
+
maximumFractionDigits: 0
|
|
626
|
+
});
|
|
627
|
+
for (let d = 0;d <= 9; d++) {
|
|
628
|
+
const glyph = digitFormatter.format(d);
|
|
629
|
+
if (glyph !== String(d)) {
|
|
630
|
+
working = working.split(glyph).join(String(d));
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
const sepParts = new Intl.NumberFormat(locale, {
|
|
634
|
+
useGrouping: true,
|
|
635
|
+
minimumFractionDigits: 1,
|
|
636
|
+
maximumFractionDigits: 1
|
|
637
|
+
}).formatToParts(-12345.6);
|
|
638
|
+
const groupSep = sepParts.find((p) => p.type === "group")?.value ?? "";
|
|
639
|
+
const decimalSep = sepParts.find((p) => p.type === "decimal")?.value ?? ".";
|
|
640
|
+
working = working.replace(/[--]/g, "");
|
|
641
|
+
const localeMinus = sepParts.find((p) => p.type === "minusSign")?.value ?? "-";
|
|
642
|
+
if (localeMinus !== "-") {
|
|
643
|
+
working = working.split(localeMinus).join("-");
|
|
644
|
+
}
|
|
645
|
+
let isNegativeByFormatAffix = false;
|
|
646
|
+
if (format) {
|
|
647
|
+
const positiveAffixValues = new Set(new Intl.NumberFormat(locale, format).formatToParts(0).filter((part) => part.type === "currency" || part.type === "percentSign" || part.type === "literal" || part.type === "unit" || part.type === "compact").map((part) => part.value));
|
|
648
|
+
const negativeParts = new Intl.NumberFormat(locale, format).formatToParts(-1);
|
|
649
|
+
const negativeOnlyAffixes = negativeParts.filter((part) => (part.type === "currency" || part.type === "percentSign" || part.type === "literal" || part.type === "unit" || part.type === "compact") && part.value.trim() !== "" && !positiveAffixValues.has(part.value)).map((part) => part.value);
|
|
650
|
+
isNegativeByFormatAffix = negativeOnlyAffixes.length > 0 && negativeOnlyAffixes.every((part) => working.includes(part));
|
|
651
|
+
const stripSamples = [0, -1];
|
|
652
|
+
for (const sample of stripSamples) {
|
|
653
|
+
const parts = new Intl.NumberFormat(locale, format).formatToParts(sample);
|
|
654
|
+
for (const part of parts) {
|
|
655
|
+
if (part.type === "currency" || part.type === "percentSign" || part.type === "literal" || part.type === "unit" || part.type === "compact") {
|
|
656
|
+
if (part.value)
|
|
657
|
+
working = working.split(part.value).join("");
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
if (isNegativeByFormatAffix && !/^[+-]/.test(working)) {
|
|
663
|
+
working = "-" + working;
|
|
664
|
+
}
|
|
665
|
+
working = working.split("%").join("");
|
|
666
|
+
working = working.replace(/^[\s ]+|[\s ]+$/g, "");
|
|
667
|
+
if (working === "")
|
|
668
|
+
return { value: null, status: "empty" };
|
|
669
|
+
const decimalSplit = working.split(decimalSep);
|
|
670
|
+
if (decimalSplit.length > 2)
|
|
671
|
+
return { value: null, status: "malformed" };
|
|
672
|
+
const integerPart = decimalSplit[0] ?? "";
|
|
673
|
+
const fractionPart = decimalSplit[1];
|
|
674
|
+
if (groupSep && integerPart.includes(groupSep)) {
|
|
675
|
+
const probeParts = new Intl.NumberFormat(locale, {
|
|
676
|
+
useGrouping: true
|
|
677
|
+
}).formatToParts(12345678);
|
|
678
|
+
const integerRuns = [];
|
|
679
|
+
for (const p of probeParts) {
|
|
680
|
+
if (p.type === "integer")
|
|
681
|
+
integerRuns.push(p.value);
|
|
682
|
+
}
|
|
683
|
+
const primary = integerRuns.length > 0 ? (integerRuns[integerRuns.length - 1] ?? "").length : 3;
|
|
684
|
+
const secondary = integerRuns.length > 1 ? (integerRuns[integerRuns.length - 2] ?? "").length : primary;
|
|
685
|
+
const groupEsc = escapeRegex(groupSep);
|
|
686
|
+
const grouped = new RegExp(`^[+-]?\\d{1,${secondary}}(${groupEsc}\\d{${secondary}})*${groupEsc}\\d{${primary}}$`);
|
|
687
|
+
if (!grouped.test(integerPart))
|
|
688
|
+
return { value: null, status: "malformed" };
|
|
689
|
+
}
|
|
690
|
+
let normalized = groupSep.length > 0 ? integerPart.split(groupSep).join("") : integerPart;
|
|
691
|
+
if (fractionPart !== undefined)
|
|
692
|
+
normalized += "." + fractionPart;
|
|
693
|
+
if (!/^[+-]?(\d+\.?\d*|\.\d+)$/.test(normalized)) {
|
|
694
|
+
return { value: null, status: "malformed" };
|
|
695
|
+
}
|
|
696
|
+
const parsed = parseFloat(normalized);
|
|
697
|
+
if (!Number.isFinite(parsed))
|
|
698
|
+
return { value: null, status: "malformed" };
|
|
699
|
+
return { value: parsed, status: "valid" };
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
// src/components/number-input/number-input.svelte
|
|
703
|
+
var rest_excludes3 = new Set([
|
|
704
|
+
"$$slots",
|
|
705
|
+
"$$events",
|
|
706
|
+
"$$legacy",
|
|
707
|
+
"id",
|
|
708
|
+
"defaultValue",
|
|
709
|
+
"value",
|
|
710
|
+
"min",
|
|
711
|
+
"max",
|
|
712
|
+
"step",
|
|
713
|
+
"format",
|
|
714
|
+
"locale",
|
|
715
|
+
"disabled",
|
|
716
|
+
"required",
|
|
717
|
+
"name",
|
|
718
|
+
"label",
|
|
719
|
+
"description",
|
|
720
|
+
"error",
|
|
721
|
+
"class",
|
|
722
|
+
"onchange",
|
|
723
|
+
"onblur",
|
|
724
|
+
"aria-describedby"
|
|
725
|
+
]);
|
|
726
|
+
var root3 = $3.from_html(`<span class="cinder-_required-marker" aria-hidden="true">*</span>`);
|
|
727
|
+
var root_13 = $3.from_html(`<label class="cinder-input-field__label"> <!></label>`);
|
|
728
|
+
var root_23 = $3.from_html(`<input type="hidden"/>`);
|
|
729
|
+
var root_33 = $3.from_html(`<p class="cinder-input-field__description"> </p>`);
|
|
730
|
+
var root_42 = $3.from_html(`<p class="cinder-input-field__error" aria-live="polite"> </p>`);
|
|
731
|
+
var root_52 = $3.from_html(`<div><!> <div class="cinder-number-input"><input/> <button type="button" class="cinder-number-input__stepper cinder-number-input__stepper--increment" tabindex="-1"><span aria-hidden="true">+</span></button> <button type="button" class="cinder-number-input__stepper cinder-number-input__stepper--decrement" tabindex="-1"><span aria-hidden="true">−</span></button></div> <!> <!> <!></div>`);
|
|
732
|
+
function Number_input($$anchor, $$props) {
|
|
733
|
+
$3.push($$props, true);
|
|
734
|
+
let defaultValue = $3.prop($$props, "defaultValue", 3, null), value = $3.prop($$props, "value", 15, null), rest = $3.rest_props($$props, rest_excludes3);
|
|
735
|
+
const context = getFormFieldContext();
|
|
736
|
+
const localeContext = getLocaleContext();
|
|
737
|
+
let editorBuffer = $3.state("");
|
|
738
|
+
let isFocused = $3.state(false);
|
|
739
|
+
let hasMounted = $3.state(false);
|
|
740
|
+
let inputElement = $3.state(undefined);
|
|
741
|
+
$3.user_effect(() => {
|
|
742
|
+
$3.set(hasMounted, true);
|
|
743
|
+
});
|
|
744
|
+
let malformedError = $3.state(false);
|
|
745
|
+
let requiredEmptyError = $3.state(false);
|
|
746
|
+
untrack(() => {
|
|
747
|
+
if (value() === null && defaultValue() !== null) {
|
|
748
|
+
value(defaultValue());
|
|
749
|
+
}
|
|
750
|
+
});
|
|
751
|
+
const resolvedLocale = $3.derived(() => $$props.locale ?? localeContext?.locale ?? ($3.get(hasMounted) ? navigator.language : "en-US"));
|
|
752
|
+
const resolvedMin = $3.derived(() => typeof $$props.min === "number" && Number.isFinite($$props.min) ? $$props.min : -Infinity);
|
|
753
|
+
const resolvedMax = $3.derived(() => typeof $$props.max === "number" && Number.isFinite($$props.max) ? $$props.max : Infinity);
|
|
754
|
+
const isValidStep = (s) => typeof s === "number" && Number.isFinite(s) && s > 0;
|
|
755
|
+
const incrementStep = $3.derived(() => isValidStep($$props.step) ? $$props.step : 1);
|
|
756
|
+
const snapStep = $3.derived(() => isValidStep($$props.step) ? $$props.step : null);
|
|
757
|
+
const resolvedRequired = $3.derived(() => $$props.required ?? context?.required ?? false);
|
|
758
|
+
const resolvedDisabled = $3.derived(() => $$props.disabled ?? context?.disabled ?? false);
|
|
759
|
+
function roundToPrecision(n, digits) {
|
|
760
|
+
return Number(n.toFixed(Math.min(digits, 12)));
|
|
761
|
+
}
|
|
762
|
+
function fractionalDigits(n) {
|
|
763
|
+
if (!Number.isFinite(n))
|
|
764
|
+
return 0;
|
|
765
|
+
const s = String(n);
|
|
766
|
+
if (s.includes("e") || s.includes("E")) {
|
|
767
|
+
const parts = s.toLowerCase().split("e");
|
|
768
|
+
const mantissa = parts[0] ?? "";
|
|
769
|
+
const expStr = parts[1] ?? "0";
|
|
770
|
+
const exp = Number(expStr);
|
|
771
|
+
const fracOfMantissa = mantissa.split(".")[1]?.length ?? 0;
|
|
772
|
+
return Math.max(0, fracOfMantissa - exp);
|
|
773
|
+
}
|
|
774
|
+
return s.split(".")[1]?.length ?? 0;
|
|
775
|
+
}
|
|
776
|
+
function commit(next, parseStatus, emitChange) {
|
|
777
|
+
const nextMalformed = !$3.get(resolvedDisabled) && parseStatus === "malformed";
|
|
778
|
+
const nextRequiredEmpty = !$3.get(resolvedDisabled) && !nextMalformed && $3.get(resolvedRequired) && next === null;
|
|
779
|
+
if ($3.get(inputElement)) {
|
|
780
|
+
if (nextMalformed) {
|
|
781
|
+
$3.get(inputElement).setCustomValidity("Please enter a valid number.");
|
|
782
|
+
} else if (nextRequiredEmpty) {
|
|
783
|
+
$3.get(inputElement).setCustomValidity("Please enter a number.");
|
|
784
|
+
} else {
|
|
785
|
+
$3.get(inputElement).setCustomValidity("");
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
$3.set(malformedError, nextMalformed, true);
|
|
789
|
+
$3.set(requiredEmptyError, nextRequiredEmpty, true);
|
|
790
|
+
if (!Object.is(next, value())) {
|
|
791
|
+
$3.set(isInternalValueChange, true);
|
|
792
|
+
value(next);
|
|
793
|
+
}
|
|
794
|
+
if (emitChange) {
|
|
795
|
+
$$props.onchange?.(next);
|
|
796
|
+
}
|
|
797
|
+
return next;
|
|
798
|
+
}
|
|
799
|
+
function commitFromNumber(source, raw, parseStatus = "valid") {
|
|
800
|
+
if (raw === null)
|
|
801
|
+
return commit(null, parseStatus, true);
|
|
802
|
+
if (!Number.isFinite(raw))
|
|
803
|
+
return commit(null, "malformed", true);
|
|
804
|
+
let result = raw;
|
|
805
|
+
if (source === "typed" && $3.get(snapStep) !== null) {
|
|
806
|
+
const origin = Number.isFinite($3.get(resolvedMin)) ? $3.get(resolvedMin) : 0;
|
|
807
|
+
result = origin + Math.round((raw - origin) / $3.get(snapStep)) * $3.get(snapStep);
|
|
808
|
+
result = roundToPrecision(result, fractionalDigits($3.get(snapStep)));
|
|
809
|
+
} else if (source === "delta" && $3.get(snapStep) !== null) {
|
|
810
|
+
const cleanRaw = roundToPrecision(raw, 12);
|
|
811
|
+
result = roundToPrecision(raw, Math.max(fractionalDigits($3.get(snapStep)), fractionalDigits(cleanRaw)));
|
|
812
|
+
}
|
|
813
|
+
const clamped = Math.min($3.get(resolvedMax), Math.max($3.get(resolvedMin), result));
|
|
814
|
+
return commit(clamped, parseStatus, true);
|
|
815
|
+
}
|
|
816
|
+
function commitFromText(source, text) {
|
|
817
|
+
const result = parseLocaleNumber(text, $3.get(resolvedLocale), $$props.format);
|
|
818
|
+
if (result.status !== "valid") {
|
|
819
|
+
return commit(null, result.status, true);
|
|
820
|
+
}
|
|
821
|
+
const canonical = $$props.format?.style === "percent" ? roundToPrecision(result.value / 100, Math.max(2, fractionalDigits(result.value) + 2)) : result.value;
|
|
822
|
+
return commitFromNumber(source, canonical, "valid");
|
|
823
|
+
}
|
|
824
|
+
let isInternalValueChange = $3.state(false);
|
|
825
|
+
let enterKeyFlushed = false;
|
|
826
|
+
const displayValue = $3.derived(() => $3.get(isFocused) ? $3.get(editorBuffer) : $3.get(malformedError) ? $3.get(editorBuffer) : value() === null || value() === undefined ? "" : formatNumber(value(), $3.get(resolvedLocale), $$props.format));
|
|
827
|
+
const parentValueSignature = $3.derived(() => `${value() ?? ""}|${$3.get(resolvedLocale)}|${JSON.stringify($$props.format ?? null)}`);
|
|
828
|
+
let lastSeenParentSignature = untrack(() => $3.get(parentValueSignature));
|
|
829
|
+
$3.user_effect(() => {
|
|
830
|
+
const signature = $3.get(parentValueSignature);
|
|
831
|
+
if (signature === lastSeenParentSignature)
|
|
832
|
+
return;
|
|
833
|
+
lastSeenParentSignature = signature;
|
|
834
|
+
if ($3.get(isInternalValueChange)) {
|
|
835
|
+
$3.set(isInternalValueChange, false);
|
|
836
|
+
return;
|
|
837
|
+
}
|
|
838
|
+
if (!$3.get(isFocused))
|
|
839
|
+
return;
|
|
840
|
+
$3.set(editorBuffer, value() === null || value() === undefined ? "" : buildEditDisplay(value()), true);
|
|
841
|
+
});
|
|
842
|
+
$3.user_effect(() => {
|
|
843
|
+
if (!$3.get(inputElement))
|
|
844
|
+
return;
|
|
845
|
+
if ($3.get(resolvedDisabled)) {
|
|
846
|
+
$3.get(inputElement).setCustomValidity("");
|
|
847
|
+
$3.set(malformedError, false);
|
|
848
|
+
$3.set(requiredEmptyError, false);
|
|
849
|
+
} else if (value() !== null && value() !== undefined && !$3.get(isInternalValueChange)) {
|
|
850
|
+
$3.set(malformedError, false);
|
|
851
|
+
$3.set(requiredEmptyError, false);
|
|
852
|
+
$3.get(inputElement).setCustomValidity("");
|
|
853
|
+
} else if ($3.get(malformedError)) {} else if (!$3.get(isFocused) && $3.get(resolvedRequired) && (value() === null || value() === undefined)) {
|
|
854
|
+
$3.get(inputElement).setCustomValidity("Please enter a number.");
|
|
855
|
+
$3.set(requiredEmptyError, true);
|
|
856
|
+
} else if ($3.get(isFocused) && $3.get(requiredEmptyError)) {
|
|
857
|
+
$3.get(inputElement).setCustomValidity("");
|
|
858
|
+
$3.set(requiredEmptyError, false);
|
|
859
|
+
} else if (value() !== null && value() !== undefined) {
|
|
860
|
+
$3.get(inputElement).setCustomValidity("");
|
|
861
|
+
$3.set(requiredEmptyError, false);
|
|
862
|
+
}
|
|
863
|
+
});
|
|
864
|
+
function buildEditDisplay(v) {
|
|
865
|
+
const editFormat = {
|
|
866
|
+
...$$props.format,
|
|
867
|
+
style: "decimal",
|
|
868
|
+
useGrouping: false,
|
|
869
|
+
currency: undefined,
|
|
870
|
+
currencyDisplay: undefined,
|
|
871
|
+
notation: "standard",
|
|
872
|
+
compactDisplay: undefined
|
|
873
|
+
};
|
|
874
|
+
if ($$props.format?.style === "percent") {
|
|
875
|
+
const asPercent = roundToPrecision(v * 100, 12);
|
|
876
|
+
return formatNumber(asPercent, $3.get(resolvedLocale), editFormat);
|
|
877
|
+
}
|
|
878
|
+
return formatNumber(v, $3.get(resolvedLocale), editFormat);
|
|
879
|
+
}
|
|
880
|
+
function ariaValueNowFromText(text) {
|
|
881
|
+
const result = parseLocaleNumber(text, $3.get(resolvedLocale), $$props.format);
|
|
882
|
+
if (result.status !== "valid")
|
|
883
|
+
return;
|
|
884
|
+
return Number.isFinite(result.value) ? result.value : undefined;
|
|
885
|
+
}
|
|
886
|
+
const resolvedAriaValueNow = $3.derived(() => $3.get(isFocused) ? ariaValueNowFromText($3.get(editorBuffer)) : value() === null || value() === undefined ? undefined : $$props.format?.style === "percent" ? roundToPrecision(value() * 100, 12) : value());
|
|
887
|
+
const resolvedAriaValueMin = $3.derived(() => Number.isFinite($3.get(resolvedMin)) ? $$props.format?.style === "percent" ? roundToPrecision($3.get(resolvedMin) * 100, 12) : $3.get(resolvedMin) : undefined);
|
|
888
|
+
const resolvedAriaValueMax = $3.derived(() => Number.isFinite($3.get(resolvedMax)) ? $$props.format?.style === "percent" ? roundToPrecision($3.get(resolvedMax) * 100, 12) : $3.get(resolvedMax) : undefined);
|
|
889
|
+
function onFocus() {
|
|
890
|
+
if (!$3.get(malformedError)) {
|
|
891
|
+
$3.set(editorBuffer, value() === null || value() === undefined ? "" : buildEditDisplay(value()), true);
|
|
892
|
+
}
|
|
893
|
+
$3.set(isFocused, true);
|
|
894
|
+
}
|
|
895
|
+
function onBlur(event) {
|
|
896
|
+
const buffered = $3.get(editorBuffer);
|
|
897
|
+
$3.set(isFocused, false);
|
|
898
|
+
commitFromText("typed", buffered);
|
|
899
|
+
$$props.onblur?.(event);
|
|
900
|
+
}
|
|
901
|
+
function onInput(event) {
|
|
902
|
+
$3.set(editorBuffer, event.currentTarget.value, true);
|
|
903
|
+
if ($3.get(malformedError)) {
|
|
904
|
+
$3.set(malformedError, false);
|
|
905
|
+
$3.get(inputElement)?.setCustomValidity("");
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
function getBaseForStep(direction) {
|
|
909
|
+
const parsed = $3.get(isFocused) ? parseLocaleNumber($3.get(editorBuffer), $3.get(resolvedLocale), $$props.format) : null;
|
|
910
|
+
let baseFromDisplay = null;
|
|
911
|
+
if (parsed && parsed.status === "valid") {
|
|
912
|
+
baseFromDisplay = $$props.format?.style === "percent" ? roundToPrecision(parsed.value / 100, Math.max(2, fractionalDigits(parsed.value) + 2)) : parsed.value;
|
|
913
|
+
}
|
|
914
|
+
const defaultStart = direction === "increment" ? Number.isFinite($3.get(resolvedMin)) ? $3.get(resolvedMin) : 0 : Number.isFinite($3.get(resolvedMax)) ? $3.get(resolvedMax) : 0;
|
|
915
|
+
return baseFromDisplay ?? value() ?? defaultStart;
|
|
916
|
+
}
|
|
917
|
+
function stepBy(direction, multiplier = 1) {
|
|
918
|
+
const base = getBaseForStep(direction);
|
|
919
|
+
const delta = $3.get(incrementStep) * multiplier * (direction === "increment" ? 1 : -1);
|
|
920
|
+
const next = commitFromNumber("delta", base + delta);
|
|
921
|
+
if ($3.get(isFocused)) {
|
|
922
|
+
$3.set(editorBuffer, next === null ? "" : buildEditDisplay(next), true);
|
|
923
|
+
}
|
|
924
|
+
$3.get(inputElement)?.focus();
|
|
925
|
+
}
|
|
926
|
+
function onKeyDown(event) {
|
|
927
|
+
if ($3.get(resolvedDisabled))
|
|
928
|
+
return;
|
|
929
|
+
switch (event.key) {
|
|
930
|
+
case "ArrowUp":
|
|
931
|
+
event.preventDefault();
|
|
932
|
+
stepBy("increment");
|
|
933
|
+
break;
|
|
934
|
+
case "ArrowDown":
|
|
935
|
+
event.preventDefault();
|
|
936
|
+
stepBy("decrement");
|
|
937
|
+
break;
|
|
938
|
+
case "PageUp":
|
|
939
|
+
event.preventDefault();
|
|
940
|
+
stepBy("increment", 10);
|
|
941
|
+
break;
|
|
942
|
+
case "PageDown":
|
|
943
|
+
event.preventDefault();
|
|
944
|
+
stepBy("decrement", 10);
|
|
945
|
+
break;
|
|
946
|
+
case "Home":
|
|
947
|
+
if (Number.isFinite($3.get(resolvedMin))) {
|
|
948
|
+
event.preventDefault();
|
|
949
|
+
const homeNext = commitFromNumber("delta", $3.get(resolvedMin));
|
|
950
|
+
if ($3.get(isFocused))
|
|
951
|
+
$3.set(editorBuffer, homeNext === null ? "" : buildEditDisplay(homeNext), true);
|
|
952
|
+
}
|
|
953
|
+
break;
|
|
954
|
+
case "End":
|
|
955
|
+
if (Number.isFinite($3.get(resolvedMax))) {
|
|
956
|
+
event.preventDefault();
|
|
957
|
+
const endNext = commitFromNumber("delta", $3.get(resolvedMax));
|
|
958
|
+
if ($3.get(isFocused))
|
|
959
|
+
$3.set(editorBuffer, endNext === null ? "" : buildEditDisplay(endNext), true);
|
|
960
|
+
}
|
|
961
|
+
break;
|
|
962
|
+
case "Enter": {
|
|
963
|
+
event.preventDefault();
|
|
964
|
+
commitFromText("typed", $3.get(isFocused) ? $3.get(editorBuffer) : "");
|
|
965
|
+
const form = $3.get(inputElement)?.closest("form");
|
|
966
|
+
if (form) {
|
|
967
|
+
if (form.checkValidity()) {
|
|
968
|
+
enterKeyFlushed = true;
|
|
969
|
+
form.requestSubmit();
|
|
970
|
+
} else {
|
|
971
|
+
form.reportValidity();
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
break;
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
$3.user_effect(() => {
|
|
979
|
+
if (!$3.get(inputElement))
|
|
980
|
+
return;
|
|
981
|
+
const form = $3.get(inputElement).closest("form");
|
|
982
|
+
if (!form)
|
|
983
|
+
return;
|
|
984
|
+
const onSubmit = () => {
|
|
985
|
+
if ($3.get(resolvedDisabled))
|
|
986
|
+
return;
|
|
987
|
+
if (enterKeyFlushed) {
|
|
988
|
+
enterKeyFlushed = false;
|
|
989
|
+
return;
|
|
990
|
+
}
|
|
991
|
+
if ($3.get(isFocused))
|
|
992
|
+
commitFromText("typed", $3.get(editorBuffer));
|
|
993
|
+
};
|
|
994
|
+
const onReset = () => {
|
|
995
|
+
if ($3.get(resolvedDisabled))
|
|
996
|
+
return;
|
|
997
|
+
commitFromNumber("reset", defaultValue() ?? null, defaultValue() === null ? "empty" : "valid");
|
|
998
|
+
};
|
|
999
|
+
form.addEventListener("submit", onSubmit, true);
|
|
1000
|
+
form.addEventListener("reset", onReset);
|
|
1001
|
+
return () => {
|
|
1002
|
+
form.removeEventListener("submit", onSubmit, true);
|
|
1003
|
+
form.removeEventListener("reset", onReset);
|
|
1004
|
+
};
|
|
1005
|
+
});
|
|
1006
|
+
const internalErrorMessage = $3.derived(() => !$$props.error && $3.get(malformedError) ? "Please enter a valid number." : !$$props.error && $3.get(requiredEmptyError) ? "Please enter a number." : null);
|
|
1007
|
+
const internalErrorId = $3.derived(() => $3.get(internalErrorMessage) ? `${$$props.id}-internal-error` : undefined);
|
|
1008
|
+
const internalInvalid = $3.derived(() => $3.get(malformedError) || $3.get(requiredEmptyError) ? "true" : undefined);
|
|
1009
|
+
const field = $3.derived(() => resolveFieldControl({
|
|
1010
|
+
id: $$props.id,
|
|
1011
|
+
generatedId: $$props.id,
|
|
1012
|
+
context,
|
|
1013
|
+
hasDescription: !!$$props.description,
|
|
1014
|
+
hasError: !!$$props.error,
|
|
1015
|
+
localIdNamespace: "number-input",
|
|
1016
|
+
consumerDescribedBy: $$props["aria-describedby"],
|
|
1017
|
+
consumerInvalid: $3.get(internalInvalid) ?? rest["aria-invalid"],
|
|
1018
|
+
additionalDescribedBy: [$3.get(internalErrorId)],
|
|
1019
|
+
required: $$props.required,
|
|
1020
|
+
disabled: $$props.disabled
|
|
1021
|
+
}));
|
|
1022
|
+
const ownDescriptionId = $3.derived(() => $3.get(field).ownDescriptionId);
|
|
1023
|
+
const ownErrorId = $3.derived(() => $3.get(field).ownErrorId);
|
|
1024
|
+
const describedBy = $3.derived(() => $3.get(field).describedBy);
|
|
1025
|
+
const resolvedAriaInvalid = $3.derived(() => $3.get(field).ariaInvalid);
|
|
1026
|
+
const incrementDisabled = $3.derived(() => $3.get(resolvedDisabled) || value() !== null && value() !== undefined && value() >= $3.get(resolvedMax));
|
|
1027
|
+
const decrementDisabled = $3.derived(() => $3.get(resolvedDisabled) || value() !== null && value() !== undefined && value() <= $3.get(resolvedMin));
|
|
1028
|
+
const showHiddenInput = $3.derived(() => typeof $$props.name === "string" && $$props.name.length > 0 && !$3.get(resolvedDisabled));
|
|
1029
|
+
const stepperLabelSuffix = $3.derived(() => $$props.label ? ` ${$$props.label} by ${$3.get(incrementStep)}` : ` by ${$3.get(incrementStep)}`);
|
|
1030
|
+
var div = root_52();
|
|
1031
|
+
var node = $3.child(div);
|
|
1032
|
+
{
|
|
1033
|
+
var consequent_1 = ($$anchor2) => {
|
|
1034
|
+
var label_1 = root_13();
|
|
1035
|
+
var text_1 = $3.child(label_1);
|
|
1036
|
+
var node_1 = $3.sibling(text_1);
|
|
1037
|
+
{
|
|
1038
|
+
var consequent = ($$anchor3) => {
|
|
1039
|
+
var span = root3();
|
|
1040
|
+
$3.append($$anchor3, span);
|
|
1041
|
+
};
|
|
1042
|
+
$3.if(node_1, ($$render) => {
|
|
1043
|
+
if ($3.get(resolvedRequired))
|
|
1044
|
+
$$render(consequent);
|
|
1045
|
+
});
|
|
1046
|
+
}
|
|
1047
|
+
$3.reset(label_1);
|
|
1048
|
+
$3.template_effect(() => {
|
|
1049
|
+
$3.set_attribute(label_1, "for", $$props.id);
|
|
1050
|
+
$3.set_attribute(label_1, "data-disabled", $3.get(resolvedDisabled) || undefined);
|
|
1051
|
+
$3.set_text(text_1, `${$$props.label ?? ""} `);
|
|
1052
|
+
});
|
|
1053
|
+
$3.append($$anchor2, label_1);
|
|
1054
|
+
};
|
|
1055
|
+
$3.if(node, ($$render) => {
|
|
1056
|
+
if ($$props.label)
|
|
1057
|
+
$$render(consequent_1);
|
|
1058
|
+
});
|
|
1059
|
+
}
|
|
1060
|
+
var div_1 = $3.sibling(node, 2);
|
|
1061
|
+
var input = $3.child(div_1);
|
|
1062
|
+
$3.attribute_effect(input, () => ({
|
|
1063
|
+
id: $$props.id,
|
|
1064
|
+
type: "text",
|
|
1065
|
+
role: "spinbutton",
|
|
1066
|
+
inputmode: "decimal",
|
|
1067
|
+
value: $3.get(displayValue),
|
|
1068
|
+
disabled: $3.get(resolvedDisabled),
|
|
1069
|
+
required: $3.get(resolvedRequired),
|
|
1070
|
+
class: "cinder-input cinder-number-input__input",
|
|
1071
|
+
...rest,
|
|
1072
|
+
"aria-invalid": $3.get(resolvedAriaInvalid),
|
|
1073
|
+
"aria-describedby": $3.get(describedBy),
|
|
1074
|
+
"aria-valuenow": $3.get(resolvedAriaValueNow),
|
|
1075
|
+
"aria-valuemin": $3.get(resolvedAriaValueMin),
|
|
1076
|
+
"aria-valuemax": $3.get(resolvedAriaValueMax),
|
|
1077
|
+
oninput: onInput,
|
|
1078
|
+
onfocus: onFocus,
|
|
1079
|
+
onblur: onBlur,
|
|
1080
|
+
onkeydown: onKeyDown
|
|
1081
|
+
}), undefined, undefined, undefined, undefined, true);
|
|
1082
|
+
$3.bind_this(input, ($$value) => $3.set(inputElement, $$value), () => $3.get(inputElement));
|
|
1083
|
+
var button = $3.sibling(input, 2);
|
|
1084
|
+
var button_1 = $3.sibling(button, 2);
|
|
1085
|
+
$3.reset(div_1);
|
|
1086
|
+
var node_2 = $3.sibling(div_1, 2);
|
|
1087
|
+
{
|
|
1088
|
+
var consequent_2 = ($$anchor2) => {
|
|
1089
|
+
var input_1 = root_23();
|
|
1090
|
+
$3.remove_input_defaults(input_1);
|
|
1091
|
+
$3.template_effect(($0) => {
|
|
1092
|
+
$3.set_attribute(input_1, "name", $$props.name);
|
|
1093
|
+
$3.set_value(input_1, $0);
|
|
1094
|
+
}, [
|
|
1095
|
+
() => value() === null || value() === undefined ? "" : String(value())
|
|
1096
|
+
]);
|
|
1097
|
+
$3.append($$anchor2, input_1);
|
|
1098
|
+
};
|
|
1099
|
+
$3.if(node_2, ($$render) => {
|
|
1100
|
+
if ($3.get(showHiddenInput))
|
|
1101
|
+
$$render(consequent_2);
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
var node_3 = $3.sibling(node_2, 2);
|
|
1105
|
+
{
|
|
1106
|
+
var consequent_3 = ($$anchor2) => {
|
|
1107
|
+
var p = root_33();
|
|
1108
|
+
var text_2 = $3.child(p, true);
|
|
1109
|
+
$3.reset(p);
|
|
1110
|
+
$3.template_effect(() => {
|
|
1111
|
+
$3.set_attribute(p, "id", $3.get(ownDescriptionId));
|
|
1112
|
+
$3.set_text(text_2, $$props.description);
|
|
1113
|
+
});
|
|
1114
|
+
$3.append($$anchor2, p);
|
|
1115
|
+
};
|
|
1116
|
+
$3.if(node_3, ($$render) => {
|
|
1117
|
+
if ($$props.description)
|
|
1118
|
+
$$render(consequent_3);
|
|
1119
|
+
});
|
|
1120
|
+
}
|
|
1121
|
+
var node_4 = $3.sibling(node_3, 2);
|
|
1122
|
+
{
|
|
1123
|
+
var consequent_4 = ($$anchor2) => {
|
|
1124
|
+
var p_1 = root_42();
|
|
1125
|
+
var text_3 = $3.child(p_1, true);
|
|
1126
|
+
$3.reset(p_1);
|
|
1127
|
+
$3.template_effect(() => {
|
|
1128
|
+
$3.set_attribute(p_1, "id", $3.get(ownErrorId));
|
|
1129
|
+
$3.set_text(text_3, $$props.error);
|
|
1130
|
+
});
|
|
1131
|
+
$3.append($$anchor2, p_1);
|
|
1132
|
+
};
|
|
1133
|
+
var consequent_5 = ($$anchor2) => {
|
|
1134
|
+
var p_2 = root_42();
|
|
1135
|
+
var text_4 = $3.child(p_2, true);
|
|
1136
|
+
$3.reset(p_2);
|
|
1137
|
+
$3.template_effect(() => {
|
|
1138
|
+
$3.set_attribute(p_2, "id", $3.get(internalErrorId));
|
|
1139
|
+
$3.set_text(text_4, $3.get(internalErrorMessage));
|
|
1140
|
+
});
|
|
1141
|
+
$3.append($$anchor2, p_2);
|
|
1142
|
+
};
|
|
1143
|
+
$3.if(node_4, ($$render) => {
|
|
1144
|
+
if ($$props.error)
|
|
1145
|
+
$$render(consequent_4);
|
|
1146
|
+
else if ($3.get(internalErrorMessage))
|
|
1147
|
+
$$render(consequent_5, 1);
|
|
1148
|
+
});
|
|
1149
|
+
}
|
|
1150
|
+
$3.reset(div);
|
|
1151
|
+
$3.template_effect(($0) => {
|
|
1152
|
+
$3.set_class(div, 1, $0);
|
|
1153
|
+
$3.set_attribute(div_1, "data-disabled", $3.get(resolvedDisabled) ? "" : undefined);
|
|
1154
|
+
$3.set_attribute(button, "aria-label", `Increment${$3.get(stepperLabelSuffix)}`);
|
|
1155
|
+
button.disabled = $3.get(incrementDisabled);
|
|
1156
|
+
$3.set_attribute(button_1, "aria-label", `Decrement${$3.get(stepperLabelSuffix)}`);
|
|
1157
|
+
button_1.disabled = $3.get(decrementDisabled);
|
|
1158
|
+
}, [
|
|
1159
|
+
() => $3.clsx(classNames("cinder-input-field", $$props.class))
|
|
1160
|
+
]);
|
|
1161
|
+
$3.delegated("click", button, () => stepBy("increment"));
|
|
1162
|
+
$3.delegated("click", button_1, () => stepBy("decrement"));
|
|
1163
|
+
$3.append($$anchor, div);
|
|
1164
|
+
$3.pop();
|
|
1165
|
+
}
|
|
1166
|
+
$3.delegate(["click"]);
|
|
1167
|
+
|
|
1168
|
+
// src/components/segment/segment.svelte
|
|
1169
|
+
import"svelte/internal/disclose-version";
|
|
1170
|
+
import * as $5 from "svelte/internal/client";
|
|
1171
|
+
import { untrack as untrack2 } from "svelte";
|
|
1172
|
+
|
|
1173
|
+
// src/components/segmented-control/segmented-control-state.svelte.ts
|
|
1174
|
+
import * as $4 from "svelte/internal/client";
|
|
1175
|
+
|
|
1176
|
+
// src/_internal/strict-stable-context.ts
|
|
1177
|
+
import { getContext, setContext } from "svelte";
|
|
1178
|
+
function strictStableContext(key, missingMessage) {
|
|
1179
|
+
const contextKey = Symbol.for(key);
|
|
1180
|
+
return [
|
|
1181
|
+
() => {
|
|
1182
|
+
const context = getContext(contextKey);
|
|
1183
|
+
if (context === undefined) {
|
|
1184
|
+
throw new Error(`missing_context: ${missingMessage}`);
|
|
1185
|
+
}
|
|
1186
|
+
return context;
|
|
1187
|
+
},
|
|
1188
|
+
(context) => setContext(contextKey, context)
|
|
1189
|
+
];
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
// src/utilities/document-order.ts
|
|
1193
|
+
var DOCUMENT_POSITION_PRECEDING = 2;
|
|
1194
|
+
var DOCUMENT_POSITION_FOLLOWING = 4;
|
|
1195
|
+
function inDocumentOrder(items) {
|
|
1196
|
+
const sortedItems = [...items];
|
|
1197
|
+
sortedItems.sort((a, b) => {
|
|
1198
|
+
if (a.node === b.node)
|
|
1199
|
+
return 0;
|
|
1200
|
+
const position = a.node.compareDocumentPosition(b.node);
|
|
1201
|
+
if (position & DOCUMENT_POSITION_FOLLOWING)
|
|
1202
|
+
return -1;
|
|
1203
|
+
if (position & DOCUMENT_POSITION_PRECEDING)
|
|
1204
|
+
return 1;
|
|
1205
|
+
return 0;
|
|
1206
|
+
});
|
|
1207
|
+
return sortedItems;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
// src/utilities/roving-tabindex.ts
|
|
1211
|
+
var ROVING_KEYS = new Set(["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End"]);
|
|
1212
|
+
function isRovingKey(key) {
|
|
1213
|
+
return ROVING_KEYS.has(key);
|
|
1214
|
+
}
|
|
1215
|
+
function findNextIndex(currentIndex, length, direction, isDisabled) {
|
|
1216
|
+
if (length === 0)
|
|
1217
|
+
return -1;
|
|
1218
|
+
if (!isDisabled) {
|
|
1219
|
+
return (currentIndex + direction + length) % length;
|
|
1220
|
+
}
|
|
1221
|
+
for (let offset = 1;offset <= length; offset += 1) {
|
|
1222
|
+
const candidateIndex = (currentIndex + offset * direction + length * offset) % length;
|
|
1223
|
+
if (!isDisabled(candidateIndex)) {
|
|
1224
|
+
return candidateIndex;
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
return currentIndex;
|
|
1228
|
+
}
|
|
1229
|
+
function findFirstIndex(length, isDisabled, currentIndex = 0) {
|
|
1230
|
+
if (length === 0)
|
|
1231
|
+
return -1;
|
|
1232
|
+
if (!isDisabled)
|
|
1233
|
+
return 0;
|
|
1234
|
+
for (let index = 0;index < length; index += 1) {
|
|
1235
|
+
if (!isDisabled(index))
|
|
1236
|
+
return index;
|
|
1237
|
+
}
|
|
1238
|
+
return currentIndex;
|
|
1239
|
+
}
|
|
1240
|
+
function findLastIndex(length, isDisabled, currentIndex = 0) {
|
|
1241
|
+
if (length === 0)
|
|
1242
|
+
return -1;
|
|
1243
|
+
if (!isDisabled)
|
|
1244
|
+
return length - 1;
|
|
1245
|
+
for (let index = length - 1;index >= 0; index -= 1) {
|
|
1246
|
+
if (!isDisabled(index))
|
|
1247
|
+
return index;
|
|
1248
|
+
}
|
|
1249
|
+
return currentIndex;
|
|
1250
|
+
}
|
|
1251
|
+
function handleRovingKeydown(event, currentIndex, length, options = {}) {
|
|
1252
|
+
const { isDisabled, vertical = true, horizontal = true } = options;
|
|
1253
|
+
if (length === 0)
|
|
1254
|
+
return null;
|
|
1255
|
+
switch (event.key) {
|
|
1256
|
+
case "ArrowRight":
|
|
1257
|
+
return horizontal ? findNextIndex(currentIndex, length, 1, isDisabled) : null;
|
|
1258
|
+
case "ArrowDown":
|
|
1259
|
+
return vertical ? findNextIndex(currentIndex, length, 1, isDisabled) : null;
|
|
1260
|
+
case "ArrowLeft":
|
|
1261
|
+
return horizontal ? findNextIndex(currentIndex, length, -1, isDisabled) : null;
|
|
1262
|
+
case "ArrowUp":
|
|
1263
|
+
return vertical ? findNextIndex(currentIndex, length, -1, isDisabled) : null;
|
|
1264
|
+
case "Home":
|
|
1265
|
+
return findFirstIndex(length, isDisabled, currentIndex);
|
|
1266
|
+
case "End":
|
|
1267
|
+
return findLastIndex(length, isDisabled, currentIndex);
|
|
1268
|
+
default:
|
|
1269
|
+
return null;
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
function getFocusableIndex(selectedIndex, length, isDisabled) {
|
|
1273
|
+
if (length === 0)
|
|
1274
|
+
return -1;
|
|
1275
|
+
if (selectedIndex >= 0 && selectedIndex < length)
|
|
1276
|
+
return selectedIndex;
|
|
1277
|
+
return findFirstIndex(length, isDisabled, 0);
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
// src/components/segmented-control/segmented-control-state.svelte.ts
|
|
1281
|
+
var [getSegmentedControlContext, setSegmentedControlContext] = strictStableContext("@lostgradient/cinder/segmented-control/context", "Segment must be rendered inside a SegmentedControl");
|
|
1282
|
+
class SegmentedControlController {
|
|
1283
|
+
#registrations = [];
|
|
1284
|
+
#version = $4.state(0);
|
|
1285
|
+
#options;
|
|
1286
|
+
constructor(options) {
|
|
1287
|
+
this.#options = options;
|
|
1288
|
+
}
|
|
1289
|
+
get segments() {
|
|
1290
|
+
$4.get(this.#version);
|
|
1291
|
+
return inDocumentOrder(this.#registrations);
|
|
1292
|
+
}
|
|
1293
|
+
get selectionMode() {
|
|
1294
|
+
return this.#options.selectionMode();
|
|
1295
|
+
}
|
|
1296
|
+
get variant() {
|
|
1297
|
+
return this.#options.variant();
|
|
1298
|
+
}
|
|
1299
|
+
get controlDisabled() {
|
|
1300
|
+
return this.#options.controlDisabled();
|
|
1301
|
+
}
|
|
1302
|
+
register(registration) {
|
|
1303
|
+
this.#registrations.push(registration);
|
|
1304
|
+
$4.set(this.#version, $4.get(this.#version) + 1);
|
|
1305
|
+
return () => {
|
|
1306
|
+
const index = this.#registrations.indexOf(registration);
|
|
1307
|
+
if (index >= 0)
|
|
1308
|
+
this.#registrations.splice(index, 1);
|
|
1309
|
+
$4.set(this.#version, $4.get(this.#version) + 1);
|
|
1310
|
+
};
|
|
1311
|
+
}
|
|
1312
|
+
isSelected(value) {
|
|
1313
|
+
const current = this.#options.getValue();
|
|
1314
|
+
if (this.#options.selectionMode() === "multiple") {
|
|
1315
|
+
if (!current || typeof current === "string")
|
|
1316
|
+
return false;
|
|
1317
|
+
return current.has(value);
|
|
1318
|
+
}
|
|
1319
|
+
return current === value;
|
|
1320
|
+
}
|
|
1321
|
+
isFocusable(value) {
|
|
1322
|
+
if (this.#options.selectionMode() !== "single") {
|
|
1323
|
+
const segment = this.segments.find((entry) => entry.value === value);
|
|
1324
|
+
if (!segment)
|
|
1325
|
+
return false;
|
|
1326
|
+
return !segment.disabled && !this.#options.controlDisabled();
|
|
1327
|
+
}
|
|
1328
|
+
const focusableValue = this.#computeFocusableValue();
|
|
1329
|
+
return focusableValue === value;
|
|
1330
|
+
}
|
|
1331
|
+
#computeFocusableValue() {
|
|
1332
|
+
const segments = this.segments;
|
|
1333
|
+
if (segments.length === 0)
|
|
1334
|
+
return null;
|
|
1335
|
+
const current = this.#options.getValue();
|
|
1336
|
+
const isMultiple = this.#options.selectionMode() === "multiple";
|
|
1337
|
+
if (!isMultiple && typeof current === "string") {
|
|
1338
|
+
const selectedSegment = segments.find((segment) => segment.value === current);
|
|
1339
|
+
if (selectedSegment && !selectedSegment.disabled && !this.#options.controlDisabled()) {
|
|
1340
|
+
return selectedSegment.value;
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
if (this.#options.controlDisabled())
|
|
1344
|
+
return null;
|
|
1345
|
+
const firstEnabled = segments.find((segment) => !segment.disabled);
|
|
1346
|
+
return firstEnabled?.value ?? null;
|
|
1347
|
+
}
|
|
1348
|
+
toggle(value) {
|
|
1349
|
+
if (this.#options.controlDisabled())
|
|
1350
|
+
return;
|
|
1351
|
+
const segment = this.segments.find((entry) => entry.value === value);
|
|
1352
|
+
if (!segment || segment.disabled)
|
|
1353
|
+
return;
|
|
1354
|
+
if (this.#options.selectionMode() === "multiple") {
|
|
1355
|
+
const set4 = this.#options.getValue();
|
|
1356
|
+
if (!set4 || typeof set4 === "string")
|
|
1357
|
+
return;
|
|
1358
|
+
if (set4.has(value))
|
|
1359
|
+
set4.delete(value);
|
|
1360
|
+
else
|
|
1361
|
+
set4.add(value);
|
|
1362
|
+
return;
|
|
1363
|
+
}
|
|
1364
|
+
const current = this.#options.getValue();
|
|
1365
|
+
if (current === value) {
|
|
1366
|
+
if (!this.#options.disallowEmptySelection()) {
|
|
1367
|
+
this.#options.setValue(undefined);
|
|
1368
|
+
}
|
|
1369
|
+
return;
|
|
1370
|
+
}
|
|
1371
|
+
this.#options.setValue(value);
|
|
1372
|
+
this.#options.onChange?.(value);
|
|
1373
|
+
}
|
|
1374
|
+
handleKeydown(event) {
|
|
1375
|
+
if (this.#options.controlDisabled())
|
|
1376
|
+
return;
|
|
1377
|
+
if (this.#options.selectionMode() !== "single")
|
|
1378
|
+
return;
|
|
1379
|
+
const segments = this.segments;
|
|
1380
|
+
if (segments.length === 0)
|
|
1381
|
+
return;
|
|
1382
|
+
const focusedSegment = typeof document === "undefined" ? null : segments.find((segment) => segment.node === document.activeElement) ?? null;
|
|
1383
|
+
const value = this.#options.getValue();
|
|
1384
|
+
const currentValue = focusedSegment?.value ?? (typeof value === "string" ? value : null);
|
|
1385
|
+
const currentIndex = currentValue === null ? segments.findIndex((segment) => !segment.disabled) : segments.findIndex((segment) => segment.value === currentValue);
|
|
1386
|
+
const safeCurrentIndex = currentIndex >= 0 ? currentIndex : getFocusableIndex(-1, segments.length, (index) => segments[index]?.disabled ?? false);
|
|
1387
|
+
if (safeCurrentIndex < 0)
|
|
1388
|
+
return;
|
|
1389
|
+
const orientation = this.#options.orientation();
|
|
1390
|
+
const nextIndex = handleRovingKeydown(event, safeCurrentIndex, segments.length, {
|
|
1391
|
+
isDisabled: (index) => segments[index]?.disabled ?? false,
|
|
1392
|
+
vertical: true,
|
|
1393
|
+
horizontal: orientation !== "vertical"
|
|
1394
|
+
});
|
|
1395
|
+
if (nextIndex === null)
|
|
1396
|
+
return;
|
|
1397
|
+
event.preventDefault();
|
|
1398
|
+
if (nextIndex === safeCurrentIndex)
|
|
1399
|
+
return;
|
|
1400
|
+
const nextSegment = segments[nextIndex];
|
|
1401
|
+
if (!nextSegment)
|
|
1402
|
+
return;
|
|
1403
|
+
this.toggle(nextSegment.value);
|
|
1404
|
+
nextSegment.node.focus();
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
// src/components/segment/segment.svelte
|
|
1409
|
+
var rest_excludes4 = new Set([
|
|
1410
|
+
"$$slots",
|
|
1411
|
+
"$$events",
|
|
1412
|
+
"$$legacy",
|
|
1413
|
+
"value",
|
|
1414
|
+
"disabled",
|
|
1415
|
+
"controls",
|
|
1416
|
+
"leading",
|
|
1417
|
+
"trailing",
|
|
1418
|
+
"children",
|
|
1419
|
+
"class"
|
|
1420
|
+
]);
|
|
1421
|
+
var root4 = $5.from_html(`<span class="cinder-segmented-control-option-icon" aria-hidden="true"><!></span>`);
|
|
1422
|
+
var root_14 = $5.from_html(`<span class="cinder-segmented-control-option-trailing" aria-hidden="true"><!></span>`);
|
|
1423
|
+
var root_24 = $5.from_html(`<button><!> <!> <!></button>`);
|
|
1424
|
+
function Segment($$anchor, $$props) {
|
|
1425
|
+
$5.push($$props, true);
|
|
1426
|
+
let disabled = $5.prop($$props, "disabled", 3, false), rest = $5.rest_props($$props, rest_excludes4);
|
|
1427
|
+
const context = getSegmentedControlContext();
|
|
1428
|
+
const registerSegment = (node) => {
|
|
1429
|
+
return untrack2(() => context.register({
|
|
1430
|
+
node,
|
|
1431
|
+
get value() {
|
|
1432
|
+
return $$props.value;
|
|
1433
|
+
},
|
|
1434
|
+
get disabled() {
|
|
1435
|
+
return disabled() || context.controlDisabled;
|
|
1436
|
+
},
|
|
1437
|
+
get controls() {
|
|
1438
|
+
return $$props.controls;
|
|
1439
|
+
}
|
|
1440
|
+
}));
|
|
1441
|
+
};
|
|
1442
|
+
const isSelected = $5.derived(() => context.isSelected($$props.value));
|
|
1443
|
+
const isFocusable = $5.derived(() => context.isFocusable($$props.value));
|
|
1444
|
+
const effectiveDisabled = $5.derived(() => disabled() || context.controlDisabled);
|
|
1445
|
+
const role = $5.derived(() => context.selectionMode === "multiple" ? undefined : context.variant === "tablist" ? "tab" : "radio");
|
|
1446
|
+
var button = root_24();
|
|
1447
|
+
var event_handler = () => context.toggle($$props.value);
|
|
1448
|
+
$5.attribute_effect(button, ($0) => ({
|
|
1449
|
+
...rest,
|
|
1450
|
+
type: "button",
|
|
1451
|
+
role: $5.get(role),
|
|
1452
|
+
"data-cinder-segment-value": $$props.value,
|
|
1453
|
+
"aria-checked": $5.get(role) === "radio" ? $5.get(isSelected) : undefined,
|
|
1454
|
+
"aria-selected": $5.get(role) === "tab" ? $5.get(isSelected) : undefined,
|
|
1455
|
+
"aria-pressed": context.selectionMode === "multiple" ? $5.get(isSelected) : undefined,
|
|
1456
|
+
"aria-controls": $5.get(role) === "tab" ? $$props.controls : undefined,
|
|
1457
|
+
"aria-disabled": $5.get(effectiveDisabled) ? "true" : undefined,
|
|
1458
|
+
disabled: context.selectionMode === "multiple" ? $5.get(effectiveDisabled) : undefined,
|
|
1459
|
+
tabindex: $5.get(isFocusable) ? 0 : -1,
|
|
1460
|
+
class: $0,
|
|
1461
|
+
"data-cinder-selected": $5.get(isSelected) ? "" : undefined,
|
|
1462
|
+
"data-cinder-pressed": context.selectionMode === "multiple" && $5.get(isSelected) ? "" : undefined,
|
|
1463
|
+
onclick: event_handler
|
|
1464
|
+
}), [
|
|
1465
|
+
() => classNames("cinder-segmented-control-option", $$props.class)
|
|
1466
|
+
]);
|
|
1467
|
+
var node_1 = $5.child(button);
|
|
1468
|
+
{
|
|
1469
|
+
var consequent = ($$anchor2) => {
|
|
1470
|
+
var span = root4();
|
|
1471
|
+
var node_2 = $5.child(span);
|
|
1472
|
+
$5.snippet(node_2, () => $$props.leading);
|
|
1473
|
+
$5.reset(span);
|
|
1474
|
+
$5.append($$anchor2, span);
|
|
1475
|
+
};
|
|
1476
|
+
$5.if(node_1, ($$render) => {
|
|
1477
|
+
if ($$props.leading)
|
|
1478
|
+
$$render(consequent);
|
|
1479
|
+
});
|
|
1480
|
+
}
|
|
1481
|
+
var node_3 = $5.sibling(node_1, 2);
|
|
1482
|
+
$5.snippet(node_3, () => $$props.children ?? $5.noop);
|
|
1483
|
+
var node_4 = $5.sibling(node_3, 2);
|
|
1484
|
+
{
|
|
1485
|
+
var consequent_1 = ($$anchor2) => {
|
|
1486
|
+
var span_1 = root_14();
|
|
1487
|
+
var node_5 = $5.child(span_1);
|
|
1488
|
+
$5.snippet(node_5, () => $$props.trailing);
|
|
1489
|
+
$5.reset(span_1);
|
|
1490
|
+
$5.append($$anchor2, span_1);
|
|
1491
|
+
};
|
|
1492
|
+
$5.if(node_4, ($$render) => {
|
|
1493
|
+
if ($$props.trailing)
|
|
1494
|
+
$$render(consequent_1);
|
|
1495
|
+
});
|
|
1496
|
+
}
|
|
1497
|
+
$5.reset(button);
|
|
1498
|
+
$5.attach(button, () => registerSegment);
|
|
1499
|
+
$5.append($$anchor, button);
|
|
1500
|
+
$5.pop();
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
// src/components/segmented-control/segmented-control.svelte
|
|
1504
|
+
import"svelte/internal/disclose-version";
|
|
1505
|
+
import * as $6 from "svelte/internal/client";
|
|
1506
|
+
import { untrack as untrack3 } from "svelte";
|
|
1507
|
+
import { SvelteSet } from "svelte/reactivity";
|
|
1508
|
+
var rest_excludes5 = new Set([
|
|
1509
|
+
"$$slots",
|
|
1510
|
+
"$$events",
|
|
1511
|
+
"$$legacy",
|
|
1512
|
+
"id",
|
|
1513
|
+
"value",
|
|
1514
|
+
"label",
|
|
1515
|
+
"name",
|
|
1516
|
+
"hideLabel",
|
|
1517
|
+
"disabled",
|
|
1518
|
+
"size",
|
|
1519
|
+
"density",
|
|
1520
|
+
"orientation",
|
|
1521
|
+
"detached",
|
|
1522
|
+
"fullWidth",
|
|
1523
|
+
"variant",
|
|
1524
|
+
"selectionMode",
|
|
1525
|
+
"disallowEmptySelection",
|
|
1526
|
+
"class",
|
|
1527
|
+
"onchange",
|
|
1528
|
+
"children"
|
|
1529
|
+
]);
|
|
1530
|
+
var root5 = $6.from_html(`<input type="hidden"/>`);
|
|
1531
|
+
var root_15 = $6.from_html(`<input type="hidden" disabled=""/> <!>`, 1);
|
|
1532
|
+
var root_25 = $6.from_html(`<div class="cinder-segmented-control-container"><span> </span> <div><!></div> <!></div>`);
|
|
1533
|
+
function Segmented_control($$anchor, $$props) {
|
|
1534
|
+
$6.push($$props, true);
|
|
1535
|
+
let value = $6.prop($$props, "value", 15), hideLabel = $6.prop($$props, "hideLabel", 3, false), disabled = $6.prop($$props, "disabled", 3, false), size = $6.prop($$props, "size", 3, "md"), orientation = $6.prop($$props, "orientation", 3, "horizontal"), detached = $6.prop($$props, "detached", 3, false), fullWidth = $6.prop($$props, "fullWidth", 3, false), variant = $6.prop($$props, "variant", 3, "radiogroup"), selectionMode = $6.prop($$props, "selectionMode", 3, "single"), disallowEmptySelection = $6.prop($$props, "disallowEmptySelection", 3, true), rest = $6.rest_props($$props, rest_excludes5);
|
|
1536
|
+
let resetInputElement = $6.state(null);
|
|
1537
|
+
let resetSyncTimeout;
|
|
1538
|
+
const initialSingleValue = untrack3(() => typeof value() === "string" ? value() : undefined);
|
|
1539
|
+
const initialMultipleValues = untrack3(() => selectionMode() === "multiple" && value() instanceof SvelteSet ? Array.from(value()) : undefined);
|
|
1540
|
+
const controller = new SegmentedControlController({
|
|
1541
|
+
selectionMode: () => selectionMode(),
|
|
1542
|
+
variant: () => variant(),
|
|
1543
|
+
orientation: () => orientation(),
|
|
1544
|
+
controlDisabled: () => disabled(),
|
|
1545
|
+
disallowEmptySelection: () => disallowEmptySelection(),
|
|
1546
|
+
getValue: () => value(),
|
|
1547
|
+
setValue: (next) => {
|
|
1548
|
+
value(next);
|
|
1549
|
+
},
|
|
1550
|
+
onChange: (selected) => $$props.onchange?.(selected)
|
|
1551
|
+
});
|
|
1552
|
+
const contextValue = {
|
|
1553
|
+
get selectionMode() {
|
|
1554
|
+
return selectionMode();
|
|
1555
|
+
},
|
|
1556
|
+
get variant() {
|
|
1557
|
+
return variant();
|
|
1558
|
+
},
|
|
1559
|
+
get controlDisabled() {
|
|
1560
|
+
return disabled();
|
|
1561
|
+
},
|
|
1562
|
+
register: (registration) => controller.register(registration),
|
|
1563
|
+
isSelected: (segmentValue) => controller.isSelected(segmentValue),
|
|
1564
|
+
isFocusable: (segmentValue) => controller.isFocusable(segmentValue),
|
|
1565
|
+
toggle: (segmentValue) => controller.toggle(segmentValue)
|
|
1566
|
+
};
|
|
1567
|
+
setSegmentedControlContext(contextValue);
|
|
1568
|
+
const groupRole = $6.derived(() => selectionMode() === "multiple" ? "group" : variant() === "tablist" ? "tablist" : "radiogroup");
|
|
1569
|
+
const effectiveSize = $6.derived(() => $$props.density === "toolbar" ? "sm" : size());
|
|
1570
|
+
const selectedValues = $6.derived(() => selectionMode() === "multiple" ? value() instanceof SvelteSet ? Array.from(value()) : [] : typeof value() === "string" ? [value()] : []);
|
|
1571
|
+
function resetToInitialValue(event) {
|
|
1572
|
+
if (resetSyncTimeout !== undefined)
|
|
1573
|
+
clearTimeout(resetSyncTimeout);
|
|
1574
|
+
resetSyncTimeout = setTimeout(() => {
|
|
1575
|
+
resetSyncTimeout = undefined;
|
|
1576
|
+
if (event.defaultPrevented)
|
|
1577
|
+
return;
|
|
1578
|
+
if (selectionMode() === "multiple") {
|
|
1579
|
+
value(initialMultipleValues === undefined ? undefined : new SvelteSet(initialMultipleValues));
|
|
1580
|
+
return;
|
|
1581
|
+
}
|
|
1582
|
+
value(initialSingleValue);
|
|
1583
|
+
}, 0);
|
|
1584
|
+
}
|
|
1585
|
+
$6.user_effect(() => {
|
|
1586
|
+
const input = $6.get(resetInputElement);
|
|
1587
|
+
if (input === null)
|
|
1588
|
+
return;
|
|
1589
|
+
const form = input.form;
|
|
1590
|
+
form?.addEventListener("reset", resetToInitialValue);
|
|
1591
|
+
return () => {
|
|
1592
|
+
form?.removeEventListener("reset", resetToInitialValue);
|
|
1593
|
+
if (resetSyncTimeout !== undefined) {
|
|
1594
|
+
clearTimeout(resetSyncTimeout);
|
|
1595
|
+
resetSyncTimeout = undefined;
|
|
1596
|
+
}
|
|
1597
|
+
};
|
|
1598
|
+
});
|
|
1599
|
+
var div = root_25();
|
|
1600
|
+
var span = $6.child(div);
|
|
1601
|
+
var text = $6.child(span, true);
|
|
1602
|
+
$6.reset(span);
|
|
1603
|
+
var div_1 = $6.sibling(span, 2);
|
|
1604
|
+
var event_handler = (event) => controller.handleKeydown(event);
|
|
1605
|
+
$6.attribute_effect(div_1, ($0) => ({
|
|
1606
|
+
...rest,
|
|
1607
|
+
id: $$props.id,
|
|
1608
|
+
role: $6.get(groupRole),
|
|
1609
|
+
"aria-labelledby": `${$$props.id}-label`,
|
|
1610
|
+
"aria-disabled": disabled() ? "true" : undefined,
|
|
1611
|
+
"aria-orientation": selectionMode() === "single" ? orientation() : undefined,
|
|
1612
|
+
"data-cinder-orientation": orientation(),
|
|
1613
|
+
"data-cinder-size": $6.get(effectiveSize),
|
|
1614
|
+
"data-cinder-density": $$props.density === "toolbar" ? "toolbar" : undefined,
|
|
1615
|
+
"data-cinder-selection-mode": selectionMode(),
|
|
1616
|
+
"data-cinder-detached": detached() ? "" : undefined,
|
|
1617
|
+
"data-cinder-full-width": fullWidth() ? "" : undefined,
|
|
1618
|
+
"data-cinder-variant": variant(),
|
|
1619
|
+
class: $0,
|
|
1620
|
+
onkeydown: event_handler
|
|
1621
|
+
}), [() => classNames("cinder-segmented-control", $$props.class)]);
|
|
1622
|
+
var node = $6.child(div_1);
|
|
1623
|
+
$6.snippet(node, () => $$props.children);
|
|
1624
|
+
$6.reset(div_1);
|
|
1625
|
+
var node_1 = $6.sibling(div_1, 2);
|
|
1626
|
+
{
|
|
1627
|
+
var consequent = ($$anchor2) => {
|
|
1628
|
+
var fragment = root_15();
|
|
1629
|
+
var input_1 = $6.first_child(fragment);
|
|
1630
|
+
$6.bind_this(input_1, ($$value) => $6.set(resetInputElement, $$value), () => $6.get(resetInputElement));
|
|
1631
|
+
var node_2 = $6.sibling(input_1, 2);
|
|
1632
|
+
$6.each(node_2, 16, () => $6.get(selectedValues), (selectedValue) => selectedValue, ($$anchor3, selectedValue) => {
|
|
1633
|
+
var input_2 = root5();
|
|
1634
|
+
$6.remove_input_defaults(input_2);
|
|
1635
|
+
$6.template_effect(() => {
|
|
1636
|
+
$6.set_attribute(input_2, "name", $$props.name);
|
|
1637
|
+
$6.set_value(input_2, selectedValue);
|
|
1638
|
+
input_2.disabled = disabled();
|
|
1639
|
+
});
|
|
1640
|
+
$6.append($$anchor3, input_2);
|
|
1641
|
+
});
|
|
1642
|
+
$6.append($$anchor2, fragment);
|
|
1643
|
+
};
|
|
1644
|
+
$6.if(node_1, ($$render) => {
|
|
1645
|
+
if ($$props.name)
|
|
1646
|
+
$$render(consequent);
|
|
1647
|
+
});
|
|
1648
|
+
}
|
|
1649
|
+
$6.reset(div);
|
|
1650
|
+
$6.template_effect(($0) => {
|
|
1651
|
+
$6.set_attribute(span, "id", `${$$props.id}-label`);
|
|
1652
|
+
$6.set_class(span, 1, $0);
|
|
1653
|
+
$6.set_text(text, $$props.label);
|
|
1654
|
+
}, [
|
|
1655
|
+
() => $6.clsx(classNames("cinder-segmented-control-label", hideLabel() && "cinder-sr-only"))
|
|
1656
|
+
]);
|
|
1657
|
+
$6.append($$anchor, div);
|
|
1658
|
+
$6.pop();
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
// src/components/select/select.svelte
|
|
1662
|
+
import"svelte/internal/disclose-version";
|
|
1663
|
+
import * as $7 from "svelte/internal/client";
|
|
1664
|
+
var rest_excludes6 = new Set([
|
|
1665
|
+
"$$slots",
|
|
1666
|
+
"$$events",
|
|
1667
|
+
"$$legacy",
|
|
1668
|
+
"id",
|
|
1669
|
+
"value",
|
|
1670
|
+
"options",
|
|
1671
|
+
"label",
|
|
1672
|
+
"description",
|
|
1673
|
+
"error",
|
|
1674
|
+
"required",
|
|
1675
|
+
"disabled",
|
|
1676
|
+
"class",
|
|
1677
|
+
"aria-describedby",
|
|
1678
|
+
"aria-invalid"
|
|
1679
|
+
]);
|
|
1680
|
+
var root6 = $7.from_html(`<span class="cinder-_required-marker" aria-hidden="true">*</span>`);
|
|
1681
|
+
var root_16 = $7.from_html(`<label class="cinder-select-field__label"> <!></label>`);
|
|
1682
|
+
var root_26 = $7.from_html(`<select></select>`);
|
|
1683
|
+
var root_34 = $7.from_html(`<option> </option>`);
|
|
1684
|
+
var root_43 = $7.from_html(`<p class="cinder-select-field__description"> </p>`);
|
|
1685
|
+
var root_53 = $7.from_html(`<div><!> <span class="cinder-select-field__control"><!> <span class="cinder-select-field__chevron" aria-hidden="true"></span></span> <!> <p class="cinder-select-field__error" aria-live="polite"> </p></div>`);
|
|
1686
|
+
function Select($$anchor, $$props) {
|
|
1687
|
+
$7.push($$props, true);
|
|
1688
|
+
let value = $7.prop($$props, "value", 15), rest = $7.rest_props($$props, rest_excludes6);
|
|
1689
|
+
const context = getFormFieldContext();
|
|
1690
|
+
const field = $7.derived(() => resolveFieldControl({
|
|
1691
|
+
id: $$props.id,
|
|
1692
|
+
generatedId: $$props.id,
|
|
1693
|
+
context,
|
|
1694
|
+
hasDescription: !!$$props.description,
|
|
1695
|
+
hasError: !!$$props.error,
|
|
1696
|
+
localIdNamespace: "select",
|
|
1697
|
+
consumerDescribedBy: $$props["aria-describedby"],
|
|
1698
|
+
consumerInvalid: $$props["aria-invalid"],
|
|
1699
|
+
required: $$props.required,
|
|
1700
|
+
disabled: $$props.disabled
|
|
1701
|
+
}));
|
|
1702
|
+
const stableLocalErrorId = $7.derived(() => context?.errorId === `${$7.get(field).id}-error` ? `${$7.get(field).id}-select-error` : `${$7.get(field).id}-error`);
|
|
1703
|
+
$7.user_effect(() => {
|
|
1704
|
+
if ($$props.options.length === 0) {
|
|
1705
|
+
devWarn("[cinder/Select] options is empty — pass at least one option, or ignore during async load.");
|
|
1706
|
+
}
|
|
1707
|
+
});
|
|
1708
|
+
var div = root_53();
|
|
1709
|
+
var node = $7.child(div);
|
|
1710
|
+
{
|
|
1711
|
+
var consequent_1 = ($$anchor2) => {
|
|
1712
|
+
var label_1 = root_16();
|
|
1713
|
+
var text = $7.child(label_1);
|
|
1714
|
+
var node_1 = $7.sibling(text);
|
|
1715
|
+
{
|
|
1716
|
+
var consequent = ($$anchor3) => {
|
|
1717
|
+
var span = root6();
|
|
1718
|
+
$7.append($$anchor3, span);
|
|
1719
|
+
};
|
|
1720
|
+
$7.if(node_1, ($$render) => {
|
|
1721
|
+
if ($7.get(field).required)
|
|
1722
|
+
$$render(consequent);
|
|
1723
|
+
});
|
|
1724
|
+
}
|
|
1725
|
+
$7.reset(label_1);
|
|
1726
|
+
$7.template_effect(() => {
|
|
1727
|
+
$7.set_attribute(label_1, "for", $$props.id);
|
|
1728
|
+
$7.set_attribute(label_1, "data-disabled", $7.get(field).disabled || undefined);
|
|
1729
|
+
$7.set_text(text, `${$$props.label ?? ""} `);
|
|
1730
|
+
});
|
|
1731
|
+
$7.append($$anchor2, label_1);
|
|
1732
|
+
};
|
|
1733
|
+
$7.if(node, ($$render) => {
|
|
1734
|
+
if ($$props.label)
|
|
1735
|
+
$$render(consequent_1);
|
|
1736
|
+
});
|
|
1737
|
+
}
|
|
1738
|
+
var span_1 = $7.sibling(node, 2);
|
|
1739
|
+
var node_2 = $7.child(span_1);
|
|
1740
|
+
{
|
|
1741
|
+
var consequent_2 = ($$anchor2) => {
|
|
1742
|
+
var select = root_26();
|
|
1743
|
+
$7.attribute_effect(select, () => ({
|
|
1744
|
+
id: $$props.id,
|
|
1745
|
+
class: "cinder-_input-frame cinder-select",
|
|
1746
|
+
disabled: $7.get(field).disabled,
|
|
1747
|
+
required: $7.get(field).required,
|
|
1748
|
+
"data-cinder-empty": "true",
|
|
1749
|
+
...rest,
|
|
1750
|
+
"aria-describedby": $7.get(field).describedBy,
|
|
1751
|
+
"aria-invalid": $7.get(field).ariaInvalid
|
|
1752
|
+
}));
|
|
1753
|
+
$7.append($$anchor2, select);
|
|
1754
|
+
};
|
|
1755
|
+
var alternate = ($$anchor2) => {
|
|
1756
|
+
var select_1 = root_26();
|
|
1757
|
+
$7.attribute_effect(select_1, () => ({
|
|
1758
|
+
id: $$props.id,
|
|
1759
|
+
class: "cinder-_input-frame cinder-select",
|
|
1760
|
+
disabled: $7.get(field).disabled,
|
|
1761
|
+
required: $7.get(field).required,
|
|
1762
|
+
...rest,
|
|
1763
|
+
"aria-describedby": $7.get(field).describedBy,
|
|
1764
|
+
"aria-invalid": $7.get(field).ariaInvalid
|
|
1765
|
+
}));
|
|
1766
|
+
$7.each(select_1, 21, () => $$props.options, (option) => option.value, ($$anchor3, option) => {
|
|
1767
|
+
var option_1 = root_34();
|
|
1768
|
+
var text_1 = $7.child(option_1, true);
|
|
1769
|
+
$7.reset(option_1);
|
|
1770
|
+
var option_1_value = {};
|
|
1771
|
+
$7.template_effect(() => {
|
|
1772
|
+
option_1.disabled = $7.get(option).disabled;
|
|
1773
|
+
$7.set_text(text_1, $7.get(option).label);
|
|
1774
|
+
if (option_1_value !== (option_1_value = $7.get(option).value)) {
|
|
1775
|
+
option_1.value = (option_1.__value = $7.get(option).value) ?? "";
|
|
1776
|
+
}
|
|
1777
|
+
});
|
|
1778
|
+
$7.append($$anchor3, option_1);
|
|
1779
|
+
});
|
|
1780
|
+
$7.reset(select_1);
|
|
1781
|
+
$7.bind_select_value(select_1, value);
|
|
1782
|
+
$7.append($$anchor2, select_1);
|
|
1783
|
+
};
|
|
1784
|
+
$7.if(node_2, ($$render) => {
|
|
1785
|
+
if ($$props.options.length === 0)
|
|
1786
|
+
$$render(consequent_2);
|
|
1787
|
+
else
|
|
1788
|
+
$$render(alternate, -1);
|
|
1789
|
+
});
|
|
1790
|
+
}
|
|
1791
|
+
$7.next(2);
|
|
1792
|
+
$7.reset(span_1);
|
|
1793
|
+
var node_3 = $7.sibling(span_1, 2);
|
|
1794
|
+
{
|
|
1795
|
+
var consequent_3 = ($$anchor2) => {
|
|
1796
|
+
var p = root_43();
|
|
1797
|
+
var text_2 = $7.child(p, true);
|
|
1798
|
+
$7.reset(p);
|
|
1799
|
+
$7.template_effect(() => {
|
|
1800
|
+
$7.set_attribute(p, "id", $7.get(field).ownDescriptionId);
|
|
1801
|
+
$7.set_text(text_2, $$props.description);
|
|
1802
|
+
});
|
|
1803
|
+
$7.append($$anchor2, p);
|
|
1804
|
+
};
|
|
1805
|
+
$7.if(node_3, ($$render) => {
|
|
1806
|
+
if ($$props.description)
|
|
1807
|
+
$$render(consequent_3);
|
|
1808
|
+
});
|
|
1809
|
+
}
|
|
1810
|
+
var p_1 = $7.sibling(node_3, 2);
|
|
1811
|
+
var text_3 = $7.child(p_1, true);
|
|
1812
|
+
$7.reset(p_1);
|
|
1813
|
+
$7.reset(div);
|
|
1814
|
+
$7.template_effect(($0) => {
|
|
1815
|
+
$7.set_class(div, 1, $0);
|
|
1816
|
+
$7.set_attribute(p_1, "id", $7.get(field).ownErrorId ?? $7.get(stableLocalErrorId));
|
|
1817
|
+
$7.set_attribute(p_1, "data-cinder-error", !!$$props.error || undefined);
|
|
1818
|
+
$7.set_text(text_3, $$props.error ?? "");
|
|
1819
|
+
}, [
|
|
1820
|
+
() => $7.clsx(classNames("cinder-select-field", $$props.class))
|
|
1821
|
+
]);
|
|
1822
|
+
$7.append($$anchor, div);
|
|
1823
|
+
$7.pop();
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
// src/components/time-field/time-field.svelte
|
|
1827
|
+
import"svelte/internal/disclose-version";
|
|
1828
|
+
import * as $8 from "svelte/internal/client";
|
|
1829
|
+
import { untrack as untrack4 } from "svelte";
|
|
1830
|
+
|
|
1831
|
+
// src/_internal/time-parts.ts
|
|
1832
|
+
var TIME_PATTERN = /^(?<hours>\d{2}):(?<minutes>\d{2})(?::(?<seconds>\d{2}))?$/;
|
|
1833
|
+
function parseTimeString(value) {
|
|
1834
|
+
const trimmedValue = value.trim();
|
|
1835
|
+
if (trimmedValue.length === 0)
|
|
1836
|
+
return null;
|
|
1837
|
+
const match = TIME_PATTERN.exec(trimmedValue);
|
|
1838
|
+
if (!match?.groups)
|
|
1839
|
+
return null;
|
|
1840
|
+
const hours = Number(match.groups["hours"]);
|
|
1841
|
+
const minutes = Number(match.groups["minutes"]);
|
|
1842
|
+
const seconds = Number(match.groups["seconds"] ?? "0");
|
|
1843
|
+
if (!Number.isInteger(hours) || hours < 0 || hours > 23)
|
|
1844
|
+
return null;
|
|
1845
|
+
if (!Number.isInteger(minutes) || minutes < 0 || minutes > 59)
|
|
1846
|
+
return null;
|
|
1847
|
+
if (!Number.isInteger(seconds) || seconds < 0 || seconds > 59)
|
|
1848
|
+
return null;
|
|
1849
|
+
return { hours, minutes, seconds };
|
|
1850
|
+
}
|
|
1851
|
+
function serializeTimeParts(parts, includeSeconds) {
|
|
1852
|
+
const hours = String(parts.hours).padStart(2, "0");
|
|
1853
|
+
const minutes = String(parts.minutes).padStart(2, "0");
|
|
1854
|
+
const seconds = String(parts.seconds).padStart(2, "0");
|
|
1855
|
+
return includeSeconds ? `${hours}:${minutes}:${seconds}` : `${hours}:${minutes}`;
|
|
1856
|
+
}
|
|
1857
|
+
|
|
1858
|
+
// src/components/time-field/time-field.svelte
|
|
1859
|
+
var rest_excludes7 = new Set([
|
|
1860
|
+
"$$slots",
|
|
1861
|
+
"$$events",
|
|
1862
|
+
"$$legacy",
|
|
1863
|
+
"id",
|
|
1864
|
+
"value",
|
|
1865
|
+
"defaultValue",
|
|
1866
|
+
"granularity",
|
|
1867
|
+
"timezones",
|
|
1868
|
+
"timezone",
|
|
1869
|
+
"timezoneName",
|
|
1870
|
+
"label",
|
|
1871
|
+
"description",
|
|
1872
|
+
"error",
|
|
1873
|
+
"disabled",
|
|
1874
|
+
"readonly",
|
|
1875
|
+
"required",
|
|
1876
|
+
"name",
|
|
1877
|
+
"class",
|
|
1878
|
+
"aria-label",
|
|
1879
|
+
"aria-labelledby",
|
|
1880
|
+
"aria-describedby",
|
|
1881
|
+
"aria-invalid",
|
|
1882
|
+
"onchange"
|
|
1883
|
+
]);
|
|
1884
|
+
var root7 = $8.from_html(`<label class="cinder-time-field__label"> </label>`);
|
|
1885
|
+
var root_17 = $8.from_html(`<input type="hidden"/>`);
|
|
1886
|
+
var root_27 = $8.from_html(`<option> </option>`);
|
|
1887
|
+
var root_35 = $8.from_html(`<span class="cinder-sr-only">timezone</span> <select class="cinder-time-field__timezone"></select>`, 1);
|
|
1888
|
+
var root_44 = $8.from_html(`<p class="cinder-time-field__description"> </p>`);
|
|
1889
|
+
var root_54 = $8.from_html(`<p class="cinder-time-field__error" aria-live="polite"> </p>`);
|
|
1890
|
+
var root_62 = $8.from_html(`<div><!> <div class="cinder-time-field__controls"><input class="cinder-time-field__input" type="time"/> <!> <!> <!></div> <!> <!></div>`);
|
|
1891
|
+
function Time_field($$anchor, $$props) {
|
|
1892
|
+
const generatedId = $8.props_id();
|
|
1893
|
+
$8.push($$props, true);
|
|
1894
|
+
let value = $8.prop($$props, "value", 15, undefined), defaultValue = $8.prop($$props, "defaultValue", 3, ""), granularity = $8.prop($$props, "granularity", 3, "minute"), timezone = $8.prop($$props, "timezone", 15, undefined), disabled = $8.prop($$props, "disabled", 3, false), readonly = $8.prop($$props, "readonly", 3, false), required = $8.prop($$props, "required", 3, false), rest = $8.rest_props($$props, rest_excludes7);
|
|
1895
|
+
const formField = getFormFieldContext();
|
|
1896
|
+
const includeSeconds = $8.derived(() => granularity() === "second");
|
|
1897
|
+
const inputStep = $8.derived(() => $8.get(includeSeconds) ? 1 : 60);
|
|
1898
|
+
let inputMirrorValue = $8.state(undefined);
|
|
1899
|
+
let inputMirrorSourceValue = $8.state(undefined);
|
|
1900
|
+
const submittedValue = $8.derived(() => canonicalTimeValue($8.get(inputMirrorValue) ?? value()));
|
|
1901
|
+
let resetTimezoneBaseline = $8.state(undefined);
|
|
1902
|
+
let skipTimezoneBaselineUpdate = false;
|
|
1903
|
+
untrack4(() => {
|
|
1904
|
+
if (value() === undefined)
|
|
1905
|
+
value(canonicalTimeValue(defaultValue()));
|
|
1906
|
+
if (timezone() === undefined && $$props.timezones && $$props.timezones.length > 0)
|
|
1907
|
+
timezone($$props.timezones[0]);
|
|
1908
|
+
$8.set(resetTimezoneBaseline, timezone(), true);
|
|
1909
|
+
});
|
|
1910
|
+
$8.user_effect(() => {
|
|
1911
|
+
if (!$$props.timezones || $$props.timezones.length === 0) {
|
|
1912
|
+
return;
|
|
1913
|
+
}
|
|
1914
|
+
if (timezone() === undefined || !$$props.timezones.includes(timezone())) {
|
|
1915
|
+
timezone($$props.timezones[0]);
|
|
1916
|
+
}
|
|
1917
|
+
});
|
|
1918
|
+
$8.user_effect(() => {
|
|
1919
|
+
if (skipTimezoneBaselineUpdate) {
|
|
1920
|
+
skipTimezoneBaselineUpdate = false;
|
|
1921
|
+
return;
|
|
1922
|
+
}
|
|
1923
|
+
$8.set(resetTimezoneBaseline, timezone(), true);
|
|
1924
|
+
});
|
|
1925
|
+
$8.user_effect(() => {
|
|
1926
|
+
if ($8.get(inputMirrorValue) === undefined)
|
|
1927
|
+
return;
|
|
1928
|
+
if ($8.get(inputMirrorSourceValue) === value())
|
|
1929
|
+
return;
|
|
1930
|
+
$8.set(inputMirrorValue, undefined);
|
|
1931
|
+
$8.set(inputMirrorSourceValue, undefined);
|
|
1932
|
+
});
|
|
1933
|
+
$8.user_effect(() => {
|
|
1934
|
+
if (value() === undefined)
|
|
1935
|
+
return;
|
|
1936
|
+
const nextValue = canonicalTimeValue(value());
|
|
1937
|
+
if (value() === nextValue)
|
|
1938
|
+
return;
|
|
1939
|
+
$8.set(inputMirrorValue, undefined);
|
|
1940
|
+
$8.set(inputMirrorSourceValue, undefined);
|
|
1941
|
+
value(nextValue);
|
|
1942
|
+
});
|
|
1943
|
+
const field = $8.derived(() => resolveFieldControl({
|
|
1944
|
+
id: formField?.controlId ?? $$props.id,
|
|
1945
|
+
generatedId,
|
|
1946
|
+
context: formField,
|
|
1947
|
+
localIdNamespace: "time-field",
|
|
1948
|
+
hasDescription: !!$$props.description,
|
|
1949
|
+
hasError: !!$$props.error,
|
|
1950
|
+
consumerDescribedBy: $$props["aria-describedby"],
|
|
1951
|
+
consumerInvalid: $$props["aria-invalid"],
|
|
1952
|
+
required: required() ? true : undefined,
|
|
1953
|
+
disabled: disabled() ? true : undefined
|
|
1954
|
+
}));
|
|
1955
|
+
const inputId = $8.derived(() => $8.get(field).id);
|
|
1956
|
+
const labelId = $8.derived(() => $$props.label ? `${$8.get(inputId)}-label` : formField?.labelId);
|
|
1957
|
+
const timezoneLabelId = $8.derived(() => `${$8.get(inputId)}-timezone-label`);
|
|
1958
|
+
const descriptionId = $8.derived(() => $8.get(field).ownDescriptionId);
|
|
1959
|
+
const errorId2 = $8.derived(() => $8.get(field).ownErrorId);
|
|
1960
|
+
const describedBy = $8.derived(() => $8.get(field).describedBy);
|
|
1961
|
+
const invalid = $8.derived(() => $8.get(field).ariaInvalid);
|
|
1962
|
+
const resolvedDisabled = $8.derived(() => $8.get(field).disabled);
|
|
1963
|
+
const resolvedRequired = $8.derived(() => $8.get(field).required);
|
|
1964
|
+
const inputAriaLabel = $8.derived(() => $$props.label || formField?.labelId ? undefined : normalizeAriaText($$props["aria-label"]));
|
|
1965
|
+
const inputAriaLabelledBy = $8.derived(() => $$props.label ? undefined : normalizeAriaText($$props["aria-labelledby"]) ?? formField?.labelId);
|
|
1966
|
+
const timezoneAriaLabelledBy = $8.derived(() => $8.get(labelId) ? `${$8.get(labelId)} ${$8.get(timezoneLabelId)}` : $8.get(inputAriaLabelledBy) ? `${$8.get(inputAriaLabelledBy)} ${$8.get(timezoneLabelId)}` : undefined);
|
|
1967
|
+
const timezoneAriaLabel = $8.derived(() => $8.get(timezoneAriaLabelledBy) ? undefined : $8.get(inputAriaLabel) ? `${$8.get(inputAriaLabel)} timezone` : "Timezone");
|
|
1968
|
+
const resolvedTimezoneName = $8.derived(() => timezone() !== undefined ? $$props.timezoneName ?? ($$props.name ? `${$$props.name}-timezone` : undefined) : undefined);
|
|
1969
|
+
function emit(nextValue, nextTimezone = timezone()) {
|
|
1970
|
+
$$props.onchange?.({ value: nextValue, timezone: nextTimezone });
|
|
1971
|
+
}
|
|
1972
|
+
function normalizeAriaText(text) {
|
|
1973
|
+
return typeof text === "string" && text.trim().length > 0 ? text : undefined;
|
|
1974
|
+
}
|
|
1975
|
+
function resetTimezoneFor(options) {
|
|
1976
|
+
if (!options || options.length === 0)
|
|
1977
|
+
return $8.get(resetTimezoneBaseline);
|
|
1978
|
+
return $8.get(resetTimezoneBaseline) && options.includes($8.get(resetTimezoneBaseline)) ? $8.get(resetTimezoneBaseline) : options[0];
|
|
1979
|
+
}
|
|
1980
|
+
function canonicalTimeValue(nextValue) {
|
|
1981
|
+
if (!nextValue)
|
|
1982
|
+
return "";
|
|
1983
|
+
const parsed = parseTimeString(nextValue);
|
|
1984
|
+
return parsed ? serializeTimeParts(parsed, $8.get(includeSeconds)) : "";
|
|
1985
|
+
}
|
|
1986
|
+
function handleInputChange(event) {
|
|
1987
|
+
if ($8.get(resolvedDisabled) || readonly())
|
|
1988
|
+
return;
|
|
1989
|
+
const target = event.currentTarget;
|
|
1990
|
+
const nextValue = canonicalTimeValue(target.value);
|
|
1991
|
+
$8.set(inputMirrorValue, undefined);
|
|
1992
|
+
$8.set(inputMirrorSourceValue, undefined);
|
|
1993
|
+
value(nextValue);
|
|
1994
|
+
emit(nextValue);
|
|
1995
|
+
}
|
|
1996
|
+
function handleInput(event) {
|
|
1997
|
+
if ($8.get(resolvedDisabled) || readonly())
|
|
1998
|
+
return;
|
|
1999
|
+
$8.set(inputMirrorSourceValue, value(), true);
|
|
2000
|
+
$8.set(inputMirrorValue, event.currentTarget.value, true);
|
|
2001
|
+
}
|
|
2002
|
+
function handleTimezoneChange(event) {
|
|
2003
|
+
if ($8.get(resolvedDisabled) || readonly())
|
|
2004
|
+
return;
|
|
2005
|
+
const target = event.currentTarget;
|
|
2006
|
+
skipTimezoneBaselineUpdate = true;
|
|
2007
|
+
timezone(target.value);
|
|
2008
|
+
const nextValue = canonicalTimeValue(value());
|
|
2009
|
+
$8.set(inputMirrorValue, undefined);
|
|
2010
|
+
$8.set(inputMirrorSourceValue, undefined);
|
|
2011
|
+
value(nextValue);
|
|
2012
|
+
emit(nextValue, timezone());
|
|
2013
|
+
}
|
|
2014
|
+
$8.user_effect(() => {
|
|
2015
|
+
const input = document.getElementById($8.get(inputId));
|
|
2016
|
+
const form = input instanceof HTMLInputElement ? input.form : null;
|
|
2017
|
+
if (!form)
|
|
2018
|
+
return;
|
|
2019
|
+
const resetValue = canonicalTimeValue(defaultValue());
|
|
2020
|
+
const resetTimezone = resetTimezoneFor($$props.timezones);
|
|
2021
|
+
const handleReset = () => {
|
|
2022
|
+
if ($8.get(resolvedDisabled))
|
|
2023
|
+
return;
|
|
2024
|
+
$8.set(inputMirrorValue, undefined);
|
|
2025
|
+
$8.set(inputMirrorSourceValue, undefined);
|
|
2026
|
+
value(resetValue);
|
|
2027
|
+
timezone(resetTimezone);
|
|
2028
|
+
};
|
|
2029
|
+
form.addEventListener("reset", handleReset);
|
|
2030
|
+
return () => form.removeEventListener("reset", handleReset);
|
|
2031
|
+
});
|
|
2032
|
+
var div = root_62();
|
|
2033
|
+
$8.attribute_effect(div, ($0) => ({ ...rest, class: $0 }), [() => classNames("cinder-time-field", $$props.class)]);
|
|
2034
|
+
var node = $8.child(div);
|
|
2035
|
+
{
|
|
2036
|
+
var consequent = ($$anchor2) => {
|
|
2037
|
+
var label_1 = root7();
|
|
2038
|
+
var text_1 = $8.child(label_1, true);
|
|
2039
|
+
$8.reset(label_1);
|
|
2040
|
+
$8.template_effect(() => {
|
|
2041
|
+
$8.set_attribute(label_1, "id", $8.get(labelId));
|
|
2042
|
+
$8.set_attribute(label_1, "for", $8.get(inputId));
|
|
2043
|
+
$8.set_text(text_1, $$props.label);
|
|
2044
|
+
});
|
|
2045
|
+
$8.append($$anchor2, label_1);
|
|
2046
|
+
};
|
|
2047
|
+
$8.if(node, ($$render) => {
|
|
2048
|
+
if ($$props.label)
|
|
2049
|
+
$$render(consequent);
|
|
2050
|
+
});
|
|
2051
|
+
}
|
|
2052
|
+
var div_1 = $8.sibling(node, 2);
|
|
2053
|
+
var input_1 = $8.child(div_1);
|
|
2054
|
+
$8.remove_input_defaults(input_1);
|
|
2055
|
+
var node_1 = $8.sibling(input_1, 2);
|
|
2056
|
+
{
|
|
2057
|
+
var consequent_1 = ($$anchor2) => {
|
|
2058
|
+
var input_2 = root_17();
|
|
2059
|
+
$8.remove_input_defaults(input_2);
|
|
2060
|
+
$8.template_effect(() => {
|
|
2061
|
+
$8.set_attribute(input_2, "name", $$props.name);
|
|
2062
|
+
$8.set_value(input_2, $8.get(submittedValue));
|
|
2063
|
+
input_2.disabled = $8.get(resolvedDisabled);
|
|
2064
|
+
});
|
|
2065
|
+
$8.append($$anchor2, input_2);
|
|
2066
|
+
};
|
|
2067
|
+
$8.if(node_1, ($$render) => {
|
|
2068
|
+
if ($$props.name)
|
|
2069
|
+
$$render(consequent_1);
|
|
2070
|
+
});
|
|
2071
|
+
}
|
|
2072
|
+
var node_2 = $8.sibling(node_1, 2);
|
|
2073
|
+
{
|
|
2074
|
+
var consequent_2 = ($$anchor2) => {
|
|
2075
|
+
var fragment = root_35();
|
|
2076
|
+
var span = $8.first_child(fragment);
|
|
2077
|
+
var select = $8.sibling(span, 2);
|
|
2078
|
+
$8.each(select, 20, () => $$props.timezones, (option) => option, ($$anchor3, option) => {
|
|
2079
|
+
var option_1 = root_27();
|
|
2080
|
+
var text_2 = $8.child(option_1, true);
|
|
2081
|
+
$8.reset(option_1);
|
|
2082
|
+
var option_1_value = {};
|
|
2083
|
+
$8.template_effect(() => {
|
|
2084
|
+
$8.set_text(text_2, option);
|
|
2085
|
+
if (option_1_value !== (option_1_value = option)) {
|
|
2086
|
+
option_1.value = (option_1.__value = option) ?? "";
|
|
2087
|
+
}
|
|
2088
|
+
});
|
|
2089
|
+
$8.append($$anchor3, option_1);
|
|
2090
|
+
});
|
|
2091
|
+
$8.reset(select);
|
|
2092
|
+
var select_value;
|
|
2093
|
+
$8.init_select(select);
|
|
2094
|
+
$8.template_effect(() => {
|
|
2095
|
+
$8.set_attribute(span, "id", $8.get(timezoneLabelId));
|
|
2096
|
+
$8.set_attribute(select, "aria-label", $8.get(timezoneAriaLabel));
|
|
2097
|
+
$8.set_attribute(select, "aria-labelledby", $8.get(timezoneAriaLabelledBy));
|
|
2098
|
+
$8.set_attribute(select, "aria-describedby", $8.get(describedBy));
|
|
2099
|
+
select.disabled = $8.get(resolvedDisabled) || readonly();
|
|
2100
|
+
if (select_value !== (select_value = timezone())) {
|
|
2101
|
+
select.value = (select.__value = timezone()) ?? "", $8.select_option(select, timezone());
|
|
2102
|
+
}
|
|
2103
|
+
});
|
|
2104
|
+
$8.delegated("change", select, handleTimezoneChange);
|
|
2105
|
+
$8.append($$anchor2, fragment);
|
|
2106
|
+
};
|
|
2107
|
+
$8.if(node_2, ($$render) => {
|
|
2108
|
+
if ($$props.timezones && $$props.timezones.length > 0)
|
|
2109
|
+
$$render(consequent_2);
|
|
2110
|
+
});
|
|
2111
|
+
}
|
|
2112
|
+
var node_3 = $8.sibling(node_2, 2);
|
|
2113
|
+
{
|
|
2114
|
+
var consequent_3 = ($$anchor2) => {
|
|
2115
|
+
var input_3 = root_17();
|
|
2116
|
+
$8.remove_input_defaults(input_3);
|
|
2117
|
+
$8.template_effect(() => {
|
|
2118
|
+
$8.set_attribute(input_3, "name", $8.get(resolvedTimezoneName));
|
|
2119
|
+
$8.set_value(input_3, timezone());
|
|
2120
|
+
input_3.disabled = $8.get(resolvedDisabled);
|
|
2121
|
+
});
|
|
2122
|
+
$8.append($$anchor2, input_3);
|
|
2123
|
+
};
|
|
2124
|
+
$8.if(node_3, ($$render) => {
|
|
2125
|
+
if ($8.get(resolvedTimezoneName))
|
|
2126
|
+
$$render(consequent_3);
|
|
2127
|
+
});
|
|
2128
|
+
}
|
|
2129
|
+
$8.reset(div_1);
|
|
2130
|
+
var node_4 = $8.sibling(div_1, 2);
|
|
2131
|
+
{
|
|
2132
|
+
var consequent_4 = ($$anchor2) => {
|
|
2133
|
+
var p = root_44();
|
|
2134
|
+
var text_3 = $8.child(p, true);
|
|
2135
|
+
$8.reset(p);
|
|
2136
|
+
$8.template_effect(() => {
|
|
2137
|
+
$8.set_attribute(p, "id", $8.get(descriptionId));
|
|
2138
|
+
$8.set_text(text_3, $$props.description);
|
|
2139
|
+
});
|
|
2140
|
+
$8.append($$anchor2, p);
|
|
2141
|
+
};
|
|
2142
|
+
$8.if(node_4, ($$render) => {
|
|
2143
|
+
if ($$props.description)
|
|
2144
|
+
$$render(consequent_4);
|
|
2145
|
+
});
|
|
2146
|
+
}
|
|
2147
|
+
var node_5 = $8.sibling(node_4, 2);
|
|
2148
|
+
{
|
|
2149
|
+
var consequent_5 = ($$anchor2) => {
|
|
2150
|
+
var p_1 = root_54();
|
|
2151
|
+
var text_4 = $8.child(p_1, true);
|
|
2152
|
+
$8.reset(p_1);
|
|
2153
|
+
$8.template_effect(() => {
|
|
2154
|
+
$8.set_attribute(p_1, "id", $8.get(errorId2));
|
|
2155
|
+
$8.set_text(text_4, $$props.error);
|
|
2156
|
+
});
|
|
2157
|
+
$8.append($$anchor2, p_1);
|
|
2158
|
+
};
|
|
2159
|
+
$8.if(node_5, ($$render) => {
|
|
2160
|
+
if ($$props.error)
|
|
2161
|
+
$$render(consequent_5);
|
|
2162
|
+
});
|
|
2163
|
+
}
|
|
2164
|
+
$8.reset(div);
|
|
2165
|
+
$8.template_effect(() => {
|
|
2166
|
+
$8.set_attribute(input_1, "id", $8.get(inputId));
|
|
2167
|
+
$8.set_attribute(input_1, "step", $8.get(inputStep));
|
|
2168
|
+
$8.set_value(input_1, $8.get(inputMirrorValue) ?? value() ?? "");
|
|
2169
|
+
input_1.disabled = $8.get(resolvedDisabled);
|
|
2170
|
+
input_1.readOnly = readonly();
|
|
2171
|
+
input_1.required = $8.get(resolvedRequired);
|
|
2172
|
+
$8.set_attribute(input_1, "aria-label", $8.get(inputAriaLabel));
|
|
2173
|
+
$8.set_attribute(input_1, "aria-labelledby", $8.get(inputAriaLabelledBy));
|
|
2174
|
+
$8.set_attribute(input_1, "aria-describedby", $8.get(describedBy));
|
|
2175
|
+
$8.set_attribute(input_1, "aria-invalid", $8.get(invalid));
|
|
2176
|
+
});
|
|
2177
|
+
$8.delegated("input", input_1, handleInput);
|
|
2178
|
+
$8.delegated("change", input_1, handleInputChange);
|
|
2179
|
+
$8.append($$anchor, div);
|
|
2180
|
+
$8.pop();
|
|
2181
|
+
}
|
|
2182
|
+
$8.delegate(["input", "change"]);
|
|
2183
|
+
|
|
2184
|
+
// src/components/schedule-builder/schedule-builder.utilities.ts
|
|
2185
|
+
var INTERVAL_UNITS = [
|
|
2186
|
+
"minutes",
|
|
2187
|
+
"hours",
|
|
2188
|
+
"days",
|
|
2189
|
+
"weeks"
|
|
2190
|
+
];
|
|
2191
|
+
var WEEKDAYS = [
|
|
2192
|
+
{ value: 1, short: "Mon", long: "Monday" },
|
|
2193
|
+
{ value: 2, short: "Tue", long: "Tuesday" },
|
|
2194
|
+
{ value: 3, short: "Wed", long: "Wednesday" },
|
|
2195
|
+
{ value: 4, short: "Thu", long: "Thursday" },
|
|
2196
|
+
{ value: 5, short: "Fri", long: "Friday" },
|
|
2197
|
+
{ value: 6, short: "Sat", long: "Saturday" },
|
|
2198
|
+
{ value: 0, short: "Sun", long: "Sunday" }
|
|
2199
|
+
];
|
|
2200
|
+
var CRON_FIELDS = [
|
|
2201
|
+
{ name: "Minute", min: 0, max: 59, hint: "0–59" },
|
|
2202
|
+
{ name: "Hour", min: 0, max: 23, hint: "0–23" },
|
|
2203
|
+
{ name: "Day of month", min: 1, max: 31, hint: "1–31" },
|
|
2204
|
+
{ name: "Month", min: 1, max: 12, hint: "1–12" },
|
|
2205
|
+
{ name: "Day of week", min: 0, max: 6, hint: "0–6 (Sun–Sat)" }
|
|
2206
|
+
];
|
|
2207
|
+
function defaultScheduleValue() {
|
|
2208
|
+
return { mode: "interval", every: 15, unit: "minutes" };
|
|
2209
|
+
}
|
|
2210
|
+
function singularUnit(unit) {
|
|
2211
|
+
return unit.slice(0, -1);
|
|
2212
|
+
}
|
|
2213
|
+
function validateCronField(rawValue, fieldIndex) {
|
|
2214
|
+
const field = CRON_FIELDS[fieldIndex];
|
|
2215
|
+
if (!field)
|
|
2216
|
+
return "Unknown field.";
|
|
2217
|
+
const value = rawValue.trim();
|
|
2218
|
+
if (value === "")
|
|
2219
|
+
return "Required.";
|
|
2220
|
+
const inRange = (n) => Number.isInteger(n) && n >= field.min && n <= field.max;
|
|
2221
|
+
for (const part of value.split(",")) {
|
|
2222
|
+
const token = part.trim();
|
|
2223
|
+
if (token === "")
|
|
2224
|
+
return "Empty list item.";
|
|
2225
|
+
if (token === "*")
|
|
2226
|
+
continue;
|
|
2227
|
+
const stepMatch = token.match(/^(\*|\d+-\d+)\/(\d+)$/);
|
|
2228
|
+
if (stepMatch) {
|
|
2229
|
+
const step = Number(stepMatch[2] ?? "");
|
|
2230
|
+
if (!Number.isInteger(step) || step <= 0)
|
|
2231
|
+
return "Step must be a positive integer.";
|
|
2232
|
+
if (step > field.max)
|
|
2233
|
+
return `Step is larger than ${field.hint}.`;
|
|
2234
|
+
const rangeText = stepMatch[1] ?? "*";
|
|
2235
|
+
if (rangeText !== "*") {
|
|
2236
|
+
const [a, b] = rangeText.split("-").map(Number);
|
|
2237
|
+
if (a === undefined || b === undefined || !inRange(a) || !inRange(b)) {
|
|
2238
|
+
return `Out of range (${field.hint}).`;
|
|
2239
|
+
}
|
|
2240
|
+
if (a > b)
|
|
2241
|
+
return "Range start is after its end.";
|
|
2242
|
+
}
|
|
2243
|
+
continue;
|
|
2244
|
+
}
|
|
2245
|
+
const rangeMatch = token.match(/^(\d+)-(\d+)$/);
|
|
2246
|
+
if (rangeMatch) {
|
|
2247
|
+
const a = Number(rangeMatch[1]);
|
|
2248
|
+
const b = Number(rangeMatch[2]);
|
|
2249
|
+
if (!inRange(a) || !inRange(b))
|
|
2250
|
+
return `Out of range (${field.hint}).`;
|
|
2251
|
+
if (a > b)
|
|
2252
|
+
return "Range start is after its end.";
|
|
2253
|
+
continue;
|
|
2254
|
+
}
|
|
2255
|
+
if (/^\d+$/.test(token)) {
|
|
2256
|
+
if (!inRange(Number(token)))
|
|
2257
|
+
return `Out of range (${field.hint}).`;
|
|
2258
|
+
continue;
|
|
2259
|
+
}
|
|
2260
|
+
return "Not a valid cron token.";
|
|
2261
|
+
}
|
|
2262
|
+
return;
|
|
2263
|
+
}
|
|
2264
|
+
function cronFieldsValid(fields) {
|
|
2265
|
+
return fields.length === 5 && fields.every((value, index) => validateCronField(value, index) === undefined);
|
|
2266
|
+
}
|
|
2267
|
+
function joinCron(fields) {
|
|
2268
|
+
return fields.map((field) => field.trim()).join(" ");
|
|
2269
|
+
}
|
|
2270
|
+
function splitCron(expression) {
|
|
2271
|
+
const parts = expression.trim().split(/\s+/).filter(Boolean);
|
|
2272
|
+
const lastField = parts.length > 5 ? parts.slice(4).join(" ") : parts[4];
|
|
2273
|
+
return [parts[0] ?? "*", parts[1] ?? "*", parts[2] ?? "*", parts[3] ?? "*", lastField ?? "*"];
|
|
2274
|
+
}
|
|
2275
|
+
function parseTime(time) {
|
|
2276
|
+
const match = time.trim().match(/^(\d{1,2}):(\d{2})$/);
|
|
2277
|
+
if (!match)
|
|
2278
|
+
return { hour: 0, minute: 0 };
|
|
2279
|
+
const hour = Math.min(23, Math.max(0, Number(match[1])));
|
|
2280
|
+
const minute = Math.min(59, Math.max(0, Number(match[2])));
|
|
2281
|
+
return { hour, minute };
|
|
2282
|
+
}
|
|
2283
|
+
function lowerEveryN(every, unit) {
|
|
2284
|
+
const safeEvery = Number.isInteger(every) && every > 0 ? every : 1;
|
|
2285
|
+
return { mode: "interval", every: safeEvery, unit };
|
|
2286
|
+
}
|
|
2287
|
+
function lowerDailyAt(time) {
|
|
2288
|
+
const { hour, minute } = parseTime(time);
|
|
2289
|
+
return { mode: "cron", expression: `${minute} ${hour} * * *` };
|
|
2290
|
+
}
|
|
2291
|
+
function lowerWeeklyAt(days, time) {
|
|
2292
|
+
const { hour, minute } = parseTime(time);
|
|
2293
|
+
const sortedDays = [...days];
|
|
2294
|
+
sortedDays.sort((a, b) => a - b);
|
|
2295
|
+
const dow = sortedDays.length > 0 ? sortedDays.join(",") : "*";
|
|
2296
|
+
return { mode: "cron", expression: `${minute} ${hour} * * ${dow}` };
|
|
2297
|
+
}
|
|
2298
|
+
function lowerMonthlyOnDay(day, time) {
|
|
2299
|
+
const { hour, minute } = parseTime(time);
|
|
2300
|
+
const safeDay = Math.min(31, Math.max(1, Math.trunc(day)));
|
|
2301
|
+
return { mode: "cron", expression: `${minute} ${hour} ${safeDay} * *` };
|
|
2302
|
+
}
|
|
2303
|
+
function isEvenDivisorStep(every, cycleLength) {
|
|
2304
|
+
return Number.isInteger(every) && every > 0 && every < cycleLength && cycleLength % every === 0;
|
|
2305
|
+
}
|
|
2306
|
+
function valueToCronFields(value) {
|
|
2307
|
+
if (value.mode === "cron")
|
|
2308
|
+
return splitCron(value.expression);
|
|
2309
|
+
switch (value.unit) {
|
|
2310
|
+
case "minutes":
|
|
2311
|
+
if (isEvenDivisorStep(value.every, 60))
|
|
2312
|
+
return [`*/${value.every}`, "*", "*", "*", "*"];
|
|
2313
|
+
if (value.every % 60 === 0)
|
|
2314
|
+
return hoursIntervalFields(value.every / 60);
|
|
2315
|
+
return ["0", "0", "*", "*", "*"];
|
|
2316
|
+
case "hours":
|
|
2317
|
+
return hoursIntervalFields(value.every);
|
|
2318
|
+
case "days":
|
|
2319
|
+
case "weeks":
|
|
2320
|
+
return ["0", "0", "*", "*", "*"];
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
function hoursIntervalFields(everyHours) {
|
|
2324
|
+
if (everyHours === 1)
|
|
2325
|
+
return ["0", "*", "*", "*", "*"];
|
|
2326
|
+
if (isEvenDivisorStep(everyHours, 24))
|
|
2327
|
+
return ["0", `*/${everyHours}`, "*", "*", "*"];
|
|
2328
|
+
return ["0", "0", "*", "*", "*"];
|
|
2329
|
+
}
|
|
2330
|
+
function valueToInterval(value) {
|
|
2331
|
+
if (value.mode === "interval")
|
|
2332
|
+
return { every: value.every, unit: value.unit };
|
|
2333
|
+
const [minute, hour, dom, month, dow] = splitCron(value.expression);
|
|
2334
|
+
if (month !== "*" || dow !== "*")
|
|
2335
|
+
return;
|
|
2336
|
+
if (dom === "*" && hour === "*" && minute === "*")
|
|
2337
|
+
return { every: 1, unit: "minutes" };
|
|
2338
|
+
if (dom === "*" && hour === "*" && minute === "0")
|
|
2339
|
+
return { every: 1, unit: "hours" };
|
|
2340
|
+
const minuteStep = cronFieldStep(minute);
|
|
2341
|
+
if (minuteStep && isEvenDivisorStep(minuteStep, 60) && hour === "*" && dom === "*") {
|
|
2342
|
+
return { every: minuteStep, unit: "minutes" };
|
|
2343
|
+
}
|
|
2344
|
+
const hourStep = cronFieldStep(hour);
|
|
2345
|
+
if (hourStep && isEvenDivisorStep(hourStep, 24) && minute === "0" && dom === "*") {
|
|
2346
|
+
return { every: hourStep, unit: "hours" };
|
|
2347
|
+
}
|
|
2348
|
+
return;
|
|
2349
|
+
}
|
|
2350
|
+
function cronFieldStep(token) {
|
|
2351
|
+
const match = token.match(/^\*\/(\d+)$/);
|
|
2352
|
+
return match ? Number(match[1]) : undefined;
|
|
2353
|
+
}
|
|
2354
|
+
var DOW_NAMES = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
|
2355
|
+
function pad2(n) {
|
|
2356
|
+
return n.toString().padStart(2, "0");
|
|
2357
|
+
}
|
|
2358
|
+
function isFixedInRange(token, min, max) {
|
|
2359
|
+
if (!/^\d+$/.test(token))
|
|
2360
|
+
return false;
|
|
2361
|
+
const n = Number(token);
|
|
2362
|
+
return Number.isInteger(n) && n >= min && n <= max;
|
|
2363
|
+
}
|
|
2364
|
+
function describeValue(value) {
|
|
2365
|
+
if (value.mode === "interval") {
|
|
2366
|
+
return value.every === 1 ? `Every ${singularUnit(value.unit)}` : `Every ${value.every} ${value.unit}`;
|
|
2367
|
+
}
|
|
2368
|
+
const [minute, hour, dom, month, dow] = splitCron(value.expression);
|
|
2369
|
+
const timeIsFixed = isFixedInRange(minute, 0, 59) && isFixedInRange(hour, 0, 23);
|
|
2370
|
+
const at = timeIsFixed ? ` at ${pad2(Number(hour))}:${pad2(Number(minute))}` : "";
|
|
2371
|
+
if (timeIsFixed && dom === "*" && month === "*" && dow !== "*" && /^[\d,]+$/.test(dow)) {
|
|
2372
|
+
const dayNumbers = dow.split(",").map(Number);
|
|
2373
|
+
const allDaysInRange = dayNumbers.every((day) => Number.isInteger(day) && day >= 0 && day <= 6);
|
|
2374
|
+
if (allDaysInRange) {
|
|
2375
|
+
const names = dayNumbers.map((day) => DOW_NAMES[day] ?? "").join(", ");
|
|
2376
|
+
return `Weekly on ${names}${at}`;
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
if (timeIsFixed && isFixedInRange(dom, 1, 31) && month === "*" && dow === "*") {
|
|
2380
|
+
return `Monthly on day ${dom}${at}`;
|
|
2381
|
+
}
|
|
2382
|
+
if (dom === "*" && month === "*" && dow === "*" && timeIsFixed) {
|
|
2383
|
+
return `Daily${at}`;
|
|
2384
|
+
}
|
|
2385
|
+
return `Cron: ${joinCron([minute, hour, dom, month, dow])}`;
|
|
2386
|
+
}
|
|
2387
|
+
|
|
2388
|
+
// src/components/schedule-builder/schedule-builder.svelte
|
|
2389
|
+
var rest_excludes8 = new Set([
|
|
2390
|
+
"$$slots",
|
|
2391
|
+
"$$events",
|
|
2392
|
+
"$$legacy",
|
|
2393
|
+
"value",
|
|
2394
|
+
"onchange",
|
|
2395
|
+
"computeNextFires",
|
|
2396
|
+
"previewCount",
|
|
2397
|
+
"timezoneLabel",
|
|
2398
|
+
"timezone",
|
|
2399
|
+
"label",
|
|
2400
|
+
"class",
|
|
2401
|
+
"aria-label",
|
|
2402
|
+
"aria-labelledby"
|
|
2403
|
+
]);
|
|
2404
|
+
var root8 = $9.from_html(`<!> <!> <!>`, 1);
|
|
2405
|
+
var root_18 = $9.from_html(`<!> <!> <!> <!>`, 1);
|
|
2406
|
+
var root_28 = $9.from_html(`<div class="cinder-schedule-builder__field-row"><!> <!></div>`);
|
|
2407
|
+
var root_36 = $9.from_html(`<div class="cinder-schedule-builder__weekday-group" role="group" aria-label="Days of week"></div> <!>`, 1);
|
|
2408
|
+
var root_45 = $9.from_html(`<div role="tabpanel" class="cinder-schedule-builder__panel" data-sb-panel="presets"><!> <!></div>`);
|
|
2409
|
+
var root_55 = $9.from_html(`<div role="tabpanel" class="cinder-schedule-builder__panel" data-sb-panel="cron"><div class="cinder-schedule-builder__cron-fields"></div></div>`);
|
|
2410
|
+
var root_63 = $9.from_html(`<div role="tabpanel" class="cinder-schedule-builder__panel" data-sb-panel="interval"><div class="cinder-schedule-builder__field-row"><!> <!></div></div>`);
|
|
2411
|
+
var root_72 = $9.from_html(`<p class="cinder-schedule-builder__empty">Preview unavailable — fix the cron expression above.</p>`);
|
|
2412
|
+
var root_82 = $9.from_html(`<p class="cinder-schedule-builder__empty">Preview unavailable.</p>`);
|
|
2413
|
+
var root_92 = $9.from_html(`<li class="cinder-schedule-builder__preview-item"> </li>`);
|
|
2414
|
+
var root_102 = $9.from_html(`<ul class="cinder-schedule-builder__preview-list"></ul>`);
|
|
2415
|
+
var root_11 = $9.from_html(`<p class="cinder-schedule-builder__empty">No upcoming fires.</p>`);
|
|
2416
|
+
var root_122 = $9.from_html(`<div class="cinder-schedule-builder__preview"><span class="cinder-schedule-builder__section-label">Upcoming fires</span> <!></div>`);
|
|
2417
|
+
var root_132 = $9.from_html(`<span class="cinder-schedule-builder__empty">Not set</span>`);
|
|
2418
|
+
var root_142 = $9.from_html(`<div><!> <!> <dl class="cinder-schedule-builder__summary"><dt class="cinder-schedule-builder__section-label">Summary</dt> <dd class="cinder-schedule-builder__summary-text"> </dd></dl> <!> <dl class="cinder-schedule-builder__timezone"><dt class="cinder-schedule-builder__section-label">Timezone</dt> <dd class="cinder-schedule-builder__timezone-value"><!></dd></dl></div>`);
|
|
2419
|
+
function Schedule_builder($$anchor, $$props) {
|
|
2420
|
+
const baseId = $9.props_id();
|
|
2421
|
+
$9.push($$props, true);
|
|
2422
|
+
const PRESET_EVERY_UNIT_OPTIONS = [
|
|
2423
|
+
{ value: "minutes", label: "Minutes" },
|
|
2424
|
+
{ value: "hours", label: "Hours" }
|
|
2425
|
+
];
|
|
2426
|
+
const INTERVAL_UNIT_LABELS = {
|
|
2427
|
+
minutes: "Minutes",
|
|
2428
|
+
hours: "Hours",
|
|
2429
|
+
days: "Days",
|
|
2430
|
+
weeks: "Weeks"
|
|
2431
|
+
};
|
|
2432
|
+
const INTERVAL_UNIT_OPTIONS = INTERVAL_UNITS.map((unit) => ({ value: unit, label: INTERVAL_UNIT_LABELS[unit] }));
|
|
2433
|
+
let previewCount = $9.prop($$props, "previewCount", 3, 5), label = $9.prop($$props, "label", 3, "Schedule"), rest = $9.rest_props($$props, rest_excludes8);
|
|
2434
|
+
const normalizedAriaLabel = $9.derived(() => typeof $$props["aria-label"] === "string" && $$props["aria-label"].trim().length > 0 ? $$props["aria-label"] : undefined);
|
|
2435
|
+
const normalizedAriaLabelledby = $9.derived(() => typeof $$props["aria-labelledby"] === "string" && $$props["aria-labelledby"].trim().length > 0 ? $$props["aria-labelledby"] : undefined);
|
|
2436
|
+
const resolvedAriaLabel = $9.derived(() => $9.get(normalizedAriaLabelledby) === undefined && $9.get(normalizedAriaLabel) === undefined ? label() : $9.get(normalizedAriaLabel));
|
|
2437
|
+
const seedValue = $$props.value ?? defaultScheduleValue();
|
|
2438
|
+
function scheduleValuesEqual(a, b) {
|
|
2439
|
+
if (a.mode !== b.mode)
|
|
2440
|
+
return false;
|
|
2441
|
+
if (a.mode === "cron" && b.mode === "cron")
|
|
2442
|
+
return a.expression === b.expression;
|
|
2443
|
+
if (a.mode === "interval" && b.mode === "interval") {
|
|
2444
|
+
return a.every === b.every && a.unit === b.unit;
|
|
2445
|
+
}
|
|
2446
|
+
return false;
|
|
2447
|
+
}
|
|
2448
|
+
function initialAuthoringMode(candidateValue) {
|
|
2449
|
+
if (candidateValue === undefined)
|
|
2450
|
+
return "presets";
|
|
2451
|
+
if (candidateValue.mode === "cron")
|
|
2452
|
+
return "cron";
|
|
2453
|
+
return candidateValue.unit === "minutes" || candidateValue.unit === "hours" ? "presets" : "interval";
|
|
2454
|
+
}
|
|
2455
|
+
function seedFieldsFromValue(seededValue) {
|
|
2456
|
+
const interval = valueToInterval(seededValue);
|
|
2457
|
+
const isMinutesOrHours = interval !== undefined && (interval.unit === "minutes" || interval.unit === "hours");
|
|
2458
|
+
return {
|
|
2459
|
+
authoringMode: initialAuthoringMode(seededValue),
|
|
2460
|
+
cronFields: valueToCronFields(seededValue),
|
|
2461
|
+
intervalEvery: interval?.every ?? 15,
|
|
2462
|
+
intervalUnit: interval?.unit ?? "minutes",
|
|
2463
|
+
presetKind: "every",
|
|
2464
|
+
presetEveryValue: isMinutesOrHours ? interval.every : 15,
|
|
2465
|
+
presetEveryUnit: isMinutesOrHours ? interval.unit : "minutes",
|
|
2466
|
+
presetDailyTime: "09:00",
|
|
2467
|
+
presetWeeklyDays: [],
|
|
2468
|
+
presetWeeklyTime: "09:00",
|
|
2469
|
+
presetMonthlyDay: 1,
|
|
2470
|
+
presetMonthlyTime: "09:00"
|
|
2471
|
+
};
|
|
2472
|
+
}
|
|
2473
|
+
const initialSeed = seedFieldsFromValue(seedValue);
|
|
2474
|
+
let authoringMode = $9.state($9.proxy(initialSeed.authoringMode));
|
|
2475
|
+
let presetKind = $9.state($9.proxy(initialSeed.presetKind));
|
|
2476
|
+
let cronFields = $9.state($9.proxy(initialSeed.cronFields));
|
|
2477
|
+
let intervalEvery = $9.state($9.proxy(initialSeed.intervalEvery));
|
|
2478
|
+
let intervalUnit = $9.state($9.proxy(initialSeed.intervalUnit));
|
|
2479
|
+
let presetEveryValue = $9.state($9.proxy(initialSeed.presetEveryValue));
|
|
2480
|
+
let presetEveryUnit = $9.state($9.proxy(initialSeed.presetEveryUnit));
|
|
2481
|
+
let presetDailyTime = $9.state($9.proxy(initialSeed.presetDailyTime));
|
|
2482
|
+
let presetWeeklyDays = $9.state($9.proxy(initialSeed.presetWeeklyDays));
|
|
2483
|
+
let presetWeeklyTime = $9.state($9.proxy(initialSeed.presetWeeklyTime));
|
|
2484
|
+
let presetMonthlyDay = $9.state($9.proxy(initialSeed.presetMonthlyDay));
|
|
2485
|
+
let presetMonthlyTime = $9.state($9.proxy(initialSeed.presetMonthlyTime));
|
|
2486
|
+
function valueForPresets() {
|
|
2487
|
+
switch ($9.get(presetKind)) {
|
|
2488
|
+
case "every":
|
|
2489
|
+
return lowerEveryN($9.get(presetEveryValue), $9.get(presetEveryUnit));
|
|
2490
|
+
case "daily":
|
|
2491
|
+
return lowerDailyAt($9.get(presetDailyTime));
|
|
2492
|
+
case "weekly":
|
|
2493
|
+
return lowerWeeklyAt($9.get(presetWeeklyDays), $9.get(presetWeeklyTime));
|
|
2494
|
+
case "monthly":
|
|
2495
|
+
return lowerMonthlyOnDay($9.get(presetMonthlyDay), $9.get(presetMonthlyTime));
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
2498
|
+
function valueForMode(mode) {
|
|
2499
|
+
if (mode === "cron")
|
|
2500
|
+
return { mode: "cron", expression: joinCron($9.get(cronFields)) };
|
|
2501
|
+
if (mode === "interval")
|
|
2502
|
+
return {
|
|
2503
|
+
mode: "interval",
|
|
2504
|
+
every: $9.get(intervalEvery),
|
|
2505
|
+
unit: $9.get(intervalUnit)
|
|
2506
|
+
};
|
|
2507
|
+
return valueForPresets();
|
|
2508
|
+
}
|
|
2509
|
+
const currentValue = $9.derived(() => valueForMode($9.get(authoringMode)));
|
|
2510
|
+
const currentValueIsValid = $9.derived(() => $9.get(authoringMode) !== "cron" || cronFieldsValid($9.get(cronFields)));
|
|
2511
|
+
const resolvedPreviewCount = $9.derived(() => Number.isInteger(previewCount()) && previewCount() > 0 ? previewCount() : 5);
|
|
2512
|
+
const previewResult = $9.derived(() => {
|
|
2513
|
+
if (!$$props.computeNextFires)
|
|
2514
|
+
return { status: "hidden" };
|
|
2515
|
+
if (!$9.get(currentValueIsValid))
|
|
2516
|
+
return { status: "invalid" };
|
|
2517
|
+
try {
|
|
2518
|
+
return {
|
|
2519
|
+
status: "ok",
|
|
2520
|
+
fires: $$props.computeNextFires($9.get(currentValue), $9.get(resolvedPreviewCount))
|
|
2521
|
+
};
|
|
2522
|
+
} catch {
|
|
2523
|
+
return { status: "error" };
|
|
2524
|
+
}
|
|
2525
|
+
});
|
|
2526
|
+
let lastKnownValue = seedValue;
|
|
2527
|
+
let previousValueProp = $$props.value;
|
|
2528
|
+
$9.user_effect(() => {
|
|
2529
|
+
const incoming = $$props.value;
|
|
2530
|
+
const propChanged = incoming !== previousValueProp;
|
|
2531
|
+
previousValueProp = incoming;
|
|
2532
|
+
if (!propChanged)
|
|
2533
|
+
return;
|
|
2534
|
+
const resolved = incoming ?? defaultScheduleValue();
|
|
2535
|
+
if (incoming !== undefined && scheduleValuesEqual(resolved, lastKnownValue))
|
|
2536
|
+
return;
|
|
2537
|
+
const seed = seedFieldsFromValue(resolved);
|
|
2538
|
+
$9.set(authoringMode, seed.authoringMode, true);
|
|
2539
|
+
$9.set(cronFields, seed.cronFields, true);
|
|
2540
|
+
$9.set(intervalEvery, seed.intervalEvery, true);
|
|
2541
|
+
$9.set(intervalUnit, seed.intervalUnit, true);
|
|
2542
|
+
$9.set(presetKind, seed.presetKind, true);
|
|
2543
|
+
$9.set(presetEveryValue, seed.presetEveryValue, true);
|
|
2544
|
+
$9.set(presetEveryUnit, seed.presetEveryUnit, true);
|
|
2545
|
+
$9.set(presetDailyTime, seed.presetDailyTime, true);
|
|
2546
|
+
$9.set(presetWeeklyDays, seed.presetWeeklyDays, true);
|
|
2547
|
+
$9.set(presetWeeklyTime, seed.presetWeeklyTime, true);
|
|
2548
|
+
$9.set(presetMonthlyDay, seed.presetMonthlyDay, true);
|
|
2549
|
+
$9.set(presetMonthlyTime, seed.presetMonthlyTime, true);
|
|
2550
|
+
lastKnownValue = resolved;
|
|
2551
|
+
});
|
|
2552
|
+
function emitChange() {
|
|
2553
|
+
lastKnownValue = $9.get(currentValue);
|
|
2554
|
+
$$props.onchange?.($9.get(currentValue));
|
|
2555
|
+
}
|
|
2556
|
+
function handleAuthoringModeChange(nextMode) {
|
|
2557
|
+
if (nextMode === $9.get(authoringMode))
|
|
2558
|
+
return;
|
|
2559
|
+
$9.set(authoringMode, nextMode, true);
|
|
2560
|
+
if (nextMode === "cron") {
|
|
2561
|
+
$9.set(cronFields, valueToCronFields(lastKnownValue), true);
|
|
2562
|
+
} else if (nextMode === "interval") {
|
|
2563
|
+
const interval = valueToInterval(lastKnownValue);
|
|
2564
|
+
if (interval) {
|
|
2565
|
+
$9.set(intervalEvery, interval.every, true);
|
|
2566
|
+
$9.set(intervalUnit, interval.unit, true);
|
|
2567
|
+
}
|
|
2568
|
+
} else if (nextMode === "presets") {
|
|
2569
|
+
const seed = seedFieldsFromValue(lastKnownValue);
|
|
2570
|
+
$9.set(presetKind, seed.presetKind, true);
|
|
2571
|
+
$9.set(presetEveryValue, seed.presetEveryValue, true);
|
|
2572
|
+
$9.set(presetEveryUnit, seed.presetEveryUnit, true);
|
|
2573
|
+
$9.set(presetDailyTime, seed.presetDailyTime, true);
|
|
2574
|
+
$9.set(presetWeeklyDays, seed.presetWeeklyDays, true);
|
|
2575
|
+
$9.set(presetWeeklyTime, seed.presetWeeklyTime, true);
|
|
2576
|
+
$9.set(presetMonthlyDay, seed.presetMonthlyDay, true);
|
|
2577
|
+
$9.set(presetMonthlyTime, seed.presetMonthlyTime, true);
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2580
|
+
function handlePresetKindChange(nextKind) {
|
|
2581
|
+
if (nextKind === $9.get(presetKind))
|
|
2582
|
+
return;
|
|
2583
|
+
$9.set(presetKind, nextKind, true);
|
|
2584
|
+
emitChange();
|
|
2585
|
+
}
|
|
2586
|
+
function handleCronFieldChange(index, raw) {
|
|
2587
|
+
const next3 = [...$9.get(cronFields)];
|
|
2588
|
+
next3[index] = raw;
|
|
2589
|
+
$9.set(cronFields, next3, true);
|
|
2590
|
+
if (cronFieldsValid(next3))
|
|
2591
|
+
emitChange();
|
|
2592
|
+
}
|
|
2593
|
+
function toPositiveInteger(next3) {
|
|
2594
|
+
if (next3 === null || !Number.isFinite(next3) || next3 < 1)
|
|
2595
|
+
return 1;
|
|
2596
|
+
return Math.trunc(next3);
|
|
2597
|
+
}
|
|
2598
|
+
function handleIntervalEveryChange(next3) {
|
|
2599
|
+
$9.set(intervalEvery, toPositiveInteger(next3), true);
|
|
2600
|
+
emitChange();
|
|
2601
|
+
}
|
|
2602
|
+
function handleIntervalUnitChange(event) {
|
|
2603
|
+
$9.set(intervalUnit, event.currentTarget.value, true);
|
|
2604
|
+
emitChange();
|
|
2605
|
+
}
|
|
2606
|
+
function handlePresetEveryValueChange(next3) {
|
|
2607
|
+
$9.set(presetEveryValue, toPositiveInteger(next3), true);
|
|
2608
|
+
emitChange();
|
|
2609
|
+
}
|
|
2610
|
+
function handlePresetEveryUnitChange(event) {
|
|
2611
|
+
$9.set(presetEveryUnit, event.currentTarget.value, true);
|
|
2612
|
+
emitChange();
|
|
2613
|
+
}
|
|
2614
|
+
function acceptPresetTime(next3, commit) {
|
|
2615
|
+
if (!next3)
|
|
2616
|
+
return;
|
|
2617
|
+
commit(next3);
|
|
2618
|
+
emitChange();
|
|
2619
|
+
}
|
|
2620
|
+
function handlePresetDailyTimeChange(next3) {
|
|
2621
|
+
acceptPresetTime(next3, (time) => $9.set(presetDailyTime, time, true));
|
|
2622
|
+
}
|
|
2623
|
+
function toggleWeeklyDay(day) {
|
|
2624
|
+
$9.set(presetWeeklyDays, $9.get(presetWeeklyDays).includes(day) ? $9.get(presetWeeklyDays).filter((existing) => existing !== day) : [...$9.get(presetWeeklyDays), day], true);
|
|
2625
|
+
emitChange();
|
|
2626
|
+
}
|
|
2627
|
+
function handlePresetWeeklyTimeChange(next3) {
|
|
2628
|
+
acceptPresetTime(next3, (time) => $9.set(presetWeeklyTime, time, true));
|
|
2629
|
+
}
|
|
2630
|
+
function handlePresetMonthlyDayChange(next3) {
|
|
2631
|
+
$9.set(presetMonthlyDay, next3 && next3 >= 1 ? Math.min(31, Math.trunc(next3)) : 1, true);
|
|
2632
|
+
emitChange();
|
|
2633
|
+
}
|
|
2634
|
+
function handlePresetMonthlyTimeChange(next3) {
|
|
2635
|
+
acceptPresetTime(next3, (time) => $9.set(presetMonthlyTime, time, true));
|
|
2636
|
+
}
|
|
2637
|
+
const modeTabId = (mode) => `${baseId}-mode-${mode}-tab`;
|
|
2638
|
+
const modePanelId = (mode) => `${baseId}-mode-${mode}-panel`;
|
|
2639
|
+
var div = root_142();
|
|
2640
|
+
$9.attribute_effect(div, ($0) => ({
|
|
2641
|
+
...rest,
|
|
2642
|
+
class: $0,
|
|
2643
|
+
role: "group",
|
|
2644
|
+
"aria-label": $9.get(resolvedAriaLabel),
|
|
2645
|
+
"aria-labelledby": $9.get(normalizedAriaLabelledby),
|
|
2646
|
+
"data-sb-mode": $9.get(authoringMode)
|
|
2647
|
+
}), [() => classNames("cinder-schedule-builder", $$props.class)]);
|
|
2648
|
+
var node = $9.child(div);
|
|
2649
|
+
{
|
|
2650
|
+
let $0 = $9.derived(() => `${baseId}-mode`);
|
|
2651
|
+
Segmented_control(node, {
|
|
2652
|
+
get id() {
|
|
2653
|
+
return $9.get($0);
|
|
2654
|
+
},
|
|
2655
|
+
label: "Schedule authoring mode",
|
|
2656
|
+
variant: "tablist",
|
|
2657
|
+
get value() {
|
|
2658
|
+
return $9.get(authoringMode);
|
|
2659
|
+
},
|
|
2660
|
+
onchange: handleAuthoringModeChange,
|
|
2661
|
+
class: "cinder-schedule-builder__mode-switch",
|
|
2662
|
+
children: ($$anchor2, $$slotProps) => {
|
|
2663
|
+
var fragment = root8();
|
|
2664
|
+
var node_1 = $9.first_child(fragment);
|
|
2665
|
+
{
|
|
2666
|
+
let $02 = $9.derived(() => modeTabId("presets"));
|
|
2667
|
+
let $1 = $9.derived(() => modePanelId("presets"));
|
|
2668
|
+
Segment(node_1, {
|
|
2669
|
+
get id() {
|
|
2670
|
+
return $9.get($02);
|
|
2671
|
+
},
|
|
2672
|
+
value: "presets",
|
|
2673
|
+
get controls() {
|
|
2674
|
+
return $9.get($1);
|
|
2675
|
+
},
|
|
2676
|
+
children: ($$anchor3, $$slotProps2) => {
|
|
2677
|
+
$9.next();
|
|
2678
|
+
var text2 = $9.text("Presets");
|
|
2679
|
+
$9.append($$anchor3, text2);
|
|
2680
|
+
},
|
|
2681
|
+
$$slots: { default: true }
|
|
2682
|
+
});
|
|
2683
|
+
}
|
|
2684
|
+
var node_2 = $9.sibling(node_1, 2);
|
|
2685
|
+
{
|
|
2686
|
+
let $02 = $9.derived(() => modeTabId("cron"));
|
|
2687
|
+
let $1 = $9.derived(() => modePanelId("cron"));
|
|
2688
|
+
Segment(node_2, {
|
|
2689
|
+
get id() {
|
|
2690
|
+
return $9.get($02);
|
|
2691
|
+
},
|
|
2692
|
+
value: "cron",
|
|
2693
|
+
get controls() {
|
|
2694
|
+
return $9.get($1);
|
|
2695
|
+
},
|
|
2696
|
+
children: ($$anchor3, $$slotProps2) => {
|
|
2697
|
+
$9.next();
|
|
2698
|
+
var text_1 = $9.text("Cron");
|
|
2699
|
+
$9.append($$anchor3, text_1);
|
|
2700
|
+
},
|
|
2701
|
+
$$slots: { default: true }
|
|
2702
|
+
});
|
|
2703
|
+
}
|
|
2704
|
+
var node_3 = $9.sibling(node_2, 2);
|
|
2705
|
+
{
|
|
2706
|
+
let $02 = $9.derived(() => modeTabId("interval"));
|
|
2707
|
+
let $1 = $9.derived(() => modePanelId("interval"));
|
|
2708
|
+
Segment(node_3, {
|
|
2709
|
+
get id() {
|
|
2710
|
+
return $9.get($02);
|
|
2711
|
+
},
|
|
2712
|
+
value: "interval",
|
|
2713
|
+
get controls() {
|
|
2714
|
+
return $9.get($1);
|
|
2715
|
+
},
|
|
2716
|
+
children: ($$anchor3, $$slotProps2) => {
|
|
2717
|
+
$9.next();
|
|
2718
|
+
var text_2 = $9.text("Interval");
|
|
2719
|
+
$9.append($$anchor3, text_2);
|
|
2720
|
+
},
|
|
2721
|
+
$$slots: { default: true }
|
|
2722
|
+
});
|
|
2723
|
+
}
|
|
2724
|
+
$9.append($$anchor2, fragment);
|
|
2725
|
+
},
|
|
2726
|
+
$$slots: { default: true }
|
|
2727
|
+
});
|
|
2728
|
+
}
|
|
2729
|
+
var node_4 = $9.sibling(node, 2);
|
|
2730
|
+
{
|
|
2731
|
+
var consequent_3 = ($$anchor2) => {
|
|
2732
|
+
var div_1 = root_45();
|
|
2733
|
+
var node_5 = $9.child(div_1);
|
|
2734
|
+
{
|
|
2735
|
+
let $0 = $9.derived(() => `${baseId}-preset-kind`);
|
|
2736
|
+
Segmented_control(node_5, {
|
|
2737
|
+
get id() {
|
|
2738
|
+
return $9.get($0);
|
|
2739
|
+
},
|
|
2740
|
+
label: "Preset kind",
|
|
2741
|
+
get value() {
|
|
2742
|
+
return $9.get(presetKind);
|
|
2743
|
+
},
|
|
2744
|
+
onchange: handlePresetKindChange,
|
|
2745
|
+
class: "cinder-schedule-builder__preset-kind",
|
|
2746
|
+
children: ($$anchor3, $$slotProps) => {
|
|
2747
|
+
var fragment_1 = root_18();
|
|
2748
|
+
var node_6 = $9.first_child(fragment_1);
|
|
2749
|
+
{
|
|
2750
|
+
let $02 = $9.derived(() => `${baseId}-preset-kind-every`);
|
|
2751
|
+
Segment(node_6, {
|
|
2752
|
+
get id() {
|
|
2753
|
+
return $9.get($02);
|
|
2754
|
+
},
|
|
2755
|
+
value: "every",
|
|
2756
|
+
children: ($$anchor4, $$slotProps2) => {
|
|
2757
|
+
$9.next();
|
|
2758
|
+
var text_3 = $9.text("Every N");
|
|
2759
|
+
$9.append($$anchor4, text_3);
|
|
2760
|
+
},
|
|
2761
|
+
$$slots: { default: true }
|
|
2762
|
+
});
|
|
2763
|
+
}
|
|
2764
|
+
var node_7 = $9.sibling(node_6, 2);
|
|
2765
|
+
{
|
|
2766
|
+
let $02 = $9.derived(() => `${baseId}-preset-kind-daily`);
|
|
2767
|
+
Segment(node_7, {
|
|
2768
|
+
get id() {
|
|
2769
|
+
return $9.get($02);
|
|
2770
|
+
},
|
|
2771
|
+
value: "daily",
|
|
2772
|
+
children: ($$anchor4, $$slotProps2) => {
|
|
2773
|
+
$9.next();
|
|
2774
|
+
var text_4 = $9.text("Daily");
|
|
2775
|
+
$9.append($$anchor4, text_4);
|
|
2776
|
+
},
|
|
2777
|
+
$$slots: { default: true }
|
|
2778
|
+
});
|
|
2779
|
+
}
|
|
2780
|
+
var node_8 = $9.sibling(node_7, 2);
|
|
2781
|
+
{
|
|
2782
|
+
let $02 = $9.derived(() => `${baseId}-preset-kind-weekly`);
|
|
2783
|
+
Segment(node_8, {
|
|
2784
|
+
get id() {
|
|
2785
|
+
return $9.get($02);
|
|
2786
|
+
},
|
|
2787
|
+
value: "weekly",
|
|
2788
|
+
children: ($$anchor4, $$slotProps2) => {
|
|
2789
|
+
$9.next();
|
|
2790
|
+
var text_5 = $9.text("Weekly");
|
|
2791
|
+
$9.append($$anchor4, text_5);
|
|
2792
|
+
},
|
|
2793
|
+
$$slots: { default: true }
|
|
2794
|
+
});
|
|
2795
|
+
}
|
|
2796
|
+
var node_9 = $9.sibling(node_8, 2);
|
|
2797
|
+
{
|
|
2798
|
+
let $02 = $9.derived(() => `${baseId}-preset-kind-monthly`);
|
|
2799
|
+
Segment(node_9, {
|
|
2800
|
+
get id() {
|
|
2801
|
+
return $9.get($02);
|
|
2802
|
+
},
|
|
2803
|
+
value: "monthly",
|
|
2804
|
+
children: ($$anchor4, $$slotProps2) => {
|
|
2805
|
+
$9.next();
|
|
2806
|
+
var text_6 = $9.text("Monthly");
|
|
2807
|
+
$9.append($$anchor4, text_6);
|
|
2808
|
+
},
|
|
2809
|
+
$$slots: { default: true }
|
|
2810
|
+
});
|
|
2811
|
+
}
|
|
2812
|
+
$9.append($$anchor3, fragment_1);
|
|
2813
|
+
},
|
|
2814
|
+
$$slots: { default: true }
|
|
2815
|
+
});
|
|
2816
|
+
}
|
|
2817
|
+
var node_10 = $9.sibling(node_5, 2);
|
|
2818
|
+
{
|
|
2819
|
+
var consequent = ($$anchor3) => {
|
|
2820
|
+
var div_2 = root_28();
|
|
2821
|
+
var node_11 = $9.child(div_2);
|
|
2822
|
+
var bind_get = () => $9.get(presetEveryValue);
|
|
2823
|
+
var bind_set = handlePresetEveryValueChange;
|
|
2824
|
+
{
|
|
2825
|
+
let $0 = $9.derived(() => `${baseId}-preset-every-value`);
|
|
2826
|
+
Number_input(node_11, {
|
|
2827
|
+
get id() {
|
|
2828
|
+
return $9.get($0);
|
|
2829
|
+
},
|
|
2830
|
+
label: "Every",
|
|
2831
|
+
min: 1,
|
|
2832
|
+
step: 1,
|
|
2833
|
+
get value() {
|
|
2834
|
+
return bind_get();
|
|
2835
|
+
},
|
|
2836
|
+
set value($$value) {
|
|
2837
|
+
bind_set($$value);
|
|
2838
|
+
}
|
|
2839
|
+
});
|
|
2840
|
+
}
|
|
2841
|
+
var node_12 = $9.sibling(node_11, 2);
|
|
2842
|
+
{
|
|
2843
|
+
let $0 = $9.derived(() => `${baseId}-preset-every-unit`);
|
|
2844
|
+
Select(node_12, {
|
|
2845
|
+
get id() {
|
|
2846
|
+
return $9.get($0);
|
|
2847
|
+
},
|
|
2848
|
+
label: "Unit",
|
|
2849
|
+
get options() {
|
|
2850
|
+
return PRESET_EVERY_UNIT_OPTIONS;
|
|
2851
|
+
},
|
|
2852
|
+
get value() {
|
|
2853
|
+
return $9.get(presetEveryUnit);
|
|
2854
|
+
},
|
|
2855
|
+
onchange: handlePresetEveryUnitChange
|
|
2856
|
+
});
|
|
2857
|
+
}
|
|
2858
|
+
$9.reset(div_2);
|
|
2859
|
+
$9.append($$anchor3, div_2);
|
|
2860
|
+
};
|
|
2861
|
+
var consequent_1 = ($$anchor3) => {
|
|
2862
|
+
var bind_get_1 = () => $9.get(presetDailyTime);
|
|
2863
|
+
var bind_set_1 = handlePresetDailyTimeChange;
|
|
2864
|
+
{
|
|
2865
|
+
let $0 = $9.derived(() => `${baseId}-preset-daily-time`);
|
|
2866
|
+
Time_field($$anchor3, {
|
|
2867
|
+
get id() {
|
|
2868
|
+
return $9.get($0);
|
|
2869
|
+
},
|
|
2870
|
+
label: "At",
|
|
2871
|
+
get value() {
|
|
2872
|
+
return bind_get_1();
|
|
2873
|
+
},
|
|
2874
|
+
set value($$value) {
|
|
2875
|
+
bind_set_1($$value);
|
|
2876
|
+
}
|
|
2877
|
+
});
|
|
2878
|
+
}
|
|
2879
|
+
};
|
|
2880
|
+
var consequent_2 = ($$anchor3) => {
|
|
2881
|
+
var fragment_3 = root_36();
|
|
2882
|
+
var div_3 = $9.first_child(fragment_3);
|
|
2883
|
+
$9.each(div_3, 21, () => WEEKDAYS, (day) => day.value, ($$anchor4, day) => {
|
|
2884
|
+
{
|
|
2885
|
+
let $0 = $9.derived(() => $9.get(presetWeeklyDays).includes($9.get(day).value));
|
|
2886
|
+
Chip($$anchor4, {
|
|
2887
|
+
mode: "toggle",
|
|
2888
|
+
get label() {
|
|
2889
|
+
return $9.get(day).short;
|
|
2890
|
+
},
|
|
2891
|
+
get "aria-label"() {
|
|
2892
|
+
return $9.get(day).long;
|
|
2893
|
+
},
|
|
2894
|
+
get pressed() {
|
|
2895
|
+
return $9.get($0);
|
|
2896
|
+
},
|
|
2897
|
+
onpressedchange: () => toggleWeeklyDay($9.get(day).value)
|
|
2898
|
+
});
|
|
2899
|
+
}
|
|
2900
|
+
});
|
|
2901
|
+
$9.reset(div_3);
|
|
2902
|
+
var node_13 = $9.sibling(div_3, 2);
|
|
2903
|
+
var bind_get_2 = () => $9.get(presetWeeklyTime);
|
|
2904
|
+
var bind_set_2 = handlePresetWeeklyTimeChange;
|
|
2905
|
+
{
|
|
2906
|
+
let $0 = $9.derived(() => `${baseId}-preset-weekly-time`);
|
|
2907
|
+
Time_field(node_13, {
|
|
2908
|
+
get id() {
|
|
2909
|
+
return $9.get($0);
|
|
2910
|
+
},
|
|
2911
|
+
label: "At",
|
|
2912
|
+
get value() {
|
|
2913
|
+
return bind_get_2();
|
|
2914
|
+
},
|
|
2915
|
+
set value($$value) {
|
|
2916
|
+
bind_set_2($$value);
|
|
2917
|
+
}
|
|
2918
|
+
});
|
|
2919
|
+
}
|
|
2920
|
+
$9.append($$anchor3, fragment_3);
|
|
2921
|
+
};
|
|
2922
|
+
var alternate = ($$anchor3) => {
|
|
2923
|
+
var div_4 = root_28();
|
|
2924
|
+
var node_14 = $9.child(div_4);
|
|
2925
|
+
var bind_get_3 = () => $9.get(presetMonthlyDay);
|
|
2926
|
+
var bind_set_3 = handlePresetMonthlyDayChange;
|
|
2927
|
+
{
|
|
2928
|
+
let $0 = $9.derived(() => `${baseId}-preset-monthly-day`);
|
|
2929
|
+
Number_input(node_14, {
|
|
2930
|
+
get id() {
|
|
2931
|
+
return $9.get($0);
|
|
2932
|
+
},
|
|
2933
|
+
label: "Day of month",
|
|
2934
|
+
min: 1,
|
|
2935
|
+
max: 31,
|
|
2936
|
+
get value() {
|
|
2937
|
+
return bind_get_3();
|
|
2938
|
+
},
|
|
2939
|
+
set value($$value) {
|
|
2940
|
+
bind_set_3($$value);
|
|
2941
|
+
}
|
|
2942
|
+
});
|
|
2943
|
+
}
|
|
2944
|
+
var node_15 = $9.sibling(node_14, 2);
|
|
2945
|
+
var bind_get_4 = () => $9.get(presetMonthlyTime);
|
|
2946
|
+
var bind_set_4 = handlePresetMonthlyTimeChange;
|
|
2947
|
+
{
|
|
2948
|
+
let $0 = $9.derived(() => `${baseId}-preset-monthly-time`);
|
|
2949
|
+
Time_field(node_15, {
|
|
2950
|
+
get id() {
|
|
2951
|
+
return $9.get($0);
|
|
2952
|
+
},
|
|
2953
|
+
label: "At",
|
|
2954
|
+
get value() {
|
|
2955
|
+
return bind_get_4();
|
|
2956
|
+
},
|
|
2957
|
+
set value($$value) {
|
|
2958
|
+
bind_set_4($$value);
|
|
2959
|
+
}
|
|
2960
|
+
});
|
|
2961
|
+
}
|
|
2962
|
+
$9.reset(div_4);
|
|
2963
|
+
$9.append($$anchor3, div_4);
|
|
2964
|
+
};
|
|
2965
|
+
$9.if(node_10, ($$render) => {
|
|
2966
|
+
if ($9.get(presetKind) === "every")
|
|
2967
|
+
$$render(consequent);
|
|
2968
|
+
else if ($9.get(presetKind) === "daily")
|
|
2969
|
+
$$render(consequent_1, 1);
|
|
2970
|
+
else if ($9.get(presetKind) === "weekly")
|
|
2971
|
+
$$render(consequent_2, 2);
|
|
2972
|
+
else
|
|
2973
|
+
$$render(alternate, -1);
|
|
2974
|
+
});
|
|
2975
|
+
}
|
|
2976
|
+
$9.reset(div_1);
|
|
2977
|
+
$9.template_effect(($0, $1) => {
|
|
2978
|
+
$9.set_attribute(div_1, "id", $0);
|
|
2979
|
+
$9.set_attribute(div_1, "aria-labelledby", $1);
|
|
2980
|
+
}, [() => modePanelId("presets"), () => modeTabId("presets")]);
|
|
2981
|
+
$9.append($$anchor2, div_1);
|
|
2982
|
+
};
|
|
2983
|
+
var consequent_4 = ($$anchor2) => {
|
|
2984
|
+
var div_5 = root_55();
|
|
2985
|
+
var div_6 = $9.child(div_5);
|
|
2986
|
+
$9.each(div_6, 23, () => CRON_FIELDS, (field) => field.name, ($$anchor3, field, index) => {
|
|
2987
|
+
const fieldError = $9.derived(() => validateCronField($9.get(cronFields)[$9.get(index)] ?? "*", $9.get(index)));
|
|
2988
|
+
var bind_get_5 = () => $9.get(cronFields)[$9.get(index)] ?? "*";
|
|
2989
|
+
var bind_set_5 = (next3) => handleCronFieldChange($9.get(index), next3);
|
|
2990
|
+
{
|
|
2991
|
+
let $0 = $9.derived(() => `${baseId}-cron-field-${$9.get(index)}`);
|
|
2992
|
+
Input($$anchor3, $9.spread_props({
|
|
2993
|
+
get id() {
|
|
2994
|
+
return $9.get($0);
|
|
2995
|
+
},
|
|
2996
|
+
get label() {
|
|
2997
|
+
return $9.get(field).name;
|
|
2998
|
+
},
|
|
2999
|
+
get description() {
|
|
3000
|
+
return $9.get(field).hint;
|
|
3001
|
+
},
|
|
3002
|
+
get value() {
|
|
3003
|
+
return bind_get_5();
|
|
3004
|
+
},
|
|
3005
|
+
set value($$value) {
|
|
3006
|
+
bind_set_5($$value);
|
|
3007
|
+
}
|
|
3008
|
+
}, () => $9.get(fieldError) ? { error: $9.get(fieldError) } : {}));
|
|
3009
|
+
}
|
|
3010
|
+
});
|
|
3011
|
+
$9.reset(div_6);
|
|
3012
|
+
$9.reset(div_5);
|
|
3013
|
+
$9.template_effect(($0, $1) => {
|
|
3014
|
+
$9.set_attribute(div_5, "id", $0);
|
|
3015
|
+
$9.set_attribute(div_5, "aria-labelledby", $1);
|
|
3016
|
+
}, [() => modePanelId("cron"), () => modeTabId("cron")]);
|
|
3017
|
+
$9.append($$anchor2, div_5);
|
|
3018
|
+
};
|
|
3019
|
+
var alternate_1 = ($$anchor2) => {
|
|
3020
|
+
var div_7 = root_63();
|
|
3021
|
+
var div_8 = $9.child(div_7);
|
|
3022
|
+
var node_16 = $9.child(div_8);
|
|
3023
|
+
var bind_get_6 = () => $9.get(intervalEvery);
|
|
3024
|
+
var bind_set_6 = handleIntervalEveryChange;
|
|
3025
|
+
{
|
|
3026
|
+
let $0 = $9.derived(() => `${baseId}-interval-every`);
|
|
3027
|
+
Number_input(node_16, {
|
|
3028
|
+
get id() {
|
|
3029
|
+
return $9.get($0);
|
|
3030
|
+
},
|
|
3031
|
+
label: "Every",
|
|
3032
|
+
min: 1,
|
|
3033
|
+
step: 1,
|
|
3034
|
+
get value() {
|
|
3035
|
+
return bind_get_6();
|
|
3036
|
+
},
|
|
3037
|
+
set value($$value) {
|
|
3038
|
+
bind_set_6($$value);
|
|
3039
|
+
}
|
|
3040
|
+
});
|
|
3041
|
+
}
|
|
3042
|
+
var node_17 = $9.sibling(node_16, 2);
|
|
3043
|
+
{
|
|
3044
|
+
let $0 = $9.derived(() => `${baseId}-interval-unit`);
|
|
3045
|
+
Select(node_17, {
|
|
3046
|
+
get id() {
|
|
3047
|
+
return $9.get($0);
|
|
3048
|
+
},
|
|
3049
|
+
label: "Unit",
|
|
3050
|
+
get options() {
|
|
3051
|
+
return INTERVAL_UNIT_OPTIONS;
|
|
3052
|
+
},
|
|
3053
|
+
get value() {
|
|
3054
|
+
return $9.get(intervalUnit);
|
|
3055
|
+
},
|
|
3056
|
+
onchange: handleIntervalUnitChange
|
|
3057
|
+
});
|
|
3058
|
+
}
|
|
3059
|
+
$9.reset(div_8);
|
|
3060
|
+
$9.reset(div_7);
|
|
3061
|
+
$9.template_effect(($0, $1) => {
|
|
3062
|
+
$9.set_attribute(div_7, "id", $0);
|
|
3063
|
+
$9.set_attribute(div_7, "aria-labelledby", $1);
|
|
3064
|
+
}, [() => modePanelId("interval"), () => modeTabId("interval")]);
|
|
3065
|
+
$9.append($$anchor2, div_7);
|
|
3066
|
+
};
|
|
3067
|
+
$9.if(node_4, ($$render) => {
|
|
3068
|
+
if ($9.get(authoringMode) === "presets")
|
|
3069
|
+
$$render(consequent_3);
|
|
3070
|
+
else if ($9.get(authoringMode) === "cron")
|
|
3071
|
+
$$render(consequent_4, 1);
|
|
3072
|
+
else
|
|
3073
|
+
$$render(alternate_1, -1);
|
|
3074
|
+
});
|
|
3075
|
+
}
|
|
3076
|
+
var dl = $9.sibling(node_4, 2);
|
|
3077
|
+
var dd = $9.sibling($9.child(dl), 2);
|
|
3078
|
+
var text_7 = $9.child(dd, true);
|
|
3079
|
+
$9.reset(dd);
|
|
3080
|
+
$9.reset(dl);
|
|
3081
|
+
var node_18 = $9.sibling(dl, 2);
|
|
3082
|
+
{
|
|
3083
|
+
var consequent_8 = ($$anchor2) => {
|
|
3084
|
+
var div_9 = root_122();
|
|
3085
|
+
var span = $9.child(div_9);
|
|
3086
|
+
var node_19 = $9.sibling(span, 2);
|
|
3087
|
+
{
|
|
3088
|
+
var consequent_5 = ($$anchor3) => {
|
|
3089
|
+
var p = root_72();
|
|
3090
|
+
$9.append($$anchor3, p);
|
|
3091
|
+
};
|
|
3092
|
+
var consequent_6 = ($$anchor3) => {
|
|
3093
|
+
var p_1 = root_82();
|
|
3094
|
+
$9.append($$anchor3, p_1);
|
|
3095
|
+
};
|
|
3096
|
+
var consequent_7 = ($$anchor3) => {
|
|
3097
|
+
var ul = root_102();
|
|
3098
|
+
$9.each(ul, 21, () => $9.get(previewResult).fires, (fire) => fire.id, ($$anchor4, fire) => {
|
|
3099
|
+
var li = root_92();
|
|
3100
|
+
var text_8 = $9.child(li, true);
|
|
3101
|
+
$9.reset(li);
|
|
3102
|
+
$9.template_effect(() => $9.set_text(text_8, $9.get(fire).label));
|
|
3103
|
+
$9.append($$anchor4, li);
|
|
3104
|
+
});
|
|
3105
|
+
$9.reset(ul);
|
|
3106
|
+
$9.template_effect(() => $9.set_attribute(ul, "aria-labelledby", `${baseId}-preview-label`));
|
|
3107
|
+
$9.append($$anchor3, ul);
|
|
3108
|
+
};
|
|
3109
|
+
var alternate_2 = ($$anchor3) => {
|
|
3110
|
+
var p_2 = root_11();
|
|
3111
|
+
$9.append($$anchor3, p_2);
|
|
3112
|
+
};
|
|
3113
|
+
$9.if(node_19, ($$render) => {
|
|
3114
|
+
if ($9.get(previewResult).status === "invalid")
|
|
3115
|
+
$$render(consequent_5);
|
|
3116
|
+
else if ($9.get(previewResult).status === "error")
|
|
3117
|
+
$$render(consequent_6, 1);
|
|
3118
|
+
else if ($9.get(previewResult).fires.length > 0)
|
|
3119
|
+
$$render(consequent_7, 2);
|
|
3120
|
+
else
|
|
3121
|
+
$$render(alternate_2, -1);
|
|
3122
|
+
});
|
|
3123
|
+
}
|
|
3124
|
+
$9.reset(div_9);
|
|
3125
|
+
$9.template_effect(() => $9.set_attribute(span, "id", `${baseId}-preview-label`));
|
|
3126
|
+
$9.append($$anchor2, div_9);
|
|
3127
|
+
};
|
|
3128
|
+
$9.if(node_18, ($$render) => {
|
|
3129
|
+
if ($9.get(previewResult).status !== "hidden")
|
|
3130
|
+
$$render(consequent_8);
|
|
3131
|
+
});
|
|
3132
|
+
}
|
|
3133
|
+
var dl_1 = $9.sibling(node_18, 2);
|
|
3134
|
+
var dd_1 = $9.sibling($9.child(dl_1), 2);
|
|
3135
|
+
var node_20 = $9.child(dd_1);
|
|
3136
|
+
{
|
|
3137
|
+
var consequent_9 = ($$anchor2) => {
|
|
3138
|
+
var fragment_6 = $9.comment();
|
|
3139
|
+
var node_21 = $9.first_child(fragment_6);
|
|
3140
|
+
$9.snippet(node_21, () => $$props.timezone);
|
|
3141
|
+
$9.append($$anchor2, fragment_6);
|
|
3142
|
+
};
|
|
3143
|
+
var consequent_10 = ($$anchor2) => {
|
|
3144
|
+
var text_9 = $9.text();
|
|
3145
|
+
$9.template_effect(() => $9.set_text(text_9, $$props.timezoneLabel));
|
|
3146
|
+
$9.append($$anchor2, text_9);
|
|
3147
|
+
};
|
|
3148
|
+
var alternate_3 = ($$anchor2) => {
|
|
3149
|
+
var span_1 = root_132();
|
|
3150
|
+
$9.append($$anchor2, span_1);
|
|
3151
|
+
};
|
|
3152
|
+
$9.if(node_20, ($$render) => {
|
|
3153
|
+
if ($$props.timezone)
|
|
3154
|
+
$$render(consequent_9);
|
|
3155
|
+
else if ($$props.timezoneLabel)
|
|
3156
|
+
$$render(consequent_10, 1);
|
|
3157
|
+
else
|
|
3158
|
+
$$render(alternate_3, -1);
|
|
3159
|
+
});
|
|
3160
|
+
}
|
|
3161
|
+
$9.reset(dd_1);
|
|
3162
|
+
$9.reset(dl_1);
|
|
3163
|
+
$9.reset(div);
|
|
3164
|
+
$9.template_effect(($0) => $9.set_text(text_7, $0), [() => describeValue($9.get(currentValue))]);
|
|
3165
|
+
$9.append($$anchor, div);
|
|
3166
|
+
$9.pop();
|
|
3167
|
+
}
|
|
3168
|
+
|
|
3169
|
+
// src/components/schedule-builder/index.ts
|
|
3170
|
+
var schedule_builder_default = Schedule_builder;
|
|
3171
|
+
export {
|
|
3172
|
+
schedule_builder_default as default,
|
|
3173
|
+
Schedule_builder as ScheduleBuilder
|
|
3174
|
+
};
|
|
3175
|
+
|
|
3176
|
+
//# debugId=E9DA60597E63E03B64756E2164756E21
|