@wirekyt/solid 0.0.1 → 0.0.2

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 (207) hide show
  1. package/dist/accordion.d.ts +68 -0
  2. package/dist/accordion.js +168 -0
  3. package/dist/accordion.jsx +143 -0
  4. package/dist/angle-slider.d.ts +72 -0
  5. package/dist/angle-slider.js +141 -0
  6. package/dist/angle-slider.jsx +130 -0
  7. package/dist/avatar.d.ts +47 -0
  8. package/dist/avatar.js +86 -0
  9. package/dist/avatar.jsx +79 -0
  10. package/dist/carousel.d.ts +92 -0
  11. package/dist/carousel.js +189 -0
  12. package/dist/carousel.jsx +174 -0
  13. package/dist/checkbox.d.ts +140 -0
  14. package/dist/checkbox.js +252 -0
  15. package/dist/checkbox.jsx +234 -0
  16. package/dist/client-only.d.ts +9 -0
  17. package/dist/client-only.js +22 -0
  18. package/dist/client-only.jsx +13 -0
  19. package/dist/clipboard.d.ts +70 -0
  20. package/dist/clipboard.js +137 -0
  21. package/dist/clipboard.jsx +120 -0
  22. package/dist/collapsible-BwNoH1At.jsx +106 -0
  23. package/dist/collapsible-Dp8aqjtN.js +118 -0
  24. package/dist/collapsible.d.ts +58 -0
  25. package/dist/collapsible.js +2 -0
  26. package/dist/collapsible.jsx +2 -0
  27. package/dist/collection-By8qgqkx.js +213 -0
  28. package/dist/collection-Mkvw6TyT.jsx +213 -0
  29. package/dist/collection.d.ts +2 -0
  30. package/dist/collection.js +2 -0
  31. package/dist/collection.jsx +2 -0
  32. package/dist/color-picker.d.ts +179 -0
  33. package/dist/color-picker.js +457 -0
  34. package/dist/color-picker.jsx +395 -0
  35. package/dist/combobox.d.ts +128 -0
  36. package/dist/combobox.js +326 -0
  37. package/dist/combobox.jsx +284 -0
  38. package/dist/core-7QKBNp9p.js +485 -0
  39. package/dist/core-7QKBNp9p.jsx +485 -0
  40. package/dist/date-input.d.ts +68 -0
  41. package/dist/date-input.js +178 -0
  42. package/dist/date-input.jsx +163 -0
  43. package/dist/date-picker.d.ts +191 -0
  44. package/dist/date-picker.js +506 -0
  45. package/dist/date-picker.jsx +430 -0
  46. package/dist/dialog.d.ts +77 -0
  47. package/dist/dialog.js +205 -0
  48. package/dist/dialog.jsx +159 -0
  49. package/dist/download-trigger.d.ts +22 -0
  50. package/dist/download-trigger.js +55 -0
  51. package/dist/download-trigger.jsx +51 -0
  52. package/dist/drawer.d.ts +114 -0
  53. package/dist/drawer.js +291 -0
  54. package/dist/drawer.jsx +237 -0
  55. package/dist/editable.d.ts +77 -0
  56. package/dist/editable.js +171 -0
  57. package/dist/editable.jsx +162 -0
  58. package/dist/factory-D2A7xdtl.js +34 -0
  59. package/dist/factory-DRw_slzE.jsx +34 -0
  60. package/dist/factory-wuwfJqbU.d.ts +15 -0
  61. package/dist/field-CQr_Dibp.js +317 -0
  62. package/dist/field-R5jVNdtK.jsx +282 -0
  63. package/dist/field.d.ts +194 -0
  64. package/dist/field.js +2 -0
  65. package/dist/field.jsx +2 -0
  66. package/dist/fieldset-5shfE0Z5.jsx +155 -0
  67. package/dist/fieldset-D5teGLZ9.js +170 -0
  68. package/dist/fieldset.d.ts +98 -0
  69. package/dist/fieldset.js +2 -0
  70. package/dist/fieldset.jsx +2 -0
  71. package/dist/file-upload.d.ts +100 -0
  72. package/dist/file-upload.js +254 -0
  73. package/dist/file-upload.jsx +232 -0
  74. package/dist/floating-panel.d.ts +97 -0
  75. package/dist/floating-panel.js +231 -0
  76. package/dist/floating-panel.jsx +199 -0
  77. package/dist/focus-trap.d.ts +12 -0
  78. package/dist/focus-trap.js +30 -0
  79. package/dist/focus-trap.jsx +26 -0
  80. package/dist/format.d.ts +32 -0
  81. package/dist/format.js +50 -0
  82. package/dist/format.jsx +53 -0
  83. package/dist/frame.d.ts +12 -0
  84. package/dist/frame.js +119 -0
  85. package/dist/frame.jsx +83 -0
  86. package/dist/image-cropper.d.ts +62 -0
  87. package/dist/image-cropper.js +137 -0
  88. package/dist/image-cropper.jsx +130 -0
  89. package/dist/index-B17eqq14.d.ts +32 -0
  90. package/dist/index-BZHmHI7d.d.ts +142 -0
  91. package/dist/index-CANuc1X0.d.ts +81 -0
  92. package/dist/index-CJwZCGOS.d.ts +75 -0
  93. package/dist/index-ClU-Lb8Z.d.ts +23 -0
  94. package/dist/index-J9N2CBHP.d.ts +21 -0
  95. package/dist/index.d.ts +5 -0
  96. package/dist/index.js +5 -0
  97. package/dist/index.jsx +5 -0
  98. package/dist/json-tree-view.d.ts +50 -0
  99. package/dist/json-tree-view.js +330 -0
  100. package/dist/json-tree-view.jsx +201 -0
  101. package/dist/listbox.d.ts +109 -0
  102. package/dist/listbox.js +237 -0
  103. package/dist/listbox.jsx +212 -0
  104. package/dist/marquee.d.ts +57 -0
  105. package/dist/marquee.js +125 -0
  106. package/dist/marquee.jsx +113 -0
  107. package/dist/menu.d.ts +158 -0
  108. package/dist/menu.js +441 -0
  109. package/dist/menu.jsx +362 -0
  110. package/dist/navigation-menu.d.ts +88 -0
  111. package/dist/navigation-menu.js +289 -0
  112. package/dist/navigation-menu.jsx +228 -0
  113. package/dist/number-input.d.ts +72 -0
  114. package/dist/number-input.js +166 -0
  115. package/dist/number-input.jsx +157 -0
  116. package/dist/pagination.d.ts +67 -0
  117. package/dist/pagination.js +131 -0
  118. package/dist/pagination.jsx +124 -0
  119. package/dist/password-input.d.ts +64 -0
  120. package/dist/password-input.js +144 -0
  121. package/dist/password-input.jsx +125 -0
  122. package/dist/pin-input.d.ts +57 -0
  123. package/dist/pin-input.js +138 -0
  124. package/dist/pin-input.jsx +129 -0
  125. package/dist/popover.d.ts +92 -0
  126. package/dist/popover.js +206 -0
  127. package/dist/popover.jsx +174 -0
  128. package/dist/presence-9UGkuyfn.jsx +59 -0
  129. package/dist/presence-CE6lXCu5.js +72 -0
  130. package/dist/presence.d.ts +2 -0
  131. package/dist/presence.js +2 -0
  132. package/dist/presence.jsx +2 -0
  133. package/dist/progress.d.ts +77 -0
  134. package/dist/progress.js +146 -0
  135. package/dist/progress.jsx +137 -0
  136. package/dist/providers-B-Vi5wQ7.js +124 -0
  137. package/dist/providers-CqNHqLpB.jsx +110 -0
  138. package/dist/qr-code.d.ts +57 -0
  139. package/dist/qr-code.js +111 -0
  140. package/dist/qr-code.jsx +104 -0
  141. package/dist/radio-group.d.ts +77 -0
  142. package/dist/radio-group.js +170 -0
  143. package/dist/radio-group.jsx +157 -0
  144. package/dist/rating-group.d.ts +67 -0
  145. package/dist/rating-group.js +142 -0
  146. package/dist/rating-group.jsx +131 -0
  147. package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
  148. package/dist/rolldown-runtime-D7D4PA-g.jsx +13 -0
  149. package/dist/run-if-fn-CjvD7VzQ.js +5 -0
  150. package/dist/run-if-fn-CjvD7VzQ.jsx +5 -0
  151. package/dist/scroll-area.d.ts +61 -0
  152. package/dist/scroll-area.js +119 -0
  153. package/dist/scroll-area.jsx +109 -0
  154. package/dist/segment-group.d.ts +80 -0
  155. package/dist/segment-group.js +166 -0
  156. package/dist/segment-group.jsx +153 -0
  157. package/dist/select.d.ts +132 -0
  158. package/dist/select.js +337 -0
  159. package/dist/select.jsx +283 -0
  160. package/dist/signature-pad.d.ts +67 -0
  161. package/dist/signature-pad.js +159 -0
  162. package/dist/signature-pad.jsx +141 -0
  163. package/dist/slider.d.ts +87 -0
  164. package/dist/slider.js +191 -0
  165. package/dist/slider.jsx +179 -0
  166. package/dist/splitter.d.ts +57 -0
  167. package/dist/splitter.js +126 -0
  168. package/dist/splitter.jsx +116 -0
  169. package/dist/steps.d.ts +100 -0
  170. package/dist/steps.js +199 -0
  171. package/dist/steps.jsx +184 -0
  172. package/dist/swap.d.ts +51 -0
  173. package/dist/swap.js +123 -0
  174. package/dist/swap.jsx +106 -0
  175. package/dist/switch.d.ts +57 -0
  176. package/dist/switch.js +125 -0
  177. package/dist/switch.jsx +116 -0
  178. package/dist/tabs.d.ts +58 -0
  179. package/dist/tabs.js +146 -0
  180. package/dist/tabs.jsx +122 -0
  181. package/dist/tags-input.d.ts +97 -0
  182. package/dist/tags-input.js +228 -0
  183. package/dist/tags-input.jsx +213 -0
  184. package/dist/timer.d.ts +62 -0
  185. package/dist/timer.js +119 -0
  186. package/dist/timer.jsx +110 -0
  187. package/dist/toast.d.ts +60 -0
  188. package/dist/toast.js +120 -0
  189. package/dist/toast.jsx +106 -0
  190. package/dist/toggle-group.d.ts +42 -0
  191. package/dist/toggle-group.js +87 -0
  192. package/dist/toggle-group.jsx +80 -0
  193. package/dist/toggle.d.ts +38 -0
  194. package/dist/toggle.js +73 -0
  195. package/dist/toggle.jsx +61 -0
  196. package/dist/tooltip.d.ts +67 -0
  197. package/dist/tooltip.js +159 -0
  198. package/dist/tooltip.jsx +127 -0
  199. package/dist/tour.d.ts +112 -0
  200. package/dist/tour.js +256 -0
  201. package/dist/tour.jsx +192 -0
  202. package/dist/tree-view-ATyeBPXq.js +290 -0
  203. package/dist/tree-view-CoWx7osT.jsx +265 -0
  204. package/dist/tree-view.d.ts +3 -0
  205. package/dist/tree-view.js +3 -0
  206. package/dist/tree-view.jsx +3 -0
  207. package/package.json +324 -6
@@ -0,0 +1,485 @@
1
+ import { callAll, compact, ensure, hasProp, isEqual, isFunction, isNumber, isObject, isString, toArray, warn } from "@wirekyt/dom/utils";
2
+ import { createContext, createEffect, createMemo, createSignal, mergeProps, onCleanup, onMount, splitProps, untrack, useContext } from "solid-js";
3
+ import { Key } from "@solid-primitives/keyed";
4
+ import { INIT_STATE, MachineStatus, createScope, findTransition, getExitEnterStates, hasTag, matchesState, mergeProps as mergeProps$1, resolveStateValue } from "@wirekyt/dom";
5
+ import { createNormalizer } from "@wirekyt/dom/types";
6
+ //#region src/utils/create-context.ts
7
+ function getErrorMessage(hook, provider) {
8
+ return `${hook} returned \`undefined\`. Seems you forgot to wrap component within ${provider}`;
9
+ }
10
+ function createContext$1(options = {}) {
11
+ const { strict = true, hookName = "useContext", providerName = "Provider", errorMessage, defaultValue } = options;
12
+ const Context = createContext(defaultValue);
13
+ function useContext$1() {
14
+ const context = useContext(Context);
15
+ if (!context && strict) {
16
+ const error = new Error(errorMessage ?? getErrorMessage(hookName, providerName));
17
+ error.name = "ContextError";
18
+ if (hasProp(Error, "captureStackTrace") && isFunction(Error.captureStackTrace)) Error.captureStackTrace(error, useContext$1);
19
+ throw error;
20
+ }
21
+ return context;
22
+ }
23
+ return [
24
+ Context.Provider,
25
+ useContext$1,
26
+ Context
27
+ ];
28
+ }
29
+ //#endregion
30
+ //#region src/utils/compose-refs.ts
31
+ const isRefFn = (ref) => typeof ref === "function";
32
+ const setRefs = (refs, node) => {
33
+ for (const ref of refs) if (isRefFn(ref)) ref(node);
34
+ };
35
+ function composeRefs(...refs) {
36
+ let node = null;
37
+ createEffect(() => {
38
+ setRefs(refs, node);
39
+ });
40
+ return (el) => {
41
+ node = el;
42
+ setRefs(refs, el);
43
+ };
44
+ }
45
+ //#endregion
46
+ //#region src/utils/create-split-props.ts
47
+ const createSplitProps = () => (props, keys) => splitProps(props, keys);
48
+ //#endregion
49
+ //#region src/utils/render-strategy.ts
50
+ const [RenderStrategyProvider, useRenderStrategyContext] = createContext$1({
51
+ hookName: "useRenderStrategyContext",
52
+ providerName: "<RenderStrategyProvider />"
53
+ });
54
+ const splitRenderStrategyProps = (props) => createSplitProps()(props, ["lazyMount", "unmountOnExit"]);
55
+ //#endregion
56
+ //#region src/core/merge-props.ts
57
+ function mergeProps$2(...sources) {
58
+ const target = {};
59
+ for (let i = 0; i < sources.length; i++) {
60
+ let source = sources[i];
61
+ if (typeof source === "function") source = source();
62
+ if (source) {
63
+ const descriptors = Object.getOwnPropertyDescriptors(source);
64
+ for (const key in descriptors) {
65
+ if (key in target) continue;
66
+ Object.defineProperty(target, key, {
67
+ enumerable: true,
68
+ get() {
69
+ let e = {};
70
+ if (key === "style" || key === "class" || key === "className" || key.startsWith("on")) {
71
+ for (let i = 0; i < sources.length; i++) {
72
+ let s = sources[i];
73
+ if (typeof s === "function") s = s();
74
+ e = mergeProps$1(e, { [key]: (s || {})[key] });
75
+ }
76
+ return e[key];
77
+ }
78
+ for (let i = sources.length - 1; i >= 0; i--) {
79
+ let v, s = sources[i];
80
+ if (typeof s === "function") s = s();
81
+ v = (s || {})[key];
82
+ if (v !== void 0) return v;
83
+ }
84
+ }
85
+ });
86
+ }
87
+ }
88
+ }
89
+ return target;
90
+ }
91
+ //#endregion
92
+ //#region src/core/bindable.ts
93
+ function createBindable(props) {
94
+ const initial = props().value ?? props().defaultValue;
95
+ const eq = props().isEqual ?? Object.is;
96
+ const [value, setValue] = createSignal(initial);
97
+ const controlled = createMemo(() => props().value != void 0);
98
+ const valueRef = { current: value() };
99
+ const prevValue = { current: void 0 };
100
+ createEffect(() => {
101
+ const v = controlled() ? props().value : value();
102
+ prevValue.current = v;
103
+ valueRef.current = v;
104
+ });
105
+ const set = (v) => {
106
+ const prev = prevValue.current;
107
+ const next = isFunction(v) ? v(valueRef.current) : v;
108
+ if (props().debug) console.log(`[bindable > ${props().debug}] setValue`, {
109
+ next,
110
+ prev
111
+ });
112
+ if (!controlled()) setValue(next);
113
+ if (!eq(next, prev)) props().onChange?.(next, prev);
114
+ };
115
+ function get() {
116
+ const v = controlled() ? props().value : value;
117
+ return isFunction(v) ? v() : v;
118
+ }
119
+ return {
120
+ initial,
121
+ ref: valueRef,
122
+ get,
123
+ set,
124
+ invoke(nextValue, prevValue) {
125
+ props().onChange?.(nextValue, prevValue);
126
+ },
127
+ hash(value) {
128
+ return props().hash?.(value) ?? String(value);
129
+ }
130
+ };
131
+ }
132
+ createBindable.cleanup = (fn) => {
133
+ onCleanup(() => fn());
134
+ };
135
+ createBindable.ref = (defaultValue) => {
136
+ let value = defaultValue;
137
+ return {
138
+ get: () => value,
139
+ set: (next) => {
140
+ value = next;
141
+ }
142
+ };
143
+ };
144
+ //#endregion
145
+ //#region src/core/refs.ts
146
+ function createRefs(refs) {
147
+ const ref = { current: refs };
148
+ return {
149
+ get(key) {
150
+ return ref.current[key];
151
+ },
152
+ set(key, value) {
153
+ ref.current[key] = value;
154
+ }
155
+ };
156
+ }
157
+ //#endregion
158
+ //#region src/core/track.ts
159
+ function access$1(v) {
160
+ if (isFunction(v)) return v();
161
+ return v;
162
+ }
163
+ const createTrack = (deps, effect) => {
164
+ let prevDeps = [];
165
+ let isFirstRun = true;
166
+ createEffect(() => {
167
+ if (isFirstRun) {
168
+ prevDeps = deps.map((d) => access$1(d));
169
+ isFirstRun = false;
170
+ return;
171
+ }
172
+ let changed = false;
173
+ for (let i = 0; i < deps.length; i++) if (!isEqual(prevDeps[i], access$1(deps[i]))) {
174
+ changed = true;
175
+ break;
176
+ }
177
+ if (changed) {
178
+ prevDeps = deps.map((d) => access$1(d));
179
+ effect();
180
+ }
181
+ });
182
+ };
183
+ //#endregion
184
+ //#region src/core/machine.ts
185
+ function useMachine(machine, userProps = {}) {
186
+ const scope = createMemo(() => {
187
+ const { id, ids, getRootNode } = access(userProps);
188
+ return createScope({
189
+ id,
190
+ ids,
191
+ getRootNode
192
+ });
193
+ });
194
+ const debug = (...args) => {
195
+ if (machine.debug) console.log(...args);
196
+ };
197
+ const prop = createProp(createMemo(() => machine.props?.({
198
+ props: compact(access(userProps)),
199
+ scope: scope()
200
+ }) ?? access(userProps)));
201
+ const context = machine.context?.({
202
+ prop,
203
+ bindable: createBindable,
204
+ get scope() {
205
+ return scope();
206
+ },
207
+ flush,
208
+ getContext() {
209
+ return ctx;
210
+ },
211
+ getComputed() {
212
+ return computed;
213
+ },
214
+ getRefs() {
215
+ return refs;
216
+ },
217
+ getEvent() {
218
+ return getEvent();
219
+ }
220
+ });
221
+ const ctx = {
222
+ get(key) {
223
+ return context?.[key].get();
224
+ },
225
+ set(key, value) {
226
+ context?.[key].set(value);
227
+ },
228
+ initial(key) {
229
+ return context?.[key].initial;
230
+ },
231
+ hash(key) {
232
+ const current = context?.[key].get();
233
+ return context?.[key].hash(current);
234
+ }
235
+ };
236
+ const effects = { current: /* @__PURE__ */ new Map() };
237
+ const transitionRef = { current: null };
238
+ const previousEventRef = { current: null };
239
+ const eventRef = { current: { type: "" } };
240
+ const getEvent = () => mergeProps(eventRef.current, {
241
+ current() {
242
+ return eventRef.current;
243
+ },
244
+ previous() {
245
+ return previousEventRef.current;
246
+ }
247
+ });
248
+ const getState = () => mergeProps(state, {
249
+ matches(...values) {
250
+ const current = state.get();
251
+ return values.some((value) => matchesState(current, value));
252
+ },
253
+ hasTag(tag) {
254
+ return hasTag(machine, state.get(), tag);
255
+ }
256
+ });
257
+ const refs = createRefs(machine.refs?.({
258
+ prop,
259
+ context: ctx
260
+ }) ?? {});
261
+ const getParams = () => ({
262
+ state: getState(),
263
+ context: ctx,
264
+ event: getEvent(),
265
+ prop,
266
+ send,
267
+ action,
268
+ guard,
269
+ track: createTrack,
270
+ refs,
271
+ computed,
272
+ flush,
273
+ get scope() {
274
+ return scope();
275
+ },
276
+ choose
277
+ });
278
+ const action = (keys) => {
279
+ const strs = isFunction(keys) ? keys(getParams()) : keys;
280
+ if (!strs) return;
281
+ const fns = strs.map((s) => {
282
+ const fn = machine.implementations?.actions?.[s];
283
+ if (!fn) warn(`[wirekyt] No implementation found for action "${JSON.stringify(s)}"`);
284
+ return fn;
285
+ });
286
+ for (const fn of fns) fn?.(getParams());
287
+ };
288
+ const guard = (str) => {
289
+ if (isFunction(str)) return str(getParams());
290
+ const fn = machine.implementations?.guards?.[str];
291
+ if (!fn) warn(`[wirekyt] No implementation found for guard "${JSON.stringify(str)}"`);
292
+ return fn?.(getParams());
293
+ };
294
+ const effect = (keys) => {
295
+ const strs = isFunction(keys) ? keys(getParams()) : keys;
296
+ if (!strs) return;
297
+ const fns = strs.map((s) => {
298
+ const fn = machine.implementations?.effects?.[s];
299
+ if (!fn) warn(`[wirekyt] No implementation found for effect "${JSON.stringify(s)}"`);
300
+ return fn;
301
+ });
302
+ const cleanups = [];
303
+ for (const fn of fns) {
304
+ const cleanup = fn?.(getParams());
305
+ if (cleanup) cleanups.push(cleanup);
306
+ }
307
+ return () => cleanups.forEach((fn) => fn?.());
308
+ };
309
+ const choose = (transitions) => {
310
+ return toArray(transitions).find((t) => {
311
+ let result = !t.guard;
312
+ if (isString(t.guard)) result = !!guard(t.guard);
313
+ else if (isFunction(t.guard)) result = t.guard(getParams());
314
+ return result;
315
+ });
316
+ };
317
+ const computed = (key) => {
318
+ ensure(machine.computed, () => `[wirekyt] No computed object found on machine`);
319
+ const fn = machine.computed[key];
320
+ return fn({
321
+ context: ctx,
322
+ event: eventRef.current,
323
+ prop,
324
+ refs,
325
+ scope: scope(),
326
+ computed
327
+ });
328
+ };
329
+ const state = createBindable(() => ({
330
+ defaultValue: resolveStateValue(machine, machine.initialState({ prop })),
331
+ onChange(nextState, prevState) {
332
+ const { exiting, entering } = getExitEnterStates(machine, prevState, nextState, transitionRef.current?.reenter);
333
+ exiting.forEach((item) => {
334
+ effects.current.get(item.path)?.();
335
+ effects.current.delete(item.path);
336
+ });
337
+ exiting.forEach((item) => {
338
+ action(item.state?.exit);
339
+ });
340
+ action(transitionRef.current?.actions);
341
+ entering.forEach((item) => {
342
+ const cleanup = effect(item.state?.effects);
343
+ if (cleanup) {
344
+ const existing = effects.current.get(item.path);
345
+ effects.current.set(item.path, existing ? callAll(existing, cleanup) : cleanup);
346
+ }
347
+ });
348
+ if (prevState === INIT_STATE) {
349
+ action(machine.entry);
350
+ const cleanup = effect(machine.effects);
351
+ if (cleanup) {
352
+ const existing = effects.current.get(INIT_STATE);
353
+ effects.current.set(INIT_STATE, existing ? callAll(existing, cleanup) : cleanup);
354
+ }
355
+ }
356
+ entering.forEach((item) => {
357
+ action(item.state?.entry);
358
+ });
359
+ }
360
+ }));
361
+ let status = MachineStatus.NotStarted;
362
+ onMount(() => {
363
+ const started = status === MachineStatus.Started;
364
+ status = MachineStatus.Started;
365
+ debug(started ? "rehydrating..." : "initializing...");
366
+ state.invoke(state.initial, INIT_STATE);
367
+ });
368
+ onCleanup(() => {
369
+ debug("unmounting...");
370
+ status = MachineStatus.Stopped;
371
+ effects.current.forEach((fn) => fn?.());
372
+ effects.current = /* @__PURE__ */ new Map();
373
+ transitionRef.current = null;
374
+ action(machine.exit);
375
+ });
376
+ const send = (event) => {
377
+ queueMicrotask(() => {
378
+ if (status !== MachineStatus.Started) return;
379
+ previousEventRef.current = eventRef.current;
380
+ eventRef.current = event;
381
+ let currentState = untrack(() => state.get());
382
+ const { transitions, source } = findTransition(machine, currentState, event.type);
383
+ const transition = choose(transitions);
384
+ if (!transition) return;
385
+ transitionRef.current = transition;
386
+ const target = resolveStateValue(machine, transition.target ?? currentState, source);
387
+ debug("transition", event.type, transition.target || currentState, `(${transition.actions})`);
388
+ if (target !== currentState) state.set(target);
389
+ else if (transition.reenter) state.invoke(currentState, currentState);
390
+ else action(transition.actions);
391
+ });
392
+ };
393
+ machine.watch?.(getParams());
394
+ return {
395
+ state: getState(),
396
+ send,
397
+ context: ctx,
398
+ prop,
399
+ get scope() {
400
+ return scope();
401
+ },
402
+ refs,
403
+ computed,
404
+ event: getEvent(),
405
+ getStatus: () => status
406
+ };
407
+ }
408
+ function flush(fn) {
409
+ fn();
410
+ }
411
+ function access(value) {
412
+ return isFunction(value) ? value() : value;
413
+ }
414
+ function createProp(value) {
415
+ return function get(key) {
416
+ return value()[key];
417
+ };
418
+ }
419
+ //#endregion
420
+ //#region src/core/normalize-props.ts
421
+ const eventMap = {
422
+ onFocus: "onFocusIn",
423
+ onBlur: "onFocusOut",
424
+ onDoubleClick: "onDblClick",
425
+ onChange: "onInput",
426
+ defaultChecked: "checked",
427
+ defaultValue: "value",
428
+ htmlFor: "for",
429
+ className: "class"
430
+ };
431
+ const format = (v) => v.startsWith("--") ? v : hyphenateStyleName(v);
432
+ function toSolidProp(prop) {
433
+ return prop in eventMap ? eventMap[prop] : prop;
434
+ }
435
+ const normalizeProps = createNormalizer((props) => {
436
+ const normalized = {};
437
+ for (const key in props) {
438
+ const value = props[key];
439
+ if (key === "readOnly" && value === false) continue;
440
+ if (key === "style" && isObject(value)) {
441
+ normalized["style"] = cssify(value);
442
+ continue;
443
+ }
444
+ if (key === "children") {
445
+ if (isString(value)) normalized["textContent"] = value;
446
+ continue;
447
+ }
448
+ normalized[toSolidProp(key)] = value;
449
+ }
450
+ return normalized;
451
+ });
452
+ function cssify(style) {
453
+ let css = {};
454
+ for (const property in style) {
455
+ const value = style[property];
456
+ if (!isString(value) && !isNumber(value)) continue;
457
+ css[format(property)] = value;
458
+ }
459
+ return css;
460
+ }
461
+ const uppercasePattern = /[A-Z]/g;
462
+ const msPattern = /^ms-/;
463
+ function toHyphenLower(match) {
464
+ return "-" + match.toLowerCase();
465
+ }
466
+ const cache = {};
467
+ function hyphenateStyleName(name) {
468
+ if (cache.hasOwnProperty(name)) return cache[name];
469
+ const hName = name.replace(uppercasePattern, toHyphenLower);
470
+ return cache[name] = msPattern.test(hName) ? "-" + hName : hName;
471
+ }
472
+ //#endregion
473
+ //#region src/core/use-sync-external-store.ts
474
+ function useSyncExternalStore(subscribe, getSnapshot, _getServerSnapshot) {
475
+ const [snapshot, setSnapshot] = createSignal(getSnapshot());
476
+ onMount(() => {
477
+ setSnapshot(() => getSnapshot());
478
+ onCleanup(subscribe(() => {
479
+ setSnapshot(() => getSnapshot());
480
+ }));
481
+ });
482
+ return snapshot;
483
+ }
484
+ //#endregion
485
+ export { mergeProps$2 as a, useRenderStrategyContext as c, createContext$1 as d, useMachine as i, createSplitProps as l, useSyncExternalStore as n, RenderStrategyProvider as o, normalizeProps as r, splitRenderStrategyProps as s, Key as t, composeRefs as u };
@@ -0,0 +1,68 @@
1
+ import { a as Optional, r as MaybeAccessor, s as PropTypes } from "./index-ClU-Lb8Z.js";
2
+ import { r as PolymorphicProps, t as HTMLProps } from "./factory-wuwfJqbU.js";
3
+ import { Accessor, JSX } from "solid-js";
4
+ import * as dateInput from "@wirekyt/dom/machines/date-input";
5
+ import { DateSegment, DateValue as DateInputDateValue, FocusChangeDetails as DateInputFocusChangeDetails, HiddenInputProps, SegmentGroupProps, SegmentProps, SelectionMode as DateInputSelectionMode, ValueChangeDetails as DateInputValueChangeDetails, anatomy as dateInputAnatomy } from "@wirekyt/dom/machines/date-input";
6
+ //#region src/components/date-input/use-date-input.d.ts
7
+ interface UseDateInputProps extends Optional<Omit<dateInput.Props, "dir" | "getRootNode">, "id"> {}
8
+ interface UseDateInputReturn extends Accessor<dateInput.Api<PropTypes>> {}
9
+ declare const useDateInput: (props?: MaybeAccessor<UseDateInputProps>) => UseDateInputReturn;
10
+ //#endregion
11
+ //#region src/components/date-input/use-context.d.ts
12
+ interface UseDateInputContext extends UseDateInputReturn {}
13
+ declare const DateInputProvider: import("solid-js").ContextProviderComponent<UseDateInputContext>, useDateInputContext: () => UseDateInputContext;
14
+ //#endregion
15
+ //#region src/components/date-input/context.d.ts
16
+ interface DateInputContextProps {
17
+ children: (context: UseDateInputContext) => JSX.Element;
18
+ }
19
+ declare const DateInputContext: (props: DateInputContextProps) => JSX.Element;
20
+ //#endregion
21
+ //#region src/components/date-input/label.d.ts
22
+ interface DateInputLabelBaseProps extends PolymorphicProps<"label"> {}
23
+ interface DateInputLabelProps extends HTMLProps<"label">, DateInputLabelBaseProps {}
24
+ declare const DateInputLabel: (props: DateInputLabelProps) => import("solid-js").JSX.Element;
25
+ //#endregion
26
+ //#region src/components/date-input/root.d.ts
27
+ interface DateInputRootBaseProps extends UseDateInputProps, PolymorphicProps<"div"> {}
28
+ interface DateInputRootProps extends HTMLProps<"div">, DateInputRootBaseProps {}
29
+ declare const DateInputRoot: (props: DateInputRootProps) => import("solid-js").JSX.Element;
30
+ //#endregion
31
+ //#region src/components/date-input/root-provider.d.ts
32
+ interface RootProviderProps {
33
+ value: UseDateInputReturn;
34
+ }
35
+ interface DateInputRootProviderBaseProps extends RootProviderProps, PolymorphicProps<"div"> {}
36
+ interface DateInputRootProviderProps extends HTMLProps<"div">, DateInputRootProviderBaseProps {}
37
+ declare const DateInputRootProvider: (props: DateInputRootProviderProps) => import("solid-js").JSX.Element;
38
+ //#endregion
39
+ //#region src/components/date-input/segment.d.ts
40
+ interface DateInputSegmentBaseProps extends PolymorphicProps<"span">, Pick<SegmentProps, "segment"> {}
41
+ interface DateInputSegmentProps extends HTMLProps<"span">, DateInputSegmentBaseProps {}
42
+ declare const DateInputSegment: (props: DateInputSegmentProps) => import("solid-js").JSX.Element;
43
+ //#endregion
44
+ //#region src/components/date-input/segment-group.d.ts
45
+ interface DateInputSegmentGroupBaseProps extends PolymorphicProps<"div">, SegmentGroupProps {}
46
+ interface DateInputSegmentGroupProps extends HTMLProps<"div">, DateInputSegmentGroupBaseProps {}
47
+ declare const DateInputSegmentGroup: (props: DateInputSegmentGroupProps) => import("solid-js").JSX.Element;
48
+ //#endregion
49
+ //#region src/components/date-input/hidden-input.d.ts
50
+ interface DateInputHiddenInputBaseProps extends PolymorphicProps<"input">, HiddenInputProps {}
51
+ interface DateInputHiddenInputProps extends HTMLProps<"input">, DateInputHiddenInputBaseProps {}
52
+ declare const DateInputHiddenInput: (props: DateInputHiddenInputProps) => import("solid-js").JSX.Element;
53
+ //#endregion
54
+ //#region src/components/date-input/control.d.ts
55
+ interface DateInputControlBaseProps extends PolymorphicProps<"div"> {}
56
+ interface DateInputControlProps extends HTMLProps<"div">, DateInputControlBaseProps {}
57
+ declare const DateInputControl: (props: DateInputControlProps) => import("solid-js").JSX.Element;
58
+ //#endregion
59
+ //#region src/components/date-input/segment-context.d.ts
60
+ interface DateInputSegmentContextProps {
61
+ children: (segment: DateSegment) => JSX.Element;
62
+ }
63
+ declare const DateInputSegmentContext: (props: DateInputSegmentContextProps) => JSX.Element;
64
+ declare namespace date_input_d_exports {
65
+ export { DateInputContext as Context, DateInputContextProps as ContextProps, DateInputControl as Control, DateInputControlBaseProps as ControlBaseProps, DateInputControlProps as ControlProps, DateInputHiddenInput as HiddenInput, DateInputHiddenInputBaseProps as HiddenInputBaseProps, DateInputHiddenInputProps as HiddenInputProps, DateInputLabel as Label, DateInputLabelBaseProps as LabelBaseProps, DateInputLabelProps as LabelProps, DateInputRoot as Root, DateInputRootBaseProps as RootBaseProps, DateInputRootProps as RootProps, DateInputRootProvider as RootProvider, DateInputRootProviderBaseProps as RootProviderBaseProps, DateInputRootProviderProps as RootProviderProps, DateInputSegment as Segment, DateInputSegmentBaseProps as SegmentBaseProps, DateInputSegmentContext as SegmentContext, DateInputSegmentContextProps as SegmentContextProps, DateInputSegmentGroup as SegmentGroup, DateInputSegmentGroupBaseProps as SegmentGroupBaseProps, DateInputSegmentGroupProps as SegmentGroupProps, DateInputSegmentProps as SegmentProps };
66
+ }
67
+ //#endregion
68
+ export { date_input_d_exports as DateInput, DateInputContext, type DateInputContextProps, DateInputControl, type DateInputControlBaseProps, type DateInputControlProps, type DateInputDateValue, type DateInputFocusChangeDetails, DateInputHiddenInput, type DateInputHiddenInputBaseProps, type DateInputHiddenInputProps, DateInputLabel, type DateInputLabelBaseProps, type DateInputLabelProps, DateInputRoot, type DateInputRootBaseProps, type DateInputRootProps, DateInputRootProvider, type DateInputRootProviderBaseProps, type DateInputRootProviderProps, DateInputSegment, type DateInputSegmentBaseProps, DateInputSegmentContext, type DateInputSegmentContextProps, DateInputSegmentGroup, type DateInputSegmentGroupBaseProps, type DateInputSegmentGroupProps, type DateInputSegmentProps, type DateInputSelectionMode, type DateInputValueChangeDetails, type UseDateInputContext, type UseDateInputProps, type UseDateInputReturn, dateInputAnatomy, useDateInput, useDateInputContext };