@sprawlify/react 0.0.6 → 0.0.8
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.
- package/dist/chunk-BYnRvbsk.cjs +53 -0
- package/dist/{collapsible-DYgHs1_i.mjs → collapsible-Nbt3Sequ.mjs} +7 -4
- package/dist/{collapsible-D_cXuaRy.cjs → collapsible-aFKYmVbP.cjs} +13 -9
- package/dist/collection-DGEUORi5.cjs +230 -0
- package/dist/collection-DQWWySNV.mjs +187 -0
- package/dist/components/accordion/index.cjs +21 -24
- package/dist/components/accordion/index.d.cts +11 -9
- package/dist/components/accordion/index.d.mts +11 -9
- package/dist/components/accordion/index.mjs +10 -14
- package/dist/components/angle-slider/index.cjs +14 -9
- package/dist/components/angle-slider/index.d.cts +13 -11
- package/dist/components/angle-slider/index.d.mts +13 -11
- package/dist/components/angle-slider/index.mjs +8 -4
- package/dist/components/avatar/index.cjs +14 -9
- package/dist/components/avatar/index.d.cts +8 -6
- package/dist/components/avatar/index.d.mts +8 -6
- package/dist/components/avatar/index.mjs +8 -4
- package/dist/components/bottom-sheet/index.cjs +216 -0
- package/dist/components/bottom-sheet/index.d.cts +80 -0
- package/dist/components/bottom-sheet/index.d.mts +81 -0
- package/dist/components/bottom-sheet/index.mjs +192 -0
- package/dist/components/carousel/index.cjs +265 -0
- package/dist/components/carousel/index.d.cts +95 -0
- package/dist/components/carousel/index.d.mts +95 -0
- package/dist/components/carousel/index.mjs +243 -0
- package/dist/components/checkbox/index.cjs +311 -0
- package/dist/components/checkbox/index.d.cts +115 -0
- package/dist/components/checkbox/index.d.mts +115 -0
- package/dist/components/checkbox/index.mjs +291 -0
- package/dist/components/client-only/index.cjs +14 -0
- package/dist/components/client-only/index.d.cts +8 -0
- package/dist/components/client-only/index.d.mts +8 -0
- package/dist/components/client-only/index.mjs +13 -0
- package/dist/components/clipboard/index.cjs +186 -0
- package/dist/components/clipboard/index.d.cts +71 -0
- package/dist/components/clipboard/index.d.mts +71 -0
- package/dist/components/clipboard/index.mjs +163 -0
- package/dist/components/collapsible/index.cjs +8 -3
- package/dist/components/collapsible/index.d.cts +10 -8
- package/dist/components/collapsible/index.d.mts +10 -8
- package/dist/components/collapsible/index.mjs +7 -3
- package/dist/components/collection/index.cjs +11 -0
- package/dist/components/collection/index.d.cts +2 -0
- package/dist/components/collection/index.d.mts +2 -0
- package/dist/components/collection/index.mjs +5 -0
- package/dist/components/color-picker/index.cjs +617 -0
- package/dist/components/color-picker/index.d.cts +181 -0
- package/dist/components/color-picker/index.d.mts +182 -0
- package/dist/components/color-picker/index.mjs +573 -0
- package/dist/components/combobox/index.cjs +420 -0
- package/dist/components/combobox/index.d.cts +132 -0
- package/dist/components/combobox/index.d.mts +133 -0
- package/dist/components/combobox/index.mjs +390 -0
- package/dist/components/date-picker/index.cjs +567 -0
- package/dist/components/date-picker/index.d.cts +164 -0
- package/dist/components/date-picker/index.d.mts +165 -0
- package/dist/components/date-picker/index.mjs +526 -0
- package/dist/components/dialog/index.cjs +211 -0
- package/dist/components/dialog/index.d.cts +80 -0
- package/dist/components/dialog/index.d.mts +81 -0
- package/dist/components/dialog/index.mjs +187 -0
- package/dist/components/download-trigger/index.cjs +43 -0
- package/dist/components/download-trigger/index.d.cts +16 -0
- package/dist/components/download-trigger/index.d.mts +16 -0
- package/dist/components/download-trigger/index.mjs +42 -0
- package/dist/components/editable/index.cjs +246 -0
- package/dist/components/editable/index.d.cts +79 -0
- package/dist/components/editable/index.d.mts +79 -0
- package/dist/components/editable/index.mjs +221 -0
- package/dist/components/field/index.cjs +29 -0
- package/dist/components/field/index.d.cts +116 -0
- package/dist/components/field/index.d.mts +116 -0
- package/dist/components/field/index.mjs +11 -0
- package/dist/components/fieldset/index.cjs +25 -0
- package/dist/components/fieldset/index.d.cts +73 -0
- package/dist/components/fieldset/index.d.mts +73 -0
- package/dist/components/fieldset/index.mjs +11 -0
- package/dist/components/file-upload/index.cjs +351 -0
- package/dist/components/file-upload/index.d.cts +102 -0
- package/dist/components/file-upload/index.d.mts +102 -0
- package/dist/components/file-upload/index.mjs +322 -0
- package/dist/components/floating-panel/index.cjs +287 -0
- package/dist/components/floating-panel/index.d.cts +100 -0
- package/dist/components/floating-panel/index.d.mts +101 -0
- package/dist/components/floating-panel/index.mjs +259 -0
- package/dist/components/focus-trap/index.cjs +36 -0
- package/dist/components/focus-trap/index.d.cts +14 -0
- package/dist/components/focus-trap/index.d.mts +14 -0
- package/dist/components/focus-trap/index.mjs +35 -0
- package/dist/components/format/index.cjs +57 -0
- package/dist/components/format/index.d.cts +36 -0
- package/dist/components/format/index.d.mts +36 -0
- package/dist/components/format/index.mjs +49 -0
- package/dist/components/frame/index.cjs +90 -0
- package/dist/components/frame/index.d.cts +13 -0
- package/dist/components/frame/index.d.mts +13 -0
- package/dist/components/frame/index.mjs +89 -0
- package/dist/components/highlight/index.cjs +32 -0
- package/dist/components/highlight/index.d.cts +14 -0
- package/dist/components/highlight/index.d.mts +14 -0
- package/dist/components/highlight/index.mjs +30 -0
- package/dist/components/portal/index.cjs +33 -0
- package/dist/components/portal/index.d.cts +11 -0
- package/dist/components/portal/index.d.mts +11 -0
- package/dist/components/portal/index.mjs +32 -0
- package/dist/components/presence/index.cjs +11 -0
- package/dist/components/presence/index.d.cts +2 -0
- package/dist/components/presence/index.d.mts +4 -0
- package/dist/components/presence/index.mjs +7 -0
- package/dist/components/select/index.cjs +423 -0
- package/dist/components/select/index.d.cts +132 -0
- package/dist/components/select/index.d.mts +133 -0
- package/dist/components/select/index.mjs +387 -0
- package/dist/compose-refs-BEptPEkE.mjs +16 -0
- package/dist/compose-refs-C5QNDywq.cjs +22 -0
- package/dist/{factory-DN0EdT7u.mjs → core-Ba4IEjhK.mjs} +4 -154
- package/dist/{factory-CfqPG186.cjs → core-DCWyxy9D.cjs} +2 -251
- package/dist/{create-context-DCEySQ7J.cjs → create-context-CQ4U0lLj.cjs} +1 -1
- package/dist/environment-CvilmfQt.cjs +58 -0
- package/dist/environment-Ded7DkGr.mjs +46 -0
- package/dist/factory-Bi8oEg8i.mjs +49 -0
- package/dist/factory-C-EBNsCW.d.mts +15 -0
- package/dist/factory-C166evrS.cjs +61 -0
- package/dist/factory-C4cfTHs7.d.cts +15 -0
- package/dist/field-B-6qoKdn.mjs +324 -0
- package/dist/field-C-57Gj2E.cjs +406 -0
- package/dist/fieldset-B-MkM2Ms.cjs +239 -0
- package/dist/fieldset-gaVneDYh.mjs +186 -0
- package/dist/index-BJvW7OpY.d.mts +25 -0
- package/dist/index-BhGgEHWc.d.cts +34 -0
- package/dist/index-ByIsf4E7.d.mts +74 -0
- package/dist/index-Cp1i1zbg.d.mts +34 -0
- package/dist/index-CumJbg8V.d.cts +74 -0
- package/dist/index.cjs +17 -12
- package/dist/index.d.cts +7 -5
- package/dist/index.d.mts +7 -5
- package/dist/index.mjs +7 -3
- package/dist/locale-BcnWD1Hf.cjs +78 -0
- package/dist/locale-Coin-d7R.mjs +54 -0
- package/dist/normalize-props-skGwa8Dk.d.cts +13 -0
- package/dist/presence-Bc6Bxe5i.mjs +72 -0
- package/dist/presence-CPov8wyU.cjs +103 -0
- package/dist/providers-BNAArubQ.cjs +0 -0
- package/dist/providers-Dm2P3F2_.mjs +1 -0
- package/dist/render-strategy-BywM_IvB.cjs +30 -0
- package/dist/render-strategy-FiPgAp1U.mjs +13 -0
- package/dist/types-B4tvWlDb.d.cts +6 -0
- package/dist/types-BmBABPZb.d.mts +6 -0
- package/dist/use-event-4J5QFFqK.mjs +19 -0
- package/dist/use-event-CLH8zHoJ.cjs +25 -0
- package/dist/use-fieldset-context-CCQLmNLL.cjs +23 -0
- package/dist/use-fieldset-context-LwveT1OS.mjs +12 -0
- package/dist/use-safe-layout-effect-C2GgvNT3.cjs +13 -0
- package/dist/use-safe-layout-effect-CLjnuJFb.mjs +7 -0
- package/dist/utils/index.cjs +3 -3
- package/dist/utils/index.d.cts +1 -1
- package/dist/utils/index.d.mts +1 -1
- package/dist/utils/index.mjs +2 -2
- package/package.json +232 -2
- package/dist/factory-BZBSaT-0.d.cts +0 -29
- package/dist/factory-DaVMAttY.d.mts +0 -41
- /package/dist/{chunk-CYMnug_4.mjs → chunk-BXPHTOwk.mjs} +0 -0
- /package/dist/{create-context-DGYD_HQt.mjs → create-context-CCXzjEv8.mjs} +0 -0
- /package/dist/{create-split-props-BFscidWy.mjs → create-split-props-CBL0m-GX.mjs} +0 -0
- /package/dist/{create-split-props-CSaOnJRj.cjs → create-split-props-Dp4TWOyM.cjs} +0 -0
- /package/dist/{index-OOf7QNG5.d.mts → index-CureNJdc.d.mts} +0 -0
- /package/dist/{index-DiYk6N_L.d.cts → index-dbTyAXLy.d.cts} +0 -0
- /package/dist/{render-strategy--1FNKx5x.d.mts → render-strategy-C8IyLw0O.d.mts} +0 -0
- /package/dist/{render-strategy-RT-KvAqO.d.cts → render-strategy-rA4C5NUX.d.cts} +0 -0
- /package/dist/{utils-Cb5K29pi.cjs → utils-B_Ojepvp.cjs} +0 -0
- /package/dist/{utils-nfWHwVIS.mjs → utils-C-m3mZWI.mjs} +0 -0
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { INIT_STATE, MachineStatus, createScope, mergeProps, mergeProps as mergeProps$1 } from "@sprawlify/primitives/core";
|
|
1
|
+
import { INIT_STATE, MachineStatus, createScope, mergeProps as mergeProps$1 } from "@sprawlify/primitives/core";
|
|
3
2
|
import { compact, ensure, identity, isFunction, isString, toArray, warn } from "@sprawlify/primitives/utils";
|
|
4
3
|
import * as React$1 from "react";
|
|
5
|
-
import {
|
|
4
|
+
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
6
5
|
import { createPortal, flushSync } from "react-dom";
|
|
7
6
|
import { createNormalizer } from "@sprawlify/primitives/types";
|
|
8
|
-
import { jsx
|
|
9
|
-
import { getDocument, getWindow } from "@sprawlify/primitives/dom-query";
|
|
10
|
-
import { createCollator, createFilter, isRTL } from "@sprawlify/primitives/i18n-utils";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
11
8
|
|
|
12
9
|
//#region src/core/use-layout-effect.ts
|
|
13
10
|
const useSafeLayoutEffect = typeof globalThis.document !== "undefined" ? useLayoutEffect : useEffect;
|
|
@@ -349,151 +346,4 @@ const Portal = (props) => {
|
|
|
349
346
|
};
|
|
350
347
|
|
|
351
348
|
//#endregion
|
|
352
|
-
|
|
353
|
-
const isFunction$1 = (value) => typeof value === "function";
|
|
354
|
-
const runIfFn = (valueOrFn, ...args) => isFunction$1(valueOrFn) ? valueOrFn(...args) : valueOrFn;
|
|
355
|
-
|
|
356
|
-
//#endregion
|
|
357
|
-
//#region src/providers/environment/use-environment-context.ts
|
|
358
|
-
const [EnvironmentContextProvider, useEnvironmentContext] = createContext$1({
|
|
359
|
-
name: "EnvironmentContext",
|
|
360
|
-
hookName: "useEnvironmentContext",
|
|
361
|
-
providerName: "<EnvironmentProvider />",
|
|
362
|
-
strict: false,
|
|
363
|
-
defaultValue: {
|
|
364
|
-
getRootNode: () => document,
|
|
365
|
-
getDocument: () => document,
|
|
366
|
-
getWindow: () => window
|
|
367
|
-
}
|
|
368
|
-
});
|
|
369
|
-
|
|
370
|
-
//#endregion
|
|
371
|
-
//#region src/providers/environment/environment-provider.tsx
|
|
372
|
-
const EnvironmentProvider = (props) => {
|
|
373
|
-
const { value, children } = props;
|
|
374
|
-
const [spanRef, setSpanRef] = useState();
|
|
375
|
-
const getRootNode = useMemo(() => {
|
|
376
|
-
return () => runIfFn(value) ?? spanRef?.getRootNode() ?? document;
|
|
377
|
-
}, [value, spanRef]);
|
|
378
|
-
return /* @__PURE__ */ jsxs(EnvironmentContextProvider, {
|
|
379
|
-
value: useMemo(() => ({
|
|
380
|
-
getRootNode,
|
|
381
|
-
getWindow: () => getWindow(getRootNode()),
|
|
382
|
-
getDocument: () => getDocument(getRootNode())
|
|
383
|
-
}), [getRootNode]),
|
|
384
|
-
children: [children, !value && /* @__PURE__ */ jsx("span", {
|
|
385
|
-
hidden: true,
|
|
386
|
-
ref: setSpanRef
|
|
387
|
-
})]
|
|
388
|
-
});
|
|
389
|
-
};
|
|
390
|
-
|
|
391
|
-
//#endregion
|
|
392
|
-
//#region src/providers/locale/use-locale-context.ts
|
|
393
|
-
const [LocaleContextProvider, useLocaleContext] = createContext$1({
|
|
394
|
-
name: "LocaleContext",
|
|
395
|
-
hookName: "useLocaleContext",
|
|
396
|
-
providerName: "<LocaleProvider />",
|
|
397
|
-
strict: false,
|
|
398
|
-
defaultValue: {
|
|
399
|
-
dir: "ltr",
|
|
400
|
-
locale: "en-US"
|
|
401
|
-
}
|
|
402
|
-
});
|
|
403
|
-
|
|
404
|
-
//#endregion
|
|
405
|
-
//#region src/providers/locale/locale-provider.tsx
|
|
406
|
-
const LocaleProvider = (props) => {
|
|
407
|
-
const { children, locale } = props;
|
|
408
|
-
return /* @__PURE__ */ jsx(LocaleContextProvider, {
|
|
409
|
-
value: {
|
|
410
|
-
locale,
|
|
411
|
-
dir: isRTL(locale) ? "rtl" : "ltr"
|
|
412
|
-
},
|
|
413
|
-
children
|
|
414
|
-
});
|
|
415
|
-
};
|
|
416
|
-
|
|
417
|
-
//#endregion
|
|
418
|
-
//#region src/providers/locale/use-collator.ts
|
|
419
|
-
function useCollator(props = {}) {
|
|
420
|
-
const env = useLocaleContext();
|
|
421
|
-
const locale = props.locale ?? env.locale;
|
|
422
|
-
return useMemo(() => {
|
|
423
|
-
const { locale: _, ...options } = props;
|
|
424
|
-
return createCollator(locale, options);
|
|
425
|
-
}, [locale, props]);
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
//#endregion
|
|
429
|
-
//#region src/providers/locale/use-filter.ts
|
|
430
|
-
function useFilter(props) {
|
|
431
|
-
const env = useLocaleContext();
|
|
432
|
-
const locale = props.locale ?? env.locale;
|
|
433
|
-
return useMemo(() => createFilter({
|
|
434
|
-
...props,
|
|
435
|
-
locale
|
|
436
|
-
}), [locale, props]);
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
//#endregion
|
|
440
|
-
//#region src/utils/compose-refs.ts
|
|
441
|
-
function composeRefs(...refs) {
|
|
442
|
-
return (node) => {
|
|
443
|
-
const cleanUps = [];
|
|
444
|
-
for (const ref of refs) if (typeof ref === "function") {
|
|
445
|
-
const cb = ref(node);
|
|
446
|
-
if (typeof cb === "function") cleanUps.push(cb);
|
|
447
|
-
} else if (ref) ref.current = node;
|
|
448
|
-
if (cleanUps.length) return () => {
|
|
449
|
-
for (const cleanUp of cleanUps) cleanUp();
|
|
450
|
-
};
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
//#endregion
|
|
455
|
-
//#region src/components/factory.ts
|
|
456
|
-
function getRef(element) {
|
|
457
|
-
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
458
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
459
|
-
if (mayWarn) return element.ref;
|
|
460
|
-
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
461
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
462
|
-
if (mayWarn) return element.props.ref;
|
|
463
|
-
return element.props.ref || element.ref;
|
|
464
|
-
}
|
|
465
|
-
const withAsChild = (Component) => {
|
|
466
|
-
const Comp = memo(forwardRef((props, ref) => {
|
|
467
|
-
const { asChild, children, ...restProps } = props;
|
|
468
|
-
if (!asChild) return createElement(Component, {
|
|
469
|
-
...restProps,
|
|
470
|
-
ref
|
|
471
|
-
}, children);
|
|
472
|
-
if (!isValidElement(children)) return null;
|
|
473
|
-
const onlyChild = Children.only(children);
|
|
474
|
-
const childRef = getRef(onlyChild);
|
|
475
|
-
return cloneElement(onlyChild, {
|
|
476
|
-
...mergeProps(restProps, onlyChild.props),
|
|
477
|
-
ref: ref ? composeRefs(ref, childRef) : childRef
|
|
478
|
-
});
|
|
479
|
-
}));
|
|
480
|
-
Comp.displayName = typeof Component === "string" ? Component : Component.displayName || Component.name;
|
|
481
|
-
return Comp;
|
|
482
|
-
};
|
|
483
|
-
const jsxFactory = () => {
|
|
484
|
-
const cache = /* @__PURE__ */ new Map();
|
|
485
|
-
return new Proxy(withAsChild, {
|
|
486
|
-
apply(_target, _thisArg, argArray) {
|
|
487
|
-
return withAsChild(argArray[0]);
|
|
488
|
-
},
|
|
489
|
-
get(_, element) {
|
|
490
|
-
const asElement = element;
|
|
491
|
-
if (!cache.has(asElement)) cache.set(asElement, withAsChild(asElement));
|
|
492
|
-
return cache.get(asElement);
|
|
493
|
-
}
|
|
494
|
-
});
|
|
495
|
-
};
|
|
496
|
-
const sprawlify = jsxFactory();
|
|
497
|
-
|
|
498
|
-
//#endregion
|
|
499
|
-
export { LocaleProvider as a, useEnvironmentContext as c, normalizeProps as d, useMachine as f, useCollator as i, mergeProps$1 as l, sprawlify as n, useLocaleContext as o, useFilter as r, EnvironmentProvider as s, jsxFactory as t, Portal as u };
|
|
349
|
+
export { useMachine as i, Portal as n, normalizeProps as r, mergeProps$1 as t };
|
|
@@ -1,53 +1,11 @@
|
|
|
1
|
-
|
|
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 __export = (all, symbols) => {
|
|
9
|
-
let target = {};
|
|
10
|
-
for (var name in all) {
|
|
11
|
-
__defProp(target, name, {
|
|
12
|
-
get: all[name],
|
|
13
|
-
enumerable: true
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
if (symbols) {
|
|
17
|
-
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
18
|
-
}
|
|
19
|
-
return target;
|
|
20
|
-
};
|
|
21
|
-
var __copyProps = (to, from, except, desc) => {
|
|
22
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
24
|
-
key = keys[i];
|
|
25
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
26
|
-
__defProp(to, key, {
|
|
27
|
-
get: ((k) => from[k]).bind(null, key),
|
|
28
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return to;
|
|
34
|
-
};
|
|
35
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
36
|
-
value: mod,
|
|
37
|
-
enumerable: true
|
|
38
|
-
}) : target, mod));
|
|
39
|
-
|
|
40
|
-
//#endregion
|
|
41
|
-
const require_create_context = require('./create-context-DCEySQ7J.cjs');
|
|
1
|
+
const require_chunk = require('./chunk-BYnRvbsk.cjs');
|
|
42
2
|
let __sprawlify_primitives_core = require("@sprawlify/primitives/core");
|
|
43
3
|
let __sprawlify_primitives_utils = require("@sprawlify/primitives/utils");
|
|
44
4
|
let react = require("react");
|
|
45
|
-
react = __toESM(react);
|
|
5
|
+
react = require_chunk.__toESM(react);
|
|
46
6
|
let react_dom = require("react-dom");
|
|
47
7
|
let __sprawlify_primitives_types = require("@sprawlify/primitives/types");
|
|
48
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
49
|
-
let __sprawlify_primitives_dom_query = require("@sprawlify/primitives/dom-query");
|
|
50
|
-
let __sprawlify_primitives_i18n_utils = require("@sprawlify/primitives/i18n-utils");
|
|
51
9
|
|
|
52
10
|
//#region src/core/use-layout-effect.ts
|
|
53
11
|
const useSafeLayoutEffect = typeof globalThis.document !== "undefined" ? react.useLayoutEffect : react.useEffect;
|
|
@@ -389,225 +347,18 @@ const Portal = (props) => {
|
|
|
389
347
|
};
|
|
390
348
|
|
|
391
349
|
//#endregion
|
|
392
|
-
//#region src/utils/run-if-fn.ts
|
|
393
|
-
const isFunction = (value) => typeof value === "function";
|
|
394
|
-
const runIfFn = (valueOrFn, ...args) => isFunction(valueOrFn) ? valueOrFn(...args) : valueOrFn;
|
|
395
|
-
|
|
396
|
-
//#endregion
|
|
397
|
-
//#region src/providers/environment/use-environment-context.ts
|
|
398
|
-
const [EnvironmentContextProvider, useEnvironmentContext] = require_create_context.createContext({
|
|
399
|
-
name: "EnvironmentContext",
|
|
400
|
-
hookName: "useEnvironmentContext",
|
|
401
|
-
providerName: "<EnvironmentProvider />",
|
|
402
|
-
strict: false,
|
|
403
|
-
defaultValue: {
|
|
404
|
-
getRootNode: () => document,
|
|
405
|
-
getDocument: () => document,
|
|
406
|
-
getWindow: () => window
|
|
407
|
-
}
|
|
408
|
-
});
|
|
409
|
-
|
|
410
|
-
//#endregion
|
|
411
|
-
//#region src/providers/environment/environment-provider.tsx
|
|
412
|
-
const EnvironmentProvider = (props) => {
|
|
413
|
-
const { value, children } = props;
|
|
414
|
-
const [spanRef, setSpanRef] = (0, react.useState)();
|
|
415
|
-
const getRootNode = (0, react.useMemo)(() => {
|
|
416
|
-
return () => runIfFn(value) ?? spanRef?.getRootNode() ?? document;
|
|
417
|
-
}, [value, spanRef]);
|
|
418
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(EnvironmentContextProvider, {
|
|
419
|
-
value: (0, react.useMemo)(() => ({
|
|
420
|
-
getRootNode,
|
|
421
|
-
getWindow: () => (0, __sprawlify_primitives_dom_query.getWindow)(getRootNode()),
|
|
422
|
-
getDocument: () => (0, __sprawlify_primitives_dom_query.getDocument)(getRootNode())
|
|
423
|
-
}), [getRootNode]),
|
|
424
|
-
children: [children, !value && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
425
|
-
hidden: true,
|
|
426
|
-
ref: setSpanRef
|
|
427
|
-
})]
|
|
428
|
-
});
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
//#endregion
|
|
432
|
-
//#region src/providers/locale/use-locale-context.ts
|
|
433
|
-
const [LocaleContextProvider, useLocaleContext] = require_create_context.createContext({
|
|
434
|
-
name: "LocaleContext",
|
|
435
|
-
hookName: "useLocaleContext",
|
|
436
|
-
providerName: "<LocaleProvider />",
|
|
437
|
-
strict: false,
|
|
438
|
-
defaultValue: {
|
|
439
|
-
dir: "ltr",
|
|
440
|
-
locale: "en-US"
|
|
441
|
-
}
|
|
442
|
-
});
|
|
443
|
-
|
|
444
|
-
//#endregion
|
|
445
|
-
//#region src/providers/locale/locale-provider.tsx
|
|
446
|
-
const LocaleProvider = (props) => {
|
|
447
|
-
const { children, locale } = props;
|
|
448
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LocaleContextProvider, {
|
|
449
|
-
value: {
|
|
450
|
-
locale,
|
|
451
|
-
dir: (0, __sprawlify_primitives_i18n_utils.isRTL)(locale) ? "rtl" : "ltr"
|
|
452
|
-
},
|
|
453
|
-
children
|
|
454
|
-
});
|
|
455
|
-
};
|
|
456
|
-
|
|
457
|
-
//#endregion
|
|
458
|
-
//#region src/providers/locale/use-collator.ts
|
|
459
|
-
function useCollator(props = {}) {
|
|
460
|
-
const env = useLocaleContext();
|
|
461
|
-
const locale = props.locale ?? env.locale;
|
|
462
|
-
return (0, react.useMemo)(() => {
|
|
463
|
-
const { locale: _, ...options } = props;
|
|
464
|
-
return (0, __sprawlify_primitives_i18n_utils.createCollator)(locale, options);
|
|
465
|
-
}, [locale, props]);
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
//#endregion
|
|
469
|
-
//#region src/providers/locale/use-filter.ts
|
|
470
|
-
function useFilter(props) {
|
|
471
|
-
const env = useLocaleContext();
|
|
472
|
-
const locale = props.locale ?? env.locale;
|
|
473
|
-
return (0, react.useMemo)(() => (0, __sprawlify_primitives_i18n_utils.createFilter)({
|
|
474
|
-
...props,
|
|
475
|
-
locale
|
|
476
|
-
}), [locale, props]);
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
//#endregion
|
|
480
|
-
//#region src/utils/compose-refs.ts
|
|
481
|
-
function composeRefs(...refs) {
|
|
482
|
-
return (node) => {
|
|
483
|
-
const cleanUps = [];
|
|
484
|
-
for (const ref of refs) if (typeof ref === "function") {
|
|
485
|
-
const cb = ref(node);
|
|
486
|
-
if (typeof cb === "function") cleanUps.push(cb);
|
|
487
|
-
} else if (ref) ref.current = node;
|
|
488
|
-
if (cleanUps.length) return () => {
|
|
489
|
-
for (const cleanUp of cleanUps) cleanUp();
|
|
490
|
-
};
|
|
491
|
-
};
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
//#endregion
|
|
495
|
-
//#region src/components/factory.ts
|
|
496
|
-
function getRef(element) {
|
|
497
|
-
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
498
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
499
|
-
if (mayWarn) return element.ref;
|
|
500
|
-
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
501
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
502
|
-
if (mayWarn) return element.props.ref;
|
|
503
|
-
return element.props.ref || element.ref;
|
|
504
|
-
}
|
|
505
|
-
const withAsChild = (Component) => {
|
|
506
|
-
const Comp = (0, react.memo)((0, react.forwardRef)((props, ref) => {
|
|
507
|
-
const { asChild, children, ...restProps } = props;
|
|
508
|
-
if (!asChild) return (0, react.createElement)(Component, {
|
|
509
|
-
...restProps,
|
|
510
|
-
ref
|
|
511
|
-
}, children);
|
|
512
|
-
if (!(0, react.isValidElement)(children)) return null;
|
|
513
|
-
const onlyChild = react.Children.only(children);
|
|
514
|
-
const childRef = getRef(onlyChild);
|
|
515
|
-
return (0, react.cloneElement)(onlyChild, {
|
|
516
|
-
...(0, __sprawlify_primitives_core.mergeProps)(restProps, onlyChild.props),
|
|
517
|
-
ref: ref ? composeRefs(ref, childRef) : childRef
|
|
518
|
-
});
|
|
519
|
-
}));
|
|
520
|
-
Comp.displayName = typeof Component === "string" ? Component : Component.displayName || Component.name;
|
|
521
|
-
return Comp;
|
|
522
|
-
};
|
|
523
|
-
const jsxFactory = () => {
|
|
524
|
-
const cache = /* @__PURE__ */ new Map();
|
|
525
|
-
return new Proxy(withAsChild, {
|
|
526
|
-
apply(_target, _thisArg, argArray) {
|
|
527
|
-
return withAsChild(argArray[0]);
|
|
528
|
-
},
|
|
529
|
-
get(_, element) {
|
|
530
|
-
const asElement = element;
|
|
531
|
-
if (!cache.has(asElement)) cache.set(asElement, withAsChild(asElement));
|
|
532
|
-
return cache.get(asElement);
|
|
533
|
-
}
|
|
534
|
-
});
|
|
535
|
-
};
|
|
536
|
-
const sprawlify = jsxFactory();
|
|
537
|
-
|
|
538
|
-
//#endregion
|
|
539
|
-
Object.defineProperty(exports, 'EnvironmentProvider', {
|
|
540
|
-
enumerable: true,
|
|
541
|
-
get: function () {
|
|
542
|
-
return EnvironmentProvider;
|
|
543
|
-
}
|
|
544
|
-
});
|
|
545
|
-
Object.defineProperty(exports, 'LocaleProvider', {
|
|
546
|
-
enumerable: true,
|
|
547
|
-
get: function () {
|
|
548
|
-
return LocaleProvider;
|
|
549
|
-
}
|
|
550
|
-
});
|
|
551
350
|
Object.defineProperty(exports, 'Portal', {
|
|
552
351
|
enumerable: true,
|
|
553
352
|
get: function () {
|
|
554
353
|
return Portal;
|
|
555
354
|
}
|
|
556
355
|
});
|
|
557
|
-
Object.defineProperty(exports, '__export', {
|
|
558
|
-
enumerable: true,
|
|
559
|
-
get: function () {
|
|
560
|
-
return __export;
|
|
561
|
-
}
|
|
562
|
-
});
|
|
563
|
-
Object.defineProperty(exports, '__toESM', {
|
|
564
|
-
enumerable: true,
|
|
565
|
-
get: function () {
|
|
566
|
-
return __toESM;
|
|
567
|
-
}
|
|
568
|
-
});
|
|
569
|
-
Object.defineProperty(exports, 'jsxFactory', {
|
|
570
|
-
enumerable: true,
|
|
571
|
-
get: function () {
|
|
572
|
-
return jsxFactory;
|
|
573
|
-
}
|
|
574
|
-
});
|
|
575
356
|
Object.defineProperty(exports, 'normalizeProps', {
|
|
576
357
|
enumerable: true,
|
|
577
358
|
get: function () {
|
|
578
359
|
return normalizeProps;
|
|
579
360
|
}
|
|
580
361
|
});
|
|
581
|
-
Object.defineProperty(exports, 'sprawlify', {
|
|
582
|
-
enumerable: true,
|
|
583
|
-
get: function () {
|
|
584
|
-
return sprawlify;
|
|
585
|
-
}
|
|
586
|
-
});
|
|
587
|
-
Object.defineProperty(exports, 'useCollator', {
|
|
588
|
-
enumerable: true,
|
|
589
|
-
get: function () {
|
|
590
|
-
return useCollator;
|
|
591
|
-
}
|
|
592
|
-
});
|
|
593
|
-
Object.defineProperty(exports, 'useEnvironmentContext', {
|
|
594
|
-
enumerable: true,
|
|
595
|
-
get: function () {
|
|
596
|
-
return useEnvironmentContext;
|
|
597
|
-
}
|
|
598
|
-
});
|
|
599
|
-
Object.defineProperty(exports, 'useFilter', {
|
|
600
|
-
enumerable: true,
|
|
601
|
-
get: function () {
|
|
602
|
-
return useFilter;
|
|
603
|
-
}
|
|
604
|
-
});
|
|
605
|
-
Object.defineProperty(exports, 'useLocaleContext', {
|
|
606
|
-
enumerable: true,
|
|
607
|
-
get: function () {
|
|
608
|
-
return useLocaleContext;
|
|
609
|
-
}
|
|
610
|
-
});
|
|
611
362
|
Object.defineProperty(exports, 'useMachine', {
|
|
612
363
|
enumerable: true,
|
|
613
364
|
get: function () {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-BYnRvbsk.cjs');
|
|
2
|
+
const require_create_context = require('./create-context-CQ4U0lLj.cjs');
|
|
3
|
+
let react = require("react");
|
|
4
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
+
let __sprawlify_primitives_dom_query = require("@sprawlify/primitives/dom-query");
|
|
6
|
+
|
|
7
|
+
//#region src/utils/run-if-fn.ts
|
|
8
|
+
const isFunction = (value) => typeof value === "function";
|
|
9
|
+
const runIfFn = (valueOrFn, ...args) => isFunction(valueOrFn) ? valueOrFn(...args) : valueOrFn;
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/providers/environment/use-environment-context.ts
|
|
13
|
+
const [EnvironmentContextProvider, useEnvironmentContext] = require_create_context.createContext({
|
|
14
|
+
name: "EnvironmentContext",
|
|
15
|
+
hookName: "useEnvironmentContext",
|
|
16
|
+
providerName: "<EnvironmentProvider />",
|
|
17
|
+
strict: false,
|
|
18
|
+
defaultValue: {
|
|
19
|
+
getRootNode: () => document,
|
|
20
|
+
getDocument: () => document,
|
|
21
|
+
getWindow: () => window
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/providers/environment/environment-provider.tsx
|
|
27
|
+
const EnvironmentProvider = (props) => {
|
|
28
|
+
const { value, children } = props;
|
|
29
|
+
const [spanRef, setSpanRef] = (0, react.useState)();
|
|
30
|
+
const getRootNode = (0, react.useMemo)(() => {
|
|
31
|
+
return () => runIfFn(value) ?? spanRef?.getRootNode() ?? document;
|
|
32
|
+
}, [value, spanRef]);
|
|
33
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(EnvironmentContextProvider, {
|
|
34
|
+
value: (0, react.useMemo)(() => ({
|
|
35
|
+
getRootNode,
|
|
36
|
+
getWindow: () => (0, __sprawlify_primitives_dom_query.getWindow)(getRootNode()),
|
|
37
|
+
getDocument: () => (0, __sprawlify_primitives_dom_query.getDocument)(getRootNode())
|
|
38
|
+
}), [getRootNode]),
|
|
39
|
+
children: [children, !value && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
40
|
+
hidden: true,
|
|
41
|
+
ref: setSpanRef
|
|
42
|
+
})]
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
Object.defineProperty(exports, 'EnvironmentProvider', {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function () {
|
|
50
|
+
return EnvironmentProvider;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
Object.defineProperty(exports, 'useEnvironmentContext', {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function () {
|
|
56
|
+
return useEnvironmentContext;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { t as createContext$1 } from "./create-context-CCXzjEv8.mjs";
|
|
2
|
+
import { useMemo, useState } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { getDocument, getWindow } from "@sprawlify/primitives/dom-query";
|
|
5
|
+
|
|
6
|
+
//#region src/utils/run-if-fn.ts
|
|
7
|
+
const isFunction = (value) => typeof value === "function";
|
|
8
|
+
const runIfFn = (valueOrFn, ...args) => isFunction(valueOrFn) ? valueOrFn(...args) : valueOrFn;
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/providers/environment/use-environment-context.ts
|
|
12
|
+
const [EnvironmentContextProvider, useEnvironmentContext] = createContext$1({
|
|
13
|
+
name: "EnvironmentContext",
|
|
14
|
+
hookName: "useEnvironmentContext",
|
|
15
|
+
providerName: "<EnvironmentProvider />",
|
|
16
|
+
strict: false,
|
|
17
|
+
defaultValue: {
|
|
18
|
+
getRootNode: () => document,
|
|
19
|
+
getDocument: () => document,
|
|
20
|
+
getWindow: () => window
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/providers/environment/environment-provider.tsx
|
|
26
|
+
const EnvironmentProvider = (props) => {
|
|
27
|
+
const { value, children } = props;
|
|
28
|
+
const [spanRef, setSpanRef] = useState();
|
|
29
|
+
const getRootNode = useMemo(() => {
|
|
30
|
+
return () => runIfFn(value) ?? spanRef?.getRootNode() ?? document;
|
|
31
|
+
}, [value, spanRef]);
|
|
32
|
+
return /* @__PURE__ */ jsxs(EnvironmentContextProvider, {
|
|
33
|
+
value: useMemo(() => ({
|
|
34
|
+
getRootNode,
|
|
35
|
+
getWindow: () => getWindow(getRootNode()),
|
|
36
|
+
getDocument: () => getDocument(getRootNode())
|
|
37
|
+
}), [getRootNode]),
|
|
38
|
+
children: [children, !value && /* @__PURE__ */ jsx("span", {
|
|
39
|
+
hidden: true,
|
|
40
|
+
ref: setSpanRef
|
|
41
|
+
})]
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
export { useEnvironmentContext as n, EnvironmentProvider as t };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { t as composeRefs } from "./compose-refs-BEptPEkE.mjs";
|
|
2
|
+
import { mergeProps } from "@sprawlify/primitives/core";
|
|
3
|
+
import { Children, cloneElement, createElement, forwardRef, isValidElement, memo } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/factory.ts
|
|
6
|
+
function getRef(element) {
|
|
7
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
8
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
9
|
+
if (mayWarn) return element.ref;
|
|
10
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
11
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
12
|
+
if (mayWarn) return element.props.ref;
|
|
13
|
+
return element.props.ref || element.ref;
|
|
14
|
+
}
|
|
15
|
+
const withAsChild = (Component) => {
|
|
16
|
+
const Comp = memo(forwardRef((props, ref) => {
|
|
17
|
+
const { asChild, children, ...restProps } = props;
|
|
18
|
+
if (!asChild) return createElement(Component, {
|
|
19
|
+
...restProps,
|
|
20
|
+
ref
|
|
21
|
+
}, children);
|
|
22
|
+
if (!isValidElement(children)) return null;
|
|
23
|
+
const onlyChild = Children.only(children);
|
|
24
|
+
const childRef = getRef(onlyChild);
|
|
25
|
+
return cloneElement(onlyChild, {
|
|
26
|
+
...mergeProps(restProps, onlyChild.props),
|
|
27
|
+
ref: ref ? composeRefs(ref, childRef) : childRef
|
|
28
|
+
});
|
|
29
|
+
}));
|
|
30
|
+
Comp.displayName = typeof Component === "string" ? Component : Component.displayName || Component.name;
|
|
31
|
+
return Comp;
|
|
32
|
+
};
|
|
33
|
+
const jsxFactory = () => {
|
|
34
|
+
const cache = /* @__PURE__ */ new Map();
|
|
35
|
+
return new Proxy(withAsChild, {
|
|
36
|
+
apply(_target, _thisArg, argArray) {
|
|
37
|
+
return withAsChild(argArray[0]);
|
|
38
|
+
},
|
|
39
|
+
get(_, element) {
|
|
40
|
+
const asElement = element;
|
|
41
|
+
if (!cache.has(asElement)) cache.set(asElement, withAsChild(asElement));
|
|
42
|
+
return cache.get(asElement);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
const sprawlify = jsxFactory();
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
export { sprawlify as n, jsxFactory as t };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { ComponentPropsWithoutRef, JSX } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/factory.d.ts
|
|
4
|
+
interface PolymorphicProps {
|
|
5
|
+
asChild?: boolean | undefined;
|
|
6
|
+
}
|
|
7
|
+
type JsxElements = { [E in keyof JSX.IntrinsicElements]: SprawlifyForwardRefComponent<E> };
|
|
8
|
+
type SprawlifyForwardRefComponent<E$1 extends React.ElementType> = React.ForwardRefExoticComponent<SprawlifyPropsWithRef<E$1>>;
|
|
9
|
+
type SprawlifyPropsWithRef<E$1 extends React.ElementType> = React.ComponentPropsWithRef<E$1> & PolymorphicProps;
|
|
10
|
+
type HTMLProps<T extends keyof JSX.IntrinsicElements> = ComponentPropsWithoutRef<T>;
|
|
11
|
+
type HTMLSprawlifyProps<T extends keyof JSX.IntrinsicElements> = HTMLProps<T> & PolymorphicProps;
|
|
12
|
+
declare const jsxFactory: () => JsxElements;
|
|
13
|
+
declare const sprawlify: JsxElements;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { sprawlify as a, jsxFactory as i, HTMLSprawlifyProps as n, PolymorphicProps as r, HTMLProps as t };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-BYnRvbsk.cjs');
|
|
2
|
+
const require_compose_refs = require('./compose-refs-C5QNDywq.cjs');
|
|
3
|
+
let __sprawlify_primitives_core = require("@sprawlify/primitives/core");
|
|
4
|
+
let react = require("react");
|
|
5
|
+
|
|
6
|
+
//#region src/components/factory.ts
|
|
7
|
+
function getRef(element) {
|
|
8
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
9
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
10
|
+
if (mayWarn) return element.ref;
|
|
11
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
12
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
13
|
+
if (mayWarn) return element.props.ref;
|
|
14
|
+
return element.props.ref || element.ref;
|
|
15
|
+
}
|
|
16
|
+
const withAsChild = (Component) => {
|
|
17
|
+
const Comp = (0, react.memo)((0, react.forwardRef)((props, ref) => {
|
|
18
|
+
const { asChild, children, ...restProps } = props;
|
|
19
|
+
if (!asChild) return (0, react.createElement)(Component, {
|
|
20
|
+
...restProps,
|
|
21
|
+
ref
|
|
22
|
+
}, children);
|
|
23
|
+
if (!(0, react.isValidElement)(children)) return null;
|
|
24
|
+
const onlyChild = react.Children.only(children);
|
|
25
|
+
const childRef = getRef(onlyChild);
|
|
26
|
+
return (0, react.cloneElement)(onlyChild, {
|
|
27
|
+
...(0, __sprawlify_primitives_core.mergeProps)(restProps, onlyChild.props),
|
|
28
|
+
ref: ref ? require_compose_refs.composeRefs(ref, childRef) : childRef
|
|
29
|
+
});
|
|
30
|
+
}));
|
|
31
|
+
Comp.displayName = typeof Component === "string" ? Component : Component.displayName || Component.name;
|
|
32
|
+
return Comp;
|
|
33
|
+
};
|
|
34
|
+
const jsxFactory = () => {
|
|
35
|
+
const cache = /* @__PURE__ */ new Map();
|
|
36
|
+
return new Proxy(withAsChild, {
|
|
37
|
+
apply(_target, _thisArg, argArray) {
|
|
38
|
+
return withAsChild(argArray[0]);
|
|
39
|
+
},
|
|
40
|
+
get(_, element) {
|
|
41
|
+
const asElement = element;
|
|
42
|
+
if (!cache.has(asElement)) cache.set(asElement, withAsChild(asElement));
|
|
43
|
+
return cache.get(asElement);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
const sprawlify = jsxFactory();
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
Object.defineProperty(exports, 'jsxFactory', {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function () {
|
|
53
|
+
return jsxFactory;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
Object.defineProperty(exports, 'sprawlify', {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function () {
|
|
59
|
+
return sprawlify;
|
|
60
|
+
}
|
|
61
|
+
});
|