@plitzi/sdk-style 0.39.4 → 0.39.7
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 +30 -0
- package/dist/builder/StyleAdvanceEditor.mjs +4 -3
- package/dist/builder/components/InputEasing/Curve.mjs +1 -1
- package/dist/builder/components/InputEasing/Grid.mjs +3 -3
- package/dist/builder/components/InputEasing/InputEasing.mjs +2 -2
- package/dist/builder/components/InputEasing/InputEasingButton.mjs +1 -1
- package/dist/builder/components/InputEasing/InputEasingList.mjs +4 -4
- package/dist/builder/components/Selector/Selector.mjs +143 -123
- package/dist/builder/components/Selector/SelectorItem/ItemOptions.mjs +4 -3
- package/dist/builder/components/Selector/SelectorItem/SelectorItem.mjs +29 -19
- package/dist/builder/components/Selector/SelectorItem/helpers.d.ts +1 -1
- package/dist/builder/components/Selector/SelectorItem/helpers.mjs +1 -1
- package/dist/builder/components/Selector/SelectorSuggestions/SelectorSuggestions.d.ts +6 -3
- package/dist/builder/components/Selector/SelectorSuggestions/SelectorSuggestions.mjs +56 -18
- package/dist/builder/components/Selector/SelectorSuggestions/helpers.d.ts +8 -0
- package/dist/builder/components/Selector/SelectorSuggestions/helpers.mjs +9 -0
- package/dist/builder/components/Selector/SelectorSuggestions/index.d.ts +1 -0
- package/dist/builder/components/Selector/SelectorSuggestions/index.mjs +3 -2
- package/dist/builder/components/StyleInspector/Inspector.mjs +1 -1
- package/dist/builder/components/StyleInspector/StyleInspector.mjs +2 -2
- package/dist/builder/components/StyleInspector/categories/Background/Background.mjs +1 -1
- package/dist/builder/components/StyleInspector/categories/Background/components/BackgroundLayer/BackgroundLayer.mjs +6 -6
- package/dist/builder/components/StyleInspector/categories/Background/components/GradientStopBar/GradientStopEditor.mjs +3 -3
- package/dist/builder/components/StyleInspector/categories/Background/components/LayerGroup/LayerGroup.mjs +1 -1
- package/dist/builder/components/StyleInspector/categories/Background/modes/RawMode.mjs +1 -1
- package/dist/builder/components/StyleInspector/categories/Effects/Filters/FilterItem.mjs +1 -1
- package/dist/builder/components/StyleInspector/categories/Effects/Transition/TransitionEasing.mjs +4 -4
- package/dist/builder/components/StyleInspector/categories/Effects/Transition/TransitionItem.mjs +1 -1
- package/dist/builder/components/StyleInspector/categories/Position/PositionAdvanced.mjs +5 -5
- package/dist/builder/components/StyleInspector/categories/Spacing/SpacingEditor.mjs +1 -1
- package/dist/builder/components/StyleInspector/categories/Spacing/SpacingMargin.mjs +1 -1
- package/dist/builder/components/StyleInspector/categories/Spacing/SpacingPadding.mjs +2 -2
- package/dist/builder/components/StyleInspector/components/AncestorRules/AncestorRuleChip.mjs +1 -1
- package/dist/builder/components/StyleInspector/components/AncestorRules/AncestorRules.mjs +1 -1
- package/dist/builder/components/StyleInspector/components/CategoryContainer/CategoryContainer.mjs +5 -5
- package/dist/builder/components/StyleInspector/components/CategoryOption/categoryTypes/OptionIconGroup.mjs +1 -1
- package/dist/builder/components/StyleInspector/components/InspectorFooter/InspectorFooter.mjs +3 -3
- package/dist/builder/components/StyleInspector/components/InspectorLabel/InspectorLabel.mjs +2 -2
- package/dist/builder/components/StyleInspector/components/InspectorSearch/InspectorSearch.mjs +1 -1
- package/dist/builder/components/StyleInspector/components/ShadowItem/ShadowItem.mjs +1 -1
- package/dist/builder/components/StyleInspector/components/TargetSummary/TargetSummary.mjs +2 -2
- package/dist/builder/components/StyleInspector/components/ValueList/ValueList.mjs +1 -1
- package/dist/builder/components/StyleInspector/components/ValueListItem/ValueListItem.mjs +6 -6
- package/dist/builder/components/StyleManager/ManagerSelector.mjs +281 -123
- package/dist/builder/components/StyleManager/StyleManager.mjs +75 -35
- package/dist/builder/components/StyleManager/StyleSelectorTag.d.ts +5 -1
- package/dist/builder/components/StyleManager/StyleSelectorTag.mjs +81 -63
- package/dist/builder/hooks/useWindowedList.d.ts +19 -0
- package/dist/builder/hooks/useWindowedList.mjs +38 -0
- package/package.json +8 -8
- package/dist/builder/components/Selector/SelectorSuggestions/SuggestionsCreator.d.ts +0 -7
- package/dist/builder/components/Selector/SelectorSuggestions/SuggestionsCreator.mjs +0 -19
- package/dist/builder/components/Selector/SelectorSuggestions/SuggestionsList.d.ts +0 -7
- package/dist/builder/components/Selector/SelectorSuggestions/SuggestionsList.mjs +0 -24
|
@@ -1,69 +1,87 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
"bg-
|
|
15
|
-
"bg-secondary-50 dark:bg-secondary-900/30": u && !l
|
|
1
|
+
import { memo as e, useCallback as t } from "react";
|
|
2
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
3
|
+
import i from "clsx";
|
|
4
|
+
var a = e(({ id: e, label: a = "Selector", active: o = !1, checked: s = !1, selecting: c = !1, nested: l = !1, elementsCount: u = 0, ancestorsCount: d = 0, unusedAncestorsCount: f = 0, type: p = "class", onSelect: m, onDelete: h, onToggleCheck: g }) => {
|
|
5
|
+
let _ = t(() => m?.(e), [e, m]), v = t((t) => {
|
|
6
|
+
t.stopPropagation(), e && h?.(e);
|
|
7
|
+
}, [e, h]), y = t(() => g?.(e), [e, g]), b = t((e) => e.stopPropagation(), []), x = f ? `Rules under ${d} ancestor classes, ${f} of them around no element it dresses` : `Rules under ${d} ancestor classes`, S = p === "element";
|
|
8
|
+
return /* @__PURE__ */ r("div", {
|
|
9
|
+
className: i("group relative flex h-7 shrink-0 cursor-pointer items-center gap-2 pr-2 select-none", {
|
|
10
|
+
"pl-7": l,
|
|
11
|
+
"pl-2": !l,
|
|
12
|
+
"hover:bg-ui-hover": !o,
|
|
13
|
+
"bg-primary-50 dark:bg-primary-400/15": o,
|
|
14
|
+
"bg-secondary-50 dark:bg-secondary-900/30": s && !o
|
|
16
15
|
}),
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
"aria-current": o ? "true" : void 0,
|
|
17
|
+
onClick: _,
|
|
18
|
+
children: [
|
|
19
|
+
o && /* @__PURE__ */ n("span", { className: "bg-primary-500 absolute inset-y-0 left-0 w-0.5" }),
|
|
20
|
+
/* @__PURE__ */ n("div", {
|
|
21
|
+
className: i("flex w-4 shrink-0 items-center justify-center", { "hidden group-hover:flex": !c && !s }),
|
|
22
|
+
children: /* @__PURE__ */ r("span", {
|
|
23
|
+
className: "relative flex size-3.5 items-center justify-center",
|
|
24
|
+
children: [/* @__PURE__ */ n("input", {
|
|
25
|
+
type: "checkbox",
|
|
26
|
+
className: "peer checked:border-primary-600 checked:bg-primary-600 border-ui-line-strong bg-ui-raised size-3.5 cursor-pointer appearance-none rounded-[3px] border",
|
|
27
|
+
"aria-label": `Check ${a}`,
|
|
28
|
+
checked: s,
|
|
29
|
+
onChange: y,
|
|
30
|
+
onClick: b
|
|
31
|
+
}), /* @__PURE__ */ n("i", { className: "fa-solid fa-check pointer-events-none absolute hidden text-[8px] text-white peer-checked:block" })]
|
|
27
32
|
})
|
|
28
|
-
}),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}), /* @__PURE__ */ i("div", {
|
|
36
|
-
className: "flex items-center",
|
|
37
|
-
children: [
|
|
38
|
-
f > 0 && /* @__PURE__ */ i("div", {
|
|
39
|
-
className: o("mr-1 flex items-center gap-1 rounded-sm px-1.5 py-1 text-xs", {
|
|
40
|
-
"bg-amber-500/15 text-amber-700 dark:text-amber-300": p > 0,
|
|
41
|
-
"bg-gray-200 text-zinc-600 dark:bg-zinc-700 dark:text-zinc-300": p === 0
|
|
42
|
-
}),
|
|
43
|
-
title: S,
|
|
44
|
-
children: [/* @__PURE__ */ r("i", { className: o("fas", {
|
|
45
|
-
"fa-sitemap": !p,
|
|
46
|
-
"fa-triangle-exclamation": !!p
|
|
47
|
-
}) }), f]
|
|
33
|
+
}),
|
|
34
|
+
/* @__PURE__ */ n("span", {
|
|
35
|
+
className: i("flex w-4 shrink-0 items-center justify-center text-[11px]", {
|
|
36
|
+
"group-hover:hidden": !c && !s,
|
|
37
|
+
hidden: c || s,
|
|
38
|
+
"text-primary-500 dark:text-primary-300": S,
|
|
39
|
+
"text-ui-fg-subtle font-mono font-bold": !S
|
|
48
40
|
}),
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
size: "xs",
|
|
57
|
-
onClick: y,
|
|
58
|
-
children: /* @__PURE__ */ r(a.Icon, { icon: "fas fa-trash" })
|
|
59
|
-
})
|
|
41
|
+
"aria-hidden": !0,
|
|
42
|
+
children: S ? /* @__PURE__ */ n("i", { className: "fa-solid fa-cube" }) : "."
|
|
43
|
+
}),
|
|
44
|
+
/* @__PURE__ */ n("span", {
|
|
45
|
+
className: i("min-w-0 grow basis-0 truncate font-mono text-xs", {
|
|
46
|
+
"text-primary-700 dark:text-primary-200 font-semibold": o,
|
|
47
|
+
"text-ui-fg": !o
|
|
60
48
|
}),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
49
|
+
title: `${p}: ${a}`,
|
|
50
|
+
children: a
|
|
51
|
+
}),
|
|
52
|
+
d > 0 && /* @__PURE__ */ r("span", {
|
|
53
|
+
className: i("flex shrink-0 items-center gap-1 rounded-sm px-1 text-[11px] leading-4", {
|
|
54
|
+
"bg-amber-500/15 text-amber-700 dark:text-amber-300": f > 0,
|
|
55
|
+
"bg-ui-active text-ui-fg": f === 0
|
|
56
|
+
}),
|
|
57
|
+
title: x,
|
|
58
|
+
children: [/* @__PURE__ */ n("i", { className: i("fas text-[10px]", {
|
|
59
|
+
"fa-sitemap": !f,
|
|
60
|
+
"fa-triangle-exclamation": !!f
|
|
61
|
+
}) }), d]
|
|
62
|
+
}),
|
|
63
|
+
/* @__PURE__ */ n("button", {
|
|
64
|
+
type: "button",
|
|
65
|
+
className: i("text-ui-fg-subtle h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded-sm text-[11px] hover:bg-red-500/10 hover:text-red-600 dark:hover:text-red-400", {
|
|
66
|
+
flex: o,
|
|
67
|
+
"hidden group-hover:flex": !o
|
|
68
|
+
}),
|
|
69
|
+
title: S ? `Delete the ${a} defaults` : `Delete .${a} from the space`,
|
|
70
|
+
"aria-label": `Delete ${a}`,
|
|
71
|
+
onClick: v,
|
|
72
|
+
children: /* @__PURE__ */ n("i", { className: "fas fa-trash" })
|
|
73
|
+
}),
|
|
74
|
+
u > 0 && /* @__PURE__ */ n("span", {
|
|
75
|
+
className: "bg-ui-active text-ui-fg min-w-5 shrink-0 rounded-sm px-1 text-center text-[11px] leading-4 font-medium tabular-nums",
|
|
76
|
+
title: `Dresses ${String(u)} element${u === 1 ? "" : "s"}`,
|
|
77
|
+
children: u
|
|
78
|
+
}),
|
|
79
|
+
u === 0 && !S && /* @__PURE__ */ n("span", {
|
|
80
|
+
className: "shrink-0 rounded-sm bg-amber-500/10 px-1 text-[10px] leading-4 font-medium text-amber-700 dark:text-amber-300",
|
|
81
|
+
title: "No element wears it",
|
|
82
|
+
children: "unused"
|
|
83
|
+
})
|
|
84
|
+
]
|
|
67
85
|
});
|
|
68
86
|
});
|
|
69
|
-
export {
|
|
87
|
+
export { a as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { UIEvent } from 'react';
|
|
2
|
+
export type WindowedList = {
|
|
3
|
+
/** On the element that scrolls. */
|
|
4
|
+
ref: (element: HTMLElement | null) => void;
|
|
5
|
+
onScroll: (e: UIEvent<HTMLElement>) => void;
|
|
6
|
+
/** The rows to draw: from `start`, up to but not including `end`. */
|
|
7
|
+
start: number;
|
|
8
|
+
end: number;
|
|
9
|
+
/** The room of the rows not drawn, above and below them. */
|
|
10
|
+
before: number;
|
|
11
|
+
after: number;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A long list drawn by what is in view: each row's height is known, so the rows out of view are room, not elements.
|
|
15
|
+
* The Style Manager listed every selector of a space — 1,900 on the website — and each check, pick or scroll redrew
|
|
16
|
+
* them all.
|
|
17
|
+
*/
|
|
18
|
+
declare const useWindowedList: (heights: readonly number[]) => WindowedList;
|
|
19
|
+
export default useWindowedList;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useCallback as e, useEffect as t, useMemo as n, useRef as r, useState as i } from "react";
|
|
2
|
+
// src/builder/hooks/useWindowedList.ts
|
|
3
|
+
var a = 8, o = (o) => {
|
|
4
|
+
let [s, c] = i(null), [l, u] = i({
|
|
5
|
+
top: 0,
|
|
6
|
+
height: 600
|
|
7
|
+
}), d = r(0), f = n(() => {
|
|
8
|
+
let e = [0];
|
|
9
|
+
for (let t of o) e.push(e[e.length - 1] + t);
|
|
10
|
+
return e;
|
|
11
|
+
}, [o]);
|
|
12
|
+
t(() => {
|
|
13
|
+
if (!s) return;
|
|
14
|
+
let e = () => u((e) => ({
|
|
15
|
+
...e,
|
|
16
|
+
height: s.clientHeight || e.height
|
|
17
|
+
}));
|
|
18
|
+
if (e(), typeof ResizeObserver > "u") return;
|
|
19
|
+
let t = new ResizeObserver(e);
|
|
20
|
+
return t.observe(s), () => t.disconnect();
|
|
21
|
+
}, [s]), t(() => () => cancelAnimationFrame(d.current), []);
|
|
22
|
+
let p = e((e) => {
|
|
23
|
+
let t = e.currentTarget.scrollTop;
|
|
24
|
+
cancelAnimationFrame(d.current), d.current = requestAnimationFrame(() => u((e) => ({
|
|
25
|
+
...e,
|
|
26
|
+
top: t
|
|
27
|
+
})));
|
|
28
|
+
}, []), m = f[f.length - 1], h = Math.max(f.findIndex((e) => e > l.top) - 1, 0), g = f.findIndex((e) => e >= l.top + l.height), _ = Math.max(h - a, 0), v = Math.min((g === -1 ? o.length : g) + a, o.length);
|
|
29
|
+
return {
|
|
30
|
+
ref: c,
|
|
31
|
+
onScroll: p,
|
|
32
|
+
start: _,
|
|
33
|
+
end: v,
|
|
34
|
+
before: f[_],
|
|
35
|
+
after: m - f[v]
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export { o as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-style",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.7",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -32,20 +32,20 @@
|
|
|
32
32
|
"build:prod": "vite build"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@plitzi/nexus": "^1.
|
|
36
|
-
"@plitzi/plitzi-ui": "^1.6.
|
|
37
|
-
"@plitzi/sdk-event-bridge": "0.39.
|
|
38
|
-
"@plitzi/sdk-shared": "0.39.
|
|
39
|
-
"@plitzi/sdk-variables": "0.39.
|
|
35
|
+
"@plitzi/nexus": "^1.5.1",
|
|
36
|
+
"@plitzi/plitzi-ui": "^1.6.40",
|
|
37
|
+
"@plitzi/sdk-event-bridge": "0.39.7",
|
|
38
|
+
"@plitzi/sdk-shared": "0.39.7",
|
|
39
|
+
"@plitzi/sdk-variables": "0.39.7",
|
|
40
40
|
"clsx": "^2.1.1",
|
|
41
|
-
"immer": "^11.2.
|
|
41
|
+
"immer": "^11.2.10",
|
|
42
42
|
"zod": "^4.6.7"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"eslint": "^9.39.5",
|
|
46
46
|
"react": "^19.3.1",
|
|
47
47
|
"typescript": "^6.0.3",
|
|
48
|
-
"vite": "^8.3.
|
|
48
|
+
"vite": "^8.3.8",
|
|
49
49
|
"vitest": "^5.1.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SelectorValue } from '../Selector';
|
|
2
|
-
export type SuggestionsCreatorProps = {
|
|
3
|
-
selector?: string;
|
|
4
|
-
onClick?: (selector: SelectorValue) => void;
|
|
5
|
-
};
|
|
6
|
-
declare const SuggestionsCreator: ({ selector, onClick }: SuggestionsCreatorProps) => import('react').JSX.Element;
|
|
7
|
-
export default SuggestionsCreator;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import e from "../SelectorItem/index.mjs";
|
|
2
|
-
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
-
// src/builder/components/Selector/SelectorSuggestions/SuggestionsCreator.tsx
|
|
4
|
-
var r = ({ selector: r, onClick: i }) => /* @__PURE__ */ n("div", {
|
|
5
|
-
className: "flex flex-col",
|
|
6
|
-
children: [/* @__PURE__ */ t("div", {
|
|
7
|
-
className: "text-sm font-bold text-zinc-800 dark:text-zinc-200",
|
|
8
|
-
children: "New Token"
|
|
9
|
-
}), /* @__PURE__ */ n("div", {
|
|
10
|
-
className: "flex items-center gap-1 px-2 text-xs text-zinc-600 dark:text-zinc-400",
|
|
11
|
-
children: [/* @__PURE__ */ t("div", { children: "Create:" }), /* @__PURE__ */ t(e, {
|
|
12
|
-
selector: r,
|
|
13
|
-
editable: !1,
|
|
14
|
-
active: !0,
|
|
15
|
-
onClick: i
|
|
16
|
-
})]
|
|
17
|
-
})]
|
|
18
|
-
});
|
|
19
|
-
export { r as default };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SelectorValue } from '../Selector';
|
|
2
|
-
export type SuggestionsListProps = {
|
|
3
|
-
selectors?: SelectorValue[];
|
|
4
|
-
onSelect?: (selector: SelectorValue) => void;
|
|
5
|
-
};
|
|
6
|
-
declare const SuggestionsList: ({ selectors, onSelect }: SuggestionsListProps) => import('react').JSX.Element;
|
|
7
|
-
export default SuggestionsList;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import e from "../SelectorItem/index.mjs";
|
|
2
|
-
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
-
// src/builder/components/Selector/SelectorSuggestions/SuggestionsList.tsx
|
|
4
|
-
var r = ({ selectors: r = [], onSelect: i }) => /* @__PURE__ */ n("div", {
|
|
5
|
-
className: "flex w-full flex-col",
|
|
6
|
-
children: [/* @__PURE__ */ t("div", {
|
|
7
|
-
className: "mb-1 w-full text-sm font-bold text-zinc-800 dark:text-zinc-200",
|
|
8
|
-
children: "Tokens Availables"
|
|
9
|
-
}), /* @__PURE__ */ n("div", {
|
|
10
|
-
className: "flex max-h-[250px] flex-col items-start gap-1 overflow-y-auto text-xs",
|
|
11
|
-
children: [r.map((n, r) => /* @__PURE__ */ t(e, {
|
|
12
|
-
className: "cursor-pointer",
|
|
13
|
-
selector: n.name,
|
|
14
|
-
type: n.type,
|
|
15
|
-
editable: !1,
|
|
16
|
-
onClick: i,
|
|
17
|
-
active: !0
|
|
18
|
-
}, `${n.name}_${r}`)), r.length === 0 && /* @__PURE__ */ t("div", {
|
|
19
|
-
className: "w-full rounded-sm border-2 border-dashed border-gray-300 p-3 text-center text-zinc-500 dark:border-zinc-600 dark:text-zinc-400",
|
|
20
|
-
children: "No tokens availables"
|
|
21
|
-
})]
|
|
22
|
-
})]
|
|
23
|
-
});
|
|
24
|
-
export { r as default };
|