@plitzi/sdk-style 0.38.10 → 0.38.11
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 +180 -0
- package/dist/components/InputEasing/InputEasingButton.mjs +1 -1
- package/dist/components/InputEasing/InputEasingList.mjs +5 -5
- package/dist/components/Selector/Selector.mjs +2 -1
- package/dist/components/Selector/SelectorItem/ItemOptions.mjs +45 -41
- package/dist/components/Selector/SelectorItem/SelectorItem.mjs +4 -4
- package/dist/components/Selector/SelectorItem/helpers.d.ts +2 -0
- package/dist/components/Selector/SelectorItem/helpers.mjs +4 -0
- package/dist/components/StyleInspector/Inspector.mjs +185 -171
- package/dist/components/StyleInspector/InspectorSearchContext.d.ts +3 -0
- package/dist/components/StyleInspector/InspectorSearchContext.mjs +6 -0
- package/dist/components/StyleInspector/StyleInspector.mjs +154 -128
- package/dist/components/StyleInspector/categories/Background/Background.mjs +82 -114
- package/dist/components/StyleInspector/categories/Background/components/BackgroundAttachment/BackgroundAttachment.d.ts +8 -0
- package/dist/components/StyleInspector/categories/Background/components/BackgroundAttachment/BackgroundAttachment.mjs +53 -0
- package/dist/components/StyleInspector/categories/Background/components/BackgroundAttachment/index.d.ts +3 -0
- package/dist/components/StyleInspector/categories/Background/components/BackgroundAttachment/index.mjs +5 -0
- package/dist/components/StyleInspector/categories/Background/components/BackgroundLayer/BackgroundLayer.mjs +159 -153
- package/dist/components/StyleInspector/categories/Background/components/BackgroundLayer/helpers.d.ts +11 -0
- package/dist/components/StyleInspector/categories/Background/components/BackgroundLayer/helpers.mjs +45 -0
- package/dist/components/StyleInspector/categories/Background/components/BackgroundPosition/BackgroundPosition.mjs +26 -23
- package/dist/components/StyleInspector/categories/Background/components/BackgroundSize/BackgroundSize.mjs +65 -56
- package/dist/components/StyleInspector/categories/Background/components/BackgroundSize/helpers.d.ts +4 -0
- package/dist/components/StyleInspector/categories/Background/components/BackgroundSize/helpers.mjs +8 -0
- package/dist/components/StyleInspector/categories/Background/components/BackgroundTile/BackgroundTile.mjs +28 -27
- package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/GradientPreviewBar.d.ts +4 -2
- package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/GradientPreviewBar.mjs +19 -18
- package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/GradientStopBar.d.ts +4 -0
- package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/GradientStopBar.mjs +48 -80
- package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/GradientStopEditor.d.ts +5 -3
- package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/GradientStopEditor.mjs +51 -41
- package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/GradientStopHandle.d.ts +5 -1
- package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/GradientStopHandle.mjs +54 -32
- package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/GradientStopTrack.d.ts +3 -1
- package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/GradientStopTrack.mjs +14 -13
- package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/helpers.d.ts +8 -0
- package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/helpers.mjs +8 -0
- package/dist/components/StyleInspector/categories/Background/components/LayerGroup/LayerGroup.d.ts +8 -0
- package/dist/components/StyleInspector/categories/Background/components/LayerGroup/LayerGroup.mjs +11 -0
- package/dist/components/StyleInspector/categories/Background/components/LayerGroup/index.d.ts +3 -0
- package/dist/components/StyleInspector/categories/Background/components/LayerGroup/index.mjs +5 -0
- package/dist/components/StyleInspector/categories/Background/helpers/backgroundParser.d.ts +21 -7
- package/dist/components/StyleInspector/categories/Background/helpers/backgroundParser.mjs +114 -113
- package/dist/components/StyleInspector/categories/Background/helpers/layerValues.d.ts +8 -0
- package/dist/components/StyleInspector/categories/Background/helpers/layerValues.mjs +11 -0
- package/dist/components/StyleInspector/categories/Background/modes/ConicGradientMode.mjs +52 -87
- package/dist/components/StyleInspector/categories/Background/modes/ImageMode.mjs +16 -77
- package/dist/components/StyleInspector/categories/Background/modes/LinearGradientMode.mjs +19 -62
- package/dist/components/StyleInspector/categories/Background/modes/RadialGradientMode.mjs +79 -97
- package/dist/components/StyleInspector/categories/Background/modes/RawMode.d.ts +8 -0
- package/dist/components/StyleInspector/categories/Background/modes/RawMode.mjs +22 -0
- package/dist/components/StyleInspector/categories/Background/modes/helpers.d.ts +19 -0
- package/dist/components/StyleInspector/categories/Background/modes/helpers.mjs +54 -0
- package/dist/components/StyleInspector/categories/Border/Border.mjs +26 -43
- package/dist/components/StyleInspector/categories/Border/BorderPlacements.mjs +60 -51
- package/dist/components/StyleInspector/categories/Display/Display.mjs +32 -49
- package/dist/components/StyleInspector/categories/DisplayFlexChild/DisplayFlexChild.mjs +33 -38
- package/dist/components/StyleInspector/categories/Effects/BoxShadow/BoxShadow.mjs +21 -33
- package/dist/components/StyleInspector/categories/Effects/Effects.mjs +131 -154
- package/dist/components/StyleInspector/categories/Effects/Filters/Filter.mjs +23 -31
- package/dist/components/StyleInspector/categories/Effects/Filters/FilterItem.d.ts +9 -5
- package/dist/components/StyleInspector/categories/Effects/Filters/FilterItem.mjs +57 -124
- package/dist/components/StyleInspector/categories/Effects/Filters/helpers.d.ts +25 -0
- package/dist/components/StyleInspector/categories/Effects/Filters/helpers.mjs +87 -0
- package/dist/components/StyleInspector/categories/Effects/Transform/Transform.mjs +18 -28
- package/dist/components/StyleInspector/categories/Effects/Transform/TransformItem.d.ts +1 -2
- package/dist/components/StyleInspector/categories/Effects/Transform/TransformItem.mjs +52 -76
- package/dist/components/StyleInspector/categories/Effects/Transform/transformFunctions.d.ts +5 -0
- package/dist/components/StyleInspector/categories/Effects/Transform/transformFunctions.mjs +8 -2
- package/dist/components/StyleInspector/categories/Effects/Transition/Transition.mjs +21 -37
- package/dist/components/StyleInspector/categories/Effects/Transition/TransitionEasing.d.ts +10 -0
- package/dist/components/StyleInspector/categories/Effects/Transition/TransitionEasing.mjs +92 -0
- package/dist/components/StyleInspector/categories/Effects/Transition/TransitionItem.d.ts +4 -4
- package/dist/components/StyleInspector/categories/Effects/Transition/TransitionItem.mjs +78 -359
- package/dist/components/StyleInspector/categories/Effects/Transition/helpers.d.ts +39 -0
- package/dist/components/StyleInspector/categories/Effects/Transition/helpers.mjs +268 -0
- package/dist/components/StyleInspector/categories/List/List.mjs +39 -38
- package/dist/components/StyleInspector/categories/ListItem/ListItem.mjs +29 -29
- package/dist/components/StyleInspector/categories/Others/Others.mjs +66 -88
- package/dist/components/StyleInspector/categories/Position/Position.mjs +67 -75
- package/dist/components/StyleInspector/categories/RawStyle/RawStyle.mjs +19 -18
- package/dist/components/StyleInspector/categories/Size/Size.mjs +68 -88
- package/dist/components/StyleInspector/categories/Spacing/Spacing.mjs +18 -27
- package/dist/components/StyleInspector/categories/Spacing/SpacingMargin.mjs +2 -2
- package/dist/components/StyleInspector/categories/Spacing/SpacingPadding.mjs +4 -3
- package/dist/components/StyleInspector/categories/Typography/Typography.mjs +88 -98
- package/dist/components/StyleInspector/categories/Typography/TypographyFont.mjs +1 -1
- package/dist/components/StyleInspector/categories/Typography/TypographyStyle.mjs +1 -1
- package/dist/components/StyleInspector/categories/Typography/TypographyTextShadow.mjs +26 -39
- package/dist/components/StyleInspector/categories/Variables/Variables.mjs +38 -37
- package/dist/components/StyleInspector/categoryKeys.d.ts +45 -0
- package/dist/components/StyleInspector/categoryKeys.mjs +220 -0
- package/dist/components/StyleInspector/components/CategoryContainer/CategoryContainer.mjs +43 -38
- package/dist/components/StyleInspector/components/CategoryOption/categoryTypes/OptionIconGroup.mjs +2 -1
- package/dist/components/StyleInspector/components/CategorySection/CategorySection.mjs +30 -15
- package/dist/components/StyleInspector/components/ColorSwatch/ColorSwatch.d.ts +8 -0
- package/dist/components/StyleInspector/components/ColorSwatch/ColorSwatch.mjs +23 -0
- package/dist/components/StyleInspector/components/ColorSwatch/helpers.d.ts +3 -0
- package/dist/components/StyleInspector/components/ColorSwatch/helpers.mjs +9 -0
- package/dist/components/StyleInspector/components/ColorSwatch/index.d.ts +3 -0
- package/dist/components/StyleInspector/components/ColorSwatch/index.mjs +5 -0
- package/dist/components/StyleInspector/components/InspectorDots/InspectorDots.d.ts +1 -0
- package/dist/components/StyleInspector/components/InspectorDots/InspectorDots.mjs +11 -11
- package/dist/components/StyleInspector/components/InspectorFooter/InspectorFooter.d.ts +11 -0
- package/dist/components/StyleInspector/components/InspectorFooter/InspectorFooter.mjs +38 -0
- package/dist/components/StyleInspector/components/InspectorFooter/helpers.d.ts +2 -0
- package/dist/components/StyleInspector/components/InspectorFooter/helpers.mjs +11 -0
- package/dist/components/StyleInspector/components/InspectorFooter/index.d.ts +3 -0
- package/dist/components/StyleInspector/components/InspectorFooter/index.mjs +5 -0
- package/dist/components/StyleInspector/components/InspectorLabel/InspectorLabel.mjs +34 -31
- package/dist/components/StyleInspector/components/InspectorLabel/helpers.d.ts +17 -0
- package/dist/components/StyleInspector/components/InspectorLabel/helpers.mjs +16 -0
- package/dist/components/StyleInspector/components/InspectorSearch/InspectorSearch.d.ts +7 -0
- package/dist/components/StyleInspector/components/InspectorSearch/InspectorSearch.mjs +24 -0
- package/dist/components/StyleInspector/components/InspectorSearch/index.d.ts +3 -0
- package/dist/components/StyleInspector/components/InspectorSearch/index.mjs +5 -0
- package/dist/components/StyleInspector/components/ShadowItem/ShadowItem.d.ts +9 -0
- package/dist/components/StyleInspector/components/ShadowItem/ShadowItem.mjs +110 -0
- package/dist/components/StyleInspector/components/ShadowItem/index.d.ts +3 -0
- package/dist/components/StyleInspector/components/ShadowItem/index.mjs +5 -0
- package/dist/components/StyleInspector/components/TargetSummary/TargetSummary.d.ts +7 -0
- package/dist/components/StyleInspector/components/TargetSummary/TargetSummary.mjs +24 -0
- package/dist/components/StyleInspector/components/TargetSummary/index.d.ts +3 -0
- package/dist/components/StyleInspector/components/TargetSummary/index.mjs +5 -0
- package/dist/components/StyleInspector/components/ValueList/ValueList.d.ts +12 -0
- package/dist/components/StyleInspector/components/ValueList/ValueList.mjs +25 -0
- package/dist/components/StyleInspector/components/ValueList/index.d.ts +3 -0
- package/dist/components/StyleInspector/components/ValueList/index.mjs +5 -0
- package/dist/components/StyleInspector/components/ValueListItem/ValueListItem.d.ts +16 -0
- package/dist/components/StyleInspector/components/ValueListItem/ValueListItem.mjs +71 -0
- package/dist/components/StyleInspector/components/ValueListItem/index.d.ts +3 -0
- package/dist/components/StyleInspector/components/ValueListItem/index.mjs +5 -0
- package/dist/components/StyleInspector/cssValues.d.ts +15 -0
- package/dist/components/StyleInspector/cssValues.mjs +27 -0
- package/dist/components/StyleInspector/helpers.d.ts +17 -1
- package/dist/components/StyleInspector/helpers.mjs +9 -2
- package/dist/components/StyleInspector/hooks/useInspectorValues.mjs +42 -45
- package/dist/components/StyleInspector/search.d.ts +11 -0
- package/dist/components/StyleInspector/search.mjs +14 -0
- package/dist/components/StyleInspector/shadowValue.d.ts +20 -0
- package/dist/components/StyleInspector/shadowValue.mjs +36 -0
- package/dist/components/StyleManager/StyleSelectorTag.mjs +1 -1
- package/package.json +185 -17
- package/dist/components/StyleInspector/categories/Effects/BoxShadow/BoxShadowItem.d.ts +0 -8
- package/dist/components/StyleInspector/categories/Effects/BoxShadow/BoxShadowItem.mjs +0 -132
- package/dist/components/StyleInspector/categories/Effects/BoxShadow/helpers.d.ts +0 -2
- package/dist/components/StyleInspector/categories/Effects/BoxShadow/helpers.mjs +0 -18
- package/dist/components/StyleInspector/categories/Typography/TypographyTextShadowItem.d.ts +0 -8
- package/dist/components/StyleInspector/categories/Typography/TypographyTextShadowItem.mjs +0 -83
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
export type GradientStop = {
|
|
2
2
|
id: string;
|
|
3
3
|
color: string;
|
|
4
|
+
/** Empty, one position or two (`10% 20%`, a hard band) — as written. */
|
|
4
5
|
position: string;
|
|
5
6
|
};
|
|
6
|
-
|
|
7
|
+
/**
|
|
8
|
+
* What a layer is. `raw` is any image the editor has no controls for — a token standing for it, `image-set()`,
|
|
9
|
+
* `cross-fade()` — kept word for word, so editing another layer never rewrites it into something else.
|
|
10
|
+
*/
|
|
11
|
+
export type BackgroundLayerType = 'none' | 'url' | 'linear-gradient' | 'radial-gradient' | 'conic-gradient' | 'raw';
|
|
7
12
|
export type BackgroundLayer = {
|
|
8
13
|
id: string;
|
|
9
14
|
type: BackgroundLayerType;
|
|
10
15
|
url: string;
|
|
16
|
+
raw: string;
|
|
17
|
+
/** A gradient's `repeating-` form. */
|
|
18
|
+
repeating: boolean;
|
|
19
|
+
/** Empty for CSS's default (to bottom), which is then not written. */
|
|
11
20
|
angle: string;
|
|
12
21
|
radialShape: 'circle' | 'ellipse';
|
|
22
|
+
/** A keyword (`closest-side`…) or an explicit size (`100px`, `40% 20%`). */
|
|
13
23
|
radialExtent: string;
|
|
24
|
+
/** Empty for CSS's default (center). */
|
|
14
25
|
radialPosition: string;
|
|
15
26
|
conicAngle: string;
|
|
16
27
|
conicPosition: string;
|
|
@@ -23,8 +34,17 @@ export type BackgroundLayer = {
|
|
|
23
34
|
clip: string;
|
|
24
35
|
};
|
|
25
36
|
export declare const DEFAULT_STOPS: GradientStop[];
|
|
37
|
+
/** What a layer added in the editor starts as — a gradient or a picture placed once, not tiled. */
|
|
26
38
|
export declare const DEFAULT_LAYER_PROPS: {
|
|
39
|
+
repeat: string;
|
|
40
|
+
size: string;
|
|
41
|
+
positionX: string;
|
|
42
|
+
positionY: string;
|
|
43
|
+
attachment: string;
|
|
44
|
+
clip: string;
|
|
27
45
|
url: string;
|
|
46
|
+
raw: string;
|
|
47
|
+
repeating: boolean;
|
|
28
48
|
angle: string;
|
|
29
49
|
radialShape: "ellipse";
|
|
30
50
|
radialExtent: string;
|
|
@@ -32,12 +52,6 @@ export declare const DEFAULT_LAYER_PROPS: {
|
|
|
32
52
|
conicAngle: string;
|
|
33
53
|
conicPosition: string;
|
|
34
54
|
stops: GradientStop[];
|
|
35
|
-
size: string;
|
|
36
|
-
positionX: string;
|
|
37
|
-
positionY: string;
|
|
38
|
-
repeat: string;
|
|
39
|
-
attachment: string;
|
|
40
|
-
clip: string;
|
|
41
55
|
};
|
|
42
56
|
export declare const newLayerId: () => string;
|
|
43
57
|
export declare const newStopId: () => string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { splitBySpaceOutsideParens as e } from "../../../cssValues.mjs";
|
|
1
2
|
//#region src/components/StyleInspector/categories/Background/helpers/backgroundParser.ts
|
|
2
|
-
var
|
|
3
|
+
var t = [{
|
|
3
4
|
id: "stop-default-0",
|
|
4
5
|
color: "#000000",
|
|
5
6
|
position: "0%"
|
|
@@ -7,161 +8,161 @@ var e = [{
|
|
|
7
8
|
id: "stop-default-1",
|
|
8
9
|
color: "#ffffff",
|
|
9
10
|
position: "100%"
|
|
10
|
-
}],
|
|
11
|
-
url: "",
|
|
12
|
-
angle: "180deg",
|
|
13
|
-
radialShape: "ellipse",
|
|
14
|
-
radialExtent: "farthest-corner",
|
|
15
|
-
radialPosition: "50% 50%",
|
|
16
|
-
conicAngle: "0deg",
|
|
17
|
-
conicPosition: "50% 50%",
|
|
18
|
-
stops: e,
|
|
11
|
+
}], n = {
|
|
19
12
|
size: "auto",
|
|
20
13
|
positionX: "0%",
|
|
21
14
|
positionY: "0%",
|
|
22
|
-
repeat: "
|
|
15
|
+
repeat: "repeat",
|
|
23
16
|
attachment: "scroll",
|
|
24
17
|
clip: "border-box"
|
|
25
|
-
},
|
|
26
|
-
|
|
18
|
+
}, r = {
|
|
19
|
+
url: "",
|
|
20
|
+
raw: "",
|
|
21
|
+
repeating: !1,
|
|
22
|
+
angle: "",
|
|
23
|
+
radialShape: "ellipse",
|
|
24
|
+
radialExtent: "farthest-corner",
|
|
25
|
+
radialPosition: "",
|
|
26
|
+
conicAngle: "0deg",
|
|
27
|
+
conicPosition: "",
|
|
28
|
+
stops: t,
|
|
29
|
+
...n,
|
|
30
|
+
repeat: "no-repeat"
|
|
31
|
+
}, i = 0, a = () => `layer-${++i}`, o = () => `stop-${++i}`;
|
|
32
|
+
function s(e) {
|
|
27
33
|
let t = [], n = 0, r = "";
|
|
28
34
|
for (let i of e) i === "(" ? n++ : i === ")" && n--, i === "," && n === 0 ? (t.push(r.trim()), r = "") : r += i;
|
|
29
35
|
return r.trim() && t.push(r.trim()), t;
|
|
30
36
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
let e = t.slice(r + 1).trim();
|
|
36
|
-
if (/^-?[\d.]/.test(e) || /\d(px|em|rem|%|vw|vh|dvh|dvw|lvh|lvw|fr|ch|ex)$/.test(e)) return {
|
|
37
|
-
color: t.slice(0, r).trim(),
|
|
38
|
-
position: e
|
|
39
|
-
};
|
|
40
|
-
}
|
|
37
|
+
var c = /^[-+]?(\d|\.\d)[\w.%]*$|^calc\(/i, l = /^[-+]?(\d|\.\d)[\d.]*(deg|rad|turn|grad)?$/i, u = (e) => c.test(e);
|
|
38
|
+
function d(t) {
|
|
39
|
+
let n = e(t.trim()), r = n.length;
|
|
40
|
+
for (; r > 1 && u(n[r - 1]);) r--;
|
|
41
41
|
return {
|
|
42
|
-
color:
|
|
43
|
-
position: ""
|
|
42
|
+
color: n.slice(0, r).join(" "),
|
|
43
|
+
position: n.slice(r).join(" ")
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
return
|
|
48
|
-
id:
|
|
49
|
-
...
|
|
46
|
+
function f(e) {
|
|
47
|
+
return e.map((e) => ({
|
|
48
|
+
id: o(),
|
|
49
|
+
...d(e)
|
|
50
50
|
}));
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
let
|
|
52
|
+
function p(e) {
|
|
53
|
+
let t = s(e), n = (t[0] ?? "").trim(), r = l.test(n) || n.startsWith("to ");
|
|
54
54
|
return {
|
|
55
|
-
angle:
|
|
56
|
-
stops:
|
|
55
|
+
angle: r ? n : "",
|
|
56
|
+
stops: f(t.slice(+!!r))
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
e && (c = e[1].trim());
|
|
65
|
-
}
|
|
66
|
-
let u = n.slice(l).join(", ");
|
|
59
|
+
var m = /^(circle|ellipse|closest-|farthest-|at\s)|\sat\s/;
|
|
60
|
+
function h(t) {
|
|
61
|
+
let n = s(t), i = (n[0] ?? "").trim();
|
|
62
|
+
if (!(m.test(i) || u(e(i)[0] ?? ""))) return { stops: f(n) };
|
|
63
|
+
let [a, o = ""] = i.startsWith("at ") ? ["", i.slice(3)] : i.split(/\s+at\s+/), c = e(a), l = c.find((e) => e === "circle" || e === "ellipse"), d = c.filter((e) => e !== "circle" && e !== "ellipse").join(" ");
|
|
67
64
|
return {
|
|
68
|
-
radialShape:
|
|
69
|
-
radialExtent:
|
|
70
|
-
radialPosition:
|
|
71
|
-
stops:
|
|
65
|
+
radialShape: l === "circle" ? "circle" : "ellipse",
|
|
66
|
+
radialExtent: d || r.radialExtent,
|
|
67
|
+
radialPosition: o.trim(),
|
|
68
|
+
stops: f(n.slice(1))
|
|
72
69
|
};
|
|
73
70
|
}
|
|
74
|
-
function
|
|
75
|
-
let
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
let t = r.match(/at\s+(.+?)(?:\s+from|$)/);
|
|
81
|
-
t && (o = t[1].trim());
|
|
82
|
-
}
|
|
83
|
-
let l = n.slice(c).join(", ");
|
|
84
|
-
return {
|
|
85
|
-
conicAngle: i,
|
|
86
|
-
conicPosition: o,
|
|
87
|
-
stops: s(l)
|
|
71
|
+
function g(e) {
|
|
72
|
+
let t = s(e), n = (t[0] ?? "").trim();
|
|
73
|
+
return !n.startsWith("from ") && !n.startsWith("at ") ? { stops: f(t) } : {
|
|
74
|
+
conicAngle: /from\s+(\S+)/.exec(n)?.[1] ?? r.conicAngle,
|
|
75
|
+
conicPosition: /at\s+(.+?)(?:\s+from\s|$)/.exec(n)?.[1].trim() ?? "",
|
|
76
|
+
stops: f(t.slice(1))
|
|
88
77
|
};
|
|
89
78
|
}
|
|
90
|
-
|
|
79
|
+
var _ = /^(repeating-)?(linear|radial|conic)-gradient\(([\s\S]+)\)$/i, v = /^url\(\s*(?:"(.*)"|'(.*)'|(.*?))\s*\)$/i;
|
|
80
|
+
function y(e) {
|
|
91
81
|
let t = e.trim();
|
|
92
82
|
if (!t || t === "none") return { type: "none" };
|
|
93
|
-
let n =
|
|
83
|
+
let n = v.exec(t);
|
|
94
84
|
if (n) return {
|
|
95
85
|
type: "url",
|
|
96
|
-
url: n
|
|
97
|
-
};
|
|
98
|
-
let r = t.match(/^url\('(.*)'\)$/i);
|
|
99
|
-
if (r) return {
|
|
100
|
-
type: "url",
|
|
101
|
-
url: r[1]
|
|
86
|
+
url: n.slice(1).find(Boolean) ?? ""
|
|
102
87
|
};
|
|
103
|
-
let
|
|
104
|
-
if (
|
|
105
|
-
type: "
|
|
106
|
-
|
|
88
|
+
let r = _.exec(t);
|
|
89
|
+
if (!r) return {
|
|
90
|
+
type: "raw",
|
|
91
|
+
raw: t
|
|
107
92
|
};
|
|
108
|
-
let a =
|
|
109
|
-
|
|
93
|
+
let i = !!r[1], a = r[2].toLowerCase();
|
|
94
|
+
return a === "linear" ? {
|
|
110
95
|
type: "linear-gradient",
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
if (o) return {
|
|
96
|
+
repeating: i,
|
|
97
|
+
...p(r[3])
|
|
98
|
+
} : a === "radial" ? {
|
|
115
99
|
type: "radial-gradient",
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
return s ? {
|
|
100
|
+
repeating: i,
|
|
101
|
+
...h(r[3])
|
|
102
|
+
} : {
|
|
120
103
|
type: "conic-gradient",
|
|
121
|
-
|
|
122
|
-
|
|
104
|
+
repeating: i,
|
|
105
|
+
...g(r[3])
|
|
106
|
+
};
|
|
123
107
|
}
|
|
124
|
-
|
|
125
|
-
let
|
|
126
|
-
if (
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
let
|
|
108
|
+
var b = /* @__PURE__ */ new Set(["top", "bottom"]), x = /* @__PURE__ */ new Set(["left", "right"]), S = (t) => {
|
|
109
|
+
let r = e(t ?? "");
|
|
110
|
+
if (r.length === 0) return [n.positionX, n.positionY];
|
|
111
|
+
if (r.length === 1) return b.has(r[0]) ? ["center", r[0]] : [r[0], "center"];
|
|
112
|
+
if (r.length === 2) {
|
|
113
|
+
let [e, t] = r;
|
|
114
|
+
return b.has(e) || x.has(t) ? [t, e] : [e, t];
|
|
115
|
+
}
|
|
116
|
+
return r.length === 3 ? u(r[1]) ? [`${r[0]} ${r[1]}`, r[2]] : [r[0], `${r[1]} ${r[2]}`] : [`${r[0]} ${r[1]}`, r.slice(2).join(" ")];
|
|
117
|
+
}, C = (e, t) => e.length > 0 ? e[t % e.length] : void 0;
|
|
118
|
+
function w(e) {
|
|
119
|
+
let t = (e["background-image"] ?? "").trim();
|
|
120
|
+
if (!t || t === "none") return [];
|
|
121
|
+
let i = s(t), o = s(e["background-size"] ?? ""), c = s(e["background-position"] ?? ""), l = s(e["background-repeat"] ?? ""), u = s(e["background-attachment"] ?? ""), d = s(e["background-clip"] ?? "");
|
|
122
|
+
return i.map((e, t) => {
|
|
123
|
+
let [i, s] = S(C(c, t));
|
|
130
124
|
return {
|
|
131
|
-
...
|
|
132
|
-
...
|
|
133
|
-
id:
|
|
134
|
-
size: o
|
|
135
|
-
positionX:
|
|
136
|
-
positionY:
|
|
137
|
-
repeat:
|
|
138
|
-
attachment:
|
|
139
|
-
clip:
|
|
125
|
+
...r,
|
|
126
|
+
...y(e),
|
|
127
|
+
id: a(),
|
|
128
|
+
size: C(o, t) ?? n.size,
|
|
129
|
+
positionX: i,
|
|
130
|
+
positionY: s,
|
|
131
|
+
repeat: C(l, t) ?? n.repeat,
|
|
132
|
+
attachment: C(u, t) ?? n.attachment,
|
|
133
|
+
clip: C(d, t) ?? n.clip
|
|
140
134
|
};
|
|
141
135
|
});
|
|
142
136
|
}
|
|
143
|
-
function
|
|
137
|
+
function T(e) {
|
|
144
138
|
return e.position ? `${e.color} ${e.position}` : e.color;
|
|
145
139
|
}
|
|
146
|
-
|
|
140
|
+
var E = (e) => {
|
|
141
|
+
switch (e.type) {
|
|
142
|
+
case "linear-gradient": return e.angle;
|
|
143
|
+
case "radial-gradient": return [
|
|
144
|
+
e.radialShape === "ellipse" ? "" : e.radialShape,
|
|
145
|
+
e.radialExtent === "farthest-corner" ? "" : e.radialExtent,
|
|
146
|
+
e.radialPosition ? `at ${e.radialPosition}` : ""
|
|
147
|
+
].filter(Boolean).join(" ");
|
|
148
|
+
case "conic-gradient": return [e.conicAngle && e.conicAngle !== "0deg" ? `from ${e.conicAngle}` : "", e.conicPosition ? `at ${e.conicPosition}` : ""].filter(Boolean).join(" ");
|
|
149
|
+
default: return "";
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
function D(e) {
|
|
147
153
|
switch (e.type) {
|
|
148
154
|
case "url": return `url("${e.url}")`;
|
|
149
|
-
case "
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
case "radial-gradient": {
|
|
154
|
-
let t = e.stops.map(p).join(", "), n = e.radialShape === "ellipse" ? "" : `${e.radialShape} `, r = e.radialExtent === "farthest-corner" ? "" : `${e.radialExtent} `, i = `at ${e.radialPosition}`;
|
|
155
|
-
return `radial-gradient(${n || r ? `${n}${r}${i}` : i}, ${t})`;
|
|
156
|
-
}
|
|
155
|
+
case "raw": return e.raw || "none";
|
|
156
|
+
case "linear-gradient":
|
|
157
|
+
case "radial-gradient":
|
|
157
158
|
case "conic-gradient": {
|
|
158
|
-
let t = e.stops.map(
|
|
159
|
-
return
|
|
159
|
+
let t = E(e), n = e.stops.map(T).join(", ");
|
|
160
|
+
return `${e.repeating ? "repeating-" : ""}${e.type}(${t ? `${t}, ` : ""}${n})`;
|
|
160
161
|
}
|
|
161
162
|
default: return "none";
|
|
162
163
|
}
|
|
163
164
|
}
|
|
164
|
-
function
|
|
165
|
+
function O(e) {
|
|
165
166
|
return e.length === 0 ? {
|
|
166
167
|
"background-image": void 0,
|
|
167
168
|
"background-size": void 0,
|
|
@@ -170,7 +171,7 @@ function h(e) {
|
|
|
170
171
|
"background-attachment": void 0,
|
|
171
172
|
"background-clip": void 0
|
|
172
173
|
} : {
|
|
173
|
-
"background-image": e.map(
|
|
174
|
+
"background-image": e.map(D).join(", "),
|
|
174
175
|
"background-size": e.map((e) => e.size).join(", "),
|
|
175
176
|
"background-position": e.map((e) => `${e.positionX} ${e.positionY}`).join(", "),
|
|
176
177
|
"background-repeat": e.map((e) => e.repeat).join(", "),
|
|
@@ -179,4 +180,4 @@ function h(e) {
|
|
|
179
180
|
};
|
|
180
181
|
}
|
|
181
182
|
//#endregion
|
|
182
|
-
export {
|
|
183
|
+
export { r as DEFAULT_LAYER_PROPS, t as DEFAULT_STOPS, a as newLayerId, o as newStopId, w as parseBackgroundLayers, D as serializeLayerImage, O as serializeLayersToCSS, T as serializeStop, s as splitTopLevelCommas };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { StyleCategory, StyleValue } from '@plitzi/sdk-shared';
|
|
2
|
+
/** The properties a background's layers are written across, one comma-separated list each. */
|
|
3
|
+
export declare const BG_LAYER_KEYS: StyleCategory[];
|
|
4
|
+
/**
|
|
5
|
+
* The layers' properties as one string — what tells a change made elsewhere (undo, another collaborator) from the one
|
|
6
|
+
* the editor just wrote, which it already shows.
|
|
7
|
+
*/
|
|
8
|
+
export declare const layerValuesKey: (record: Partial<Record<StyleCategory, StyleValue>>) => string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/components/StyleInspector/categories/Background/helpers/layerValues.ts
|
|
2
|
+
var e = [
|
|
3
|
+
"background-image",
|
|
4
|
+
"background-size",
|
|
5
|
+
"background-position",
|
|
6
|
+
"background-repeat",
|
|
7
|
+
"background-attachment",
|
|
8
|
+
"background-clip"
|
|
9
|
+
], t = (t) => e.map((e) => String(t[e])).join("||");
|
|
10
|
+
//#endregion
|
|
11
|
+
export { e as BG_LAYER_KEYS, t as layerValuesKey };
|
|
@@ -1,100 +1,65 @@
|
|
|
1
|
-
import e from "../../../
|
|
2
|
-
import t from "../../../components/
|
|
3
|
-
import n from "
|
|
4
|
-
import r from "
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
1
|
+
import { asText as e } from "../../../cssValues.mjs";
|
|
2
|
+
import t from "../../../components/CategoryOption/index.mjs";
|
|
3
|
+
import n from "../../../components/CategorySection/index.mjs";
|
|
4
|
+
import { ANGLE_UNITS as r, CENTER_X_WORDS as i, CENTER_Y_WORDS as a, centerParts as o, joinCenter as s } from "./helpers.mjs";
|
|
5
|
+
import c from "../components/GradientStopBar/index.mjs";
|
|
6
|
+
import { useCallback as l } from "react";
|
|
7
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
8
|
//#region src/components/StyleInspector/categories/Background/modes/ConicGradientMode.tsx
|
|
10
|
-
var
|
|
11
|
-
let
|
|
12
|
-
...
|
|
13
|
-
conicAngle:
|
|
14
|
-
}), [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
9
|
+
var p = ({ layer: p, onChange: m }) => {
|
|
10
|
+
let [h, g] = o(p.conicPosition), _ = l((t) => m?.({
|
|
11
|
+
...p,
|
|
12
|
+
conicAngle: e(t)
|
|
13
|
+
}), [p, m]), v = l((t) => m?.({
|
|
14
|
+
...p,
|
|
15
|
+
conicPosition: s(e(t), g)
|
|
16
|
+
}), [
|
|
17
|
+
g,
|
|
18
|
+
p,
|
|
19
|
+
m
|
|
20
|
+
]), y = l((t) => m?.({
|
|
21
|
+
...p,
|
|
22
|
+
conicPosition: s(h, e(t))
|
|
23
|
+
}), [
|
|
24
|
+
h,
|
|
25
|
+
p,
|
|
26
|
+
m
|
|
27
|
+
]), b = l((e) => m?.({
|
|
28
|
+
...p,
|
|
28
29
|
stops: e
|
|
29
|
-
}), [
|
|
30
|
-
return /* @__PURE__ */
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
label: "Start
|
|
33
|
-
children: /* @__PURE__ */
|
|
30
|
+
}), [p, m]);
|
|
31
|
+
return /* @__PURE__ */ f(u, { children: [
|
|
32
|
+
/* @__PURE__ */ d(n, {
|
|
33
|
+
label: "Start angle",
|
|
34
|
+
children: /* @__PURE__ */ d(t, {
|
|
34
35
|
type: "metric",
|
|
35
|
-
value:
|
|
36
|
-
units:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
value: "deg"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
label: "rad",
|
|
43
|
-
value: "rad"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
label: "turn",
|
|
47
|
-
value: "turn"
|
|
48
|
-
}
|
|
49
|
-
],
|
|
50
|
-
min: 0,
|
|
51
|
-
max: 360,
|
|
52
|
-
onChange: f
|
|
36
|
+
value: p.conicAngle,
|
|
37
|
+
units: r,
|
|
38
|
+
min: -Infinity,
|
|
39
|
+
onChange: _
|
|
53
40
|
})
|
|
54
41
|
}),
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
label: "
|
|
57
|
-
children: [/* @__PURE__ */
|
|
42
|
+
/* @__PURE__ */ f(n, {
|
|
43
|
+
label: "Center",
|
|
44
|
+
children: [/* @__PURE__ */ d(t, {
|
|
58
45
|
type: "metric",
|
|
59
|
-
value:
|
|
60
|
-
allowedWords:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
],
|
|
65
|
-
onChange: p
|
|
66
|
-
}), /* @__PURE__ */ c(e, {
|
|
46
|
+
value: h,
|
|
47
|
+
allowedWords: i,
|
|
48
|
+
min: -Infinity,
|
|
49
|
+
onChange: v
|
|
50
|
+
}), /* @__PURE__ */ d(t, {
|
|
67
51
|
type: "metric",
|
|
68
|
-
value:
|
|
69
|
-
allowedWords:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
"bottom"
|
|
73
|
-
],
|
|
74
|
-
onChange: m
|
|
52
|
+
value: g,
|
|
53
|
+
allowedWords: a,
|
|
54
|
+
min: -Infinity,
|
|
55
|
+
onChange: y
|
|
75
56
|
})]
|
|
76
57
|
}),
|
|
77
|
-
/* @__PURE__ */ c
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
children: /* @__PURE__ */ c(a, {
|
|
81
|
-
stops: u.stops,
|
|
82
|
-
onChange: h
|
|
83
|
-
})
|
|
84
|
-
}),
|
|
85
|
-
/* @__PURE__ */ c(r, {
|
|
86
|
-
layer: u,
|
|
87
|
-
onChange: d
|
|
88
|
-
}),
|
|
89
|
-
/* @__PURE__ */ c(n, {
|
|
90
|
-
layer: u,
|
|
91
|
-
onChange: d
|
|
92
|
-
}),
|
|
93
|
-
/* @__PURE__ */ c(i, {
|
|
94
|
-
layer: u,
|
|
95
|
-
onChange: d
|
|
58
|
+
/* @__PURE__ */ d(c, {
|
|
59
|
+
stops: p.stops,
|
|
60
|
+
onChange: b
|
|
96
61
|
})
|
|
97
62
|
] });
|
|
98
63
|
};
|
|
99
64
|
//#endregion
|
|
100
|
-
export {
|
|
65
|
+
export { p as default };
|
|
@@ -1,80 +1,19 @@
|
|
|
1
|
-
import e from "../../../
|
|
2
|
-
import t from "../../../components/
|
|
3
|
-
import n from "
|
|
4
|
-
import r from "
|
|
5
|
-
import i from "../components/BackgroundTile/index.mjs";
|
|
6
|
-
import { useCallback as a, useMemo as o } from "react";
|
|
7
|
-
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
1
|
+
import { asText as e } from "../../../cssValues.mjs";
|
|
2
|
+
import t from "../../../components/CategoryOption/index.mjs";
|
|
3
|
+
import { useCallback as n } from "react";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
8
5
|
//#region src/components/StyleInspector/categories/Background/modes/ImageMode.tsx
|
|
9
|
-
var
|
|
10
|
-
let
|
|
11
|
-
...
|
|
12
|
-
url:
|
|
13
|
-
}), [
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
className: "px-1 text-xs select-none",
|
|
21
|
-
children: "Fixed"
|
|
22
|
-
}),
|
|
23
|
-
description: "Fixed to viewport",
|
|
24
|
-
active: u.attachment === "fixed",
|
|
25
|
-
size: "custom"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
value: "local",
|
|
29
|
-
icon: /* @__PURE__ */ c("div", {
|
|
30
|
-
className: "px-1 text-xs select-none",
|
|
31
|
-
children: "Local"
|
|
32
|
-
}),
|
|
33
|
-
description: "Scrolls with content",
|
|
34
|
-
active: u.attachment === "local",
|
|
35
|
-
size: "custom"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
value: "scroll",
|
|
39
|
-
icon: /* @__PURE__ */ c("div", {
|
|
40
|
-
className: "px-1 text-xs select-none",
|
|
41
|
-
children: "Scroll"
|
|
42
|
-
}),
|
|
43
|
-
description: "Scrolls with element",
|
|
44
|
-
active: u.attachment === "scroll",
|
|
45
|
-
size: "custom"
|
|
46
|
-
}
|
|
47
|
-
], [u.attachment]);
|
|
48
|
-
return /* @__PURE__ */ l(s, { children: [
|
|
49
|
-
/* @__PURE__ */ c(t, {
|
|
50
|
-
label: "URL",
|
|
51
|
-
children: /* @__PURE__ */ c(e, {
|
|
52
|
-
type: "input",
|
|
53
|
-
value: u.url,
|
|
54
|
-
onChange: f
|
|
55
|
-
})
|
|
56
|
-
}),
|
|
57
|
-
/* @__PURE__ */ c(r, {
|
|
58
|
-
layer: u,
|
|
59
|
-
onChange: d
|
|
60
|
-
}),
|
|
61
|
-
/* @__PURE__ */ c(n, {
|
|
62
|
-
layer: u,
|
|
63
|
-
onChange: d
|
|
64
|
-
}),
|
|
65
|
-
/* @__PURE__ */ c(i, {
|
|
66
|
-
layer: u,
|
|
67
|
-
onChange: d
|
|
68
|
-
}),
|
|
69
|
-
/* @__PURE__ */ c(t, {
|
|
70
|
-
label: "Attachment",
|
|
71
|
-
children: /* @__PURE__ */ c(e, {
|
|
72
|
-
type: "iconGroup",
|
|
73
|
-
items: m,
|
|
74
|
-
onChange: p
|
|
75
|
-
})
|
|
76
|
-
})
|
|
77
|
-
] });
|
|
6
|
+
var i = ({ layer: i, onChange: a }) => {
|
|
7
|
+
let o = n((t) => a?.({
|
|
8
|
+
...i,
|
|
9
|
+
url: e(t)
|
|
10
|
+
}), [i, a]);
|
|
11
|
+
return /* @__PURE__ */ r(t, {
|
|
12
|
+
label: "URL",
|
|
13
|
+
type: "input",
|
|
14
|
+
value: i.url,
|
|
15
|
+
onChange: o
|
|
16
|
+
});
|
|
78
17
|
};
|
|
79
18
|
//#endregion
|
|
80
|
-
export {
|
|
19
|
+
export { i as default };
|