@plitzi/sdk-style 0.38.10 → 0.38.12
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 +289 -0
- package/dist/StyleMap/helpers/isValueValid.mjs +5 -4
- package/dist/StyleMap/helpers/utils.mjs +13 -12
- 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 +213 -187
- package/dist/components/StyleInspector/categories/Background/Background.mjs +84 -177
- 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/GradientCenter/GradientCenter.d.ts +8 -0
- package/dist/components/StyleInspector/categories/Background/components/GradientCenter/GradientCenter.mjs +28 -0
- package/dist/components/StyleInspector/categories/Background/components/GradientCenter/index.d.ts +3 -0
- package/dist/components/StyleInspector/categories/Background/components/GradientCenter/index.mjs +5 -0
- 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 +22 -79
- 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 +58 -98
- 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 +65 -81
- package/dist/components/StyleInspector/categories/Display/DisplayGap.d.ts +14 -1
- package/dist/components/StyleInspector/categories/Display/DisplayGap.mjs +26 -13
- package/dist/components/StyleInspector/categories/DisplayFlexChild/DisplayFlexChild.mjs +33 -38
- package/dist/components/StyleInspector/categories/Effects/BoxShadow/BoxShadow.mjs +13 -36
- package/dist/components/StyleInspector/categories/Effects/Effects.mjs +120 -204
- 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 +21 -70
- package/dist/components/StyleInspector/categories/ListItem/ListItem.mjs +21 -70
- package/dist/components/StyleInspector/categories/Others/Others.mjs +63 -85
- 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 +65 -85
- package/dist/components/StyleInspector/categories/Spacing/Spacing.mjs +18 -27
- package/dist/components/StyleInspector/categories/Spacing/SpacingBox.d.ts +15 -0
- package/dist/components/StyleInspector/categories/Spacing/SpacingBox.mjs +63 -0
- package/dist/components/StyleInspector/categories/Spacing/SpacingMargin.d.ts +3 -11
- package/dist/components/StyleInspector/categories/Spacing/SpacingMargin.mjs +18 -70
- package/dist/components/StyleInspector/categories/Spacing/SpacingPadding.d.ts +3 -7
- package/dist/components/StyleInspector/categories/Spacing/SpacingPadding.mjs +16 -67
- package/dist/components/StyleInspector/categories/Typography/Typography.mjs +58 -67
- 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 +16 -40
- package/dist/components/StyleInspector/categories/Variables/Variables.mjs +38 -37
- package/dist/components/StyleInspector/categories/blendModes.d.ts +2 -0
- package/dist/components/StyleInspector/categories/blendModes.mjs +21 -0
- package/dist/components/StyleInspector/categories/listMarkers.d.ts +8 -0
- package/dist/components/StyleInspector/categories/listMarkers.mjs +25 -0
- 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/ShadowList/ShadowList.d.ts +15 -0
- package/dist/components/StyleInspector/components/ShadowList/ShadowList.mjs +25 -0
- package/dist/components/StyleInspector/components/ShadowList/index.d.ts +3 -0
- package/dist/components/StyleInspector/components/ShadowList/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 +13 -0
- package/dist/components/StyleInspector/cssValues.mjs +23 -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/hooks/usePropertyChange.d.ts +6 -0
- package/dist/components/StyleInspector/hooks/usePropertyChange.mjs +9 -0
- 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 +225 -21
- package/dist/components/StyleInspector/categories/Display/DisplayGridGap.d.ts +0 -8
- package/dist/components/StyleInspector/categories/Display/DisplayGridGap.mjs +0 -27
- 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,55 +1,52 @@
|
|
|
1
|
-
import e from "../
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { resolveTokens as e } from "../cssValues.mjs";
|
|
2
|
+
import t from "../StyleInspectorContext.mjs";
|
|
3
|
+
import { use as n, useMemo as r } from "react";
|
|
4
|
+
import { get as i, pick as a } from "@plitzi/plitzi-ui/helpers";
|
|
5
|
+
import { baseDefaultValue as o } from "@plitzi/sdk-shared";
|
|
6
|
+
import { VARIABLE_REGEX as s } from "@plitzi/sdk-shared/schema/schemaConstants";
|
|
6
7
|
//#region src/components/StyleInspector/hooks/useInspectorValues.ts
|
|
7
|
-
var
|
|
8
|
-
let { inheritData:
|
|
9
|
-
|
|
10
|
-
let
|
|
11
|
-
|
|
12
|
-
m,
|
|
13
|
-
u
|
|
14
|
-
]), b = n(() => !!s && !u && Object.keys(h).filter((e) => s.includes(e) || s.length === 0).length > 0, [
|
|
15
|
-
s,
|
|
8
|
+
var c = ({ keys: c, skipContext: l = !1, context: u = {}, asValue: d = !1, defaultValues: f, strictMode: p = !1, replaceTokens: m = !1 }) => {
|
|
9
|
+
let { inheritData: h, bindingData: g, variables: _, getValues: v } = {};
|
|
10
|
+
l ? {inheritData: h, bindingData: g, variables: _, getValues: v} = u : {inheritData: h, bindingData: g, variables: _, getValues: v} = n(t);
|
|
11
|
+
let y = v(), b = r(() => !!c && !d && Object.keys(h).filter((e) => c.includes(e) || c.length === 0).length > 0, [
|
|
12
|
+
c,
|
|
16
13
|
h,
|
|
17
|
-
|
|
18
|
-
]), x =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
]), S =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
]), C =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}), e[n] =
|
|
35
|
-
}),
|
|
14
|
+
d
|
|
15
|
+
]), x = r(() => !!c && !d && Object.keys(g).filter((e) => c.includes(e) || c.length === 0).length > 0, [
|
|
16
|
+
c,
|
|
17
|
+
g,
|
|
18
|
+
d
|
|
19
|
+
]), S = r(() => !!c && !d && Object.keys(a(y, c)).filter((e) => typeof y[e] == "string" && s.test(y[e])).length > 0, [
|
|
20
|
+
c,
|
|
21
|
+
y,
|
|
22
|
+
d
|
|
23
|
+
]), C = r(() => c ? c.length > 0 ? !d && Object.keys(a(y, c)).length > 0 : !d && Object.keys(y).length > 0 : !1, [
|
|
24
|
+
c,
|
|
25
|
+
d,
|
|
26
|
+
y
|
|
27
|
+
]), w = r(() => {
|
|
28
|
+
let t = {};
|
|
29
|
+
return c && c.forEach((n) => {
|
|
30
|
+
let r;
|
|
31
|
+
r = p ? i(y, n, i(f ?? {}, n)) : i(y, n, i(g, n, i(h, `${n}.0.value`, i(f ?? {}, n, o[n])))), m && typeof r == "string" && (r = e(r, _)), t[n] = r;
|
|
32
|
+
}), t;
|
|
36
33
|
}, [
|
|
37
|
-
|
|
38
|
-
f,
|
|
34
|
+
c,
|
|
39
35
|
p,
|
|
40
|
-
v,
|
|
41
|
-
d,
|
|
42
36
|
m,
|
|
37
|
+
y,
|
|
38
|
+
f,
|
|
43
39
|
h,
|
|
44
|
-
g
|
|
40
|
+
g,
|
|
41
|
+
_
|
|
45
42
|
]);
|
|
46
|
-
return
|
|
47
|
-
values:
|
|
48
|
-
hasInherit:
|
|
49
|
-
hasBinding:
|
|
50
|
-
hasVariables:
|
|
51
|
-
hasValues:
|
|
43
|
+
return d ? w : {
|
|
44
|
+
values: w,
|
|
45
|
+
hasInherit: b,
|
|
46
|
+
hasBinding: x,
|
|
47
|
+
hasVariables: S,
|
|
48
|
+
hasValues: C
|
|
52
49
|
};
|
|
53
50
|
};
|
|
54
51
|
//#endregion
|
|
55
|
-
export {
|
|
52
|
+
export { c as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StyleCategory, StyleValue } from '@plitzi/sdk-shared';
|
|
2
|
+
/** What a `CategoryOption` hands its `onChange`: the union of every kind of control it can be. */
|
|
3
|
+
type OptionValue = StyleValue | Record<StyleCategory, StyleValue> | boolean;
|
|
4
|
+
/** A control's change handler for one property — `onChange={handleChange('width')}` — writing to what is selected. */
|
|
5
|
+
declare const usePropertyChange: () => (type: StyleCategory) => (value: OptionValue) => void;
|
|
6
|
+
export default usePropertyChange;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import e from "../StyleInspectorContext.mjs";
|
|
2
|
+
import { use as t, useCallback as n } from "react";
|
|
3
|
+
//#region src/components/StyleInspector/hooks/usePropertyChange.ts
|
|
4
|
+
var r = () => {
|
|
5
|
+
let { setValue: r } = t(e);
|
|
6
|
+
return n((e) => (t) => r(e, t), [r]);
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { r as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CategoryKeys } from './categoryKeys';
|
|
2
|
+
import { StyleCategory } from '@plitzi/sdk-shared';
|
|
3
|
+
/**
|
|
4
|
+
* A query as the property names are written: lower case, and words joined by hyphens, so `border radius` finds
|
|
5
|
+
* `border-radius`. Empty when there is nothing to search for.
|
|
6
|
+
*/
|
|
7
|
+
export declare const normalizeQuery: (raw: string) => string;
|
|
8
|
+
/** Whether a category holds what was typed: its title, or any property it edits. Everything matches no query. */
|
|
9
|
+
export declare const categoryMatches: ({ title, dot }: CategoryKeys, query: string) => boolean;
|
|
10
|
+
/** Whether what was typed lives behind the category's advanced toggle — which a search then opens. */
|
|
11
|
+
export declare const advancedMatches: (advanced: StyleCategory[] | undefined, query: string) => boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/components/StyleInspector/search.ts
|
|
2
|
+
var e = {
|
|
3
|
+
bg: "background",
|
|
4
|
+
colour: "color",
|
|
5
|
+
rounded: "radius",
|
|
6
|
+
corner: "radius",
|
|
7
|
+
layer: "z-index",
|
|
8
|
+
stack: "z-index"
|
|
9
|
+
}, t = (t) => {
|
|
10
|
+
let n = t.trim().toLowerCase().replace(/\s+/g, "-");
|
|
11
|
+
return e[n] ?? n;
|
|
12
|
+
}, n = (e, t) => t.split("-").every((t) => !t || e.includes(t)), r = (e, t) => e.some((e) => n(e, t)), i = ({ title: e, dot: t }, i) => !i || n(e.toLowerCase().replace(/\s+/g, "-"), i) || r(t, i), a = (e, t) => !!t && !!e && r(e, t);
|
|
13
|
+
//#endregion
|
|
14
|
+
export { a as advancedMatches, i as categoryMatches, t as normalizeQuery };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** One shadow of a `box-shadow` or `text-shadow` list, its parts named. A text shadow has no `inset` and no `spread`. */
|
|
2
|
+
export type Shadow = {
|
|
3
|
+
inset: boolean;
|
|
4
|
+
x: string;
|
|
5
|
+
y: string;
|
|
6
|
+
blur: string;
|
|
7
|
+
spread: string;
|
|
8
|
+
color: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const DEFAULT_SHADOW: Shadow;
|
|
11
|
+
/**
|
|
12
|
+
* A shadow as CSS allows it to be written: `inset` and the color on either end, two to four lengths between. What does
|
|
13
|
+
* not read as one — a token standing for the whole shadow, `none` — answers `undefined`, and the editor keeps it as
|
|
14
|
+
* text rather than replacing it with a guess.
|
|
15
|
+
*/
|
|
16
|
+
export declare const parseShadow: (value: string) => Shadow | undefined;
|
|
17
|
+
/** Written back in the canonical order, `spread` and `inset` only where the property has them. */
|
|
18
|
+
export declare const serializeShadow: (shadow: Shadow, { withSpread }: {
|
|
19
|
+
withSpread: boolean;
|
|
20
|
+
}) => string;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { splitBySpaceOutsideParens as e } from "./cssValues.mjs";
|
|
2
|
+
//#region src/components/StyleInspector/shadowValue.ts
|
|
3
|
+
var t = {
|
|
4
|
+
inset: !1,
|
|
5
|
+
x: "0px",
|
|
6
|
+
y: "4px",
|
|
7
|
+
blur: "12px",
|
|
8
|
+
spread: "0px",
|
|
9
|
+
color: "rgba(0, 0, 0, 0.25)"
|
|
10
|
+
}, n = /^[-+]?(\d|\.\d)|^calc\(/i, r = (t) => {
|
|
11
|
+
let r = [], i = !1, a;
|
|
12
|
+
for (let o of e(t.trim())) if (o.toLowerCase() === "inset") i = !0;
|
|
13
|
+
else if (n.test(o)) r.push(o);
|
|
14
|
+
else if (/^var\(/i.test(o) && r.length < 2) r.push(o);
|
|
15
|
+
else if (a === void 0) a = o;
|
|
16
|
+
else return;
|
|
17
|
+
if (r.length < 2 || r.length > 4) return;
|
|
18
|
+
let [o, s, c = "0px", l = "0px"] = r;
|
|
19
|
+
return {
|
|
20
|
+
inset: i,
|
|
21
|
+
x: o,
|
|
22
|
+
y: s,
|
|
23
|
+
blur: c,
|
|
24
|
+
spread: l,
|
|
25
|
+
color: a ?? "currentColor"
|
|
26
|
+
};
|
|
27
|
+
}, i = (e, { withSpread: t }) => [
|
|
28
|
+
t && e.inset ? "inset" : void 0,
|
|
29
|
+
e.x,
|
|
30
|
+
e.y,
|
|
31
|
+
e.blur,
|
|
32
|
+
t ? e.spread : void 0,
|
|
33
|
+
e.color
|
|
34
|
+
].filter((e) => !!e).join(" ");
|
|
35
|
+
//#endregion
|
|
36
|
+
export { t as DEFAULT_SHADOW, r as parseShadow, i as serializeShadow };
|
|
@@ -59,7 +59,7 @@ var c = t(({ id: t, label: c = "Selector", active: l = !1, checked: u = !1, elem
|
|
|
59
59
|
})
|
|
60
60
|
}),
|
|
61
61
|
d > 0 && /* @__PURE__ */ r("div", {
|
|
62
|
-
className: "bg-
|
|
62
|
+
className: "bg-primary-600 flex items-center justify-center rounded-sm px-1.5 py-1 text-xs text-white",
|
|
63
63
|
children: d
|
|
64
64
|
})
|
|
65
65
|
]
|