@plasmicapp/react-web 0.2.201 → 0.2.203
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/all.d.ts +1926 -1925
- package/dist/auth/PlasmicPageGuard.d.ts +11 -11
- package/dist/common.d.ts +10 -10
- package/dist/data-sources/index.d.ts +1 -1
- package/dist/host/index.d.ts +1 -1
- package/dist/index-common.d.ts +18 -18
- package/dist/index-skinny.d.ts +1 -1
- package/dist/index.cjs.js +3495 -3495
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/plume/button/index.d.ts +36 -36
- package/dist/plume/checkbox/index.d.ts +47 -47
- package/dist/plume/collection-utils.d.ts +191 -191
- package/dist/plume/collection-utils.spec.d.ts +1 -1
- package/dist/plume/menu/context.d.ts +8 -8
- package/dist/plume/menu/index.d.ts +3 -3
- package/dist/plume/menu/menu-group.d.ts +23 -23
- package/dist/plume/menu/menu-item.d.ts +23 -23
- package/dist/plume/menu/menu.d.ts +39 -39
- package/dist/plume/menu-button/DropdownMenu.d.ts +34 -34
- package/dist/plume/menu-button/index.d.ts +2 -2
- package/dist/plume/menu-button/menu-button.d.ts +72 -72
- package/dist/plume/menu-button/menu-trigger.d.ts +21 -21
- package/dist/plume/plume-utils.d.ts +41 -41
- package/dist/plume/props-utils.d.ts +15 -15
- package/dist/plume/select/context.d.ts +3 -3
- package/dist/plume/select/index.d.ts +4 -4
- package/dist/plume/select/select-option-group.d.ts +23 -23
- package/dist/plume/select/select-option.d.ts +23 -23
- package/dist/plume/select/select.d.ts +111 -111
- package/dist/plume/switch/index.d.ts +39 -39
- package/dist/plume/text-input/index.d.ts +36 -36
- package/dist/plume/triggered-overlay/context.d.ts +14 -14
- package/dist/plume/triggered-overlay/index.d.ts +2 -2
- package/dist/plume/triggered-overlay/triggered-overlay.d.ts +24 -24
- package/dist/query/index.d.ts +1 -1
- package/dist/react-utils.d.ts +21 -21
- package/dist/react-utils.spec.d.ts +1 -1
- package/dist/react-web.esm.js +3496 -3496
- package/dist/react-web.esm.js.map +1 -1
- package/dist/render/PlasmicHead/index.d.ts +37 -37
- package/dist/render/PlasmicIcon.d.ts +4 -4
- package/dist/render/PlasmicImg/index.d.ts +81 -81
- package/dist/render/PlasmicLink.d.ts +2 -2
- package/dist/render/PlasmicSlot.d.ts +11 -11
- package/dist/render/Stack.d.ts +51 -51
- package/dist/render/elements.d.ts +74 -74
- package/dist/render/global-variants.d.ts +1 -1
- package/dist/render/screen-variants.d.ts +5 -5
- package/dist/render/ssr.d.ts +21 -21
- package/dist/render/translation.d.ts +19 -19
- package/dist/render/triggers.d.ts +39 -39
- package/dist/states/errors.d.ts +13 -13
- package/dist/states/graph.d.ts +25 -25
- package/dist/states/helpers.d.ts +43 -43
- package/dist/states/index.d.ts +4 -4
- package/dist/states/types.d.ts +66 -66
- package/dist/states/valtio.d.ts +10 -10
- package/dist/states/vanilla.d.ts +3 -3
- package/dist/stories/PlasmicImg.stories.d.ts +6 -6
- package/dist/stories/UseDollarState.stories.d.ts +78 -78
- package/lib/data-sources/index.d.ts +1 -1
- package/lib/host/index.d.ts +1 -1
- package/lib/query/index.d.ts +1 -1
- package/package.json +8 -9
- package/skinny/dist/auth/PlasmicPageGuard.d.ts +11 -11
- package/skinny/dist/{collection-utils-0967eaf0.js → collection-utils-2f28e4eb.js} +297 -297
- package/skinny/dist/{collection-utils-0967eaf0.js.map → collection-utils-2f28e4eb.js.map} +1 -1
- package/skinny/dist/{common-9d6d348d.js → common-ed411407.js} +130 -130
- package/skinny/dist/{common-9d6d348d.js.map → common-ed411407.js.map} +1 -1
- package/skinny/dist/common.d.ts +10 -10
- package/skinny/dist/data-sources/index.d.ts +1 -1
- package/skinny/dist/host/index.d.ts +1 -1
- package/skinny/dist/index-common.d.ts +18 -18
- package/skinny/dist/index-skinny.d.ts +1 -1
- package/skinny/dist/index.d.ts +11 -11
- package/skinny/dist/index.js +1559 -1559
- package/skinny/dist/index.js.map +1 -1
- package/skinny/dist/plume/button/index.d.ts +36 -36
- package/skinny/dist/plume/button/index.js +21 -21
- package/skinny/dist/plume/checkbox/index.d.ts +47 -47
- package/skinny/dist/plume/checkbox/index.js +64 -64
- package/skinny/dist/plume/collection-utils.d.ts +191 -191
- package/skinny/dist/plume/collection-utils.spec.d.ts +1 -1
- package/skinny/dist/plume/menu/context.d.ts +8 -8
- package/skinny/dist/plume/menu/index.d.ts +3 -3
- package/skinny/dist/plume/menu/index.js +165 -165
- package/skinny/dist/plume/menu/menu-group.d.ts +23 -23
- package/skinny/dist/plume/menu/menu-item.d.ts +23 -23
- package/skinny/dist/plume/menu/menu.d.ts +39 -39
- package/skinny/dist/plume/menu-button/DropdownMenu.d.ts +34 -34
- package/skinny/dist/plume/menu-button/index.d.ts +2 -2
- package/skinny/dist/plume/menu-button/index.js +125 -125
- package/skinny/dist/plume/menu-button/index.js.map +1 -1
- package/skinny/dist/plume/menu-button/menu-button.d.ts +72 -72
- package/skinny/dist/plume/menu-button/menu-trigger.d.ts +21 -21
- package/skinny/dist/plume/plume-utils.d.ts +41 -41
- package/skinny/dist/plume/props-utils.d.ts +15 -15
- package/skinny/dist/plume/select/context.d.ts +3 -3
- package/skinny/dist/plume/select/index.d.ts +4 -4
- package/skinny/dist/plume/select/index.js +250 -250
- package/skinny/dist/plume/select/index.js.map +1 -1
- package/skinny/dist/plume/select/select-option-group.d.ts +23 -23
- package/skinny/dist/plume/select/select-option.d.ts +23 -23
- package/skinny/dist/plume/select/select.d.ts +111 -111
- package/skinny/dist/plume/switch/index.d.ts +39 -39
- package/skinny/dist/plume/switch/index.js +61 -61
- package/skinny/dist/plume/text-input/index.d.ts +36 -36
- package/skinny/dist/plume/text-input/index.js +45 -45
- package/skinny/dist/plume/triggered-overlay/context.d.ts +14 -14
- package/skinny/dist/plume/triggered-overlay/index.d.ts +2 -2
- package/skinny/dist/plume/triggered-overlay/index.js +100 -100
- package/skinny/dist/plume/triggered-overlay/index.js.map +1 -1
- package/skinny/dist/plume/triggered-overlay/triggered-overlay.d.ts +24 -24
- package/skinny/dist/{plume-utils-7d68bcc0.js → plume-utils-e699cd08.js} +30 -30
- package/skinny/dist/{plume-utils-7d68bcc0.js.map → plume-utils-e699cd08.js.map} +1 -1
- package/skinny/dist/{props-utils-9f9c761a.js → props-utils-9d74371f.js} +4 -4
- package/skinny/dist/{props-utils-9f9c761a.js.map → props-utils-9d74371f.js.map} +1 -1
- package/skinny/dist/query/index.d.ts +1 -1
- package/skinny/dist/{react-utils-ee4e03ba.js → react-utils-5ff031c2.js} +195 -195
- package/skinny/dist/{react-utils-ee4e03ba.js.map → react-utils-5ff031c2.js.map} +1 -1
- package/skinny/dist/react-utils.d.ts +21 -21
- package/skinny/dist/react-utils.spec.d.ts +1 -1
- package/skinny/dist/render/PlasmicHead/index.d.ts +37 -37
- package/skinny/dist/render/PlasmicHead/index.js +54 -54
- package/skinny/dist/render/PlasmicIcon.d.ts +4 -4
- package/skinny/dist/render/PlasmicImg/index.d.ts +81 -81
- package/skinny/dist/render/PlasmicImg/index.js +297 -297
- package/skinny/dist/render/PlasmicLink.d.ts +2 -2
- package/skinny/dist/render/PlasmicSlot.d.ts +11 -11
- package/skinny/dist/render/Stack.d.ts +51 -51
- package/skinny/dist/render/elements.d.ts +74 -74
- package/skinny/dist/render/global-variants.d.ts +1 -1
- package/skinny/dist/render/screen-variants.d.ts +5 -5
- package/skinny/dist/render/ssr.d.ts +21 -21
- package/skinny/dist/render/translation.d.ts +19 -19
- package/skinny/dist/render/triggers.d.ts +39 -39
- package/skinny/dist/{ssr-c9834f50.js → ssr-8625df04.js} +107 -107
- package/skinny/dist/{ssr-c9834f50.js.map → ssr-8625df04.js.map} +1 -1
- package/skinny/dist/states/errors.d.ts +13 -13
- package/skinny/dist/states/graph.d.ts +25 -25
- package/skinny/dist/states/helpers.d.ts +43 -43
- package/skinny/dist/states/index.d.ts +4 -4
- package/skinny/dist/states/types.d.ts +66 -66
- package/skinny/dist/states/valtio.d.ts +10 -10
- package/skinny/dist/states/vanilla.d.ts +3 -3
- package/skinny/dist/stories/PlasmicImg.stories.d.ts +6 -6
- package/skinny/dist/stories/UseDollarState.stories.d.ts +78 -78
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { DOMProps } from "@react-types/shared";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { AnyPlasmicClass, PlasmicClassArgs, PlasmicClassOverrides, PlasmicClassVariants, VariantDef } from "../plume-utils";
|
|
4
|
-
import { StyleProps } from "../props-utils";
|
|
5
|
-
export interface BaseTriggeredOverlayProps extends StyleProps, DOMProps {
|
|
6
|
-
children?: React.ReactNode;
|
|
7
|
-
}
|
|
8
|
-
export interface TriggeredOverlayConfig<C extends AnyPlasmicClass> {
|
|
9
|
-
isPlacedTopVariant?: VariantDef<PlasmicClassVariants<C>>;
|
|
10
|
-
isPlacedBottomVariant?: VariantDef<PlasmicClassVariants<C>>;
|
|
11
|
-
isPlacedLeftVariant?: VariantDef<PlasmicClassVariants<C>>;
|
|
12
|
-
isPlacedRightVariant?: VariantDef<PlasmicClassVariants<C>>;
|
|
13
|
-
contentSlot: keyof PlasmicClassArgs<C>;
|
|
14
|
-
root: keyof PlasmicClassOverrides<C>;
|
|
15
|
-
contentContainer: keyof PlasmicClassOverrides<C>;
|
|
16
|
-
}
|
|
17
|
-
export type TriggeredOverlayRef = React.Ref<HTMLElement>;
|
|
18
|
-
export declare function useTriggeredOverlay<P extends BaseTriggeredOverlayProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: TriggeredOverlayConfig<C>, outerRef?: TriggeredOverlayRef, isDismissable?: boolean): {
|
|
19
|
-
plasmicProps: {
|
|
20
|
-
variants: PlasmicClassVariants<C>;
|
|
21
|
-
args: PlasmicClassArgs<C>;
|
|
22
|
-
overrides: PlasmicClassOverrides<C>;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
1
|
+
import { DOMProps } from "@react-types/shared";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { AnyPlasmicClass, PlasmicClassArgs, PlasmicClassOverrides, PlasmicClassVariants, VariantDef } from "../plume-utils";
|
|
4
|
+
import { StyleProps } from "../props-utils";
|
|
5
|
+
export interface BaseTriggeredOverlayProps extends StyleProps, DOMProps {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export interface TriggeredOverlayConfig<C extends AnyPlasmicClass> {
|
|
9
|
+
isPlacedTopVariant?: VariantDef<PlasmicClassVariants<C>>;
|
|
10
|
+
isPlacedBottomVariant?: VariantDef<PlasmicClassVariants<C>>;
|
|
11
|
+
isPlacedLeftVariant?: VariantDef<PlasmicClassVariants<C>>;
|
|
12
|
+
isPlacedRightVariant?: VariantDef<PlasmicClassVariants<C>>;
|
|
13
|
+
contentSlot: keyof PlasmicClassArgs<C>;
|
|
14
|
+
root: keyof PlasmicClassOverrides<C>;
|
|
15
|
+
contentContainer: keyof PlasmicClassOverrides<C>;
|
|
16
|
+
}
|
|
17
|
+
export type TriggeredOverlayRef = React.Ref<HTMLElement>;
|
|
18
|
+
export declare function useTriggeredOverlay<P extends BaseTriggeredOverlayProps, C extends AnyPlasmicClass>(plasmicClass: C, props: P, config: TriggeredOverlayConfig<C>, outerRef?: TriggeredOverlayRef, isDismissable?: boolean): {
|
|
19
|
+
plasmicProps: {
|
|
20
|
+
variants: PlasmicClassVariants<C>;
|
|
21
|
+
args: PlasmicClassArgs<C>;
|
|
22
|
+
overrides: PlasmicClassOverrides<C>;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { m as mapValues, k as groupBy } from './common-
|
|
2
|
+
import { m as mapValues, k as groupBy } from './common-ed411407.js';
|
|
3
3
|
|
|
4
|
-
var PLUME_STRICT_MODE = true;
|
|
5
|
-
function mergeVariantToggles() {
|
|
6
|
-
var toggles = [];
|
|
7
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
8
|
-
toggles[_i] = arguments[_i];
|
|
9
|
-
}
|
|
10
|
-
var definedToggles = toggles.filter(function (x) { return !!x.def; });
|
|
11
|
-
var grouped = groupBy(definedToggles, function (_a) {
|
|
12
|
-
var def = _a.def;
|
|
13
|
-
return def.group;
|
|
14
|
-
});
|
|
15
|
-
return mapValues(grouped, function (subToggles) {
|
|
16
|
-
return Object.fromEntries(subToggles.map(function (_a) {
|
|
17
|
-
var def = _a.def, active = _a.active;
|
|
18
|
-
return [def.variant, !!active];
|
|
19
|
-
}));
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
function noOutline() {
|
|
23
|
-
return { outline: "none" };
|
|
24
|
-
}
|
|
25
|
-
function getPlumeType(child) {
|
|
26
|
-
var _a;
|
|
27
|
-
if (!React.isValidElement(child)) {
|
|
28
|
-
return undefined;
|
|
29
|
-
}
|
|
30
|
-
var childType = child.type;
|
|
31
|
-
return (childType.__plumeType || ((_a = childType.getPlumeType) === null || _a === void 0 ? void 0 : _a.call(childType, child.props)));
|
|
4
|
+
var PLUME_STRICT_MODE = true;
|
|
5
|
+
function mergeVariantToggles() {
|
|
6
|
+
var toggles = [];
|
|
7
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
8
|
+
toggles[_i] = arguments[_i];
|
|
9
|
+
}
|
|
10
|
+
var definedToggles = toggles.filter(function (x) { return !!x.def; });
|
|
11
|
+
var grouped = groupBy(definedToggles, function (_a) {
|
|
12
|
+
var def = _a.def;
|
|
13
|
+
return def.group;
|
|
14
|
+
});
|
|
15
|
+
return mapValues(grouped, function (subToggles) {
|
|
16
|
+
return Object.fromEntries(subToggles.map(function (_a) {
|
|
17
|
+
var def = _a.def, active = _a.active;
|
|
18
|
+
return [def.variant, !!active];
|
|
19
|
+
}));
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function noOutline() {
|
|
23
|
+
return { outline: "none" };
|
|
24
|
+
}
|
|
25
|
+
function getPlumeType(child) {
|
|
26
|
+
var _a;
|
|
27
|
+
if (!React.isValidElement(child)) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
var childType = child.type;
|
|
31
|
+
return (childType.__plumeType || ((_a = childType.getPlumeType) === null || _a === void 0 ? void 0 : _a.call(childType, child.props)));
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export { PLUME_STRICT_MODE as P, getPlumeType as g, mergeVariantToggles as m, noOutline as n };
|
|
35
|
-
//# sourceMappingURL=plume-utils-
|
|
35
|
+
//# sourceMappingURL=plume-utils-e699cd08.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plume-utils-
|
|
1
|
+
{"version":3,"file":"plume-utils-e699cd08.js","sources":["../../src/plume/plume-utils.ts"],"sourcesContent":["import * as React from \"react\";\nimport { groupBy, mapValues } from \"../common\";\nimport { SingleChoiceArg } from \"../render/elements\";\n\nexport let PLUME_STRICT_MODE = true;\n\nexport function setPlumeStrictMode(mode: boolean) {\n PLUME_STRICT_MODE = mode;\n}\n\ntype VariantArgChoices<T> = T extends (infer M)[]\n ? M\n : T extends SingleChoiceArg<infer M>\n ? M\n : never;\ntype VariantArgsChoices<V> = { [k in keyof V]-?: VariantArgChoices<V[k]> };\ntype DictValues<V extends Record<string, any>> = V[keyof V];\ntype DictTuples<V extends Record<string, any>> = DictValues<\n { [K in keyof V]: [K, V[K]] }\n>;\nexport type VariantDefTuple<V> = DictTuples<VariantArgsChoices<V>>;\n\ntype DistributeTuple<T> = T extends [infer T1, infer T2]\n ? { group: T1; variant: T2 }\n : never;\n\nexport type VariantDef<V> = DistributeTuple<VariantDefTuple<V>>;\n\nexport type PlasmicClass<\n V extends Record<string, any>,\n A extends Record<string, any>,\n O extends Record<string, any>\n> = {\n (props: { variants?: V; args?: A; overrides?: O }): React.ReactElement | null;\n internalVariantProps: (keyof V)[];\n internalArgProps: (keyof A)[];\n};\n\nexport type AnyPlasmicClass = PlasmicClass<any, any, any>;\n\nexport type PlasmicClassVariants<\n C extends AnyPlasmicClass\n> = C extends PlasmicClass<infer V, any, any> ? V : unknown;\nexport type PlasmicClassArgs<\n C extends AnyPlasmicClass\n> = C extends PlasmicClass<any, infer A, any> ? A : unknown;\nexport type PlasmicClassOverrides<\n C extends AnyPlasmicClass\n> = C extends PlasmicClass<any, any, infer O> ? O : unknown;\n\ntype BooleanLike = boolean | undefined | null;\n\nexport function mergeVariantToggles<V>(\n ...toggles: { def?: VariantDef<V>; active: BooleanLike }[]\n) {\n const definedToggles = toggles.filter((x) => !!x.def) as {\n def: VariantDef<V>;\n active: BooleanLike;\n }[];\n const grouped = groupBy(definedToggles, ({ def }) => def.group as string);\n return mapValues(grouped, (subToggles) => {\n return Object.fromEntries(\n subToggles.map(({ def, active }) => [def.variant, !!active])\n );\n });\n}\n\nexport function noOutline() {\n return { outline: \"none\" };\n}\n\nexport function getPlumeType(child: React.ReactChild): string | undefined {\n if (!React.isValidElement(child)) {\n return undefined;\n }\n const childType = child.type as any;\n return (childType.__plumeType || childType.getPlumeType?.(child.props)) as\n | string\n | undefined;\n}\n"],"names":[],"mappings":";;;IAIW,iBAAiB,GAAG,KAAK;SAgDpB,mBAAmB;IACjC,iBAA0D;SAA1D,UAA0D,EAA1D,qBAA0D,EAA1D,IAA0D;QAA1D,4BAA0D;;IAE1D,IAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,CAAC,CAAC,GAAG,GAAA,CAGjD,CAAC;IACJ,IAAM,OAAO,GAAG,OAAO,CAAC,cAAc,EAAE,UAAC,EAAO;YAAL,GAAG,SAAA;QAAO,OAAA,GAAG,CAAC,KAAe;KAAA,CAAC,CAAC;IAC1E,OAAO,SAAS,CAAC,OAAO,EAAE,UAAC,UAAU;QACnC,OAAO,MAAM,CAAC,WAAW,CACvB,UAAU,CAAC,GAAG,CAAC,UAAC,EAAe;gBAAb,GAAG,SAAA,EAAE,MAAM,YAAA;YAAO,OAAA,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;SAAA,CAAC,CAC7D,CAAC;KACH,CAAC,CAAC;AACL,CAAC;SAEe,SAAS;IACvB,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AAC7B,CAAC;SAEe,YAAY,CAAC,KAAuB;;IAClD,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE;QAChC,OAAO,SAAS,CAAC;KAClB;IACD,IAAM,SAAS,GAAG,KAAK,CAAC,IAAW,CAAC;IACpC,QAAQ,SAAS,CAAC,WAAW,KAAI,MAAA,SAAS,CAAC,YAAY,0DAAG,KAAK,CAAC,KAAK,CAAC,CAAA,EAExD;AAChB;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { p as pick } from './common-
|
|
1
|
+
import { p as pick } from './common-ed411407.js';
|
|
2
2
|
|
|
3
|
-
function getStyleProps(props) {
|
|
4
|
-
return pick(props, "className", "style");
|
|
3
|
+
function getStyleProps(props) {
|
|
4
|
+
return pick(props, "className", "style");
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export { getStyleProps as g };
|
|
8
|
-
//# sourceMappingURL=props-utils-
|
|
8
|
+
//# sourceMappingURL=props-utils-9d74371f.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props-utils-
|
|
1
|
+
{"version":3,"file":"props-utils-9d74371f.js","sources":["../../src/plume/props-utils.ts"],"sourcesContent":["import * as React from \"react\";\nimport { pick, pickBy } from \"../common\";\nimport {\n AnyPlasmicClass,\n PlasmicClassArgs,\n PlasmicClassOverrides,\n PlasmicClassVariants,\n} from \"./plume-utils\";\n\nexport interface StyleProps {\n className?: string;\n style?: React.CSSProperties;\n}\n\nexport function getStyleProps<P extends StyleProps>(props: P): StyleProps {\n return pick(props, \"className\", \"style\");\n}\n\nexport function getDefaultPlasmicProps<C extends AnyPlasmicClass>(\n plasmicClass: C,\n props: Record<string, any>\n) {\n return {\n plasmicProps: {\n variants: pick(\n props,\n ...plasmicClass.internalVariantProps\n ) as PlasmicClassVariants<C>,\n args: pick(\n props,\n ...plasmicClass.internalArgProps\n ) as PlasmicClassArgs<C>,\n overrides: {} as PlasmicClassOverrides<C>,\n },\n };\n}\n\nconst RE_DATA_PROP = /^(data-.*)$/;\n\nexport function getDataProps(props: Record<string, any>) {\n return pickBy(props, (k) => RE_DATA_PROP.test(k));\n}\n"],"names":[],"mappings":";;SAcgB,aAAa,CAAuB,KAAQ;IAC1D,OAAO,IAAI,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;AAC3C;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "@plasmicapp/query";
|
|
1
|
+
export * from "@plasmicapp/query";
|
|
@@ -1,201 +1,201 @@
|
|
|
1
|
-
import { f as __values, d as __spreadArray, e as __read, b as __assign } from './common-
|
|
1
|
+
import { f as __values, d as __spreadArray, e as __read, b as __assign } from './common-ed411407.js';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
|
|
5
|
-
var isBrowser = typeof window !== "undefined";
|
|
6
|
-
var NONE = Symbol("NONE");
|
|
7
|
-
var useIsomorphicLayoutEffect = isBrowser
|
|
8
|
-
? React__default.useLayoutEffect
|
|
9
|
-
: React__default.useEffect;
|
|
10
|
-
function createElementWithChildren(elementType, props, children) {
|
|
11
|
-
if (Array.isArray(children)) {
|
|
12
|
-
return React__default.createElement.apply(React__default, __spreadArray([elementType,
|
|
13
|
-
props], __read(children), false));
|
|
14
|
-
}
|
|
15
|
-
else if (children || "children" in props) {
|
|
16
|
-
// Only call React.createElement with `children` if there are actual children,
|
|
17
|
-
// or if there was an explicit (albeit undefined) children passed via
|
|
18
|
-
// props. Otherwise, if you pass `undefined` as the children argument
|
|
19
|
-
// to React.createElement, the created element will have prop {children: undefined}.
|
|
20
|
-
// If the `root` is an PlasmicGeneratedComponent, and these props with {children: undefined}
|
|
21
|
-
// are used, then it will be taken as a `children` override, and will thus blank out
|
|
22
|
-
// everything under the root node.
|
|
23
|
-
return React__default.createElement(elementType, props, children);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
return React__default.createElement(elementType, props);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function ensureNotArray(children) {
|
|
30
|
-
if (Array.isArray(children)) {
|
|
31
|
-
if (children.length === 1) {
|
|
32
|
-
return children[0];
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
return React__default.createElement.apply(React__default, __spreadArray([React__default.Fragment, {}], __read(children), false));
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
return children;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Flattens ReactNode into an array of ReactChild, but does NOT replace
|
|
44
|
-
* missing keys with array index, as React.Children.toArray() does.
|
|
45
|
-
*/
|
|
46
|
-
function toChildArray(children) {
|
|
47
|
-
if (isReactChild(children)) {
|
|
48
|
-
return [children];
|
|
49
|
-
}
|
|
50
|
-
else if (Array.isArray(children)) {
|
|
51
|
-
return children.flatMap(toChildArray);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
return [];
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function isReactText(child) {
|
|
58
|
-
return typeof child === "string" || typeof child === "number";
|
|
59
|
-
}
|
|
60
|
-
function isReactChild(child) {
|
|
61
|
-
return React__default.isValidElement(child) || isReactText(child);
|
|
62
|
-
}
|
|
63
|
-
function isReactNode(x) {
|
|
64
|
-
return (typeof x === "string" || typeof x === "number" || React__default.isValidElement(x));
|
|
65
|
-
}
|
|
66
|
-
function mergeProps(props) {
|
|
67
|
-
var e_1, _a, e_2, _b;
|
|
68
|
-
var restProps = [];
|
|
69
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
70
|
-
restProps[_i - 1] = arguments[_i];
|
|
71
|
-
}
|
|
72
|
-
if (restProps.every(function (rest) { return Object.keys(rest).length === 0; })) {
|
|
73
|
-
return props;
|
|
74
|
-
}
|
|
75
|
-
var result = __assign({}, props);
|
|
76
|
-
try {
|
|
77
|
-
for (var restProps_1 = __values(restProps), restProps_1_1 = restProps_1.next(); !restProps_1_1.done; restProps_1_1 = restProps_1.next()) {
|
|
78
|
-
var rest = restProps_1_1.value;
|
|
79
|
-
try {
|
|
80
|
-
for (var _c = (e_2 = void 0, __values(Object.keys(rest))), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
81
|
-
var key = _d.value;
|
|
82
|
-
result[key] = mergePropVals(key, result[key], rest[key]);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
86
|
-
finally {
|
|
87
|
-
try {
|
|
88
|
-
if (_d && !_d.done && (_b = _c
|
|
89
|
-
}
|
|
90
|
-
finally { if (e_2) throw e_2.error; }
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
95
|
-
finally {
|
|
96
|
-
try {
|
|
97
|
-
if (restProps_1_1 && !restProps_1_1.done && (_a = restProps_1
|
|
98
|
-
}
|
|
99
|
-
finally { if (e_1) throw e_1.error; }
|
|
100
|
-
}
|
|
101
|
-
return result;
|
|
102
|
-
}
|
|
103
|
-
function updateRef(ref, value) {
|
|
104
|
-
if (!ref) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
if (typeof ref === "function") {
|
|
108
|
-
ref(value);
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
if (!Object.isFrozen(ref)) {
|
|
112
|
-
ref.current = value;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
function mergeRefs() {
|
|
117
|
-
var refs = [];
|
|
118
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
119
|
-
refs[_i] = arguments[_i];
|
|
120
|
-
}
|
|
121
|
-
return function (value) {
|
|
122
|
-
var e_3, _a;
|
|
123
|
-
try {
|
|
124
|
-
for (var refs_1 = __values(refs), refs_1_1 = refs_1.next(); !refs_1_1.done; refs_1_1 = refs_1.next()) {
|
|
125
|
-
var ref = refs_1_1.value;
|
|
126
|
-
updateRef(ref, value);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
130
|
-
finally {
|
|
131
|
-
try {
|
|
132
|
-
if (refs_1_1 && !refs_1_1.done && (_a = refs_1
|
|
133
|
-
}
|
|
134
|
-
finally { if (e_3) throw e_3.error; }
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
function mergePropVals(name, val1, val2) {
|
|
139
|
-
if (val1 === NONE || val2 === NONE) {
|
|
140
|
-
// The NONE sentinel always skips all merging and returns null
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
else if (val1 == null) {
|
|
144
|
-
// If either of them is nil, prefer the other
|
|
145
|
-
return val2;
|
|
146
|
-
}
|
|
147
|
-
else if (val2 == null) {
|
|
148
|
-
return val1;
|
|
149
|
-
}
|
|
150
|
-
else if (name === "className") {
|
|
151
|
-
// Special case for className -- always combine both class names
|
|
152
|
-
return classNames(val1, val2);
|
|
153
|
-
}
|
|
154
|
-
else if (name === "style") {
|
|
155
|
-
// Special case for style -- always shallow-merge style dicts
|
|
156
|
-
return __assign(__assign({}, val1), val2);
|
|
157
|
-
}
|
|
158
|
-
else if (name === "ref") {
|
|
159
|
-
// Special case for ref
|
|
160
|
-
return mergeRefs(val1, val2);
|
|
161
|
-
}
|
|
162
|
-
else if (typeof val1 !== typeof val2) {
|
|
163
|
-
// If the type of the two values are different, then no way to merge them.
|
|
164
|
-
// Prefer val2.
|
|
165
|
-
return val2;
|
|
166
|
-
}
|
|
167
|
-
else if (name.startsWith("on") && typeof val1 === "function") {
|
|
168
|
-
// Special case for event handlers -- always call both handlers
|
|
169
|
-
return function () {
|
|
170
|
-
var args = [];
|
|
171
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
172
|
-
args[_i] = arguments[_i];
|
|
173
|
-
}
|
|
174
|
-
var res;
|
|
175
|
-
if (typeof val1 === "function") {
|
|
176
|
-
res = val1.apply(void 0, __spreadArray([], __read(args), false));
|
|
177
|
-
}
|
|
178
|
-
if (typeof val2 === "function") {
|
|
179
|
-
res = val2.apply(void 0, __spreadArray([], __read(args), false));
|
|
180
|
-
}
|
|
181
|
-
return res;
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
// For all else, prefer val2
|
|
186
|
-
return val2;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
function getElementTypeName(element) {
|
|
190
|
-
var _a, _b, _c, _d;
|
|
191
|
-
if (typeof element.type === "string") {
|
|
192
|
-
return element.type;
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
var comp = element.type;
|
|
196
|
-
return (_d = (_b = (_a = comp.displayName) !== null && _a !== void 0 ? _a : comp.name) !== null && _b !== void 0 ? _b : (_c = comp.render) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : "Component";
|
|
197
|
-
}
|
|
5
|
+
var isBrowser = typeof window !== "undefined";
|
|
6
|
+
var NONE = Symbol("NONE");
|
|
7
|
+
var useIsomorphicLayoutEffect = isBrowser
|
|
8
|
+
? React__default.useLayoutEffect
|
|
9
|
+
: React__default.useEffect;
|
|
10
|
+
function createElementWithChildren(elementType, props, children) {
|
|
11
|
+
if (Array.isArray(children)) {
|
|
12
|
+
return React__default.createElement.apply(React__default, __spreadArray([elementType,
|
|
13
|
+
props], __read(children), false));
|
|
14
|
+
}
|
|
15
|
+
else if (children || "children" in props) {
|
|
16
|
+
// Only call React.createElement with `children` if there are actual children,
|
|
17
|
+
// or if there was an explicit (albeit undefined) children passed via
|
|
18
|
+
// props. Otherwise, if you pass `undefined` as the children argument
|
|
19
|
+
// to React.createElement, the created element will have prop {children: undefined}.
|
|
20
|
+
// If the `root` is an PlasmicGeneratedComponent, and these props with {children: undefined}
|
|
21
|
+
// are used, then it will be taken as a `children` override, and will thus blank out
|
|
22
|
+
// everything under the root node.
|
|
23
|
+
return React__default.createElement(elementType, props, children);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return React__default.createElement(elementType, props);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function ensureNotArray(children) {
|
|
30
|
+
if (Array.isArray(children)) {
|
|
31
|
+
if (children.length === 1) {
|
|
32
|
+
return children[0];
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return React__default.createElement.apply(React__default, __spreadArray([React__default.Fragment, {}], __read(children), false));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return children;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Flattens ReactNode into an array of ReactChild, but does NOT replace
|
|
44
|
+
* missing keys with array index, as React.Children.toArray() does.
|
|
45
|
+
*/
|
|
46
|
+
function toChildArray(children) {
|
|
47
|
+
if (isReactChild(children)) {
|
|
48
|
+
return [children];
|
|
49
|
+
}
|
|
50
|
+
else if (Array.isArray(children)) {
|
|
51
|
+
return children.flatMap(toChildArray);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function isReactText(child) {
|
|
58
|
+
return typeof child === "string" || typeof child === "number";
|
|
59
|
+
}
|
|
60
|
+
function isReactChild(child) {
|
|
61
|
+
return React__default.isValidElement(child) || isReactText(child);
|
|
62
|
+
}
|
|
63
|
+
function isReactNode(x) {
|
|
64
|
+
return (typeof x === "string" || typeof x === "number" || React__default.isValidElement(x));
|
|
65
|
+
}
|
|
66
|
+
function mergeProps(props) {
|
|
67
|
+
var e_1, _a, e_2, _b;
|
|
68
|
+
var restProps = [];
|
|
69
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
70
|
+
restProps[_i - 1] = arguments[_i];
|
|
71
|
+
}
|
|
72
|
+
if (restProps.every(function (rest) { return Object.keys(rest).length === 0; })) {
|
|
73
|
+
return props;
|
|
74
|
+
}
|
|
75
|
+
var result = __assign({}, props);
|
|
76
|
+
try {
|
|
77
|
+
for (var restProps_1 = __values(restProps), restProps_1_1 = restProps_1.next(); !restProps_1_1.done; restProps_1_1 = restProps_1.next()) {
|
|
78
|
+
var rest = restProps_1_1.value;
|
|
79
|
+
try {
|
|
80
|
+
for (var _c = (e_2 = void 0, __values(Object.keys(rest))), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
81
|
+
var key = _d.value;
|
|
82
|
+
result[key] = mergePropVals(key, result[key], rest[key]);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
86
|
+
finally {
|
|
87
|
+
try {
|
|
88
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
89
|
+
}
|
|
90
|
+
finally { if (e_2) throw e_2.error; }
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
95
|
+
finally {
|
|
96
|
+
try {
|
|
97
|
+
if (restProps_1_1 && !restProps_1_1.done && (_a = restProps_1.return)) _a.call(restProps_1);
|
|
98
|
+
}
|
|
99
|
+
finally { if (e_1) throw e_1.error; }
|
|
100
|
+
}
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
function updateRef(ref, value) {
|
|
104
|
+
if (!ref) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (typeof ref === "function") {
|
|
108
|
+
ref(value);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
if (!Object.isFrozen(ref)) {
|
|
112
|
+
ref.current = value;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function mergeRefs() {
|
|
117
|
+
var refs = [];
|
|
118
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
119
|
+
refs[_i] = arguments[_i];
|
|
120
|
+
}
|
|
121
|
+
return function (value) {
|
|
122
|
+
var e_3, _a;
|
|
123
|
+
try {
|
|
124
|
+
for (var refs_1 = __values(refs), refs_1_1 = refs_1.next(); !refs_1_1.done; refs_1_1 = refs_1.next()) {
|
|
125
|
+
var ref = refs_1_1.value;
|
|
126
|
+
updateRef(ref, value);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
130
|
+
finally {
|
|
131
|
+
try {
|
|
132
|
+
if (refs_1_1 && !refs_1_1.done && (_a = refs_1.return)) _a.call(refs_1);
|
|
133
|
+
}
|
|
134
|
+
finally { if (e_3) throw e_3.error; }
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function mergePropVals(name, val1, val2) {
|
|
139
|
+
if (val1 === NONE || val2 === NONE) {
|
|
140
|
+
// The NONE sentinel always skips all merging and returns null
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
else if (val1 == null) {
|
|
144
|
+
// If either of them is nil, prefer the other
|
|
145
|
+
return val2;
|
|
146
|
+
}
|
|
147
|
+
else if (val2 == null) {
|
|
148
|
+
return val1;
|
|
149
|
+
}
|
|
150
|
+
else if (name === "className") {
|
|
151
|
+
// Special case for className -- always combine both class names
|
|
152
|
+
return classNames(val1, val2);
|
|
153
|
+
}
|
|
154
|
+
else if (name === "style") {
|
|
155
|
+
// Special case for style -- always shallow-merge style dicts
|
|
156
|
+
return __assign(__assign({}, val1), val2);
|
|
157
|
+
}
|
|
158
|
+
else if (name === "ref") {
|
|
159
|
+
// Special case for ref
|
|
160
|
+
return mergeRefs(val1, val2);
|
|
161
|
+
}
|
|
162
|
+
else if (typeof val1 !== typeof val2) {
|
|
163
|
+
// If the type of the two values are different, then no way to merge them.
|
|
164
|
+
// Prefer val2.
|
|
165
|
+
return val2;
|
|
166
|
+
}
|
|
167
|
+
else if (name.startsWith("on") && typeof val1 === "function") {
|
|
168
|
+
// Special case for event handlers -- always call both handlers
|
|
169
|
+
return function () {
|
|
170
|
+
var args = [];
|
|
171
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
172
|
+
args[_i] = arguments[_i];
|
|
173
|
+
}
|
|
174
|
+
var res;
|
|
175
|
+
if (typeof val1 === "function") {
|
|
176
|
+
res = val1.apply(void 0, __spreadArray([], __read(args), false));
|
|
177
|
+
}
|
|
178
|
+
if (typeof val2 === "function") {
|
|
179
|
+
res = val2.apply(void 0, __spreadArray([], __read(args), false));
|
|
180
|
+
}
|
|
181
|
+
return res;
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
// For all else, prefer val2
|
|
186
|
+
return val2;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function getElementTypeName(element) {
|
|
190
|
+
var _a, _b, _c, _d;
|
|
191
|
+
if (typeof element.type === "string") {
|
|
192
|
+
return element.type;
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
var comp = element.type;
|
|
196
|
+
return (_d = (_b = (_a = comp.displayName) !== null && _a !== void 0 ? _a : comp.name) !== null && _b !== void 0 ? _b : (_c = comp.render) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : "Component";
|
|
197
|
+
}
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
export { NONE as N, mergePropVals as a, isBrowser as b, createElementWithChildren as c, mergeRefs as d, ensureNotArray as e, getElementTypeName as g, isReactNode as i, mergeProps as m, toChildArray as t, useIsomorphicLayoutEffect as u };
|
|
201
|
-
//# sourceMappingURL=react-utils-
|
|
201
|
+
//# sourceMappingURL=react-utils-5ff031c2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-utils-
|
|
1
|
+
{"version":3,"file":"react-utils-5ff031c2.js","sources":["../../src/react-utils.tsx"],"sourcesContent":["import classNames from \"classnames\";\nimport React from \"react\";\n\nexport const isBrowser = typeof window !== \"undefined\";\nexport const NONE = Symbol(\"NONE\");\n\nexport const useIsomorphicLayoutEffect = isBrowser\n ? React.useLayoutEffect\n : React.useEffect;\n\nexport function createElementWithChildren(\n elementType: any,\n props: any,\n children: React.ReactNode\n) {\n if (Array.isArray(children)) {\n return React.createElement(\n elementType,\n props,\n ...children\n ) as React.ReactElement;\n } else if (children || \"children\" in props) {\n // Only call React.createElement with `children` if there are actual children,\n // or if there was an explicit (albeit undefined) children passed via\n // props. Otherwise, if you pass `undefined` as the children argument\n // to React.createElement, the created element will have prop {children: undefined}.\n // If the `root` is an PlasmicGeneratedComponent, and these props with {children: undefined}\n // are used, then it will be taken as a `children` override, and will thus blank out\n // everything under the root node.\n return React.createElement(elementType, props, children);\n } else {\n return React.createElement(elementType, props);\n }\n}\n\nexport function ensureNotArray(children: React.ReactNode) {\n if (Array.isArray(children)) {\n if (children.length === 1) {\n return children[0];\n } else {\n return React.createElement(React.Fragment, {}, ...children);\n }\n } else {\n return children;\n }\n}\n\n/**\n * Flattens ReactNode into an array of ReactChild, but does NOT replace\n * missing keys with array index, as React.Children.toArray() does.\n */\nexport function toChildArray(children: React.ReactNode): React.ReactChild[] {\n if (isReactChild(children)) {\n return [children];\n } else if (Array.isArray(children)) {\n return children.flatMap(toChildArray);\n } else {\n return [];\n }\n}\n\nexport function isReactText(child: React.ReactNode): child is React.ReactText {\n return typeof child === \"string\" || typeof child === \"number\";\n}\n\nexport function isReactChild(\n child: React.ReactNode\n): child is React.ReactChild {\n return React.isValidElement(child) || isReactText(child);\n}\n\nexport function isReactFragment(\n child: React.ReactNode\n): child is React.ReactElement {\n return React.isValidElement(child) && child.type === React.Fragment;\n}\n\nexport function isReactNode(x: any) {\n return (\n typeof x === \"string\" || typeof x === \"number\" || React.isValidElement(x)\n );\n}\n\n// From https://stackoverflow.com/questions/54775790/forcing-excess-property-checking-on-variable-passed-to-typescript-function\n// We also wrap the error message in a Partial<> because otherwise Jetbrains IDEs will autocomplete the component with all the string methods as props - see https://github.com/plasmicapp/plasmic/issues/16.\nexport type StrictProps<T, TExpected> = Exclude<\n keyof T,\n keyof TExpected\n> extends never\n ? {}\n : Partial<\"Unexpected extraneous props\">;\n\nexport type HTMLElementRefOf<T extends keyof JSX.IntrinsicElements> = Exclude<\n React.ComponentProps<T>[\"ref\"],\n string\n>;\n\nexport function mergeProps(\n props: Record<string, any>,\n ...restProps: Record<string, any>[]\n): Record<string, any> {\n if (restProps.every((rest) => Object.keys(rest).length === 0)) {\n return props;\n }\n\n const result = { ...props };\n\n for (const rest of restProps) {\n for (const key of Object.keys(rest)) {\n result[key] = mergePropVals(key, result[key], rest[key]);\n }\n }\n\n return result;\n}\n\nfunction updateRef<T>(ref: React.Ref<T> | undefined, value: T | null) {\n if (!ref) {\n return;\n }\n\n if (typeof ref === \"function\") {\n ref(value);\n } else {\n if (!Object.isFrozen(ref)) {\n (ref as React.MutableRefObject<T | null>).current = value;\n }\n }\n}\n\nexport function mergeRefs<T>(...refs: (React.Ref<T> | undefined)[]) {\n return (value: T) => {\n for (const ref of refs) {\n updateRef(ref, value);\n }\n };\n}\n\nexport function mergePropVals(name: string, val1: any, val2: any): any {\n if (val1 === NONE || val2 === NONE) {\n // The NONE sentinel always skips all merging and returns null\n return null;\n } else if (val1 == null) {\n // If either of them is nil, prefer the other\n return val2;\n } else if (val2 == null) {\n return val1;\n } else if (name === \"className\") {\n // Special case for className -- always combine both class names\n return classNames(val1, val2);\n } else if (name === \"style\") {\n // Special case for style -- always shallow-merge style dicts\n return { ...val1, ...val2 };\n } else if (name === \"ref\") {\n // Special case for ref\n return mergeRefs(val1, val2);\n } else if (typeof val1 !== typeof val2) {\n // If the type of the two values are different, then no way to merge them.\n // Prefer val2.\n return val2;\n } else if (name.startsWith(\"on\") && typeof val1 === \"function\") {\n // Special case for event handlers -- always call both handlers\n return (...args: any[]) => {\n let res: any;\n if (typeof val1 === \"function\") {\n res = val1(...args);\n }\n if (typeof val2 === \"function\") {\n res = val2(...args);\n }\n return res;\n };\n } else {\n // For all else, prefer val2\n return val2;\n }\n}\n\nexport function getElementTypeName(element: React.ReactElement) {\n if (typeof element.type === \"string\") {\n return element.type;\n } else {\n const comp = element.type as any;\n return comp.displayName ?? comp.name ?? comp.render?.name ?? \"Component\";\n }\n}\n"],"names":["React"],"mappings":";;;;IAGa,SAAS,GAAG,OAAO,MAAM,KAAK,YAAY;IAC1C,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE;IAEtB,yBAAyB,GAAG,SAAS;MAC9CA,cAAK,CAAC,eAAe;MACrBA,cAAK,CAAC,UAAU;SAEJ,yBAAyB,CACvC,WAAgB,EAChB,KAAU,EACV,QAAyB;IAEzB,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QAC3B,OAAOA,cAAK,CAAC,aAAa,OAAnBA,cAAK,iBACV,WAAW;YACX,KAAK,UACF,QAAQ,UACU,CAAC;KACzB;SAAM,IAAI,QAAQ,IAAI,UAAU,IAAI,KAAK,EAAE;;;;;;;;QAQ1C,OAAOA,cAAK,CAAC,aAAa,CAAC,WAAW,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;KAC1D;SAAM;QACL,OAAOA,cAAK,CAAC,aAAa,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;KAChD;AACH,CAAC;SAEe,cAAc,CAAC,QAAyB;IACtD,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QAC3B,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YACzB,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC;SACpB;aAAM;YACL,OAAOA,cAAK,CAAC,aAAa,OAAnBA,cAAK,iBAAeA,cAAK,CAAC,QAAQ,EAAE,EAAE,UAAK,QAAQ,WAAE;SAC7D;KACF;SAAM;QACL,OAAO,QAAQ,CAAC;KACjB;AACH,CAAC;AAED;;;;SAIgB,YAAY,CAAC,QAAyB;IACpD,IAAI,YAAY,CAA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