@typestyles/react 0.0.0-unstable.db05b288c087 → 0.0.0-unstable.dce5dc80213a
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/README.md +16 -16
- package/dist/babel-plugin.cjs +14223 -152
- package/dist/babel-plugin.cjs.map +1 -1
- package/dist/babel-plugin.d.cts +10 -10
- package/dist/babel-plugin.d.cts.map +1 -0
- package/dist/babel-plugin.d.ts +10 -10
- package/dist/babel-plugin.d.ts.map +1 -0
- package/dist/babel-plugin.js +14223 -130
- package/dist/babel-plugin.js.map +1 -1
- package/dist/css-prop-DMDmFKhu.js +21 -0
- package/dist/css-prop-DMDmFKhu.js.map +1 -0
- package/dist/css-prop-DOMoNwJN.cjs +38 -0
- package/dist/css-prop-DOMoNwJN.cjs.map +1 -0
- package/dist/css-prop-runtime-zKybLO8E.d.cts +14 -0
- package/dist/css-prop-runtime-zKybLO8E.d.cts.map +1 -0
- package/dist/css-prop-runtime-zKybLO8E.d.ts +14 -0
- package/dist/css-prop-runtime-zKybLO8E.d.ts.map +1 -0
- package/dist/css-prop-runtime.cjs +7 -7
- package/dist/css-prop-runtime.cjs.map +1 -1
- package/dist/css-prop-runtime.d.cts +2 -7
- package/dist/css-prop-runtime.d.ts +2 -7
- package/dist/css-prop-runtime.js +8 -2
- package/dist/css-prop-runtime.js.map +1 -1
- package/dist/index.cjs +75 -99
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -21
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +25 -21
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +69 -75
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.cjs +20 -38
- package/dist/jsx-dev-runtime.cjs.map +1 -1
- package/dist/jsx-dev-runtime.d.cts +9 -11
- package/dist/jsx-dev-runtime.d.cts.map +1 -0
- package/dist/jsx-dev-runtime.d.ts +9 -11
- package/dist/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/jsx-dev-runtime.js +19 -25
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx-runtime.cjs +23 -41
- package/dist/jsx-runtime.cjs.map +1 -1
- package/dist/jsx-runtime.d.cts +10 -12
- package/dist/jsx-runtime.d.cts.map +1 -0
- package/dist/jsx-runtime.d.ts +10 -12
- package/dist/jsx-runtime.d.ts.map +1 -0
- package/dist/jsx-runtime.js +20 -27
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/resolve-hash-class-DuqLJq6S.cjs +14 -0
- package/dist/resolve-hash-class-DuqLJq6S.cjs.map +1 -0
- package/dist/resolve-hash-class-Rs_7aMMQ.js +9 -0
- package/dist/resolve-hash-class-Rs_7aMMQ.js.map +1 -0
- package/dist/types-DcDsqg2q.d.cts +10 -0
- package/dist/types-DcDsqg2q.d.cts.map +1 -0
- package/dist/types-DcDsqg2q.d.ts +10 -0
- package/dist/types-DcDsqg2q.d.ts.map +1 -0
- package/package.json +9 -11
- package/dist/chunk-3YCUQVCM.js +0 -8
- package/dist/chunk-3YCUQVCM.js.map +0 -1
- package/dist/chunk-4BYX2HZ7.js +0 -22
- package/dist/chunk-4BYX2HZ7.js.map +0 -1
- package/dist/types-_vEO6H8X.d.cts +0 -9
- package/dist/types-_vEO6H8X.d.ts +0 -9
package/dist/index.js
CHANGED
|
@@ -1,85 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { n as TypeStylesContext, r as TypeStylesProvider, t as resolveCssPropClass } from "./css-prop-DMDmFKhu.js";
|
|
2
|
+
import { t as resolveHashClass } from "./resolve-hash-class-Rs_7aMMQ.js";
|
|
3
|
+
import { cssProp } from "./css-prop-runtime.js";
|
|
4
|
+
import { forwardRef } from "react";
|
|
5
|
+
import { cx } from "typestyles";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
//#region src/split-props.ts
|
|
8
|
+
const RESERVED_CONFIG_KEYS = new Set([
|
|
9
|
+
"base",
|
|
10
|
+
"variants",
|
|
11
|
+
"compoundVariants",
|
|
12
|
+
"defaultVariants",
|
|
13
|
+
"slots"
|
|
14
14
|
]);
|
|
15
15
|
function splitVariantProps(props, variantKeys) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
rest
|
|
29
|
-
};
|
|
16
|
+
const variants = {};
|
|
17
|
+
const rest = { ...props };
|
|
18
|
+
for (const key of variantKeys) if (key in rest) {
|
|
19
|
+
variants[key] = rest[key];
|
|
20
|
+
delete rest[key];
|
|
21
|
+
}
|
|
22
|
+
delete rest.className;
|
|
23
|
+
delete rest.css;
|
|
24
|
+
return {
|
|
25
|
+
variants,
|
|
26
|
+
rest
|
|
27
|
+
};
|
|
30
28
|
}
|
|
31
29
|
function getVariantKeysFromConfig(config) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
if (typeof config === "function") return [];
|
|
31
|
+
if ("variants" in config && config.variants && typeof config.variants === "object") return Object.keys(config.variants);
|
|
32
|
+
return Object.keys(config).filter((key) => !RESERVED_CONFIG_KEYS.has(key));
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/create-styled.tsx
|
|
36
|
+
function resolveRecipeFactory(api) {
|
|
37
|
+
if ("recipe" in api) return api.recipe;
|
|
38
|
+
return api.component;
|
|
39
39
|
}
|
|
40
40
|
function resolveStyledArgs(tag, configOrNamespace, maybeConfig) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
if (typeof configOrNamespace === "string" && maybeConfig != null) return {
|
|
42
|
+
tag,
|
|
43
|
+
namespace: configOrNamespace,
|
|
44
|
+
config: maybeConfig
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
tag,
|
|
48
|
+
namespace: typeof tag === "string" ? tag : "styled",
|
|
49
|
+
config: configOrNamespace
|
|
50
|
+
};
|
|
50
51
|
}
|
|
51
|
-
function createStyled(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return /* @__PURE__ */ jsx(Element, { ...rest, ref, className: mergedClassName });
|
|
75
|
-
}
|
|
76
|
-
);
|
|
77
|
-
Component.displayName = namespace.charAt(0).toUpperCase() + namespace.slice(1);
|
|
78
|
-
return Component;
|
|
79
|
-
}
|
|
80
|
-
return styled;
|
|
52
|
+
function createStyled(api) {
|
|
53
|
+
const makeRecipe = resolveRecipeFactory(api);
|
|
54
|
+
function styled(tag, configOrNamespace, maybeConfig) {
|
|
55
|
+
const { tag: element, namespace, config } = resolveStyledArgs(tag, configOrNamespace, maybeConfig);
|
|
56
|
+
const recipe = makeRecipe({
|
|
57
|
+
name: namespace,
|
|
58
|
+
styles: config
|
|
59
|
+
});
|
|
60
|
+
const variantKeys = getVariantKeysFromConfig(config);
|
|
61
|
+
const Component = forwardRef(function StyledComponent(props, ref) {
|
|
62
|
+
const { className, ...propsWithoutClassName } = props;
|
|
63
|
+
const { variants, rest } = splitVariantProps(propsWithoutClassName, variantKeys);
|
|
64
|
+
const mergedClassName = cx(recipe(variants), className);
|
|
65
|
+
return jsx(element, {
|
|
66
|
+
...rest,
|
|
67
|
+
ref,
|
|
68
|
+
className: mergedClassName
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
Component.displayName = namespace.charAt(0).toUpperCase() + namespace.slice(1);
|
|
72
|
+
return Component;
|
|
73
|
+
}
|
|
74
|
+
return styled;
|
|
81
75
|
}
|
|
76
|
+
//#endregion
|
|
77
|
+
export { TypeStylesContext, TypeStylesProvider, createStyled, cssProp, resolveCssPropClass, resolveHashClass };
|
|
82
78
|
|
|
83
|
-
export { createStyled };
|
|
84
|
-
//# sourceMappingURL=index.js.map
|
|
85
79
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/split-props.ts","../src/create-styled.tsx"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":["Element"],"sources":["../src/split-props.ts","../src/create-styled.tsx"],"sourcesContent":["const RESERVED_CONFIG_KEYS = new Set([\n 'base',\n 'variants',\n 'compoundVariants',\n 'defaultVariants',\n 'slots',\n]);\n\nexport function splitVariantProps<P extends Record<string, unknown>>(\n props: P,\n variantKeys: readonly string[],\n): {\n variants: Record<string, unknown>;\n rest: Omit<P, (typeof variantKeys)[number] | 'className' | 'css'>;\n} {\n const variants: Record<string, unknown> = {};\n const rest = { ...props } as Record<string, unknown>;\n\n for (const key of variantKeys) {\n if (key in rest) {\n variants[key] = rest[key];\n delete rest[key];\n }\n }\n\n delete rest.className;\n delete rest.css;\n\n return {\n variants,\n rest: rest as Omit<P, (typeof variantKeys)[number] | 'className' | 'css'>,\n };\n}\n\nexport function getVariantKeysFromConfig(\n config: Record<string, unknown> | ((ctx: unknown) => Record<string, unknown>),\n): readonly string[] {\n if (typeof config === 'function') {\n return [];\n }\n\n if ('variants' in config && config.variants && typeof config.variants === 'object') {\n return Object.keys(config.variants);\n }\n\n return Object.keys(config).filter((key) => !RESERVED_CONFIG_KEYS.has(key));\n}\n","import {\n forwardRef,\n type ComponentPropsWithoutRef,\n type ElementType,\n type ForwardRefExoticComponent,\n type RefAttributes,\n} from 'react';\nimport type {\n ComponentConfigInput,\n ComponentReturn,\n ComponentVariants,\n FlatComponentConfigInput,\n FlatComponentReturn,\n StylesApi,\n TypeStylesApi,\n VariantDefinitions,\n} from 'typestyles';\nimport { cx } from 'typestyles';\nimport { getVariantKeysFromConfig, splitVariantProps } from './split-props';\n\ntype StyledComponentType<Tag extends ElementType, Recipe> = ForwardRefExoticComponent<\n ComponentPropsWithoutRef<Tag> & ComponentVariants<Recipe> & RefAttributes<Element>\n>;\n\nexport type StyledFactory = {\n <Tag extends ElementType, const V extends VariantDefinitions>(\n tag: Tag,\n config: ComponentConfigInput<V>,\n ): StyledComponentType<Tag, ComponentReturn<V>>;\n <Tag extends ElementType, const V extends VariantDefinitions, const N extends string>(\n tag: Tag,\n namespace: N,\n config: ComponentConfigInput<V>,\n ): StyledComponentType<Tag, ComponentReturn<V>>;\n <Tag extends ElementType, const K extends string>(\n tag: Tag,\n config: FlatComponentConfigInput<K>,\n ): StyledComponentType<Tag, FlatComponentReturn<K>>;\n <Tag extends ElementType, const K extends string, const N extends string>(\n tag: Tag,\n namespace: N,\n config: FlatComponentConfigInput<K>,\n ): StyledComponentType<Tag, FlatComponentReturn<K>>;\n};\n\ntype RecipeFactory = StylesApi['component'];\n\n/** Accepts `createTypeStyles()` (preferred) or a lower-level `createStyles()` instance. */\nexport type StyledApi = Pick<TypeStylesApi, 'recipe'> | StylesApi;\n\nfunction resolveRecipeFactory(api: StyledApi): RecipeFactory {\n if ('recipe' in api) return api.recipe;\n return api.component;\n}\n\nfunction resolveStyledArgs(\n tag: ElementType,\n configOrNamespace:\n | string\n | ComponentConfigInput<VariantDefinitions>\n | FlatComponentConfigInput<string>,\n maybeConfig?: ComponentConfigInput<VariantDefinitions> | FlatComponentConfigInput<string>,\n): {\n tag: ElementType;\n namespace: string;\n config: ComponentConfigInput<VariantDefinitions> | FlatComponentConfigInput<string>;\n} {\n if (typeof configOrNamespace === 'string' && maybeConfig != null) {\n return { tag, namespace: configOrNamespace, config: maybeConfig };\n }\n\n const namespace = typeof tag === 'string' ? tag : 'styled';\n return {\n tag,\n namespace,\n config: configOrNamespace as\n | ComponentConfigInput<VariantDefinitions>\n | FlatComponentConfigInput<string>,\n };\n}\n\nexport function createStyled(api: StyledApi): StyledFactory {\n const makeRecipe = resolveRecipeFactory(api);\n\n function styled<Tag extends ElementType>(\n tag: Tag,\n configOrNamespace:\n | string\n | ComponentConfigInput<VariantDefinitions>\n | FlatComponentConfigInput<string>,\n maybeConfig?: ComponentConfigInput<VariantDefinitions> | FlatComponentConfigInput<string>,\n ) {\n const {\n tag: element,\n namespace,\n config,\n } = resolveStyledArgs(tag, configOrNamespace, maybeConfig);\n // `styled` still takes the legacy config object (`base`, `variants`, flat keys).\n // The engine accepts that shape as `styles`; axes stay on `recipe()` itself.\n const recipe = (\n makeRecipe as (input: {\n name: string;\n styles: unknown;\n }) => (selections?: Record<string, unknown>) => { toString(): string }\n )({\n name: namespace,\n styles: config,\n });\n const variantKeys = getVariantKeysFromConfig(\n config as Record<string, unknown> | ((ctx: unknown) => Record<string, unknown>),\n );\n\n const Component = forwardRef<Element, ComponentPropsWithoutRef<Tag> & Record<string, unknown>>(\n function StyledComponent(props, ref) {\n const { className, ...propsWithoutClassName } = props;\n const { variants, rest } = splitVariantProps(\n propsWithoutClassName as Record<string, unknown>,\n variantKeys,\n );\n const mergedClassName = cx(recipe(variants), className);\n const Element = element;\n\n return <Element {...rest} ref={ref} className={mergedClassName} />;\n },\n );\n\n Component.displayName = namespace.charAt(0).toUpperCase() + namespace.slice(1);\n\n return Component;\n }\n\n return styled as StyledFactory;\n}\n"],"mappings":";;;;;;;AAAA,MAAM,uBAAuB,IAAI,IAAI;CACnC;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,SAAgB,kBACd,OACA,aAIA;CACA,MAAM,WAAoC,CAAC;CAC3C,MAAM,OAAO,EAAE,GAAG,MAAM;CAExB,KAAK,MAAM,OAAO,aAChB,IAAI,OAAO,MAAM;EACf,SAAS,OAAO,KAAK;EACrB,OAAO,KAAK;CACd;CAGF,OAAO,KAAK;CACZ,OAAO,KAAK;CAEZ,OAAO;EACL;EACM;CACR;AACF;AAEA,SAAgB,yBACd,QACmB;CACnB,IAAI,OAAO,WAAW,YACpB,OAAO,CAAC;CAGV,IAAI,cAAc,UAAU,OAAO,YAAY,OAAO,OAAO,aAAa,UACxE,OAAO,OAAO,KAAK,OAAO,QAAQ;CAGpC,OAAO,OAAO,KAAK,MAAM,CAAC,CAAC,QAAQ,QAAQ,CAAC,qBAAqB,IAAI,GAAG,CAAC;AAC3E;;;ACIA,SAAS,qBAAqB,KAA+B;CAC3D,IAAI,YAAY,KAAK,OAAO,IAAI;CAChC,OAAO,IAAI;AACb;AAEA,SAAS,kBACP,KACA,mBAIA,aAKA;CACA,IAAI,OAAO,sBAAsB,YAAY,eAAe,MAC1D,OAAO;EAAE;EAAK,WAAW;EAAmB,QAAQ;CAAY;CAIlE,OAAO;EACL;EACA,WAHgB,OAAO,QAAQ,WAAW,MAAM;EAIhD,QAAQ;CAGV;AACF;AAEA,SAAgB,aAAa,KAA+B;CAC1D,MAAM,aAAa,qBAAqB,GAAG;CAE3C,SAAS,OACP,KACA,mBAIA,aACA;EACA,MAAM,EACJ,KAAK,SACL,WACA,WACE,kBAAkB,KAAK,mBAAmB,WAAW;EAGzD,MAAM,SACJ,WAIA;GACA,MAAM;GACN,QAAQ;EACV,CAAC;EACD,MAAM,cAAc,yBAClB,MACF;EAEA,MAAM,YAAY,WAChB,SAAS,gBAAgB,OAAO,KAAK;GACnC,MAAM,EAAE,WAAW,GAAG,0BAA0B;GAChD,MAAM,EAAE,UAAU,SAAS,kBACzB,uBACA,WACF;GACA,MAAM,kBAAkB,GAAG,OAAO,QAAQ,GAAG,SAAS;GAGtD,OAAO,IAACA,SAAD;IAAS,GAAI;IAAW;IAAK,WAAW;GAAkB,CAAA;EACnE,CACF;EAEA,UAAU,cAAc,UAAU,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,UAAU,MAAM,CAAC;EAE7E,OAAO;CACT;CAEA,OAAO;AACT"}
|
package/dist/jsx-dev-runtime.cjs
CHANGED
|
@@ -1,44 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
var TypeStylesContext = react.createContext(null);
|
|
16
|
-
|
|
17
|
-
// src/jsx-dev-runtime.ts
|
|
18
|
-
function processCssProp(props, styles) {
|
|
19
|
-
if (props.css == null) {
|
|
20
|
-
return props;
|
|
21
|
-
}
|
|
22
|
-
const { css, className, ...rest } = props;
|
|
23
|
-
const nextProps = {
|
|
24
|
-
...rest,
|
|
25
|
-
className: resolveCssPropClass(styles.hashClass, css, className)
|
|
26
|
-
};
|
|
27
|
-
return nextProps;
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_css_prop = require("./css-prop-DOMoNwJN.cjs");
|
|
3
|
+
const require_resolve_hash_class = require("./resolve-hash-class-DuqLJq6S.cjs");
|
|
4
|
+
let react = require("react");
|
|
5
|
+
let react_jsx_dev_runtime = require("react/jsx-dev-runtime");
|
|
6
|
+
//#region src/jsx-dev-runtime.ts
|
|
7
|
+
function processCssProp(props, hashClass) {
|
|
8
|
+
if (props.css == null) return props;
|
|
9
|
+
const { css, className, ...rest } = props;
|
|
10
|
+
return {
|
|
11
|
+
...rest,
|
|
12
|
+
className: require_css_prop.resolveCssPropClass(hashClass, css, className)
|
|
13
|
+
};
|
|
28
14
|
}
|
|
29
|
-
|
|
15
|
+
const Fragment = react_jsx_dev_runtime.Fragment;
|
|
30
16
|
function jsxDEV(type, props, key, isStaticChildren, source, self) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
const nextProps = styles ? processCssProp(props, styles) : props;
|
|
38
|
-
return jsxDevRuntime.jsxDEV(type, nextProps, key, isStaticChildren, source, self);
|
|
17
|
+
const styles = (0, react.useContext)(require_css_prop.TypeStylesContext);
|
|
18
|
+
if (props.css != null && styles == null) throw new Error("[@typestyles/react] The `css` prop requires a `TypeStylesProvider` with a styles instance. Wrap your app in `<TypeStylesProvider styles={api}>` (from `createTypeStyles()`), or use the Babel plugin for zero-runtime css props.");
|
|
19
|
+
const nextProps = styles ? processCssProp(props, require_resolve_hash_class.resolveHashClass(styles)) : props;
|
|
20
|
+
return (0, react_jsx_dev_runtime.jsxDEV)(type, nextProps, key, isStaticChildren, source, self);
|
|
39
21
|
}
|
|
40
|
-
|
|
22
|
+
//#endregion
|
|
41
23
|
exports.Fragment = Fragment;
|
|
42
24
|
exports.jsxDEV = jsxDEV;
|
|
43
|
-
|
|
25
|
+
|
|
44
26
|
//# sourceMappingURL=jsx-dev-runtime.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.cjs","names":["resolveCssPropClass","ReactFragment","useContext","TypeStylesContext","resolveHashClass","reactJsxDEV"],"sources":["../src/jsx-dev-runtime.ts"],"sourcesContent":["import { useContext, type ElementType, type ReactNode } from 'react';\nimport { jsxDEV as reactJsxDEV, Fragment as ReactFragment } from 'react/jsx-dev-runtime';\nimport type { CSSProperties } from 'typestyles';\nimport { resolveCssPropClass } from './css-prop';\nimport { TypeStylesContext } from './context';\nimport { resolveHashClass } from './resolve-hash-class';\nimport type { WithCssProp } from './types';\n\nfunction processCssProp<P extends Record<string, unknown>>(\n props: WithCssProp<P>,\n hashClass: (properties: CSSProperties, label?: string) => string,\n): P {\n if (props.css == null) {\n return props as P;\n }\n\n const { css, className, ...rest } = props;\n const nextProps = {\n ...rest,\n className: resolveCssPropClass(hashClass, css, className),\n } as unknown as P;\n\n return nextProps;\n}\n\nexport const Fragment = ReactFragment;\n\nexport function jsxDEV<P extends Record<string, unknown>>(\n type: ElementType,\n props: WithCssProp<P>,\n key: React.Key | undefined,\n isStaticChildren: boolean,\n source: object | undefined,\n self: unknown,\n): React.ReactElement {\n const styles = useContext(TypeStylesContext);\n\n if (props.css != null && styles == null) {\n throw new Error(\n '[@typestyles/react] The `css` prop requires a `TypeStylesProvider` with a styles instance. ' +\n 'Wrap your app in `<TypeStylesProvider styles={api}>` (from `createTypeStyles()`), or use the Babel plugin for zero-runtime css props.',\n );\n }\n\n const nextProps = styles ? processCssProp(props, resolveHashClass(styles)) : (props as P);\n return reactJsxDEV(type, nextProps, key, isStaticChildren, source, self);\n}\n\nexport type { ReactNode };\n"],"mappings":";;;;;;AAQA,SAAS,eACP,OACA,WACG;CACH,IAAI,MAAM,OAAO,MACf,OAAO;CAGT,MAAM,EAAE,KAAK,WAAW,GAAG,SAAS;CAMpC,OAAO;EAJL,GAAG;EACH,WAAWA,iBAAAA,oBAAoB,WAAW,KAAK,SAAS;CAG3C;AACjB;AAEA,MAAa,WAAWC,sBAAAA;AAExB,SAAgB,OACd,MACA,OACA,KACA,kBACA,QACA,MACoB;CACpB,MAAM,UAAA,GAASC,MAAAA,WAAAA,CAAWC,iBAAAA,iBAAiB;CAE3C,IAAI,MAAM,OAAO,QAAQ,UAAU,MACjC,MAAM,IAAI,MACR,kOAEF;CAGF,MAAM,YAAY,SAAS,eAAe,OAAOC,2BAAAA,iBAAiB,MAAM,CAAC,IAAK;CAC9E,QAAA,GAAOC,sBAAAA,OAAAA,CAAY,MAAM,WAAW,KAAK,kBAAkB,QAAQ,IAAI;AACzE"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
declare const Fragment: react.ExoticComponent<{
|
|
8
|
-
children?: ReactNode | undefined;
|
|
1
|
+
import { n as WithCssProp } from "./types-DcDsqg2q.cjs";
|
|
2
|
+
import { ElementType, ReactNode } from "react";
|
|
3
|
+
//#region src/jsx-dev-runtime.d.ts
|
|
4
|
+
export declare const Fragment: import("react").ExoticComponent<{
|
|
5
|
+
children?: ReactNode | undefined;
|
|
9
6
|
}>;
|
|
10
|
-
declare function jsxDEV<P extends Record<string, unknown>>(type: ElementType, props: WithCssProp<P>, key: React.Key | undefined, isStaticChildren: boolean, source: object | undefined, self: unknown): React.ReactElement;
|
|
11
|
-
|
|
12
|
-
export {
|
|
7
|
+
export declare function jsxDEV<P extends Record<string, unknown>>(type: ElementType, props: WithCssProp<P>, key: React.Key | undefined, isStaticChildren: boolean, source: object | undefined, self: unknown): React.ReactElement;
|
|
8
|
+
//#endregion
|
|
9
|
+
export type { ReactNode };
|
|
10
|
+
//# sourceMappingURL=jsx-dev-runtime.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.d.cts","names":[],"sources":["../src/jsx-dev-runtime.ts"],"mappings":";;;qBAyBa,0BAAQ;;;wBAEL,OAAO,UAAU,yBAC/B,MAAM,aACN,OAAO,YAAY,IACnB,KAAK,MAAM,iBACX,2BACA,4BACA,gBACC,MAAM"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
declare const Fragment: react.ExoticComponent<{
|
|
8
|
-
children?: ReactNode | undefined;
|
|
1
|
+
import { n as WithCssProp } from "./types-DcDsqg2q.js";
|
|
2
|
+
import { ElementType, ReactNode } from "react";
|
|
3
|
+
//#region src/jsx-dev-runtime.d.ts
|
|
4
|
+
export declare const Fragment: import("react").ExoticComponent<{
|
|
5
|
+
children?: ReactNode | undefined;
|
|
9
6
|
}>;
|
|
10
|
-
declare function jsxDEV<P extends Record<string, unknown>>(type: ElementType, props: WithCssProp<P>, key: React.Key | undefined, isStaticChildren: boolean, source: object | undefined, self: unknown): React.ReactElement;
|
|
11
|
-
|
|
12
|
-
export {
|
|
7
|
+
export declare function jsxDEV<P extends Record<string, unknown>>(type: ElementType, props: WithCssProp<P>, key: React.Key | undefined, isStaticChildren: boolean, source: object | undefined, self: unknown): React.ReactElement;
|
|
8
|
+
//#endregion
|
|
9
|
+
export type { ReactNode };
|
|
10
|
+
//# sourceMappingURL=jsx-dev-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.d.ts","names":[],"sources":["../src/jsx-dev-runtime.ts"],"mappings":";;;qBAyBa,0BAAQ;;;wBAEL,OAAO,UAAU,yBAC/B,MAAM,aACN,OAAO,YAAY,IACnB,KAAK,MAAM,iBACX,2BACA,4BACA,gBACC,MAAM"}
|
package/dist/jsx-dev-runtime.js
CHANGED
|
@@ -1,30 +1,24 @@
|
|
|
1
|
-
import { TypeStylesContext, resolveCssPropClass } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
return nextProps;
|
|
1
|
+
import { n as TypeStylesContext, t as resolveCssPropClass } from "./css-prop-DMDmFKhu.js";
|
|
2
|
+
import { t as resolveHashClass } from "./resolve-hash-class-Rs_7aMMQ.js";
|
|
3
|
+
import { useContext } from "react";
|
|
4
|
+
import { Fragment as Fragment$1, jsxDEV as jsxDEV$1 } from "react/jsx-dev-runtime";
|
|
5
|
+
//#region src/jsx-dev-runtime.ts
|
|
6
|
+
function processCssProp(props, hashClass) {
|
|
7
|
+
if (props.css == null) return props;
|
|
8
|
+
const { css, className, ...rest } = props;
|
|
9
|
+
return {
|
|
10
|
+
...rest,
|
|
11
|
+
className: resolveCssPropClass(hashClass, css, className)
|
|
12
|
+
};
|
|
15
13
|
}
|
|
16
|
-
|
|
14
|
+
const Fragment = Fragment$1;
|
|
17
15
|
function jsxDEV(type, props, key, isStaticChildren, source, self) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
const nextProps = styles ? processCssProp(props, styles) : props;
|
|
25
|
-
return jsxDEV$1(type, nextProps, key, isStaticChildren, source, self);
|
|
16
|
+
const styles = useContext(TypeStylesContext);
|
|
17
|
+
if (props.css != null && styles == null) throw new Error("[@typestyles/react] The `css` prop requires a `TypeStylesProvider` with a styles instance. Wrap your app in `<TypeStylesProvider styles={api}>` (from `createTypeStyles()`), or use the Babel plugin for zero-runtime css props.");
|
|
18
|
+
const nextProps = styles ? processCssProp(props, resolveHashClass(styles)) : props;
|
|
19
|
+
return jsxDEV$1(type, nextProps, key, isStaticChildren, source, self);
|
|
26
20
|
}
|
|
27
|
-
|
|
21
|
+
//#endregion
|
|
28
22
|
export { Fragment, jsxDEV };
|
|
29
|
-
|
|
23
|
+
|
|
30
24
|
//# sourceMappingURL=jsx-dev-runtime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.js","names":["ReactFragment","reactJsxDEV"],"sources":["../src/jsx-dev-runtime.ts"],"sourcesContent":["import { useContext, type ElementType, type ReactNode } from 'react';\nimport { jsxDEV as reactJsxDEV, Fragment as ReactFragment } from 'react/jsx-dev-runtime';\nimport type { CSSProperties } from 'typestyles';\nimport { resolveCssPropClass } from './css-prop';\nimport { TypeStylesContext } from './context';\nimport { resolveHashClass } from './resolve-hash-class';\nimport type { WithCssProp } from './types';\n\nfunction processCssProp<P extends Record<string, unknown>>(\n props: WithCssProp<P>,\n hashClass: (properties: CSSProperties, label?: string) => string,\n): P {\n if (props.css == null) {\n return props as P;\n }\n\n const { css, className, ...rest } = props;\n const nextProps = {\n ...rest,\n className: resolveCssPropClass(hashClass, css, className),\n } as unknown as P;\n\n return nextProps;\n}\n\nexport const Fragment = ReactFragment;\n\nexport function jsxDEV<P extends Record<string, unknown>>(\n type: ElementType,\n props: WithCssProp<P>,\n key: React.Key | undefined,\n isStaticChildren: boolean,\n source: object | undefined,\n self: unknown,\n): React.ReactElement {\n const styles = useContext(TypeStylesContext);\n\n if (props.css != null && styles == null) {\n throw new Error(\n '[@typestyles/react] The `css` prop requires a `TypeStylesProvider` with a styles instance. ' +\n 'Wrap your app in `<TypeStylesProvider styles={api}>` (from `createTypeStyles()`), or use the Babel plugin for zero-runtime css props.',\n );\n }\n\n const nextProps = styles ? processCssProp(props, resolveHashClass(styles)) : (props as P);\n return reactJsxDEV(type, nextProps, key, isStaticChildren, source, self);\n}\n\nexport type { ReactNode };\n"],"mappings":";;;;;AAQA,SAAS,eACP,OACA,WACG;CACH,IAAI,MAAM,OAAO,MACf,OAAO;CAGT,MAAM,EAAE,KAAK,WAAW,GAAG,SAAS;CAMpC,OAAO;EAJL,GAAG;EACH,WAAW,oBAAoB,WAAW,KAAK,SAAS;CAG3C;AACjB;AAEA,MAAa,WAAWA;AAExB,SAAgB,OACd,MACA,OACA,KACA,kBACA,QACA,MACoB;CACpB,MAAM,SAAS,WAAW,iBAAiB;CAE3C,IAAI,MAAM,OAAO,QAAQ,UAAU,MACjC,MAAM,IAAI,MACR,kOAEF;CAGF,MAAM,YAAY,SAAS,eAAe,OAAO,iBAAiB,MAAM,CAAC,IAAK;CAC9E,OAAOC,SAAY,MAAM,WAAW,KAAK,kBAAkB,QAAQ,IAAI;AACzE"}
|
package/dist/jsx-runtime.cjs
CHANGED
|
@@ -1,50 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
var TypeStylesContext = react.createContext(null);
|
|
15
|
-
|
|
16
|
-
// src/jsx-runtime.ts
|
|
17
|
-
function processCssProp(props, styles) {
|
|
18
|
-
if (props.css == null) {
|
|
19
|
-
return props;
|
|
20
|
-
}
|
|
21
|
-
const { css, className, ...rest } = props;
|
|
22
|
-
const nextProps = {
|
|
23
|
-
...rest,
|
|
24
|
-
className: resolveCssPropClass(styles.hashClass, css, className)
|
|
25
|
-
};
|
|
26
|
-
return nextProps;
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_css_prop = require("./css-prop-DOMoNwJN.cjs");
|
|
3
|
+
const require_resolve_hash_class = require("./resolve-hash-class-DuqLJq6S.cjs");
|
|
4
|
+
let react = require("react");
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
//#region src/jsx-runtime.ts
|
|
7
|
+
function processCssProp(props, hashClass) {
|
|
8
|
+
if (props.css == null) return props;
|
|
9
|
+
const { css, className, ...rest } = props;
|
|
10
|
+
return {
|
|
11
|
+
...rest,
|
|
12
|
+
className: require_css_prop.resolveCssPropClass(hashClass, css, className)
|
|
13
|
+
};
|
|
27
14
|
}
|
|
28
15
|
function wrapJsx(factory, type, props, key) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"[@typestyles/react] The `css` prop requires a `TypeStylesProvider` with a `styles` instance. Wrap your app in `<TypeStylesProvider styles={styles}>`, or use the Babel plugin for zero-runtime css props."
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
const nextProps = styles ? processCssProp(props, styles) : props;
|
|
36
|
-
return factory(type, nextProps, key);
|
|
16
|
+
const styles = (0, react.useContext)(require_css_prop.TypeStylesContext);
|
|
17
|
+
if (props.css != null && styles == null) throw new Error("[@typestyles/react] The `css` prop requires a `TypeStylesProvider` with a styles instance. Wrap your app in `<TypeStylesProvider styles={api}>` (from `createTypeStyles()`), or use the Babel plugin for zero-runtime css props.");
|
|
18
|
+
return factory(type, styles ? processCssProp(props, require_resolve_hash_class.resolveHashClass(styles)) : props, key);
|
|
37
19
|
}
|
|
38
|
-
|
|
39
|
-
function
|
|
40
|
-
|
|
20
|
+
const Fragment = react_jsx_runtime.Fragment;
|
|
21
|
+
function jsx(type, props, key) {
|
|
22
|
+
return wrapJsx(react_jsx_runtime.jsx, type, props, key);
|
|
41
23
|
}
|
|
42
24
|
function jsxs(type, props, key) {
|
|
43
|
-
|
|
25
|
+
return wrapJsx(react_jsx_runtime.jsxs, type, props, key);
|
|
44
26
|
}
|
|
45
|
-
|
|
27
|
+
//#endregion
|
|
46
28
|
exports.Fragment = Fragment;
|
|
47
|
-
exports.jsx =
|
|
29
|
+
exports.jsx = jsx;
|
|
48
30
|
exports.jsxs = jsxs;
|
|
49
|
-
|
|
31
|
+
|
|
50
32
|
//# sourceMappingURL=jsx-runtime.cjs.map
|
package/dist/jsx-runtime.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"jsx-runtime.cjs","names":["resolveCssPropClass","useContext","TypeStylesContext","resolveHashClass","ReactFragment","reactJsx","reactJsxs"],"sources":["../src/jsx-runtime.ts"],"sourcesContent":["import { useContext, type ElementType, type ReactNode } from 'react';\nimport { jsx as reactJsx, jsxs as reactJsxs, Fragment as ReactFragment } from 'react/jsx-runtime';\nimport type { CSSProperties } from 'typestyles';\nimport { resolveCssPropClass } from './css-prop';\nimport { TypeStylesContext } from './context';\nimport { resolveHashClass } from './resolve-hash-class';\nimport type { WithCssProp } from './types';\n\nfunction processCssProp<P extends Record<string, unknown>>(\n props: WithCssProp<P>,\n hashClass: (properties: CSSProperties, label?: string) => string,\n): P {\n if (props.css == null) {\n return props as P;\n }\n\n const { css, className, ...rest } = props;\n const nextProps = {\n ...rest,\n className: resolveCssPropClass(hashClass, css, className),\n } as unknown as P;\n\n return nextProps;\n}\n\nfunction wrapJsx<P extends Record<string, unknown>>(\n factory: typeof reactJsx,\n type: ElementType,\n props: WithCssProp<P>,\n key?: React.Key,\n): React.ReactElement {\n const styles = useContext(TypeStylesContext);\n\n if (props.css != null && styles == null) {\n throw new Error(\n '[@typestyles/react] The `css` prop requires a `TypeStylesProvider` with a styles instance. ' +\n 'Wrap your app in `<TypeStylesProvider styles={api}>` (from `createTypeStyles()`), or use the Babel plugin for zero-runtime css props.',\n );\n }\n\n const nextProps = styles ? processCssProp(props, resolveHashClass(styles)) : (props as P);\n return factory(type, nextProps, key);\n}\n\nexport const Fragment = ReactFragment;\n\nexport function jsx<P extends Record<string, unknown>>(\n type: ElementType,\n props: WithCssProp<P>,\n key?: React.Key,\n): React.ReactElement {\n return wrapJsx(reactJsx, type, props, key);\n}\n\nexport function jsxs<P extends Record<string, unknown>>(\n type: ElementType,\n props: WithCssProp<P>,\n key?: React.Key,\n): React.ReactElement {\n return wrapJsx(reactJsxs, type, props, key);\n}\n\nexport type { ReactNode };\n"],"mappings":";;;;;;AAQA,SAAS,eACP,OACA,WACG;CACH,IAAI,MAAM,OAAO,MACf,OAAO;CAGT,MAAM,EAAE,KAAK,WAAW,GAAG,SAAS;CAMpC,OAAO;EAJL,GAAG;EACH,WAAWA,iBAAAA,oBAAoB,WAAW,KAAK,SAAS;CAG3C;AACjB;AAEA,SAAS,QACP,SACA,MACA,OACA,KACoB;CACpB,MAAM,UAAA,GAASC,MAAAA,WAAAA,CAAWC,iBAAAA,iBAAiB;CAE3C,IAAI,MAAM,OAAO,QAAQ,UAAU,MACjC,MAAM,IAAI,MACR,kOAEF;CAIF,OAAO,QAAQ,MADG,SAAS,eAAe,OAAOC,2BAAAA,iBAAiB,MAAM,CAAC,IAAK,OAC9C,GAAG;AACrC;AAEA,MAAa,WAAWC,kBAAAA;AAExB,SAAgB,IACd,MACA,OACA,KACoB;CACpB,OAAO,QAAQC,kBAAAA,KAAU,MAAM,OAAO,GAAG;AAC3C;AAEA,SAAgB,KACd,MACA,OACA,KACoB;CACpB,OAAO,QAAQC,kBAAAA,MAAW,MAAM,OAAO,GAAG;AAC5C"}
|
package/dist/jsx-runtime.d.cts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
declare const Fragment: react.ExoticComponent<{
|
|
8
|
-
children?: ReactNode | undefined;
|
|
1
|
+
import { n as WithCssProp } from "./types-DcDsqg2q.cjs";
|
|
2
|
+
import { ElementType, ReactNode } from "react";
|
|
3
|
+
//#region src/jsx-runtime.d.ts
|
|
4
|
+
export declare const Fragment: import("react").ExoticComponent<{
|
|
5
|
+
children?: ReactNode | undefined;
|
|
9
6
|
}>;
|
|
10
|
-
declare function jsx<P extends Record<string, unknown>>(type: ElementType, props: WithCssProp<P>, key?: React.Key): React.ReactElement;
|
|
11
|
-
declare function jsxs<P extends Record<string, unknown>>(type: ElementType, props: WithCssProp<P>, key?: React.Key): React.ReactElement;
|
|
12
|
-
|
|
13
|
-
export {
|
|
7
|
+
export declare function jsx<P extends Record<string, unknown>>(type: ElementType, props: WithCssProp<P>, key?: React.Key): React.ReactElement;
|
|
8
|
+
export declare function jsxs<P extends Record<string, unknown>>(type: ElementType, props: WithCssProp<P>, key?: React.Key): React.ReactElement;
|
|
9
|
+
//#endregion
|
|
10
|
+
export type { ReactNode };
|
|
11
|
+
//# sourceMappingURL=jsx-runtime.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-runtime.d.cts","names":[],"sources":["../src/jsx-runtime.ts"],"mappings":";;;qBA4Ca,0BAAQ;;;wBAEL,IAAI,UAAU,yBAC5B,MAAM,aACN,OAAO,YAAY,IACnB,MAAM,MAAM,MACX,MAAM;wBAIO,KAAK,UAAU,yBAC7B,MAAM,aACN,OAAO,YAAY,IACnB,MAAM,MAAM,MACX,MAAM"}
|
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
declare const Fragment: react.ExoticComponent<{
|
|
8
|
-
children?: ReactNode | undefined;
|
|
1
|
+
import { n as WithCssProp } from "./types-DcDsqg2q.js";
|
|
2
|
+
import { ElementType, ReactNode } from "react";
|
|
3
|
+
//#region src/jsx-runtime.d.ts
|
|
4
|
+
export declare const Fragment: import("react").ExoticComponent<{
|
|
5
|
+
children?: ReactNode | undefined;
|
|
9
6
|
}>;
|
|
10
|
-
declare function jsx<P extends Record<string, unknown>>(type: ElementType, props: WithCssProp<P>, key?: React.Key): React.ReactElement;
|
|
11
|
-
declare function jsxs<P extends Record<string, unknown>>(type: ElementType, props: WithCssProp<P>, key?: React.Key): React.ReactElement;
|
|
12
|
-
|
|
13
|
-
export {
|
|
7
|
+
export declare function jsx<P extends Record<string, unknown>>(type: ElementType, props: WithCssProp<P>, key?: React.Key): React.ReactElement;
|
|
8
|
+
export declare function jsxs<P extends Record<string, unknown>>(type: ElementType, props: WithCssProp<P>, key?: React.Key): React.ReactElement;
|
|
9
|
+
//#endregion
|
|
10
|
+
export type { ReactNode };
|
|
11
|
+
//# sourceMappingURL=jsx-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-runtime.d.ts","names":[],"sources":["../src/jsx-runtime.ts"],"mappings":";;;qBA4Ca,0BAAQ;;;wBAEL,IAAI,UAAU,yBAC5B,MAAM,aACN,OAAO,YAAY,IACnB,MAAM,MAAM,MACX,MAAM;wBAIO,KAAK,UAAU,yBAC7B,MAAM,aACN,OAAO,YAAY,IACnB,MAAM,MAAM,MACX,MAAM"}
|
package/dist/jsx-runtime.js
CHANGED
|
@@ -1,36 +1,29 @@
|
|
|
1
|
-
import { TypeStylesContext, resolveCssPropClass } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
return nextProps;
|
|
1
|
+
import { n as TypeStylesContext, t as resolveCssPropClass } from "./css-prop-DMDmFKhu.js";
|
|
2
|
+
import { t as resolveHashClass } from "./resolve-hash-class-Rs_7aMMQ.js";
|
|
3
|
+
import { useContext } from "react";
|
|
4
|
+
import { Fragment as Fragment$1, jsx as jsx$1, jsxs as jsxs$1 } from "react/jsx-runtime";
|
|
5
|
+
//#region src/jsx-runtime.ts
|
|
6
|
+
function processCssProp(props, hashClass) {
|
|
7
|
+
if (props.css == null) return props;
|
|
8
|
+
const { css, className, ...rest } = props;
|
|
9
|
+
return {
|
|
10
|
+
...rest,
|
|
11
|
+
className: resolveCssPropClass(hashClass, css, className)
|
|
12
|
+
};
|
|
15
13
|
}
|
|
16
14
|
function wrapJsx(factory, type, props, key) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"[@typestyles/react] The `css` prop requires a `TypeStylesProvider` with a `styles` instance. Wrap your app in `<TypeStylesProvider styles={styles}>`, or use the Babel plugin for zero-runtime css props."
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
const nextProps = styles ? processCssProp(props, styles) : props;
|
|
24
|
-
return factory(type, nextProps, key);
|
|
15
|
+
const styles = useContext(TypeStylesContext);
|
|
16
|
+
if (props.css != null && styles == null) throw new Error("[@typestyles/react] The `css` prop requires a `TypeStylesProvider` with a styles instance. Wrap your app in `<TypeStylesProvider styles={api}>` (from `createTypeStyles()`), or use the Babel plugin for zero-runtime css props.");
|
|
17
|
+
return factory(type, styles ? processCssProp(props, resolveHashClass(styles)) : props, key);
|
|
25
18
|
}
|
|
26
|
-
|
|
19
|
+
const Fragment = Fragment$1;
|
|
27
20
|
function jsx(type, props, key) {
|
|
28
|
-
|
|
21
|
+
return wrapJsx(jsx$1, type, props, key);
|
|
29
22
|
}
|
|
30
23
|
function jsxs(type, props, key) {
|
|
31
|
-
|
|
24
|
+
return wrapJsx(jsxs$1, type, props, key);
|
|
32
25
|
}
|
|
33
|
-
|
|
26
|
+
//#endregion
|
|
34
27
|
export { Fragment, jsx, jsxs };
|
|
35
|
-
|
|
28
|
+
|
|
36
29
|
//# sourceMappingURL=jsx-runtime.js.map
|