@tenphi/tasty 2.0.3 → 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/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 -389
- package/dist/pipeline/exclusive.js.map +0 -1
- package/dist/pipeline/index.d.ts +0 -55
- package/dist/pipeline/index.js +0 -749
- package/dist/pipeline/index.js.map +0 -1
- package/dist/pipeline/materialize-contradictions.js +0 -125
- package/dist/pipeline/materialize-contradictions.js.map +0 -1
- package/dist/pipeline/materialize.js +0 -1038
- 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 -725
- 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/margin.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
//#region src/styles/margin.d.ts
|
|
2
|
-
declare function marginStyle({
|
|
3
|
-
margin,
|
|
4
|
-
marginBlock,
|
|
5
|
-
marginInline,
|
|
6
|
-
marginTop,
|
|
7
|
-
marginRight,
|
|
8
|
-
marginBottom,
|
|
9
|
-
marginLeft
|
|
10
|
-
}: {
|
|
11
|
-
margin?: string | number | boolean;
|
|
12
|
-
marginBlock?: string | number | boolean;
|
|
13
|
-
marginInline?: string | number | boolean;
|
|
14
|
-
marginTop?: string | number | boolean;
|
|
15
|
-
marginRight?: string | number | boolean;
|
|
16
|
-
marginBottom?: string | number | boolean;
|
|
17
|
-
marginLeft?: string | number | boolean;
|
|
18
|
-
}): Record<string, string> | null;
|
|
19
|
-
declare namespace marginStyle {
|
|
20
|
-
var __lookupStyles: string[];
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
export { marginStyle };
|
|
24
|
-
//# sourceMappingURL=margin.d.ts.map
|
package/dist/styles/margin.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { processDirectionalStyle } from "./directional.js";
|
|
2
|
-
//#region src/styles/margin.ts
|
|
3
|
-
const MARGIN_CONFIG = {
|
|
4
|
-
property: "margin",
|
|
5
|
-
defaultValue: "var(--gap)",
|
|
6
|
-
trueValue: "1x",
|
|
7
|
-
defaultInit: "0"
|
|
8
|
-
};
|
|
9
|
-
function marginStyle({ margin, marginBlock, marginInline, marginTop, marginRight, marginBottom, marginLeft }) {
|
|
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
|
-
});
|
|
19
|
-
}
|
|
20
|
-
marginStyle.__lookupStyles = [
|
|
21
|
-
"margin",
|
|
22
|
-
"marginTop",
|
|
23
|
-
"marginRight",
|
|
24
|
-
"marginBottom",
|
|
25
|
-
"marginLeft",
|
|
26
|
-
"marginBlock",
|
|
27
|
-
"marginInline"
|
|
28
|
-
];
|
|
29
|
-
//#endregion
|
|
30
|
-
export { marginStyle };
|
|
31
|
-
|
|
32
|
-
//# sourceMappingURL=margin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//#region src/styles/outline.d.ts
|
|
2
|
-
interface OutlineStyleProps {
|
|
3
|
-
outline?: string | boolean | number;
|
|
4
|
-
outlineOffset?: string | number;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Generates CSS for outline property with optional offset.
|
|
8
|
-
*
|
|
9
|
-
* Syntax:
|
|
10
|
-
* - `outline="2px solid #red"` - outline only
|
|
11
|
-
* - `outline="2px solid #red / 4px"` - outline with offset (slash separator)
|
|
12
|
-
* - `outline="2px / 4px"` - width with offset (simpler form)
|
|
13
|
-
* - `outline={true}` - default 1ow solid outline
|
|
14
|
-
* - `outlineOffset="4px"` - offset as separate prop (can be combined with outline)
|
|
15
|
-
*
|
|
16
|
-
* Priority: slash syntax in outline takes precedence over outlineOffset prop
|
|
17
|
-
*
|
|
18
|
-
* @return CSS properties for outline and optionally outline-offset
|
|
19
|
-
*/
|
|
20
|
-
declare function outlineStyle({
|
|
21
|
-
outline,
|
|
22
|
-
outlineOffset
|
|
23
|
-
}: OutlineStyleProps): Record<string, string> | null;
|
|
24
|
-
declare namespace outlineStyle {
|
|
25
|
-
var __lookupStyles: string[];
|
|
26
|
-
}
|
|
27
|
-
//#endregion
|
|
28
|
-
export { outlineStyle };
|
|
29
|
-
//# sourceMappingURL=outline.d.ts.map
|
package/dist/styles/outline.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { CSS_WIDE_KEYWORDS } from "../parser/const.js";
|
|
2
|
-
import { filterMods, parseStyle } from "../utils/styles.js";
|
|
3
|
-
import { BORDER_STYLES } from "./const.js";
|
|
4
|
-
//#region src/styles/outline.ts
|
|
5
|
-
/**
|
|
6
|
-
* Generates CSS for outline property with optional offset.
|
|
7
|
-
*
|
|
8
|
-
* Syntax:
|
|
9
|
-
* - `outline="2px solid #red"` - outline only
|
|
10
|
-
* - `outline="2px solid #red / 4px"` - outline with offset (slash separator)
|
|
11
|
-
* - `outline="2px / 4px"` - width with offset (simpler form)
|
|
12
|
-
* - `outline={true}` - default 1ow solid outline
|
|
13
|
-
* - `outlineOffset="4px"` - offset as separate prop (can be combined with outline)
|
|
14
|
-
*
|
|
15
|
-
* Priority: slash syntax in outline takes precedence over outlineOffset prop
|
|
16
|
-
*
|
|
17
|
-
* @return CSS properties for outline and optionally outline-offset
|
|
18
|
-
*/
|
|
19
|
-
function outlineStyle({ outline, outlineOffset }) {
|
|
20
|
-
const result = {};
|
|
21
|
-
if (outline != null && outline !== false) if (typeof outline === "string" && CSS_WIDE_KEYWORDS.has(outline)) result["outline"] = outline;
|
|
22
|
-
else {
|
|
23
|
-
let outlineValue = outline;
|
|
24
|
-
if (outline === true) outlineValue = "1ow";
|
|
25
|
-
if (outline === 0) outlineValue = "0";
|
|
26
|
-
const group = parseStyle(String(outlineValue)).groups[0];
|
|
27
|
-
if (group) {
|
|
28
|
-
const { parts } = group;
|
|
29
|
-
const outlinePart = parts[0] ?? {
|
|
30
|
-
values: [],
|
|
31
|
-
mods: [],
|
|
32
|
-
colors: []
|
|
33
|
-
};
|
|
34
|
-
const offsetPart = parts[1];
|
|
35
|
-
const typeMods = filterMods(outlinePart.mods, BORDER_STYLES);
|
|
36
|
-
result["outline"] = [
|
|
37
|
-
outlinePart.values[0] || "var(--outline-width)",
|
|
38
|
-
typeMods[0] || "solid",
|
|
39
|
-
outlinePart.colors[0] || "var(--outline-color)"
|
|
40
|
-
].join(" ");
|
|
41
|
-
if (offsetPart?.values[0]) result["outline-offset"] = offsetPart.values[0];
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
if (outlineOffset != null && !result["outline-offset"]) {
|
|
45
|
-
const offsetValue = typeof outlineOffset === "number" ? `${outlineOffset}px` : outlineOffset;
|
|
46
|
-
result["outline-offset"] = parseStyle(offsetValue).groups[0]?.values[0] || offsetValue;
|
|
47
|
-
}
|
|
48
|
-
if (Object.keys(result).length === 0) return null;
|
|
49
|
-
return result;
|
|
50
|
-
}
|
|
51
|
-
outlineStyle.__lookupStyles = ["outline", "outlineOffset"];
|
|
52
|
-
//#endregion
|
|
53
|
-
export { outlineStyle };
|
|
54
|
-
|
|
55
|
-
//# sourceMappingURL=outline.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
//#region src/styles/padding.d.ts
|
|
2
|
-
declare function paddingStyle({
|
|
3
|
-
padding,
|
|
4
|
-
paddingBlock,
|
|
5
|
-
paddingInline,
|
|
6
|
-
paddingTop,
|
|
7
|
-
paddingRight,
|
|
8
|
-
paddingBottom,
|
|
9
|
-
paddingLeft
|
|
10
|
-
}: {
|
|
11
|
-
padding?: string | number | boolean;
|
|
12
|
-
paddingBlock?: string | number | boolean;
|
|
13
|
-
paddingInline?: string | number | boolean;
|
|
14
|
-
paddingTop?: string | number | boolean;
|
|
15
|
-
paddingRight?: string | number | boolean;
|
|
16
|
-
paddingBottom?: string | number | boolean;
|
|
17
|
-
paddingLeft?: string | number | boolean;
|
|
18
|
-
}): Record<string, string> | null;
|
|
19
|
-
declare namespace paddingStyle {
|
|
20
|
-
var __lookupStyles: string[];
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
export { paddingStyle };
|
|
24
|
-
//# sourceMappingURL=padding.d.ts.map
|
package/dist/styles/padding.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { processDirectionalStyle } from "./directional.js";
|
|
2
|
-
//#region src/styles/padding.ts
|
|
3
|
-
const PADDING_CONFIG = {
|
|
4
|
-
property: "padding",
|
|
5
|
-
defaultValue: "var(--gap)",
|
|
6
|
-
trueValue: "1x",
|
|
7
|
-
defaultInit: "0"
|
|
8
|
-
};
|
|
9
|
-
function paddingStyle({ padding, paddingBlock, paddingInline, paddingTop, paddingRight, paddingBottom, paddingLeft }) {
|
|
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
|
-
});
|
|
19
|
-
}
|
|
20
|
-
paddingStyle.__lookupStyles = [
|
|
21
|
-
"padding",
|
|
22
|
-
"paddingTop",
|
|
23
|
-
"paddingRight",
|
|
24
|
-
"paddingBottom",
|
|
25
|
-
"paddingLeft",
|
|
26
|
-
"paddingBlock",
|
|
27
|
-
"paddingInline"
|
|
28
|
-
];
|
|
29
|
-
//#endregion
|
|
30
|
-
export { paddingStyle };
|
|
31
|
-
|
|
32
|
-
//# sourceMappingURL=padding.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,37 +0,0 @@
|
|
|
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
|
package/dist/styles/placement.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,71 +0,0 @@
|
|
|
1
|
-
import { borderStyle } from "./border.js";
|
|
2
|
-
import { colorStyle } from "./color.js";
|
|
3
|
-
import { displayStyle } from "./display.js";
|
|
4
|
-
import { fadeStyle } from "./fade.js";
|
|
5
|
-
import { fillStyle, svgFillStyle } from "./fill.js";
|
|
6
|
-
import { flowStyle } from "./flow.js";
|
|
7
|
-
import { gapStyle } from "./gap.js";
|
|
8
|
-
import { heightStyle } from "./height.js";
|
|
9
|
-
import { insetStyle } from "./inset.js";
|
|
10
|
-
import { marginStyle } from "./margin.js";
|
|
11
|
-
import { outlineStyle } from "./outline.js";
|
|
12
|
-
import { paddingStyle } from "./padding.js";
|
|
13
|
-
import { placementStyle } from "./placement.js";
|
|
14
|
-
import { presetStyle } from "./preset.js";
|
|
15
|
-
import { radiusStyle } from "./radius.js";
|
|
16
|
-
import { scrollMarginStyle } from "./scrollMargin.js";
|
|
17
|
-
import { scrollbarStyle } from "./scrollbar.js";
|
|
18
|
-
import { shadowStyle } from "./shadow.js";
|
|
19
|
-
import { transitionStyle } from "./transition.js";
|
|
20
|
-
import { widthStyle } from "./width.js";
|
|
21
|
-
|
|
22
|
-
//#region src/styles/predefined.d.ts
|
|
23
|
-
/**
|
|
24
|
-
* Exported object containing wrapped predefined style handlers.
|
|
25
|
-
* Users can import and call these to extend or delegate to built-in behavior.
|
|
26
|
-
*
|
|
27
|
-
* Internal handlers use *Style suffix for searchability.
|
|
28
|
-
* External API uses short names for convenience.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```ts
|
|
32
|
-
* import { styleHandlers, configure } from '@tenphi/tasty';
|
|
33
|
-
*
|
|
34
|
-
* configure({
|
|
35
|
-
* handlers: {
|
|
36
|
-
* fill: ({ fill }) => {
|
|
37
|
-
* if (fill?.startsWith('gradient:')) {
|
|
38
|
-
* return { background: fill.slice(9) };
|
|
39
|
-
* }
|
|
40
|
-
* return styleHandlers.fill({ fill });
|
|
41
|
-
* },
|
|
42
|
-
* },
|
|
43
|
-
* });
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
declare const styleHandlers: {
|
|
47
|
-
readonly border: typeof borderStyle;
|
|
48
|
-
readonly color: typeof colorStyle;
|
|
49
|
-
readonly display: typeof displayStyle;
|
|
50
|
-
readonly fade: typeof fadeStyle;
|
|
51
|
-
readonly fill: typeof fillStyle;
|
|
52
|
-
readonly svgFill: typeof svgFillStyle;
|
|
53
|
-
readonly flow: typeof flowStyle;
|
|
54
|
-
readonly gap: typeof gapStyle;
|
|
55
|
-
readonly height: typeof heightStyle;
|
|
56
|
-
readonly inset: typeof insetStyle;
|
|
57
|
-
readonly margin: typeof marginStyle;
|
|
58
|
-
readonly outline: typeof outlineStyle;
|
|
59
|
-
readonly padding: typeof paddingStyle;
|
|
60
|
-
readonly placement: typeof placementStyle;
|
|
61
|
-
readonly preset: typeof presetStyle;
|
|
62
|
-
readonly radius: typeof radiusStyle;
|
|
63
|
-
readonly scrollMargin: typeof scrollMarginStyle;
|
|
64
|
-
readonly scrollbar: typeof scrollbarStyle;
|
|
65
|
-
readonly shadow: typeof shadowStyle;
|
|
66
|
-
readonly transition: typeof transitionStyle;
|
|
67
|
-
readonly width: typeof widthStyle;
|
|
68
|
-
};
|
|
69
|
-
//#endregion
|
|
70
|
-
export { styleHandlers };
|
|
71
|
-
//# sourceMappingURL=predefined.d.ts.map
|
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
import { isDevEnv } from "../utils/is-dev-env.js";
|
|
2
|
-
import { borderStyle } from "./border.js";
|
|
3
|
-
import { createStyle } from "./createStyle.js";
|
|
4
|
-
import { colorStyle } from "./color.js";
|
|
5
|
-
import { displayStyle } from "./display.js";
|
|
6
|
-
import { fadeStyle } from "./fade.js";
|
|
7
|
-
import { fillStyle, svgFillStyle } from "./fill.js";
|
|
8
|
-
import { flowStyle } from "./flow.js";
|
|
9
|
-
import { gapStyle } from "./gap.js";
|
|
10
|
-
import { heightStyle } from "./height.js";
|
|
11
|
-
import { insetStyle } from "./inset.js";
|
|
12
|
-
import { marginStyle } from "./margin.js";
|
|
13
|
-
import { outlineStyle } from "./outline.js";
|
|
14
|
-
import { paddingStyle } from "./padding.js";
|
|
15
|
-
import { placementStyle } from "./placement.js";
|
|
16
|
-
import { presetStyle } from "./preset.js";
|
|
17
|
-
import { radiusStyle } from "./radius.js";
|
|
18
|
-
import { scrollMarginStyle } from "./scrollMargin.js";
|
|
19
|
-
import { scrollbarStyle } from "./scrollbar.js";
|
|
20
|
-
import { shadowStyle } from "./shadow.js";
|
|
21
|
-
import { transitionStyle } from "./transition.js";
|
|
22
|
-
import { widthStyle } from "./width.js";
|
|
23
|
-
//#region src/styles/predefined.ts
|
|
24
|
-
const devMode = isDevEnv();
|
|
25
|
-
const columnsConverter = (val) => {
|
|
26
|
-
if (typeof val === "number") return "minmax(1px, 1fr) ".repeat(val).trim();
|
|
27
|
-
};
|
|
28
|
-
const rowsConverter = (val) => {
|
|
29
|
-
if (typeof val === "number") return "auto ".repeat(val).trim();
|
|
30
|
-
};
|
|
31
|
-
const STYLE_HANDLER_MAP = {};
|
|
32
|
-
let initialHandlerMapSnapshot = null;
|
|
33
|
-
/**
|
|
34
|
-
* Capture a snapshot of the current STYLE_HANDLER_MAP.
|
|
35
|
-
* Called after predefine() to preserve built-in handler state.
|
|
36
|
-
*/
|
|
37
|
-
function captureInitialHandlerState() {
|
|
38
|
-
initialHandlerMapSnapshot = {};
|
|
39
|
-
for (const key of Object.keys(STYLE_HANDLER_MAP)) initialHandlerMapSnapshot[key] = [...STYLE_HANDLER_MAP[key]];
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Reset STYLE_HANDLER_MAP to the initial built-in state.
|
|
43
|
-
* Called by resetConfig() to restore handlers after tests.
|
|
44
|
-
*/
|
|
45
|
-
function resetHandlers() {
|
|
46
|
-
if (!initialHandlerMapSnapshot) return;
|
|
47
|
-
for (const key of Object.keys(STYLE_HANDLER_MAP)) delete STYLE_HANDLER_MAP[key];
|
|
48
|
-
for (const key of Object.keys(initialHandlerMapSnapshot)) STYLE_HANDLER_MAP[key] = [...initialHandlerMapSnapshot[key]];
|
|
49
|
-
}
|
|
50
|
-
function defineCustomStyle(names, handler) {
|
|
51
|
-
let handlerWithLookup;
|
|
52
|
-
if (typeof names === "function") {
|
|
53
|
-
handlerWithLookup = names;
|
|
54
|
-
names = handlerWithLookup.__lookupStyles;
|
|
55
|
-
} else if (handler) handlerWithLookup = Object.assign(handler, { __lookupStyles: names });
|
|
56
|
-
else {
|
|
57
|
-
console.warn("Tasty: incorrect custom style definition: ", names);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (Array.isArray(names)) names.forEach((name) => {
|
|
61
|
-
if (!STYLE_HANDLER_MAP[name]) STYLE_HANDLER_MAP[name] = [];
|
|
62
|
-
STYLE_HANDLER_MAP[name].push(handlerWithLookup);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
function defineStyleAlias(styleName, cssStyleName, converter) {
|
|
66
|
-
const styleHandler = createStyle(styleName, cssStyleName, converter);
|
|
67
|
-
if (!STYLE_HANDLER_MAP[styleName]) STYLE_HANDLER_MAP[styleName] = [];
|
|
68
|
-
STYLE_HANDLER_MAP[styleName].push(styleHandler);
|
|
69
|
-
}
|
|
70
|
-
function predefine() {
|
|
71
|
-
defineStyleAlias("gridAreas", "grid-template-areas");
|
|
72
|
-
defineStyleAlias("gridColumns", "grid-template-columns", columnsConverter);
|
|
73
|
-
defineStyleAlias("gridRows", "grid-template-rows", rowsConverter);
|
|
74
|
-
defineStyleAlias("gridTemplate", "grid-template", (val) => {
|
|
75
|
-
if (typeof val !== "string") return;
|
|
76
|
-
return val.split("/").map((s, i) => (i ? columnsConverter : rowsConverter)(s)).join("/");
|
|
77
|
-
});
|
|
78
|
-
[
|
|
79
|
-
displayStyle,
|
|
80
|
-
transitionStyle,
|
|
81
|
-
fillStyle,
|
|
82
|
-
svgFillStyle,
|
|
83
|
-
widthStyle,
|
|
84
|
-
marginStyle,
|
|
85
|
-
gapStyle,
|
|
86
|
-
flowStyle,
|
|
87
|
-
colorStyle,
|
|
88
|
-
heightStyle,
|
|
89
|
-
radiusStyle,
|
|
90
|
-
borderStyle,
|
|
91
|
-
shadowStyle,
|
|
92
|
-
paddingStyle,
|
|
93
|
-
placementStyle,
|
|
94
|
-
presetStyle,
|
|
95
|
-
scrollMarginStyle,
|
|
96
|
-
outlineStyle,
|
|
97
|
-
scrollbarStyle,
|
|
98
|
-
fadeStyle,
|
|
99
|
-
insetStyle
|
|
100
|
-
].forEach((handler) => defineCustomStyle(handler));
|
|
101
|
-
captureInitialHandlerState();
|
|
102
|
-
return {
|
|
103
|
-
STYLE_HANDLER_MAP,
|
|
104
|
-
defineCustomStyle,
|
|
105
|
-
defineStyleAlias
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Normalize a handler definition to a StyleHandler with __lookupStyles.
|
|
110
|
-
* - Function only: lookup styles inferred from key name
|
|
111
|
-
* - [string, fn]: single lookup style
|
|
112
|
-
* - [string[], fn]: multiple lookup styles
|
|
113
|
-
*/
|
|
114
|
-
function normalizeHandlerDefinition(keyName, definition) {
|
|
115
|
-
let handler;
|
|
116
|
-
let lookupStyles;
|
|
117
|
-
if (typeof definition === "function") {
|
|
118
|
-
handler = definition;
|
|
119
|
-
lookupStyles = [keyName];
|
|
120
|
-
} else if (Array.isArray(definition)) {
|
|
121
|
-
const [first, fn] = definition;
|
|
122
|
-
if (typeof fn !== "function") throw new Error(`[Tasty] Invalid handler definition for "${keyName}". Tuple must have a function as the second element: [string, function] or [string[], function].`);
|
|
123
|
-
handler = fn;
|
|
124
|
-
if (typeof first === "string") lookupStyles = [first];
|
|
125
|
-
else if (Array.isArray(first)) lookupStyles = first;
|
|
126
|
-
else throw new Error(`[Tasty] Invalid handler definition for "${keyName}". First element must be a string or string array.`);
|
|
127
|
-
} else throw new Error(`[Tasty] Invalid handler definition for "${keyName}". Expected function, [string, function], or [string[], function].`);
|
|
128
|
-
validateHandler(keyName, handler, lookupStyles);
|
|
129
|
-
const wrappedHandler = ((props) => handler(props));
|
|
130
|
-
wrappedHandler.__lookupStyles = lookupStyles;
|
|
131
|
-
return wrappedHandler;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Validate a handler definition in development mode.
|
|
135
|
-
*/
|
|
136
|
-
function validateHandler(name, handler, lookupStyles) {
|
|
137
|
-
if (!devMode) return;
|
|
138
|
-
if (typeof handler !== "function") console.warn(`[Tasty] Handler "${name}" is not a function. Handlers must be functions that return CSSMap, CSSMap[], or null.`);
|
|
139
|
-
if (!lookupStyles || !Array.isArray(lookupStyles) || lookupStyles.length === 0) console.warn(`[Tasty] Handler "${name}" has invalid lookupStyles. Expected non-empty array of style names.`);
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Register a custom handler, replacing any existing handlers for the same lookup styles.
|
|
143
|
-
* This is called by configure() to process user-defined handlers.
|
|
144
|
-
*
|
|
145
|
-
* When registering a handler for style X, any existing handler that processes X
|
|
146
|
-
* is removed from ALL its lookup styles to prevent double-processing.
|
|
147
|
-
* For example, if gapStyle handles ['display', 'flow', 'gap'] and a new handler
|
|
148
|
-
* is registered for just ['gap'], gapStyle is removed from display and flow too.
|
|
149
|
-
*/
|
|
150
|
-
function registerHandler(handler) {
|
|
151
|
-
const lookupStyles = handler.__lookupStyles;
|
|
152
|
-
if (!lookupStyles || lookupStyles.length === 0) {
|
|
153
|
-
if (devMode) console.warn("[Tasty] Cannot register handler without __lookupStyles property.");
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
const handlersToRemove = /* @__PURE__ */ new Set();
|
|
157
|
-
for (const styleName of lookupStyles) {
|
|
158
|
-
const existing = STYLE_HANDLER_MAP[styleName];
|
|
159
|
-
if (existing) for (const existingHandler of existing) handlersToRemove.add(existingHandler);
|
|
160
|
-
}
|
|
161
|
-
for (const oldHandler of handlersToRemove) {
|
|
162
|
-
const oldLookupStyles = oldHandler.__lookupStyles;
|
|
163
|
-
if (oldLookupStyles) for (const oldStyleName of oldLookupStyles) {
|
|
164
|
-
const handlers = STYLE_HANDLER_MAP[oldStyleName];
|
|
165
|
-
if (handlers) {
|
|
166
|
-
const filtered = handlers.filter((h) => h !== oldHandler);
|
|
167
|
-
if (filtered.length === 0) delete STYLE_HANDLER_MAP[oldStyleName];
|
|
168
|
-
else STYLE_HANDLER_MAP[oldStyleName] = filtered;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
for (const styleName of lookupStyles) {
|
|
173
|
-
const existing = STYLE_HANDLER_MAP[styleName];
|
|
174
|
-
if (existing) existing.push(handler);
|
|
175
|
-
else STYLE_HANDLER_MAP[styleName] = [handler];
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Create a wrapped handler that can be safely called by users.
|
|
180
|
-
* The wrapper preserves __lookupStyles for proper registration.
|
|
181
|
-
*/
|
|
182
|
-
function wrapHandler(handler) {
|
|
183
|
-
const fn = handler;
|
|
184
|
-
const wrapped = ((props) => fn(props));
|
|
185
|
-
wrapped.__lookupStyles = handler.__lookupStyles;
|
|
186
|
-
return wrapped;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Exported object containing wrapped predefined style handlers.
|
|
190
|
-
* Users can import and call these to extend or delegate to built-in behavior.
|
|
191
|
-
*
|
|
192
|
-
* Internal handlers use *Style suffix for searchability.
|
|
193
|
-
* External API uses short names for convenience.
|
|
194
|
-
*
|
|
195
|
-
* @example
|
|
196
|
-
* ```ts
|
|
197
|
-
* import { styleHandlers, configure } from '@tenphi/tasty';
|
|
198
|
-
*
|
|
199
|
-
* configure({
|
|
200
|
-
* handlers: {
|
|
201
|
-
* fill: ({ fill }) => {
|
|
202
|
-
* if (fill?.startsWith('gradient:')) {
|
|
203
|
-
* return { background: fill.slice(9) };
|
|
204
|
-
* }
|
|
205
|
-
* return styleHandlers.fill({ fill });
|
|
206
|
-
* },
|
|
207
|
-
* },
|
|
208
|
-
* });
|
|
209
|
-
* ```
|
|
210
|
-
*/
|
|
211
|
-
const styleHandlers = {
|
|
212
|
-
border: wrapHandler(borderStyle),
|
|
213
|
-
color: wrapHandler(colorStyle),
|
|
214
|
-
display: wrapHandler(displayStyle),
|
|
215
|
-
fade: wrapHandler(fadeStyle),
|
|
216
|
-
fill: wrapHandler(fillStyle),
|
|
217
|
-
svgFill: wrapHandler(svgFillStyle),
|
|
218
|
-
flow: wrapHandler(flowStyle),
|
|
219
|
-
gap: wrapHandler(gapStyle),
|
|
220
|
-
height: wrapHandler(heightStyle),
|
|
221
|
-
inset: wrapHandler(insetStyle),
|
|
222
|
-
margin: wrapHandler(marginStyle),
|
|
223
|
-
outline: wrapHandler(outlineStyle),
|
|
224
|
-
padding: wrapHandler(paddingStyle),
|
|
225
|
-
placement: wrapHandler(placementStyle),
|
|
226
|
-
preset: wrapHandler(presetStyle),
|
|
227
|
-
radius: wrapHandler(radiusStyle),
|
|
228
|
-
scrollMargin: wrapHandler(scrollMarginStyle),
|
|
229
|
-
scrollbar: wrapHandler(scrollbarStyle),
|
|
230
|
-
shadow: wrapHandler(shadowStyle),
|
|
231
|
-
transition: wrapHandler(transitionStyle),
|
|
232
|
-
width: wrapHandler(widthStyle)
|
|
233
|
-
};
|
|
234
|
-
//#endregion
|
|
235
|
-
export { normalizeHandlerDefinition, predefine, registerHandler, resetHandlers, styleHandlers };
|
|
236
|
-
|
|
237
|
-
//# sourceMappingURL=predefined.js.map
|