@stamcat/craftsman 0.0.23-alpha.21 → 0.0.23-alpha.23
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/package.json
CHANGED
|
@@ -1,30 +1,23 @@
|
|
|
1
1
|
import { isEmpty as e } from "../utilities/validations.esm.js";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { Fragment as
|
|
2
|
+
import { css as t } from "@emotion/react";
|
|
3
|
+
import n from "@emotion/styled";
|
|
4
|
+
import { Fragment as r, jsx as i } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/Button.tsx
|
|
6
|
-
var
|
|
6
|
+
var a = n.button`
|
|
7
7
|
${(e) => e.styles}
|
|
8
|
-
${((e) => e.size &&
|
|
8
|
+
${((e) => e.size && t`
|
|
9
9
|
border-radius: calc(var(--btn-border-radius) * ${e.size});
|
|
10
10
|
padding: calc(var(--btn-pad-y) * ${e.size}) calc(var(--btn-pad-x) * ${e.size});
|
|
11
11
|
font-size: max(10px, calc(var(--w-text) * ${e.size}));
|
|
12
12
|
`)}
|
|
13
|
-
`,
|
|
14
|
-
let { type:
|
|
15
|
-
return e(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return /* @__PURE__ */ a(o, {
|
|
22
|
-
type: r,
|
|
23
|
-
size: d,
|
|
24
|
-
className: i,
|
|
25
|
-
...u
|
|
26
|
-
});
|
|
27
|
-
} });
|
|
13
|
+
`, o = (t) => {
|
|
14
|
+
let { type: n = "button", variant: o = "default", className: s, size: c, ...l } = t, u = typeof c == "number" ? Math.min(10, Math.max(.1, c)) : void 0, d = [o === "default" ? void 0 : o, s].filter(Boolean).join(" ") || void 0;
|
|
15
|
+
return e(t.children) ? /* @__PURE__ */ i(r, {}) : /* @__PURE__ */ i(a, {
|
|
16
|
+
type: n,
|
|
17
|
+
size: u,
|
|
18
|
+
className: d,
|
|
19
|
+
...l
|
|
20
|
+
});
|
|
28
21
|
};
|
|
29
22
|
//#endregion
|
|
30
|
-
export {
|
|
23
|
+
export { o as Button };
|
|
@@ -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 {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
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
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
25
|
-
let e =
|
|
28
|
+
return u(() => {
|
|
29
|
+
let e = g();
|
|
26
30
|
if (e.length === 0) return null;
|
|
27
|
-
let
|
|
28
|
-
for (let
|
|
29
|
-
return /* @__PURE__ */
|
|
30
|
-
"data-emotion": `${
|
|
31
|
-
dangerouslySetInnerHTML: { __html:
|
|
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__ */
|
|
34
|
-
value:
|
|
35
|
-
children:
|
|
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 {
|
|
46
|
+
export { d as NextJSProvider };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
//#region src/utilities/validations.ts
|
|
2
|
-
/* #__PURE__ */
|
|
3
2
|
function e(e) {
|
|
4
3
|
return e == null || typeof e == "object" && Object.keys(e).length === 0 || typeof e == "string" && e.trim().length === 0 || typeof e == "string" && e === " ";
|
|
5
4
|
}
|
|
6
|
-
/* #__PURE__ */
|
|
7
5
|
function t(e) {
|
|
8
6
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);
|
|
9
7
|
}
|