@plitzi/sdk-dev-tools 0.38.17 → 0.38.18

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,75 @@
1
1
  # @plitzi/sdk-dev-tools
2
2
 
3
+ ## 0.38.18
4
+
5
+ ### Patch Changes
6
+
7
+ - b3023c9: ## Security
8
+
9
+ - **A page of the same site on another origin is no longer this server's own** (`@plitzi/sdk-server`): the guard
10
+ against writes another page caused (`crossSiteWrites`, the sign-in's login-CSRF check and `createOriginGuardMiddleware`)
11
+ trusted `Sec-Fetch-Site: same-site` — and a site has no port and spans every sub-domain, so another port of the host
12
+ (where `createAuthoringHost` serves pages an agent wrote) or a sibling sub-domain (every space of a platform on one
13
+ domain) could write as if it were the server's own page. Now only `same-origin` (and `none`, a typed URL) is; `same-site`
14
+ is refused 403 `reason: 'foreign'` unless its origin is named (`crossSiteWrites.origins`, `identity.platformOrigins`),
15
+ and the `Origin` fallback compares host and port. In production an app and its spaces are already on different sites,
16
+ so a deployment that works there needs nothing; one that relied on a sibling sub-domain locally names it.
17
+ `createAuthoringHost`'s docs now say to serve on a host of its own — a cookie belongs to a host whatever its port.
18
+
19
+ ## Server
20
+ - **An open page takes a new version of its space where it stands** (`@plitzi/sdk-server`, `@plitzi/plitzi-sdk`):
21
+ `server.updatePages(documents, { draft? })` hands the pages showing that space — or that draft — its new documents,
22
+ and each swaps them in place, its state, scroll and focus kept (`replaceSpace` on what the SDK's `render` returns;
23
+ `false`, and the page loads again, for a page with elements the server draws). The development loop of a project uses
24
+ it: a save to the space no longer reloads the open page. `createAuthoringHost`'s `put` over an id that pages show
25
+ hands them the new version and answers how many took it (`updated`), so a page an agent keeps improving is seen to
26
+ grow instead of reloading — no second iframe needed.
27
+ - **`devReload` is `livePages`** (`@plitzi/sdk-server`): the channel the open pages listen on now carries the space,
28
+ not only "load again", and a host that is not developing uses it too. Its address is `/__plitzi/live`; a draft's page
29
+ listens for its own changes alone (`?__pt=`). A plugin swapped where it is drawn stays a development server's
30
+ (`devMode`). `plitzi upgrade migrations --write` renames the option in a project's code (`livePagesOption`).
31
+
32
+ ## Packages
33
+ - **`@plitzi/sdk-server` starts in half the time** (`@plitzi/sdk-shared`, `@plitzi/sdk-server`): importing it took
34
+ ~310 ms, ~200 of them `date-fns` — 108 modules nothing on the server uses, brought by `@plitzi/sdk-shared/helpers` —
35
+ and loaded the browser's hooks and contexts of every folder of `@plitzi/sdk-shared` it read, `@plitzi/nexus/react`
36
+ with them. Now ~150 ms (`@plitzi/sdk-shared` 139 → 113 modules, `@plitzi/nexus` 53 → 31). What moved, each
37
+ rewritten by `plitzi upgrade migrations --write` (`movedExports`):
38
+ - the dates — `formatDate`, `formatDateUTC`, `formatFromNow`, `formatUTCToLocal`, `getDurationMs`, `isDate`,
39
+ `isValidFormat`, `parseDate`, `toUnixSeconds`, `SupportedLocale` — from `@plitzi/sdk-shared/helpers` to
40
+ `@plitzi/sdk-shared/dates`;
41
+ - React's bindings to an entry of their own beside each area, as `@plitzi/nexus/react` is: `useDisplayMode`,
42
+ `useElementSize` → `@plitzi/sdk-shared/style/react`; `SchemaContext` → `schema/react`; `PluginsContext` →
43
+ `plugins/react`; `DevToolsContext` → `devTools/react`; `useFlagResolution` → `flags/react` (`flagUserFrom` stays
44
+ in `flags`);
45
+ - `PROJECT_DATA_PREFIX` from `@plitzi/sdk-shared/server` to `@plitzi/sdk-shared/project/paths` — the project's
46
+ layout names, an entry a browser imports too (`@plitzi/sdk-shared/project` stays Node only and re-exports them).
47
+ The theme cookie's helpers (`themeFromCookies`…) are also `@plitzi/sdk-shared/theme/cookie`, still exported by
48
+ `@plitzi/sdk-shared/theme`.
49
+
50
+ `yarn check:server-footprint` (in CI after the build) holds what the server's root loads, package by package — Plitzi's
51
+ and every other — to a budget: a heavy library or a folder of hooks coming back fails with what came in.
52
+
53
+ ## CLI
54
+ - **`plitzi upgrade migrations --write` writes a file import's new home when it has one** (`@plitzi/cli`): the
55
+ `folderImports` migration of 0.38.17 named every import of a package's FILE and wrote none. It now reads the installed
56
+ declarations with the project's own TypeScript and rewrites each `import` / `export … from` whose every name the folder
57
+ exports under one name — `import usePlitzi from '@plitzi/sdk-shared/hooks/usePlitzi'` →
58
+ `import { usePlitzi } from '@plitzi/sdk-shared/hooks'`, `type` modifiers and aliases kept. What has no one answer is
59
+ said with why (a namespace import, an `import()` or mock, a name the folder does not export, a project with no
60
+ TypeScript). The report says which places `--write` writes (`writable` in `--json`) instead of calling every one
61
+ "yours to change"; a migration now gives each place its own `edit` in place of a whole-file `rewrite`
62
+ (`docs/en/releases.md`).
63
+ - **`plitzi doctor` says an import of a path the installed package does not export** (`@plitzi/cli`):
64
+ `import-not-exported`, an error, at the importing file — what Node otherwise reports at start as an
65
+ `ERR_MODULE_NOT_FOUND` into the package's `dist`, which reads as a broken install rather than a changed API. For a
66
+ `@plitzi` package the fix names `plitzi upgrade migrations --write`; for any other, its `exports`. Asked only of a
67
+ package that is installed.
68
+
69
+ - Updated dependencies [b3023c9]
70
+ - @plitzi/sdk-schema@0.38.18
71
+ - @plitzi/sdk-shared@0.38.18
72
+
3
73
  ## 0.38.17
4
74
 
5
75
  ### Patch Changes
@@ -1,6 +1,7 @@
1
1
  import { useCallback as e, useEffect as t, useMemo as n, useRef as r, useState as i } from "react";
2
- import { DevToolsContext as a, pConsole as o } from "@plitzi/sdk-shared/devTools";
3
- import { omit as s } from "@plitzi/plitzi-ui/helpers";
2
+ import { pConsole as a } from "@plitzi/sdk-shared/devTools";
3
+ import { omit as o } from "@plitzi/plitzi-ui/helpers";
4
+ import { DevToolsContext as s } from "@plitzi/sdk-shared/devTools/react";
4
5
  import { jsx as c } from "react/jsx-runtime";
5
6
  //#region src/DevToolsContextProvider.tsx
6
7
  var l = ({ children: l }) => {
@@ -15,11 +16,11 @@ var l = ({ children: l }) => {
15
16
  }, [d]), g = e((e, t) => p((n) => ({
16
17
  ...n,
17
18
  [e]: t
18
- })), []), _ = e((e) => p((t) => s(t, [e])), []), v = e((e, ...t) => {
19
+ })), []), _ = e((e) => p((t) => o(t, [e])), []), v = e((e, ...t) => {
19
20
  if (e && typeof f[e] == "function") return f[e](...t);
20
21
  }, [f]), y = e(() => d([]), []);
21
- m.current ||= (o.setCallback(h), o.setCallbackAddProvider(g), o.setCallbackRemoveProvider(_), !0), t(() => (o.setCallback(h), o.setCallbackAddProvider(g), o.setCallbackRemoveProvider(_), o.processPendingLogs(), () => {
22
- o.setCallback(void 0), o.setCallbackAddProvider(void 0), o.setCallbackRemoveProvider(void 0), o.flush();
22
+ m.current ||= (a.setCallback(h), a.setCallbackAddProvider(g), a.setCallbackRemoveProvider(_), !0), t(() => (a.setCallback(h), a.setCallbackAddProvider(g), a.setCallbackRemoveProvider(_), a.processPendingLogs(), () => {
23
+ a.setCallback(void 0), a.setCallbackAddProvider(void 0), a.setCallbackRemoveProvider(void 0), a.flush();
23
24
  }), [
24
25
  h,
25
26
  g,
@@ -38,7 +39,7 @@ var l = ({ children: l }) => {
38
39
  y,
39
40
  v
40
41
  ]);
41
- return /* @__PURE__ */ c(a, {
42
+ return /* @__PURE__ */ c(s, {
42
43
  value: b,
43
44
  children: l
44
45
  });
@@ -5,7 +5,7 @@ import { jsx as o } from "react/jsx-runtime";
5
5
  import { ThemeContext as s } from "@plitzi/plitzi-ui/Provider";
6
6
  import { createRoot as c } from "react-dom/client";
7
7
  import { ComponentContext as l } from "@plitzi/sdk-shared/elements";
8
- import { PluginsContext as u } from "@plitzi/sdk-shared/plugins";
8
+ import { PluginsContext as u } from "@plitzi/sdk-shared/plugins/react";
9
9
  //#region src/DevToolsRoot.tsx
10
10
  var d = { display: "contents" }, f = ({ children: f }) => {
11
11
  let p = r(null), m = r(void 0), h = r(void 0), g = t(i), _ = e(a), v = e(u), y = e(l), b = e(s);
@@ -1,6 +1,7 @@
1
1
  import e from "clsx";
2
2
  import { use as t, useCallback as n, useMemo as r } from "react";
3
- import { DEV_TOOLS_ATTRIBUTE as i, DevToolsContext as a } from "@plitzi/sdk-shared/devTools";
3
+ import { DEV_TOOLS_ATTRIBUTE as i } from "@plitzi/sdk-shared/devTools";
4
+ import { DevToolsContext as a } from "@plitzi/sdk-shared/devTools/react";
4
5
  import { jsx as o, jsxs as s } from "react/jsx-runtime";
5
6
  //#region src/components/DevToolsIndicator/DevToolsIndicator.tsx
6
7
  var c = ({ className: c, onOpen: l }) => {
@@ -11,7 +11,7 @@ import l from "./tabs/TracingViewer/TracingViewer.mjs";
11
11
  import u from "./tabs/VariablesViewer/index.mjs";
12
12
  import d from "clsx";
13
13
  import { use as f } from "react";
14
- import { DevToolsContext as p } from "@plitzi/sdk-shared/devTools";
14
+ import { DevToolsContext as p } from "@plitzi/sdk-shared/devTools/react";
15
15
  import { jsx as m, jsxs as h } from "react/jsx-runtime";
16
16
  //#region src/components/DevToolsPanel/DevToolsBody.tsx
17
17
  var g = ({ className: g, tabSelected: _, orientation: v, logTypeFilter: y, elementSelected: b, onSelectElement: x, qa: S = !1 }) => {
@@ -1,12 +1,12 @@
1
1
  import e from "../../../../../../highlight/index.mjs";
2
2
  import { useCallback as t, useMemo as n, useState as r } from "react";
3
3
  import { useCommonStore as i } from "@plitzi/sdk-shared/store";
4
- import { formatDate as a } from "@plitzi/sdk-shared/helpers";
5
- import { get as o } from "@plitzi/plitzi-ui/helpers";
6
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
4
+ import { get as a } from "@plitzi/plitzi-ui/helpers";
5
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
6
+ import { formatDate as c } from "@plitzi/sdk-shared/dates";
7
7
  //#region src/components/DevToolsPanel/tabs/Logs/categories/LogInteraction/BodyHeader.tsx
8
8
  var l = ({ triggerName: l, startTime: u, endTime: d, duration: f, elementId: p, hostElementId: m }) => {
9
- let [h] = i("schema.flat"), g = n(() => p ? o(h, p) : void 0, [p, h]), _ = n(() => a(u, "HH:mm:ss.SSS"), [u]), v = n(() => a(d, "HH:mm:ss.SSS"), [d]), y = n(() => {
9
+ let [h] = i("schema.flat"), g = n(() => p ? a(h, p) : void 0, [p, h]), _ = n(() => c(u, "HH:mm:ss.SSS"), [u]), v = n(() => c(d, "HH:mm:ss.SSS"), [d]), y = n(() => {
10
10
  if (typeof document < "u") return document.querySelector(`[data-id="${p}"]`);
11
11
  }, [p]), b = t(() => {
12
12
  y?.scrollIntoView({
@@ -17,34 +17,34 @@ var l = ({ triggerName: l, startTime: u, endTime: d, duration: f, elementId: p,
17
17
  }, [y]), [x, S] = r(!1);
18
18
  e(x ? p : void 0);
19
19
  let C = t(() => S(!0), []), w = t(() => S(!1), []);
20
- return /* @__PURE__ */ c("div", {
20
+ return /* @__PURE__ */ s("div", {
21
21
  className: "flex justify-around gap-3",
22
22
  children: [
23
- /* @__PURE__ */ c("div", {
23
+ /* @__PURE__ */ s("div", {
24
24
  className: "flex min-w-0 grow basis-0 flex-col",
25
- children: [/* @__PURE__ */ c("div", {
25
+ children: [/* @__PURE__ */ s("div", {
26
26
  className: "mb-1 flex items-center gap-1.5 text-[10px] font-semibold tracking-wider text-zinc-400 uppercase dark:text-zinc-500",
27
- children: [/* @__PURE__ */ s("i", { className: "fa-regular fa-clock" }), "Times"]
28
- }), /* @__PURE__ */ c("div", {
27
+ children: [/* @__PURE__ */ o("i", { className: "fa-regular fa-clock" }), "Times"]
28
+ }), /* @__PURE__ */ s("div", {
29
29
  className: "flex flex-col gap-0.5 font-mono text-zinc-700 dark:text-zinc-300",
30
30
  children: [
31
- /* @__PURE__ */ c("div", {
31
+ /* @__PURE__ */ s("div", {
32
32
  className: "flex gap-1",
33
- children: [/* @__PURE__ */ s("span", {
33
+ children: [/* @__PURE__ */ o("span", {
34
34
  className: "text-zinc-400 dark:text-zinc-500",
35
35
  children: "Start"
36
36
  }), _]
37
37
  }),
38
- /* @__PURE__ */ c("div", {
38
+ /* @__PURE__ */ s("div", {
39
39
  className: "flex gap-1",
40
- children: [/* @__PURE__ */ s("span", {
40
+ children: [/* @__PURE__ */ o("span", {
41
41
  className: "text-zinc-400 dark:text-zinc-500",
42
42
  children: "End"
43
43
  }), v]
44
44
  }),
45
- /* @__PURE__ */ c("div", {
45
+ /* @__PURE__ */ s("div", {
46
46
  className: "flex gap-1",
47
- children: [/* @__PURE__ */ s("span", {
47
+ children: [/* @__PURE__ */ o("span", {
48
48
  className: "text-zinc-400 dark:text-zinc-500",
49
49
  children: "Duration"
50
50
  }), f]
@@ -52,53 +52,53 @@ var l = ({ triggerName: l, startTime: u, endTime: d, duration: f, elementId: p,
52
52
  ]
53
53
  })]
54
54
  }),
55
- /* @__PURE__ */ s("div", { className: "w-px shrink-0 bg-zinc-200 dark:bg-zinc-800" }),
56
- /* @__PURE__ */ c("div", {
55
+ /* @__PURE__ */ o("div", { className: "w-px shrink-0 bg-zinc-200 dark:bg-zinc-800" }),
56
+ /* @__PURE__ */ s("div", {
57
57
  className: "flex min-w-0 grow basis-0 flex-col",
58
- children: [/* @__PURE__ */ c("div", {
58
+ children: [/* @__PURE__ */ s("div", {
59
59
  className: "mb-1 flex items-center gap-1.5 text-[10px] font-semibold tracking-wider text-zinc-400 uppercase dark:text-zinc-500",
60
- children: [/* @__PURE__ */ s("i", { className: "fa-solid fa-circle-info" }), "Details"]
61
- }), /* @__PURE__ */ c("div", {
60
+ children: [/* @__PURE__ */ o("i", { className: "fa-solid fa-circle-info" }), "Details"]
61
+ }), /* @__PURE__ */ s("div", {
62
62
  className: "flex flex-col gap-0.5 text-zinc-700 dark:text-zinc-300",
63
63
  children: [
64
- /* @__PURE__ */ c("div", {
64
+ /* @__PURE__ */ s("div", {
65
65
  className: "flex gap-1",
66
- children: [/* @__PURE__ */ s("span", {
66
+ children: [/* @__PURE__ */ o("span", {
67
67
  className: "text-zinc-400 dark:text-zinc-500",
68
68
  children: "Type"
69
- }), /* @__PURE__ */ s("span", { children: "Interaction" })]
69
+ }), /* @__PURE__ */ o("span", { children: "Interaction" })]
70
70
  }),
71
- /* @__PURE__ */ c("div", {
71
+ /* @__PURE__ */ s("div", {
72
72
  className: "flex min-w-0 gap-1",
73
- children: [/* @__PURE__ */ s("span", {
73
+ children: [/* @__PURE__ */ o("span", {
74
74
  className: "shrink-0 text-zinc-400 dark:text-zinc-500",
75
75
  children: "Trigger"
76
- }), /* @__PURE__ */ s("span", {
76
+ }), /* @__PURE__ */ o("span", {
77
77
  className: "truncate",
78
78
  children: l
79
79
  })]
80
80
  }),
81
- m && /* @__PURE__ */ c("div", {
81
+ m && /* @__PURE__ */ s("div", {
82
82
  className: "flex min-w-0 gap-1",
83
- children: [/* @__PURE__ */ s("span", {
83
+ children: [/* @__PURE__ */ o("span", {
84
84
  className: "shrink-0 text-zinc-400 dark:text-zinc-500",
85
85
  children: "Fired on"
86
- }), /* @__PURE__ */ s("span", {
86
+ }), /* @__PURE__ */ o("span", {
87
87
  className: "truncate font-mono",
88
88
  children: m
89
89
  })]
90
90
  }),
91
- /* @__PURE__ */ c("div", {
91
+ /* @__PURE__ */ s("div", {
92
92
  className: "flex min-w-0 gap-1",
93
- children: [/* @__PURE__ */ s("span", {
93
+ children: [/* @__PURE__ */ o("span", {
94
94
  className: "shrink-0 text-zinc-400 dark:text-zinc-500",
95
95
  children: "Element"
96
- }), /* @__PURE__ */ c("span", {
96
+ }), /* @__PURE__ */ s("span", {
97
97
  className: "cursor-pointer truncate text-violet-600 hover:text-violet-500 dark:text-violet-400 dark:hover:text-violet-300",
98
98
  onClick: b,
99
99
  onMouseEnter: C,
100
100
  onMouseLeave: w,
101
- children: [g?.definition.label, p && /* @__PURE__ */ c("span", {
101
+ children: [g?.definition.label, p && /* @__PURE__ */ s("span", {
102
102
  className: "ml-1 font-mono text-[10px] text-zinc-400 dark:text-zinc-500",
103
103
  children: [
104
104
  "[",
@@ -1,34 +1,34 @@
1
1
  import e from "./ExecutionTreeNode.mjs";
2
2
  import t from "clsx";
3
3
  import { useCallback as n, useMemo as r } from "react";
4
- import { getDurationMs as i } from "@plitzi/sdk-shared/helpers";
5
- import { get as a } from "@plitzi/plitzi-ui/helpers";
6
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
4
+ import { get as i } from "@plitzi/plitzi-ui/helpers";
5
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
+ import { getDurationMs as s } from "@plitzi/sdk-shared/dates";
7
7
  //#region src/components/DevToolsPanel/tabs/Logs/categories/LogInteraction/ExecutionTree/ExecutionTree.tsx
8
8
  var c = ({ className: c, nodeId: l, nodes: u, selected: d, onSelect: f }) => {
9
9
  let p = r(() => {
10
- let e = a(u, l), t = [];
10
+ let e = i(u, l), t = [];
11
11
  for (; e;) {
12
- let { node: n, startTime: r, endTime: o } = e, s = `${i(r, o)}ms`, c = n.id === l ? 0 : 1;
12
+ let { node: n, startTime: r, endTime: a } = e, o = `${s(r, a)}ms`, c = n.id === l ? 0 : 1;
13
13
  t.push({
14
14
  id: n.id,
15
15
  action: n.action,
16
16
  title: n.title,
17
17
  status: e.status,
18
18
  level: c,
19
- duration: s
20
- }), e = a(u, n.afterNode);
19
+ duration: o
20
+ }), e = i(u, n.afterNode);
21
21
  }
22
22
  return t;
23
23
  }, [l, u]), m = n((e) => f?.(e), [f]);
24
- return /* @__PURE__ */ s("div", {
24
+ return /* @__PURE__ */ o("div", {
25
25
  className: t("flex flex-col gap-1.5", c),
26
- children: [/* @__PURE__ */ s("div", {
26
+ children: [/* @__PURE__ */ o("div", {
27
27
  className: "flex items-center gap-1.5 px-2 text-[10px] font-semibold tracking-wider text-zinc-400 uppercase dark:text-zinc-500",
28
- children: [/* @__PURE__ */ o("i", { className: "fa-solid fa-code-merge" }), "Execution Tree"]
29
- }), /* @__PURE__ */ o("div", {
28
+ children: [/* @__PURE__ */ a("i", { className: "fa-solid fa-code-merge" }), "Execution Tree"]
29
+ }), /* @__PURE__ */ a("div", {
30
30
  className: "flex flex-col",
31
- children: p.map((t, n) => /* @__PURE__ */ o(e, {
31
+ children: p.map((t, n) => /* @__PURE__ */ a(e, {
32
32
  id: t.id,
33
33
  action: t.action,
34
34
  title: t.title,
@@ -2,26 +2,26 @@ import e from "./NodeHeader.mjs";
2
2
  import t from "./NodeMetadata.mjs";
3
3
  import n from "./NodeWhen.mjs";
4
4
  import { useMemo as r } from "react";
5
- import { getDurationMs as i } from "@plitzi/sdk-shared/helpers";
6
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ import { getDurationMs as o } from "@plitzi/sdk-shared/dates";
7
7
  //#region src/components/DevToolsPanel/tabs/Logs/categories/LogInteraction/InteractionNode/InteractionNode.tsx
8
8
  var s = ({ whenParams: s, name: c = "Node Title", startTime: l = 0, endTime: u = 0, status: d = "notStarted", when: f, type: p, action: m }) => {
9
- let h = r(() => `${i(l, u)}ms`, [l, u]);
10
- return /* @__PURE__ */ o("div", {
9
+ let h = r(() => `${o(l, u)}ms`, [l, u]);
10
+ return /* @__PURE__ */ a("div", {
11
11
  className: "flex w-full flex-col gap-2 p-2 text-zinc-700 dark:text-zinc-300",
12
12
  children: [
13
- /* @__PURE__ */ a("div", {
13
+ /* @__PURE__ */ i("div", {
14
14
  className: "truncate font-semibold text-zinc-800 dark:text-zinc-200",
15
15
  children: c
16
16
  }),
17
- /* @__PURE__ */ a(e, {
17
+ /* @__PURE__ */ i(e, {
18
18
  duration: h,
19
19
  status: d,
20
20
  type: p,
21
21
  action: m
22
22
  }),
23
- /* @__PURE__ */ a(n, { when: f }),
24
- /* @__PURE__ */ a(t, {
23
+ /* @__PURE__ */ i(n, { when: f }),
24
+ /* @__PURE__ */ i(t, {
25
25
  when: f,
26
26
  whenParams: s
27
27
  })
@@ -5,12 +5,12 @@ import r from "./LogInteractionNote.mjs";
5
5
  import i from "clsx";
6
6
  import { useMemo as a } from "react";
7
7
  import { isInteractionFlow as o } from "@plitzi/sdk-shared/devTools";
8
- import { getDurationMs as s } from "@plitzi/sdk-shared/helpers";
9
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
10
- import u from "@plitzi/plitzi-ui/ContainerCollapsable";
8
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
9
+ import l from "@plitzi/plitzi-ui/ContainerCollapsable";
10
+ import { getDurationMs as u } from "@plitzi/sdk-shared/dates";
11
11
  //#region src/components/DevToolsPanel/tabs/Logs/categories/LogInteraction/LogInteraction.tsx
12
- var d = /* @__PURE__ */ c("i", { className: "fa-solid fa-angle-right text-[10px]" }), f = /* @__PURE__ */ c("i", { className: "fa-solid fa-angle-down text-[10px]" }), p = ({ time: r, message: o, params: { elementId: p, hostElementId: m, status: h, node: g, nodes: _, startTime: v = 0, endTime: y = 0 } }) => {
13
- let b = a(() => `${s(v, y)}ms`, [v, y]), { failed: x, skipped: S, disabled: C } = a(() => {
12
+ var d = /* @__PURE__ */ s("i", { className: "fa-solid fa-angle-right text-[10px]" }), f = /* @__PURE__ */ s("i", { className: "fa-solid fa-angle-down text-[10px]" }), p = ({ time: r, message: o, params: { elementId: p, hostElementId: m, status: h, node: g, nodes: _, startTime: v = 0, endTime: y = 0 } }) => {
13
+ let b = a(() => `${u(v, y)}ms`, [v, y]), { failed: x, skipped: S, disabled: C } = a(() => {
14
14
  let e = Object.values(_).map(({ status: e }) => e);
15
15
  return {
16
16
  failed: e.filter((e) => e === "failed").length,
@@ -18,15 +18,15 @@ var d = /* @__PURE__ */ c("i", { className: "fa-solid fa-angle-right text-[10px]
18
18
  disabled: e.filter((e) => e === "disabled").length
19
19
  };
20
20
  }, [_]);
21
- return /* @__PURE__ */ l(u, {
21
+ return /* @__PURE__ */ c(l, {
22
22
  className: i("last:border-b-none w-full border-b border-l-2 border-b-zinc-200 px-2 py-1 transition-colors hover:bg-zinc-50 dark:border-b-zinc-700 dark:hover:bg-zinc-800/50", {
23
23
  "border-l-emerald-500": h === "completed",
24
24
  "border-l-red-500": h === "failed",
25
25
  "border-l-zinc-300 dark:border-l-zinc-600": h === "skipped"
26
26
  }),
27
27
  collapsed: !0,
28
- children: [/* @__PURE__ */ c(u.Header, {
29
- title: /* @__PURE__ */ c(n, {
28
+ children: [/* @__PURE__ */ s(l.Header, {
29
+ title: /* @__PURE__ */ s(n, {
30
30
  status: h,
31
31
  message: o,
32
32
  time: r
@@ -35,20 +35,20 @@ var d = /* @__PURE__ */ c("i", { className: "fa-solid fa-angle-right text-[10px]
35
35
  className: { headerTitle: "overflow-hidden" },
36
36
  iconCollapsed: d,
37
37
  iconExpanded: f,
38
- children: /* @__PURE__ */ l("div", {
38
+ children: /* @__PURE__ */ c("div", {
39
39
  className: "flex gap-3 text-zinc-400 dark:text-zinc-500",
40
40
  children: [
41
- !!x && /* @__PURE__ */ c(e, {
41
+ !!x && /* @__PURE__ */ s(e, {
42
42
  logType: "danger",
43
43
  title: "Failed",
44
44
  children: x
45
45
  }),
46
- h !== "skipped" && !!S && /* @__PURE__ */ c(e, {
46
+ h !== "skipped" && !!S && /* @__PURE__ */ s(e, {
47
47
  logType: "warning",
48
48
  title: "Skipped",
49
49
  children: S
50
50
  }),
51
- h !== "skipped" && !!C && /* @__PURE__ */ c(e, {
51
+ h !== "skipped" && !!C && /* @__PURE__ */ s(e, {
52
52
  logType: "custom",
53
53
  iconClassName: "fa-solid fa-ban",
54
54
  title: "Disabled",
@@ -57,7 +57,7 @@ var d = /* @__PURE__ */ c("i", { className: "fa-solid fa-angle-right text-[10px]
57
57
  b
58
58
  ]
59
59
  })
60
- }), /* @__PURE__ */ c(u.Content, { children: /* @__PURE__ */ c(t, {
60
+ }), /* @__PURE__ */ s(l.Content, { children: /* @__PURE__ */ s(t, {
61
61
  elementId: p,
62
62
  hostElementId: m,
63
63
  node: g,
@@ -67,11 +67,11 @@ var d = /* @__PURE__ */ c("i", { className: "fa-solid fa-angle-right text-[10px]
67
67
  duration: b
68
68
  }) })]
69
69
  });
70
- }, m = ({ time: e, message: t, params: n }) => o(n) ? /* @__PURE__ */ c(p, {
70
+ }, m = ({ time: e, message: t, params: n }) => o(n) ? /* @__PURE__ */ s(p, {
71
71
  time: e,
72
72
  message: t,
73
73
  params: n
74
- }) : /* @__PURE__ */ c(r, {
74
+ }) : /* @__PURE__ */ s(r, {
75
75
  time: e,
76
76
  message: t,
77
77
  params: n
@@ -1,60 +1,60 @@
1
1
  import { useMemo as e } from "react";
2
2
  import { useCommonStore as t } from "@plitzi/sdk-shared/store";
3
- import { formatDate as n } from "@plitzi/sdk-shared/helpers";
4
- import { get as r } from "@plitzi/plitzi-ui/helpers";
5
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
3
+ import { get as n } from "@plitzi/plitzi-ui/helpers";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ import { formatDate as a } from "@plitzi/sdk-shared/dates";
6
6
  //#region src/components/DevToolsPanel/tabs/Logs/categories/LogNavigation/LogNavigationBody.tsx
7
7
  var o = ({ elementId: o, startTime: s, endTime: c, duration: l }) => {
8
- let [u] = t("schema.flat"), d = e(() => o ? r(u, o) : void 0, [o, u]);
9
- return /* @__PURE__ */ a("div", {
8
+ let [u] = t("schema.flat"), d = e(() => o ? n(u, o) : void 0, [o, u]);
9
+ return /* @__PURE__ */ i("div", {
10
10
  className: "m-2 flex justify-around gap-4",
11
11
  children: [
12
- /* @__PURE__ */ a("div", {
12
+ /* @__PURE__ */ i("div", {
13
13
  className: "flex min-w-0 grow basis-0 flex-col gap-2",
14
- children: [/* @__PURE__ */ a("div", {
14
+ children: [/* @__PURE__ */ i("div", {
15
15
  className: "flex items-center gap-1 font-bold",
16
- children: [/* @__PURE__ */ i("i", { className: "fa-regular fa-clock" }), "Times"]
17
- }), /* @__PURE__ */ a("div", {
16
+ children: [/* @__PURE__ */ r("i", { className: "fa-regular fa-clock" }), "Times"]
17
+ }), /* @__PURE__ */ i("div", {
18
18
  className: "flex flex-col",
19
19
  children: [
20
- /* @__PURE__ */ a("div", {
20
+ /* @__PURE__ */ i("div", {
21
21
  className: "flex gap-1",
22
- children: [/* @__PURE__ */ i("span", { children: "Started:" }), typeof s == "string" ? s : n(s)]
22
+ children: [/* @__PURE__ */ r("span", { children: "Started:" }), typeof s == "string" ? s : a(s)]
23
23
  }),
24
- /* @__PURE__ */ a("div", {
24
+ /* @__PURE__ */ i("div", {
25
25
  className: "flex gap-1",
26
- children: [/* @__PURE__ */ i("span", { children: "End:" }), typeof c == "string" ? c : n(c)]
26
+ children: [/* @__PURE__ */ r("span", { children: "End:" }), typeof c == "string" ? c : a(c)]
27
27
  }),
28
- /* @__PURE__ */ a("div", {
28
+ /* @__PURE__ */ i("div", {
29
29
  className: "flex gap-1",
30
- children: [/* @__PURE__ */ i("span", { children: "Duration:" }), l]
30
+ children: [/* @__PURE__ */ r("span", { children: "Duration:" }), l]
31
31
  })
32
32
  ]
33
33
  })]
34
34
  }),
35
- /* @__PURE__ */ i("div", { className: "border-r border-gray-300" }),
36
- /* @__PURE__ */ a("div", {
35
+ /* @__PURE__ */ r("div", { className: "border-r border-gray-300" }),
36
+ /* @__PURE__ */ i("div", {
37
37
  className: "flex min-w-0 grow basis-0 flex-col gap-2",
38
- children: [/* @__PURE__ */ a("div", {
38
+ children: [/* @__PURE__ */ i("div", {
39
39
  className: "flex items-center gap-1",
40
- children: [/* @__PURE__ */ i("i", { className: "fa-solid fa-circle-info" }), "Details"]
41
- }), /* @__PURE__ */ a("div", {
40
+ children: [/* @__PURE__ */ r("i", { className: "fa-solid fa-circle-info" }), "Details"]
41
+ }), /* @__PURE__ */ i("div", {
42
42
  className: "flex flex-col",
43
43
  children: [
44
- /* @__PURE__ */ a("div", {
44
+ /* @__PURE__ */ i("div", {
45
45
  className: "flex gap-1",
46
- children: [/* @__PURE__ */ i("span", { children: "Type:" }), /* @__PURE__ */ i("span", { children: "Navigation" })]
46
+ children: [/* @__PURE__ */ r("span", { children: "Type:" }), /* @__PURE__ */ r("span", { children: "Navigation" })]
47
47
  }),
48
- /* @__PURE__ */ a("div", {
48
+ /* @__PURE__ */ i("div", {
49
49
  className: "flex gap-1",
50
- children: [/* @__PURE__ */ i("span", { children: "Trigger:" }), /* @__PURE__ */ i("span", {
50
+ children: [/* @__PURE__ */ r("span", { children: "Trigger:" }), /* @__PURE__ */ r("span", {
51
51
  className: "truncate",
52
52
  children: "-"
53
53
  })]
54
54
  }),
55
- d && /* @__PURE__ */ a("div", {
55
+ d && /* @__PURE__ */ i("div", {
56
56
  className: "flex gap-1",
57
- children: [/* @__PURE__ */ i("span", { children: "Element:" }), /* @__PURE__ */ a("span", {
57
+ children: [/* @__PURE__ */ r("span", { children: "Element:" }), /* @__PURE__ */ i("span", {
58
58
  className: "cursor-pointer truncate text-blue-500",
59
59
  children: [
60
60
  d.definition.label,
@@ -1,7 +1,7 @@
1
1
  import e from "../../LogStatus.mjs";
2
2
  import { useMemo as t } from "react";
3
- import { formatDate as n } from "@plitzi/sdk-shared/helpers";
4
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
3
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
+ import { formatDate as i } from "@plitzi/sdk-shared/dates";
5
5
  //#region src/components/DevToolsPanel/tabs/Logs/categories/LogNavigation/LogNavigationHeader.tsx
6
6
  var a = ({ status: a, message: o, time: s }) => {
7
7
  let { logType: c, statusMessage: l } = t(() => a === "normal" ? {
@@ -20,18 +20,18 @@ var a = ({ status: a, message: o, time: s }) => {
20
20
  logType: "custom",
21
21
  statusMessage: ""
22
22
  }, [a]);
23
- return /* @__PURE__ */ i("div", {
23
+ return /* @__PURE__ */ r("div", {
24
24
  className: "flex w-full items-center gap-2 overflow-hidden",
25
25
  children: [
26
- /* @__PURE__ */ r("span", {
26
+ /* @__PURE__ */ n("span", {
27
27
  className: "shrink-0 font-mono text-zinc-400 tabular-nums dark:text-zinc-500",
28
- children: typeof s == "string" ? s : n(s)
28
+ children: typeof s == "string" ? s : i(s)
29
29
  }),
30
- /* @__PURE__ */ r(e, {
30
+ /* @__PURE__ */ n(e, {
31
31
  logType: c,
32
32
  children: l
33
33
  }),
34
- /* @__PURE__ */ r("div", {
34
+ /* @__PURE__ */ n("div", {
35
35
  className: "grow basis-0 truncate text-zinc-700 dark:text-zinc-300",
36
36
  children: o
37
37
  })
@@ -1,23 +1,23 @@
1
1
  import e from "../../LogStatus.mjs";
2
- import { formatDate as t } from "@plitzi/sdk-shared/helpers";
3
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
2
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
+ import { formatDate as r } from "@plitzi/sdk-shared/dates";
4
4
  //#region src/components/DevToolsPanel/tabs/Logs/categories/LogStore/LogStoreHeader.tsx
5
- var i = ({ storeName: i, path: a, message: o, time: s }) => /* @__PURE__ */ r("div", {
5
+ var i = ({ storeName: i, path: a, message: o, time: s }) => /* @__PURE__ */ n("div", {
6
6
  className: "flex w-full items-center gap-2 overflow-hidden",
7
7
  children: [
8
- /* @__PURE__ */ n("span", {
8
+ /* @__PURE__ */ t("span", {
9
9
  className: "shrink-0 font-mono text-zinc-400 tabular-nums dark:text-zinc-500",
10
- children: typeof s == "string" ? s : t(s)
10
+ children: typeof s == "string" ? s : r(s)
11
11
  }),
12
- /* @__PURE__ */ n(e, {
12
+ /* @__PURE__ */ t(e, {
13
13
  logType: "info",
14
14
  children: "Store"
15
15
  }),
16
- i && /* @__PURE__ */ n("span", {
16
+ i && /* @__PURE__ */ t("span", {
17
17
  className: "shrink-0 font-semibold text-zinc-700 dark:text-zinc-200",
18
18
  children: i
19
19
  }),
20
- /* @__PURE__ */ n("span", {
20
+ /* @__PURE__ */ t("span", {
21
21
  className: "truncate font-mono text-zinc-400 dark:text-zinc-500",
22
22
  children: a ?? o ?? "(full state)"
23
23
  })
@@ -4,7 +4,7 @@ import n from "clsx";
4
4
  import { use as r, useCallback as i, useMemo as a, useState as o } from "react";
5
5
  import { jsx as s, jsxs as c } from "react/jsx-runtime";
6
6
  import { ComponentContext as l } from "@plitzi/sdk-shared/elements";
7
- import { PluginsContext as u } from "@plitzi/sdk-shared/plugins";
7
+ import { PluginsContext as u } from "@plitzi/sdk-shared/plugins/react";
8
8
  //#region src/components/DevToolsPanel/tabs/PluginsViewer/PluginsViewer.tsx
9
9
  var d = {
10
10
  "local-custom": "Shipped with this space",
@@ -8,9 +8,9 @@ import s from "../../../../scope/useStoreState.mjs";
8
8
  import c from "@plitzi/plitzi-ui/hooks/useStorage";
9
9
  import l from "clsx";
10
10
  import { use as u, useCallback as d, useMemo as f } from "react";
11
- import { DevToolsContext as p } from "@plitzi/sdk-shared/devTools";
12
- import { useTheme as m } from "@plitzi/sdk-shared/theme";
13
- import { emptyObject as h } from "@plitzi/sdk-shared/helpers";
11
+ import { useTheme as p } from "@plitzi/sdk-shared/theme";
12
+ import { emptyObject as m } from "@plitzi/sdk-shared/helpers";
13
+ import { DevToolsContext as h } from "@plitzi/sdk-shared/devTools/react";
14
14
  import { jsx as g, jsxs as _ } from "react/jsx-runtime";
15
15
  import v from "@uiw/react-json-view";
16
16
  import * as y from "@uiw/react-json-view/vscode";
@@ -23,7 +23,7 @@ var b = {
23
23
  padding: "8px",
24
24
  fontSize: "14px"
25
25
  }, x = (e) => l("cursor-pointer rounded px-2 py-0.5 font-medium transition-colors", e ? "bg-violet-500/15 text-violet-600 dark:text-violet-300" : "text-zinc-500 hover:bg-zinc-200/70 hover:text-zinc-800 dark:text-zinc-400 dark:hover:bg-zinc-700/50 dark:hover:text-zinc-100"), S = {}, C = [], w = ({ elementSelected: l }) => {
26
- let { resolvedTheme: y } = m(), { getData: w } = u(p), T = r(), E = n(), [D, O] = c("plitzi-sdk.dev-tools.store.view", "own"), k = s(l ? void 0 : E, D === "merged"), A = d(() => O("own"), [O]), j = d(() => O("merged"), [O]), M = l ? w?.(`getElementDataSource-${l}`) : k, N = f(() => i(M), [M]), P = f(() => T ? [T] : C, [T]), F = e(P)[0]?.records ?? S, I = f(() => Object.values(F).reduce((e, t) => Math.max(e, t.updatedAt), 0), [F]), L = t(Object.keys(F).length > 0, I), R = f(() => a(F, L), [F, L]);
26
+ let { resolvedTheme: y } = p(), { getData: w } = u(h), T = r(), E = n(), [D, O] = c("plitzi-sdk.dev-tools.store.view", "own"), k = s(l ? void 0 : E, D === "merged"), A = d(() => O("own"), [O]), j = d(() => O("merged"), [O]), M = l ? w?.(`getElementDataSource-${l}`) : k, N = f(() => i(M), [M]), P = f(() => T ? [T] : C, [T]), F = e(P)[0]?.records ?? S, I = f(() => Object.values(F).reduce((e, t) => Math.max(e, t.updatedAt), 0), [F]), L = t(Object.keys(F).length > 0, I), R = f(() => a(F, L), [F, L]);
27
27
  return /* @__PURE__ */ _("div", {
28
28
  className: "flex h-full w-full flex-col",
29
29
  children: [!l && /* @__PURE__ */ _("div", {
@@ -47,7 +47,7 @@ var b = {
47
47
  })
48
48
  ]
49
49
  }), /* @__PURE__ */ _(v, {
50
- value: N ?? h,
50
+ value: N ?? m,
51
51
  style: y === "dark" ? b : void 0,
52
52
  enableClipboard: !1,
53
53
  indentWidth: 15,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-dev-tools",
3
- "version": "0.38.17",
3
+ "version": "0.38.18",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist"
@@ -45,8 +45,8 @@
45
45
  "dependencies": {
46
46
  "@plitzi/nexus": "^1.4.0",
47
47
  "@plitzi/plitzi-ui": "^1.6.33",
48
- "@plitzi/sdk-schema": "0.38.17",
49
- "@plitzi/sdk-shared": "0.38.17",
48
+ "@plitzi/sdk-schema": "0.38.18",
49
+ "@plitzi/sdk-shared": "0.38.18",
50
50
  "@uiw/react-json-view": "^2.0.0-alpha.44",
51
51
  "clsx": "^2.1.1"
52
52
  }