@plitzi/sdk-variables 0.33.1 → 0.34.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @plitzi/sdk-variables
2
2
 
3
+ ## 0.34.0
4
+
5
+ ### Minor Changes
6
+
7
+ - v0.34.0
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [5aceda0]
12
+ - Updated dependencies
13
+ - Updated dependencies [5aceda0]
14
+ - @plitzi/sdk-shared@0.34.0
15
+
16
+ ## 0.33.2
17
+
18
+ ### Patch Changes
19
+
20
+ - v0.33.2
21
+ - Updated dependencies
22
+ - @plitzi/sdk-shared@0.33.2
23
+
3
24
  ## 0.33.1
4
25
 
5
26
  ### Patch Changes
@@ -35,7 +35,9 @@ var e = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/, t = /^rgba?\(\s*(\d
35
35
  typeof n == "object" ? (n.default !== void 0 && i.push(`${c}${t}: ${n.default};`), n.light !== void 0 && a.push(`${c}${t}: ${n.light};`), n.dark !== void 0 && o.push(`${c}${t}: ${n.dark};`)) : i.push(`${c}${t}: ${n};`);
36
36
  }
37
37
  let l = "";
38
- return r && (l = `${t} {\n${i.join("\n")}\n}`), a.length && (l += `\n\n@media (prefers-color-scheme: light) {\n${s}${t} {\n${a.join("\n")}\n }\n}`), o.length && (l += `\n\n@media (prefers-color-scheme: dark) {\n${s}${t} {\n${o.join("\n")}\n }\n}`), l;
38
+ r && (l = `${t} {\n${i.join("\n")}\n}`);
39
+ let u = (e) => t === ":root" ? `${t}.${e}, .${e}` : `.${e} ${t}`, d = (e) => t === ":root" ? `${t}:not(.${e})` : `:root:not(.${e}) ${t}`;
40
+ return a.length && (l += `\n\n@media (prefers-color-scheme: light) {\n${s}${d("dark")} {\n${a.join("\n")}\n }\n}`), o.length && (l += `\n\n@media (prefers-color-scheme: dark) {\n${s}${d("light")} {\n${o.join("\n")}\n }\n}`), a.length && (l += `\n\n${u("light")} {\n${a.join("\n")}\n}`), o.length && (l += `\n\n${u("dark")} {\n${o.join("\n")}\n}`), l;
39
41
  }, s = (e, t, n = 2, r = !0) => o(e, t, n, r);
40
42
  //#endregion
41
43
  export { a as schemaVariablesToCss, s as styleSelectorVariablesToCss, o as styleVariablesToCss };
@@ -1,17 +1,17 @@
1
1
  import e from "../../models/SchemaVariableForm/index.mjs";
2
2
  import t from "./SchemaVariable.mjs";
3
- import n from "@plitzi/plitzi-ui/Button";
4
- import r from "clsx";
5
- import { useCallback as i, useState as a } from "react";
3
+ import { useCallback as n, useState as r } from "react";
4
+ import i from "@plitzi/plitzi-ui/Button";
5
+ import a from "clsx";
6
6
  import { jsx as o, jsxs as s } from "react/jsx-runtime";
7
7
  //#region src/components/SchemaVariables/SchemaVariables.tsx
8
8
  var c = ({ className: c, variables: l, whenData: u, onAdd: d, onUpdate: f, onRemove: p }) => {
9
- let [m, h] = a(), g = i((e) => {
9
+ let [m, h] = r(), g = n((e) => {
10
10
  d?.(e), h(void 0);
11
- }, [d]), _ = i((e, t) => f?.({
11
+ }, [d]), _ = n((e, t) => f?.({
12
12
  ...t,
13
13
  name: e
14
- }), [f]), v = i((e) => p?.(e), [p]), y = i(() => {
14
+ }), [f]), v = n((e) => p?.(e), [p]), y = n(() => {
15
15
  h({
16
16
  name: "variable",
17
17
  type: "text",
@@ -19,9 +19,9 @@ var c = ({ className: c, variables: l, whenData: u, onAdd: d, onUpdate: f, onRem
19
19
  value: "",
20
20
  subValues: []
21
21
  });
22
- }, []), b = i(() => h(void 0), []);
22
+ }, []), b = n(() => h(void 0), []);
23
23
  return /* @__PURE__ */ s("div", {
24
- className: r("flex w-full flex-col gap-3", c),
24
+ className: a("flex w-full flex-col gap-3", c),
25
25
  children: [
26
26
  /* @__PURE__ */ o("div", {
27
27
  className: "flex min-h-0 grow basis-0 flex-col gap-1 overflow-y-auto",
@@ -41,12 +41,12 @@ var c = ({ className: c, variables: l, whenData: u, onAdd: d, onUpdate: f, onRem
41
41
  }),
42
42
  !m && /* @__PURE__ */ o("div", {
43
43
  className: "flex w-full px-1",
44
- children: /* @__PURE__ */ s(n, {
44
+ children: /* @__PURE__ */ s(i, {
45
45
  className: "w-full",
46
46
  size: "xs",
47
47
  onClick: y,
48
48
  iconPlacement: "before",
49
- children: [/* @__PURE__ */ o(n.Icon, { icon: "fa-solid fa-plus" }), "Add Space Variable"]
49
+ children: [/* @__PURE__ */ o(i.Icon, { icon: "fa-solid fa-plus" }), "Add Space Variable"]
50
50
  })
51
51
  }),
52
52
  m && /* @__PURE__ */ o(e, {
@@ -1,8 +1,8 @@
1
1
  import e from "../../models/StyleVariableForm/index.mjs";
2
2
  import t from "./VariableList.mjs";
3
- import n from "@plitzi/plitzi-ui/Button";
4
- import r from "clsx";
5
- import { useCallback as i, useState as a } from "react";
3
+ import { useCallback as n, useState as r } from "react";
4
+ import i from "@plitzi/plitzi-ui/Button";
5
+ import a from "clsx";
6
6
  import { jsx as o, jsxs as s } from "react/jsx-runtime";
7
7
  import { StyleVariableCategory as c } from "@plitzi/sdk-shared";
8
8
  //#region src/components/StyleVariables/StyleVariables.tsx
@@ -11,12 +11,12 @@ var l = ({ className: l, variables: u = {
11
11
  spacing: {},
12
12
  shadow: {}
13
13
  }, onAdd: d, onUpdate: f, onRemove: p }) => {
14
- let [m, h] = a(), g = i((e) => {
14
+ let [m, h] = r(), g = n((e) => {
15
15
  d?.(e), h(void 0);
16
- }, [d]), _ = i((e, t) => f?.({
16
+ }, [d]), _ = n((e, t) => f?.({
17
17
  ...t,
18
18
  name: e
19
- }), [f]), v = i((e, t) => p?.(e, t), [p]), y = i(() => {
19
+ }), [f]), v = n((e, t) => p?.(e, t), [p]), y = n(() => {
20
20
  h({
21
21
  name: "",
22
22
  category: c.COLOR,
@@ -26,9 +26,9 @@ var l = ({ className: l, variables: u = {
26
26
  default: ""
27
27
  }
28
28
  });
29
- }, []), b = i(() => h(void 0), []);
29
+ }, []), b = n(() => h(void 0), []);
30
30
  return /* @__PURE__ */ s("div", {
31
- className: r("flex flex-col gap-2", l),
31
+ className: a("flex flex-col gap-2", l),
32
32
  children: [
33
33
  /* @__PURE__ */ o(t, {
34
34
  variables: u,
@@ -37,12 +37,12 @@ var l = ({ className: l, variables: u = {
37
37
  }),
38
38
  !m && /* @__PURE__ */ o("div", {
39
39
  className: "flex w-full px-1",
40
- children: /* @__PURE__ */ s(n, {
40
+ children: /* @__PURE__ */ s(i, {
41
41
  className: "w-full",
42
42
  size: "xs",
43
43
  onClick: y,
44
44
  iconPlacement: "before",
45
- children: [/* @__PURE__ */ o(n.Icon, { icon: "fa-solid fa-plus" }), "Add Style Variable"]
45
+ children: [/* @__PURE__ */ o(i.Icon, { icon: "fa-solid fa-plus" }), "Add Style Variable"]
46
46
  })
47
47
  }),
48
48
  m && /* @__PURE__ */ o(e, {
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
- import { schemaVariableFormSchema as e } from "./models/SchemaVariableForm/SchemaVariableForm.mjs";
2
- import t from "./models/SchemaVariableForm/index.mjs";
3
- import n from "./components/SchemaVariables/index.mjs";
4
- import { styleVariableFormSchema as r } from "./models/StyleVariableForm/StyleVariableForm.mjs";
5
- import i from "./models/StyleVariableForm/index.mjs";
6
- import { models_exports as a } from "./models/index.mjs";
7
- import o from "./components/StyleVariables/index.mjs";
8
- import { components_exports as s } from "./components/index.mjs";
9
- import c from "./VariablesContext.mjs";
10
- import { schemaVariablesToCss as l, styleSelectorVariablesToCss as u, styleVariablesToCss as d } from "./VariablesHelper.mjs";
11
- export { t as SchemaVariableForm, n as SchemaVariables, i as StyleVariableForm, o as StyleVariables, c as VariablesContext, s as components, a as forms, e as schemaVariableFormSchema, l as schemaVariablesToCss, u as styleSelectorVariablesToCss, r as styleVariableFormSchema, d as styleVariablesToCss };
1
+ import e from "./VariablesContext.mjs";
2
+ import { schemaVariablesToCss as t, styleSelectorVariablesToCss as n, styleVariablesToCss as r } from "./VariablesHelper.mjs";
3
+ import { schemaVariableFormSchema as i } from "./models/SchemaVariableForm/SchemaVariableForm.mjs";
4
+ import a from "./models/SchemaVariableForm/index.mjs";
5
+ import o from "./components/SchemaVariables/index.mjs";
6
+ import { styleVariableFormSchema as s } from "./models/StyleVariableForm/StyleVariableForm.mjs";
7
+ import c from "./models/StyleVariableForm/index.mjs";
8
+ import { models_exports as l } from "./models/index.mjs";
9
+ import u from "./components/StyleVariables/index.mjs";
10
+ import { components_exports as d } from "./components/index.mjs";
11
+ export { a as SchemaVariableForm, o as SchemaVariables, c as StyleVariableForm, u as StyleVariables, e as VariablesContext, d as components, l as forms, i as schemaVariableFormSchema, t as schemaVariablesToCss, n as styleSelectorVariablesToCss, s as styleVariableFormSchema, r as styleVariablesToCss };
@@ -1,7 +1,7 @@
1
1
  import e from "./VariableValue.mjs";
2
2
  import t from "./VariableSubValue.mjs";
3
- import n from "@plitzi/plitzi-ui/Button";
4
- import { useCallback as r } from "react";
3
+ import { useCallback as n } from "react";
4
+ import r from "@plitzi/plitzi-ui/Button";
5
5
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
6
  import o from "@plitzi/plitzi-ui/Alert";
7
7
  import s, { useFieldArray as c, useForm as l, useFormWatch as u } from "@plitzi/plitzi-ui/Form";
@@ -38,14 +38,14 @@ var f = d.object({
38
38
  control: x.formMethods.control,
39
39
  name: "subValues",
40
40
  rules: { minLength: 0 }
41
- }), E = u(x.formMethods, "type"), D = u(x.formMethods, "subValues"), O = r((e) => y?.(e), [y]), k = D && D.length > 0, A = r(() => C({
41
+ }), E = u(x.formMethods, "type"), D = u(x.formMethods, "subValues"), O = n((e) => y?.(e), [y]), k = D && D.length > 0, A = n(() => C({
42
42
  value: "",
43
43
  when: void 0
44
- }), [C]), j = r((e) => () => {
44
+ }), [C]), j = n((e) => () => {
45
45
  e > 0 && T(e, e - 1);
46
- }, [T]), M = r((e) => () => {
46
+ }, [T]), M = n((e) => () => {
47
47
  e < S.length - 1 && T(e, e + 1);
48
- }, [S, T]), N = r((e) => () => w(e), [w]), P = r(() => {
48
+ }, [S, T]), N = n((e) => () => w(e), [w]), P = n(() => {
49
49
  x.formMethods.setValue("value", "");
50
50
  }, [x]);
51
51
  return /* @__PURE__ */ a(s, {
@@ -145,7 +145,7 @@ var f = d.object({
145
145
  onClickDown: M(n)
146
146
  })
147
147
  }, e.id))
148
- }), /* @__PURE__ */ i(n, {
148
+ }), /* @__PURE__ */ i(r, {
149
149
  size: "xs",
150
150
  title: "Down",
151
151
  onClick: A,
@@ -155,11 +155,11 @@ var f = d.object({
155
155
  ]
156
156
  }), /* @__PURE__ */ a(s.Footer, {
157
157
  justify: "end",
158
- children: [/* @__PURE__ */ i(n, {
158
+ children: [/* @__PURE__ */ i(r, {
159
159
  onClick: b,
160
160
  size: "xs",
161
161
  children: "Cancel"
162
- }), /* @__PURE__ */ i(n, {
162
+ }), /* @__PURE__ */ i(r, {
163
163
  type: "submit",
164
164
  size: "xs",
165
165
  children: v ? "Add" : "Update"
@@ -1,5 +1,5 @@
1
- import e from "@plitzi/plitzi-ui/Button";
2
- import { useCallback as t, useState as n } from "react";
1
+ import { useCallback as e, useState as t } from "react";
2
+ import n from "@plitzi/plitzi-ui/Button";
3
3
  import { jsx as r, jsxs as i } from "react/jsx-runtime";
4
4
  import a, { useForm as o, useFormWatch as s } from "@plitzi/plitzi-ui/Form";
5
5
  import { z as c } from "zod";
@@ -54,16 +54,16 @@ var u = c.string().min(3, "Too Short").max(20, "Too Long").regex(/^(?:\w+\s+|)([
54
54
  };
55
55
  }
56
56
  }, p = ({ name: c = "New Page", category: u = l.COLOR, value: p, isNewRecord: m = !1, onClose: h, onSubmit: g }) => {
57
- let [_, v] = n(f(u, c, p)), y = o({
57
+ let [_, v] = t(f(u, c, p)), y = o({
58
58
  defaultValues: _,
59
59
  config: { schema: d }
60
- }), b = s(y.formMethods, "category"), x = t((e) => {
60
+ }), b = s(y.formMethods, "category"), x = e((e) => {
61
61
  y.formMethods.setValue("value", e === l.COLOR ? {
62
62
  default: "",
63
63
  light: "",
64
64
  dark: ""
65
65
  } : ""), v(f(e, c, e));
66
- }, [y.formMethods, c]), S = t((e) => g?.(e), [g]);
66
+ }, [y.formMethods, c]), S = e((e) => g?.(e), [g]);
67
67
  return /* @__PURE__ */ i(a, {
68
68
  form: y,
69
69
  onSubmit: S,
@@ -133,12 +133,12 @@ var u = c.string().min(3, "Too Short").max(20, "Too Long").regex(/^(?:\w+\s+|)([
133
133
  className: "grow basis-0"
134
134
  })
135
135
  ]
136
- }), /* @__PURE__ */ i(a.Footer, { children: [/* @__PURE__ */ r(e, {
136
+ }), /* @__PURE__ */ i(a.Footer, { children: [/* @__PURE__ */ r(n, {
137
137
  onClick: h,
138
138
  size: "xs",
139
139
  className: "grow basis-0",
140
140
  children: "Cancel"
141
- }), /* @__PURE__ */ r(e, {
141
+ }), /* @__PURE__ */ r(n, {
142
142
  type: "submit",
143
143
  size: "xs",
144
144
  className: "grow basis-0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-variables",
3
- "version": "0.33.1",
3
+ "version": "0.34.0",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist"
@@ -146,18 +146,21 @@
146
146
  "typecheck": "tsc -p tsconfig.app.json --noEmit",
147
147
  "build:dev": "vite build --mode development --minify false && node ../sdk-shared/scripts/generate-exports.mjs",
148
148
  "build:dev-watch": "vite build --mode development --watch --minify false",
149
- "build:prod": "vite build && node ../sdk-shared/scripts/generate-exports.mjs"
149
+ "build:prod": "vite build && node ../sdk-shared/scripts/generate-exports.mjs",
150
+ "test": "vitest run",
151
+ "test:watch": "vitest"
150
152
  },
151
153
  "dependencies": {
152
- "@plitzi/plitzi-ui": "^1.6.19",
153
- "@plitzi/sdk-shared": "0.33.1",
154
+ "@plitzi/plitzi-ui": "^1.6.21",
155
+ "@plitzi/sdk-shared": "0.34.0",
154
156
  "clsx": "^2.1.1",
155
157
  "eslint": "^9.39.5",
156
- "zod": "^4.4.3"
158
+ "zod": "^4.6.4"
157
159
  },
158
160
  "devDependencies": {
159
161
  "eslint": "^9.39.5",
160
162
  "typescript": "^6.0.3",
161
- "vite": "^8.2.1"
163
+ "vite": "^8.3.0",
164
+ "vitest": "^5.0.0"
162
165
  }
163
166
  }