@tenphi/tasty 0.0.0-snapshot.c8bdaeb → 0.0.0-snapshot.c8c7b2a
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/README.md +309 -159
- package/dist/_virtual/_rolldown/runtime.js +1 -2
- package/dist/chunks/cacheKey.d.ts +1 -0
- package/dist/chunks/cacheKey.js +17 -10
- package/dist/chunks/cacheKey.js.map +1 -1
- package/dist/chunks/definitions.d.ts +1 -1
- package/dist/chunks/definitions.js +3 -5
- package/dist/chunks/definitions.js.map +1 -1
- package/dist/chunks/index.d.ts +1 -0
- package/dist/chunks/renderChunk.d.ts +1 -0
- package/dist/chunks/renderChunk.js +32 -34
- package/dist/chunks/renderChunk.js.map +1 -1
- package/dist/compute-styles.d.ts +31 -0
- package/dist/compute-styles.js +322 -0
- package/dist/compute-styles.js.map +1 -0
- package/dist/config.d.ts +157 -30
- package/dist/config.js +233 -45
- package/dist/config.js.map +1 -1
- package/dist/core/index.d.ts +12 -11
- package/dist/core/index.js +12 -11
- package/dist/counter-style/index.js +51 -0
- package/dist/counter-style/index.js.map +1 -0
- package/dist/debug.d.ts +26 -141
- package/dist/debug.js +359 -639
- package/dist/debug.js.map +1 -1
- package/dist/font-face/index.js +63 -0
- package/dist/font-face/index.js.map +1 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/useCounterStyle.d.ts +36 -0
- package/dist/hooks/useCounterStyle.js +65 -0
- package/dist/hooks/useCounterStyle.js.map +1 -0
- package/dist/hooks/useFontFace.d.ts +45 -0
- package/dist/hooks/useFontFace.js +66 -0
- package/dist/hooks/useFontFace.js.map +1 -0
- package/dist/hooks/useGlobalStyles.d.ts +21 -2
- package/dist/hooks/useGlobalStyles.js +60 -28
- package/dist/hooks/useGlobalStyles.js.map +1 -1
- package/dist/hooks/useKeyframes.d.ts +4 -2
- package/dist/hooks/useKeyframes.js +44 -43
- package/dist/hooks/useKeyframes.js.map +1 -1
- package/dist/hooks/useProperty.d.ts +4 -2
- package/dist/hooks/useProperty.js +36 -31
- package/dist/hooks/useProperty.js.map +1 -1
- package/dist/hooks/useRawCSS.d.ts +13 -44
- package/dist/hooks/useRawCSS.js +91 -16
- package/dist/hooks/useRawCSS.js.map +1 -1
- package/dist/hooks/useStyles.d.ts +3 -3
- package/dist/hooks/useStyles.js +8 -146
- package/dist/hooks/useStyles.js.map +1 -1
- package/dist/index.d.ts +15 -12
- package/dist/index.js +15 -12
- package/dist/injector/index.d.ts +36 -11
- package/dist/injector/index.js +43 -12
- package/dist/injector/index.js.map +1 -1
- package/dist/injector/injector.d.ts +62 -3
- package/dist/injector/injector.js +293 -46
- package/dist/injector/injector.js.map +1 -1
- package/dist/injector/sheet-manager.d.ts +22 -17
- package/dist/injector/sheet-manager.js +64 -79
- package/dist/injector/sheet-manager.js.map +1 -1
- package/dist/injector/types.d.ts +121 -21
- package/dist/keyframes/index.js +1 -1
- package/dist/parser/classify.js +6 -6
- package/dist/parser/classify.js.map +1 -1
- package/dist/parser/const.js +30 -3
- package/dist/parser/const.js.map +1 -1
- package/dist/parser/lru.js +1 -1
- package/dist/parser/lru.js.map +1 -1
- package/dist/parser/parser.js +2 -3
- package/dist/parser/parser.js.map +1 -1
- package/dist/parser/tokenizer.js +1 -1
- package/dist/parser/tokenizer.js.map +1 -1
- package/dist/parser/types.js +1 -1
- package/dist/parser/types.js.map +1 -1
- package/dist/pipeline/conditions.js +1 -1
- package/dist/pipeline/conditions.js.map +1 -1
- package/dist/pipeline/exclusive.js +58 -4
- package/dist/pipeline/exclusive.js.map +1 -1
- package/dist/pipeline/index.d.ts +3 -1
- package/dist/pipeline/index.js +82 -34
- package/dist/pipeline/index.js.map +1 -1
- package/dist/pipeline/materialize.js +436 -123
- package/dist/pipeline/materialize.js.map +1 -1
- package/dist/pipeline/parseStateKey.d.ts +1 -1
- package/dist/pipeline/parseStateKey.js +21 -13
- package/dist/pipeline/parseStateKey.js.map +1 -1
- package/dist/pipeline/simplify.js +181 -7
- package/dist/pipeline/simplify.js.map +1 -1
- package/dist/pipeline/warnings.js +1 -1
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/okhsl-plugin.js +3 -277
- package/dist/plugins/okhsl-plugin.js.map +1 -1
- package/dist/plugins/types.d.ts +20 -2
- package/dist/properties/index.js +83 -19
- package/dist/properties/index.js.map +1 -1
- package/dist/properties/property-type-resolver.d.ts +24 -0
- package/dist/properties/property-type-resolver.js +90 -0
- package/dist/properties/property-type-resolver.js.map +1 -0
- package/dist/rsc-cache.js +79 -0
- package/dist/rsc-cache.js.map +1 -0
- package/dist/ssr/astro-client.d.ts +1 -0
- package/dist/ssr/astro-client.js +19 -0
- package/dist/ssr/astro-client.js.map +1 -0
- package/dist/ssr/astro-middleware.d.ts +15 -0
- package/dist/ssr/astro-middleware.js +19 -0
- package/dist/ssr/astro-middleware.js.map +1 -0
- package/dist/ssr/astro.d.ts +108 -0
- package/dist/ssr/astro.js +149 -0
- package/dist/ssr/astro.js.map +1 -0
- package/dist/ssr/async-storage.d.ts +17 -0
- package/dist/ssr/async-storage.js +44 -0
- package/dist/ssr/async-storage.js.map +1 -0
- package/dist/ssr/collect-auto-properties.js +58 -0
- package/dist/ssr/collect-auto-properties.js.map +1 -0
- package/dist/ssr/collector.d.ts +98 -0
- package/dist/ssr/collector.js +235 -0
- package/dist/ssr/collector.js.map +1 -0
- package/dist/ssr/context.js +16 -0
- package/dist/ssr/context.js.map +1 -0
- package/dist/ssr/format-global-rules.js +22 -0
- package/dist/ssr/format-global-rules.js.map +1 -0
- package/dist/ssr/format-keyframes.js +69 -0
- package/dist/ssr/format-keyframes.js.map +1 -0
- package/dist/ssr/format-property.js +49 -0
- package/dist/ssr/format-property.js.map +1 -0
- package/dist/ssr/format-rules.js +73 -0
- package/dist/ssr/format-rules.js.map +1 -0
- package/dist/ssr/hydrate.d.ts +29 -0
- package/dist/ssr/hydrate.js +45 -0
- package/dist/ssr/hydrate.js.map +1 -0
- package/dist/ssr/index.d.ts +4 -0
- package/dist/ssr/index.js +10 -0
- package/dist/ssr/index.js.map +1 -0
- package/dist/ssr/next.d.ts +46 -0
- package/dist/ssr/next.js +75 -0
- package/dist/ssr/next.js.map +1 -0
- package/dist/ssr/ssr-collector-ref.js +29 -0
- package/dist/ssr/ssr-collector-ref.js.map +1 -0
- package/dist/states/index.js +13 -259
- package/dist/states/index.js.map +1 -1
- package/dist/static/index.js +1 -2
- package/dist/static/inject.d.ts +5 -0
- package/dist/static/inject.js +17 -0
- package/dist/static/inject.js.map +1 -0
- package/dist/static/tastyStatic.js +1 -2
- package/dist/static/tastyStatic.js.map +1 -1
- package/dist/static/types.js +1 -1
- package/dist/styles/border.d.ts +1 -1
- package/dist/styles/border.js +30 -24
- package/dist/styles/border.js.map +1 -1
- package/dist/styles/color.d.ts +1 -1
- package/dist/styles/color.js +11 -8
- package/dist/styles/color.js.map +1 -1
- package/dist/styles/const.js +17 -0
- package/dist/styles/const.js.map +1 -0
- package/dist/styles/createStyle.js +28 -26
- package/dist/styles/createStyle.js.map +1 -1
- package/dist/styles/dimension.js +15 -3
- package/dist/styles/dimension.js.map +1 -1
- package/dist/styles/directional.js +133 -0
- package/dist/styles/directional.js.map +1 -0
- package/dist/styles/display.d.ts +3 -10
- package/dist/styles/display.js +45 -39
- package/dist/styles/display.js.map +1 -1
- package/dist/styles/fade.d.ts +1 -1
- package/dist/styles/fade.js +9 -5
- package/dist/styles/fade.js.map +1 -1
- package/dist/styles/fill.d.ts +2 -2
- package/dist/styles/fill.js +9 -9
- package/dist/styles/fill.js.map +1 -1
- package/dist/styles/flow.js +1 -1
- package/dist/styles/gap.d.ts +1 -1
- package/dist/styles/gap.js +4 -3
- package/dist/styles/gap.js.map +1 -1
- package/dist/styles/height.d.ts +1 -1
- package/dist/styles/height.js +1 -2
- package/dist/styles/height.js.map +1 -1
- package/dist/styles/index.d.ts +0 -1
- package/dist/styles/index.js +3 -4
- package/dist/styles/index.js.map +1 -1
- package/dist/styles/inset.d.ts +1 -29
- package/dist/styles/inset.js +19 -135
- package/dist/styles/inset.js.map +1 -1
- package/dist/styles/list.d.ts +5 -5
- package/dist/styles/list.js +4 -2
- package/dist/styles/list.js.map +1 -1
- package/dist/styles/margin.d.ts +1 -1
- package/dist/styles/margin.js +17 -89
- package/dist/styles/margin.js.map +1 -1
- package/dist/styles/outline.d.ts +1 -1
- package/dist/styles/outline.js +6 -16
- package/dist/styles/outline.js.map +1 -1
- package/dist/styles/padding.d.ts +1 -1
- package/dist/styles/padding.js +17 -89
- package/dist/styles/padding.js.map +1 -1
- package/dist/styles/placement.d.ts +37 -0
- package/dist/styles/placement.js +74 -0
- package/dist/styles/placement.js.map +1 -0
- package/dist/styles/predefined.d.ts +4 -6
- package/dist/styles/predefined.js +9 -13
- package/dist/styles/predefined.js.map +1 -1
- package/dist/styles/preset.d.ts +6 -1
- package/dist/styles/preset.js +54 -53
- package/dist/styles/preset.js.map +1 -1
- package/dist/styles/radius.d.ts +1 -3
- package/dist/styles/radius.js +38 -6
- package/dist/styles/radius.js.map +1 -1
- package/dist/styles/scrollMargin.d.ts +24 -0
- package/dist/styles/scrollMargin.js +32 -0
- package/dist/styles/scrollMargin.js.map +1 -0
- package/dist/styles/scrollbar.d.ts +9 -5
- package/dist/styles/scrollbar.js +31 -92
- package/dist/styles/scrollbar.js.map +1 -1
- package/dist/styles/shadow.d.ts +1 -1
- package/dist/styles/shadow.js +4 -3
- package/dist/styles/shadow.js.map +1 -1
- package/dist/styles/shared.js +17 -0
- package/dist/styles/shared.js.map +1 -0
- package/dist/styles/transition.d.ts +1 -1
- package/dist/styles/transition.js +6 -5
- package/dist/styles/transition.js.map +1 -1
- package/dist/styles/types.d.ts +94 -28
- package/dist/styles/width.d.ts +1 -1
- package/dist/styles/width.js +1 -2
- package/dist/styles/width.js.map +1 -1
- package/dist/tasty.d.ts +46 -894
- package/dist/tasty.js +101 -59
- package/dist/tasty.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils/cache-wrapper.js +4 -9
- package/dist/utils/cache-wrapper.js.map +1 -1
- package/dist/utils/case-converter.js +1 -1
- package/dist/utils/color-math.d.ts +46 -0
- package/dist/utils/color-math.js +749 -0
- package/dist/utils/color-math.js.map +1 -0
- package/dist/utils/color-space.d.ts +5 -0
- package/dist/utils/color-space.js +228 -0
- package/dist/utils/color-space.js.map +1 -0
- package/dist/utils/colors.js +3 -2
- package/dist/utils/colors.js.map +1 -1
- package/dist/utils/deps-equal.js +15 -0
- package/dist/utils/deps-equal.js.map +1 -0
- package/dist/utils/dotize.js +1 -1
- package/dist/utils/dotize.js.map +1 -1
- package/dist/utils/filter-base-props.d.ts +1 -1
- package/dist/utils/filter-base-props.js +1 -1
- package/dist/utils/filter-base-props.js.map +1 -1
- package/dist/utils/get-display-name.js +1 -1
- package/dist/utils/has-keys.js +13 -0
- package/dist/utils/has-keys.js.map +1 -0
- package/dist/utils/hash.js +14 -0
- package/dist/utils/hash.js.map +1 -0
- package/dist/utils/is-dev-env.js +1 -1
- package/dist/utils/is-dev-env.js.map +1 -1
- package/dist/utils/is-valid-element-type.js +1 -1
- package/dist/utils/merge-styles.js +1 -2
- package/dist/utils/merge-styles.js.map +1 -1
- package/dist/utils/mod-attrs.d.ts +0 -2
- package/dist/utils/mod-attrs.js +3 -4
- package/dist/utils/mod-attrs.js.map +1 -1
- package/dist/utils/process-tokens.d.ts +3 -17
- package/dist/utils/process-tokens.js +19 -107
- package/dist/utils/process-tokens.js.map +1 -1
- package/dist/utils/resolve-recipes.js +1 -2
- package/dist/utils/resolve-recipes.js.map +1 -1
- package/dist/utils/selector-transform.js +32 -0
- package/dist/utils/selector-transform.js.map +1 -0
- package/dist/utils/string.js +1 -1
- package/dist/utils/styles.d.ts +3 -82
- package/dist/utils/styles.js +29 -399
- package/dist/utils/styles.js.map +1 -1
- package/dist/utils/typography.d.ts +35 -13
- package/dist/utils/typography.js +16 -18
- package/dist/utils/typography.js.map +1 -1
- package/dist/utils/warnings.js +1 -1
- package/dist/zero/babel.d.ts +57 -84
- package/dist/zero/babel.js +217 -37
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/css-writer.js +1 -2
- package/dist/zero/css-writer.js.map +1 -1
- package/dist/zero/extractor.js +119 -3
- package/dist/zero/extractor.js.map +1 -1
- package/dist/zero/index.js +1 -2
- package/dist/zero/next.d.ts +56 -30
- package/dist/zero/next.js +105 -40
- package/dist/zero/next.js.map +1 -1
- package/docs/README.md +31 -0
- package/docs/adoption.md +298 -0
- package/docs/comparison.md +419 -0
- package/docs/configuration.md +394 -0
- package/docs/debug.md +320 -0
- package/docs/design-system.md +436 -0
- package/docs/dsl.md +688 -0
- package/docs/getting-started.md +217 -0
- package/docs/injector.md +544 -0
- package/docs/methodology.md +616 -0
- package/docs/pipeline.md +519 -0
- package/docs/react-api.md +557 -0
- package/docs/ssr.md +442 -0
- package/docs/styles.md +596 -0
- package/docs/tasty-static.md +532 -0
- package/package.json +68 -36
- package/dist/styles/align.d.ts +0 -15
- package/dist/styles/align.js +0 -14
- package/dist/styles/align.js.map +0 -1
- package/dist/styles/justify.d.ts +0 -15
- package/dist/styles/justify.js +0 -14
- package/dist/styles/justify.js.map +0 -1
- package/dist/styles/styledScrollbar.d.ts +0 -47
- package/dist/styles/styledScrollbar.js +0 -38
- package/dist/styles/styledScrollbar.js.map +0 -1
- package/dist/tokens/typography.d.ts +0 -19
- package/dist/tokens/typography.js +0 -237
- package/dist/tokens/typography.js.map +0 -1
- package/dist/utils/hsl-to-rgb.js +0 -38
- package/dist/utils/hsl-to-rgb.js.map +0 -1
- package/dist/utils/okhsl-to-rgb.js +0 -296
- package/dist/utils/okhsl-to-rgb.js.map +0 -1
package/dist/styles/margin.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ declare function marginStyle({
|
|
|
15
15
|
marginRight?: string | number | boolean;
|
|
16
16
|
marginBottom?: string | number | boolean;
|
|
17
17
|
marginLeft?: string | number | boolean;
|
|
18
|
-
}):
|
|
18
|
+
}): Record<string, string> | null;
|
|
19
19
|
declare namespace marginStyle {
|
|
20
20
|
var __lookupStyles: string[];
|
|
21
21
|
}
|
package/dist/styles/margin.js
CHANGED
|
@@ -1,93 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { processDirectionalStyle } from "./directional.js";
|
|
3
2
|
//#region src/styles/margin.ts
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (value === true) value = "1x";
|
|
11
|
-
const { values } = parseStyle(value).groups[0] ?? { values: [] };
|
|
12
|
-
return values[0] || "var(--gap)";
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Extract values and directions from a single parsed group.
|
|
16
|
-
*/
|
|
17
|
-
function extractGroupData(group) {
|
|
18
|
-
const { values = [], mods = [] } = group;
|
|
19
|
-
return {
|
|
20
|
-
values: values.length ? values : ["var(--gap)"],
|
|
21
|
-
directions: filterMods(mods, DIRECTIONS)
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Apply a single group's values and directions onto a direction map.
|
|
26
|
-
*/
|
|
27
|
-
function applyGroup(dirs, values, directions) {
|
|
28
|
-
if (!values.length) return;
|
|
29
|
-
if (directions.length === 0) {
|
|
30
|
-
dirs.top = values[0];
|
|
31
|
-
dirs.right = values[1] || values[0];
|
|
32
|
-
dirs.bottom = values[2] || values[0];
|
|
33
|
-
dirs.left = values[3] || values[1] || values[0];
|
|
34
|
-
} else directions.forEach((dir, i) => {
|
|
35
|
-
dirs[dir] = values[i] ?? values[0];
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Optimize margin output shorthand.
|
|
40
|
-
*/
|
|
41
|
-
function optimizeMargin(dirs) {
|
|
42
|
-
const { top, right, bottom, left } = dirs;
|
|
43
|
-
if (top === right && right === bottom && bottom === left) return { margin: top };
|
|
44
|
-
if (top === bottom && left === right) return { margin: `${top} ${left}` };
|
|
45
|
-
return { margin: `${top} ${right} ${bottom} ${left}` };
|
|
46
|
-
}
|
|
3
|
+
const MARGIN_CONFIG = {
|
|
4
|
+
property: "margin",
|
|
5
|
+
defaultValue: "var(--gap)",
|
|
6
|
+
trueValue: "1x",
|
|
7
|
+
defaultInit: "0"
|
|
8
|
+
};
|
|
47
9
|
function marginStyle({ margin, marginBlock, marginInline, marginTop, marginRight, marginBottom, marginLeft }) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
else if (margin === true) margin = "1x";
|
|
58
|
-
if (typeof margin === "string" && margin) {
|
|
59
|
-
const groups = parseStyle(margin).groups ?? [];
|
|
60
|
-
for (const group of groups) {
|
|
61
|
-
const { values, directions } = extractGroupData(group);
|
|
62
|
-
applyGroup(dirs, values, directions);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
if (marginBlock != null) {
|
|
67
|
-
const val = parseMarginValue(marginBlock);
|
|
68
|
-
if (val) dirs.top = dirs.bottom = val;
|
|
69
|
-
}
|
|
70
|
-
if (marginInline != null) {
|
|
71
|
-
const val = parseMarginValue(marginInline);
|
|
72
|
-
if (val) dirs.left = dirs.right = val;
|
|
73
|
-
}
|
|
74
|
-
if (marginTop != null) {
|
|
75
|
-
const val = parseMarginValue(marginTop);
|
|
76
|
-
if (val) dirs.top = val;
|
|
77
|
-
}
|
|
78
|
-
if (marginRight != null) {
|
|
79
|
-
const val = parseMarginValue(marginRight);
|
|
80
|
-
if (val) dirs.right = val;
|
|
81
|
-
}
|
|
82
|
-
if (marginBottom != null) {
|
|
83
|
-
const val = parseMarginValue(marginBottom);
|
|
84
|
-
if (val) dirs.bottom = val;
|
|
85
|
-
}
|
|
86
|
-
if (marginLeft != null) {
|
|
87
|
-
const val = parseMarginValue(marginLeft);
|
|
88
|
-
if (val) dirs.left = val;
|
|
89
|
-
}
|
|
90
|
-
return optimizeMargin(dirs);
|
|
10
|
+
return processDirectionalStyle(MARGIN_CONFIG, {
|
|
11
|
+
main: margin,
|
|
12
|
+
block: marginBlock,
|
|
13
|
+
inline: marginInline,
|
|
14
|
+
top: marginTop,
|
|
15
|
+
right: marginRight,
|
|
16
|
+
bottom: marginBottom,
|
|
17
|
+
left: marginLeft
|
|
18
|
+
});
|
|
91
19
|
}
|
|
92
20
|
marginStyle.__lookupStyles = [
|
|
93
21
|
"margin",
|
|
@@ -98,7 +26,7 @@ marginStyle.__lookupStyles = [
|
|
|
98
26
|
"marginBlock",
|
|
99
27
|
"marginInline"
|
|
100
28
|
];
|
|
101
|
-
|
|
102
29
|
//#endregion
|
|
103
30
|
export { marginStyle };
|
|
31
|
+
|
|
104
32
|
//# sourceMappingURL=margin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"margin.js","names":[],"sources":["../../src/styles/margin.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"margin.js","names":[],"sources":["../../src/styles/margin.ts"],"sourcesContent":["import { processDirectionalStyle } from './directional';\n\nconst MARGIN_CONFIG = {\n property: 'margin',\n defaultValue: 'var(--gap)',\n trueValue: '1x',\n defaultInit: '0',\n} as const;\n\nexport function marginStyle({\n margin,\n marginBlock,\n marginInline,\n marginTop,\n marginRight,\n marginBottom,\n marginLeft,\n}: {\n margin?: string | number | boolean;\n marginBlock?: string | number | boolean;\n marginInline?: string | number | boolean;\n marginTop?: string | number | boolean;\n marginRight?: string | number | boolean;\n marginBottom?: string | number | boolean;\n marginLeft?: string | number | boolean;\n}) {\n return processDirectionalStyle(MARGIN_CONFIG, {\n main: margin,\n block: marginBlock,\n inline: marginInline,\n top: marginTop,\n right: marginRight,\n bottom: marginBottom,\n left: marginLeft,\n });\n}\n\nmarginStyle.__lookupStyles = [\n 'margin',\n 'marginTop',\n 'marginRight',\n 'marginBottom',\n 'marginLeft',\n 'marginBlock',\n 'marginInline',\n];\n"],"mappings":";;AAEA,MAAM,gBAAgB;CACpB,UAAU;CACV,cAAc;CACd,WAAW;CACX,aAAa;CACd;AAED,SAAgB,YAAY,EAC1B,QACA,aACA,cACA,WACA,aACA,cACA,cASC;AACD,QAAO,wBAAwB,eAAe;EAC5C,MAAM;EACN,OAAO;EACP,QAAQ;EACR,KAAK;EACL,OAAO;EACP,QAAQ;EACR,MAAM;EACP,CAAC;;AAGJ,YAAY,iBAAiB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
|
package/dist/styles/outline.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ interface OutlineStyleProps {
|
|
|
20
20
|
declare function outlineStyle({
|
|
21
21
|
outline,
|
|
22
22
|
outlineOffset
|
|
23
|
-
}: OutlineStyleProps): Record<string, string> |
|
|
23
|
+
}: OutlineStyleProps): Record<string, string> | null;
|
|
24
24
|
declare namespace outlineStyle {
|
|
25
25
|
var __lookupStyles: string[];
|
|
26
26
|
}
|
package/dist/styles/outline.js
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
|
+
import { CSS_WIDE_KEYWORDS } from "../parser/const.js";
|
|
1
2
|
import { filterMods, parseStyle } from "../utils/styles.js";
|
|
2
|
-
|
|
3
|
+
import { BORDER_STYLES } from "./const.js";
|
|
3
4
|
//#region src/styles/outline.ts
|
|
4
|
-
const BORDER_STYLES = [
|
|
5
|
-
"none",
|
|
6
|
-
"hidden",
|
|
7
|
-
"dotted",
|
|
8
|
-
"dashed",
|
|
9
|
-
"solid",
|
|
10
|
-
"double",
|
|
11
|
-
"groove",
|
|
12
|
-
"ridge",
|
|
13
|
-
"inset",
|
|
14
|
-
"outset"
|
|
15
|
-
];
|
|
16
5
|
/**
|
|
17
6
|
* Generates CSS for outline property with optional offset.
|
|
18
7
|
*
|
|
@@ -29,7 +18,8 @@ const BORDER_STYLES = [
|
|
|
29
18
|
*/
|
|
30
19
|
function outlineStyle({ outline, outlineOffset }) {
|
|
31
20
|
const result = {};
|
|
32
|
-
if (outline != null && outline !== false)
|
|
21
|
+
if (outline != null && outline !== false) if (typeof outline === "string" && CSS_WIDE_KEYWORDS.has(outline)) result["outline"] = outline;
|
|
22
|
+
else {
|
|
33
23
|
let outlineValue = outline;
|
|
34
24
|
if (outline === true) outlineValue = "1ow";
|
|
35
25
|
if (outline === 0) outlineValue = "0";
|
|
@@ -55,11 +45,11 @@ function outlineStyle({ outline, outlineOffset }) {
|
|
|
55
45
|
const offsetValue = typeof outlineOffset === "number" ? `${outlineOffset}px` : outlineOffset;
|
|
56
46
|
result["outline-offset"] = parseStyle(offsetValue).groups[0]?.values[0] || offsetValue;
|
|
57
47
|
}
|
|
58
|
-
if (Object.keys(result).length === 0) return;
|
|
48
|
+
if (Object.keys(result).length === 0) return null;
|
|
59
49
|
return result;
|
|
60
50
|
}
|
|
61
51
|
outlineStyle.__lookupStyles = ["outline", "outlineOffset"];
|
|
62
|
-
|
|
63
52
|
//#endregion
|
|
64
53
|
export { outlineStyle };
|
|
54
|
+
|
|
65
55
|
//# sourceMappingURL=outline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outline.js","names":[],"sources":["../../src/styles/outline.ts"],"sourcesContent":["import { filterMods, parseStyle } from '../utils/styles';\
|
|
1
|
+
{"version":3,"file":"outline.js","names":[],"sources":["../../src/styles/outline.ts"],"sourcesContent":["import { CSS_WIDE_KEYWORDS } from '../parser/const';\nimport { filterMods, parseStyle } from '../utils/styles';\nimport { BORDER_STYLES } from './const';\n\ninterface OutlineStyleProps {\n outline?: string | boolean | number;\n outlineOffset?: string | number;\n}\n\n/**\n * Generates CSS for outline property with optional offset.\n *\n * Syntax:\n * - `outline=\"2px solid #red\"` - outline only\n * - `outline=\"2px solid #red / 4px\"` - outline with offset (slash separator)\n * - `outline=\"2px / 4px\"` - width with offset (simpler form)\n * - `outline={true}` - default 1ow solid outline\n * - `outlineOffset=\"4px\"` - offset as separate prop (can be combined with outline)\n *\n * Priority: slash syntax in outline takes precedence over outlineOffset prop\n *\n * @return CSS properties for outline and optionally outline-offset\n */\nexport function outlineStyle({ outline, outlineOffset }: OutlineStyleProps) {\n const result: Record<string, string> = {};\n\n // Handle outline (0 is valid - means no outline)\n if (outline != null && outline !== false) {\n if (typeof outline === 'string' && CSS_WIDE_KEYWORDS.has(outline)) {\n result['outline'] = outline;\n } else {\n let outlineValue: string | boolean | number = outline;\n if (outline === true) outlineValue = '1ow';\n if (outline === 0) outlineValue = '0';\n\n const processed = parseStyle(String(outlineValue));\n const group = processed.groups[0];\n\n if (group) {\n const { parts } = group;\n const outlinePart = parts[0] ?? { values: [], mods: [], colors: [] };\n const offsetPart = parts[1];\n\n const typeMods = filterMods(\n outlinePart.mods,\n BORDER_STYLES as unknown as string[],\n );\n\n const value = outlinePart.values[0] || 'var(--outline-width)';\n const type = typeMods[0] || 'solid';\n const outlineColor = outlinePart.colors[0] || 'var(--outline-color)';\n\n result['outline'] = [value, type, outlineColor].join(' ');\n\n if (offsetPart?.values[0]) {\n result['outline-offset'] = offsetPart.values[0];\n }\n }\n }\n }\n\n // Handle outlineOffset prop (only if not already set by slash syntax)\n if (outlineOffset != null && !result['outline-offset']) {\n const offsetValue =\n typeof outlineOffset === 'number' ? `${outlineOffset}px` : outlineOffset;\n const processed = parseStyle(offsetValue);\n result['outline-offset'] = processed.groups[0]?.values[0] || offsetValue;\n }\n\n if (Object.keys(result).length === 0) {\n return null;\n }\n\n return result;\n}\n\noutlineStyle.__lookupStyles = ['outline', 'outlineOffset'];\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuBA,SAAgB,aAAa,EAAE,SAAS,iBAAoC;CAC1E,MAAM,SAAiC,EAAE;AAGzC,KAAI,WAAW,QAAQ,YAAY,MACjC,KAAI,OAAO,YAAY,YAAY,kBAAkB,IAAI,QAAQ,CAC/D,QAAO,aAAa;MACf;EACL,IAAI,eAA0C;AAC9C,MAAI,YAAY,KAAM,gBAAe;AACrC,MAAI,YAAY,EAAG,gBAAe;EAGlC,MAAM,QADY,WAAW,OAAO,aAAa,CAAC,CAC1B,OAAO;AAE/B,MAAI,OAAO;GACT,MAAM,EAAE,UAAU;GAClB,MAAM,cAAc,MAAM,MAAM;IAAE,QAAQ,EAAE;IAAE,MAAM,EAAE;IAAE,QAAQ,EAAE;IAAE;GACpE,MAAM,aAAa,MAAM;GAEzB,MAAM,WAAW,WACf,YAAY,MACZ,cACD;AAMD,UAAO,aAAa;IAJN,YAAY,OAAO,MAAM;IAC1B,SAAS,MAAM;IACP,YAAY,OAAO,MAAM;IAEC,CAAC,KAAK,IAAI;AAEzD,OAAI,YAAY,OAAO,GACrB,QAAO,oBAAoB,WAAW,OAAO;;;AAOrD,KAAI,iBAAiB,QAAQ,CAAC,OAAO,mBAAmB;EACtD,MAAM,cACJ,OAAO,kBAAkB,WAAW,GAAG,cAAc,MAAM;AAE7D,SAAO,oBADW,WAAW,YAAY,CACJ,OAAO,IAAI,OAAO,MAAM;;AAG/D,KAAI,OAAO,KAAK,OAAO,CAAC,WAAW,EACjC,QAAO;AAGT,QAAO;;AAGT,aAAa,iBAAiB,CAAC,WAAW,gBAAgB"}
|
package/dist/styles/padding.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ declare function paddingStyle({
|
|
|
15
15
|
paddingRight?: string | number | boolean;
|
|
16
16
|
paddingBottom?: string | number | boolean;
|
|
17
17
|
paddingLeft?: string | number | boolean;
|
|
18
|
-
}):
|
|
18
|
+
}): Record<string, string> | null;
|
|
19
19
|
declare namespace paddingStyle {
|
|
20
20
|
var __lookupStyles: string[];
|
|
21
21
|
}
|
package/dist/styles/padding.js
CHANGED
|
@@ -1,93 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { processDirectionalStyle } from "./directional.js";
|
|
3
2
|
//#region src/styles/padding.ts
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (value === true) value = "1x";
|
|
11
|
-
const { values } = parseStyle(value).groups[0] ?? { values: [] };
|
|
12
|
-
return values[0] || "var(--gap)";
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Extract values and directions from a single parsed group.
|
|
16
|
-
*/
|
|
17
|
-
function extractGroupData(group) {
|
|
18
|
-
const { values = [], mods = [] } = group;
|
|
19
|
-
return {
|
|
20
|
-
values: values.length ? values : ["var(--gap)"],
|
|
21
|
-
directions: filterMods(mods, DIRECTIONS)
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Apply a single group's values and directions onto a direction map.
|
|
26
|
-
*/
|
|
27
|
-
function applyGroup(dirs, values, directions) {
|
|
28
|
-
if (!values.length) return;
|
|
29
|
-
if (directions.length === 0) {
|
|
30
|
-
dirs.top = values[0];
|
|
31
|
-
dirs.right = values[1] || values[0];
|
|
32
|
-
dirs.bottom = values[2] || values[0];
|
|
33
|
-
dirs.left = values[3] || values[1] || values[0];
|
|
34
|
-
} else directions.forEach((dir, i) => {
|
|
35
|
-
dirs[dir] = values[i] ?? values[0];
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Optimize padding output shorthand.
|
|
40
|
-
*/
|
|
41
|
-
function optimizePadding(dirs) {
|
|
42
|
-
const { top, right, bottom, left } = dirs;
|
|
43
|
-
if (top === right && right === bottom && bottom === left) return { padding: top };
|
|
44
|
-
if (top === bottom && left === right) return { padding: `${top} ${left}` };
|
|
45
|
-
return { padding: `${top} ${right} ${bottom} ${left}` };
|
|
46
|
-
}
|
|
3
|
+
const PADDING_CONFIG = {
|
|
4
|
+
property: "padding",
|
|
5
|
+
defaultValue: "var(--gap)",
|
|
6
|
+
trueValue: "1x",
|
|
7
|
+
defaultInit: "0"
|
|
8
|
+
};
|
|
47
9
|
function paddingStyle({ padding, paddingBlock, paddingInline, paddingTop, paddingRight, paddingBottom, paddingLeft }) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
else if (padding === true) padding = "1x";
|
|
58
|
-
if (typeof padding === "string" && padding) {
|
|
59
|
-
const groups = parseStyle(padding).groups ?? [];
|
|
60
|
-
for (const group of groups) {
|
|
61
|
-
const { values, directions } = extractGroupData(group);
|
|
62
|
-
applyGroup(dirs, values, directions);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
if (paddingBlock != null) {
|
|
67
|
-
const val = parsePaddingValue(paddingBlock);
|
|
68
|
-
if (val) dirs.top = dirs.bottom = val;
|
|
69
|
-
}
|
|
70
|
-
if (paddingInline != null) {
|
|
71
|
-
const val = parsePaddingValue(paddingInline);
|
|
72
|
-
if (val) dirs.left = dirs.right = val;
|
|
73
|
-
}
|
|
74
|
-
if (paddingTop != null) {
|
|
75
|
-
const val = parsePaddingValue(paddingTop);
|
|
76
|
-
if (val) dirs.top = val;
|
|
77
|
-
}
|
|
78
|
-
if (paddingRight != null) {
|
|
79
|
-
const val = parsePaddingValue(paddingRight);
|
|
80
|
-
if (val) dirs.right = val;
|
|
81
|
-
}
|
|
82
|
-
if (paddingBottom != null) {
|
|
83
|
-
const val = parsePaddingValue(paddingBottom);
|
|
84
|
-
if (val) dirs.bottom = val;
|
|
85
|
-
}
|
|
86
|
-
if (paddingLeft != null) {
|
|
87
|
-
const val = parsePaddingValue(paddingLeft);
|
|
88
|
-
if (val) dirs.left = val;
|
|
89
|
-
}
|
|
90
|
-
return optimizePadding(dirs);
|
|
10
|
+
return processDirectionalStyle(PADDING_CONFIG, {
|
|
11
|
+
main: padding,
|
|
12
|
+
block: paddingBlock,
|
|
13
|
+
inline: paddingInline,
|
|
14
|
+
top: paddingTop,
|
|
15
|
+
right: paddingRight,
|
|
16
|
+
bottom: paddingBottom,
|
|
17
|
+
left: paddingLeft
|
|
18
|
+
});
|
|
91
19
|
}
|
|
92
20
|
paddingStyle.__lookupStyles = [
|
|
93
21
|
"padding",
|
|
@@ -98,7 +26,7 @@ paddingStyle.__lookupStyles = [
|
|
|
98
26
|
"paddingBlock",
|
|
99
27
|
"paddingInline"
|
|
100
28
|
];
|
|
101
|
-
|
|
102
29
|
//#endregion
|
|
103
30
|
export { paddingStyle };
|
|
31
|
+
|
|
104
32
|
//# sourceMappingURL=padding.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"padding.js","names":[],"sources":["../../src/styles/padding.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"padding.js","names":[],"sources":["../../src/styles/padding.ts"],"sourcesContent":["import { processDirectionalStyle } from './directional';\n\nconst PADDING_CONFIG = {\n property: 'padding',\n defaultValue: 'var(--gap)',\n trueValue: '1x',\n defaultInit: '0',\n} as const;\n\nexport function paddingStyle({\n padding,\n paddingBlock,\n paddingInline,\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n}: {\n padding?: string | number | boolean;\n paddingBlock?: string | number | boolean;\n paddingInline?: string | number | boolean;\n paddingTop?: string | number | boolean;\n paddingRight?: string | number | boolean;\n paddingBottom?: string | number | boolean;\n paddingLeft?: string | number | boolean;\n}) {\n return processDirectionalStyle(PADDING_CONFIG, {\n main: padding,\n block: paddingBlock,\n inline: paddingInline,\n top: paddingTop,\n right: paddingRight,\n bottom: paddingBottom,\n left: paddingLeft,\n });\n}\n\npaddingStyle.__lookupStyles = [\n 'padding',\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n 'paddingBlock',\n 'paddingInline',\n];\n"],"mappings":";;AAEA,MAAM,iBAAiB;CACrB,UAAU;CACV,cAAc;CACd,WAAW;CACX,aAAa;CACd;AAED,SAAgB,aAAa,EAC3B,SACA,cACA,eACA,YACA,cACA,eACA,eASC;AACD,QAAO,wBAAwB,gBAAgB;EAC7C,MAAM;EACN,OAAO;EACP,QAAQ;EACR,KAAK;EACL,OAAO;EACP,QAAQ;EACR,MAAM;EACP,CAAC;;AAGJ,aAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//#region src/styles/placement.d.ts
|
|
2
|
+
interface PlacementStyleProps {
|
|
3
|
+
place?: string | boolean;
|
|
4
|
+
placeItems?: string | boolean;
|
|
5
|
+
placeContent?: string | boolean;
|
|
6
|
+
align?: string | boolean;
|
|
7
|
+
justify?: string | boolean;
|
|
8
|
+
alignItems?: string | boolean;
|
|
9
|
+
alignContent?: string | boolean;
|
|
10
|
+
justifyItems?: string | boolean;
|
|
11
|
+
justifyContent?: string | boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Unified placement handler replacing align, justify, and place.
|
|
15
|
+
*
|
|
16
|
+
* Priority (later overrides earlier):
|
|
17
|
+
* 1. place (lowest) — sets all 4 longhands
|
|
18
|
+
* 2. placeItems, placeContent, align, justify (medium) — each sets 2 longhands
|
|
19
|
+
* 3. alignItems, alignContent, justifyItems, justifyContent (highest) — each sets 1 longhand
|
|
20
|
+
*/
|
|
21
|
+
declare function placementStyle({
|
|
22
|
+
place,
|
|
23
|
+
placeItems,
|
|
24
|
+
placeContent,
|
|
25
|
+
align,
|
|
26
|
+
justify,
|
|
27
|
+
alignItems,
|
|
28
|
+
alignContent,
|
|
29
|
+
justifyItems,
|
|
30
|
+
justifyContent
|
|
31
|
+
}: PlacementStyleProps): Record<string, string> | null;
|
|
32
|
+
declare namespace placementStyle {
|
|
33
|
+
var __lookupStyles: string[];
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { placementStyle };
|
|
37
|
+
//# sourceMappingURL=placement.d.ts.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
//#region src/styles/placement.ts
|
|
2
|
+
function str(val) {
|
|
3
|
+
if (val == null || val === false || val === "") return null;
|
|
4
|
+
if (val === true) return "center";
|
|
5
|
+
return String(val);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Unified placement handler replacing align, justify, and place.
|
|
9
|
+
*
|
|
10
|
+
* Priority (later overrides earlier):
|
|
11
|
+
* 1. place (lowest) — sets all 4 longhands
|
|
12
|
+
* 2. placeItems, placeContent, align, justify (medium) — each sets 2 longhands
|
|
13
|
+
* 3. alignItems, alignContent, justifyItems, justifyContent (highest) — each sets 1 longhand
|
|
14
|
+
*/
|
|
15
|
+
function placementStyle({ place, placeItems, placeContent, align, justify, alignItems, alignContent, justifyItems, justifyContent }) {
|
|
16
|
+
const result = {};
|
|
17
|
+
const placeVal = str(place);
|
|
18
|
+
if (placeVal) {
|
|
19
|
+
const parts = placeVal.split(/\s+/);
|
|
20
|
+
const first = parts[0];
|
|
21
|
+
const second = parts[1] || first;
|
|
22
|
+
result["align-items"] = first;
|
|
23
|
+
result["justify-items"] = second;
|
|
24
|
+
result["align-content"] = first;
|
|
25
|
+
result["justify-content"] = second;
|
|
26
|
+
}
|
|
27
|
+
const placeItemsVal = str(placeItems);
|
|
28
|
+
if (placeItemsVal) {
|
|
29
|
+
const parts = placeItemsVal.split(/\s+/);
|
|
30
|
+
result["align-items"] = parts[0];
|
|
31
|
+
result["justify-items"] = parts[1] || parts[0];
|
|
32
|
+
}
|
|
33
|
+
const placeContentVal = str(placeContent);
|
|
34
|
+
if (placeContentVal) {
|
|
35
|
+
const parts = placeContentVal.split(/\s+/);
|
|
36
|
+
result["align-content"] = parts[0];
|
|
37
|
+
result["justify-content"] = parts[1] || parts[0];
|
|
38
|
+
}
|
|
39
|
+
const alignVal = str(align);
|
|
40
|
+
if (alignVal) {
|
|
41
|
+
result["align-items"] = alignVal;
|
|
42
|
+
result["align-content"] = alignVal;
|
|
43
|
+
}
|
|
44
|
+
const justifyVal = str(justify);
|
|
45
|
+
if (justifyVal) {
|
|
46
|
+
result["justify-items"] = justifyVal;
|
|
47
|
+
result["justify-content"] = justifyVal;
|
|
48
|
+
}
|
|
49
|
+
const alignItemsVal = str(alignItems);
|
|
50
|
+
if (alignItemsVal) result["align-items"] = alignItemsVal;
|
|
51
|
+
const alignContentVal = str(alignContent);
|
|
52
|
+
if (alignContentVal) result["align-content"] = alignContentVal;
|
|
53
|
+
const justifyItemsVal = str(justifyItems);
|
|
54
|
+
if (justifyItemsVal) result["justify-items"] = justifyItemsVal;
|
|
55
|
+
const justifyContentVal = str(justifyContent);
|
|
56
|
+
if (justifyContentVal) result["justify-content"] = justifyContentVal;
|
|
57
|
+
if (Object.keys(result).length === 0) return null;
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
placementStyle.__lookupStyles = [
|
|
61
|
+
"place",
|
|
62
|
+
"placeItems",
|
|
63
|
+
"placeContent",
|
|
64
|
+
"align",
|
|
65
|
+
"justify",
|
|
66
|
+
"alignItems",
|
|
67
|
+
"alignContent",
|
|
68
|
+
"justifyItems",
|
|
69
|
+
"justifyContent"
|
|
70
|
+
];
|
|
71
|
+
//#endregion
|
|
72
|
+
export { placementStyle };
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=placement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"placement.js","names":[],"sources":["../../src/styles/placement.ts"],"sourcesContent":["interface PlacementStyleProps {\n place?: string | boolean;\n placeItems?: string | boolean;\n placeContent?: string | boolean;\n align?: string | boolean;\n justify?: string | boolean;\n alignItems?: string | boolean;\n alignContent?: string | boolean;\n justifyItems?: string | boolean;\n justifyContent?: string | boolean;\n}\n\nfunction str(val: string | boolean | undefined): string | null {\n if (val == null || val === false || val === '') return null;\n if (val === true) return 'center';\n\n return String(val);\n}\n\n/**\n * Unified placement handler replacing align, justify, and place.\n *\n * Priority (later overrides earlier):\n * 1. place (lowest) — sets all 4 longhands\n * 2. placeItems, placeContent, align, justify (medium) — each sets 2 longhands\n * 3. alignItems, alignContent, justifyItems, justifyContent (highest) — each sets 1 longhand\n */\nexport function placementStyle({\n place,\n placeItems,\n placeContent,\n align,\n justify,\n alignItems,\n alignContent,\n justifyItems,\n justifyContent,\n}: PlacementStyleProps) {\n const result: Record<string, string> = {};\n\n const placeVal = str(place);\n\n if (placeVal) {\n const parts = placeVal.split(/\\s+/);\n const first = parts[0];\n const second = parts[1] || first;\n\n result['align-items'] = first;\n result['justify-items'] = second;\n result['align-content'] = first;\n result['justify-content'] = second;\n }\n\n const placeItemsVal = str(placeItems);\n\n if (placeItemsVal) {\n const parts = placeItemsVal.split(/\\s+/);\n\n result['align-items'] = parts[0];\n result['justify-items'] = parts[1] || parts[0];\n }\n\n const placeContentVal = str(placeContent);\n\n if (placeContentVal) {\n const parts = placeContentVal.split(/\\s+/);\n\n result['align-content'] = parts[0];\n result['justify-content'] = parts[1] || parts[0];\n }\n\n const alignVal = str(align);\n\n if (alignVal) {\n result['align-items'] = alignVal;\n result['align-content'] = alignVal;\n }\n\n const justifyVal = str(justify);\n\n if (justifyVal) {\n result['justify-items'] = justifyVal;\n result['justify-content'] = justifyVal;\n }\n\n const alignItemsVal = str(alignItems);\n\n if (alignItemsVal) result['align-items'] = alignItemsVal;\n\n const alignContentVal = str(alignContent);\n\n if (alignContentVal) result['align-content'] = alignContentVal;\n\n const justifyItemsVal = str(justifyItems);\n\n if (justifyItemsVal) result['justify-items'] = justifyItemsVal;\n\n const justifyContentVal = str(justifyContent);\n\n if (justifyContentVal) result['justify-content'] = justifyContentVal;\n\n if (Object.keys(result).length === 0) return null;\n\n return result;\n}\n\nplacementStyle.__lookupStyles = [\n 'place',\n 'placeItems',\n 'placeContent',\n 'align',\n 'justify',\n 'alignItems',\n 'alignContent',\n 'justifyItems',\n 'justifyContent',\n];\n"],"mappings":";AAYA,SAAS,IAAI,KAAkD;AAC7D,KAAI,OAAO,QAAQ,QAAQ,SAAS,QAAQ,GAAI,QAAO;AACvD,KAAI,QAAQ,KAAM,QAAO;AAEzB,QAAO,OAAO,IAAI;;;;;;;;;;AAWpB,SAAgB,eAAe,EAC7B,OACA,YACA,cACA,OACA,SACA,YACA,cACA,cACA,kBACsB;CACtB,MAAM,SAAiC,EAAE;CAEzC,MAAM,WAAW,IAAI,MAAM;AAE3B,KAAI,UAAU;EACZ,MAAM,QAAQ,SAAS,MAAM,MAAM;EACnC,MAAM,QAAQ,MAAM;EACpB,MAAM,SAAS,MAAM,MAAM;AAE3B,SAAO,iBAAiB;AACxB,SAAO,mBAAmB;AAC1B,SAAO,mBAAmB;AAC1B,SAAO,qBAAqB;;CAG9B,MAAM,gBAAgB,IAAI,WAAW;AAErC,KAAI,eAAe;EACjB,MAAM,QAAQ,cAAc,MAAM,MAAM;AAExC,SAAO,iBAAiB,MAAM;AAC9B,SAAO,mBAAmB,MAAM,MAAM,MAAM;;CAG9C,MAAM,kBAAkB,IAAI,aAAa;AAEzC,KAAI,iBAAiB;EACnB,MAAM,QAAQ,gBAAgB,MAAM,MAAM;AAE1C,SAAO,mBAAmB,MAAM;AAChC,SAAO,qBAAqB,MAAM,MAAM,MAAM;;CAGhD,MAAM,WAAW,IAAI,MAAM;AAE3B,KAAI,UAAU;AACZ,SAAO,iBAAiB;AACxB,SAAO,mBAAmB;;CAG5B,MAAM,aAAa,IAAI,QAAQ;AAE/B,KAAI,YAAY;AACd,SAAO,mBAAmB;AAC1B,SAAO,qBAAqB;;CAG9B,MAAM,gBAAgB,IAAI,WAAW;AAErC,KAAI,cAAe,QAAO,iBAAiB;CAE3C,MAAM,kBAAkB,IAAI,aAAa;AAEzC,KAAI,gBAAiB,QAAO,mBAAmB;CAE/C,MAAM,kBAAkB,IAAI,aAAa;AAEzC,KAAI,gBAAiB,QAAO,mBAAmB;CAE/C,MAAM,oBAAoB,IAAI,eAAe;AAE7C,KAAI,kBAAmB,QAAO,qBAAqB;AAEnD,KAAI,OAAO,KAAK,OAAO,CAAC,WAAW,EAAG,QAAO;AAE7C,QAAO;;AAGT,eAAe,iBAAiB;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { alignStyle } from "./align.js";
|
|
2
1
|
import { borderStyle } from "./border.js";
|
|
3
2
|
import { colorStyle } from "./color.js";
|
|
4
3
|
import { displayStyle } from "./display.js";
|
|
@@ -8,15 +7,15 @@ import { flowStyle } from "./flow.js";
|
|
|
8
7
|
import { gapStyle } from "./gap.js";
|
|
9
8
|
import { heightStyle } from "./height.js";
|
|
10
9
|
import { insetStyle } from "./inset.js";
|
|
11
|
-
import { justifyStyle } from "./justify.js";
|
|
12
10
|
import { marginStyle } from "./margin.js";
|
|
13
11
|
import { outlineStyle } from "./outline.js";
|
|
14
12
|
import { paddingStyle } from "./padding.js";
|
|
13
|
+
import { placementStyle } from "./placement.js";
|
|
15
14
|
import { presetStyle } from "./preset.js";
|
|
16
15
|
import { radiusStyle } from "./radius.js";
|
|
16
|
+
import { scrollMarginStyle } from "./scrollMargin.js";
|
|
17
17
|
import { scrollbarStyle } from "./scrollbar.js";
|
|
18
18
|
import { shadowStyle } from "./shadow.js";
|
|
19
|
-
import { styledScrollbarStyle } from "./styledScrollbar.js";
|
|
20
19
|
import { transitionStyle } from "./transition.js";
|
|
21
20
|
import { widthStyle } from "./width.js";
|
|
22
21
|
|
|
@@ -45,7 +44,6 @@ import { widthStyle } from "./width.js";
|
|
|
45
44
|
* ```
|
|
46
45
|
*/
|
|
47
46
|
declare const styleHandlers: {
|
|
48
|
-
readonly align: typeof alignStyle;
|
|
49
47
|
readonly border: typeof borderStyle;
|
|
50
48
|
readonly color: typeof colorStyle;
|
|
51
49
|
readonly display: typeof displayStyle;
|
|
@@ -56,15 +54,15 @@ declare const styleHandlers: {
|
|
|
56
54
|
readonly gap: typeof gapStyle;
|
|
57
55
|
readonly height: typeof heightStyle;
|
|
58
56
|
readonly inset: typeof insetStyle;
|
|
59
|
-
readonly justify: typeof justifyStyle;
|
|
60
57
|
readonly margin: typeof marginStyle;
|
|
61
58
|
readonly outline: typeof outlineStyle;
|
|
62
59
|
readonly padding: typeof paddingStyle;
|
|
60
|
+
readonly placement: typeof placementStyle;
|
|
63
61
|
readonly preset: typeof presetStyle;
|
|
64
62
|
readonly radius: typeof radiusStyle;
|
|
63
|
+
readonly scrollMargin: typeof scrollMarginStyle;
|
|
65
64
|
readonly scrollbar: typeof scrollbarStyle;
|
|
66
65
|
readonly shadow: typeof shadowStyle;
|
|
67
|
-
readonly styledScrollbar: typeof styledScrollbarStyle;
|
|
68
66
|
readonly transition: typeof transitionStyle;
|
|
69
67
|
readonly width: typeof widthStyle;
|
|
70
68
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { isDevEnv } from "../utils/is-dev-env.js";
|
|
2
|
-
import { alignStyle } from "./align.js";
|
|
3
2
|
import { borderStyle } from "./border.js";
|
|
4
3
|
import { createStyle } from "./createStyle.js";
|
|
5
4
|
import { colorStyle } from "./color.js";
|
|
@@ -10,18 +9,17 @@ import { flowStyle } from "./flow.js";
|
|
|
10
9
|
import { gapStyle } from "./gap.js";
|
|
11
10
|
import { heightStyle } from "./height.js";
|
|
12
11
|
import { insetStyle } from "./inset.js";
|
|
13
|
-
import { justifyStyle } from "./justify.js";
|
|
14
12
|
import { marginStyle } from "./margin.js";
|
|
15
13
|
import { outlineStyle } from "./outline.js";
|
|
16
14
|
import { paddingStyle } from "./padding.js";
|
|
15
|
+
import { placementStyle } from "./placement.js";
|
|
17
16
|
import { presetStyle } from "./preset.js";
|
|
18
17
|
import { radiusStyle } from "./radius.js";
|
|
18
|
+
import { scrollMarginStyle } from "./scrollMargin.js";
|
|
19
19
|
import { scrollbarStyle } from "./scrollbar.js";
|
|
20
20
|
import { shadowStyle } from "./shadow.js";
|
|
21
|
-
import { styledScrollbarStyle } from "./styledScrollbar.js";
|
|
22
21
|
import { transitionStyle } from "./transition.js";
|
|
23
22
|
import { widthStyle } from "./width.js";
|
|
24
|
-
|
|
25
23
|
//#region src/styles/predefined.ts
|
|
26
24
|
const devMode = isDevEnv();
|
|
27
25
|
const columnsConverter = (val) => {
|
|
@@ -56,7 +54,7 @@ function defineCustomStyle(names, handler) {
|
|
|
56
54
|
names = handlerWithLookup.__lookupStyles;
|
|
57
55
|
} else if (handler) handlerWithLookup = Object.assign(handler, { __lookupStyles: names });
|
|
58
56
|
else {
|
|
59
|
-
console.warn("
|
|
57
|
+
console.warn("Tasty: incorrect custom style definition: ", names);
|
|
60
58
|
return;
|
|
61
59
|
}
|
|
62
60
|
if (Array.isArray(names)) names.forEach((name) => {
|
|
@@ -92,11 +90,10 @@ function predefine() {
|
|
|
92
90
|
borderStyle,
|
|
93
91
|
shadowStyle,
|
|
94
92
|
paddingStyle,
|
|
95
|
-
|
|
96
|
-
justifyStyle,
|
|
93
|
+
placementStyle,
|
|
97
94
|
presetStyle,
|
|
95
|
+
scrollMarginStyle,
|
|
98
96
|
outlineStyle,
|
|
99
|
-
styledScrollbarStyle,
|
|
100
97
|
scrollbarStyle,
|
|
101
98
|
fadeStyle,
|
|
102
99
|
insetStyle
|
|
@@ -138,7 +135,7 @@ function normalizeHandlerDefinition(keyName, definition) {
|
|
|
138
135
|
*/
|
|
139
136
|
function validateHandler(name, handler, lookupStyles) {
|
|
140
137
|
if (!devMode) return;
|
|
141
|
-
if (typeof handler !== "function") console.warn(`[Tasty] Handler "${name}" is not a function. Handlers must be functions that return CSSMap, CSSMap[], or
|
|
138
|
+
if (typeof handler !== "function") console.warn(`[Tasty] Handler "${name}" is not a function. Handlers must be functions that return CSSMap, CSSMap[], or null.`);
|
|
142
139
|
if (!lookupStyles || !Array.isArray(lookupStyles) || lookupStyles.length === 0) console.warn(`[Tasty] Handler "${name}" has invalid lookupStyles. Expected non-empty array of style names.`);
|
|
143
140
|
}
|
|
144
141
|
/**
|
|
@@ -212,7 +209,6 @@ function wrapHandler(handler) {
|
|
|
212
209
|
* ```
|
|
213
210
|
*/
|
|
214
211
|
const styleHandlers = {
|
|
215
|
-
align: wrapHandler(alignStyle),
|
|
216
212
|
border: wrapHandler(borderStyle),
|
|
217
213
|
color: wrapHandler(colorStyle),
|
|
218
214
|
display: wrapHandler(displayStyle),
|
|
@@ -223,19 +219,19 @@ const styleHandlers = {
|
|
|
223
219
|
gap: wrapHandler(gapStyle),
|
|
224
220
|
height: wrapHandler(heightStyle),
|
|
225
221
|
inset: wrapHandler(insetStyle),
|
|
226
|
-
justify: wrapHandler(justifyStyle),
|
|
227
222
|
margin: wrapHandler(marginStyle),
|
|
228
223
|
outline: wrapHandler(outlineStyle),
|
|
229
224
|
padding: wrapHandler(paddingStyle),
|
|
225
|
+
placement: wrapHandler(placementStyle),
|
|
230
226
|
preset: wrapHandler(presetStyle),
|
|
231
227
|
radius: wrapHandler(radiusStyle),
|
|
228
|
+
scrollMargin: wrapHandler(scrollMarginStyle),
|
|
232
229
|
scrollbar: wrapHandler(scrollbarStyle),
|
|
233
230
|
shadow: wrapHandler(shadowStyle),
|
|
234
|
-
styledScrollbar: wrapHandler(styledScrollbarStyle),
|
|
235
231
|
transition: wrapHandler(transitionStyle),
|
|
236
232
|
width: wrapHandler(widthStyle)
|
|
237
233
|
};
|
|
238
|
-
|
|
239
234
|
//#endregion
|
|
240
235
|
export { normalizeHandlerDefinition, predefine, registerHandler, resetHandlers, styleHandlers };
|
|
236
|
+
|
|
241
237
|
//# sourceMappingURL=predefined.js.map
|