@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,3285 @@
|
|
|
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
|
+
// ../../node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
|
|
55
|
+
function clamp(start, value, end) {
|
|
56
|
+
return max(start, min(value, end));
|
|
57
|
+
}
|
|
58
|
+
function evaluate(value, param) {
|
|
59
|
+
return typeof value === "function" ? value(param) : value;
|
|
60
|
+
}
|
|
61
|
+
function getSide(placement) {
|
|
62
|
+
return placement.split("-")[0];
|
|
63
|
+
}
|
|
64
|
+
function getAlignment(placement) {
|
|
65
|
+
return placement.split("-")[1];
|
|
66
|
+
}
|
|
67
|
+
function getOppositeAxis(axis) {
|
|
68
|
+
return axis === "x" ? "y" : "x";
|
|
69
|
+
}
|
|
70
|
+
function getAxisLength(axis) {
|
|
71
|
+
return axis === "y" ? "height" : "width";
|
|
72
|
+
}
|
|
73
|
+
function getSideAxis(placement) {
|
|
74
|
+
const firstChar = placement[0];
|
|
75
|
+
return firstChar === "t" || firstChar === "b" ? "y" : "x";
|
|
76
|
+
}
|
|
77
|
+
function getAlignmentAxis(placement) {
|
|
78
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
79
|
+
}
|
|
80
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
81
|
+
if (rtl === undefined) {
|
|
82
|
+
rtl = false;
|
|
83
|
+
}
|
|
84
|
+
const alignment = getAlignment(placement);
|
|
85
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
86
|
+
const length = getAxisLength(alignmentAxis);
|
|
87
|
+
let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
|
|
88
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
89
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
90
|
+
}
|
|
91
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
92
|
+
}
|
|
93
|
+
function getExpandedPlacements(placement) {
|
|
94
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
95
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
96
|
+
}
|
|
97
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
98
|
+
return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
|
|
99
|
+
}
|
|
100
|
+
function getSideList(side, isStart, rtl) {
|
|
101
|
+
switch (side) {
|
|
102
|
+
case "top":
|
|
103
|
+
case "bottom":
|
|
104
|
+
if (rtl)
|
|
105
|
+
return isStart ? rlPlacement : lrPlacement;
|
|
106
|
+
return isStart ? lrPlacement : rlPlacement;
|
|
107
|
+
case "left":
|
|
108
|
+
case "right":
|
|
109
|
+
return isStart ? tbPlacement : btPlacement;
|
|
110
|
+
default:
|
|
111
|
+
return [];
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
115
|
+
const alignment = getAlignment(placement);
|
|
116
|
+
let list = getSideList(getSide(placement), direction === "start", rtl);
|
|
117
|
+
if (alignment) {
|
|
118
|
+
list = list.map((side) => side + "-" + alignment);
|
|
119
|
+
if (flipAlignment) {
|
|
120
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return list;
|
|
124
|
+
}
|
|
125
|
+
function getOppositePlacement(placement) {
|
|
126
|
+
const side = getSide(placement);
|
|
127
|
+
return oppositeSideMap[side] + placement.slice(side.length);
|
|
128
|
+
}
|
|
129
|
+
function expandPaddingObject(padding) {
|
|
130
|
+
return {
|
|
131
|
+
top: 0,
|
|
132
|
+
right: 0,
|
|
133
|
+
bottom: 0,
|
|
134
|
+
left: 0,
|
|
135
|
+
...padding
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function getPaddingObject(padding) {
|
|
139
|
+
return typeof padding !== "number" ? expandPaddingObject(padding) : {
|
|
140
|
+
top: padding,
|
|
141
|
+
right: padding,
|
|
142
|
+
bottom: padding,
|
|
143
|
+
left: padding
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function rectToClientRect(rect) {
|
|
147
|
+
const {
|
|
148
|
+
x,
|
|
149
|
+
y,
|
|
150
|
+
width,
|
|
151
|
+
height
|
|
152
|
+
} = rect;
|
|
153
|
+
return {
|
|
154
|
+
width,
|
|
155
|
+
height,
|
|
156
|
+
top: y,
|
|
157
|
+
left: x,
|
|
158
|
+
right: x + width,
|
|
159
|
+
bottom: y + height,
|
|
160
|
+
x,
|
|
161
|
+
y
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
var sides, alignments, placements, min, max, round, floor, createCoords = (v) => ({
|
|
165
|
+
x: v,
|
|
166
|
+
y: v
|
|
167
|
+
}), oppositeSideMap, lrPlacement, rlPlacement, tbPlacement, btPlacement;
|
|
168
|
+
var init_floating_ui_utils = __esm(() => {
|
|
169
|
+
sides = ["top", "right", "bottom", "left"];
|
|
170
|
+
alignments = ["start", "end"];
|
|
171
|
+
placements = /* @__PURE__ */ sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
|
|
172
|
+
min = Math.min;
|
|
173
|
+
max = Math.max;
|
|
174
|
+
round = Math.round;
|
|
175
|
+
floor = Math.floor;
|
|
176
|
+
oppositeSideMap = {
|
|
177
|
+
left: "right",
|
|
178
|
+
right: "left",
|
|
179
|
+
bottom: "top",
|
|
180
|
+
top: "bottom"
|
|
181
|
+
};
|
|
182
|
+
lrPlacement = ["left", "right"];
|
|
183
|
+
rlPlacement = ["right", "left"];
|
|
184
|
+
tbPlacement = ["top", "bottom"];
|
|
185
|
+
btPlacement = ["bottom", "top"];
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
// ../../node_modules/@floating-ui/core/dist/floating-ui.core.mjs
|
|
189
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
190
|
+
let {
|
|
191
|
+
reference,
|
|
192
|
+
floating
|
|
193
|
+
} = _ref;
|
|
194
|
+
const sideAxis = getSideAxis(placement);
|
|
195
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
196
|
+
const alignLength = getAxisLength(alignmentAxis);
|
|
197
|
+
const side = getSide(placement);
|
|
198
|
+
const isVertical = sideAxis === "y";
|
|
199
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
200
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
201
|
+
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
202
|
+
let coords;
|
|
203
|
+
switch (side) {
|
|
204
|
+
case "top":
|
|
205
|
+
coords = {
|
|
206
|
+
x: commonX,
|
|
207
|
+
y: reference.y - floating.height
|
|
208
|
+
};
|
|
209
|
+
break;
|
|
210
|
+
case "bottom":
|
|
211
|
+
coords = {
|
|
212
|
+
x: commonX,
|
|
213
|
+
y: reference.y + reference.height
|
|
214
|
+
};
|
|
215
|
+
break;
|
|
216
|
+
case "right":
|
|
217
|
+
coords = {
|
|
218
|
+
x: reference.x + reference.width,
|
|
219
|
+
y: commonY
|
|
220
|
+
};
|
|
221
|
+
break;
|
|
222
|
+
case "left":
|
|
223
|
+
coords = {
|
|
224
|
+
x: reference.x - floating.width,
|
|
225
|
+
y: commonY
|
|
226
|
+
};
|
|
227
|
+
break;
|
|
228
|
+
default:
|
|
229
|
+
coords = {
|
|
230
|
+
x: reference.x,
|
|
231
|
+
y: reference.y
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
switch (getAlignment(placement)) {
|
|
235
|
+
case "start":
|
|
236
|
+
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
237
|
+
break;
|
|
238
|
+
case "end":
|
|
239
|
+
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
return coords;
|
|
243
|
+
}
|
|
244
|
+
async function detectOverflow(state3, options) {
|
|
245
|
+
var _await$platform$isEle;
|
|
246
|
+
if (options === undefined) {
|
|
247
|
+
options = {};
|
|
248
|
+
}
|
|
249
|
+
const {
|
|
250
|
+
x,
|
|
251
|
+
y,
|
|
252
|
+
platform,
|
|
253
|
+
rects,
|
|
254
|
+
elements,
|
|
255
|
+
strategy
|
|
256
|
+
} = state3;
|
|
257
|
+
const {
|
|
258
|
+
boundary = "clippingAncestors",
|
|
259
|
+
rootBoundary = "viewport",
|
|
260
|
+
elementContext = "floating",
|
|
261
|
+
altBoundary = false,
|
|
262
|
+
padding = 0
|
|
263
|
+
} = evaluate(options, state3);
|
|
264
|
+
const paddingObject = getPaddingObject(padding);
|
|
265
|
+
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
266
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
267
|
+
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
268
|
+
element: ((_await$platform$isEle = await (platform.isElement == null ? undefined : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform.getDocumentElement == null ? undefined : platform.getDocumentElement(elements.floating)),
|
|
269
|
+
boundary,
|
|
270
|
+
rootBoundary,
|
|
271
|
+
strategy
|
|
272
|
+
}));
|
|
273
|
+
const rect = elementContext === "floating" ? {
|
|
274
|
+
x,
|
|
275
|
+
y,
|
|
276
|
+
width: rects.floating.width,
|
|
277
|
+
height: rects.floating.height
|
|
278
|
+
} : rects.reference;
|
|
279
|
+
const offsetParent = await (platform.getOffsetParent == null ? undefined : platform.getOffsetParent(elements.floating));
|
|
280
|
+
const offsetScale = await (platform.isElement == null ? undefined : platform.isElement(offsetParent)) ? await (platform.getScale == null ? undefined : platform.getScale(offsetParent)) || {
|
|
281
|
+
x: 1,
|
|
282
|
+
y: 1
|
|
283
|
+
} : {
|
|
284
|
+
x: 1,
|
|
285
|
+
y: 1
|
|
286
|
+
};
|
|
287
|
+
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
288
|
+
elements,
|
|
289
|
+
rect,
|
|
290
|
+
offsetParent,
|
|
291
|
+
strategy
|
|
292
|
+
}) : rect);
|
|
293
|
+
return {
|
|
294
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
295
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
296
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
297
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
function getPlacementList(alignment, autoAlignment, allowedPlacements) {
|
|
301
|
+
const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter((placement) => getAlignment(placement) === alignment), ...allowedPlacements.filter((placement) => getAlignment(placement) !== alignment)] : allowedPlacements.filter((placement) => getSide(placement) === placement);
|
|
302
|
+
return allowedPlacementsSortedByAlignment.filter((placement) => {
|
|
303
|
+
if (alignment) {
|
|
304
|
+
return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
|
|
305
|
+
}
|
|
306
|
+
return true;
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
function getSideOffsets(overflow, rect) {
|
|
310
|
+
return {
|
|
311
|
+
top: overflow.top - rect.height,
|
|
312
|
+
right: overflow.right - rect.width,
|
|
313
|
+
bottom: overflow.bottom - rect.height,
|
|
314
|
+
left: overflow.left - rect.width
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
function isAnySideFullyClipped(overflow) {
|
|
318
|
+
return sides.some((side) => overflow[side] >= 0);
|
|
319
|
+
}
|
|
320
|
+
function getBoundingRect(rects) {
|
|
321
|
+
const minX = min(...rects.map((rect) => rect.left));
|
|
322
|
+
const minY = min(...rects.map((rect) => rect.top));
|
|
323
|
+
const maxX = max(...rects.map((rect) => rect.right));
|
|
324
|
+
const maxY = max(...rects.map((rect) => rect.bottom));
|
|
325
|
+
return {
|
|
326
|
+
x: minX,
|
|
327
|
+
y: minY,
|
|
328
|
+
width: maxX - minX,
|
|
329
|
+
height: maxY - minY
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
function getRectsByLine(rects) {
|
|
333
|
+
const sortedRects = rects.slice().sort((a, b) => a.y - b.y);
|
|
334
|
+
const groups = [];
|
|
335
|
+
let prevRect = null;
|
|
336
|
+
for (let i = 0;i < sortedRects.length; i++) {
|
|
337
|
+
const rect = sortedRects[i];
|
|
338
|
+
if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {
|
|
339
|
+
groups.push([rect]);
|
|
340
|
+
} else {
|
|
341
|
+
groups[groups.length - 1].push(rect);
|
|
342
|
+
}
|
|
343
|
+
prevRect = rect;
|
|
344
|
+
}
|
|
345
|
+
return groups.map((rect) => rectToClientRect(getBoundingRect(rect)));
|
|
346
|
+
}
|
|
347
|
+
async function convertValueToCoords(state3, options) {
|
|
348
|
+
const {
|
|
349
|
+
placement,
|
|
350
|
+
platform,
|
|
351
|
+
elements
|
|
352
|
+
} = state3;
|
|
353
|
+
const rtl = await (platform.isRTL == null ? undefined : platform.isRTL(elements.floating));
|
|
354
|
+
const side = getSide(placement);
|
|
355
|
+
const alignment = getAlignment(placement);
|
|
356
|
+
const isVertical = getSideAxis(placement) === "y";
|
|
357
|
+
const mainAxisMulti = originSides.has(side) ? -1 : 1;
|
|
358
|
+
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
359
|
+
const rawValue = evaluate(options, state3);
|
|
360
|
+
let {
|
|
361
|
+
mainAxis,
|
|
362
|
+
crossAxis,
|
|
363
|
+
alignmentAxis
|
|
364
|
+
} = typeof rawValue === "number" ? {
|
|
365
|
+
mainAxis: rawValue,
|
|
366
|
+
crossAxis: 0,
|
|
367
|
+
alignmentAxis: null
|
|
368
|
+
} : {
|
|
369
|
+
mainAxis: rawValue.mainAxis || 0,
|
|
370
|
+
crossAxis: rawValue.crossAxis || 0,
|
|
371
|
+
alignmentAxis: rawValue.alignmentAxis
|
|
372
|
+
};
|
|
373
|
+
if (alignment && typeof alignmentAxis === "number") {
|
|
374
|
+
crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
|
|
375
|
+
}
|
|
376
|
+
return isVertical ? {
|
|
377
|
+
x: crossAxis * crossAxisMulti,
|
|
378
|
+
y: mainAxis * mainAxisMulti
|
|
379
|
+
} : {
|
|
380
|
+
x: mainAxis * mainAxisMulti,
|
|
381
|
+
y: crossAxis * crossAxisMulti
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
var MAX_RESET_COUNT = 50, computePosition = async (reference, floating, config) => {
|
|
385
|
+
const {
|
|
386
|
+
placement = "bottom",
|
|
387
|
+
strategy = "absolute",
|
|
388
|
+
middleware = [],
|
|
389
|
+
platform
|
|
390
|
+
} = config;
|
|
391
|
+
const platformWithDetectOverflow = platform.detectOverflow ? platform : {
|
|
392
|
+
...platform,
|
|
393
|
+
detectOverflow
|
|
394
|
+
};
|
|
395
|
+
const rtl = await (platform.isRTL == null ? undefined : platform.isRTL(floating));
|
|
396
|
+
let rects = await platform.getElementRects({
|
|
397
|
+
reference,
|
|
398
|
+
floating,
|
|
399
|
+
strategy
|
|
400
|
+
});
|
|
401
|
+
let {
|
|
402
|
+
x,
|
|
403
|
+
y
|
|
404
|
+
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
405
|
+
let statefulPlacement = placement;
|
|
406
|
+
let resetCount = 0;
|
|
407
|
+
const middlewareData = {};
|
|
408
|
+
for (let i = 0;i < middleware.length; i++) {
|
|
409
|
+
const currentMiddleware = middleware[i];
|
|
410
|
+
if (!currentMiddleware) {
|
|
411
|
+
continue;
|
|
412
|
+
}
|
|
413
|
+
const {
|
|
414
|
+
name,
|
|
415
|
+
fn
|
|
416
|
+
} = currentMiddleware;
|
|
417
|
+
const {
|
|
418
|
+
x: nextX,
|
|
419
|
+
y: nextY,
|
|
420
|
+
data,
|
|
421
|
+
reset: reset3
|
|
422
|
+
} = await fn({
|
|
423
|
+
x,
|
|
424
|
+
y,
|
|
425
|
+
initialPlacement: placement,
|
|
426
|
+
placement: statefulPlacement,
|
|
427
|
+
strategy,
|
|
428
|
+
middlewareData,
|
|
429
|
+
rects,
|
|
430
|
+
platform: platformWithDetectOverflow,
|
|
431
|
+
elements: {
|
|
432
|
+
reference,
|
|
433
|
+
floating
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
x = nextX != null ? nextX : x;
|
|
437
|
+
y = nextY != null ? nextY : y;
|
|
438
|
+
middlewareData[name] = {
|
|
439
|
+
...middlewareData[name],
|
|
440
|
+
...data
|
|
441
|
+
};
|
|
442
|
+
if (reset3 && resetCount < MAX_RESET_COUNT) {
|
|
443
|
+
resetCount++;
|
|
444
|
+
if (typeof reset3 === "object") {
|
|
445
|
+
if (reset3.placement) {
|
|
446
|
+
statefulPlacement = reset3.placement;
|
|
447
|
+
}
|
|
448
|
+
if (reset3.rects) {
|
|
449
|
+
rects = reset3.rects === true ? await platform.getElementRects({
|
|
450
|
+
reference,
|
|
451
|
+
floating,
|
|
452
|
+
strategy
|
|
453
|
+
}) : reset3.rects;
|
|
454
|
+
}
|
|
455
|
+
({
|
|
456
|
+
x,
|
|
457
|
+
y
|
|
458
|
+
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
459
|
+
}
|
|
460
|
+
i = -1;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
return {
|
|
464
|
+
x,
|
|
465
|
+
y,
|
|
466
|
+
placement: statefulPlacement,
|
|
467
|
+
strategy,
|
|
468
|
+
middlewareData
|
|
469
|
+
};
|
|
470
|
+
}, arrow = (options) => ({
|
|
471
|
+
name: "arrow",
|
|
472
|
+
options,
|
|
473
|
+
async fn(state3) {
|
|
474
|
+
const {
|
|
475
|
+
x,
|
|
476
|
+
y,
|
|
477
|
+
placement,
|
|
478
|
+
rects,
|
|
479
|
+
platform,
|
|
480
|
+
elements,
|
|
481
|
+
middlewareData
|
|
482
|
+
} = state3;
|
|
483
|
+
const {
|
|
484
|
+
element,
|
|
485
|
+
padding = 0
|
|
486
|
+
} = evaluate(options, state3) || {};
|
|
487
|
+
if (element == null) {
|
|
488
|
+
return {};
|
|
489
|
+
}
|
|
490
|
+
const paddingObject = getPaddingObject(padding);
|
|
491
|
+
const coords = {
|
|
492
|
+
x,
|
|
493
|
+
y
|
|
494
|
+
};
|
|
495
|
+
const axis = getAlignmentAxis(placement);
|
|
496
|
+
const length = getAxisLength(axis);
|
|
497
|
+
const arrowDimensions = await platform.getDimensions(element);
|
|
498
|
+
const isYAxis = axis === "y";
|
|
499
|
+
const minProp = isYAxis ? "top" : "left";
|
|
500
|
+
const maxProp = isYAxis ? "bottom" : "right";
|
|
501
|
+
const clientProp = isYAxis ? "clientHeight" : "clientWidth";
|
|
502
|
+
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
|
|
503
|
+
const startDiff = coords[axis] - rects.reference[axis];
|
|
504
|
+
const arrowOffsetParent = await (platform.getOffsetParent == null ? undefined : platform.getOffsetParent(element));
|
|
505
|
+
let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
|
|
506
|
+
if (!clientSize || !await (platform.isElement == null ? undefined : platform.isElement(arrowOffsetParent))) {
|
|
507
|
+
clientSize = elements.floating[clientProp] || rects.floating[length];
|
|
508
|
+
}
|
|
509
|
+
const centerToReference = endDiff / 2 - startDiff / 2;
|
|
510
|
+
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
|
|
511
|
+
const minPadding = min(paddingObject[minProp], largestPossiblePadding);
|
|
512
|
+
const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
|
|
513
|
+
const min$1 = minPadding;
|
|
514
|
+
const max2 = clientSize - arrowDimensions[length] - maxPadding;
|
|
515
|
+
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
516
|
+
const offset = clamp(min$1, center, max2);
|
|
517
|
+
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
518
|
+
const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
|
|
519
|
+
return {
|
|
520
|
+
[axis]: coords[axis] + alignmentOffset,
|
|
521
|
+
data: {
|
|
522
|
+
[axis]: offset,
|
|
523
|
+
centerOffset: center - offset - alignmentOffset,
|
|
524
|
+
...shouldAddOffset && {
|
|
525
|
+
alignmentOffset
|
|
526
|
+
}
|
|
527
|
+
},
|
|
528
|
+
reset: shouldAddOffset
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
}), autoPlacement = function(options) {
|
|
532
|
+
if (options === undefined) {
|
|
533
|
+
options = {};
|
|
534
|
+
}
|
|
535
|
+
return {
|
|
536
|
+
name: "autoPlacement",
|
|
537
|
+
options,
|
|
538
|
+
async fn(state3) {
|
|
539
|
+
var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
|
|
540
|
+
const {
|
|
541
|
+
rects,
|
|
542
|
+
middlewareData,
|
|
543
|
+
placement,
|
|
544
|
+
platform,
|
|
545
|
+
elements
|
|
546
|
+
} = state3;
|
|
547
|
+
const {
|
|
548
|
+
crossAxis = false,
|
|
549
|
+
alignment,
|
|
550
|
+
allowedPlacements = placements,
|
|
551
|
+
autoAlignment = true,
|
|
552
|
+
...detectOverflowOptions
|
|
553
|
+
} = evaluate(options, state3);
|
|
554
|
+
const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
|
|
555
|
+
const overflow = await platform.detectOverflow(state3, detectOverflowOptions);
|
|
556
|
+
const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? undefined : _middlewareData$autoP.index) || 0;
|
|
557
|
+
const currentPlacement = placements$1[currentIndex];
|
|
558
|
+
if (currentPlacement == null) {
|
|
559
|
+
return {};
|
|
560
|
+
}
|
|
561
|
+
const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? undefined : platform.isRTL(elements.floating)));
|
|
562
|
+
if (placement !== currentPlacement) {
|
|
563
|
+
return {
|
|
564
|
+
reset: {
|
|
565
|
+
placement: placements$1[0]
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
|
|
570
|
+
const allOverflows = [...((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? undefined : _middlewareData$autoP2.overflows) || [], {
|
|
571
|
+
placement: currentPlacement,
|
|
572
|
+
overflows: currentOverflows
|
|
573
|
+
}];
|
|
574
|
+
const nextPlacement = placements$1[currentIndex + 1];
|
|
575
|
+
if (nextPlacement) {
|
|
576
|
+
return {
|
|
577
|
+
data: {
|
|
578
|
+
index: currentIndex + 1,
|
|
579
|
+
overflows: allOverflows
|
|
580
|
+
},
|
|
581
|
+
reset: {
|
|
582
|
+
placement: nextPlacement
|
|
583
|
+
}
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
const placementsSortedByMostSpace = allOverflows.map((d) => {
|
|
587
|
+
const alignment2 = getAlignment(d.placement);
|
|
588
|
+
return [d.placement, alignment2 && crossAxis ? d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) : d.overflows[0], d.overflows];
|
|
589
|
+
}).sort((a, b) => a[1] - b[1]);
|
|
590
|
+
const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter((d) => d[2].slice(0, getAlignment(d[0]) ? 2 : 3).every((v) => v <= 0));
|
|
591
|
+
const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? undefined : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
|
|
592
|
+
if (resetPlacement !== placement) {
|
|
593
|
+
return {
|
|
594
|
+
data: {
|
|
595
|
+
index: currentIndex + 1,
|
|
596
|
+
overflows: allOverflows
|
|
597
|
+
},
|
|
598
|
+
reset: {
|
|
599
|
+
placement: resetPlacement
|
|
600
|
+
}
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
return {};
|
|
604
|
+
}
|
|
605
|
+
};
|
|
606
|
+
}, flip = function(options) {
|
|
607
|
+
if (options === undefined) {
|
|
608
|
+
options = {};
|
|
609
|
+
}
|
|
610
|
+
return {
|
|
611
|
+
name: "flip",
|
|
612
|
+
options,
|
|
613
|
+
async fn(state3) {
|
|
614
|
+
var _middlewareData$arrow, _middlewareData$flip;
|
|
615
|
+
const {
|
|
616
|
+
placement,
|
|
617
|
+
middlewareData,
|
|
618
|
+
rects,
|
|
619
|
+
initialPlacement,
|
|
620
|
+
platform,
|
|
621
|
+
elements
|
|
622
|
+
} = state3;
|
|
623
|
+
const {
|
|
624
|
+
mainAxis: checkMainAxis = true,
|
|
625
|
+
crossAxis: checkCrossAxis = true,
|
|
626
|
+
fallbackPlacements: specifiedFallbackPlacements,
|
|
627
|
+
fallbackStrategy = "bestFit",
|
|
628
|
+
fallbackAxisSideDirection = "none",
|
|
629
|
+
flipAlignment = true,
|
|
630
|
+
...detectOverflowOptions
|
|
631
|
+
} = evaluate(options, state3);
|
|
632
|
+
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
633
|
+
return {};
|
|
634
|
+
}
|
|
635
|
+
const side = getSide(placement);
|
|
636
|
+
const initialSideAxis = getSideAxis(initialPlacement);
|
|
637
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
638
|
+
const rtl = await (platform.isRTL == null ? undefined : platform.isRTL(elements.floating));
|
|
639
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
640
|
+
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
|
|
641
|
+
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
642
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
643
|
+
}
|
|
644
|
+
const placements2 = [initialPlacement, ...fallbackPlacements];
|
|
645
|
+
const overflow = await platform.detectOverflow(state3, detectOverflowOptions);
|
|
646
|
+
const overflows = [];
|
|
647
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? undefined : _middlewareData$flip.overflows) || [];
|
|
648
|
+
if (checkMainAxis) {
|
|
649
|
+
overflows.push(overflow[side]);
|
|
650
|
+
}
|
|
651
|
+
if (checkCrossAxis) {
|
|
652
|
+
const sides2 = getAlignmentSides(placement, rects, rtl);
|
|
653
|
+
overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
|
|
654
|
+
}
|
|
655
|
+
overflowsData = [...overflowsData, {
|
|
656
|
+
placement,
|
|
657
|
+
overflows
|
|
658
|
+
}];
|
|
659
|
+
if (!overflows.every((side2) => side2 <= 0)) {
|
|
660
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
|
661
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? undefined : _middlewareData$flip2.index) || 0) + 1;
|
|
662
|
+
const nextPlacement = placements2[nextIndex];
|
|
663
|
+
if (nextPlacement) {
|
|
664
|
+
const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
|
|
665
|
+
if (!ignoreCrossAxisOverflow || overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
|
|
666
|
+
return {
|
|
667
|
+
data: {
|
|
668
|
+
index: nextIndex,
|
|
669
|
+
overflows: overflowsData
|
|
670
|
+
},
|
|
671
|
+
reset: {
|
|
672
|
+
placement: nextPlacement
|
|
673
|
+
}
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? undefined : _overflowsData$filter.placement;
|
|
678
|
+
if (!resetPlacement) {
|
|
679
|
+
switch (fallbackStrategy) {
|
|
680
|
+
case "bestFit": {
|
|
681
|
+
var _overflowsData$filter2;
|
|
682
|
+
const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
|
|
683
|
+
if (hasFallbackAxisSideDirection) {
|
|
684
|
+
const currentSideAxis = getSideAxis(d.placement);
|
|
685
|
+
return currentSideAxis === initialSideAxis || currentSideAxis === "y";
|
|
686
|
+
}
|
|
687
|
+
return true;
|
|
688
|
+
}).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? undefined : _overflowsData$filter2[0];
|
|
689
|
+
if (placement2) {
|
|
690
|
+
resetPlacement = placement2;
|
|
691
|
+
}
|
|
692
|
+
break;
|
|
693
|
+
}
|
|
694
|
+
case "initialPlacement":
|
|
695
|
+
resetPlacement = initialPlacement;
|
|
696
|
+
break;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
if (placement !== resetPlacement) {
|
|
700
|
+
return {
|
|
701
|
+
reset: {
|
|
702
|
+
placement: resetPlacement
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
return {};
|
|
708
|
+
}
|
|
709
|
+
};
|
|
710
|
+
}, hide = function(options) {
|
|
711
|
+
if (options === undefined) {
|
|
712
|
+
options = {};
|
|
713
|
+
}
|
|
714
|
+
return {
|
|
715
|
+
name: "hide",
|
|
716
|
+
options,
|
|
717
|
+
async fn(state3) {
|
|
718
|
+
const {
|
|
719
|
+
rects,
|
|
720
|
+
platform
|
|
721
|
+
} = state3;
|
|
722
|
+
const {
|
|
723
|
+
strategy = "referenceHidden",
|
|
724
|
+
...detectOverflowOptions
|
|
725
|
+
} = evaluate(options, state3);
|
|
726
|
+
switch (strategy) {
|
|
727
|
+
case "referenceHidden": {
|
|
728
|
+
const overflow = await platform.detectOverflow(state3, {
|
|
729
|
+
...detectOverflowOptions,
|
|
730
|
+
elementContext: "reference"
|
|
731
|
+
});
|
|
732
|
+
const offsets = getSideOffsets(overflow, rects.reference);
|
|
733
|
+
return {
|
|
734
|
+
data: {
|
|
735
|
+
referenceHiddenOffsets: offsets,
|
|
736
|
+
referenceHidden: isAnySideFullyClipped(offsets)
|
|
737
|
+
}
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
case "escaped": {
|
|
741
|
+
const overflow = await platform.detectOverflow(state3, {
|
|
742
|
+
...detectOverflowOptions,
|
|
743
|
+
altBoundary: true
|
|
744
|
+
});
|
|
745
|
+
const offsets = getSideOffsets(overflow, rects.floating);
|
|
746
|
+
return {
|
|
747
|
+
data: {
|
|
748
|
+
escapedOffsets: offsets,
|
|
749
|
+
escaped: isAnySideFullyClipped(offsets)
|
|
750
|
+
}
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
default: {
|
|
754
|
+
return {};
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
};
|
|
759
|
+
}, inline = function(options) {
|
|
760
|
+
if (options === undefined) {
|
|
761
|
+
options = {};
|
|
762
|
+
}
|
|
763
|
+
return {
|
|
764
|
+
name: "inline",
|
|
765
|
+
options,
|
|
766
|
+
async fn(state3) {
|
|
767
|
+
const {
|
|
768
|
+
placement,
|
|
769
|
+
elements,
|
|
770
|
+
rects,
|
|
771
|
+
platform,
|
|
772
|
+
strategy
|
|
773
|
+
} = state3;
|
|
774
|
+
const {
|
|
775
|
+
padding = 2,
|
|
776
|
+
x,
|
|
777
|
+
y
|
|
778
|
+
} = evaluate(options, state3);
|
|
779
|
+
const nativeClientRects = Array.from(await (platform.getClientRects == null ? undefined : platform.getClientRects(elements.reference)) || []);
|
|
780
|
+
const clientRects = getRectsByLine(nativeClientRects);
|
|
781
|
+
const fallback = rectToClientRect(getBoundingRect(nativeClientRects));
|
|
782
|
+
const paddingObject = getPaddingObject(padding);
|
|
783
|
+
function getBoundingClientRect() {
|
|
784
|
+
if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
|
|
785
|
+
return clientRects.find((rect) => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;
|
|
786
|
+
}
|
|
787
|
+
if (clientRects.length >= 2) {
|
|
788
|
+
if (getSideAxis(placement) === "y") {
|
|
789
|
+
const firstRect = clientRects[0];
|
|
790
|
+
const lastRect = clientRects[clientRects.length - 1];
|
|
791
|
+
const isTop = getSide(placement) === "top";
|
|
792
|
+
const top2 = firstRect.top;
|
|
793
|
+
const bottom2 = lastRect.bottom;
|
|
794
|
+
const left2 = isTop ? firstRect.left : lastRect.left;
|
|
795
|
+
const right2 = isTop ? firstRect.right : lastRect.right;
|
|
796
|
+
const width2 = right2 - left2;
|
|
797
|
+
const height2 = bottom2 - top2;
|
|
798
|
+
return {
|
|
799
|
+
top: top2,
|
|
800
|
+
bottom: bottom2,
|
|
801
|
+
left: left2,
|
|
802
|
+
right: right2,
|
|
803
|
+
width: width2,
|
|
804
|
+
height: height2,
|
|
805
|
+
x: left2,
|
|
806
|
+
y: top2
|
|
807
|
+
};
|
|
808
|
+
}
|
|
809
|
+
const isLeftSide = getSide(placement) === "left";
|
|
810
|
+
const maxRight = max(...clientRects.map((rect) => rect.right));
|
|
811
|
+
const minLeft = min(...clientRects.map((rect) => rect.left));
|
|
812
|
+
const measureRects = clientRects.filter((rect) => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
|
|
813
|
+
const top = measureRects[0].top;
|
|
814
|
+
const bottom = measureRects[measureRects.length - 1].bottom;
|
|
815
|
+
const left = minLeft;
|
|
816
|
+
const right = maxRight;
|
|
817
|
+
const width = right - left;
|
|
818
|
+
const height = bottom - top;
|
|
819
|
+
return {
|
|
820
|
+
top,
|
|
821
|
+
bottom,
|
|
822
|
+
left,
|
|
823
|
+
right,
|
|
824
|
+
width,
|
|
825
|
+
height,
|
|
826
|
+
x: left,
|
|
827
|
+
y: top
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
return fallback;
|
|
831
|
+
}
|
|
832
|
+
const resetRects = await platform.getElementRects({
|
|
833
|
+
reference: {
|
|
834
|
+
getBoundingClientRect
|
|
835
|
+
},
|
|
836
|
+
floating: elements.floating,
|
|
837
|
+
strategy
|
|
838
|
+
});
|
|
839
|
+
if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {
|
|
840
|
+
return {
|
|
841
|
+
reset: {
|
|
842
|
+
rects: resetRects
|
|
843
|
+
}
|
|
844
|
+
};
|
|
845
|
+
}
|
|
846
|
+
return {};
|
|
847
|
+
}
|
|
848
|
+
};
|
|
849
|
+
}, originSides, offset = function(options) {
|
|
850
|
+
if (options === undefined) {
|
|
851
|
+
options = 0;
|
|
852
|
+
}
|
|
853
|
+
return {
|
|
854
|
+
name: "offset",
|
|
855
|
+
options,
|
|
856
|
+
async fn(state3) {
|
|
857
|
+
var _middlewareData$offse, _middlewareData$arrow;
|
|
858
|
+
const {
|
|
859
|
+
x,
|
|
860
|
+
y,
|
|
861
|
+
placement,
|
|
862
|
+
middlewareData
|
|
863
|
+
} = state3;
|
|
864
|
+
const diffCoords = await convertValueToCoords(state3, options);
|
|
865
|
+
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? undefined : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
866
|
+
return {};
|
|
867
|
+
}
|
|
868
|
+
return {
|
|
869
|
+
x: x + diffCoords.x,
|
|
870
|
+
y: y + diffCoords.y,
|
|
871
|
+
data: {
|
|
872
|
+
...diffCoords,
|
|
873
|
+
placement
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
}
|
|
877
|
+
};
|
|
878
|
+
}, shift = function(options) {
|
|
879
|
+
if (options === undefined) {
|
|
880
|
+
options = {};
|
|
881
|
+
}
|
|
882
|
+
return {
|
|
883
|
+
name: "shift",
|
|
884
|
+
options,
|
|
885
|
+
async fn(state3) {
|
|
886
|
+
const {
|
|
887
|
+
x,
|
|
888
|
+
y,
|
|
889
|
+
placement,
|
|
890
|
+
platform
|
|
891
|
+
} = state3;
|
|
892
|
+
const {
|
|
893
|
+
mainAxis: checkMainAxis = true,
|
|
894
|
+
crossAxis: checkCrossAxis = false,
|
|
895
|
+
limiter = {
|
|
896
|
+
fn: (_ref) => {
|
|
897
|
+
let {
|
|
898
|
+
x: x2,
|
|
899
|
+
y: y2
|
|
900
|
+
} = _ref;
|
|
901
|
+
return {
|
|
902
|
+
x: x2,
|
|
903
|
+
y: y2
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
},
|
|
907
|
+
...detectOverflowOptions
|
|
908
|
+
} = evaluate(options, state3);
|
|
909
|
+
const coords = {
|
|
910
|
+
x,
|
|
911
|
+
y
|
|
912
|
+
};
|
|
913
|
+
const overflow = await platform.detectOverflow(state3, detectOverflowOptions);
|
|
914
|
+
const crossAxis = getSideAxis(getSide(placement));
|
|
915
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
916
|
+
let mainAxisCoord = coords[mainAxis];
|
|
917
|
+
let crossAxisCoord = coords[crossAxis];
|
|
918
|
+
if (checkMainAxis) {
|
|
919
|
+
const minSide = mainAxis === "y" ? "top" : "left";
|
|
920
|
+
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
921
|
+
const min2 = mainAxisCoord + overflow[minSide];
|
|
922
|
+
const max2 = mainAxisCoord - overflow[maxSide];
|
|
923
|
+
mainAxisCoord = clamp(min2, mainAxisCoord, max2);
|
|
924
|
+
}
|
|
925
|
+
if (checkCrossAxis) {
|
|
926
|
+
const minSide = crossAxis === "y" ? "top" : "left";
|
|
927
|
+
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
928
|
+
const min2 = crossAxisCoord + overflow[minSide];
|
|
929
|
+
const max2 = crossAxisCoord - overflow[maxSide];
|
|
930
|
+
crossAxisCoord = clamp(min2, crossAxisCoord, max2);
|
|
931
|
+
}
|
|
932
|
+
const limitedCoords = limiter.fn({
|
|
933
|
+
...state3,
|
|
934
|
+
[mainAxis]: mainAxisCoord,
|
|
935
|
+
[crossAxis]: crossAxisCoord
|
|
936
|
+
});
|
|
937
|
+
return {
|
|
938
|
+
...limitedCoords,
|
|
939
|
+
data: {
|
|
940
|
+
x: limitedCoords.x - x,
|
|
941
|
+
y: limitedCoords.y - y,
|
|
942
|
+
enabled: {
|
|
943
|
+
[mainAxis]: checkMainAxis,
|
|
944
|
+
[crossAxis]: checkCrossAxis
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
};
|
|
950
|
+
}, limitShift = function(options) {
|
|
951
|
+
if (options === undefined) {
|
|
952
|
+
options = {};
|
|
953
|
+
}
|
|
954
|
+
return {
|
|
955
|
+
options,
|
|
956
|
+
fn(state3) {
|
|
957
|
+
const {
|
|
958
|
+
x,
|
|
959
|
+
y,
|
|
960
|
+
placement,
|
|
961
|
+
rects,
|
|
962
|
+
middlewareData
|
|
963
|
+
} = state3;
|
|
964
|
+
const {
|
|
965
|
+
offset: offset2 = 0,
|
|
966
|
+
mainAxis: checkMainAxis = true,
|
|
967
|
+
crossAxis: checkCrossAxis = true
|
|
968
|
+
} = evaluate(options, state3);
|
|
969
|
+
const coords = {
|
|
970
|
+
x,
|
|
971
|
+
y
|
|
972
|
+
};
|
|
973
|
+
const crossAxis = getSideAxis(placement);
|
|
974
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
975
|
+
let mainAxisCoord = coords[mainAxis];
|
|
976
|
+
let crossAxisCoord = coords[crossAxis];
|
|
977
|
+
const rawOffset = evaluate(offset2, state3);
|
|
978
|
+
const computedOffset = typeof rawOffset === "number" ? {
|
|
979
|
+
mainAxis: rawOffset,
|
|
980
|
+
crossAxis: 0
|
|
981
|
+
} : {
|
|
982
|
+
mainAxis: 0,
|
|
983
|
+
crossAxis: 0,
|
|
984
|
+
...rawOffset
|
|
985
|
+
};
|
|
986
|
+
if (checkMainAxis) {
|
|
987
|
+
const len = mainAxis === "y" ? "height" : "width";
|
|
988
|
+
const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
|
|
989
|
+
const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
|
|
990
|
+
if (mainAxisCoord < limitMin) {
|
|
991
|
+
mainAxisCoord = limitMin;
|
|
992
|
+
} else if (mainAxisCoord > limitMax) {
|
|
993
|
+
mainAxisCoord = limitMax;
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
if (checkCrossAxis) {
|
|
997
|
+
var _middlewareData$offse, _middlewareData$offse2;
|
|
998
|
+
const len = mainAxis === "y" ? "width" : "height";
|
|
999
|
+
const isOriginSide = originSides.has(getSide(placement));
|
|
1000
|
+
const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? undefined : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
|
|
1001
|
+
const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? undefined : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
|
|
1002
|
+
if (crossAxisCoord < limitMin) {
|
|
1003
|
+
crossAxisCoord = limitMin;
|
|
1004
|
+
} else if (crossAxisCoord > limitMax) {
|
|
1005
|
+
crossAxisCoord = limitMax;
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
return {
|
|
1009
|
+
[mainAxis]: mainAxisCoord,
|
|
1010
|
+
[crossAxis]: crossAxisCoord
|
|
1011
|
+
};
|
|
1012
|
+
}
|
|
1013
|
+
};
|
|
1014
|
+
}, size = function(options) {
|
|
1015
|
+
if (options === undefined) {
|
|
1016
|
+
options = {};
|
|
1017
|
+
}
|
|
1018
|
+
return {
|
|
1019
|
+
name: "size",
|
|
1020
|
+
options,
|
|
1021
|
+
async fn(state3) {
|
|
1022
|
+
var _state$middlewareData, _state$middlewareData2;
|
|
1023
|
+
const {
|
|
1024
|
+
placement,
|
|
1025
|
+
rects,
|
|
1026
|
+
platform,
|
|
1027
|
+
elements
|
|
1028
|
+
} = state3;
|
|
1029
|
+
const {
|
|
1030
|
+
apply = () => {},
|
|
1031
|
+
...detectOverflowOptions
|
|
1032
|
+
} = evaluate(options, state3);
|
|
1033
|
+
const overflow = await platform.detectOverflow(state3, detectOverflowOptions);
|
|
1034
|
+
const side = getSide(placement);
|
|
1035
|
+
const alignment = getAlignment(placement);
|
|
1036
|
+
const isYAxis = getSideAxis(placement) === "y";
|
|
1037
|
+
const {
|
|
1038
|
+
width,
|
|
1039
|
+
height
|
|
1040
|
+
} = rects.floating;
|
|
1041
|
+
let heightSide;
|
|
1042
|
+
let widthSide;
|
|
1043
|
+
if (side === "top" || side === "bottom") {
|
|
1044
|
+
heightSide = side;
|
|
1045
|
+
widthSide = alignment === (await (platform.isRTL == null ? undefined : platform.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
|
|
1046
|
+
} else {
|
|
1047
|
+
widthSide = side;
|
|
1048
|
+
heightSide = alignment === "end" ? "top" : "bottom";
|
|
1049
|
+
}
|
|
1050
|
+
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
1051
|
+
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
1052
|
+
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
|
|
1053
|
+
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
|
|
1054
|
+
const noShift = !state3.middlewareData.shift;
|
|
1055
|
+
let availableHeight = overflowAvailableHeight;
|
|
1056
|
+
let availableWidth = overflowAvailableWidth;
|
|
1057
|
+
if ((_state$middlewareData = state3.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
|
|
1058
|
+
availableWidth = maximumClippingWidth;
|
|
1059
|
+
}
|
|
1060
|
+
if ((_state$middlewareData2 = state3.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
|
|
1061
|
+
availableHeight = maximumClippingHeight;
|
|
1062
|
+
}
|
|
1063
|
+
if (noShift && !alignment) {
|
|
1064
|
+
const xMin = max(overflow.left, 0);
|
|
1065
|
+
const xMax = max(overflow.right, 0);
|
|
1066
|
+
const yMin = max(overflow.top, 0);
|
|
1067
|
+
const yMax = max(overflow.bottom, 0);
|
|
1068
|
+
if (isYAxis) {
|
|
1069
|
+
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
|
1070
|
+
} else {
|
|
1071
|
+
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
await apply({
|
|
1075
|
+
...state3,
|
|
1076
|
+
availableWidth,
|
|
1077
|
+
availableHeight
|
|
1078
|
+
});
|
|
1079
|
+
const nextDimensions = await platform.getDimensions(elements.floating);
|
|
1080
|
+
if (width !== nextDimensions.width || height !== nextDimensions.height) {
|
|
1081
|
+
return {
|
|
1082
|
+
reset: {
|
|
1083
|
+
rects: true
|
|
1084
|
+
}
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
return {};
|
|
1088
|
+
}
|
|
1089
|
+
};
|
|
1090
|
+
};
|
|
1091
|
+
var init_floating_ui_core = __esm(() => {
|
|
1092
|
+
init_floating_ui_utils();
|
|
1093
|
+
init_floating_ui_utils();
|
|
1094
|
+
originSides = /* @__PURE__ */ new Set(["left", "top"]);
|
|
1095
|
+
});
|
|
1096
|
+
|
|
1097
|
+
// ../../node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
|
|
1098
|
+
function hasWindow() {
|
|
1099
|
+
return typeof window !== "undefined";
|
|
1100
|
+
}
|
|
1101
|
+
function getNodeName(node) {
|
|
1102
|
+
if (isNode(node)) {
|
|
1103
|
+
return (node.nodeName || "").toLowerCase();
|
|
1104
|
+
}
|
|
1105
|
+
return "#document";
|
|
1106
|
+
}
|
|
1107
|
+
function getWindow(node) {
|
|
1108
|
+
var _node$ownerDocument;
|
|
1109
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? undefined : _node$ownerDocument.defaultView) || window;
|
|
1110
|
+
}
|
|
1111
|
+
function getDocumentElement(node) {
|
|
1112
|
+
var _ref;
|
|
1113
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? undefined : _ref.documentElement;
|
|
1114
|
+
}
|
|
1115
|
+
function isNode(value) {
|
|
1116
|
+
if (!hasWindow()) {
|
|
1117
|
+
return false;
|
|
1118
|
+
}
|
|
1119
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
1120
|
+
}
|
|
1121
|
+
function isElement(value) {
|
|
1122
|
+
if (!hasWindow()) {
|
|
1123
|
+
return false;
|
|
1124
|
+
}
|
|
1125
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
1126
|
+
}
|
|
1127
|
+
function isHTMLElement(value) {
|
|
1128
|
+
if (!hasWindow()) {
|
|
1129
|
+
return false;
|
|
1130
|
+
}
|
|
1131
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
1132
|
+
}
|
|
1133
|
+
function isShadowRoot(value) {
|
|
1134
|
+
if (!hasWindow() || typeof ShadowRoot === "undefined") {
|
|
1135
|
+
return false;
|
|
1136
|
+
}
|
|
1137
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
1138
|
+
}
|
|
1139
|
+
function isOverflowElement(element) {
|
|
1140
|
+
const {
|
|
1141
|
+
overflow,
|
|
1142
|
+
overflowX,
|
|
1143
|
+
overflowY,
|
|
1144
|
+
display
|
|
1145
|
+
} = getComputedStyle2(element);
|
|
1146
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
|
|
1147
|
+
}
|
|
1148
|
+
function isTableElement(element) {
|
|
1149
|
+
return /^(table|td|th)$/.test(getNodeName(element));
|
|
1150
|
+
}
|
|
1151
|
+
function isTopLayer(element) {
|
|
1152
|
+
try {
|
|
1153
|
+
if (element.matches(":popover-open")) {
|
|
1154
|
+
return true;
|
|
1155
|
+
}
|
|
1156
|
+
} catch (_e) {}
|
|
1157
|
+
try {
|
|
1158
|
+
return element.matches(":modal");
|
|
1159
|
+
} catch (_e) {
|
|
1160
|
+
return false;
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
function isContainingBlock(elementOrCss) {
|
|
1164
|
+
const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss;
|
|
1165
|
+
return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || "");
|
|
1166
|
+
}
|
|
1167
|
+
function getContainingBlock(element) {
|
|
1168
|
+
let currentNode = getParentNode(element);
|
|
1169
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1170
|
+
if (isContainingBlock(currentNode)) {
|
|
1171
|
+
return currentNode;
|
|
1172
|
+
} else if (isTopLayer(currentNode)) {
|
|
1173
|
+
return null;
|
|
1174
|
+
}
|
|
1175
|
+
currentNode = getParentNode(currentNode);
|
|
1176
|
+
}
|
|
1177
|
+
return null;
|
|
1178
|
+
}
|
|
1179
|
+
function isWebKit() {
|
|
1180
|
+
if (isWebKitValue == null) {
|
|
1181
|
+
isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
|
|
1182
|
+
}
|
|
1183
|
+
return isWebKitValue;
|
|
1184
|
+
}
|
|
1185
|
+
function isLastTraversableNode(node) {
|
|
1186
|
+
return /^(html|body|#document)$/.test(getNodeName(node));
|
|
1187
|
+
}
|
|
1188
|
+
function getComputedStyle2(element) {
|
|
1189
|
+
return getWindow(element).getComputedStyle(element);
|
|
1190
|
+
}
|
|
1191
|
+
function getNodeScroll(element) {
|
|
1192
|
+
if (isElement(element)) {
|
|
1193
|
+
return {
|
|
1194
|
+
scrollLeft: element.scrollLeft,
|
|
1195
|
+
scrollTop: element.scrollTop
|
|
1196
|
+
};
|
|
1197
|
+
}
|
|
1198
|
+
return {
|
|
1199
|
+
scrollLeft: element.scrollX,
|
|
1200
|
+
scrollTop: element.scrollY
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1203
|
+
function getParentNode(node) {
|
|
1204
|
+
if (getNodeName(node) === "html") {
|
|
1205
|
+
return node;
|
|
1206
|
+
}
|
|
1207
|
+
const result = node.assignedSlot || node.parentNode || isShadowRoot(node) && node.host || getDocumentElement(node);
|
|
1208
|
+
return isShadowRoot(result) ? result.host : result;
|
|
1209
|
+
}
|
|
1210
|
+
function getNearestOverflowAncestor(node) {
|
|
1211
|
+
const parentNode = getParentNode(node);
|
|
1212
|
+
if (isLastTraversableNode(parentNode)) {
|
|
1213
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
1214
|
+
}
|
|
1215
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
1216
|
+
return parentNode;
|
|
1217
|
+
}
|
|
1218
|
+
return getNearestOverflowAncestor(parentNode);
|
|
1219
|
+
}
|
|
1220
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
1221
|
+
var _node$ownerDocument2;
|
|
1222
|
+
if (list === undefined) {
|
|
1223
|
+
list = [];
|
|
1224
|
+
}
|
|
1225
|
+
if (traverseIframes === undefined) {
|
|
1226
|
+
traverseIframes = true;
|
|
1227
|
+
}
|
|
1228
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
1229
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? undefined : _node$ownerDocument2.body);
|
|
1230
|
+
const win = getWindow(scrollableAncestor);
|
|
1231
|
+
if (isBody) {
|
|
1232
|
+
const frameElement = getFrameElement(win);
|
|
1233
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
1234
|
+
} else {
|
|
1235
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
function getFrameElement(win) {
|
|
1239
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
1240
|
+
}
|
|
1241
|
+
var willChangeRe, containRe, isNotNone = (value) => !!value && value !== "none", isWebKitValue;
|
|
1242
|
+
var init_floating_ui_utils_dom = __esm(() => {
|
|
1243
|
+
willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
|
|
1244
|
+
containRe = /paint|layout|strict|content/;
|
|
1245
|
+
});
|
|
1246
|
+
|
|
1247
|
+
// ../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
|
|
1248
|
+
var exports_floating_ui_dom = {};
|
|
1249
|
+
__export(exports_floating_ui_dom, {
|
|
1250
|
+
size: () => size2,
|
|
1251
|
+
shift: () => shift2,
|
|
1252
|
+
platform: () => platform,
|
|
1253
|
+
offset: () => offset2,
|
|
1254
|
+
limitShift: () => limitShift2,
|
|
1255
|
+
inline: () => inline2,
|
|
1256
|
+
hide: () => hide2,
|
|
1257
|
+
getOverflowAncestors: () => getOverflowAncestors,
|
|
1258
|
+
flip: () => flip2,
|
|
1259
|
+
detectOverflow: () => detectOverflow2,
|
|
1260
|
+
computePosition: () => computePosition2,
|
|
1261
|
+
autoUpdate: () => autoUpdate,
|
|
1262
|
+
autoPlacement: () => autoPlacement2,
|
|
1263
|
+
arrow: () => arrow2
|
|
1264
|
+
});
|
|
1265
|
+
function getCssDimensions(element) {
|
|
1266
|
+
const css = getComputedStyle2(element);
|
|
1267
|
+
let width = parseFloat(css.width) || 0;
|
|
1268
|
+
let height = parseFloat(css.height) || 0;
|
|
1269
|
+
const hasOffset = isHTMLElement(element);
|
|
1270
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
1271
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
1272
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
1273
|
+
if (shouldFallback) {
|
|
1274
|
+
width = offsetWidth;
|
|
1275
|
+
height = offsetHeight;
|
|
1276
|
+
}
|
|
1277
|
+
return {
|
|
1278
|
+
width,
|
|
1279
|
+
height,
|
|
1280
|
+
$: shouldFallback
|
|
1281
|
+
};
|
|
1282
|
+
}
|
|
1283
|
+
function unwrapElement(element) {
|
|
1284
|
+
return !isElement(element) ? element.contextElement : element;
|
|
1285
|
+
}
|
|
1286
|
+
function getScale(element) {
|
|
1287
|
+
const domElement = unwrapElement(element);
|
|
1288
|
+
if (!isHTMLElement(domElement)) {
|
|
1289
|
+
return createCoords(1);
|
|
1290
|
+
}
|
|
1291
|
+
const rect = domElement.getBoundingClientRect();
|
|
1292
|
+
const {
|
|
1293
|
+
width,
|
|
1294
|
+
height,
|
|
1295
|
+
$: $5
|
|
1296
|
+
} = getCssDimensions(domElement);
|
|
1297
|
+
let x = ($5 ? round(rect.width) : rect.width) / width;
|
|
1298
|
+
let y = ($5 ? round(rect.height) : rect.height) / height;
|
|
1299
|
+
if (!x || !Number.isFinite(x)) {
|
|
1300
|
+
x = 1;
|
|
1301
|
+
}
|
|
1302
|
+
if (!y || !Number.isFinite(y)) {
|
|
1303
|
+
y = 1;
|
|
1304
|
+
}
|
|
1305
|
+
return {
|
|
1306
|
+
x,
|
|
1307
|
+
y
|
|
1308
|
+
};
|
|
1309
|
+
}
|
|
1310
|
+
function getVisualOffsets(element) {
|
|
1311
|
+
const win = getWindow(element);
|
|
1312
|
+
if (!isWebKit() || !win.visualViewport) {
|
|
1313
|
+
return noOffsets;
|
|
1314
|
+
}
|
|
1315
|
+
return {
|
|
1316
|
+
x: win.visualViewport.offsetLeft,
|
|
1317
|
+
y: win.visualViewport.offsetTop
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
1321
|
+
if (isFixed === undefined) {
|
|
1322
|
+
isFixed = false;
|
|
1323
|
+
}
|
|
1324
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
1325
|
+
return false;
|
|
1326
|
+
}
|
|
1327
|
+
return isFixed;
|
|
1328
|
+
}
|
|
1329
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
1330
|
+
if (includeScale === undefined) {
|
|
1331
|
+
includeScale = false;
|
|
1332
|
+
}
|
|
1333
|
+
if (isFixedStrategy === undefined) {
|
|
1334
|
+
isFixedStrategy = false;
|
|
1335
|
+
}
|
|
1336
|
+
const clientRect = element.getBoundingClientRect();
|
|
1337
|
+
const domElement = unwrapElement(element);
|
|
1338
|
+
let scale = createCoords(1);
|
|
1339
|
+
if (includeScale) {
|
|
1340
|
+
if (offsetParent) {
|
|
1341
|
+
if (isElement(offsetParent)) {
|
|
1342
|
+
scale = getScale(offsetParent);
|
|
1343
|
+
}
|
|
1344
|
+
} else {
|
|
1345
|
+
scale = getScale(element);
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
1349
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
1350
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
1351
|
+
let width = clientRect.width / scale.x;
|
|
1352
|
+
let height = clientRect.height / scale.y;
|
|
1353
|
+
if (domElement) {
|
|
1354
|
+
const win = getWindow(domElement);
|
|
1355
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
1356
|
+
let currentWin = win;
|
|
1357
|
+
let currentIFrame = getFrameElement(currentWin);
|
|
1358
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
1359
|
+
const iframeScale = getScale(currentIFrame);
|
|
1360
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
1361
|
+
const css = getComputedStyle2(currentIFrame);
|
|
1362
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
1363
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
1364
|
+
x *= iframeScale.x;
|
|
1365
|
+
y *= iframeScale.y;
|
|
1366
|
+
width *= iframeScale.x;
|
|
1367
|
+
height *= iframeScale.y;
|
|
1368
|
+
x += left;
|
|
1369
|
+
y += top;
|
|
1370
|
+
currentWin = getWindow(currentIFrame);
|
|
1371
|
+
currentIFrame = getFrameElement(currentWin);
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
return rectToClientRect({
|
|
1375
|
+
width,
|
|
1376
|
+
height,
|
|
1377
|
+
x,
|
|
1378
|
+
y
|
|
1379
|
+
});
|
|
1380
|
+
}
|
|
1381
|
+
function getWindowScrollBarX(element, rect) {
|
|
1382
|
+
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
1383
|
+
if (!rect) {
|
|
1384
|
+
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
1385
|
+
}
|
|
1386
|
+
return rect.left + leftScroll;
|
|
1387
|
+
}
|
|
1388
|
+
function getHTMLOffset(documentElement, scroll) {
|
|
1389
|
+
const htmlRect = documentElement.getBoundingClientRect();
|
|
1390
|
+
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
|
|
1391
|
+
const y = htmlRect.top + scroll.scrollTop;
|
|
1392
|
+
return {
|
|
1393
|
+
x,
|
|
1394
|
+
y
|
|
1395
|
+
};
|
|
1396
|
+
}
|
|
1397
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
1398
|
+
let {
|
|
1399
|
+
elements,
|
|
1400
|
+
rect,
|
|
1401
|
+
offsetParent,
|
|
1402
|
+
strategy
|
|
1403
|
+
} = _ref;
|
|
1404
|
+
const isFixed = strategy === "fixed";
|
|
1405
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
1406
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
1407
|
+
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
1408
|
+
return rect;
|
|
1409
|
+
}
|
|
1410
|
+
let scroll = {
|
|
1411
|
+
scrollLeft: 0,
|
|
1412
|
+
scrollTop: 0
|
|
1413
|
+
};
|
|
1414
|
+
let scale = createCoords(1);
|
|
1415
|
+
const offsets = createCoords(0);
|
|
1416
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1417
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1418
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
1419
|
+
scroll = getNodeScroll(offsetParent);
|
|
1420
|
+
}
|
|
1421
|
+
if (isOffsetParentAnElement) {
|
|
1422
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
1423
|
+
scale = getScale(offsetParent);
|
|
1424
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1425
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
1429
|
+
return {
|
|
1430
|
+
width: rect.width * scale.x,
|
|
1431
|
+
height: rect.height * scale.y,
|
|
1432
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
1433
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
1434
|
+
};
|
|
1435
|
+
}
|
|
1436
|
+
function getClientRects(element) {
|
|
1437
|
+
return Array.from(element.getClientRects());
|
|
1438
|
+
}
|
|
1439
|
+
function getDocumentRect(element) {
|
|
1440
|
+
const html = getDocumentElement(element);
|
|
1441
|
+
const scroll = getNodeScroll(element);
|
|
1442
|
+
const body = element.ownerDocument.body;
|
|
1443
|
+
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
1444
|
+
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
1445
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
1446
|
+
const y = -scroll.scrollTop;
|
|
1447
|
+
if (getComputedStyle2(body).direction === "rtl") {
|
|
1448
|
+
x += max(html.clientWidth, body.clientWidth) - width;
|
|
1449
|
+
}
|
|
1450
|
+
return {
|
|
1451
|
+
width,
|
|
1452
|
+
height,
|
|
1453
|
+
x,
|
|
1454
|
+
y
|
|
1455
|
+
};
|
|
1456
|
+
}
|
|
1457
|
+
function getViewportRect(element, strategy) {
|
|
1458
|
+
const win = getWindow(element);
|
|
1459
|
+
const html = getDocumentElement(element);
|
|
1460
|
+
const visualViewport = win.visualViewport;
|
|
1461
|
+
let width = html.clientWidth;
|
|
1462
|
+
let height = html.clientHeight;
|
|
1463
|
+
let x = 0;
|
|
1464
|
+
let y = 0;
|
|
1465
|
+
if (visualViewport) {
|
|
1466
|
+
width = visualViewport.width;
|
|
1467
|
+
height = visualViewport.height;
|
|
1468
|
+
const visualViewportBased = isWebKit();
|
|
1469
|
+
if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
|
|
1470
|
+
x = visualViewport.offsetLeft;
|
|
1471
|
+
y = visualViewport.offsetTop;
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
const windowScrollbarX = getWindowScrollBarX(html);
|
|
1475
|
+
if (windowScrollbarX <= 0) {
|
|
1476
|
+
const doc = html.ownerDocument;
|
|
1477
|
+
const body = doc.body;
|
|
1478
|
+
const bodyStyles = getComputedStyle(body);
|
|
1479
|
+
const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
1480
|
+
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
|
1481
|
+
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
|
1482
|
+
width -= clippingStableScrollbarWidth;
|
|
1483
|
+
}
|
|
1484
|
+
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
|
1485
|
+
width += windowScrollbarX;
|
|
1486
|
+
}
|
|
1487
|
+
return {
|
|
1488
|
+
width,
|
|
1489
|
+
height,
|
|
1490
|
+
x,
|
|
1491
|
+
y
|
|
1492
|
+
};
|
|
1493
|
+
}
|
|
1494
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
1495
|
+
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
|
1496
|
+
const top = clientRect.top + element.clientTop;
|
|
1497
|
+
const left = clientRect.left + element.clientLeft;
|
|
1498
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
1499
|
+
const width = element.clientWidth * scale.x;
|
|
1500
|
+
const height = element.clientHeight * scale.y;
|
|
1501
|
+
const x = left * scale.x;
|
|
1502
|
+
const y = top * scale.y;
|
|
1503
|
+
return {
|
|
1504
|
+
width,
|
|
1505
|
+
height,
|
|
1506
|
+
x,
|
|
1507
|
+
y
|
|
1508
|
+
};
|
|
1509
|
+
}
|
|
1510
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
1511
|
+
let rect;
|
|
1512
|
+
if (clippingAncestor === "viewport") {
|
|
1513
|
+
rect = getViewportRect(element, strategy);
|
|
1514
|
+
} else if (clippingAncestor === "document") {
|
|
1515
|
+
rect = getDocumentRect(getDocumentElement(element));
|
|
1516
|
+
} else if (isElement(clippingAncestor)) {
|
|
1517
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
1518
|
+
} else {
|
|
1519
|
+
const visualOffsets = getVisualOffsets(element);
|
|
1520
|
+
rect = {
|
|
1521
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
1522
|
+
y: clippingAncestor.y - visualOffsets.y,
|
|
1523
|
+
width: clippingAncestor.width,
|
|
1524
|
+
height: clippingAncestor.height
|
|
1525
|
+
};
|
|
1526
|
+
}
|
|
1527
|
+
return rectToClientRect(rect);
|
|
1528
|
+
}
|
|
1529
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
|
1530
|
+
const parentNode = getParentNode(element);
|
|
1531
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
1532
|
+
return false;
|
|
1533
|
+
}
|
|
1534
|
+
return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
|
|
1535
|
+
}
|
|
1536
|
+
function getClippingElementAncestors(element, cache) {
|
|
1537
|
+
const cachedResult = cache.get(element);
|
|
1538
|
+
if (cachedResult) {
|
|
1539
|
+
return cachedResult;
|
|
1540
|
+
}
|
|
1541
|
+
let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
|
|
1542
|
+
let currentContainingBlockComputedStyle = null;
|
|
1543
|
+
const elementIsFixed = getComputedStyle2(element).position === "fixed";
|
|
1544
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
1545
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1546
|
+
const computedStyle = getComputedStyle2(currentNode);
|
|
1547
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
1548
|
+
if (!currentNodeIsContaining && computedStyle.position === "fixed") {
|
|
1549
|
+
currentContainingBlockComputedStyle = null;
|
|
1550
|
+
}
|
|
1551
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
1552
|
+
if (shouldDropCurrentNode) {
|
|
1553
|
+
result = result.filter((ancestor) => ancestor !== currentNode);
|
|
1554
|
+
} else {
|
|
1555
|
+
currentContainingBlockComputedStyle = computedStyle;
|
|
1556
|
+
}
|
|
1557
|
+
currentNode = getParentNode(currentNode);
|
|
1558
|
+
}
|
|
1559
|
+
cache.set(element, result);
|
|
1560
|
+
return result;
|
|
1561
|
+
}
|
|
1562
|
+
function getClippingRect(_ref) {
|
|
1563
|
+
let {
|
|
1564
|
+
element,
|
|
1565
|
+
boundary,
|
|
1566
|
+
rootBoundary,
|
|
1567
|
+
strategy
|
|
1568
|
+
} = _ref;
|
|
1569
|
+
const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
1570
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
1571
|
+
const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
|
|
1572
|
+
let top = firstRect.top;
|
|
1573
|
+
let right = firstRect.right;
|
|
1574
|
+
let bottom = firstRect.bottom;
|
|
1575
|
+
let left = firstRect.left;
|
|
1576
|
+
for (let i = 1;i < clippingAncestors.length; i++) {
|
|
1577
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
|
|
1578
|
+
top = max(rect.top, top);
|
|
1579
|
+
right = min(rect.right, right);
|
|
1580
|
+
bottom = min(rect.bottom, bottom);
|
|
1581
|
+
left = max(rect.left, left);
|
|
1582
|
+
}
|
|
1583
|
+
return {
|
|
1584
|
+
width: right - left,
|
|
1585
|
+
height: bottom - top,
|
|
1586
|
+
x: left,
|
|
1587
|
+
y: top
|
|
1588
|
+
};
|
|
1589
|
+
}
|
|
1590
|
+
function getDimensions(element) {
|
|
1591
|
+
const {
|
|
1592
|
+
width,
|
|
1593
|
+
height
|
|
1594
|
+
} = getCssDimensions(element);
|
|
1595
|
+
return {
|
|
1596
|
+
width,
|
|
1597
|
+
height
|
|
1598
|
+
};
|
|
1599
|
+
}
|
|
1600
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
1601
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1602
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
1603
|
+
const isFixed = strategy === "fixed";
|
|
1604
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
1605
|
+
let scroll = {
|
|
1606
|
+
scrollLeft: 0,
|
|
1607
|
+
scrollTop: 0
|
|
1608
|
+
};
|
|
1609
|
+
const offsets = createCoords(0);
|
|
1610
|
+
function setLeftRTLScrollbarOffset() {
|
|
1611
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
1612
|
+
}
|
|
1613
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1614
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
1615
|
+
scroll = getNodeScroll(offsetParent);
|
|
1616
|
+
}
|
|
1617
|
+
if (isOffsetParentAnElement) {
|
|
1618
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
1619
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1620
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1621
|
+
} else if (documentElement) {
|
|
1622
|
+
setLeftRTLScrollbarOffset();
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
|
1626
|
+
setLeftRTLScrollbarOffset();
|
|
1627
|
+
}
|
|
1628
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
1629
|
+
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
1630
|
+
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
1631
|
+
return {
|
|
1632
|
+
x,
|
|
1633
|
+
y,
|
|
1634
|
+
width: rect.width,
|
|
1635
|
+
height: rect.height
|
|
1636
|
+
};
|
|
1637
|
+
}
|
|
1638
|
+
function isStaticPositioned(element) {
|
|
1639
|
+
return getComputedStyle2(element).position === "static";
|
|
1640
|
+
}
|
|
1641
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
1642
|
+
if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") {
|
|
1643
|
+
return null;
|
|
1644
|
+
}
|
|
1645
|
+
if (polyfill) {
|
|
1646
|
+
return polyfill(element);
|
|
1647
|
+
}
|
|
1648
|
+
let rawOffsetParent = element.offsetParent;
|
|
1649
|
+
if (getDocumentElement(element) === rawOffsetParent) {
|
|
1650
|
+
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
1651
|
+
}
|
|
1652
|
+
return rawOffsetParent;
|
|
1653
|
+
}
|
|
1654
|
+
function getOffsetParent(element, polyfill) {
|
|
1655
|
+
const win = getWindow(element);
|
|
1656
|
+
if (isTopLayer(element)) {
|
|
1657
|
+
return win;
|
|
1658
|
+
}
|
|
1659
|
+
if (!isHTMLElement(element)) {
|
|
1660
|
+
let svgOffsetParent = getParentNode(element);
|
|
1661
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
1662
|
+
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
1663
|
+
return svgOffsetParent;
|
|
1664
|
+
}
|
|
1665
|
+
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
1666
|
+
}
|
|
1667
|
+
return win;
|
|
1668
|
+
}
|
|
1669
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
1670
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
1671
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
1672
|
+
}
|
|
1673
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
1674
|
+
return win;
|
|
1675
|
+
}
|
|
1676
|
+
return offsetParent || getContainingBlock(element) || win;
|
|
1677
|
+
}
|
|
1678
|
+
function isRTL(element) {
|
|
1679
|
+
return getComputedStyle2(element).direction === "rtl";
|
|
1680
|
+
}
|
|
1681
|
+
function rectsAreEqual(a, b) {
|
|
1682
|
+
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
1683
|
+
}
|
|
1684
|
+
function observeMove(element, onMove) {
|
|
1685
|
+
let io = null;
|
|
1686
|
+
let timeoutId;
|
|
1687
|
+
const root3 = getDocumentElement(element);
|
|
1688
|
+
function cleanup() {
|
|
1689
|
+
var _io;
|
|
1690
|
+
clearTimeout(timeoutId);
|
|
1691
|
+
(_io = io) == null || _io.disconnect();
|
|
1692
|
+
io = null;
|
|
1693
|
+
}
|
|
1694
|
+
function refresh(skip, threshold) {
|
|
1695
|
+
if (skip === undefined) {
|
|
1696
|
+
skip = false;
|
|
1697
|
+
}
|
|
1698
|
+
if (threshold === undefined) {
|
|
1699
|
+
threshold = 1;
|
|
1700
|
+
}
|
|
1701
|
+
cleanup();
|
|
1702
|
+
const elementRectForRootMargin = element.getBoundingClientRect();
|
|
1703
|
+
const {
|
|
1704
|
+
left,
|
|
1705
|
+
top,
|
|
1706
|
+
width,
|
|
1707
|
+
height
|
|
1708
|
+
} = elementRectForRootMargin;
|
|
1709
|
+
if (!skip) {
|
|
1710
|
+
onMove();
|
|
1711
|
+
}
|
|
1712
|
+
if (!width || !height) {
|
|
1713
|
+
return;
|
|
1714
|
+
}
|
|
1715
|
+
const insetTop = floor(top);
|
|
1716
|
+
const insetRight = floor(root3.clientWidth - (left + width));
|
|
1717
|
+
const insetBottom = floor(root3.clientHeight - (top + height));
|
|
1718
|
+
const insetLeft = floor(left);
|
|
1719
|
+
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
1720
|
+
const options = {
|
|
1721
|
+
rootMargin,
|
|
1722
|
+
threshold: max(0, min(1, threshold)) || 1
|
|
1723
|
+
};
|
|
1724
|
+
let isFirstUpdate = true;
|
|
1725
|
+
function handleObserve(entries) {
|
|
1726
|
+
const ratio = entries[0].intersectionRatio;
|
|
1727
|
+
if (ratio !== threshold) {
|
|
1728
|
+
if (!isFirstUpdate) {
|
|
1729
|
+
return refresh();
|
|
1730
|
+
}
|
|
1731
|
+
if (!ratio) {
|
|
1732
|
+
timeoutId = setTimeout(() => {
|
|
1733
|
+
refresh(false, 0.0000001);
|
|
1734
|
+
}, 1000);
|
|
1735
|
+
} else {
|
|
1736
|
+
refresh(false, ratio);
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
|
|
1740
|
+
refresh();
|
|
1741
|
+
}
|
|
1742
|
+
isFirstUpdate = false;
|
|
1743
|
+
}
|
|
1744
|
+
try {
|
|
1745
|
+
io = new IntersectionObserver(handleObserve, {
|
|
1746
|
+
...options,
|
|
1747
|
+
root: root3.ownerDocument
|
|
1748
|
+
});
|
|
1749
|
+
} catch (_e) {
|
|
1750
|
+
io = new IntersectionObserver(handleObserve, options);
|
|
1751
|
+
}
|
|
1752
|
+
io.observe(element);
|
|
1753
|
+
}
|
|
1754
|
+
refresh(true);
|
|
1755
|
+
return cleanup;
|
|
1756
|
+
}
|
|
1757
|
+
function autoUpdate(reference, floating, update, options) {
|
|
1758
|
+
if (options === undefined) {
|
|
1759
|
+
options = {};
|
|
1760
|
+
}
|
|
1761
|
+
const {
|
|
1762
|
+
ancestorScroll = true,
|
|
1763
|
+
ancestorResize = true,
|
|
1764
|
+
elementResize = typeof ResizeObserver === "function",
|
|
1765
|
+
layoutShift = typeof IntersectionObserver === "function",
|
|
1766
|
+
animationFrame = false
|
|
1767
|
+
} = options;
|
|
1768
|
+
const referenceEl = unwrapElement(reference);
|
|
1769
|
+
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
|
|
1770
|
+
ancestors.forEach((ancestor) => {
|
|
1771
|
+
ancestorScroll && ancestor.addEventListener("scroll", update, {
|
|
1772
|
+
passive: true
|
|
1773
|
+
});
|
|
1774
|
+
ancestorResize && ancestor.addEventListener("resize", update);
|
|
1775
|
+
});
|
|
1776
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
1777
|
+
let reobserveFrame = -1;
|
|
1778
|
+
let resizeObserver = null;
|
|
1779
|
+
if (elementResize) {
|
|
1780
|
+
resizeObserver = new ResizeObserver((_ref) => {
|
|
1781
|
+
let [firstEntry] = _ref;
|
|
1782
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
|
|
1783
|
+
resizeObserver.unobserve(floating);
|
|
1784
|
+
cancelAnimationFrame(reobserveFrame);
|
|
1785
|
+
reobserveFrame = requestAnimationFrame(() => {
|
|
1786
|
+
var _resizeObserver;
|
|
1787
|
+
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
1788
|
+
});
|
|
1789
|
+
}
|
|
1790
|
+
update();
|
|
1791
|
+
});
|
|
1792
|
+
if (referenceEl && !animationFrame) {
|
|
1793
|
+
resizeObserver.observe(referenceEl);
|
|
1794
|
+
}
|
|
1795
|
+
if (floating) {
|
|
1796
|
+
resizeObserver.observe(floating);
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
let frameId;
|
|
1800
|
+
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
1801
|
+
if (animationFrame) {
|
|
1802
|
+
frameLoop();
|
|
1803
|
+
}
|
|
1804
|
+
function frameLoop() {
|
|
1805
|
+
const nextRefRect = getBoundingClientRect(reference);
|
|
1806
|
+
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
|
|
1807
|
+
update();
|
|
1808
|
+
}
|
|
1809
|
+
prevRefRect = nextRefRect;
|
|
1810
|
+
frameId = requestAnimationFrame(frameLoop);
|
|
1811
|
+
}
|
|
1812
|
+
update();
|
|
1813
|
+
return () => {
|
|
1814
|
+
var _resizeObserver2;
|
|
1815
|
+
ancestors.forEach((ancestor) => {
|
|
1816
|
+
ancestorScroll && ancestor.removeEventListener("scroll", update);
|
|
1817
|
+
ancestorResize && ancestor.removeEventListener("resize", update);
|
|
1818
|
+
});
|
|
1819
|
+
cleanupIo == null || cleanupIo();
|
|
1820
|
+
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
1821
|
+
resizeObserver = null;
|
|
1822
|
+
if (animationFrame) {
|
|
1823
|
+
cancelAnimationFrame(frameId);
|
|
1824
|
+
}
|
|
1825
|
+
};
|
|
1826
|
+
}
|
|
1827
|
+
var noOffsets, SCROLLBAR_MAX = 25, getElementRects = async function(data) {
|
|
1828
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
1829
|
+
const getDimensionsFn = this.getDimensions;
|
|
1830
|
+
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
1831
|
+
return {
|
|
1832
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
1833
|
+
floating: {
|
|
1834
|
+
x: 0,
|
|
1835
|
+
y: 0,
|
|
1836
|
+
width: floatingDimensions.width,
|
|
1837
|
+
height: floatingDimensions.height
|
|
1838
|
+
}
|
|
1839
|
+
};
|
|
1840
|
+
}, platform, detectOverflow2, offset2, autoPlacement2, shift2, flip2, size2, hide2, arrow2, inline2, limitShift2, computePosition2 = (reference, floating, options) => {
|
|
1841
|
+
const cache = new Map;
|
|
1842
|
+
const mergedOptions = {
|
|
1843
|
+
platform,
|
|
1844
|
+
...options
|
|
1845
|
+
};
|
|
1846
|
+
const platformWithCache = {
|
|
1847
|
+
...mergedOptions.platform,
|
|
1848
|
+
_c: cache
|
|
1849
|
+
};
|
|
1850
|
+
return computePosition(reference, floating, {
|
|
1851
|
+
...mergedOptions,
|
|
1852
|
+
platform: platformWithCache
|
|
1853
|
+
});
|
|
1854
|
+
};
|
|
1855
|
+
var init_floating_ui_dom = __esm(() => {
|
|
1856
|
+
init_floating_ui_core();
|
|
1857
|
+
init_floating_ui_utils();
|
|
1858
|
+
init_floating_ui_utils_dom();
|
|
1859
|
+
init_floating_ui_utils_dom();
|
|
1860
|
+
noOffsets = /* @__PURE__ */ createCoords(0);
|
|
1861
|
+
platform = {
|
|
1862
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
1863
|
+
getDocumentElement,
|
|
1864
|
+
getClippingRect,
|
|
1865
|
+
getOffsetParent,
|
|
1866
|
+
getElementRects,
|
|
1867
|
+
getClientRects,
|
|
1868
|
+
getDimensions,
|
|
1869
|
+
getScale,
|
|
1870
|
+
isElement,
|
|
1871
|
+
isRTL
|
|
1872
|
+
};
|
|
1873
|
+
detectOverflow2 = detectOverflow;
|
|
1874
|
+
offset2 = offset;
|
|
1875
|
+
autoPlacement2 = autoPlacement;
|
|
1876
|
+
shift2 = shift;
|
|
1877
|
+
flip2 = flip;
|
|
1878
|
+
size2 = size;
|
|
1879
|
+
hide2 = hide;
|
|
1880
|
+
arrow2 = arrow;
|
|
1881
|
+
inline2 = inline;
|
|
1882
|
+
limitShift2 = limitShift;
|
|
1883
|
+
});
|
|
1884
|
+
|
|
1885
|
+
// src/components/portal/portal.svelte
|
|
1886
|
+
import"svelte/internal/disclose-version";
|
|
1887
|
+
import * as $2 from "svelte/internal/client";
|
|
1888
|
+
|
|
1889
|
+
// src/utilities/class-names.ts
|
|
1890
|
+
function classNames(...parts) {
|
|
1891
|
+
return parts.filter((part) => typeof part === "string" && part.length > 0).join(" ");
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1894
|
+
// src/components/portal/portal.utilities.svelte.ts
|
|
1895
|
+
import * as $ from "svelte/internal/client";
|
|
1896
|
+
|
|
1897
|
+
// ../../node_modules/esm-env/true.js
|
|
1898
|
+
var true_default = true;
|
|
1899
|
+
// src/utilities/dev-warn.ts
|
|
1900
|
+
function devWarn(message, ...args) {
|
|
1901
|
+
if (!true_default)
|
|
1902
|
+
return;
|
|
1903
|
+
console.warn(message, ...args);
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
// src/utilities/read-option.ts
|
|
1907
|
+
function isOptionGetter(value) {
|
|
1908
|
+
return typeof value === "function";
|
|
1909
|
+
}
|
|
1910
|
+
function readOption(value) {
|
|
1911
|
+
return isOptionGetter(value) ? value() : value;
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
// src/components/portal/portal.utilities.svelte.ts
|
|
1915
|
+
function resolvePortalTarget(target) {
|
|
1916
|
+
if (typeof document === "undefined")
|
|
1917
|
+
return null;
|
|
1918
|
+
if (target == null) {
|
|
1919
|
+
return { kind: "resolved", target: document.body };
|
|
1920
|
+
}
|
|
1921
|
+
if (target instanceof HTMLElement) {
|
|
1922
|
+
return { kind: "resolved", target };
|
|
1923
|
+
}
|
|
1924
|
+
try {
|
|
1925
|
+
const resolved = document.querySelector(target);
|
|
1926
|
+
return resolved instanceof HTMLElement ? { kind: "resolved", target: resolved } : { kind: "unresolved", key: target };
|
|
1927
|
+
} catch {
|
|
1928
|
+
return { kind: "unresolved", key: target };
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
function copyInheritedPortalAttributes(element, source, inheritAttributes, fallbackAttributes = {
|
|
1932
|
+
dir: element.getAttribute("dir"),
|
|
1933
|
+
dataTheme: element.getAttribute("data-theme"),
|
|
1934
|
+
theme: element.getAttribute("data-cinder-theme")
|
|
1935
|
+
}) {
|
|
1936
|
+
const preservesExplicitDirection = fallbackAttributes.preserveDirection || element.dataset["cinderExplicitDirection"] === "true";
|
|
1937
|
+
const inheritedDir = inheritAttributes && source && !preservesExplicitDirection ? source.closest("[dir]")?.getAttribute("dir") : null;
|
|
1938
|
+
const nextDir = inheritedDir ?? fallbackAttributes.dir;
|
|
1939
|
+
if (nextDir) {
|
|
1940
|
+
element.setAttribute("dir", nextDir);
|
|
1941
|
+
} else {
|
|
1942
|
+
element.removeAttribute("dir");
|
|
1943
|
+
}
|
|
1944
|
+
const preservesExplicitDataTheme = fallbackAttributes.preserveDataTheme === true;
|
|
1945
|
+
const inheritedDataTheme = inheritAttributes && source && !preservesExplicitDataTheme && fallbackAttributes.dataTheme === null ? source.closest("[data-theme]")?.getAttribute("data-theme") : null;
|
|
1946
|
+
const nextDataTheme = inheritedDataTheme ?? fallbackAttributes.dataTheme;
|
|
1947
|
+
if (nextDataTheme) {
|
|
1948
|
+
element.setAttribute("data-theme", nextDataTheme);
|
|
1949
|
+
} else {
|
|
1950
|
+
element.removeAttribute("data-theme");
|
|
1951
|
+
}
|
|
1952
|
+
const preservesExplicitTheme = fallbackAttributes.preserveTheme === true;
|
|
1953
|
+
const inheritedTheme = inheritAttributes && source && !preservesExplicitTheme && fallbackAttributes.theme === null ? source.closest("[data-cinder-theme]")?.getAttribute("data-cinder-theme") : null;
|
|
1954
|
+
const nextTheme = inheritedTheme ?? fallbackAttributes.theme;
|
|
1955
|
+
if (nextTheme) {
|
|
1956
|
+
element.setAttribute("data-cinder-theme", nextTheme);
|
|
1957
|
+
} else {
|
|
1958
|
+
element.removeAttribute("data-cinder-theme");
|
|
1959
|
+
}
|
|
1960
|
+
return {
|
|
1961
|
+
dir: inheritedDir ?? null,
|
|
1962
|
+
dataTheme: inheritedDataTheme ?? null,
|
|
1963
|
+
theme: inheritedTheme ?? null
|
|
1964
|
+
};
|
|
1965
|
+
}
|
|
1966
|
+
function observeInheritedPortalAttributes(source, inheritAttributes, syncAttributes) {
|
|
1967
|
+
if (!inheritAttributes || !source || typeof MutationObserver === "undefined")
|
|
1968
|
+
return null;
|
|
1969
|
+
const observer = new MutationObserver(() => {
|
|
1970
|
+
syncAttributes();
|
|
1971
|
+
});
|
|
1972
|
+
function observe(elementToObserve) {
|
|
1973
|
+
if (!elementToObserve || observedElements.includes(elementToObserve))
|
|
1974
|
+
return;
|
|
1975
|
+
observedElements.push(elementToObserve);
|
|
1976
|
+
observer.observe(elementToObserve, {
|
|
1977
|
+
attributes: true,
|
|
1978
|
+
attributeFilter: ["dir", "data-theme", "data-cinder-theme"]
|
|
1979
|
+
});
|
|
1980
|
+
}
|
|
1981
|
+
const observedElements = [];
|
|
1982
|
+
let ancestor = source;
|
|
1983
|
+
while (ancestor) {
|
|
1984
|
+
observe(ancestor);
|
|
1985
|
+
ancestor = ancestor.parentElement;
|
|
1986
|
+
}
|
|
1987
|
+
observe(document.documentElement);
|
|
1988
|
+
return () => observer.disconnect();
|
|
1989
|
+
}
|
|
1990
|
+
function createPortalAttachment(options = {}) {
|
|
1991
|
+
let lastWarnedUnresolvedKey = null;
|
|
1992
|
+
return (element) => {
|
|
1993
|
+
const initialParent = element.parentElement;
|
|
1994
|
+
const initialAttributes = {
|
|
1995
|
+
dir: element.getAttribute("dir"),
|
|
1996
|
+
dataTheme: element.getAttribute("data-theme"),
|
|
1997
|
+
theme: element.getAttribute("data-cinder-theme")
|
|
1998
|
+
};
|
|
1999
|
+
const managedAttributes = { dir: null, dataTheme: null, theme: null };
|
|
2000
|
+
function currentFallbackAttributes() {
|
|
2001
|
+
const explicitAttributes = readOption(options.explicitAttributes ?? {});
|
|
2002
|
+
const explicitDirection = explicitAttributes.dir;
|
|
2003
|
+
const explicitDataTheme = explicitAttributes.dataTheme;
|
|
2004
|
+
const explicitTheme = explicitAttributes.theme;
|
|
2005
|
+
const direction = element.getAttribute("dir");
|
|
2006
|
+
const dataTheme = element.getAttribute("data-theme");
|
|
2007
|
+
const theme = element.getAttribute("data-cinder-theme");
|
|
2008
|
+
return {
|
|
2009
|
+
dir: explicitDirection !== undefined ? explicitDirection : direction !== managedAttributes.dir ? direction : initialAttributes.dir,
|
|
2010
|
+
preserveDirection: explicitDirection !== undefined,
|
|
2011
|
+
dataTheme: explicitDataTheme !== undefined ? explicitDataTheme : dataTheme !== managedAttributes.dataTheme ? dataTheme : null,
|
|
2012
|
+
preserveDataTheme: explicitDataTheme !== undefined,
|
|
2013
|
+
theme: explicitTheme !== undefined ? explicitTheme : theme !== managedAttributes.theme ? theme : null,
|
|
2014
|
+
preserveTheme: explicitTheme !== undefined
|
|
2015
|
+
};
|
|
2016
|
+
}
|
|
2017
|
+
function syncInheritedAttributes(source, inheritAttributes) {
|
|
2018
|
+
const nextManagedAttributes = copyInheritedPortalAttributes(element, source, inheritAttributes, currentFallbackAttributes());
|
|
2019
|
+
managedAttributes.dir = nextManagedAttributes.dir;
|
|
2020
|
+
managedAttributes.dataTheme = nextManagedAttributes.dataTheme;
|
|
2021
|
+
managedAttributes.theme = nextManagedAttributes.theme;
|
|
2022
|
+
}
|
|
2023
|
+
const anchor = typeof document !== "undefined" ? document.createComment("@lostgradient/cinder/portal") : null;
|
|
2024
|
+
if (anchor && initialParent && element.parentNode === initialParent) {
|
|
2025
|
+
initialParent.insertBefore(anchor, element);
|
|
2026
|
+
}
|
|
2027
|
+
function restoreInline() {
|
|
2028
|
+
if (!anchor || !anchor.parentNode)
|
|
2029
|
+
return;
|
|
2030
|
+
if (element.parentNode === anchor.parentNode && element.previousSibling === anchor)
|
|
2031
|
+
return;
|
|
2032
|
+
anchor.parentNode.insertBefore(element, anchor.nextSibling);
|
|
2033
|
+
}
|
|
2034
|
+
$.user_effect(() => {
|
|
2035
|
+
let stopObservingInheritedAttributes = null;
|
|
2036
|
+
const disabled = readOption(options.disabled ?? false);
|
|
2037
|
+
const inheritAttributes = readOption(options.inheritAttributes ?? true);
|
|
2038
|
+
const targetValue = readOption(options.target ?? null);
|
|
2039
|
+
const attributeSource = readOption(options.source ?? initialParent) ?? initialParent;
|
|
2040
|
+
const resolved = disabled ? null : resolvePortalTarget(targetValue);
|
|
2041
|
+
if (!disabled && resolved?.kind === "resolved") {
|
|
2042
|
+
syncInheritedAttributes(attributeSource, inheritAttributes);
|
|
2043
|
+
stopObservingInheritedAttributes = observeInheritedPortalAttributes(attributeSource, inheritAttributes, () => syncInheritedAttributes(attributeSource, inheritAttributes));
|
|
2044
|
+
resolved.target.appendChild(element);
|
|
2045
|
+
lastWarnedUnresolvedKey = null;
|
|
2046
|
+
} else if (!disabled && resolved?.kind === "unresolved") {
|
|
2047
|
+
restoreInline();
|
|
2048
|
+
syncInheritedAttributes(null, false);
|
|
2049
|
+
if (lastWarnedUnresolvedKey !== resolved.key) {
|
|
2050
|
+
devWarn(`[cinder/portal] could not resolve portal target ${JSON.stringify(resolved.key)}.`);
|
|
2051
|
+
lastWarnedUnresolvedKey = resolved.key;
|
|
2052
|
+
}
|
|
2053
|
+
} else if (disabled) {
|
|
2054
|
+
restoreInline();
|
|
2055
|
+
syncInheritedAttributes(null, false);
|
|
2056
|
+
lastWarnedUnresolvedKey = null;
|
|
2057
|
+
}
|
|
2058
|
+
return () => {
|
|
2059
|
+
stopObservingInheritedAttributes?.();
|
|
2060
|
+
if (element.isConnected) {
|
|
2061
|
+
element.remove();
|
|
2062
|
+
}
|
|
2063
|
+
};
|
|
2064
|
+
});
|
|
2065
|
+
return () => {
|
|
2066
|
+
if (anchor && anchor.parentNode) {
|
|
2067
|
+
anchor.parentNode.removeChild(anchor);
|
|
2068
|
+
}
|
|
2069
|
+
};
|
|
2070
|
+
};
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
// src/components/portal/portal.svelte
|
|
2074
|
+
var rest_excludes = new Set([
|
|
2075
|
+
"$$slots",
|
|
2076
|
+
"$$events",
|
|
2077
|
+
"$$legacy",
|
|
2078
|
+
"target",
|
|
2079
|
+
"disabled",
|
|
2080
|
+
"class",
|
|
2081
|
+
"inheritAttributes",
|
|
2082
|
+
"children"
|
|
2083
|
+
]);
|
|
2084
|
+
var root = $2.from_html(`<div><!></div>`);
|
|
2085
|
+
function Portal($$anchor, $$props) {
|
|
2086
|
+
$2.push($$props, true);
|
|
2087
|
+
let target = $2.prop($$props, "target", 3, null), disabled = $2.prop($$props, "disabled", 3, false), inheritAttributes = $2.prop($$props, "inheritAttributes", 3, true), rest = $2.rest_props($$props, rest_excludes);
|
|
2088
|
+
let hasHydrated = $2.state(false);
|
|
2089
|
+
$2.user_effect(() => {
|
|
2090
|
+
$2.set(hasHydrated, true);
|
|
2091
|
+
});
|
|
2092
|
+
const resolvedTarget = $2.derived(() => !disabled() ? resolvePortalTarget(target()) : null);
|
|
2093
|
+
const shouldRenderChildren = $2.derived(() => disabled() || $2.get(hasHydrated) && $2.get(resolvedTarget) !== null);
|
|
2094
|
+
var div = root();
|
|
2095
|
+
$2.attribute_effect(div, ($0) => ({ class: $0, ...rest }), [() => classNames($$props.class)]);
|
|
2096
|
+
var node = $2.child(div);
|
|
2097
|
+
{
|
|
2098
|
+
var consequent = ($$anchor2) => {
|
|
2099
|
+
var fragment = $2.comment();
|
|
2100
|
+
var node_1 = $2.first_child(fragment);
|
|
2101
|
+
$2.snippet(node_1, () => $$props.children);
|
|
2102
|
+
$2.append($$anchor2, fragment);
|
|
2103
|
+
};
|
|
2104
|
+
$2.if(node, ($$render) => {
|
|
2105
|
+
if ($2.get(shouldRenderChildren))
|
|
2106
|
+
$$render(consequent);
|
|
2107
|
+
});
|
|
2108
|
+
}
|
|
2109
|
+
$2.reset(div);
|
|
2110
|
+
$2.attach(div, () => createPortalAttachment({
|
|
2111
|
+
target: () => target(),
|
|
2112
|
+
disabled: () => disabled(),
|
|
2113
|
+
inheritAttributes: () => inheritAttributes(),
|
|
2114
|
+
explicitAttributes: () => ({
|
|
2115
|
+
dir: $$props.dir,
|
|
2116
|
+
dataTheme: rest["data-theme"],
|
|
2117
|
+
theme: rest["data-cinder-theme"]
|
|
2118
|
+
})
|
|
2119
|
+
}));
|
|
2120
|
+
$2.append($$anchor, div);
|
|
2121
|
+
$2.pop();
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2124
|
+
// src/components/portal/index.ts
|
|
2125
|
+
var portal_default = Portal;
|
|
2126
|
+
// src/components/chat-composer-popover/index.ts
|
|
2127
|
+
import"@lostgradient/cinder/chat-composer-popover/styles";
|
|
2128
|
+
|
|
2129
|
+
// src/components/chat-composer-popover/chat-composer-popover.svelte
|
|
2130
|
+
import"svelte/internal/disclose-version";
|
|
2131
|
+
import * as $8 from "svelte/internal/client";
|
|
2132
|
+
|
|
2133
|
+
// src/components/command-item/command-item.svelte
|
|
2134
|
+
import"svelte/internal/disclose-version";
|
|
2135
|
+
import * as $3 from "svelte/internal/client";
|
|
2136
|
+
import { untrack } from "svelte";
|
|
2137
|
+
|
|
2138
|
+
// src/components/_internal/command-list-context.ts
|
|
2139
|
+
import { createContext } from "svelte";
|
|
2140
|
+
var [getCommandListContextStrict, setCommandListContextRaw] = createContext();
|
|
2141
|
+
function setCommandListContext(context) {
|
|
2142
|
+
setCommandListContextRaw(context);
|
|
2143
|
+
}
|
|
2144
|
+
function getCommandListContext() {
|
|
2145
|
+
return getCommandListContextStrict();
|
|
2146
|
+
}
|
|
2147
|
+
function hasCommandListContext() {
|
|
2148
|
+
try {
|
|
2149
|
+
getCommandListContextStrict();
|
|
2150
|
+
return true;
|
|
2151
|
+
} catch {
|
|
2152
|
+
return false;
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2155
|
+
|
|
2156
|
+
// src/components/command-item/command-item.svelte
|
|
2157
|
+
var root2 = $3.from_html(`<span class="cinder-command-item__leading" aria-hidden="true"><!></span>`);
|
|
2158
|
+
var root_1 = $3.from_html(`<span class="cinder-command-item__description cinder-_truncate"> </span>`);
|
|
2159
|
+
var root_2 = $3.from_html(`<span class="cinder-command-item__trailing" aria-hidden="true"><!></span>`);
|
|
2160
|
+
var root_3 = $3.from_html(`<li role="option"><!> <span class="cinder-command-item__content"><span class="cinder-command-item__label cinder-_truncate"><!></span> <!></span> <!></li>`);
|
|
2161
|
+
function Command_item($$anchor, $$props) {
|
|
2162
|
+
$3.push($$props, true);
|
|
2163
|
+
if (!hasCommandListContext()) {
|
|
2164
|
+
throw new Error("CommandItem must be used within a CommandPalette or CommandMenu.");
|
|
2165
|
+
}
|
|
2166
|
+
let onselect = $3.prop($$props, "onselect", 3, () => {}), selectionMode = $3.prop($$props, "selectionMode", 3, "item"), disabled = $3.prop($$props, "disabled", 3, false);
|
|
2167
|
+
const commandList = getCommandListContext();
|
|
2168
|
+
untrack(() => selectionMode());
|
|
2169
|
+
let registrationHandle = $3.state(null);
|
|
2170
|
+
const itemId = $3.derived(() => $3.get(registrationHandle)?.id ?? null);
|
|
2171
|
+
const registerWithPalette = (node) => {
|
|
2172
|
+
return untrack(() => {
|
|
2173
|
+
const registeredItem = commandList.register({
|
|
2174
|
+
getValue: () => $$props.value,
|
|
2175
|
+
getOnselect: () => onselect(),
|
|
2176
|
+
getDisabled: () => disabled()
|
|
2177
|
+
}, node);
|
|
2178
|
+
$3.set(registrationHandle, registeredItem, true);
|
|
2179
|
+
return () => {
|
|
2180
|
+
registeredItem.unregister();
|
|
2181
|
+
$3.set(registrationHandle, null);
|
|
2182
|
+
};
|
|
2183
|
+
});
|
|
2184
|
+
};
|
|
2185
|
+
const isActive = $3.derived(() => $3.get(itemId) !== null && commandList.activeItemId === $3.get(itemId));
|
|
2186
|
+
const normalizedAccessibleLabel = $3.derived(() => normalizeOptionalAttribute($$props.accessibleLabel));
|
|
2187
|
+
const normalizedKeyboardShortcut = $3.derived(() => normalizeOptionalAttribute($$props.keyboardShortcut));
|
|
2188
|
+
function normalizeOptionalAttribute(value) {
|
|
2189
|
+
const trimmed = value?.trim();
|
|
2190
|
+
return trimmed ? trimmed : undefined;
|
|
2191
|
+
}
|
|
2192
|
+
function handlePointerEnter() {
|
|
2193
|
+
if (!disabled() && $3.get(itemId) !== null) {
|
|
2194
|
+
commandList.setActiveById($3.get(itemId));
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
function handlePointerDown(event2) {
|
|
2198
|
+
event2.preventDefault();
|
|
2199
|
+
}
|
|
2200
|
+
function handleClick() {
|
|
2201
|
+
if (!disabled() && $3.get(itemId) !== null) {
|
|
2202
|
+
commandList.activateItemById($3.get(itemId));
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2205
|
+
var li = root_3();
|
|
2206
|
+
var node_1 = $3.child(li);
|
|
2207
|
+
{
|
|
2208
|
+
var consequent = ($$anchor2) => {
|
|
2209
|
+
var span = root2();
|
|
2210
|
+
var node_2 = $3.child(span);
|
|
2211
|
+
$3.snippet(node_2, () => $$props.leading);
|
|
2212
|
+
$3.reset(span);
|
|
2213
|
+
$3.append($$anchor2, span);
|
|
2214
|
+
};
|
|
2215
|
+
$3.if(node_1, ($$render) => {
|
|
2216
|
+
if ($$props.leading)
|
|
2217
|
+
$$render(consequent);
|
|
2218
|
+
});
|
|
2219
|
+
}
|
|
2220
|
+
var span_1 = $3.sibling(node_1, 2);
|
|
2221
|
+
var span_2 = $3.child(span_1);
|
|
2222
|
+
var node_3 = $3.child(span_2);
|
|
2223
|
+
$3.snippet(node_3, () => $$props.children);
|
|
2224
|
+
$3.reset(span_2);
|
|
2225
|
+
var node_4 = $3.sibling(span_2, 2);
|
|
2226
|
+
{
|
|
2227
|
+
var consequent_1 = ($$anchor2) => {
|
|
2228
|
+
var span_3 = root_1();
|
|
2229
|
+
var text = $3.child(span_3, true);
|
|
2230
|
+
$3.reset(span_3);
|
|
2231
|
+
$3.template_effect(() => $3.set_text(text, $$props.description));
|
|
2232
|
+
$3.append($$anchor2, span_3);
|
|
2233
|
+
};
|
|
2234
|
+
$3.if(node_4, ($$render) => {
|
|
2235
|
+
if ($$props.description)
|
|
2236
|
+
$$render(consequent_1);
|
|
2237
|
+
});
|
|
2238
|
+
}
|
|
2239
|
+
$3.reset(span_1);
|
|
2240
|
+
var node_5 = $3.sibling(span_1, 2);
|
|
2241
|
+
{
|
|
2242
|
+
var consequent_2 = ($$anchor2) => {
|
|
2243
|
+
var span_4 = root_2();
|
|
2244
|
+
var node_6 = $3.child(span_4);
|
|
2245
|
+
$3.snippet(node_6, () => $$props.trailing);
|
|
2246
|
+
$3.reset(span_4);
|
|
2247
|
+
$3.append($$anchor2, span_4);
|
|
2248
|
+
};
|
|
2249
|
+
$3.if(node_5, ($$render) => {
|
|
2250
|
+
if ($$props.trailing)
|
|
2251
|
+
$$render(consequent_2);
|
|
2252
|
+
});
|
|
2253
|
+
}
|
|
2254
|
+
$3.reset(li);
|
|
2255
|
+
$3.attach(li, () => registerWithPalette);
|
|
2256
|
+
$3.template_effect(($0) => {
|
|
2257
|
+
$3.set_attribute(li, "id", $3.get(itemId) ?? undefined);
|
|
2258
|
+
$3.set_class(li, 1, $0);
|
|
2259
|
+
$3.set_attribute(li, "aria-selected", $3.get(isActive));
|
|
2260
|
+
$3.set_attribute(li, "aria-disabled", disabled() || undefined);
|
|
2261
|
+
$3.set_attribute(li, "aria-label", $3.get(normalizedAccessibleLabel));
|
|
2262
|
+
$3.set_attribute(li, "aria-keyshortcuts", $3.get(normalizedKeyboardShortcut));
|
|
2263
|
+
$3.set_attribute(li, "data-cinder-active", $3.get(isActive) ? "" : undefined);
|
|
2264
|
+
$3.set_attribute(li, "data-cinder-disabled", disabled() || undefined);
|
|
2265
|
+
}, [
|
|
2266
|
+
() => $3.clsx(classNames("cinder-command-item", $$props.class))
|
|
2267
|
+
]);
|
|
2268
|
+
$3.event("pointerenter", li, handlePointerEnter);
|
|
2269
|
+
$3.delegated("pointerdown", li, handlePointerDown);
|
|
2270
|
+
$3.delegated("click", li, handleClick);
|
|
2271
|
+
$3.append($$anchor, li);
|
|
2272
|
+
$3.pop();
|
|
2273
|
+
}
|
|
2274
|
+
$3.delegate(["pointerdown", "click"]);
|
|
2275
|
+
|
|
2276
|
+
// src/components/command-menu/command-menu.svelte
|
|
2277
|
+
import"svelte/internal/disclose-version";
|
|
2278
|
+
import * as $7 from "svelte/internal/client";
|
|
2279
|
+
|
|
2280
|
+
// src/components/command-menu/caret-rect.svelte.ts
|
|
2281
|
+
import * as $4 from "svelte/internal/client";
|
|
2282
|
+
var MIRROR_STYLE_PROPERTIES = [
|
|
2283
|
+
"box-sizing",
|
|
2284
|
+
"width",
|
|
2285
|
+
"height",
|
|
2286
|
+
"min-height",
|
|
2287
|
+
"max-height",
|
|
2288
|
+
"border-block-start-style",
|
|
2289
|
+
"border-block-end-style",
|
|
2290
|
+
"border-inline-start-style",
|
|
2291
|
+
"border-inline-end-style",
|
|
2292
|
+
"border-top-style",
|
|
2293
|
+
"border-right-style",
|
|
2294
|
+
"border-bottom-style",
|
|
2295
|
+
"border-left-style",
|
|
2296
|
+
"border-block-start-width",
|
|
2297
|
+
"border-block-end-width",
|
|
2298
|
+
"border-inline-start-width",
|
|
2299
|
+
"border-inline-end-width",
|
|
2300
|
+
"border-top-width",
|
|
2301
|
+
"border-right-width",
|
|
2302
|
+
"border-bottom-width",
|
|
2303
|
+
"border-left-width",
|
|
2304
|
+
"padding-block-start",
|
|
2305
|
+
"padding-block-end",
|
|
2306
|
+
"padding-inline-start",
|
|
2307
|
+
"padding-inline-end",
|
|
2308
|
+
"font-family",
|
|
2309
|
+
"font-size",
|
|
2310
|
+
"font-weight",
|
|
2311
|
+
"font-style",
|
|
2312
|
+
"font-variant",
|
|
2313
|
+
"line-height",
|
|
2314
|
+
"letter-spacing",
|
|
2315
|
+
"word-spacing",
|
|
2316
|
+
"text-indent",
|
|
2317
|
+
"text-transform",
|
|
2318
|
+
"text-align",
|
|
2319
|
+
"text-rendering",
|
|
2320
|
+
"overflow-wrap",
|
|
2321
|
+
"word-break",
|
|
2322
|
+
"word-wrap",
|
|
2323
|
+
"tab-size",
|
|
2324
|
+
"direction",
|
|
2325
|
+
"writing-mode"
|
|
2326
|
+
];
|
|
2327
|
+
function getCaretRect(field, caretIndex) {
|
|
2328
|
+
if (!field || typeof document === "undefined" || typeof getComputedStyle === "undefined") {
|
|
2329
|
+
return null;
|
|
2330
|
+
}
|
|
2331
|
+
const fieldRect = field.getBoundingClientRect();
|
|
2332
|
+
if (fieldRect.width === 0 || fieldRect.height === 0 || !field.isConnected)
|
|
2333
|
+
return null;
|
|
2334
|
+
const computedStyle = getComputedStyle(field);
|
|
2335
|
+
const mirror = document.createElement("div");
|
|
2336
|
+
const marker = document.createElement("span");
|
|
2337
|
+
const normalizedCaretIndex = Math.max(0, Math.min(caretIndex, field.value.length));
|
|
2338
|
+
mirror.setAttribute("data-cinder-command-menu-caret-mirror", "");
|
|
2339
|
+
mirror.style.position = "fixed";
|
|
2340
|
+
mirror.style.visibility = "hidden";
|
|
2341
|
+
mirror.style.pointerEvents = "none";
|
|
2342
|
+
mirror.style.whiteSpace = field instanceof HTMLTextAreaElement ? "pre-wrap" : "pre";
|
|
2343
|
+
mirror.style.overflow = computedStyle.overflow;
|
|
2344
|
+
mirror.style.left = `${fieldRect.left}px`;
|
|
2345
|
+
mirror.style.top = `${fieldRect.top}px`;
|
|
2346
|
+
for (const property of MIRROR_STYLE_PROPERTIES) {
|
|
2347
|
+
mirror.style.setProperty(property, computedStyle.getPropertyValue(property));
|
|
2348
|
+
}
|
|
2349
|
+
mirror.textContent = field.value.slice(0, normalizedCaretIndex);
|
|
2350
|
+
marker.textContent = "";
|
|
2351
|
+
mirror.append(marker);
|
|
2352
|
+
document.body.append(mirror);
|
|
2353
|
+
mirror.scrollLeft = field.scrollLeft;
|
|
2354
|
+
mirror.scrollTop = field.scrollTop;
|
|
2355
|
+
const markerRect = marker.getBoundingClientRect();
|
|
2356
|
+
const rect = new DOMRect(markerRect.left, markerRect.top, Math.max(markerRect.width, 1), Math.max(markerRect.height, Number.parseFloat(computedStyle.lineHeight) || 16));
|
|
2357
|
+
mirror.remove();
|
|
2358
|
+
return rect;
|
|
2359
|
+
}
|
|
2360
|
+
|
|
2361
|
+
// src/components/command-menu/command-menu.svelte
|
|
2362
|
+
import { on } from "svelte/events";
|
|
2363
|
+
|
|
2364
|
+
// src/_internal/anchored-overlay.svelte.ts
|
|
2365
|
+
import * as $5 from "svelte/internal/client";
|
|
2366
|
+
var DEFAULT_PLACEMENT = "bottom-start";
|
|
2367
|
+
var DEFAULT_OFFSET = 8;
|
|
2368
|
+
var DEFAULT_SHIFT_PADDING = 8;
|
|
2369
|
+
var DEFAULT_ARROW_PADDING = 6;
|
|
2370
|
+
function getPlacementSide(placement) {
|
|
2371
|
+
if (placement.startsWith("top"))
|
|
2372
|
+
return "top";
|
|
2373
|
+
if (placement.startsWith("right"))
|
|
2374
|
+
return "right";
|
|
2375
|
+
if (placement.startsWith("left"))
|
|
2376
|
+
return "left";
|
|
2377
|
+
return "bottom";
|
|
2378
|
+
}
|
|
2379
|
+
function getAnchoredOverlayWidthStyle(widthMode, anchorRect) {
|
|
2380
|
+
if (widthMode === "none")
|
|
2381
|
+
return "";
|
|
2382
|
+
if (widthMode === "match-anchor") {
|
|
2383
|
+
const width = Math.max(0, anchorRect?.width ?? 0);
|
|
2384
|
+
return width > 0 ? `min-inline-size: ${width}px; inline-size: ${width}px;` : "";
|
|
2385
|
+
}
|
|
2386
|
+
if (widthMode === "menu") {
|
|
2387
|
+
return [
|
|
2388
|
+
"inline-size: max-content;",
|
|
2389
|
+
"min-inline-size: min(12rem, calc(100vw - var(--cinder-space-4)));",
|
|
2390
|
+
"max-inline-size: min(24rem, calc(100vw - var(--cinder-space-4)));"
|
|
2391
|
+
].join(" ");
|
|
2392
|
+
}
|
|
2393
|
+
return "max-inline-size: min(28rem, calc(100vw - var(--cinder-space-4)));";
|
|
2394
|
+
}
|
|
2395
|
+
function getArrowStyle(placement, data) {
|
|
2396
|
+
if (!data)
|
|
2397
|
+
return "";
|
|
2398
|
+
const side = getPlacementSide(placement);
|
|
2399
|
+
const staticSide = { top: "bottom", right: "left", bottom: "top", left: "right" }[side];
|
|
2400
|
+
return [
|
|
2401
|
+
data.x != null ? `left: ${data.x}px;` : "",
|
|
2402
|
+
data.y != null ? `top: ${data.y}px;` : "",
|
|
2403
|
+
staticSide ? `${staticSide}: -4px;` : ""
|
|
2404
|
+
].filter(Boolean).join(" ");
|
|
2405
|
+
}
|
|
2406
|
+
function reportAnchoredOverlaySetupError(error) {
|
|
2407
|
+
if (typeof globalThis.reportError === "function") {
|
|
2408
|
+
globalThis.reportError(error);
|
|
2409
|
+
return;
|
|
2410
|
+
}
|
|
2411
|
+
setTimeout(() => {
|
|
2412
|
+
throw error;
|
|
2413
|
+
}, 0);
|
|
2414
|
+
}
|
|
2415
|
+
function createAnchoredOverlay(options) {
|
|
2416
|
+
let positionReady = $5.state(false);
|
|
2417
|
+
let positionStyle = $5.state("");
|
|
2418
|
+
let resolvedPlacement = $5.state($5.proxy(options.placement?.() ?? DEFAULT_PLACEMENT));
|
|
2419
|
+
let arrowStyle = $5.state("");
|
|
2420
|
+
$5.user_effect(() => {
|
|
2421
|
+
if (!options.open()) {
|
|
2422
|
+
$5.set(positionReady, false);
|
|
2423
|
+
$5.set(positionStyle, "");
|
|
2424
|
+
$5.set(arrowStyle, "");
|
|
2425
|
+
$5.set(resolvedPlacement, options.placement?.() ?? DEFAULT_PLACEMENT, true);
|
|
2426
|
+
return;
|
|
2427
|
+
}
|
|
2428
|
+
const anchor = options.anchor();
|
|
2429
|
+
const panel = options.panel();
|
|
2430
|
+
if (!anchor || !panel) {
|
|
2431
|
+
$5.set(positionReady, false);
|
|
2432
|
+
$5.set(positionStyle, "");
|
|
2433
|
+
$5.set(arrowStyle, "");
|
|
2434
|
+
return;
|
|
2435
|
+
}
|
|
2436
|
+
const placement = options.placement?.() ?? DEFAULT_PLACEMENT;
|
|
2437
|
+
const offset3 = options.offset?.() ?? DEFAULT_OFFSET;
|
|
2438
|
+
const shiftPadding = options.shiftPadding?.() ?? DEFAULT_SHIFT_PADDING;
|
|
2439
|
+
const shiftCrossAxis = options.shiftCrossAxis?.() ?? false;
|
|
2440
|
+
const arrowPadding = options.arrowPadding?.() ?? DEFAULT_ARROW_PADDING;
|
|
2441
|
+
const arrow3 = options.arrow?.();
|
|
2442
|
+
const showArrow = options.showArrow?.() ?? Boolean(arrow3);
|
|
2443
|
+
const widthMode = options.widthMode?.() ?? "content";
|
|
2444
|
+
let cancelled = false;
|
|
2445
|
+
let generation = 0;
|
|
2446
|
+
let stopAutoUpdate;
|
|
2447
|
+
(async () => {
|
|
2448
|
+
const {
|
|
2449
|
+
arrow: arrowMiddleware,
|
|
2450
|
+
autoUpdate: autoUpdate2,
|
|
2451
|
+
computePosition: computePosition3,
|
|
2452
|
+
flip: flip3,
|
|
2453
|
+
offset: offsetMiddleware,
|
|
2454
|
+
shift: shift3
|
|
2455
|
+
} = await Promise.resolve().then(() => (init_floating_ui_dom(), exports_floating_ui_dom));
|
|
2456
|
+
if (cancelled)
|
|
2457
|
+
return;
|
|
2458
|
+
const middleware = [
|
|
2459
|
+
offsetMiddleware(offset3),
|
|
2460
|
+
flip3(),
|
|
2461
|
+
shift3({ padding: shiftPadding, crossAxis: shiftCrossAxis })
|
|
2462
|
+
];
|
|
2463
|
+
if (showArrow && arrow3) {
|
|
2464
|
+
middleware.push(arrowMiddleware({ element: arrow3, padding: arrowPadding }));
|
|
2465
|
+
}
|
|
2466
|
+
stopAutoUpdate = autoUpdate2(anchor, panel, async () => {
|
|
2467
|
+
if (cancelled)
|
|
2468
|
+
return;
|
|
2469
|
+
const currentGeneration = ++generation;
|
|
2470
|
+
let result;
|
|
2471
|
+
try {
|
|
2472
|
+
result = await computePosition3(anchor, panel, { placement, middleware, strategy: "fixed" });
|
|
2473
|
+
} catch {
|
|
2474
|
+
if (cancelled || currentGeneration !== generation)
|
|
2475
|
+
return;
|
|
2476
|
+
$5.set(positionReady, false);
|
|
2477
|
+
$5.set(positionStyle, "");
|
|
2478
|
+
$5.set(arrowStyle, "");
|
|
2479
|
+
$5.set(resolvedPlacement, placement, true);
|
|
2480
|
+
return;
|
|
2481
|
+
}
|
|
2482
|
+
if (cancelled || currentGeneration !== generation)
|
|
2483
|
+
return;
|
|
2484
|
+
const widthStyle = getAnchoredOverlayWidthStyle(widthMode, anchor.getBoundingClientRect());
|
|
2485
|
+
$5.set(positionStyle, [
|
|
2486
|
+
"position: fixed;",
|
|
2487
|
+
`left: ${result.x}px;`,
|
|
2488
|
+
`top: ${result.y}px;`,
|
|
2489
|
+
widthStyle
|
|
2490
|
+
].filter(Boolean).join(" "), true);
|
|
2491
|
+
$5.set(resolvedPlacement, result.placement, true);
|
|
2492
|
+
$5.set(arrowStyle, showArrow ? getArrowStyle(result.placement, result.middlewareData.arrow) : "", true);
|
|
2493
|
+
$5.set(positionReady, true);
|
|
2494
|
+
});
|
|
2495
|
+
})().catch((error) => {
|
|
2496
|
+
if (cancelled)
|
|
2497
|
+
return;
|
|
2498
|
+
$5.set(positionReady, false);
|
|
2499
|
+
$5.set(positionStyle, "");
|
|
2500
|
+
$5.set(arrowStyle, "");
|
|
2501
|
+
$5.set(resolvedPlacement, placement, true);
|
|
2502
|
+
reportAnchoredOverlaySetupError(error);
|
|
2503
|
+
});
|
|
2504
|
+
return () => {
|
|
2505
|
+
cancelled = true;
|
|
2506
|
+
stopAutoUpdate?.();
|
|
2507
|
+
$5.set(positionReady, false);
|
|
2508
|
+
$5.set(positionStyle, "");
|
|
2509
|
+
$5.set(arrowStyle, "");
|
|
2510
|
+
$5.set(resolvedPlacement, placement, true);
|
|
2511
|
+
};
|
|
2512
|
+
});
|
|
2513
|
+
return {
|
|
2514
|
+
get positionReady() {
|
|
2515
|
+
return $5.get(positionReady);
|
|
2516
|
+
},
|
|
2517
|
+
get positionStyle() {
|
|
2518
|
+
return $5.get(positionStyle);
|
|
2519
|
+
},
|
|
2520
|
+
get resolvedPlacement() {
|
|
2521
|
+
return $5.get(resolvedPlacement);
|
|
2522
|
+
},
|
|
2523
|
+
get arrowStyle() {
|
|
2524
|
+
return $5.get(arrowStyle);
|
|
2525
|
+
}
|
|
2526
|
+
};
|
|
2527
|
+
}
|
|
2528
|
+
|
|
2529
|
+
// src/components/_internal/create-command-list-state.svelte.ts
|
|
2530
|
+
import * as $6 from "svelte/internal/client";
|
|
2531
|
+
|
|
2532
|
+
// src/utilities/document-order.ts
|
|
2533
|
+
var DOCUMENT_POSITION_PRECEDING = 2;
|
|
2534
|
+
var DOCUMENT_POSITION_FOLLOWING = 4;
|
|
2535
|
+
function inDocumentOrder(items) {
|
|
2536
|
+
const sortedItems = [...items];
|
|
2537
|
+
sortedItems.sort((a, b) => {
|
|
2538
|
+
if (a.node === b.node)
|
|
2539
|
+
return 0;
|
|
2540
|
+
const position = a.node.compareDocumentPosition(b.node);
|
|
2541
|
+
if (position & DOCUMENT_POSITION_FOLLOWING)
|
|
2542
|
+
return -1;
|
|
2543
|
+
if (position & DOCUMENT_POSITION_PRECEDING)
|
|
2544
|
+
return 1;
|
|
2545
|
+
return 0;
|
|
2546
|
+
});
|
|
2547
|
+
return sortedItems;
|
|
2548
|
+
}
|
|
2549
|
+
|
|
2550
|
+
// src/components/_internal/create-command-list-state.svelte.ts
|
|
2551
|
+
class CommandListState {
|
|
2552
|
+
#getListboxId;
|
|
2553
|
+
#registeredListboxId = $6.state("");
|
|
2554
|
+
#registrations = $6.state($6.proxy([]));
|
|
2555
|
+
get registrations() {
|
|
2556
|
+
return $6.get(this.#registrations);
|
|
2557
|
+
}
|
|
2558
|
+
set registrations(value) {
|
|
2559
|
+
$6.set(this.#registrations, value, true);
|
|
2560
|
+
}
|
|
2561
|
+
#registrationsReady = $6.state(false);
|
|
2562
|
+
get registrationsReady() {
|
|
2563
|
+
return $6.get(this.#registrationsReady);
|
|
2564
|
+
}
|
|
2565
|
+
set registrationsReady(value) {
|
|
2566
|
+
$6.set(this.#registrationsReady, value, true);
|
|
2567
|
+
}
|
|
2568
|
+
#itemCounter = 0;
|
|
2569
|
+
#readyCycle = 0;
|
|
2570
|
+
#intendedActiveId = $6.state(null);
|
|
2571
|
+
#enabledIds = $6.derived(() => {
|
|
2572
|
+
return inDocumentOrder(this.registrations).filter((registration) => !registration.getDisabled()).map((registration) => registration.id);
|
|
2573
|
+
});
|
|
2574
|
+
get enabledIds() {
|
|
2575
|
+
return $6.get(this.#enabledIds);
|
|
2576
|
+
}
|
|
2577
|
+
set enabledIds(value) {
|
|
2578
|
+
$6.set(this.#enabledIds, value);
|
|
2579
|
+
}
|
|
2580
|
+
#activeItemId = $6.derived(() => $6.get(this.#intendedActiveId) !== null && this.enabledIds.includes($6.get(this.#intendedActiveId)) ? $6.get(this.#intendedActiveId) : this.enabledIds[0] ?? null);
|
|
2581
|
+
get activeItemId() {
|
|
2582
|
+
return $6.get(this.#activeItemId);
|
|
2583
|
+
}
|
|
2584
|
+
set activeItemId(value) {
|
|
2585
|
+
$6.set(this.#activeItemId, value);
|
|
2586
|
+
}
|
|
2587
|
+
constructor(listboxId) {
|
|
2588
|
+
this.#getListboxId = typeof listboxId === "function" ? listboxId : () => listboxId;
|
|
2589
|
+
$6.set(this.#registeredListboxId, this.#getListboxId(), true);
|
|
2590
|
+
}
|
|
2591
|
+
get listboxId() {
|
|
2592
|
+
return $6.get(this.#registeredListboxId);
|
|
2593
|
+
}
|
|
2594
|
+
syncListboxId(nextListboxId = this.#getListboxId()) {
|
|
2595
|
+
const listboxId = nextListboxId;
|
|
2596
|
+
if ($6.get(this.#registeredListboxId) === listboxId)
|
|
2597
|
+
return;
|
|
2598
|
+
$6.set(this.#registeredListboxId, listboxId, true);
|
|
2599
|
+
$6.set(this.#intendedActiveId, null);
|
|
2600
|
+
this.registrations = this.registrations.map((registration, index) => ({
|
|
2601
|
+
...registration,
|
|
2602
|
+
id: updateRegistrationHandleId(registration, `${listboxId}-item-${index + 1}`)
|
|
2603
|
+
}));
|
|
2604
|
+
this.#itemCounter = this.registrations.length;
|
|
2605
|
+
this.refreshRegistrationsReady();
|
|
2606
|
+
}
|
|
2607
|
+
resetActiveItem() {
|
|
2608
|
+
$6.set(this.#intendedActiveId, null);
|
|
2609
|
+
}
|
|
2610
|
+
refreshRegistrationsReady() {
|
|
2611
|
+
this.registrationsReady = false;
|
|
2612
|
+
const cycle = ++this.#readyCycle;
|
|
2613
|
+
queueMicrotask(() => {
|
|
2614
|
+
if (cycle === this.#readyCycle)
|
|
2615
|
+
this.registrationsReady = true;
|
|
2616
|
+
});
|
|
2617
|
+
}
|
|
2618
|
+
scrollActiveItemIntoView() {
|
|
2619
|
+
if (this.activeItemId === null)
|
|
2620
|
+
return;
|
|
2621
|
+
const record = this.registrations.find((registration) => registration.id === this.activeItemId);
|
|
2622
|
+
record?.node.scrollIntoView({ block: "nearest" });
|
|
2623
|
+
}
|
|
2624
|
+
setActiveById(id) {
|
|
2625
|
+
$6.set(this.#intendedActiveId, id, true);
|
|
2626
|
+
}
|
|
2627
|
+
register(input, node) {
|
|
2628
|
+
this.syncListboxId();
|
|
2629
|
+
const id = `${this.listboxId}-item-${++this.#itemCounter}`;
|
|
2630
|
+
const handle = $6.proxy({
|
|
2631
|
+
id,
|
|
2632
|
+
unregister: () => {
|
|
2633
|
+
const index = this.registrations.findIndex((registeredItem) => registeredItem.node === node);
|
|
2634
|
+
if (index !== -1)
|
|
2635
|
+
this.registrations.splice(index, 1);
|
|
2636
|
+
}
|
|
2637
|
+
});
|
|
2638
|
+
const registration = {
|
|
2639
|
+
id,
|
|
2640
|
+
node,
|
|
2641
|
+
handle,
|
|
2642
|
+
getValue: input.getValue,
|
|
2643
|
+
getOnselect: input.getOnselect,
|
|
2644
|
+
getDisabled: input.getDisabled
|
|
2645
|
+
};
|
|
2646
|
+
this.registrations.push(registration);
|
|
2647
|
+
return handle;
|
|
2648
|
+
}
|
|
2649
|
+
activateItemById(id) {
|
|
2650
|
+
const record = this.registrations.find((registration) => registration.id === id);
|
|
2651
|
+
if (!record || record.getDisabled())
|
|
2652
|
+
return null;
|
|
2653
|
+
record.getOnselect()();
|
|
2654
|
+
return record;
|
|
2655
|
+
}
|
|
2656
|
+
handleKeydown({
|
|
2657
|
+
event: event2,
|
|
2658
|
+
onEnter,
|
|
2659
|
+
onEscape,
|
|
2660
|
+
ignoreModifiedNavigation = false,
|
|
2661
|
+
preventDefaultOnEmptyEnter = false
|
|
2662
|
+
}) {
|
|
2663
|
+
if (event2.isComposing || event2.keyCode === 229)
|
|
2664
|
+
return false;
|
|
2665
|
+
const isModified = event2.altKey || event2.ctrlKey || event2.metaKey || event2.shiftKey;
|
|
2666
|
+
const ids = this.enabledIds;
|
|
2667
|
+
if (event2.key === "ArrowDown") {
|
|
2668
|
+
if (ignoreModifiedNavigation && isModified)
|
|
2669
|
+
return false;
|
|
2670
|
+
event2.preventDefault();
|
|
2671
|
+
if (ids.length === 0)
|
|
2672
|
+
return true;
|
|
2673
|
+
const index = this.activeItemId === null ? -1 : ids.indexOf(this.activeItemId);
|
|
2674
|
+
$6.set(this.#intendedActiveId, ids[(index + 1) % ids.length] ?? null, true);
|
|
2675
|
+
return true;
|
|
2676
|
+
}
|
|
2677
|
+
if (event2.key === "ArrowUp") {
|
|
2678
|
+
if (ignoreModifiedNavigation && isModified)
|
|
2679
|
+
return false;
|
|
2680
|
+
event2.preventDefault();
|
|
2681
|
+
if (ids.length === 0)
|
|
2682
|
+
return true;
|
|
2683
|
+
const index = this.activeItemId === null ? 0 : ids.indexOf(this.activeItemId);
|
|
2684
|
+
$6.set(this.#intendedActiveId, ids[index <= 0 ? ids.length - 1 : index - 1] ?? null, true);
|
|
2685
|
+
return true;
|
|
2686
|
+
}
|
|
2687
|
+
if (event2.key === "Home") {
|
|
2688
|
+
if (ignoreModifiedNavigation && isModified)
|
|
2689
|
+
return false;
|
|
2690
|
+
event2.preventDefault();
|
|
2691
|
+
$6.set(this.#intendedActiveId, ids[0] ?? null, true);
|
|
2692
|
+
return true;
|
|
2693
|
+
}
|
|
2694
|
+
if (event2.key === "End") {
|
|
2695
|
+
if (ignoreModifiedNavigation && isModified)
|
|
2696
|
+
return false;
|
|
2697
|
+
event2.preventDefault();
|
|
2698
|
+
$6.set(this.#intendedActiveId, ids[ids.length - 1] ?? null, true);
|
|
2699
|
+
return true;
|
|
2700
|
+
}
|
|
2701
|
+
if (event2.key === "Enter") {
|
|
2702
|
+
if (!onEnter)
|
|
2703
|
+
return false;
|
|
2704
|
+
if (this.activeItemId === null && !preventDefaultOnEmptyEnter)
|
|
2705
|
+
return false;
|
|
2706
|
+
event2.preventDefault();
|
|
2707
|
+
event2.stopPropagation();
|
|
2708
|
+
if (this.activeItemId === null)
|
|
2709
|
+
return true;
|
|
2710
|
+
onEnter?.(this.activeItemId);
|
|
2711
|
+
return true;
|
|
2712
|
+
}
|
|
2713
|
+
if (event2.key === "Escape" && onEscape) {
|
|
2714
|
+
event2.preventDefault();
|
|
2715
|
+
event2.stopPropagation();
|
|
2716
|
+
onEscape();
|
|
2717
|
+
return true;
|
|
2718
|
+
}
|
|
2719
|
+
return false;
|
|
2720
|
+
}
|
|
2721
|
+
createContext(activateItemById = (id) => void this.activateItemById(id)) {
|
|
2722
|
+
const getListboxId = () => this.listboxId;
|
|
2723
|
+
const getActiveItemId = () => this.activeItemId;
|
|
2724
|
+
const register = (input, node) => this.register(input, node);
|
|
2725
|
+
const setActiveById = (id) => this.setActiveById(id);
|
|
2726
|
+
return {
|
|
2727
|
+
get listboxId() {
|
|
2728
|
+
return getListboxId();
|
|
2729
|
+
},
|
|
2730
|
+
get activeItemId() {
|
|
2731
|
+
return getActiveItemId();
|
|
2732
|
+
},
|
|
2733
|
+
register,
|
|
2734
|
+
setActiveById,
|
|
2735
|
+
activateItemById
|
|
2736
|
+
};
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2739
|
+
function createCommandListState(listboxId) {
|
|
2740
|
+
return new CommandListState(listboxId);
|
|
2741
|
+
}
|
|
2742
|
+
function updateRegistrationHandleId(registration, id) {
|
|
2743
|
+
registration.handle.id = id;
|
|
2744
|
+
return id;
|
|
2745
|
+
}
|
|
2746
|
+
|
|
2747
|
+
// src/components/command-menu/command-menu-trigger.ts
|
|
2748
|
+
function isSingleNonWhitespaceCodePoint(value) {
|
|
2749
|
+
return Array.from(value).length === 1 && !/\s/u.test(value);
|
|
2750
|
+
}
|
|
2751
|
+
function detectTrigger({
|
|
2752
|
+
text,
|
|
2753
|
+
selectionStart,
|
|
2754
|
+
selectionEnd,
|
|
2755
|
+
triggerChar = "/"
|
|
2756
|
+
}) {
|
|
2757
|
+
if (selectionStart !== selectionEnd)
|
|
2758
|
+
return null;
|
|
2759
|
+
if (!isSingleNonWhitespaceCodePoint(triggerChar))
|
|
2760
|
+
return null;
|
|
2761
|
+
const caretIndex = Math.max(0, Math.min(selectionEnd, text.length));
|
|
2762
|
+
if (caretIndex === 0)
|
|
2763
|
+
return null;
|
|
2764
|
+
const triggerStart = text.lastIndexOf(triggerChar, caretIndex - 1);
|
|
2765
|
+
if (triggerStart < 0)
|
|
2766
|
+
return null;
|
|
2767
|
+
const beforeTrigger = triggerStart === 0 ? "" : text[triggerStart - 1];
|
|
2768
|
+
if (beforeTrigger && !/\s/u.test(beforeTrigger))
|
|
2769
|
+
return null;
|
|
2770
|
+
const query = text.slice(triggerStart + triggerChar.length, caretIndex);
|
|
2771
|
+
if (/\s/u.test(query))
|
|
2772
|
+
return null;
|
|
2773
|
+
return {
|
|
2774
|
+
active: true,
|
|
2775
|
+
query,
|
|
2776
|
+
start: triggerStart,
|
|
2777
|
+
end: caretIndex
|
|
2778
|
+
};
|
|
2779
|
+
}
|
|
2780
|
+
|
|
2781
|
+
// src/components/command-menu/command-menu.svelte
|
|
2782
|
+
var root3 = $7.from_html(`<div class="cinder-command-menu__empty" role="status"><!></div>`);
|
|
2783
|
+
var root_12 = $7.from_html(`<div><ul role="listbox" class="cinder-command-menu__listbox"><!></ul> <!></div>`);
|
|
2784
|
+
function Command_menu($$anchor, $$props) {
|
|
2785
|
+
const fallbackListboxId = $7.props_id();
|
|
2786
|
+
$7.push($$props, true);
|
|
2787
|
+
let listboxId = $7.prop($$props, "listboxId", 3, fallbackListboxId), open = $7.prop($$props, "open", 15, false), query = $7.prop($$props, "query", 11, ""), placement = $7.prop($$props, "placement", 3, "bottom-start"), offset3 = $7.prop($$props, "offset", 3, 6), label = $7.prop($$props, "label", 3, "Commands");
|
|
2788
|
+
const portalAttachment = createPortalAttachment({
|
|
2789
|
+
target: () => document.body,
|
|
2790
|
+
inheritAttributes: true,
|
|
2791
|
+
source: () => $$props.anchor
|
|
2792
|
+
});
|
|
2793
|
+
let mounted = $7.state(false);
|
|
2794
|
+
let listElement = $7.state(undefined);
|
|
2795
|
+
const commandList = createCommandListState(() => listboxId());
|
|
2796
|
+
const showEmpty = $7.derived(() => $7.get(mounted) && open() && commandList.registrationsReady && commandList.registrations.length === 0);
|
|
2797
|
+
const caretAnchor = $7.derived(() => {
|
|
2798
|
+
const anchorElement = $$props.anchor;
|
|
2799
|
+
const currentCaretIndex = $$props.caretIndex;
|
|
2800
|
+
if (!anchorElement)
|
|
2801
|
+
return null;
|
|
2802
|
+
return {
|
|
2803
|
+
getBoundingClientRect() {
|
|
2804
|
+
return getCaretRect(anchorElement, currentCaretIndex) ?? anchorElement.getBoundingClientRect();
|
|
2805
|
+
}
|
|
2806
|
+
};
|
|
2807
|
+
});
|
|
2808
|
+
const anchoredOverlay = createAnchoredOverlay({
|
|
2809
|
+
open: () => open(),
|
|
2810
|
+
anchor: () => $7.get(caretAnchor),
|
|
2811
|
+
panel: () => $7.get(listElement),
|
|
2812
|
+
placement: () => placement(),
|
|
2813
|
+
offset: () => offset3(),
|
|
2814
|
+
widthMode: () => "content"
|
|
2815
|
+
});
|
|
2816
|
+
$7.user_effect(() => {
|
|
2817
|
+
$7.set(mounted, true);
|
|
2818
|
+
});
|
|
2819
|
+
$7.user_effect(() => {
|
|
2820
|
+
commandList.syncListboxId(listboxId());
|
|
2821
|
+
});
|
|
2822
|
+
$7.user_effect(() => {
|
|
2823
|
+
if (!open()) {
|
|
2824
|
+
commandList.resetActiveItem();
|
|
2825
|
+
return;
|
|
2826
|
+
}
|
|
2827
|
+
});
|
|
2828
|
+
$7.user_effect(() => {
|
|
2829
|
+
query();
|
|
2830
|
+
commandList.refreshRegistrationsReady();
|
|
2831
|
+
});
|
|
2832
|
+
$7.user_effect(() => {
|
|
2833
|
+
$$props.onstatechange?.({
|
|
2834
|
+
listboxId: commandList.listboxId,
|
|
2835
|
+
activeItemId: open() ? commandList.activeItemId : null
|
|
2836
|
+
});
|
|
2837
|
+
});
|
|
2838
|
+
$7.user_effect(() => {
|
|
2839
|
+
commandList.scrollActiveItemIntoView();
|
|
2840
|
+
});
|
|
2841
|
+
function activateItemById(id) {
|
|
2842
|
+
const record = commandList.activateItemById(id);
|
|
2843
|
+
if (!record)
|
|
2844
|
+
return;
|
|
2845
|
+
$$props.onselect?.({ value: record.getValue(), query: query() });
|
|
2846
|
+
}
|
|
2847
|
+
setCommandListContext(commandList.createContext(activateItemById));
|
|
2848
|
+
function dismiss() {
|
|
2849
|
+
if (!open())
|
|
2850
|
+
return;
|
|
2851
|
+
open(false);
|
|
2852
|
+
$$props.ondismiss?.();
|
|
2853
|
+
}
|
|
2854
|
+
function handleKeydown(event2) {
|
|
2855
|
+
if (!open())
|
|
2856
|
+
return;
|
|
2857
|
+
commandList.handleKeydown({
|
|
2858
|
+
event: event2,
|
|
2859
|
+
onEnter: activateItemById,
|
|
2860
|
+
onEscape: dismiss,
|
|
2861
|
+
ignoreModifiedNavigation: true
|
|
2862
|
+
});
|
|
2863
|
+
}
|
|
2864
|
+
function handleDocumentPointerdown(event2) {
|
|
2865
|
+
const target = event2.target;
|
|
2866
|
+
if (!(target instanceof Node))
|
|
2867
|
+
return;
|
|
2868
|
+
if ($$props.anchor?.contains(target))
|
|
2869
|
+
return;
|
|
2870
|
+
if ($7.get(listElement)?.contains(target))
|
|
2871
|
+
return;
|
|
2872
|
+
dismiss();
|
|
2873
|
+
}
|
|
2874
|
+
$7.user_effect(() => {
|
|
2875
|
+
if (!open() || !$$props.anchor)
|
|
2876
|
+
return;
|
|
2877
|
+
const stopKeydown = on($$props.anchor, "keydown", handleKeydown);
|
|
2878
|
+
const stopPointerdown = on(document, "pointerdown", handleDocumentPointerdown, { capture: true });
|
|
2879
|
+
return () => {
|
|
2880
|
+
stopKeydown();
|
|
2881
|
+
stopPointerdown();
|
|
2882
|
+
};
|
|
2883
|
+
});
|
|
2884
|
+
var fragment = $7.comment();
|
|
2885
|
+
var node = $7.first_child(fragment);
|
|
2886
|
+
{
|
|
2887
|
+
var consequent_1 = ($$anchor2) => {
|
|
2888
|
+
var div = root_12();
|
|
2889
|
+
var ul = $7.child(div);
|
|
2890
|
+
var node_1 = $7.child(ul);
|
|
2891
|
+
$7.snippet(node_1, () => $$props.items, () => ({ query: query() }));
|
|
2892
|
+
$7.reset(ul);
|
|
2893
|
+
var node_2 = $7.sibling(ul, 2);
|
|
2894
|
+
{
|
|
2895
|
+
var consequent = ($$anchor3) => {
|
|
2896
|
+
var div_1 = root3();
|
|
2897
|
+
var node_3 = $7.child(div_1);
|
|
2898
|
+
$7.snippet(node_3, () => $$props.empty);
|
|
2899
|
+
$7.reset(div_1);
|
|
2900
|
+
$7.append($$anchor3, div_1);
|
|
2901
|
+
};
|
|
2902
|
+
$7.if(node_2, ($$render) => {
|
|
2903
|
+
if ($7.get(showEmpty) && $$props.empty)
|
|
2904
|
+
$$render(consequent);
|
|
2905
|
+
});
|
|
2906
|
+
}
|
|
2907
|
+
$7.reset(div);
|
|
2908
|
+
$7.bind_this(div, ($$value) => $7.set(listElement, $$value), () => $7.get(listElement));
|
|
2909
|
+
$7.attach(div, () => portalAttachment);
|
|
2910
|
+
$7.template_effect(($0) => {
|
|
2911
|
+
$7.set_attribute(div, "aria-hidden", anchoredOverlay.positionReady ? undefined : "true");
|
|
2912
|
+
$7.set_class(div, 1, $0);
|
|
2913
|
+
$7.set_attribute(div, "data-cinder-position-ready", anchoredOverlay.positionReady);
|
|
2914
|
+
$7.set_style(div, anchoredOverlay.positionStyle);
|
|
2915
|
+
$7.set_attribute(ul, "id", commandList.listboxId);
|
|
2916
|
+
$7.set_attribute(ul, "aria-label", label());
|
|
2917
|
+
}, [
|
|
2918
|
+
() => $7.clsx(classNames("cinder-_floating-surface", "cinder-command-menu", $$props.class))
|
|
2919
|
+
]);
|
|
2920
|
+
$7.append($$anchor2, div);
|
|
2921
|
+
};
|
|
2922
|
+
$7.if(node, ($$render) => {
|
|
2923
|
+
if ($7.get(mounted) && open() && $$props.anchor)
|
|
2924
|
+
$$render(consequent_1);
|
|
2925
|
+
});
|
|
2926
|
+
}
|
|
2927
|
+
$7.append($$anchor, fragment);
|
|
2928
|
+
$7.pop();
|
|
2929
|
+
}
|
|
2930
|
+
|
|
2931
|
+
// src/components/chat-composer-popover/chat-composer-popover.svelte
|
|
2932
|
+
import { onDestroy } from "svelte";
|
|
2933
|
+
|
|
2934
|
+
// src/components/chat-composer-popover/chat-composer-popover-filter.ts
|
|
2935
|
+
function normalize(value) {
|
|
2936
|
+
return value.trim().toLowerCase();
|
|
2937
|
+
}
|
|
2938
|
+
function fuzzySubsequenceScore(candidate, query) {
|
|
2939
|
+
const normalizedCandidate = normalize(candidate);
|
|
2940
|
+
const normalizedQuery = normalize(query);
|
|
2941
|
+
if (normalizedQuery.length === 0)
|
|
2942
|
+
return 0;
|
|
2943
|
+
if (normalizedCandidate.length === 0)
|
|
2944
|
+
return null;
|
|
2945
|
+
let score = 0;
|
|
2946
|
+
let searchIndex = 0;
|
|
2947
|
+
let previousMatchIndex = -1;
|
|
2948
|
+
for (const character of normalizedQuery) {
|
|
2949
|
+
const matchIndex = normalizedCandidate.indexOf(character, searchIndex);
|
|
2950
|
+
if (matchIndex === -1)
|
|
2951
|
+
return null;
|
|
2952
|
+
score += matchIndex === previousMatchIndex + 1 ? 4 : 1;
|
|
2953
|
+
if (matchIndex === 0)
|
|
2954
|
+
score += 2;
|
|
2955
|
+
if (/[\s/_-]/u.test(normalizedCandidate[matchIndex - 1] ?? ""))
|
|
2956
|
+
score += 2;
|
|
2957
|
+
previousMatchIndex = matchIndex;
|
|
2958
|
+
searchIndex = matchIndex + 1;
|
|
2959
|
+
}
|
|
2960
|
+
return score - normalizedCandidate.length * 0.01;
|
|
2961
|
+
}
|
|
2962
|
+
function filterFuzzySubsequence(items, query) {
|
|
2963
|
+
const normalizedQuery = normalize(query);
|
|
2964
|
+
if (normalizedQuery.length === 0)
|
|
2965
|
+
return [...items];
|
|
2966
|
+
const matchedItems = items.map((item, index) => {
|
|
2967
|
+
const candidates = [item.label, item.value, ...item.keywords ?? []];
|
|
2968
|
+
let bestScore = null;
|
|
2969
|
+
for (const candidate of candidates) {
|
|
2970
|
+
const score = fuzzySubsequenceScore(candidate, normalizedQuery);
|
|
2971
|
+
if (score !== null && (bestScore === null || score > bestScore)) {
|
|
2972
|
+
bestScore = score;
|
|
2973
|
+
}
|
|
2974
|
+
}
|
|
2975
|
+
return bestScore === null ? null : { item, index, score: bestScore };
|
|
2976
|
+
}).filter((result) => result !== null);
|
|
2977
|
+
matchedItems.sort((a, b) => b.score - a.score || a.index - b.index);
|
|
2978
|
+
return matchedItems.map((result) => result.item);
|
|
2979
|
+
}
|
|
2980
|
+
|
|
2981
|
+
// src/components/chat-composer-popover/chat-composer-popover.svelte
|
|
2982
|
+
var root4 = $8.from_html(`<!> <!>`, 1);
|
|
2983
|
+
function Chat_composer_popover($$anchor, $$props) {
|
|
2984
|
+
$8.push($$props, true);
|
|
2985
|
+
let value = $8.prop($$props, "value", 15, ""), triggers = $8.prop($$props, "triggers", 19, () => ["/", "@"]), label = $8.prop($$props, "label", 3, "Composer suggestions"), placement = $8.prop($$props, "placement", 3, "bottom-start"), offset3 = $8.prop($$props, "offset", 3, 6), filter = $8.prop($$props, "filter", 3, filterFuzzySubsequence);
|
|
2986
|
+
let open = $8.state(false);
|
|
2987
|
+
let anchor = $8.state(null);
|
|
2988
|
+
let caretIndex = $8.state(0);
|
|
2989
|
+
const listboxId = $8.derived(() => `${$$props.id}-listbox`);
|
|
2990
|
+
let activeItemId = $8.state(null);
|
|
2991
|
+
let activeMatch = $8.state(null);
|
|
2992
|
+
let composerSyncTimer = null;
|
|
2993
|
+
let lastSyncedValue = $8.state($8.proxy(value()));
|
|
2994
|
+
let suppressNextValueSync = false;
|
|
2995
|
+
const emptyContent = $8.derived(() => $$props.empty);
|
|
2996
|
+
const query = $8.derived(() => $8.get(activeMatch)?.query ?? "");
|
|
2997
|
+
const trigger = $8.derived(() => $8.get(activeMatch)?.trigger ?? triggers()[0] ?? "/");
|
|
2998
|
+
const filteredItems = $8.derived(() => {
|
|
2999
|
+
if (!$8.get(activeMatch))
|
|
3000
|
+
return [];
|
|
3001
|
+
return [
|
|
3002
|
+
...filter()($$props.items, $8.get(activeMatch).query, $8.get(activeMatch).trigger)
|
|
3003
|
+
];
|
|
3004
|
+
});
|
|
3005
|
+
const composerProps = $8.derived(() => ({
|
|
3006
|
+
composerRole: "combobox",
|
|
3007
|
+
composerAriaExpanded: $8.get(open),
|
|
3008
|
+
composerAriaControls: $8.get(open) ? $8.get(listboxId) : undefined,
|
|
3009
|
+
composerAriaActiveDescendant: $8.get(open) ? $8.get(activeItemId) ?? undefined : undefined,
|
|
3010
|
+
composerAriaAutocomplete: "list",
|
|
3011
|
+
oncomposerinput: handleComposerInput,
|
|
3012
|
+
oncomposerkeydown: handleComposerKeydown,
|
|
3013
|
+
oncomposerselectionchange: handleComposerSelectionChange,
|
|
3014
|
+
oncomposerblur: handleComposerBlur
|
|
3015
|
+
}));
|
|
3016
|
+
function getComposerElement(event2) {
|
|
3017
|
+
const target = event2.currentTarget ?? event2.target;
|
|
3018
|
+
if (target instanceof HTMLTextAreaElement || target instanceof HTMLInputElement) {
|
|
3019
|
+
return target;
|
|
3020
|
+
}
|
|
3021
|
+
return null;
|
|
3022
|
+
}
|
|
3023
|
+
function findTriggerMatch(text2, selectionStart, selectionEnd) {
|
|
3024
|
+
if ($$props.detectTrigger)
|
|
3025
|
+
return $$props.detectTrigger(text2, selectionStart, selectionEnd);
|
|
3026
|
+
for (const triggerChar of triggers()) {
|
|
3027
|
+
const match = detectTrigger({ text: text2, selectionStart, selectionEnd, triggerChar });
|
|
3028
|
+
if (match) {
|
|
3029
|
+
return { ...match, trigger: triggerChar };
|
|
3030
|
+
}
|
|
3031
|
+
}
|
|
3032
|
+
return null;
|
|
3033
|
+
}
|
|
3034
|
+
function updateFromComposer(composerElement, nextValue) {
|
|
3035
|
+
if (composerElement)
|
|
3036
|
+
$8.set(anchor, composerElement, true);
|
|
3037
|
+
const selectionStart = composerElement?.selectionStart ?? nextValue.length;
|
|
3038
|
+
const selectionEnd = composerElement?.selectionEnd ?? selectionStart;
|
|
3039
|
+
$8.set(lastSyncedValue, nextValue, true);
|
|
3040
|
+
value(nextValue);
|
|
3041
|
+
$8.set(caretIndex, selectionEnd, true);
|
|
3042
|
+
$8.set(activeMatch, findTriggerMatch(nextValue, selectionStart, selectionEnd), true);
|
|
3043
|
+
const wasOpen = $8.get(open);
|
|
3044
|
+
$8.set(open, $8.get(activeMatch) !== null && $8.get(anchor) !== null, true);
|
|
3045
|
+
if (!$8.get(open)) {
|
|
3046
|
+
$8.set(activeItemId, null);
|
|
3047
|
+
if (wasOpen)
|
|
3048
|
+
$$props.ondismiss?.();
|
|
3049
|
+
}
|
|
3050
|
+
}
|
|
3051
|
+
function dismiss({ restoreFocus = true } = {}) {
|
|
3052
|
+
if (!$8.get(open) && !$8.get(activeMatch) && !$8.get(activeItemId))
|
|
3053
|
+
return;
|
|
3054
|
+
clearComposerSyncTimer();
|
|
3055
|
+
$8.set(open, false);
|
|
3056
|
+
$8.set(activeItemId, null);
|
|
3057
|
+
$8.set(activeMatch, null);
|
|
3058
|
+
if (restoreFocus)
|
|
3059
|
+
$8.get(anchor)?.focus();
|
|
3060
|
+
$$props.ondismiss?.();
|
|
3061
|
+
}
|
|
3062
|
+
function handleComposerInput(nextValue, event2) {
|
|
3063
|
+
suppressNextValueSync = false;
|
|
3064
|
+
updateFromComposer(event2 ? getComposerElement(event2) : $8.get(anchor), nextValue);
|
|
3065
|
+
}
|
|
3066
|
+
function handleComposerSelectionChange(event2) {
|
|
3067
|
+
suppressNextValueSync = false;
|
|
3068
|
+
const composerElement = getComposerElement(event2);
|
|
3069
|
+
if (!composerElement)
|
|
3070
|
+
return;
|
|
3071
|
+
syncComposerSelectionAfterNativeNavigation(composerElement);
|
|
3072
|
+
}
|
|
3073
|
+
function handleComposerBlur(event2) {
|
|
3074
|
+
if (event2.currentTarget === $8.get(anchor)) {
|
|
3075
|
+
dismiss({ restoreFocus: false });
|
|
3076
|
+
}
|
|
3077
|
+
}
|
|
3078
|
+
function syncComposerSelectionAfterNativeNavigation(composerElement) {
|
|
3079
|
+
clearComposerSyncTimer();
|
|
3080
|
+
composerSyncTimer = setTimeout(() => {
|
|
3081
|
+
composerSyncTimer = null;
|
|
3082
|
+
updateFromComposer(composerElement, composerElement.value);
|
|
3083
|
+
}, 0);
|
|
3084
|
+
}
|
|
3085
|
+
function clearComposerSyncTimer() {
|
|
3086
|
+
if (composerSyncTimer === null)
|
|
3087
|
+
return;
|
|
3088
|
+
clearTimeout(composerSyncTimer);
|
|
3089
|
+
composerSyncTimer = null;
|
|
3090
|
+
}
|
|
3091
|
+
function handleComposerKeydown(event2) {
|
|
3092
|
+
const composerElement = event2.currentTarget instanceof HTMLTextAreaElement || event2.currentTarget instanceof HTMLInputElement ? event2.currentTarget : null;
|
|
3093
|
+
if (composerElement) {
|
|
3094
|
+
$8.set(anchor, composerElement, true);
|
|
3095
|
+
$8.set(caretIndex, composerElement.selectionEnd ?? value().length, true);
|
|
3096
|
+
}
|
|
3097
|
+
if (!$8.get(open) || event2.isComposing || event2.keyCode === 229)
|
|
3098
|
+
return;
|
|
3099
|
+
if (event2.key === "Escape") {
|
|
3100
|
+
event2.preventDefault();
|
|
3101
|
+
event2.stopPropagation();
|
|
3102
|
+
dismiss();
|
|
3103
|
+
return;
|
|
3104
|
+
}
|
|
3105
|
+
const isNavigationKey = event2.key === "ArrowDown" || event2.key === "ArrowUp" || event2.key === "ArrowLeft" || event2.key === "ArrowRight" || event2.key === "Home" || event2.key === "End";
|
|
3106
|
+
const isMenuNavigationKey = event2.key === "ArrowDown" || event2.key === "ArrowUp" || event2.key === "Home" || event2.key === "End";
|
|
3107
|
+
const isModifiedNavigation = isNavigationKey && (event2.altKey || event2.ctrlKey || event2.metaKey || event2.shiftKey);
|
|
3108
|
+
if (isMenuNavigationKey && !isModifiedNavigation || event2.key === "Enter" && $8.get(activeItemId)) {
|
|
3109
|
+
event2.preventDefault();
|
|
3110
|
+
}
|
|
3111
|
+
if (composerElement && isNavigationKey && (isModifiedNavigation || !isMenuNavigationKey)) {
|
|
3112
|
+
syncComposerSelectionAfterNativeNavigation(composerElement);
|
|
3113
|
+
}
|
|
3114
|
+
}
|
|
3115
|
+
onDestroy(() => {
|
|
3116
|
+
clearComposerSyncTimer();
|
|
3117
|
+
});
|
|
3118
|
+
$8.user_effect(() => {
|
|
3119
|
+
if (value() === $8.get(lastSyncedValue))
|
|
3120
|
+
return;
|
|
3121
|
+
if (suppressNextValueSync) {
|
|
3122
|
+
suppressNextValueSync = false;
|
|
3123
|
+
$8.set(lastSyncedValue, value(), true);
|
|
3124
|
+
return;
|
|
3125
|
+
}
|
|
3126
|
+
updateFromComposer($8.get(anchor), value());
|
|
3127
|
+
});
|
|
3128
|
+
function handleStateChange(state7) {
|
|
3129
|
+
$8.set(activeItemId, state7.activeItemId, true);
|
|
3130
|
+
}
|
|
3131
|
+
function handleSelect(selection) {
|
|
3132
|
+
const selectedItem = $8.get(filteredItems).find((candidate) => candidate.value === selection.value);
|
|
3133
|
+
if (!selectedItem || !$8.get(activeMatch))
|
|
3134
|
+
return;
|
|
3135
|
+
const detail = {
|
|
3136
|
+
item: selectedItem,
|
|
3137
|
+
value: selection.value,
|
|
3138
|
+
query: $8.get(activeMatch).query,
|
|
3139
|
+
trigger: $8.get(activeMatch).trigger,
|
|
3140
|
+
range: { start: $8.get(activeMatch).start, end: $8.get(activeMatch).end }
|
|
3141
|
+
};
|
|
3142
|
+
$8.set(open, false);
|
|
3143
|
+
$8.set(activeItemId, null);
|
|
3144
|
+
$8.set(activeMatch, null);
|
|
3145
|
+
$8.get(anchor)?.focus();
|
|
3146
|
+
suppressNextValueSync = true;
|
|
3147
|
+
queueMicrotask(() => {
|
|
3148
|
+
suppressNextValueSync = false;
|
|
3149
|
+
});
|
|
3150
|
+
$$props.onselect?.(detail);
|
|
3151
|
+
}
|
|
3152
|
+
var fragment = root4();
|
|
3153
|
+
var node = $8.first_child(fragment);
|
|
3154
|
+
$8.snippet(node, () => $$props.composer, () => $8.get(composerProps));
|
|
3155
|
+
var node_1 = $8.sibling(node, 2);
|
|
3156
|
+
{
|
|
3157
|
+
const items = ($$anchor2) => {
|
|
3158
|
+
var fragment_1 = $8.comment();
|
|
3159
|
+
var node_2 = $8.first_child(fragment_1);
|
|
3160
|
+
$8.each(node_2, 17, () => $8.get(filteredItems), (command) => command.value, ($$anchor3, command) => {
|
|
3161
|
+
{
|
|
3162
|
+
let $0 = $8.derived(() => $8.get(command).disabled === true);
|
|
3163
|
+
let $1 = $8.derived(() => $$props.item ? "" : $8.get(command).description ?? "");
|
|
3164
|
+
let $22 = $8.derived(() => $8.get(command).description ? `${$8.get(command).label}, ${$8.get(command).description}` : $8.get(command).label);
|
|
3165
|
+
Command_item($$anchor3, {
|
|
3166
|
+
get value() {
|
|
3167
|
+
return $8.get(command).value;
|
|
3168
|
+
},
|
|
3169
|
+
get disabled() {
|
|
3170
|
+
return $8.get($0);
|
|
3171
|
+
},
|
|
3172
|
+
get description() {
|
|
3173
|
+
return $8.get($1);
|
|
3174
|
+
},
|
|
3175
|
+
get accessibleLabel() {
|
|
3176
|
+
return $8.get($22);
|
|
3177
|
+
},
|
|
3178
|
+
selectionMode: "parent",
|
|
3179
|
+
children: ($$anchor4, $$slotProps) => {
|
|
3180
|
+
var fragment_3 = $8.comment();
|
|
3181
|
+
var node_3 = $8.first_child(fragment_3);
|
|
3182
|
+
{
|
|
3183
|
+
var consequent = ($$anchor5) => {
|
|
3184
|
+
var fragment_4 = $8.comment();
|
|
3185
|
+
var node_4 = $8.first_child(fragment_4);
|
|
3186
|
+
$8.snippet(node_4, () => $$props.item, () => ({
|
|
3187
|
+
item: $8.get(command),
|
|
3188
|
+
query: $8.get(query),
|
|
3189
|
+
trigger: $8.get(trigger)
|
|
3190
|
+
}));
|
|
3191
|
+
$8.append($$anchor5, fragment_4);
|
|
3192
|
+
};
|
|
3193
|
+
var alternate = ($$anchor5) => {
|
|
3194
|
+
var text_1 = $8.text();
|
|
3195
|
+
$8.template_effect(() => $8.set_text(text_1, $8.get(command).label));
|
|
3196
|
+
$8.append($$anchor5, text_1);
|
|
3197
|
+
};
|
|
3198
|
+
$8.if(node_3, ($$render) => {
|
|
3199
|
+
if ($$props.item)
|
|
3200
|
+
$$render(consequent);
|
|
3201
|
+
else
|
|
3202
|
+
$$render(alternate, -1);
|
|
3203
|
+
});
|
|
3204
|
+
}
|
|
3205
|
+
$8.append($$anchor4, fragment_3);
|
|
3206
|
+
},
|
|
3207
|
+
$$slots: { default: true }
|
|
3208
|
+
});
|
|
3209
|
+
}
|
|
3210
|
+
});
|
|
3211
|
+
$8.append($$anchor2, fragment_1);
|
|
3212
|
+
};
|
|
3213
|
+
const empty = ($$anchor2) => {
|
|
3214
|
+
var fragment_6 = $8.comment();
|
|
3215
|
+
var node_5 = $8.first_child(fragment_6);
|
|
3216
|
+
{
|
|
3217
|
+
var consequent_1 = ($$anchor3) => {
|
|
3218
|
+
var fragment_7 = $8.comment();
|
|
3219
|
+
var node_6 = $8.first_child(fragment_7);
|
|
3220
|
+
$8.snippet(node_6, () => $8.get(emptyContent));
|
|
3221
|
+
$8.append($$anchor3, fragment_7);
|
|
3222
|
+
};
|
|
3223
|
+
var alternate_1 = ($$anchor3) => {
|
|
3224
|
+
var text_2 = $8.text("No suggestions");
|
|
3225
|
+
$8.append($$anchor3, text_2);
|
|
3226
|
+
};
|
|
3227
|
+
$8.if(node_5, ($$render) => {
|
|
3228
|
+
if ($8.get(emptyContent))
|
|
3229
|
+
$$render(consequent_1);
|
|
3230
|
+
else
|
|
3231
|
+
$$render(alternate_1, -1);
|
|
3232
|
+
});
|
|
3233
|
+
}
|
|
3234
|
+
$8.append($$anchor2, fragment_6);
|
|
3235
|
+
};
|
|
3236
|
+
Command_menu(node_1, {
|
|
3237
|
+
get anchor() {
|
|
3238
|
+
return $8.get(anchor);
|
|
3239
|
+
},
|
|
3240
|
+
get caretIndex() {
|
|
3241
|
+
return $8.get(caretIndex);
|
|
3242
|
+
},
|
|
3243
|
+
get query() {
|
|
3244
|
+
return $8.get(query);
|
|
3245
|
+
},
|
|
3246
|
+
get placement() {
|
|
3247
|
+
return placement();
|
|
3248
|
+
},
|
|
3249
|
+
get offset() {
|
|
3250
|
+
return offset3();
|
|
3251
|
+
},
|
|
3252
|
+
get label() {
|
|
3253
|
+
return label();
|
|
3254
|
+
},
|
|
3255
|
+
get listboxId() {
|
|
3256
|
+
return $8.get(listboxId);
|
|
3257
|
+
},
|
|
3258
|
+
onselect: handleSelect,
|
|
3259
|
+
ondismiss: () => dismiss({ restoreFocus: false }),
|
|
3260
|
+
onstatechange: handleStateChange,
|
|
3261
|
+
get open() {
|
|
3262
|
+
return $8.get(open);
|
|
3263
|
+
},
|
|
3264
|
+
set open($$value) {
|
|
3265
|
+
$8.set(open, $$value, true);
|
|
3266
|
+
},
|
|
3267
|
+
items,
|
|
3268
|
+
empty,
|
|
3269
|
+
$$slots: { items: true, empty: true }
|
|
3270
|
+
});
|
|
3271
|
+
}
|
|
3272
|
+
$8.append($$anchor, fragment);
|
|
3273
|
+
$8.pop();
|
|
3274
|
+
}
|
|
3275
|
+
|
|
3276
|
+
// src/components/chat-composer-popover/index.ts
|
|
3277
|
+
var chat_composer_popover_default = Chat_composer_popover;
|
|
3278
|
+
export {
|
|
3279
|
+
fuzzySubsequenceScore,
|
|
3280
|
+
filterFuzzySubsequence,
|
|
3281
|
+
chat_composer_popover_default as default,
|
|
3282
|
+
Chat_composer_popover as ChatComposerPopover
|
|
3283
|
+
};
|
|
3284
|
+
|
|
3285
|
+
//# debugId=ECD95A7ABDFB684364756E2164756E21
|