@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,12 @@
|
|
|
1
|
+
//#region src/styles/flow.ts
|
|
2
|
+
function flowStyle({ display = "block", flow }) {
|
|
3
|
+
let style;
|
|
4
|
+
if (display.includes("grid")) style = "grid-auto-flow";
|
|
5
|
+
else if (display.includes("flex")) style = "flex-flow";
|
|
6
|
+
return style ? { [style]: flow } : null;
|
|
7
|
+
}
|
|
8
|
+
flowStyle.__lookupStyles = ["display", "flow"];
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { flowStyle };
|
|
12
|
+
//# sourceMappingURL=flow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow.js","names":[],"sources":["../../src/styles/flow.ts"],"sourcesContent":["export function flowStyle({ display = 'block', flow }) {\n let style;\n\n if (display.includes('grid')) {\n style = 'grid-auto-flow';\n } else if (display.includes('flex')) {\n style = 'flex-flow';\n }\n\n return style ? { [style]: flow } : null;\n}\n\nflowStyle.__lookupStyles = ['display', 'flow'];\n"],"mappings":";AAAA,SAAgB,UAAU,EAAE,UAAU,SAAS,QAAQ;CACrD,IAAI;AAEJ,KAAI,QAAQ,SAAS,OAAO,CAC1B,SAAQ;UACC,QAAQ,SAAS,OAAO,CACjC,SAAQ;AAGV,QAAO,QAAQ,GAAG,QAAQ,MAAM,GAAG;;AAGrC,UAAU,iBAAiB,CAAC,WAAW,OAAO"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/styles/flow.ts
|
|
2
|
+
function flowStyle({ display = "block", flow }) {
|
|
3
|
+
let style;
|
|
4
|
+
if (display.includes("grid")) style = "grid-auto-flow";
|
|
5
|
+
else if (display.includes("flex")) style = "flex-flow";
|
|
6
|
+
return style ? { [style]: flow } : null;
|
|
7
|
+
}
|
|
8
|
+
flowStyle.__lookupStyles = ["display", "flow"];
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { flowStyle };
|
|
12
|
+
//# sourceMappingURL=flow.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow.mjs","names":[],"sources":["../../src/styles/flow.ts"],"sourcesContent":["export function flowStyle({ display = 'block', flow }) {\n let style;\n\n if (display.includes('grid')) {\n style = 'grid-auto-flow';\n } else if (display.includes('flex')) {\n style = 'flex-flow';\n }\n\n return style ? { [style]: flow } : null;\n}\n\nflowStyle.__lookupStyles = ['display', 'flow'];\n"],"mappings":";AAAA,SAAgB,UAAU,EAAE,UAAU,SAAS,QAAQ;CACrD,IAAI;AAEJ,KAAI,QAAQ,SAAS,OAAO,CAC1B,SAAQ;UACC,QAAQ,SAAS,OAAO,CACjC,SAAQ;AAGV,QAAO,QAAQ,GAAG,QAAQ,MAAM,GAAG;;AAGrC,UAAU,iBAAiB,CAAC,WAAW,OAAO"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/styles/gap.d.ts
|
|
2
|
+
declare function gapStyle({
|
|
3
|
+
display,
|
|
4
|
+
flow,
|
|
5
|
+
gap
|
|
6
|
+
}: {
|
|
7
|
+
display?: string;
|
|
8
|
+
flow?: string;
|
|
9
|
+
gap?: string | number | boolean;
|
|
10
|
+
}): {
|
|
11
|
+
gap: string;
|
|
12
|
+
$?: undefined;
|
|
13
|
+
} | ({
|
|
14
|
+
'margin-right': string;
|
|
15
|
+
'margin-bottom': string;
|
|
16
|
+
$?: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
$: string;
|
|
19
|
+
'margin-right': string;
|
|
20
|
+
'margin-bottom': string;
|
|
21
|
+
})[] | {
|
|
22
|
+
[x: string]: string;
|
|
23
|
+
$: string;
|
|
24
|
+
gap?: undefined;
|
|
25
|
+
} | undefined;
|
|
26
|
+
declare namespace gapStyle {
|
|
27
|
+
var __lookupStyles: string[];
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { gapStyle };
|
|
31
|
+
//# sourceMappingURL=gap.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { makeEmptyDetails } from "../parser/types.js";
|
|
2
|
+
import { parseStyle } from "../utils/styles.js";
|
|
3
|
+
|
|
4
|
+
//#region src/styles/gap.ts
|
|
5
|
+
function gapStyle({ display = "block", flow, gap }) {
|
|
6
|
+
if (typeof gap === "number") gap = `${gap}px`;
|
|
7
|
+
if (!gap) return;
|
|
8
|
+
if (gap === true) gap = "1x";
|
|
9
|
+
const isGrid = display.includes("grid");
|
|
10
|
+
const isFlex = display.includes("flex");
|
|
11
|
+
const isWrap = flow ? flow.includes("wrap") && !flow.includes("nowrap") : false;
|
|
12
|
+
if (!isGrid && flow == null) flow = isFlex ? "row" : "column";
|
|
13
|
+
const { values } = parseStyle(gap).groups[0] ?? makeEmptyDetails();
|
|
14
|
+
gap = values.join(" ");
|
|
15
|
+
if (isGrid || isFlex) return { gap };
|
|
16
|
+
const gapDir = flow?.includes("row") ? "right" : "bottom";
|
|
17
|
+
return isWrap ? [{
|
|
18
|
+
"margin-right": `calc(-1 * ${values[1] || values[0]})`,
|
|
19
|
+
"margin-bottom": `calc(-1 * ${values[0]})`
|
|
20
|
+
}, {
|
|
21
|
+
$: "& > *",
|
|
22
|
+
"margin-right": values[1] || values[0],
|
|
23
|
+
"margin-bottom": values[0]
|
|
24
|
+
}] : {
|
|
25
|
+
$: "& > *:not(:last-child)",
|
|
26
|
+
[`margin-${gapDir}`]: gap
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
gapStyle.__lookupStyles = [
|
|
30
|
+
"display",
|
|
31
|
+
"flow",
|
|
32
|
+
"gap"
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { gapStyle };
|
|
37
|
+
//# sourceMappingURL=gap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gap.js","names":[],"sources":["../../src/styles/gap.ts"],"sourcesContent":["import { makeEmptyDetails } from '../parser/types';\nimport { parseStyle } from '../utils/styles';\n\nexport function gapStyle({\n display = 'block',\n flow,\n gap,\n}: {\n display?: string;\n flow?: string;\n gap?: string | number | boolean;\n}) {\n if (typeof gap === 'number') {\n gap = `${gap}px`;\n }\n\n if (!gap) {\n return;\n }\n\n if (gap === true) {\n gap = '1x';\n }\n\n const isGrid = display.includes('grid');\n const isFlex = display.includes('flex');\n const isWrap = flow\n ? flow.includes('wrap') && !flow.includes('nowrap')\n : false;\n\n if (!isGrid && flow == null) {\n flow = isFlex ? 'row' : 'column';\n }\n\n const processed = parseStyle(gap);\n const { values } = processed.groups[0] ?? makeEmptyDetails();\n\n gap = values.join(' ');\n\n if (isGrid || isFlex) {\n return { gap };\n }\n\n const gapDir = flow?.includes('row') ? 'right' : 'bottom';\n\n return isWrap\n ? [\n {\n 'margin-right': `calc(-1 * ${values[1] || values[0]})`,\n 'margin-bottom': `calc(-1 * ${values[0]})`,\n },\n {\n $: '& > *',\n 'margin-right': values[1] || values[0],\n 'margin-bottom': values[0],\n },\n ]\n : {\n $: '& > *:not(:last-child)',\n [`margin-${gapDir}`]: gap,\n };\n}\n\ngapStyle.__lookupStyles = ['display', 'flow', 'gap'];\n"],"mappings":";;;;AAGA,SAAgB,SAAS,EACvB,UAAU,SACV,MACA,OAKC;AACD,KAAI,OAAO,QAAQ,SACjB,OAAM,GAAG,IAAI;AAGf,KAAI,CAAC,IACH;AAGF,KAAI,QAAQ,KACV,OAAM;CAGR,MAAM,SAAS,QAAQ,SAAS,OAAO;CACvC,MAAM,SAAS,QAAQ,SAAS,OAAO;CACvC,MAAM,SAAS,OACX,KAAK,SAAS,OAAO,IAAI,CAAC,KAAK,SAAS,SAAS,GACjD;AAEJ,KAAI,CAAC,UAAU,QAAQ,KACrB,QAAO,SAAS,QAAQ;CAI1B,MAAM,EAAE,WADU,WAAW,IAAI,CACJ,OAAO,MAAM,kBAAkB;AAE5D,OAAM,OAAO,KAAK,IAAI;AAEtB,KAAI,UAAU,OACZ,QAAO,EAAE,KAAK;CAGhB,MAAM,SAAS,MAAM,SAAS,MAAM,GAAG,UAAU;AAEjD,QAAO,SACH,CACE;EACE,gBAAgB,aAAa,OAAO,MAAM,OAAO,GAAG;EACpD,iBAAiB,aAAa,OAAO,GAAG;EACzC,EACD;EACE,GAAG;EACH,gBAAgB,OAAO,MAAM,OAAO;EACpC,iBAAiB,OAAO;EACzB,CACF,GACD;EACE,GAAG;GACF,UAAU,WAAW;EACvB;;AAGP,SAAS,iBAAiB;CAAC;CAAW;CAAQ;CAAM"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { makeEmptyDetails } from "../parser/types.mjs";
|
|
2
|
+
import { parseStyle } from "../utils/styles.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/styles/gap.ts
|
|
5
|
+
function gapStyle({ display = "block", flow, gap }) {
|
|
6
|
+
if (typeof gap === "number") gap = `${gap}px`;
|
|
7
|
+
if (!gap) return;
|
|
8
|
+
if (gap === true) gap = "1x";
|
|
9
|
+
const isGrid = display.includes("grid");
|
|
10
|
+
const isFlex = display.includes("flex");
|
|
11
|
+
const isWrap = flow ? flow.includes("wrap") && !flow.includes("nowrap") : false;
|
|
12
|
+
if (!isGrid && flow == null) flow = isFlex ? "row" : "column";
|
|
13
|
+
const { values } = parseStyle(gap).groups[0] ?? makeEmptyDetails();
|
|
14
|
+
gap = values.join(" ");
|
|
15
|
+
if (isGrid || isFlex) return { gap };
|
|
16
|
+
const gapDir = flow?.includes("row") ? "right" : "bottom";
|
|
17
|
+
return isWrap ? [{
|
|
18
|
+
"margin-right": `calc(-1 * ${values[1] || values[0]})`,
|
|
19
|
+
"margin-bottom": `calc(-1 * ${values[0]})`
|
|
20
|
+
}, {
|
|
21
|
+
$: "& > *",
|
|
22
|
+
"margin-right": values[1] || values[0],
|
|
23
|
+
"margin-bottom": values[0]
|
|
24
|
+
}] : {
|
|
25
|
+
$: "& > *:not(:last-child)",
|
|
26
|
+
[`margin-${gapDir}`]: gap
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
gapStyle.__lookupStyles = [
|
|
30
|
+
"display",
|
|
31
|
+
"flow",
|
|
32
|
+
"gap"
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { gapStyle };
|
|
37
|
+
//# sourceMappingURL=gap.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gap.mjs","names":[],"sources":["../../src/styles/gap.ts"],"sourcesContent":["import { makeEmptyDetails } from '../parser/types';\nimport { parseStyle } from '../utils/styles';\n\nexport function gapStyle({\n display = 'block',\n flow,\n gap,\n}: {\n display?: string;\n flow?: string;\n gap?: string | number | boolean;\n}) {\n if (typeof gap === 'number') {\n gap = `${gap}px`;\n }\n\n if (!gap) {\n return;\n }\n\n if (gap === true) {\n gap = '1x';\n }\n\n const isGrid = display.includes('grid');\n const isFlex = display.includes('flex');\n const isWrap = flow\n ? flow.includes('wrap') && !flow.includes('nowrap')\n : false;\n\n if (!isGrid && flow == null) {\n flow = isFlex ? 'row' : 'column';\n }\n\n const processed = parseStyle(gap);\n const { values } = processed.groups[0] ?? makeEmptyDetails();\n\n gap = values.join(' ');\n\n if (isGrid || isFlex) {\n return { gap };\n }\n\n const gapDir = flow?.includes('row') ? 'right' : 'bottom';\n\n return isWrap\n ? [\n {\n 'margin-right': `calc(-1 * ${values[1] || values[0]})`,\n 'margin-bottom': `calc(-1 * ${values[0]})`,\n },\n {\n $: '& > *',\n 'margin-right': values[1] || values[0],\n 'margin-bottom': values[0],\n },\n ]\n : {\n $: '& > *:not(:last-child)',\n [`margin-${gapDir}`]: gap,\n };\n}\n\ngapStyle.__lookupStyles = ['display', 'flow', 'gap'];\n"],"mappings":";;;;AAGA,SAAgB,SAAS,EACvB,UAAU,SACV,MACA,OAKC;AACD,KAAI,OAAO,QAAQ,SACjB,OAAM,GAAG,IAAI;AAGf,KAAI,CAAC,IACH;AAGF,KAAI,QAAQ,KACV,OAAM;CAGR,MAAM,SAAS,QAAQ,SAAS,OAAO;CACvC,MAAM,SAAS,QAAQ,SAAS,OAAO;CACvC,MAAM,SAAS,OACX,KAAK,SAAS,OAAO,IAAI,CAAC,KAAK,SAAS,SAAS,GACjD;AAEJ,KAAI,CAAC,UAAU,QAAQ,KACrB,QAAO,SAAS,QAAQ;CAI1B,MAAM,EAAE,WADU,WAAW,IAAI,CACJ,OAAO,MAAM,kBAAkB;AAE5D,OAAM,OAAO,KAAK,IAAI;AAEtB,KAAI,UAAU,OACZ,QAAO,EAAE,KAAK;CAGhB,MAAM,SAAS,MAAM,SAAS,MAAM,GAAG,UAAU;AAEjD,QAAO,SACH,CACE;EACE,gBAAgB,aAAa,OAAO,MAAM,OAAO,GAAG;EACpD,iBAAiB,aAAa,OAAO,GAAG;EACzC,EACD;EACE,GAAG;EACH,gBAAgB,OAAO,MAAM,OAAO;EACpC,iBAAiB,OAAO;EACzB,CACF,GACD;EACE,GAAG;GACF,UAAU,WAAW;EACvB;;AAGP,SAAS,iBAAiB;CAAC;CAAW;CAAQ;CAAM"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/styles/height.d.ts
|
|
2
|
+
interface HeightStyleProps {
|
|
3
|
+
height?: string | number | boolean;
|
|
4
|
+
minHeight?: string | number | boolean;
|
|
5
|
+
maxHeight?: string | number | boolean;
|
|
6
|
+
}
|
|
7
|
+
declare function heightStyle({
|
|
8
|
+
height,
|
|
9
|
+
minHeight,
|
|
10
|
+
maxHeight
|
|
11
|
+
}: HeightStyleProps): Record<string, string | string[]> | undefined;
|
|
12
|
+
declare namespace heightStyle {
|
|
13
|
+
var __lookupStyles: string[];
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { heightStyle };
|
|
17
|
+
//# sourceMappingURL=height.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { dimensionStyle } from "./dimension.js";
|
|
2
|
+
|
|
3
|
+
//#region src/styles/height.ts
|
|
4
|
+
const dimension = dimensionStyle("height");
|
|
5
|
+
function heightStyle({ height, minHeight, maxHeight }) {
|
|
6
|
+
return dimension({
|
|
7
|
+
value: height,
|
|
8
|
+
min: minHeight,
|
|
9
|
+
max: maxHeight
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
heightStyle.__lookupStyles = [
|
|
13
|
+
"height",
|
|
14
|
+
"minHeight",
|
|
15
|
+
"maxHeight"
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { heightStyle };
|
|
20
|
+
//# sourceMappingURL=height.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"height.js","names":[],"sources":["../../src/styles/height.ts"],"sourcesContent":["import { dimensionStyle } from './dimension';\n\nconst dimension = dimensionStyle('height');\n\ninterface HeightStyleProps {\n height?: string | number | boolean;\n minHeight?: string | number | boolean;\n maxHeight?: string | number | boolean;\n}\n\nexport function heightStyle({\n height,\n minHeight,\n maxHeight,\n}: HeightStyleProps) {\n return dimension({ value: height, min: minHeight, max: maxHeight });\n}\n\nheightStyle.__lookupStyles = ['height', 'minHeight', 'maxHeight'];\n"],"mappings":";;;AAEA,MAAM,YAAY,eAAe,SAAS;AAQ1C,SAAgB,YAAY,EAC1B,QACA,WACA,aACmB;AACnB,QAAO,UAAU;EAAE,OAAO;EAAQ,KAAK;EAAW,KAAK;EAAW,CAAC;;AAGrE,YAAY,iBAAiB;CAAC;CAAU;CAAa;CAAY"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { dimensionStyle } from "./dimension.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/styles/height.ts
|
|
4
|
+
const dimension = dimensionStyle("height");
|
|
5
|
+
function heightStyle({ height, minHeight, maxHeight }) {
|
|
6
|
+
return dimension({
|
|
7
|
+
value: height,
|
|
8
|
+
min: minHeight,
|
|
9
|
+
max: maxHeight
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
heightStyle.__lookupStyles = [
|
|
13
|
+
"height",
|
|
14
|
+
"minHeight",
|
|
15
|
+
"maxHeight"
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { heightStyle };
|
|
20
|
+
//# sourceMappingURL=height.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"height.mjs","names":[],"sources":["../../src/styles/height.ts"],"sourcesContent":["import { dimensionStyle } from './dimension';\n\nconst dimension = dimensionStyle('height');\n\ninterface HeightStyleProps {\n height?: string | number | boolean;\n minHeight?: string | number | boolean;\n maxHeight?: string | number | boolean;\n}\n\nexport function heightStyle({\n height,\n minHeight,\n maxHeight,\n}: HeightStyleProps) {\n return dimension({ value: height, min: minHeight, max: maxHeight });\n}\n\nheightStyle.__lookupStyles = ['height', 'minHeight', 'maxHeight'];\n"],"mappings":";;;AAEA,MAAM,YAAY,eAAe,SAAS;AAQ1C,SAAgB,YAAY,EAC1B,QACA,WACA,aACmB;AACnB,QAAO,UAAU;EAAE,OAAO;EAAQ,KAAK;EAAW,KAAK;EAAW,CAAC;;AAGrE,YAAY,iBAAiB;CAAC;CAAU;CAAa;CAAY"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { convertColorChainToRgbChain, createStyle } from "./createStyle.js";
|
|
2
|
+
import { normalizeHandlerDefinition, predefine, registerHandler, resetHandlers, styleHandlers } from "./predefined.js";
|
|
3
|
+
|
|
4
|
+
//#region src/styles/index.ts
|
|
5
|
+
const { STYLE_HANDLER_MAP, defineCustomStyle, defineStyleAlias } = predefine();
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { STYLE_HANDLER_MAP };
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/styles/index.ts"],"sourcesContent":["import { predefine, styleHandlers } from './predefined';\n\nconst { STYLE_HANDLER_MAP, defineCustomStyle, defineStyleAlias } = predefine();\n\nexport {\n STYLE_HANDLER_MAP,\n defineCustomStyle,\n defineStyleAlias,\n styleHandlers,\n};\nexport * from './createStyle';\nexport {\n normalizeHandlerDefinition,\n registerHandler,\n resetHandlers,\n validateHandlerResult,\n} from './predefined';\n"],"mappings":";;;;AAEA,MAAM,EAAE,mBAAmB,mBAAmB,qBAAqB,WAAW"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { convertColorChainToRgbChain, createStyle } from "./createStyle.mjs";
|
|
2
|
+
import { normalizeHandlerDefinition, predefine, registerHandler } from "./predefined.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/styles/index.ts
|
|
5
|
+
const { STYLE_HANDLER_MAP, defineCustomStyle, defineStyleAlias } = predefine();
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { STYLE_HANDLER_MAP };
|
|
9
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/styles/index.ts"],"sourcesContent":["import { predefine, styleHandlers } from './predefined';\n\nconst { STYLE_HANDLER_MAP, defineCustomStyle, defineStyleAlias } = predefine();\n\nexport {\n STYLE_HANDLER_MAP,\n defineCustomStyle,\n defineStyleAlias,\n styleHandlers,\n};\nexport * from './createStyle';\nexport {\n normalizeHandlerDefinition,\n registerHandler,\n resetHandlers,\n validateHandlerResult,\n} from './predefined';\n"],"mappings":";;;;AAEA,MAAM,EAAE,mBAAmB,mBAAmB,qBAAqB,WAAW"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//#region src/styles/inset.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Inset style handler.
|
|
4
|
+
*
|
|
5
|
+
* IMPORTANT: This handler uses individual CSS properties (top, right, bottom, left)
|
|
6
|
+
* when only individual direction props are specified. This allows CSS cascade to work
|
|
7
|
+
* correctly when modifiers override only some directions.
|
|
8
|
+
*
|
|
9
|
+
* Example problem with using `inset` shorthand everywhere:
|
|
10
|
+
* styles: {
|
|
11
|
+
* top: { '': 0, 'side=bottom': 'initial' },
|
|
12
|
+
* right: { '': 0, 'side=left': 'initial' },
|
|
13
|
+
* bottom: { '': 0, 'side=top': 'initial' },
|
|
14
|
+
* left: { '': 0, 'side=right': 'initial' },
|
|
15
|
+
* }
|
|
16
|
+
*
|
|
17
|
+
* If we output `inset` for both cases:
|
|
18
|
+
* - Default: inset: 0 0 0 0
|
|
19
|
+
* - side=bottom: inset: initial auto auto auto ← WRONG! Overrides all 4 directions
|
|
20
|
+
*
|
|
21
|
+
* With individual properties:
|
|
22
|
+
* - Default: top: 0; right: 0; bottom: 0; left: 0
|
|
23
|
+
* - side=bottom: top: initial ← CORRECT! Only overrides top
|
|
24
|
+
*
|
|
25
|
+
* The `inset` shorthand is only used when the base `inset` prop is specified
|
|
26
|
+
* OR when `insetBlock`/`insetInline` are used (which imply setting pairs).
|
|
27
|
+
*/
|
|
28
|
+
declare function insetStyle({
|
|
29
|
+
inset,
|
|
30
|
+
insetBlock,
|
|
31
|
+
insetInline,
|
|
32
|
+
top,
|
|
33
|
+
right,
|
|
34
|
+
bottom,
|
|
35
|
+
left
|
|
36
|
+
}: {
|
|
37
|
+
inset?: string | number | boolean;
|
|
38
|
+
insetBlock?: string | number | boolean;
|
|
39
|
+
insetInline?: string | number | boolean;
|
|
40
|
+
top?: string | number | boolean;
|
|
41
|
+
right?: string | number | boolean;
|
|
42
|
+
bottom?: string | number | boolean;
|
|
43
|
+
left?: string | number | boolean;
|
|
44
|
+
}): Record<string, string>;
|
|
45
|
+
declare namespace insetStyle {
|
|
46
|
+
var __lookupStyles: string[];
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
export { insetStyle };
|
|
50
|
+
//# sourceMappingURL=inset.d.ts.map
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { DIRECTIONS, filterMods, parseStyle } from "../utils/styles.js";
|
|
2
|
+
|
|
3
|
+
//#region src/styles/inset.ts
|
|
4
|
+
/**
|
|
5
|
+
* Parse an inset value and return the first processed value
|
|
6
|
+
*/
|
|
7
|
+
function parseInsetValue(value) {
|
|
8
|
+
if (typeof value === "number") return `${value}px`;
|
|
9
|
+
if (!value) return null;
|
|
10
|
+
if (value === true) value = "0";
|
|
11
|
+
const { values } = parseStyle(value).groups[0] ?? { values: [] };
|
|
12
|
+
return values[0] || "0";
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Parse inset value with optional directions (like "1x top" or "2x left right")
|
|
16
|
+
*/
|
|
17
|
+
function parseDirectionalInset(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 = "0";
|
|
27
|
+
const { values = [], mods = [] } = parseStyle(value).groups[0] ?? {};
|
|
28
|
+
return {
|
|
29
|
+
values: values.length ? values : ["0"],
|
|
30
|
+
directions: filterMods(mods, DIRECTIONS)
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Inset style handler.
|
|
35
|
+
*
|
|
36
|
+
* IMPORTANT: This handler uses individual CSS properties (top, right, bottom, left)
|
|
37
|
+
* when only individual direction props are specified. This allows CSS cascade to work
|
|
38
|
+
* correctly when modifiers override only some directions.
|
|
39
|
+
*
|
|
40
|
+
* Example problem with using `inset` shorthand everywhere:
|
|
41
|
+
* styles: {
|
|
42
|
+
* top: { '': 0, 'side=bottom': 'initial' },
|
|
43
|
+
* right: { '': 0, 'side=left': 'initial' },
|
|
44
|
+
* bottom: { '': 0, 'side=top': 'initial' },
|
|
45
|
+
* left: { '': 0, 'side=right': 'initial' },
|
|
46
|
+
* }
|
|
47
|
+
*
|
|
48
|
+
* If we output `inset` for both cases:
|
|
49
|
+
* - Default: inset: 0 0 0 0
|
|
50
|
+
* - side=bottom: inset: initial auto auto auto ← WRONG! Overrides all 4 directions
|
|
51
|
+
*
|
|
52
|
+
* With individual properties:
|
|
53
|
+
* - Default: top: 0; right: 0; bottom: 0; left: 0
|
|
54
|
+
* - side=bottom: top: initial ← CORRECT! Only overrides top
|
|
55
|
+
*
|
|
56
|
+
* The `inset` shorthand is only used when the base `inset` prop is specified
|
|
57
|
+
* OR when `insetBlock`/`insetInline` are used (which imply setting pairs).
|
|
58
|
+
*/
|
|
59
|
+
function insetStyle({ inset, insetBlock, insetInline, top, right, bottom, left }) {
|
|
60
|
+
if (inset == null && insetBlock == null && insetInline == null && top == null && right == null && bottom == null && left == null) return {};
|
|
61
|
+
if (inset == null && insetBlock == null && insetInline == null) {
|
|
62
|
+
const result = {};
|
|
63
|
+
if (top != null) {
|
|
64
|
+
const val = parseInsetValue(top);
|
|
65
|
+
if (val) result["top"] = val;
|
|
66
|
+
}
|
|
67
|
+
if (right != null) {
|
|
68
|
+
const val = parseInsetValue(right);
|
|
69
|
+
if (val) result["right"] = val;
|
|
70
|
+
}
|
|
71
|
+
if (bottom != null) {
|
|
72
|
+
const val = parseInsetValue(bottom);
|
|
73
|
+
if (val) result["bottom"] = val;
|
|
74
|
+
}
|
|
75
|
+
if (left != null) {
|
|
76
|
+
const val = parseInsetValue(left);
|
|
77
|
+
if (val) result["left"] = val;
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
let [topVal, rightVal, bottomVal, leftVal] = [
|
|
82
|
+
"auto",
|
|
83
|
+
"auto",
|
|
84
|
+
"auto",
|
|
85
|
+
"auto"
|
|
86
|
+
];
|
|
87
|
+
if (inset != null) {
|
|
88
|
+
const { values, directions } = parseDirectionalInset(inset);
|
|
89
|
+
if (values.length) if (directions.length === 0) {
|
|
90
|
+
topVal = values[0];
|
|
91
|
+
rightVal = values[1] || values[0];
|
|
92
|
+
bottomVal = values[2] || values[0];
|
|
93
|
+
leftVal = values[3] || values[1] || values[0];
|
|
94
|
+
} else directions.forEach((dir, i) => {
|
|
95
|
+
const val = values[i] ?? values[0];
|
|
96
|
+
if (dir === "top") topVal = val;
|
|
97
|
+
else if (dir === "right") rightVal = val;
|
|
98
|
+
else if (dir === "bottom") bottomVal = val;
|
|
99
|
+
else if (dir === "left") leftVal = val;
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
if (insetBlock != null) {
|
|
103
|
+
const val = parseInsetValue(insetBlock);
|
|
104
|
+
if (val) topVal = bottomVal = val;
|
|
105
|
+
}
|
|
106
|
+
if (insetInline != null) {
|
|
107
|
+
const val = parseInsetValue(insetInline);
|
|
108
|
+
if (val) leftVal = rightVal = val;
|
|
109
|
+
}
|
|
110
|
+
if (top != null) {
|
|
111
|
+
const val = parseInsetValue(top);
|
|
112
|
+
if (val) topVal = val;
|
|
113
|
+
}
|
|
114
|
+
if (right != null) {
|
|
115
|
+
const val = parseInsetValue(right);
|
|
116
|
+
if (val) rightVal = val;
|
|
117
|
+
}
|
|
118
|
+
if (bottom != null) {
|
|
119
|
+
const val = parseInsetValue(bottom);
|
|
120
|
+
if (val) bottomVal = val;
|
|
121
|
+
}
|
|
122
|
+
if (left != null) {
|
|
123
|
+
const val = parseInsetValue(left);
|
|
124
|
+
if (val) leftVal = val;
|
|
125
|
+
}
|
|
126
|
+
if (topVal === rightVal && rightVal === bottomVal && bottomVal === leftVal) return { inset: topVal };
|
|
127
|
+
if (topVal === bottomVal && leftVal === rightVal) return { inset: `${topVal} ${leftVal}` };
|
|
128
|
+
return { inset: `${topVal} ${rightVal} ${bottomVal} ${leftVal}` };
|
|
129
|
+
}
|
|
130
|
+
insetStyle.__lookupStyles = [
|
|
131
|
+
"inset",
|
|
132
|
+
"insetBlock",
|
|
133
|
+
"insetInline",
|
|
134
|
+
"top",
|
|
135
|
+
"right",
|
|
136
|
+
"bottom",
|
|
137
|
+
"left"
|
|
138
|
+
];
|
|
139
|
+
|
|
140
|
+
//#endregion
|
|
141
|
+
export { insetStyle };
|
|
142
|
+
//# sourceMappingURL=inset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inset.js","names":[],"sources":["../../src/styles/inset.ts"],"sourcesContent":["import { DIRECTIONS, filterMods, parseStyle } from '../utils/styles';\n\n/**\n * Parse an inset value and return the first processed value\n */\nfunction parseInsetValue(value: string | number | boolean): string | null {\n if (typeof value === 'number') return `${value}px`;\n if (!value) return null;\n if (value === true) value = '0';\n\n const { values } = parseStyle(value).groups[0] ?? { values: [] };\n\n return values[0] || '0';\n}\n\n/**\n * Parse inset value with optional directions (like \"1x top\" or \"2x left right\")\n */\nfunction parseDirectionalInset(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 = '0';\n\n const { values = [], mods = [] } = parseStyle(value).groups[0] ?? {};\n\n return {\n values: values.length ? values : ['0'],\n directions: filterMods(mods, DIRECTIONS),\n };\n}\n\n/**\n * Inset style handler.\n *\n * IMPORTANT: This handler uses individual CSS properties (top, right, bottom, left)\n * when only individual direction props are specified. This allows CSS cascade to work\n * correctly when modifiers override only some directions.\n *\n * Example problem with using `inset` shorthand everywhere:\n * styles: {\n * top: { '': 0, 'side=bottom': 'initial' },\n * right: { '': 0, 'side=left': 'initial' },\n * bottom: { '': 0, 'side=top': 'initial' },\n * left: { '': 0, 'side=right': 'initial' },\n * }\n *\n * If we output `inset` for both cases:\n * - Default: inset: 0 0 0 0\n * - side=bottom: inset: initial auto auto auto ← WRONG! Overrides all 4 directions\n *\n * With individual properties:\n * - Default: top: 0; right: 0; bottom: 0; left: 0\n * - side=bottom: top: initial ← CORRECT! Only overrides top\n *\n * The `inset` shorthand is only used when the base `inset` prop is specified\n * OR when `insetBlock`/`insetInline` are used (which imply setting pairs).\n */\nexport function insetStyle({\n inset,\n insetBlock,\n insetInline,\n top,\n right,\n bottom,\n left,\n}: {\n inset?: string | number | boolean;\n insetBlock?: string | number | boolean;\n insetInline?: string | number | boolean;\n top?: string | number | boolean;\n right?: string | number | boolean;\n bottom?: string | number | boolean;\n left?: string | number | boolean;\n}) {\n // If no props are defined, return empty object\n if (\n inset == null &&\n insetBlock == null &&\n insetInline == null &&\n top == null &&\n right == null &&\n bottom == null &&\n left == null\n ) {\n return {};\n }\n\n // When only individual direction props are used (no inset, insetBlock, insetInline),\n // output individual CSS properties to allow proper CSS cascade with modifiers\n const onlyIndividualProps =\n inset == null && insetBlock == null && insetInline == null;\n\n if (onlyIndividualProps) {\n const result: Record<string, string> = {};\n\n if (top != null) {\n const val = parseInsetValue(top);\n if (val) result['top'] = val;\n }\n if (right != null) {\n const val = parseInsetValue(right);\n if (val) result['right'] = val;\n }\n if (bottom != null) {\n const val = parseInsetValue(bottom);\n if (val) result['bottom'] = val;\n }\n if (left != null) {\n const val = parseInsetValue(left);\n if (val) result['left'] = val;\n }\n\n return result;\n }\n\n // When inset, insetBlock, or insetInline is used, use the shorthand approach\n // Initialize all directions to auto\n let [topVal, rightVal, bottomVal, leftVal] = ['auto', 'auto', 'auto', 'auto'];\n\n // Priority 1 (lowest): inset\n if (inset != null) {\n const { values, directions } = parseDirectionalInset(inset);\n\n if (values.length) {\n if (directions.length === 0) {\n topVal = values[0];\n rightVal = values[1] || values[0];\n bottomVal = values[2] || values[0];\n leftVal = values[3] || values[1] || values[0];\n } else {\n // Assign values to directions in the order they appear\n // e.g., 'right 1x top 0' → right: 1x, top: 0\n directions.forEach((dir, i) => {\n const val = values[i] ?? values[0];\n if (dir === 'top') topVal = val;\n else if (dir === 'right') rightVal = val;\n else if (dir === 'bottom') bottomVal = val;\n else if (dir === 'left') leftVal = val;\n });\n }\n }\n }\n\n // Priority 2 (medium): insetBlock/insetInline\n if (insetBlock != null) {\n const val = parseInsetValue(insetBlock);\n if (val) topVal = bottomVal = val;\n }\n if (insetInline != null) {\n const val = parseInsetValue(insetInline);\n if (val) leftVal = rightVal = val;\n }\n\n // Priority 3 (highest): individual directions\n if (top != null) {\n const val = parseInsetValue(top);\n if (val) topVal = val;\n }\n if (right != null) {\n const val = parseInsetValue(right);\n if (val) rightVal = val;\n }\n if (bottom != null) {\n const val = parseInsetValue(bottom);\n if (val) bottomVal = val;\n }\n if (left != null) {\n const val = parseInsetValue(left);\n if (val) leftVal = val;\n }\n\n // Optimize output: 1 value if all same, 2 values if top==bottom && left==right\n if (topVal === rightVal && rightVal === bottomVal && bottomVal === leftVal) {\n return { inset: topVal };\n }\n if (topVal === bottomVal && leftVal === rightVal) {\n return { inset: `${topVal} ${leftVal}` };\n }\n\n return { inset: `${topVal} ${rightVal} ${bottomVal} ${leftVal}` };\n}\n\ninsetStyle.__lookupStyles = [\n 'inset',\n 'insetBlock',\n 'insetInline',\n 'top',\n 'right',\n 'bottom',\n 'left',\n];\n"],"mappings":"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"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { DIRECTIONS, filterMods, parseStyle } from "../utils/styles.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/styles/inset.ts
|
|
4
|
+
/**
|
|
5
|
+
* Parse an inset value and return the first processed value
|
|
6
|
+
*/
|
|
7
|
+
function parseInsetValue(value) {
|
|
8
|
+
if (typeof value === "number") return `${value}px`;
|
|
9
|
+
if (!value) return null;
|
|
10
|
+
if (value === true) value = "0";
|
|
11
|
+
const { values } = parseStyle(value).groups[0] ?? { values: [] };
|
|
12
|
+
return values[0] || "0";
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Parse inset value with optional directions (like "1x top" or "2x left right")
|
|
16
|
+
*/
|
|
17
|
+
function parseDirectionalInset(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 = "0";
|
|
27
|
+
const { values = [], mods = [] } = parseStyle(value).groups[0] ?? {};
|
|
28
|
+
return {
|
|
29
|
+
values: values.length ? values : ["0"],
|
|
30
|
+
directions: filterMods(mods, DIRECTIONS)
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Inset style handler.
|
|
35
|
+
*
|
|
36
|
+
* IMPORTANT: This handler uses individual CSS properties (top, right, bottom, left)
|
|
37
|
+
* when only individual direction props are specified. This allows CSS cascade to work
|
|
38
|
+
* correctly when modifiers override only some directions.
|
|
39
|
+
*
|
|
40
|
+
* Example problem with using `inset` shorthand everywhere:
|
|
41
|
+
* styles: {
|
|
42
|
+
* top: { '': 0, 'side=bottom': 'initial' },
|
|
43
|
+
* right: { '': 0, 'side=left': 'initial' },
|
|
44
|
+
* bottom: { '': 0, 'side=top': 'initial' },
|
|
45
|
+
* left: { '': 0, 'side=right': 'initial' },
|
|
46
|
+
* }
|
|
47
|
+
*
|
|
48
|
+
* If we output `inset` for both cases:
|
|
49
|
+
* - Default: inset: 0 0 0 0
|
|
50
|
+
* - side=bottom: inset: initial auto auto auto ← WRONG! Overrides all 4 directions
|
|
51
|
+
*
|
|
52
|
+
* With individual properties:
|
|
53
|
+
* - Default: top: 0; right: 0; bottom: 0; left: 0
|
|
54
|
+
* - side=bottom: top: initial ← CORRECT! Only overrides top
|
|
55
|
+
*
|
|
56
|
+
* The `inset` shorthand is only used when the base `inset` prop is specified
|
|
57
|
+
* OR when `insetBlock`/`insetInline` are used (which imply setting pairs).
|
|
58
|
+
*/
|
|
59
|
+
function insetStyle({ inset, insetBlock, insetInline, top, right, bottom, left }) {
|
|
60
|
+
if (inset == null && insetBlock == null && insetInline == null && top == null && right == null && bottom == null && left == null) return {};
|
|
61
|
+
if (inset == null && insetBlock == null && insetInline == null) {
|
|
62
|
+
const result = {};
|
|
63
|
+
if (top != null) {
|
|
64
|
+
const val = parseInsetValue(top);
|
|
65
|
+
if (val) result["top"] = val;
|
|
66
|
+
}
|
|
67
|
+
if (right != null) {
|
|
68
|
+
const val = parseInsetValue(right);
|
|
69
|
+
if (val) result["right"] = val;
|
|
70
|
+
}
|
|
71
|
+
if (bottom != null) {
|
|
72
|
+
const val = parseInsetValue(bottom);
|
|
73
|
+
if (val) result["bottom"] = val;
|
|
74
|
+
}
|
|
75
|
+
if (left != null) {
|
|
76
|
+
const val = parseInsetValue(left);
|
|
77
|
+
if (val) result["left"] = val;
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
let [topVal, rightVal, bottomVal, leftVal] = [
|
|
82
|
+
"auto",
|
|
83
|
+
"auto",
|
|
84
|
+
"auto",
|
|
85
|
+
"auto"
|
|
86
|
+
];
|
|
87
|
+
if (inset != null) {
|
|
88
|
+
const { values, directions } = parseDirectionalInset(inset);
|
|
89
|
+
if (values.length) if (directions.length === 0) {
|
|
90
|
+
topVal = values[0];
|
|
91
|
+
rightVal = values[1] || values[0];
|
|
92
|
+
bottomVal = values[2] || values[0];
|
|
93
|
+
leftVal = values[3] || values[1] || values[0];
|
|
94
|
+
} else directions.forEach((dir, i) => {
|
|
95
|
+
const val = values[i] ?? values[0];
|
|
96
|
+
if (dir === "top") topVal = val;
|
|
97
|
+
else if (dir === "right") rightVal = val;
|
|
98
|
+
else if (dir === "bottom") bottomVal = val;
|
|
99
|
+
else if (dir === "left") leftVal = val;
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
if (insetBlock != null) {
|
|
103
|
+
const val = parseInsetValue(insetBlock);
|
|
104
|
+
if (val) topVal = bottomVal = val;
|
|
105
|
+
}
|
|
106
|
+
if (insetInline != null) {
|
|
107
|
+
const val = parseInsetValue(insetInline);
|
|
108
|
+
if (val) leftVal = rightVal = val;
|
|
109
|
+
}
|
|
110
|
+
if (top != null) {
|
|
111
|
+
const val = parseInsetValue(top);
|
|
112
|
+
if (val) topVal = val;
|
|
113
|
+
}
|
|
114
|
+
if (right != null) {
|
|
115
|
+
const val = parseInsetValue(right);
|
|
116
|
+
if (val) rightVal = val;
|
|
117
|
+
}
|
|
118
|
+
if (bottom != null) {
|
|
119
|
+
const val = parseInsetValue(bottom);
|
|
120
|
+
if (val) bottomVal = val;
|
|
121
|
+
}
|
|
122
|
+
if (left != null) {
|
|
123
|
+
const val = parseInsetValue(left);
|
|
124
|
+
if (val) leftVal = val;
|
|
125
|
+
}
|
|
126
|
+
if (topVal === rightVal && rightVal === bottomVal && bottomVal === leftVal) return { inset: topVal };
|
|
127
|
+
if (topVal === bottomVal && leftVal === rightVal) return { inset: `${topVal} ${leftVal}` };
|
|
128
|
+
return { inset: `${topVal} ${rightVal} ${bottomVal} ${leftVal}` };
|
|
129
|
+
}
|
|
130
|
+
insetStyle.__lookupStyles = [
|
|
131
|
+
"inset",
|
|
132
|
+
"insetBlock",
|
|
133
|
+
"insetInline",
|
|
134
|
+
"top",
|
|
135
|
+
"right",
|
|
136
|
+
"bottom",
|
|
137
|
+
"left"
|
|
138
|
+
];
|
|
139
|
+
|
|
140
|
+
//#endregion
|
|
141
|
+
export { insetStyle };
|
|
142
|
+
//# sourceMappingURL=inset.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inset.mjs","names":[],"sources":["../../src/styles/inset.ts"],"sourcesContent":["import { DIRECTIONS, filterMods, parseStyle } from '../utils/styles';\n\n/**\n * Parse an inset value and return the first processed value\n */\nfunction parseInsetValue(value: string | number | boolean): string | null {\n if (typeof value === 'number') return `${value}px`;\n if (!value) return null;\n if (value === true) value = '0';\n\n const { values } = parseStyle(value).groups[0] ?? { values: [] };\n\n return values[0] || '0';\n}\n\n/**\n * Parse inset value with optional directions (like \"1x top\" or \"2x left right\")\n */\nfunction parseDirectionalInset(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 = '0';\n\n const { values = [], mods = [] } = parseStyle(value).groups[0] ?? {};\n\n return {\n values: values.length ? values : ['0'],\n directions: filterMods(mods, DIRECTIONS),\n };\n}\n\n/**\n * Inset style handler.\n *\n * IMPORTANT: This handler uses individual CSS properties (top, right, bottom, left)\n * when only individual direction props are specified. This allows CSS cascade to work\n * correctly when modifiers override only some directions.\n *\n * Example problem with using `inset` shorthand everywhere:\n * styles: {\n * top: { '': 0, 'side=bottom': 'initial' },\n * right: { '': 0, 'side=left': 'initial' },\n * bottom: { '': 0, 'side=top': 'initial' },\n * left: { '': 0, 'side=right': 'initial' },\n * }\n *\n * If we output `inset` for both cases:\n * - Default: inset: 0 0 0 0\n * - side=bottom: inset: initial auto auto auto ← WRONG! Overrides all 4 directions\n *\n * With individual properties:\n * - Default: top: 0; right: 0; bottom: 0; left: 0\n * - side=bottom: top: initial ← CORRECT! Only overrides top\n *\n * The `inset` shorthand is only used when the base `inset` prop is specified\n * OR when `insetBlock`/`insetInline` are used (which imply setting pairs).\n */\nexport function insetStyle({\n inset,\n insetBlock,\n insetInline,\n top,\n right,\n bottom,\n left,\n}: {\n inset?: string | number | boolean;\n insetBlock?: string | number | boolean;\n insetInline?: string | number | boolean;\n top?: string | number | boolean;\n right?: string | number | boolean;\n bottom?: string | number | boolean;\n left?: string | number | boolean;\n}) {\n // If no props are defined, return empty object\n if (\n inset == null &&\n insetBlock == null &&\n insetInline == null &&\n top == null &&\n right == null &&\n bottom == null &&\n left == null\n ) {\n return {};\n }\n\n // When only individual direction props are used (no inset, insetBlock, insetInline),\n // output individual CSS properties to allow proper CSS cascade with modifiers\n const onlyIndividualProps =\n inset == null && insetBlock == null && insetInline == null;\n\n if (onlyIndividualProps) {\n const result: Record<string, string> = {};\n\n if (top != null) {\n const val = parseInsetValue(top);\n if (val) result['top'] = val;\n }\n if (right != null) {\n const val = parseInsetValue(right);\n if (val) result['right'] = val;\n }\n if (bottom != null) {\n const val = parseInsetValue(bottom);\n if (val) result['bottom'] = val;\n }\n if (left != null) {\n const val = parseInsetValue(left);\n if (val) result['left'] = val;\n }\n\n return result;\n }\n\n // When inset, insetBlock, or insetInline is used, use the shorthand approach\n // Initialize all directions to auto\n let [topVal, rightVal, bottomVal, leftVal] = ['auto', 'auto', 'auto', 'auto'];\n\n // Priority 1 (lowest): inset\n if (inset != null) {\n const { values, directions } = parseDirectionalInset(inset);\n\n if (values.length) {\n if (directions.length === 0) {\n topVal = values[0];\n rightVal = values[1] || values[0];\n bottomVal = values[2] || values[0];\n leftVal = values[3] || values[1] || values[0];\n } else {\n // Assign values to directions in the order they appear\n // e.g., 'right 1x top 0' → right: 1x, top: 0\n directions.forEach((dir, i) => {\n const val = values[i] ?? values[0];\n if (dir === 'top') topVal = val;\n else if (dir === 'right') rightVal = val;\n else if (dir === 'bottom') bottomVal = val;\n else if (dir === 'left') leftVal = val;\n });\n }\n }\n }\n\n // Priority 2 (medium): insetBlock/insetInline\n if (insetBlock != null) {\n const val = parseInsetValue(insetBlock);\n if (val) topVal = bottomVal = val;\n }\n if (insetInline != null) {\n const val = parseInsetValue(insetInline);\n if (val) leftVal = rightVal = val;\n }\n\n // Priority 3 (highest): individual directions\n if (top != null) {\n const val = parseInsetValue(top);\n if (val) topVal = val;\n }\n if (right != null) {\n const val = parseInsetValue(right);\n if (val) rightVal = val;\n }\n if (bottom != null) {\n const val = parseInsetValue(bottom);\n if (val) bottomVal = val;\n }\n if (left != null) {\n const val = parseInsetValue(left);\n if (val) leftVal = val;\n }\n\n // Optimize output: 1 value if all same, 2 values if top==bottom && left==right\n if (topVal === rightVal && rightVal === bottomVal && bottomVal === leftVal) {\n return { inset: topVal };\n }\n if (topVal === bottomVal && leftVal === rightVal) {\n return { inset: `${topVal} ${leftVal}` };\n }\n\n return { inset: `${topVal} ${rightVal} ${bottomVal} ${leftVal}` };\n}\n\ninsetStyle.__lookupStyles = [\n 'inset',\n 'insetBlock',\n 'insetInline',\n 'top',\n 'right',\n 'bottom',\n 'left',\n];\n"],"mappings":";;;;;;AAKA,SAAS,gBAAgB,OAAiD;AACxE,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,sBAAsB,OAG7B;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,IAAI;EACtC,YAAY,WAAW,MAAM,WAAW;EACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BH,SAAgB,WAAW,EACzB,OACA,YACA,aACA,KACA,OACA,QACA,QASC;AAED,KACE,SAAS,QACT,cAAc,QACd,eAAe,QACf,OAAO,QACP,SAAS,QACT,UAAU,QACV,QAAQ,KAER,QAAO,EAAE;AAQX,KAFE,SAAS,QAAQ,cAAc,QAAQ,eAAe,MAE/B;EACvB,MAAM,SAAiC,EAAE;AAEzC,MAAI,OAAO,MAAM;GACf,MAAM,MAAM,gBAAgB,IAAI;AAChC,OAAI,IAAK,QAAO,SAAS;;AAE3B,MAAI,SAAS,MAAM;GACjB,MAAM,MAAM,gBAAgB,MAAM;AAClC,OAAI,IAAK,QAAO,WAAW;;AAE7B,MAAI,UAAU,MAAM;GAClB,MAAM,MAAM,gBAAgB,OAAO;AACnC,OAAI,IAAK,QAAO,YAAY;;AAE9B,MAAI,QAAQ,MAAM;GAChB,MAAM,MAAM,gBAAgB,KAAK;AACjC,OAAI,IAAK,QAAO,UAAU;;AAG5B,SAAO;;CAKT,IAAI,CAAC,QAAQ,UAAU,WAAW,WAAW;EAAC;EAAQ;EAAQ;EAAQ;EAAO;AAG7E,KAAI,SAAS,MAAM;EACjB,MAAM,EAAE,QAAQ,eAAe,sBAAsB,MAAM;AAE3D,MAAI,OAAO,OACT,KAAI,WAAW,WAAW,GAAG;AAC3B,YAAS,OAAO;AAChB,cAAW,OAAO,MAAM,OAAO;AAC/B,eAAY,OAAO,MAAM,OAAO;AAChC,aAAU,OAAO,MAAM,OAAO,MAAM,OAAO;QAI3C,YAAW,SAAS,KAAK,MAAM;GAC7B,MAAM,MAAM,OAAO,MAAM,OAAO;AAChC,OAAI,QAAQ,MAAO,UAAS;YACnB,QAAQ,QAAS,YAAW;YAC5B,QAAQ,SAAU,aAAY;YAC9B,QAAQ,OAAQ,WAAU;IACnC;;AAMR,KAAI,cAAc,MAAM;EACtB,MAAM,MAAM,gBAAgB,WAAW;AACvC,MAAI,IAAK,UAAS,YAAY;;AAEhC,KAAI,eAAe,MAAM;EACvB,MAAM,MAAM,gBAAgB,YAAY;AACxC,MAAI,IAAK,WAAU,WAAW;;AAIhC,KAAI,OAAO,MAAM;EACf,MAAM,MAAM,gBAAgB,IAAI;AAChC,MAAI,IAAK,UAAS;;AAEpB,KAAI,SAAS,MAAM;EACjB,MAAM,MAAM,gBAAgB,MAAM;AAClC,MAAI,IAAK,YAAW;;AAEtB,KAAI,UAAU,MAAM;EAClB,MAAM,MAAM,gBAAgB,OAAO;AACnC,MAAI,IAAK,aAAY;;AAEvB,KAAI,QAAQ,MAAM;EAChB,MAAM,MAAM,gBAAgB,KAAK;AACjC,MAAI,IAAK,WAAU;;AAIrB,KAAI,WAAW,YAAY,aAAa,aAAa,cAAc,QACjE,QAAO,EAAE,OAAO,QAAQ;AAE1B,KAAI,WAAW,aAAa,YAAY,SACtC,QAAO,EAAE,OAAO,GAAG,OAAO,GAAG,WAAW;AAG1C,QAAO,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW;;AAGnE,WAAW,iBAAiB;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/styles/justify.d.ts
|
|
2
|
+
declare function justifyStyle({
|
|
3
|
+
justify
|
|
4
|
+
}: {
|
|
5
|
+
justify: any;
|
|
6
|
+
}): {
|
|
7
|
+
'justify-items': string;
|
|
8
|
+
'justify-content': string;
|
|
9
|
+
} | undefined;
|
|
10
|
+
declare namespace justifyStyle {
|
|
11
|
+
var __lookupStyles: string[];
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { justifyStyle };
|
|
15
|
+
//# sourceMappingURL=justify.d.ts.map
|