@mkbabb/glass-ui 3.1.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/dist/{CardFooter-CSGcJkqa.js → CardFooter-3-VGho1J.js} +1 -1
  2. package/dist/{CommandShortcut-DWT19a2Y.js → CommandShortcut-C6lsz3pG.js} +3 -3
  3. package/dist/{ContextMenuSubContent-gAFxJ-qi.js → ContextMenuSubContent-DrWkXKQP.js} +4 -4
  4. package/dist/{DataTable-R8-Zidms.js → DataTable-BsrDYdoE.js} +3 -3
  5. package/dist/{DialogContent-2fALDSvc.js → DialogContent-B61rP8lj.js} +3 -3
  6. package/dist/{DialogFooter-ClrNEOVU.js → DialogFooter-Er0wA3K6.js} +2 -2
  7. package/dist/{DiscoGlyph-C3JfMnRV.js → DiscoGlyph-B7YooI2-.js} +1 -1
  8. package/dist/{GlyphFace-BRS8vUb7.js → GlyphFace-Bvk6OIas.js} +1 -1
  9. package/dist/{HoverPopover-CWFCfLx3.js → HoverPopover-BlEwqG7S.js} +1 -1
  10. package/dist/{IconTooltip-BkaA7tZ2.js → IconTooltip-DXveGjx7.js} +1 -1
  11. package/dist/{MetricBadge-DmAihkXd.js → MetricBadge-J_GBCb8e.js} +1 -1
  12. package/dist/{Notification-OqIpADml.js → Notification-DP_ApJLo.js} +3 -3
  13. package/dist/{NumberFieldContent-DTH9gb_N.js → NumberFieldContent-B6L6YrQz.js} +2 -2
  14. package/dist/{PopoverContent-EiklFrna.js → PopoverContent-CxEEUL7Y.js} +1 -1
  15. package/dist/{Progress-FApA9fm_.js → Progress-Bs44qWEM.js} +1 -1
  16. package/dist/{ScrollingText-BFd0i2zJ.js → ScrollingText-1Qjnwz6H.js} +2 -2
  17. package/dist/{SelectScrollDownButton-Dth8-wXQ.js → SelectScrollDownButton-BvvvAbuh.js} +4 -4
  18. package/dist/{Toaster-Bjlunvq4.js → Toaster-Brs6QjBU.js} +1 -1
  19. package/dist/{UnderlineTabs-DAWMLmJG.js → UnderlineTabs-B4FV2zi_.js} +1 -1
  20. package/dist/animated-digit.js +2 -2
  21. package/dist/api.js +1 -1
  22. package/dist/aurora.js +118 -150
  23. package/dist/badge.js +1 -1
  24. package/dist/button.js +1 -1
  25. package/dist/card.js +1 -1
  26. package/dist/carousel.js +5 -5
  27. package/dist/{check-dwgetki8.js → check-CdkxGxXJ.js} +1 -1
  28. package/dist/{chevron-down-DILQA1t6.js → chevron-down-pBY8sYfV.js} +1 -1
  29. package/dist/{chevron-right-fS7fal2t.js → chevron-right-BjeKC22V.js} +1 -1
  30. package/dist/{chevron-up-BtYjYQOS.js → chevron-up-DBeNHUm1.js} +1 -1
  31. package/dist/collapsible.js +1 -1
  32. package/dist/command.js +1 -1
  33. package/dist/components/custom/aurora/composables/color.d.ts +56 -8
  34. package/dist/components/custom/aurora/index.d.ts +2 -1
  35. package/dist/components/custom/aurora/presets.d.ts +1 -1
  36. package/dist/components/custom/aurora/shaders/aurora.frag.d.ts +1 -1
  37. package/dist/components/custom/configurator/Configurator.vue.d.ts +26 -0
  38. package/dist/components/custom/configurator/index.d.ts +1 -1
  39. package/dist/components/custom/dock/DockIconButton.vue.d.ts +14 -3
  40. package/dist/components/custom/dock/GlassDock.vue.d.ts +17 -0
  41. package/dist/composables/dom/index.d.ts +1 -0
  42. package/dist/composables/dom/useTextHighlight.d.ts +40 -0
  43. package/dist/composables/motion/core/index.d.ts +1 -0
  44. package/dist/composables/motion/usePrioritizedTask.d.ts +41 -0
  45. package/dist/composables/sortable/useSortable.d.ts +13 -0
  46. package/dist/configurator.js +1 -1
  47. package/dist/confirm-dialog.js +3 -3
  48. package/dist/context-menu.js +2 -2
  49. package/dist/controls.js +2 -2
  50. package/dist/dark.js +1 -1
  51. package/dist/data-table.js +1 -1
  52. package/dist/dialog.js +2 -2
  53. package/dist/disco-glyph.js +1 -1
  54. package/dist/dock.js +91 -74
  55. package/dist/dom.js +6 -5
  56. package/dist/{dropdown-menu-BvRUamNs.js → dropdown-menu-naE0skDg.js} +4 -4
  57. package/dist/dropdown-menu.js +1 -1
  58. package/dist/expandable-container.js +2 -2
  59. package/dist/forms.js +4 -4
  60. package/dist/glass-carousel.js +59 -52
  61. package/dist/glass-panel.js +2 -2
  62. package/dist/glass-ui.css +1 -1
  63. package/dist/glass-ui.js +231 -224
  64. package/dist/glyph-face.js +2 -2
  65. package/dist/header-ribbon.js +1 -1
  66. package/dist/hover-card.js +1 -1
  67. package/dist/hover-popover.js +1 -1
  68. package/dist/icon-tooltip.js +1 -1
  69. package/dist/instrument-chassis.js +1 -1
  70. package/dist/instrument-rail.js +1 -1
  71. package/dist/keyboard.js +1 -1
  72. package/dist/label.js +1 -1
  73. package/dist/labeled-field.js +6 -6
  74. package/dist/metric-badge.js +1 -1
  75. package/dist/metric-stack.js +1 -1
  76. package/dist/{minimize-2-LsCJ_eNt.js → minimize-2-BP27-qBY.js} +1 -1
  77. package/dist/motion-core.js +155 -95
  78. package/dist/motion.js +3 -3
  79. package/dist/notification.js +1 -1
  80. package/dist/number-field.js +1 -1
  81. package/dist/paper-backdrop.js +1 -1
  82. package/dist/popover.js +1 -1
  83. package/dist/{presets-a-D93K1S.js → presets-BpTf63Hp.js} +4 -4
  84. package/dist/progress.js +1 -1
  85. package/dist/pulse.js +1 -1
  86. package/dist/reactive.js +2 -2
  87. package/dist/responsive-tabs.js +2 -2
  88. package/dist/scrolling-text.js +1 -1
  89. package/dist/{search-DBAiUABx.js → search-DBG8qaRs.js} +1 -1
  90. package/dist/search.js +153 -149
  91. package/dist/select.js +3 -3
  92. package/dist/separator.js +1 -1
  93. package/dist/{sheet-CukNDezz.js → sheet-BnvZRXPq.js} +3 -3
  94. package/dist/sheet.js +1 -1
  95. package/dist/{slider-DJvHkTRe.js → slider-wx8ifVFB.js} +3 -3
  96. package/dist/slider.js +1 -1
  97. package/dist/sortable-list.js +2 -2
  98. package/dist/styles/components.css +45 -0
  99. package/dist/styles/dock.css +71 -2
  100. package/dist/styles/index.css +5 -1
  101. package/dist/styles/tokens.css +11 -0
  102. package/dist/styles/utilities.css +56 -0
  103. package/dist/supportsCssTimeline-IQY3gfKD.js +12 -0
  104. package/dist/switch.js +1 -1
  105. package/dist/tabs.js +25 -10
  106. package/dist/timeline.js +2 -2
  107. package/dist/toast.js +1 -1
  108. package/dist/toggle-group.js +1 -1
  109. package/dist/tooltip.js +1 -1
  110. package/dist/typewriter.js +1 -1
  111. package/dist/{useAnimatedNumber-DKQYVB7s.js → useAnimatedNumber-BOxrS3a6.js} +1 -1
  112. package/dist/{useConfiguratorState-BR5vUDL8.js → useConfiguratorState-Dq2gNv4A.js} +55 -41
  113. package/dist/{useIdleReady-Cmkhm03v.js → useIdleReady-sLhGo6CL.js} +1 -1
  114. package/dist/useSortable-DLK9kwZp.js +189 -0
  115. package/dist/useTextHighlight-CLST6an0.js +72 -0
  116. package/dist/{useTouchGate-D9Zvrzyc.js → useTouchGate-XX8gHfay.js} +1 -1
  117. package/dist/{useViewTransition-DYIK6Gzb.js → useViewTransition-CUJM7fXT.js} +5 -3
  118. package/dist/utils/index.d.ts +2 -1
  119. package/dist/utils/platformSupport.d.ts +8 -0
  120. package/dist/{x-q7pJa83X.js → x-C4pz9nbD.js} +1 -1
  121. package/package.json +14 -3
  122. package/src/styles/dock.css +71 -2
  123. package/src/styles/index.css +1 -1
  124. package/src/styles/tokens.css +11 -0
  125. package/src/styles/utilities.css +56 -0
  126. package/dist/useSortable-Cq2Y1JLO.js +0 -175
  127. /package/dist/{CollapsibleContent-CVMOcYlV.js → CollapsibleContent-wlmlDujU.js} +0 -0
  128. /package/dist/{ContextMenuContent-otjFIu8v.js → ContextMenuContent-De01_83g.js} +0 -0
  129. /package/dist/{HoverCardContent-DaGrgJBO.js → HoverCardContent-DGUhpRVt.js} +0 -0
  130. /package/dist/{Input-DDpFn568.js → Input-IFsIzId2.js} +0 -0
  131. /package/dist/{InstrumentChassis-CnHTMxds.js → InstrumentChassis-CqKPBNqp.js} +0 -0
  132. /package/dist/{InstrumentRail-C6dEbi8E.js → InstrumentRail-CCjvKkpB.js} +0 -0
  133. /package/dist/{Label-DJty89bp.js → Label-D53EOwLE.js} +0 -0
  134. /package/dist/{ModalOverlay-iWiAgbYH.js → ModalOverlay-B_CBtqcE.js} +0 -0
  135. /package/dist/{PaperBackdrop-CeZ-w0R0.js → PaperBackdrop-Ds-wDsKf.js} +0 -0
  136. /package/dist/{SelectGroup-DdR4tdDY.js → SelectGroup-DAgcsfFw.js} +0 -0
  137. /package/dist/{SelectSeparator-CXm_hlqA.js → SelectSeparator-DN1jzLaI.js} +0 -0
  138. /package/dist/{Separator-D8AUMhxY.js → Separator-DXxac0j8.js} +0 -0
  139. /package/dist/{Switch-Cr1t_F_U.js → Switch-imA0Hdjs.js} +0 -0
  140. /package/dist/{ToggleGroupItem-OesUouE7.js → ToggleGroupItem-Cy7xHFEo.js} +0 -0
  141. /package/dist/{TooltipProvider-DE78vbEP.js → TooltipProvider-MZFRxOvT.js} +0 -0
  142. /package/dist/{_plugin-vue_export-helper-Dq1MygBL.js → _plugin-vue_export-helper-C1je1s0u.js} +0 -0
  143. /package/dist/{badge-x46my_Fo.js → badge-Cl6JZ1B7.js} +0 -0
  144. /package/dist/{button-C0aHmBbt.js → button-DS3ULf5i.js} +0 -0
  145. /package/dist/{constants-DwBwnG8N.js → constants-DfWPi8kh.js} +0 -0
  146. /package/dist/{createLucideIcon-Bn9a1b70.js → createLucideIcon-DuDoe_ra.js} +0 -0
  147. /package/dist/{dockContext-D5NZCWJs.js → dockContext-DM58L1Jt.js} +0 -0
  148. /package/dist/{keys-CaTQS-vx.js → keys-SIKQYNx1.js} +0 -0
  149. /package/dist/{menuItemVariants-BsbGNq9C.js → menuItemVariants-C2QlXqT3.js} +0 -0
  150. /package/dist/{useGlassRenderer-Ds-nmrGz.js → useGlassRenderer-C98tZnJ7.js} +0 -0
  151. /package/dist/{useGlobalDark-B0WvLJE3.js → useGlobalDark-BUUTZvkU.js} +0 -0
  152. /package/dist/{useIntersectionPause-IY2CwPQb.js → useIntersectionPause-CUmANkoc.js} +0 -0
  153. /package/dist/{useInterval-DVgGUf_y.js → useInterval-B58LmYth.js} +0 -0
  154. /package/dist/{useKeyboardShortcuts-Dpw_RUcB.js → useKeyboardShortcuts-BQfnAHHW.js} +0 -0
  155. /package/dist/{useResizeObserver-Cg9npuM3.js → useResizeObserver-C_7GjpRn.js} +0 -0
  156. /package/dist/{useSpringMount-Cfk1XK1R.js → useSpringMount-CnizvZGm.js} +0 -0
  157. /package/dist/{useTimer-NAaj9zNq.js → useTimer-6FoosoDY.js} +0 -0
  158. /package/dist/{useUserInvalidAria-DVu1eTXG.js → useUserInvalidAria-BW5iyqWR.js} +0 -0
@@ -489,6 +489,56 @@
489
489
  overflow-y: visible;
490
490
  }
491
491
 
492
+ /* ── Scroll-on-overflow opt-in (GlassDock `overflow="scroll"`) ───────
493
+ The default contract grows-to-fit then overflows visibly past the
494
+ axis cap. `overflow="scroll"` instead makes the dock the scroll port
495
+ on its layout axis, pairing the existing cap with a hidden-scrollbar
496
+ scroll region so over-cap content stays reachable. The rounded pill
497
+ masks the scroll edge; both axes keep their cap. */
498
+
499
+ /* Inline axis (horizontal docks). The active layer becomes the scroll
500
+ port: `min-width: 0` releases the flex item's `min-content` floor so
501
+ it can shrink under the clamped `.dock-layers` track, then `overflow-x:
502
+ auto` scrolls its over-cap content. `.dock-layers` must KEEP clipping
503
+ so the pill's rounded edge masks the scroll boundary — hence the
504
+ grow-mode `overflow-x: visible` (`.dock-layers`, above) is overridden
505
+ back to `hidden` here. */
506
+ .glass-dock.dock-scroll-x.expanded:not(.dock-wrap) > .dock-layers {
507
+ overflow-x: hidden;
508
+ }
509
+
510
+ .glass-dock.dock-scroll-x .dock-layer--full {
511
+ min-width: 0;
512
+ overflow-x: auto;
513
+ scrollbar-width: none;
514
+ /* Trap the inline-scroll momentum at the dock's own boundary so a
515
+ wheel/trackpad gesture that bottoms out the pill does NOT chain into
516
+ scrolling the page behind it (the dock is a self-contained scroll
517
+ port, not a window into the route scroller). */
518
+ overscroll-behavior-x: contain;
519
+ }
520
+
521
+ .glass-dock.dock-scroll-x .dock-layer--full::-webkit-scrollbar {
522
+ display: none;
523
+ }
524
+
525
+ /* Block axis (vertical rails). The root keeps its `max-block-size` cap
526
+ and scrolls its over-cap children — cap + scroll is the correct
527
+ pairing the grow-mode contract split apart. Ties the
528
+ `.vertical.always-expanded` visible default on specificity and wins on
529
+ source order. */
530
+ .glass-dock.vertical.dock-scroll-y {
531
+ overflow-y: auto;
532
+ scrollbar-width: none;
533
+ /* Same momentum-trap as the inline port — a rail that bottoms out must
534
+ not chain its remaining wheel delta into the page scroller behind it. */
535
+ overscroll-behavior-y: contain;
536
+ }
537
+
538
+ .glass-dock.vertical.dock-scroll-y::-webkit-scrollbar {
539
+ display: none;
540
+ }
541
+
492
542
  .glass-dock.dock-wrap {
493
543
  white-space: normal;
494
544
  border-radius: var(--radius-2xl);
@@ -670,7 +720,11 @@
670
720
  border: none;
671
721
  background: transparent;
672
722
  border-radius: var(--dock-control-radius, var(--radius-pill));
673
- color: color-mix(in srgb, var(--foreground) calc(var(--opacity-icon-muted) * 100%), transparent);
723
+ /* Foreground base routes through `--dock-fg-on-aurora` (defaults to
724
+ `--foreground`, byte-identical to before) so a consumer floating the
725
+ dock over an aurora can lift contrast per-backdrop. The muted icon
726
+ weight mixes that base down with `--opacity-icon-muted`. */
727
+ color: color-mix(in srgb, var(--dock-fg-on-aurora, var(--foreground)) calc(var(--opacity-icon-muted) * 100%), transparent);
674
728
  outline: none;
675
729
  transition:
676
730
  background-color var(--dock-motion-fast),
@@ -968,7 +1022,8 @@
968
1022
  border: none;
969
1023
  background: transparent;
970
1024
  border-radius: var(--dock-control-radius, var(--radius-pill));
971
- color: color-mix(in srgb, var(--foreground) calc(var(--opacity-icon-muted) * 100%), transparent);
1025
+ /* Shares the dock-icon-button legibility base (`--dock-fg-on-aurora`). */
1026
+ color: color-mix(in srgb, var(--dock-fg-on-aurora, var(--foreground)) calc(var(--opacity-icon-muted) * 100%), transparent);
972
1027
  outline: none;
973
1028
  transition:
974
1029
  background-color var(--dock-motion-fast),
@@ -1081,5 +1136,19 @@
1081
1136
  --dock-control-size: var(--dock-touch-target, 2.75rem);
1082
1137
  --size-icon-btn: var(--dock-touch-target, 2.75rem);
1083
1138
  }
1139
+
1140
+ /* S-2 — the in-dock floor above lifts the control-SIZE token, which
1141
+ only reaches a DockIconButton that has a `.glass-dock` ancestor.
1142
+ A STANDALONE DockIconButton (a routed settings gear, no dock
1143
+ wrapper) reads the bare `--size-icon-btn` and would fall below the
1144
+ 44px WCAG target. This button-level floor holds the touch box
1145
+ regardless of ancestry; the in-dock rule above stays (more specific,
1146
+ and it also reserves the slot in the dock's width-math). Compact
1147
+ buttons opt out — they are auto-sized affordances, not primary
1148
+ targets. */
1149
+ .dock-icon-button:not(.dock-icon-button--compact) {
1150
+ min-block-size: var(--dock-touch-target, 2.75rem);
1151
+ min-inline-size: var(--dock-touch-target, 2.75rem);
1152
+ }
1084
1153
  }
1085
1154
  }
@@ -53,7 +53,7 @@
53
53
  * Consumes tokens (1) + theme aliases (3).
54
54
  * 5. paper.css — paper underpaint + grain overlay utilities.
55
55
  * Pairs with (4) for paper-on-glass compositions.
56
- * 6. dock.css — .dock-icon-btn, .dock-select-trigger, etc.
56
+ * 6. dock.css — .dock-icon-button, .dock-select-trigger, etc.
57
57
  * Component utility layer; consumes (1) + (3).
58
58
  * 7. cards.css — .cartoon-surface, .paper-texture.
59
59
  * Component utility layer.
@@ -619,6 +619,17 @@
619
619
  dock reads as painted chrome, not a frosted ghost. */
620
620
  --glass-opacity-dock: 0.42;
621
621
 
622
+ /* Dock foreground over an animated backdrop. A dock floating over an
623
+ aurora/animated surface (`value.js` dock-over-aurora, a slides routed
624
+ control, bbnf) sits on a mid-luminance, shifting field where the muted
625
+ default fg can drop below contrast. This token is the dock control's
626
+ foreground base — a complete `hsl()` color consumed via `var()`; for the
627
+ muted icon weight the control mixes it down with `--opacity-icon-muted`.
628
+ Defaults to `var(--foreground)` so the dock paints byte-identically to
629
+ today; a consumer overrides it per-backdrop (e.g. a near-white over a
630
+ dark aurora) without touching library source. */
631
+ --dock-fg-on-aurora: var(--foreground);
632
+
622
633
  /* Chassis-specific opacity. Looser than `default` (0.50) so the
623
634
  <InstrumentChassis> surface reads as glass-over-aurora at its
624
635
  64rem-wide footprint; the default tier stays calibrated for cards.
@@ -480,6 +480,40 @@
480
480
  --metric-badge-padding-inline: 0.5rem;
481
481
  }
482
482
 
483
+ /* AS.W4 — @container style(--density) companion. A pill nested under a host
484
+ that sets `--density: comfortable | spacious` on a wrapping element picks
485
+ up the matching padding register with no `data-density` markup contract;
486
+ the attribute rules above stay the SOLE fallback (inv 47).
487
+ The inner `.metric-pill.metric-badge--label-stacked` selector (0,2,0) sits
488
+ just BELOW the `.metric-pill[data-density]…` attribute rules (0,3,0) — so a
489
+ pill carrying BOTH the attribute and a `--density` ancestor lands on the
490
+ attribute rule (same tokens, identical paint), while a pill with only the
491
+ ancestor token still resolves the right register (no competing rule sets
492
+ these padding custom props at higher weight in that case).
493
+
494
+ No `@supports` wrapper: unlike the sibling scroll-state recipe (which
495
+ probes `@supports (container-type: scroll-state)` — a probeable
496
+ container-type VALUE), style queries introduce no new `container-type`
497
+ value (every element is a style container by default), so there is no
498
+ clean declaration test for style-query support. This relies on
499
+ `@container style()`'s own graceful degradation: an engine without
500
+ style-query support parses the unknown at-rule as invalid, drops the
501
+ block, and keeps the `[data-density]` attribute base. (The earlier
502
+ `@supports (container-type: inline-size)` wrapper was wrong — it probed
503
+ SIZE-query support, a distinct feature with a distinct support timeline.) */
504
+ @container style(--density: spacious) {
505
+ .metric-pill.metric-badge--label-stacked {
506
+ --metric-badge-padding-block-stacked: 0.5rem;
507
+ --metric-badge-padding-inline: 0.75rem;
508
+ }
509
+ }
510
+ @container style(--density: comfortable) {
511
+ .metric-pill.metric-badge--label-stacked {
512
+ --metric-badge-padding-block-stacked: 0.25rem;
513
+ --metric-badge-padding-inline: 0.5rem;
514
+ }
515
+ }
516
+
483
517
  .metric-badge__label {
484
518
  letter-spacing: 0.18em;
485
519
  line-height: 1;
@@ -894,6 +928,28 @@
894
928
  );
895
929
  }
896
930
 
931
+ /* ── Text-highlight paint (CSS Custom Highlight API) ─────────────────────
932
+ The default `::highlight()` paint for the `useTextHighlight` composable
933
+ (composables/dom). A named `Highlight` registered in `CSS.highlights`
934
+ under one of these keys paints its `Range` set without a `<mark>` wrapper.
935
+ Token-bridged: the search mark reads the canonical pastel-yellow rainbow
936
+ token at a soft alpha; the equation/variable mark reads `--primary`. Both
937
+ axes are overridable via the `--text-highlight-*` custom properties. */
938
+ ::highlight(glass-search-mark) {
939
+ background-color: var(
940
+ --text-highlight-search-bg,
941
+ color-mix(in srgb, var(--rainbow-pastel-yellow) 55%, transparent)
942
+ );
943
+ color: var(--text-highlight-search-fg, inherit);
944
+ }
945
+ ::highlight(glass-mark) {
946
+ background-color: var(
947
+ --text-highlight-bg,
948
+ color-mix(in srgb, var(--primary) 18%, transparent)
949
+ );
950
+ color: var(--text-highlight-fg, inherit);
951
+ }
952
+
897
953
  /* ── Interactive-button four-state recipe ────────────────────────────────
898
954
  `.btn-interactive` carries the canonical "Button-with-spring-hover"
899
955
  four-state contract — transition + hover-scale (`--scale-hover`) +
@@ -1,175 +0,0 @@
1
- import { computed as e, onScopeDispose as t, shallowRef as n } from "vue";
2
- //#region src/composables/sortable/useSortable.ts
3
- var r = "[data-sortable-handle]", i = "is-sortable-drop-above", a = "is-sortable-drop-below", o = "sortable-drag-ghost", s = "is-sortable-dragging", c = /* @__PURE__ */ new Set();
4
- function l(e, t, n) {
5
- if (!e.group) return null;
6
- for (let r of c) {
7
- if (r === e || r.group !== e.group) continue;
8
- let i = r.getContainer();
9
- if (!i) continue;
10
- let a = i.getBoundingClientRect();
11
- if (t >= a.left && t <= a.right && n >= a.top && n <= a.bottom) return r;
12
- }
13
- return null;
14
- }
15
- function u(u) {
16
- let { items: d, getId: f, onReorder: p, onInsert: m, group: h, handleSelector: g = r, axis: _ = "y" } = u, v = n(null), y = n(null), b = n(null), x = null, S = null, C = 0, w = 0, T = null, E = null, D = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Map();
17
- function k() {
18
- return d.value;
19
- }
20
- function A(e) {
21
- let t = k();
22
- for (let n = 0; n < t.length; n++) if (f(t[n]) === e) return n;
23
- return -1;
24
- }
25
- function j(e, t, n, r, i) {
26
- let a = i ? n : r;
27
- for (let n = 0; n < t.length; n++) {
28
- let r = e.get(t[n].id);
29
- if (!r) continue;
30
- let o = r.getBoundingClientRect();
31
- if (a < (i ? o.left + o.width / 2 : o.top + o.height / 2)) return n;
32
- }
33
- return t.length;
34
- }
35
- function M(e, t) {
36
- return j(D, k().map((e) => ({ id: f(e) })), e, t, _ === "x");
37
- }
38
- function N(e) {
39
- return g === null ? !0 : e instanceof Element ? e.closest(g) !== null : !1;
40
- }
41
- function P(e, t, n) {
42
- let r = e.getBoundingClientRect();
43
- C = t - r.left, w = n - r.top;
44
- let i = e.cloneNode(!0);
45
- i.classList.add(o), i.style.position = "fixed", i.style.left = `${r.left}px`, i.style.top = `${r.top}px`, i.style.width = `${r.width}px`, i.style.height = `${r.height}px`, i.style.margin = "0", i.style.pointerEvents = "none", i.style.zIndex = "9999", i.id && i.removeAttribute("id");
46
- for (let e of i.querySelectorAll("[id]")) e.removeAttribute("id");
47
- document.body.appendChild(i), S = i;
48
- }
49
- function F(e, t) {
50
- S && (S.style.left = `${e - C}px`, S.style.top = `${t - w}px`);
51
- }
52
- function I() {
53
- S && S.parentNode && S.parentNode.removeChild(S), S = null;
54
- }
55
- function L(e, t) {
56
- let n = D.get(e);
57
- if (!(n instanceof HTMLElement)) return;
58
- v.value = e, y.value = {
59
- x: t.clientX,
60
- y: t.clientY
61
- }, b.value = A(e), x = null, T = n, n.classList.add(s), P(n, t.clientX, t.clientY);
62
- let r = t.currentTarget;
63
- if (r && "setPointerCapture" in r) try {
64
- r.setPointerCapture(t.pointerId);
65
- } catch {}
66
- document.addEventListener("pointermove", R), document.addEventListener("pointerup", z), document.addEventListener("pointercancel", z);
67
- }
68
- function R(e) {
69
- if (v.value === null) return;
70
- y.value = {
71
- x: e.clientX,
72
- y: e.clientY
73
- }, F(e.clientX, e.clientY);
74
- let t = l(W, e.clientX, e.clientY);
75
- if (t) {
76
- x && x !== t && x.setExternalDropIndex(null), x = t;
77
- let n = t.getItems().map((e) => ({ id: t.getId(e) })), r = j(t.getElements(), n, e.clientX, e.clientY, _ === "x");
78
- t.setExternalDropIndex(r), b.value = null;
79
- } else x &&= (x.setExternalDropIndex(null), null), b.value = M(e.clientX, e.clientY);
80
- }
81
- function z(e) {
82
- let t = v.value, n = x, r = b.value;
83
- if (B(), t === null) return;
84
- let i = k(), a = i.findIndex((e) => f(e) === t);
85
- if (a < 0) return;
86
- if (n) {
87
- let e = i[a], t = i.slice();
88
- t.splice(a, 1), p(t);
89
- let r = n.getExternalDropIndex?.() ?? null;
90
- n.setExternalDropIndex(null), n.acceptExternal(r ?? 0, e);
91
- return;
92
- }
93
- if (r === null) return;
94
- let o = r;
95
- if (o > a && --o, o === a) return;
96
- let s = i.slice(), [c] = s.splice(a, 1);
97
- s.splice(o, 0, c), p(s);
98
- }
99
- function B() {
100
- I(), T &&= (T.classList.remove(s), null), x &&= (x.setExternalDropIndex(null), null), v.value = null, y.value = null, b.value = null, document.removeEventListener("pointermove", R), document.removeEventListener("pointerup", z), document.removeEventListener("pointercancel", z);
101
- }
102
- function V(t) {
103
- let n = O.get(t);
104
- if (n) return n;
105
- let r = (e) => {
106
- e === null ? D.delete(t) : D.set(t, e);
107
- };
108
- function o(e, n) {
109
- let r = A(t);
110
- return r < 0 ? {
111
- above: !1,
112
- below: !1
113
- } : e === n ? {
114
- above: !1,
115
- below: r === n - 1
116
- } : {
117
- above: r === e,
118
- below: !1
119
- };
120
- }
121
- let s = e(() => {
122
- let e = {
123
- [i]: !1,
124
- [a]: !1
125
- };
126
- if (v.value !== null && b.value !== null) {
127
- let t = o(b.value, k().length);
128
- t.above && (e[i] = !0), t.below && (e[a] = !0);
129
- }
130
- if (H.value !== null && v.value === null) {
131
- let t = o(H.value, k().length);
132
- t.above && (e[i] = !0), t.below && (e[a] = !0);
133
- }
134
- return e;
135
- }), c = {
136
- ref: r,
137
- dataAttrs: { "data-sortable-id": String(t) },
138
- class: s,
139
- onPointerdown: (e) => {
140
- e.button === 0 && N(e.target) && (e.preventDefault(), L(t, e));
141
- }
142
- };
143
- return O.set(t, c), c;
144
- }
145
- let H = n(null), U = {
146
- ref: (e) => {
147
- E = e;
148
- },
149
- dataAttrs: { "data-sortable-container": h ?? "" }
150
- }, W = {
151
- group: h,
152
- getContainer: () => E,
153
- getItems: () => d.value,
154
- getId: (e) => f(e),
155
- getElements: () => D,
156
- setExternalDropIndex: (e) => {
157
- H.value = e;
158
- },
159
- acceptExternal: (e, t) => {
160
- m && m(e, t);
161
- }
162
- };
163
- return W.getExternalDropIndex = () => H.value, c.add(W), t(() => {
164
- c.delete(W), B();
165
- }), {
166
- registerItem: V,
167
- container: U,
168
- isDragging: e(() => v.value !== null),
169
- dragId: e(() => v.value),
170
- dragPosition: e(() => y.value),
171
- dropIndex: e(() => b.value)
172
- };
173
- }
174
- //#endregion
175
- export { u as t };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes