@plitzi/sdk-style 0.39.3 → 0.39.6
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/StyleMap/StyleMap.d.ts +9 -4
- package/dist/StyleMap/StyleMap.mjs +4 -4
- package/dist/StyleMap/helpers/utils.mjs +1 -1
- package/dist/StyleReducer.d.ts +4 -3
- 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.d.ts +3 -1
- package/dist/builder/components/Selector/Selector.mjs +153 -132
- package/dist/builder/components/Selector/SelectorItem/ItemOptions.mjs +4 -3
- package/dist/builder/components/Selector/SelectorItem/SelectorItem.d.ts +6 -1
- package/dist/builder/components/Selector/SelectorItem/SelectorItem.mjs +51 -39
- 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 +4 -3
- package/dist/builder/components/StyleInspector/StyleInspectorProvider.mjs +1 -1
- 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 +272 -116
- 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/dist/helpers/processSelectorVariables.mjs +12 -13
- 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
package/dist/builder/components/StyleInspector/components/InspectorFooter/InspectorFooter.mjs
CHANGED
|
@@ -4,11 +4,11 @@ import r from "@plitzi/plitzi-ui/Icon";
|
|
|
4
4
|
import i from "@plitzi/plitzi-ui/Switch";
|
|
5
5
|
// src/builder/components/StyleInspector/components/InspectorFooter/InspectorFooter.tsx
|
|
6
6
|
var a = ({ replaceTokens: a, showAllOptions: o, canShowAllOptions: s, onCollapseAll: c, onChangeReplaceTokens: l, onChangeShowAllOptions: u }) => /* @__PURE__ */ n("div", {
|
|
7
|
-
className: "flex items-center justify-between gap-3 border-t
|
|
7
|
+
className: "border-ui-line flex items-center justify-between gap-3 border-t px-2.5 py-1.5",
|
|
8
8
|
children: [/* @__PURE__ */ n("div", {
|
|
9
|
-
className: "flex items-center gap-3
|
|
9
|
+
className: "text-ui-fg-subtle flex items-center gap-3",
|
|
10
10
|
children: [/* @__PURE__ */ t(r, {
|
|
11
|
-
className: "
|
|
11
|
+
className: "hover:text-ui-fg cursor-pointer text-xs",
|
|
12
12
|
icon: "fa-solid fa-angles-up",
|
|
13
13
|
title: "Collapse every category",
|
|
14
14
|
onClick: c
|
|
@@ -26,8 +26,8 @@ var l = i(({ keyValue: i, children: l, className: u = "", size: d = "small", sec
|
|
|
26
26
|
children: /* @__PURE__ */ s("label", {
|
|
27
27
|
className: c("m-0 truncate rounded-sm leading-5 transition-colors duration-150", {
|
|
28
28
|
"px-1": !f,
|
|
29
|
-
"
|
|
30
|
-
"text-
|
|
29
|
+
"border-ui-line-strong bg-ui-active text-ui-fg rounded-b-none border px-2 font-semibold": f,
|
|
30
|
+
"text-ui-fg-muted": !f && _ === "none",
|
|
31
31
|
"bg-sky-500/12 text-sky-700 dark:bg-sky-400/12 dark:text-sky-300": _ === "value",
|
|
32
32
|
"bg-emerald-500/12 text-emerald-700 dark:bg-emerald-400/12 dark:text-emerald-300": _ === "variable",
|
|
33
33
|
"bg-violet-500/12 text-violet-700 dark:bg-violet-400/14 dark:text-violet-300": _ === "binding",
|
package/dist/builder/components/StyleInspector/components/InspectorSearch/InspectorSearch.mjs
CHANGED
|
@@ -7,7 +7,7 @@ var r = ({ value: r, onChange: i }) => {
|
|
|
7
7
|
e.key === "Escape" && r && (e.stopPropagation(), i(""));
|
|
8
8
|
}, [i, r]);
|
|
9
9
|
return /* @__PURE__ */ t("div", {
|
|
10
|
-
className: "border-
|
|
10
|
+
className: "border-ui-line border-b px-2 py-1.5",
|
|
11
11
|
children: /* @__PURE__ */ t(n, {
|
|
12
12
|
size: "xs",
|
|
13
13
|
value: r,
|
|
@@ -55,7 +55,7 @@ var p = o(({ value: o, withSpread: p, onChange: m, onRemove: h }) => {
|
|
|
55
55
|
value: o,
|
|
56
56
|
onChange: b
|
|
57
57
|
}), /* @__PURE__ */ d("p", {
|
|
58
|
-
className: "m-0 text-[11px]
|
|
58
|
+
className: "text-ui-fg-subtle m-0 text-[11px]",
|
|
59
59
|
children: "Not a single shadow the editor can split into parts (a token, for one), so it is edited as written."
|
|
60
60
|
})] }),
|
|
61
61
|
g && p && /* @__PURE__ */ d(r, {
|
|
@@ -5,7 +5,7 @@ var i = e(({ selectorName: e, parts: i, onReset: a }) => /* @__PURE__ */ n("div"
|
|
|
5
5
|
className: "bg-primary-500/10 dark:bg-primary-400/10 flex items-center gap-2 rounded-md px-2 py-1 text-xs",
|
|
6
6
|
children: [
|
|
7
7
|
/* @__PURE__ */ t("span", {
|
|
8
|
-
className: "
|
|
8
|
+
className: "text-ui-fg-subtle shrink-0",
|
|
9
9
|
children: "Editing"
|
|
10
10
|
}),
|
|
11
11
|
/* @__PURE__ */ t("span", {
|
|
@@ -13,7 +13,7 @@ var i = e(({ selectorName: e, parts: i, onReset: a }) => /* @__PURE__ */ n("div"
|
|
|
13
13
|
children: [e, ...i].filter(Boolean).join(" › ")
|
|
14
14
|
}),
|
|
15
15
|
/* @__PURE__ */ t(r, {
|
|
16
|
-
className: "
|
|
16
|
+
className: "text-ui-fg-subtle hover:text-ui-fg shrink-0 cursor-pointer",
|
|
17
17
|
icon: "fa-solid fa-xmark",
|
|
18
18
|
title: "Back to the selector's own rules",
|
|
19
19
|
onClick: a
|
|
@@ -10,7 +10,7 @@ var i = t(({ label: t, keys: i, addLabel: a, onAdd: o, children: s }) => /* @__P
|
|
|
10
10
|
children: t
|
|
11
11
|
}), /* @__PURE__ */ n("button", {
|
|
12
12
|
type: "button",
|
|
13
|
-
className: "focus-visible:outline-primary-500 flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded-md
|
|
13
|
+
className: "focus-visible:outline-primary-500 text-ui-fg-subtle hover:bg-ui-hover hover:text-ui-fg flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded-md transition-colors duration-150 focus-visible:outline-2",
|
|
14
14
|
title: a,
|
|
15
15
|
"aria-label": a,
|
|
16
16
|
onClick: o,
|
|
@@ -21,19 +21,19 @@ var l = e(({ summary: e, preview: l, title: u, removeLabel: d, onRemove: f, chil
|
|
|
21
21
|
children: [/* @__PURE__ */ o(c.Trigger, {
|
|
22
22
|
className: s("group flex h-7 w-full min-w-0 cursor-pointer items-center gap-2 rounded-md border px-2 text-xs transition-colors duration-150 select-none", {
|
|
23
23
|
"border-primary-500/60 bg-primary-500/5 dark:border-primary-400/60 dark:bg-primary-400/10": m,
|
|
24
|
-
"border-
|
|
24
|
+
"border-ui-line bg-ui-raised hover:border-ui-line-strong hover:bg-ui-hover": !m
|
|
25
25
|
}),
|
|
26
26
|
onClick: _,
|
|
27
27
|
children: [
|
|
28
28
|
l,
|
|
29
29
|
/* @__PURE__ */ a("span", {
|
|
30
|
-
className: "min-w-0 grow truncate font-mono text-[11px]
|
|
30
|
+
className: "text-ui-fg min-w-0 grow truncate font-mono text-[11px]",
|
|
31
31
|
title: e,
|
|
32
32
|
children: e
|
|
33
33
|
}),
|
|
34
34
|
/* @__PURE__ */ a("button", {
|
|
35
35
|
type: "button",
|
|
36
|
-
className: "flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded
|
|
36
|
+
className: "text-ui-fg-subtle group-hover:text-ui-fg flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded transition-colors duration-150 hover:bg-red-500/10 hover:text-red-600 dark:hover:text-red-400",
|
|
37
37
|
title: d,
|
|
38
38
|
"aria-label": d,
|
|
39
39
|
onClick: y,
|
|
@@ -47,13 +47,13 @@ var l = e(({ summary: e, preview: l, title: u, removeLabel: d, onRemove: f, chil
|
|
|
47
47
|
className: "flex w-full flex-col outline-none",
|
|
48
48
|
tabIndex: -1,
|
|
49
49
|
children: [/* @__PURE__ */ o("div", {
|
|
50
|
-
className: "flex items-center justify-between gap-2 border-b
|
|
50
|
+
className: "border-ui-line flex items-center justify-between gap-2 border-b px-3 py-2",
|
|
51
51
|
children: [/* @__PURE__ */ a("span", {
|
|
52
|
-
className: "text-
|
|
52
|
+
className: "text-ui-fg text-xs font-semibold",
|
|
53
53
|
children: u
|
|
54
54
|
}), /* @__PURE__ */ a("button", {
|
|
55
55
|
type: "button",
|
|
56
|
-
className: "flex h-5 w-5 cursor-pointer items-center justify-center rounded
|
|
56
|
+
className: "text-ui-fg-subtle hover:bg-ui-hover hover:text-ui-fg flex h-5 w-5 cursor-pointer items-center justify-center rounded",
|
|
57
57
|
title: "Close",
|
|
58
58
|
"aria-label": "Close",
|
|
59
59
|
onClick: v,
|
|
@@ -1,170 +1,326 @@
|
|
|
1
1
|
import e from "./StyleSelectorTag.mjs";
|
|
2
|
-
import t from "../../
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import t from "../../hooks/useWindowedList.mjs";
|
|
3
|
+
import n from "../../models/SelectorForm/index.mjs";
|
|
4
|
+
import { ancestorRemovals as r, unusedAncestors as i } from "../StyleInspector/helpers.mjs";
|
|
5
|
+
import { memo as a, use as o, useCallback as s, useMemo as c, useState as l } from "react";
|
|
6
|
+
import { useBuilderStore as ee } from "@plitzi/sdk-shared/store";
|
|
6
7
|
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
7
|
-
import { produce as
|
|
8
|
-
import
|
|
8
|
+
import { produce as te } from "immer";
|
|
9
|
+
import f from "@plitzi/plitzi-ui/Button";
|
|
10
|
+
import p from "clsx";
|
|
9
11
|
import m from "@plitzi/plitzi-ui/Modal";
|
|
10
12
|
import { ComponentContext as h } from "@plitzi/sdk-shared/elements";
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import { BuilderContext as
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
import { isEmpty as g } from "@plitzi/plitzi-ui/helpers/lodash";
|
|
14
|
+
import _ from "@plitzi/plitzi-ui/hooks/useDisclosure";
|
|
15
|
+
import v from "@plitzi/plitzi-ui/Input";
|
|
16
|
+
import { BuilderContext as ne } from "@plitzi/sdk-shared/builder/contexts";
|
|
17
|
+
// src/builder/components/StyleManager/ManagerSelector.tsx
|
|
18
|
+
var y = (e) => e.split(":")[0], re = (e, t) => {
|
|
19
|
+
let n = y(t);
|
|
20
|
+
return !!n && Object.values(e.definition.styleSelectors).some((e) => e.split(" ").includes(n));
|
|
21
|
+
}, ie = (e) => e < 1e3 ? String(e) : `${(e / 1e3).toFixed(+(e < 1e4)).replace(/\.0$/, "")}k`, ae = [
|
|
22
|
+
{
|
|
23
|
+
id: "all",
|
|
24
|
+
label: "All"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "classes",
|
|
28
|
+
label: "Classes"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: "elements",
|
|
32
|
+
label: "Elements"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: "unused",
|
|
36
|
+
label: "Unused"
|
|
37
|
+
}
|
|
38
|
+
], b = {
|
|
39
|
+
section: 28,
|
|
40
|
+
group: 28,
|
|
41
|
+
row: 28
|
|
42
|
+
}, x = 40, S = 5, C = "Other", oe = (e) => {
|
|
43
|
+
let t = e.indexOf("-");
|
|
44
|
+
return t > 0 ? e.slice(0, t + 1) : void 0;
|
|
45
|
+
}, w = a(({ displayMode: a, flat: w, flatList: T, selectors: E, selected: se, onSelect: D }) => {
|
|
46
|
+
let O = c(() => Object.values(E ?? {}), [E]), [k, A] = l(""), [j, M] = l("all"), [N, P] = l([]), { builderHandler: F } = o(ne), [I] = ee("style.platform"), { components: ce } = o(h), le = c(() => O.filter((e) => !!e.componentType).map((e) => e.componentType), [O]), L = c(() => {
|
|
47
|
+
let e = O;
|
|
48
|
+
return g(k) || (e = O.filter((e) => e.name.toLowerCase().includes(k.toLowerCase()))), [...e].sort((e, t) => {
|
|
19
49
|
let n = Number(e.type === "element"), r = Number(t.type === "element");
|
|
20
50
|
return n === r ? e.name.localeCompare(t.name) : r - n;
|
|
21
51
|
});
|
|
22
|
-
}, [
|
|
52
|
+
}, [O, k]), R = c(() => {
|
|
53
|
+
let e = {};
|
|
54
|
+
for (let t of T) new Set(Object.values(t.definition.styleSelectors).flatMap((e) => e.split(" ").filter(Boolean))).forEach((t) => {
|
|
55
|
+
e[t] = (e[t] ?? 0) + 1;
|
|
56
|
+
});
|
|
57
|
+
return Object.fromEntries(O.map((t) => [t.name, e[y(t.name)] ?? 0]));
|
|
58
|
+
}, [O, T]), z = c(() => {
|
|
59
|
+
let e = L.filter((e) => e.type !== "element");
|
|
60
|
+
return {
|
|
61
|
+
all: L,
|
|
62
|
+
classes: e,
|
|
63
|
+
elements: L.filter((e) => e.type === "element"),
|
|
64
|
+
unused: e.filter((e) => R[e.name] === 0)
|
|
65
|
+
};
|
|
66
|
+
}, [L, R]), B = z[j], [V, H] = l(/* @__PURE__ */ new Set()), U = c(() => {
|
|
67
|
+
let e = (e, t = !1) => e.map((e) => ({
|
|
68
|
+
kind: "row",
|
|
69
|
+
key: e.name,
|
|
70
|
+
selector: e,
|
|
71
|
+
nested: t
|
|
72
|
+
})), t = (t) => {
|
|
73
|
+
if (t.length < x || k) return e(t);
|
|
74
|
+
let n = /* @__PURE__ */ new Map(), r = [];
|
|
75
|
+
for (let e of t) {
|
|
76
|
+
let t = oe(e.name);
|
|
77
|
+
t ? n.set(t, [...n.get(t) ?? [], e]) : r.push(e);
|
|
78
|
+
}
|
|
79
|
+
let i = (t, n) => {
|
|
80
|
+
let r = V.has(t);
|
|
81
|
+
return [{
|
|
82
|
+
kind: "group",
|
|
83
|
+
key: `group:${t}`,
|
|
84
|
+
prefix: t,
|
|
85
|
+
count: n.length,
|
|
86
|
+
open: r
|
|
87
|
+
}, ...r ? e(n, !0) : []];
|
|
88
|
+
}, a = [...n.entries()].filter(([, e]) => e.length >= S), o = [...r, ...[...n.values()].filter((e) => e.length < S).flat()].sort((e, t) => e.name.localeCompare(t.name));
|
|
89
|
+
return [...a.sort(([e], [t]) => e.localeCompare(t)).flatMap(([e, t]) => i(e, t)), ...o.length > 0 ? i(C, o) : []];
|
|
90
|
+
};
|
|
91
|
+
return j === "all" ? [...z.elements.length > 0 ? [{
|
|
92
|
+
kind: "section",
|
|
93
|
+
key: "section:elements",
|
|
94
|
+
title: "Element defaults",
|
|
95
|
+
count: z.elements.length
|
|
96
|
+
}, ...e(z.elements)] : [], ...z.classes.length > 0 ? [{
|
|
97
|
+
kind: "section",
|
|
98
|
+
key: "section:classes",
|
|
99
|
+
title: "Classes",
|
|
100
|
+
count: z.classes.length
|
|
101
|
+
}, ...t(z.classes)] : []] : j === "elements" ? e(B) : t(B);
|
|
102
|
+
}, [
|
|
103
|
+
j,
|
|
104
|
+
z,
|
|
105
|
+
B,
|
|
106
|
+
k,
|
|
107
|
+
V
|
|
108
|
+
]), W = c(() => U.map((e) => b[e.kind]), [U]), G = t(W), K = s((e) => () => H((t) => {
|
|
109
|
+
let n = new Set(t);
|
|
110
|
+
return n.delete(e) || n.add(e), n;
|
|
111
|
+
}), []), ue = s((e) => A(e), [A]), de = s((e) => () => M(e), []), fe = s((e, t) => {
|
|
23
112
|
if (t) {
|
|
24
113
|
if (t.mode === "default") {
|
|
25
114
|
let { name: e } = t;
|
|
26
|
-
|
|
115
|
+
F("styleAddSelector", a, e, "class", void 0, void 0, {
|
|
27
116
|
styleSelector: void 0,
|
|
28
117
|
componentType: void 0
|
|
29
118
|
});
|
|
30
119
|
} else {
|
|
31
120
|
let { componentType: e } = t;
|
|
32
|
-
|
|
121
|
+
F("styleAddSelector", a, e, "element", void 0, void 0, {
|
|
33
122
|
styleSelector: void 0,
|
|
34
123
|
componentType: e
|
|
35
124
|
});
|
|
36
125
|
}
|
|
37
126
|
}
|
|
38
|
-
}, [
|
|
127
|
+
}, [F, a]), [pe, me, he, q] = _({
|
|
39
128
|
id: "add-selector",
|
|
40
|
-
onClose:
|
|
41
|
-
}),
|
|
42
|
-
|
|
43
|
-
}, [
|
|
129
|
+
onClose: fe
|
|
130
|
+
}), ge = s((e) => {
|
|
131
|
+
D?.((t) => t?.name === e ? void 0 : O.find((t) => t.name === e));
|
|
132
|
+
}, [D, O]), _e = s((e, t, n) => {
|
|
44
133
|
if (!t || !n || n.length === 0) return;
|
|
45
|
-
let r = new Set(n),
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
});
|
|
134
|
+
let r = new Set(n), i = new Set(n.map(y)), o = T.filter((e) => n.some((t) => re(e, t))).map((e) => te(e, (e) => {
|
|
135
|
+
let { styleSelectors: t } = e.definition;
|
|
136
|
+
for (let [e, n] of Object.entries(t)) t[e] = n.split(" ").filter((e) => e && !i.has(e)).join(" ");
|
|
49
137
|
}));
|
|
50
|
-
|
|
138
|
+
o.length > 0 && F("schemaUpdateElements", o), F("styleRemoveSelectors", a, n), P((e) => e.filter((e) => !r.has(e))), D?.((e) => e && r.has(e.name) ? void 0 : e);
|
|
51
139
|
}, [
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
]), [U, W, G, K, , q] = v({
|
|
140
|
+
F,
|
|
141
|
+
a,
|
|
142
|
+
T,
|
|
143
|
+
D
|
|
144
|
+
]), [ve, ye, J, Y, , X] = _({
|
|
58
145
|
id: "delete-selector",
|
|
59
|
-
onClose:
|
|
60
|
-
}),
|
|
61
|
-
...e,
|
|
62
|
-
[t.name]: S.filter((e) => V(e, t.name)).length
|
|
63
|
-
}), {}), [
|
|
64
|
-
N,
|
|
65
|
-
S,
|
|
66
|
-
V
|
|
67
|
-
]), Q = s(() => Object.fromEntries(E.map((e) => [e.name, {
|
|
146
|
+
onClose: _e
|
|
147
|
+
}), be = s((e) => J(void 0, [e]), [J]), xe = s((e) => P((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]), []), Se = s(() => P([]), []), Ce = s(() => P(z.unused.map((e) => e.name)), [z.unused]), we = s(() => J(void 0, N), [J, N]), Z = Array.isArray(X) ? X.length : 0, Q = c(() => Object.fromEntries(O.map((e) => [e.name, {
|
|
68
148
|
count: new Set(Object.values(e.attributes).flatMap((e) => Object.keys(e.ancestors ?? {}))).size,
|
|
69
|
-
unused:
|
|
70
|
-
}])), [
|
|
71
|
-
for (let [e, { unused: t }] of Object.entries(Q)) for (let
|
|
72
|
-
styleSelector:
|
|
73
|
-
styleAncestor:
|
|
74
|
-
componentType:
|
|
149
|
+
unused: i(w, e)
|
|
150
|
+
}])), [w, O]), $ = c(() => Object.values(Q).reduce((e, { unused: t }) => e + t.size, 0), [Q]), Te = `${$} unused ancestor ${$ === 1 ? "rule" : "rules"}`, Ee = s(() => {
|
|
151
|
+
for (let [e, { unused: t }] of Object.entries(Q)) for (let n of r(I, e, t)) F("styleUpdateSelector", n.displayMode, e, void 0, void 0, {
|
|
152
|
+
styleSelector: n.styleSelector,
|
|
153
|
+
styleAncestor: n.styleAncestor,
|
|
154
|
+
componentType: I[n.displayMode][e].componentType
|
|
75
155
|
});
|
|
76
156
|
}, [
|
|
77
157
|
Q,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
]),
|
|
158
|
+
F,
|
|
159
|
+
I
|
|
160
|
+
]), De = s(() => void Y(void 0, !1), [Y]), Oe = s(() => void Y(void 0, !0), [Y]);
|
|
81
161
|
return /* @__PURE__ */ d("div", {
|
|
82
|
-
className: "flex
|
|
162
|
+
className: "border-ui-line flex w-[300px] shrink-0 flex-col gap-2 overflow-hidden border-r px-2 pt-2",
|
|
83
163
|
children: [
|
|
84
|
-
/* @__PURE__ */ d(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
164
|
+
/* @__PURE__ */ d("div", {
|
|
165
|
+
className: "flex items-center gap-1.5",
|
|
166
|
+
children: [/* @__PURE__ */ u("div", {
|
|
167
|
+
className: "grow",
|
|
168
|
+
children: /* @__PURE__ */ u(v, {
|
|
169
|
+
placeholder: "Search selectors",
|
|
170
|
+
"aria-label": "Search selectors",
|
|
171
|
+
value: k,
|
|
172
|
+
onChange: ue,
|
|
173
|
+
size: "xs",
|
|
174
|
+
clearable: !0,
|
|
175
|
+
children: /* @__PURE__ */ u(v.Icon, { icon: "fa-solid fa-magnifying-glass" })
|
|
176
|
+
})
|
|
177
|
+
}), /* @__PURE__ */ d(f, {
|
|
178
|
+
intent: "primary",
|
|
179
|
+
size: "xs",
|
|
180
|
+
iconPlacement: "before",
|
|
181
|
+
title: "New selector",
|
|
182
|
+
onClick: he,
|
|
183
|
+
children: [/* @__PURE__ */ u(f.Icon, { icon: "fa-solid fa-plus" }), "New"]
|
|
184
|
+
})]
|
|
95
185
|
}),
|
|
96
|
-
/* @__PURE__ */ u(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
186
|
+
/* @__PURE__ */ u("div", {
|
|
187
|
+
className: "bg-ui-raised flex gap-0.5 rounded-md p-0.5",
|
|
188
|
+
role: "tablist",
|
|
189
|
+
children: ae.map(({ id: e, label: t }) => /* @__PURE__ */ d("button", {
|
|
190
|
+
type: "button",
|
|
191
|
+
role: "tab",
|
|
192
|
+
"aria-selected": j === e,
|
|
193
|
+
className: p("flex min-w-0 flex-1 cursor-pointer items-center justify-center gap-1 rounded px-1 py-1 text-[11px] font-medium whitespace-nowrap", {
|
|
194
|
+
"bg-ui-active text-ui-fg shadow-sm": j === e,
|
|
195
|
+
"text-ui-fg-subtle hover:text-ui-fg": j !== e
|
|
196
|
+
}),
|
|
197
|
+
title: `${t} · ${z[e].length.toLocaleString("en")}`,
|
|
198
|
+
onClick: de(e),
|
|
199
|
+
children: [t, /* @__PURE__ */ u("span", {
|
|
200
|
+
className: p("tabular-nums", {
|
|
201
|
+
"text-amber-600 dark:text-amber-400": e === "unused" && z.unused.length > 0,
|
|
202
|
+
"opacity-60": !(e === "unused" && z.unused.length > 0)
|
|
203
|
+
}),
|
|
204
|
+
children: ie(z[e].length)
|
|
205
|
+
})]
|
|
206
|
+
}, e))
|
|
101
207
|
}),
|
|
102
208
|
$ > 0 && /* @__PURE__ */ d("div", {
|
|
103
|
-
className: "flex items-center justify-between gap-2 rounded-
|
|
209
|
+
className: "flex items-center justify-between gap-2 rounded-md border border-amber-500/30 bg-amber-500/10 px-2 py-1.5",
|
|
104
210
|
children: [/* @__PURE__ */ d("span", {
|
|
105
|
-
className: "text-xs text-amber-
|
|
106
|
-
children: [/* @__PURE__ */ u("i", { className: "fas fa-
|
|
107
|
-
}), /* @__PURE__ */ u(
|
|
211
|
+
className: "text-xs text-amber-800 dark:text-amber-200",
|
|
212
|
+
children: [/* @__PURE__ */ u("i", { className: "fas fa-sitemap mr-1.5 text-[10px]" }), Te]
|
|
213
|
+
}), /* @__PURE__ */ u(f, {
|
|
108
214
|
size: "xs",
|
|
109
|
-
onClick:
|
|
215
|
+
onClick: Ee,
|
|
110
216
|
children: "Clean up"
|
|
111
217
|
})]
|
|
112
218
|
}),
|
|
113
|
-
|
|
114
|
-
className: "
|
|
219
|
+
j === "unused" && z.unused.length > 0 && N.length === 0 && /* @__PURE__ */ d("div", {
|
|
220
|
+
className: "text-ui-fg-subtle flex items-center justify-between gap-2 px-1 text-xs",
|
|
221
|
+
children: [/* @__PURE__ */ u("span", { children: "No element wears these classes." }), /* @__PURE__ */ u(f, {
|
|
222
|
+
size: "xs",
|
|
223
|
+
onClick: Ce,
|
|
224
|
+
children: "Select all"
|
|
225
|
+
})]
|
|
226
|
+
}),
|
|
227
|
+
N.length > 0 && /* @__PURE__ */ d("div", {
|
|
228
|
+
className: "bg-secondary-50 dark:bg-secondary-900/30 flex items-center justify-between gap-2 rounded-md px-2 py-1",
|
|
115
229
|
children: [/* @__PURE__ */ d("span", {
|
|
116
|
-
className: "text-
|
|
117
|
-
children: [
|
|
230
|
+
className: "text-ui-fg-muted text-xs",
|
|
231
|
+
children: [N.length, " selected"]
|
|
118
232
|
}), /* @__PURE__ */ d("div", {
|
|
119
233
|
className: "flex gap-1",
|
|
120
|
-
children: [/* @__PURE__ */ u(
|
|
234
|
+
children: [/* @__PURE__ */ u(f, {
|
|
121
235
|
size: "xs",
|
|
122
|
-
onClick:
|
|
236
|
+
onClick: Se,
|
|
123
237
|
children: "Clear"
|
|
124
|
-
}), /* @__PURE__ */ d(
|
|
238
|
+
}), /* @__PURE__ */ d(f, {
|
|
125
239
|
intent: "danger",
|
|
126
240
|
size: "xs",
|
|
127
241
|
iconPlacement: "before",
|
|
128
|
-
onClick:
|
|
129
|
-
children: [/* @__PURE__ */ u(
|
|
242
|
+
onClick: we,
|
|
243
|
+
children: [/* @__PURE__ */ u(f.Icon, { icon: "fas fa-trash" }), "Delete"]
|
|
130
244
|
})]
|
|
131
245
|
})]
|
|
132
246
|
}),
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
247
|
+
/* @__PURE__ */ d("div", {
|
|
248
|
+
ref: G.ref,
|
|
249
|
+
className: "-mx-2 flex grow basis-0 flex-col overflow-y-auto pb-2",
|
|
250
|
+
onScroll: G.onScroll,
|
|
251
|
+
children: [
|
|
252
|
+
/* @__PURE__ */ u("div", {
|
|
253
|
+
style: { height: G.before },
|
|
254
|
+
className: "shrink-0"
|
|
255
|
+
}),
|
|
256
|
+
U.slice(G.start, G.end).map((t) => {
|
|
257
|
+
if (t.kind === "section") return /* @__PURE__ */ d("h6", {
|
|
258
|
+
className: "text-ui-fg-subtle flex h-7 shrink-0 items-center justify-between px-2 text-[10px] font-semibold tracking-wider uppercase",
|
|
259
|
+
children: [t.title, /* @__PURE__ */ u("span", {
|
|
260
|
+
className: "font-normal tabular-nums",
|
|
261
|
+
children: t.count
|
|
262
|
+
})]
|
|
263
|
+
}, t.key);
|
|
264
|
+
if (t.kind === "group") return /* @__PURE__ */ d("button", {
|
|
265
|
+
type: "button",
|
|
266
|
+
"aria-expanded": t.open,
|
|
267
|
+
className: "text-ui-fg-muted hover:bg-ui-hover flex h-7 w-full shrink-0 cursor-pointer items-center gap-2 pr-2 pl-2 text-left text-xs",
|
|
268
|
+
onClick: K(t.prefix),
|
|
269
|
+
children: [
|
|
270
|
+
/* @__PURE__ */ u("i", { className: p("fa-solid text-ui-fg-subtle w-4 text-center text-[9px]", t.open ? "fa-chevron-down" : "fa-chevron-right") }),
|
|
271
|
+
/* @__PURE__ */ u("span", {
|
|
272
|
+
className: p("grow truncate", { "font-mono": t.prefix !== C }),
|
|
273
|
+
children: t.prefix === C ? C : `${t.prefix}…`
|
|
274
|
+
}),
|
|
275
|
+
/* @__PURE__ */ u("span", {
|
|
276
|
+
className: "text-ui-fg-subtle text-[11px] tabular-nums",
|
|
277
|
+
children: t.count
|
|
278
|
+
})
|
|
279
|
+
]
|
|
280
|
+
}, t.key);
|
|
281
|
+
let { name: n, type: r } = t.selector;
|
|
282
|
+
return /* @__PURE__ */ u(e, {
|
|
283
|
+
id: n,
|
|
284
|
+
active: n === se,
|
|
285
|
+
checked: N.includes(n),
|
|
286
|
+
selecting: N.length > 0,
|
|
287
|
+
nested: t.nested,
|
|
288
|
+
label: n,
|
|
289
|
+
type: r,
|
|
290
|
+
elementsCount: R[n],
|
|
291
|
+
ancestorsCount: Q[n].count,
|
|
292
|
+
unusedAncestorsCount: Q[n].unused.size,
|
|
293
|
+
onSelect: ge,
|
|
294
|
+
onDelete: be,
|
|
295
|
+
onToggleCheck: xe
|
|
296
|
+
}, t.key);
|
|
297
|
+
}),
|
|
298
|
+
/* @__PURE__ */ u("div", {
|
|
299
|
+
style: { height: G.after },
|
|
300
|
+
className: "shrink-0"
|
|
301
|
+
}),
|
|
302
|
+
B.length === 0 && /* @__PURE__ */ u("p", {
|
|
303
|
+
className: "text-ui-fg-subtle px-2 py-6 text-center text-xs",
|
|
304
|
+
children: k ? "No selector matches the search." : j === "unused" ? "Every class is worn by an element." : "No selectors yet: make one with New."
|
|
305
|
+
})
|
|
306
|
+
]
|
|
151
307
|
}),
|
|
152
308
|
/* @__PURE__ */ d(m, {
|
|
153
|
-
id:
|
|
154
|
-
open:
|
|
155
|
-
onClose:
|
|
309
|
+
id: pe,
|
|
310
|
+
open: me,
|
|
311
|
+
onClose: q,
|
|
156
312
|
size: "sm",
|
|
157
|
-
children: [/* @__PURE__ */ u(m.Header, { children: /* @__PURE__ */ u("h4", { children: "Add Selector" }) }), /* @__PURE__ */ u(m.Body, { children: /* @__PURE__ */ u(
|
|
158
|
-
componentsNotAvailables:
|
|
159
|
-
components:
|
|
160
|
-
onSubmit:
|
|
161
|
-
onClose:
|
|
313
|
+
children: [/* @__PURE__ */ u(m.Header, { children: /* @__PURE__ */ u("h4", { children: "Add Selector" }) }), /* @__PURE__ */ u(m.Body, { children: /* @__PURE__ */ u(n, {
|
|
314
|
+
componentsNotAvailables: le,
|
|
315
|
+
components: ce.current,
|
|
316
|
+
onSubmit: q,
|
|
317
|
+
onClose: q
|
|
162
318
|
}) })]
|
|
163
319
|
}),
|
|
164
320
|
/* @__PURE__ */ d(m, {
|
|
165
|
-
id:
|
|
166
|
-
open:
|
|
167
|
-
onClose:
|
|
321
|
+
id: ve,
|
|
322
|
+
open: ye,
|
|
323
|
+
onClose: Y,
|
|
168
324
|
children: [
|
|
169
325
|
/* @__PURE__ */ u(m.Header, { children: /* @__PURE__ */ u("h4", { children: "Remove Selector" }) }),
|
|
170
326
|
/* @__PURE__ */ d(m.Body, { children: [Z > 1 && /* @__PURE__ */ d("h4", { children: [
|
|
@@ -174,12 +330,12 @@ var x = i(({ displayMode: i, flat: x, flatList: S, selectors: C, selected: w, on
|
|
|
174
330
|
] }), Z <= 1 && /* @__PURE__ */ u("h4", { children: "Do you want to remove this item ?" })] }),
|
|
175
331
|
/* @__PURE__ */ d(m.Footer, {
|
|
176
332
|
justify: "end",
|
|
177
|
-
children: [/* @__PURE__ */ u(
|
|
178
|
-
onClick:
|
|
333
|
+
children: [/* @__PURE__ */ u(f, {
|
|
334
|
+
onClick: De,
|
|
179
335
|
size: "sm",
|
|
180
336
|
children: "Cancel"
|
|
181
|
-
}), /* @__PURE__ */ u(
|
|
182
|
-
onClick:
|
|
337
|
+
}), /* @__PURE__ */ u(f, {
|
|
338
|
+
onClick: Oe,
|
|
183
339
|
size: "sm",
|
|
184
340
|
children: "Submit"
|
|
185
341
|
})]
|
|
@@ -189,4 +345,4 @@ var x = i(({ displayMode: i, flat: x, flatList: S, selectors: C, selected: w, on
|
|
|
189
345
|
]
|
|
190
346
|
});
|
|
191
347
|
});
|
|
192
|
-
export {
|
|
348
|
+
export { w as default };
|