@lostgradient/cinder 0.20.0 → 0.21.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 +162 -0
- package/components.json +1 -1
- package/dist/components/alert-dialog/index.js +481 -162
- package/dist/components/approval-card/approval-card.css +3 -0
- package/dist/components/approval-card/index.js +402 -119
- package/dist/components/area-chart/index.js +252 -1
- package/dist/components/autocomplete/index.js +124 -40
- package/dist/components/avatar-group/index.js +185 -81
- package/dist/components/bar-chart/index.js +252 -1
- package/dist/components/button/button.css +13 -3
- package/dist/components/calendar/calendar.css +3 -0
- package/dist/components/carousel/carousel.css +40 -6
- package/dist/components/carousel/carousel.schema.js +43 -2
- package/dist/components/carousel/carousel.svelte.d.ts +25 -4
- package/dist/components/carousel/carousel.types.d.ts +43 -2
- package/dist/components/carousel/carousel.variables.js +7 -2
- package/dist/components/carousel/index.d.ts +1 -1
- package/dist/components/carousel/index.js +2018 -351
- package/dist/components/checkbox/checkbox.css +1 -1
- package/dist/components/checkbox-group/checkbox-group.css +1 -1
- package/dist/components/chip/chip.css +3 -0
- package/dist/components/code-block/code-block.css +35 -2
- package/dist/components/code-block/code-block.schema.js +9 -1
- package/dist/components/code-block/code-block.types.d.ts +8 -0
- package/dist/components/code-block/index.js +263 -4
- package/dist/components/color-field/color-field.css +1 -1
- package/dist/components/color-picker/color-picker.css +1 -1
- package/dist/components/combobox/combobox.css +4 -1
- package/dist/components/combobox/index.js +124 -40
- package/dist/components/command-menu/index.js +20 -17
- package/dist/components/confirm-dialog/index.js +497 -178
- package/dist/components/connection-indicator/connection-indicator.css +3 -2
- package/dist/components/context-menu/index.js +124 -40
- package/dist/components/copy-button/copy-button.css +4 -1
- package/dist/components/data-grid/data-grid.css +3 -0
- package/dist/components/data-table/index.js +252 -1
- package/dist/components/date-picker/date-picker.css +1 -1
- package/dist/components/date-picker/index.js +124 -40
- package/dist/components/date-range-field/date-range-field.css +7 -1
- package/dist/components/date-range-field/index.js +124 -40
- package/dist/components/diff-statistics/diff-statistics.css +2 -2
- package/dist/components/drawer/drawer.css +20 -12
- package/dist/components/drawer/index.js +106 -25
- package/dist/components/dropdown/dropdown.css +1 -1
- package/dist/components/dropdown/index.js +124 -40
- package/dist/components/dropdown-menu/index.js +20 -17
- package/dist/components/event-stream-viewer/event-stream-viewer.css +29 -4
- package/dist/components/event-stream-viewer/event-stream-viewer.variables.js +5 -2
- package/dist/components/event-timeline/event-timeline.css +3 -0
- package/dist/components/event-timeline/index.js +124 -40
- package/dist/components/focus-trap/index.js +105 -24
- package/dist/components/form-field/form-field.css +1 -1
- package/dist/components/hover-card/hover-card.css +45 -1
- package/dist/components/hover-card/index.js +144 -19
- package/dist/components/inline-loading/inline-loading.css +2 -2
- package/dist/components/input/input.css +1 -1
- package/dist/components/invocation-rule-builder/index.js +124 -40
- package/dist/components/invocation-rule-builder/invocation-rule-builder.css +18 -0
- package/dist/components/json-editor/json-editor.css +4 -1
- package/dist/components/json-schema-editor/index.js +152 -68
- package/dist/components/json-viewer/json-viewer.css +5 -2
- package/dist/components/kanban-board/index.js +2 -2
- package/dist/components/kanban-board/kanban-board.css +1 -1
- package/dist/components/line-chart/index.js +252 -1
- package/dist/components/marquee/marquee.css +3 -0
- package/dist/components/matrix-chart/index.js +252 -1
- package/dist/components/menu-bar/index.js +20 -17
- package/dist/components/menu-bar/menu-bar.css +3 -0
- package/dist/components/meter/index.js +13 -3
- package/dist/components/modal/index.js +447 -130
- package/dist/components/modal/modal.css +56 -24
- package/dist/components/multi-select/index.js +3553 -467
- package/dist/components/multi-select/multi-select.css +4 -10
- package/dist/components/navigation-bar/index.js +20 -17
- package/dist/components/navigation-item/navigation-item.css +3 -0
- package/dist/components/pagination/pagination.css +3 -0
- package/dist/components/permission-matrix/index.js +252 -1
- package/dist/components/permission-matrix/permission-matrix.css +15 -0
- package/dist/components/phone-input/phone-input.css +1 -1
- package/dist/components/pin-input/pin-input.css +10 -2
- package/dist/components/popover/index.js +124 -40
- package/dist/components/qr-code/qr-code.css +1 -1
- package/dist/components/radio-group/radio-group.css +1 -1
- package/dist/components/rating/rating.css +1 -1
- package/dist/components/schema-form/schema-form.css +1 -1
- package/dist/components/scroll-area/index.js +526 -22
- package/dist/components/scroll-area/scroll-area.css +30 -0
- package/dist/components/scroll-area/scroll-area.schema.js +9 -1
- package/dist/components/scroll-area/scroll-area.types.d.ts +17 -0
- package/dist/components/secret-value-field/secret-value-field.css +11 -1
- package/dist/components/segmented-control/segmented-control.css +12 -2
- package/dist/components/select/select.css +4 -1
- package/dist/components/selection-popover/index.js +149 -40
- package/dist/components/selection-popover/selection-popover.css +3 -0
- package/dist/components/selection-popover/virtual-keyboard-dismissal.svelte.d.ts +14 -0
- package/dist/components/sheet/index.js +106 -25
- package/dist/components/sheet/sheet.css +20 -12
- package/dist/components/sidebar/index.js +106 -25
- package/dist/components/sortable-list/index.js +2 -2
- package/dist/components/sortable-list/sortable-list.css +14 -9
- package/dist/components/speed-dial/index.js +20 -17
- package/dist/components/statistic/statistic.css +2 -2
- package/dist/components/statistic-group/statistic-group.css +2 -2
- package/dist/components/status-dot/status-dot.css +2 -2
- package/dist/components/table/index.js +252 -1
- package/dist/components/table/table.css +15 -0
- package/dist/components/tag-input/tag-input.css +1 -1
- package/dist/components/team-section/index.js +193 -89
- package/dist/components/textarea/textarea.css +4 -1
- package/dist/components/time-field/time-field.css +4 -1
- package/dist/components/tooltip/index.js +130 -46
- package/dist/components/tooltip/tooltip.schema.js +7 -3
- package/dist/components/tooltip/tooltip.types.d.ts +20 -2
- package/dist/components/transfer-list/index.js +253 -1
- package/dist/components/transfer-list/transfer-list.css +18 -0
- package/dist/index.js +22861 -22220
- package/dist/server/components/alert-dialog/index.js +7 -4
- package/dist/server/components/approval-card/index.js +9 -8
- package/dist/server/components/area-chart/index.js +6 -4
- package/dist/server/components/autocomplete/index.js +7 -7
- package/dist/server/components/avatar-group/index.js +7 -7
- package/dist/server/components/bar-chart/index.js +6 -4
- package/dist/server/components/carousel/index.js +6 -2
- package/dist/server/components/code-block/index.js +5 -3
- package/dist/server/components/combobox/index.js +8 -8
- package/dist/server/components/command-menu/index.js +5 -5
- package/dist/server/components/confirm-dialog/index.js +7 -4
- package/dist/server/components/context-menu/index.js +7 -7
- package/dist/server/components/data-table/index.js +5 -3
- package/dist/server/components/date-picker/index.js +8 -8
- package/dist/server/components/date-range-field/index.js +8 -8
- package/dist/server/components/drawer/index.js +4 -4
- package/dist/server/components/dropdown/index.js +7 -7
- package/dist/server/components/dropdown-menu/index.js +6 -6
- package/dist/server/components/event-timeline/index.js +6 -6
- package/dist/server/components/focus-trap/index.js +3 -3
- package/dist/server/components/hover-card/index.js +7 -6
- package/dist/server/components/invocation-rule-builder/index.js +8 -8
- package/dist/server/components/json-schema-editor/index.js +6 -6
- package/dist/server/components/kanban-board/index.js +2 -2
- package/dist/server/components/line-chart/index.js +6 -4
- package/dist/server/components/matrix-chart/index.js +6 -4
- package/dist/server/components/menu-bar/index.js +6 -6
- package/dist/server/components/meter/index.js +1 -1
- package/dist/server/components/modal/index.js +7 -4
- package/dist/server/components/multi-select/index.js +9 -2
- package/dist/server/components/navigation-bar/index.js +5 -5
- package/dist/server/components/permission-matrix/index.js +4 -2
- package/dist/server/components/popover/index.js +7 -7
- package/dist/server/components/portal/index.js +3 -3
- package/dist/server/components/run-step-timeline/index.js +1 -1
- package/dist/server/components/scroll-area/index.js +8 -2
- package/dist/server/components/selection-popover/index.js +6 -6
- package/dist/server/components/sheet/index.js +3 -3
- package/dist/server/components/sidebar/index.js +5 -5
- package/dist/server/components/sortable-list/index.js +2 -2
- package/dist/server/components/speed-dial/index.js +6 -6
- package/dist/server/components/speed-dial-action/index.js +4 -4
- package/dist/server/components/table/index.js +5 -3
- package/dist/server/components/team-section/index.js +7 -7
- package/dist/server/components/toast-region/index.js +3 -3
- package/dist/server/components/tooltip/index.js +6 -6
- package/dist/server/components/transfer-list/index.js +4 -2
- package/dist/server/index.js +69 -68
- package/dist/server/{index.server-dvd8t7ds.js → index.server-01bz4wmw.js} +1 -1
- package/dist/server/{index.server-gbj2zt1q.js → index.server-03ndc3td.js} +1 -1
- package/dist/server/{index.server-1qr1qkjb.js → index.server-0p1z1kbs.js} +1 -1
- package/dist/server/{index.server-b36zkjsr.js → index.server-1cnz5ax1.js} +30 -6
- package/dist/server/{index.server-xtx9sey2.js → index.server-2bw5fqwh.js} +1 -1
- package/dist/server/{index.server-v3t6v21s.js → index.server-2eb8pcev.js} +1 -1
- package/dist/server/{index.server-2n185esx.js → index.server-2h45p8kd.js} +2 -2
- package/dist/server/{index.server-3gm8s994.js → index.server-2k0cnsm4.js} +30 -2
- package/dist/server/{index.server-jwrnsnxk.js → index.server-2qydtmtp.js} +1 -1
- package/dist/server/{index.server-4bdnshs1.js → index.server-3e8n2sry.js} +2 -2
- package/dist/server/{index.server-dpyw7nad.js → index.server-4sr9f5r0.js} +1 -1
- package/dist/server/{index.server-rxvbt0y3.js → index.server-4w0rydct.js} +1 -1
- package/dist/server/{index.server-znrr9zve.js → index.server-6184qc69.js} +1 -1
- package/dist/server/{index.server-mw3z3nfz.js → index.server-64dvhh7s.js} +8 -2
- package/dist/server/{index.server-w9tnnse5.js → index.server-6771g0q4.js} +4 -4
- package/dist/server/{index.server-jxy33axv.js → index.server-6e5cj9hs.js} +1 -1
- package/dist/server/{index.server-gp0jh4cx.js → index.server-6z6s8qz8.js} +1 -1
- package/dist/server/{index.server-jj0tkfqp.js → index.server-72d0qgdy.js} +3 -3
- package/dist/server/{index.server-x93qnzqm.js → index.server-77p0jy71.js} +1 -1
- package/dist/server/{index.server-cepvcyxn.js → index.server-7kez94sz.js} +17 -6
- package/dist/server/{index.server-rd908evp.js → index.server-7sxx7645.js} +2 -2
- package/dist/server/{index.server-1br18a82.js → index.server-8t53gqe7.js} +3 -3
- package/dist/server/{index.server-jnp8yqgj.js → index.server-8w95jmf1.js} +1 -1
- package/dist/server/{index.server-g8j7wnpa.js → index.server-9emgn750.js} +1 -1
- package/dist/server/{index.server-zt8d7yer.js → index.server-9n2bc545.js} +1 -1
- package/dist/server/{index.server-bprjmaxb.js → index.server-a5w1wy5w.js} +1 -1
- package/dist/server/{index.server-t6dkkfxk.js → index.server-a5zsgn3k.js} +1 -1
- package/dist/server/{index.server-nsqx19rk.js → index.server-a8gpnzgg.js} +6 -6
- package/dist/server/{index.server-edx404az.js → index.server-ayhcc6z5.js} +1 -1
- package/dist/server/{index.server-z53avp9h.js → index.server-b7pq5xpd.js} +1 -1
- package/dist/server/{index.server-aerjcjgw.js → index.server-cptwpqbr.js} +1 -1
- package/dist/server/{index.server-85dr75be.js → index.server-d70brw24.js} +1 -1
- package/dist/server/{index.server-wsbwydct.js → index.server-fd3az8g2.js} +3 -3
- package/dist/server/{index.server-429t1qje.js → index.server-fka21791.js} +2 -2
- package/dist/server/{index.server-vb58jd7c.js → index.server-grq89cv5.js} +1 -1
- package/dist/server/{index.server-74g52t91.js → index.server-hxjkfdp2.js} +1 -1
- package/dist/server/{index.server-r5y5t888.js → index.server-j4akck2w.js} +1 -1
- package/dist/server/{index.server-sqtgjjc3.js → index.server-j57zek3p.js} +1 -1
- package/dist/server/index.server-ja3fmd29.js +211 -0
- package/dist/server/{index.server-66amt15s.js → index.server-kszs0qx5.js} +25 -2
- package/dist/server/{index.server-f02vwrw5.js → index.server-nbq0tmx1.js} +26 -16
- package/dist/server/{index.server-ktwnf9vg.js → index.server-nbspp00m.js} +1 -1
- package/dist/server/{index.server-xanhe43k.js → index.server-pee1wa4g.js} +1 -1
- package/dist/server/{index.server-dqt9we67.js → index.server-q7r53g7z.js} +1 -1
- package/dist/server/{index.server-1xq7j9dj.js → index.server-scdk1we9.js} +6 -6
- package/dist/server/{index.server-rgcepyhr.js → index.server-sfbna82r.js} +1 -1
- package/dist/server/{index.server-dpe08kr7.js → index.server-sgjc9gkq.js} +1 -1
- package/dist/server/{index.server-wm3t5yw7.js → index.server-sxkkaj8b.js} +13 -3
- package/dist/server/{index.server-r147w5z4.js → index.server-td8rx9dz.js} +1 -1
- package/dist/server/{index.server-3g76h7z7.js → index.server-th1tsad4.js} +62 -26
- package/dist/server/{index.server-ak9pqjfw.js → index.server-tpny5pjk.js} +224 -91
- package/dist/server/{index.server-8wb8g3w1.js → index.server-tvj0x3qy.js} +1 -1
- package/dist/server/{index.server-vqb9m9hq.js → index.server-w2jwyz17.js} +2 -2
- package/dist/server/{index.server-29sg0ywf.js → index.server-w5f4ex0f.js} +9 -6
- package/dist/server/{index.server-5p5r6t6n.js → index.server-w8phxx00.js} +1 -1
- package/dist/server/{index.server-tj2erfba.js → index.server-x6hbm4je.js} +2 -2
- package/dist/server/{index.server-7r9d6g1c.js → index.server-xqbes4jd.js} +6 -6
- package/dist/server/{index.server-j15z5xn7.js → index.server-xsh52hjt.js} +1 -1
- package/dist/server/{index.server-k1625sfw.js → index.server-y8m06g9p.js} +1 -1
- package/dist/server/{index.server-32p6dz3e.js → index.server-ybb5ery2.js} +1 -1
- package/dist/server/{index.server-1p7b8y48.js → index.server-yhjecwfj.js} +6 -6
- package/dist/server/{index.server-4nh4arvs.js → index.server-zfxb12hm.js} +30 -48
- package/dist/utilities/attachments.d.ts +63 -1
- package/dist/utilities/drag-scroll-physics.d.ts +48 -0
- package/dist/utilities/use-drag-scroll.svelte.d.ts +26 -0
- package/dist/utilities/use-drag-scroll.types.d.ts +15 -0
- package/dist/utilities/use-fine-pointer.svelte.d.ts +12 -0
- package/dist/utilities/use-fine-pointer.types.d.ts +4 -0
- package/package.json +2 -2
- package/src/_internal/anchored-overlay.svelte.ts +48 -26
- package/src/components/_sortable-item.svelte +21 -2
- package/src/components/approval-card/approval-card.css +3 -0
- package/src/components/avatar-group/avatar-group.svelte +46 -17
- package/src/components/button/button.css +13 -3
- package/src/components/calendar/calendar.css +3 -0
- package/src/components/carousel/carousel.css +40 -6
- package/src/components/carousel/carousel.examples.json +6 -0
- package/src/components/carousel/carousel.schema.json +42 -1
- package/src/components/carousel/carousel.schema.ts +49 -1
- package/src/components/carousel/carousel.svelte +311 -136
- package/src/components/carousel/carousel.types.ts +47 -2
- package/src/components/carousel/carousel.variables.json +6 -1
- package/src/components/carousel/carousel.variables.ts +6 -1
- package/src/components/carousel/index.ts +1 -0
- package/src/components/checkbox/checkbox.css +1 -1
- package/src/components/checkbox-group/checkbox-group.css +1 -1
- package/src/components/chip/chip.css +3 -0
- package/src/components/code-block/code-block.css +35 -2
- 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 +12 -2
- package/src/components/code-block/code-block.types.ts +8 -0
- package/src/components/color-field/color-field.css +1 -1
- package/src/components/color-picker/color-picker.css +1 -1
- package/src/components/combobox/combobox.css +4 -1
- package/src/components/connection-indicator/connection-indicator.css +3 -2
- package/src/components/copy-button/copy-button.css +4 -1
- package/src/components/data-grid/data-grid.css +3 -0
- package/src/components/date-picker/date-picker.css +1 -1
- package/src/components/date-range-field/date-range-field.css +7 -1
- package/src/components/diff-statistics/diff-statistics.css +2 -2
- package/src/components/drawer/drawer.css +20 -12
- package/src/components/drawer/drawer.svelte +5 -1
- package/src/components/dropdown/dropdown.css +1 -1
- package/src/components/event-stream-viewer/event-stream-viewer.css +29 -4
- package/src/components/event-stream-viewer/event-stream-viewer.variables.json +1 -1
- package/src/components/event-stream-viewer/event-stream-viewer.variables.ts +4 -1
- package/src/components/event-timeline/event-timeline.css +3 -0
- package/src/components/form-field/form-field.css +1 -1
- package/src/components/hover-card/hover-card.css +45 -1
- package/src/components/hover-card/hover-card.svelte +64 -2
- package/src/components/inline-loading/inline-loading.css +2 -2
- package/src/components/input/input.css +1 -1
- package/src/components/invocation-rule-builder/invocation-rule-builder.css +18 -0
- package/src/components/json-editor/json-editor.css +4 -1
- package/src/components/json-viewer/json-viewer.css +5 -2
- package/src/components/kanban-board/kanban-board.css +1 -1
- package/src/components/marquee/marquee.css +3 -0
- package/src/components/menu-bar/menu-bar.css +3 -0
- package/src/components/meter/meter.svelte +19 -4
- package/src/components/meter/meter.types.ts +4 -0
- package/src/components/modal/modal.css +56 -24
- package/src/components/modal/modal.svelte +59 -99
- package/src/components/multi-select/multi-select.css +4 -10
- package/src/components/multi-select/multi-select.svelte +43 -0
- package/src/components/navigation-item/navigation-item.css +3 -0
- package/src/components/pagination/pagination.css +3 -0
- package/src/components/permission-matrix/permission-matrix.css +15 -0
- package/src/components/permission-matrix/permission-matrix.svelte +6 -1
- package/src/components/phone-input/phone-input.css +1 -1
- package/src/components/pin-input/pin-input.css +10 -2
- package/src/components/qr-code/qr-code.css +1 -1
- package/src/components/radio-group/radio-group.css +1 -1
- package/src/components/rating/rating.css +1 -1
- package/src/components/schema-form/schema-form.css +1 -1
- package/src/components/scroll-area/scroll-area.css +30 -0
- package/src/components/scroll-area/scroll-area.schema.json +8 -0
- package/src/components/scroll-area/scroll-area.schema.ts +10 -0
- package/src/components/scroll-area/scroll-area.svelte +44 -2
- package/src/components/scroll-area/scroll-area.types.ts +17 -0
- package/src/components/secret-value-field/secret-value-field.css +11 -1
- package/src/components/segmented-control/segmented-control.css +12 -2
- package/src/components/select/select.css +4 -1
- package/src/components/selection-popover/selection-popover.css +3 -0
- package/src/components/selection-popover/selection-popover.svelte +32 -0
- package/src/components/selection-popover/virtual-keyboard-dismissal.svelte.ts +16 -0
- package/src/components/sheet/sheet.css +20 -12
- package/src/components/sheet/sheet.svelte +1 -1
- package/src/components/sortable-list/sortable-list.css +14 -9
- package/src/components/statistic/statistic.css +2 -2
- package/src/components/statistic-group/statistic-group.css +2 -2
- package/src/components/status-dot/status-dot.css +2 -2
- package/src/components/table/table.css +15 -0
- package/src/components/table/table.svelte +2 -0
- package/src/components/tag-input/tag-input.css +1 -1
- package/src/components/textarea/textarea.css +4 -1
- package/src/components/time-field/time-field.css +4 -1
- package/src/components/tooltip/tooltip.schema.json +6 -2
- package/src/components/tooltip/tooltip.schema.ts +8 -2
- package/src/components/tooltip/tooltip.svelte +124 -23
- package/src/components/tooltip/tooltip.types.ts +20 -2
- package/src/components/transfer-list/transfer-list.css +18 -0
- package/src/components/transfer-list/transfer-list.svelte +3 -0
- package/src/styles/components/_control-item.css +3 -0
- package/src/styles/components/_field-label.css +1 -1
- package/src/styles/components/_input-frame.css +3 -0
- package/src/styles/components/_scroll-fade.css +317 -0
- package/src/styles/components/_status-surface.css +21 -1
- package/src/styles/components.css +5 -0
- package/src/styles/index.css +1 -0
- package/src/styles/tokens-base.css +207 -69
- package/src/styles/utilities.css +10 -1
- package/src/utilities/attachments.ts +202 -26
- package/src/utilities/drag-scroll-physics.ts +82 -0
- package/src/utilities/use-drag-scroll.svelte.ts +186 -0
- package/src/utilities/use-drag-scroll.types.ts +17 -0
- package/src/utilities/use-fine-pointer.svelte.ts +23 -0
- package/src/utilities/use-fine-pointer.types.ts +4 -0
|
@@ -51,22 +51,2865 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
51
51
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
52
52
|
});
|
|
53
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(state4, 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
|
+
} = state4;
|
|
257
|
+
const {
|
|
258
|
+
boundary = "clippingAncestors",
|
|
259
|
+
rootBoundary = "viewport",
|
|
260
|
+
elementContext = "floating",
|
|
261
|
+
altBoundary = false,
|
|
262
|
+
padding = 0
|
|
263
|
+
} = evaluate(options, state4);
|
|
264
|
+
const paddingObject = getPaddingObject(padding);
|
|
265
|
+
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
266
|
+
const element2 = elements[altBoundary ? altContext : elementContext];
|
|
267
|
+
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
268
|
+
element: ((_await$platform$isEle = await (platform.isElement == null ? undefined : platform.isElement(element2))) != null ? _await$platform$isEle : true) ? element2 : element2.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(state4, options) {
|
|
348
|
+
const {
|
|
349
|
+
placement,
|
|
350
|
+
platform,
|
|
351
|
+
elements
|
|
352
|
+
} = state4;
|
|
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, state4);
|
|
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: reset4
|
|
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 (reset4 && resetCount < MAX_RESET_COUNT) {
|
|
443
|
+
resetCount++;
|
|
444
|
+
if (typeof reset4 === "object") {
|
|
445
|
+
if (reset4.placement) {
|
|
446
|
+
statefulPlacement = reset4.placement;
|
|
447
|
+
}
|
|
448
|
+
if (reset4.rects) {
|
|
449
|
+
rects = reset4.rects === true ? await platform.getElementRects({
|
|
450
|
+
reference,
|
|
451
|
+
floating,
|
|
452
|
+
strategy
|
|
453
|
+
}) : reset4.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(state4) {
|
|
474
|
+
const {
|
|
475
|
+
x,
|
|
476
|
+
y,
|
|
477
|
+
placement,
|
|
478
|
+
rects,
|
|
479
|
+
platform,
|
|
480
|
+
elements,
|
|
481
|
+
middlewareData
|
|
482
|
+
} = state4;
|
|
483
|
+
const {
|
|
484
|
+
element: element2,
|
|
485
|
+
padding = 0
|
|
486
|
+
} = evaluate(options, state4) || {};
|
|
487
|
+
if (element2 == 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(element2);
|
|
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(element2));
|
|
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(state4) {
|
|
539
|
+
var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
|
|
540
|
+
const {
|
|
541
|
+
rects,
|
|
542
|
+
middlewareData,
|
|
543
|
+
placement,
|
|
544
|
+
platform,
|
|
545
|
+
elements
|
|
546
|
+
} = state4;
|
|
547
|
+
const {
|
|
548
|
+
crossAxis = false,
|
|
549
|
+
alignment,
|
|
550
|
+
allowedPlacements = placements,
|
|
551
|
+
autoAlignment = true,
|
|
552
|
+
...detectOverflowOptions
|
|
553
|
+
} = evaluate(options, state4);
|
|
554
|
+
const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
|
|
555
|
+
const overflow = await platform.detectOverflow(state4, 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(state4) {
|
|
614
|
+
var _middlewareData$arrow, _middlewareData$flip;
|
|
615
|
+
const {
|
|
616
|
+
placement,
|
|
617
|
+
middlewareData,
|
|
618
|
+
rects,
|
|
619
|
+
initialPlacement,
|
|
620
|
+
platform,
|
|
621
|
+
elements
|
|
622
|
+
} = state4;
|
|
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, state4);
|
|
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(state4, 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(state4) {
|
|
718
|
+
const {
|
|
719
|
+
rects,
|
|
720
|
+
platform
|
|
721
|
+
} = state4;
|
|
722
|
+
const {
|
|
723
|
+
strategy = "referenceHidden",
|
|
724
|
+
...detectOverflowOptions
|
|
725
|
+
} = evaluate(options, state4);
|
|
726
|
+
switch (strategy) {
|
|
727
|
+
case "referenceHidden": {
|
|
728
|
+
const overflow = await platform.detectOverflow(state4, {
|
|
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(state4, {
|
|
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(state4) {
|
|
767
|
+
const {
|
|
768
|
+
placement,
|
|
769
|
+
elements,
|
|
770
|
+
rects,
|
|
771
|
+
platform,
|
|
772
|
+
strategy
|
|
773
|
+
} = state4;
|
|
774
|
+
const {
|
|
775
|
+
padding = 2,
|
|
776
|
+
x,
|
|
777
|
+
y
|
|
778
|
+
} = evaluate(options, state4);
|
|
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(state4) {
|
|
857
|
+
var _middlewareData$offse, _middlewareData$arrow;
|
|
858
|
+
const {
|
|
859
|
+
x,
|
|
860
|
+
y,
|
|
861
|
+
placement,
|
|
862
|
+
middlewareData
|
|
863
|
+
} = state4;
|
|
864
|
+
const diffCoords = await convertValueToCoords(state4, 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(state4) {
|
|
886
|
+
const {
|
|
887
|
+
x,
|
|
888
|
+
y,
|
|
889
|
+
placement,
|
|
890
|
+
platform
|
|
891
|
+
} = state4;
|
|
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, state4);
|
|
909
|
+
const coords = {
|
|
910
|
+
x,
|
|
911
|
+
y
|
|
912
|
+
};
|
|
913
|
+
const overflow = await platform.detectOverflow(state4, 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
|
+
...state4,
|
|
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(state4) {
|
|
957
|
+
const {
|
|
958
|
+
x,
|
|
959
|
+
y,
|
|
960
|
+
placement,
|
|
961
|
+
rects,
|
|
962
|
+
middlewareData
|
|
963
|
+
} = state4;
|
|
964
|
+
const {
|
|
965
|
+
offset: offset2 = 0,
|
|
966
|
+
mainAxis: checkMainAxis = true,
|
|
967
|
+
crossAxis: checkCrossAxis = true
|
|
968
|
+
} = evaluate(options, state4);
|
|
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, state4);
|
|
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(state4) {
|
|
1022
|
+
var _state$middlewareData, _state$middlewareData2;
|
|
1023
|
+
const {
|
|
1024
|
+
placement,
|
|
1025
|
+
rects,
|
|
1026
|
+
platform,
|
|
1027
|
+
elements
|
|
1028
|
+
} = state4;
|
|
1029
|
+
const {
|
|
1030
|
+
apply = () => {},
|
|
1031
|
+
...detectOverflowOptions
|
|
1032
|
+
} = evaluate(options, state4);
|
|
1033
|
+
const overflow = await platform.detectOverflow(state4, 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 = !state4.middlewareData.shift;
|
|
1055
|
+
let availableHeight = overflowAvailableHeight;
|
|
1056
|
+
let availableWidth = overflowAvailableWidth;
|
|
1057
|
+
if ((_state$middlewareData = state4.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
|
|
1058
|
+
availableWidth = maximumClippingWidth;
|
|
1059
|
+
}
|
|
1060
|
+
if ((_state$middlewareData2 = state4.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
|
+
...state4,
|
|
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(element2) {
|
|
1140
|
+
const {
|
|
1141
|
+
overflow,
|
|
1142
|
+
overflowX,
|
|
1143
|
+
overflowY,
|
|
1144
|
+
display
|
|
1145
|
+
} = getComputedStyle2(element2);
|
|
1146
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
|
|
1147
|
+
}
|
|
1148
|
+
function isTableElement(element2) {
|
|
1149
|
+
return /^(table|td|th)$/.test(getNodeName(element2));
|
|
1150
|
+
}
|
|
1151
|
+
function isTopLayer(element2) {
|
|
1152
|
+
try {
|
|
1153
|
+
if (element2.matches(":popover-open")) {
|
|
1154
|
+
return true;
|
|
1155
|
+
}
|
|
1156
|
+
} catch (_e) {}
|
|
1157
|
+
try {
|
|
1158
|
+
return element2.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(element2) {
|
|
1168
|
+
let currentNode = getParentNode(element2);
|
|
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(element2) {
|
|
1189
|
+
return getWindow(element2).getComputedStyle(element2);
|
|
1190
|
+
}
|
|
1191
|
+
function getNodeScroll(element2) {
|
|
1192
|
+
if (isElement(element2)) {
|
|
1193
|
+
return {
|
|
1194
|
+
scrollLeft: element2.scrollLeft,
|
|
1195
|
+
scrollTop: element2.scrollTop
|
|
1196
|
+
};
|
|
1197
|
+
}
|
|
1198
|
+
return {
|
|
1199
|
+
scrollLeft: element2.scrollX,
|
|
1200
|
+
scrollTop: element2.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(element2) {
|
|
1266
|
+
const css = getComputedStyle2(element2);
|
|
1267
|
+
let width = parseFloat(css.width) || 0;
|
|
1268
|
+
let height = parseFloat(css.height) || 0;
|
|
1269
|
+
const hasOffset = isHTMLElement(element2);
|
|
1270
|
+
const offsetWidth = hasOffset ? element2.offsetWidth : width;
|
|
1271
|
+
const offsetHeight = hasOffset ? element2.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(element2) {
|
|
1284
|
+
return !isElement(element2) ? element2.contextElement : element2;
|
|
1285
|
+
}
|
|
1286
|
+
function getScale(element2) {
|
|
1287
|
+
const domElement = unwrapElement(element2);
|
|
1288
|
+
if (!isHTMLElement(domElement)) {
|
|
1289
|
+
return createCoords(1);
|
|
1290
|
+
}
|
|
1291
|
+
const rect = domElement.getBoundingClientRect();
|
|
1292
|
+
const {
|
|
1293
|
+
width,
|
|
1294
|
+
height,
|
|
1295
|
+
$: $8
|
|
1296
|
+
} = getCssDimensions(domElement);
|
|
1297
|
+
let x = ($8 ? round(rect.width) : rect.width) / width;
|
|
1298
|
+
let y = ($8 ? 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(element2) {
|
|
1311
|
+
const win = getWindow(element2);
|
|
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(element2, isFixed, floatingOffsetParent) {
|
|
1321
|
+
if (isFixed === undefined) {
|
|
1322
|
+
isFixed = false;
|
|
1323
|
+
}
|
|
1324
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element2)) {
|
|
1325
|
+
return false;
|
|
1326
|
+
}
|
|
1327
|
+
return isFixed;
|
|
1328
|
+
}
|
|
1329
|
+
function getBoundingClientRect(element2, includeScale, isFixedStrategy, offsetParent) {
|
|
1330
|
+
if (includeScale === undefined) {
|
|
1331
|
+
includeScale = false;
|
|
1332
|
+
}
|
|
1333
|
+
if (isFixedStrategy === undefined) {
|
|
1334
|
+
isFixedStrategy = false;
|
|
1335
|
+
}
|
|
1336
|
+
const clientRect = element2.getBoundingClientRect();
|
|
1337
|
+
const domElement = unwrapElement(element2);
|
|
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(element2);
|
|
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(element2, rect) {
|
|
1382
|
+
const leftScroll = getNodeScroll(element2).scrollLeft;
|
|
1383
|
+
if (!rect) {
|
|
1384
|
+
return getBoundingClientRect(getDocumentElement(element2)).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(element2) {
|
|
1437
|
+
return Array.from(element2.getClientRects());
|
|
1438
|
+
}
|
|
1439
|
+
function getDocumentRect(element2) {
|
|
1440
|
+
const html = getDocumentElement(element2);
|
|
1441
|
+
const scroll = getNodeScroll(element2);
|
|
1442
|
+
const body = element2.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(element2);
|
|
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(element2, strategy) {
|
|
1458
|
+
const win = getWindow(element2);
|
|
1459
|
+
const html = getDocumentElement(element2);
|
|
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(element2, strategy) {
|
|
1495
|
+
const clientRect = getBoundingClientRect(element2, true, strategy === "fixed");
|
|
1496
|
+
const top = clientRect.top + element2.clientTop;
|
|
1497
|
+
const left = clientRect.left + element2.clientLeft;
|
|
1498
|
+
const scale = isHTMLElement(element2) ? getScale(element2) : createCoords(1);
|
|
1499
|
+
const width = element2.clientWidth * scale.x;
|
|
1500
|
+
const height = element2.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(element2, clippingAncestor, strategy) {
|
|
1511
|
+
let rect;
|
|
1512
|
+
if (clippingAncestor === "viewport") {
|
|
1513
|
+
rect = getViewportRect(element2, strategy);
|
|
1514
|
+
} else if (clippingAncestor === "document") {
|
|
1515
|
+
rect = getDocumentRect(getDocumentElement(element2));
|
|
1516
|
+
} else if (isElement(clippingAncestor)) {
|
|
1517
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
1518
|
+
} else {
|
|
1519
|
+
const visualOffsets = getVisualOffsets(element2);
|
|
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(element2, stopNode) {
|
|
1530
|
+
const parentNode = getParentNode(element2);
|
|
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(element2, cache) {
|
|
1537
|
+
const cachedResult = cache.get(element2);
|
|
1538
|
+
if (cachedResult) {
|
|
1539
|
+
return cachedResult;
|
|
1540
|
+
}
|
|
1541
|
+
let result = getOverflowAncestors(element2, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
|
|
1542
|
+
let currentContainingBlockComputedStyle = null;
|
|
1543
|
+
const elementIsFixed = getComputedStyle2(element2).position === "fixed";
|
|
1544
|
+
let currentNode = elementIsFixed ? getParentNode(element2) : element2;
|
|
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(element2, 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(element2, result);
|
|
1560
|
+
return result;
|
|
1561
|
+
}
|
|
1562
|
+
function getClippingRect(_ref) {
|
|
1563
|
+
let {
|
|
1564
|
+
element: element2,
|
|
1565
|
+
boundary,
|
|
1566
|
+
rootBoundary,
|
|
1567
|
+
strategy
|
|
1568
|
+
} = _ref;
|
|
1569
|
+
const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element2) ? [] : getClippingElementAncestors(element2, this._c) : [].concat(boundary);
|
|
1570
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
1571
|
+
const firstRect = getClientRectFromClippingAncestor(element2, 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(element2, 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(element2) {
|
|
1591
|
+
const {
|
|
1592
|
+
width,
|
|
1593
|
+
height
|
|
1594
|
+
} = getCssDimensions(element2);
|
|
1595
|
+
return {
|
|
1596
|
+
width,
|
|
1597
|
+
height
|
|
1598
|
+
};
|
|
1599
|
+
}
|
|
1600
|
+
function getRectRelativeToOffsetParent(element2, offsetParent, strategy) {
|
|
1601
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1602
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
1603
|
+
const isFixed = strategy === "fixed";
|
|
1604
|
+
const rect = getBoundingClientRect(element2, 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(element2) {
|
|
1639
|
+
return getComputedStyle2(element2).position === "static";
|
|
1640
|
+
}
|
|
1641
|
+
function getTrueOffsetParent(element2, polyfill) {
|
|
1642
|
+
if (!isHTMLElement(element2) || getComputedStyle2(element2).position === "fixed") {
|
|
1643
|
+
return null;
|
|
1644
|
+
}
|
|
1645
|
+
if (polyfill) {
|
|
1646
|
+
return polyfill(element2);
|
|
1647
|
+
}
|
|
1648
|
+
let rawOffsetParent = element2.offsetParent;
|
|
1649
|
+
if (getDocumentElement(element2) === rawOffsetParent) {
|
|
1650
|
+
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
1651
|
+
}
|
|
1652
|
+
return rawOffsetParent;
|
|
1653
|
+
}
|
|
1654
|
+
function getOffsetParent(element2, polyfill) {
|
|
1655
|
+
const win = getWindow(element2);
|
|
1656
|
+
if (isTopLayer(element2)) {
|
|
1657
|
+
return win;
|
|
1658
|
+
}
|
|
1659
|
+
if (!isHTMLElement(element2)) {
|
|
1660
|
+
let svgOffsetParent = getParentNode(element2);
|
|
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(element2, 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(element2) || win;
|
|
1677
|
+
}
|
|
1678
|
+
function isRTL(element2) {
|
|
1679
|
+
return getComputedStyle2(element2).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(element2, onMove) {
|
|
1685
|
+
let io = null;
|
|
1686
|
+
let timeoutId;
|
|
1687
|
+
const root4 = getDocumentElement(element2);
|
|
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 = element2.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(root4.clientWidth - (left + width));
|
|
1717
|
+
const insetBottom = floor(root4.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, element2.getBoundingClientRect())) {
|
|
1740
|
+
refresh();
|
|
1741
|
+
}
|
|
1742
|
+
isFirstUpdate = false;
|
|
1743
|
+
}
|
|
1744
|
+
try {
|
|
1745
|
+
io = new IntersectionObserver(handleObserve, {
|
|
1746
|
+
...options,
|
|
1747
|
+
root: root4.ownerDocument
|
|
1748
|
+
});
|
|
1749
|
+
} catch (_e) {
|
|
1750
|
+
io = new IntersectionObserver(handleObserve, options);
|
|
1751
|
+
}
|
|
1752
|
+
io.observe(element2);
|
|
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 $3 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 $2 from "svelte/internal/client";
|
|
1896
|
+
import { untrack } from "svelte";
|
|
1897
|
+
|
|
1898
|
+
// ../../node_modules/esm-env/true.js
|
|
1899
|
+
var true_default = true;
|
|
1900
|
+
// src/utilities/dev-warn.ts
|
|
1901
|
+
function devWarn(message, ...args) {
|
|
1902
|
+
if (!true_default)
|
|
1903
|
+
return;
|
|
1904
|
+
console.warn(message, ...args);
|
|
1905
|
+
}
|
|
1906
|
+
|
|
1907
|
+
// src/utilities/read-option.ts
|
|
1908
|
+
function isOptionGetter(value) {
|
|
1909
|
+
return typeof value === "function";
|
|
1910
|
+
}
|
|
1911
|
+
function readOption(value) {
|
|
1912
|
+
return isOptionGetter(value) ? value() : value;
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1915
|
+
// src/utilities/use-reduced-motion.svelte.ts
|
|
1916
|
+
import * as $ from "svelte/internal/client";
|
|
1917
|
+
import { MediaQuery } from "svelte/reactivity";
|
|
1918
|
+
function useReducedMotion() {
|
|
1919
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
1920
|
+
return { current: false };
|
|
1921
|
+
}
|
|
1922
|
+
const query = new MediaQuery("(prefers-reduced-motion: reduce)", false);
|
|
1923
|
+
return {
|
|
1924
|
+
get current() {
|
|
1925
|
+
return query.current;
|
|
1926
|
+
}
|
|
1927
|
+
};
|
|
1928
|
+
}
|
|
1929
|
+
|
|
1930
|
+
// src/components/portal/portal.utilities.svelte.ts
|
|
1931
|
+
function resolvePortalTarget(target) {
|
|
1932
|
+
if (typeof document === "undefined")
|
|
1933
|
+
return null;
|
|
1934
|
+
if (target == null) {
|
|
1935
|
+
return { kind: "resolved", target: document.body };
|
|
1936
|
+
}
|
|
1937
|
+
if (target instanceof HTMLElement) {
|
|
1938
|
+
return { kind: "resolved", target };
|
|
1939
|
+
}
|
|
1940
|
+
try {
|
|
1941
|
+
const resolved = document.querySelector(target);
|
|
1942
|
+
return resolved instanceof HTMLElement ? { kind: "resolved", target: resolved } : { kind: "unresolved", key: target };
|
|
1943
|
+
} catch {
|
|
1944
|
+
return { kind: "unresolved", key: target };
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
function findNearestOpenTopLayer(source, isModalDialog = (element) => element.matches(":modal")) {
|
|
1948
|
+
const selfTrigger = closestAcrossShadow(source, ".cinder-popover__trigger");
|
|
1949
|
+
let candidate = source;
|
|
1950
|
+
while (candidate) {
|
|
1951
|
+
try {
|
|
1952
|
+
if (candidate.matches("dialog") && isModalDialog(candidate) || candidate.matches("[popover]") && candidate.matches(":popover-open"))
|
|
1953
|
+
return candidate;
|
|
1954
|
+
} catch {}
|
|
1955
|
+
if (candidate !== selfTrigger) {
|
|
1956
|
+
const ownerId = candidate.dataset["cinderPortalOwner"];
|
|
1957
|
+
if (ownerId) {
|
|
1958
|
+
const root = candidate.getRootNode();
|
|
1959
|
+
const localOwner = root instanceof ShadowRoot ? Array.from(root.querySelectorAll("[id]")).find((element) => element.id === ownerId) : root instanceof Document ? root.getElementById(ownerId) : null;
|
|
1960
|
+
const owner = localOwner ?? document.getElementById(ownerId);
|
|
1961
|
+
if (owner instanceof HTMLElement)
|
|
1962
|
+
return owner;
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
const rootNode = candidate.getRootNode();
|
|
1966
|
+
const shadowHost = rootNode instanceof ShadowRoot ? rootNode.host : null;
|
|
1967
|
+
candidate = candidate.parentElement ?? (shadowHost instanceof HTMLElement ? shadowHost : null);
|
|
1968
|
+
}
|
|
1969
|
+
return null;
|
|
1970
|
+
}
|
|
1971
|
+
function getInheritedPortalStyle(source) {
|
|
1972
|
+
if (!source || typeof window === "undefined")
|
|
1973
|
+
return "";
|
|
1974
|
+
const computed = getComputedStyle(source);
|
|
1975
|
+
const hasDirectTypography = source.tagName === "NAV" || source.parentElement === null && [
|
|
1976
|
+
"font-family",
|
|
1977
|
+
"font-size",
|
|
1978
|
+
"font-weight",
|
|
1979
|
+
"line-height",
|
|
1980
|
+
"letter-spacing"
|
|
1981
|
+
].some((property) => source.style.getPropertyValue(property) !== "");
|
|
1982
|
+
const typographySource = hasDirectTypography ? source : source.parentElement ?? source;
|
|
1983
|
+
const typography = getComputedStyle(typographySource);
|
|
1984
|
+
const inherited = document.createElement("div").style;
|
|
1985
|
+
const customPropertyNames = new Set;
|
|
1986
|
+
let customPropertySource = source;
|
|
1987
|
+
while (customPropertySource) {
|
|
1988
|
+
for (const property of Array.from(customPropertySource.style)) {
|
|
1989
|
+
if (property.startsWith("--cinder-"))
|
|
1990
|
+
customPropertyNames.add(property);
|
|
1991
|
+
}
|
|
1992
|
+
customPropertySource = customPropertySource.parentElement ?? getShadowHost(customPropertySource);
|
|
1993
|
+
}
|
|
1994
|
+
for (let index = 0;index < computed.length; index += 1) {
|
|
1995
|
+
const property = computed.item(index);
|
|
1996
|
+
if (property.startsWith("--cinder-"))
|
|
1997
|
+
customPropertyNames.add(property);
|
|
1998
|
+
}
|
|
1999
|
+
for (const property of customPropertyNames) {
|
|
2000
|
+
const value = computed.getPropertyValue(property);
|
|
2001
|
+
if (value)
|
|
2002
|
+
inherited.setProperty(property, value);
|
|
2003
|
+
}
|
|
2004
|
+
const colorScheme = computed.colorScheme || source.style.colorScheme;
|
|
2005
|
+
if (colorScheme) {
|
|
2006
|
+
inherited.setProperty("color-scheme", colorScheme);
|
|
2007
|
+
}
|
|
2008
|
+
if (!source.hasAttribute("dir") && computed.direction) {
|
|
2009
|
+
inherited.setProperty("direction", computed.direction);
|
|
2010
|
+
}
|
|
2011
|
+
for (const property of [
|
|
2012
|
+
"font-family",
|
|
2013
|
+
"font-size",
|
|
2014
|
+
"font-weight",
|
|
2015
|
+
"line-height",
|
|
2016
|
+
"letter-spacing"
|
|
2017
|
+
]) {
|
|
2018
|
+
const value = typography.getPropertyValue(property);
|
|
2019
|
+
if (value)
|
|
2020
|
+
inherited.setProperty(property, value);
|
|
2021
|
+
}
|
|
2022
|
+
for (const property of Array.from(source.style)) {
|
|
2023
|
+
if (!property.startsWith("--cinder-"))
|
|
2024
|
+
continue;
|
|
2025
|
+
const rawValue = source.style.getPropertyValue(property);
|
|
2026
|
+
if (!rawValue.includes("var("))
|
|
2027
|
+
inherited.setProperty(property, rawValue);
|
|
2028
|
+
}
|
|
2029
|
+
if (source.style.colorScheme)
|
|
2030
|
+
inherited.setProperty("color-scheme", source.style.colorScheme);
|
|
2031
|
+
return inherited.cssText;
|
|
2032
|
+
}
|
|
2033
|
+
function createInheritedPortalStyle(source, active) {
|
|
2034
|
+
let style = $2.state("");
|
|
2035
|
+
const reducedMotion = useReducedMotion();
|
|
2036
|
+
$2.user_effect(() => {
|
|
2037
|
+
reducedMotion.current;
|
|
2038
|
+
if (!active()) {
|
|
2039
|
+
$2.set(style, "");
|
|
2040
|
+
return;
|
|
2041
|
+
}
|
|
2042
|
+
const inheritanceSource = source();
|
|
2043
|
+
const syncStyle = () => {
|
|
2044
|
+
$2.set(style, getInheritedPortalStyle(inheritanceSource), true);
|
|
2045
|
+
};
|
|
2046
|
+
syncStyle();
|
|
2047
|
+
const stopObserving = observeInheritedPortalAttributes(inheritanceSource, true, syncStyle);
|
|
2048
|
+
if (typeof window === "undefined")
|
|
2049
|
+
return stopObserving ?? undefined;
|
|
2050
|
+
const mediaQueries = [
|
|
2051
|
+
"(prefers-color-scheme: dark)",
|
|
2052
|
+
"(prefers-contrast: more)",
|
|
2053
|
+
"(forced-colors: active)"
|
|
2054
|
+
].map((query) => window.matchMedia(query));
|
|
2055
|
+
const onMediaChange = () => syncStyle();
|
|
2056
|
+
for (const mediaQuery of mediaQueries)
|
|
2057
|
+
mediaQuery.addEventListener("change", onMediaChange);
|
|
2058
|
+
window.addEventListener("resize", onMediaChange);
|
|
2059
|
+
return () => {
|
|
2060
|
+
stopObserving?.();
|
|
2061
|
+
for (const mediaQuery of mediaQueries)
|
|
2062
|
+
mediaQuery.removeEventListener("change", onMediaChange);
|
|
2063
|
+
window.removeEventListener("resize", onMediaChange);
|
|
2064
|
+
};
|
|
2065
|
+
});
|
|
2066
|
+
return {
|
|
2067
|
+
get style() {
|
|
2068
|
+
return $2.get(style);
|
|
2069
|
+
}
|
|
2070
|
+
};
|
|
2071
|
+
}
|
|
2072
|
+
function copyInheritedPortalAttributes(element, source, inheritAttributes, fallbackAttributes = {
|
|
2073
|
+
dir: element.getAttribute("dir"),
|
|
2074
|
+
lang: element.getAttribute("lang"),
|
|
2075
|
+
dataTheme: element.getAttribute("data-theme"),
|
|
2076
|
+
theme: element.getAttribute("data-cinder-theme")
|
|
2077
|
+
}) {
|
|
2078
|
+
const inheritedDirectionAttribute = "data-cinder-portal-inherited-direction";
|
|
2079
|
+
const preservesExplicitDirection = fallbackAttributes.preserveDirection || element.dataset["cinderExplicitDirection"] === "true";
|
|
2080
|
+
let inheritedDir = null;
|
|
2081
|
+
let generatedDirectionFallback = null;
|
|
2082
|
+
if (inheritAttributes && source && !preservesExplicitDirection) {
|
|
2083
|
+
let computedDirection = null;
|
|
2084
|
+
let hasReadComputedDirection = false;
|
|
2085
|
+
const readComputedDirection = () => {
|
|
2086
|
+
if (!hasReadComputedDirection) {
|
|
2087
|
+
computedDirection = typeof getComputedStyle === "function" ? getComputedStyle(source).direction : null;
|
|
2088
|
+
hasReadComputedDirection = true;
|
|
2089
|
+
}
|
|
2090
|
+
return computedDirection;
|
|
2091
|
+
};
|
|
2092
|
+
let directionSource = source;
|
|
2093
|
+
let crossedGeneratedDirectionBoundary = false;
|
|
2094
|
+
while (directionSource) {
|
|
2095
|
+
const matchingDirection = closestAcrossShadow(directionSource, "[dir]");
|
|
2096
|
+
if (!matchingDirection) {
|
|
2097
|
+
directionSource = getShadowHost(directionSource);
|
|
2098
|
+
continue;
|
|
2099
|
+
}
|
|
2100
|
+
if (!matchingDirection.hasAttribute(inheritedDirectionAttribute)) {
|
|
2101
|
+
const explicitDirection = matchingDirection.getAttribute("dir");
|
|
2102
|
+
const normalizedExplicitDirection = explicitDirection?.toLowerCase();
|
|
2103
|
+
if (crossedGeneratedDirectionBoundary) {
|
|
2104
|
+
if (normalizedExplicitDirection === "auto")
|
|
2105
|
+
inheritedDir = "auto";
|
|
2106
|
+
break;
|
|
2107
|
+
}
|
|
2108
|
+
const documentComputedDirection = matchingDirection === document.documentElement && normalizedExplicitDirection !== "auto" ? readComputedDirection() : null;
|
|
2109
|
+
inheritedDir = normalizedExplicitDirection === "auto" ? normalizedExplicitDirection : documentComputedDirection || explicitDirection;
|
|
2110
|
+
break;
|
|
2111
|
+
}
|
|
2112
|
+
const generatedDirection = matchingDirection.getAttribute("dir");
|
|
2113
|
+
generatedDirectionFallback ??= generatedDirection;
|
|
2114
|
+
crossedGeneratedDirectionBoundary = true;
|
|
2115
|
+
directionSource = matchingDirection.parentElement ?? getShadowHost(matchingDirection);
|
|
2116
|
+
}
|
|
2117
|
+
if (inheritedDir === null) {
|
|
2118
|
+
inheritedDir = readComputedDirection() || generatedDirectionFallback;
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
const nextDir = inheritedDir ?? fallbackAttributes.dir;
|
|
2122
|
+
if (nextDir) {
|
|
2123
|
+
element.setAttribute("dir", nextDir);
|
|
2124
|
+
if (!preservesExplicitDirection && inheritedDir !== null) {
|
|
2125
|
+
element.setAttribute(inheritedDirectionAttribute, "true");
|
|
2126
|
+
} else {
|
|
2127
|
+
element.removeAttribute(inheritedDirectionAttribute);
|
|
2128
|
+
}
|
|
2129
|
+
} else {
|
|
2130
|
+
element.removeAttribute("dir");
|
|
2131
|
+
element.removeAttribute(inheritedDirectionAttribute);
|
|
2132
|
+
}
|
|
2133
|
+
const preservesExplicitLanguage = fallbackAttributes.preserveLanguage ?? fallbackAttributes.lang !== null;
|
|
2134
|
+
const inheritedLanguage = inheritAttributes && source && !preservesExplicitLanguage ? closestAcrossShadow(source, "[lang]")?.getAttribute("lang") : null;
|
|
2135
|
+
const nextLanguage = inheritedLanguage ?? fallbackAttributes.lang;
|
|
2136
|
+
if (nextLanguage !== null && nextLanguage !== undefined) {
|
|
2137
|
+
element.setAttribute("lang", nextLanguage);
|
|
2138
|
+
} else {
|
|
2139
|
+
element.removeAttribute("lang");
|
|
2140
|
+
}
|
|
2141
|
+
const preservesExplicitDataTheme = fallbackAttributes.preserveDataTheme === true;
|
|
2142
|
+
const inheritedDataTheme = inheritAttributes && source && !preservesExplicitDataTheme && fallbackAttributes.dataTheme === null ? closestAcrossShadow(source, "[data-theme]")?.getAttribute("data-theme") : null;
|
|
2143
|
+
const nextDataTheme = inheritedDataTheme ?? fallbackAttributes.dataTheme;
|
|
2144
|
+
if (nextDataTheme) {
|
|
2145
|
+
element.setAttribute("data-theme", nextDataTheme);
|
|
2146
|
+
} else {
|
|
2147
|
+
element.removeAttribute("data-theme");
|
|
2148
|
+
}
|
|
2149
|
+
const preservesExplicitTheme = fallbackAttributes.preserveTheme === true;
|
|
2150
|
+
const inheritedTheme = inheritAttributes && source && !preservesExplicitTheme && fallbackAttributes.theme === null ? closestAcrossShadow(source, "[data-cinder-theme]")?.getAttribute("data-cinder-theme") : null;
|
|
2151
|
+
const nextTheme = inheritedTheme ?? fallbackAttributes.theme;
|
|
2152
|
+
if (nextTheme) {
|
|
2153
|
+
element.setAttribute("data-cinder-theme", nextTheme);
|
|
2154
|
+
} else {
|
|
2155
|
+
element.removeAttribute("data-cinder-theme");
|
|
2156
|
+
}
|
|
2157
|
+
return {
|
|
2158
|
+
dir: inheritedDir ?? null,
|
|
2159
|
+
lang: inheritedLanguage ?? null,
|
|
2160
|
+
dataTheme: inheritedDataTheme ?? null,
|
|
2161
|
+
theme: inheritedTheme ?? null
|
|
2162
|
+
};
|
|
2163
|
+
}
|
|
2164
|
+
function redispatchPortaledEvent(event, sourceTarget) {
|
|
2165
|
+
if (!sourceTarget)
|
|
2166
|
+
return false;
|
|
2167
|
+
const originalTarget = event.target;
|
|
2168
|
+
const originalComposedPath = event.composedPath();
|
|
2169
|
+
const eventInit = {
|
|
2170
|
+
bubbles: event.bubbles,
|
|
2171
|
+
cancelable: event.cancelable,
|
|
2172
|
+
composed: event.composed
|
|
2173
|
+
};
|
|
2174
|
+
for (const property of [
|
|
2175
|
+
"view",
|
|
2176
|
+
"key",
|
|
2177
|
+
"code",
|
|
2178
|
+
"location",
|
|
2179
|
+
"repeat",
|
|
2180
|
+
"isComposing",
|
|
2181
|
+
"button",
|
|
2182
|
+
"buttons",
|
|
2183
|
+
"movementX",
|
|
2184
|
+
"movementY",
|
|
2185
|
+
"which",
|
|
2186
|
+
"clientX",
|
|
2187
|
+
"clientY",
|
|
2188
|
+
"screenX",
|
|
2189
|
+
"screenY",
|
|
2190
|
+
"ctrlKey",
|
|
2191
|
+
"shiftKey",
|
|
2192
|
+
"altKey",
|
|
2193
|
+
"metaKey",
|
|
2194
|
+
"relatedTarget",
|
|
2195
|
+
"pointerId",
|
|
2196
|
+
"pointerType",
|
|
2197
|
+
"isPrimary",
|
|
2198
|
+
"detail",
|
|
2199
|
+
"data",
|
|
2200
|
+
"inputType",
|
|
2201
|
+
"dataTransfer",
|
|
2202
|
+
"pressure",
|
|
2203
|
+
"tiltX",
|
|
2204
|
+
"tiltY",
|
|
2205
|
+
"twist",
|
|
2206
|
+
"tangentialPressure",
|
|
2207
|
+
"width",
|
|
2208
|
+
"height"
|
|
2209
|
+
]) {
|
|
2210
|
+
if (property in event)
|
|
2211
|
+
eventInit[property] = Reflect.get(event, property);
|
|
2212
|
+
}
|
|
2213
|
+
let bridgedEvent;
|
|
2214
|
+
try {
|
|
2215
|
+
bridgedEvent = Reflect.construct(event.constructor, [event.type, eventInit]);
|
|
2216
|
+
} catch {
|
|
2217
|
+
bridgedEvent = new Event(event.type, eventInit);
|
|
2218
|
+
}
|
|
2219
|
+
for (const property of ["movementX", "movementY", "which", "width", "height"]) {
|
|
2220
|
+
if (!(property in event))
|
|
2221
|
+
continue;
|
|
2222
|
+
const value = Reflect.get(event, property);
|
|
2223
|
+
if (Reflect.get(bridgedEvent, property) === value)
|
|
2224
|
+
continue;
|
|
2225
|
+
try {
|
|
2226
|
+
Object.defineProperty(bridgedEvent, property, { configurable: true, value });
|
|
2227
|
+
} catch {}
|
|
2228
|
+
}
|
|
2229
|
+
redispatchedPortalEvents.add(bridgedEvent);
|
|
2230
|
+
Object.defineProperty(bridgedEvent, "target", { configurable: true, value: originalTarget });
|
|
2231
|
+
const nativeComposedPath = bridgedEvent.composedPath.bind(bridgedEvent);
|
|
2232
|
+
let dispatchComplete = false;
|
|
2233
|
+
Object.defineProperty(bridgedEvent, "composedPath", {
|
|
2234
|
+
configurable: true,
|
|
2235
|
+
value: () => {
|
|
2236
|
+
return dispatchComplete ? [...originalComposedPath] : nativeComposedPath();
|
|
2237
|
+
}
|
|
2238
|
+
});
|
|
2239
|
+
if (event.defaultPrevented)
|
|
2240
|
+
bridgedEvent.preventDefault();
|
|
2241
|
+
event.stopPropagation();
|
|
2242
|
+
const dispatched = sourceTarget.dispatchEvent(bridgedEvent);
|
|
2243
|
+
dispatchComplete = true;
|
|
2244
|
+
if (!dispatched) {
|
|
2245
|
+
event.preventDefault();
|
|
2246
|
+
}
|
|
2247
|
+
return true;
|
|
2248
|
+
}
|
|
2249
|
+
var redispatchedPortalEvents = new WeakSet;
|
|
2250
|
+
function getShadowHost(element) {
|
|
2251
|
+
const root = element.getRootNode();
|
|
2252
|
+
return root instanceof ShadowRoot && root.host instanceof HTMLElement ? root.host : null;
|
|
2253
|
+
}
|
|
2254
|
+
function closestAcrossShadow(element, selector) {
|
|
2255
|
+
let current = element;
|
|
2256
|
+
while (current) {
|
|
2257
|
+
const match = current.closest(selector);
|
|
2258
|
+
if (match)
|
|
2259
|
+
return match;
|
|
2260
|
+
current = getShadowHost(current);
|
|
2261
|
+
}
|
|
2262
|
+
return null;
|
|
2263
|
+
}
|
|
2264
|
+
function isRedispatchedPortaledEvent(event) {
|
|
2265
|
+
return redispatchedPortalEvents.has(event);
|
|
2266
|
+
}
|
|
2267
|
+
function isEffectivelyDisabled(source) {
|
|
2268
|
+
if (source.matches(":disabled"))
|
|
2269
|
+
return true;
|
|
2270
|
+
const disabledFieldset = source.closest("fieldset[disabled]");
|
|
2271
|
+
if (!disabledFieldset)
|
|
2272
|
+
return false;
|
|
2273
|
+
const firstLegend = disabledFieldset.querySelector(":scope > legend");
|
|
2274
|
+
return !firstLegend?.contains(source);
|
|
2275
|
+
}
|
|
2276
|
+
function isPortalSourceUnavailable(source) {
|
|
2277
|
+
if (isEffectivelyDisabled(source))
|
|
2278
|
+
return true;
|
|
2279
|
+
if (closestAcrossShadow(source, '[hidden], [inert], [aria-hidden="true"]'))
|
|
2280
|
+
return true;
|
|
2281
|
+
if (typeof window === "undefined" || typeof getComputedStyle !== "function")
|
|
2282
|
+
return false;
|
|
2283
|
+
let ancestor = source;
|
|
2284
|
+
while (ancestor) {
|
|
2285
|
+
const computed = getComputedStyle(ancestor);
|
|
2286
|
+
if (computed.display === "none" || computed.visibility === "hidden")
|
|
2287
|
+
return true;
|
|
2288
|
+
ancestor = ancestor.parentElement ?? getShadowHost(ancestor);
|
|
2289
|
+
}
|
|
2290
|
+
return false;
|
|
2291
|
+
}
|
|
2292
|
+
function observePortalSourceAvailability(source, onChange) {
|
|
2293
|
+
if (!source)
|
|
2294
|
+
return () => {};
|
|
2295
|
+
const syncAvailability = () => {
|
|
2296
|
+
onChange(isPortalSourceUnavailable(source));
|
|
2297
|
+
};
|
|
2298
|
+
if (typeof MutationObserver === "undefined") {
|
|
2299
|
+
syncAvailability();
|
|
2300
|
+
return () => {};
|
|
2301
|
+
}
|
|
2302
|
+
const observer = new MutationObserver(syncAvailability);
|
|
2303
|
+
let ancestor = source;
|
|
2304
|
+
while (ancestor) {
|
|
2305
|
+
observer.observe(ancestor, {
|
|
2306
|
+
attributes: true,
|
|
2307
|
+
attributeFilter: [
|
|
2308
|
+
"hidden",
|
|
2309
|
+
"inert",
|
|
2310
|
+
"aria-hidden",
|
|
2311
|
+
"disabled",
|
|
2312
|
+
"class",
|
|
2313
|
+
"style"
|
|
2314
|
+
]
|
|
2315
|
+
});
|
|
2316
|
+
ancestor = ancestor.parentElement ?? getShadowHost(ancestor);
|
|
2317
|
+
}
|
|
2318
|
+
syncAvailability();
|
|
2319
|
+
const resizeObserver = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(syncAvailability);
|
|
2320
|
+
resizeObserver?.observe(source);
|
|
2321
|
+
return () => {
|
|
2322
|
+
observer.disconnect();
|
|
2323
|
+
resizeObserver?.disconnect();
|
|
2324
|
+
};
|
|
2325
|
+
}
|
|
2326
|
+
function observeInheritedPortalAttributes(source, inheritAttributes, syncAttributes) {
|
|
2327
|
+
if (!inheritAttributes || !source)
|
|
2328
|
+
return null;
|
|
2329
|
+
const observer = typeof MutationObserver === "undefined" ? null : new MutationObserver(() => {
|
|
2330
|
+
syncAttributes();
|
|
2331
|
+
});
|
|
2332
|
+
const observedElements = [];
|
|
2333
|
+
function observe(elementToObserve) {
|
|
2334
|
+
if (!observer || !elementToObserve || observedElements.includes(elementToObserve))
|
|
2335
|
+
return;
|
|
2336
|
+
observedElements.push(elementToObserve);
|
|
2337
|
+
observer.observe(elementToObserve, {
|
|
2338
|
+
attributes: true,
|
|
2339
|
+
attributeFilter: [
|
|
2340
|
+
"class",
|
|
2341
|
+
"style",
|
|
2342
|
+
"dir",
|
|
2343
|
+
"lang",
|
|
2344
|
+
"data-theme",
|
|
2345
|
+
"data-cinder-theme"
|
|
2346
|
+
]
|
|
2347
|
+
});
|
|
2348
|
+
}
|
|
2349
|
+
function rebindObservedElements() {
|
|
2350
|
+
const nextElements = [];
|
|
2351
|
+
let ancestor = source ?? null;
|
|
2352
|
+
while (ancestor) {
|
|
2353
|
+
nextElements.push(ancestor);
|
|
2354
|
+
ancestor = ancestor.parentElement ?? getShadowHost(ancestor);
|
|
2355
|
+
}
|
|
2356
|
+
if (!nextElements.includes(document.documentElement)) {
|
|
2357
|
+
nextElements.push(document.documentElement);
|
|
2358
|
+
}
|
|
2359
|
+
if (observedElements.length === nextElements.length && observedElements.every((element, index) => element === nextElements[index])) {
|
|
2360
|
+
return;
|
|
2361
|
+
}
|
|
2362
|
+
observer?.disconnect();
|
|
2363
|
+
observedElements.length = 0;
|
|
2364
|
+
for (const element of nextElements)
|
|
2365
|
+
observe(element);
|
|
2366
|
+
}
|
|
2367
|
+
rebindObservedElements();
|
|
2368
|
+
const resizeObserver = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(syncAttributes);
|
|
2369
|
+
resizeObserver?.observe(source);
|
|
2370
|
+
const stopObservingComputedDirection = observeComputedDirection(source, syncAttributes, rebindObservedElements);
|
|
2371
|
+
return () => {
|
|
2372
|
+
observer?.disconnect();
|
|
2373
|
+
resizeObserver?.disconnect();
|
|
2374
|
+
stopObservingComputedDirection();
|
|
2375
|
+
};
|
|
2376
|
+
}
|
|
2377
|
+
var computedDirectionObservations = new Set;
|
|
2378
|
+
var observedMediaQueries = new Map;
|
|
2379
|
+
var directionInvalidationRoots = new Map;
|
|
2380
|
+
var directionInvalidationEvents = [
|
|
2381
|
+
"focusin",
|
|
2382
|
+
"focusout",
|
|
2383
|
+
"pointerover",
|
|
2384
|
+
"pointerout",
|
|
2385
|
+
"input",
|
|
2386
|
+
"change",
|
|
2387
|
+
"toggle",
|
|
2388
|
+
"pointerdown",
|
|
2389
|
+
"pointerup",
|
|
2390
|
+
"pointercancel",
|
|
2391
|
+
"keydown",
|
|
2392
|
+
"keyup"
|
|
2393
|
+
];
|
|
2394
|
+
var directionInvalidationObserver = null;
|
|
2395
|
+
var directionInvalidationFrame = null;
|
|
2396
|
+
var directionInvalidationDocument = null;
|
|
2397
|
+
var directionInvalidationStarted = false;
|
|
2398
|
+
function invalidateComputedDirections() {
|
|
2399
|
+
if (directionInvalidationFrame !== null || typeof window === "undefined")
|
|
2400
|
+
return;
|
|
2401
|
+
if (typeof window.requestAnimationFrame !== "function") {
|
|
2402
|
+
syncComputedDirections();
|
|
2403
|
+
return;
|
|
2404
|
+
}
|
|
2405
|
+
directionInvalidationFrame = window.requestAnimationFrame(() => {
|
|
2406
|
+
directionInvalidationFrame = null;
|
|
2407
|
+
syncComputedDirections();
|
|
2408
|
+
});
|
|
2409
|
+
}
|
|
2410
|
+
function invalidatePortalDirection() {
|
|
2411
|
+
if (computedDirectionObservations.size === 0)
|
|
2412
|
+
return;
|
|
2413
|
+
refreshMediaQueryObservers();
|
|
2414
|
+
invalidateComputedDirections();
|
|
2415
|
+
}
|
|
2416
|
+
function syncComputedDirections() {
|
|
2417
|
+
const topologyChanges = new Set;
|
|
2418
|
+
for (const current of computedDirectionObservations) {
|
|
2419
|
+
if (!rebindComputedDirectionObservation(current))
|
|
2420
|
+
continue;
|
|
2421
|
+
topologyChanges.add(current);
|
|
2422
|
+
current.rebindInheritedAttributes();
|
|
2423
|
+
}
|
|
2424
|
+
if (topologyChanges.size > 0)
|
|
2425
|
+
refreshMediaQueryObservers();
|
|
2426
|
+
if (typeof getComputedStyle !== "function")
|
|
2427
|
+
return;
|
|
2428
|
+
for (const current of computedDirectionObservations) {
|
|
2429
|
+
const direction = getComputedStyle(current.source).direction;
|
|
2430
|
+
if (direction === current.direction && !topologyChanges.has(current))
|
|
2431
|
+
continue;
|
|
2432
|
+
current.direction = direction;
|
|
2433
|
+
current.sync();
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
function collectMediaQueries(rules, queries) {
|
|
2437
|
+
for (const rule of Array.from(rules)) {
|
|
2438
|
+
const conditionText = Reflect.get(rule, "conditionText");
|
|
2439
|
+
const media = Reflect.get(rule, "media");
|
|
2440
|
+
if (typeof conditionText === "string" && media && typeof media === "object") {
|
|
2441
|
+
queries.add(conditionText);
|
|
2442
|
+
}
|
|
2443
|
+
const mediaText = media && Reflect.get(media, "mediaText");
|
|
2444
|
+
if (typeof mediaText === "string" && mediaText)
|
|
2445
|
+
queries.add(mediaText);
|
|
2446
|
+
const importedStylesheet = Reflect.get(rule, "styleSheet");
|
|
2447
|
+
if (importedStylesheet) {
|
|
2448
|
+
try {
|
|
2449
|
+
const importedMedia = Reflect.get(importedStylesheet, "media");
|
|
2450
|
+
const importedMediaText = importedMedia && Reflect.get(importedMedia, "mediaText");
|
|
2451
|
+
if (typeof importedMediaText === "string" && importedMediaText)
|
|
2452
|
+
queries.add(importedMediaText);
|
|
2453
|
+
const importedRules = Reflect.get(importedStylesheet, "cssRules");
|
|
2454
|
+
if (isCssRuleCollection(importedRules))
|
|
2455
|
+
collectMediaQueries(importedRules, queries);
|
|
2456
|
+
} catch {}
|
|
2457
|
+
}
|
|
2458
|
+
const nestedRules = Reflect.get(rule, "cssRules");
|
|
2459
|
+
if (isCssRuleCollection(nestedRules)) {
|
|
2460
|
+
try {
|
|
2461
|
+
collectMediaQueries(nestedRules, queries);
|
|
2462
|
+
} catch {}
|
|
2463
|
+
}
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
function addMediaQueryListener(mediaQuery) {
|
|
2467
|
+
if (typeof mediaQuery.addEventListener === "function") {
|
|
2468
|
+
mediaQuery.addEventListener("change", invalidateComputedDirections);
|
|
2469
|
+
} else {
|
|
2470
|
+
mediaQuery.addListener?.(invalidateComputedDirections);
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2473
|
+
function removeMediaQueryListener(mediaQuery) {
|
|
2474
|
+
if (typeof mediaQuery.removeEventListener === "function") {
|
|
2475
|
+
mediaQuery.removeEventListener("change", invalidateComputedDirections);
|
|
2476
|
+
} else {
|
|
2477
|
+
mediaQuery.removeListener?.(invalidateComputedDirections);
|
|
2478
|
+
}
|
|
2479
|
+
}
|
|
2480
|
+
function isCssRuleCollection(value) {
|
|
2481
|
+
if (typeof CSSRuleList !== "undefined" && value instanceof CSSRuleList)
|
|
2482
|
+
return true;
|
|
2483
|
+
return typeof value === "object" && value !== null && Symbol.iterator in value;
|
|
2484
|
+
}
|
|
2485
|
+
function refreshMediaQueryObservers() {
|
|
2486
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function")
|
|
2487
|
+
return;
|
|
2488
|
+
const queries = new Set;
|
|
2489
|
+
const roots = new Set([document]);
|
|
2490
|
+
for (const current of computedDirectionObservations) {
|
|
2491
|
+
const root = current.source.getRootNode();
|
|
2492
|
+
if (root instanceof ShadowRoot)
|
|
2493
|
+
roots.add(root);
|
|
2494
|
+
for (const observedRoot of current.roots)
|
|
2495
|
+
roots.add(observedRoot);
|
|
2496
|
+
}
|
|
2497
|
+
for (const root of roots) {
|
|
2498
|
+
const stylesheets = [
|
|
2499
|
+
...Array.from(root.styleSheets ?? []),
|
|
2500
|
+
...Array.from(root.adoptedStyleSheets ?? [])
|
|
2501
|
+
];
|
|
2502
|
+
for (const stylesheet of stylesheets) {
|
|
2503
|
+
try {
|
|
2504
|
+
const mediaText = stylesheet.media?.mediaText;
|
|
2505
|
+
if (mediaText)
|
|
2506
|
+
queries.add(mediaText);
|
|
2507
|
+
collectMediaQueries(stylesheet.cssRules, queries);
|
|
2508
|
+
} catch {}
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
for (const [query, mediaQuery] of observedMediaQueries) {
|
|
2512
|
+
if (queries.has(query))
|
|
2513
|
+
continue;
|
|
2514
|
+
removeMediaQueryListener(mediaQuery);
|
|
2515
|
+
observedMediaQueries.delete(query);
|
|
2516
|
+
}
|
|
2517
|
+
for (const query of queries) {
|
|
2518
|
+
if (observedMediaQueries.has(query))
|
|
2519
|
+
continue;
|
|
2520
|
+
const mediaQuery = window.matchMedia(query);
|
|
2521
|
+
addMediaQueryListener(mediaQuery);
|
|
2522
|
+
observedMediaQueries.set(query, mediaQuery);
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2525
|
+
function startDirectionInvalidationObservers() {
|
|
2526
|
+
if (directionInvalidationStarted || typeof document === "undefined")
|
|
2527
|
+
return;
|
|
2528
|
+
directionInvalidationStarted = true;
|
|
2529
|
+
directionInvalidationDocument = document;
|
|
2530
|
+
directionInvalidationObserver = typeof MutationObserver === "undefined" ? null : new MutationObserver((mutations) => {
|
|
2531
|
+
if (mutations.some(isStylesheetMutation)) {
|
|
2532
|
+
refreshMediaQueryObservers();
|
|
2533
|
+
}
|
|
2534
|
+
invalidateComputedDirections();
|
|
2535
|
+
});
|
|
2536
|
+
directionInvalidationObserver?.observe(document.documentElement, {
|
|
2537
|
+
attributes: true,
|
|
2538
|
+
characterData: true,
|
|
2539
|
+
childList: true,
|
|
2540
|
+
subtree: true
|
|
2541
|
+
});
|
|
2542
|
+
document.addEventListener("load", handleStylesheetLoad, true);
|
|
2543
|
+
if (typeof window !== "undefined" && typeof window.addEventListener === "function") {
|
|
2544
|
+
window.addEventListener("resize", invalidateComputedDirections);
|
|
2545
|
+
window.addEventListener("orientationchange", invalidateComputedDirections);
|
|
2546
|
+
window.addEventListener("hashchange", invalidateComputedDirections);
|
|
2547
|
+
for (const event of directionInvalidationEvents) {
|
|
2548
|
+
document.addEventListener(event, invalidateComputedDirections, true);
|
|
2549
|
+
}
|
|
2550
|
+
}
|
|
2551
|
+
refreshMediaQueryObservers();
|
|
2552
|
+
}
|
|
2553
|
+
function isStylesheetMutation(mutation) {
|
|
2554
|
+
if (mutation.type === "attributes") {
|
|
2555
|
+
return (mutation.target instanceof HTMLStyleElement || isStylesheetLink(mutation.target)) && (mutation.attributeName === "media" || mutation.attributeName === "disabled");
|
|
2556
|
+
}
|
|
2557
|
+
if (mutation.type === "characterData") {
|
|
2558
|
+
return mutation.target.parentElement instanceof HTMLStyleElement;
|
|
2559
|
+
}
|
|
2560
|
+
if (mutation.type !== "childList")
|
|
2561
|
+
return false;
|
|
2562
|
+
if (mutation.target instanceof HTMLStyleElement)
|
|
2563
|
+
return true;
|
|
2564
|
+
return [...mutation.addedNodes, ...mutation.removedNodes].some(containsStylesheetNode);
|
|
2565
|
+
}
|
|
2566
|
+
function containsStylesheetNode(node) {
|
|
2567
|
+
if (node instanceof HTMLStyleElement || isStylesheetLink(node))
|
|
2568
|
+
return true;
|
|
2569
|
+
if (!(node instanceof Element || node instanceof DocumentFragment))
|
|
2570
|
+
return false;
|
|
2571
|
+
return node.querySelector("style") !== null || [...node.querySelectorAll("link")].some(isStylesheetLink);
|
|
2572
|
+
}
|
|
2573
|
+
function isStylesheetLink(node) {
|
|
2574
|
+
return node instanceof HTMLLinkElement && node.rel.split(/\s+/).some((relationship) => relationship.toLowerCase() === "stylesheet");
|
|
2575
|
+
}
|
|
2576
|
+
function observeDirectionShadowRoots(source) {
|
|
2577
|
+
const roots = [];
|
|
2578
|
+
let current = source;
|
|
2579
|
+
while (current) {
|
|
2580
|
+
const root = current.getRootNode();
|
|
2581
|
+
if (root instanceof ShadowRoot) {
|
|
2582
|
+
roots.push(root);
|
|
2583
|
+
const existing = directionInvalidationRoots.get(root);
|
|
2584
|
+
if (existing)
|
|
2585
|
+
existing.count += 1;
|
|
2586
|
+
else {
|
|
2587
|
+
const observer = typeof MutationObserver === "undefined" ? null : new MutationObserver((mutations) => {
|
|
2588
|
+
if (mutations.some(isStylesheetMutation))
|
|
2589
|
+
refreshMediaQueryObservers();
|
|
2590
|
+
invalidateComputedDirections();
|
|
2591
|
+
});
|
|
2592
|
+
observer?.observe(root, {
|
|
2593
|
+
attributes: true,
|
|
2594
|
+
characterData: true,
|
|
2595
|
+
childList: true,
|
|
2596
|
+
subtree: true
|
|
2597
|
+
});
|
|
2598
|
+
root.addEventListener("load", handleStylesheetLoad, true);
|
|
2599
|
+
for (const event of directionInvalidationEvents) {
|
|
2600
|
+
root.addEventListener(event, invalidateComputedDirections, true);
|
|
2601
|
+
}
|
|
2602
|
+
directionInvalidationRoots.set(root, { observer, count: 1 });
|
|
2603
|
+
}
|
|
2604
|
+
}
|
|
2605
|
+
current = getShadowHost(current);
|
|
2606
|
+
}
|
|
2607
|
+
return roots;
|
|
2608
|
+
}
|
|
2609
|
+
function releaseDirectionShadowRoot(root) {
|
|
2610
|
+
const existing = directionInvalidationRoots.get(root);
|
|
2611
|
+
if (!existing)
|
|
2612
|
+
return;
|
|
2613
|
+
existing.count -= 1;
|
|
2614
|
+
if (existing.count > 0)
|
|
2615
|
+
return;
|
|
2616
|
+
existing.observer?.disconnect();
|
|
2617
|
+
root.removeEventListener("load", handleStylesheetLoad, true);
|
|
2618
|
+
for (const event of directionInvalidationEvents) {
|
|
2619
|
+
root.removeEventListener(event, invalidateComputedDirections, true);
|
|
2620
|
+
}
|
|
2621
|
+
directionInvalidationRoots.delete(root);
|
|
2622
|
+
}
|
|
2623
|
+
function stopDirectionInvalidationObservers() {
|
|
2624
|
+
if (computedDirectionObservations.size > 0)
|
|
2625
|
+
return;
|
|
2626
|
+
directionInvalidationStarted = false;
|
|
2627
|
+
directionInvalidationObserver?.disconnect();
|
|
2628
|
+
directionInvalidationObserver = null;
|
|
2629
|
+
directionInvalidationDocument?.removeEventListener("load", handleStylesheetLoad, true);
|
|
2630
|
+
if (typeof window !== "undefined") {
|
|
2631
|
+
window.removeEventListener("resize", invalidateComputedDirections);
|
|
2632
|
+
window.removeEventListener("orientationchange", invalidateComputedDirections);
|
|
2633
|
+
window.removeEventListener("hashchange", invalidateComputedDirections);
|
|
2634
|
+
}
|
|
2635
|
+
for (const event of directionInvalidationEvents) {
|
|
2636
|
+
directionInvalidationDocument?.removeEventListener(event, invalidateComputedDirections, true);
|
|
2637
|
+
}
|
|
2638
|
+
for (const mediaQuery of observedMediaQueries.values()) {
|
|
2639
|
+
removeMediaQueryListener(mediaQuery);
|
|
2640
|
+
}
|
|
2641
|
+
observedMediaQueries.clear();
|
|
2642
|
+
for (const [root, { observer }] of directionInvalidationRoots) {
|
|
2643
|
+
observer?.disconnect();
|
|
2644
|
+
root.removeEventListener("load", handleStylesheetLoad, true);
|
|
2645
|
+
for (const event of directionInvalidationEvents) {
|
|
2646
|
+
root.removeEventListener(event, invalidateComputedDirections, true);
|
|
2647
|
+
}
|
|
2648
|
+
}
|
|
2649
|
+
directionInvalidationRoots.clear();
|
|
2650
|
+
if (directionInvalidationFrame !== null) {
|
|
2651
|
+
if (typeof window !== "undefined")
|
|
2652
|
+
window.cancelAnimationFrame(directionInvalidationFrame);
|
|
2653
|
+
directionInvalidationFrame = null;
|
|
2654
|
+
}
|
|
2655
|
+
directionInvalidationDocument = null;
|
|
2656
|
+
}
|
|
2657
|
+
function handleStylesheetLoad(event) {
|
|
2658
|
+
const target = event.target;
|
|
2659
|
+
if (target instanceof HTMLStyleElement || target instanceof Node && isStylesheetLink(target)) {
|
|
2660
|
+
refreshMediaQueryObservers();
|
|
2661
|
+
invalidateComputedDirections();
|
|
2662
|
+
}
|
|
2663
|
+
}
|
|
2664
|
+
function observeComputedDirection(source, sync, rebindInheritedAttributes) {
|
|
2665
|
+
if (typeof getComputedStyle !== "function" || typeof window === "undefined" || typeof document === "undefined") {
|
|
2666
|
+
return () => {};
|
|
2667
|
+
}
|
|
2668
|
+
const observation = {
|
|
2669
|
+
source,
|
|
2670
|
+
direction: getComputedStyle(source).direction,
|
|
2671
|
+
sync,
|
|
2672
|
+
rebindInheritedAttributes,
|
|
2673
|
+
roots: [],
|
|
2674
|
+
resizeObserver: null,
|
|
2675
|
+
resizeObservedElements: []
|
|
2676
|
+
};
|
|
2677
|
+
computedDirectionObservations.add(observation);
|
|
2678
|
+
startDirectionInvalidationObservers();
|
|
2679
|
+
observation.roots = observeDirectionShadowRoots(source);
|
|
2680
|
+
refreshMediaQueryObservers();
|
|
2681
|
+
rebindResizeObservation(observation, collectResizeObservedElements(source));
|
|
2682
|
+
return () => {
|
|
2683
|
+
computedDirectionObservations.delete(observation);
|
|
2684
|
+
observation.resizeObserver?.disconnect();
|
|
2685
|
+
for (const root of observation.roots)
|
|
2686
|
+
releaseDirectionShadowRoot(root);
|
|
2687
|
+
if (computedDirectionObservations.size === 0) {
|
|
2688
|
+
stopDirectionInvalidationObservers();
|
|
2689
|
+
} else {
|
|
2690
|
+
refreshMediaQueryObservers();
|
|
2691
|
+
}
|
|
2692
|
+
};
|
|
2693
|
+
}
|
|
2694
|
+
function collectDirectionShadowRoots(source) {
|
|
2695
|
+
const roots = [];
|
|
2696
|
+
let current = source;
|
|
2697
|
+
while (current) {
|
|
2698
|
+
const root = current.getRootNode();
|
|
2699
|
+
if (root instanceof ShadowRoot && !roots.includes(root))
|
|
2700
|
+
roots.push(root);
|
|
2701
|
+
current = getShadowHost(current);
|
|
2702
|
+
}
|
|
2703
|
+
return roots;
|
|
2704
|
+
}
|
|
2705
|
+
function collectResizeObservedElements(source) {
|
|
2706
|
+
const elements = [];
|
|
2707
|
+
let current = source;
|
|
2708
|
+
while (current) {
|
|
2709
|
+
elements.push(current);
|
|
2710
|
+
current = current.parentElement ?? getShadowHost(current);
|
|
2711
|
+
}
|
|
2712
|
+
return elements;
|
|
2713
|
+
}
|
|
2714
|
+
function rebindResizeObservation(observation, nextElements) {
|
|
2715
|
+
if (observation.resizeObservedElements.length === nextElements.length && observation.resizeObservedElements.every((element, index) => element === nextElements[index]))
|
|
2716
|
+
return false;
|
|
2717
|
+
observation.resizeObserver?.disconnect();
|
|
2718
|
+
observation.resizeObserver = null;
|
|
2719
|
+
observation.resizeObservedElements = nextElements;
|
|
2720
|
+
if (typeof ResizeObserver === "undefined")
|
|
2721
|
+
return true;
|
|
2722
|
+
const resizeObserver = new ResizeObserver(invalidateComputedDirections);
|
|
2723
|
+
for (const element of nextElements)
|
|
2724
|
+
resizeObserver.observe(element);
|
|
2725
|
+
observation.resizeObserver = resizeObserver;
|
|
2726
|
+
return true;
|
|
2727
|
+
}
|
|
2728
|
+
function rebindComputedDirectionObservation(observation) {
|
|
2729
|
+
const nextRoots = collectDirectionShadowRoots(observation.source);
|
|
2730
|
+
const rootsChanged = nextRoots.length !== observation.roots.length || nextRoots.some((root, index) => root !== observation.roots[index]);
|
|
2731
|
+
if (rootsChanged) {
|
|
2732
|
+
for (const root of observation.roots)
|
|
2733
|
+
releaseDirectionShadowRoot(root);
|
|
2734
|
+
observation.roots = observeDirectionShadowRoots(observation.source);
|
|
2735
|
+
}
|
|
2736
|
+
const resizeChanged = rebindResizeObservation(observation, collectResizeObservedElements(observation.source));
|
|
2737
|
+
return rootsChanged || resizeChanged;
|
|
2738
|
+
}
|
|
2739
|
+
function createPortalAttachment(options = {}) {
|
|
2740
|
+
let lastWarnedUnresolvedKey = null;
|
|
2741
|
+
return (element) => {
|
|
2742
|
+
const initialParent = element.parentElement;
|
|
2743
|
+
const initialAttributes = {
|
|
2744
|
+
dir: element.getAttribute("dir"),
|
|
2745
|
+
lang: element.getAttribute("lang"),
|
|
2746
|
+
dataTheme: element.getAttribute("data-theme"),
|
|
2747
|
+
theme: element.getAttribute("data-cinder-theme")
|
|
2748
|
+
};
|
|
2749
|
+
const preserveInitialDirection = options.explicitAttributes === undefined;
|
|
2750
|
+
const managedAttributes = { dir: null, lang: null, dataTheme: null, theme: null };
|
|
2751
|
+
function currentFallbackAttributes() {
|
|
2752
|
+
const explicitAttributes = readOption(options.explicitAttributes ?? {});
|
|
2753
|
+
const explicitDirection = explicitAttributes.dir;
|
|
2754
|
+
const explicitLanguage = explicitAttributes.lang;
|
|
2755
|
+
const explicitDataTheme = explicitAttributes.dataTheme;
|
|
2756
|
+
const explicitTheme = explicitAttributes.theme;
|
|
2757
|
+
const direction = element.getAttribute("dir");
|
|
2758
|
+
const language = element.getAttribute("lang");
|
|
2759
|
+
const dataTheme = element.getAttribute("data-theme");
|
|
2760
|
+
const theme = element.getAttribute("data-cinder-theme");
|
|
2761
|
+
return {
|
|
2762
|
+
dir: explicitDirection !== undefined ? explicitDirection : direction !== managedAttributes.dir ? direction : preserveInitialDirection ? initialAttributes.dir : null,
|
|
2763
|
+
preserveDirection: explicitDirection !== undefined || preserveInitialDirection && initialAttributes.dir !== null,
|
|
2764
|
+
lang: explicitLanguage !== undefined ? explicitLanguage : language !== managedAttributes.lang ? language : null,
|
|
2765
|
+
preserveLanguage: explicitLanguage !== undefined,
|
|
2766
|
+
dataTheme: explicitDataTheme !== undefined ? explicitDataTheme : dataTheme !== managedAttributes.dataTheme ? dataTheme : null,
|
|
2767
|
+
preserveDataTheme: explicitDataTheme !== undefined,
|
|
2768
|
+
theme: explicitTheme !== undefined ? explicitTheme : theme !== managedAttributes.theme ? theme : null,
|
|
2769
|
+
preserveTheme: explicitTheme !== undefined
|
|
2770
|
+
};
|
|
2771
|
+
}
|
|
2772
|
+
function syncInheritedAttributes(source, inheritAttributes) {
|
|
2773
|
+
const nextManagedAttributes = copyInheritedPortalAttributes(element, source, inheritAttributes, currentFallbackAttributes());
|
|
2774
|
+
managedAttributes.dir = nextManagedAttributes.dir;
|
|
2775
|
+
managedAttributes.lang = nextManagedAttributes.lang;
|
|
2776
|
+
managedAttributes.dataTheme = nextManagedAttributes.dataTheme;
|
|
2777
|
+
managedAttributes.theme = nextManagedAttributes.theme;
|
|
2778
|
+
}
|
|
2779
|
+
const anchor = typeof document !== "undefined" ? document.createComment("@lostgradient/cinder/portal") : null;
|
|
2780
|
+
if (anchor && initialParent && element.parentNode === initialParent) {
|
|
2781
|
+
initialParent.insertBefore(anchor, element);
|
|
2782
|
+
}
|
|
2783
|
+
function restoreInline() {
|
|
2784
|
+
if (!anchor || !anchor.parentNode)
|
|
2785
|
+
return;
|
|
2786
|
+
if (element.parentNode === anchor.parentNode && element.previousSibling === anchor)
|
|
2787
|
+
return;
|
|
2788
|
+
anchor.parentNode.insertBefore(element, anchor.nextSibling);
|
|
2789
|
+
}
|
|
2790
|
+
let activeAttributeSource = null;
|
|
2791
|
+
let activeInheritAttributes = false;
|
|
2792
|
+
$2.user_effect(() => {
|
|
2793
|
+
readOption(options.explicitAttributes ?? {});
|
|
2794
|
+
untrack(() => syncInheritedAttributes(activeAttributeSource, activeInheritAttributes));
|
|
2795
|
+
});
|
|
2796
|
+
$2.user_effect(() => {
|
|
2797
|
+
let stopObservingInheritedAttributes = null;
|
|
2798
|
+
const disabled = readOption(options.disabled ?? false);
|
|
2799
|
+
const inheritAttributes = readOption(options.inheritAttributes ?? true);
|
|
2800
|
+
const targetValue = readOption(options.target ?? null);
|
|
2801
|
+
const attributeSource = readOption(options.source ?? initialParent) ?? initialParent;
|
|
2802
|
+
const rawResolved = disabled ? null : resolvePortalTarget(targetValue);
|
|
2803
|
+
const resolved = rawResolved?.kind === "resolved" && (rawResolved.target === element || element.contains(rawResolved.target)) ? { kind: "unresolved", key: "own-wrapper" } : rawResolved;
|
|
2804
|
+
if (!disabled && resolved?.kind === "resolved") {
|
|
2805
|
+
activeAttributeSource = attributeSource;
|
|
2806
|
+
activeInheritAttributes = inheritAttributes;
|
|
2807
|
+
untrack(() => syncInheritedAttributes(attributeSource, inheritAttributes));
|
|
2808
|
+
stopObservingInheritedAttributes = observeInheritedPortalAttributes(attributeSource, inheritAttributes, () => syncInheritedAttributes(attributeSource, inheritAttributes));
|
|
2809
|
+
if (element.parentElement !== resolved.target) {
|
|
2810
|
+
resolved.target.appendChild(element);
|
|
2811
|
+
}
|
|
2812
|
+
lastWarnedUnresolvedKey = null;
|
|
2813
|
+
} else if (!disabled && resolved?.kind === "unresolved") {
|
|
2814
|
+
restoreInline();
|
|
2815
|
+
activeAttributeSource = null;
|
|
2816
|
+
activeInheritAttributes = false;
|
|
2817
|
+
untrack(() => syncInheritedAttributes(null, false));
|
|
2818
|
+
if (lastWarnedUnresolvedKey !== resolved.key) {
|
|
2819
|
+
devWarn(`[cinder/portal] could not resolve portal target ${JSON.stringify(resolved.key)}.`);
|
|
2820
|
+
lastWarnedUnresolvedKey = resolved.key;
|
|
2821
|
+
}
|
|
2822
|
+
} else if (disabled) {
|
|
2823
|
+
restoreInline();
|
|
2824
|
+
activeAttributeSource = null;
|
|
2825
|
+
activeInheritAttributes = false;
|
|
2826
|
+
untrack(() => syncInheritedAttributes(null, false));
|
|
2827
|
+
lastWarnedUnresolvedKey = null;
|
|
2828
|
+
}
|
|
2829
|
+
return () => {
|
|
2830
|
+
stopObservingInheritedAttributes?.();
|
|
2831
|
+
};
|
|
2832
|
+
});
|
|
2833
|
+
return () => {
|
|
2834
|
+
element.remove();
|
|
2835
|
+
if (anchor && anchor.parentNode) {
|
|
2836
|
+
anchor.parentNode.removeChild(anchor);
|
|
2837
|
+
}
|
|
2838
|
+
};
|
|
2839
|
+
};
|
|
2840
|
+
}
|
|
2841
|
+
|
|
2842
|
+
// src/components/portal/portal.svelte
|
|
2843
|
+
var rest_excludes = new Set([
|
|
2844
|
+
"$$slots",
|
|
2845
|
+
"$$events",
|
|
2846
|
+
"$$legacy",
|
|
2847
|
+
"target",
|
|
2848
|
+
"disabled",
|
|
2849
|
+
"class",
|
|
2850
|
+
"inheritAttributes",
|
|
2851
|
+
"children"
|
|
2852
|
+
]);
|
|
2853
|
+
var root = $3.from_html(`<div><!></div>`);
|
|
2854
|
+
function Portal($$anchor, $$props) {
|
|
2855
|
+
$3.push($$props, true);
|
|
2856
|
+
let target = $3.prop($$props, "target", 3, null), disabled = $3.prop($$props, "disabled", 3, false), inheritAttributes = $3.prop($$props, "inheritAttributes", 3, true), rest = $3.rest_props($$props, rest_excludes);
|
|
2857
|
+
let hasHydrated = $3.state(false);
|
|
2858
|
+
$3.user_effect(() => {
|
|
2859
|
+
$3.set(hasHydrated, true);
|
|
2860
|
+
});
|
|
2861
|
+
const resolvedTarget = $3.derived(() => !disabled() ? resolvePortalTarget(target()) : null);
|
|
2862
|
+
const shouldRenderChildren = $3.derived(() => disabled() || $3.get(hasHydrated) && $3.get(resolvedTarget) !== null);
|
|
2863
|
+
const portalAttachment = createPortalAttachment({
|
|
2864
|
+
target: () => target(),
|
|
2865
|
+
disabled: () => disabled(),
|
|
2866
|
+
inheritAttributes: () => inheritAttributes(),
|
|
2867
|
+
explicitAttributes: () => ({
|
|
2868
|
+
dir: $$props.dir,
|
|
2869
|
+
lang: $$props.lang,
|
|
2870
|
+
dataTheme: rest["data-theme"],
|
|
2871
|
+
theme: rest["data-cinder-theme"]
|
|
2872
|
+
})
|
|
2873
|
+
});
|
|
2874
|
+
var div = root();
|
|
2875
|
+
$3.attribute_effect(div, ($0) => ({ class: $0, ...rest }), [() => classNames($$props.class)]);
|
|
2876
|
+
var node = $3.child(div);
|
|
2877
|
+
{
|
|
2878
|
+
var consequent = ($$anchor2) => {
|
|
2879
|
+
var fragment = $3.comment();
|
|
2880
|
+
var node_1 = $3.first_child(fragment);
|
|
2881
|
+
$3.snippet(node_1, () => $$props.children);
|
|
2882
|
+
$3.append($$anchor2, fragment);
|
|
2883
|
+
};
|
|
2884
|
+
$3.if(node, ($$render) => {
|
|
2885
|
+
if ($3.get(shouldRenderChildren))
|
|
2886
|
+
$$render(consequent);
|
|
2887
|
+
});
|
|
2888
|
+
}
|
|
2889
|
+
$3.reset(div);
|
|
2890
|
+
$3.attach(div, () => portalAttachment);
|
|
2891
|
+
$3.append($$anchor, div);
|
|
2892
|
+
$3.pop();
|
|
2893
|
+
}
|
|
2894
|
+
|
|
2895
|
+
// src/components/portal/index.ts
|
|
2896
|
+
var portal_default = Portal;
|
|
54
2897
|
// src/components/multi-select/index.ts
|
|
55
2898
|
import"@lostgradient/cinder/multi-select/styles";
|
|
56
2899
|
|
|
57
2900
|
// src/components/multi-select/multi-select.svelte
|
|
58
2901
|
import"svelte/internal/disclose-version";
|
|
59
|
-
import * as $
|
|
2902
|
+
import * as $11 from "svelte/internal/client";
|
|
60
2903
|
|
|
61
2904
|
// ../../node_modules/lucide-svelte/dist/icons/chevron-down.svelte
|
|
62
2905
|
import"svelte/internal/disclose-version";
|
|
63
2906
|
import"svelte/internal/flags/legacy";
|
|
64
|
-
import * as $
|
|
2907
|
+
import * as $5 from "svelte/internal/client";
|
|
65
2908
|
|
|
66
2909
|
// ../../node_modules/lucide-svelte/dist/Icon.svelte
|
|
67
2910
|
import"svelte/internal/disclose-version";
|
|
68
2911
|
import"svelte/internal/flags/legacy";
|
|
69
|
-
import * as $ from "svelte/internal/client";
|
|
2912
|
+
import * as $4 from "svelte/internal/client";
|
|
70
2913
|
|
|
71
2914
|
// ../../node_modules/lucide-svelte/dist/defaultAttributes.js
|
|
72
2915
|
var defaultAttributes = {
|
|
@@ -83,10 +2926,10 @@ var defaultAttributes = {
|
|
|
83
2926
|
var defaultAttributes_default = defaultAttributes;
|
|
84
2927
|
|
|
85
2928
|
// ../../node_modules/lucide-svelte/dist/Icon.svelte
|
|
86
|
-
var
|
|
2929
|
+
var root2 = $4.from_svg(`<svg><!><!></svg>`);
|
|
87
2930
|
function Icon($$anchor, $$props) {
|
|
88
|
-
const $$sanitized_props =
|
|
89
|
-
const $$restProps =
|
|
2931
|
+
const $$sanitized_props = $4.legacy_rest_props($$props, ["children", "$$slots", "$$events", "$$legacy"]);
|
|
2932
|
+
const $$restProps = $4.legacy_rest_props($$sanitized_props, [
|
|
90
2933
|
"name",
|
|
91
2934
|
"color",
|
|
92
2935
|
"size",
|
|
@@ -94,19 +2937,19 @@ function Icon($$anchor, $$props) {
|
|
|
94
2937
|
"absoluteStrokeWidth",
|
|
95
2938
|
"iconNode"
|
|
96
2939
|
]);
|
|
97
|
-
|
|
98
|
-
let name =
|
|
99
|
-
let color =
|
|
100
|
-
let size =
|
|
101
|
-
let strokeWidth =
|
|
102
|
-
let absoluteStrokeWidth =
|
|
103
|
-
let iconNode =
|
|
2940
|
+
$4.push($$props, false);
|
|
2941
|
+
let name = $4.prop($$props, "name", 8, undefined);
|
|
2942
|
+
let color = $4.prop($$props, "color", 8, "currentColor");
|
|
2943
|
+
let size = $4.prop($$props, "size", 8, 24);
|
|
2944
|
+
let strokeWidth = $4.prop($$props, "strokeWidth", 8, 2);
|
|
2945
|
+
let absoluteStrokeWidth = $4.prop($$props, "absoluteStrokeWidth", 8, false);
|
|
2946
|
+
let iconNode = $4.prop($$props, "iconNode", 24, () => []);
|
|
104
2947
|
const mergeClasses = (...classes) => classes.filter((className, index2, array) => {
|
|
105
2948
|
return Boolean(className) && array.indexOf(className) === index2;
|
|
106
2949
|
}).join(" ");
|
|
107
|
-
|
|
108
|
-
var svg =
|
|
109
|
-
|
|
2950
|
+
$4.init();
|
|
2951
|
+
var svg = root2();
|
|
2952
|
+
$4.attribute_effect(svg, ($0, $1) => ({
|
|
110
2953
|
...defaultAttributes_default,
|
|
111
2954
|
...$$restProps,
|
|
112
2955
|
width: size(),
|
|
@@ -115,64 +2958,64 @@ function Icon($$anchor, $$props) {
|
|
|
115
2958
|
"stroke-width": $0,
|
|
116
2959
|
class: $1
|
|
117
2960
|
}), [
|
|
118
|
-
() => (
|
|
119
|
-
() => (
|
|
2961
|
+
() => ($4.deep_read_state(absoluteStrokeWidth()), $4.deep_read_state(strokeWidth()), $4.deep_read_state(size()), $4.untrack(() => absoluteStrokeWidth() ? Number(strokeWidth()) * 24 / Number(size()) : strokeWidth())),
|
|
2962
|
+
() => ($4.deep_read_state(name()), $4.deep_read_state($$sanitized_props), $4.untrack(() => mergeClasses("lucide-icon", "lucide", name() ? `lucide-${name()}` : "", $$sanitized_props.class)))
|
|
120
2963
|
]);
|
|
121
|
-
var node =
|
|
122
|
-
|
|
123
|
-
var $$array =
|
|
124
|
-
let tag = () =>
|
|
125
|
-
let attrs = () =>
|
|
126
|
-
var fragment =
|
|
127
|
-
var node_1 =
|
|
128
|
-
|
|
129
|
-
|
|
2964
|
+
var node = $4.child(svg);
|
|
2965
|
+
$4.each(node, 1, iconNode, $4.index, ($$anchor2, $$item) => {
|
|
2966
|
+
var $$array = $4.derived(() => $4.to_array($4.get($$item), 2));
|
|
2967
|
+
let tag = () => $4.get($$array)[0];
|
|
2968
|
+
let attrs = () => $4.get($$array)[1];
|
|
2969
|
+
var fragment = $4.comment();
|
|
2970
|
+
var node_1 = $4.first_child(fragment);
|
|
2971
|
+
$4.element(node_1, tag, true, ($$element, $$anchor3) => {
|
|
2972
|
+
$4.attribute_effect($$element, () => ({ ...attrs() }));
|
|
130
2973
|
});
|
|
131
|
-
|
|
2974
|
+
$4.append($$anchor2, fragment);
|
|
132
2975
|
});
|
|
133
|
-
var node_2 =
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
2976
|
+
var node_2 = $4.sibling(node);
|
|
2977
|
+
$4.slot(node_2, $$props, "default", {}, null);
|
|
2978
|
+
$4.reset(svg);
|
|
2979
|
+
$4.append($$anchor, svg);
|
|
2980
|
+
$4.pop();
|
|
138
2981
|
}
|
|
139
2982
|
|
|
140
2983
|
// ../../node_modules/lucide-svelte/dist/icons/chevron-down.svelte
|
|
141
2984
|
function Chevron_down($$anchor, $$props) {
|
|
142
|
-
const $$sanitized_props = $
|
|
2985
|
+
const $$sanitized_props = $5.legacy_rest_props($$props, ["children", "$$slots", "$$events", "$$legacy"]);
|
|
143
2986
|
const iconNode = [["path", { d: "m6 9 6 6 6-6" }]];
|
|
144
|
-
Icon($$anchor, $
|
|
2987
|
+
Icon($$anchor, $5.spread_props({ name: "chevron-down" }, () => $$sanitized_props, {
|
|
145
2988
|
get iconNode() {
|
|
146
2989
|
return iconNode;
|
|
147
2990
|
},
|
|
148
2991
|
children: ($$anchor2, $$slotProps) => {
|
|
149
|
-
var fragment_1 = $
|
|
150
|
-
var node = $
|
|
151
|
-
$
|
|
152
|
-
$
|
|
2992
|
+
var fragment_1 = $5.comment();
|
|
2993
|
+
var node = $5.first_child(fragment_1);
|
|
2994
|
+
$5.slot(node, $$props, "default", {}, null);
|
|
2995
|
+
$5.append($$anchor2, fragment_1);
|
|
153
2996
|
},
|
|
154
2997
|
$$slots: { default: true }
|
|
155
2998
|
}));
|
|
156
2999
|
}
|
|
157
3000
|
// src/components/multi-select/multi-select.svelte
|
|
158
|
-
import { tick, untrack as
|
|
3001
|
+
import { tick, untrack as untrack3 } from "svelte";
|
|
159
3002
|
|
|
160
3003
|
// src/components/_internal/checkbox-indicator-shell.svelte
|
|
161
3004
|
import"svelte/internal/disclose-version";
|
|
162
|
-
import * as $
|
|
163
|
-
var
|
|
3005
|
+
import * as $6 from "svelte/internal/client";
|
|
3006
|
+
var root3 = $6.from_html(`<span data-cinder-checkbox-indicator-shell=""><!> <span class="cinder-checkbox-field__indicator" aria-hidden="true"></span></span>`);
|
|
164
3007
|
function Checkbox_indicator_shell($$anchor, $$props) {
|
|
165
|
-
var span =
|
|
166
|
-
var node = $
|
|
167
|
-
$
|
|
168
|
-
$
|
|
169
|
-
$
|
|
170
|
-
$
|
|
171
|
-
$
|
|
3008
|
+
var span = root3();
|
|
3009
|
+
var node = $6.child(span);
|
|
3010
|
+
$6.snippet(node, () => $$props.control);
|
|
3011
|
+
$6.next(2);
|
|
3012
|
+
$6.reset(span);
|
|
3013
|
+
$6.template_effect(() => $6.set_class(span, 1, $6.clsx(["cinder-checkbox-field__control", $$props.class])));
|
|
3014
|
+
$6.append($$anchor, span);
|
|
172
3015
|
}
|
|
173
3016
|
|
|
174
3017
|
// src/components/_internal/create-command-list-state.svelte.ts
|
|
175
|
-
import * as $
|
|
3018
|
+
import * as $7 from "svelte/internal/client";
|
|
176
3019
|
|
|
177
3020
|
// src/_internal/overlay.ts
|
|
178
3021
|
var escapeStack = [];
|
|
@@ -256,54 +3099,54 @@ function inDocumentOrder(items) {
|
|
|
256
3099
|
class CommandListState {
|
|
257
3100
|
#getListboxId;
|
|
258
3101
|
#autoActivateFirst = true;
|
|
259
|
-
#registeredListboxId = $
|
|
260
|
-
#registrations = $
|
|
3102
|
+
#registeredListboxId = $7.state("");
|
|
3103
|
+
#registrations = $7.state($7.proxy([]));
|
|
261
3104
|
get registrations() {
|
|
262
|
-
return $
|
|
3105
|
+
return $7.get(this.#registrations);
|
|
263
3106
|
}
|
|
264
3107
|
set registrations(value) {
|
|
265
|
-
$
|
|
3108
|
+
$7.set(this.#registrations, value, true);
|
|
266
3109
|
}
|
|
267
|
-
#registrationsReady = $
|
|
3110
|
+
#registrationsReady = $7.state(false);
|
|
268
3111
|
get registrationsReady() {
|
|
269
|
-
return $
|
|
3112
|
+
return $7.get(this.#registrationsReady);
|
|
270
3113
|
}
|
|
271
3114
|
set registrationsReady(value) {
|
|
272
|
-
$
|
|
3115
|
+
$7.set(this.#registrationsReady, value, true);
|
|
273
3116
|
}
|
|
274
3117
|
#itemCounter = 0;
|
|
275
3118
|
#readyCycle = 0;
|
|
276
|
-
#intendedActiveId = $
|
|
277
|
-
#enabledIds = $
|
|
3119
|
+
#intendedActiveId = $7.state(null);
|
|
3120
|
+
#enabledIds = $7.derived(() => {
|
|
278
3121
|
return inDocumentOrder(this.registrations).filter((registration) => !registration.getDisabled()).map((registration) => registration.id);
|
|
279
3122
|
});
|
|
280
3123
|
get enabledIds() {
|
|
281
|
-
return $
|
|
3124
|
+
return $7.get(this.#enabledIds);
|
|
282
3125
|
}
|
|
283
3126
|
set enabledIds(value) {
|
|
284
|
-
$
|
|
3127
|
+
$7.set(this.#enabledIds, value);
|
|
285
3128
|
}
|
|
286
|
-
#activeItemId = $
|
|
3129
|
+
#activeItemId = $7.derived(() => $7.get(this.#intendedActiveId) !== null && this.enabledIds.includes($7.get(this.#intendedActiveId)) ? $7.get(this.#intendedActiveId) : this.#autoActivateFirst ? this.enabledIds[0] ?? null : null);
|
|
287
3130
|
get activeItemId() {
|
|
288
|
-
return $
|
|
3131
|
+
return $7.get(this.#activeItemId);
|
|
289
3132
|
}
|
|
290
3133
|
set activeItemId(value) {
|
|
291
|
-
$
|
|
3134
|
+
$7.set(this.#activeItemId, value);
|
|
292
3135
|
}
|
|
293
3136
|
constructor(listboxId, options = {}) {
|
|
294
3137
|
this.#getListboxId = typeof listboxId === "function" ? listboxId : () => listboxId;
|
|
295
|
-
$
|
|
3138
|
+
$7.set(this.#registeredListboxId, this.#getListboxId(), true);
|
|
296
3139
|
this.#autoActivateFirst = options.autoActivateFirst ?? true;
|
|
297
3140
|
}
|
|
298
3141
|
get listboxId() {
|
|
299
|
-
return $
|
|
3142
|
+
return $7.get(this.#registeredListboxId);
|
|
300
3143
|
}
|
|
301
3144
|
syncListboxId(nextListboxId = this.#getListboxId()) {
|
|
302
3145
|
const listboxId = nextListboxId;
|
|
303
|
-
if ($
|
|
3146
|
+
if ($7.get(this.#registeredListboxId) === listboxId)
|
|
304
3147
|
return;
|
|
305
|
-
$
|
|
306
|
-
$
|
|
3148
|
+
$7.set(this.#registeredListboxId, listboxId, true);
|
|
3149
|
+
$7.set(this.#intendedActiveId, null);
|
|
307
3150
|
this.registrations = this.registrations.map((registration, index2) => ({
|
|
308
3151
|
...registration,
|
|
309
3152
|
id: updateRegistrationHandleId(registration, `${listboxId}-item-${index2 + 1}`)
|
|
@@ -312,7 +3155,7 @@ class CommandListState {
|
|
|
312
3155
|
this.refreshRegistrationsReady();
|
|
313
3156
|
}
|
|
314
3157
|
resetActiveItem() {
|
|
315
|
-
$
|
|
3158
|
+
$7.set(this.#intendedActiveId, null);
|
|
316
3159
|
}
|
|
317
3160
|
refreshRegistrationsReady() {
|
|
318
3161
|
this.registrationsReady = false;
|
|
@@ -358,12 +3201,12 @@ class CommandListState {
|
|
|
358
3201
|
};
|
|
359
3202
|
}
|
|
360
3203
|
setActiveById(id) {
|
|
361
|
-
$
|
|
3204
|
+
$7.set(this.#intendedActiveId, id, true);
|
|
362
3205
|
}
|
|
363
3206
|
register(input, node) {
|
|
364
3207
|
this.syncListboxId();
|
|
365
3208
|
const id = `${this.listboxId}-item-${++this.#itemCounter}`;
|
|
366
|
-
const handle = $
|
|
3209
|
+
const handle = $7.proxy({
|
|
367
3210
|
id,
|
|
368
3211
|
unregister: () => {
|
|
369
3212
|
const index2 = this.registrations.findIndex((registeredItem) => registeredItem.node === node);
|
|
@@ -383,10 +3226,10 @@ class CommandListState {
|
|
|
383
3226
|
return handle;
|
|
384
3227
|
}
|
|
385
3228
|
syncItems(items) {
|
|
386
|
-
const previousActiveId = $
|
|
3229
|
+
const previousActiveId = $7.get(this.#intendedActiveId);
|
|
387
3230
|
this.registrations = items.map((item) => ({ ...item, handle: { id: item.id, unregister: () => {} } }));
|
|
388
3231
|
this.#itemCounter = items.length;
|
|
389
|
-
$
|
|
3232
|
+
$7.set(this.#intendedActiveId, items.some((item) => item.id === previousActiveId) ? previousActiveId : null, true);
|
|
390
3233
|
this.refreshRegistrationsReady();
|
|
391
3234
|
}
|
|
392
3235
|
activateItemById(id) {
|
|
@@ -414,7 +3257,7 @@ class CommandListState {
|
|
|
414
3257
|
if (ids.length === 0)
|
|
415
3258
|
return true;
|
|
416
3259
|
const index2 = this.activeItemId === null ? -1 : ids.indexOf(this.activeItemId);
|
|
417
|
-
$
|
|
3260
|
+
$7.set(this.#intendedActiveId, ids[(index2 + 1) % ids.length] ?? null, true);
|
|
418
3261
|
return true;
|
|
419
3262
|
}
|
|
420
3263
|
if (event.key === "ArrowUp") {
|
|
@@ -424,21 +3267,21 @@ class CommandListState {
|
|
|
424
3267
|
if (ids.length === 0)
|
|
425
3268
|
return true;
|
|
426
3269
|
const index2 = this.activeItemId === null ? 0 : ids.indexOf(this.activeItemId);
|
|
427
|
-
$
|
|
3270
|
+
$7.set(this.#intendedActiveId, ids[index2 <= 0 ? ids.length - 1 : index2 - 1] ?? null, true);
|
|
428
3271
|
return true;
|
|
429
3272
|
}
|
|
430
3273
|
if (event.key === "Home") {
|
|
431
3274
|
if (ignoreModifiedNavigation && isModified)
|
|
432
3275
|
return false;
|
|
433
3276
|
event.preventDefault();
|
|
434
|
-
$
|
|
3277
|
+
$7.set(this.#intendedActiveId, ids[0] ?? null, true);
|
|
435
3278
|
return true;
|
|
436
3279
|
}
|
|
437
3280
|
if (event.key === "End") {
|
|
438
3281
|
if (ignoreModifiedNavigation && isModified)
|
|
439
3282
|
return false;
|
|
440
3283
|
event.preventDefault();
|
|
441
|
-
$
|
|
3284
|
+
$7.set(this.#intendedActiveId, ids[ids.length - 1] ?? null, true);
|
|
442
3285
|
return true;
|
|
443
3286
|
}
|
|
444
3287
|
if (event.key === "Enter") {
|
|
@@ -487,6 +3330,229 @@ function updateRegistrationHandleId(registration, id) {
|
|
|
487
3330
|
return id;
|
|
488
3331
|
}
|
|
489
3332
|
|
|
3333
|
+
// src/_internal/anchored-overlay.svelte.ts
|
|
3334
|
+
import * as $8 from "svelte/internal/client";
|
|
3335
|
+
var DEFAULT_PLACEMENT = "bottom-start";
|
|
3336
|
+
var DEFAULT_OFFSET = 8;
|
|
3337
|
+
var DEFAULT_SHIFT_PADDING = 8;
|
|
3338
|
+
var DEFAULT_ARROW_PADDING = 6;
|
|
3339
|
+
function getAnchoredOverlayWidthStyle(widthMode, anchorRect) {
|
|
3340
|
+
if (widthMode === "none")
|
|
3341
|
+
return "";
|
|
3342
|
+
if (widthMode === "match-anchor") {
|
|
3343
|
+
const width = Math.max(0, anchorRect?.width ?? 0);
|
|
3344
|
+
return width > 0 ? `min-inline-size: ${width}px; inline-size: ${width}px;` : "";
|
|
3345
|
+
}
|
|
3346
|
+
if (widthMode === "menu") {
|
|
3347
|
+
return [
|
|
3348
|
+
"inline-size: max-content;",
|
|
3349
|
+
"min-inline-size: min(12rem, calc(100vw - var(--cinder-space-4)));",
|
|
3350
|
+
"max-inline-size: min(24rem, calc(100vw - var(--cinder-space-4)));"
|
|
3351
|
+
].join(" ");
|
|
3352
|
+
}
|
|
3353
|
+
return "max-inline-size: min(28rem, calc(100vw - var(--cinder-space-4)));";
|
|
3354
|
+
}
|
|
3355
|
+
function getAnchoredOverlayAvailableHeightStyle(availableHeight) {
|
|
3356
|
+
return `${Math.max(0, availableHeight)}px`;
|
|
3357
|
+
}
|
|
3358
|
+
function getAnchoredOverlayMaxBlockSizeStyle(availableHeight, maximumBlockSize) {
|
|
3359
|
+
return `min(${maximumBlockSize}, ${getAnchoredOverlayAvailableHeightStyle(availableHeight)})`;
|
|
3360
|
+
}
|
|
3361
|
+
function applyAnchoredOverlayMaxBlockSize(panel, availableHeight, maximumBlockSize) {
|
|
3362
|
+
const value = getAnchoredOverlayMaxBlockSizeStyle(availableHeight, maximumBlockSize);
|
|
3363
|
+
panel.style.maxBlockSize = value;
|
|
3364
|
+
return value;
|
|
3365
|
+
}
|
|
3366
|
+
function isAnchoredOverlayWriteCurrent(positioningGeneration, latestGeneration, cancelled) {
|
|
3367
|
+
return !cancelled && positioningGeneration === latestGeneration;
|
|
3368
|
+
}
|
|
3369
|
+
function getArrowStyle(data) {
|
|
3370
|
+
if (!data)
|
|
3371
|
+
return "";
|
|
3372
|
+
return [
|
|
3373
|
+
data.x != null ? `left: ${data.x}px;` : "",
|
|
3374
|
+
data.y != null ? `top: ${data.y}px;` : ""
|
|
3375
|
+
].filter(Boolean).join(" ");
|
|
3376
|
+
}
|
|
3377
|
+
function reportAnchoredOverlaySetupError(error) {
|
|
3378
|
+
if (typeof globalThis.reportError === "function") {
|
|
3379
|
+
globalThis.reportError(error);
|
|
3380
|
+
return;
|
|
3381
|
+
}
|
|
3382
|
+
setTimeout(() => {
|
|
3383
|
+
throw error;
|
|
3384
|
+
}, 0);
|
|
3385
|
+
}
|
|
3386
|
+
var floatingUiModulePromise;
|
|
3387
|
+
function cacheFloatingUiModule(load) {
|
|
3388
|
+
floatingUiModulePromise ??= load().catch((error) => {
|
|
3389
|
+
floatingUiModulePromise = undefined;
|
|
3390
|
+
throw error;
|
|
3391
|
+
});
|
|
3392
|
+
return floatingUiModulePromise;
|
|
3393
|
+
}
|
|
3394
|
+
function createAnchoredOverlay(options) {
|
|
3395
|
+
let positionReady = $8.state(false);
|
|
3396
|
+
let positionStyle = $8.state("");
|
|
3397
|
+
let availableHeightStyle = $8.state("");
|
|
3398
|
+
let resolvedPlacement = $8.state($8.proxy(options.placement?.() ?? DEFAULT_PLACEMENT));
|
|
3399
|
+
let arrowStyle = $8.state("");
|
|
3400
|
+
$8.user_effect(() => {
|
|
3401
|
+
const anchor = options.anchor();
|
|
3402
|
+
const panel = options.panel();
|
|
3403
|
+
if (!anchor || !panel)
|
|
3404
|
+
return;
|
|
3405
|
+
cacheFloatingUiModule(() => Promise.resolve().then(() => (init_floating_ui_dom(), exports_floating_ui_dom))).catch(() => {});
|
|
3406
|
+
});
|
|
3407
|
+
$8.user_effect(() => {
|
|
3408
|
+
if (!options.open()) {
|
|
3409
|
+
$8.set(positionReady, false);
|
|
3410
|
+
$8.set(positionStyle, "");
|
|
3411
|
+
$8.set(availableHeightStyle, "");
|
|
3412
|
+
$8.set(arrowStyle, "");
|
|
3413
|
+
$8.set(resolvedPlacement, options.placement?.() ?? DEFAULT_PLACEMENT, true);
|
|
3414
|
+
return;
|
|
3415
|
+
}
|
|
3416
|
+
const anchor = options.anchor();
|
|
3417
|
+
const panel = options.panel();
|
|
3418
|
+
if (!anchor || !panel) {
|
|
3419
|
+
$8.set(positionReady, false);
|
|
3420
|
+
$8.set(positionStyle, "");
|
|
3421
|
+
$8.set(availableHeightStyle, "");
|
|
3422
|
+
$8.set(arrowStyle, "");
|
|
3423
|
+
return;
|
|
3424
|
+
}
|
|
3425
|
+
const placement = options.placement?.() ?? DEFAULT_PLACEMENT;
|
|
3426
|
+
const offset3 = options.offset?.() ?? DEFAULT_OFFSET;
|
|
3427
|
+
const shiftPadding = options.shiftPadding?.() ?? DEFAULT_SHIFT_PADDING;
|
|
3428
|
+
const shiftCrossAxis = options.shiftCrossAxis?.() ?? false;
|
|
3429
|
+
const arrowPadding = options.arrowPadding?.() ?? DEFAULT_ARROW_PADDING;
|
|
3430
|
+
const arrow3 = options.arrow?.();
|
|
3431
|
+
const arrowVisible = options.arrowVisible?.() ?? Boolean(arrow3);
|
|
3432
|
+
const sizeEnabled = options.size?.() ?? false;
|
|
3433
|
+
const sizeMaxBlockSize = options.sizeMaxBlockSize?.() ?? "100%";
|
|
3434
|
+
const widthMode = options.widthMode?.() ?? "content";
|
|
3435
|
+
const strategyOverride = options.strategy?.();
|
|
3436
|
+
const boundary = options.boundary?.() ?? undefined;
|
|
3437
|
+
let cancelled = false;
|
|
3438
|
+
let generation = 0;
|
|
3439
|
+
let stopAutoUpdate;
|
|
3440
|
+
let boundaryResizeObserver;
|
|
3441
|
+
(async () => {
|
|
3442
|
+
const {
|
|
3443
|
+
arrow: arrowMiddleware,
|
|
3444
|
+
autoUpdate: autoUpdate2,
|
|
3445
|
+
computePosition: computePosition3,
|
|
3446
|
+
flip: flip3,
|
|
3447
|
+
offset: offsetMiddleware,
|
|
3448
|
+
size: sizeMiddleware,
|
|
3449
|
+
shift: shift3
|
|
3450
|
+
} = await cacheFloatingUiModule(() => Promise.resolve().then(() => (init_floating_ui_dom(), exports_floating_ui_dom)));
|
|
3451
|
+
if (cancelled)
|
|
3452
|
+
return;
|
|
3453
|
+
const updatePosition = async () => {
|
|
3454
|
+
if (cancelled)
|
|
3455
|
+
return;
|
|
3456
|
+
const currentGeneration = ++generation;
|
|
3457
|
+
if (!sizeEnabled) {
|
|
3458
|
+
$8.set(availableHeightStyle, "");
|
|
3459
|
+
panel.style.removeProperty("max-block-size");
|
|
3460
|
+
}
|
|
3461
|
+
const middleware = [
|
|
3462
|
+
offsetMiddleware(offset3),
|
|
3463
|
+
flip3(boundary ? { boundary } : undefined)
|
|
3464
|
+
];
|
|
3465
|
+
if (sizeEnabled) {
|
|
3466
|
+
middleware.push(sizeMiddleware({
|
|
3467
|
+
...boundary ? { boundary } : {},
|
|
3468
|
+
padding: shiftPadding,
|
|
3469
|
+
apply({ availableHeight }) {
|
|
3470
|
+
if (!isAnchoredOverlayWriteCurrent(currentGeneration, generation, cancelled))
|
|
3471
|
+
return;
|
|
3472
|
+
$8.set(availableHeightStyle, applyAnchoredOverlayMaxBlockSize(panel, availableHeight, sizeMaxBlockSize), true);
|
|
3473
|
+
}
|
|
3474
|
+
}));
|
|
3475
|
+
}
|
|
3476
|
+
middleware.push(shift3({
|
|
3477
|
+
...boundary ? { boundary } : {},
|
|
3478
|
+
padding: shiftPadding,
|
|
3479
|
+
crossAxis: shiftCrossAxis
|
|
3480
|
+
}));
|
|
3481
|
+
if (arrowVisible && arrow3) {
|
|
3482
|
+
middleware.push(arrowMiddleware({ element: arrow3, padding: arrowPadding }));
|
|
3483
|
+
}
|
|
3484
|
+
let result;
|
|
3485
|
+
const strategy = strategyOverride ?? (panel.closest("dialog") ? "absolute" : "fixed");
|
|
3486
|
+
try {
|
|
3487
|
+
result = await computePosition3(anchor, panel, { placement, middleware, strategy });
|
|
3488
|
+
} catch {
|
|
3489
|
+
if (cancelled || currentGeneration !== generation)
|
|
3490
|
+
return;
|
|
3491
|
+
$8.set(positionReady, false);
|
|
3492
|
+
$8.set(positionStyle, "");
|
|
3493
|
+
$8.set(arrowStyle, "");
|
|
3494
|
+
$8.set(resolvedPlacement, placement, true);
|
|
3495
|
+
return;
|
|
3496
|
+
}
|
|
3497
|
+
if (cancelled || currentGeneration !== generation)
|
|
3498
|
+
return;
|
|
3499
|
+
const widthStyle = getAnchoredOverlayWidthStyle(widthMode, anchor.getBoundingClientRect());
|
|
3500
|
+
$8.set(positionStyle, [
|
|
3501
|
+
`position: ${strategy};`,
|
|
3502
|
+
`left: ${result.x}px;`,
|
|
3503
|
+
`top: ${result.y}px;`,
|
|
3504
|
+
$8.get(availableHeightStyle) ? `max-block-size: ${$8.get(availableHeightStyle)};` : "",
|
|
3505
|
+
widthStyle
|
|
3506
|
+
].filter(Boolean).join(" "), true);
|
|
3507
|
+
$8.set(resolvedPlacement, result.placement, true);
|
|
3508
|
+
$8.set(arrowStyle, arrowVisible ? getArrowStyle(result.middlewareData.arrow) : "", true);
|
|
3509
|
+
$8.set(positionReady, true);
|
|
3510
|
+
};
|
|
3511
|
+
stopAutoUpdate = autoUpdate2(anchor, panel, updatePosition);
|
|
3512
|
+
if (boundary && boundary !== anchor && boundary !== panel && typeof ResizeObserver !== "undefined") {
|
|
3513
|
+
boundaryResizeObserver = new ResizeObserver(() => {
|
|
3514
|
+
updatePosition();
|
|
3515
|
+
});
|
|
3516
|
+
boundaryResizeObserver.observe(boundary);
|
|
3517
|
+
}
|
|
3518
|
+
})().catch((error) => {
|
|
3519
|
+
if (cancelled)
|
|
3520
|
+
return;
|
|
3521
|
+
$8.set(positionReady, false);
|
|
3522
|
+
$8.set(positionStyle, "");
|
|
3523
|
+
$8.set(availableHeightStyle, "");
|
|
3524
|
+
$8.set(arrowStyle, "");
|
|
3525
|
+
$8.set(resolvedPlacement, placement, true);
|
|
3526
|
+
reportAnchoredOverlaySetupError(error);
|
|
3527
|
+
});
|
|
3528
|
+
return () => {
|
|
3529
|
+
cancelled = true;
|
|
3530
|
+
stopAutoUpdate?.();
|
|
3531
|
+
boundaryResizeObserver?.disconnect();
|
|
3532
|
+
panel.style.removeProperty("max-block-size");
|
|
3533
|
+
$8.set(positionReady, false);
|
|
3534
|
+
$8.set(positionStyle, "");
|
|
3535
|
+
$8.set(availableHeightStyle, "");
|
|
3536
|
+
$8.set(arrowStyle, "");
|
|
3537
|
+
$8.set(resolvedPlacement, placement, true);
|
|
3538
|
+
};
|
|
3539
|
+
});
|
|
3540
|
+
return {
|
|
3541
|
+
get positionReady() {
|
|
3542
|
+
return $8.get(positionReady);
|
|
3543
|
+
},
|
|
3544
|
+
get positionStyle() {
|
|
3545
|
+
return $8.get(positionStyle);
|
|
3546
|
+
},
|
|
3547
|
+
get resolvedPlacement() {
|
|
3548
|
+
return $8.get(resolvedPlacement);
|
|
3549
|
+
},
|
|
3550
|
+
get arrowStyle() {
|
|
3551
|
+
return $8.get(arrowStyle);
|
|
3552
|
+
}
|
|
3553
|
+
};
|
|
3554
|
+
}
|
|
3555
|
+
|
|
490
3556
|
// src/_internal/field-control.ts
|
|
491
3557
|
function describeId(fieldId, hasDescription) {
|
|
492
3558
|
return hasDescription ? `${fieldId}-description` : undefined;
|
|
@@ -548,28 +3614,23 @@ var getFormFieldContext = optionalContext(getFormFieldContextStrict);
|
|
|
548
3614
|
|
|
549
3615
|
// src/_internal/form-field-frame.svelte
|
|
550
3616
|
import"svelte/internal/disclose-version";
|
|
551
|
-
import * as $
|
|
3617
|
+
import * as $10 from "svelte/internal/client";
|
|
552
3618
|
|
|
553
3619
|
// src/_internal/form-field-provider.svelte
|
|
554
3620
|
import"svelte/internal/disclose-version";
|
|
555
|
-
import * as $
|
|
3621
|
+
import * as $9 from "svelte/internal/client";
|
|
556
3622
|
function Form_field_provider($$anchor, $$props) {
|
|
557
|
-
$
|
|
3623
|
+
$9.push($$props, true);
|
|
558
3624
|
setFormFieldContext($$props.context);
|
|
559
|
-
var fragment = $
|
|
560
|
-
var node = $
|
|
561
|
-
$
|
|
562
|
-
$
|
|
563
|
-
$
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
// src/utilities/class-names.ts
|
|
567
|
-
function classNames(...parts) {
|
|
568
|
-
return parts.filter((part) => typeof part === "string" && part.length > 0).join(" ");
|
|
3625
|
+
var fragment = $9.comment();
|
|
3626
|
+
var node = $9.first_child(fragment);
|
|
3627
|
+
$9.snippet(node, () => $$props.children);
|
|
3628
|
+
$9.append($$anchor, fragment);
|
|
3629
|
+
$9.pop();
|
|
569
3630
|
}
|
|
570
3631
|
|
|
571
3632
|
// src/_internal/form-field-frame.svelte
|
|
572
|
-
var
|
|
3633
|
+
var rest_excludes2 = new Set([
|
|
573
3634
|
"$$slots",
|
|
574
3635
|
"$$events",
|
|
575
3636
|
"$$legacy",
|
|
@@ -599,39 +3660,39 @@ var rest_excludes = new Set([
|
|
|
599
3660
|
"after",
|
|
600
3661
|
"message"
|
|
601
3662
|
]);
|
|
602
|
-
var
|
|
603
|
-
var root_1 = $
|
|
604
|
-
var root_2 = $
|
|
605
|
-
var root_3 = $
|
|
606
|
-
var root_4 = $
|
|
607
|
-
var root_5 = $
|
|
3663
|
+
var root4 = $10.from_html(`<span class="cinder-_required-marker" aria-hidden="true">*</span>`);
|
|
3664
|
+
var root_1 = $10.from_html(`<label> <!></label>`);
|
|
3665
|
+
var root_2 = $10.from_html(`<div><!> <!> <!></div>`);
|
|
3666
|
+
var root_3 = $10.from_html(`<p> </p>`);
|
|
3667
|
+
var root_4 = $10.from_html(`<p aria-live="polite"> </p>`);
|
|
3668
|
+
var root_5 = $10.from_html(`<div><!> <!> <!> <!> <!></div>`);
|
|
608
3669
|
function Form_field_frame($$anchor, $$props) {
|
|
609
|
-
$
|
|
610
|
-
let hideLabel = $
|
|
611
|
-
const labelId = $
|
|
612
|
-
const descriptionId = $
|
|
613
|
-
const errorId2 = $
|
|
614
|
-
const describedBy = $
|
|
615
|
-
const invalid = $
|
|
616
|
-
const needsControlWrapper = $
|
|
3670
|
+
$10.push($$props, true);
|
|
3671
|
+
let hideLabel = $10.prop($$props, "hideLabel", 3, false), required = $10.prop($$props, "required", 3, false), disabled = $10.prop($$props, "disabled", 3, false), controlLeading = $10.prop($$props, "controlLeading", 3, false), controlTrailing = $10.prop($$props, "controlTrailing", 3, false), controlNativeDate = $10.prop($$props, "controlNativeDate", 3, false), controlDisabled = $10.prop($$props, "controlDisabled", 3, false), controlInvalid = $10.prop($$props, "controlInvalid", 3, false), fullWidth = $10.prop($$props, "fullWidth", 3, false), errorAlwaysMounted = $10.prop($$props, "errorAlwaysMounted", 3, false), rest = $10.rest_props($$props, rest_excludes2);
|
|
3672
|
+
const labelId = $10.derived(() => $$props.label ? `${$$props.id}-label` : undefined);
|
|
3673
|
+
const descriptionId = $10.derived(() => $$props.descriptionId ?? describeId($$props.id, !!$$props.description));
|
|
3674
|
+
const errorId2 = $10.derived(() => $$props.errorId ?? errorId($$props.id, !!$$props.error));
|
|
3675
|
+
const describedBy = $10.derived(() => composeDescribedBy($10.get(descriptionId), $10.get(errorId2)));
|
|
3676
|
+
const invalid = $10.derived(() => ariaInvalid(!!$$props.error));
|
|
3677
|
+
const needsControlWrapper = $10.derived(() => !!$$props.controlClass || !!$$props.before || !!$$props.after);
|
|
617
3678
|
const context = {
|
|
618
3679
|
get controlId() {
|
|
619
3680
|
return $$props.id;
|
|
620
3681
|
},
|
|
621
3682
|
get labelId() {
|
|
622
|
-
return $
|
|
3683
|
+
return $10.get(labelId);
|
|
623
3684
|
},
|
|
624
3685
|
get describedBy() {
|
|
625
|
-
return $
|
|
3686
|
+
return $10.get(describedBy);
|
|
626
3687
|
},
|
|
627
3688
|
get descriptionId() {
|
|
628
|
-
return $
|
|
3689
|
+
return $10.get(descriptionId);
|
|
629
3690
|
},
|
|
630
3691
|
get errorId() {
|
|
631
|
-
return $
|
|
3692
|
+
return $10.get(errorId2);
|
|
632
3693
|
},
|
|
633
3694
|
get invalid() {
|
|
634
|
-
return $
|
|
3695
|
+
return $10.get(invalid);
|
|
635
3696
|
},
|
|
636
3697
|
get required() {
|
|
637
3698
|
return required();
|
|
@@ -641,99 +3702,99 @@ function Form_field_frame($$anchor, $$props) {
|
|
|
641
3702
|
}
|
|
642
3703
|
};
|
|
643
3704
|
var div = root_5();
|
|
644
|
-
$
|
|
3705
|
+
$10.attribute_effect(div, ($0) => ({
|
|
645
3706
|
...rest,
|
|
646
3707
|
class: $0,
|
|
647
3708
|
"data-cinder-full-width": fullWidth() ? "" : undefined
|
|
648
3709
|
}), [() => classNames("cinder-form-field", $$props.class)]);
|
|
649
|
-
var node = $
|
|
3710
|
+
var node = $10.child(div);
|
|
650
3711
|
{
|
|
651
3712
|
var consequent_1 = ($$anchor2) => {
|
|
652
3713
|
var label_1 = root_1();
|
|
653
|
-
var text = $
|
|
654
|
-
var node_1 = $
|
|
3714
|
+
var text = $10.child(label_1);
|
|
3715
|
+
var node_1 = $10.sibling(text);
|
|
655
3716
|
{
|
|
656
3717
|
var consequent = ($$anchor3) => {
|
|
657
|
-
var span =
|
|
658
|
-
$
|
|
3718
|
+
var span = root4();
|
|
3719
|
+
$10.append($$anchor3, span);
|
|
659
3720
|
};
|
|
660
|
-
$
|
|
3721
|
+
$10.if(node_1, ($$render) => {
|
|
661
3722
|
if (required())
|
|
662
3723
|
$$render(consequent);
|
|
663
3724
|
});
|
|
664
3725
|
}
|
|
665
|
-
$
|
|
666
|
-
$
|
|
667
|
-
$
|
|
668
|
-
$
|
|
669
|
-
$
|
|
670
|
-
$
|
|
671
|
-
$
|
|
3726
|
+
$10.reset(label_1);
|
|
3727
|
+
$10.template_effect(($0) => {
|
|
3728
|
+
$10.set_attribute(label_1, "id", $10.get(labelId));
|
|
3729
|
+
$10.set_attribute(label_1, "for", $$props.id);
|
|
3730
|
+
$10.set_class(label_1, 1, $0);
|
|
3731
|
+
$10.set_attribute(label_1, "data-disabled", disabled() || undefined);
|
|
3732
|
+
$10.set_text(text, `${$$props.label ?? ""} `);
|
|
672
3733
|
}, [
|
|
673
|
-
() => $
|
|
3734
|
+
() => $10.clsx(classNames("cinder-form-field__label", $$props.labelClass, hideLabel() && "cinder-sr-only"))
|
|
674
3735
|
]);
|
|
675
|
-
$
|
|
3736
|
+
$10.append($$anchor2, label_1);
|
|
676
3737
|
};
|
|
677
|
-
$
|
|
3738
|
+
$10.if(node, ($$render) => {
|
|
678
3739
|
if ($$props.label)
|
|
679
3740
|
$$render(consequent_1);
|
|
680
3741
|
});
|
|
681
3742
|
}
|
|
682
|
-
var node_2 = $
|
|
3743
|
+
var node_2 = $10.sibling(node, 2);
|
|
683
3744
|
{
|
|
684
3745
|
var consequent_4 = ($$anchor2) => {
|
|
685
3746
|
var div_1 = root_2();
|
|
686
|
-
var node_3 = $
|
|
3747
|
+
var node_3 = $10.child(div_1);
|
|
687
3748
|
{
|
|
688
3749
|
var consequent_2 = ($$anchor3) => {
|
|
689
|
-
var fragment = $
|
|
690
|
-
var node_4 = $
|
|
691
|
-
$
|
|
692
|
-
$
|
|
3750
|
+
var fragment = $10.comment();
|
|
3751
|
+
var node_4 = $10.first_child(fragment);
|
|
3752
|
+
$10.snippet(node_4, () => $$props.before);
|
|
3753
|
+
$10.append($$anchor3, fragment);
|
|
693
3754
|
};
|
|
694
|
-
$
|
|
3755
|
+
$10.if(node_3, ($$render) => {
|
|
695
3756
|
if ($$props.before)
|
|
696
3757
|
$$render(consequent_2);
|
|
697
3758
|
});
|
|
698
3759
|
}
|
|
699
|
-
var node_5 = $
|
|
3760
|
+
var node_5 = $10.sibling(node_3, 2);
|
|
700
3761
|
Form_field_provider(node_5, {
|
|
701
3762
|
get context() {
|
|
702
3763
|
return context;
|
|
703
3764
|
},
|
|
704
3765
|
children: ($$anchor3, $$slotProps) => {
|
|
705
|
-
var fragment_1 = $
|
|
706
|
-
var node_6 = $
|
|
707
|
-
$
|
|
708
|
-
$
|
|
3766
|
+
var fragment_1 = $10.comment();
|
|
3767
|
+
var node_6 = $10.first_child(fragment_1);
|
|
3768
|
+
$10.snippet(node_6, () => $$props.control);
|
|
3769
|
+
$10.append($$anchor3, fragment_1);
|
|
709
3770
|
},
|
|
710
3771
|
$$slots: { default: true }
|
|
711
3772
|
});
|
|
712
|
-
var node_7 = $
|
|
3773
|
+
var node_7 = $10.sibling(node_5, 2);
|
|
713
3774
|
{
|
|
714
3775
|
var consequent_3 = ($$anchor3) => {
|
|
715
|
-
var fragment_2 = $
|
|
716
|
-
var node_8 = $
|
|
717
|
-
$
|
|
718
|
-
$
|
|
3776
|
+
var fragment_2 = $10.comment();
|
|
3777
|
+
var node_8 = $10.first_child(fragment_2);
|
|
3778
|
+
$10.snippet(node_8, () => $$props.after);
|
|
3779
|
+
$10.append($$anchor3, fragment_2);
|
|
719
3780
|
};
|
|
720
|
-
$
|
|
3781
|
+
$10.if(node_7, ($$render) => {
|
|
721
3782
|
if ($$props.after)
|
|
722
3783
|
$$render(consequent_3);
|
|
723
3784
|
});
|
|
724
3785
|
}
|
|
725
|
-
$
|
|
726
|
-
$
|
|
727
|
-
$
|
|
728
|
-
$
|
|
729
|
-
$
|
|
730
|
-
$
|
|
731
|
-
$
|
|
732
|
-
$
|
|
3786
|
+
$10.reset(div_1);
|
|
3787
|
+
$10.template_effect(($0) => {
|
|
3788
|
+
$10.set_class(div_1, 1, $0);
|
|
3789
|
+
$10.set_attribute(div_1, "data-leading", controlLeading() ? "" : undefined);
|
|
3790
|
+
$10.set_attribute(div_1, "data-trailing", controlTrailing() ? "" : undefined);
|
|
3791
|
+
$10.set_attribute(div_1, "data-native-date", controlNativeDate() ? "" : undefined);
|
|
3792
|
+
$10.set_attribute(div_1, "data-disabled", controlDisabled() ? "" : undefined);
|
|
3793
|
+
$10.set_attribute(div_1, "data-invalid", controlInvalid() ? "" : undefined);
|
|
733
3794
|
}, [
|
|
734
|
-
() => $
|
|
3795
|
+
() => $10.clsx(classNames("cinder-form-field__control", $$props.controlClass))
|
|
735
3796
|
]);
|
|
736
|
-
$
|
|
3797
|
+
$10.append($$anchor2, div_1);
|
|
737
3798
|
};
|
|
738
3799
|
var alternate = ($$anchor2) => {
|
|
739
3800
|
Form_field_provider($$anchor2, {
|
|
@@ -741,175 +3802,175 @@ function Form_field_frame($$anchor, $$props) {
|
|
|
741
3802
|
return context;
|
|
742
3803
|
},
|
|
743
3804
|
children: ($$anchor3, $$slotProps) => {
|
|
744
|
-
var fragment_4 = $
|
|
745
|
-
var node_9 = $
|
|
746
|
-
$
|
|
747
|
-
$
|
|
3805
|
+
var fragment_4 = $10.comment();
|
|
3806
|
+
var node_9 = $10.first_child(fragment_4);
|
|
3807
|
+
$10.snippet(node_9, () => $$props.control);
|
|
3808
|
+
$10.append($$anchor3, fragment_4);
|
|
748
3809
|
},
|
|
749
3810
|
$$slots: { default: true }
|
|
750
3811
|
});
|
|
751
3812
|
};
|
|
752
|
-
$
|
|
753
|
-
if ($
|
|
3813
|
+
$10.if(node_2, ($$render) => {
|
|
3814
|
+
if ($10.get(needsControlWrapper))
|
|
754
3815
|
$$render(consequent_4);
|
|
755
3816
|
else
|
|
756
3817
|
$$render(alternate, -1);
|
|
757
3818
|
});
|
|
758
3819
|
}
|
|
759
|
-
var node_10 = $
|
|
3820
|
+
var node_10 = $10.sibling(node_2, 2);
|
|
760
3821
|
{
|
|
761
3822
|
var consequent_5 = ($$anchor2) => {
|
|
762
3823
|
var p = root_3();
|
|
763
|
-
var text_1 = $
|
|
764
|
-
$
|
|
765
|
-
$
|
|
766
|
-
$
|
|
767
|
-
$
|
|
768
|
-
$
|
|
3824
|
+
var text_1 = $10.child(p, true);
|
|
3825
|
+
$10.reset(p);
|
|
3826
|
+
$10.template_effect(($0) => {
|
|
3827
|
+
$10.set_attribute(p, "id", $10.get(descriptionId));
|
|
3828
|
+
$10.set_class(p, 1, $0);
|
|
3829
|
+
$10.set_text(text_1, $$props.description);
|
|
769
3830
|
}, [
|
|
770
|
-
() => $
|
|
3831
|
+
() => $10.clsx(classNames("cinder-form-field__description", $$props.descriptionClass))
|
|
771
3832
|
]);
|
|
772
|
-
$
|
|
3833
|
+
$10.append($$anchor2, p);
|
|
773
3834
|
};
|
|
774
|
-
$
|
|
3835
|
+
$10.if(node_10, ($$render) => {
|
|
775
3836
|
if ($$props.description)
|
|
776
3837
|
$$render(consequent_5);
|
|
777
3838
|
});
|
|
778
3839
|
}
|
|
779
|
-
var node_11 = $
|
|
3840
|
+
var node_11 = $10.sibling(node_10, 2);
|
|
780
3841
|
{
|
|
781
3842
|
var consequent_6 = ($$anchor2) => {
|
|
782
|
-
var fragment_5 = $
|
|
783
|
-
var node_12 = $
|
|
784
|
-
$
|
|
785
|
-
$
|
|
3843
|
+
var fragment_5 = $10.comment();
|
|
3844
|
+
var node_12 = $10.first_child(fragment_5);
|
|
3845
|
+
$10.snippet(node_12, () => $$props.message);
|
|
3846
|
+
$10.append($$anchor2, fragment_5);
|
|
786
3847
|
};
|
|
787
|
-
$
|
|
3848
|
+
$10.if(node_11, ($$render) => {
|
|
788
3849
|
if ($$props.message)
|
|
789
3850
|
$$render(consequent_6);
|
|
790
3851
|
});
|
|
791
3852
|
}
|
|
792
|
-
var node_13 = $
|
|
3853
|
+
var node_13 = $10.sibling(node_11, 2);
|
|
793
3854
|
{
|
|
794
3855
|
var consequent_7 = ($$anchor2) => {
|
|
795
3856
|
var p_1 = root_4();
|
|
796
|
-
var text_2 = $
|
|
797
|
-
$
|
|
798
|
-
$
|
|
799
|
-
$
|
|
800
|
-
$
|
|
801
|
-
$
|
|
802
|
-
$
|
|
3857
|
+
var text_2 = $10.child(p_1, true);
|
|
3858
|
+
$10.reset(p_1);
|
|
3859
|
+
$10.template_effect(($0) => {
|
|
3860
|
+
$10.set_attribute(p_1, "id", $10.get(errorId2));
|
|
3861
|
+
$10.set_class(p_1, 1, $0);
|
|
3862
|
+
$10.set_attribute(p_1, "data-cinder-error", $$props.error ? "" : undefined);
|
|
3863
|
+
$10.set_text(text_2, $$props.error ?? "");
|
|
803
3864
|
}, [
|
|
804
|
-
() => $
|
|
3865
|
+
() => $10.clsx(classNames("cinder-form-field__error", $$props.errorClass))
|
|
805
3866
|
]);
|
|
806
|
-
$
|
|
3867
|
+
$10.append($$anchor2, p_1);
|
|
807
3868
|
};
|
|
808
|
-
$
|
|
3869
|
+
$10.if(node_13, ($$render) => {
|
|
809
3870
|
if ($$props.error || errorAlwaysMounted())
|
|
810
3871
|
$$render(consequent_7);
|
|
811
3872
|
});
|
|
812
3873
|
}
|
|
813
|
-
$
|
|
814
|
-
$
|
|
815
|
-
$
|
|
3874
|
+
$10.reset(div);
|
|
3875
|
+
$10.append($$anchor, div);
|
|
3876
|
+
$10.pop();
|
|
816
3877
|
}
|
|
817
3878
|
|
|
818
3879
|
// src/components/multi-select/multi-select.svelte
|
|
819
|
-
var
|
|
820
|
-
var root_12 = $
|
|
821
|
-
var root_22 = $
|
|
822
|
-
var root_32 = $
|
|
823
|
-
var root_42 = $
|
|
824
|
-
var root_52 = $
|
|
825
|
-
var root_6 = $
|
|
826
|
-
var root_7 = $
|
|
827
|
-
var root_8 = $
|
|
828
|
-
var root_9 = $
|
|
829
|
-
var root_10 = $
|
|
830
|
-
var root_11 = $
|
|
3880
|
+
var root5 = $11.from_html(`<span class="cinder-multi-select__count" aria-hidden="true"> </span>`);
|
|
3881
|
+
var root_12 = $11.from_html(`<button type="button" class="cinder-multi-select__clear" aria-label="Clear selected items">×</button>`);
|
|
3882
|
+
var root_22 = $11.from_html(`<input class="cinder-_input-frame cinder-multi-select__filter" type="text" role="combobox" placeholder="Filter options" aria-autocomplete="list" aria-haspopup="listbox"/>`);
|
|
3883
|
+
var root_32 = $11.from_html(`<span class="cinder-checkbox cinder-checkbox--indicator cinder-multi-select__checkbox-box" aria-hidden="true"></span>`);
|
|
3884
|
+
var root_42 = $11.from_html(`<span class="cinder-multi-select__option-description"> </span>`);
|
|
3885
|
+
var root_52 = $11.from_html(`<li role="option" class="cinder-_option-row cinder-multi-select__option"><!> <span class="cinder-multi-select__option-text"><span class="cinder-multi-select__option-label"> </span> <!></span></li>`);
|
|
3886
|
+
var root_6 = $11.from_html(`<li class="cinder-multi-select__empty" role="option" aria-disabled="true" aria-selected="false"> </li>`);
|
|
3887
|
+
var root_7 = $11.from_html(`<div class="cinder-_floating-surface cinder-multi-select__panel" data-cinder-open=""><!> <ul role="listbox" class="cinder-multi-select__listbox" aria-multiselectable="true"></ul></div>`);
|
|
3888
|
+
var root_8 = $11.from_html(`<p class="cinder-multi-select__sr-status" role="status" aria-live="polite"> </p> <span class="cinder-multi-select__sr-status">Filter options</span>`, 1);
|
|
3889
|
+
var root_9 = $11.from_html(`<input type="hidden"/>`);
|
|
3890
|
+
var root_10 = $11.from_html(`<div class="cinder-multi-select__control"><button type="button" class="cinder-_input-frame cinder-multi-select__trigger" aria-haspopup="listbox"><span class="cinder-multi-select__summary cinder-_truncate"> </span> <!> <span class="cinder-multi-select__chevron" aria-hidden="true"><!></span></button> <!> <!></div> <!> <input type="text" tabindex="-1" aria-hidden="true" class="cinder-multi-select__validation-proxy"/> <!>`, 1);
|
|
3891
|
+
var root_11 = $11.from_html(`<p class="cinder-multi-select__warning"> </p>`);
|
|
831
3892
|
function Multi_select($$anchor, $$props) {
|
|
832
|
-
$
|
|
3893
|
+
$11.push($$props, true);
|
|
833
3894
|
const multiSelectControl = ($$anchor2) => {
|
|
834
3895
|
var fragment = root_10();
|
|
835
|
-
var div = $
|
|
836
|
-
var button = $
|
|
837
|
-
var span = $
|
|
838
|
-
var text = $
|
|
839
|
-
$
|
|
840
|
-
var node_1 = $
|
|
3896
|
+
var div = $11.first_child(fragment);
|
|
3897
|
+
var button = $11.child(div);
|
|
3898
|
+
var span = $11.child(button);
|
|
3899
|
+
var text = $11.child(span, true);
|
|
3900
|
+
$11.reset(span);
|
|
3901
|
+
var node_1 = $11.sibling(span, 2);
|
|
841
3902
|
{
|
|
842
3903
|
var consequent = ($$anchor3) => {
|
|
843
|
-
var span_1 =
|
|
844
|
-
var text_1 = $
|
|
845
|
-
$
|
|
846
|
-
$
|
|
847
|
-
$
|
|
3904
|
+
var span_1 = root5();
|
|
3905
|
+
var text_1 = $11.child(span_1, true);
|
|
3906
|
+
$11.reset(span_1);
|
|
3907
|
+
$11.template_effect(() => $11.set_text(text_1, $11.get(selectedCount)));
|
|
3908
|
+
$11.append($$anchor3, span_1);
|
|
848
3909
|
};
|
|
849
|
-
$
|
|
850
|
-
if ($
|
|
3910
|
+
$11.if(node_1, ($$render) => {
|
|
3911
|
+
if ($11.get(selectedCount) > 0)
|
|
851
3912
|
$$render(consequent);
|
|
852
3913
|
});
|
|
853
3914
|
}
|
|
854
|
-
var span_2 = $
|
|
855
|
-
var node_2 = $
|
|
3915
|
+
var span_2 = $11.sibling(node_1, 2);
|
|
3916
|
+
var node_2 = $11.child(span_2);
|
|
856
3917
|
Chevron_down(node_2, { size: 16, strokeWidth: 2 });
|
|
857
|
-
$
|
|
858
|
-
$
|
|
859
|
-
$
|
|
860
|
-
var node_3 = $
|
|
3918
|
+
$11.reset(span_2);
|
|
3919
|
+
$11.reset(button);
|
|
3920
|
+
$11.bind_this(button, ($$value) => $11.set(triggerElement, $$value), () => $11.get(triggerElement));
|
|
3921
|
+
var node_3 = $11.sibling(button, 2);
|
|
861
3922
|
{
|
|
862
3923
|
var consequent_1 = ($$anchor3) => {
|
|
863
3924
|
var button_1 = root_12();
|
|
864
|
-
$
|
|
865
|
-
$
|
|
3925
|
+
$11.delegated("click", button_1, clearSelection);
|
|
3926
|
+
$11.append($$anchor3, button_1);
|
|
866
3927
|
};
|
|
867
|
-
$
|
|
868
|
-
if ($
|
|
3928
|
+
$11.if(node_3, ($$render) => {
|
|
3929
|
+
if ($11.get(selectedCount) > 0 && !$11.get(field).disabled && !readonly())
|
|
869
3930
|
$$render(consequent_1);
|
|
870
3931
|
});
|
|
871
3932
|
}
|
|
872
|
-
var node_4 = $
|
|
3933
|
+
var node_4 = $11.sibling(node_3, 2);
|
|
873
3934
|
{
|
|
874
3935
|
var consequent_4 = ($$anchor3) => {
|
|
875
3936
|
var div_1 = root_7();
|
|
876
|
-
var node_5 = $
|
|
3937
|
+
var node_5 = $11.child(div_1);
|
|
877
3938
|
{
|
|
878
3939
|
var consequent_2 = ($$anchor4) => {
|
|
879
3940
|
var input = root_22();
|
|
880
|
-
$
|
|
881
|
-
$
|
|
882
|
-
$
|
|
883
|
-
$
|
|
884
|
-
$
|
|
885
|
-
$
|
|
886
|
-
$
|
|
887
|
-
$
|
|
3941
|
+
$11.remove_input_defaults(input);
|
|
3942
|
+
$11.bind_this(input, ($$value) => $11.set(filterElement, $$value), () => $11.get(filterElement));
|
|
3943
|
+
$11.template_effect(() => {
|
|
3944
|
+
$11.set_attribute(input, "id", $11.get(filterId));
|
|
3945
|
+
$11.set_value(input, $11.get(query));
|
|
3946
|
+
$11.set_attribute(input, "aria-labelledby", $11.get(filterAriaLabelledBy));
|
|
3947
|
+
$11.set_attribute(input, "aria-expanded", $11.get(open));
|
|
3948
|
+
$11.set_attribute(input, "aria-readonly", readonly() || undefined);
|
|
888
3949
|
input.readOnly = readonly();
|
|
889
|
-
$
|
|
890
|
-
$
|
|
3950
|
+
$11.set_attribute(input, "aria-controls", $11.get(listboxId));
|
|
3951
|
+
$11.set_attribute(input, "aria-activedescendant", $11.get(activeOptionId));
|
|
891
3952
|
});
|
|
892
|
-
$
|
|
893
|
-
$
|
|
894
|
-
$
|
|
3953
|
+
$11.delegated("input", input, handleFilterInput);
|
|
3954
|
+
$11.delegated("keydown", input, handleFilterKeydown);
|
|
3955
|
+
$11.append($$anchor4, input);
|
|
895
3956
|
};
|
|
896
|
-
$
|
|
3957
|
+
$11.if(node_5, ($$render) => {
|
|
897
3958
|
if (filterable())
|
|
898
3959
|
$$render(consequent_2);
|
|
899
3960
|
});
|
|
900
3961
|
}
|
|
901
|
-
var ul = $
|
|
902
|
-
$
|
|
3962
|
+
var ul = $11.sibling(node_5, 2);
|
|
3963
|
+
$11.each(ul, 23, () => $11.get(visibleItems), (item) => item.id, ($$anchor4, item, index2) => {
|
|
903
3964
|
var li = root_52();
|
|
904
|
-
var node_6 = $
|
|
3965
|
+
var node_6 = $11.child(li);
|
|
905
3966
|
{
|
|
906
3967
|
const control = ($$anchor5) => {
|
|
907
3968
|
var span_3 = root_32();
|
|
908
|
-
$
|
|
909
|
-
$
|
|
910
|
-
$
|
|
911
|
-
}, [() => $
|
|
912
|
-
$
|
|
3969
|
+
$11.template_effect(($0) => {
|
|
3970
|
+
$11.set_attribute(span_3, "data-cinder-checked", $0);
|
|
3971
|
+
$11.set_attribute(span_3, "data-cinder-disabled", $11.get(field).disabled || readonly() || $11.get(item).disabled || undefined);
|
|
3972
|
+
}, [() => $11.get(selectedSet).has($11.get(item).id) || undefined]);
|
|
3973
|
+
$11.append($$anchor5, span_3);
|
|
913
3974
|
};
|
|
914
3975
|
Checkbox_indicator_shell(node_6, {
|
|
915
3976
|
class: "cinder-multi-select__checkbox-indicator",
|
|
@@ -917,168 +3978,172 @@ function Multi_select($$anchor, $$props) {
|
|
|
917
3978
|
$$slots: { control: true }
|
|
918
3979
|
});
|
|
919
3980
|
}
|
|
920
|
-
var span_4 = $
|
|
921
|
-
var span_5 = $
|
|
922
|
-
var text_2 = $
|
|
923
|
-
$
|
|
924
|
-
var node_7 = $
|
|
3981
|
+
var span_4 = $11.sibling(node_6, 2);
|
|
3982
|
+
var span_5 = $11.child(span_4);
|
|
3983
|
+
var text_2 = $11.child(span_5, true);
|
|
3984
|
+
$11.reset(span_5);
|
|
3985
|
+
var node_7 = $11.sibling(span_5, 2);
|
|
925
3986
|
{
|
|
926
3987
|
var consequent_3 = ($$anchor5) => {
|
|
927
3988
|
var span_6 = root_42();
|
|
928
|
-
var text_3 = $
|
|
929
|
-
$
|
|
930
|
-
$
|
|
931
|
-
$
|
|
3989
|
+
var text_3 = $11.child(span_6, true);
|
|
3990
|
+
$11.reset(span_6);
|
|
3991
|
+
$11.template_effect(() => $11.set_text(text_3, $11.get(item).description));
|
|
3992
|
+
$11.append($$anchor5, span_6);
|
|
932
3993
|
};
|
|
933
|
-
$
|
|
934
|
-
if ($
|
|
3994
|
+
$11.if(node_7, ($$render) => {
|
|
3995
|
+
if ($11.get(item).description)
|
|
935
3996
|
$$render(consequent_3);
|
|
936
3997
|
});
|
|
937
3998
|
}
|
|
938
|
-
$
|
|
939
|
-
$
|
|
940
|
-
$
|
|
941
|
-
$
|
|
942
|
-
$
|
|
943
|
-
$
|
|
944
|
-
$
|
|
945
|
-
$
|
|
946
|
-
}, [() => $
|
|
947
|
-
$
|
|
3999
|
+
$11.reset(span_4);
|
|
4000
|
+
$11.reset(li);
|
|
4001
|
+
$11.template_effect(($0) => {
|
|
4002
|
+
$11.set_attribute(li, "id", `${$$props.id ?? ""}-option-${$11.get(index2) ?? ""}`);
|
|
4003
|
+
$11.set_attribute(li, "aria-selected", $0);
|
|
4004
|
+
$11.set_attribute(li, "aria-disabled", $11.get(item).disabled || undefined);
|
|
4005
|
+
$11.set_attribute(li, "data-cinder-active", $11.get(activeIndex) === $11.get(index2) || undefined);
|
|
4006
|
+
$11.set_text(text_2, $11.get(item).label);
|
|
4007
|
+
}, [() => $11.get(selectedSet).has($11.get(item).id)]);
|
|
4008
|
+
$11.delegated("mousedown", li, (event2) => {
|
|
948
4009
|
event2.preventDefault();
|
|
949
|
-
if ($
|
|
4010
|
+
if ($11.get(item).disabled)
|
|
950
4011
|
return;
|
|
951
|
-
commandList.setActiveById(`${$$props.id}-option-${$
|
|
952
|
-
toggleItem($
|
|
4012
|
+
commandList.setActiveById(`${$$props.id}-option-${$11.get(index2)}`);
|
|
4013
|
+
toggleItem($11.get(item));
|
|
953
4014
|
});
|
|
954
|
-
$
|
|
955
|
-
if ($
|
|
4015
|
+
$11.event("mouseenter", li, () => {
|
|
4016
|
+
if ($11.get(item).disabled)
|
|
956
4017
|
return;
|
|
957
|
-
commandList.setActiveById(`${$$props.id}-option-${$
|
|
4018
|
+
commandList.setActiveById(`${$$props.id}-option-${$11.get(index2)}`);
|
|
958
4019
|
});
|
|
959
|
-
$
|
|
4020
|
+
$11.append($$anchor4, li);
|
|
960
4021
|
}, ($$anchor4) => {
|
|
961
4022
|
var li_1 = root_6();
|
|
962
|
-
var text_4 = $
|
|
963
|
-
$
|
|
964
|
-
$
|
|
965
|
-
$
|
|
4023
|
+
var text_4 = $11.child(li_1, true);
|
|
4024
|
+
$11.reset(li_1);
|
|
4025
|
+
$11.template_effect(() => $11.set_text(text_4, $11.get(emptyListMessage)));
|
|
4026
|
+
$11.append($$anchor4, li_1);
|
|
966
4027
|
});
|
|
967
|
-
$
|
|
968
|
-
$
|
|
969
|
-
$
|
|
970
|
-
$
|
|
971
|
-
$
|
|
972
|
-
|
|
973
|
-
$
|
|
974
|
-
$
|
|
975
|
-
$
|
|
976
|
-
$
|
|
977
|
-
$
|
|
978
|
-
$
|
|
979
|
-
$
|
|
980
|
-
$
|
|
4028
|
+
$11.reset(ul);
|
|
4029
|
+
$11.bind_this(ul, ($$value) => $11.set(listboxElement, $$value), () => $11.get(listboxElement));
|
|
4030
|
+
$11.reset(div_1);
|
|
4031
|
+
$11.bind_this(div_1, ($$value) => $11.set(panelElement, $$value), () => $11.get(panelElement));
|
|
4032
|
+
$11.attach(div_1, () => panelPortalAttachment);
|
|
4033
|
+
$11.template_effect(() => {
|
|
4034
|
+
$11.set_attribute(div_1, "id", `${$$props.id}-popover`);
|
|
4035
|
+
$11.set_attribute(div_1, "data-cinder-direction", direction());
|
|
4036
|
+
$11.set_attribute(div_1, "data-cinder-placement", anchoredOverlay.resolvedPlacement);
|
|
4037
|
+
$11.set_attribute(div_1, "data-cinder-position-ready", anchoredOverlay.positionReady);
|
|
4038
|
+
$11.set_style(div_1, anchoredOverlay.positionStyle);
|
|
4039
|
+
$11.set_attribute(ul, "id", $11.get(listboxId));
|
|
4040
|
+
$11.set_attribute(ul, "aria-labelledby", $11.get(listboxLabelledBy));
|
|
4041
|
+
$11.set_attribute(ul, "aria-label", $11.get(listboxLabelledBy) ? undefined : "Options");
|
|
4042
|
+
$11.set_attribute(ul, "aria-required", $11.get(field).required || undefined);
|
|
4043
|
+
$11.set_attribute(ul, "aria-readonly", readonly() || undefined);
|
|
4044
|
+
$11.set_attribute(ul, "aria-activedescendant", filterable() ? undefined : $11.get(activeOptionId));
|
|
4045
|
+
$11.set_attribute(ul, "tabindex", filterable() ? -1 : 0);
|
|
981
4046
|
});
|
|
982
|
-
$
|
|
983
|
-
$
|
|
4047
|
+
$11.delegated("keydown", ul, handleListNavigationKeydown);
|
|
4048
|
+
$11.append($$anchor3, div_1);
|
|
984
4049
|
};
|
|
985
|
-
$
|
|
986
|
-
if ($
|
|
4050
|
+
$11.if(node_4, ($$render) => {
|
|
4051
|
+
if ($11.get(open))
|
|
987
4052
|
$$render(consequent_4);
|
|
988
4053
|
});
|
|
989
4054
|
}
|
|
990
|
-
$
|
|
991
|
-
$
|
|
992
|
-
var node_8 = $
|
|
4055
|
+
$11.reset(div);
|
|
4056
|
+
$11.bind_this(div, ($$value) => $11.set(controlElement, $$value), () => $11.get(controlElement));
|
|
4057
|
+
var node_8 = $11.sibling(div, 2);
|
|
993
4058
|
{
|
|
994
4059
|
var consequent_5 = ($$anchor3) => {
|
|
995
4060
|
var fragment_1 = root_8();
|
|
996
|
-
var p = $
|
|
997
|
-
var text_5 = $
|
|
998
|
-
$
|
|
999
|
-
var span_7 = $
|
|
1000
|
-
$
|
|
1001
|
-
$
|
|
1002
|
-
$
|
|
4061
|
+
var p = $11.first_child(fragment_1);
|
|
4062
|
+
var text_5 = $11.child(p, true);
|
|
4063
|
+
$11.reset(p);
|
|
4064
|
+
var span_7 = $11.sibling(p, 2);
|
|
4065
|
+
$11.template_effect(() => {
|
|
4066
|
+
$11.set_text(text_5, $11.get(open) && $11.get(visibleItems).length === 0 ? $11.get(emptyListMessage) : "");
|
|
4067
|
+
$11.set_attribute(span_7, "id", $11.get(filterLabelHintId));
|
|
1003
4068
|
});
|
|
1004
|
-
$
|
|
4069
|
+
$11.append($$anchor3, fragment_1);
|
|
1005
4070
|
};
|
|
1006
|
-
$
|
|
4071
|
+
$11.if(node_8, ($$render) => {
|
|
1007
4072
|
if (filterable())
|
|
1008
4073
|
$$render(consequent_5);
|
|
1009
4074
|
});
|
|
1010
4075
|
}
|
|
1011
|
-
var input_1 = $
|
|
1012
|
-
$
|
|
1013
|
-
$
|
|
1014
|
-
var node_9 = $
|
|
4076
|
+
var input_1 = $11.sibling(node_8, 2);
|
|
4077
|
+
$11.remove_input_defaults(input_1);
|
|
4078
|
+
$11.bind_this(input_1, ($$value) => $11.set(validityProxyElement, $$value), () => $11.get(validityProxyElement));
|
|
4079
|
+
var node_9 = $11.sibling(input_1, 2);
|
|
1015
4080
|
{
|
|
1016
4081
|
var consequent_6 = ($$anchor3) => {
|
|
1017
|
-
var fragment_2 = $
|
|
1018
|
-
var node_10 = $
|
|
1019
|
-
$
|
|
4082
|
+
var fragment_2 = $11.comment();
|
|
4083
|
+
var node_10 = $11.first_child(fragment_2);
|
|
4084
|
+
$11.each(node_10, 16, () => $11.get(uniqueSelectedIds), (selectedId) => selectedId, ($$anchor4, selectedId) => {
|
|
1020
4085
|
var input_2 = root_9();
|
|
1021
|
-
$
|
|
1022
|
-
$
|
|
1023
|
-
$
|
|
1024
|
-
$
|
|
1025
|
-
input_2.disabled = $
|
|
4086
|
+
$11.remove_input_defaults(input_2);
|
|
4087
|
+
$11.template_effect(() => {
|
|
4088
|
+
$11.set_attribute(input_2, "name", $$props.name);
|
|
4089
|
+
$11.set_value(input_2, selectedId);
|
|
4090
|
+
input_2.disabled = $11.get(field).disabled;
|
|
1026
4091
|
});
|
|
1027
|
-
$
|
|
4092
|
+
$11.append($$anchor4, input_2);
|
|
1028
4093
|
});
|
|
1029
|
-
$
|
|
4094
|
+
$11.append($$anchor3, fragment_2);
|
|
1030
4095
|
};
|
|
1031
|
-
$
|
|
4096
|
+
$11.if(node_9, ($$render) => {
|
|
1032
4097
|
if ($$props.name)
|
|
1033
4098
|
$$render(consequent_6);
|
|
1034
4099
|
});
|
|
1035
4100
|
}
|
|
1036
|
-
$
|
|
1037
|
-
$
|
|
1038
|
-
button.disabled = $
|
|
1039
|
-
$
|
|
1040
|
-
$
|
|
1041
|
-
$
|
|
1042
|
-
$
|
|
1043
|
-
$
|
|
1044
|
-
$
|
|
1045
|
-
$
|
|
1046
|
-
$
|
|
1047
|
-
$
|
|
1048
|
-
$
|
|
1049
|
-
input_1.required = $
|
|
1050
|
-
input_1.disabled = $
|
|
4101
|
+
$11.template_effect(() => {
|
|
4102
|
+
$11.set_attribute(button, "id", $$props.id);
|
|
4103
|
+
button.disabled = $11.get(field).disabled;
|
|
4104
|
+
$11.set_attribute(button, "aria-invalid", $11.get(triggerAriaInvalid));
|
|
4105
|
+
$11.set_attribute(button, "aria-describedby", $11.get(triggerDescribedBy));
|
|
4106
|
+
$11.set_attribute(button, "aria-expanded", $11.get(open));
|
|
4107
|
+
$11.set_attribute(button, "aria-controls", $11.get(listboxId));
|
|
4108
|
+
$11.set_attribute(button, "data-cinder-invalid", $11.get(triggerAriaInvalid) ? "true" : undefined);
|
|
4109
|
+
$11.set_attribute(button, "data-cinder-open", $11.get(open) || undefined);
|
|
4110
|
+
$11.set_attribute(button, "data-cinder-has-clear", $11.get(selectedCount) > 0 && !$11.get(field).disabled && !readonly() || undefined);
|
|
4111
|
+
$11.set_attribute(button, "data-cinder-readonly", readonly() || undefined);
|
|
4112
|
+
$11.set_text(text, $11.get(triggerSummary));
|
|
4113
|
+
$11.set_value(input_1, $11.get(selectedCount) > 0 ? "selected" : "");
|
|
4114
|
+
input_1.required = $11.get(field).required;
|
|
4115
|
+
input_1.disabled = $11.get(field).disabled;
|
|
1051
4116
|
});
|
|
1052
|
-
$
|
|
1053
|
-
$
|
|
1054
|
-
$
|
|
1055
|
-
$
|
|
4117
|
+
$11.delegated("click", button, () => $11.get(open) ? closeMenu() : openMenu());
|
|
4118
|
+
$11.delegated("keydown", button, handleTriggerKeydown);
|
|
4119
|
+
$11.event("invalid", input_1, handleProxyInvalid);
|
|
4120
|
+
$11.append($$anchor2, fragment);
|
|
1056
4121
|
};
|
|
1057
4122
|
const warningMessage = ($$anchor2) => {
|
|
1058
|
-
var fragment_3 = $
|
|
1059
|
-
var node_11 = $
|
|
4123
|
+
var fragment_3 = $11.comment();
|
|
4124
|
+
var node_11 = $11.first_child(fragment_3);
|
|
1060
4125
|
{
|
|
1061
4126
|
var consequent_7 = ($$anchor3) => {
|
|
1062
4127
|
var p_1 = root_11();
|
|
1063
|
-
var text_6 = $
|
|
1064
|
-
$
|
|
1065
|
-
$
|
|
1066
|
-
$
|
|
1067
|
-
$
|
|
4128
|
+
var text_6 = $11.child(p_1, true);
|
|
4129
|
+
$11.reset(p_1);
|
|
4130
|
+
$11.template_effect(() => {
|
|
4131
|
+
$11.set_attribute(p_1, "id", $11.get(warningId));
|
|
4132
|
+
$11.set_text(text_6, $$props.warning);
|
|
1068
4133
|
});
|
|
1069
|
-
$
|
|
4134
|
+
$11.append($$anchor3, p_1);
|
|
1070
4135
|
};
|
|
1071
|
-
$
|
|
4136
|
+
$11.if(node_11, ($$render) => {
|
|
1072
4137
|
if ($$props.warning)
|
|
1073
4138
|
$$render(consequent_7);
|
|
1074
4139
|
});
|
|
1075
4140
|
}
|
|
1076
|
-
$
|
|
4141
|
+
$11.append($$anchor2, fragment_3);
|
|
1077
4142
|
};
|
|
1078
|
-
let selectedIds = $
|
|
4143
|
+
let selectedIds = $11.prop($$props, "selectedIds", 31, () => $11.proxy([])), placeholder = $11.prop($$props, "placeholder", 3, "Select options"), readonly = $11.prop($$props, "readonly", 3, false), filterable = $11.prop($$props, "filterable", 3, false), selectionFeedback = $11.prop($$props, "selectionFeedback", 3, "fixed"), direction = $11.prop($$props, "direction", 3, "down");
|
|
1079
4144
|
const context = getFormFieldContext();
|
|
1080
|
-
const warningId = $
|
|
1081
|
-
const field = $
|
|
4145
|
+
const warningId = $11.derived(() => $$props.warning ? `${$$props.id}-warning` : undefined);
|
|
4146
|
+
const field = $11.derived(() => resolveFieldControl({
|
|
1082
4147
|
id: $$props.id,
|
|
1083
4148
|
generatedId: $$props.id,
|
|
1084
4149
|
context,
|
|
@@ -1086,88 +4151,109 @@ function Multi_select($$anchor, $$props) {
|
|
|
1086
4151
|
hasError: !!$$props.error,
|
|
1087
4152
|
localIdNamespace: "multi-select",
|
|
1088
4153
|
consumerDescribedBy: $$props["aria-describedby"],
|
|
1089
|
-
additionalDescribedBy: [$
|
|
4154
|
+
additionalDescribedBy: [$11.get(warningId)],
|
|
1090
4155
|
required: $$props.required,
|
|
1091
4156
|
disabled: $$props.disabled
|
|
1092
4157
|
}));
|
|
1093
|
-
const stableLocalErrorId = $
|
|
1094
|
-
const listboxId = $
|
|
1095
|
-
const filterId = $
|
|
1096
|
-
const filterLabelHintId = $
|
|
1097
|
-
const labelId = $
|
|
1098
|
-
const listboxLabelledBy = $
|
|
1099
|
-
const itemIdSet = $
|
|
1100
|
-
const uniqueSelectedIds = $
|
|
4158
|
+
const stableLocalErrorId = $11.derived(() => context?.errorId === `${$11.get(field).id}-error` ? `${$11.get(field).id}-multi-select-error` : `${$11.get(field).id}-error`);
|
|
4159
|
+
const listboxId = $11.derived(() => `${$$props.id}-listbox`);
|
|
4160
|
+
const filterId = $11.derived(() => `${$$props.id}-filter`);
|
|
4161
|
+
const filterLabelHintId = $11.derived(() => `${$$props.id}-filter-label-hint`);
|
|
4162
|
+
const labelId = $11.derived(() => $$props.label ? `${$$props.id}-label` : undefined);
|
|
4163
|
+
const listboxLabelledBy = $11.derived(() => $11.get(labelId) ?? context?.labelId);
|
|
4164
|
+
const itemIdSet = $11.derived(() => new Set($$props.items.map((item) => item.id)));
|
|
4165
|
+
const uniqueSelectedIds = $11.derived(() => {
|
|
1101
4166
|
const seen = new Set;
|
|
1102
4167
|
const next2 = [];
|
|
1103
4168
|
for (const selectedId of selectedIds()) {
|
|
1104
|
-
if (!$
|
|
4169
|
+
if (!$11.get(itemIdSet).has(selectedId) || seen.has(selectedId))
|
|
1105
4170
|
continue;
|
|
1106
4171
|
seen.add(selectedId);
|
|
1107
4172
|
next2.push(selectedId);
|
|
1108
4173
|
}
|
|
1109
4174
|
return next2;
|
|
1110
4175
|
});
|
|
1111
|
-
const selectedSet = $
|
|
1112
|
-
const selectedCount = $
|
|
1113
|
-
let open = $
|
|
1114
|
-
let query = $
|
|
1115
|
-
let reorderAfterReopen = $
|
|
1116
|
-
let openedAtLeastOnce = $
|
|
1117
|
-
let triggerElement = $
|
|
1118
|
-
let controlElement = $
|
|
1119
|
-
let panelElement = $
|
|
1120
|
-
let filterElement = $
|
|
1121
|
-
let listboxElement = $
|
|
1122
|
-
let validityProxyElement = $
|
|
1123
|
-
let nativeError = $
|
|
4176
|
+
const selectedSet = $11.derived(() => new Set($11.get(uniqueSelectedIds)));
|
|
4177
|
+
const selectedCount = $11.derived(() => $11.get(uniqueSelectedIds).length);
|
|
4178
|
+
let open = $11.state(false);
|
|
4179
|
+
let query = $11.state("");
|
|
4180
|
+
let reorderAfterReopen = $11.state(false);
|
|
4181
|
+
let openedAtLeastOnce = $11.state(false);
|
|
4182
|
+
let triggerElement = $11.state(null);
|
|
4183
|
+
let controlElement = $11.state(null);
|
|
4184
|
+
let panelElement = $11.state(null);
|
|
4185
|
+
let filterElement = $11.state(null);
|
|
4186
|
+
let listboxElement = $11.state(null);
|
|
4187
|
+
let validityProxyElement = $11.state(null);
|
|
4188
|
+
let nativeError = $11.state("");
|
|
1124
4189
|
let resetSyncTimeout;
|
|
1125
|
-
const
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
4190
|
+
const anchoredOverlay = createAnchoredOverlay({
|
|
4191
|
+
open: () => $11.get(open),
|
|
4192
|
+
anchor: () => $11.get(triggerElement),
|
|
4193
|
+
panel: () => $11.get(panelElement),
|
|
4194
|
+
placement: () => direction() === "up" ? "top-start" : "bottom-start",
|
|
4195
|
+
offset: () => 4,
|
|
4196
|
+
widthMode: () => "match-anchor"
|
|
4197
|
+
});
|
|
4198
|
+
const panelPortalAttachment = createPortalAttachment({
|
|
4199
|
+
target: () => {
|
|
4200
|
+
if (!$11.get(triggerElement))
|
|
4201
|
+
return document.body;
|
|
4202
|
+
try {
|
|
4203
|
+
return findNearestOpenTopLayer($11.get(triggerElement)) ?? document.body;
|
|
4204
|
+
} catch {
|
|
4205
|
+
return document.body;
|
|
4206
|
+
}
|
|
4207
|
+
},
|
|
4208
|
+
source: () => $11.get(controlElement),
|
|
4209
|
+
inheritAttributes: true
|
|
4210
|
+
});
|
|
4211
|
+
const triggerAriaInvalid = $11.derived(() => $11.get(field).ariaInvalid ?? ($11.get(nativeError) ? true : undefined));
|
|
4212
|
+
const combinedError = $11.derived(() => $$props.error || $11.get(nativeError) || undefined);
|
|
4213
|
+
const triggerDescribedBy = $11.derived(() => {
|
|
4214
|
+
const ids = new Set(($11.get(field).describedBy ?? "").split(/\s+/).filter(Boolean));
|
|
4215
|
+
if ($11.get(nativeError))
|
|
4216
|
+
ids.add($11.get(field).ownErrorId ?? $11.get(stableLocalErrorId));
|
|
1131
4217
|
const value = Array.from(ids).join(" ");
|
|
1132
4218
|
return value === "" ? undefined : value;
|
|
1133
4219
|
});
|
|
1134
|
-
const filterAriaLabelledBy = $
|
|
1135
|
-
if (!$
|
|
1136
|
-
return $
|
|
1137
|
-
return `${$
|
|
4220
|
+
const filterAriaLabelledBy = $11.derived(() => {
|
|
4221
|
+
if (!$11.get(listboxLabelledBy))
|
|
4222
|
+
return $11.get(filterLabelHintId);
|
|
4223
|
+
return `${$11.get(listboxLabelledBy)} ${$11.get(filterLabelHintId)}`;
|
|
1138
4224
|
});
|
|
1139
|
-
const triggerSummary = $
|
|
1140
|
-
const emptyListMessage = $
|
|
1141
|
-
const initialSelectedIds =
|
|
1142
|
-
const commandList = createCommandListState(() => $
|
|
4225
|
+
const triggerSummary = $11.derived(() => $11.get(selectedCount) > 0 ? `${$11.get(selectedCount)} selected` : placeholder());
|
|
4226
|
+
const emptyListMessage = $11.derived(() => filterable() ? "No matching options" : "No options");
|
|
4227
|
+
const initialSelectedIds = untrack3(() => [...selectedIds()]);
|
|
4228
|
+
const commandList = createCommandListState(() => $11.get(listboxId));
|
|
1143
4229
|
const defaultFilter = (item, nextQuery) => {
|
|
1144
4230
|
if (!nextQuery)
|
|
1145
4231
|
return true;
|
|
1146
4232
|
const q = nextQuery.toLowerCase();
|
|
1147
4233
|
return item.label.toLowerCase().includes(q) || (item.description?.toLowerCase().includes(q) ?? false);
|
|
1148
4234
|
};
|
|
1149
|
-
const filteredItems = $
|
|
4235
|
+
const filteredItems = $11.derived(() => {
|
|
1150
4236
|
if (!filterable())
|
|
1151
4237
|
return $$props.items;
|
|
1152
4238
|
const fn = $$props.filter ?? defaultFilter;
|
|
1153
|
-
return $$props.items.filter((item) => fn(item, $
|
|
4239
|
+
return $$props.items.filter((item) => fn(item, $11.get(query)));
|
|
1154
4240
|
});
|
|
1155
|
-
const visibleItems = $
|
|
1156
|
-
const shouldPromoteSelected = selectionFeedback() === "top" || selectionFeedback() === "top-after-reopen" && $
|
|
4241
|
+
const visibleItems = $11.derived(() => {
|
|
4242
|
+
const shouldPromoteSelected = selectionFeedback() === "top" || selectionFeedback() === "top-after-reopen" && $11.get(reorderAfterReopen);
|
|
1157
4243
|
if (!shouldPromoteSelected)
|
|
1158
|
-
return $
|
|
4244
|
+
return $11.get(filteredItems);
|
|
1159
4245
|
const selected = [];
|
|
1160
4246
|
const unselected = [];
|
|
1161
|
-
for (const item of $
|
|
1162
|
-
if ($
|
|
4247
|
+
for (const item of $11.get(filteredItems)) {
|
|
4248
|
+
if ($11.get(selectedSet).has(item.id))
|
|
1163
4249
|
selected.push(item);
|
|
1164
4250
|
else
|
|
1165
4251
|
unselected.push(item);
|
|
1166
4252
|
}
|
|
1167
4253
|
return [...selected, ...unselected];
|
|
1168
4254
|
});
|
|
1169
|
-
const activeOptionId = $
|
|
1170
|
-
const activeIndex = $
|
|
4255
|
+
const activeOptionId = $11.derived(() => $11.get(open) ? commandList.activeItemId ?? undefined : undefined);
|
|
4256
|
+
const activeIndex = $11.derived(() => commandList.activeItemId === null ? -1 : $11.get(visibleItems).findIndex((_, index2) => `${$$props.id}-option-${index2}` === commandList.activeItemId));
|
|
1171
4257
|
function firstEnabledIndex(list) {
|
|
1172
4258
|
return list.findIndex((item) => !item.disabled);
|
|
1173
4259
|
}
|
|
@@ -1179,57 +4265,57 @@ function Multi_select($$anchor, $$props) {
|
|
|
1179
4265
|
return -1;
|
|
1180
4266
|
}
|
|
1181
4267
|
function openMenu(preferLast = false) {
|
|
1182
|
-
if ($
|
|
4268
|
+
if ($11.get(field).disabled)
|
|
1183
4269
|
return;
|
|
1184
|
-
$
|
|
1185
|
-
$
|
|
1186
|
-
$
|
|
1187
|
-
$
|
|
4270
|
+
$11.set(open, true);
|
|
4271
|
+
$11.set(query, "");
|
|
4272
|
+
$11.set(reorderAfterReopen, selectionFeedback() === "top-after-reopen" && $11.get(openedAtLeastOnce), true);
|
|
4273
|
+
$11.set(openedAtLeastOnce, true);
|
|
1188
4274
|
tick().then(() => {
|
|
1189
|
-
const nextIndex = preferLast ? getLastEnabledIndex($
|
|
4275
|
+
const nextIndex = preferLast ? getLastEnabledIndex($11.get(visibleItems)) : firstEnabledIndex($11.get(visibleItems));
|
|
1190
4276
|
if (nextIndex >= 0)
|
|
1191
4277
|
commandList.setActiveById(`${$$props.id}-option-${nextIndex}`);
|
|
1192
4278
|
if (filterable())
|
|
1193
|
-
$
|
|
4279
|
+
$11.get(filterElement)?.focus();
|
|
1194
4280
|
else
|
|
1195
|
-
$
|
|
4281
|
+
$11.get(listboxElement)?.focus();
|
|
1196
4282
|
});
|
|
1197
4283
|
}
|
|
1198
4284
|
function closeMenu(restoreFocus = true) {
|
|
1199
|
-
$
|
|
1200
|
-
$
|
|
4285
|
+
$11.set(open, false);
|
|
4286
|
+
$11.set(query, "");
|
|
1201
4287
|
if (restoreFocus)
|
|
1202
|
-
$
|
|
4288
|
+
$11.get(triggerElement)?.focus();
|
|
1203
4289
|
}
|
|
1204
4290
|
function setSelectedIds(next2) {
|
|
1205
4291
|
selectedIds([...next2]);
|
|
1206
4292
|
}
|
|
1207
4293
|
function toggleItem(item) {
|
|
1208
|
-
if ($
|
|
4294
|
+
if ($11.get(field).disabled || readonly() || item.disabled)
|
|
1209
4295
|
return;
|
|
1210
|
-
const nextSelectedIds = $
|
|
4296
|
+
const nextSelectedIds = $11.get(selectedSet).has(item.id) ? $11.get(uniqueSelectedIds).filter((candidate) => candidate !== item.id) : [...$11.get(uniqueSelectedIds), item.id];
|
|
1211
4297
|
setSelectedIds(nextSelectedIds);
|
|
1212
|
-
if (!$
|
|
4298
|
+
if (!$11.get(open))
|
|
1213
4299
|
return;
|
|
1214
4300
|
queueMicrotask(() => {
|
|
1215
|
-
const nextIndex = $
|
|
4301
|
+
const nextIndex = $11.get(visibleItems).findIndex((candidate) => candidate.id === item.id);
|
|
1216
4302
|
if (nextIndex >= 0)
|
|
1217
4303
|
commandList.setActiveById(`${$$props.id}-option-${nextIndex}`);
|
|
1218
4304
|
});
|
|
1219
4305
|
}
|
|
1220
4306
|
function clearSelection(event2) {
|
|
1221
4307
|
event2?.stopPropagation();
|
|
1222
|
-
if ($
|
|
4308
|
+
if ($11.get(field).disabled || readonly() || selectedIds().length === 0)
|
|
1223
4309
|
return;
|
|
1224
4310
|
setSelectedIds([]);
|
|
1225
|
-
$
|
|
4311
|
+
$11.get(triggerElement)?.focus();
|
|
1226
4312
|
}
|
|
1227
4313
|
function handleListNavigationKeydown(event2) {
|
|
1228
4314
|
commandList.handleKeydown({
|
|
1229
4315
|
event: event2,
|
|
1230
4316
|
onEnter: (itemId) => {
|
|
1231
|
-
const index2 = $
|
|
1232
|
-
const item = $
|
|
4317
|
+
const index2 = $11.get(visibleItems).findIndex((_, candidateIndex) => `${$$props.id}-option-${candidateIndex}` === itemId);
|
|
4318
|
+
const item = $11.get(visibleItems)[index2];
|
|
1233
4319
|
if (item)
|
|
1234
4320
|
toggleItem(item);
|
|
1235
4321
|
},
|
|
@@ -1238,22 +4324,22 @@ function Multi_select($$anchor, $$props) {
|
|
|
1238
4324
|
});
|
|
1239
4325
|
if (event2.key === " ") {
|
|
1240
4326
|
event2.preventDefault();
|
|
1241
|
-
const item = $
|
|
4327
|
+
const item = $11.get(visibleItems)[$11.get(activeIndex)];
|
|
1242
4328
|
if (item)
|
|
1243
4329
|
toggleItem(item);
|
|
1244
4330
|
}
|
|
1245
4331
|
}
|
|
1246
4332
|
function handleTriggerKeydown(event2) {
|
|
1247
|
-
if ($
|
|
4333
|
+
if ($11.get(field).disabled)
|
|
1248
4334
|
return;
|
|
1249
|
-
if ((event2.key === "Enter" || event2.key === " ") && !$
|
|
4335
|
+
if ((event2.key === "Enter" || event2.key === " ") && !$11.get(open)) {
|
|
1250
4336
|
event2.preventDefault();
|
|
1251
4337
|
openMenu();
|
|
1252
4338
|
return;
|
|
1253
4339
|
}
|
|
1254
4340
|
if (event2.key === "ArrowDown") {
|
|
1255
4341
|
event2.preventDefault();
|
|
1256
|
-
if (!$
|
|
4342
|
+
if (!$11.get(open))
|
|
1257
4343
|
openMenu();
|
|
1258
4344
|
else
|
|
1259
4345
|
commandList.handleKeydown({ event: event2 });
|
|
@@ -1261,7 +4347,7 @@ function Multi_select($$anchor, $$props) {
|
|
|
1261
4347
|
}
|
|
1262
4348
|
if (event2.key === "ArrowUp") {
|
|
1263
4349
|
event2.preventDefault();
|
|
1264
|
-
if (!$
|
|
4350
|
+
if (!$11.get(open))
|
|
1265
4351
|
openMenu(true);
|
|
1266
4352
|
else
|
|
1267
4353
|
commandList.handleKeydown({ event: event2 });
|
|
@@ -1273,7 +4359,7 @@ function Multi_select($$anchor, $$props) {
|
|
|
1273
4359
|
}
|
|
1274
4360
|
function handleFilterInput(event2) {
|
|
1275
4361
|
commandList.resetActiveItem();
|
|
1276
|
-
$
|
|
4362
|
+
$11.set(query, event2.currentTarget.value, true);
|
|
1277
4363
|
}
|
|
1278
4364
|
function handleFilterKeydown(event2) {
|
|
1279
4365
|
if (event2.isComposing)
|
|
@@ -1292,28 +4378,28 @@ function Multi_select($$anchor, $$props) {
|
|
|
1292
4378
|
if (event2.defaultPrevented)
|
|
1293
4379
|
return;
|
|
1294
4380
|
setSelectedIds(initialSelectedIds);
|
|
1295
|
-
$
|
|
1296
|
-
$
|
|
4381
|
+
$11.set(open, false);
|
|
4382
|
+
$11.set(query, "");
|
|
1297
4383
|
}, 0);
|
|
1298
4384
|
}
|
|
1299
4385
|
function handleProxyInvalid(event2) {
|
|
1300
4386
|
event2.preventDefault();
|
|
1301
|
-
$
|
|
1302
|
-
$
|
|
4387
|
+
$11.set(nativeError, $11.get(validityProxyElement)?.validationMessage || ($11.get(validityProxyElement)?.validity.valueMissing ? "Please select at least one option." : ""), true);
|
|
4388
|
+
$11.get(triggerElement)?.focus();
|
|
1303
4389
|
}
|
|
1304
|
-
$
|
|
1305
|
-
const
|
|
1306
|
-
if (!
|
|
4390
|
+
$11.user_effect(() => {
|
|
4391
|
+
const proxy4 = $11.get(validityProxyElement);
|
|
4392
|
+
if (!proxy4)
|
|
1307
4393
|
return;
|
|
1308
|
-
|
|
1309
|
-
if (
|
|
1310
|
-
$
|
|
4394
|
+
proxy4.setCustomValidity($11.get(field).required && $11.get(uniqueSelectedIds).length === 0 ? "Please select at least one option." : "");
|
|
4395
|
+
if (proxy4.validationMessage === "")
|
|
4396
|
+
$11.set(nativeError, "");
|
|
1311
4397
|
});
|
|
1312
|
-
$
|
|
1313
|
-
const
|
|
1314
|
-
if (
|
|
4398
|
+
$11.user_effect(() => {
|
|
4399
|
+
const proxy4 = $11.get(validityProxyElement);
|
|
4400
|
+
if (proxy4 === null)
|
|
1315
4401
|
return;
|
|
1316
|
-
const form =
|
|
4402
|
+
const form = proxy4.form;
|
|
1317
4403
|
form?.addEventListener("reset", resetToInitialValue);
|
|
1318
4404
|
return () => {
|
|
1319
4405
|
form?.removeEventListener("reset", resetToInitialValue);
|
|
@@ -1323,12 +4409,12 @@ function Multi_select($$anchor, $$props) {
|
|
|
1323
4409
|
}
|
|
1324
4410
|
};
|
|
1325
4411
|
});
|
|
1326
|
-
$
|
|
1327
|
-
const listbox = $
|
|
4412
|
+
$11.user_effect(() => {
|
|
4413
|
+
const listbox = $11.get(listboxElement);
|
|
1328
4414
|
if (!listbox)
|
|
1329
4415
|
return;
|
|
1330
4416
|
const optionNodes = Array.from(listbox.querySelectorAll('[role="option"]'));
|
|
1331
|
-
commandList.syncItems($
|
|
4417
|
+
commandList.syncItems($11.get(visibleItems).flatMap((item, index2) => {
|
|
1332
4418
|
const node = optionNodes[index2];
|
|
1333
4419
|
return node ? [
|
|
1334
4420
|
{
|
|
@@ -1341,26 +4427,26 @@ function Multi_select($$anchor, $$props) {
|
|
|
1341
4427
|
] : [];
|
|
1342
4428
|
}));
|
|
1343
4429
|
});
|
|
1344
|
-
$
|
|
1345
|
-
if (!$
|
|
4430
|
+
$11.user_effect(() => {
|
|
4431
|
+
if (!$11.get(open))
|
|
1346
4432
|
return;
|
|
1347
4433
|
return commandList.bindDismissal({
|
|
1348
|
-
isOpen: () => $
|
|
1349
|
-
isInside: (target) => !!$
|
|
4434
|
+
isOpen: () => $11.get(open),
|
|
4435
|
+
isInside: (target) => !!$11.get(controlElement)?.contains(target) || !!$11.get(panelElement)?.contains(target),
|
|
1350
4436
|
onDismiss: closeMenu
|
|
1351
4437
|
});
|
|
1352
4438
|
});
|
|
1353
|
-
$
|
|
1354
|
-
if (!$
|
|
4439
|
+
$11.user_effect(() => {
|
|
4440
|
+
if (!$11.get(open))
|
|
1355
4441
|
return;
|
|
1356
4442
|
commandList.scrollActiveItemIntoView();
|
|
1357
4443
|
});
|
|
1358
4444
|
{
|
|
1359
|
-
let $0 = $
|
|
1360
|
-
let $1 = $
|
|
4445
|
+
let $0 = $11.derived(() => classNames("cinder-multi-select", $$props.class));
|
|
4446
|
+
let $1 = $11.derived(() => $11.get(field).ownErrorId ?? $11.get(stableLocalErrorId));
|
|
1361
4447
|
Form_field_frame($$anchor, {
|
|
1362
4448
|
get id() {
|
|
1363
|
-
return $
|
|
4449
|
+
return $11.get(field).id;
|
|
1364
4450
|
},
|
|
1365
4451
|
get label() {
|
|
1366
4452
|
return $$props.label;
|
|
@@ -1369,25 +4455,25 @@ function Multi_select($$anchor, $$props) {
|
|
|
1369
4455
|
return $$props.description;
|
|
1370
4456
|
},
|
|
1371
4457
|
get error() {
|
|
1372
|
-
return $
|
|
4458
|
+
return $11.get(combinedError);
|
|
1373
4459
|
},
|
|
1374
4460
|
get required() {
|
|
1375
|
-
return $
|
|
4461
|
+
return $11.get(field).required;
|
|
1376
4462
|
},
|
|
1377
4463
|
get disabled() {
|
|
1378
|
-
return $
|
|
4464
|
+
return $11.get(field).disabled;
|
|
1379
4465
|
},
|
|
1380
4466
|
get class() {
|
|
1381
|
-
return $
|
|
4467
|
+
return $11.get($0);
|
|
1382
4468
|
},
|
|
1383
4469
|
labelClass: "cinder-multi-select__label",
|
|
1384
4470
|
descriptionClass: "cinder-multi-select__description",
|
|
1385
4471
|
errorClass: "cinder-multi-select__error",
|
|
1386
4472
|
get descriptionId() {
|
|
1387
|
-
return $
|
|
4473
|
+
return $11.get(field).ownDescriptionId;
|
|
1388
4474
|
},
|
|
1389
4475
|
get errorId() {
|
|
1390
|
-
return $
|
|
4476
|
+
return $11.get($1);
|
|
1391
4477
|
},
|
|
1392
4478
|
errorAlwaysMounted: true,
|
|
1393
4479
|
get control() {
|
|
@@ -1398,9 +4484,9 @@ function Multi_select($$anchor, $$props) {
|
|
|
1398
4484
|
}
|
|
1399
4485
|
});
|
|
1400
4486
|
}
|
|
1401
|
-
$
|
|
4487
|
+
$11.pop();
|
|
1402
4488
|
}
|
|
1403
|
-
$
|
|
4489
|
+
$11.delegate(["click", "keydown", "input", "mousedown"]);
|
|
1404
4490
|
|
|
1405
4491
|
// src/components/multi-select/index.ts
|
|
1406
4492
|
var multi_select_default = Multi_select;
|
|
@@ -1409,4 +4495,4 @@ export {
|
|
|
1409
4495
|
Multi_select as MultiSelect
|
|
1410
4496
|
};
|
|
1411
4497
|
|
|
1412
|
-
//# debugId=
|
|
4498
|
+
//# debugId=DCC3DBD7F0A144CA64756E2164756E21
|