@tenphi/tasty 2.0.2 → 2.0.4
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/dist/{ssr/async-storage.js → async-storage-B7_o6FKt.js} +2 -2
- package/dist/async-storage-B7_o6FKt.js.map +1 -0
- package/dist/{ssr/collector.d.ts → collector-CkZ517g4.d.ts} +3 -3
- package/dist/{ssr/collector.js → collector-DXqvGOb1.js} +5 -10
- package/dist/collector-DXqvGOb1.js.map +1 -0
- package/dist/config-5jzS6k6B.js +10005 -0
- package/dist/config-5jzS6k6B.js.map +1 -0
- package/dist/config-DknGsfMo.d.ts +857 -0
- package/dist/{ssr/context.js → context-CkSg-kDT.js} +11 -3
- package/dist/context-CkSg-kDT.js.map +1 -0
- package/dist/core/index.d.ts +5 -34
- package/dist/core/index.js +5 -26
- package/dist/core-CtU6-9OC.js +1507 -0
- package/dist/core-CtU6-9OC.js.map +1 -0
- package/dist/{zero/extractor.js → css-writer-DHkX0JuE.js} +74 -11
- package/dist/css-writer-DHkX0JuE.js.map +1 -0
- package/dist/{ssr/format-global-rules.js → format-global-rules-Dbc_1tc3.js} +2 -2
- package/dist/format-global-rules-Dbc_1tc3.js.map +1 -0
- package/dist/format-rules-DH13ewDu.js +143 -0
- package/dist/format-rules-DH13ewDu.js.map +1 -0
- package/dist/{ssr/hydrate.js → hydrate-C1Gv-DoS.js} +3 -3
- package/dist/hydrate-C1Gv-DoS.js.map +1 -0
- package/dist/{styles/types.d.ts → index-PzENbpAq.d.ts} +701 -5
- package/dist/index-o7zV2yCr.d.ts +1561 -0
- package/dist/index.d.ts +5 -51
- package/dist/index.js +728 -35
- package/dist/index.js.map +1 -0
- package/dist/keyframes-b7X3UxDV.js +587 -0
- package/dist/keyframes-b7X3UxDV.js.map +1 -0
- package/dist/{utils/merge-styles.d.ts → merge-styles-C7KTy7MY.d.ts} +3 -3
- package/dist/{utils/merge-styles.js → merge-styles-Tgo3BbL2.js} +3 -4
- package/dist/merge-styles-Tgo3BbL2.js.map +1 -0
- package/dist/{utils/resolve-recipes.js → resolve-recipes-Ca2-5CxM.js} +4 -6
- package/dist/resolve-recipes-Ca2-5CxM.js.map +1 -0
- package/dist/ssr/astro-client.js +1 -1
- package/dist/ssr/astro.js +4 -4
- package/dist/ssr/index.d.ts +44 -4
- package/dist/ssr/index.js +4 -4
- package/dist/ssr/next.d.ts +1 -1
- package/dist/ssr/next.js +6 -6
- package/dist/ssr/next.js.map +1 -1
- package/dist/static/index.d.ts +91 -5
- package/dist/static/index.js +49 -3
- package/dist/static/index.js.map +1 -0
- package/dist/zero/babel.d.ts +1 -1
- package/dist/zero/babel.js +10 -6
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +67 -3
- package/dist/zero/index.js +1 -2
- package/docs/pipeline.md +204 -50
- package/package.json +3 -3
- package/dist/_virtual/_rolldown/runtime.js +0 -7
- package/dist/chunks/cacheKey.d.ts +0 -1
- package/dist/chunks/cacheKey.js +0 -77
- package/dist/chunks/cacheKey.js.map +0 -1
- package/dist/chunks/definitions.d.ts +0 -37
- package/dist/chunks/definitions.js +0 -258
- package/dist/chunks/definitions.js.map +0 -1
- package/dist/chunks/index.d.ts +0 -1
- package/dist/chunks/renderChunk.d.ts +0 -1
- package/dist/chunks/renderChunk.js +0 -59
- package/dist/chunks/renderChunk.js.map +0 -1
- package/dist/compute-styles.d.ts +0 -31
- package/dist/compute-styles.js +0 -322
- package/dist/compute-styles.js.map +0 -1
- package/dist/config.d.ts +0 -407
- package/dist/config.js +0 -591
- package/dist/config.js.map +0 -1
- package/dist/counter-style/index.js +0 -51
- package/dist/counter-style/index.js.map +0 -1
- package/dist/debug.d.ts +0 -89
- package/dist/debug.js +0 -453
- package/dist/debug.js.map +0 -1
- package/dist/font-face/index.js +0 -63
- package/dist/font-face/index.js.map +0 -1
- package/dist/hooks/index.d.ts +0 -7
- package/dist/hooks/useCounterStyle.d.ts +0 -36
- package/dist/hooks/useCounterStyle.js +0 -65
- package/dist/hooks/useCounterStyle.js.map +0 -1
- package/dist/hooks/useFontFace.d.ts +0 -45
- package/dist/hooks/useFontFace.js +0 -66
- package/dist/hooks/useFontFace.js.map +0 -1
- package/dist/hooks/useGlobalStyles.d.ts +0 -46
- package/dist/hooks/useGlobalStyles.js +0 -88
- package/dist/hooks/useGlobalStyles.js.map +0 -1
- package/dist/hooks/useKeyframes.d.ts +0 -58
- package/dist/hooks/useKeyframes.js +0 -55
- package/dist/hooks/useKeyframes.js.map +0 -1
- package/dist/hooks/useProperty.d.ts +0 -81
- package/dist/hooks/useProperty.js +0 -96
- package/dist/hooks/useProperty.js.map +0 -1
- package/dist/hooks/useRawCSS.d.ts +0 -22
- package/dist/hooks/useRawCSS.js +0 -103
- package/dist/hooks/useRawCSS.js.map +0 -1
- package/dist/hooks/useStyles.d.ts +0 -40
- package/dist/hooks/useStyles.js +0 -31
- package/dist/hooks/useStyles.js.map +0 -1
- package/dist/injector/index.d.ts +0 -182
- package/dist/injector/index.js +0 -185
- package/dist/injector/index.js.map +0 -1
- package/dist/injector/injector.d.ts +0 -198
- package/dist/injector/injector.js +0 -651
- package/dist/injector/injector.js.map +0 -1
- package/dist/injector/sheet-manager.d.ts +0 -132
- package/dist/injector/sheet-manager.js +0 -699
- package/dist/injector/sheet-manager.js.map +0 -1
- package/dist/injector/types.d.ts +0 -235
- package/dist/keyframes/index.js +0 -206
- package/dist/keyframes/index.js.map +0 -1
- package/dist/parser/classify.js +0 -319
- package/dist/parser/classify.js.map +0 -1
- package/dist/parser/const.js +0 -60
- package/dist/parser/const.js.map +0 -1
- package/dist/parser/lru.js +0 -109
- package/dist/parser/lru.js.map +0 -1
- package/dist/parser/parser.d.ts +0 -25
- package/dist/parser/parser.js +0 -115
- package/dist/parser/parser.js.map +0 -1
- package/dist/parser/tokenizer.js +0 -69
- package/dist/parser/tokenizer.js.map +0 -1
- package/dist/parser/types.d.ts +0 -51
- package/dist/parser/types.js +0 -46
- package/dist/parser/types.js.map +0 -1
- package/dist/pipeline/conditions.d.ts +0 -134
- package/dist/pipeline/conditions.js +0 -406
- package/dist/pipeline/conditions.js.map +0 -1
- package/dist/pipeline/exclusive.js +0 -382
- package/dist/pipeline/exclusive.js.map +0 -1
- package/dist/pipeline/index.d.ts +0 -55
- package/dist/pipeline/index.js +0 -708
- package/dist/pipeline/index.js.map +0 -1
- package/dist/pipeline/materialize.js +0 -1157
- package/dist/pipeline/materialize.js.map +0 -1
- package/dist/pipeline/parseStateKey.d.ts +0 -15
- package/dist/pipeline/parseStateKey.js +0 -446
- package/dist/pipeline/parseStateKey.js.map +0 -1
- package/dist/pipeline/simplify.js +0 -690
- package/dist/pipeline/simplify.js.map +0 -1
- package/dist/pipeline/warnings.js +0 -18
- package/dist/pipeline/warnings.js.map +0 -1
- package/dist/plugins/index.d.ts +0 -2
- package/dist/plugins/okhsl-plugin.d.ts +0 -35
- package/dist/plugins/okhsl-plugin.js +0 -97
- package/dist/plugins/okhsl-plugin.js.map +0 -1
- package/dist/plugins/types.d.ts +0 -87
- package/dist/properties/index.js +0 -222
- package/dist/properties/index.js.map +0 -1
- package/dist/properties/property-type-resolver.d.ts +0 -24
- package/dist/properties/property-type-resolver.js +0 -90
- package/dist/properties/property-type-resolver.js.map +0 -1
- package/dist/rsc-cache.js +0 -79
- package/dist/rsc-cache.js.map +0 -1
- package/dist/ssr/async-storage.d.ts +0 -17
- package/dist/ssr/async-storage.js.map +0 -1
- package/dist/ssr/collect-auto-properties.js +0 -58
- package/dist/ssr/collect-auto-properties.js.map +0 -1
- package/dist/ssr/collector.js.map +0 -1
- package/dist/ssr/context.js.map +0 -1
- package/dist/ssr/format-global-rules.js.map +0 -1
- package/dist/ssr/format-keyframes.js +0 -69
- package/dist/ssr/format-keyframes.js.map +0 -1
- package/dist/ssr/format-property.js +0 -49
- package/dist/ssr/format-property.js.map +0 -1
- package/dist/ssr/format-rules.js +0 -73
- package/dist/ssr/format-rules.js.map +0 -1
- package/dist/ssr/hydrate.d.ts +0 -29
- package/dist/ssr/hydrate.js.map +0 -1
- package/dist/ssr/ssr-collector-ref.js +0 -29
- package/dist/ssr/ssr-collector-ref.js.map +0 -1
- package/dist/states/index.d.ts +0 -49
- package/dist/states/index.js +0 -170
- package/dist/states/index.js.map +0 -1
- package/dist/static/tastyStatic.d.ts +0 -46
- package/dist/static/tastyStatic.js +0 -30
- package/dist/static/tastyStatic.js.map +0 -1
- package/dist/static/types.d.ts +0 -49
- package/dist/static/types.js +0 -24
- package/dist/static/types.js.map +0 -1
- package/dist/styles/border.d.ts +0 -25
- package/dist/styles/border.js +0 -120
- package/dist/styles/border.js.map +0 -1
- package/dist/styles/color.d.ts +0 -14
- package/dist/styles/color.js +0 -26
- package/dist/styles/color.js.map +0 -1
- package/dist/styles/const.js +0 -17
- package/dist/styles/const.js.map +0 -1
- package/dist/styles/createStyle.js +0 -79
- package/dist/styles/createStyle.js.map +0 -1
- package/dist/styles/dimension.js +0 -109
- package/dist/styles/dimension.js.map +0 -1
- package/dist/styles/directional.js +0 -133
- package/dist/styles/directional.js.map +0 -1
- package/dist/styles/display.d.ts +0 -30
- package/dist/styles/display.js +0 -73
- package/dist/styles/display.js.map +0 -1
- package/dist/styles/fade.d.ts +0 -15
- package/dist/styles/fade.js +0 -62
- package/dist/styles/fade.js.map +0 -1
- package/dist/styles/fill.d.ts +0 -42
- package/dist/styles/fill.js +0 -51
- package/dist/styles/fill.js.map +0 -1
- package/dist/styles/flow.d.ts +0 -16
- package/dist/styles/flow.js +0 -12
- package/dist/styles/flow.js.map +0 -1
- package/dist/styles/gap.d.ts +0 -31
- package/dist/styles/gap.js +0 -38
- package/dist/styles/gap.js.map +0 -1
- package/dist/styles/height.d.ts +0 -17
- package/dist/styles/height.js +0 -19
- package/dist/styles/height.js.map +0 -1
- package/dist/styles/index.d.ts +0 -1
- package/dist/styles/index.js +0 -8
- package/dist/styles/index.js.map +0 -1
- package/dist/styles/inset.d.ts +0 -24
- package/dist/styles/inset.js +0 -34
- package/dist/styles/inset.js.map +0 -1
- package/dist/styles/list.d.ts +0 -16
- package/dist/styles/list.js +0 -100
- package/dist/styles/list.js.map +0 -1
- package/dist/styles/margin.d.ts +0 -24
- package/dist/styles/margin.js +0 -32
- package/dist/styles/margin.js.map +0 -1
- package/dist/styles/outline.d.ts +0 -29
- package/dist/styles/outline.js +0 -55
- package/dist/styles/outline.js.map +0 -1
- package/dist/styles/padding.d.ts +0 -24
- package/dist/styles/padding.js +0 -32
- package/dist/styles/padding.js.map +0 -1
- package/dist/styles/placement.d.ts +0 -37
- package/dist/styles/placement.js +0 -74
- package/dist/styles/placement.js.map +0 -1
- package/dist/styles/predefined.d.ts +0 -71
- package/dist/styles/predefined.js +0 -237
- package/dist/styles/predefined.js.map +0 -1
- package/dist/styles/preset.d.ts +0 -52
- package/dist/styles/preset.js +0 -127
- package/dist/styles/preset.js.map +0 -1
- package/dist/styles/radius.d.ts +0 -12
- package/dist/styles/radius.js +0 -83
- package/dist/styles/radius.js.map +0 -1
- package/dist/styles/scrollMargin.d.ts +0 -24
- package/dist/styles/scrollMargin.js +0 -32
- package/dist/styles/scrollMargin.js.map +0 -1
- package/dist/styles/scrollbar.d.ts +0 -25
- package/dist/styles/scrollbar.js +0 -51
- package/dist/styles/scrollbar.js.map +0 -1
- package/dist/styles/shadow.d.ts +0 -14
- package/dist/styles/shadow.js +0 -25
- package/dist/styles/shadow.js.map +0 -1
- package/dist/styles/shared.js +0 -17
- package/dist/styles/shared.js.map +0 -1
- package/dist/styles/transition.d.ts +0 -14
- package/dist/styles/transition.js +0 -159
- package/dist/styles/transition.js.map +0 -1
- package/dist/styles/width.d.ts +0 -17
- package/dist/styles/width.js +0 -19
- package/dist/styles/width.js.map +0 -1
- package/dist/tasty.d.ts +0 -134
- package/dist/tasty.js +0 -248
- package/dist/tasty.js.map +0 -1
- package/dist/types.d.ts +0 -184
- package/dist/utils/cache-wrapper.js +0 -21
- package/dist/utils/cache-wrapper.js.map +0 -1
- package/dist/utils/case-converter.js +0 -8
- package/dist/utils/case-converter.js.map +0 -1
- package/dist/utils/color-math.d.ts +0 -46
- package/dist/utils/color-math.js +0 -749
- package/dist/utils/color-math.js.map +0 -1
- package/dist/utils/color-space.d.ts +0 -5
- package/dist/utils/color-space.js +0 -228
- package/dist/utils/color-space.js.map +0 -1
- package/dist/utils/colors.d.ts +0 -5
- package/dist/utils/colors.js +0 -10
- package/dist/utils/colors.js.map +0 -1
- package/dist/utils/css-types.d.ts +0 -7
- package/dist/utils/deps-equal.js +0 -15
- package/dist/utils/deps-equal.js.map +0 -1
- package/dist/utils/dotize.d.ts +0 -26
- package/dist/utils/dotize.js +0 -122
- package/dist/utils/dotize.js.map +0 -1
- package/dist/utils/filter-base-props.d.ts +0 -15
- package/dist/utils/filter-base-props.js +0 -45
- package/dist/utils/filter-base-props.js.map +0 -1
- package/dist/utils/get-display-name.d.ts +0 -7
- package/dist/utils/get-display-name.js +0 -10
- package/dist/utils/get-display-name.js.map +0 -1
- package/dist/utils/has-keys.js +0 -13
- package/dist/utils/has-keys.js.map +0 -1
- package/dist/utils/hash.js +0 -14
- package/dist/utils/hash.js.map +0 -1
- package/dist/utils/is-dev-env.js +0 -19
- package/dist/utils/is-dev-env.js.map +0 -1
- package/dist/utils/is-valid-element-type.js +0 -15
- package/dist/utils/is-valid-element-type.js.map +0 -1
- package/dist/utils/merge-styles.js.map +0 -1
- package/dist/utils/mod-attrs.d.ts +0 -6
- package/dist/utils/mod-attrs.js +0 -20
- package/dist/utils/mod-attrs.js.map +0 -1
- package/dist/utils/process-tokens.d.ts +0 -17
- package/dist/utils/process-tokens.js +0 -83
- package/dist/utils/process-tokens.js.map +0 -1
- package/dist/utils/resolve-recipes.d.ts +0 -17
- package/dist/utils/resolve-recipes.js.map +0 -1
- package/dist/utils/selector-transform.js +0 -32
- package/dist/utils/selector-transform.js.map +0 -1
- package/dist/utils/string.js +0 -8
- package/dist/utils/string.js.map +0 -1
- package/dist/utils/styles.d.ts +0 -99
- package/dist/utils/styles.js +0 -220
- package/dist/utils/styles.js.map +0 -1
- package/dist/utils/typography.d.ts +0 -58
- package/dist/utils/typography.js +0 -51
- package/dist/utils/typography.js.map +0 -1
- package/dist/utils/warnings.d.ts +0 -16
- package/dist/utils/warnings.js +0 -16
- package/dist/utils/warnings.js.map +0 -1
- package/dist/zero/css-writer.d.ts +0 -45
- package/dist/zero/css-writer.js +0 -73
- package/dist/zero/css-writer.js.map +0 -1
- package/dist/zero/extractor.d.ts +0 -24
- package/dist/zero/extractor.js.map +0 -1
package/dist/styles/preset.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { CSS_WIDE_KEYWORDS } from "../parser/const.js";
|
|
2
|
-
import { parseStyle } from "../utils/styles.js";
|
|
3
|
-
//#region src/styles/preset.ts
|
|
4
|
-
const PRESET_MODIFIERS = new Set([
|
|
5
|
-
"strong",
|
|
6
|
-
"bold",
|
|
7
|
-
"italic",
|
|
8
|
-
"icon",
|
|
9
|
-
"tight"
|
|
10
|
-
]);
|
|
11
|
-
/**
|
|
12
|
-
* Convert a value to CSS, handling numbers as pixels for numeric properties
|
|
13
|
-
*/
|
|
14
|
-
function toCSS(value, isNumeric) {
|
|
15
|
-
if (value == null) return null;
|
|
16
|
-
if (typeof value === "number") return isNumeric ? `${value}px` : String(value);
|
|
17
|
-
return parseStyle(String(value)).groups[0]?.values[0] || String(value);
|
|
18
|
-
}
|
|
19
|
-
function setCSSValue(styles, styleName, presetName, { varOnly, cssOnly } = {}) {
|
|
20
|
-
const value = (() => {
|
|
21
|
-
if (CSS_WIDE_KEYWORDS.has(presetName)) return presetName;
|
|
22
|
-
const defaultValue = `var(--default-${styleName}${styleName === "font-family" ? ", var(--font-sans, var(--font-sans-fallback))" : ""})`;
|
|
23
|
-
const fontSuffix = styleName === "font-family" ? ", var(--font-sans, var(--font-sans-fallback))" : "";
|
|
24
|
-
if (presetName === "default") return `${defaultValue}${fontSuffix}`;
|
|
25
|
-
else return `var(--${presetName}-${styleName}, ${defaultValue})${fontSuffix}`;
|
|
26
|
-
})();
|
|
27
|
-
if (!cssOnly) styles[`--${styleName}`] = value;
|
|
28
|
-
if (!varOnly) styles[styleName] = value;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Resolve font/fontFamily value to CSS font-family string.
|
|
32
|
-
*
|
|
33
|
-
* - `font="monospace"` → var(--font-mono, var(--font-mono-fallback))
|
|
34
|
-
* - `font={true}` → var(--font-sans, var(--font-sans-fallback))
|
|
35
|
-
* - `font="CustomFont"` → CustomFont, var(--font-sans, var(--font-sans-fallback))
|
|
36
|
-
* - `fontFamily="Arial"` → Arial (direct, no fallback)
|
|
37
|
-
*/
|
|
38
|
-
function resolveFontFamily(font, fontFamily) {
|
|
39
|
-
if (fontFamily) return fontFamily;
|
|
40
|
-
if (font == null || font === false) return null;
|
|
41
|
-
if (font === "monospace") return "var(--font-mono, var(--font-mono-fallback))";
|
|
42
|
-
if (font === true) return "var(--font-sans, var(--font-sans-fallback))";
|
|
43
|
-
return `${font}, var(--font-sans, var(--font-sans-fallback))`;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Handles typography preset and individual font properties.
|
|
47
|
-
*
|
|
48
|
-
* Preset syntax uses `/` to separate name from modifier:
|
|
49
|
-
* - `preset="h1"` — name only
|
|
50
|
-
* - `preset="h2 / strong"` — name + modifier
|
|
51
|
-
* - `preset="bold"` — modifier-only shorthand (name defaults to `inherit`)
|
|
52
|
-
*
|
|
53
|
-
* When `preset` is defined, it sets up CSS custom properties for typography.
|
|
54
|
-
* Individual font props can be used with or without `preset`:
|
|
55
|
-
* - With `preset`: overrides the preset value for that property
|
|
56
|
-
* - Without `preset`: outputs the CSS directly
|
|
57
|
-
*
|
|
58
|
-
* Number values are converted to pixels for fontSize, lineHeight, letterSpacing.
|
|
59
|
-
* fontWeight accepts numbers directly (e.g., 400, 700).
|
|
60
|
-
*
|
|
61
|
-
* font vs fontFamily:
|
|
62
|
-
* - `font` is the recommended prop with special handling (monospace, boolean, fallback)
|
|
63
|
-
* - `fontFamily` is a direct value without special handling
|
|
64
|
-
*/
|
|
65
|
-
function presetStyle({ preset, fontSize, lineHeight, textTransform, letterSpacing, fontWeight, fontStyle, fontFamily, font }) {
|
|
66
|
-
const styles = {};
|
|
67
|
-
if (preset != null && preset !== false) {
|
|
68
|
-
const { parts } = parseStyle(preset === true ? "" : String(preset)).groups[0] ?? { parts: [] };
|
|
69
|
-
const namePart = parts[0];
|
|
70
|
-
const modPart = parts[1];
|
|
71
|
-
const nameToken = namePart?.mods[0] ?? namePart?.values[0] ?? "";
|
|
72
|
-
const isModOnly = PRESET_MODIFIERS.has(nameToken);
|
|
73
|
-
const name = isModOnly ? "inherit" : nameToken || "inherit";
|
|
74
|
-
const modifier = isModOnly ? nameToken : modPart?.mods[0] ?? "";
|
|
75
|
-
const isStrong = modifier === "strong" || modifier === "bold";
|
|
76
|
-
const isItalic = modifier === "italic";
|
|
77
|
-
const isIcon = modifier === "icon";
|
|
78
|
-
const isTight = modifier === "tight";
|
|
79
|
-
if (fontSize == null) setCSSValue(styles, "font-size", name, { cssOnly: true });
|
|
80
|
-
if (lineHeight == null) setCSSValue(styles, "line-height", name, { cssOnly: true });
|
|
81
|
-
if (letterSpacing == null) setCSSValue(styles, "letter-spacing", name, { cssOnly: true });
|
|
82
|
-
if (fontWeight == null) setCSSValue(styles, "font-weight", name, { cssOnly: true });
|
|
83
|
-
if (fontStyle == null) setCSSValue(styles, "font-style", name, { cssOnly: true });
|
|
84
|
-
if (textTransform == null) setCSSValue(styles, "text-transform", name, { cssOnly: true });
|
|
85
|
-
if (fontFamily == null && font == null) setCSSValue(styles, "font-family", name, { cssOnly: true });
|
|
86
|
-
setCSSValue(styles, "bold-font-weight", name, { varOnly: true });
|
|
87
|
-
setCSSValue(styles, "icon-size", name, { varOnly: true });
|
|
88
|
-
if (isStrong) styles["font-weight"] = "var(--bold-font-weight)";
|
|
89
|
-
if (isItalic) styles["font-style"] = "italic";
|
|
90
|
-
if (isIcon) {
|
|
91
|
-
styles["font-size"] = "var(--icon-size)";
|
|
92
|
-
styles["line-height"] = "var(--icon-size)";
|
|
93
|
-
}
|
|
94
|
-
if (isTight) styles["line-height"] = "1em";
|
|
95
|
-
}
|
|
96
|
-
const fontSizeVal = toCSS(fontSize, true);
|
|
97
|
-
if (fontSizeVal) styles["font-size"] = fontSizeVal;
|
|
98
|
-
const lineHeightVal = toCSS(lineHeight, true);
|
|
99
|
-
if (lineHeightVal) styles["line-height"] = lineHeightVal;
|
|
100
|
-
const letterSpacingVal = toCSS(letterSpacing, true);
|
|
101
|
-
if (letterSpacingVal) styles["letter-spacing"] = letterSpacingVal;
|
|
102
|
-
const fontWeightVal = toCSS(fontWeight, false);
|
|
103
|
-
if (fontWeightVal) styles["font-weight"] = fontWeightVal;
|
|
104
|
-
if (fontStyle != null) if (fontStyle === true) styles["font-style"] = "italic";
|
|
105
|
-
else if (typeof fontStyle === "string" && CSS_WIDE_KEYWORDS.has(fontStyle)) styles["font-style"] = fontStyle;
|
|
106
|
-
else styles["font-style"] = fontStyle ? "italic" : "normal";
|
|
107
|
-
if (textTransform) styles["text-transform"] = textTransform;
|
|
108
|
-
const fontFamily_ = resolveFontFamily(font, fontFamily);
|
|
109
|
-
if (fontFamily_) styles["font-family"] = fontFamily_;
|
|
110
|
-
if (Object.keys(styles).length === 0) return null;
|
|
111
|
-
return styles;
|
|
112
|
-
}
|
|
113
|
-
presetStyle.__lookupStyles = [
|
|
114
|
-
"preset",
|
|
115
|
-
"fontSize",
|
|
116
|
-
"lineHeight",
|
|
117
|
-
"letterSpacing",
|
|
118
|
-
"textTransform",
|
|
119
|
-
"fontWeight",
|
|
120
|
-
"fontStyle",
|
|
121
|
-
"fontFamily",
|
|
122
|
-
"font"
|
|
123
|
-
];
|
|
124
|
-
//#endregion
|
|
125
|
-
export { presetStyle };
|
|
126
|
-
|
|
127
|
-
//# sourceMappingURL=preset.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"preset.js","names":[],"sources":["../../src/styles/preset.ts"],"sourcesContent":["import { CSS_WIDE_KEYWORDS } from '../parser/const';\nimport { parseStyle } from '../utils/styles';\n\nimport type { Styles } from './types';\n\nconst PRESET_MODIFIERS = new Set(['strong', 'bold', 'italic', 'icon', 'tight']);\n\n/**\n * Convert a value to CSS, handling numbers as pixels for numeric properties\n */\nfunction toCSS(\n value: string | number | undefined,\n isNumeric: boolean,\n): string | null {\n if (value == null) return null;\n if (typeof value === 'number') {\n return isNumeric ? `${value}px` : String(value);\n }\n // Parse through style parser to handle custom units like 1x, 2r, etc.\n const processed = parseStyle(String(value));\n return processed.groups[0]?.values[0] || String(value);\n}\n\nfunction setCSSValue(\n styles: Styles,\n styleName: string,\n presetName: string,\n { varOnly, cssOnly }: { varOnly?: boolean; cssOnly?: boolean } = {},\n) {\n const value = (() => {\n if (CSS_WIDE_KEYWORDS.has(presetName)) {\n return presetName;\n }\n\n const defaultValue = `var(--default-${styleName}${\n styleName === 'font-family'\n ? ', var(--font-sans, var(--font-sans-fallback))'\n : ''\n })`;\n const fontSuffix =\n styleName === 'font-family'\n ? ', var(--font-sans, var(--font-sans-fallback))'\n : '';\n\n if (presetName === 'default') {\n return `${defaultValue}${fontSuffix}`;\n } else {\n return `var(--${presetName}-${styleName}, ${defaultValue})${fontSuffix}`;\n }\n })();\n\n if (!cssOnly) {\n styles[`--${styleName}`] = value;\n }\n\n if (!varOnly) {\n styles[styleName] = value;\n }\n}\n\ninterface PresetStyleProps {\n preset?: string | boolean;\n fontSize?: string | number;\n lineHeight?: string | number;\n textTransform?: string;\n letterSpacing?: string | number;\n fontWeight?: string | number;\n fontStyle?: string | boolean;\n fontFamily?: string;\n /** Alias for fontFamily with special handling for 'monospace' and boolean */\n font?: string | boolean;\n}\n\n/**\n * Resolve font/fontFamily value to CSS font-family string.\n *\n * - `font=\"monospace\"` → var(--font-mono, var(--font-mono-fallback))\n * - `font={true}` → var(--font-sans, var(--font-sans-fallback))\n * - `font=\"CustomFont\"` → CustomFont, var(--font-sans, var(--font-sans-fallback))\n * - `fontFamily=\"Arial\"` → Arial (direct, no fallback)\n */\nfunction resolveFontFamily(\n font: string | boolean | undefined,\n fontFamily: string | undefined,\n): string | null {\n // fontFamily takes precedence as a direct value\n if (fontFamily) {\n return fontFamily;\n }\n\n if (font == null || font === false) {\n return null;\n }\n\n if (font === 'monospace') {\n return 'var(--font-mono, var(--font-mono-fallback))';\n }\n\n if (font === true) {\n return 'var(--font-sans, var(--font-sans-fallback))';\n }\n\n return `${font}, var(--font-sans, var(--font-sans-fallback))`;\n}\n\n/**\n * Handles typography preset and individual font properties.\n *\n * Preset syntax uses `/` to separate name from modifier:\n * - `preset=\"h1\"` — name only\n * - `preset=\"h2 / strong\"` — name + modifier\n * - `preset=\"bold\"` — modifier-only shorthand (name defaults to `inherit`)\n *\n * When `preset` is defined, it sets up CSS custom properties for typography.\n * Individual font props can be used with or without `preset`:\n * - With `preset`: overrides the preset value for that property\n * - Without `preset`: outputs the CSS directly\n *\n * Number values are converted to pixels for fontSize, lineHeight, letterSpacing.\n * fontWeight accepts numbers directly (e.g., 400, 700).\n *\n * font vs fontFamily:\n * - `font` is the recommended prop with special handling (monospace, boolean, fallback)\n * - `fontFamily` is a direct value without special handling\n */\nexport function presetStyle({\n preset,\n fontSize,\n lineHeight,\n textTransform,\n letterSpacing,\n fontWeight,\n fontStyle,\n fontFamily,\n font,\n}: PresetStyleProps) {\n const styles: Styles = {};\n const hasPreset = preset != null && preset !== false;\n\n // Handle preset if defined\n if (hasPreset) {\n const presetValue = preset === true ? '' : String(preset);\n\n const processed = parseStyle(presetValue);\n const group = processed.groups[0];\n const { parts } = group ?? { parts: [] };\n\n // parts[0] = preset name (or a modifier for shorthand like preset=\"bold\")\n // parts[1] = optional modifier after slash (e.g. \"t3 / bold\")\n const namePart = parts[0];\n const modPart = parts[1];\n\n const nameToken = namePart?.mods[0] ?? namePart?.values[0] ?? '';\n const isModOnly = PRESET_MODIFIERS.has(nameToken);\n\n const name = isModOnly ? 'inherit' : nameToken || 'inherit';\n const modifier = isModOnly ? nameToken : (modPart?.mods[0] ?? '');\n\n const isStrong = modifier === 'strong' || modifier === 'bold';\n const isItalic = modifier === 'italic';\n const isIcon = modifier === 'icon';\n const isTight = modifier === 'tight';\n\n // Set preset values for properties not explicitly overridden\n if (fontSize == null) {\n setCSSValue(styles, 'font-size', name, { cssOnly: true });\n }\n if (lineHeight == null) {\n setCSSValue(styles, 'line-height', name, { cssOnly: true });\n }\n if (letterSpacing == null) {\n setCSSValue(styles, 'letter-spacing', name, { cssOnly: true });\n }\n if (fontWeight == null) {\n setCSSValue(styles, 'font-weight', name, { cssOnly: true });\n }\n if (fontStyle == null) {\n setCSSValue(styles, 'font-style', name, { cssOnly: true });\n }\n if (textTransform == null) {\n setCSSValue(styles, 'text-transform', name, { cssOnly: true });\n }\n if (fontFamily == null && font == null) {\n setCSSValue(styles, 'font-family', name, { cssOnly: true });\n }\n\n setCSSValue(styles, 'bold-font-weight', name, { varOnly: true });\n setCSSValue(styles, 'icon-size', name, { varOnly: true });\n\n if (isStrong) {\n styles['font-weight'] = 'var(--bold-font-weight)';\n }\n if (isItalic) {\n styles['font-style'] = 'italic';\n }\n if (isIcon) {\n styles['font-size'] = 'var(--icon-size)';\n styles['line-height'] = 'var(--icon-size)';\n }\n if (isTight) {\n styles['line-height'] = '1em';\n }\n }\n\n // Handle individual font properties (work with or without preset)\n const fontSizeVal = toCSS(fontSize, true);\n if (fontSizeVal) {\n styles['font-size'] = fontSizeVal;\n }\n\n const lineHeightVal = toCSS(lineHeight, true);\n if (lineHeightVal) {\n styles['line-height'] = lineHeightVal;\n }\n\n const letterSpacingVal = toCSS(letterSpacing, true);\n if (letterSpacingVal) {\n styles['letter-spacing'] = letterSpacingVal;\n }\n\n // fontWeight: numbers should NOT get 'px' suffix\n const fontWeightVal = toCSS(fontWeight, false);\n if (fontWeightVal) {\n styles['font-weight'] = fontWeightVal;\n }\n\n if (fontStyle != null) {\n if (fontStyle === true) {\n styles['font-style'] = 'italic';\n } else if (\n typeof fontStyle === 'string' &&\n CSS_WIDE_KEYWORDS.has(fontStyle)\n ) {\n styles['font-style'] = fontStyle;\n } else {\n styles['font-style'] = fontStyle ? 'italic' : 'normal';\n }\n }\n\n if (textTransform) {\n styles['text-transform'] = textTransform;\n }\n\n // Handle font/fontFamily (font has special handling, fontFamily is direct)\n const fontFamily_ = resolveFontFamily(font, fontFamily);\n if (fontFamily_) {\n styles['font-family'] = fontFamily_;\n }\n\n if (Object.keys(styles).length === 0) {\n return null;\n }\n\n return styles;\n}\n\npresetStyle.__lookupStyles = [\n 'preset',\n 'fontSize',\n 'lineHeight',\n 'letterSpacing',\n 'textTransform',\n 'fontWeight',\n 'fontStyle',\n 'fontFamily',\n 'font',\n];\n"],"mappings":"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"}
|
package/dist/styles/radius.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
//#region src/styles/radius.d.ts
|
|
2
|
-
declare function radiusStyle({
|
|
3
|
-
radius
|
|
4
|
-
}: {
|
|
5
|
-
radius?: string | number | boolean;
|
|
6
|
-
}): Record<string, string> | null;
|
|
7
|
-
declare namespace radiusStyle {
|
|
8
|
-
var __lookupStyles: string[];
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
11
|
-
export { radiusStyle };
|
|
12
|
-
//# sourceMappingURL=radius.d.ts.map
|
package/dist/styles/radius.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { makeEmptyDetails } from "../parser/types.js";
|
|
2
|
-
import { DIRECTIONS, parseStyle } from "../utils/styles.js";
|
|
3
|
-
import { extractCSSWideKeyword } from "./shared.js";
|
|
4
|
-
//#region src/styles/radius.ts
|
|
5
|
-
const PROP = "var(--radius)";
|
|
6
|
-
const SHARP = "var(--sharp-radius)";
|
|
7
|
-
const RADIUS_LONGHANDS = [
|
|
8
|
-
"border-top-left-radius",
|
|
9
|
-
"border-top-right-radius",
|
|
10
|
-
"border-bottom-right-radius",
|
|
11
|
-
"border-bottom-left-radius"
|
|
12
|
-
];
|
|
13
|
-
function radiusStyle({ radius }) {
|
|
14
|
-
if (typeof radius === "number") radius = `${radius}px`;
|
|
15
|
-
if (!radius) return null;
|
|
16
|
-
if (radius === true) radius = "1r";
|
|
17
|
-
const group = parseStyle(radius).groups[0] ?? makeEmptyDetails();
|
|
18
|
-
const { mods } = group;
|
|
19
|
-
let { values } = group;
|
|
20
|
-
const keyword = extractCSSWideKeyword(group);
|
|
21
|
-
const useLonghand = mods.includes("longhand");
|
|
22
|
-
if (keyword) {
|
|
23
|
-
const dirMods = mods.filter((m) => DIRECTIONS.includes(m));
|
|
24
|
-
if (!dirMods.length) {
|
|
25
|
-
if (useLonghand) return Object.fromEntries(RADIUS_LONGHANDS.map((prop) => [prop, keyword]));
|
|
26
|
-
return { "border-radius": keyword };
|
|
27
|
-
}
|
|
28
|
-
const result = {};
|
|
29
|
-
const corners = /* @__PURE__ */ new Set();
|
|
30
|
-
dirMods.forEach((dir) => {
|
|
31
|
-
const i = DIRECTIONS.indexOf(dir);
|
|
32
|
-
corners.add(i);
|
|
33
|
-
corners.add((i + 1) % 4);
|
|
34
|
-
});
|
|
35
|
-
corners.forEach((i) => {
|
|
36
|
-
result[RADIUS_LONGHANDS[i]] = keyword;
|
|
37
|
-
});
|
|
38
|
-
return result;
|
|
39
|
-
}
|
|
40
|
-
if (mods.includes("round")) values = ["9999rem"];
|
|
41
|
-
else if (mods.includes("ellipse")) values = ["50%"];
|
|
42
|
-
else if (!values.length) values = [PROP];
|
|
43
|
-
if (mods.includes("leaf")) values = [
|
|
44
|
-
values[1] || SHARP,
|
|
45
|
-
values[0] || PROP,
|
|
46
|
-
values[1] || SHARP,
|
|
47
|
-
values[0] || PROP
|
|
48
|
-
];
|
|
49
|
-
else if (mods.includes("backleaf")) values = [
|
|
50
|
-
values[0] || PROP,
|
|
51
|
-
values[1] || SHARP,
|
|
52
|
-
values[0] || PROP,
|
|
53
|
-
values[1] || SHARP
|
|
54
|
-
];
|
|
55
|
-
else if (mods.length) {
|
|
56
|
-
const arr = [
|
|
57
|
-
"0",
|
|
58
|
-
"0",
|
|
59
|
-
"0",
|
|
60
|
-
"0"
|
|
61
|
-
];
|
|
62
|
-
let flag = false;
|
|
63
|
-
DIRECTIONS.forEach((dir, i) => {
|
|
64
|
-
if (!mods.includes(dir)) return;
|
|
65
|
-
flag = true;
|
|
66
|
-
arr[i] = values[0] || PROP;
|
|
67
|
-
arr[(i + 1) % 4] = values[0] || PROP;
|
|
68
|
-
});
|
|
69
|
-
if (flag) values = arr;
|
|
70
|
-
}
|
|
71
|
-
if (useLonghand) return {
|
|
72
|
-
[RADIUS_LONGHANDS[0]]: values[0],
|
|
73
|
-
[RADIUS_LONGHANDS[1]]: values[1] || values[0],
|
|
74
|
-
[RADIUS_LONGHANDS[2]]: values[2] || values[0],
|
|
75
|
-
[RADIUS_LONGHANDS[3]]: values[3] || values[1] || values[0]
|
|
76
|
-
};
|
|
77
|
-
return { "border-radius": values.join(" ") };
|
|
78
|
-
}
|
|
79
|
-
radiusStyle.__lookupStyles = ["radius"];
|
|
80
|
-
//#endregion
|
|
81
|
-
export { radiusStyle };
|
|
82
|
-
|
|
83
|
-
//# sourceMappingURL=radius.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"radius.js","names":[],"sources":["../../src/styles/radius.ts"],"sourcesContent":["import { makeEmptyDetails } from '../parser/types';\nimport { DIRECTIONS, parseStyle } from '../utils/styles';\nimport { extractCSSWideKeyword } from './shared';\n\nconst PROP = 'var(--radius)';\nconst SHARP = 'var(--sharp-radius)';\n\nconst RADIUS_LONGHANDS = [\n 'border-top-left-radius',\n 'border-top-right-radius',\n 'border-bottom-right-radius',\n 'border-bottom-left-radius',\n];\n\nexport function radiusStyle({\n radius,\n}: {\n radius?: string | number | boolean;\n}) {\n if (typeof radius === 'number') {\n radius = `${radius}px`;\n }\n\n if (!radius) return null;\n\n if (radius === true) radius = '1r';\n\n const processed = parseStyle(radius);\n const group = processed.groups[0] ?? makeEmptyDetails();\n const { mods } = group;\n let { values } = group;\n\n const keyword = extractCSSWideKeyword(group);\n\n const useLonghand = mods.includes('longhand');\n\n if (keyword) {\n const dirMods = mods.filter((m) => DIRECTIONS.includes(m));\n\n if (!dirMods.length) {\n if (useLonghand) {\n return Object.fromEntries(\n RADIUS_LONGHANDS.map((prop) => [prop, keyword]),\n );\n }\n\n return { 'border-radius': keyword };\n }\n\n const result: Record<string, string> = {};\n const corners = new Set<number>();\n\n dirMods.forEach((dir) => {\n const i = DIRECTIONS.indexOf(dir);\n corners.add(i);\n corners.add((i + 1) % 4);\n });\n\n corners.forEach((i) => {\n result[RADIUS_LONGHANDS[i]] = keyword;\n });\n\n return result;\n }\n\n if (mods.includes('round')) {\n values = ['9999rem'];\n } else if (mods.includes('ellipse')) {\n values = ['50%'];\n } else if (!values.length) {\n values = [PROP];\n }\n\n if (mods.includes('leaf')) {\n values = [\n values[1] || SHARP,\n values[0] || PROP,\n values[1] || SHARP,\n values[0] || PROP,\n ];\n } else if (mods.includes('backleaf')) {\n values = [\n values[0] || PROP,\n values[1] || SHARP,\n values[0] || PROP,\n values[1] || SHARP,\n ];\n } else if (mods.length) {\n const arr = ['0', '0', '0', '0'];\n\n let flag = false;\n\n DIRECTIONS.forEach((dir, i) => {\n if (!mods.includes(dir)) return;\n\n flag = true;\n\n arr[i] = values[0] || PROP;\n arr[(i + 1) % 4] = values[0] || PROP;\n });\n\n if (flag) {\n values = arr;\n }\n }\n\n if (useLonghand) {\n return {\n [RADIUS_LONGHANDS[0]]: values[0],\n [RADIUS_LONGHANDS[1]]: values[1] || values[0],\n [RADIUS_LONGHANDS[2]]: values[2] || values[0],\n [RADIUS_LONGHANDS[3]]: values[3] || values[1] || values[0],\n };\n }\n\n return {\n 'border-radius': values.join(' '),\n };\n}\n\nradiusStyle.__lookupStyles = ['radius'];\n"],"mappings":";;;;AAIA,MAAM,OAAO;AACb,MAAM,QAAQ;AAEd,MAAM,mBAAmB;CACvB;CACA;CACA;CACA;CACD;AAED,SAAgB,YAAY,EAC1B,UAGC;AACD,KAAI,OAAO,WAAW,SACpB,UAAS,GAAG,OAAO;AAGrB,KAAI,CAAC,OAAQ,QAAO;AAEpB,KAAI,WAAW,KAAM,UAAS;CAG9B,MAAM,QADY,WAAW,OAAO,CACZ,OAAO,MAAM,kBAAkB;CACvD,MAAM,EAAE,SAAS;CACjB,IAAI,EAAE,WAAW;CAEjB,MAAM,UAAU,sBAAsB,MAAM;CAE5C,MAAM,cAAc,KAAK,SAAS,WAAW;AAE7C,KAAI,SAAS;EACX,MAAM,UAAU,KAAK,QAAQ,MAAM,WAAW,SAAS,EAAE,CAAC;AAE1D,MAAI,CAAC,QAAQ,QAAQ;AACnB,OAAI,YACF,QAAO,OAAO,YACZ,iBAAiB,KAAK,SAAS,CAAC,MAAM,QAAQ,CAAC,CAChD;AAGH,UAAO,EAAE,iBAAiB,SAAS;;EAGrC,MAAM,SAAiC,EAAE;EACzC,MAAM,0BAAU,IAAI,KAAa;AAEjC,UAAQ,SAAS,QAAQ;GACvB,MAAM,IAAI,WAAW,QAAQ,IAAI;AACjC,WAAQ,IAAI,EAAE;AACd,WAAQ,KAAK,IAAI,KAAK,EAAE;IACxB;AAEF,UAAQ,SAAS,MAAM;AACrB,UAAO,iBAAiB,MAAM;IAC9B;AAEF,SAAO;;AAGT,KAAI,KAAK,SAAS,QAAQ,CACxB,UAAS,CAAC,UAAU;UACX,KAAK,SAAS,UAAU,CACjC,UAAS,CAAC,MAAM;UACP,CAAC,OAAO,OACjB,UAAS,CAAC,KAAK;AAGjB,KAAI,KAAK,SAAS,OAAO,CACvB,UAAS;EACP,OAAO,MAAM;EACb,OAAO,MAAM;EACb,OAAO,MAAM;EACb,OAAO,MAAM;EACd;UACQ,KAAK,SAAS,WAAW,CAClC,UAAS;EACP,OAAO,MAAM;EACb,OAAO,MAAM;EACb,OAAO,MAAM;EACb,OAAO,MAAM;EACd;UACQ,KAAK,QAAQ;EACtB,MAAM,MAAM;GAAC;GAAK;GAAK;GAAK;GAAI;EAEhC,IAAI,OAAO;AAEX,aAAW,SAAS,KAAK,MAAM;AAC7B,OAAI,CAAC,KAAK,SAAS,IAAI,CAAE;AAEzB,UAAO;AAEP,OAAI,KAAK,OAAO,MAAM;AACtB,QAAK,IAAI,KAAK,KAAK,OAAO,MAAM;IAChC;AAEF,MAAI,KACF,UAAS;;AAIb,KAAI,YACF,QAAO;GACJ,iBAAiB,KAAK,OAAO;GAC7B,iBAAiB,KAAK,OAAO,MAAM,OAAO;GAC1C,iBAAiB,KAAK,OAAO,MAAM,OAAO;GAC1C,iBAAiB,KAAK,OAAO,MAAM,OAAO,MAAM,OAAO;EACzD;AAGH,QAAO,EACL,iBAAiB,OAAO,KAAK,IAAI,EAClC;;AAGH,YAAY,iBAAiB,CAAC,SAAS"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
//#region src/styles/scrollMargin.d.ts
|
|
2
|
-
declare function scrollMarginStyle({
|
|
3
|
-
scrollMargin,
|
|
4
|
-
scrollMarginBlock,
|
|
5
|
-
scrollMarginInline,
|
|
6
|
-
scrollMarginTop,
|
|
7
|
-
scrollMarginRight,
|
|
8
|
-
scrollMarginBottom,
|
|
9
|
-
scrollMarginLeft
|
|
10
|
-
}: {
|
|
11
|
-
scrollMargin?: string | number | boolean;
|
|
12
|
-
scrollMarginBlock?: string | number | boolean;
|
|
13
|
-
scrollMarginInline?: string | number | boolean;
|
|
14
|
-
scrollMarginTop?: string | number | boolean;
|
|
15
|
-
scrollMarginRight?: string | number | boolean;
|
|
16
|
-
scrollMarginBottom?: string | number | boolean;
|
|
17
|
-
scrollMarginLeft?: string | number | boolean;
|
|
18
|
-
}): Record<string, string> | null;
|
|
19
|
-
declare namespace scrollMarginStyle {
|
|
20
|
-
var __lookupStyles: string[];
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
export { scrollMarginStyle };
|
|
24
|
-
//# sourceMappingURL=scrollMargin.d.ts.map
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { processDirectionalStyle } from "./directional.js";
|
|
2
|
-
//#region src/styles/scrollMargin.ts
|
|
3
|
-
const SCROLL_MARGIN_CONFIG = {
|
|
4
|
-
property: "scroll-margin",
|
|
5
|
-
defaultValue: "0",
|
|
6
|
-
trueValue: "1x",
|
|
7
|
-
defaultInit: "0"
|
|
8
|
-
};
|
|
9
|
-
function scrollMarginStyle({ scrollMargin, scrollMarginBlock, scrollMarginInline, scrollMarginTop, scrollMarginRight, scrollMarginBottom, scrollMarginLeft }) {
|
|
10
|
-
return processDirectionalStyle(SCROLL_MARGIN_CONFIG, {
|
|
11
|
-
main: scrollMargin,
|
|
12
|
-
block: scrollMarginBlock,
|
|
13
|
-
inline: scrollMarginInline,
|
|
14
|
-
top: scrollMarginTop,
|
|
15
|
-
right: scrollMarginRight,
|
|
16
|
-
bottom: scrollMarginBottom,
|
|
17
|
-
left: scrollMarginLeft
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
scrollMarginStyle.__lookupStyles = [
|
|
21
|
-
"scrollMargin",
|
|
22
|
-
"scrollMarginTop",
|
|
23
|
-
"scrollMarginRight",
|
|
24
|
-
"scrollMarginBottom",
|
|
25
|
-
"scrollMarginLeft",
|
|
26
|
-
"scrollMarginBlock",
|
|
27
|
-
"scrollMarginInline"
|
|
28
|
-
];
|
|
29
|
-
//#endregion
|
|
30
|
-
export { scrollMarginStyle };
|
|
31
|
-
|
|
32
|
-
//# sourceMappingURL=scrollMargin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scrollMargin.js","names":[],"sources":["../../src/styles/scrollMargin.ts"],"sourcesContent":["import { processDirectionalStyle } from './directional';\n\nconst SCROLL_MARGIN_CONFIG = {\n property: 'scroll-margin',\n defaultValue: '0',\n trueValue: '1x',\n defaultInit: '0',\n} as const;\n\nexport function scrollMarginStyle({\n scrollMargin,\n scrollMarginBlock,\n scrollMarginInline,\n scrollMarginTop,\n scrollMarginRight,\n scrollMarginBottom,\n scrollMarginLeft,\n}: {\n scrollMargin?: string | number | boolean;\n scrollMarginBlock?: string | number | boolean;\n scrollMarginInline?: string | number | boolean;\n scrollMarginTop?: string | number | boolean;\n scrollMarginRight?: string | number | boolean;\n scrollMarginBottom?: string | number | boolean;\n scrollMarginLeft?: string | number | boolean;\n}) {\n return processDirectionalStyle(SCROLL_MARGIN_CONFIG, {\n main: scrollMargin,\n block: scrollMarginBlock,\n inline: scrollMarginInline,\n top: scrollMarginTop,\n right: scrollMarginRight,\n bottom: scrollMarginBottom,\n left: scrollMarginLeft,\n });\n}\n\nscrollMarginStyle.__lookupStyles = [\n 'scrollMargin',\n 'scrollMarginTop',\n 'scrollMarginRight',\n 'scrollMarginBottom',\n 'scrollMarginLeft',\n 'scrollMarginBlock',\n 'scrollMarginInline',\n];\n"],"mappings":";;AAEA,MAAM,uBAAuB;CAC3B,UAAU;CACV,cAAc;CACd,WAAW;CACX,aAAa;CACd;AAED,SAAgB,kBAAkB,EAChC,cACA,mBACA,oBACA,iBACA,mBACA,oBACA,oBASC;AACD,QAAO,wBAAwB,sBAAsB;EACnD,MAAM;EACN,OAAO;EACP,QAAQ;EACR,KAAK;EACL,OAAO;EACP,QAAQ;EACR,MAAM;EACP,CAAC;;AAGJ,kBAAkB,iBAAiB;CACjC;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
//#region src/styles/scrollbar.d.ts
|
|
2
|
-
interface ScrollbarStyleProps {
|
|
3
|
-
scrollbar?: string | boolean;
|
|
4
|
-
overflow?: string;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Standard CSS scrollbar styling via `scrollbar-width`, `scrollbar-color`,
|
|
8
|
-
* and `scrollbar-gutter`.
|
|
9
|
-
*
|
|
10
|
-
* Width values: `thin` (default), `auto`, `none`
|
|
11
|
-
* Modifiers: `stable`, `both-edges`, `always`
|
|
12
|
-
*
|
|
13
|
-
* Note: `auto` is classified as a VALUE_KEYWORD by the parser, so it lands
|
|
14
|
-
* in `values` rather than `mods`. Both locations are checked for robustness.
|
|
15
|
-
*/
|
|
16
|
-
declare function scrollbarStyle({
|
|
17
|
-
scrollbar,
|
|
18
|
-
overflow
|
|
19
|
-
}: ScrollbarStyleProps): Record<string, string> | null;
|
|
20
|
-
declare namespace scrollbarStyle {
|
|
21
|
-
var __lookupStyles: string[];
|
|
22
|
-
}
|
|
23
|
-
//#endregion
|
|
24
|
-
export { scrollbarStyle };
|
|
25
|
-
//# sourceMappingURL=scrollbar.d.ts.map
|
package/dist/styles/scrollbar.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { CSS_WIDE_KEYWORDS } from "../parser/const.js";
|
|
2
|
-
import { makeEmptyDetails } from "../parser/types.js";
|
|
3
|
-
import { parseStyle } from "../utils/styles.js";
|
|
4
|
-
import { warn } from "../utils/warnings.js";
|
|
5
|
-
//#region src/styles/scrollbar.ts
|
|
6
|
-
/**
|
|
7
|
-
* Standard CSS scrollbar styling via `scrollbar-width`, `scrollbar-color`,
|
|
8
|
-
* and `scrollbar-gutter`.
|
|
9
|
-
*
|
|
10
|
-
* Width values: `thin` (default), `auto`, `none`
|
|
11
|
-
* Modifiers: `stable`, `both-edges`, `always`
|
|
12
|
-
*
|
|
13
|
-
* Note: `auto` is classified as a VALUE_KEYWORD by the parser, so it lands
|
|
14
|
-
* in `values` rather than `mods`. Both locations are checked for robustness.
|
|
15
|
-
*/
|
|
16
|
-
function scrollbarStyle({ scrollbar, overflow }) {
|
|
17
|
-
if (!scrollbar) return null;
|
|
18
|
-
if (typeof scrollbar === "string" && CSS_WIDE_KEYWORDS.has(scrollbar)) return {
|
|
19
|
-
"scrollbar-width": scrollbar,
|
|
20
|
-
"scrollbar-color": scrollbar
|
|
21
|
-
};
|
|
22
|
-
const { mods, colors, values } = parseStyle(String(scrollbar === true ? "thin" : scrollbar)).groups[0] ?? makeEmptyDetails();
|
|
23
|
-
const defaultThumbColor = "var(--scrollbar-thumb-color)";
|
|
24
|
-
const defaultTrackColor = "var(--scrollbar-track-color, transparent)";
|
|
25
|
-
const style = {};
|
|
26
|
-
if (mods.includes("none")) {
|
|
27
|
-
const ignored = [
|
|
28
|
-
...mods.filter((m) => m !== "none"),
|
|
29
|
-
...values,
|
|
30
|
-
...colors
|
|
31
|
-
];
|
|
32
|
-
if (ignored.length) warn(`scrollbar="none" hides the scrollbar; other tokens are ignored: ${ignored.join(", ")}`);
|
|
33
|
-
style["scrollbar-width"] = "none";
|
|
34
|
-
return style;
|
|
35
|
-
}
|
|
36
|
-
if (mods.includes("auto") || values.includes("auto")) style["scrollbar-width"] = "auto";
|
|
37
|
-
else style["scrollbar-width"] = "thin";
|
|
38
|
-
style["scrollbar-color"] = `${colors?.[0] || defaultThumbColor} ${colors?.[1] || defaultTrackColor}`;
|
|
39
|
-
if (mods.includes("stable") || mods.includes("both-edges")) style["scrollbar-gutter"] = mods.includes("both-edges") ? "stable both-edges" : "stable";
|
|
40
|
-
if (mods.includes("always")) {
|
|
41
|
-
const effectiveOverflow = overflow || "scroll";
|
|
42
|
-
style["overflow"] = effectiveOverflow;
|
|
43
|
-
if (!style["scrollbar-gutter"] && (effectiveOverflow === "scroll" || effectiveOverflow === "auto")) style["scrollbar-gutter"] = "stable";
|
|
44
|
-
}
|
|
45
|
-
return style;
|
|
46
|
-
}
|
|
47
|
-
scrollbarStyle.__lookupStyles = ["scrollbar", "overflow"];
|
|
48
|
-
//#endregion
|
|
49
|
-
export { scrollbarStyle };
|
|
50
|
-
|
|
51
|
-
//# sourceMappingURL=scrollbar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scrollbar.js","names":[],"sources":["../../src/styles/scrollbar.ts"],"sourcesContent":["import { CSS_WIDE_KEYWORDS } from '../parser/const';\nimport { makeEmptyDetails } from '../parser/types';\nimport { parseStyle } from '../utils/styles';\nimport { warn } from '../utils/warnings';\n\ninterface ScrollbarStyleProps {\n scrollbar?: string | boolean;\n overflow?: string;\n}\n\n/**\n * Standard CSS scrollbar styling via `scrollbar-width`, `scrollbar-color`,\n * and `scrollbar-gutter`.\n *\n * Width values: `thin` (default), `auto`, `none`\n * Modifiers: `stable`, `both-edges`, `always`\n *\n * Note: `auto` is classified as a VALUE_KEYWORD by the parser, so it lands\n * in `values` rather than `mods`. Both locations are checked for robustness.\n */\nexport function scrollbarStyle({\n scrollbar,\n overflow,\n}: ScrollbarStyleProps): Record<string, string> | null {\n if (!scrollbar) return null;\n\n if (typeof scrollbar === 'string' && CSS_WIDE_KEYWORDS.has(scrollbar)) {\n return {\n 'scrollbar-width': scrollbar,\n 'scrollbar-color': scrollbar,\n };\n }\n\n // `true` is treated as `thin` (empty string is falsy, caught by the guard above)\n const value = scrollbar === true ? 'thin' : scrollbar;\n const processed = parseStyle(String(value));\n const { mods, colors, values } = processed.groups[0] ?? makeEmptyDetails();\n\n const defaultThumbColor = 'var(--scrollbar-thumb-color)';\n const defaultTrackColor = 'var(--scrollbar-track-color, transparent)';\n\n const style: Record<string, string> = {};\n\n if (mods.includes('none')) {\n const ignored = [...mods.filter((m) => m !== 'none'), ...values, ...colors];\n\n if (ignored.length) {\n warn(\n `scrollbar=\"none\" hides the scrollbar; other tokens are ignored: ${ignored.join(', ')}`,\n );\n }\n\n style['scrollbar-width'] = 'none';\n\n return style;\n }\n\n // `thin` is the default — accepted as a value for readability but always\n // the fallback when neither `auto` nor `none` is specified.\n // `auto` is a VALUE_KEYWORD in the parser, so it may land in `values`.\n if (mods.includes('auto') || values.includes('auto')) {\n style['scrollbar-width'] = 'auto';\n } else {\n style['scrollbar-width'] = 'thin';\n }\n\n const thumbColor = colors?.[0] || defaultThumbColor;\n const trackColor = colors?.[1] || defaultTrackColor;\n style['scrollbar-color'] = `${thumbColor} ${trackColor}`;\n\n if (mods.includes('stable') || mods.includes('both-edges')) {\n style['scrollbar-gutter'] = mods.includes('both-edges')\n ? 'stable both-edges'\n : 'stable';\n }\n\n if (mods.includes('always')) {\n const effectiveOverflow = overflow || 'scroll';\n style['overflow'] = effectiveOverflow;\n\n // scrollbar-gutter only applies with scroll/auto overflow\n if (\n !style['scrollbar-gutter'] &&\n (effectiveOverflow === 'scroll' || effectiveOverflow === 'auto')\n ) {\n style['scrollbar-gutter'] = 'stable';\n }\n }\n\n return style;\n}\n\nscrollbarStyle.__lookupStyles = ['scrollbar', 'overflow'];\n"],"mappings":";;;;;;;;;;;;;;;AAoBA,SAAgB,eAAe,EAC7B,WACA,YACqD;AACrD,KAAI,CAAC,UAAW,QAAO;AAEvB,KAAI,OAAO,cAAc,YAAY,kBAAkB,IAAI,UAAU,CACnE,QAAO;EACL,mBAAmB;EACnB,mBAAmB;EACpB;CAMH,MAAM,EAAE,MAAM,QAAQ,WADJ,WAAW,OADf,cAAc,OAAO,SAAS,UACF,CAAC,CACA,OAAO,MAAM,kBAAkB;CAE1E,MAAM,oBAAoB;CAC1B,MAAM,oBAAoB;CAE1B,MAAM,QAAgC,EAAE;AAExC,KAAI,KAAK,SAAS,OAAO,EAAE;EACzB,MAAM,UAAU;GAAC,GAAG,KAAK,QAAQ,MAAM,MAAM,OAAO;GAAE,GAAG;GAAQ,GAAG;GAAO;AAE3E,MAAI,QAAQ,OACV,MACE,mEAAmE,QAAQ,KAAK,KAAK,GACtF;AAGH,QAAM,qBAAqB;AAE3B,SAAO;;AAMT,KAAI,KAAK,SAAS,OAAO,IAAI,OAAO,SAAS,OAAO,CAClD,OAAM,qBAAqB;KAE3B,OAAM,qBAAqB;AAK7B,OAAM,qBAAqB,GAFR,SAAS,MAAM,kBAEO,GADtB,SAAS,MAAM;AAGlC,KAAI,KAAK,SAAS,SAAS,IAAI,KAAK,SAAS,aAAa,CACxD,OAAM,sBAAsB,KAAK,SAAS,aAAa,GACnD,sBACA;AAGN,KAAI,KAAK,SAAS,SAAS,EAAE;EAC3B,MAAM,oBAAoB,YAAY;AACtC,QAAM,cAAc;AAGpB,MACE,CAAC,MAAM,wBACN,sBAAsB,YAAY,sBAAsB,QAEzD,OAAM,sBAAsB;;AAIhC,QAAO;;AAGT,eAAe,iBAAiB,CAAC,aAAa,WAAW"}
|
package/dist/styles/shadow.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
//#region src/styles/shadow.d.ts
|
|
2
|
-
declare function shadowStyle({
|
|
3
|
-
shadow
|
|
4
|
-
}: {
|
|
5
|
-
shadow?: string | boolean;
|
|
6
|
-
}): {
|
|
7
|
-
'box-shadow': string;
|
|
8
|
-
} | null;
|
|
9
|
-
declare namespace shadowStyle {
|
|
10
|
-
var __lookupStyles: string[];
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
export { shadowStyle };
|
|
14
|
-
//# sourceMappingURL=shadow.d.ts.map
|
package/dist/styles/shadow.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { CSS_WIDE_KEYWORDS } from "../parser/const.js";
|
|
2
|
-
import { makeEmptyDetails } from "../parser/types.js";
|
|
3
|
-
import { parseStyle } from "../utils/styles.js";
|
|
4
|
-
//#region src/styles/shadow.ts
|
|
5
|
-
function toBoxShadow(shadow) {
|
|
6
|
-
const { values, mods, colors } = parseStyle(shadow).groups[0] ?? makeEmptyDetails();
|
|
7
|
-
const mod = mods[0] || "";
|
|
8
|
-
const shadowColor = (colors && colors[0]) ?? "";
|
|
9
|
-
return [
|
|
10
|
-
mod,
|
|
11
|
-
...values,
|
|
12
|
-
shadowColor
|
|
13
|
-
].join(" ");
|
|
14
|
-
}
|
|
15
|
-
function shadowStyle({ shadow }) {
|
|
16
|
-
if (!shadow) return null;
|
|
17
|
-
if (shadow === true) shadow = "var(--shadow)";
|
|
18
|
-
if (CSS_WIDE_KEYWORDS.has(shadow)) return { "box-shadow": shadow };
|
|
19
|
-
return { "box-shadow": shadow.split(",").map(toBoxShadow).join(",") };
|
|
20
|
-
}
|
|
21
|
-
shadowStyle.__lookupStyles = ["shadow"];
|
|
22
|
-
//#endregion
|
|
23
|
-
export { shadowStyle };
|
|
24
|
-
|
|
25
|
-
//# sourceMappingURL=shadow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shadow.js","names":[],"sources":["../../src/styles/shadow.ts"],"sourcesContent":["import { CSS_WIDE_KEYWORDS } from '../parser/const';\nimport { makeEmptyDetails } from '../parser/types';\nimport { parseStyle } from '../utils/styles';\n\nfunction toBoxShadow(shadow: string): string {\n const processed = parseStyle(shadow);\n const { values, mods, colors } = processed.groups[0] ?? makeEmptyDetails();\n const mod = mods[0] || '';\n const shadowColor = (colors && colors[0]) ?? '';\n\n return [mod, ...values, shadowColor].join(' ');\n}\n\nexport function shadowStyle({ shadow }: { shadow?: string | boolean }) {\n if (!shadow) return null;\n\n if (shadow === true) shadow = 'var(--shadow)';\n\n if (CSS_WIDE_KEYWORDS.has(shadow)) {\n return { 'box-shadow': shadow };\n }\n\n return {\n 'box-shadow': shadow.split(',').map(toBoxShadow).join(','),\n };\n}\n\nshadowStyle.__lookupStyles = ['shadow'];\n"],"mappings":";;;;AAIA,SAAS,YAAY,QAAwB;CAE3C,MAAM,EAAE,QAAQ,MAAM,WADJ,WAAW,OAAO,CACO,OAAO,MAAM,kBAAkB;CAC1E,MAAM,MAAM,KAAK,MAAM;CACvB,MAAM,eAAe,UAAU,OAAO,OAAO;AAE7C,QAAO;EAAC;EAAK,GAAG;EAAQ;EAAY,CAAC,KAAK,IAAI;;AAGhD,SAAgB,YAAY,EAAE,UAAyC;AACrE,KAAI,CAAC,OAAQ,QAAO;AAEpB,KAAI,WAAW,KAAM,UAAS;AAE9B,KAAI,kBAAkB,IAAI,OAAO,CAC/B,QAAO,EAAE,cAAc,QAAQ;AAGjC,QAAO,EACL,cAAc,OAAO,MAAM,IAAI,CAAC,IAAI,YAAY,CAAC,KAAK,IAAI,EAC3D;;AAGH,YAAY,iBAAiB,CAAC,SAAS"}
|
package/dist/styles/shared.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { CSS_WIDE_KEYWORDS } from "../parser/const.js";
|
|
2
|
-
//#region src/styles/shared.ts
|
|
3
|
-
/**
|
|
4
|
-
* If the group contains exactly one value that is a CSS-wide keyword
|
|
5
|
-
* and no colors, return the keyword. Otherwise null.
|
|
6
|
-
*
|
|
7
|
-
* Direction mods (top/right/bottom/left) may coexist with the keyword
|
|
8
|
-
* for directional application like `padding="inherit top"`.
|
|
9
|
-
*/
|
|
10
|
-
function extractCSSWideKeyword(group) {
|
|
11
|
-
if (group.values.length !== 1 || group.colors.length > 0) return null;
|
|
12
|
-
return CSS_WIDE_KEYWORDS.has(group.values[0]) ? group.values[0] : null;
|
|
13
|
-
}
|
|
14
|
-
//#endregion
|
|
15
|
-
export { extractCSSWideKeyword };
|
|
16
|
-
|
|
17
|
-
//# sourceMappingURL=shared.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","names":[],"sources":["../../src/styles/shared.ts"],"sourcesContent":["import { CSS_WIDE_KEYWORDS } from '../parser/const';\nimport type { StyleDetails } from '../parser/types';\n\n/**\n * If the group contains exactly one value that is a CSS-wide keyword\n * and no colors, return the keyword. Otherwise null.\n *\n * Direction mods (top/right/bottom/left) may coexist with the keyword\n * for directional application like `padding=\"inherit top\"`.\n */\nexport function extractCSSWideKeyword(group: StyleDetails): string | null {\n if (group.values.length !== 1 || group.colors.length > 0) return null;\n return CSS_WIDE_KEYWORDS.has(group.values[0]) ? group.values[0] : null;\n}\n"],"mappings":";;;;;;;;;AAUA,SAAgB,sBAAsB,OAAoC;AACxE,KAAI,MAAM,OAAO,WAAW,KAAK,MAAM,OAAO,SAAS,EAAG,QAAO;AACjE,QAAO,kBAAkB,IAAI,MAAM,OAAO,GAAG,GAAG,MAAM,OAAO,KAAK"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
//#region src/styles/transition.d.ts
|
|
2
|
-
declare function transitionStyle({
|
|
3
|
-
transition
|
|
4
|
-
}: {
|
|
5
|
-
transition?: string;
|
|
6
|
-
}): {
|
|
7
|
-
transition: string;
|
|
8
|
-
} | null;
|
|
9
|
-
declare namespace transitionStyle {
|
|
10
|
-
var __lookupStyles: string[];
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
export { transitionStyle };
|
|
14
|
-
//# sourceMappingURL=transition.d.ts.map
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { CSS_WIDE_KEYWORDS } from "../parser/const.js";
|
|
2
|
-
import { parseStyle } from "../utils/styles.js";
|
|
3
|
-
//#region src/styles/transition.ts
|
|
4
|
-
const SECOND_FILL_COLOR_PROPERTY = "--tasty-second-fill-color";
|
|
5
|
-
const MAP = {
|
|
6
|
-
fade: ["mask", "mask-composite"],
|
|
7
|
-
translate: ["transform", "translate"],
|
|
8
|
-
rotate: ["transform", "rotate"],
|
|
9
|
-
scale: ["transform", "scale"],
|
|
10
|
-
fill: [
|
|
11
|
-
"background-color",
|
|
12
|
-
"background-image",
|
|
13
|
-
SECOND_FILL_COLOR_PROPERTY
|
|
14
|
-
],
|
|
15
|
-
image: [
|
|
16
|
-
"background-image",
|
|
17
|
-
"background-position",
|
|
18
|
-
"background-size",
|
|
19
|
-
"background-repeat",
|
|
20
|
-
"background-attachment",
|
|
21
|
-
"background-origin",
|
|
22
|
-
"background-clip",
|
|
23
|
-
SECOND_FILL_COLOR_PROPERTY
|
|
24
|
-
],
|
|
25
|
-
background: [
|
|
26
|
-
"background-color",
|
|
27
|
-
"background-image",
|
|
28
|
-
"background-position",
|
|
29
|
-
"background-size",
|
|
30
|
-
"background-repeat",
|
|
31
|
-
"background-attachment",
|
|
32
|
-
"background-origin",
|
|
33
|
-
"background-clip",
|
|
34
|
-
SECOND_FILL_COLOR_PROPERTY
|
|
35
|
-
],
|
|
36
|
-
border: [
|
|
37
|
-
"border",
|
|
38
|
-
"border-top",
|
|
39
|
-
"border-right",
|
|
40
|
-
"border-bottom",
|
|
41
|
-
"border-left"
|
|
42
|
-
],
|
|
43
|
-
filter: ["filter", "backdrop-filter"],
|
|
44
|
-
radius: ["border-radius"],
|
|
45
|
-
shadow: ["box-shadow"],
|
|
46
|
-
outline: ["outline", "outline-offset"],
|
|
47
|
-
preset: [
|
|
48
|
-
"font-size",
|
|
49
|
-
"line-height",
|
|
50
|
-
"letter-spacing",
|
|
51
|
-
"font-weight",
|
|
52
|
-
"font-style"
|
|
53
|
-
],
|
|
54
|
-
text: ["font-weight", "text-decoration-color"],
|
|
55
|
-
color: ["color"],
|
|
56
|
-
opacity: ["opacity"],
|
|
57
|
-
theme: [
|
|
58
|
-
"color",
|
|
59
|
-
"background-color",
|
|
60
|
-
"background-image",
|
|
61
|
-
"box-shadow",
|
|
62
|
-
"border",
|
|
63
|
-
"border-radius",
|
|
64
|
-
"outline",
|
|
65
|
-
"opacity",
|
|
66
|
-
SECOND_FILL_COLOR_PROPERTY
|
|
67
|
-
],
|
|
68
|
-
width: [
|
|
69
|
-
"max-width",
|
|
70
|
-
"min-width",
|
|
71
|
-
"width"
|
|
72
|
-
],
|
|
73
|
-
height: [
|
|
74
|
-
"max-height",
|
|
75
|
-
"min-height",
|
|
76
|
-
"height"
|
|
77
|
-
],
|
|
78
|
-
gap: ["gap", "margin"],
|
|
79
|
-
zIndex: ["z-index"],
|
|
80
|
-
inset: [
|
|
81
|
-
"inset",
|
|
82
|
-
"top",
|
|
83
|
-
"right",
|
|
84
|
-
"bottom",
|
|
85
|
-
"left"
|
|
86
|
-
]
|
|
87
|
-
};
|
|
88
|
-
const DEFAULT_EASING = "linear";
|
|
89
|
-
const EASING_KEYWORDS = new Set([
|
|
90
|
-
"ease",
|
|
91
|
-
"ease-in",
|
|
92
|
-
"ease-out",
|
|
93
|
-
"ease-in-out",
|
|
94
|
-
"linear",
|
|
95
|
-
"step-start",
|
|
96
|
-
"step-end"
|
|
97
|
-
]);
|
|
98
|
-
function isEasing(token) {
|
|
99
|
-
return EASING_KEYWORDS.has(token) || token.startsWith("cubic-bezier(") || token.startsWith("steps(") || token.startsWith("linear(");
|
|
100
|
-
}
|
|
101
|
-
function getTiming(name) {
|
|
102
|
-
return `var(${name.startsWith("--") ? `${name}-transition` : `--${name}-transition`}, var(--transition))`;
|
|
103
|
-
}
|
|
104
|
-
function transitionStyle({ transition }) {
|
|
105
|
-
if (!transition) return null;
|
|
106
|
-
if (CSS_WIDE_KEYWORDS.has(transition)) return { transition };
|
|
107
|
-
const processed = parseStyle(transition);
|
|
108
|
-
const tokens = [];
|
|
109
|
-
processed.groups.forEach((g, idx) => {
|
|
110
|
-
tokens.push(...g.all);
|
|
111
|
-
if (idx < processed.groups.length - 1) tokens.push(",");
|
|
112
|
-
});
|
|
113
|
-
if (tokens.length === 0) return null;
|
|
114
|
-
let tempTransition = [];
|
|
115
|
-
const transitions = [];
|
|
116
|
-
tokens.forEach((token) => {
|
|
117
|
-
if (token === ",") {
|
|
118
|
-
if (tempTransition.length) {
|
|
119
|
-
transitions.push(tempTransition);
|
|
120
|
-
tempTransition = [];
|
|
121
|
-
}
|
|
122
|
-
} else tempTransition.push(token);
|
|
123
|
-
});
|
|
124
|
-
if (tempTransition.length) transitions.push(tempTransition);
|
|
125
|
-
const map = {};
|
|
126
|
-
transitions.forEach((transition) => {
|
|
127
|
-
const name = transition[0];
|
|
128
|
-
let timing;
|
|
129
|
-
let easing;
|
|
130
|
-
let delay;
|
|
131
|
-
if (transition[1] && isEasing(transition[1])) {
|
|
132
|
-
easing = transition[1];
|
|
133
|
-
delay = transition[2];
|
|
134
|
-
} else {
|
|
135
|
-
timing = transition[1];
|
|
136
|
-
easing = transition[2];
|
|
137
|
-
delay = transition[3];
|
|
138
|
-
}
|
|
139
|
-
(MAP[name] || [name]).forEach((style) => {
|
|
140
|
-
map[style] = [
|
|
141
|
-
name,
|
|
142
|
-
easing,
|
|
143
|
-
timing,
|
|
144
|
-
delay
|
|
145
|
-
];
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
return { transition: Object.entries(map).map(([style, [name, easing, timing, delay]]) => {
|
|
149
|
-
let value = `${style} ${timing || getTiming(name)}`;
|
|
150
|
-
if (easing || delay) value += ` ${easing || DEFAULT_EASING}`;
|
|
151
|
-
if (delay) value += ` ${delay}`;
|
|
152
|
-
return value;
|
|
153
|
-
}).join(", ") };
|
|
154
|
-
}
|
|
155
|
-
transitionStyle.__lookupStyles = ["transition"];
|
|
156
|
-
//#endregion
|
|
157
|
-
export { transitionStyle };
|
|
158
|
-
|
|
159
|
-
//# sourceMappingURL=transition.js.map
|