@sprawlify/react 0.0.2 → 0.0.4

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 (32) hide show
  1. package/dist/chunk-Be3lCSWa.mjs +18 -0
  2. package/dist/collapsible-uHsTDy9p.mjs +149 -0
  3. package/dist/collapsible-ztcYulwp.cjs +208 -0
  4. package/dist/components/accordion/index.cjs +226 -0
  5. package/dist/components/accordion/index.d.cts +67 -0
  6. package/dist/components/accordion/index.d.mts +67 -0
  7. package/dist/components/accordion/index.mjs +204 -0
  8. package/dist/components/collapsible/index.cjs +25 -0
  9. package/dist/components/collapsible/index.d.cts +55 -0
  10. package/dist/components/collapsible/index.d.mts +55 -0
  11. package/dist/components/collapsible/index.mjs +5 -0
  12. package/dist/{utils-CVmRc1p7.mjs → create-context-C0L0yhLQ.mjs} +1 -2
  13. package/dist/{utils-DQoI5AQQ.cjs → create-context-DCEySQ7J.cjs} +1 -2
  14. package/dist/factory-B3Fr36su.d.cts +29 -0
  15. package/dist/factory-BV5hc6hz.d.mts +41 -0
  16. package/dist/factory-BvslhNMh.mjs +499 -0
  17. package/dist/factory-CfqPG186.cjs +616 -0
  18. package/dist/index.cjs +15 -536
  19. package/dist/index.d.cts +3 -28
  20. package/dist/index.d.mts +3 -40
  21. package/dist/index.mjs +3 -497
  22. package/dist/render-strategy-BfNJW1Xz.d.mts +9 -0
  23. package/dist/render-strategy-CErLP5e-.d.cts +8 -0
  24. package/dist/utils/index.cjs +4 -3
  25. package/dist/utils/index.d.cts +1 -1
  26. package/dist/utils/index.d.mts +1 -1
  27. package/dist/utils/index.mjs +2 -1
  28. package/dist/utils-Cb5K29pi.cjs +1 -0
  29. package/dist/utils-Q0vUJnHt.mjs +3 -0
  30. package/package.json +22 -2
  31. /package/dist/{index-D-QxCLG0.d.cts → index-Bk-VrHD9.d.cts} +0 -0
  32. /package/dist/{index-BbV54I7I.d.mts → index-lntzaDM3.d.mts} +0 -0
package/dist/index.cjs CHANGED
@@ -1,538 +1,17 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
- key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) {
13
- __defProp(to, key, {
14
- get: ((k) => from[k]).bind(null, key),
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- }
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
- value: mod,
24
- enumerable: true
25
- }) : target, mod));
26
-
27
- //#endregion
28
- const require_utils = require('./utils-DQoI5AQQ.cjs');
1
+ const require_factory = require('./factory-CfqPG186.cjs');
2
+ const require_create_context = require('./create-context-DCEySQ7J.cjs');
3
+ require('./utils-Cb5K29pi.cjs');
29
4
  let __sprawlify_primitives_core = require("@sprawlify/primitives/core");
30
- let __sprawlify_primitives_utils = require("@sprawlify/primitives/utils");
31
- let react = require("react");
32
- react = __toESM(react);
33
- let react_dom = require("react-dom");
34
- let __sprawlify_primitives_types = require("@sprawlify/primitives/types");
35
- let react_jsx_runtime = require("react/jsx-runtime");
36
- let __sprawlify_primitives_dom_query = require("@sprawlify/primitives/dom-query");
37
- let __sprawlify_primitives_i18n_utils = require("@sprawlify/primitives/i18n-utils");
38
-
39
- //#region src/core/use-layout-effect.ts
40
- const useSafeLayoutEffect = typeof globalThis.document !== "undefined" ? react.useLayoutEffect : react.useEffect;
41
-
42
- //#endregion
43
- //#region src/core/bindable.ts
44
- function useBindable(props) {
45
- const initial = props().value ?? props().defaultValue;
46
- const eq = props().isEqual ?? Object.is;
47
- const [initialValue] = (0, react.useState)(initial);
48
- const [value, setValue] = (0, react.useState)(initialValue);
49
- const controlled = props().value !== void 0;
50
- const valueRef = (0, react.useRef)(value);
51
- valueRef.current = controlled ? props().value : value;
52
- const prevValue = (0, react.useRef)(valueRef.current);
53
- useSafeLayoutEffect(() => {
54
- prevValue.current = valueRef.current;
55
- }, [value, props().value]);
56
- const setFn = (value$1) => {
57
- const prev = prevValue.current;
58
- const next = (0, __sprawlify_primitives_utils.isFunction)(value$1) ? value$1(prev) : value$1;
59
- if (props().debug) console.log(`[bindable > ${props().debug}] setValue`, {
60
- next,
61
- prev
62
- });
63
- if (!controlled) setValue(next);
64
- if (!eq(next, prev)) props().onChange?.(next, prev);
65
- };
66
- function get() {
67
- return controlled ? props().value : value;
68
- }
69
- return {
70
- initial: initialValue,
71
- ref: valueRef,
72
- get,
73
- set(value$1) {
74
- (props().sync ? react_dom.flushSync : __sprawlify_primitives_utils.identity)(() => setFn(value$1));
75
- },
76
- invoke(nextValue, prevValue$1) {
77
- props().onChange?.(nextValue, prevValue$1);
78
- },
79
- hash(value$1) {
80
- return props().hash?.(value$1) ?? String(value$1);
81
- }
82
- };
83
- }
84
- useBindable.cleanup = (fn) => {
85
- (0, react.useEffect)(() => fn, []);
86
- };
87
- useBindable.ref = (defaultValue) => {
88
- const value = (0, react.useRef)(defaultValue);
89
- return {
90
- get: () => value.current,
91
- set: (next) => {
92
- value.current = next;
93
- }
94
- };
95
- };
96
-
97
- //#endregion
98
- //#region src/core/refs.ts
99
- function useRefs(refs) {
100
- const ref = (0, react.useRef)(refs);
101
- return {
102
- get(key) {
103
- return ref.current[key];
104
- },
105
- set(key, value) {
106
- ref.current[key] = value;
107
- }
108
- };
109
- }
110
-
111
- //#endregion
112
- //#region src/core/track.ts
113
- const useTrack = (deps, effect) => {
114
- const render = (0, react.useRef)(false);
115
- const called = (0, react.useRef)(false);
116
- (0, react.useEffect)(() => {
117
- if (render.current && called.current) return effect();
118
- called.current = true;
119
- }, [...(deps ?? []).map((d) => typeof d === "function" ? d() : d)]);
120
- (0, react.useEffect)(() => {
121
- render.current = true;
122
- return () => {
123
- render.current = false;
124
- };
125
- }, []);
126
- };
127
-
128
- //#endregion
129
- //#region src/core/machine.ts
130
- function useMachine(machine, userProps = {}) {
131
- const scope = (0, react.useMemo)(() => {
132
- const { id, ids, getRootNode } = userProps;
133
- return (0, __sprawlify_primitives_core.createScope)({
134
- id,
135
- ids,
136
- getRootNode
137
- });
138
- }, [userProps]);
139
- const debug = (...args) => {
140
- if (machine.debug) console.log(...args);
141
- };
142
- const prop = useProp(machine.props?.({
143
- props: (0, __sprawlify_primitives_utils.compact)(userProps),
144
- scope
145
- }) ?? userProps);
146
- const context = machine.context?.({
147
- prop,
148
- bindable: useBindable,
149
- scope,
150
- flush,
151
- getContext() {
152
- return ctx;
153
- },
154
- getComputed() {
155
- return computed;
156
- },
157
- getRefs() {
158
- return refs;
159
- },
160
- getEvent() {
161
- return getEvent();
162
- }
163
- });
164
- const contextRef = useLiveRef(context);
165
- const ctx = {
166
- get(key) {
167
- return contextRef.current?.[key].ref.current;
168
- },
169
- set(key, value) {
170
- contextRef.current?.[key].set(value);
171
- },
172
- initial(key) {
173
- return contextRef.current?.[key].initial;
174
- },
175
- hash(key) {
176
- const current = contextRef.current?.[key].get();
177
- return contextRef.current?.[key].hash(current);
178
- }
179
- };
180
- const effects = (0, react.useRef)(/* @__PURE__ */ new Map());
181
- const transitionRef = (0, react.useRef)(null);
182
- const previousEventRef = (0, react.useRef)(null);
183
- const eventRef = (0, react.useRef)({ type: "" });
184
- const getEvent = () => ({
185
- ...eventRef.current,
186
- current() {
187
- return eventRef.current;
188
- },
189
- previous() {
190
- return previousEventRef.current;
191
- }
192
- });
193
- const getState = () => ({
194
- ...state,
195
- matches(...values) {
196
- return values.includes(state.ref.current);
197
- },
198
- hasTag(tag) {
199
- return !!machine.states[state.ref.current]?.tags?.includes(tag);
200
- }
201
- });
202
- const refs = useRefs(machine.refs?.({
203
- prop,
204
- context: ctx
205
- }) ?? {});
206
- const getParams = () => ({
207
- state: getState(),
208
- context: ctx,
209
- event: getEvent(),
210
- prop,
211
- send,
212
- action,
213
- guard,
214
- track: useTrack,
215
- refs,
216
- computed,
217
- flush,
218
- scope,
219
- choose
220
- });
221
- const action = (keys) => {
222
- const strs = (0, __sprawlify_primitives_utils.isFunction)(keys) ? keys(getParams()) : keys;
223
- if (!strs) return;
224
- const fns = strs.map((s) => {
225
- const fn = machine.implementations?.actions?.[s];
226
- if (!fn) (0, __sprawlify_primitives_utils.warn)(`[sprawlify-js] No implementation found for action "${JSON.stringify(s)}"`);
227
- return fn;
228
- });
229
- for (const fn of fns) fn?.(getParams());
230
- };
231
- const guard = (str) => {
232
- if ((0, __sprawlify_primitives_utils.isFunction)(str)) return str(getParams());
233
- return machine.implementations?.guards?.[str](getParams());
234
- };
235
- const effect = (keys) => {
236
- const strs = (0, __sprawlify_primitives_utils.isFunction)(keys) ? keys(getParams()) : keys;
237
- if (!strs) return;
238
- const fns = strs.map((s) => {
239
- const fn = machine.implementations?.effects?.[s];
240
- if (!fn) (0, __sprawlify_primitives_utils.warn)(`[sprawlify-js] No implementation found for effect "${JSON.stringify(s)}"`);
241
- return fn;
242
- });
243
- const cleanups = [];
244
- for (const fn of fns) {
245
- const cleanup = fn?.(getParams());
246
- if (cleanup) cleanups.push(cleanup);
247
- }
248
- return () => cleanups.forEach((fn) => fn?.());
249
- };
250
- const choose = (transitions) => {
251
- return (0, __sprawlify_primitives_utils.toArray)(transitions).find((t) => {
252
- let result = !t.guard;
253
- if ((0, __sprawlify_primitives_utils.isString)(t.guard)) result = !!guard(t.guard);
254
- else if ((0, __sprawlify_primitives_utils.isFunction)(t.guard)) result = t.guard(getParams());
255
- return result;
256
- });
257
- };
258
- const computed = (key) => {
259
- (0, __sprawlify_primitives_utils.ensure)(machine.computed, () => `[sprawlify-js] No computed object found on machine`);
260
- const fn = machine.computed[key];
261
- return fn({
262
- context: ctx,
263
- event: getEvent(),
264
- prop,
265
- refs,
266
- scope,
267
- computed
268
- });
269
- };
270
- const state = useBindable(() => ({
271
- defaultValue: machine.initialState({ prop }),
272
- onChange(nextState, prevState) {
273
- if (prevState) {
274
- effects.current.get(prevState)?.();
275
- effects.current.delete(prevState);
276
- }
277
- if (prevState) action(machine.states[prevState]?.exit);
278
- action(transitionRef.current?.actions);
279
- const cleanup = effect(machine.states[nextState]?.effects);
280
- if (cleanup) effects.current.set(nextState, cleanup);
281
- if (prevState === __sprawlify_primitives_core.INIT_STATE) {
282
- action(machine.entry);
283
- const cleanup$1 = effect(machine.effects);
284
- if (cleanup$1) effects.current.set(__sprawlify_primitives_core.INIT_STATE, cleanup$1);
285
- }
286
- action(machine.states[nextState]?.entry);
287
- }
288
- }));
289
- const hydratedStateRef = (0, react.useRef)(void 0);
290
- const statusRef = (0, react.useRef)(__sprawlify_primitives_core.MachineStatus.NotStarted);
291
- useSafeLayoutEffect(() => {
292
- queueMicrotask(() => {
293
- const started = statusRef.current === __sprawlify_primitives_core.MachineStatus.Started;
294
- statusRef.current = __sprawlify_primitives_core.MachineStatus.Started;
295
- debug(started ? "rehydrating..." : "initializing...");
296
- const initialState = hydratedStateRef.current ?? state.initial;
297
- state.invoke(initialState, started ? state.get() : __sprawlify_primitives_core.INIT_STATE);
298
- });
299
- const fns = effects.current;
300
- const currentState = state.ref.current;
301
- return () => {
302
- debug("unmounting...");
303
- hydratedStateRef.current = currentState;
304
- statusRef.current = __sprawlify_primitives_core.MachineStatus.Stopped;
305
- fns.forEach((fn) => fn?.());
306
- effects.current = /* @__PURE__ */ new Map();
307
- transitionRef.current = null;
308
- queueMicrotask(() => {
309
- action(machine.exit);
310
- });
311
- };
312
- }, []);
313
- const getCurrentState = () => {
314
- if ("ref" in state) return state.ref.current;
315
- return state.get();
316
- };
317
- const send = (event) => {
318
- queueMicrotask(() => {
319
- if (statusRef.current !== __sprawlify_primitives_core.MachineStatus.Started) return;
320
- previousEventRef.current = eventRef.current;
321
- eventRef.current = event;
322
- const currentState = getCurrentState();
323
- const transition = choose(machine.states[currentState].on?.[event.type] ?? machine.on?.[event.type]);
324
- if (!transition) return;
325
- transitionRef.current = transition;
326
- const target = transition.target ?? currentState;
327
- debug("transition", event.type, transition.target || currentState, `(${transition.actions})`);
328
- const changed = target !== currentState;
329
- if (changed) (0, react_dom.flushSync)(() => state.set(target));
330
- else if (transition.reenter && !changed) state.invoke(currentState, currentState);
331
- else action(transition.actions ?? []);
332
- });
333
- };
334
- machine.watch?.(getParams());
335
- return {
336
- state: getState(),
337
- send,
338
- context: ctx,
339
- prop,
340
- scope,
341
- refs,
342
- computed,
343
- event: getEvent(),
344
- getStatus: () => statusRef.current
345
- };
346
- }
347
- function useLiveRef(value) {
348
- const ref = (0, react.useRef)(value);
349
- ref.current = value;
350
- return ref;
351
- }
352
- function useProp(value) {
353
- const ref = useLiveRef(value);
354
- return function get(key) {
355
- return ref.current[key];
356
- };
357
- }
358
- function flush(fn) {
359
- queueMicrotask(() => {
360
- (0, react_dom.flushSync)(() => fn());
361
- });
362
- }
363
-
364
- //#endregion
365
- //#region src/core/normalize-props.ts
366
- const normalizeProps = (0, __sprawlify_primitives_types.createNormalizer)((v) => v);
367
-
368
- //#endregion
369
- //#region src/core/portal.tsx
370
- const Portal = (props) => {
371
- const { children, container, disabled, getRootNode } = props;
372
- if (typeof window === "undefined" || disabled) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Fragment, { children });
373
- const doc = getRootNode?.().ownerDocument ?? document;
374
- const mountNode = container?.current ?? doc.body;
375
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Fragment, { children: react.Children.map(children, (child) => (0, react_dom.createPortal)(child, mountNode)) });
376
- };
377
-
378
- //#endregion
379
- //#region src/utils/run-if-fn.ts
380
- const isFunction = (value) => typeof value === "function";
381
- const runIfFn = (valueOrFn, ...args) => isFunction(valueOrFn) ? valueOrFn(...args) : valueOrFn;
382
-
383
- //#endregion
384
- //#region src/providers/environment/use-environment-context.ts
385
- const [EnvironmentContextProvider, useEnvironmentContext] = require_utils.createContext({
386
- name: "EnvironmentContext",
387
- hookName: "useEnvironmentContext",
388
- providerName: "<EnvironmentProvider />",
389
- strict: false,
390
- defaultValue: {
391
- getRootNode: () => document,
392
- getDocument: () => document,
393
- getWindow: () => window
394
- }
395
- });
396
-
397
- //#endregion
398
- //#region src/providers/environment/environment-provider.tsx
399
- const EnvironmentProvider = (props) => {
400
- const { value, children } = props;
401
- const [spanRef, setSpanRef] = (0, react.useState)();
402
- const getRootNode = (0, react.useMemo)(() => {
403
- return () => runIfFn(value) ?? spanRef?.getRootNode() ?? document;
404
- }, [value, spanRef]);
405
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(EnvironmentContextProvider, {
406
- value: (0, react.useMemo)(() => ({
407
- getRootNode,
408
- getWindow: () => (0, __sprawlify_primitives_dom_query.getWindow)(getRootNode()),
409
- getDocument: () => (0, __sprawlify_primitives_dom_query.getDocument)(getRootNode())
410
- }), [getRootNode]),
411
- children: [children, !value && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
412
- hidden: true,
413
- ref: setSpanRef
414
- })]
415
- });
416
- };
417
-
418
- //#endregion
419
- //#region src/providers/locale/use-locale-context.ts
420
- const [LocaleContextProvider, useLocaleContext] = require_utils.createContext({
421
- name: "LocaleContext",
422
- hookName: "useLocaleContext",
423
- providerName: "<LocaleProvider />",
424
- strict: false,
425
- defaultValue: {
426
- dir: "ltr",
427
- locale: "en-US"
428
- }
429
- });
430
-
431
- //#endregion
432
- //#region src/providers/locale/locale-provider.tsx
433
- const LocaleProvider = (props) => {
434
- const { children, locale } = props;
435
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LocaleContextProvider, {
436
- value: {
437
- locale,
438
- dir: (0, __sprawlify_primitives_i18n_utils.isRTL)(locale) ? "rtl" : "ltr"
439
- },
440
- children
441
- });
442
- };
443
-
444
- //#endregion
445
- //#region src/providers/locale/use-collator.ts
446
- function useCollator(props = {}) {
447
- const env = useLocaleContext();
448
- const locale = props.locale ?? env.locale;
449
- return (0, react.useMemo)(() => {
450
- const { locale: _, ...options } = props;
451
- return (0, __sprawlify_primitives_i18n_utils.createCollator)(locale, options);
452
- }, [locale, props]);
453
- }
454
-
455
- //#endregion
456
- //#region src/providers/locale/use-filter.ts
457
- function useFilter(props) {
458
- const env = useLocaleContext();
459
- const locale = props.locale ?? env.locale;
460
- return (0, react.useMemo)(() => (0, __sprawlify_primitives_i18n_utils.createFilter)({
461
- ...props,
462
- locale
463
- }), [locale, props]);
464
- }
465
-
466
- //#endregion
467
- //#region src/utils/compose-refs.ts
468
- function composeRefs(...refs) {
469
- return (node) => {
470
- const cleanUps = [];
471
- for (const ref of refs) if (typeof ref === "function") {
472
- const cb = ref(node);
473
- if (typeof cb === "function") cleanUps.push(cb);
474
- } else if (ref) ref.current = node;
475
- if (cleanUps.length) return () => {
476
- for (const cleanUp of cleanUps) cleanUp();
477
- };
478
- };
479
- }
480
-
481
- //#endregion
482
- //#region src/components/factory.ts
483
- function getRef(element) {
484
- let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
485
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
486
- if (mayWarn) return element.ref;
487
- getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
488
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
489
- if (mayWarn) return element.props.ref;
490
- return element.props.ref || element.ref;
491
- }
492
- const withAsChild = (Component) => {
493
- const Comp = (0, react.memo)((0, react.forwardRef)((props, ref) => {
494
- const { asChild, children, ...restProps } = props;
495
- if (!asChild) return (0, react.createElement)(Component, {
496
- ...restProps,
497
- ref
498
- }, children);
499
- if (!(0, react.isValidElement)(children)) return null;
500
- const onlyChild = react.Children.only(children);
501
- const childRef = getRef(onlyChild);
502
- return (0, react.cloneElement)(onlyChild, {
503
- ...(0, __sprawlify_primitives_core.mergeProps)(restProps, onlyChild.props),
504
- ref: ref ? composeRefs(ref, childRef) : childRef
505
- });
506
- }));
507
- Comp.displayName = typeof Component === "string" ? Component : Component.displayName || Component.name;
508
- return Comp;
509
- };
510
- const jsxFactory = () => {
511
- const cache = /* @__PURE__ */ new Map();
512
- return new Proxy(withAsChild, {
513
- apply(_target, _thisArg, argArray) {
514
- return withAsChild(argArray[0]);
515
- },
516
- get(_, element) {
517
- const asElement = element;
518
- if (!cache.has(asElement)) cache.set(asElement, withAsChild(asElement));
519
- return cache.get(asElement);
520
- }
521
- });
522
- };
523
- const sprawlify = jsxFactory();
524
5
 
525
- //#endregion
526
- exports.EnvironmentProvider = EnvironmentProvider;
527
- exports.LocaleProvider = LocaleProvider;
528
- exports.Portal = Portal;
529
- exports.__toESM = __toESM;
530
- exports.createContext = require_utils.createContext;
531
- exports.jsxFactory = jsxFactory;
532
- exports.normalizeProps = normalizeProps;
533
- exports.sprawlify = sprawlify;
534
- exports.useCollator = useCollator;
535
- exports.useEnvironmentContext = useEnvironmentContext;
536
- exports.useFilter = useFilter;
537
- exports.useLocaleContext = useLocaleContext;
538
- exports.useMachine = useMachine;
6
+ exports.EnvironmentProvider = require_factory.EnvironmentProvider;
7
+ exports.LocaleProvider = require_factory.LocaleProvider;
8
+ exports.Portal = require_factory.Portal;
9
+ exports.createContext = require_create_context.createContext;
10
+ exports.jsxFactory = require_factory.jsxFactory;
11
+ exports.normalizeProps = require_factory.normalizeProps;
12
+ exports.sprawlify = require_factory.sprawlify;
13
+ exports.useCollator = require_factory.useCollator;
14
+ exports.useEnvironmentContext = require_factory.useEnvironmentContext;
15
+ exports.useFilter = require_factory.useFilter;
16
+ exports.useLocaleContext = require_factory.useLocaleContext;
17
+ exports.useMachine = require_factory.useMachine;
package/dist/index.d.cts CHANGED
@@ -1,22 +1,13 @@
1
- import { n as createContext } from "./index-D-QxCLG0.cjs";
1
+ import { a as sprawlify, c as PropTypes, i as jsxFactory, l as normalizeProps, n as HTMLSprawlifyProps, o as Assign, r as PolymorphicProps, s as Optional, t as HTMLProps } from "./factory-B3Fr36su.cjs";
2
+ import { n as createContext } from "./index-Bk-VrHD9.cjs";
3
+ import { JSX, PropsWithChildren, ReactNode, RefObject } from "react";
2
4
  import { Machine, MachineSchema, Service } from "@sprawlify/primitives/core";
3
- import * as _sprawlify_primitives_types0 from "@sprawlify/primitives/types";
4
- import React, { CSSProperties, ComponentPropsWithoutRef, HTMLAttributes, JSX, PropsWithChildren, ReactNode, RefObject } from "react";
5
5
  import * as react_jsx_runtime0 from "react/jsx-runtime";
6
6
  import { FilterOptions, FilterReturn, Locale } from "@sprawlify/primitives/i18n-utils";
7
7
 
8
8
  //#region src/core/machine.d.ts
9
9
  declare function useMachine<T extends MachineSchema>(machine: Machine<T>, userProps?: Partial<T["props"]>): Service<T>;
10
10
  //#endregion
11
- //#region src/core/normalize-props.d.ts
12
- type WithoutRef<T> = Omit<T, "ref">;
13
- type ElementsWithoutRef = { [K in keyof JSX.IntrinsicElements]: WithoutRef<JSX.IntrinsicElements[K]> };
14
- type PropTypes = ElementsWithoutRef & {
15
- element: WithoutRef<HTMLAttributes<HTMLElement>>;
16
- style: CSSProperties;
17
- };
18
- declare const normalizeProps: _sprawlify_primitives_types0.NormalizeProps<PropTypes>;
19
- //#endregion
20
11
  //#region src/core/portal.d.ts
21
12
  interface PortalProps {
22
13
  disabled?: boolean | undefined;
@@ -60,20 +51,4 @@ interface UseFilterReturn extends FilterReturn {}
60
51
  //#region src/providers/locale/use-locale-context.d.ts
61
52
  interface UseLocaleContext extends Locale {}
62
53
  //#endregion
63
- //#region src/types.d.ts
64
- type Assign<T, U> = Omit<T, keyof U> & U;
65
- type Optional<T, K$1 extends keyof T> = Pick<Partial<T>, K$1> & Omit<T, K$1>;
66
- //#endregion
67
- //#region src/components/factory.d.ts
68
- interface PolymorphicProps {
69
- asChild?: boolean | undefined;
70
- }
71
- type JsxElements = { [E in keyof JSX.IntrinsicElements]: SprawlifyForwardRefComponent<E> };
72
- type SprawlifyForwardRefComponent<E$1 extends React.ElementType> = React.ForwardRefExoticComponent<SprawlifyPropsWithRef<E$1>>;
73
- type SprawlifyPropsWithRef<E$1 extends React.ElementType> = React.ComponentPropsWithRef<E$1> & PolymorphicProps;
74
- type HTMLProps<T extends keyof JSX.IntrinsicElements> = ComponentPropsWithoutRef<T>;
75
- type HTMLSprawlifyProps<T extends keyof JSX.IntrinsicElements> = HTMLProps<T> & PolymorphicProps;
76
- declare const jsxFactory: () => JsxElements;
77
- declare const sprawlify: JsxElements;
78
- //#endregion
79
54
  export { type Assign, EnvironmentProvider, EnvironmentProviderProps, HTMLProps, HTMLSprawlifyProps, LocaleProvider, LocaleProviderProps, type Optional, PolymorphicProps, Portal, PortalProps, PropTypes, RootNode, UseCollatorProps, UseEnvironmentContext, UseFilterProps, UseFilterReturn, UseLocaleContext, createContext, jsxFactory, normalizeProps, sprawlify, useCollator, useEnvironmentContext, useFilter, useLocaleContext, useMachine };
package/dist/index.d.mts CHANGED
@@ -1,30 +1,9 @@
1
- import { n as createContext } from "./index-BbV54I7I.mjs";
2
- import { Machine, MachineSchema, Service } from "@sprawlify/primitives/core";
3
- import React, { CSSProperties, ComponentPropsWithoutRef, HTMLAttributes, JSX, PropsWithChildren, ReactNode, RefObject } from "react";
4
- import * as _sprawlify_primitives_types0 from "@sprawlify/primitives/types";
1
+ import { a as sprawlify, c as Portal, d as normalizeProps, f as useMachine, i as jsxFactory, l as PortalProps, n as HTMLSprawlifyProps, o as Assign, r as PolymorphicProps, s as Optional, t as HTMLProps, u as PropTypes } from "./factory-BV5hc6hz.mjs";
2
+ import { n as createContext } from "./index-lntzaDM3.mjs";
3
+ import { PropsWithChildren, ReactNode } from "react";
5
4
  import * as react_jsx_runtime0 from "react/jsx-runtime";
6
5
  import { FilterOptions, FilterReturn, Locale } from "@sprawlify/primitives/i18n-utils";
7
6
 
8
- //#region src/core/machine.d.ts
9
- declare function useMachine<T extends MachineSchema>(machine: Machine<T>, userProps?: Partial<T["props"]>): Service<T>;
10
- //#endregion
11
- //#region src/core/normalize-props.d.ts
12
- type WithoutRef<T> = Omit<T, "ref">;
13
- type ElementsWithoutRef = { [K in keyof JSX.IntrinsicElements]: WithoutRef<JSX.IntrinsicElements[K]> };
14
- type PropTypes = ElementsWithoutRef & {
15
- element: WithoutRef<HTMLAttributes<HTMLElement>>;
16
- style: CSSProperties;
17
- };
18
- declare const normalizeProps: _sprawlify_primitives_types0.NormalizeProps<PropTypes>;
19
- //#endregion
20
- //#region src/core/portal.d.ts
21
- interface PortalProps {
22
- disabled?: boolean | undefined;
23
- container?: RefObject<HTMLElement> | undefined;
24
- getRootNode?: (() => ShadowRoot | Document | Node) | undefined;
25
- }
26
- declare const Portal: (props: PropsWithChildren<PortalProps>) => JSX.Element;
27
- //#endregion
28
7
  //#region src/providers/environment/use-environment-context.d.ts
29
8
  type RootNode = ShadowRoot | Document | Node;
30
9
  interface UseEnvironmentContext {
@@ -60,20 +39,4 @@ interface UseFilterReturn extends FilterReturn {}
60
39
  //#region src/providers/locale/use-locale-context.d.ts
61
40
  interface UseLocaleContext extends Locale {}
62
41
  //#endregion
63
- //#region src/types.d.ts
64
- type Assign<T, U> = Omit<T, keyof U> & U;
65
- type Optional<T, K$1 extends keyof T> = Pick<Partial<T>, K$1> & Omit<T, K$1>;
66
- //#endregion
67
- //#region src/components/factory.d.ts
68
- interface PolymorphicProps {
69
- asChild?: boolean | undefined;
70
- }
71
- type JsxElements = { [E in keyof JSX.IntrinsicElements]: SprawlifyForwardRefComponent<E> };
72
- type SprawlifyForwardRefComponent<E$1 extends React.ElementType> = React.ForwardRefExoticComponent<SprawlifyPropsWithRef<E$1>>;
73
- type SprawlifyPropsWithRef<E$1 extends React.ElementType> = React.ComponentPropsWithRef<E$1> & PolymorphicProps;
74
- type HTMLProps<T extends keyof JSX.IntrinsicElements> = ComponentPropsWithoutRef<T>;
75
- type HTMLSprawlifyProps<T extends keyof JSX.IntrinsicElements> = HTMLProps<T> & PolymorphicProps;
76
- declare const jsxFactory: () => JsxElements;
77
- declare const sprawlify: JsxElements;
78
- //#endregion
79
42
  export { type Assign, EnvironmentProvider, type EnvironmentProviderProps, HTMLProps, HTMLSprawlifyProps, LocaleProvider, type LocaleProviderProps, type Optional, PolymorphicProps, Portal, PortalProps, PropTypes, type RootNode, type UseCollatorProps, type UseEnvironmentContext, type UseFilterProps, type UseFilterReturn, type UseLocaleContext, createContext, jsxFactory, normalizeProps, sprawlify, useCollator, useEnvironmentContext, useFilter, useLocaleContext, useMachine };