@mkbabb/glass-ui 8.0.0 → 9.0.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 (142) hide show
  1. package/dist/aurora.js +371 -349
  2. package/dist/blob.js +42 -42
  3. package/dist/{checkbox-BnXuGgJ3.js → checkbox-B1qn65se.js} +1 -1
  4. package/dist/checkbox.js +1 -1
  5. package/dist/color.glsl-DTJhdekG.js +34 -0
  6. package/dist/color.wgsl-BTszLY39.js +398 -0
  7. package/dist/{command-BuBnYpxF.js → command-tEzAaVY_.js} +1 -1
  8. package/dist/command.js +1 -1
  9. package/dist/components/_shared/control.d.ts +0 -1
  10. package/dist/components/_shared/index.d.ts +0 -1
  11. package/dist/components/aurora/Aurora.vue.d.ts +1 -0
  12. package/dist/components/aurora/composables/frameLoop.d.ts +6 -5
  13. package/dist/components/aurora/composables/runtime.d.ts +26 -1
  14. package/dist/components/aurora/composables/useAurora.d.ts +28 -0
  15. package/dist/components/aurora/composables/wgpuSetup.d.ts +1 -1
  16. package/dist/components/aurora/constants/presets.d.ts +44 -5
  17. package/dist/components/aurora/index.d.ts +1 -1
  18. package/dist/components/configurator/Configurator.vue.d.ts +25 -2
  19. package/dist/components/configurator/ConfiguratorRow.vue.d.ts +4 -2
  20. package/dist/components/configurator/styles.css +1 -1
  21. package/dist/components/dock/DockSeparator.vue.d.ts +2 -3
  22. package/dist/components/dock/GlassDock.vue.d.ts +1 -0
  23. package/dist/components/dock/composables/dockContext.d.ts +1 -8
  24. package/dist/components/dock/composables/useDockRun.d.ts +20 -0
  25. package/dist/components/dock/composables/useDockSearch.d.ts +1 -1
  26. package/dist/components/dock/composables/useDockShellProps.d.ts +18 -101
  27. package/dist/components/dock/composables/useDockState.d.ts +2 -9
  28. package/dist/components/dock/constants.d.ts +15 -0
  29. package/dist/components/dock/index.d.ts +2 -2
  30. package/dist/components/dock/styles/controls/icon-button.css +1 -1
  31. package/dist/components/dock/styles/controls/tab-button.css +1 -1
  32. package/dist/components/dock/styles/controls/triggers.css +1 -1
  33. package/dist/components/dock/styles/controls.css +1 -1
  34. package/dist/components/dock/styles/density.css +1 -1
  35. package/dist/components/dock/styles/index.css +1 -1
  36. package/dist/components/dock/styles/layer-group.css +1 -1
  37. package/dist/components/dock/styles/layers.css +1 -1
  38. package/dist/components/dock/styles/morph.css +1 -1
  39. package/dist/components/dock/styles/run.css +1 -0
  40. package/dist/components/dock/styles/search.css +1 -1
  41. package/dist/components/dock/styles/shape.css +1 -1
  42. package/dist/components/dock/styles/shell-regions.css +1 -1
  43. package/dist/components/dock/styles/shell.css +1 -1
  44. package/dist/components/fourier-field/FourierField.vue.d.ts +28 -25
  45. package/dist/components/fourier-field/clock.d.ts +35 -0
  46. package/dist/components/fourier-field/constants.d.ts +78 -103
  47. package/dist/components/fourier-field/index.d.ts +3 -28
  48. package/dist/components/fourier-field/math.d.ts +69 -77
  49. package/dist/components/fourier-field/renderer/mint.d.ts +50 -0
  50. package/dist/components/fourier-field/renderer/uniforms.d.ts +84 -0
  51. package/dist/components/fourier-field/renderer/wgpu.d.ts +28 -0
  52. package/dist/components/fourier-field/shaders/compute.wgsl.d.ts +1 -0
  53. package/dist/components/fourier-field/shaders/render.wgsl.d.ts +1 -0
  54. package/dist/components/fourier-field/useFourierField.d.ts +49 -0
  55. package/dist/components/handmark/HandMark.vue.d.ts +18 -14
  56. package/dist/components/handmark/index.d.ts +4 -23
  57. package/dist/components/handmark/stroke.d.ts +92 -0
  58. package/dist/composables/dark/darkModeSyncScript.d.ts +19 -0
  59. package/dist/composables/motion/pointer/pointerFieldMappings.d.ts +0 -41
  60. package/dist/{components/search/composables → composables/search}/index.d.ts +2 -2
  61. package/dist/{components/search/composables/fuzzySearchIndex.d.ts → composables/search/match.d.ts} +8 -3
  62. package/dist/configurator-BHJymdrF.js +339 -0
  63. package/dist/configurator.js +1 -1
  64. package/dist/constellation.js +2 -2
  65. package/dist/control-DJp15L4U.js +7 -0
  66. package/dist/{dark-z_P5QwqI.js → dark-CLlmo7dD.js} +2 -2
  67. package/dist/dark-mode-toggle.js +1 -1
  68. package/dist/dark.js +1 -1
  69. package/dist/dock.js +712 -486
  70. package/dist/dom.js +90 -8
  71. package/dist/easing.js +3 -3
  72. package/dist/expandable-container-BY1hQXi4.js +142 -0
  73. package/dist/expandable-container.js +2 -142
  74. package/dist/fourier-field.js +643 -855
  75. package/dist/fourier-math.js +6 -6
  76. package/dist/glass-ui.css +1 -1
  77. package/dist/glass-ui.js +85 -72
  78. package/dist/handmark.js +330 -718
  79. package/dist/index.d.ts +1 -1
  80. package/dist/labeled-field.js +2 -2
  81. package/dist/{menu-wLu1XGKn.js → menu-TDMNtZjG.js} +1 -1
  82. package/dist/menu.js +1 -1
  83. package/dist/motion-core.js +34 -34
  84. package/dist/{participation-B0hdsIRo.js → participation-Di4UHbzk.js} +8 -8
  85. package/dist/{pointerFieldMappings-DP5tla5z.js → pointerFieldMappings-DXwlU5uj.js} +7 -23
  86. package/dist/{popover-DBMKTPkL.js → popover-C04Rrdcz.js} +1 -1
  87. package/dist/popover.js +1 -1
  88. package/dist/{radio-group-Ci8o-pDx.js → radio-group-BNV7PN1O.js} +1 -1
  89. package/dist/radio-group.js +1 -1
  90. package/dist/{select-CDgwGH_P.js → select-COox45Kv.js} +1 -1
  91. package/dist/select.js +1 -1
  92. package/dist/{slider-gsc8jDIo.js → slider-5ChjjWSR.js} +1 -1
  93. package/dist/slider.js +1 -1
  94. package/dist/styles/components.css +1 -1
  95. package/dist/styles/glass/material.css +1 -1
  96. package/dist/styles/glass/overlay-plate.css +1 -1
  97. package/dist/{switch-DxZzDrmV.js → switch-lLkbREB-.js} +1 -1
  98. package/dist/switch.js +1 -1
  99. package/dist/{tabs-CYscnq5H.js → tabs-DSJMd1Et.js} +1 -1
  100. package/dist/tabs.js +1 -1
  101. package/dist/{toggle-group-11aPGMfE.js → toggle-group-DUcmKnDw.js} +1 -1
  102. package/dist/toggle-group.js +1 -1
  103. package/dist/{tooltip-DqKMZ4dn.js → tooltip-BKk2qVDn.js} +1 -1
  104. package/dist/tooltip.js +1 -1
  105. package/dist/{resolveCanvasColor-6MCrswTB.js → useCanvas2D-CQRElMyE.js} +1 -11
  106. package/dist/useResolveTokenColor-B2FfJnd9.js +24 -0
  107. package/package.json +2 -20
  108. package/dist/canvas.d.ts +0 -1
  109. package/dist/canvas.js +0 -2
  110. package/dist/color.wgsl-B0N3mKMb.js +0 -412
  111. package/dist/compile-D7VYG3gi.js +0 -19
  112. package/dist/components/dock/composables/useDockOverflowFit.d.ts +0 -20
  113. package/dist/components/dock/composables/useDockTouchGate.d.ts +0 -42
  114. package/dist/components/dock/styles/overflow.css +0 -1
  115. package/dist/components/fourier-field/composables/fourierFieldGLSetup.d.ts +0 -24
  116. package/dist/components/fourier-field/composables/fourierFieldWGPUSetup.d.ts +0 -31
  117. package/dist/components/fourier-field/composables/uniformBridgeWGPU.d.ts +0 -39
  118. package/dist/components/fourier-field/composables/useFourierField.d.ts +0 -56
  119. package/dist/components/fourier-field/shaders/fourier-field.compute.wgsl.d.ts +0 -1
  120. package/dist/components/fourier-field/shaders/fourier-field.glsl.d.ts +0 -4
  121. package/dist/components/fourier-field/shaders/fourier-field.render.wgsl.d.ts +0 -1
  122. package/dist/components/fourier-field/shaders/fourier-field.ribbon.d.ts +0 -51
  123. package/dist/components/handmark/brush.d.ts +0 -269
  124. package/dist/components/handmark/composables/useHandMark.d.ts +0 -99
  125. package/dist/components/handmark/constants.d.ts +0 -69
  126. package/dist/components/handmark/freehand.d.ts +0 -69
  127. package/dist/components/handmark/geometry.d.ts +0 -62
  128. package/dist/components/handmark/ink.d.ts +0 -11
  129. package/dist/components/handmark/noise.d.ts +0 -30
  130. package/dist/components/handmark/texture.d.ts +0 -39
  131. package/dist/components/handmark/types.d.ts +0 -70
  132. package/dist/components/search/SearchBar.vue.d.ts +0 -38
  133. package/dist/components/search/index.d.ts +0 -8
  134. package/dist/components/search/searchVariants.d.ts +0 -16
  135. package/dist/configurator-BoeScnDL.js +0 -311
  136. package/dist/control-Da4XeT43.js +0 -11
  137. package/dist/search.d.ts +0 -1
  138. package/dist/search.js +0 -61
  139. package/dist/useFuzzySearch-CUnZknpm.js +0 -177
  140. package/dist/useResolveTokenColor-CspQv_ik.js +0 -107
  141. /package/dist/{components/search/composables → composables/search}/types.d.ts +0 -0
  142. /package/dist/{components/search/composables → composables/search}/useFuzzySearch.d.ts +0 -0
@@ -1,311 +0,0 @@
1
- import { t as e } from "./class-names-q-UGOkHH.js";
2
- import { t } from "./createContext-BhkE9mLH.js";
3
- import { t as n } from "./_plugin-vue_export-helper-B3ysoDQm.js";
4
- import { t as r } from "./label-BQEZhnK_.js";
5
- import { t as i } from "./fading-scroll-CTeW3KNS.js";
6
- import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, createVNode as f, defineComponent as p, mergeModels as m, normalizeClass as h, normalizeStyle as g, openBlock as _, reactive as v, ref as y, renderList as b, renderSlot as x, toDisplayString as S, toRaw as C, unref as w, useId as T, useModel as E, withCtx as D, withModifiers as ee } from "vue";
7
- import { ChevronDown as O, RotateCcw as k } from "@lucide/vue";
8
- //#region src/components/configurator/size.ts
9
- var A = t("configuratorSize"), j = A.KEY;
10
- function M(e) {
11
- A.provide(e);
12
- }
13
- var N = A.use, P = ["data-aside-side", "data-gallery"], F = {
14
- key: 0,
15
- "data-gallery-dock": "",
16
- class: "configurator-presets shrink-0 px-3 py-2"
17
- }, I = [
18
- "data-active",
19
- "aria-pressed",
20
- "onClick"
21
- ], L = { class: "configurator-stage relative min-h-0 min-w-0 overflow-hidden" }, R = { class: "flex flex-col" }, z = {
22
- key: 1,
23
- class: "configurator-controls flex-1 min-h-0 overflow-visible"
24
- }, B = { class: "flex flex-col" }, V = {
25
- key: 2,
26
- class: "configurator-footer shrink-0 border-t px-3 py-2"
27
- }, H = /* @__PURE__ */ p({
28
- __name: "Configurator",
29
- props: {
30
- presets: {},
31
- activePreset: {},
32
- layers: {},
33
- activeLayer: {},
34
- scrollMode: { default: "auto" },
35
- size: { default: "md" },
36
- asideSide: { default: "right" },
37
- galleryPlacement: { default: "aside" },
38
- asideWidth: {},
39
- class: { type: [
40
- Boolean,
41
- null,
42
- String,
43
- Object,
44
- Array
45
- ] }
46
- },
47
- emits: [
48
- "select-preset",
49
- "select-layer",
50
- "reset"
51
- ],
52
- setup(t, { emit: n }) {
53
- let r = t;
54
- M(o(() => r.size));
55
- let d = n, p = o(() => e("configurator glass-floating rounded-panel border border-border/60 overflow-hidden", "grid grid-cols-1", "grid-rows-[auto_minmax(var(--configurator-stage-min,18rem),auto)_minmax(0,1fr)]", "min-h-0", r.class)), m = o(() => {
56
- let e = {
57
- "--radius-ctx": "var(--radius-panel)",
58
- "--radius-inset": "var(--configurator-pad-inline)"
59
- };
60
- if (r.asideWidth != null) {
61
- let [t, n] = Array.isArray(r.asideWidth) ? r.asideWidth : [r.asideWidth, r.asideWidth];
62
- e["--configurator-aside-min"] = t, e["--configurator-aside-max"] = n;
63
- }
64
- return e;
65
- }), v = o(() => r.asideSide === "left" ? "lg:border-r lg:border-l-0" : "lg:border-l"), y = o(() => r.scrollMode !== "never");
66
- return (n, r) => (_(), l("section", {
67
- "data-slot": "configurator",
68
- "data-aside-side": t.asideSide,
69
- "data-gallery": t.galleryPlacement,
70
- class: h(p.value),
71
- style: g(m.value)
72
- }, [
73
- n.$slots.presets || t.presets && t.presets.length > 0 ? (_(), l("div", F, [x(n.$slots, "presets", {
74
- presets: t.presets,
75
- activePreset: t.activePreset
76
- }, () => [f(w(i), {
77
- axis: "x",
78
- class: "configurator-gallery-track flex gap-2 scrollbar-hidden",
79
- role: "group",
80
- "aria-label": "Presets"
81
- }, {
82
- default: D(() => [(_(!0), l(a, null, b(t.presets, (n) => (_(), l("button", {
83
- key: n.key,
84
- type: "button",
85
- "data-preset-tile": "",
86
- "data-active": n.key === t.activePreset || void 0,
87
- "aria-pressed": n.key === t.activePreset,
88
- class: h(w(e)("configurator-preset-chip glass-capsule glass-capsule-hover shadow-cartoon focus-ring shrink-0 px-3 py-1 text-micro font-medium text-foreground", n.key === t.activePreset && "is-active")),
89
- onClick: ee((e) => d("select-preset", n.key), ["stop"])
90
- }, S(n.label), 11, I))), 128))]),
91
- _: 1
92
- })])])) : c("", !0),
93
- u("div", L, [x(n.$slots, "stage")]),
94
- u("aside", { class: h(w(e)("configurator-aside flex min-h-0 min-w-0 flex-col border-t lg:border-t-0", v.value)) }, [y.value ? (_(), s(w(i), {
95
- key: 0,
96
- axis: "y",
97
- class: "configurator-controls flex-1 min-h-0 scrollbar-thin"
98
- }, {
99
- default: D(() => [x(n.$slots, "controls", {
100
- layers: t.layers,
101
- activeLayer: t.activeLayer,
102
- selectLayer: (e) => d("select-layer", e)
103
- }, () => [u("div", R, [x(n.$slots, "default")])])]),
104
- _: 3
105
- })) : (_(), l("div", z, [x(n.$slots, "controls", {
106
- layers: t.layers,
107
- activeLayer: t.activeLayer,
108
- selectLayer: (e) => d("select-layer", e)
109
- }, () => [u("div", B, [x(n.$slots, "default")])])])), n.$slots.footer ? (_(), l("div", V, [x(n.$slots, "footer", { reset: () => d("reset") })])) : c("", !0)], 2)
110
- ], 14, P));
111
- }
112
- }), U = ["data-state"], te = [
113
- "aria-expanded",
114
- "aria-controls",
115
- "data-state"
116
- ], W = { class: "flex min-w-0 items-baseline gap-2" }, G = { class: "configurator-section-label truncate" }, K = {
117
- key: 0,
118
- class: "truncate text-micro font-mono text-muted-foreground/70"
119
- }, q = [
120
- "id",
121
- "aria-hidden",
122
- "inert",
123
- "data-state"
124
- ], J = { class: "min-h-0 overflow-hidden" }, Y = ["data-dividers"], X = /*#__PURE__*/ n(/* @__PURE__ */ p({
125
- __name: "ConfiguratorLayer",
126
- props: /*@__PURE__*/ m({
127
- label: {},
128
- sub: {},
129
- id: {},
130
- defaultOpen: {
131
- type: Boolean,
132
- default: !0
133
- },
134
- dividers: { type: Boolean },
135
- class: { type: [
136
- Boolean,
137
- null,
138
- String,
139
- Object,
140
- Array
141
- ] },
142
- bodyClass: { type: [
143
- Boolean,
144
- null,
145
- String,
146
- Object,
147
- Array
148
- ] }
149
- }, {
150
- open: {
151
- type: Boolean,
152
- default: void 0
153
- },
154
- openModifiers: {}
155
- }),
156
- emits: ["update:open"],
157
- setup(t) {
158
- let n = t, r = E(t, "open");
159
- r.value === void 0 && (r.value = n.defaultOpen);
160
- let i = `configurator-layer-body-${T()}`, a = o(() => n.id ?? i);
161
- function s() {
162
- r.value = !r.value;
163
- }
164
- let d = o(() => r.value ? "open" : "closed");
165
- return (i, o) => (_(), l("div", {
166
- "data-slot": "configurator-layer",
167
- class: h(w(e)("configurator-layer border", n.class)),
168
- "data-state": d.value
169
- }, [u("button", {
170
- type: "button",
171
- "data-slot": "configurator-layer-trigger",
172
- class: h(w(e)("configurator-layer-trigger", "group flex w-full items-center justify-between gap-2 py-2", "tap-squish transition-control text-left hover:bg-foreground/5 focus-ring")),
173
- "aria-expanded": r.value,
174
- "aria-controls": a.value,
175
- "data-state": d.value,
176
- onClick: s
177
- }, [u("div", W, [u("span", G, S(t.label), 1), t.sub ? (_(), l("span", K, S(t.sub), 1)) : c("", !0)]), f(w(O), {
178
- class: "h-4 w-4 shrink-0 text-muted-foreground group-data-[state=open]:rotate-180 transition-disclosure",
179
- "aria-hidden": "true"
180
- })], 10, te), u("div", {
181
- id: a.value,
182
- role: "region",
183
- "aria-hidden": !r.value,
184
- inert: !r.value || void 0,
185
- "data-state": d.value,
186
- class: "configurator-layer-region grid motion-reduce:transition-none",
187
- style: g({ gridTemplateRows: r.value ? "1fr" : "0fr" })
188
- }, [u("div", J, [u("div", {
189
- "data-dividers": n.dividers || void 0,
190
- class: h(w(e)("configurator-layer-body py-2 space-y-2", n.dividers && "[&>*+*]:border-t [&>*+*]:pt-2", n.bodyClass))
191
- }, [x(i.$slots, "default", {}, void 0, !0)], 10, Y)])], 12, q)], 10, U));
192
- }
193
- }), [["__scopeId", "data-v-22ad90dd"]]), Z = ["data-size"], Q = { class: "flex items-baseline justify-between gap-3" }, ne = { class: "flex min-w-0 items-baseline gap-2" }, re = {
194
- key: 0,
195
- class: "truncate text-small font-normal text-muted-foreground"
196
- }, ie = {
197
- key: 1,
198
- class: "truncate text-micro font-mono text-muted-foreground/70"
199
- }, ae = ["aria-label"], oe = { class: "flex w-full min-w-0 items-center [&>*]:min-w-0 [&>*]:w-full [&>*]:flex-1" }, $ = {
200
- key: 0,
201
- class: "text-micro leading-snug text-muted-foreground/80"
202
- }, se = /*#__PURE__*/ n(/* @__PURE__ */ p({
203
- __name: "ConfiguratorRow",
204
- props: {
205
- label: {},
206
- sub: {},
207
- name: {},
208
- description: {},
209
- canReset: { type: Boolean },
210
- size: {},
211
- class: { type: [
212
- Boolean,
213
- null,
214
- String,
215
- Object,
216
- Array
217
- ] }
218
- },
219
- emits: ["reset"],
220
- setup(t, { emit: n }) {
221
- let i = t, a = n, s = N(), p = o(() => i.size ?? s?.value ?? void 0);
222
- return (n, o) => (_(), l("div", {
223
- "data-slot": "configurator-row",
224
- class: h(w(e)("configurator-row flex flex-col gap-1.5 py-2", i.class)),
225
- "data-size": p.value
226
- }, [
227
- u("div", Q, [u("div", ne, [
228
- f(w(r), { class: "truncate text-small font-medium text-foreground" }, {
229
- default: D(() => [d(S(t.label), 1)]),
230
- _: 1
231
- }),
232
- t.sub ? (_(), l("span", re, S(t.sub), 1)) : c("", !0),
233
- t.name ? (_(), l("span", ie, S(t.name), 1)) : c("", !0)
234
- ]), t.canReset ? (_(), l("button", {
235
- key: 0,
236
- type: "button",
237
- "data-slot": "configurator-reset",
238
- class: "tap-squish transition-control focus-ring inline-flex h-6 w-6 items-center justify-center rounded-pill text-muted-foreground/60 hover:bg-foreground/5 hover:text-foreground",
239
- "aria-label": `Reset ${t.label}`,
240
- onClick: o[0] ||= (e) => a("reset")
241
- }, [f(w(k), {
242
- class: "h-3 w-3",
243
- "aria-hidden": "true"
244
- })], 8, ae)) : c("", !0)]),
245
- u("div", oe, [x(n.$slots, "default", {}, void 0, !0)]),
246
- t.description ? (_(), l("p", $, S(t.description), 1)) : c("", !0)
247
- ], 10, Z));
248
- }
249
- }), [["__scopeId", "data-v-7044aa73"]]);
250
- //#endregion
251
- //#region src/components/configurator/useConfiguratorState.ts
252
- function ce(e) {
253
- let t = C(e);
254
- if (typeof structuredClone != "function") throw Error("[glass-ui:configurator] structuredClone is unavailable in this runtime. Pass a custom clone via ConfiguratorStateOptions.clone for environments without structured-clone support.");
255
- try {
256
- return structuredClone(t);
257
- } catch (e) {
258
- throw Error("[glass-ui:configurator] structuredClone failed: " + (e instanceof Error ? e.message : String(e)) + ". Preset values must be structured-cloneable (no functions, symbols, DOM nodes, or class instances). Pass a custom clone via ConfiguratorStateOptions.clone if the data shape requires it.");
259
- }
260
- }
261
- function le(e, t) {
262
- return JSON.stringify(e) === JSON.stringify(t);
263
- }
264
- function ue(e) {
265
- let t = e.clone ?? ce, n = e.equals ?? le, r = e.presets, i = e.cloneMode ?? "commit-on-write", a = e.initialPreset ?? (r.length > 0 ? r[0].key : void 0), s = a ? r.find((e) => e.key === a) : void 0, c = v(s ? t(s.config) : {}), l = y(a), u = i === "per-preset" ? Object.fromEntries(r.map((e) => [e.key, t(e.config)])) : null, d = o(() => l.value), f = o(() => {
266
- let e = l.value;
267
- if (!e) return !1;
268
- let t = r.find((t) => t.key === e);
269
- return t ? !n(c, t.config) : !1;
270
- });
271
- function p(e) {
272
- return r.find((t) => t.key === e);
273
- }
274
- function m(e) {
275
- let t = c, n = e;
276
- for (let e of Object.keys(t)) e in n || delete t[e];
277
- for (let e of Object.keys(n)) t[e] = n[e];
278
- }
279
- function h(e) {
280
- u && (u[e] = t(c));
281
- }
282
- function g(e) {
283
- let n = p(e);
284
- if (n) if (i === "per-preset" && u) {
285
- let t = l.value;
286
- t && t !== e && t in u && h(t), l.value = e, m(u[e]);
287
- } else l.value = e, m(t(n.config));
288
- }
289
- function _() {
290
- let e = l.value;
291
- if (!e) return;
292
- let n = p(e);
293
- n && (i === "per-preset" && u ? (u[e] = t(n.config), m(u[e])) : m(t(n.config)));
294
- }
295
- function b(e = 1) {
296
- if (r.length === 0) return;
297
- let t = l.value, n = t ? r.findIndex((e) => e.key === t) : -1, i = r.length, a = r[(n + e + i) % i];
298
- g(a.key);
299
- }
300
- return {
301
- config: c,
302
- activePreset: d,
303
- isDirty: f,
304
- selectPreset: g,
305
- resetCurrent: _,
306
- cyclePreset: b,
307
- getPreset: p
308
- };
309
- }
310
- //#endregion
311
- export { j as a, H as i, se as n, M as o, X as r, N as s, ue as t };
@@ -1,11 +0,0 @@
1
- //#region src/components/_shared/control.ts
2
- var e = {
3
- sm: "[--control-pill-h:var(--control-h-sm)] [--control-pill-text:var(--control-text-sm)]",
4
- md: "",
5
- lg: "[--control-pill-h:var(--control-h-lg)]"
6
- }, t = (t = "md") => e[t], n = (e) => ({
7
- "data-invalid": e || void 0,
8
- "aria-invalid": e || void 0
9
- });
10
- //#endregion
11
- export { n, t };
package/dist/search.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./components/search/index.js";
package/dist/search.js DELETED
@@ -1,61 +0,0 @@
1
- import { n as e, t } from "./class-names-q-UGOkHH.js";
2
- import { t as n } from "./control-Da4XeT43.js";
3
- import { a as r, i, n as a, r as o, t as s } from "./useFuzzySearch-CUnZknpm.js";
4
- import { computed as c, createBlock as l, createElementVNode as u, defineComponent as d, mergeProps as f, normalizeClass as p, openBlock as m, ref as h, renderSlot as g, resolveDynamicComponent as _, unref as v, useAttrs as y, withCtx as b } from "vue";
5
- import { Search as x } from "@lucide/vue";
6
- //#region src/components/search/searchVariants.ts
7
- var S = {
8
- inline: "",
9
- floating: "",
10
- bare: "border-none bg-transparent p-0 rounded-none"
11
- };
12
- function C(t = {}) {
13
- return e(S[t.variant ?? "inline"], t.class, t.className);
14
- }
15
- //#endregion
16
- //#region src/components/search/SearchBar.vue?vue&type=script&setup=true&lang.ts
17
- var w = ["value", "placeholder"], T = /* @__PURE__ */ d({
18
- inheritAttrs: !1,
19
- __name: "SearchBar",
20
- props: {
21
- modelValue: { default: "" },
22
- placeholder: { default: "Search…" },
23
- icon: {},
24
- tag: { default: "div" },
25
- size: { default: "md" },
26
- surface: { default: "glass" },
27
- variant: { default: "inline" }
28
- },
29
- emits: ["update:modelValue"],
30
- setup(e, { expose: r, emit: i }) {
31
- let a = i, o = y(), s = c(() => {
32
- let { class: e, ...t } = o;
33
- return t;
34
- }), d = h(null);
35
- return r({ inputRef: d }), (r, i) => (m(), l(_(e.tag), {
36
- class: p(v(t)("input-bar", v(n)(e.size), v(C)({ variant: e.variant }), r.$attrs.class)),
37
- "data-surface": e.surface
38
- }, {
39
- default: b(() => [
40
- (m(), l(_(e.icon ?? v(x)), {
41
- class: "size-(--search-icon-size) text-muted-foreground shrink-0",
42
- "aria-hidden": "true"
43
- })),
44
- u("input", f({
45
- ref_key: "inputRef",
46
- ref: d,
47
- type: "search"
48
- }, s.value, {
49
- value: e.modelValue,
50
- placeholder: e.placeholder,
51
- class: "input-bar-field",
52
- onInput: i[0] ||= (e) => a("update:modelValue", e.target.value)
53
- }), null, 16, w),
54
- g(r.$slots, "default")
55
- ]),
56
- _: 3
57
- }, 8, ["class", "data-surface"]));
58
- }
59
- });
60
- //#endregion
61
- export { T as SearchBar, a as buildIndex, o as clearSearchCache, i as fuzzyMatch, C as searchFieldVariants, r as searchIndex, s as useFuzzySearch };
@@ -1,177 +0,0 @@
1
- import { computed as e, onScopeDispose as t, ref as n, watch as r } from "vue";
2
- //#region src/components/search/composables/fuzzySearchIndex.ts
3
- function i(e, t) {
4
- let n = e.length, r = t.length;
5
- if (n === 0) return {
6
- score: 0,
7
- matches: []
8
- };
9
- if (n > r) return null;
10
- let i = [], a = 0, o = 0, s = -2;
11
- for (let c = 0; c < r && a < n; c++) {
12
- if (e[a] !== t[c]) continue;
13
- i.push(c);
14
- let n = 1;
15
- if (s === c - 1 && (n += 5), c === 0) n += 8;
16
- else {
17
- let e = t[c - 1];
18
- " -_./\\:()".includes(e) ? n += 7 : t[c] >= "A" && t[c] <= "Z" && e >= "a" && e <= "z" && (n += 6);
19
- }
20
- a === c && (n += 3), o += n, s = c, a++;
21
- }
22
- return a < n ? null : (o -= Math.max(0, (r - n) * .1), {
23
- score: o,
24
- matches: i
25
- });
26
- }
27
- function a(e, t) {
28
- if (!t) return null;
29
- let n = 0, r = [];
30
- for (let a of e) {
31
- let e = i(a, t);
32
- if (!e) return null;
33
- n += e.score;
34
- for (let t of e.matches) r.push(t);
35
- }
36
- return {
37
- score: n,
38
- matches: r
39
- };
40
- }
41
- function o(e, t) {
42
- let n = 0, r = [], i = [
43
- [t._lc.label, 12],
44
- [t._lc.type, 10],
45
- [t._lc.text, 3]
46
- ];
47
- for (let [o, s] of i) {
48
- if (!o) continue;
49
- let i = a(e, o);
50
- i && i.score * s > n && (n = i.score * s, r = o === t._lc.label ? i.matches : []);
51
- }
52
- return n <= 0 ? null : {
53
- score: n,
54
- matches: r
55
- };
56
- }
57
- function s(e) {
58
- return e.map((e) => ({
59
- item: e,
60
- _lc: {
61
- label: e.label.toLowerCase(),
62
- text: e.text.toLowerCase(),
63
- type: e.type?.toLowerCase() ?? ""
64
- }
65
- }));
66
- }
67
- var c = /* @__PURE__ */ new WeakMap();
68
- function l(e) {
69
- let t = c.get(e);
70
- return t || (t = /* @__PURE__ */ new Map(), c.set(e, t)), t;
71
- }
72
- function u(e, t, n = 30) {
73
- let r = t.toLowerCase().trim();
74
- if (!r) return [];
75
- let i = l(e), a = i.get(r);
76
- if (a) return a.slice(0, n);
77
- i.size > 200 && i.clear();
78
- let s = r.split(/\s+/).filter(Boolean);
79
- if (s.length === 0) return [];
80
- let c = e;
81
- if (r.length > 1) {
82
- let e = r.slice(0, -1), t = i.get(e);
83
- t && (c = t.map((e) => ({
84
- item: e.item,
85
- _lc: {
86
- label: e.item.label.toLowerCase(),
87
- text: e.item.text.toLowerCase(),
88
- type: e.item.type?.toLowerCase() ?? ""
89
- }
90
- })));
91
- }
92
- let u = [];
93
- for (let e of c) {
94
- let t = o(s, e);
95
- t && u.push({
96
- item: e.item,
97
- score: t.score,
98
- matchIndices: t.matches
99
- });
100
- }
101
- return u.sort((e, t) => t.score - e.score), i.set(r, u), u.slice(0, n);
102
- }
103
- function d(e) {
104
- if (e) {
105
- c.delete(e);
106
- return;
107
- }
108
- c = /* @__PURE__ */ new WeakMap();
109
- }
110
- //#endregion
111
- //#region src/components/search/composables/useFuzzySearch.ts
112
- function f(i) {
113
- let a = typeof i.items == "function" ? i.items : () => i.items, o = i.debounceMs ?? 120, c = i.maxResults ?? 30, l = n(""), f = n(!1), p = n(!1), m = n(0), h = n(""), g = e(() => a()), _ = e(() => s(g.value)), v;
114
- function y(e = v) {
115
- e !== void 0 && (clearTimeout(e), v === e && (v = void 0));
116
- }
117
- r(l, (e, t, n) => {
118
- if (y(), !e || o <= 0) {
119
- h.value = e;
120
- return;
121
- }
122
- let r = setTimeout(() => {
123
- v === r && (h.value = e, v = void 0);
124
- }, o);
125
- v = r, n(() => y(r));
126
- }), r(g, () => {
127
- y(), h.value = l.value, m.value = 0;
128
- }, { deep: !0 });
129
- let b = e(() => u(_.value, h.value, c));
130
- r(b, () => {
131
- m.value = 0;
132
- });
133
- function x(e) {
134
- i.onSelect?.(e), S();
135
- }
136
- function S() {
137
- f.value = !1, p.value = !1, y(), l.value = "", h.value = "", m.value = 0, d(_.value);
138
- }
139
- function C() {
140
- f.value = !0;
141
- }
142
- function w() {
143
- p.value = !p.value;
144
- }
145
- function T(e) {
146
- switch (e.key) {
147
- case "ArrowDown":
148
- e.preventDefault(), m.value < b.value.length - 1 && m.value++;
149
- break;
150
- case "ArrowUp":
151
- e.preventDefault(), m.value > 0 && m.value--;
152
- break;
153
- case "Enter":
154
- e.preventDefault(), b.value[m.value] && x(b.value[m.value]);
155
- break;
156
- case "Escape":
157
- e.preventDefault(), p.value ? p.value = !1 : S();
158
- break;
159
- }
160
- }
161
- return t(() => {
162
- y(), d(_.value);
163
- }, !0), {
164
- query: l,
165
- results: b,
166
- isOpen: f,
167
- isExpanded: p,
168
- selectedIndex: m,
169
- selectResult: x,
170
- close: S,
171
- open: C,
172
- toggleExpanded: w,
173
- onKeydown: T
174
- };
175
- }
176
- //#endregion
177
- export { u as a, i, s as n, d as r, f as t };
@@ -1,107 +0,0 @@
1
- import { t as e } from "./useTimer-C3yfti4C.js";
2
- import { getCurrentScope as t, onScopeDispose as n, ref as r } from "vue";
3
- //#region src/composables/dom/useTouchGate.ts
4
- var i = /* @__PURE__ */ new Set(), a = !1;
5
- function o(e) {
6
- for (let t of i) {
7
- if (!t.isActive()) continue;
8
- let n = t.controlEl();
9
- n && !n.contains(e.target) && t.deactivate();
10
- }
11
- }
12
- function s() {
13
- a || typeof document > "u" || (document.addEventListener("touchstart", o, { passive: !0 }), a = !0);
14
- }
15
- function c() {
16
- i.size > 0 || !a || typeof document > "u" || (document.removeEventListener("touchstart", o), a = !1);
17
- }
18
- function l(a = 3e3) {
19
- let o = r(!1), l = typeof window < "u" && "ontouchstart" in window, u = null, d = null, f = !1, p = !1, m = e(() => {
20
- x();
21
- }, a, { immediate: !1 }), h = e(() => {
22
- f && u && (f = !1, d = null, y(u));
23
- }, 150, { immediate: !1 });
24
- function g() {
25
- m.stop();
26
- }
27
- function _() {
28
- h.stop(), f = !1, d = null;
29
- }
30
- function v() {
31
- g(), m.start(a);
32
- }
33
- function y(e) {
34
- o.value = !0, e.style.touchAction = "none", v();
35
- }
36
- function b(e) {
37
- if (p = e, e) {
38
- g();
39
- return;
40
- }
41
- v();
42
- }
43
- function x() {
44
- p || (g(), _(), o.value = !1, u &&= (u.style.touchAction = "", null));
45
- }
46
- function S(e, t) {
47
- return l ? (u = e, o.value ? (v(), !0) : (_(), f = !0, d = t, h.start(150), !1)) : !0;
48
- }
49
- function C(e) {
50
- if (!l || !f || d === null) return;
51
- let t = e.touches[0]?.clientY ?? 0;
52
- Math.abs(t - d) > 10 && _();
53
- }
54
- function w() {
55
- if (l) {
56
- if (f && u) {
57
- _(), y(u);
58
- return;
59
- }
60
- o.value && v();
61
- }
62
- }
63
- let T = {
64
- isActive: () => o.value,
65
- controlEl: () => u,
66
- deactivate: x
67
- };
68
- l && (i.add(T), s());
69
- function E() {
70
- g(), _(), l && (i.delete(T), c()), u &&= (u.style.touchAction = "", null);
71
- }
72
- return t() && n(E), {
73
- isActive: o,
74
- isTouchDevice: l,
75
- handleTouchStart: S,
76
- handleScrollCheck: C,
77
- handleTouchEnd: w,
78
- resetTimer: v,
79
- deactivate: x,
80
- suppressDeactivate: b
81
- };
82
- }
83
- //#endregion
84
- //#region src/composables/dom/useResolveTokenColor.ts
85
- function u(e, t) {
86
- if (!e.includes("var(") || typeof window > "u" || !t) return e;
87
- let n = t.style.color;
88
- t.style.color = e;
89
- let r = getComputedStyle(t).color;
90
- return t.style.color = n, r || e;
91
- }
92
- function d(e = 256) {
93
- let t = /* @__PURE__ */ new Map();
94
- return {
95
- resolve(n, r) {
96
- let i = t.get(n);
97
- if (i !== void 0) return i;
98
- let a = u(n, r);
99
- return t.size >= e && t.clear(), t.set(n, a), a;
100
- },
101
- invalidate() {
102
- t.clear();
103
- }
104
- };
105
- }
106
- //#endregion
107
- export { u as n, l as r, d as t };