@svgrid/grid 2.2.31 → 2.2.33

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 (196) hide show
  1. package/README.md +1 -1
  2. package/dist/DockNodeView.svelte +1 -1
  3. package/dist/GridFooter.svelte +0 -40
  4. package/dist/GridMenus.svelte +0 -77
  5. package/dist/SvAvatar.svelte +1 -1
  6. package/dist/SvCheckBox.svelte +2 -1
  7. package/dist/SvCircularProgress.svelte +1 -1
  8. package/dist/SvDateRangeInput.svelte +1 -1
  9. package/dist/SvGrid.controller.svelte.d.ts +20 -0
  10. package/dist/SvGrid.controller.svelte.js +358 -18
  11. package/dist/SvGrid.css +103 -3
  12. package/dist/SvGrid.svelte +164 -35
  13. package/dist/SvGrid.types.d.ts +81 -0
  14. package/dist/SvGridChart.svelte +2 -10
  15. package/dist/SvGridDropdown.svelte +38 -6
  16. package/dist/SvGridDropdown.svelte.d.ts +4 -0
  17. package/dist/SvGridSelect.svelte +12 -5
  18. package/dist/SvGridSelect.svelte.d.ts +6 -0
  19. package/dist/SvGroupCell.svelte +9 -2
  20. package/dist/SvKbd.svelte +1 -1
  21. package/dist/SvList.svelte +1 -1
  22. package/dist/SvMenubar.svelte +1 -1
  23. package/dist/SvMultiSelect.svelte +12 -4
  24. package/dist/SvMultiSelect.svelte.d.ts +6 -0
  25. package/dist/SvOtpInput.svelte +1 -1
  26. package/dist/SvPasswordInput.svelte +1 -1
  27. package/dist/SvProgress.svelte +1 -1
  28. package/dist/SvRating.svelte +1 -1
  29. package/dist/SvResult.svelte +1 -1
  30. package/dist/SvRichText.svelte +35 -16
  31. package/dist/SvRichText.svelte.d.ts +9 -0
  32. package/dist/SvSwitchButton.svelte +2 -1
  33. package/dist/SvToaster.svelte +1 -1
  34. package/dist/SvTour.svelte +4 -0
  35. package/dist/SvTree.svelte +9 -2
  36. package/dist/SvTree.svelte.d.ts +5 -0
  37. package/dist/SvTreeSelect.svelte +6 -4
  38. package/dist/build-api.js +16 -0
  39. package/dist/cdn/{GridMenus-Ds3OpzZT.js → GridMenus-B7XhhqdN.js} +34 -36
  40. package/dist/cdn/{GridMenus-Da_p7SKS.js → GridMenus-BxmIvCJh.js} +35 -37
  41. package/dist/cdn/{SvDateTimePicker-DB0aIEk8.js → SvDateTimePicker-ClqtVIj3.js} +2 -1
  42. package/dist/cdn/{SvDateTimePicker-B8GopjhC.js → SvDateTimePicker-o94wfSUa.js} +3 -2
  43. package/dist/cdn/{SvGridChart-BcLCYvw9.js → SvGridChart-Cr_90pPD.js} +1 -1
  44. package/dist/cdn/{SvGridChartPanel-DvjwxLvK.js → SvGridChartPanel-ICbxiUvK.js} +4 -4
  45. package/dist/cdn/{SvGridChartView-PwqI4s02.js → SvGridChartView-Bx42PMvf.js} +2 -2
  46. package/dist/cdn/{SvGridDropdown-hpnHvOGt.js → SvGridDropdown-CUOdm7YA.js} +93 -88
  47. package/dist/cdn/{SvGridDropdown-DjALc_4f.js → SvGridDropdown-D0VdjeR8.js} +129 -123
  48. package/dist/cdn/{disclose-version-DoD9AFD_.js → disclose-version-DljhZohK.js} +45 -45
  49. package/dist/cdn/{src-DYDCiC0D.js → src-erjBRYfX.js} +5952 -5615
  50. package/dist/cdn/{src-BLJfdyL0.js → src-ktbQVOk-.js} +4190 -3851
  51. package/dist/cdn/svgrid.js +9 -9
  52. package/dist/cdn/svgrid.svelte-external.js +8 -8
  53. package/dist/cell-render.d.ts +1 -0
  54. package/dist/cell-render.js +115 -1
  55. package/dist/cell-values.js +5 -0
  56. package/dist/chart.d.ts +2 -0
  57. package/dist/chart.js +1 -4
  58. package/dist/core.d.ts +80 -9
  59. package/dist/core.js +89 -0
  60. package/dist/createMenu.svelte.js +0 -1
  61. package/dist/createPopoverSelect.svelte.d.ts +2 -2
  62. package/dist/editing.js +1 -1
  63. package/dist/editor-contract.d.ts +12 -5
  64. package/dist/editor-registry.d.ts +18 -7
  65. package/dist/editor-registry.js +10 -1
  66. package/dist/export-format.js +3 -0
  67. package/dist/group-display.d.ts +39 -0
  68. package/dist/group-display.js +52 -0
  69. package/dist/index.d.ts +2 -2
  70. package/dist/index.js +2 -2
  71. package/dist/keyboard-handlers.js +16 -0
  72. package/dist/recurrence.js +3 -2
  73. package/dist/selection.js +0 -1
  74. package/dist/svgrid-wrapper.types.d.ts +8 -2
  75. package/dist/themes/index.d.ts +10 -0
  76. package/dist/themes/index.js +26 -0
  77. package/package.json +3 -2
  78. package/src/DockNodeView.svelte +1 -1
  79. package/src/GridFooter.svelte +0 -40
  80. package/src/GridMenus.svelte +0 -77
  81. package/src/SvAccordion.test.ts +5 -5
  82. package/src/SvAvatar.svelte +1 -1
  83. package/src/SvButtonGroup.test.ts +6 -6
  84. package/src/SvCalendar.test.ts +1 -1
  85. package/src/SvCheckBox.svelte +2 -1
  86. package/src/SvCircularProgress.svelte +1 -1
  87. package/src/SvDateRangeInput.svelte +1 -1
  88. package/src/SvFileUpload.test.ts +1 -1
  89. package/src/SvGrid.controller.svelte.ts +367 -22
  90. package/src/SvGrid.css +103 -3
  91. package/src/SvGrid.svelte +164 -35
  92. package/src/SvGrid.types.ts +81 -1
  93. package/src/SvGridChart.svelte +2 -10
  94. package/src/SvGridDropdown.svelte +38 -6
  95. package/src/SvGridSelect.svelte +12 -5
  96. package/src/SvGroupCell.svelte +9 -2
  97. package/src/SvKbd.svelte +1 -1
  98. package/src/SvList.svelte +1 -1
  99. package/src/SvMenubar.svelte +1 -1
  100. package/src/SvMultiSelect.svelte +12 -4
  101. package/src/SvOtpInput.svelte +1 -1
  102. package/src/SvPasswordInput.svelte +1 -1
  103. package/src/SvProgress.svelte +1 -1
  104. package/src/SvRating.svelte +1 -1
  105. package/src/SvResult.svelte +1 -1
  106. package/src/SvRichText.svelte +35 -16
  107. package/src/SvSwitchButton.svelte +2 -1
  108. package/src/SvToaster.svelte +1 -1
  109. package/src/SvTour.svelte +4 -0
  110. package/src/SvTree.svelte +9 -2
  111. package/src/SvTreeSelect.svelte +6 -4
  112. package/src/ai.test.ts +1 -1
  113. package/src/build-api.ts +15 -105
  114. package/src/builtin-editors.test.ts +3 -1
  115. package/src/cell-formatting.test.ts +1 -1
  116. package/src/cell-render.test.ts +27 -3
  117. package/src/cell-render.ts +122 -95
  118. package/src/cell-values.ts +4 -0
  119. package/src/chart-export.test.ts +2 -2
  120. package/src/chart.ts +1 -2
  121. package/src/clipboard.test.ts +0 -2
  122. package/src/clipboard.ts +0 -102
  123. package/src/columns.ts +0 -115
  124. package/src/core.ts +157 -8
  125. package/src/createMenu.svelte.ts +0 -1
  126. package/src/editing.test.ts +1 -1
  127. package/src/editing.ts +2 -105
  128. package/src/editor-contract.ts +12 -5
  129. package/src/editor-registry.grid.test.ts +48 -2
  130. package/src/editor-registry.test.ts +3 -1
  131. package/src/editor-registry.ts +23 -7
  132. package/src/export-format.ts +3 -0
  133. package/src/facet-buckets.test.ts +33 -33
  134. package/src/features.ts +0 -90
  135. package/src/group-display.test.ts +91 -1
  136. package/src/group-display.ts +83 -0
  137. package/src/index.ts +9 -0
  138. package/src/keyboard-handlers.coverage.test.ts +1 -1
  139. package/src/keyboard-handlers.ts +17 -120
  140. package/src/list-power.test.ts +2 -2
  141. package/src/menus.test.ts +4 -5
  142. package/src/menus.ts +0 -112
  143. package/src/named-views.coverage.test.ts +3 -3
  144. package/src/new-features.test.ts +3 -1
  145. package/src/recurrence.ts +3 -2
  146. package/src/row-drag.test.ts +1 -1
  147. package/src/row-resize.test.ts +41 -42
  148. package/src/scheduler-model.ts +1 -1
  149. package/src/scroll-sync.test.ts +4 -7
  150. package/src/scroll-sync.ts +0 -122
  151. package/src/selection.ts +0 -109
  152. package/src/server-data-source.coverage.test.ts +1 -1
  153. package/src/server-group-model.test.ts +8 -8
  154. package/src/spreadsheet.test.ts +0 -1
  155. package/src/summaries.ts +0 -112
  156. package/src/svgrid-wrapper.types.ts +11 -9
  157. package/src/svgrid.async-editor-options.test.ts +271 -0
  158. package/src/svgrid.auto-row-height.test.ts +204 -0
  159. package/src/svgrid.behavior.test.ts +0 -1
  160. package/src/svgrid.charting.test.ts +4 -4
  161. package/src/svgrid.column-reorder.test.ts +0 -8
  162. package/src/svgrid.comments-autocomplete.test.ts +8 -2
  163. package/src/svgrid.context-menu.test.ts +25 -9
  164. package/src/svgrid.filter-depth.test.ts +163 -0
  165. package/src/svgrid.filter-menu-listbox.svelte.test.ts +16 -2
  166. package/src/svgrid.filter-menu-scroll.test.ts +10 -2
  167. package/src/svgrid.grand-total.test.ts +188 -0
  168. package/src/svgrid.group-display-mode.test.ts +171 -0
  169. package/src/svgrid.group-footers.test.ts +121 -0
  170. package/src/svgrid.group-pagination.test.ts +153 -0
  171. package/src/svgrid.tree-data.test.ts +186 -0
  172. package/src/svgriddropdown.async-panel.svelte.test.ts +195 -0
  173. package/src/themes/index.ts +42 -0
  174. package/src/tree-edit.test.ts +4 -4
  175. package/src/tree-row-model.test.ts +168 -0
  176. package/src/ui-localization.test.ts +113 -0
  177. package/themes/ag-alpine.css +22 -0
  178. package/themes/antd.css +22 -0
  179. package/themes/atlassian.css +22 -0
  180. package/themes/bootstrap.css +22 -0
  181. package/themes/carbon.css +22 -0
  182. package/themes/catppuccin.css +22 -0
  183. package/themes/dracula.css +22 -0
  184. package/themes/ember.css +22 -0
  185. package/themes/excel.css +22 -0
  186. package/themes/fluent.css +22 -0
  187. package/themes/github.css +22 -0
  188. package/themes/linear.css +22 -0
  189. package/themes/material.css +22 -0
  190. package/themes/nord.css +22 -0
  191. package/themes/notion.css +22 -0
  192. package/themes/salesforce.css +22 -0
  193. package/themes/sap.css +22 -0
  194. package/themes/shadcn.css +22 -0
  195. package/themes/tailwind.css +22 -0
  196. package/themes/vercel.css +22 -0
@@ -3,146 +3,148 @@ import { i as t, n, r } from "./popover-P-9P2YYn.js";
3
3
  import * as i from "svelte/internal/client";
4
4
  import "svelte/internal/disclose-version";
5
5
  //#region src/SvGridDropdown.svelte
6
- var a = /* @__PURE__ */ e({ default: () => b }), o = i.from_html("<span class=\"sv-grid-chip sv-grid-chip-removable svelte-ei8hp3\"> <span class=\"sv-grid-chip-remove svelte-ei8hp3\" role=\"button\">×</span></span>"), s = i.from_html("<span class=\"sv-grid-dropdown-chips svelte-ei8hp3\"></span>"), c = i.from_html("<span class=\"sv-grid-chip svelte-ei8hp3\"> </span>"), l = i.from_html("<span class=\"sv-grid-dropdown-label svelte-ei8hp3\"> </span>"), u = i.from_html("<input type=\"search\" class=\"sv-grid-dropdown-search\" placeholder=\"Search…\"/>"), d = i.from_html("<div class=\"sv-grid-dropdown-empty\"> </div>"), f = i.from_html("<span class=\"sv-grid-dropdown-check\" aria-hidden=\"true\"> </span>"), p = i.from_html("<span class=\"sv-grid-dropdown-option-chip\"> </span>"), m = i.from_html("<span class=\"sv-grid-dropdown-option-label\"> </span>"), h = i.from_html("<div role=\"option\"><!> <!></div>"), g = i.from_html("<div class=\"sv-grid-dropdown-footer\"><button type=\"button\" class=\"sv-grid-dropdown-done\">Done</button></div>"), _ = i.from_html("<div role=\"listbox\"><!> <!> <!></div>"), v = i.from_html("<div><button type=\"button\" aria-haspopup=\"listbox\"><!> <span class=\"sv-grid-dropdown-caret svelte-ei8hp3\" aria-hidden=\"true\">▾</span></button> <!></div>"), y = {
6
+ var a = /* @__PURE__ */ e({ default: () => x }), o = i.from_html("<span class=\"sv-grid-chip sv-grid-chip-removable svelte-ei8hp3\"> <span class=\"sv-grid-chip-remove svelte-ei8hp3\" role=\"button\">×</span></span>"), s = i.from_html("<span class=\"sv-grid-dropdown-chips svelte-ei8hp3\"></span>"), c = i.from_html("<span class=\"sv-grid-chip svelte-ei8hp3\"> </span>"), l = i.from_html("<span class=\"sv-grid-dropdown-label svelte-ei8hp3\"> </span>"), u = i.from_html("<input type=\"search\" class=\"sv-grid-dropdown-search\" placeholder=\"Search…\"/>"), d = i.from_html("<div class=\"sv-grid-dropdown-empty\" role=\"status\" aria-live=\"polite\">Loading…</div>"), f = i.from_html("<div class=\"sv-grid-dropdown-empty\"> </div>"), p = i.from_html("<span class=\"sv-grid-dropdown-check\" aria-hidden=\"true\"> </span>"), m = i.from_html("<span class=\"sv-grid-dropdown-option-chip\"> </span>"), h = i.from_html("<span class=\"sv-grid-dropdown-option-label\"> </span>"), g = i.from_html("<div role=\"option\"><!> <!></div>"), _ = i.from_html("<div class=\"sv-grid-dropdown-footer\"><button type=\"button\" class=\"sv-grid-dropdown-done\">Done</button></div>"), v = i.from_html("<div role=\"listbox\"><!> <!> <!></div>"), y = i.from_html("<div><button type=\"button\" aria-haspopup=\"listbox\"><!> <span class=\"sv-grid-dropdown-caret svelte-ei8hp3\" aria-hidden=\"true\">▾</span></button> <!></div>"), b = {
7
7
  hash: "svelte-ei8hp3",
8
8
  code: "\n /* All colors derive from the grid's host CSS vars so light/dark themes\n \"just work\". Hard fallbacks are kept so the component is still\n usable in an unthemed page. */.sv-grid-dropdown.svelte-ei8hp3 {position:absolute;top:0;left:0;right:0;height:100%;background:var(--sg-bg, #ffffff);color:var(--sg-fg, #0f172a);}.sv-grid-dropdown-trigger.svelte-ei8hp3 {display:flex;align-items:center;gap:6px;width:100%;height:100%;min-height:28px;padding:0 8px;background:var(--sg-bg, #ffffff);color:var(--sg-fg, #0f172a);border:0;outline:none;font:inherit;text-align:start;cursor:pointer;box-sizing:border-box;}.sv-grid-dropdown-trigger.svelte-ei8hp3:focus {outline:2px solid var(--sg-accent, #2563eb);outline-offset:-2px;}.sv-grid-dropdown-trigger-chips.svelte-ei8hp3 {align-items:center;padding:4px 8px;flex-wrap:wrap;}.sv-grid-dropdown-chips.svelte-ei8hp3 {display:inline-flex;flex-wrap:wrap;gap:4px;flex:1 1 auto;min-width:0;align-items:center;}.sv-grid-dropdown-label.svelte-ei8hp3 {flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.sv-grid-dropdown-caret.svelte-ei8hp3 {flex:0 0 auto;font-size:10px;opacity:0.7;line-height:1;}\n\n /* Popover sits absolutely below the trigger. The parent\n `.sv-grid-cell-editing` has `overflow: visible`, so this can hang\n past the row. Pulls its surface color from the grid's header bg\n so it reads as a slightly elevated layer on either theme. */\n /* Panel is `position: fixed` AND portal'd into document.body via\n `use:portalToBody`, so it escapes every ancestor overflow / clip /\n transform / stacking context. Coords come from updatePanelPosition(). */.sv-grid-dropdown-panel {overflow-y:auto;background:var(--sg-header-bg, var(--sg-bg, #ffffff));color:var(--sg-fg, #0f172a);border:1px solid var(--sg-accent, #2563eb);border-radius:6px;box-shadow:0 12px 28px rgba(0, 0, 0, 0.45);padding:4px 0;font-family:inherit;}\n /* When the option list fits in one panel we want NO scrollbar at all -\n * not even a sub-pixel ghost track. `overflow: visible` rules out the\n * scrollbar gutter that some browsers still reserve under\n * `overflow: auto` when content equals max-height. */.sv-grid-dropdown-panel.sv-grid-dropdown-panel-fits {overflow:visible;}.sv-grid-dropdown-option {display:flex;align-items:center;gap:8px;padding:6px 10px;cursor:pointer;user-select:none;color:var(--sg-fg, #0f172a);}.sv-grid-dropdown-option-highlighted {background:var(--sg-row-hover-bg, rgba(37, 99, 235, 0.1));}.sv-grid-dropdown-option-selected {font-weight:600;background:var(--sg-selection-bg, rgba(37, 99, 235, 0.15));}.sv-grid-dropdown-option-selected.sv-grid-dropdown-option-highlighted {background:var(--sg-row-hover-bg, rgba(37, 99, 235, 0.18));}.sv-grid-dropdown-option-label {flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.sv-grid-dropdown-check {flex:0 0 16px;display:inline-flex;align-items:center;justify-content:center;color:var(--sg-accent, #2563eb);font-weight:700;}.sv-grid-dropdown-swatch {flex:0 0 12px;width:12px;height:12px;border-radius:999px;border:1px solid color-mix(in srgb, var(--sg-fg, #0f172a) 25%, transparent);}\n /* Colored option chip. Declared `:global` because the option panel is\n portal'd to <body>, where Svelte's scoped classes don't reach. The\n per-chip background / border / text color come from an inline style\n (see colorfulChipStyleInline) so each option matches its cell chip. */.sv-grid-dropdown-option-chip {display:inline-flex;align-items:center;max-width:100%;padding:2px 11px;border:1px solid transparent;border-radius:999px;font-size:0.9em;font-weight:600;line-height:1.5;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.sv-grid-dropdown-empty {padding:8px 10px;color:var(--sg-muted, rgba(15, 23, 42, 0.55));font-style:italic;font-size:0.9em;}.sv-grid-dropdown-footer {display:flex;justify-content:flex-end;padding:4px 6px;border-top:1px solid var(--sg-border, rgba(15, 23, 42, 0.08));margin-top:2px;}.sv-grid-dropdown-done {font-size:11px;text-transform:uppercase;letter-spacing:0.04em;color:#fff;background:var(--sg-accent, #2563eb);border:0;border-radius:4px;padding:4px 10px;cursor:pointer;}.sv-grid-dropdown-done:hover {filter:brightness(1.12);}\n\n /* Note: option / footer / swatch styles are declared `:global(...)`\n above because the panel is portal'd to <body> and Svelte's scoped\n class won't survive on children of an element living outside the\n component subtree. */\n\n /* Theme-aware chip badges. Inside the trigger they sit on the cell\n background, so we need a tone that contrasts on BOTH themes - a\n translucent accent works well in dark mode and reads as a soft\n blue pill in light mode. */.sv-grid-chip.svelte-ei8hp3 {display:inline-flex;align-items:center;gap:4px;padding:2px 8px;font-size:0.85em;line-height:1.4;background:color-mix(in srgb, var(--sg-accent, #2563eb) 18%, transparent);color:var(--sg-fg, #0f172a);border-radius:999px;border:1px solid color-mix(in srgb, var(--sg-accent, #2563eb) 35%, transparent);white-space:nowrap;}.sv-grid-chip-removable.svelte-ei8hp3 {padding-inline-end:2px;}.sv-grid-chip-remove.svelte-ei8hp3 {display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border:0;border-radius:999px;background:color-mix(in srgb, var(--sg-fg, #0f172a) 18%, transparent);color:inherit;font-size:12px;line-height:1;cursor:pointer;padding:0;}.sv-grid-chip-remove.svelte-ei8hp3:hover {background:rgba(220, 38, 38, 0.7);color:#fff;}"
9
9
  };
10
- function b(e, a) {
11
- let b = i.props_id();
12
- i.push(a, !0), i.append_styles(e, y);
13
- let x = i.prop(a, "multiple", 3, !1), S = i.prop(a, "placeholder", 3, "Select…"), C = i.prop(a, "renderChipsInTrigger", 3, !1), w = i.prop(a, "searchable", 3, !1), T = i.prop(a, "autoOpen", 3, !0);
14
- function E(e) {
15
- return e >= 0 && e < i.get(k).length ? `${b}-opt-${e}` : void 0;
10
+ function x(e, a) {
11
+ let x = i.props_id();
12
+ i.push(a, !0), i.append_styles(e, b);
13
+ let S = i.prop(a, "multiple", 3, !1), C = i.prop(a, "placeholder", 3, "Select…"), w = i.prop(a, "renderChipsInTrigger", 3, !1), T = i.prop(a, "searchable", 3, !1), E = i.prop(a, "autoOpen", 3, !0), D = i.prop(a, "loading", 3, !1);
14
+ function O(e) {
15
+ return e >= 0 && e < i.get(j).length ? `${x}-opt-${e}` : void 0;
16
16
  }
17
- let D = i.derived(() => a.options.some((e) => e.color) ? 40 : 32), O = i.state(""), k = i.derived(() => !w() || !i.get(O).trim() ? a.options : (() => {
18
- let e = i.get(O).trim().toLowerCase();
17
+ let k = i.derived(() => a.options.some((e) => e.color) ? 40 : 32), A = i.state(""), j = i.derived(() => !T() || !i.get(A).trim() ? a.options : (() => {
18
+ let e = i.get(A).trim().toLowerCase();
19
19
  return a.options.filter((t) => t.label.toLowerCase().includes(e));
20
- })()), A = i.state(!1), j = i.state(-1), M = i.state(null), N = i.state(null), P = i.state(null), F = i.state(i.proxy({
20
+ })()), M = i.state(!1), N = i.state(-1), P = i.state(null), F = i.state(null), I = i.state(null), L = i.state(i.proxy({
21
21
  top: 0,
22
22
  left: 0,
23
23
  width: 0,
24
24
  openUpward: !1,
25
25
  maxHeight: 0,
26
26
  availHeight: 0
27
- })), I = i.derived(() => Array.isArray(a.value) ? a.value : a.value == null || a.value === "" ? [] : [a.value]), L = i.derived(() => {
28
- if (i.get(I).length === 0) return S();
29
- if (!x()) {
30
- let e = i.get(I)[0], t = a.options.find((t) => String(t.value) === String(e));
27
+ })), R = i.derived(() => Array.isArray(a.value) ? a.value : a.value == null || a.value === "" ? [] : [a.value]), z = i.derived(() => {
28
+ if (i.get(R).length === 0) return C();
29
+ if (!S()) {
30
+ let e = i.get(R)[0], t = a.options.find((t) => String(t.value) === String(e));
31
31
  return t ? t.label : String(e);
32
32
  }
33
- return `${i.get(I).length} selected`;
34
- }), R = i.derived(() => {
35
- if (x() || i.get(I).length !== 1) return;
36
- let e = i.get(I)[0];
33
+ return `${i.get(R).length} selected`;
34
+ }), B = i.derived(() => {
35
+ if (S() || i.get(R).length !== 1) return;
36
+ let e = i.get(R)[0];
37
37
  return a.options.find((t) => String(t.value) === String(e))?.color;
38
38
  });
39
- function z(e) {
40
- return i.get(I).some((t) => String(t) === String(e.value));
39
+ function V(e) {
40
+ return i.get(R).some((t) => String(t) === String(e.value));
41
41
  }
42
- function B(e) {
43
- if (x()) {
44
- let t = z(e) ? i.get(I).filter((t) => String(t) !== String(e.value)) : [...i.get(I), e.value];
42
+ function H(e) {
43
+ if (S()) {
44
+ let t = V(e) ? i.get(R).filter((t) => String(t) !== String(e.value)) : [...i.get(R), e.value];
45
45
  a.onChange?.(t);
46
- } else a.onChange?.(e.value), i.set(A, !1), a.onCommit?.();
46
+ } else a.onChange?.(e.value), i.set(M, !1), a.onCommit?.();
47
47
  }
48
- function V() {
49
- if (!i.get(A)) {
50
- if (i.set(A, !0), i.get(j) < 0) {
51
- let e = a.options.findIndex((e) => z(e));
52
- i.set(j, e >= 0 ? e : 0, !0);
48
+ function U() {
49
+ if (!i.get(M)) {
50
+ if (i.set(M, !0), i.get(N) < 0) {
51
+ let e = a.options.findIndex((e) => V(e));
52
+ i.set(N, e >= 0 ? e : 0, !0);
53
53
  }
54
- H();
54
+ W();
55
55
  }
56
56
  }
57
- function H() {
58
- if (!i.get(N)) return;
59
- let e = Math.min(a.options.length, 10) * i.get(D) + (x() ? 40 : 0) + 8;
60
- i.set(F, n(i.get(N).getBoundingClientRect(), {
61
- estimatedHeight: e,
57
+ function W() {
58
+ if (!i.get(F)) return;
59
+ let e = Math.min(i.get(j).length, 10), t = T() ? 38 : 0, r = e * i.get(k) + (S() ? 40 : 0) + t + 8;
60
+ i.set(L, n(i.get(F).getBoundingClientRect(), {
61
+ estimatedHeight: r,
62
62
  clampHorizontal: !1
63
63
  }), !0);
64
64
  }
65
65
  i.user_effect(() => {
66
- if (!i.get(A)) return;
67
- let e = () => H();
66
+ if (!i.get(M)) return;
67
+ let e = () => W();
68
68
  return window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
69
69
  window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
70
70
  };
71
+ }), i.user_effect(() => {
72
+ i.get(M) && (i.get(j).length, i.get(k), W());
71
73
  });
72
- function U() {
73
- i.set(A, !1), i.set(j, -1);
74
+ function G() {
75
+ i.set(M, !1), i.set(N, -1);
74
76
  }
75
- function W(e) {
77
+ function K(e) {
76
78
  if (e.stopPropagation(), e.key === "Escape") {
77
- e.preventDefault(), U(), a.onCancel?.();
79
+ e.preventDefault(), G(), a.onCancel?.();
78
80
  return;
79
81
  }
80
82
  if (e.key === "ArrowDown") {
81
- if (e.preventDefault(), !i.get(A)) {
82
- V();
83
+ if (e.preventDefault(), !i.get(M)) {
84
+ U();
83
85
  return;
84
86
  }
85
- i.set(j, Math.min(i.get(j) + 1, a.options.length - 1), !0), G();
87
+ i.set(N, Math.min(i.get(N) + 1, a.options.length - 1), !0), q();
86
88
  } else if (e.key === "ArrowUp") {
87
- if (e.preventDefault(), !i.get(A)) {
88
- V();
89
+ if (e.preventDefault(), !i.get(M)) {
90
+ U();
89
91
  return;
90
92
  }
91
- i.set(j, Math.max(i.get(j) - 1, 0), !0), G();
93
+ i.set(N, Math.max(i.get(N) - 1, 0), !0), q();
92
94
  } else if (e.key === "Home") {
93
- if (!i.get(A)) return;
94
- e.preventDefault(), i.set(j, 0), G();
95
+ if (!i.get(M)) return;
96
+ e.preventDefault(), i.set(N, 0), q();
95
97
  } else if (e.key === "End") {
96
- if (!i.get(A)) return;
97
- e.preventDefault(), i.set(j, a.options.length - 1), G();
98
+ if (!i.get(M)) return;
99
+ e.preventDefault(), i.set(N, a.options.length - 1), q();
98
100
  } else if (e.key === "Enter") {
99
- if (e.preventDefault(), !i.get(A)) {
100
- V();
101
+ if (e.preventDefault(), !i.get(M)) {
102
+ U();
101
103
  return;
102
104
  }
103
- let t = a.options[i.get(j)];
104
- t ? B(t) : x() && (U(), a.onCommit?.());
105
- } else if (e.key === " " && i.get(A)) {
105
+ let t = a.options[i.get(N)];
106
+ t ? H(t) : S() && (G(), a.onCommit?.());
107
+ } else if (e.key === " " && i.get(M)) {
106
108
  e.preventDefault();
107
- let t = a.options[i.get(j)];
108
- t && B(t);
109
- } else e.key === "Tab" && (i.get(A) && U(), a.onCommit?.());
109
+ let t = a.options[i.get(N)];
110
+ t && H(t);
111
+ } else e.key === "Tab" && (i.get(M) && G(), a.onCommit?.());
110
112
  }
111
- function G() {
113
+ function q() {
112
114
  queueMicrotask(() => {
113
- i.get(P) && i.get(P).querySelector(`[data-opt-idx="${i.get(j)}"]`)?.scrollIntoView({ block: "nearest" });
115
+ i.get(I) && i.get(I).querySelector(`[data-opt-idx="${i.get(N)}"]`)?.scrollIntoView({ block: "nearest" });
114
116
  });
115
117
  }
116
- function K(e) {
118
+ function J(e) {
117
119
  let t = e.relatedTarget;
118
- t && i.get(M)?.contains(t) || (i.get(A) && U(), a.onCommit?.());
120
+ t && i.get(P)?.contains(t) || (i.get(M) && G(), a.onCommit?.());
119
121
  }
120
- function q(e, t) {
122
+ function ee(e, t) {
121
123
  t.preventDefault(), t.stopPropagation();
122
- let n = i.get(I).filter((t) => String(t) !== String(e));
123
- a.onChange?.(x() ? n : n[0] ?? null);
124
+ let n = i.get(R).filter((t) => String(t) !== String(e));
125
+ a.onChange?.(S() ? n : n[0] ?? null);
124
126
  }
125
- function J(e) {
126
- T() && (e.focus(), V());
127
+ function te(e) {
128
+ E() && (e.focus(), U());
127
129
  }
128
130
  i.user_effect(() => {
129
- if (!i.get(A)) return;
131
+ if (!i.get(M)) return;
130
132
  let e = (e) => {
131
133
  let t = e.target;
132
- t && (i.get(M)?.contains(t) || i.get(P)?.contains(t) || (U(), a.onCommit?.()));
134
+ t && (i.get(P)?.contains(t) || i.get(I)?.contains(t) || (G(), a.onCommit?.()));
133
135
  };
134
136
  return document.addEventListener("pointerdown", e, !0), () => document.removeEventListener("pointerdown", e, !0);
135
137
  });
136
138
  function Y(e) {
137
139
  return `background: color-mix(in srgb, ${e} 22%, transparent);border-color: color-mix(in srgb, ${e} 45%, transparent);color: color-mix(in srgb, ${e} 80%, var(--sg-fg, #0f172a));`;
138
140
  }
139
- var X = v();
141
+ var X = y();
140
142
  let Z;
141
143
  var Q = i.child(X);
142
144
  let $;
143
- var ee = i.child(Q), te = (e) => {
145
+ var ne = i.child(Q), re = (e) => {
144
146
  var t = s();
145
- i.each(t, 21, () => i.get(I), (e) => String(e), (e, t) => {
147
+ i.each(t, 21, () => i.get(R), (e) => String(e), (e, t) => {
146
148
  let n = i.derived(() => a.options.find((e) => String(e.value) === String(i.get(t))));
147
149
  var r = o(), s = i.child(r), c = i.sibling(s);
148
150
  i.set_attribute(c, "tabindex", -1), i.reset(r), i.template_effect((e, t, n) => {
@@ -151,56 +153,59 @@ function b(e, a) {
151
153
  () => i.get(n)?.color ? Y(i.get(n).color) : "",
152
154
  () => i.get(n) ? i.get(n).label : String(i.get(t)),
153
155
  () => i.get(n) ? i.get(n).label : String(i.get(t))
154
- ]), i.delegated("mousedown", c, (e) => e.preventDefault()), i.delegated("click", c, (e) => q(i.get(t), e)), i.append(e, r);
156
+ ]), i.delegated("mousedown", c, (e) => e.preventDefault()), i.delegated("click", c, (e) => ee(i.get(t), e)), i.append(e, r);
155
157
  }), i.reset(t), i.append(e, t);
156
- }, ne = (e) => {
158
+ }, ie = (e) => {
157
159
  var t = c(), n = i.child(t, !0);
158
160
  i.reset(t), i.template_effect((e) => {
159
- i.set_style(t, e), i.set_text(n, i.get(L));
160
- }, [() => Y(i.get(R))]), i.append(e, t);
161
- }, re = (e) => {
161
+ i.set_style(t, e), i.set_text(n, i.get(z));
162
+ }, [() => Y(i.get(B))]), i.append(e, t);
163
+ }, ae = (e) => {
162
164
  var t = l(), n = i.child(t, !0);
163
- i.reset(t), i.template_effect(() => i.set_text(n, i.get(L))), i.append(e, t);
165
+ i.reset(t), i.template_effect(() => i.set_text(n, i.get(z))), i.append(e, t);
164
166
  };
165
- i.if(ee, (e) => {
166
- C() && i.get(I).length > 0 ? e(te) : !x() && i.get(I).length === 1 && i.get(R) ? e(ne, 1) : e(re, -1);
167
- }), i.next(2), i.reset(Q), i.bind_this(Q, (e) => i.set(N, e), () => i.get(N)), i.action(Q, (e) => J?.(e));
168
- var ie = i.sibling(Q, 2), ae = (e) => {
169
- let n = i.derived(() => a.options.length > 10), o = i.derived(() => Math.min(i.get(n) ? 10 * i.get(D) + (x() ? 40 : 0) + 8 : Infinity, i.get(F).maxHeight));
170
- var s = _();
167
+ i.if(ne, (e) => {
168
+ w() && i.get(R).length > 0 ? e(re) : !S() && i.get(R).length === 1 && i.get(B) ? e(ie, 1) : e(ae, -1);
169
+ }), i.next(2), i.reset(Q), i.bind_this(Q, (e) => i.set(F, e), () => i.get(F)), i.action(Q, (e) => te?.(e));
170
+ var oe = i.sibling(Q, 2), se = (e) => {
171
+ let n = i.derived(() => a.options.length > 10), o = i.derived(() => Math.min(i.get(n) ? 10 * i.get(k) + (S() ? 40 : 0) + 8 : Infinity, i.get(L).availHeight));
172
+ var s = v();
171
173
  let c, l;
172
- var v = i.child(s), y = (e) => {
174
+ var y = i.child(s), b = (e) => {
173
175
  var t = u();
174
176
  i.remove_input_defaults(t), i.delegated("mousedown", t, (e) => e.stopPropagation()), i.delegated("click", t, (e) => e.stopPropagation()), i.delegated("keydown", t, (e) => {
175
- e.key === "Escape" && (e.preventDefault(), i.set(A, !1), a.onCancel?.());
176
- }), i.bind_value(t, () => i.get(O), (e) => i.set(O, e)), i.append(e, t);
177
+ e.key === "Escape" && (e.preventDefault(), i.set(M, !1), a.onCancel?.());
178
+ }), i.bind_value(t, () => i.get(A), (e) => i.set(A, e)), i.append(e, t);
177
179
  };
178
- i.if(v, (e) => {
179
- w() && e(y);
180
+ i.if(y, (e) => {
181
+ T() && e(b);
180
182
  });
181
- var b = i.sibling(v, 2), S = (e) => {
182
- var t = d(), n = i.child(t, !0);
183
- i.reset(t), i.template_effect(() => i.set_text(n, w() && i.get(O) ? `No matches for "${i.get(O)}"` : "No options")), i.append(e, t);
184
- }, C = (e) => {
183
+ var x = i.sibling(y, 2), C = (e) => {
184
+ var t = d();
185
+ i.append(e, t);
186
+ }, w = (e) => {
187
+ var t = f(), n = i.child(t, !0);
188
+ i.reset(t), i.template_effect(() => i.set_text(n, T() && i.get(A) ? `No matches for "${i.get(A)}"` : "No options")), i.append(e, t);
189
+ }, E = (e) => {
185
190
  var t = i.comment(), n = i.first_child(t);
186
- i.each(n, 19, () => i.get(k), (e) => String(e.value), (e, t, n) => {
187
- let r = i.derived(() => z(i.get(t)));
188
- var a = h();
191
+ i.each(n, 19, () => i.get(j), (e) => String(e.value), (e, t, n) => {
192
+ let r = i.derived(() => V(i.get(t)));
193
+ var a = g();
189
194
  let o;
190
195
  var s = i.child(a), c = (e) => {
191
- var t = f(), n = i.child(t, !0);
196
+ var t = p(), n = i.child(t, !0);
192
197
  i.reset(t), i.template_effect(() => i.set_text(n, i.get(r) ? "✓" : "")), i.append(e, t);
193
198
  };
194
199
  i.if(s, (e) => {
195
- x() && e(c);
200
+ S() && e(c);
196
201
  });
197
202
  var l = i.sibling(s, 2), u = (e) => {
198
- var n = p(), r = i.child(n, !0);
203
+ var n = m(), r = i.child(n, !0);
199
204
  i.reset(n), i.template_effect((e) => {
200
205
  i.set_style(n, e), i.set_text(r, i.get(t).label);
201
206
  }, [() => Y(i.get(t).color)]), i.append(e, n);
202
207
  }, d = (e) => {
203
- var n = m(), r = i.child(n, !0);
208
+ var n = h(), r = i.child(n, !0);
204
209
  i.reset(n), i.template_effect(() => i.set_text(r, i.get(t).label)), i.append(e, n);
205
210
  };
206
211
  i.if(l, (e) => {
@@ -208,40 +213,41 @@ function b(e, a) {
208
213
  }), i.reset(a), i.template_effect((e) => {
209
214
  o = i.set_class(a, 1, "sv-grid-dropdown-option", null, o, {
210
215
  "sv-grid-dropdown-option-selected": i.get(r),
211
- "sv-grid-dropdown-option-highlighted": i.get(n) === i.get(j)
216
+ "sv-grid-dropdown-option-highlighted": i.get(n) === i.get(N)
212
217
  }), i.set_attribute(a, "id", e), i.set_attribute(a, "aria-selected", i.get(r)), i.set_attribute(a, "data-opt-idx", i.get(n));
213
- }, [() => E(i.get(n))]), i.delegated("mousedown", a, (e) => {
214
- e.preventDefault(), B(i.get(t));
215
- }), i.event("mouseenter", a, () => i.set(j, i.get(n), !0)), i.append(e, a);
218
+ }, [() => O(i.get(n))]), i.delegated("mousedown", a, (e) => {
219
+ e.preventDefault(), H(i.get(t));
220
+ }), i.event("mouseenter", a, () => i.set(N, i.get(n), !0)), i.append(e, a);
216
221
  }), i.append(e, t);
217
222
  };
218
- i.if(b, (e) => {
219
- i.get(k).length === 0 ? e(S) : e(C, -1);
223
+ i.if(x, (e) => {
224
+ D() && i.get(j).length === 0 ? e(C) : i.get(j).length === 0 ? e(w, 1) : e(E, -1);
220
225
  });
221
- var T = i.sibling(b, 2), M = (e) => {
222
- var t = g(), n = i.child(t);
226
+ var P = i.sibling(x, 2), F = (e) => {
227
+ var t = _(), n = i.child(t);
223
228
  i.reset(t), i.delegated("mousedown", n, (e) => e.preventDefault()), i.delegated("click", n, () => {
224
- U(), a.onCommit?.();
229
+ G(), a.onCommit?.();
225
230
  }), i.append(e, t);
226
231
  };
227
- i.if(T, (e) => {
228
- x() && e(M);
229
- }), i.reset(s), i.bind_this(s, (e) => i.set(P, e), () => i.get(P)), i.action(s, (e) => t?.(e)), i.action(s, (e, t) => r?.(e, t), () => ({ up: i.get(F).openUpward })), i.template_effect(() => {
230
- c = i.set_class(s, 1, "sv-grid-dropdown-panel", null, c, { "sv-grid-dropdown-panel-fits": !i.get(n) }), i.set_attribute(s, "aria-multiselectable", x()), l = i.set_style(s, "", l, {
232
+ i.if(P, (e) => {
233
+ S() && e(F);
234
+ }), i.reset(s), i.bind_this(s, (e) => i.set(I, e), () => i.get(I)), i.action(s, (e) => t?.(e)), i.action(s, (e, t) => r?.(e, t), () => ({ up: i.get(L).openUpward })), i.template_effect(() => {
235
+ c = i.set_class(s, 1, "sv-grid-dropdown-panel", null, c, { "sv-grid-dropdown-panel-fits": !i.get(n) }), i.set_attribute(s, "aria-multiselectable", S()), l = i.set_style(s, "", l, {
231
236
  position: "fixed",
232
- top: `${i.get(F).top}px`,
233
- left: `${i.get(F).left}px`,
234
- width: `${i.get(F).width}px`,
237
+ top: i.get(L).openUpward ? null : `${i.get(L).top}px`,
238
+ bottom: i.get(L).openUpward ? `${i.get(L).bottom}px` : null,
239
+ left: `${i.get(L).left}px`,
240
+ width: `${i.get(L).width}px`,
235
241
  "max-height": i.get(o) === null ? null : `${i.get(o)}px`,
236
242
  "z-index": "2147483647"
237
243
  });
238
244
  }), i.delegated("pointerdown", s, (e) => e.stopPropagation()), i.delegated("mousedown", s, (e) => e.stopPropagation()), i.delegated("click", s, (e) => e.stopPropagation()), i.append(e, s);
239
245
  };
240
- i.if(ie, (e) => {
241
- i.get(A) && e(ae);
242
- }), i.reset(X), i.bind_this(X, (e) => i.set(M, e), () => i.get(M)), i.template_effect((e) => {
243
- Z = i.set_class(X, 1, "sv-grid-dropdown svelte-ei8hp3", null, Z, { "sv-grid-dropdown-open": i.get(A) }), $ = i.set_class(Q, 1, "sv-grid-dropdown-trigger svelte-ei8hp3", null, $, { "sv-grid-dropdown-trigger-chips": C() && i.get(I).length > 0 }), i.set_attribute(Q, "aria-expanded", i.get(A)), i.set_attribute(Q, "aria-activedescendant", e);
244
- }, [() => i.get(A) ? E(i.get(j)) : void 0]), i.delegated("focusout", X, K), i.delegated("click", X, (e) => e.stopPropagation()), i.delegated("dblclick", X, (e) => e.stopPropagation()), i.delegated("pointerdown", X, (e) => e.stopPropagation()), i.delegated("mousedown", X, (e) => e.stopPropagation()), i.delegated("click", Q, () => i.get(A) ? U() : V()), i.delegated("keydown", Q, W), i.append(e, X), i.pop();
246
+ i.if(oe, (e) => {
247
+ i.get(M) && e(se);
248
+ }), i.reset(X), i.bind_this(X, (e) => i.set(P, e), () => i.get(P)), i.template_effect((e) => {
249
+ Z = i.set_class(X, 1, "sv-grid-dropdown svelte-ei8hp3", null, Z, { "sv-grid-dropdown-open": i.get(M) }), $ = i.set_class(Q, 1, "sv-grid-dropdown-trigger svelte-ei8hp3", null, $, { "sv-grid-dropdown-trigger-chips": w() && i.get(R).length > 0 }), i.set_attribute(Q, "aria-expanded", i.get(M)), i.set_attribute(Q, "aria-activedescendant", e);
250
+ }, [() => i.get(M) ? O(i.get(N)) : void 0]), i.delegated("focusout", X, J), i.delegated("click", X, (e) => e.stopPropagation()), i.delegated("dblclick", X, (e) => e.stopPropagation()), i.delegated("pointerdown", X, (e) => e.stopPropagation()), i.delegated("mousedown", X, (e) => e.stopPropagation()), i.delegated("click", Q, () => i.get(M) ? G() : U()), i.delegated("keydown", Q, K), i.append(e, X), i.pop();
245
251
  }
246
252
  i.delegate([
247
253
  "focusout",
@@ -252,4 +258,4 @@ i.delegate([
252
258
  "keydown"
253
259
  ]);
254
260
  //#endregion
255
- export { a as n, b as t };
261
+ export { a as n, x as t };