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

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/Styles.esm.js CHANGED
@@ -4,4 +4,6 @@ import { breakpoint as a, media as o, width as s, widths as c } from "./src/styl
4
4
  import { color as l, colors as u, hexToRgba as d } from "./src/styles/utilities/color.esm.js";
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
- export { 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 };
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stamcat/craftsman",
3
- "version": "0.0.23-alpha.18",
3
+ "version": "0.0.23-alpha.20",
4
4
  "type": "module",
5
5
  "description": "A powerful, lightweight framework for design systems",
6
6
  "repository": {
@@ -0,0 +1,9 @@
1
+ import { CraftsmanStyleConfig } from '../utilities/types';
2
+ import { Theme } from '../theme/types';
3
+ type ClientProviderProps = {
4
+ config?: CraftsmanStyleConfig;
5
+ theme?: Theme;
6
+ children?: React.ReactNode;
7
+ };
8
+ export declare function ClientProvider(props: ClientProviderProps): import("react").JSX.Element;
9
+ export {};
@@ -0,0 +1,14 @@
1
+ import { setCraftsmanConfig as e } from "../utilities/config.esm.js";
2
+ import { CraftsmanThemeProvider as t, themeBuilder as n } from "../theme/theme.esm.js";
3
+ import { globalStyles as r } from "../global/globalStyles.esm.js";
4
+ import { Global as i } from "@emotion/react";
5
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
+ //#region src/styles/components/ClientProvider.tsx
7
+ function s(s) {
8
+ return s.config && e(s.config), /* @__PURE__ */ o(t, {
9
+ theme: s.theme || {},
10
+ children: [/* @__PURE__ */ a(i, { styles: (e) => [r, n(e)] }), s.children]
11
+ });
12
+ }
13
+ //#endregion
14
+ export { s as ClientProvider };
@@ -0,0 +1,6 @@
1
+ type StyleProviderProps = {
2
+ key?: string;
3
+ children?: React.ReactNode;
4
+ };
5
+ export declare function NextJSProvider({ children, key }: StyleProviderProps): import("react").JSX.Element;
6
+ export {};
@@ -0,0 +1,39 @@
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";
7
+ //#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
+ e.compat = !0;
12
+ let t = e.insert, n = [];
13
+ return e.insert = (...r) => {
14
+ let i = r[1];
15
+ return e.inserted[i.name] === void 0 && n.push(i.name), t(...r);
16
+ }, {
17
+ cache: e,
18
+ flush: () => {
19
+ let e = n;
20
+ return n = [], e;
21
+ }
22
+ };
23
+ });
24
+ return i(() => {
25
+ let e = c();
26
+ 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 }
32
+ });
33
+ }), /* @__PURE__ */ t(e, {
34
+ value: s,
35
+ children: a
36
+ });
37
+ }
38
+ //#endregion
39
+ export { a as NextJSProvider };
@@ -5,3 +5,5 @@ export * from './utilities/layout';
5
5
  export * from './utilities/types';
6
6
  export * from './theme/theme';
7
7
  export * from './global/globalStyles';
8
+ export { ClientProvider } from './components/ClientProvider';
9
+ export { NextJSProvider } from './components/NextJSProvider';
@@ -1,5 +1,5 @@
1
- import { ResponsiveWidth, SetConfig } from './types';
2
- export declare function setCraftsmanConfig(config: SetConfig): void;
1
+ import { ResponsiveWidth, CraftsmanStyleConfig } from './types';
2
+ export declare function setCraftsmanConfig(config: CraftsmanStyleConfig): void;
3
3
  export declare function resetCraftsmanConfig(): void;
4
4
  export declare function getCraftsmanConfig(): {
5
5
  colors: Record<string, string>;
@@ -10,7 +10,7 @@ export type CraftsmanConfig = {
10
10
  colors: Colors;
11
11
  widths: Width;
12
12
  };
13
- export type SetConfig = Partial<{
13
+ export type CraftsmanStyleConfig = Partial<{
14
14
  colors: Partial<Colors>;
15
15
  widths: Partial<Width>;
16
16
  }>;