@plitzi/sdk-variables 0.38.15 → 0.38.17

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +108 -0
  2. package/dist/VariablesContext.mjs +1 -1
  3. package/dist/{components → builder/components}/SchemaVariables/SchemaVariable.mjs +1 -1
  4. package/dist/{components → builder/components}/SchemaVariables/SchemaVariables.mjs +1 -1
  5. package/dist/{components → builder/components}/SchemaVariables/VariableDetails.mjs +22 -22
  6. package/dist/{components → builder/components}/SchemaVariables/VariableValue.mjs +1 -1
  7. package/dist/{components → builder/components}/SchemaVariables/index.mjs +1 -1
  8. package/dist/{components → builder/components}/StyleVariables/StyleVariable.mjs +1 -1
  9. package/dist/{components → builder/components}/StyleVariables/StyleVariables.mjs +1 -1
  10. package/dist/builder/components/StyleVariables/VariableDetails.mjs +31 -0
  11. package/dist/{components → builder/components}/StyleVariables/VariableGroup.mjs +1 -1
  12. package/dist/{components → builder/components}/StyleVariables/VariableList.mjs +1 -1
  13. package/dist/{components → builder/components}/StyleVariables/VariableValue.mjs +1 -1
  14. package/dist/{components → builder/components}/StyleVariables/index.mjs +1 -1
  15. package/dist/{components → builder/components}/VariableActions/VariableActions.mjs +1 -1
  16. package/dist/{components → builder/components}/VariableActions/index.mjs +1 -1
  17. package/dist/{components → builder/components}/index.mjs +2 -2
  18. package/dist/builder/index.d.ts +9 -0
  19. package/dist/builder/index.mjs +9 -0
  20. package/dist/{models → builder/models}/SchemaVariableForm/SchemaVariableForm.mjs +1 -1
  21. package/dist/{models → builder/models}/SchemaVariableForm/VariableSubValue.mjs +17 -17
  22. package/dist/{models → builder/models}/SchemaVariableForm/VariableSubValueActions.mjs +1 -1
  23. package/dist/{models → builder/models}/SchemaVariableForm/VariableValue.mjs +1 -1
  24. package/dist/{models → builder/models}/SchemaVariableForm/index.mjs +1 -1
  25. package/dist/{models → builder/models}/StyleVariableForm/StyleVariableForm.mjs +1 -1
  26. package/dist/{models → builder/models}/StyleVariableForm/index.mjs +1 -1
  27. package/dist/{models → builder/models}/index.mjs +2 -2
  28. package/dist/index.d.ts +1 -5
  29. package/dist/index.mjs +1 -9
  30. package/package.json +13 -139
  31. package/dist/components/StyleVariables/VariableDetails.mjs +0 -31
  32. /package/dist/{components → builder/components}/SchemaVariables/SchemaVariable.d.ts +0 -0
  33. /package/dist/{components → builder/components}/SchemaVariables/SchemaVariables.d.ts +0 -0
  34. /package/dist/{components → builder/components}/SchemaVariables/VariableDetails.d.ts +0 -0
  35. /package/dist/{components → builder/components}/SchemaVariables/VariableValue.d.ts +0 -0
  36. /package/dist/{components → builder/components}/SchemaVariables/index.d.ts +0 -0
  37. /package/dist/{components → builder/components}/StyleVariables/StyleVariable.d.ts +0 -0
  38. /package/dist/{components → builder/components}/StyleVariables/StyleVariables.d.ts +0 -0
  39. /package/dist/{components → builder/components}/StyleVariables/VariableDetails.d.ts +0 -0
  40. /package/dist/{components → builder/components}/StyleVariables/VariableGroup.d.ts +0 -0
  41. /package/dist/{components → builder/components}/StyleVariables/VariableList.d.ts +0 -0
  42. /package/dist/{components → builder/components}/StyleVariables/VariableValue.d.ts +0 -0
  43. /package/dist/{components → builder/components}/StyleVariables/index.d.ts +0 -0
  44. /package/dist/{components → builder/components}/VariableActions/VariableActions.d.ts +0 -0
  45. /package/dist/{components → builder/components}/VariableActions/index.d.ts +0 -0
  46. /package/dist/{components → builder/components}/index.d.ts +0 -0
  47. /package/dist/{models → builder/models}/SchemaVariableForm/SchemaVariableForm.d.ts +0 -0
  48. /package/dist/{models → builder/models}/SchemaVariableForm/VariableSubValue.d.ts +0 -0
  49. /package/dist/{models → builder/models}/SchemaVariableForm/VariableSubValueActions.d.ts +0 -0
  50. /package/dist/{models → builder/models}/SchemaVariableForm/VariableValue.d.ts +0 -0
  51. /package/dist/{models → builder/models}/SchemaVariableForm/index.d.ts +0 -0
  52. /package/dist/{models → builder/models}/StyleVariableForm/StyleVariableForm.d.ts +0 -0
  53. /package/dist/{models → builder/models}/StyleVariableForm/index.d.ts +0 -0
  54. /package/dist/{models → builder/models}/index.d.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,113 @@
1
1
  # @plitzi/sdk-variables
2
2
 
3
+ ## 0.38.17
4
+
5
+ ### Patch Changes
6
+
7
+ - 4f8dc37: ## Packages
8
+
9
+ - **A library package is imported by its root and its folders, never by a file** (`@plitzi/sdk-shared`, `sdk-schema`,
10
+ `sdk-style`, `sdk-elements`, `sdk-interactions`, `sdk-auth`, `sdk-dev-tools`, `sdk-event-bridge`, `sdk-navigation`,
11
+ `sdk-plugins`, `sdk-variables`): each `exports` is now `"."` and `"./*"`, the latter a folder's `index`.
12
+ `@plitzi/sdk-shared/helpers/isRecord` becomes `import { isRecord } from '@plitzi/sdk-shared/helpers'`, and a default
13
+ export by the name its folder gives it — almost always its file's (`import usePlitzi from '…/hooks/usePlitzi'` →
14
+ `import { usePlitzi } from '@plitzi/sdk-shared/hooks'`). A file-level specifier now fails with `ERR_MODULE_NOT_FOUND`.
15
+ New entries where a folder barrel would have brought more than was asked for: `@plitzi/sdk-shared/project` and
16
+ `@plitzi/sdk-shared/plugins/bundle` (Node only), `@plitzi/sdk-interactions/declarations` (the global callbacks and
17
+ utility specs, without React), and `@plitzi/sdk-elements/elements/declarations`, which now also carries the
18
+ declarations' attribute types and the constants they are checked with. `RuleGroup` is exported by `@plitzi/sdk-shared`
19
+ with the document types that use it. `plitzi upgrade migrations` names every such import in a project, with the folder to
20
+ import it from instead.
21
+ - **`@plitzi/sdk-shared`'s root exports the document types, and only them** (`@plitzi/sdk-shared`): what the package
22
+ does is imported from its folder — `formatDate` from `@plitzi/sdk-shared/helpers`, `ThemeProvider` from
23
+ `@plitzi/sdk-shared/theme`, a GraphQL operation's types from `@plitzi/sdk-shared/network/graphql` — so a module that
24
+ imports a type from the root no longer loads every area of the package.
25
+ - **What one package alone used lives in that package** (`@plitzi/sdk-shared`, `@plitzi/sdk-elements`): the data
26
+ source hooks moved from `@plitzi/sdk-shared/dataSource/hooks` to `@plitzi/sdk-elements/dataSource`
27
+ (`useRegisterSource`, `useResolvedVariables`), and the Apollo links the builder's client is built with into the
28
+ builder.
29
+ - **The builder's panels are an entry of their own** (`@plitzi/sdk-style`, `@plitzi/sdk-variables`,
30
+ `@plitzi/sdk-elements`): the style inspector, the advanced style editor and `BuilderStyleContextProvider` are imported
31
+ from `@plitzi/sdk-style/builder`; the variables' lists and forms from `@plitzi/sdk-variables/builder`; the elements'
32
+ settings panels (`defaultElementsSettings`) from `@plitzi/sdk-elements/builder`. Each package's root keeps what a page
33
+ and a server use — `generateCache` no longer loads the inspector, on a server 227 modules down to 21.
34
+
35
+ ## CLI
36
+ - **`plitzi upgrade`'s `renames` part is now `migrations`** (`@plitzi/cli`): what a version changed that a project's
37
+ own source must follow, one file per change in the CLI's `src/migrations/changes/` with the version it shipped in —
38
+ rewritten with `--write` when it has one right answer, said otherwise. The `--json` report carries `migrations` (each
39
+ with its `migration`, `since`, `file`, `line`, `what` and whether it was `written`) in place of `renames` and
40
+ `changes`. The changes of 0.38.0 (`canTemplate` → `canSnippet`, the `*Template` authoring names), 0.38.9 (a
41
+ `formControl` without `required` is optional) and 0.38.12 (`usePlitziServiceContext` → `usePlitzi`) are no longer
42
+ looked for: a project still on one of those versions makes them by hand.
43
+
44
+ - Updated dependencies [4f8dc37]
45
+ - @plitzi/sdk-shared@0.38.17
46
+
47
+ ## 0.38.16
48
+
49
+ ### Patch Changes
50
+
51
+ - 9cfdccb: ## Security
52
+
53
+ - **A site's credential reads nothing of the space over MCP** (`@plitzi/sdk-mcp`): the `render` token every published
54
+ page embeds — and a self-hosting `host` key — resolved to a grant naming the space, and the MCP served every read
55
+ under it: the unpublished draft, the change history with who made each change and every value before and after, the
56
+ functions' source, the space's private data, its action documents and connectors. Only an `agent` grant attaches a
57
+ space now; any other is a connection with no space (`plitzi_render` and the public guides), told so in the words
58
+ `NO_SPACE_ATTACHED` already uses. A deployment whose `getGrant` answered other scopes for reading must issue agent
59
+ grants for them.
60
+
61
+ ## Agents
62
+ - **`plitzi space watch`** (`@plitzi/cli`): the space read again on every save of `src/space/`, `src/plugins/`,
63
+ `src/data/` or `public/data/`, and only what changed said — what the save did to the space element by element, the
64
+ findings and warnings it brought and fixed (one that only moved down its file is the same one), a save that changed
65
+ nothing, or that the space stopped authoring and why. `--json` is one event a line (`ready`, `pass`, `refused`,
66
+ `error`), for an agent to run in the background instead of `author` and `space lint` after every edit. Each pass reads
67
+ the space in a process of its own (`space watch-pass`, hidden). `space lint`'s reading is `spaceFindings`, shared.
68
+ - **A space's activity, followed** (`@plitzi/sdk-shared`, `@plitzi/sdk-mcp`, `@plitzi/cli`): what happened on a space
69
+ after a cursor — its draft changed (a person in the builder, an agent, the autofix), a version went out, a server
70
+ action failed or was refused — and, with nothing yet, waited for, up to 50 s. One vocabulary,
71
+ `@plitzi/sdk-shared/activity` (`SpaceActivity`, `SpaceActivityPage`, `activityLine`, `isSpaceActivityPage`, the
72
+ limits); the reader's own writes left out and counted (`skippedMine`), `mine` keeps them.
73
+ - **`plitzi_activity { after, wait, limit, mine }`** (`@plitzi/sdk-mcp`), on the new `getActivity` adapter
74
+ (`SSRAdapters`). The listing budget is 78k (was 77k) for it.
75
+ - **`plitzi space activity [--follow] [--after <cursor>] [--mine] [--limit <n>] [--json]`** (`@plitzi/cli`), over
76
+ the platform's `GET /spaces/:spaceId/activity`; `--follow` stays, one page a line with `--json`, and asks again
77
+ when the platform does not answer.
78
+ - **The people in the builder see the agent work** (`@plitzi/sdk-server`, `@plitzi/sdk-shared`, `@plitzi/sdk-mcp`,
79
+ `@plitzi/plitzi-builder`): an agent grant carries the application the member connected (`Grant.client`,
80
+ `StoredSpaceToken.client`, `SSRGrant.client`), and every MCP write `SSRWriteContext.client` — the history's
81
+ `client` for an agent, which was never set. A collaborator may be an agent (`SubscriptionCollaborator.agent`): the
82
+ builder draws it as a robot, names it `Claude · for ana` (`collaboratorTitle`) in the header, on the canvas and in
83
+ its notices. The deployment announces it — Plitzi's joins it on a write, selects what it changed, and lets it go
84
+ after a minute of nothing. `activityLine` names it the same way (`Claude for ana over the MCP, …`), so
85
+ `plitzi space activity` says which application wrote.
86
+ - A tool may declare `documents: false` (`ToolSpec`): the host loads none of the space for it, and passes the call's
87
+ abort signal through `ToolContext.activity`.
88
+
89
+ ## Authoring
90
+ - **A file that does not parse is said at its line under any loader** (`@plitzi/sdk-authoring`): `moduleProblem` read
91
+ the first line of the error, and an esbuild transform (tsx, vitest) puts only `Transform failed with 1 error:` there
92
+ — the file, line and what is wrong are on the next. A line of the message that points at a file of the project is
93
+ now the problem (`src/space/hero.ts:139: Expected "}" but found ";"`), the project's root matched as given and as it
94
+ is on disk (`/var/…` and `/private/var/…` on macOS).
95
+
96
+ ## Testing
97
+ - **`unusedPort` is chosen where the system never hands one out** (`@plitzi/sdk-server`): it answered a port the system
98
+ had just handed out (`listen(0)`), from the ephemeral range every outgoing connection takes its local port from — so
99
+ another worker's request could take it before the test listened, and CI failed `runtime.test.ts` with `EADDRINUSE`
100
+ (the page server then ends the process). It is a free port below that range now, at random, checked first.
101
+
102
+ ## Docs
103
+ - **A self-hosted runtime's endpoints go in `data`**, as 0.38.15 moved them: `docs/en/runtimes.md`, the
104
+ `10-runtime` example and the website still put `served.stage` in `preAuth`, before the cross-site guard.
105
+ - New: `docs/en/activity.md`; `space watch` in `docs/en/agent-tooling.md`'s loop; the CLI README, the CLI skill, the
106
+ generated project's `AGENTS.md`, the MCP guide and README.
107
+
108
+ - Updated dependencies [9cfdccb]
109
+ - @plitzi/sdk-shared@0.38.16
110
+
3
111
  ## 0.38.15
4
112
 
5
113
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import { sharedContext as e } from "@plitzi/sdk-shared/helpers/sharedContext";
1
+ import { sharedContext as e } from "@plitzi/sdk-shared/helpers";
2
2
  var t = e("VariablesContext", void 0);
3
3
  //#endregion
4
4
  export { t as default };
@@ -5,7 +5,7 @@ import r from "../../models/SchemaVariableForm/index.mjs";
5
5
  import { omit as i } from "@plitzi/plitzi-ui/helpers";
6
6
  import { useCallback as a, useState as o } from "react";
7
7
  import { jsx as s, jsxs as c } from "react/jsx-runtime";
8
- //#region src/components/SchemaVariables/SchemaVariable.tsx
8
+ //#region src/builder/components/SchemaVariables/SchemaVariable.tsx
9
9
  var l = ({ name: l = "variable", value: u = "", type: d = "text", category: f = "", subValues: p, whenData: m, onChange: h, onRemove: g }) => {
10
10
  let [_, v] = o(!1), [y, b] = o(!1), x = a((e) => {
11
11
  e.stopPropagation(), g(l);
@@ -4,7 +4,7 @@ import { useCallback as n, useState as r } from "react";
4
4
  import i from "@plitzi/plitzi-ui/Button";
5
5
  import a from "clsx";
6
6
  import { jsx as o, jsxs as s } from "react/jsx-runtime";
7
- //#region src/components/SchemaVariables/SchemaVariables.tsx
7
+ //#region src/builder/components/SchemaVariables/SchemaVariables.tsx
8
8
  var c = ({ className: c, variables: l, whenData: u, onAdd: d, onUpdate: f, onRemove: p }) => {
9
9
  let [m, h] = r(), g = n((e) => {
10
10
  d?.(e), h(void 0);
@@ -1,52 +1,52 @@
1
1
  import e from "./VariableValue.mjs";
2
- import { useCallback as t } from "react";
3
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
- import { QueryBuilderFormatter as i } from "@plitzi/plitzi-ui/QueryBuilder";
5
- import { useToast as a } from "@plitzi/plitzi-ui/Toast";
6
- import { NOT_COPIED_REASON as o, copyText as s } from "@plitzi/sdk-shared/helpers/clipboard";
7
- //#region src/components/SchemaVariables/VariableDetails.tsx
2
+ import { NOT_COPIED_REASON as t, copyText as n } from "@plitzi/sdk-shared/helpers";
3
+ import { useCallback as r } from "react";
4
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
+ import { QueryBuilderFormatter as o } from "@plitzi/plitzi-ui/QueryBuilder";
6
+ import { useToast as s } from "@plitzi/plitzi-ui/Toast";
7
+ //#region src/builder/components/SchemaVariables/VariableDetails.tsx
8
8
  var c = ({ name: c, subValues: l = [], type: u = "text" }) => {
9
- let { addToast: d } = a(), f = t(() => {
10
- s(`{{${c}}}`).then((e) => d(e ? "Variable copied into the clipboard" : o, {
9
+ let { addToast: d } = s(), f = r(() => {
10
+ n(`{{${c}}}`).then((e) => d(e ? "Variable copied into the clipboard" : t, {
11
11
  appeareance: e ? "success" : "error",
12
12
  autoDismiss: !0,
13
13
  placement: "top-right"
14
14
  }));
15
15
  }, [d, c]);
16
- return /* @__PURE__ */ r("div", {
16
+ return /* @__PURE__ */ a("div", {
17
17
  className: "flex w-full flex-col gap-2",
18
- children: [l.length > 0 && /* @__PURE__ */ n("div", {
18
+ children: [l.length > 0 && /* @__PURE__ */ i("div", {
19
19
  className: "flex w-full flex-col gap-1",
20
- children: l.map((t, a) => /* @__PURE__ */ r("div", {
20
+ children: l.map((t, n) => /* @__PURE__ */ a("div", {
21
21
  className: "flex w-full flex-col rounded-sm border border-gray-300 text-xs",
22
- children: [/* @__PURE__ */ r("div", {
22
+ children: [/* @__PURE__ */ a("div", {
23
23
  className: "flex items-center gap-1 px-1 py-0.5",
24
- children: [/* @__PURE__ */ n("div", {
24
+ children: [/* @__PURE__ */ i("div", {
25
25
  className: "font-bold",
26
26
  children: "Value:"
27
- }), /* @__PURE__ */ n(e, {
27
+ }), /* @__PURE__ */ i(e, {
28
28
  className: "text-xs",
29
29
  value: String(t.value),
30
30
  type: u
31
31
  })]
32
- }), /* @__PURE__ */ r("div", {
32
+ }), /* @__PURE__ */ a("div", {
33
33
  className: "flex gap-1 border-t border-gray-300 px-1 py-0.5",
34
- children: [/* @__PURE__ */ n("div", {
34
+ children: [/* @__PURE__ */ i("div", {
35
35
  className: "font-bold",
36
36
  children: "When:"
37
- }), i(t.when)]
37
+ }), o(t.when)]
38
38
  })]
39
- }, a))
40
- }), /* @__PURE__ */ r("div", {
39
+ }, n))
40
+ }), /* @__PURE__ */ a("div", {
41
41
  className: "flex items-center justify-between gap-2",
42
- children: [/* @__PURE__ */ r("div", {
42
+ children: [/* @__PURE__ */ a("div", {
43
43
  className: "flex gap-1",
44
- children: ["Token:", /* @__PURE__ */ n("div", {
44
+ children: ["Token:", /* @__PURE__ */ i("div", {
45
45
  className: "truncate font-bold",
46
46
  title: c,
47
47
  children: `{{${c}}}`
48
48
  })]
49
- }), /* @__PURE__ */ n("i", {
49
+ }), /* @__PURE__ */ i("i", {
50
50
  className: "fa-solid fa-copy cursor-pointer hover:text-blue-400",
51
51
  onClick: f,
52
52
  title: "Copy"
@@ -1,5 +1,5 @@
1
1
  import { jsx as e, jsxs as t } from "react/jsx-runtime";
2
- //#region src/components/SchemaVariables/VariableValue.tsx
2
+ //#region src/builder/components/SchemaVariables/VariableValue.tsx
3
3
  var n = ({ type: n, value: r }) => /* @__PURE__ */ t("div", {
4
4
  className: "flex items-center gap-1 truncate text-xs",
5
5
  children: [n === "color" && /* @__PURE__ */ e("div", {
@@ -1,5 +1,5 @@
1
1
  import e from "./SchemaVariables.mjs";
2
- //#region src/components/SchemaVariables/index.ts
2
+ //#region src/builder/components/SchemaVariables/index.ts
3
3
  var t = e;
4
4
  //#endregion
5
5
  export { t as default };
@@ -6,7 +6,7 @@ import { omit as i } from "@plitzi/plitzi-ui/helpers";
6
6
  import { useCallback as a, useState as o } from "react";
7
7
  import { jsx as s, jsxs as c } from "react/jsx-runtime";
8
8
  import { StyleVariableCategory as l } from "@plitzi/sdk-shared";
9
- //#region src/components/StyleVariables/StyleVariable.tsx
9
+ //#region src/builder/components/StyleVariables/StyleVariable.tsx
10
10
  var u = ({ category: u, name: d, value: f, onUpdate: p, onRemove: m }) => {
11
11
  let [h, g] = o(!1), [_, v] = o(!1), y = a((e) => {
12
12
  e.stopPropagation(), g(!0);
@@ -5,7 +5,7 @@ import i from "@plitzi/plitzi-ui/Button";
5
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
- //#region src/components/StyleVariables/StyleVariables.tsx
8
+ //#region src/builder/components/StyleVariables/StyleVariables.tsx
9
9
  var l = ({ className: l, variables: u = {
10
10
  color: {},
11
11
  spacing: {},
@@ -0,0 +1,31 @@
1
+ import { NOT_COPIED_REASON as e, copyText as t } from "@plitzi/sdk-shared/helpers";
2
+ import { useCallback as n } from "react";
3
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
4
+ import { useToast as a } from "@plitzi/plitzi-ui/Toast";
5
+ //#region src/builder/components/StyleVariables/VariableDetails.tsx
6
+ var o = ({ name: o }) => {
7
+ let { addToast: s } = a(), c = n(() => {
8
+ t(`var(--${o})`).then((t) => s(t ? "Variable copied into the clipboard" : e, {
9
+ appeareance: t ? "success" : "error",
10
+ autoDismiss: !0,
11
+ placement: "top-right"
12
+ }));
13
+ }, [s, o]);
14
+ return /* @__PURE__ */ i("div", {
15
+ className: "flex w-full items-center justify-between gap-2",
16
+ children: [/* @__PURE__ */ i("div", {
17
+ className: "flex gap-1",
18
+ children: ["Token:", /* @__PURE__ */ r("div", {
19
+ className: "truncate font-bold",
20
+ title: o,
21
+ children: `var(--${o})`
22
+ })]
23
+ }), /* @__PURE__ */ r("i", {
24
+ className: "fa-solid fa-copy cursor-pointer hover:text-blue-400",
25
+ onClick: c,
26
+ title: "Copy"
27
+ })]
28
+ });
29
+ };
30
+ //#endregion
31
+ export { o as default };
@@ -2,7 +2,7 @@ import e from "./StyleVariable.mjs";
2
2
  import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
3
  import r from "@plitzi/plitzi-ui/ContainerCollapsable";
4
4
  import i from "@plitzi/plitzi-ui/Icon";
5
- //#region src/components/StyleVariables/VariableGroup.tsx
5
+ //#region src/builder/components/StyleVariables/VariableGroup.tsx
6
6
  var a = ({ category: a, variables: o = {}, onUpdate: s, onRemove: c }) => {
7
7
  let l = Object.keys(o).length;
8
8
  return /* @__PURE__ */ n(r, {
@@ -1,7 +1,7 @@
1
1
  import e from "./VariableGroup.mjs";
2
2
  import { jsx as t } from "react/jsx-runtime";
3
3
  import { StyleVariableCategory as n } from "@plitzi/sdk-shared";
4
- //#region src/components/StyleVariables/VariableList.tsx
4
+ //#region src/builder/components/StyleVariables/VariableList.tsx
5
5
  var r = ({ variables: r, onUpdate: i, onRemove: a }) => {
6
6
  if (r) return /* @__PURE__ */ t("div", {
7
7
  className: "flex grow flex-col overflow-y-auto",
@@ -1,6 +1,6 @@
1
1
  import { useMemo as e } from "react";
2
2
  import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
- //#region src/components/StyleVariables/VariableValue.tsx
3
+ //#region src/builder/components/StyleVariables/VariableValue.tsx
4
4
  var r = ({ type: r, value: i }) => {
5
5
  let a = e(() => typeof i == "object" ? Object.keys(i).sort((e) => e === "default" ? -1 : 1) : [], [i]);
6
6
  return /* @__PURE__ */ n("div", {
@@ -1,5 +1,5 @@
1
1
  import e from "./StyleVariables.mjs";
2
- //#region src/components/StyleVariables/index.ts
2
+ //#region src/builder/components/StyleVariables/index.ts
3
3
  var t = e;
4
4
  //#endregion
5
5
  export { t as default };
@@ -1,7 +1,7 @@
1
1
  import e from "@plitzi/plitzi-ui/Button";
2
2
  import t from "clsx";
3
3
  import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
- //#region src/components/VariableActions/VariableActions.tsx
4
+ //#region src/builder/components/VariableActions/VariableActions.tsx
5
5
  var i = ({ onUpdate: i, onRemove: a, selected: o = !1 }) => /* @__PURE__ */ r("div", {
6
6
  className: t("flex items-center gap-2 text-xs", {
7
7
  flex: o,
@@ -1,5 +1,5 @@
1
1
  import e from "./VariableActions.mjs";
2
- //#region src/components/VariableActions/index.ts
2
+ //#region src/builder/components/VariableActions/index.ts
3
3
  var t = e;
4
4
  //#endregion
5
5
  export { t as default };
@@ -1,7 +1,7 @@
1
- import { __exportAll as e } from "../_virtual/_rolldown/runtime.mjs";
1
+ import { __exportAll as e } from "../../_virtual/_rolldown/runtime.mjs";
2
2
  import t from "./SchemaVariables/index.mjs";
3
3
  import n from "./StyleVariables/index.mjs";
4
- //#region src/components/index.ts
4
+ //#region src/builder/components/index.ts
5
5
  var r = /* @__PURE__ */ e({
6
6
  SchemaVariables: () => t,
7
7
  StyleVariables: () => n
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The variables the builder edits — the schema's and the style's lists and their forms. An entry of its own so the
3
+ * package's root (the CSS a space's variables compile to) loads none of it where nothing is edited.
4
+ */
5
+ import * as components from './components';
6
+ import * as forms from './models';
7
+ export * from './components';
8
+ export * from './models';
9
+ export { components, forms };
@@ -0,0 +1,9 @@
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
+ export { t as SchemaVariableForm, n as SchemaVariables, i as StyleVariableForm, o as StyleVariables, s as components, a as forms, e as schemaVariableFormSchema, r as styleVariableFormSchema };
@@ -6,7 +6,7 @@ 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";
8
8
  import { z as d } from "zod";
9
- //#region src/models/SchemaVariableForm/SchemaVariableForm.tsx
9
+ //#region src/builder/models/SchemaVariableForm/SchemaVariableForm.tsx
10
10
  var f = d.object({
11
11
  name: d.string().min(4).regex(/^(?:\w+\s+|)([a-zA-Z_][a-zA-Z0-9_]+)$/i, { message: "Name only can be letters, numbers and _ -" }),
12
12
  category: d.string(),
@@ -1,13 +1,13 @@
1
1
  import e from "./VariableValue.mjs";
2
- import { useMemo as t } from "react";
3
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
- import i from "@plitzi/plitzi-ui/QueryBuilder";
5
- import a from "@plitzi/plitzi-ui/Form";
6
- import o from "@plitzi/plitzi-ui/Heading";
7
- import { getPathsFromObject as s } from "@plitzi/sdk-shared/helpers/utils";
8
- //#region src/models/SchemaVariableForm/VariableSubValue.tsx
2
+ import { getPathsFromObject as t } from "@plitzi/sdk-shared/helpers";
3
+ import { useMemo as n } from "react";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ import a from "@plitzi/plitzi-ui/QueryBuilder";
6
+ import o from "@plitzi/plitzi-ui/Form";
7
+ import s from "@plitzi/plitzi-ui/Heading";
8
+ //#region src/builder/models/SchemaVariableForm/VariableSubValue.tsx
9
9
  var c = ({ index: c = 0, valueType: l = "text", whenData: u, indexLimit: d, onClickRemove: f, onClickUp: p, onClickDown: m }) => {
10
- let h = t(() => s(u).reduce((e, t) => ({
10
+ let h = n(() => t(u).reduce((e, t) => ({
11
11
  ...e,
12
12
  [t]: {
13
13
  name: t,
@@ -15,9 +15,9 @@ var c = ({ index: c = 0, valueType: l = "text", whenData: u, indexLimit: d, onCl
15
15
  placeholder: `Enter ${t}`
16
16
  }
17
17
  }), {}), [u]);
18
- return /* @__PURE__ */ r("div", {
18
+ return /* @__PURE__ */ i("div", {
19
19
  className: "flex min-w-0 grow basis-0 flex-col gap-3 rounded-sm border border-gray-300 p-2",
20
- children: [/* @__PURE__ */ n(e, {
20
+ children: [/* @__PURE__ */ r(e, {
21
21
  valueType: l,
22
22
  name: `subValues.${c}.value`,
23
23
  isSubValue: !0,
@@ -26,25 +26,25 @@ var c = ({ index: c = 0, valueType: l = "text", whenData: u, indexLimit: d, onCl
26
26
  onClickRemove: f,
27
27
  onClickUp: p,
28
28
  onClickDown: m
29
- }), /* @__PURE__ */ n(a.Custom, {
29
+ }), /* @__PURE__ */ r(o.Custom, {
30
30
  name: `subValues.${c}.when`,
31
- render: ({ field: { ref: e, value: t, onChange: a }, fieldState: { error: s } }) => /* @__PURE__ */ r("div", {
31
+ render: ({ field: { ref: e, value: t, onChange: n }, fieldState: { error: o } }) => /* @__PURE__ */ i("div", {
32
32
  className: "flex flex-col gap-1",
33
33
  ref: e,
34
- children: [/* @__PURE__ */ n(o, {
34
+ children: [/* @__PURE__ */ r(s, {
35
35
  as: "h5",
36
36
  children: "When Happens"
37
- }), /* @__PURE__ */ n("div", {
37
+ }), /* @__PURE__ */ r("div", {
38
38
  className: "flex flex-col",
39
- children: /* @__PURE__ */ n(i, {
39
+ children: /* @__PURE__ */ r(a, {
40
40
  direction: "vertical",
41
41
  intent: "gray",
42
42
  className: "w-full",
43
43
  query: t,
44
44
  fields: h,
45
- onChange: a,
45
+ onChange: n,
46
46
  showBranches: !0,
47
- error: !!s?.message
47
+ error: !!o?.message
48
48
  })
49
49
  })]
50
50
  })
@@ -1,6 +1,6 @@
1
1
  import e from "@plitzi/plitzi-ui/Button";
2
2
  import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
- //#region src/models/SchemaVariableForm/VariableSubValueActions.tsx
3
+ //#region src/builder/models/SchemaVariableForm/VariableSubValueActions.tsx
4
4
  var r = ({ indexLimit: r = 0, index: i = 0, onClickRemove: a, onClickUp: o, onClickDown: s }) => /* @__PURE__ */ n("div", {
5
5
  className: "flex gap-2",
6
6
  children: [
@@ -1,7 +1,7 @@
1
1
  import e from "./VariableSubValueActions.mjs";
2
2
  import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
3
  import r from "@plitzi/plitzi-ui/Form";
4
- //#region src/models/SchemaVariableForm/VariableValue.tsx
4
+ //#region src/builder/models/SchemaVariableForm/VariableValue.tsx
5
5
  var i = ({ valueType: i = "text", hasSubValues: a = !1, name: o = "value", index: s, indexLimit: c, isSubValue: l = !1, onClickRemove: u, onClickUp: d, onClickDown: f }) => {
6
6
  let p = a ? "Fallback Value" : "Value", m = {
7
7
  name: o,
@@ -1,5 +1,5 @@
1
1
  import e, { schemaVariableFormSchema as t } from "./SchemaVariableForm.mjs";
2
- //#region src/models/SchemaVariableForm/index.ts
2
+ //#region src/builder/models/SchemaVariableForm/index.ts
3
3
  var n = e;
4
4
  //#endregion
5
5
  export { n as default, t as schemaVariableFormSchema };
@@ -4,7 +4,7 @@ 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";
6
6
  import { StyleVariableCategory as l, isStyleVariableCategory as u } from "@plitzi/sdk-shared";
7
- //#region src/models/StyleVariableForm/StyleVariableForm.tsx
7
+ //#region src/builder/models/StyleVariableForm/StyleVariableForm.tsx
8
8
  var d = c.string().min(3, "Too Short").max(20, "Too Long").regex(/^(?:\w+\s+|)([a-zA-Z_][a-zA-Z0-9_-]+)$/i, "Invalid Name"), f = c.discriminatedUnion("category", [
9
9
  c.object({
10
10
  name: d,
@@ -1,5 +1,5 @@
1
1
  import e, { styleVariableFormSchema as t } from "./StyleVariableForm.mjs";
2
- //#region src/models/StyleVariableForm/index.ts
2
+ //#region src/builder/models/StyleVariableForm/index.ts
3
3
  var n = e;
4
4
  //#endregion
5
5
  export { n as default, t as styleVariableFormSchema };
@@ -1,9 +1,9 @@
1
- import { __exportAll as e } from "../_virtual/_rolldown/runtime.mjs";
1
+ import { __exportAll as e } from "../../_virtual/_rolldown/runtime.mjs";
2
2
  import { schemaVariableFormSchema as t } from "./SchemaVariableForm/SchemaVariableForm.mjs";
3
3
  import n from "./SchemaVariableForm/index.mjs";
4
4
  import { styleVariableFormSchema as r } from "./StyleVariableForm/StyleVariableForm.mjs";
5
5
  import i from "./StyleVariableForm/index.mjs";
6
- //#region src/models/index.ts
6
+ //#region src/builder/models/index.ts
7
7
  var a = /* @__PURE__ */ e({
8
8
  SchemaVariableForm: () => n,
9
9
  StyleVariableForm: () => i,
package/dist/index.d.ts CHANGED
@@ -1,9 +1,5 @@
1
1
  import { default as VariablesContext } from './VariablesContext';
2
2
  import { schemaVariablesToCss, styleVariablesToCss } from './VariablesHelper';
3
- import * as components from './components';
4
- import * as forms from './models';
5
- export * from './models';
6
- export * from './components';
7
3
  export * from './VariablesContext';
8
4
  export * from './VariablesHelper';
9
- export { VariablesContext, schemaVariablesToCss, styleVariablesToCss, components, forms };
5
+ export { VariablesContext, schemaVariablesToCss, styleVariablesToCss };
package/dist/index.mjs CHANGED
@@ -1,11 +1,3 @@
1
1
  import e from "./VariablesContext.mjs";
2
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 };
3
+ export { e as VariablesContext, t as schemaVariablesToCss, n as styleSelectorVariablesToCss, r as styleVariablesToCss };
package/package.json CHANGED
@@ -1,146 +1,20 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-variables",
3
- "version": "0.38.15",
3
+ "version": "0.38.17",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist"
7
7
  ],
8
8
  "exports": {
9
9
  ".": {
10
+ "@plitzi/source": "./src/index.ts",
10
11
  "types": "./dist/index.d.ts",
11
12
  "import": "./dist/index.mjs"
12
13
  },
13
- "./VariablesContext": {
14
- "types": "./dist/VariablesContext.d.ts",
15
- "import": "./dist/VariablesContext.mjs"
16
- },
17
- "./VariablesHelper": {
18
- "types": "./dist/VariablesHelper.d.ts",
19
- "import": "./dist/VariablesHelper.mjs"
20
- },
21
- "./components": {
22
- "types": "./dist/components/index.d.ts",
23
- "import": "./dist/components/index.mjs"
24
- },
25
- "./components/SchemaVariables": {
26
- "types": "./dist/components/SchemaVariables/index.d.ts",
27
- "import": "./dist/components/SchemaVariables/index.mjs"
28
- },
29
- "./components/SchemaVariables/SchemaVariable": {
30
- "types": "./dist/components/SchemaVariables/SchemaVariable.d.ts",
31
- "import": "./dist/components/SchemaVariables/SchemaVariable.mjs"
32
- },
33
- "./components/SchemaVariables/SchemaVariables": {
34
- "types": "./dist/components/SchemaVariables/SchemaVariables.d.ts",
35
- "import": "./dist/components/SchemaVariables/SchemaVariables.mjs"
36
- },
37
- "./components/SchemaVariables/VariableDetails": {
38
- "types": "./dist/components/SchemaVariables/VariableDetails.d.ts",
39
- "import": "./dist/components/SchemaVariables/VariableDetails.mjs"
40
- },
41
- "./components/SchemaVariables/VariableValue": {
42
- "types": "./dist/components/SchemaVariables/VariableValue.d.ts",
43
- "import": "./dist/components/SchemaVariables/VariableValue.mjs"
44
- },
45
- "./components/SchemaVariables/index": {
46
- "types": "./dist/components/SchemaVariables/index.d.ts",
47
- "import": "./dist/components/SchemaVariables/index.mjs"
48
- },
49
- "./components/StyleVariables": {
50
- "types": "./dist/components/StyleVariables/index.d.ts",
51
- "import": "./dist/components/StyleVariables/index.mjs"
52
- },
53
- "./components/StyleVariables/StyleVariable": {
54
- "types": "./dist/components/StyleVariables/StyleVariable.d.ts",
55
- "import": "./dist/components/StyleVariables/StyleVariable.mjs"
56
- },
57
- "./components/StyleVariables/StyleVariables": {
58
- "types": "./dist/components/StyleVariables/StyleVariables.d.ts",
59
- "import": "./dist/components/StyleVariables/StyleVariables.mjs"
60
- },
61
- "./components/StyleVariables/VariableDetails": {
62
- "types": "./dist/components/StyleVariables/VariableDetails.d.ts",
63
- "import": "./dist/components/StyleVariables/VariableDetails.mjs"
64
- },
65
- "./components/StyleVariables/VariableGroup": {
66
- "types": "./dist/components/StyleVariables/VariableGroup.d.ts",
67
- "import": "./dist/components/StyleVariables/VariableGroup.mjs"
68
- },
69
- "./components/StyleVariables/VariableList": {
70
- "types": "./dist/components/StyleVariables/VariableList.d.ts",
71
- "import": "./dist/components/StyleVariables/VariableList.mjs"
72
- },
73
- "./components/StyleVariables/VariableValue": {
74
- "types": "./dist/components/StyleVariables/VariableValue.d.ts",
75
- "import": "./dist/components/StyleVariables/VariableValue.mjs"
76
- },
77
- "./components/StyleVariables/index": {
78
- "types": "./dist/components/StyleVariables/index.d.ts",
79
- "import": "./dist/components/StyleVariables/index.mjs"
80
- },
81
- "./components/VariableActions": {
82
- "types": "./dist/components/VariableActions/index.d.ts",
83
- "import": "./dist/components/VariableActions/index.mjs"
84
- },
85
- "./components/VariableActions/VariableActions": {
86
- "types": "./dist/components/VariableActions/VariableActions.d.ts",
87
- "import": "./dist/components/VariableActions/VariableActions.mjs"
88
- },
89
- "./components/VariableActions/index": {
90
- "types": "./dist/components/VariableActions/index.d.ts",
91
- "import": "./dist/components/VariableActions/index.mjs"
92
- },
93
- "./components/index": {
94
- "types": "./dist/components/index.d.ts",
95
- "import": "./dist/components/index.mjs"
96
- },
97
- "./index": {
98
- "types": "./dist/index.d.ts",
99
- "import": "./dist/index.mjs"
100
- },
101
- "./models": {
102
- "types": "./dist/models/index.d.ts",
103
- "import": "./dist/models/index.mjs"
104
- },
105
- "./models/SchemaVariableForm": {
106
- "types": "./dist/models/SchemaVariableForm/index.d.ts",
107
- "import": "./dist/models/SchemaVariableForm/index.mjs"
108
- },
109
- "./models/SchemaVariableForm/SchemaVariableForm": {
110
- "types": "./dist/models/SchemaVariableForm/SchemaVariableForm.d.ts",
111
- "import": "./dist/models/SchemaVariableForm/SchemaVariableForm.mjs"
112
- },
113
- "./models/SchemaVariableForm/VariableSubValue": {
114
- "types": "./dist/models/SchemaVariableForm/VariableSubValue.d.ts",
115
- "import": "./dist/models/SchemaVariableForm/VariableSubValue.mjs"
116
- },
117
- "./models/SchemaVariableForm/VariableSubValueActions": {
118
- "types": "./dist/models/SchemaVariableForm/VariableSubValueActions.d.ts",
119
- "import": "./dist/models/SchemaVariableForm/VariableSubValueActions.mjs"
120
- },
121
- "./models/SchemaVariableForm/VariableValue": {
122
- "types": "./dist/models/SchemaVariableForm/VariableValue.d.ts",
123
- "import": "./dist/models/SchemaVariableForm/VariableValue.mjs"
124
- },
125
- "./models/SchemaVariableForm/index": {
126
- "types": "./dist/models/SchemaVariableForm/index.d.ts",
127
- "import": "./dist/models/SchemaVariableForm/index.mjs"
128
- },
129
- "./models/StyleVariableForm": {
130
- "types": "./dist/models/StyleVariableForm/index.d.ts",
131
- "import": "./dist/models/StyleVariableForm/index.mjs"
132
- },
133
- "./models/StyleVariableForm/StyleVariableForm": {
134
- "types": "./dist/models/StyleVariableForm/StyleVariableForm.d.ts",
135
- "import": "./dist/models/StyleVariableForm/StyleVariableForm.mjs"
136
- },
137
- "./models/StyleVariableForm/index": {
138
- "types": "./dist/models/StyleVariableForm/index.d.ts",
139
- "import": "./dist/models/StyleVariableForm/index.mjs"
140
- },
141
- "./models/index": {
142
- "types": "./dist/models/index.d.ts",
143
- "import": "./dist/models/index.mjs"
14
+ "./*": {
15
+ "@plitzi/source": "./src/*/index.ts",
16
+ "types": "./dist/*/index.d.ts",
17
+ "import": "./dist/*/index.mjs"
144
18
  }
145
19
  },
146
20
  "type": "module",
@@ -148,24 +22,24 @@
148
22
  "scripts": {
149
23
  "lint": "eslint ./src",
150
24
  "typecheck": "tsc -p tsconfig.app.json --noEmit",
151
- "build:dev": "vite build --mode development --minify false && node ../sdk-shared/scripts/generate-exports.mjs",
25
+ "build:dev": "vite build --mode development --minify false",
152
26
  "build:dev-watch": "vite build --mode development --watch --minify false",
153
- "build:prod": "vite build && node ../sdk-shared/scripts/generate-exports.mjs",
27
+ "build:prod": "vite build",
154
28
  "test": "vitest run",
155
29
  "test:watch": "vitest"
156
30
  },
157
31
  "dependencies": {
158
32
  "@plitzi/plitzi-ui": "^1.6.33",
159
- "@plitzi/sdk-shared": "0.38.15",
33
+ "@plitzi/sdk-shared": "0.38.17",
160
34
  "clsx": "^2.1.1",
161
- "zod": "^4.6.5"
35
+ "zod": "^4.6.7"
162
36
  },
163
37
  "devDependencies": {
164
38
  "eslint": "^9.39.5",
165
- "react": "^19.3.0",
39
+ "react": "^19.3.1",
166
40
  "typescript": "^6.0.3",
167
- "vite": "^8.3.2",
168
- "vitest": "^5.0.3"
41
+ "vite": "^8.3.4",
42
+ "vitest": "^5.0.5"
169
43
  },
170
44
  "peerDependencies": {
171
45
  "react": "^19"
@@ -1,31 +0,0 @@
1
- import { useCallback as e } from "react";
2
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
- import { useToast as r } from "@plitzi/plitzi-ui/Toast";
4
- import { NOT_COPIED_REASON as i, copyText as a } from "@plitzi/sdk-shared/helpers/clipboard";
5
- //#region src/components/StyleVariables/VariableDetails.tsx
6
- var o = ({ name: o }) => {
7
- let { addToast: s } = r(), c = e(() => {
8
- a(`var(--${o})`).then((e) => s(e ? "Variable copied into the clipboard" : i, {
9
- appeareance: e ? "success" : "error",
10
- autoDismiss: !0,
11
- placement: "top-right"
12
- }));
13
- }, [s, o]);
14
- return /* @__PURE__ */ n("div", {
15
- className: "flex w-full items-center justify-between gap-2",
16
- children: [/* @__PURE__ */ n("div", {
17
- className: "flex gap-1",
18
- children: ["Token:", /* @__PURE__ */ t("div", {
19
- className: "truncate font-bold",
20
- title: o,
21
- children: `var(--${o})`
22
- })]
23
- }), /* @__PURE__ */ t("i", {
24
- className: "fa-solid fa-copy cursor-pointer hover:text-blue-400",
25
- onClick: c,
26
- title: "Copy"
27
- })]
28
- });
29
- };
30
- //#endregion
31
- export { o as default };
File without changes