@plitzi/sdk-style 0.36.1 → 0.37.0
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 +72 -0
- package/dist/StyleMap/StyleMap.d.ts +5 -21
- package/dist/StyleMap/helpers/isValueValid.d.ts +1 -0
- package/dist/StyleMap/helpers/isValueValid.mjs +3 -3
- package/dist/StyleMap/helpers/utils.d.ts +2 -2
- package/dist/StyleMap/helpers/utils.mjs +43 -28
- package/dist/StyleMap/methods/addSelector.d.ts +2 -7
- package/dist/StyleMap/methods/addSelector.mjs +4 -4
- package/dist/StyleMap/methods/updateSelector.d.ts +2 -5
- package/dist/StyleMap/methods/updateSelector.mjs +2 -2
- package/dist/StyleReducer.d.ts +3 -11
- package/dist/components/Selector/Selector.mjs +149 -125
- package/dist/components/Selector/SelectorHelper.d.ts +25 -0
- package/dist/components/Selector/SelectorHelper.mjs +43 -2
- package/dist/components/StyleInspector/Inspector.d.ts +2 -1
- package/dist/components/StyleInspector/Inspector.mjs +92 -87
- package/dist/components/StyleInspector/StyleInspector.mjs +240 -169
- package/dist/components/StyleInspector/StyleInspectorContext.d.ts +1 -0
- package/dist/components/StyleInspector/StyleInspectorProvider.d.ts +2 -1
- package/dist/components/StyleInspector/StyleInspectorProvider.mjs +37 -31
- package/dist/components/StyleInspector/categories/Others/Others.mjs +58 -48
- package/dist/components/StyleInspector/categories/Others/OthersScrollbar.d.ts +9 -0
- package/dist/components/StyleInspector/categories/Others/OthersScrollbar.mjs +36 -0
- package/dist/components/StyleInspector/categories/Typography/Typography.mjs +29 -45
- package/dist/components/StyleInspector/categories/Typography/TypographyFigures.d.ts +13 -0
- package/dist/components/StyleInspector/categories/Typography/TypographyFigures.mjs +61 -0
- package/dist/components/StyleInspector/components/AncestorRules/AncestorRuleChip.d.ts +10 -0
- package/dist/components/StyleInspector/components/AncestorRules/AncestorRuleChip.mjs +39 -0
- package/dist/components/StyleInspector/components/AncestorRules/AncestorRules.d.ts +14 -0
- package/dist/components/StyleInspector/components/AncestorRules/AncestorRules.mjs +36 -0
- package/dist/components/StyleInspector/components/AncestorRules/index.d.ts +3 -0
- package/dist/components/StyleInspector/components/AncestorRules/index.mjs +5 -0
- package/dist/components/StyleInspector/helpers.d.ts +36 -0
- package/dist/components/StyleInspector/helpers.mjs +54 -0
- package/dist/components/StyleInspector/hooks/useStyleInherit.d.ts +2 -1
- package/dist/components/StyleInspector/hooks/useStyleInherit.mjs +7 -5
- package/dist/components/StyleManager/ManagerSelector.d.ts +3 -2
- package/dist/components/StyleManager/ManagerSelector.mjs +114 -86
- package/dist/components/StyleManager/StyleManager.mjs +1 -0
- package/dist/components/StyleManager/StyleSelectorTag.d.ts +4 -1
- package/dist/components/StyleManager/StyleSelectorTag.mjs +36 -22
- package/dist/helpers/calculateInheriting.d.ts +1 -0
- package/dist/helpers/calculateInheriting.mjs +38 -28
- package/dist/helpers/processSelector.mjs +44 -21
- package/dist/helpers/processSelectorAttributes.d.ts +14 -6
- package/dist/helpers/processSelectorAttributes.mjs +38 -22
- package/package.json +18 -6
|
@@ -5,12 +5,13 @@ import r from "../../components/CategoryContainer/index.mjs";
|
|
|
5
5
|
import i from "./OthersForm.mjs";
|
|
6
6
|
import a from "./OthersInteraction.mjs";
|
|
7
7
|
import o from "./OthersOutline.mjs";
|
|
8
|
-
import s from "./
|
|
9
|
-
import c from "./
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
8
|
+
import s from "./OthersScrollbar.mjs";
|
|
9
|
+
import c from "./OthersSvg.mjs";
|
|
10
|
+
import l from "./OthersTable.mjs";
|
|
11
|
+
import { memo as u, use as d, useCallback as f } from "react";
|
|
12
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
12
13
|
//#region src/components/StyleInspector/categories/Others/Others.tsx
|
|
13
|
-
var
|
|
14
|
+
var h = [
|
|
14
15
|
"pointer-events",
|
|
15
16
|
"user-select",
|
|
16
17
|
"touch-action",
|
|
@@ -21,6 +22,8 @@ var m = [
|
|
|
21
22
|
"accent-color",
|
|
22
23
|
"caret-color",
|
|
23
24
|
"color-scheme",
|
|
25
|
+
"scrollbar-width",
|
|
26
|
+
"scrollbar-color",
|
|
24
27
|
"outline-width",
|
|
25
28
|
"outline-style",
|
|
26
29
|
"outline-color",
|
|
@@ -31,7 +34,7 @@ var m = [
|
|
|
31
34
|
"fill",
|
|
32
35
|
"stroke",
|
|
33
36
|
"stroke-width"
|
|
34
|
-
],
|
|
37
|
+
], g = [
|
|
35
38
|
"touch-action",
|
|
36
39
|
"resize",
|
|
37
40
|
"appearance",
|
|
@@ -40,64 +43,71 @@ var m = [
|
|
|
40
43
|
"accent-color",
|
|
41
44
|
"caret-color",
|
|
42
45
|
"color-scheme",
|
|
46
|
+
"scrollbar-width",
|
|
47
|
+
"scrollbar-color",
|
|
43
48
|
"border-collapse",
|
|
44
49
|
"border-spacing",
|
|
45
50
|
"table-layout",
|
|
46
51
|
"fill",
|
|
47
52
|
"stroke",
|
|
48
53
|
"stroke-width"
|
|
49
|
-
],
|
|
50
|
-
let { setValue:
|
|
51
|
-
keys:
|
|
54
|
+
], _ = u(({ replaceTokens: u = !1, isCollapsed: _ = !0, onCollapse: v }) => {
|
|
55
|
+
let { setValue: y } = d(e), { "pointer-events": b, "user-select": x, "touch-action": S, resize: C, appearance: w, "scroll-behavior": T, "overscroll-behavior": E, "accent-color": D, "caret-color": O, "color-scheme": k, "scrollbar-width": A, "scrollbar-color": j, "outline-width": M, "outline-style": N, "outline-color": P, "outline-offset": F, "border-collapse": I, "border-spacing": L, "table-layout": R, fill: z, stroke: B, "stroke-width": V } = t({
|
|
56
|
+
keys: h,
|
|
52
57
|
asValue: !0,
|
|
53
|
-
replaceTokens:
|
|
54
|
-
}),
|
|
55
|
-
return /* @__PURE__ */
|
|
58
|
+
replaceTokens: u
|
|
59
|
+
}), H = f((e) => v?.("others", e), [v]), U = f((e) => (t) => y(e, t), [y]);
|
|
60
|
+
return /* @__PURE__ */ m(r, {
|
|
56
61
|
title: "Others",
|
|
57
|
-
dotKeys:
|
|
58
|
-
advancedKeys:
|
|
59
|
-
isCollapsed:
|
|
60
|
-
onCollapse:
|
|
62
|
+
dotKeys: h,
|
|
63
|
+
advancedKeys: g,
|
|
64
|
+
isCollapsed: _,
|
|
65
|
+
onCollapse: H,
|
|
61
66
|
children: [
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
pointerEvents:
|
|
64
|
-
userSelect:
|
|
65
|
-
touchAction:
|
|
66
|
-
resize:
|
|
67
|
-
appearance:
|
|
68
|
-
scrollBehavior:
|
|
69
|
-
overscrollBehavior:
|
|
70
|
-
onChange:
|
|
67
|
+
/* @__PURE__ */ p(a, {
|
|
68
|
+
pointerEvents: b,
|
|
69
|
+
userSelect: x,
|
|
70
|
+
touchAction: S,
|
|
71
|
+
resize: C,
|
|
72
|
+
appearance: w,
|
|
73
|
+
scrollBehavior: T,
|
|
74
|
+
overscrollBehavior: E,
|
|
75
|
+
onChange: U
|
|
71
76
|
}),
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
-
outlineWidth:
|
|
74
|
-
outlineStyle:
|
|
75
|
-
outlineColor:
|
|
76
|
-
outlineOffset:
|
|
77
|
-
onChange:
|
|
77
|
+
/* @__PURE__ */ p(o, {
|
|
78
|
+
outlineWidth: M,
|
|
79
|
+
outlineStyle: N,
|
|
80
|
+
outlineColor: P,
|
|
81
|
+
outlineOffset: F,
|
|
82
|
+
onChange: U
|
|
78
83
|
}),
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
onChange: B
|
|
84
|
+
/* @__PURE__ */ m(n, { children: [
|
|
85
|
+
/* @__PURE__ */ p(s, {
|
|
86
|
+
scrollbarWidth: A,
|
|
87
|
+
scrollbarColor: j,
|
|
88
|
+
onChange: U
|
|
85
89
|
}),
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
onChange:
|
|
90
|
+
/* @__PURE__ */ p(i, {
|
|
91
|
+
accentColor: D,
|
|
92
|
+
caretColor: O,
|
|
93
|
+
colorScheme: k,
|
|
94
|
+
onChange: U
|
|
91
95
|
}),
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
onChange:
|
|
96
|
+
/* @__PURE__ */ p(l, {
|
|
97
|
+
borderCollapse: I,
|
|
98
|
+
borderSpacing: L,
|
|
99
|
+
tableLayout: R,
|
|
100
|
+
onChange: U
|
|
101
|
+
}),
|
|
102
|
+
/* @__PURE__ */ p(c, {
|
|
103
|
+
fill: z,
|
|
104
|
+
stroke: B,
|
|
105
|
+
strokeWidth: V,
|
|
106
|
+
onChange: U
|
|
97
107
|
})
|
|
98
108
|
] })
|
|
99
109
|
]
|
|
100
110
|
});
|
|
101
111
|
});
|
|
102
112
|
//#endregion
|
|
103
|
-
export {
|
|
113
|
+
export { _ as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StyleCategory, StyleValue } from '@plitzi/sdk-shared';
|
|
2
|
+
export type OthersScrollbarProps = {
|
|
3
|
+
scrollbarWidth?: StyleValue;
|
|
4
|
+
scrollbarColor?: StyleValue;
|
|
5
|
+
onChange?: (category: StyleCategory) => (value: StyleValue | Record<StyleCategory, StyleValue> | boolean) => void;
|
|
6
|
+
};
|
|
7
|
+
/** How a scrolling element's scrollbar looks: thin or hidden, and the thumb and track colours — in that order. */
|
|
8
|
+
declare const OthersScrollbar: ({ scrollbarWidth, scrollbarColor, onChange }: OthersScrollbarProps) => import("react").JSX.Element;
|
|
9
|
+
export default OthersScrollbar;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import e from "../../components/CategoryOption/index.mjs";
|
|
2
|
+
import t from "../../components/CategorySection/index.mjs";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/StyleInspector/categories/Others/OthersScrollbar.tsx
|
|
5
|
+
var i = ({ scrollbarWidth: i, scrollbarColor: a, onChange: o }) => /* @__PURE__ */ r(t, {
|
|
6
|
+
label: "",
|
|
7
|
+
children: [/* @__PURE__ */ r(e, {
|
|
8
|
+
keys: ["scrollbar-width"],
|
|
9
|
+
label: "Scrollbar",
|
|
10
|
+
value: i,
|
|
11
|
+
onChange: o?.("scrollbar-width"),
|
|
12
|
+
type: "select",
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ n("option", {
|
|
15
|
+
value: "auto",
|
|
16
|
+
children: "Auto"
|
|
17
|
+
}),
|
|
18
|
+
/* @__PURE__ */ n("option", {
|
|
19
|
+
value: "thin",
|
|
20
|
+
children: "Thin"
|
|
21
|
+
}),
|
|
22
|
+
/* @__PURE__ */ n("option", {
|
|
23
|
+
value: "none",
|
|
24
|
+
children: "Hidden"
|
|
25
|
+
})
|
|
26
|
+
]
|
|
27
|
+
}), /* @__PURE__ */ n(e, {
|
|
28
|
+
keys: ["scrollbar-color"],
|
|
29
|
+
label: "Thumb / Track",
|
|
30
|
+
value: a,
|
|
31
|
+
onChange: o?.("scrollbar-color"),
|
|
32
|
+
type: "input"
|
|
33
|
+
})]
|
|
34
|
+
});
|
|
35
|
+
//#endregion
|
|
36
|
+
export { i as default };
|
|
@@ -4,10 +4,11 @@ import n from "../../components/CategoryOption/index.mjs";
|
|
|
4
4
|
import r from "../../components/CategorySection/index.mjs";
|
|
5
5
|
import i from "../../components/CategoryAdvanced/index.mjs";
|
|
6
6
|
import a from "../../components/CategoryContainer/index.mjs";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { weights as
|
|
7
|
+
import ee from "./TypographyAlign.mjs";
|
|
8
|
+
import o from "./TypographyBreaking.mjs";
|
|
9
|
+
import s from "./TypographyClamp.mjs";
|
|
10
|
+
import { weights as c } from "./TypographyConstants.mjs";
|
|
11
|
+
import l from "./TypographyFigures.mjs";
|
|
11
12
|
import u from "../../../../hooks/useSpaceFonts.mjs";
|
|
12
13
|
import d from "./TypographyFont.mjs";
|
|
13
14
|
import f from "./TypographyStyle.mjs";
|
|
@@ -17,57 +18,35 @@ import { memo as h, use as g, useCallback as _ } from "react";
|
|
|
17
18
|
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
18
19
|
import { primaryFamily as b } from "@plitzi/sdk-shared/style";
|
|
19
20
|
//#region src/components/StyleInspector/categories/Typography/Typography.tsx
|
|
20
|
-
var x = [
|
|
21
|
-
"font-family",
|
|
22
|
-
"font-weight",
|
|
23
|
-
"font-size",
|
|
24
|
-
"line-height",
|
|
25
|
-
"color",
|
|
26
|
-
"text-align",
|
|
27
|
-
"font-style",
|
|
28
|
-
"text-decoration",
|
|
21
|
+
var x = /* @__PURE__ */ "font-family.font-weight.font-size.line-height.color.text-align.font-style.text-decoration.text-decoration-thickness.text-underline-offset.letter-spacing.word-spacing.text-indent.text-transform.direction.text-shadow.white-space.text-wrap.word-break.overflow-wrap.hyphens.vertical-align.text-overflow.line-clamp.font-variant-numeric.font-feature-settings.-webkit-text-fill-color".split("."), S = [
|
|
29
22
|
"text-decoration-thickness",
|
|
30
23
|
"text-underline-offset",
|
|
31
|
-
"letter-spacing",
|
|
32
|
-
"word-spacing",
|
|
33
|
-
"text-indent",
|
|
34
|
-
"text-transform",
|
|
35
|
-
"direction",
|
|
36
|
-
"text-shadow",
|
|
37
|
-
"white-space",
|
|
38
|
-
"text-wrap",
|
|
39
24
|
"word-break",
|
|
40
25
|
"overflow-wrap",
|
|
41
26
|
"hyphens",
|
|
42
27
|
"vertical-align",
|
|
43
|
-
"text-
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
"text-
|
|
47
|
-
"text-underline-offset",
|
|
48
|
-
"word-break",
|
|
49
|
-
"overflow-wrap",
|
|
50
|
-
"hyphens",
|
|
51
|
-
"vertical-align",
|
|
52
|
-
"text-shadow"
|
|
28
|
+
"text-shadow",
|
|
29
|
+
"font-variant-numeric",
|
|
30
|
+
"font-feature-settings",
|
|
31
|
+
"-webkit-text-fill-color"
|
|
53
32
|
], C = [
|
|
54
33
|
"letter-spacing",
|
|
55
34
|
"word-spacing",
|
|
56
35
|
"text-indent"
|
|
57
36
|
], w = h(({ replaceTokens: h = !1, isCollapsed: w = !0, onCollapse: T }) => {
|
|
58
|
-
let E = u(), { setValue: D } = g(e), { "font-family": O, "font-weight": k, "font-size": A, "font-style": j, "text-align": M, "text-decoration": N, "text-decoration-thickness": P, "text-underline-offset":
|
|
37
|
+
let E = u(), { setValue: D } = g(e), { "font-family": O, "font-weight": k, "font-size": A, "font-style": j, "text-align": M, "text-decoration": N, "text-decoration-thickness": P, "text-underline-offset": te, "text-indent": F, "text-transform": I, "text-shadow": L, "white-space": R, "text-wrap": z, "word-break": B, "overflow-wrap": V, hyphens: H, "vertical-align": U, "text-overflow": W, "line-clamp": G, "line-height": K, color: q, "letter-spacing": J, "word-spacing": Y, direction: X, "font-variant-numeric": Z, "font-feature-settings": Q, "-webkit-text-fill-color": ne } = t({
|
|
59
38
|
keys: x,
|
|
60
39
|
asValue: !0,
|
|
61
40
|
replaceTokens: h
|
|
62
|
-
}),
|
|
41
|
+
}), re = _((e) => T?.("typography", e), [T]), ie = E.find((e) => e.family === b(typeof O == "string" ? O : "")), $ = _((e) => (t) => D(e, t), [D]), ae = _((e) => D(void 0, e), [D]);
|
|
63
42
|
return /* @__PURE__ */ y(a, {
|
|
64
43
|
title: "Typography",
|
|
65
44
|
dotKeys: x,
|
|
66
45
|
advancedKeys: S,
|
|
67
46
|
isCollapsed: w,
|
|
68
|
-
onCollapse:
|
|
47
|
+
onCollapse: re,
|
|
69
48
|
children: [
|
|
70
|
-
/* @__PURE__ */ v(
|
|
49
|
+
/* @__PURE__ */ v(ee, {
|
|
71
50
|
partialValue: M,
|
|
72
51
|
onChange: $("text-align")
|
|
73
52
|
}),
|
|
@@ -83,10 +62,10 @@ var x = [
|
|
|
83
62
|
value: k,
|
|
84
63
|
onChange: $("font-weight"),
|
|
85
64
|
type: "select",
|
|
86
|
-
children: Object.keys(
|
|
65
|
+
children: Object.keys(c).map((e) => /* @__PURE__ */ v("option", {
|
|
87
66
|
value: e,
|
|
88
|
-
disabled: !
|
|
89
|
-
children:
|
|
67
|
+
disabled: !ie?.weights.includes(Number(e)),
|
|
68
|
+
children: c[Number(e)]
|
|
90
69
|
}, e))
|
|
91
70
|
}), /* @__PURE__ */ v(n, {
|
|
92
71
|
keys: ["color"],
|
|
@@ -116,7 +95,7 @@ var x = [
|
|
|
116
95
|
fontStyle: j,
|
|
117
96
|
textDecoration: N,
|
|
118
97
|
textDecorationThickness: P,
|
|
119
|
-
textUnderlineOffset:
|
|
98
|
+
textUnderlineOffset: te,
|
|
120
99
|
onChange: $
|
|
121
100
|
}),
|
|
122
101
|
/* @__PURE__ */ y(r, {
|
|
@@ -140,7 +119,7 @@ var x = [
|
|
|
140
119
|
/* @__PURE__ */ v(n, {
|
|
141
120
|
keys: ["text-indent"],
|
|
142
121
|
label: "Indent",
|
|
143
|
-
value:
|
|
122
|
+
value: F,
|
|
144
123
|
onChange: $("text-indent"),
|
|
145
124
|
type: "metric"
|
|
146
125
|
})
|
|
@@ -151,7 +130,7 @@ var x = [
|
|
|
151
130
|
direction: X,
|
|
152
131
|
onChange: $
|
|
153
132
|
}),
|
|
154
|
-
/* @__PURE__ */ v(
|
|
133
|
+
/* @__PURE__ */ v(o, {
|
|
155
134
|
whiteSpace: R,
|
|
156
135
|
textWrap: z,
|
|
157
136
|
wordBreak: B,
|
|
@@ -190,15 +169,20 @@ var x = [
|
|
|
190
169
|
children: "Inherit"
|
|
191
170
|
})
|
|
192
171
|
]
|
|
193
|
-
}), /* @__PURE__ */ v(
|
|
172
|
+
}), /* @__PURE__ */ v(s, {
|
|
194
173
|
value: G,
|
|
195
|
-
onChange:
|
|
174
|
+
onChange: ae
|
|
196
175
|
})]
|
|
197
176
|
}),
|
|
198
|
-
/* @__PURE__ */
|
|
177
|
+
/* @__PURE__ */ y(i, { children: [/* @__PURE__ */ v(p, {
|
|
199
178
|
value: L,
|
|
200
179
|
onChange: $("text-shadow")
|
|
201
|
-
})
|
|
180
|
+
}), /* @__PURE__ */ v(l, {
|
|
181
|
+
fontVariantNumeric: Z,
|
|
182
|
+
fontFeatureSettings: Q,
|
|
183
|
+
textFillColor: ne,
|
|
184
|
+
onChange: $
|
|
185
|
+
})] })
|
|
202
186
|
]
|
|
203
187
|
});
|
|
204
188
|
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StyleCategory, StyleValue } from '@plitzi/sdk-shared';
|
|
2
|
+
export type TypographyFiguresProps = {
|
|
3
|
+
fontVariantNumeric?: StyleValue;
|
|
4
|
+
fontFeatureSettings?: StyleValue;
|
|
5
|
+
textFillColor?: StyleValue;
|
|
6
|
+
onChange?: (category: StyleCategory) => (value: StyleValue | Record<StyleCategory, StyleValue> | boolean) => void;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* How figures and glyphs are drawn: numbers that line up in a column, the font's own optional features, and the fill
|
|
10
|
+
* that text painted with its background (`background-clip: text`) needs made transparent.
|
|
11
|
+
*/
|
|
12
|
+
declare const TypographyFigures: ({ fontVariantNumeric, fontFeatureSettings, textFillColor, onChange }: TypographyFiguresProps) => import("react").JSX.Element;
|
|
13
|
+
export default TypographyFigures;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import e from "../../components/CategoryOption/index.mjs";
|
|
2
|
+
import t from "../../components/CategorySection/index.mjs";
|
|
3
|
+
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/StyleInspector/categories/Typography/TypographyFigures.tsx
|
|
5
|
+
var a = ({ fontVariantNumeric: a, fontFeatureSettings: o, textFillColor: s, onChange: c }) => /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ i(t, {
|
|
6
|
+
label: "",
|
|
7
|
+
children: [/* @__PURE__ */ i(e, {
|
|
8
|
+
keys: ["font-variant-numeric"],
|
|
9
|
+
label: "Numbers",
|
|
10
|
+
value: a,
|
|
11
|
+
onChange: c?.("font-variant-numeric"),
|
|
12
|
+
type: "select",
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ r("option", {
|
|
15
|
+
value: "normal",
|
|
16
|
+
children: "Normal"
|
|
17
|
+
}),
|
|
18
|
+
/* @__PURE__ */ r("option", {
|
|
19
|
+
value: "tabular-nums",
|
|
20
|
+
children: "Tabular"
|
|
21
|
+
}),
|
|
22
|
+
/* @__PURE__ */ r("option", {
|
|
23
|
+
value: "proportional-nums",
|
|
24
|
+
children: "Proportional"
|
|
25
|
+
}),
|
|
26
|
+
/* @__PURE__ */ r("option", {
|
|
27
|
+
value: "lining-nums",
|
|
28
|
+
children: "Lining"
|
|
29
|
+
}),
|
|
30
|
+
/* @__PURE__ */ r("option", {
|
|
31
|
+
value: "oldstyle-nums",
|
|
32
|
+
children: "Old style"
|
|
33
|
+
}),
|
|
34
|
+
/* @__PURE__ */ r("option", {
|
|
35
|
+
value: "slashed-zero",
|
|
36
|
+
children: "Slashed zero"
|
|
37
|
+
}),
|
|
38
|
+
/* @__PURE__ */ r("option", {
|
|
39
|
+
value: "tabular-nums slashed-zero",
|
|
40
|
+
children: "Tabular, slashed zero"
|
|
41
|
+
})
|
|
42
|
+
]
|
|
43
|
+
}), /* @__PURE__ */ r(e, {
|
|
44
|
+
keys: ["-webkit-text-fill-color"],
|
|
45
|
+
label: "Text Fill",
|
|
46
|
+
type: "color",
|
|
47
|
+
value: s,
|
|
48
|
+
onChange: c?.("-webkit-text-fill-color")
|
|
49
|
+
})]
|
|
50
|
+
}), /* @__PURE__ */ r(t, {
|
|
51
|
+
label: "",
|
|
52
|
+
children: /* @__PURE__ */ r(e, {
|
|
53
|
+
keys: ["font-feature-settings"],
|
|
54
|
+
label: "Font Features",
|
|
55
|
+
value: o,
|
|
56
|
+
onChange: c?.("font-feature-settings"),
|
|
57
|
+
type: "input"
|
|
58
|
+
})
|
|
59
|
+
})] });
|
|
60
|
+
//#endregion
|
|
61
|
+
export { a as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AncestorCondition } from '../../helpers';
|
|
2
|
+
export type AncestorRuleChipProps = {
|
|
3
|
+
condition: AncestorCondition;
|
|
4
|
+
active?: boolean;
|
|
5
|
+
unused?: boolean;
|
|
6
|
+
onSelect?: (condition: AncestorCondition) => void;
|
|
7
|
+
onRemove?: (condition: AncestorCondition) => void;
|
|
8
|
+
};
|
|
9
|
+
declare const _default: import('react').MemoExoticComponent<({ condition, active, unused, onSelect, onRemove }: AncestorRuleChipProps) => import("react").JSX.Element>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,39 @@
|
|
|
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(({ condition: e, active: a = !1, unused: o = !1, onSelect: s, onRemove: c }) => {
|
|
5
|
+
let l = t(() => s?.(e), [e, s]), u = t(() => c?.(e), [e, c]), d = o ? `No element this selector dresses sits inside .${e.ancestor}, so this rule never matches` : `Edit the rules for inside .${e.ancestor} (${e.label})`;
|
|
6
|
+
return /* @__PURE__ */ r("div", {
|
|
7
|
+
className: i("flex max-w-full items-center overflow-hidden rounded-sm border text-[11px] leading-none", {
|
|
8
|
+
"border-primary-500 bg-primary-500/15 text-primary-700 dark:text-primary-200": a,
|
|
9
|
+
"border-amber-500/70 bg-amber-500/10 text-amber-700 dark:text-amber-300": o && !a,
|
|
10
|
+
"border-gray-300 bg-gray-100 text-zinc-600 dark:border-zinc-600 dark:bg-zinc-800 dark:text-zinc-300": !o && !a
|
|
11
|
+
}),
|
|
12
|
+
children: [/* @__PURE__ */ r("button", {
|
|
13
|
+
type: "button",
|
|
14
|
+
className: "flex min-w-0 items-center gap-1 px-1.5 py-1",
|
|
15
|
+
title: d,
|
|
16
|
+
onClick: l,
|
|
17
|
+
children: [
|
|
18
|
+
o && /* @__PURE__ */ n("i", { className: "fas fa-triangle-exclamation" }),
|
|
19
|
+
/* @__PURE__ */ r("span", {
|
|
20
|
+
className: "truncate",
|
|
21
|
+
children: [".", e.ancestor]
|
|
22
|
+
}),
|
|
23
|
+
/* @__PURE__ */ r("span", {
|
|
24
|
+
className: "opacity-70",
|
|
25
|
+
children: ["· ", e.label]
|
|
26
|
+
})
|
|
27
|
+
]
|
|
28
|
+
}), /* @__PURE__ */ n("button", {
|
|
29
|
+
type: "button",
|
|
30
|
+
className: "cursor-pointer border-l border-inherit px-1.5 py-1 hover:bg-red-500/15 hover:text-red-600 dark:hover:text-red-400",
|
|
31
|
+
title: "Remove this rule",
|
|
32
|
+
"aria-label": `Remove the ${e.label} rule under .${e.ancestor}`,
|
|
33
|
+
onClick: u,
|
|
34
|
+
children: /* @__PURE__ */ n("i", { className: "fas fa-xmark" })
|
|
35
|
+
})]
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
//#endregion
|
|
39
|
+
export { a as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AncestorCondition } from '../../helpers';
|
|
2
|
+
import { StyleState } from '@plitzi/sdk-shared';
|
|
3
|
+
export type AncestorRulesProps = {
|
|
4
|
+
conditions: AncestorCondition[];
|
|
5
|
+
unused: Set<string>;
|
|
6
|
+
activeAncestor?: string;
|
|
7
|
+
activeState?: StyleState;
|
|
8
|
+
activeVariant?: string;
|
|
9
|
+
onSelect?: (condition: AncestorCondition) => void;
|
|
10
|
+
onRemove?: (condition: AncestorCondition) => void;
|
|
11
|
+
onRemoveUnused?: () => void;
|
|
12
|
+
};
|
|
13
|
+
declare const _default: import('react').MemoExoticComponent<({ conditions, unused, activeAncestor, activeState, activeVariant, onSelect, onRemove, onRemoveUnused }: AncestorRulesProps) => import("react").JSX.Element>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import e from "./AncestorRuleChip.mjs";
|
|
2
|
+
import { memo as t } from "react";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
var i = t(({ conditions: t, unused: i, activeAncestor: a, activeState: o, activeVariant: s, onSelect: c, onRemove: l, onRemoveUnused: u }) => /* @__PURE__ */ r("div", {
|
|
5
|
+
className: "flex flex-col gap-1",
|
|
6
|
+
children: [/* @__PURE__ */ r("div", {
|
|
7
|
+
className: "flex items-center justify-between gap-2 text-[11px] text-zinc-500 dark:text-zinc-400",
|
|
8
|
+
children: [/* @__PURE__ */ r("span", { children: [
|
|
9
|
+
/* @__PURE__ */ n("i", { className: "fas fa-sitemap mr-1" }),
|
|
10
|
+
"Ancestor rules (",
|
|
11
|
+
t.length,
|
|
12
|
+
")"
|
|
13
|
+
] }), i.size > 0 && /* @__PURE__ */ r("button", {
|
|
14
|
+
type: "button",
|
|
15
|
+
className: "text-amber-700 hover:underline dark:text-amber-300",
|
|
16
|
+
title: "Remove every rule under an ancestor no element this selector dresses sits inside, at every breakpoint",
|
|
17
|
+
onClick: u,
|
|
18
|
+
children: [
|
|
19
|
+
"Remove unused (",
|
|
20
|
+
i.size,
|
|
21
|
+
")"
|
|
22
|
+
]
|
|
23
|
+
})]
|
|
24
|
+
}), /* @__PURE__ */ n("div", {
|
|
25
|
+
className: "flex flex-wrap gap-1",
|
|
26
|
+
children: t.map((t) => /* @__PURE__ */ n(e, {
|
|
27
|
+
condition: t,
|
|
28
|
+
active: t.ancestor === a && t.state === o && t.variant === s,
|
|
29
|
+
unused: i.has(t.ancestor),
|
|
30
|
+
onSelect: c,
|
|
31
|
+
onRemove: l
|
|
32
|
+
}, `${t.ancestor}:${t.label}`))
|
|
33
|
+
})]
|
|
34
|
+
}));
|
|
35
|
+
//#endregion
|
|
36
|
+
export { i as default };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Option } from '@plitzi/plitzi-ui/Select2';
|
|
2
|
+
import { DisplayMode, Element, Schema, Style, StyleAncestors, StyleItem, StyleState } from '@plitzi/sdk-shared';
|
|
3
|
+
/** The states a selector can react to, as the state picker offers them — from the one list every layer reads. */
|
|
4
|
+
export declare const STYLE_STATE_OPTIONS: Option[];
|
|
5
|
+
/**
|
|
6
|
+
* The classes an element's ancestors carry, closest first: what an "ancestor" condition can name. Only the base slot
|
|
7
|
+
* counts — a slot's class sits on an inner node of that ancestor, not around the element.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ancestorClasses: (flat: Schema["flat"], element?: Element) => string[];
|
|
10
|
+
/** One condition a selector has rules for under an ancestor: inside it always, in a state, a variant or both. */
|
|
11
|
+
export type AncestorCondition = {
|
|
12
|
+
ancestor: string;
|
|
13
|
+
state?: StyleState;
|
|
14
|
+
variant?: string;
|
|
15
|
+
label: string;
|
|
16
|
+
};
|
|
17
|
+
/** Every condition under every ancestor, in the order they are written in the stylesheet. */
|
|
18
|
+
export declare const ancestorConditions: (ancestors?: StyleAncestors) => AncestorCondition[];
|
|
19
|
+
/**
|
|
20
|
+
* The ancestor picker's options: the element's ancestor classes, closest first, then any class the selector already
|
|
21
|
+
* has rules for that is not around this element. The ones with rules say which conditions, so they read at a glance.
|
|
22
|
+
*/
|
|
23
|
+
export declare const ancestorOptions: (candidates: string[], configured?: StyleAncestors) => Option[];
|
|
24
|
+
/**
|
|
25
|
+
* The ancestors a selector has rules for that no element it dresses sits inside — rules that can never match, left
|
|
26
|
+
* behind when a class was renamed or the tree changed. Each wearer's ancestors are walked once.
|
|
27
|
+
*/
|
|
28
|
+
export declare const unusedAncestors: (flat: Schema["flat"], item: StyleItem) => Set<string>;
|
|
29
|
+
/** One `styleUpdateSelector` that drops every rule under an ancestor, in one slot at one breakpoint. */
|
|
30
|
+
export type AncestorRemoval = {
|
|
31
|
+
displayMode: DisplayMode;
|
|
32
|
+
styleSelector: string;
|
|
33
|
+
styleAncestor: string;
|
|
34
|
+
};
|
|
35
|
+
/** Where a selector has rules under any of `ancestors`, at every breakpoint and slot: what purging them takes. */
|
|
36
|
+
export declare const ancestorRemovals: (platform: Style["platform"], name: string, ancestors: Set<string>) => AncestorRemoval[];
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { STYLE_STATES as e, STYLE_STATE_LABELS as t, inCascadeOrder as n, isKnownState as r } from "@plitzi/sdk-shared/style/styleStates";
|
|
2
|
+
//#region src/components/StyleInspector/helpers.ts
|
|
3
|
+
var i = e.map((e) => ({
|
|
4
|
+
label: t[e],
|
|
5
|
+
value: e
|
|
6
|
+
})), a = (e, t) => {
|
|
7
|
+
let n = /* @__PURE__ */ new Set(), r = t?.definition.parentId, i = r ? e[r] : void 0;
|
|
8
|
+
for (; i;) {
|
|
9
|
+
for (let e of i.definition.styleSelectors.base.split(" ")) e && n.add(e);
|
|
10
|
+
let t = i.definition.parentId;
|
|
11
|
+
i = t ? e[t] : void 0;
|
|
12
|
+
}
|
|
13
|
+
return [...n];
|
|
14
|
+
}, o = (e) => !!e && Object.keys(e).length > 0, s = (e) => n(e ?? {}).filter(([, e]) => o(e)).map(([e]) => e).filter(r), c = (e = {}) => Object.entries(e).flatMap(([e, { default: t, states: n, variants: r }]) => [
|
|
15
|
+
...o(t) ? [{
|
|
16
|
+
ancestor: e,
|
|
17
|
+
label: "inside"
|
|
18
|
+
}] : [],
|
|
19
|
+
...s(n).map((t) => ({
|
|
20
|
+
ancestor: e,
|
|
21
|
+
state: t,
|
|
22
|
+
label: t
|
|
23
|
+
})),
|
|
24
|
+
...Object.entries(r ?? {}).flatMap(([t, n]) => [...o(n.default) ? [{
|
|
25
|
+
ancestor: e,
|
|
26
|
+
variant: t,
|
|
27
|
+
label: t
|
|
28
|
+
}] : [], ...s(n.states).map((n) => ({
|
|
29
|
+
ancestor: e,
|
|
30
|
+
variant: t,
|
|
31
|
+
state: n,
|
|
32
|
+
label: `${t}:${n}`
|
|
33
|
+
}))])
|
|
34
|
+
]), l = (e, t = {}) => {
|
|
35
|
+
let n = c(t);
|
|
36
|
+
return [.../* @__PURE__ */ new Set([...e, ...Object.keys(t)])].map((e) => {
|
|
37
|
+
let t = n.filter((t) => t.ancestor === e).map((e) => e.label);
|
|
38
|
+
return {
|
|
39
|
+
label: t.length ? `.${e} — ${t.join(", ")}` : `.${e}`,
|
|
40
|
+
value: e
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
}, u = (e, t) => Object.values(e).filter((e) => t.type === "element" ? e.definition.type === (t.componentType ?? t.name) : Object.values(e.definition.styleSelectors).some((e) => e.split(" ").includes(t.name))), d = (e, t) => {
|
|
44
|
+
let n = new Set(Object.values(t.attributes).flatMap((e) => Object.keys(e.ancestors ?? {})));
|
|
45
|
+
if (!n.size) return n;
|
|
46
|
+
for (let r of u(e, t)) if (a(e, r).forEach((e) => n.delete(e)), !n.size) break;
|
|
47
|
+
return n;
|
|
48
|
+
}, f = (e, t, n) => Object.keys(e).flatMap((r) => Object.entries(e[r][t]?.attributes ?? {}).flatMap(([e, t]) => Object.keys(t.ancestors ?? {}).filter((e) => n.has(e)).map((t) => ({
|
|
49
|
+
displayMode: r,
|
|
50
|
+
styleSelector: e,
|
|
51
|
+
styleAncestor: t
|
|
52
|
+
}))));
|
|
53
|
+
//#endregion
|
|
54
|
+
export { i as STYLE_STATE_OPTIONS, a as ancestorClasses, c as ancestorConditions, l as ancestorOptions, f as ancestorRemovals, d as unusedAncestors };
|
|
@@ -7,6 +7,7 @@ export type UseStyleInheritProps = {
|
|
|
7
7
|
styleSelector?: string;
|
|
8
8
|
styleState?: StyleState;
|
|
9
9
|
styleVariant?: string;
|
|
10
|
+
styleAncestor?: string;
|
|
10
11
|
};
|
|
11
|
-
declare const useStyleInherit: ({ element, componentType, componentSubType, selector, styleSelector, styleState, styleVariant }: UseStyleInheritProps) => import('../../..').InheritData;
|
|
12
|
+
declare const useStyleInherit: ({ element, componentType, componentSubType, selector, styleSelector, styleState, styleVariant, styleAncestor }: UseStyleInheritProps) => import('../../..').InheritData;
|
|
12
13
|
export default useStyleInherit;
|