@plitzi/sdk-style 0.37.9 → 0.37.10
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 +590 -0
- package/dist/BuilderStyleContextProvider.mjs +3 -3
- package/dist/StyleAdvanceEditor.mjs +25 -24
- package/dist/StyleHelper.mjs +19 -24
- package/dist/StyleReducer.d.ts +4 -4
- package/dist/StyleReducer.mjs +44 -48
- package/dist/components/Selector/Selector.mjs +3 -3
- package/dist/components/StyleInspector/categories/Background/components/BackgroundLayer/BackgroundLayer.mjs +39 -38
- package/dist/components/StyleInspector/categories/Others/Others.mjs +65 -74
- package/dist/components/StyleInspector/categories/Others/OthersScrollSnap.d.ts +16 -0
- package/dist/components/StyleInspector/categories/Others/OthersScrollSnap.mjs +93 -0
- package/dist/components/StyleInspector/categories/Typography/Typography.mjs +30 -30
- package/dist/components/StyleInspector/categories/Typography/TypographyFont.mjs +8 -8
- package/dist/helpers/calculateInheriting.mjs +33 -33
- package/package.json +9 -5
|
@@ -8,49 +8,50 @@ import d from "@plitzi/plitzi-ui/CodeMirror";
|
|
|
8
8
|
import f from "@plitzi/plitzi-ui/ContainerFloating";
|
|
9
9
|
import p from "@plitzi/sdk-shared/hooks/useNetwork";
|
|
10
10
|
import m from "@plitzi/sdk-shared/schema/SchemaContext";
|
|
11
|
-
import h from "@plitzi/sdk-shared/
|
|
11
|
+
import { splitNotificationsCss as h, withNotificationsCss as g } from "@plitzi/sdk-shared/style/notifications";
|
|
12
|
+
import _ from "@plitzi/sdk-shared/theme/useTheme";
|
|
12
13
|
//#region src/StyleAdvanceEditor.tsx
|
|
13
|
-
var
|
|
14
|
-
let { resolvedTheme:
|
|
14
|
+
var v = () => {
|
|
15
|
+
let { resolvedTheme: v } = _(), [[y = "", b = void 0]] = a(["schema.settings.customCss", "style.variables"]), { schemaUpdateSettings: x } = e(m), S = n(() => h(typeof y == "string" ? y : ""), [y]), [C, w] = r(() => S.customCss), T = n(() => x && o(x, 500), [x]), { server: E, webKey: D } = e(i), { networkQuery: O, networkLoading: k } = p({
|
|
15
16
|
initLoading: !1,
|
|
16
|
-
server:
|
|
17
|
-
webKey:
|
|
18
|
-
}),
|
|
19
|
-
|
|
20
|
-
}, [
|
|
21
|
-
let e = await
|
|
22
|
-
data:
|
|
17
|
+
server: E,
|
|
18
|
+
webKey: D
|
|
19
|
+
}), A = t((e) => T?.(g(e, S.notifications), "customCss"), [T, S.notifications]), j = t((e) => {
|
|
20
|
+
A(String(e)), w(String(e));
|
|
21
|
+
}, [A]), M = t(async () => {
|
|
22
|
+
let e = await O("/utils/prettier-parser", {
|
|
23
|
+
data: C,
|
|
23
24
|
parser: "css"
|
|
24
25
|
}, "post");
|
|
25
26
|
if (!e || !e.data) return;
|
|
26
|
-
let t = s(e, "data",
|
|
27
|
-
t !==
|
|
27
|
+
let t = s(e, "data", C);
|
|
28
|
+
t !== C && (w(t), A(t));
|
|
28
29
|
}, [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
]),
|
|
30
|
+
O,
|
|
31
|
+
C,
|
|
32
|
+
A
|
|
33
|
+
]), N = n(() => b ? Object.keys(b).flatMap((e) => Object.keys(b[e] ?? {})).map((e) => ({
|
|
33
34
|
type: "css-token",
|
|
34
35
|
value: e
|
|
35
|
-
})) : [], [
|
|
36
|
+
})) : [], [b]);
|
|
36
37
|
return /* @__PURE__ */ l("div", {
|
|
37
38
|
className: "relative flex h-full w-full flex-col",
|
|
38
39
|
children: [/* @__PURE__ */ c(d, {
|
|
39
40
|
className: "h-full",
|
|
40
|
-
value:
|
|
41
|
-
autoComplete:
|
|
42
|
-
theme:
|
|
41
|
+
value: C,
|
|
42
|
+
autoComplete: N,
|
|
43
|
+
theme: v,
|
|
43
44
|
lineWrapping: !0,
|
|
44
|
-
onChange:
|
|
45
|
+
onChange: j
|
|
45
46
|
}), /* @__PURE__ */ l("div", {
|
|
46
47
|
className: "absolute top-3 right-3 flex",
|
|
47
48
|
children: [/* @__PURE__ */ c(u, {
|
|
48
49
|
intent: "custom",
|
|
49
50
|
size: "custom",
|
|
50
51
|
className: "mr-2 rounded-sm bg-white p-2 text-zinc-800 shadow dark:bg-zinc-700 dark:text-zinc-200",
|
|
51
|
-
onClick:
|
|
52
|
+
onClick: M,
|
|
52
53
|
title: "Auto format",
|
|
53
|
-
disabled:
|
|
54
|
+
disabled: k,
|
|
54
55
|
children: /* @__PURE__ */ c("i", { className: "fa-solid fa-wand-magic-sparkles" })
|
|
55
56
|
}), /* @__PURE__ */ l(f, {
|
|
56
57
|
containerLeftOffset: -208,
|
|
@@ -85,4 +86,4 @@ var g = () => {
|
|
|
85
86
|
});
|
|
86
87
|
};
|
|
87
88
|
//#endregion
|
|
88
|
-
export {
|
|
89
|
+
export { v as default };
|
package/dist/StyleHelper.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { makeId as e } from "@plitzi/sdk-shared/helpers/utils";
|
|
2
|
-
import {
|
|
2
|
+
import { DISPLAY_MODES as t, DISPLAY_MODE_MIN_WIDTH as n, displayModeWidthRem as r, isDisplayMode as i } from "@plitzi/sdk-shared/style";
|
|
3
|
+
import { styleVariablesToCss as a } from "@plitzi/sdk-variables/VariablesHelper";
|
|
3
4
|
//#region src/StyleHelper.ts
|
|
4
|
-
var
|
|
5
|
+
var o = (e, t = [], n = !0, r = "") => {
|
|
5
6
|
if (!e || e.length === 0) return "";
|
|
6
7
|
let i = [];
|
|
7
8
|
return i = e.filter((e) => t.length === 0 || t.includes(e.type)).map((e) => {
|
|
@@ -13,33 +14,27 @@ var n = (e, t = [], n = !0, r = "") => {
|
|
|
13
14
|
default: return "";
|
|
14
15
|
}
|
|
15
16
|
}), i.join(r);
|
|
16
|
-
}, r = {
|
|
17
|
-
|
|
18
|
-
tablet: "48rem",
|
|
19
|
-
mobile: "0"
|
|
20
|
-
}, i = (e) => {
|
|
21
|
-
if (e === "mobile") return 0;
|
|
22
|
-
if (e === "tablet") return 768;
|
|
23
|
-
if (e === "desktop") return 1024;
|
|
17
|
+
}, s = Object.fromEntries(t.map((e) => [e, r(e)])), c = (e) => {
|
|
18
|
+
if (i(e)) return n[e];
|
|
24
19
|
let t = e.match(/(\d*\.?\d+)(px|rem)/);
|
|
25
20
|
if (!t) return 0;
|
|
26
|
-
let
|
|
27
|
-
return t[2] === "rem" ?
|
|
28
|
-
},
|
|
29
|
-
let { platform:
|
|
30
|
-
return
|
|
31
|
-
let
|
|
32
|
-
if (!
|
|
33
|
-
let
|
|
34
|
-
if (
|
|
21
|
+
let r = parseFloat(t[1]);
|
|
22
|
+
return t[2] === "rem" ? r * 16 : r;
|
|
23
|
+
}, l = (e) => {
|
|
24
|
+
let { platform: t, mode: n = "desktop-first", variables: r } = e, i = [], o = Object.keys(t).sort((e, t) => n === "mobile-first" ? c(e) - c(t) : c(t) - c(e));
|
|
25
|
+
return o.forEach((e, r) => {
|
|
26
|
+
let a = Object.values(t[e]).sort((e, t) => Number(t.type === "element") - Number(e.type === "element")).map((e) => e.cache).join("\n");
|
|
27
|
+
if (!a) return;
|
|
28
|
+
let c = s[e] ?? e;
|
|
29
|
+
if (n === "mobile-first") c === "0" || e === "mobile" ? i.push(a) : i.push(`@media (min-width: ${c}) {${a}}`);
|
|
35
30
|
else {
|
|
36
|
-
let
|
|
37
|
-
e === "desktop" ?
|
|
31
|
+
let t = o[r - 1], n = t ? s[t] ?? t : void 0;
|
|
32
|
+
e === "desktop" ? i.push(a) : n ? i.push(`@media (max-width: ${n}) and (min-width: ${c}) {${a}}`) : i.push(`@media (max-width: ${c}) {${a}}`);
|
|
38
33
|
}
|
|
39
|
-
}),
|
|
40
|
-
},
|
|
34
|
+
}), r && Object.keys(r).length && i.push(a(r)), i.join("\n");
|
|
35
|
+
}, u = (t, n = "base", r = 4) => {
|
|
41
36
|
let i = `${t}-${e(r)}`;
|
|
42
37
|
return n !== "base" && (i = `${t}-${n}-${e(r)}`), i;
|
|
43
38
|
};
|
|
44
39
|
//#endregion
|
|
45
|
-
export {
|
|
40
|
+
export { l as generateCache, u as makeSelector, o as selectorToString };
|
package/dist/StyleReducer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DisplayMode, ReducerActionOrigin, SpaceFont, Style, StyleCategory, StyleItem, StyleTarget, StyleVariableCategory, StyleVariableValue, TagType } from '@plitzi/sdk-shared';
|
|
1
|
+
import { DisplayMode, SnippetStyle, ReducerActionOrigin, SpaceFont, Style, StyleCategory, StyleItem, StyleTarget, StyleVariableCategory, StyleVariableValue, TagType } from '@plitzi/sdk-shared';
|
|
2
2
|
export declare const StyleActions: {
|
|
3
3
|
readonly STYLE_UPDATE: "STYLE_UPDATE";
|
|
4
4
|
readonly STYLE_ADD_SELECTOR: "STYLE_ADD_SELECTOR";
|
|
@@ -14,7 +14,7 @@ export declare const StyleActions: {
|
|
|
14
14
|
readonly STYLE_ADD_FONT: "STYLE_ADD_FONT";
|
|
15
15
|
readonly STYLE_UPDATE_FONT: "STYLE_UPDATE_FONT";
|
|
16
16
|
readonly STYLE_REMOVE_FONT: "STYLE_REMOVE_FONT";
|
|
17
|
-
readonly
|
|
17
|
+
readonly STYLE_ADD_SNIPPET: "STYLE_ADD_SNIPPET";
|
|
18
18
|
readonly STYLE_UPDATE_SETTINGS: "STYLE_UPDATE_SETTINGS";
|
|
19
19
|
};
|
|
20
20
|
export type StyleReducerActionsBase = ReducerActionOrigin;
|
|
@@ -79,8 +79,8 @@ export type StyleReducerActions = StyleReducerActionsBase & ({
|
|
|
79
79
|
type: 'STYLE_REMOVE_FONT';
|
|
80
80
|
family: string;
|
|
81
81
|
} | {
|
|
82
|
-
type: '
|
|
83
|
-
|
|
82
|
+
type: 'STYLE_ADD_SNIPPET';
|
|
83
|
+
style: SnippetStyle;
|
|
84
84
|
} | {
|
|
85
85
|
type: 'STYLE_UPDATE_SETTINGS';
|
|
86
86
|
path: string;
|
package/dist/StyleReducer.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { generateCache as e } from "./StyleHelper.mjs";
|
|
2
2
|
import t from "./StyleMap/index.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { produce as
|
|
3
|
+
import { set as n } from "@plitzi/plitzi-ui/helpers";
|
|
4
|
+
import { produce as r } from "immer";
|
|
5
|
+
import { mergeSnippetStyle as i } from "@plitzi/sdk-shared/style/snippetStyle";
|
|
5
6
|
//#region src/StyleReducer.ts
|
|
6
7
|
var a = {
|
|
7
8
|
STYLE_UPDATE: "STYLE_UPDATE",
|
|
@@ -18,7 +19,7 @@ var a = {
|
|
|
18
19
|
STYLE_ADD_FONT: "STYLE_ADD_FONT",
|
|
19
20
|
STYLE_UPDATE_FONT: "STYLE_UPDATE_FONT",
|
|
20
21
|
STYLE_REMOVE_FONT: "STYLE_REMOVE_FONT",
|
|
21
|
-
|
|
22
|
+
STYLE_ADD_SNIPPET: "STYLE_ADD_SNIPPET",
|
|
22
23
|
STYLE_UPDATE_SETTINGS: "STYLE_UPDATE_SETTINGS"
|
|
23
24
|
}, o = (o, s) => {
|
|
24
25
|
switch (s.type) {
|
|
@@ -27,99 +28,94 @@ var a = {
|
|
|
27
28
|
...s.style
|
|
28
29
|
};
|
|
29
30
|
case a.STYLE_ADD_SELECTOR: {
|
|
30
|
-
let { displayMode:
|
|
31
|
-
return
|
|
32
|
-
t.addSelector(
|
|
31
|
+
let { displayMode: i, selectorType: a, selector: c, path: l, value: u, params: d } = s;
|
|
32
|
+
return r(o, (r) => {
|
|
33
|
+
t.addSelector(r, i, c, a, l, u, d) && n(r, "cache", e(r));
|
|
33
34
|
});
|
|
34
35
|
}
|
|
35
36
|
case a.STYLE_UPDATE_SELECTOR: {
|
|
36
|
-
let { displayMode:
|
|
37
|
-
return
|
|
38
|
-
t.updateSelector(
|
|
37
|
+
let { displayMode: i, selector: a, path: c, value: l, params: u } = s;
|
|
38
|
+
return r(o, (r) => {
|
|
39
|
+
t.updateSelector(r, i, a, c, l, u) && n(r, "cache", e(r));
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
42
|
case a.STYLE_REMOVE_SELECTOR: {
|
|
42
|
-
let { displayMode:
|
|
43
|
-
return
|
|
44
|
-
t.removeSelector(
|
|
43
|
+
let { displayMode: i, selector: a } = s;
|
|
44
|
+
return r(o, (r) => {
|
|
45
|
+
t.removeSelector(r, i, a) && n(r, "cache", e(r));
|
|
45
46
|
});
|
|
46
47
|
}
|
|
47
48
|
case a.STYLE_REMOVE_SELECTORS: {
|
|
48
|
-
let { displayMode:
|
|
49
|
-
return
|
|
50
|
-
a.reduce((e,
|
|
49
|
+
let { displayMode: i, selectors: a } = s;
|
|
50
|
+
return r(o, (r) => {
|
|
51
|
+
a.reduce((e, n) => t.removeSelector(r, i, n) || e, !1) && n(r, "cache", e(r));
|
|
51
52
|
});
|
|
52
53
|
}
|
|
53
54
|
case a.STYLE_ADD_SELECTOR_VARIABLE: {
|
|
54
|
-
let { displayMode:
|
|
55
|
-
return
|
|
56
|
-
t.addSelectorVariable(
|
|
55
|
+
let { displayMode: i, selector: a, category: c, name: l, value: u } = s;
|
|
56
|
+
return r(o, (r) => {
|
|
57
|
+
t.addSelectorVariable(r, i, a, c, l, u) && n(r, "cache", e(r));
|
|
57
58
|
});
|
|
58
59
|
}
|
|
59
60
|
case a.STYLE_UPDATE_SELECTOR_VARIABLE: {
|
|
60
|
-
let { displayMode:
|
|
61
|
-
return
|
|
62
|
-
t.updateSelectorVariable(
|
|
61
|
+
let { displayMode: i, selector: a, category: c, name: l, value: u } = s;
|
|
62
|
+
return r(o, (r) => {
|
|
63
|
+
t.updateSelectorVariable(r, i, a, c, l, u) && n(r, "cache", e(r));
|
|
63
64
|
});
|
|
64
65
|
}
|
|
65
66
|
case a.STYLE_REMOVE_SELECTOR_VARIABLE: {
|
|
66
|
-
let { displayMode:
|
|
67
|
-
return
|
|
68
|
-
t.removeSelectorVariable(
|
|
67
|
+
let { displayMode: i, selector: a, category: c, name: l } = s;
|
|
68
|
+
return r(o, (r) => {
|
|
69
|
+
t.removeSelectorVariable(r, i, a, c, l) && n(r, "cache", e(r));
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
72
|
case a.STYLE_ADD_VARIABLE: {
|
|
72
|
-
let { category:
|
|
73
|
-
return
|
|
74
|
-
t.addVariable(
|
|
73
|
+
let { category: i, name: a, value: c } = s;
|
|
74
|
+
return r(o, (r) => {
|
|
75
|
+
t.addVariable(r, i, a, c) && n(r, "cache", e(r));
|
|
75
76
|
});
|
|
76
77
|
}
|
|
77
78
|
case a.STYLE_UPDATE_VARIABLE: {
|
|
78
|
-
let { category:
|
|
79
|
-
return
|
|
80
|
-
t.updateVariable(
|
|
79
|
+
let { category: i, name: a, value: c } = s;
|
|
80
|
+
return r(o, (r) => {
|
|
81
|
+
t.updateVariable(r, i, a, c) && n(r, "cache", e(r));
|
|
81
82
|
});
|
|
82
83
|
}
|
|
83
84
|
case a.STYLE_REMOVE_VARIABLE: {
|
|
84
|
-
let { category:
|
|
85
|
-
return
|
|
86
|
-
t.removeVariable(
|
|
85
|
+
let { category: i, name: a } = s;
|
|
86
|
+
return r(o, (r) => {
|
|
87
|
+
t.removeVariable(r, i, a) && n(r, "cache", e(r));
|
|
87
88
|
});
|
|
88
89
|
}
|
|
89
90
|
case a.STYLE_ADD_FONT: {
|
|
90
91
|
let { font: e } = s;
|
|
91
|
-
return
|
|
92
|
+
return r(o, (n) => {
|
|
92
93
|
t.addFont(n, e);
|
|
93
94
|
});
|
|
94
95
|
}
|
|
95
96
|
case a.STYLE_UPDATE_FONT: {
|
|
96
97
|
let { family: e, font: n } = s;
|
|
97
|
-
return
|
|
98
|
+
return r(o, (r) => {
|
|
98
99
|
t.updateFont(r, e, n);
|
|
99
100
|
});
|
|
100
101
|
}
|
|
101
102
|
case a.STYLE_REMOVE_FONT: {
|
|
102
103
|
let { family: e } = s;
|
|
103
|
-
return
|
|
104
|
+
return r(o, (n) => {
|
|
104
105
|
t.removeFont(n, e);
|
|
105
106
|
});
|
|
106
107
|
}
|
|
107
|
-
case a.
|
|
108
|
-
let {
|
|
109
|
-
return
|
|
110
|
-
let
|
|
111
|
-
|
|
112
|
-
i[e] = {
|
|
113
|
-
...n(i, e, {}),
|
|
114
|
-
...t[e]
|
|
115
|
-
};
|
|
116
|
-
}), r.platform = i, r.cache = e(r);
|
|
108
|
+
case a.STYLE_ADD_SNIPPET: {
|
|
109
|
+
let { style: t } = s;
|
|
110
|
+
return r(o, (n) => {
|
|
111
|
+
let { platform: r, variables: a } = i(n, t);
|
|
112
|
+
n.platform = r, n.variables = a, n.cache = e(n);
|
|
117
113
|
});
|
|
118
114
|
}
|
|
119
115
|
case a.STYLE_UPDATE_SETTINGS: {
|
|
120
116
|
let { path: e, value: t } = s;
|
|
121
|
-
return
|
|
122
|
-
e === "mode" && r
|
|
117
|
+
return r(o, (r) => {
|
|
118
|
+
e === "mode" && n(r, "mode", t);
|
|
123
119
|
});
|
|
124
120
|
}
|
|
125
121
|
default: return o;
|
|
@@ -55,14 +55,14 @@ var S = "Classes apply left to right, in the order the stylesheet lists them: wh
|
|
|
55
55
|
]), Q = c((e) => {
|
|
56
56
|
switch (e.key) {
|
|
57
57
|
case "Enter": {
|
|
58
|
-
let { value: t } = e.
|
|
58
|
+
let { value: t } = e.currentTarget;
|
|
59
59
|
if (t !== "" && !H.find((e) => e.name === t)) {
|
|
60
60
|
P("");
|
|
61
61
|
let n = {
|
|
62
62
|
name: r(t),
|
|
63
63
|
type: "class"
|
|
64
64
|
}, i = [...H, n].filter((e) => !!e.name).reduce((e, t) => `${e} ${t.name}`, "").trim();
|
|
65
|
-
A?.(n, !1), O?.(i), I(!1), e.
|
|
65
|
+
A?.(n, !1), O?.(i), I(!1), e.currentTarget.blur(), k?.(n);
|
|
66
66
|
}
|
|
67
67
|
setTimeout(() => {
|
|
68
68
|
M.current?.focus();
|
|
@@ -75,7 +75,7 @@ var S = "Classes apply left to right, in the order the stylesheet lists them: wh
|
|
|
75
75
|
case "ArrowDown":
|
|
76
76
|
I(!0);
|
|
77
77
|
break;
|
|
78
|
-
case "Escape": e.stopPropagation(), P(""), e.
|
|
78
|
+
case "Escape": e.stopPropagation(), P(""), e.currentTarget.blur();
|
|
79
79
|
}
|
|
80
80
|
}, [
|
|
81
81
|
H,
|
|
@@ -9,14 +9,15 @@ import { memo as s, useCallback as c, useMemo as l, useState as u } from "react"
|
|
|
9
9
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
10
10
|
import p from "clsx";
|
|
11
11
|
import m from "@plitzi/plitzi-ui/Icon";
|
|
12
|
+
import { nodeOf as h } from "@plitzi/sdk-shared/helpers/eventTarget";
|
|
12
13
|
//#region src/components/StyleInspector/categories/Background/components/BackgroundLayer/BackgroundLayer.tsx
|
|
13
|
-
var
|
|
14
|
+
var g = {
|
|
14
15
|
none: "None",
|
|
15
16
|
url: "Image",
|
|
16
17
|
"linear-gradient": "Linear Gradient",
|
|
17
18
|
"radial-gradient": "Radial Gradient",
|
|
18
19
|
"conic-gradient": "Conic Gradient"
|
|
19
|
-
},
|
|
20
|
+
}, _ = [
|
|
20
21
|
{
|
|
21
22
|
value: "border-box",
|
|
22
23
|
label: "Border Box"
|
|
@@ -29,45 +30,45 @@ var h = {
|
|
|
29
30
|
value: "content-box",
|
|
30
31
|
label: "Content Box"
|
|
31
32
|
}
|
|
32
|
-
],
|
|
33
|
-
let [
|
|
33
|
+
], v = s(({ layer: s, index: v, expanded: y, onExpand: b, onChange: x, onRemove: S, onReorder: C }) => {
|
|
34
|
+
let [w, T] = u(!1), E = l(() => n(s), [s]), D = c((e) => {
|
|
34
35
|
let t = String(e);
|
|
35
|
-
|
|
36
|
+
x({
|
|
36
37
|
...s,
|
|
37
38
|
type: t
|
|
38
39
|
});
|
|
39
|
-
}, [s,
|
|
40
|
+
}, [s, x]), O = c(() => b(s.id), [b, s.id]), k = c((e) => x({
|
|
40
41
|
...s,
|
|
41
42
|
clip: String(e)
|
|
42
|
-
}), [s,
|
|
43
|
-
e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", String(
|
|
44
|
-
}, [
|
|
45
|
-
|
|
46
|
-
}, []), j = c((e) => {
|
|
47
|
-
e.preventDefault(), w(!0);
|
|
43
|
+
}), [s, x]), A = c((e) => {
|
|
44
|
+
e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", String(v));
|
|
45
|
+
}, [v]), j = c(() => {
|
|
46
|
+
T(!1);
|
|
48
47
|
}, []), M = c((e) => {
|
|
49
|
-
e.
|
|
48
|
+
e.preventDefault(), T(!0);
|
|
50
49
|
}, []), N = c((e) => {
|
|
51
|
-
e.
|
|
50
|
+
e.currentTarget.contains(h(e.relatedTarget)) || T(!1);
|
|
51
|
+
}, []), P = c((e) => {
|
|
52
|
+
e.preventDefault(), T(!1);
|
|
52
53
|
let t = parseInt(e.dataTransfer.getData("text/plain"), 10);
|
|
53
|
-
isNaN(t) ||
|
|
54
|
-
}, [
|
|
54
|
+
isNaN(t) || C(t, v);
|
|
55
|
+
}, [v, C]);
|
|
55
56
|
return /* @__PURE__ */ f("div", {
|
|
56
57
|
className: p("rounded-sm border transition-colors", {
|
|
57
|
-
"border-blue-400 bg-blue-50 dark:border-blue-500 dark:bg-blue-900/20":
|
|
58
|
-
"border-gray-200 dark:border-zinc-700": !
|
|
58
|
+
"border-blue-400 bg-blue-50 dark:border-blue-500 dark:bg-blue-900/20": w,
|
|
59
|
+
"border-gray-200 dark:border-zinc-700": !w
|
|
59
60
|
}),
|
|
60
|
-
onDragOver:
|
|
61
|
-
onDragLeave:
|
|
62
|
-
onDrop:
|
|
61
|
+
onDragOver: M,
|
|
62
|
+
onDragLeave: N,
|
|
63
|
+
onDrop: P,
|
|
63
64
|
children: [/* @__PURE__ */ f("div", {
|
|
64
65
|
className: "flex h-8 items-center gap-1 px-1",
|
|
65
66
|
children: [
|
|
66
67
|
/* @__PURE__ */ d("span", {
|
|
67
68
|
draggable: !0,
|
|
68
69
|
className: "cursor-grab px-1 text-gray-400 hover:text-gray-600 active:cursor-grabbing dark:text-zinc-500 dark:hover:text-zinc-300",
|
|
69
|
-
onDragStart:
|
|
70
|
-
onDragEnd:
|
|
70
|
+
onDragStart: A,
|
|
71
|
+
onDragEnd: j,
|
|
71
72
|
children: /* @__PURE__ */ d(m, {
|
|
72
73
|
icon: "fa-solid fa-grip-lines",
|
|
73
74
|
size: "xs"
|
|
@@ -75,26 +76,26 @@ var h = {
|
|
|
75
76
|
}),
|
|
76
77
|
s.type !== "none" && /* @__PURE__ */ d("div", {
|
|
77
78
|
className: "h-4 w-4 shrink-0 rounded-sm border border-gray-300 dark:border-zinc-600",
|
|
78
|
-
style: { background:
|
|
79
|
+
style: { background: E }
|
|
79
80
|
}),
|
|
80
81
|
/* @__PURE__ */ d("span", {
|
|
81
82
|
className: "flex-1 truncate text-xs text-gray-600 dark:text-zinc-400",
|
|
82
|
-
children:
|
|
83
|
+
children: g[s.type]
|
|
83
84
|
}),
|
|
84
85
|
/* @__PURE__ */ d("button", {
|
|
85
86
|
type: "button",
|
|
86
87
|
className: "cursor-pointer p-1 text-gray-400 hover:text-gray-600 dark:text-zinc-500 dark:hover:text-zinc-300",
|
|
87
|
-
onClick:
|
|
88
|
-
title:
|
|
88
|
+
onClick: O,
|
|
89
|
+
title: y ? "Collapse" : "Expand",
|
|
89
90
|
children: /* @__PURE__ */ d(m, {
|
|
90
|
-
icon:
|
|
91
|
+
icon: y ? "fa-solid fa-angle-up" : "fa-solid fa-angle-down",
|
|
91
92
|
size: "xs"
|
|
92
93
|
})
|
|
93
94
|
}),
|
|
94
95
|
/* @__PURE__ */ d("button", {
|
|
95
96
|
type: "button",
|
|
96
97
|
className: "cursor-pointer p-1 text-gray-400 hover:text-red-500 dark:text-zinc-500 dark:hover:text-red-400",
|
|
97
|
-
onClick:
|
|
98
|
+
onClick: S,
|
|
98
99
|
title: "Remove layer",
|
|
99
100
|
children: /* @__PURE__ */ d(m, {
|
|
100
101
|
icon: "fas fa-times",
|
|
@@ -102,7 +103,7 @@ var h = {
|
|
|
102
103
|
})
|
|
103
104
|
})
|
|
104
105
|
]
|
|
105
|
-
}),
|
|
106
|
+
}), y && /* @__PURE__ */ f("div", {
|
|
106
107
|
className: "flex flex-col gap-2 border-t border-gray-200 p-2 dark:border-zinc-700",
|
|
107
108
|
children: [
|
|
108
109
|
/* @__PURE__ */ d(t, {
|
|
@@ -110,7 +111,7 @@ var h = {
|
|
|
110
111
|
children: /* @__PURE__ */ f(e, {
|
|
111
112
|
type: "select",
|
|
112
113
|
value: s.type,
|
|
113
|
-
onChange:
|
|
114
|
+
onChange: D,
|
|
114
115
|
children: [
|
|
115
116
|
/* @__PURE__ */ d("option", {
|
|
116
117
|
value: "linear-gradient",
|
|
@@ -137,27 +138,27 @@ var h = {
|
|
|
137
138
|
}),
|
|
138
139
|
s.type === "url" && /* @__PURE__ */ d(i, {
|
|
139
140
|
layer: s,
|
|
140
|
-
onChange:
|
|
141
|
+
onChange: x
|
|
141
142
|
}),
|
|
142
143
|
s.type === "linear-gradient" && /* @__PURE__ */ d(a, {
|
|
143
144
|
layer: s,
|
|
144
|
-
onChange:
|
|
145
|
+
onChange: x
|
|
145
146
|
}),
|
|
146
147
|
s.type === "radial-gradient" && /* @__PURE__ */ d(o, {
|
|
147
148
|
layer: s,
|
|
148
|
-
onChange:
|
|
149
|
+
onChange: x
|
|
149
150
|
}),
|
|
150
151
|
s.type === "conic-gradient" && /* @__PURE__ */ d(r, {
|
|
151
152
|
layer: s,
|
|
152
|
-
onChange:
|
|
153
|
+
onChange: x
|
|
153
154
|
}),
|
|
154
155
|
s.type !== "none" && /* @__PURE__ */ d(t, {
|
|
155
156
|
label: "Clip",
|
|
156
157
|
children: /* @__PURE__ */ d(e, {
|
|
157
158
|
type: "select",
|
|
158
159
|
value: s.clip,
|
|
159
|
-
onChange:
|
|
160
|
-
children:
|
|
160
|
+
onChange: k,
|
|
161
|
+
children: _.map((e) => /* @__PURE__ */ d("option", {
|
|
161
162
|
value: e.value,
|
|
162
163
|
children: e.label
|
|
163
164
|
}, e.value))
|
|
@@ -168,4 +169,4 @@ var h = {
|
|
|
168
169
|
});
|
|
169
170
|
});
|
|
170
171
|
//#endregion
|
|
171
|
-
export {
|
|
172
|
+
export { v as default };
|