@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 +3 -1
- package/package.json +1 -1
- package/src/styles/components/ClientProvider.d.ts +9 -0
- package/src/styles/components/ClientProvider.esm.js +14 -0
- package/src/styles/components/NextJSProvider.d.ts +6 -0
- package/src/styles/components/NextJSProvider.esm.js +39 -0
- package/src/styles/index.d.ts +2 -0
- package/src/styles/utilities/config.d.ts +2 -2
- package/src/styles/utilities/types.d.ts +1 -1
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
|
-
|
|
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
|
@@ -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,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 };
|
package/src/styles/index.d.ts
CHANGED
|
@@ -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,
|
|
2
|
-
export declare function setCraftsmanConfig(config:
|
|
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>;
|