@tenphi/tasty 0.1.0
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/LICENSE +21 -0
- package/README.md +236 -0
- package/dist/_virtual/_rolldown/runtime.mjs +7 -0
- package/dist/chunks/cacheKey.d.ts +1 -0
- package/dist/chunks/cacheKey.js +70 -0
- package/dist/chunks/cacheKey.js.map +1 -0
- package/dist/chunks/cacheKey.mjs +70 -0
- package/dist/chunks/cacheKey.mjs.map +1 -0
- package/dist/chunks/definitions.d.ts +37 -0
- package/dist/chunks/definitions.js +260 -0
- package/dist/chunks/definitions.js.map +1 -0
- package/dist/chunks/definitions.mjs +260 -0
- package/dist/chunks/definitions.mjs.map +1 -0
- package/dist/chunks/index.d.ts +3 -0
- package/dist/chunks/renderChunk.d.ts +2 -0
- package/dist/chunks/renderChunk.js +61 -0
- package/dist/chunks/renderChunk.js.map +1 -0
- package/dist/chunks/renderChunk.mjs +61 -0
- package/dist/chunks/renderChunk.mjs.map +1 -0
- package/dist/config.d.ts +279 -0
- package/dist/config.js +400 -0
- package/dist/config.js.map +1 -0
- package/dist/config.mjs +231 -0
- package/dist/config.mjs.map +1 -0
- package/dist/css-writer.d.mts +45 -0
- package/dist/css-writer.mjs +74 -0
- package/dist/css-writer.mjs.map +1 -0
- package/dist/debug.d.ts +204 -0
- package/dist/debug.js +733 -0
- package/dist/debug.js.map +1 -0
- package/dist/extractor.d.mts +24 -0
- package/dist/extractor.mjs +150 -0
- package/dist/extractor.mjs.map +1 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/useGlobalStyles.d.ts +27 -0
- package/dist/hooks/useGlobalStyles.js +56 -0
- package/dist/hooks/useGlobalStyles.js.map +1 -0
- package/dist/hooks/useKeyframes.d.ts +56 -0
- package/dist/hooks/useKeyframes.js +54 -0
- package/dist/hooks/useKeyframes.js.map +1 -0
- package/dist/hooks/useProperty.d.ts +79 -0
- package/dist/hooks/useProperty.js +91 -0
- package/dist/hooks/useProperty.js.map +1 -0
- package/dist/hooks/useRawCSS.d.ts +53 -0
- package/dist/hooks/useRawCSS.js +28 -0
- package/dist/hooks/useRawCSS.js.map +1 -0
- package/dist/hooks/useStyles.d.ts +40 -0
- package/dist/hooks/useStyles.js +169 -0
- package/dist/hooks/useStyles.js.map +1 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +30 -0
- package/dist/injector/index.d.ts +157 -0
- package/dist/injector/index.js +154 -0
- package/dist/injector/index.js.map +1 -0
- package/dist/injector/injector.d.ts +139 -0
- package/dist/injector/injector.js +404 -0
- package/dist/injector/injector.js.map +1 -0
- package/dist/injector/injector.mjs +404 -0
- package/dist/injector/injector.mjs.map +1 -0
- package/dist/injector/sheet-manager.d.ts +127 -0
- package/dist/injector/sheet-manager.js +714 -0
- package/dist/injector/sheet-manager.js.map +1 -0
- package/dist/injector/sheet-manager.mjs +714 -0
- package/dist/injector/sheet-manager.mjs.map +1 -0
- package/dist/injector/types.d.mts +18 -0
- package/dist/injector/types.d.ts +135 -0
- package/dist/keyframes/index.js +206 -0
- package/dist/keyframes/index.js.map +1 -0
- package/dist/keyframes/index.mjs +156 -0
- package/dist/keyframes/index.mjs.map +1 -0
- package/dist/parser/classify.js +319 -0
- package/dist/parser/classify.js.map +1 -0
- package/dist/parser/classify.mjs +319 -0
- package/dist/parser/classify.mjs.map +1 -0
- package/dist/parser/const.js +33 -0
- package/dist/parser/const.js.map +1 -0
- package/dist/parser/const.mjs +33 -0
- package/dist/parser/const.mjs.map +1 -0
- package/dist/parser/lru.js +109 -0
- package/dist/parser/lru.js.map +1 -0
- package/dist/parser/lru.mjs +109 -0
- package/dist/parser/lru.mjs.map +1 -0
- package/dist/parser/parser.d.ts +25 -0
- package/dist/parser/parser.js +116 -0
- package/dist/parser/parser.js.map +1 -0
- package/dist/parser/parser.mjs +116 -0
- package/dist/parser/parser.mjs.map +1 -0
- package/dist/parser/tokenizer.js +69 -0
- package/dist/parser/tokenizer.js.map +1 -0
- package/dist/parser/tokenizer.mjs +69 -0
- package/dist/parser/tokenizer.mjs.map +1 -0
- package/dist/parser/types.d.mts +37 -0
- package/dist/parser/types.d.ts +46 -0
- package/dist/parser/types.js +46 -0
- package/dist/parser/types.js.map +1 -0
- package/dist/parser/types.mjs +46 -0
- package/dist/parser/types.mjs.map +1 -0
- package/dist/pipeline/conditions.js +377 -0
- package/dist/pipeline/conditions.js.map +1 -0
- package/dist/pipeline/conditions.mjs +377 -0
- package/dist/pipeline/conditions.mjs.map +1 -0
- package/dist/pipeline/exclusive.d.ts +1 -0
- package/dist/pipeline/exclusive.js +231 -0
- package/dist/pipeline/exclusive.js.map +1 -0
- package/dist/pipeline/exclusive.mjs +231 -0
- package/dist/pipeline/exclusive.mjs.map +1 -0
- package/dist/pipeline/index.d.ts +53 -0
- package/dist/pipeline/index.js +641 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/pipeline/index.mjs +635 -0
- package/dist/pipeline/index.mjs.map +1 -0
- package/dist/pipeline/materialize.js +821 -0
- package/dist/pipeline/materialize.js.map +1 -0
- package/dist/pipeline/materialize.mjs +821 -0
- package/dist/pipeline/materialize.mjs.map +1 -0
- package/dist/pipeline/parseStateKey.d.ts +1 -0
- package/dist/pipeline/parseStateKey.js +418 -0
- package/dist/pipeline/parseStateKey.js.map +1 -0
- package/dist/pipeline/parseStateKey.mjs +418 -0
- package/dist/pipeline/parseStateKey.mjs.map +1 -0
- package/dist/pipeline/simplify.js +557 -0
- package/dist/pipeline/simplify.js.map +1 -0
- package/dist/pipeline/simplify.mjs +557 -0
- package/dist/pipeline/simplify.mjs.map +1 -0
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/okhsl-plugin.d.ts +35 -0
- package/dist/plugins/okhsl-plugin.js +371 -0
- package/dist/plugins/okhsl-plugin.js.map +1 -0
- package/dist/plugins/okhsl-plugin.mjs +345 -0
- package/dist/plugins/okhsl-plugin.mjs.map +1 -0
- package/dist/plugins/types.d.mts +49 -0
- package/dist/plugins/types.d.ts +69 -0
- package/dist/properties/index.js +158 -0
- package/dist/properties/index.js.map +1 -0
- package/dist/properties/index.mjs +141 -0
- package/dist/properties/index.mjs.map +1 -0
- package/dist/states/index.d.ts +45 -0
- package/dist/states/index.js +389 -0
- package/dist/states/index.js.map +1 -0
- package/dist/states/index.mjs +161 -0
- package/dist/states/index.mjs.map +1 -0
- package/dist/static/index.d.ts +5 -0
- package/dist/static/index.js +5 -0
- package/dist/static/tastyStatic.d.ts +46 -0
- package/dist/static/tastyStatic.js +31 -0
- package/dist/static/tastyStatic.js.map +1 -0
- package/dist/static/types.d.ts +49 -0
- package/dist/static/types.js +24 -0
- package/dist/static/types.js.map +1 -0
- package/dist/styles/align.d.ts +15 -0
- package/dist/styles/align.js +14 -0
- package/dist/styles/align.js.map +1 -0
- package/dist/styles/align.mjs +14 -0
- package/dist/styles/align.mjs.map +1 -0
- package/dist/styles/border.d.ts +25 -0
- package/dist/styles/border.js +114 -0
- package/dist/styles/border.js.map +1 -0
- package/dist/styles/border.mjs +114 -0
- package/dist/styles/border.mjs.map +1 -0
- package/dist/styles/color.d.ts +14 -0
- package/dist/styles/color.js +23 -0
- package/dist/styles/color.js.map +1 -0
- package/dist/styles/color.mjs +23 -0
- package/dist/styles/color.mjs.map +1 -0
- package/dist/styles/createStyle.js +77 -0
- package/dist/styles/createStyle.js.map +1 -0
- package/dist/styles/createStyle.mjs +77 -0
- package/dist/styles/createStyle.mjs.map +1 -0
- package/dist/styles/dimension.js +97 -0
- package/dist/styles/dimension.js.map +1 -0
- package/dist/styles/dimension.mjs +97 -0
- package/dist/styles/dimension.mjs.map +1 -0
- package/dist/styles/display.d.ts +37 -0
- package/dist/styles/display.js +67 -0
- package/dist/styles/display.js.map +1 -0
- package/dist/styles/display.mjs +67 -0
- package/dist/styles/display.mjs.map +1 -0
- package/dist/styles/fade.d.ts +15 -0
- package/dist/styles/fade.js +58 -0
- package/dist/styles/fade.js.map +1 -0
- package/dist/styles/fade.mjs +58 -0
- package/dist/styles/fade.mjs.map +1 -0
- package/dist/styles/fill.d.ts +44 -0
- package/dist/styles/fill.js +51 -0
- package/dist/styles/fill.js.map +1 -0
- package/dist/styles/fill.mjs +51 -0
- package/dist/styles/fill.mjs.map +1 -0
- package/dist/styles/flow.d.ts +16 -0
- package/dist/styles/flow.js +12 -0
- package/dist/styles/flow.js.map +1 -0
- package/dist/styles/flow.mjs +12 -0
- package/dist/styles/flow.mjs.map +1 -0
- package/dist/styles/gap.d.ts +31 -0
- package/dist/styles/gap.js +37 -0
- package/dist/styles/gap.js.map +1 -0
- package/dist/styles/gap.mjs +37 -0
- package/dist/styles/gap.mjs.map +1 -0
- package/dist/styles/height.d.ts +17 -0
- package/dist/styles/height.js +20 -0
- package/dist/styles/height.js.map +1 -0
- package/dist/styles/height.mjs +20 -0
- package/dist/styles/height.mjs.map +1 -0
- package/dist/styles/index.d.ts +2 -0
- package/dist/styles/index.js +9 -0
- package/dist/styles/index.js.map +1 -0
- package/dist/styles/index.mjs +9 -0
- package/dist/styles/index.mjs.map +1 -0
- package/dist/styles/inset.d.ts +50 -0
- package/dist/styles/inset.js +142 -0
- package/dist/styles/inset.js.map +1 -0
- package/dist/styles/inset.mjs +142 -0
- package/dist/styles/inset.mjs.map +1 -0
- package/dist/styles/justify.d.ts +15 -0
- package/dist/styles/justify.js +14 -0
- package/dist/styles/justify.js.map +1 -0
- package/dist/styles/justify.mjs +14 -0
- package/dist/styles/justify.mjs.map +1 -0
- package/dist/styles/list.d.ts +16 -0
- package/dist/styles/list.js +98 -0
- package/dist/styles/list.js.map +1 -0
- package/dist/styles/margin.d.ts +28 -0
- package/dist/styles/margin.js +96 -0
- package/dist/styles/margin.js.map +1 -0
- package/dist/styles/margin.mjs +96 -0
- package/dist/styles/margin.mjs.map +1 -0
- package/dist/styles/outline.d.ts +29 -0
- package/dist/styles/outline.js +65 -0
- package/dist/styles/outline.js.map +1 -0
- package/dist/styles/outline.mjs +65 -0
- package/dist/styles/outline.mjs.map +1 -0
- package/dist/styles/padding.d.ts +28 -0
- package/dist/styles/padding.js +96 -0
- package/dist/styles/padding.js.map +1 -0
- package/dist/styles/padding.mjs +96 -0
- package/dist/styles/padding.mjs.map +1 -0
- package/dist/styles/predefined.d.ts +74 -0
- package/dist/styles/predefined.js +241 -0
- package/dist/styles/predefined.js.map +1 -0
- package/dist/styles/predefined.mjs +232 -0
- package/dist/styles/predefined.mjs.map +1 -0
- package/dist/styles/preset.d.ts +47 -0
- package/dist/styles/preset.js +126 -0
- package/dist/styles/preset.js.map +1 -0
- package/dist/styles/preset.mjs +126 -0
- package/dist/styles/preset.mjs.map +1 -0
- package/dist/styles/radius.d.ts +14 -0
- package/dist/styles/radius.js +51 -0
- package/dist/styles/radius.js.map +1 -0
- package/dist/styles/radius.mjs +51 -0
- package/dist/styles/radius.mjs.map +1 -0
- package/dist/styles/scrollbar.d.ts +21 -0
- package/dist/styles/scrollbar.js +105 -0
- package/dist/styles/scrollbar.js.map +1 -0
- package/dist/styles/scrollbar.mjs +105 -0
- package/dist/styles/scrollbar.mjs.map +1 -0
- package/dist/styles/shadow.d.ts +14 -0
- package/dist/styles/shadow.js +24 -0
- package/dist/styles/shadow.js.map +1 -0
- package/dist/styles/shadow.mjs +24 -0
- package/dist/styles/shadow.mjs.map +1 -0
- package/dist/styles/styledScrollbar.d.ts +47 -0
- package/dist/styles/styledScrollbar.js +38 -0
- package/dist/styles/styledScrollbar.js.map +1 -0
- package/dist/styles/styledScrollbar.mjs +38 -0
- package/dist/styles/styledScrollbar.mjs.map +1 -0
- package/dist/styles/transition.d.ts +14 -0
- package/dist/styles/transition.js +138 -0
- package/dist/styles/transition.js.map +1 -0
- package/dist/styles/transition.mjs +138 -0
- package/dist/styles/transition.mjs.map +1 -0
- package/dist/styles/types.d.mts +492 -0
- package/dist/styles/types.d.ts +496 -0
- package/dist/styles/width.d.ts +17 -0
- package/dist/styles/width.js +20 -0
- package/dist/styles/width.js.map +1 -0
- package/dist/styles/width.mjs +20 -0
- package/dist/styles/width.mjs.map +1 -0
- package/dist/tasty.d.ts +983 -0
- package/dist/tasty.js +191 -0
- package/dist/tasty.js.map +1 -0
- package/dist/tokens/typography.d.ts +19 -0
- package/dist/tokens/typography.js +237 -0
- package/dist/tokens/typography.js.map +1 -0
- package/dist/types.d.ts +182 -0
- package/dist/utils/cache-wrapper.js +26 -0
- package/dist/utils/cache-wrapper.js.map +1 -0
- package/dist/utils/cache-wrapper.mjs +26 -0
- package/dist/utils/cache-wrapper.mjs.map +1 -0
- package/dist/utils/case-converter.js +8 -0
- package/dist/utils/case-converter.js.map +1 -0
- package/dist/utils/case-converter.mjs +8 -0
- package/dist/utils/case-converter.mjs.map +1 -0
- package/dist/utils/colors.d.ts +5 -0
- package/dist/utils/colors.js +9 -0
- package/dist/utils/colors.js.map +1 -0
- package/dist/utils/dotize.d.ts +26 -0
- package/dist/utils/dotize.js +122 -0
- package/dist/utils/dotize.js.map +1 -0
- package/dist/utils/filter-base-props.d.ts +15 -0
- package/dist/utils/filter-base-props.js +45 -0
- package/dist/utils/filter-base-props.js.map +1 -0
- package/dist/utils/get-display-name.d.ts +7 -0
- package/dist/utils/get-display-name.js +10 -0
- package/dist/utils/get-display-name.js.map +1 -0
- package/dist/utils/hsl-to-rgb.js +38 -0
- package/dist/utils/hsl-to-rgb.js.map +1 -0
- package/dist/utils/hsl-to-rgb.mjs +38 -0
- package/dist/utils/hsl-to-rgb.mjs.map +1 -0
- package/dist/utils/is-dev-env.js +19 -0
- package/dist/utils/is-dev-env.js.map +1 -0
- package/dist/utils/is-dev-env.mjs +19 -0
- package/dist/utils/is-dev-env.mjs.map +1 -0
- package/dist/utils/merge-styles.d.ts +7 -0
- package/dist/utils/merge-styles.js +146 -0
- package/dist/utils/merge-styles.js.map +1 -0
- package/dist/utils/merge-styles.mjs +146 -0
- package/dist/utils/merge-styles.mjs.map +1 -0
- package/dist/utils/mod-attrs.d.ts +8 -0
- package/dist/utils/mod-attrs.js +21 -0
- package/dist/utils/mod-attrs.js.map +1 -0
- package/dist/utils/okhsl-to-rgb.js +296 -0
- package/dist/utils/okhsl-to-rgb.js.map +1 -0
- package/dist/utils/okhsl-to-rgb.mjs +296 -0
- package/dist/utils/okhsl-to-rgb.mjs.map +1 -0
- package/dist/utils/process-tokens.d.ts +31 -0
- package/dist/utils/process-tokens.js +171 -0
- package/dist/utils/process-tokens.js.map +1 -0
- package/dist/utils/process-tokens.mjs +28 -0
- package/dist/utils/process-tokens.mjs.map +1 -0
- package/dist/utils/resolve-recipes.d.ts +17 -0
- package/dist/utils/resolve-recipes.js +143 -0
- package/dist/utils/resolve-recipes.js.map +1 -0
- package/dist/utils/resolve-recipes.mjs +143 -0
- package/dist/utils/resolve-recipes.mjs.map +1 -0
- package/dist/utils/string.js +8 -0
- package/dist/utils/string.js.map +1 -0
- package/dist/utils/string.mjs +8 -0
- package/dist/utils/string.mjs.map +1 -0
- package/dist/utils/styles.d.mts +18 -0
- package/dist/utils/styles.d.ts +183 -0
- package/dist/utils/styles.js +585 -0
- package/dist/utils/styles.js.map +1 -0
- package/dist/utils/styles.mjs +346 -0
- package/dist/utils/styles.mjs.map +1 -0
- package/dist/utils/typography.d.ts +36 -0
- package/dist/utils/typography.js +53 -0
- package/dist/utils/typography.js.map +1 -0
- package/dist/utils/warnings.d.ts +16 -0
- package/dist/utils/warnings.js +16 -0
- package/dist/utils/warnings.js.map +1 -0
- package/dist/zero/babel.d.mts +108 -0
- package/dist/zero/babel.mjs +282 -0
- package/dist/zero/babel.mjs.map +1 -0
- package/dist/zero/index.d.mts +3 -0
- package/dist/zero/index.mjs +4 -0
- package/dist/zero/next.d.mts +60 -0
- package/dist/zero/next.mjs +78 -0
- package/dist/zero/next.mjs.map +1 -0
- package/package.json +127 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/styles/justify.ts
|
|
2
|
+
function justifyStyle({ justify }) {
|
|
3
|
+
if (typeof justify !== "string") return;
|
|
4
|
+
if (!justify) return;
|
|
5
|
+
return {
|
|
6
|
+
"justify-items": justify,
|
|
7
|
+
"justify-content": justify
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
justifyStyle.__lookupStyles = ["justify"];
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { justifyStyle };
|
|
14
|
+
//# sourceMappingURL=justify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"justify.js","names":[],"sources":["../../src/styles/justify.ts"],"sourcesContent":["export function justifyStyle({ justify }) {\n if (typeof justify !== 'string') return;\n\n if (!justify) return;\n\n return {\n 'justify-items': justify,\n 'justify-content': justify,\n };\n}\n\njustifyStyle.__lookupStyles = ['justify'];\n"],"mappings":";AAAA,SAAgB,aAAa,EAAE,WAAW;AACxC,KAAI,OAAO,YAAY,SAAU;AAEjC,KAAI,CAAC,QAAS;AAEd,QAAO;EACL,iBAAiB;EACjB,mBAAmB;EACpB;;AAGH,aAAa,iBAAiB,CAAC,UAAU"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/styles/justify.ts
|
|
2
|
+
function justifyStyle({ justify }) {
|
|
3
|
+
if (typeof justify !== "string") return;
|
|
4
|
+
if (!justify) return;
|
|
5
|
+
return {
|
|
6
|
+
"justify-items": justify,
|
|
7
|
+
"justify-content": justify
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
justifyStyle.__lookupStyles = ["justify"];
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { justifyStyle };
|
|
14
|
+
//# sourceMappingURL=justify.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"justify.mjs","names":[],"sources":["../../src/styles/justify.ts"],"sourcesContent":["export function justifyStyle({ justify }) {\n if (typeof justify !== 'string') return;\n\n if (!justify) return;\n\n return {\n 'justify-items': justify,\n 'justify-content': justify,\n };\n}\n\njustifyStyle.__lookupStyles = ['justify'];\n"],"mappings":";AAAA,SAAgB,aAAa,EAAE,WAAW;AACxC,KAAI,OAAO,YAAY,SAAU;AAEjC,KAAI,CAAC,QAAS;AAEd,QAAO;EACL,iBAAiB;EACjB,mBAAmB;EACpB;;AAGH,aAAa,iBAAiB,CAAC,UAAU"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/styles/list.d.ts
|
|
2
|
+
declare const BASE_STYLES: readonly ["display", "font", "preset", "hide", "whiteSpace", "opacity", "transition"];
|
|
3
|
+
declare const POSITION_STYLES: readonly ["gridArea", "order", "gridColumn", "gridRow", "placeSelf", "alignSelf", "justifySelf", "zIndex", "margin", "inset", "position"];
|
|
4
|
+
declare const BLOCK_INNER_STYLES: readonly ["padding", "paddingInline", "paddingBlock", "overflow", "scrollbar", "textAlign"];
|
|
5
|
+
declare const BLOCK_OUTER_STYLES: readonly ["border", "radius", "shadow", "outline"];
|
|
6
|
+
declare const BLOCK_STYLES: readonly ["padding", "paddingInline", "paddingBlock", "overflow", "scrollbar", "textAlign", "border", "radius", "shadow", "outline"];
|
|
7
|
+
declare const COLOR_STYLES: readonly ["color", "fill", "fade", "image"];
|
|
8
|
+
declare const TEXT_STYLES: readonly ["textTransform", "fontWeight", "fontStyle"];
|
|
9
|
+
declare const DIMENSION_STYLES: readonly ["width", "height", "flexBasis", "flexGrow", "flexShrink", "flex"];
|
|
10
|
+
declare const FLOW_STYLES: readonly ["flow", "placeItems", "placeContent", "alignItems", "alignContent", "justifyItems", "justifyContent", "align", "justify", "gap", "columnGap", "rowGap", "gridColumns", "gridRows", "gridTemplate", "gridAreas"];
|
|
11
|
+
declare const CONTAINER_STYLES: readonly ["display", "font", "preset", "hide", "whiteSpace", "opacity", "transition", "color", "fill", "fade", "image", "width", "height", "flexBasis", "flexGrow", "flexShrink", "flex", "gridArea", "order", "gridColumn", "gridRow", "placeSelf", "alignSelf", "justifySelf", "zIndex", "margin", "inset", "position", "padding", "paddingInline", "paddingBlock", "overflow", "scrollbar", "textAlign", "border", "radius", "shadow", "outline", "flow", "placeItems", "placeContent", "alignItems", "alignContent", "justifyItems", "justifyContent", "align", "justify", "gap", "columnGap", "rowGap", "gridColumns", "gridRows", "gridTemplate", "gridAreas"];
|
|
12
|
+
declare const OUTER_STYLES: readonly ["gridArea", "order", "gridColumn", "gridRow", "placeSelf", "alignSelf", "justifySelf", "zIndex", "margin", "inset", "position", "width", "height", "flexBasis", "flexGrow", "flexShrink", "flex", "border", "radius", "shadow", "outline"];
|
|
13
|
+
declare const INNER_STYLES: readonly ["display", "font", "preset", "hide", "whiteSpace", "opacity", "transition", "color", "fill", "fade", "image", "padding", "paddingInline", "paddingBlock", "overflow", "scrollbar", "textAlign", "flow", "placeItems", "placeContent", "alignItems", "alignContent", "justifyItems", "justifyContent", "align", "justify", "gap", "columnGap", "rowGap", "gridColumns", "gridRows", "gridTemplate", "gridAreas"];
|
|
14
|
+
//#endregion
|
|
15
|
+
export { BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, COLOR_STYLES, CONTAINER_STYLES, DIMENSION_STYLES, FLOW_STYLES, INNER_STYLES, OUTER_STYLES, POSITION_STYLES, TEXT_STYLES };
|
|
16
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
//#region src/styles/list.ts
|
|
2
|
+
const BASE_STYLES = [
|
|
3
|
+
"display",
|
|
4
|
+
"font",
|
|
5
|
+
"preset",
|
|
6
|
+
"hide",
|
|
7
|
+
"whiteSpace",
|
|
8
|
+
"opacity",
|
|
9
|
+
"transition"
|
|
10
|
+
];
|
|
11
|
+
const POSITION_STYLES = [
|
|
12
|
+
"gridArea",
|
|
13
|
+
"order",
|
|
14
|
+
"gridColumn",
|
|
15
|
+
"gridRow",
|
|
16
|
+
"placeSelf",
|
|
17
|
+
"alignSelf",
|
|
18
|
+
"justifySelf",
|
|
19
|
+
"zIndex",
|
|
20
|
+
"margin",
|
|
21
|
+
"inset",
|
|
22
|
+
"position"
|
|
23
|
+
];
|
|
24
|
+
const BLOCK_INNER_STYLES = [
|
|
25
|
+
"padding",
|
|
26
|
+
"paddingInline",
|
|
27
|
+
"paddingBlock",
|
|
28
|
+
"overflow",
|
|
29
|
+
"scrollbar",
|
|
30
|
+
"textAlign"
|
|
31
|
+
];
|
|
32
|
+
const BLOCK_OUTER_STYLES = [
|
|
33
|
+
"border",
|
|
34
|
+
"radius",
|
|
35
|
+
"shadow",
|
|
36
|
+
"outline"
|
|
37
|
+
];
|
|
38
|
+
const BLOCK_STYLES = [...BLOCK_INNER_STYLES, ...BLOCK_OUTER_STYLES];
|
|
39
|
+
const COLOR_STYLES = [
|
|
40
|
+
"color",
|
|
41
|
+
"fill",
|
|
42
|
+
"fade",
|
|
43
|
+
"image"
|
|
44
|
+
];
|
|
45
|
+
const TEXT_STYLES = [
|
|
46
|
+
"textTransform",
|
|
47
|
+
"fontWeight",
|
|
48
|
+
"fontStyle"
|
|
49
|
+
];
|
|
50
|
+
const DIMENSION_STYLES = [
|
|
51
|
+
"width",
|
|
52
|
+
"height",
|
|
53
|
+
"flexBasis",
|
|
54
|
+
"flexGrow",
|
|
55
|
+
"flexShrink",
|
|
56
|
+
"flex"
|
|
57
|
+
];
|
|
58
|
+
const FLOW_STYLES = [
|
|
59
|
+
"flow",
|
|
60
|
+
"placeItems",
|
|
61
|
+
"placeContent",
|
|
62
|
+
"alignItems",
|
|
63
|
+
"alignContent",
|
|
64
|
+
"justifyItems",
|
|
65
|
+
"justifyContent",
|
|
66
|
+
"align",
|
|
67
|
+
"justify",
|
|
68
|
+
"gap",
|
|
69
|
+
"columnGap",
|
|
70
|
+
"rowGap",
|
|
71
|
+
"gridColumns",
|
|
72
|
+
"gridRows",
|
|
73
|
+
"gridTemplate",
|
|
74
|
+
"gridAreas"
|
|
75
|
+
];
|
|
76
|
+
const CONTAINER_STYLES = [
|
|
77
|
+
...BASE_STYLES,
|
|
78
|
+
...COLOR_STYLES,
|
|
79
|
+
...DIMENSION_STYLES,
|
|
80
|
+
...POSITION_STYLES,
|
|
81
|
+
...BLOCK_STYLES,
|
|
82
|
+
...FLOW_STYLES
|
|
83
|
+
];
|
|
84
|
+
const OUTER_STYLES = [
|
|
85
|
+
...POSITION_STYLES,
|
|
86
|
+
...DIMENSION_STYLES,
|
|
87
|
+
...BLOCK_OUTER_STYLES
|
|
88
|
+
];
|
|
89
|
+
const INNER_STYLES = [
|
|
90
|
+
...BASE_STYLES,
|
|
91
|
+
...COLOR_STYLES,
|
|
92
|
+
...BLOCK_INNER_STYLES,
|
|
93
|
+
...FLOW_STYLES
|
|
94
|
+
];
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
export { BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, COLOR_STYLES, CONTAINER_STYLES, DIMENSION_STYLES, FLOW_STYLES, INNER_STYLES, OUTER_STYLES, POSITION_STYLES, TEXT_STYLES };
|
|
98
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","names":[],"sources":["../../src/styles/list.ts"],"sourcesContent":["export const BASE_STYLES = [\n 'display',\n 'font',\n 'preset',\n 'hide',\n 'whiteSpace',\n 'opacity',\n 'transition',\n] as const;\n\nexport const POSITION_STYLES = [\n 'gridArea',\n 'order',\n 'gridColumn',\n 'gridRow',\n 'placeSelf',\n 'alignSelf',\n 'justifySelf',\n 'zIndex',\n 'margin',\n 'inset',\n 'position',\n] as const;\n\nexport const BLOCK_INNER_STYLES = [\n 'padding',\n 'paddingInline',\n 'paddingBlock',\n 'overflow',\n 'scrollbar',\n 'textAlign',\n] as const;\n\nexport const BLOCK_OUTER_STYLES = [\n 'border',\n 'radius',\n 'shadow',\n 'outline',\n] as const;\n\nexport const BLOCK_STYLES = [\n ...BLOCK_INNER_STYLES,\n ...BLOCK_OUTER_STYLES,\n] as const;\n\nexport const COLOR_STYLES = ['color', 'fill', 'fade', 'image'] as const;\n\nexport const TEXT_STYLES = [\n 'textTransform',\n 'fontWeight',\n 'fontStyle',\n] as const;\n\nexport const DIMENSION_STYLES = [\n 'width',\n 'height',\n 'flexBasis',\n 'flexGrow',\n 'flexShrink',\n 'flex',\n] as const;\n\nexport const FLOW_STYLES = [\n 'flow',\n 'placeItems',\n 'placeContent',\n 'alignItems',\n 'alignContent',\n 'justifyItems',\n 'justifyContent',\n 'align',\n 'justify',\n 'gap',\n 'columnGap',\n 'rowGap',\n 'gridColumns',\n 'gridRows',\n 'gridTemplate',\n 'gridAreas',\n] as const;\n\nexport const CONTAINER_STYLES = [\n ...BASE_STYLES,\n ...COLOR_STYLES,\n ...DIMENSION_STYLES,\n ...POSITION_STYLES,\n ...BLOCK_STYLES,\n ...FLOW_STYLES,\n] as const;\n\nexport const OUTER_STYLES = [\n ...POSITION_STYLES,\n ...DIMENSION_STYLES,\n ...BLOCK_OUTER_STYLES,\n] as const;\n\nexport const INNER_STYLES = [\n ...BASE_STYLES,\n ...COLOR_STYLES,\n ...BLOCK_INNER_STYLES,\n ...FLOW_STYLES,\n] as const;\n"],"mappings":";AAAA,MAAa,cAAc;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,qBAAqB;CAChC;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,qBAAqB;CAChC;CACA;CACA;CACA;CACD;AAED,MAAa,eAAe,CAC1B,GAAG,oBACH,GAAG,mBACJ;AAED,MAAa,eAAe;CAAC;CAAS;CAAQ;CAAQ;CAAQ;AAE9D,MAAa,cAAc;CACzB;CACA;CACA;CACD;AAED,MAAa,mBAAmB;CAC9B;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,cAAc;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,mBAAmB;CAC9B,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACJ;AAED,MAAa,eAAe;CAC1B,GAAG;CACH,GAAG;CACH,GAAG;CACJ;AAED,MAAa,eAAe;CAC1B,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACJ"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
}): {
|
|
19
|
+
margin?: undefined;
|
|
20
|
+
} | {
|
|
21
|
+
margin: string;
|
|
22
|
+
};
|
|
23
|
+
declare namespace marginStyle {
|
|
24
|
+
var __lookupStyles: string[];
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { marginStyle };
|
|
28
|
+
//# sourceMappingURL=margin.d.ts.map
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { DIRECTIONS, filterMods, parseStyle } from "../utils/styles.js";
|
|
2
|
+
|
|
3
|
+
//#region src/styles/margin.ts
|
|
4
|
+
/**
|
|
5
|
+
* Parse a margin value and return the first processed value
|
|
6
|
+
*/
|
|
7
|
+
function parseMarginValue(value) {
|
|
8
|
+
if (typeof value === "number") return `${value}px`;
|
|
9
|
+
if (!value) return null;
|
|
10
|
+
if (value === true) value = "1x";
|
|
11
|
+
const { values } = parseStyle(value).groups[0] ?? { values: [] };
|
|
12
|
+
return values[0] || "var(--gap)";
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Parse margin value with optional directions (like "1x top" or "2x left right")
|
|
16
|
+
*/
|
|
17
|
+
function parseDirectionalMargin(value) {
|
|
18
|
+
if (typeof value === "number") return {
|
|
19
|
+
values: [`${value}px`],
|
|
20
|
+
directions: []
|
|
21
|
+
};
|
|
22
|
+
if (!value) return {
|
|
23
|
+
values: [],
|
|
24
|
+
directions: []
|
|
25
|
+
};
|
|
26
|
+
if (value === true) value = "1x";
|
|
27
|
+
const { values = [], mods = [] } = parseStyle(value).groups[0] ?? {};
|
|
28
|
+
return {
|
|
29
|
+
values: values.length ? values : ["var(--gap)"],
|
|
30
|
+
directions: filterMods(mods, DIRECTIONS)
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function marginStyle({ margin, marginBlock, marginInline, marginTop, marginRight, marginBottom, marginLeft }) {
|
|
34
|
+
if (margin == null && marginBlock == null && marginInline == null && marginTop == null && marginRight == null && marginBottom == null && marginLeft == null) return {};
|
|
35
|
+
let [top, right, bottom, left] = [
|
|
36
|
+
"0",
|
|
37
|
+
"0",
|
|
38
|
+
"0",
|
|
39
|
+
"0"
|
|
40
|
+
];
|
|
41
|
+
if (margin != null) {
|
|
42
|
+
const { values, directions } = parseDirectionalMargin(margin);
|
|
43
|
+
if (values.length) if (directions.length === 0) {
|
|
44
|
+
top = values[0];
|
|
45
|
+
right = values[1] || values[0];
|
|
46
|
+
bottom = values[2] || values[0];
|
|
47
|
+
left = values[3] || values[1] || values[0];
|
|
48
|
+
} else directions.forEach((dir, i) => {
|
|
49
|
+
const val = values[i] ?? values[0];
|
|
50
|
+
if (dir === "top") top = val;
|
|
51
|
+
else if (dir === "right") right = val;
|
|
52
|
+
else if (dir === "bottom") bottom = val;
|
|
53
|
+
else if (dir === "left") left = val;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (marginBlock != null) {
|
|
57
|
+
const val = parseMarginValue(marginBlock);
|
|
58
|
+
if (val) top = bottom = val;
|
|
59
|
+
}
|
|
60
|
+
if (marginInline != null) {
|
|
61
|
+
const val = parseMarginValue(marginInline);
|
|
62
|
+
if (val) left = right = val;
|
|
63
|
+
}
|
|
64
|
+
if (marginTop != null) {
|
|
65
|
+
const val = parseMarginValue(marginTop);
|
|
66
|
+
if (val) top = val;
|
|
67
|
+
}
|
|
68
|
+
if (marginRight != null) {
|
|
69
|
+
const val = parseMarginValue(marginRight);
|
|
70
|
+
if (val) right = val;
|
|
71
|
+
}
|
|
72
|
+
if (marginBottom != null) {
|
|
73
|
+
const val = parseMarginValue(marginBottom);
|
|
74
|
+
if (val) bottom = val;
|
|
75
|
+
}
|
|
76
|
+
if (marginLeft != null) {
|
|
77
|
+
const val = parseMarginValue(marginLeft);
|
|
78
|
+
if (val) left = val;
|
|
79
|
+
}
|
|
80
|
+
if (top === right && right === bottom && bottom === left) return { margin: top };
|
|
81
|
+
if (top === bottom && left === right) return { margin: `${top} ${left}` };
|
|
82
|
+
return { margin: `${top} ${right} ${bottom} ${left}` };
|
|
83
|
+
}
|
|
84
|
+
marginStyle.__lookupStyles = [
|
|
85
|
+
"margin",
|
|
86
|
+
"marginTop",
|
|
87
|
+
"marginRight",
|
|
88
|
+
"marginBottom",
|
|
89
|
+
"marginLeft",
|
|
90
|
+
"marginBlock",
|
|
91
|
+
"marginInline"
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
//#endregion
|
|
95
|
+
export { marginStyle };
|
|
96
|
+
//# sourceMappingURL=margin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"margin.js","names":[],"sources":["../../src/styles/margin.ts"],"sourcesContent":["import { DIRECTIONS, filterMods, parseStyle } from '../utils/styles';\n\n/**\n * Parse a margin value and return the first processed value\n */\nfunction parseMarginValue(value: string | number | boolean): string | null {\n if (typeof value === 'number') return `${value}px`;\n if (!value) return null;\n if (value === true) value = '1x';\n\n const { values } = parseStyle(value).groups[0] ?? { values: [] };\n\n return values[0] || 'var(--gap)';\n}\n\n/**\n * Parse margin value with optional directions (like \"1x top\" or \"2x left right\")\n */\nfunction parseDirectionalMargin(value: string | number | boolean): {\n values: string[];\n directions: string[];\n} {\n if (typeof value === 'number') {\n return { values: [`${value}px`], directions: [] };\n }\n if (!value) return { values: [], directions: [] };\n if (value === true) value = '1x';\n\n const { values = [], mods = [] } = parseStyle(value).groups[0] ?? {};\n\n return {\n values: values.length ? values : ['var(--gap)'],\n directions: filterMods(mods, DIRECTIONS),\n };\n}\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 // If no margin is defined, return empty object\n if (\n margin == null &&\n marginBlock == null &&\n marginInline == null &&\n marginTop == null &&\n marginRight == null &&\n marginBottom == null &&\n marginLeft == null\n ) {\n return {};\n }\n\n // Initialize all directions to 0\n let [top, right, bottom, left] = ['0', '0', '0', '0'];\n\n // Priority 1 (lowest): margin\n if (margin != null) {\n const { values, directions } = parseDirectionalMargin(margin);\n\n if (values.length) {\n if (directions.length === 0) {\n top = values[0];\n right = values[1] || values[0];\n bottom = values[2] || values[0];\n left = values[3] || values[1] || values[0];\n } else {\n // Assign values to directions in the order they appear\n // e.g., 'right 1x top 2x' → right: 1x, top: 2x\n directions.forEach((dir, i) => {\n const val = values[i] ?? values[0];\n if (dir === 'top') top = val;\n else if (dir === 'right') right = val;\n else if (dir === 'bottom') bottom = val;\n else if (dir === 'left') left = val;\n });\n }\n }\n }\n\n // Priority 2 (medium): marginBlock/marginInline\n if (marginBlock != null) {\n const val = parseMarginValue(marginBlock);\n if (val) top = bottom = val;\n }\n if (marginInline != null) {\n const val = parseMarginValue(marginInline);\n if (val) left = right = val;\n }\n\n // Priority 3 (highest): individual directions\n if (marginTop != null) {\n const val = parseMarginValue(marginTop);\n if (val) top = val;\n }\n if (marginRight != null) {\n const val = parseMarginValue(marginRight);\n if (val) right = val;\n }\n if (marginBottom != null) {\n const val = parseMarginValue(marginBottom);\n if (val) bottom = val;\n }\n if (marginLeft != null) {\n const val = parseMarginValue(marginLeft);\n if (val) left = val;\n }\n\n // Optimize output: 1 value if all same, 2 values if top==bottom && left==right\n if (top === right && right === bottom && bottom === left) {\n return { margin: top };\n }\n if (top === bottom && left === right) {\n return { margin: `${top} ${left}` };\n }\n\n return { margin: `${top} ${right} ${bottom} ${left}` };\n}\n\nmarginStyle.__lookupStyles = [\n 'margin',\n 'marginTop',\n 'marginRight',\n 'marginBottom',\n 'marginLeft',\n 'marginBlock',\n 'marginInline',\n];\n"],"mappings":";;;;;;AAKA,SAAS,iBAAiB,OAAiD;AACzE,KAAI,OAAO,UAAU,SAAU,QAAO,GAAG,MAAM;AAC/C,KAAI,CAAC,MAAO,QAAO;AACnB,KAAI,UAAU,KAAM,SAAQ;CAE5B,MAAM,EAAE,WAAW,WAAW,MAAM,CAAC,OAAO,MAAM,EAAE,QAAQ,EAAE,EAAE;AAEhE,QAAO,OAAO,MAAM;;;;;AAMtB,SAAS,uBAAuB,OAG9B;AACA,KAAI,OAAO,UAAU,SACnB,QAAO;EAAE,QAAQ,CAAC,GAAG,MAAM,IAAI;EAAE,YAAY,EAAE;EAAE;AAEnD,KAAI,CAAC,MAAO,QAAO;EAAE,QAAQ,EAAE;EAAE,YAAY,EAAE;EAAE;AACjD,KAAI,UAAU,KAAM,SAAQ;CAE5B,MAAM,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,KAAK,WAAW,MAAM,CAAC,OAAO,MAAM,EAAE;AAEpE,QAAO;EACL,QAAQ,OAAO,SAAS,SAAS,CAAC,aAAa;EAC/C,YAAY,WAAW,MAAM,WAAW;EACzC;;AAGH,SAAgB,YAAY,EAC1B,QACA,aACA,cACA,WACA,aACA,cACA,cASC;AAED,KACE,UAAU,QACV,eAAe,QACf,gBAAgB,QAChB,aAAa,QACb,eAAe,QACf,gBAAgB,QAChB,cAAc,KAEd,QAAO,EAAE;CAIX,IAAI,CAAC,KAAK,OAAO,QAAQ,QAAQ;EAAC;EAAK;EAAK;EAAK;EAAI;AAGrD,KAAI,UAAU,MAAM;EAClB,MAAM,EAAE,QAAQ,eAAe,uBAAuB,OAAO;AAE7D,MAAI,OAAO,OACT,KAAI,WAAW,WAAW,GAAG;AAC3B,SAAM,OAAO;AACb,WAAQ,OAAO,MAAM,OAAO;AAC5B,YAAS,OAAO,MAAM,OAAO;AAC7B,UAAO,OAAO,MAAM,OAAO,MAAM,OAAO;QAIxC,YAAW,SAAS,KAAK,MAAM;GAC7B,MAAM,MAAM,OAAO,MAAM,OAAO;AAChC,OAAI,QAAQ,MAAO,OAAM;YAChB,QAAQ,QAAS,SAAQ;YACzB,QAAQ,SAAU,UAAS;YAC3B,QAAQ,OAAQ,QAAO;IAChC;;AAMR,KAAI,eAAe,MAAM;EACvB,MAAM,MAAM,iBAAiB,YAAY;AACzC,MAAI,IAAK,OAAM,SAAS;;AAE1B,KAAI,gBAAgB,MAAM;EACxB,MAAM,MAAM,iBAAiB,aAAa;AAC1C,MAAI,IAAK,QAAO,QAAQ;;AAI1B,KAAI,aAAa,MAAM;EACrB,MAAM,MAAM,iBAAiB,UAAU;AACvC,MAAI,IAAK,OAAM;;AAEjB,KAAI,eAAe,MAAM;EACvB,MAAM,MAAM,iBAAiB,YAAY;AACzC,MAAI,IAAK,SAAQ;;AAEnB,KAAI,gBAAgB,MAAM;EACxB,MAAM,MAAM,iBAAiB,aAAa;AAC1C,MAAI,IAAK,UAAS;;AAEpB,KAAI,cAAc,MAAM;EACtB,MAAM,MAAM,iBAAiB,WAAW;AACxC,MAAI,IAAK,QAAO;;AAIlB,KAAI,QAAQ,SAAS,UAAU,UAAU,WAAW,KAClD,QAAO,EAAE,QAAQ,KAAK;AAExB,KAAI,QAAQ,UAAU,SAAS,MAC7B,QAAO,EAAE,QAAQ,GAAG,IAAI,GAAG,QAAQ;AAGrC,QAAO,EAAE,QAAQ,GAAG,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ;;AAGxD,YAAY,iBAAiB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { DIRECTIONS, filterMods, parseStyle } from "../utils/styles.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/styles/margin.ts
|
|
4
|
+
/**
|
|
5
|
+
* Parse a margin value and return the first processed value
|
|
6
|
+
*/
|
|
7
|
+
function parseMarginValue(value) {
|
|
8
|
+
if (typeof value === "number") return `${value}px`;
|
|
9
|
+
if (!value) return null;
|
|
10
|
+
if (value === true) value = "1x";
|
|
11
|
+
const { values } = parseStyle(value).groups[0] ?? { values: [] };
|
|
12
|
+
return values[0] || "var(--gap)";
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Parse margin value with optional directions (like "1x top" or "2x left right")
|
|
16
|
+
*/
|
|
17
|
+
function parseDirectionalMargin(value) {
|
|
18
|
+
if (typeof value === "number") return {
|
|
19
|
+
values: [`${value}px`],
|
|
20
|
+
directions: []
|
|
21
|
+
};
|
|
22
|
+
if (!value) return {
|
|
23
|
+
values: [],
|
|
24
|
+
directions: []
|
|
25
|
+
};
|
|
26
|
+
if (value === true) value = "1x";
|
|
27
|
+
const { values = [], mods = [] } = parseStyle(value).groups[0] ?? {};
|
|
28
|
+
return {
|
|
29
|
+
values: values.length ? values : ["var(--gap)"],
|
|
30
|
+
directions: filterMods(mods, DIRECTIONS)
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function marginStyle({ margin, marginBlock, marginInline, marginTop, marginRight, marginBottom, marginLeft }) {
|
|
34
|
+
if (margin == null && marginBlock == null && marginInline == null && marginTop == null && marginRight == null && marginBottom == null && marginLeft == null) return {};
|
|
35
|
+
let [top, right, bottom, left] = [
|
|
36
|
+
"0",
|
|
37
|
+
"0",
|
|
38
|
+
"0",
|
|
39
|
+
"0"
|
|
40
|
+
];
|
|
41
|
+
if (margin != null) {
|
|
42
|
+
const { values, directions } = parseDirectionalMargin(margin);
|
|
43
|
+
if (values.length) if (directions.length === 0) {
|
|
44
|
+
top = values[0];
|
|
45
|
+
right = values[1] || values[0];
|
|
46
|
+
bottom = values[2] || values[0];
|
|
47
|
+
left = values[3] || values[1] || values[0];
|
|
48
|
+
} else directions.forEach((dir, i) => {
|
|
49
|
+
const val = values[i] ?? values[0];
|
|
50
|
+
if (dir === "top") top = val;
|
|
51
|
+
else if (dir === "right") right = val;
|
|
52
|
+
else if (dir === "bottom") bottom = val;
|
|
53
|
+
else if (dir === "left") left = val;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (marginBlock != null) {
|
|
57
|
+
const val = parseMarginValue(marginBlock);
|
|
58
|
+
if (val) top = bottom = val;
|
|
59
|
+
}
|
|
60
|
+
if (marginInline != null) {
|
|
61
|
+
const val = parseMarginValue(marginInline);
|
|
62
|
+
if (val) left = right = val;
|
|
63
|
+
}
|
|
64
|
+
if (marginTop != null) {
|
|
65
|
+
const val = parseMarginValue(marginTop);
|
|
66
|
+
if (val) top = val;
|
|
67
|
+
}
|
|
68
|
+
if (marginRight != null) {
|
|
69
|
+
const val = parseMarginValue(marginRight);
|
|
70
|
+
if (val) right = val;
|
|
71
|
+
}
|
|
72
|
+
if (marginBottom != null) {
|
|
73
|
+
const val = parseMarginValue(marginBottom);
|
|
74
|
+
if (val) bottom = val;
|
|
75
|
+
}
|
|
76
|
+
if (marginLeft != null) {
|
|
77
|
+
const val = parseMarginValue(marginLeft);
|
|
78
|
+
if (val) left = val;
|
|
79
|
+
}
|
|
80
|
+
if (top === right && right === bottom && bottom === left) return { margin: top };
|
|
81
|
+
if (top === bottom && left === right) return { margin: `${top} ${left}` };
|
|
82
|
+
return { margin: `${top} ${right} ${bottom} ${left}` };
|
|
83
|
+
}
|
|
84
|
+
marginStyle.__lookupStyles = [
|
|
85
|
+
"margin",
|
|
86
|
+
"marginTop",
|
|
87
|
+
"marginRight",
|
|
88
|
+
"marginBottom",
|
|
89
|
+
"marginLeft",
|
|
90
|
+
"marginBlock",
|
|
91
|
+
"marginInline"
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
//#endregion
|
|
95
|
+
export { marginStyle };
|
|
96
|
+
//# sourceMappingURL=margin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"margin.mjs","names":[],"sources":["../../src/styles/margin.ts"],"sourcesContent":["import { DIRECTIONS, filterMods, parseStyle } from '../utils/styles';\n\n/**\n * Parse a margin value and return the first processed value\n */\nfunction parseMarginValue(value: string | number | boolean): string | null {\n if (typeof value === 'number') return `${value}px`;\n if (!value) return null;\n if (value === true) value = '1x';\n\n const { values } = parseStyle(value).groups[0] ?? { values: [] };\n\n return values[0] || 'var(--gap)';\n}\n\n/**\n * Parse margin value with optional directions (like \"1x top\" or \"2x left right\")\n */\nfunction parseDirectionalMargin(value: string | number | boolean): {\n values: string[];\n directions: string[];\n} {\n if (typeof value === 'number') {\n return { values: [`${value}px`], directions: [] };\n }\n if (!value) return { values: [], directions: [] };\n if (value === true) value = '1x';\n\n const { values = [], mods = [] } = parseStyle(value).groups[0] ?? {};\n\n return {\n values: values.length ? values : ['var(--gap)'],\n directions: filterMods(mods, DIRECTIONS),\n };\n}\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 // If no margin is defined, return empty object\n if (\n margin == null &&\n marginBlock == null &&\n marginInline == null &&\n marginTop == null &&\n marginRight == null &&\n marginBottom == null &&\n marginLeft == null\n ) {\n return {};\n }\n\n // Initialize all directions to 0\n let [top, right, bottom, left] = ['0', '0', '0', '0'];\n\n // Priority 1 (lowest): margin\n if (margin != null) {\n const { values, directions } = parseDirectionalMargin(margin);\n\n if (values.length) {\n if (directions.length === 0) {\n top = values[0];\n right = values[1] || values[0];\n bottom = values[2] || values[0];\n left = values[3] || values[1] || values[0];\n } else {\n // Assign values to directions in the order they appear\n // e.g., 'right 1x top 2x' → right: 1x, top: 2x\n directions.forEach((dir, i) => {\n const val = values[i] ?? values[0];\n if (dir === 'top') top = val;\n else if (dir === 'right') right = val;\n else if (dir === 'bottom') bottom = val;\n else if (dir === 'left') left = val;\n });\n }\n }\n }\n\n // Priority 2 (medium): marginBlock/marginInline\n if (marginBlock != null) {\n const val = parseMarginValue(marginBlock);\n if (val) top = bottom = val;\n }\n if (marginInline != null) {\n const val = parseMarginValue(marginInline);\n if (val) left = right = val;\n }\n\n // Priority 3 (highest): individual directions\n if (marginTop != null) {\n const val = parseMarginValue(marginTop);\n if (val) top = val;\n }\n if (marginRight != null) {\n const val = parseMarginValue(marginRight);\n if (val) right = val;\n }\n if (marginBottom != null) {\n const val = parseMarginValue(marginBottom);\n if (val) bottom = val;\n }\n if (marginLeft != null) {\n const val = parseMarginValue(marginLeft);\n if (val) left = val;\n }\n\n // Optimize output: 1 value if all same, 2 values if top==bottom && left==right\n if (top === right && right === bottom && bottom === left) {\n return { margin: top };\n }\n if (top === bottom && left === right) {\n return { margin: `${top} ${left}` };\n }\n\n return { margin: `${top} ${right} ${bottom} ${left}` };\n}\n\nmarginStyle.__lookupStyles = [\n 'margin',\n 'marginTop',\n 'marginRight',\n 'marginBottom',\n 'marginLeft',\n 'marginBlock',\n 'marginInline',\n];\n"],"mappings":";;;;;;AAKA,SAAS,iBAAiB,OAAiD;AACzE,KAAI,OAAO,UAAU,SAAU,QAAO,GAAG,MAAM;AAC/C,KAAI,CAAC,MAAO,QAAO;AACnB,KAAI,UAAU,KAAM,SAAQ;CAE5B,MAAM,EAAE,WAAW,WAAW,MAAM,CAAC,OAAO,MAAM,EAAE,QAAQ,EAAE,EAAE;AAEhE,QAAO,OAAO,MAAM;;;;;AAMtB,SAAS,uBAAuB,OAG9B;AACA,KAAI,OAAO,UAAU,SACnB,QAAO;EAAE,QAAQ,CAAC,GAAG,MAAM,IAAI;EAAE,YAAY,EAAE;EAAE;AAEnD,KAAI,CAAC,MAAO,QAAO;EAAE,QAAQ,EAAE;EAAE,YAAY,EAAE;EAAE;AACjD,KAAI,UAAU,KAAM,SAAQ;CAE5B,MAAM,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,KAAK,WAAW,MAAM,CAAC,OAAO,MAAM,EAAE;AAEpE,QAAO;EACL,QAAQ,OAAO,SAAS,SAAS,CAAC,aAAa;EAC/C,YAAY,WAAW,MAAM,WAAW;EACzC;;AAGH,SAAgB,YAAY,EAC1B,QACA,aACA,cACA,WACA,aACA,cACA,cASC;AAED,KACE,UAAU,QACV,eAAe,QACf,gBAAgB,QAChB,aAAa,QACb,eAAe,QACf,gBAAgB,QAChB,cAAc,KAEd,QAAO,EAAE;CAIX,IAAI,CAAC,KAAK,OAAO,QAAQ,QAAQ;EAAC;EAAK;EAAK;EAAK;EAAI;AAGrD,KAAI,UAAU,MAAM;EAClB,MAAM,EAAE,QAAQ,eAAe,uBAAuB,OAAO;AAE7D,MAAI,OAAO,OACT,KAAI,WAAW,WAAW,GAAG;AAC3B,SAAM,OAAO;AACb,WAAQ,OAAO,MAAM,OAAO;AAC5B,YAAS,OAAO,MAAM,OAAO;AAC7B,UAAO,OAAO,MAAM,OAAO,MAAM,OAAO;QAIxC,YAAW,SAAS,KAAK,MAAM;GAC7B,MAAM,MAAM,OAAO,MAAM,OAAO;AAChC,OAAI,QAAQ,MAAO,OAAM;YAChB,QAAQ,QAAS,SAAQ;YACzB,QAAQ,SAAU,UAAS;YAC3B,QAAQ,OAAQ,QAAO;IAChC;;AAMR,KAAI,eAAe,MAAM;EACvB,MAAM,MAAM,iBAAiB,YAAY;AACzC,MAAI,IAAK,OAAM,SAAS;;AAE1B,KAAI,gBAAgB,MAAM;EACxB,MAAM,MAAM,iBAAiB,aAAa;AAC1C,MAAI,IAAK,QAAO,QAAQ;;AAI1B,KAAI,aAAa,MAAM;EACrB,MAAM,MAAM,iBAAiB,UAAU;AACvC,MAAI,IAAK,OAAM;;AAEjB,KAAI,eAAe,MAAM;EACvB,MAAM,MAAM,iBAAiB,YAAY;AACzC,MAAI,IAAK,SAAQ;;AAEnB,KAAI,gBAAgB,MAAM;EACxB,MAAM,MAAM,iBAAiB,aAAa;AAC1C,MAAI,IAAK,UAAS;;AAEpB,KAAI,cAAc,MAAM;EACtB,MAAM,MAAM,iBAAiB,WAAW;AACxC,MAAI,IAAK,QAAO;;AAIlB,KAAI,QAAQ,SAAS,UAAU,UAAU,WAAW,KAClD,QAAO,EAAE,QAAQ,KAAK;AAExB,KAAI,QAAQ,UAAU,SAAS,MAC7B,QAAO,EAAE,QAAQ,GAAG,IAAI,GAAG,QAAQ;AAGrC,QAAO,EAAE,QAAQ,GAAG,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ;;AAGxD,YAAY,iBAAiB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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> | undefined;
|
|
24
|
+
declare namespace outlineStyle {
|
|
25
|
+
var __lookupStyles: string[];
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { outlineStyle };
|
|
29
|
+
//# sourceMappingURL=outline.d.ts.map
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { filterMods, parseStyle } from "../utils/styles.js";
|
|
2
|
+
|
|
3
|
+
//#region src/styles/outline.ts
|
|
4
|
+
const BORDER_STYLES = [
|
|
5
|
+
"none",
|
|
6
|
+
"hidden",
|
|
7
|
+
"dotted",
|
|
8
|
+
"dashed",
|
|
9
|
+
"solid",
|
|
10
|
+
"double",
|
|
11
|
+
"groove",
|
|
12
|
+
"ridge",
|
|
13
|
+
"inset",
|
|
14
|
+
"outset"
|
|
15
|
+
];
|
|
16
|
+
/**
|
|
17
|
+
* Generates CSS for outline property with optional offset.
|
|
18
|
+
*
|
|
19
|
+
* Syntax:
|
|
20
|
+
* - `outline="2px solid #red"` - outline only
|
|
21
|
+
* - `outline="2px solid #red / 4px"` - outline with offset (slash separator)
|
|
22
|
+
* - `outline="2px / 4px"` - width with offset (simpler form)
|
|
23
|
+
* - `outline={true}` - default 1ow solid outline
|
|
24
|
+
* - `outlineOffset="4px"` - offset as separate prop (can be combined with outline)
|
|
25
|
+
*
|
|
26
|
+
* Priority: slash syntax in outline takes precedence over outlineOffset prop
|
|
27
|
+
*
|
|
28
|
+
* @return CSS properties for outline and optionally outline-offset
|
|
29
|
+
*/
|
|
30
|
+
function outlineStyle({ outline, outlineOffset }) {
|
|
31
|
+
const result = {};
|
|
32
|
+
if (outline != null && outline !== false) {
|
|
33
|
+
let outlineValue = outline;
|
|
34
|
+
if (outline === true) outlineValue = "1ow";
|
|
35
|
+
if (outline === 0) outlineValue = "0";
|
|
36
|
+
const group = parseStyle(String(outlineValue)).groups[0];
|
|
37
|
+
if (group) {
|
|
38
|
+
const { parts } = group;
|
|
39
|
+
const outlinePart = parts[0] ?? {
|
|
40
|
+
values: [],
|
|
41
|
+
mods: [],
|
|
42
|
+
colors: []
|
|
43
|
+
};
|
|
44
|
+
const offsetPart = parts[1];
|
|
45
|
+
const typeMods = filterMods(outlinePart.mods, BORDER_STYLES);
|
|
46
|
+
result["outline"] = [
|
|
47
|
+
outlinePart.values[0] || "var(--outline-width)",
|
|
48
|
+
typeMods[0] || "solid",
|
|
49
|
+
outlinePart.colors[0] || "var(--outline-color)"
|
|
50
|
+
].join(" ");
|
|
51
|
+
if (offsetPart?.values[0]) result["outline-offset"] = offsetPart.values[0];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (outlineOffset != null && !result["outline-offset"]) {
|
|
55
|
+
const offsetValue = typeof outlineOffset === "number" ? `${outlineOffset}px` : outlineOffset;
|
|
56
|
+
result["outline-offset"] = parseStyle(offsetValue).groups[0]?.values[0] || offsetValue;
|
|
57
|
+
}
|
|
58
|
+
if (Object.keys(result).length === 0) return;
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
outlineStyle.__lookupStyles = ["outline", "outlineOffset"];
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
export { outlineStyle };
|
|
65
|
+
//# sourceMappingURL=outline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outline.js","names":[],"sources":["../../src/styles/outline.ts"],"sourcesContent":["import { filterMods, parseStyle } from '../utils/styles';\n\nconst BORDER_STYLES = [\n 'none',\n 'hidden',\n 'dotted',\n 'dashed',\n 'solid',\n 'double',\n 'groove',\n 'ridge',\n 'inset',\n 'outset',\n];\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 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(outlinePart.mods, BORDER_STYLES);\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 // Check for offset in second part (after /) - takes precedence\n if (offsetPart?.values[0]) {\n result['outline-offset'] = offsetPart.values[0];\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 // Return undefined if no styles to apply\n if (Object.keys(result).length === 0) {\n return;\n }\n\n return result;\n}\n\noutlineStyle.__lookupStyles = ['outline', 'outlineOffset'];\n"],"mappings":";;;AAEA,MAAM,gBAAgB;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;;;;;;;;;;;;AAqBD,SAAgB,aAAa,EAAE,SAAS,iBAAoC;CAC1E,MAAM,SAAiC,EAAE;AAGzC,KAAI,WAAW,QAAQ,YAAY,OAAO;EACxC,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,WAAW,YAAY,MAAM,cAAc;AAM5D,UAAO,aAAa;IAJN,YAAY,OAAO,MAAM;IAC1B,SAAS,MAAM;IACP,YAAY,OAAO,MAAM;IAEC,CAAC,KAAK,IAAI;AAGzD,OAAI,YAAY,OAAO,GACrB,QAAO,oBAAoB,WAAW,OAAO;;;AAMnD,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;;AAI/D,KAAI,OAAO,KAAK,OAAO,CAAC,WAAW,EACjC;AAGF,QAAO;;AAGT,aAAa,iBAAiB,CAAC,WAAW,gBAAgB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { filterMods, parseStyle } from "../utils/styles.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/styles/outline.ts
|
|
4
|
+
const BORDER_STYLES = [
|
|
5
|
+
"none",
|
|
6
|
+
"hidden",
|
|
7
|
+
"dotted",
|
|
8
|
+
"dashed",
|
|
9
|
+
"solid",
|
|
10
|
+
"double",
|
|
11
|
+
"groove",
|
|
12
|
+
"ridge",
|
|
13
|
+
"inset",
|
|
14
|
+
"outset"
|
|
15
|
+
];
|
|
16
|
+
/**
|
|
17
|
+
* Generates CSS for outline property with optional offset.
|
|
18
|
+
*
|
|
19
|
+
* Syntax:
|
|
20
|
+
* - `outline="2px solid #red"` - outline only
|
|
21
|
+
* - `outline="2px solid #red / 4px"` - outline with offset (slash separator)
|
|
22
|
+
* - `outline="2px / 4px"` - width with offset (simpler form)
|
|
23
|
+
* - `outline={true}` - default 1ow solid outline
|
|
24
|
+
* - `outlineOffset="4px"` - offset as separate prop (can be combined with outline)
|
|
25
|
+
*
|
|
26
|
+
* Priority: slash syntax in outline takes precedence over outlineOffset prop
|
|
27
|
+
*
|
|
28
|
+
* @return CSS properties for outline and optionally outline-offset
|
|
29
|
+
*/
|
|
30
|
+
function outlineStyle({ outline, outlineOffset }) {
|
|
31
|
+
const result = {};
|
|
32
|
+
if (outline != null && outline !== false) {
|
|
33
|
+
let outlineValue = outline;
|
|
34
|
+
if (outline === true) outlineValue = "1ow";
|
|
35
|
+
if (outline === 0) outlineValue = "0";
|
|
36
|
+
const group = parseStyle(String(outlineValue)).groups[0];
|
|
37
|
+
if (group) {
|
|
38
|
+
const { parts } = group;
|
|
39
|
+
const outlinePart = parts[0] ?? {
|
|
40
|
+
values: [],
|
|
41
|
+
mods: [],
|
|
42
|
+
colors: []
|
|
43
|
+
};
|
|
44
|
+
const offsetPart = parts[1];
|
|
45
|
+
const typeMods = filterMods(outlinePart.mods, BORDER_STYLES);
|
|
46
|
+
result["outline"] = [
|
|
47
|
+
outlinePart.values[0] || "var(--outline-width)",
|
|
48
|
+
typeMods[0] || "solid",
|
|
49
|
+
outlinePart.colors[0] || "var(--outline-color)"
|
|
50
|
+
].join(" ");
|
|
51
|
+
if (offsetPart?.values[0]) result["outline-offset"] = offsetPart.values[0];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (outlineOffset != null && !result["outline-offset"]) {
|
|
55
|
+
const offsetValue = typeof outlineOffset === "number" ? `${outlineOffset}px` : outlineOffset;
|
|
56
|
+
result["outline-offset"] = parseStyle(offsetValue).groups[0]?.values[0] || offsetValue;
|
|
57
|
+
}
|
|
58
|
+
if (Object.keys(result).length === 0) return;
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
outlineStyle.__lookupStyles = ["outline", "outlineOffset"];
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
export { outlineStyle };
|
|
65
|
+
//# sourceMappingURL=outline.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outline.mjs","names":[],"sources":["../../src/styles/outline.ts"],"sourcesContent":["import { filterMods, parseStyle } from '../utils/styles';\n\nconst BORDER_STYLES = [\n 'none',\n 'hidden',\n 'dotted',\n 'dashed',\n 'solid',\n 'double',\n 'groove',\n 'ridge',\n 'inset',\n 'outset',\n];\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 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(outlinePart.mods, BORDER_STYLES);\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 // Check for offset in second part (after /) - takes precedence\n if (offsetPart?.values[0]) {\n result['outline-offset'] = offsetPart.values[0];\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 // Return undefined if no styles to apply\n if (Object.keys(result).length === 0) {\n return;\n }\n\n return result;\n}\n\noutlineStyle.__lookupStyles = ['outline', 'outlineOffset'];\n"],"mappings":";;;AAEA,MAAM,gBAAgB;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;;;;;;;;;;;;AAqBD,SAAgB,aAAa,EAAE,SAAS,iBAAoC;CAC1E,MAAM,SAAiC,EAAE;AAGzC,KAAI,WAAW,QAAQ,YAAY,OAAO;EACxC,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,WAAW,YAAY,MAAM,cAAc;AAM5D,UAAO,aAAa;IAJN,YAAY,OAAO,MAAM;IAC1B,SAAS,MAAM;IACP,YAAY,OAAO,MAAM;IAEC,CAAC,KAAK,IAAI;AAGzD,OAAI,YAAY,OAAO,GACrB,QAAO,oBAAoB,WAAW,OAAO;;;AAMnD,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;;AAI/D,KAAI,OAAO,KAAK,OAAO,CAAC,WAAW,EACjC;AAGF,QAAO;;AAGT,aAAa,iBAAiB,CAAC,WAAW,gBAAgB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
}): {
|
|
19
|
+
padding?: undefined;
|
|
20
|
+
} | {
|
|
21
|
+
padding: string;
|
|
22
|
+
};
|
|
23
|
+
declare namespace paddingStyle {
|
|
24
|
+
var __lookupStyles: string[];
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { paddingStyle };
|
|
28
|
+
//# sourceMappingURL=padding.d.ts.map
|