@plitzi/sdk-dev-tools 0.39.0 → 0.39.1
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,15 @@
|
|
|
1
1
|
# @plitzi/sdk-dev-tools
|
|
2
2
|
|
|
3
|
+
## 0.39.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f174a61: Released with every `@plitzi` package at this version. What changed in each, and what to do when you upgrade, is in
|
|
8
|
+
`@plitzi/cli`'s `CHANGELOG.md`: one copy of the notes, not one per package.
|
|
9
|
+
- Updated dependencies [f174a61]
|
|
10
|
+
- @plitzi/sdk-schema@0.39.1
|
|
11
|
+
- @plitzi/sdk-shared@0.39.1
|
|
12
|
+
|
|
3
13
|
## 0.39.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
|
@@ -1,44 +1,66 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { sideAt as e } from "./sideAt.mjs";
|
|
2
|
+
import t from "@plitzi/plitzi-ui/hooks/useStorage";
|
|
3
|
+
import n from "clsx";
|
|
4
|
+
import { use as r, useCallback as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
5
|
+
import { DEV_TOOLS_ATTRIBUTE as c } from "@plitzi/sdk-shared/devTools";
|
|
6
|
+
import { DevToolsContext as l } from "@plitzi/sdk-shared/devTools/react";
|
|
7
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
6
8
|
//#region src/components/DevToolsIndicator/DevToolsIndicator.tsx
|
|
7
|
-
var
|
|
8
|
-
let { logs:
|
|
9
|
+
var f = 5, p = ({ className: p, onOpen: m }) => {
|
|
10
|
+
let { logs: h } = r(l), [g, _] = t("plitzi-sdk.dev-tools.badge-side", "left"), [v, y] = s(), b = o(void 0), x = o(null), { errors: S, warnings: C } = a(() => h.reduce((e, { logType: t }) => ({
|
|
9
11
|
errors: t === "danger" ? e.errors + 1 : e.errors,
|
|
10
12
|
warnings: t === "warning" ? e.warnings + 1 : e.warnings
|
|
11
13
|
}), {
|
|
12
14
|
errors: 0,
|
|
13
15
|
warnings: 0
|
|
14
|
-
}), [
|
|
15
|
-
|
|
16
|
+
}), [h]), w = i((e) => {
|
|
17
|
+
b.current = {
|
|
18
|
+
x: e.clientX,
|
|
19
|
+
dragging: !1
|
|
20
|
+
}, e.currentTarget.setPointerCapture(e.pointerId);
|
|
21
|
+
}, []), T = i((e) => {
|
|
22
|
+
let t = b.current;
|
|
23
|
+
!t || !t.dragging && Math.abs(e.clientX - t.x) < f || (t.dragging = !0, y({
|
|
24
|
+
from: t.x,
|
|
25
|
+
x: e.clientX
|
|
26
|
+
}));
|
|
27
|
+
}, []), E = i((t) => {
|
|
28
|
+
let n = x.current?.offsetParent?.getBoundingClientRect();
|
|
29
|
+
b.current?.dragging && n && _(e(t.clientX, n)), y(void 0);
|
|
30
|
+
}, [_]), D = i(() => {
|
|
31
|
+
let e = b.current?.dragging === !0;
|
|
32
|
+
b.current = void 0, !e && (S > 0 ? m("danger") : C > 0 ? m("warning") : m());
|
|
16
33
|
}, [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
34
|
+
S,
|
|
35
|
+
C,
|
|
36
|
+
m
|
|
20
37
|
]);
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
-
|
|
23
|
-
[
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
38
|
+
return /* @__PURE__ */ u("div", {
|
|
39
|
+
ref: x,
|
|
40
|
+
className: n("absolute bottom-3 z-[1000000]", g === "right" ? "right-3" : "left-3", p),
|
|
41
|
+
style: v ? { translate: `${String(v.x - v.from)}px 0` } : void 0,
|
|
42
|
+
[c]: "",
|
|
43
|
+
children: /* @__PURE__ */ d("button", {
|
|
44
|
+
className: n("flex cursor-pointer touch-none items-center gap-2 rounded border border-zinc-200 bg-white px-2 py-1.5 text-[12px]/[16px]", "font-bold text-zinc-600 shadow-md transition-colors select-none hover:bg-zinc-50", "dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-300 dark:hover:bg-zinc-800"),
|
|
45
|
+
title: "Plitzi dev tools — drag to the other corner",
|
|
46
|
+
onPointerDown: w,
|
|
47
|
+
onPointerMove: T,
|
|
48
|
+
onPointerUp: E,
|
|
49
|
+
onClick: D,
|
|
28
50
|
children: [
|
|
29
51
|
"Plitzi",
|
|
30
|
-
|
|
52
|
+
S > 0 && /* @__PURE__ */ d("span", {
|
|
31
53
|
className: "flex items-center gap-1 text-red-600 dark:text-red-400",
|
|
32
|
-
children: [/* @__PURE__ */
|
|
54
|
+
children: [/* @__PURE__ */ u("i", { className: "fa-regular fa-circle-xmark text-[11px]" }), S]
|
|
33
55
|
}),
|
|
34
|
-
|
|
56
|
+
C > 0 && /* @__PURE__ */ d("span", {
|
|
35
57
|
className: "flex items-center gap-1 text-amber-600 dark:text-amber-400",
|
|
36
|
-
children: [/* @__PURE__ */
|
|
58
|
+
children: [/* @__PURE__ */ u("i", { className: "fa-solid fa-triangle-exclamation text-[11px]" }), C]
|
|
37
59
|
}),
|
|
38
|
-
|
|
60
|
+
S === 0 && C === 0 && /* @__PURE__ */ u("i", { className: "fa-solid fa-terminal text-[11px] text-zinc-400" })
|
|
39
61
|
]
|
|
40
62
|
})
|
|
41
63
|
});
|
|
42
64
|
};
|
|
43
65
|
//#endregion
|
|
44
|
-
export {
|
|
66
|
+
export { p as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** The bottom corner the dev-tools badge sits in. */
|
|
2
|
+
export type IndicatorSide = 'left' | 'right';
|
|
3
|
+
/** The side a badge dropped at `x` lands on: whichever half of its container the pointer let go in. */
|
|
4
|
+
export declare const sideAt: (x: number, container: {
|
|
5
|
+
left: number;
|
|
6
|
+
width: number;
|
|
7
|
+
}) => IndicatorSide;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-dev-tools",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.1",
|
|
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.36",
|
|
48
|
-
"@plitzi/sdk-schema": "0.39.
|
|
49
|
-
"@plitzi/sdk-shared": "0.39.
|
|
48
|
+
"@plitzi/sdk-schema": "0.39.1",
|
|
49
|
+
"@plitzi/sdk-shared": "0.39.1",
|
|
50
50
|
"@uiw/react-json-view": "^2.0.0-alpha.44",
|
|
51
51
|
"clsx": "^2.1.1"
|
|
52
52
|
}
|