@stamcat/craftsman 0.0.23-alpha.20 → 0.0.23-alpha.22

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.
@@ -0,0 +1,2 @@
1
+ export * from './src/styles/next/index.js'
2
+ export {}
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import { NextJSProvider as e } from "./src/styles/components/NextJSProvider.esm.js";
3
+ export { e as NextJSProvider };
package/Styles.esm.js CHANGED
@@ -5,5 +5,4 @@ import { color as l, colors as u, hexToRgba as d } from "./src/styles/utilities/
5
5
  import { CraftsmanThemeProvider as f, themeBuilder as p } from "./src/styles/theme/theme.esm.js";
6
6
  import { globalStyles as m } from "./src/styles/global/globalStyles.esm.js";
7
7
  import { ClientProvider as h } from "./src/styles/components/ClientProvider.esm.js";
8
- import { NextJSProvider as g } from "./src/styles/components/NextJSProvider.esm.js";
9
- export { h as ClientProvider, f as CraftsmanThemeProvider, g as NextJSProvider, a as breakpoint, l as color, u as colors, e as defaultColors, t as defaultWidths, n as getCraftsmanConfig, m as globalStyles, d as hexToRgba, o as media, r as resetCraftsmanConfig, i as setCraftsmanConfig, p as themeBuilder, s as width, c as widths };
8
+ export { h as ClientProvider, f as CraftsmanThemeProvider, a as breakpoint, l as color, u as colors, e as defaultColors, t as defaultWidths, n as getCraftsmanConfig, m as globalStyles, d as hexToRgba, o as media, r as resetCraftsmanConfig, i as setCraftsmanConfig, p as themeBuilder, s as width, c as widths };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stamcat/craftsman",
3
- "version": "0.0.23-alpha.20",
3
+ "version": "0.0.23-alpha.22",
4
4
  "type": "module",
5
5
  "description": "A powerful, lightweight framework for design systems",
6
6
  "repository": {
@@ -47,6 +47,10 @@
47
47
  "types": "./src/styles/index.d.ts",
48
48
  "default": "./Styles.esm.js"
49
49
  },
50
+ "./styles/NextJSProvider": {
51
+ "types": "./src/styles/next/index.d.ts",
52
+ "default": "./NextJSProvider.esm.js"
53
+ },
50
54
  "./utilities": {
51
55
  "types": "./src/utilities/index.d.ts",
52
56
  "default": "./Utilities.esm.js"
@@ -1,6 +1,10 @@
1
+ import { CraftsmanStyleConfig } from '../utilities/types';
2
+ import { Theme } from '../theme/types';
1
3
  type StyleProviderProps = {
2
4
  key?: string;
3
5
  children?: React.ReactNode;
6
+ config?: CraftsmanStyleConfig;
7
+ theme?: Theme;
4
8
  };
5
- export declare function NextJSProvider({ children, key }: StyleProviderProps): import("react").JSX.Element;
9
+ export declare function NextJSProvider({ children, key, config, theme }: StyleProviderProps): import("react").JSX.Element;
6
10
  export {};
@@ -1,13 +1,17 @@
1
1
  "use client";
2
- import { CacheProvider as e } from "@emotion/react";
3
- import { jsx as t } from "react/jsx-runtime";
4
- import { useState as n } from "react";
5
- import r from "@emotion/cache";
6
- import { useServerInsertedHTML as i } from "next/navigation";
2
+ import { setCraftsmanConfig as e } from "../utilities/config.esm.js";
3
+ import { CraftsmanThemeProvider as t, themeBuilder as n } from "../theme/theme.esm.js";
4
+ import { globalStyles as r } from "../global/globalStyles.esm.js";
5
+ import { CacheProvider as i, Global as a } from "@emotion/react";
6
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
7
+ import { useState as c } from "react";
8
+ import l from "@emotion/cache";
9
+ import { useServerInsertedHTML as u } from "next/navigation";
7
10
  //#region src/styles/components/NextJSProvider.tsx
8
- function a({ children: a, key: o = "app" }) {
9
- let [{ cache: s, flush: c }] = n(() => {
10
- let e = r({ key: o });
11
+ function d({ children: d, key: f = "app", config: p, theme: m }) {
12
+ p && e(p);
13
+ let [{ cache: h, flush: g }] = c(() => {
14
+ let e = l({ key: f });
11
15
  e.compat = !0;
12
16
  let t = e.insert, n = [];
13
17
  return e.insert = (...r) => {
@@ -21,19 +25,22 @@ function a({ children: a, key: o = "app" }) {
21
25
  }
22
26
  };
23
27
  });
24
- return i(() => {
25
- let e = c();
28
+ return u(() => {
29
+ let e = g();
26
30
  if (e.length === 0) return null;
27
- let n = "";
28
- for (let t of e) n += s.inserted[t];
29
- return /* @__PURE__ */ t("style", {
30
- "data-emotion": `${s.key} ${e.join(" ")}`,
31
- dangerouslySetInnerHTML: { __html: n }
31
+ let t = "";
32
+ for (let n of e) t += h.inserted[n];
33
+ return /* @__PURE__ */ o("style", {
34
+ "data-emotion": `${h.key} ${e.join(" ")}`,
35
+ dangerouslySetInnerHTML: { __html: t }
32
36
  });
33
- }), /* @__PURE__ */ t(e, {
34
- value: s,
35
- children: a
37
+ }), /* @__PURE__ */ o(i, {
38
+ value: h,
39
+ children: /* @__PURE__ */ s(t, {
40
+ theme: m || {},
41
+ children: [/* @__PURE__ */ o(a, { styles: (e) => [r, n(e)] }), d]
42
+ })
36
43
  });
37
44
  }
38
45
  //#endregion
39
- export { a as NextJSProvider };
46
+ export { d as NextJSProvider };
@@ -6,4 +6,3 @@ export * from './utilities/types';
6
6
  export * from './theme/theme';
7
7
  export * from './global/globalStyles';
8
8
  export { ClientProvider } from './components/ClientProvider';
9
- export { NextJSProvider } from './components/NextJSProvider';
@@ -0,0 +1 @@
1
+ export { NextJSProvider } from '../components/NextJSProvider';