@typestyles/react 0.0.0-unstable.fb509f91ba06 → 0.0.0-unstable.ff74983e3aa5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +1 -1
  2. package/dist/babel-plugin.cjs +14223 -152
  3. package/dist/babel-plugin.cjs.map +1 -1
  4. package/dist/babel-plugin.d.cts +10 -10
  5. package/dist/babel-plugin.d.cts.map +1 -0
  6. package/dist/babel-plugin.d.ts +10 -10
  7. package/dist/babel-plugin.d.ts.map +1 -0
  8. package/dist/babel-plugin.js +14223 -130
  9. package/dist/babel-plugin.js.map +1 -1
  10. package/dist/css-prop-DMDmFKhu.js +21 -0
  11. package/dist/css-prop-DMDmFKhu.js.map +1 -0
  12. package/dist/css-prop-DOMoNwJN.cjs +38 -0
  13. package/dist/css-prop-DOMoNwJN.cjs.map +1 -0
  14. package/dist/{css-prop-runtime-DHYMbbZm.d.ts → css-prop-runtime-zKybLO8E.d.cts} +7 -5
  15. package/dist/css-prop-runtime-zKybLO8E.d.cts.map +1 -0
  16. package/dist/{css-prop-runtime-DHYMbbZm.d.cts → css-prop-runtime-zKybLO8E.d.ts} +7 -5
  17. package/dist/css-prop-runtime-zKybLO8E.d.ts.map +1 -0
  18. package/dist/css-prop-runtime.cjs +6 -14
  19. package/dist/css-prop-runtime.cjs.map +1 -1
  20. package/dist/css-prop-runtime.d.cts +2 -2
  21. package/dist/css-prop-runtime.d.ts +2 -2
  22. package/dist/css-prop-runtime.js +8 -3
  23. package/dist/css-prop-runtime.js.map +1 -1
  24. package/dist/index.cjs +72 -110
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +23 -23
  27. package/dist/index.d.cts.map +1 -0
  28. package/dist/index.d.ts +23 -23
  29. package/dist/index.d.ts.map +1 -0
  30. package/dist/index.js +66 -78
  31. package/dist/index.js.map +1 -1
  32. package/dist/jsx-dev-runtime.cjs +19 -45
  33. package/dist/jsx-dev-runtime.cjs.map +1 -1
  34. package/dist/jsx-dev-runtime.d.cts +9 -11
  35. package/dist/jsx-dev-runtime.d.cts.map +1 -0
  36. package/dist/jsx-dev-runtime.d.ts +9 -11
  37. package/dist/jsx-dev-runtime.d.ts.map +1 -0
  38. package/dist/jsx-dev-runtime.js +18 -25
  39. package/dist/jsx-dev-runtime.js.map +1 -1
  40. package/dist/jsx-runtime.cjs +22 -48
  41. package/dist/jsx-runtime.cjs.map +1 -1
  42. package/dist/jsx-runtime.d.cts +10 -12
  43. package/dist/jsx-runtime.d.cts.map +1 -0
  44. package/dist/jsx-runtime.d.ts +10 -12
  45. package/dist/jsx-runtime.d.ts.map +1 -0
  46. package/dist/jsx-runtime.js +19 -27
  47. package/dist/jsx-runtime.js.map +1 -1
  48. package/dist/resolve-hash-class-DuqLJq6S.cjs +14 -0
  49. package/dist/resolve-hash-class-DuqLJq6S.cjs.map +1 -0
  50. package/dist/resolve-hash-class-Rs_7aMMQ.js +9 -0
  51. package/dist/resolve-hash-class-Rs_7aMMQ.js.map +1 -0
  52. package/dist/types-DcDsqg2q.d.cts +10 -0
  53. package/dist/types-DcDsqg2q.d.cts.map +1 -0
  54. package/dist/types-DcDsqg2q.d.ts +10 -0
  55. package/dist/types-DcDsqg2q.d.ts.map +1 -0
  56. package/package.json +9 -11
  57. package/dist/chunk-IHZMLPG2.js +0 -22
  58. package/dist/chunk-IHZMLPG2.js.map +0 -1
  59. package/dist/chunk-KM65VQPZ.js +0 -11
  60. package/dist/chunk-KM65VQPZ.js.map +0 -1
  61. package/dist/chunk-TLEOUPD2.js +0 -10
  62. package/dist/chunk-TLEOUPD2.js.map +0 -1
  63. package/dist/types-_vEO6H8X.d.cts +0 -9
  64. package/dist/types-_vEO6H8X.d.ts +0 -9
@@ -1,37 +1,29 @@
1
- import { TypeStylesContext, resolveCssPropClass } from './chunk-IHZMLPG2.js';
2
- import { resolveHashClass } from './chunk-KM65VQPZ.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
-
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
6
  function processCssProp(props, hashClass) {
7
- if (props.css == null) {
8
- return props;
9
- }
10
- const { css, className, ...rest } = props;
11
- const nextProps = {
12
- ...rest,
13
- className: resolveCssPropClass(hashClass, css, className)
14
- };
15
- return nextProps;
7
+ if (props.css == null) return props;
8
+ const { css, className, ...rest } = props;
9
+ return {
10
+ ...rest,
11
+ className: resolveCssPropClass(hashClass, css, className)
12
+ };
16
13
  }
17
14
  function wrapJsx(factory, type, props, key) {
18
- const styles = useContext(TypeStylesContext);
19
- if (props.css != null && styles == null) {
20
- throw new Error(
21
- "[@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."
22
- );
23
- }
24
- const nextProps = styles ? processCssProp(props, resolveHashClass(styles)) : props;
25
- 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);
26
18
  }
27
- var Fragment = Fragment$1;
19
+ const Fragment = Fragment$1;
28
20
  function jsx(type, props, key) {
29
- return wrapJsx(jsx$1, type, props, key);
21
+ return wrapJsx(jsx$1, type, props, key);
30
22
  }
31
23
  function jsxs(type, props, key) {
32
- return wrapJsx(jsxs$1, type, props, key);
24
+ return wrapJsx(jsxs$1, type, props, key);
33
25
  }
34
-
26
+ //#endregion
35
27
  export { Fragment, jsx, jsxs };
36
- //# sourceMappingURL=jsx-runtime.js.map
28
+
37
29
  //# sourceMappingURL=jsx-runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/jsx-runtime.ts"],"names":["ReactFragment","reactJsx","reactJsxs"],"mappings":";;;;;AAQA,SAAS,cAAA,CACP,OACA,SAAA,EACG;AACH,EAAA,IAAI,KAAA,CAAM,OAAO,IAAA,EAAM;AACrB,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,MAAM,EAAE,GAAA,EAAK,SAAA,EAAW,GAAG,MAAK,GAAI,KAAA;AACpC,EAAA,MAAM,SAAA,GAAY;AAAA,IAChB,GAAG,IAAA;AAAA,IACH,SAAA,EAAW,mBAAA,CAAoB,SAAA,EAAW,GAAA,EAAK,SAAS;AAAA,GAC1D;AAEA,EAAA,OAAO,SAAA;AACT;AAEA,SAAS,OAAA,CACP,OAAA,EACA,IAAA,EACA,KAAA,EACA,GAAA,EACoB;AACpB,EAAA,MAAM,MAAA,GAAS,WAAW,iBAAiB,CAAA;AAE3C,EAAA,IAAI,KAAA,CAAM,GAAA,IAAO,IAAA,IAAQ,MAAA,IAAU,IAAA,EAAM;AACvC,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,KAEF;AAAA,EACF;AAEA,EAAA,MAAM,YAAY,MAAA,GAAS,cAAA,CAAe,OAAO,gBAAA,CAAiB,MAAM,CAAC,CAAA,GAAK,KAAA;AAC9E,EAAA,OAAO,OAAA,CAAQ,IAAA,EAAM,SAAA,EAAW,GAAG,CAAA;AACrC;AAEO,IAAM,QAAA,GAAWA;AAEjB,SAAS,GAAA,CACd,IAAA,EACA,KAAA,EACA,GAAA,EACoB;AACpB,EAAA,OAAO,OAAA,CAAQC,KAAA,EAAU,IAAA,EAAM,KAAA,EAAO,GAAG,CAAA;AAC3C;AAEO,SAAS,IAAA,CACd,IAAA,EACA,KAAA,EACA,GAAA,EACoB;AACpB,EAAA,OAAO,OAAA,CAAQC,MAAA,EAAW,IAAA,EAAM,KAAA,EAAO,GAAG,CAAA;AAC5C","file":"jsx-runtime.js","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"]}
1
+ {"version":3,"file":"jsx-runtime.js","names":["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,WAAW,oBAAoB,WAAW,KAAK,SAAS;CAG3C;AACjB;AAEA,SAAS,QACP,SACA,MACA,OACA,KACoB;CACpB,MAAM,SAAS,WAAW,iBAAiB;CAE3C,IAAI,MAAM,OAAO,QAAQ,UAAU,MACjC,MAAM,IAAI,MACR,kOAEF;CAIF,OAAO,QAAQ,MADG,SAAS,eAAe,OAAO,iBAAiB,MAAM,CAAC,IAAK,OAC9C,GAAG;AACrC;AAEA,MAAa,WAAWA;AAExB,SAAgB,IACd,MACA,OACA,KACoB;CACpB,OAAO,QAAQC,OAAU,MAAM,OAAO,GAAG;AAC3C;AAEA,SAAgB,KACd,MACA,OACA,KACoB;CACpB,OAAO,QAAQC,QAAW,MAAM,OAAO,GAAG;AAC5C"}
@@ -0,0 +1,14 @@
1
+ //#region src/resolve-hash-class.ts
2
+ function resolveHashClass(api) {
3
+ if ("hash" in api && typeof api.hash === "function") return (properties, label) => api.hash(properties, { label });
4
+ return api.hashClass;
5
+ }
6
+ //#endregion
7
+ Object.defineProperty(exports, "resolveHashClass", {
8
+ enumerable: true,
9
+ get: function() {
10
+ return resolveHashClass;
11
+ }
12
+ });
13
+
14
+ //# sourceMappingURL=resolve-hash-class-DuqLJq6S.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-hash-class-DuqLJq6S.cjs","names":[],"sources":["../src/resolve-hash-class.ts"],"sourcesContent":["import type { CSSProperties, StylesApi, TypeStylesApi } from 'typestyles';\n\n/** Styles host for the css prop / TypeStylesProvider. */\nexport type CssStylesHost = Pick<TypeStylesApi, 'hash'> | StylesApi;\n\nexport type HashClassFn = (properties: CSSProperties, label?: string) => string;\n\n/** Normalize `hash` (createTypeStyles) and `hashClass` (createStyles). */\nexport function resolveHashClass(api: CssStylesHost): HashClassFn {\n if ('hash' in api && typeof api.hash === 'function') {\n return (properties, label) => api.hash(properties, { label });\n }\n return (api as StylesApi).hashClass;\n}\n"],"mappings":";AAQA,SAAgB,iBAAiB,KAAiC;CAChE,IAAI,UAAU,OAAO,OAAO,IAAI,SAAS,YACvC,QAAQ,YAAY,UAAU,IAAI,KAAK,YAAY,EAAE,MAAM,CAAC;CAE9D,OAAQ,IAAkB;AAC5B"}
@@ -0,0 +1,9 @@
1
+ //#region src/resolve-hash-class.ts
2
+ function resolveHashClass(api) {
3
+ if ("hash" in api && typeof api.hash === "function") return (properties, label) => api.hash(properties, { label });
4
+ return api.hashClass;
5
+ }
6
+ //#endregion
7
+ export { resolveHashClass as t };
8
+
9
+ //# sourceMappingURL=resolve-hash-class-Rs_7aMMQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-hash-class-Rs_7aMMQ.js","names":[],"sources":["../src/resolve-hash-class.ts"],"sourcesContent":["import type { CSSProperties, StylesApi, TypeStylesApi } from 'typestyles';\n\n/** Styles host for the css prop / TypeStylesProvider. */\nexport type CssStylesHost = Pick<TypeStylesApi, 'hash'> | StylesApi;\n\nexport type HashClassFn = (properties: CSSProperties, label?: string) => string;\n\n/** Normalize `hash` (createTypeStyles) and `hashClass` (createStyles). */\nexport function resolveHashClass(api: CssStylesHost): HashClassFn {\n if ('hash' in api && typeof api.hash === 'function') {\n return (properties, label) => api.hash(properties, { label });\n }\n return (api as StylesApi).hashClass;\n}\n"],"mappings":";AAQA,SAAgB,iBAAiB,KAAiC;CAChE,IAAI,UAAU,OAAO,OAAO,IAAI,SAAS,YACvC,QAAQ,YAAY,UAAU,IAAI,KAAK,YAAY,EAAE,MAAM,CAAC;CAE9D,OAAQ,IAAkB;AAC5B"}
@@ -0,0 +1,10 @@
1
+ import { CSSProperties } from "typestyles";
2
+ //#region src/types.d.ts
3
+ type CssPropValue = CSSProperties | false | null | undefined;
4
+ type WithCssProp<P> = P & {
5
+ css?: CssPropValue;
6
+ className?: string;
7
+ };
8
+ //#endregion
9
+ export { WithCssProp as n, CssPropValue as t };
10
+ //# sourceMappingURL=types-DcDsqg2q.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-DcDsqg2q.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";;KAEY,eAAe;KAEf,YAAY,KAAK;EAAM,MAAM;EAAc"}
@@ -0,0 +1,10 @@
1
+ import { CSSProperties } from "typestyles";
2
+ //#region src/types.d.ts
3
+ type CssPropValue = CSSProperties | false | null | undefined;
4
+ type WithCssProp<P> = P & {
5
+ css?: CssPropValue;
6
+ className?: string;
7
+ };
8
+ //#endregion
9
+ export { WithCssProp as n, CssPropValue as t };
10
+ //# sourceMappingURL=types-DcDsqg2q.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-DcDsqg2q.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";;KAEY,eAAe;KAEf,YAAY,KAAK;EAAM,MAAM;EAAc"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typestyles/react",
3
- "version": "0.0.0-unstable.fb509f91ba06",
3
+ "version": "0.0.0-unstable.ff74983e3aa5",
4
4
  "description": "React integration for typestyles — styled API and css prop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -71,13 +71,13 @@
71
71
  "license": "Apache-2.0",
72
72
  "repository": {
73
73
  "type": "git",
74
- "url": "https://github.com/type-styles/typestyles",
74
+ "url": "https://github.com/phthalo-dev/typestyles",
75
75
  "directory": "packages/react"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "react": ">=18.0.0",
79
79
  "react-dom": ">=18.0.0",
80
- "typestyles": ">=0.4.0"
80
+ "typestyles": ">=0.32.0"
81
81
  },
82
82
  "peerDependenciesMeta": {
83
83
  "react": {
@@ -95,18 +95,16 @@
95
95
  "@types/babel__core": "^7.20.5",
96
96
  "@types/react": "^18.3.12",
97
97
  "@types/react-dom": "^18.3.1",
98
- "eslint": "^9.39.2",
99
98
  "react": "^18.0.0",
100
99
  "react-dom": "^18.0.0",
101
- "tsup": "^8.0.0",
102
- "typestyles": "0.0.0-unstable.fb509f91ba06",
103
- "typescript": "^5.4.0",
104
- "vitest": "^3.0.0"
100
+ "typestyles": "0.0.0-unstable.ff74983e3aa5",
101
+ "typescript": "^6.0.0",
102
+ "vitest": "5.0.5",
103
+ "vite-plus": "1.3.0"
105
104
  },
106
105
  "scripts": {
107
- "build": "tsup",
108
- "test": "vitest run",
109
- "lint": "eslint .",
106
+ "build": "vp pack",
107
+ "test": "vp test run",
110
108
  "typecheck": "tsc --noEmit"
111
109
  }
112
110
  }
@@ -1,22 +0,0 @@
1
- import { createContext } from 'react';
2
- import { jsx } from 'react/jsx-runtime';
3
- import { cx } from 'typestyles';
4
-
5
- // src/context.tsx
6
- var TypeStylesContext = createContext(null);
7
- function TypeStylesProvider({
8
- styles,
9
- children
10
- }) {
11
- return /* @__PURE__ */ jsx(TypeStylesContext.Provider, { value: styles, children });
12
- }
13
- function resolveCssPropClass(hashClass, css, className) {
14
- if (css && typeof css === "object") {
15
- return cx(hashClass(css), className);
16
- }
17
- return cx(className);
18
- }
19
-
20
- export { TypeStylesContext, TypeStylesProvider, resolveCssPropClass };
21
- //# sourceMappingURL=chunk-IHZMLPG2.js.map
22
- //# sourceMappingURL=chunk-IHZMLPG2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/context.tsx","../src/css-prop.ts"],"names":[],"mappings":";;;;;AAGO,IAAM,iBAAA,GAAoB,cAAoC,IAAI;AAElE,SAAS,kBAAA,CAAmB;AAAA,EACjC,MAAA;AAAA,EACA;AACF,CAAA,EAIsB;AACpB,EAAA,2BAAQ,iBAAA,CAAkB,QAAA,EAAlB,EAA2B,KAAA,EAAO,QAAS,QAAA,EAAS,CAAA;AAC9D;ACVO,SAAS,mBAAA,CACd,SAAA,EACA,GAAA,EACA,SAAA,EACQ;AACR,EAAA,IAAI,GAAA,IAAO,OAAO,GAAA,KAAQ,QAAA,EAAU;AAClC,IAAA,OAAO,EAAA,CAAG,SAAA,CAAU,GAAG,CAAA,EAAG,SAAS,CAAA;AAAA,EACrC;AACA,EAAA,OAAO,GAAG,SAAS,CAAA;AACrB","file":"chunk-IHZMLPG2.js","sourcesContent":["import { createContext, type ReactNode } from 'react';\nimport type { CssStylesHost } from './resolve-hash-class';\n\nexport const TypeStylesContext = createContext<CssStylesHost | null>(null);\n\nexport function TypeStylesProvider({\n styles,\n children,\n}: {\n /** Prefer a `createTypeStyles()` result; `createStyles()` instances also work. */\n styles: CssStylesHost;\n children: ReactNode;\n}): React.JSX.Element {\n return <TypeStylesContext.Provider value={styles}>{children}</TypeStylesContext.Provider>;\n}\n","import type { CSSProperties } from 'typestyles';\nimport { cx } from 'typestyles';\nimport type { CssPropValue } from './types';\n\nexport function resolveCssPropClass(\n hashClass: (properties: CSSProperties, label?: string) => string,\n css: CssPropValue | undefined,\n className?: string,\n): string {\n if (css && typeof css === 'object') {\n return cx(hashClass(css), className);\n }\n return cx(className);\n}\n"]}
@@ -1,11 +0,0 @@
1
- // src/resolve-hash-class.ts
2
- function resolveHashClass(api) {
3
- if ("hash" in api && typeof api.hash === "function") {
4
- return (properties, label) => api.hash(properties, { label });
5
- }
6
- return api.hashClass;
7
- }
8
-
9
- export { resolveHashClass };
10
- //# sourceMappingURL=chunk-KM65VQPZ.js.map
11
- //# sourceMappingURL=chunk-KM65VQPZ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/resolve-hash-class.ts"],"names":[],"mappings":";AAQO,SAAS,iBAAiB,GAAA,EAAiC;AAChE,EAAA,IAAI,MAAA,IAAU,GAAA,IAAO,OAAO,GAAA,CAAI,SAAS,UAAA,EAAY;AACnD,IAAA,OAAO,CAAC,YAAY,KAAA,KAAU,GAAA,CAAI,KAAK,UAAA,EAAY,EAAE,OAAO,CAAA;AAAA,EAC9D;AACA,EAAA,OAAQ,GAAA,CAAkB,SAAA;AAC5B","file":"chunk-KM65VQPZ.js","sourcesContent":["import type { CSSProperties, StylesApi, TypeStylesApi } from 'typestyles';\n\n/** Styles host for the css prop / TypeStylesProvider. */\nexport type CssStylesHost = Pick<TypeStylesApi, 'hash'> | StylesApi;\n\nexport type HashClassFn = (properties: CSSProperties, label?: string) => string;\n\n/** Normalize `hash` (createTypeStyles) and `hashClass` (createStyles). */\nexport function resolveHashClass(api: CssStylesHost): HashClassFn {\n if ('hash' in api && typeof api.hash === 'function') {\n return (properties, label) => api.hash(properties, { label });\n }\n return (api as StylesApi).hashClass;\n}\n"]}
@@ -1,10 +0,0 @@
1
- import { resolveHashClass } from './chunk-KM65VQPZ.js';
2
-
3
- // src/css-prop-runtime.ts
4
- function cssProp(api, properties) {
5
- return resolveHashClass(api)(properties);
6
- }
7
-
8
- export { cssProp };
9
- //# sourceMappingURL=chunk-TLEOUPD2.js.map
10
- //# sourceMappingURL=chunk-TLEOUPD2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/css-prop-runtime.ts"],"names":[],"mappings":";;;AAKO,SAAS,OAAA,CAAQ,KAAoB,UAAA,EAAmC;AAC7E,EAAA,OAAO,gBAAA,CAAiB,GAAG,CAAA,CAAE,UAAU,CAAA;AACzC","file":"chunk-TLEOUPD2.js","sourcesContent":["import type { CSSProperties } from 'typestyles';\nimport type { CssStylesHost } from './resolve-hash-class';\nimport { resolveHashClass } from './resolve-hash-class';\n\n/** Runtime helper used by the Babel plugin for static `css` props. */\nexport function cssProp(api: CssStylesHost, properties: CSSProperties): string {\n return resolveHashClass(api)(properties);\n}\n"]}
@@ -1,9 +0,0 @@
1
- import { CSSProperties } from 'typestyles';
2
-
3
- type CssPropValue = CSSProperties | false | null | undefined;
4
- type WithCssProp<P> = P & {
5
- css?: CssPropValue;
6
- className?: string;
7
- };
8
-
9
- export type { CssPropValue as C, WithCssProp as W };
@@ -1,9 +0,0 @@
1
- import { CSSProperties } from 'typestyles';
2
-
3
- type CssPropValue = CSSProperties | false | null | undefined;
4
- type WithCssProp<P> = P & {
5
- css?: CssPropValue;
6
- className?: string;
7
- };
8
-
9
- export type { CssPropValue as C, WithCssProp as W };