@tenphi/tasty 0.0.0-snapshot.1c5dff6 → 0.0.0-snapshot.1f1c00a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +377 -238
- package/dist/babel-rZcEwPLM.d.ts +82 -0
- package/dist/chunks/async-storage-CG5HnUT5.js +20 -0
- package/dist/chunks/async-storage-CG5HnUT5.js.map +1 -0
- package/dist/chunks/build-config-CL4eRu2z.js +42 -0
- package/dist/chunks/build-config-CL4eRu2z.js.map +1 -0
- package/dist/chunks/collector-D2ARGT2L.js +208 -0
- package/dist/chunks/collector-D2ARGT2L.js.map +1 -0
- package/dist/chunks/config-engine-DEmmPPdp.js +272 -0
- package/dist/chunks/config-engine-DEmmPPdp.js.map +1 -0
- package/dist/chunks/css-definitions-DotDkIXt.js +876 -0
- package/dist/chunks/css-definitions-DotDkIXt.js.map +1 -0
- package/dist/chunks/css-resources-P7IBUUZs.js +142 -0
- package/dist/chunks/css-resources-P7IBUUZs.js.map +1 -0
- package/dist/chunks/debug-D8pg9RGI.js +502 -0
- package/dist/chunks/debug-D8pg9RGI.js.map +1 -0
- package/dist/chunks/dsl-DRhFWQzo.js +1378 -0
- package/dist/chunks/dsl-DRhFWQzo.js.map +1 -0
- package/dist/chunks/hydration-TRcz5vnk.js +41 -0
- package/dist/chunks/hydration-TRcz5vnk.js.map +1 -0
- package/dist/chunks/react-runtime-BpxlOTbO.js +562 -0
- package/dist/chunks/react-runtime-BpxlOTbO.js.map +1 -0
- package/dist/chunks/runtime-engine-CKFXUH-A.js +2416 -0
- package/dist/chunks/runtime-engine-CKFXUH-A.js.map +1 -0
- package/dist/chunks/runtime-state-BxaLhVdP.js +127 -0
- package/dist/chunks/runtime-state-BxaLhVdP.js.map +1 -0
- package/dist/{utils/merge-styles.js → chunks/shared-utils-y-HjvPN4.js} +61 -58
- package/dist/chunks/shared-utils-y-HjvPN4.js.map +1 -0
- package/dist/chunks/style-engine-BBbBuSkT.js +5260 -0
- package/dist/chunks/style-engine-BBbBuSkT.js.map +1 -0
- package/dist/{zero/extractor.js → chunks/zero-engine-gJrKBRiw.js} +126 -66
- package/dist/chunks/zero-engine-gJrKBRiw.js.map +1 -0
- package/dist/collector-w4mBj5gd.d.ts +164 -0
- package/dist/config-CZWCzBr6.d.ts +1349 -0
- package/dist/core/index.d.ts +5 -33
- package/dist/core/index.js +9 -26
- package/dist/index-G9JuwM9p.d.ts +1920 -0
- package/dist/index.d.ts +5 -48
- package/dist/index.js +11 -33
- package/dist/{utils/merge-styles.d.ts → merge-styles-VXwJ0Frr.d.ts} +3 -4
- package/dist/ssr/astro-client.d.ts +1 -0
- package/dist/ssr/astro-client.js +6 -0
- package/dist/ssr/astro-client.js.map +1 -0
- package/dist/ssr/astro-middleware-extract-static.d.ts +10 -0
- package/dist/ssr/astro-middleware-extract-static.js +9 -0
- package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
- package/dist/ssr/astro-middleware-extract.d.ts +10 -0
- package/dist/ssr/astro-middleware-extract.js +9 -0
- package/dist/ssr/astro-middleware-extract.js.map +1 -0
- package/dist/ssr/astro-middleware-static.d.ts +17 -0
- package/dist/ssr/astro-middleware-static.js +7 -0
- package/dist/ssr/astro-middleware-static.js.map +1 -0
- package/dist/ssr/astro-middleware.d.ts +18 -0
- package/dist/ssr/astro-middleware.js +7 -0
- package/dist/ssr/astro-middleware.js.map +1 -0
- package/dist/ssr/astro.d.ts +127 -0
- package/dist/ssr/astro.js +221 -0
- package/dist/ssr/astro.js.map +1 -0
- package/dist/ssr/index.d.ts +36 -0
- package/dist/ssr/index.js +10 -0
- package/dist/ssr/index.js.map +1 -0
- package/dist/ssr/next-config.d.ts +64 -0
- package/dist/ssr/next-config.js +128 -0
- package/dist/ssr/next-config.js.map +1 -0
- package/dist/ssr/next.d.ts +46 -0
- package/dist/ssr/next.js +60 -0
- package/dist/ssr/next.js.map +1 -0
- package/dist/static/index.d.ts +90 -5
- package/dist/static/index.js +31 -4
- package/dist/static/index.js.map +1 -0
- package/dist/static/inject.d.ts +4 -0
- package/dist/static/inject.js +17 -0
- package/dist/static/inject.js.map +1 -0
- package/dist/types-JEY8PVYP.d.ts +1567 -0
- package/dist/zero/babel.d.ts +2 -113
- package/dist/zero/babel.js +230 -106
- package/dist/zero/babel.js.map +1 -1
- package/dist/zero/index.d.ts +80 -3
- package/dist/zero/index.js +2 -4
- package/dist/zero/next.d.ts +57 -33
- package/dist/zero/next.js +93 -59
- package/dist/zero/next.js.map +1 -1
- package/docs/README.md +39 -0
- package/docs/adoption.md +323 -0
- package/docs/ai-agents.md +250 -0
- package/docs/comparison.md +448 -0
- package/docs/configuration.md +684 -56
- package/docs/debug.md +170 -343
- package/docs/design-system.md +455 -0
- package/docs/dsl.md +1065 -0
- package/docs/getting-started.md +240 -0
- package/docs/injector.md +159 -53
- package/docs/methodology.md +648 -0
- package/docs/migration-v3.md +285 -0
- package/docs/pipeline.md +765 -0
- package/docs/plugins.md +353 -0
- package/docs/react-api.md +683 -0
- package/docs/runtime-benchmarks.md +388 -0
- package/docs/ssr.md +610 -0
- package/docs/styles.md +211 -63
- package/docs/tasty-static.md +273 -67
- package/package.json +182 -58
- package/tasty.config.ts +6 -0
- package/dist/_virtual/_rolldown/runtime.js +0 -8
- package/dist/chunks/cacheKey.js +0 -70
- package/dist/chunks/cacheKey.js.map +0 -1
- package/dist/chunks/definitions.d.ts +0 -37
- package/dist/chunks/definitions.js +0 -260
- package/dist/chunks/definitions.js.map +0 -1
- package/dist/chunks/renderChunk.js +0 -61
- package/dist/chunks/renderChunk.js.map +0 -1
- package/dist/config.d.ts +0 -288
- package/dist/config.js +0 -403
- package/dist/config.js.map +0 -1
- package/dist/debug.d.ts +0 -204
- package/dist/debug.js +0 -733
- package/dist/debug.js.map +0 -1
- package/dist/hooks/useGlobalStyles.d.ts +0 -27
- package/dist/hooks/useGlobalStyles.js +0 -56
- package/dist/hooks/useGlobalStyles.js.map +0 -1
- package/dist/hooks/useKeyframes.d.ts +0 -56
- package/dist/hooks/useKeyframes.js +0 -54
- package/dist/hooks/useKeyframes.js.map +0 -1
- package/dist/hooks/useProperty.d.ts +0 -79
- package/dist/hooks/useProperty.js +0 -91
- package/dist/hooks/useProperty.js.map +0 -1
- package/dist/hooks/useRawCSS.d.ts +0 -53
- package/dist/hooks/useRawCSS.js +0 -28
- package/dist/hooks/useRawCSS.js.map +0 -1
- package/dist/hooks/useStyles.d.ts +0 -40
- package/dist/hooks/useStyles.js +0 -169
- package/dist/hooks/useStyles.js.map +0 -1
- package/dist/injector/index.d.ts +0 -157
- package/dist/injector/index.js +0 -154
- package/dist/injector/index.js.map +0 -1
- package/dist/injector/injector.d.ts +0 -139
- package/dist/injector/injector.js +0 -417
- package/dist/injector/injector.js.map +0 -1
- package/dist/injector/sheet-manager.d.ts +0 -135
- package/dist/injector/sheet-manager.js +0 -728
- package/dist/injector/sheet-manager.js.map +0 -1
- package/dist/injector/types.d.ts +0 -144
- package/dist/keyframes/index.js +0 -206
- package/dist/keyframes/index.js.map +0 -1
- package/dist/parser/classify.js +0 -319
- package/dist/parser/classify.js.map +0 -1
- package/dist/parser/const.js +0 -33
- package/dist/parser/const.js.map +0 -1
- package/dist/parser/lru.js +0 -109
- package/dist/parser/lru.js.map +0 -1
- package/dist/parser/parser.d.ts +0 -25
- package/dist/parser/parser.js +0 -116
- package/dist/parser/parser.js.map +0 -1
- package/dist/parser/tokenizer.js +0 -69
- package/dist/parser/tokenizer.js.map +0 -1
- package/dist/parser/types.d.ts +0 -51
- package/dist/parser/types.js +0 -46
- package/dist/parser/types.js.map +0 -1
- package/dist/pipeline/conditions.d.ts +0 -134
- package/dist/pipeline/conditions.js +0 -406
- package/dist/pipeline/conditions.js.map +0 -1
- package/dist/pipeline/exclusive.js +0 -231
- package/dist/pipeline/exclusive.js.map +0 -1
- package/dist/pipeline/index.d.ts +0 -53
- package/dist/pipeline/index.js +0 -660
- package/dist/pipeline/index.js.map +0 -1
- package/dist/pipeline/materialize.js +0 -856
- package/dist/pipeline/materialize.js.map +0 -1
- package/dist/pipeline/parseStateKey.d.ts +0 -15
- package/dist/pipeline/parseStateKey.js +0 -451
- package/dist/pipeline/parseStateKey.js.map +0 -1
- package/dist/pipeline/simplify.js +0 -516
- package/dist/pipeline/simplify.js.map +0 -1
- package/dist/pipeline/warnings.js +0 -18
- package/dist/pipeline/warnings.js.map +0 -1
- package/dist/plugins/okhsl-plugin.d.ts +0 -35
- package/dist/plugins/okhsl-plugin.js +0 -371
- package/dist/plugins/okhsl-plugin.js.map +0 -1
- package/dist/plugins/types.d.ts +0 -69
- package/dist/properties/index.js +0 -221
- package/dist/properties/index.js.map +0 -1
- package/dist/properties/property-type-resolver.d.ts +0 -24
- package/dist/properties/property-type-resolver.js +0 -83
- package/dist/properties/property-type-resolver.js.map +0 -1
- package/dist/states/index.d.ts +0 -49
- package/dist/states/index.js +0 -416
- package/dist/states/index.js.map +0 -1
- package/dist/static/tastyStatic.d.ts +0 -46
- package/dist/static/tastyStatic.js +0 -31
- package/dist/static/tastyStatic.js.map +0 -1
- package/dist/static/types.d.ts +0 -49
- package/dist/static/types.js +0 -24
- package/dist/static/types.js.map +0 -1
- package/dist/styles/align.d.ts +0 -15
- package/dist/styles/align.js +0 -14
- package/dist/styles/align.js.map +0 -1
- package/dist/styles/border.d.ts +0 -25
- package/dist/styles/border.js +0 -114
- package/dist/styles/border.js.map +0 -1
- package/dist/styles/color.d.ts +0 -14
- package/dist/styles/color.js +0 -23
- package/dist/styles/color.js.map +0 -1
- package/dist/styles/createStyle.js +0 -77
- package/dist/styles/createStyle.js.map +0 -1
- package/dist/styles/dimension.js +0 -97
- package/dist/styles/dimension.js.map +0 -1
- package/dist/styles/display.d.ts +0 -37
- package/dist/styles/display.js +0 -67
- package/dist/styles/display.js.map +0 -1
- package/dist/styles/fade.d.ts +0 -15
- package/dist/styles/fade.js +0 -58
- package/dist/styles/fade.js.map +0 -1
- package/dist/styles/fill.d.ts +0 -42
- package/dist/styles/fill.js +0 -52
- package/dist/styles/fill.js.map +0 -1
- package/dist/styles/flow.d.ts +0 -16
- package/dist/styles/flow.js +0 -12
- package/dist/styles/flow.js.map +0 -1
- package/dist/styles/gap.d.ts +0 -31
- package/dist/styles/gap.js +0 -37
- package/dist/styles/gap.js.map +0 -1
- package/dist/styles/height.d.ts +0 -17
- package/dist/styles/height.js +0 -20
- package/dist/styles/height.js.map +0 -1
- package/dist/styles/index.d.ts +0 -2
- package/dist/styles/index.js +0 -9
- package/dist/styles/index.js.map +0 -1
- package/dist/styles/inset.d.ts +0 -52
- package/dist/styles/inset.js +0 -150
- package/dist/styles/inset.js.map +0 -1
- package/dist/styles/justify.d.ts +0 -15
- package/dist/styles/justify.js +0 -14
- package/dist/styles/justify.js.map +0 -1
- package/dist/styles/list.d.ts +0 -16
- package/dist/styles/list.js +0 -98
- package/dist/styles/list.js.map +0 -1
- package/dist/styles/margin.d.ts +0 -24
- package/dist/styles/margin.js +0 -104
- package/dist/styles/margin.js.map +0 -1
- package/dist/styles/outline.d.ts +0 -29
- package/dist/styles/outline.js +0 -65
- package/dist/styles/outline.js.map +0 -1
- package/dist/styles/padding.d.ts +0 -24
- package/dist/styles/padding.js +0 -104
- package/dist/styles/padding.js.map +0 -1
- package/dist/styles/predefined.d.ts +0 -73
- package/dist/styles/predefined.js +0 -241
- package/dist/styles/predefined.js.map +0 -1
- package/dist/styles/preset.d.ts +0 -47
- package/dist/styles/preset.js +0 -126
- package/dist/styles/preset.js.map +0 -1
- package/dist/styles/radius.d.ts +0 -14
- package/dist/styles/radius.js +0 -51
- package/dist/styles/radius.js.map +0 -1
- package/dist/styles/scrollbar.d.ts +0 -23
- package/dist/styles/scrollbar.js +0 -34
- package/dist/styles/scrollbar.js.map +0 -1
- package/dist/styles/shadow.d.ts +0 -14
- package/dist/styles/shadow.js +0 -24
- package/dist/styles/shadow.js.map +0 -1
- package/dist/styles/styledScrollbar.d.ts +0 -47
- package/dist/styles/styledScrollbar.js +0 -38
- package/dist/styles/styledScrollbar.js.map +0 -1
- package/dist/styles/transition.d.ts +0 -14
- package/dist/styles/transition.js +0 -158
- package/dist/styles/transition.js.map +0 -1
- package/dist/styles/types.d.ts +0 -498
- package/dist/styles/width.d.ts +0 -17
- package/dist/styles/width.js +0 -20
- package/dist/styles/width.js.map +0 -1
- package/dist/tasty.d.ts +0 -982
- package/dist/tasty.js +0 -206
- package/dist/tasty.js.map +0 -1
- package/dist/tokens/typography.d.ts +0 -19
- package/dist/tokens/typography.js +0 -237
- package/dist/tokens/typography.js.map +0 -1
- package/dist/types.d.ts +0 -184
- package/dist/utils/cache-wrapper.js +0 -26
- package/dist/utils/cache-wrapper.js.map +0 -1
- package/dist/utils/case-converter.js +0 -8
- package/dist/utils/case-converter.js.map +0 -1
- package/dist/utils/colors.d.ts +0 -5
- package/dist/utils/colors.js +0 -9
- package/dist/utils/colors.js.map +0 -1
- package/dist/utils/css-types.d.ts +0 -7
- package/dist/utils/dotize.d.ts +0 -26
- package/dist/utils/dotize.js +0 -122
- package/dist/utils/dotize.js.map +0 -1
- package/dist/utils/filter-base-props.d.ts +0 -15
- package/dist/utils/filter-base-props.js +0 -45
- package/dist/utils/filter-base-props.js.map +0 -1
- package/dist/utils/get-display-name.d.ts +0 -7
- package/dist/utils/get-display-name.js +0 -10
- package/dist/utils/get-display-name.js.map +0 -1
- package/dist/utils/hsl-to-rgb.js +0 -38
- package/dist/utils/hsl-to-rgb.js.map +0 -1
- package/dist/utils/is-dev-env.js +0 -19
- package/dist/utils/is-dev-env.js.map +0 -1
- package/dist/utils/is-valid-element-type.js +0 -15
- package/dist/utils/is-valid-element-type.js.map +0 -1
- package/dist/utils/merge-styles.js.map +0 -1
- package/dist/utils/mod-attrs.d.ts +0 -8
- package/dist/utils/mod-attrs.js +0 -21
- package/dist/utils/mod-attrs.js.map +0 -1
- package/dist/utils/okhsl-to-rgb.js +0 -296
- package/dist/utils/okhsl-to-rgb.js.map +0 -1
- package/dist/utils/process-tokens.d.ts +0 -31
- package/dist/utils/process-tokens.js +0 -171
- package/dist/utils/process-tokens.js.map +0 -1
- package/dist/utils/resolve-recipes.d.ts +0 -17
- package/dist/utils/resolve-recipes.js +0 -147
- package/dist/utils/resolve-recipes.js.map +0 -1
- package/dist/utils/selector-transform.js +0 -32
- package/dist/utils/selector-transform.js.map +0 -1
- package/dist/utils/string.js +0 -8
- package/dist/utils/string.js.map +0 -1
- package/dist/utils/styles.d.ts +0 -177
- package/dist/utils/styles.js +0 -730
- package/dist/utils/styles.js.map +0 -1
- package/dist/utils/typography.d.ts +0 -36
- package/dist/utils/typography.js +0 -53
- package/dist/utils/typography.js.map +0 -1
- package/dist/utils/warnings.d.ts +0 -16
- package/dist/utils/warnings.js +0 -16
- package/dist/utils/warnings.js.map +0 -1
- package/dist/zero/css-writer.d.ts +0 -45
- package/dist/zero/css-writer.js +0 -74
- package/dist/zero/css-writer.js.map +0 -1
- package/dist/zero/extractor.d.ts +0 -24
- package/dist/zero/extractor.js.map +0 -1
- package/docs/usage.md +0 -695
package/dist/styles/list.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/styles/margin.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
//#region src/styles/margin.d.ts
|
|
2
|
-
declare function marginStyle({
|
|
3
|
-
margin,
|
|
4
|
-
marginBlock,
|
|
5
|
-
marginInline,
|
|
6
|
-
marginTop,
|
|
7
|
-
marginRight,
|
|
8
|
-
marginBottom,
|
|
9
|
-
marginLeft
|
|
10
|
-
}: {
|
|
11
|
-
margin?: string | number | boolean;
|
|
12
|
-
marginBlock?: string | number | boolean;
|
|
13
|
-
marginInline?: string | number | boolean;
|
|
14
|
-
marginTop?: string | number | boolean;
|
|
15
|
-
marginRight?: string | number | boolean;
|
|
16
|
-
marginBottom?: string | number | boolean;
|
|
17
|
-
marginLeft?: string | number | boolean;
|
|
18
|
-
}): {};
|
|
19
|
-
declare namespace marginStyle {
|
|
20
|
-
var __lookupStyles: string[];
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
export { marginStyle };
|
|
24
|
-
//# sourceMappingURL=margin.d.ts.map
|
package/dist/styles/margin.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
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
|
-
* Extract values and directions from a single parsed group.
|
|
16
|
-
*/
|
|
17
|
-
function extractGroupData(group) {
|
|
18
|
-
const { values = [], mods = [] } = group;
|
|
19
|
-
return {
|
|
20
|
-
values: values.length ? values : ["var(--gap)"],
|
|
21
|
-
directions: filterMods(mods, DIRECTIONS)
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Apply a single group's values and directions onto a direction map.
|
|
26
|
-
*/
|
|
27
|
-
function applyGroup(dirs, values, directions) {
|
|
28
|
-
if (!values.length) return;
|
|
29
|
-
if (directions.length === 0) {
|
|
30
|
-
dirs.top = values[0];
|
|
31
|
-
dirs.right = values[1] || values[0];
|
|
32
|
-
dirs.bottom = values[2] || values[0];
|
|
33
|
-
dirs.left = values[3] || values[1] || values[0];
|
|
34
|
-
} else directions.forEach((dir, i) => {
|
|
35
|
-
dirs[dir] = values[i] ?? values[0];
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Optimize margin output shorthand.
|
|
40
|
-
*/
|
|
41
|
-
function optimizeMargin(dirs) {
|
|
42
|
-
const { top, right, bottom, left } = dirs;
|
|
43
|
-
if (top === right && right === bottom && bottom === left) return { margin: top };
|
|
44
|
-
if (top === bottom && left === right) return { margin: `${top} ${left}` };
|
|
45
|
-
return { margin: `${top} ${right} ${bottom} ${left}` };
|
|
46
|
-
}
|
|
47
|
-
function marginStyle({ margin, marginBlock, marginInline, marginTop, marginRight, marginBottom, marginLeft }) {
|
|
48
|
-
if (margin == null && marginBlock == null && marginInline == null && marginTop == null && marginRight == null && marginBottom == null && marginLeft == null) return {};
|
|
49
|
-
const dirs = {
|
|
50
|
-
top: "0",
|
|
51
|
-
right: "0",
|
|
52
|
-
bottom: "0",
|
|
53
|
-
left: "0"
|
|
54
|
-
};
|
|
55
|
-
if (margin != null) {
|
|
56
|
-
if (typeof margin === "number") dirs.top = dirs.right = dirs.bottom = dirs.left = `${margin}px`;
|
|
57
|
-
else if (margin === true) margin = "1x";
|
|
58
|
-
if (typeof margin === "string" && margin) {
|
|
59
|
-
const groups = parseStyle(margin).groups ?? [];
|
|
60
|
-
for (const group of groups) {
|
|
61
|
-
const { values, directions } = extractGroupData(group);
|
|
62
|
-
applyGroup(dirs, values, directions);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
if (marginBlock != null) {
|
|
67
|
-
const val = parseMarginValue(marginBlock);
|
|
68
|
-
if (val) dirs.top = dirs.bottom = val;
|
|
69
|
-
}
|
|
70
|
-
if (marginInline != null) {
|
|
71
|
-
const val = parseMarginValue(marginInline);
|
|
72
|
-
if (val) dirs.left = dirs.right = val;
|
|
73
|
-
}
|
|
74
|
-
if (marginTop != null) {
|
|
75
|
-
const val = parseMarginValue(marginTop);
|
|
76
|
-
if (val) dirs.top = val;
|
|
77
|
-
}
|
|
78
|
-
if (marginRight != null) {
|
|
79
|
-
const val = parseMarginValue(marginRight);
|
|
80
|
-
if (val) dirs.right = val;
|
|
81
|
-
}
|
|
82
|
-
if (marginBottom != null) {
|
|
83
|
-
const val = parseMarginValue(marginBottom);
|
|
84
|
-
if (val) dirs.bottom = val;
|
|
85
|
-
}
|
|
86
|
-
if (marginLeft != null) {
|
|
87
|
-
const val = parseMarginValue(marginLeft);
|
|
88
|
-
if (val) dirs.left = val;
|
|
89
|
-
}
|
|
90
|
-
return optimizeMargin(dirs);
|
|
91
|
-
}
|
|
92
|
-
marginStyle.__lookupStyles = [
|
|
93
|
-
"margin",
|
|
94
|
-
"marginTop",
|
|
95
|
-
"marginRight",
|
|
96
|
-
"marginBottom",
|
|
97
|
-
"marginLeft",
|
|
98
|
-
"marginBlock",
|
|
99
|
-
"marginInline"
|
|
100
|
-
];
|
|
101
|
-
|
|
102
|
-
//#endregion
|
|
103
|
-
export { marginStyle };
|
|
104
|
-
//# sourceMappingURL=margin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"margin.js","names":[],"sources":["../../src/styles/margin.ts"],"sourcesContent":["import type { StyleDetails } from '../parser/types';\nimport { DIRECTIONS, filterMods, parseStyle } from '../utils/styles';\n\ntype Direction = (typeof DIRECTIONS)[number];\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 * Extract values and directions from a single parsed group.\n */\nfunction extractGroupData(group: StyleDetails): {\n values: string[];\n directions: Direction[];\n} {\n const { values = [], mods = [] } = group;\n return {\n values: values.length ? values : ['var(--gap)'],\n directions: filterMods(mods, DIRECTIONS) as Direction[],\n };\n}\n\n/**\n * Apply a single group's values and directions onto a direction map.\n */\nfunction applyGroup(\n dirs: Record<Direction, string>,\n values: string[],\n directions: Direction[],\n): void {\n if (!values.length) return;\n\n if (directions.length === 0) {\n dirs.top = values[0];\n dirs.right = values[1] || values[0];\n dirs.bottom = values[2] || values[0];\n dirs.left = values[3] || values[1] || values[0];\n } else {\n directions.forEach((dir, i) => {\n dirs[dir] = values[i] ?? values[0];\n });\n }\n}\n\n/**\n * Optimize margin output shorthand.\n */\nfunction optimizeMargin(dirs: Record<Direction, string>): {\n margin: string;\n} {\n const { top, right, bottom, left } = dirs;\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 return { margin: `${top} ${right} ${bottom} ${left}` };\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 (\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 const dirs: Record<Direction, string> = {\n top: '0',\n right: '0',\n bottom: '0',\n left: '0',\n };\n\n // Priority 1 (lowest): margin\n if (margin != null) {\n if (typeof margin === 'number') {\n const v = `${margin}px`;\n dirs.top = dirs.right = dirs.bottom = dirs.left = v;\n } else if (margin === true) {\n margin = '1x';\n }\n\n if (typeof margin === 'string' && margin) {\n const processed = parseStyle(margin);\n const groups = processed.groups ?? [];\n\n for (const group of groups) {\n const { values, directions } = extractGroupData(group);\n applyGroup(dirs, values, directions);\n }\n }\n }\n\n // Priority 2 (medium): marginBlock/marginInline\n if (marginBlock != null) {\n const val = parseMarginValue(marginBlock);\n if (val) dirs.top = dirs.bottom = val;\n }\n if (marginInline != null) {\n const val = parseMarginValue(marginInline);\n if (val) dirs.left = dirs.right = val;\n }\n\n // Priority 3 (highest): individual directions\n if (marginTop != null) {\n const val = parseMarginValue(marginTop);\n if (val) dirs.top = val;\n }\n if (marginRight != null) {\n const val = parseMarginValue(marginRight);\n if (val) dirs.right = val;\n }\n if (marginBottom != null) {\n const val = parseMarginValue(marginBottom);\n if (val) dirs.bottom = val;\n }\n if (marginLeft != null) {\n const val = parseMarginValue(marginLeft);\n if (val) dirs.left = val;\n }\n\n return optimizeMargin(dirs);\n}\n\nmarginStyle.__lookupStyles = [\n 'margin',\n 'marginTop',\n 'marginRight',\n 'marginBottom',\n 'marginLeft',\n 'marginBlock',\n 'marginInline',\n];\n"],"mappings":";;;;;;AAQA,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,iBAAiB,OAGxB;CACA,MAAM,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,KAAK;AACnC,QAAO;EACL,QAAQ,OAAO,SAAS,SAAS,CAAC,aAAa;EAC/C,YAAY,WAAW,MAAM,WAAW;EACzC;;;;;AAMH,SAAS,WACP,MACA,QACA,YACM;AACN,KAAI,CAAC,OAAO,OAAQ;AAEpB,KAAI,WAAW,WAAW,GAAG;AAC3B,OAAK,MAAM,OAAO;AAClB,OAAK,QAAQ,OAAO,MAAM,OAAO;AACjC,OAAK,SAAS,OAAO,MAAM,OAAO;AAClC,OAAK,OAAO,OAAO,MAAM,OAAO,MAAM,OAAO;OAE7C,YAAW,SAAS,KAAK,MAAM;AAC7B,OAAK,OAAO,OAAO,MAAM,OAAO;GAChC;;;;;AAON,SAAS,eAAe,MAEtB;CACA,MAAM,EAAE,KAAK,OAAO,QAAQ,SAAS;AACrC,KAAI,QAAQ,SAAS,UAAU,UAAU,WAAW,KAClD,QAAO,EAAE,QAAQ,KAAK;AAExB,KAAI,QAAQ,UAAU,SAAS,MAC7B,QAAO,EAAE,QAAQ,GAAG,IAAI,GAAG,QAAQ;AAErC,QAAO,EAAE,QAAQ,GAAG,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ;;AAGxD,SAAgB,YAAY,EAC1B,QACA,aACA,cACA,WACA,aACA,cACA,cASC;AACD,KACE,UAAU,QACV,eAAe,QACf,gBAAgB,QAChB,aAAa,QACb,eAAe,QACf,gBAAgB,QAChB,cAAc,KAEd,QAAO,EAAE;CAGX,MAAM,OAAkC;EACtC,KAAK;EACL,OAAO;EACP,QAAQ;EACR,MAAM;EACP;AAGD,KAAI,UAAU,MAAM;AAClB,MAAI,OAAO,WAAW,SAEpB,MAAK,MAAM,KAAK,QAAQ,KAAK,SAAS,KAAK,OADjC,GAAG,OAAO;WAEX,WAAW,KACpB,UAAS;AAGX,MAAI,OAAO,WAAW,YAAY,QAAQ;GAExC,MAAM,SADY,WAAW,OAAO,CACX,UAAU,EAAE;AAErC,QAAK,MAAM,SAAS,QAAQ;IAC1B,MAAM,EAAE,QAAQ,eAAe,iBAAiB,MAAM;AACtD,eAAW,MAAM,QAAQ,WAAW;;;;AAM1C,KAAI,eAAe,MAAM;EACvB,MAAM,MAAM,iBAAiB,YAAY;AACzC,MAAI,IAAK,MAAK,MAAM,KAAK,SAAS;;AAEpC,KAAI,gBAAgB,MAAM;EACxB,MAAM,MAAM,iBAAiB,aAAa;AAC1C,MAAI,IAAK,MAAK,OAAO,KAAK,QAAQ;;AAIpC,KAAI,aAAa,MAAM;EACrB,MAAM,MAAM,iBAAiB,UAAU;AACvC,MAAI,IAAK,MAAK,MAAM;;AAEtB,KAAI,eAAe,MAAM;EACvB,MAAM,MAAM,iBAAiB,YAAY;AACzC,MAAI,IAAK,MAAK,QAAQ;;AAExB,KAAI,gBAAgB,MAAM;EACxB,MAAM,MAAM,iBAAiB,aAAa;AAC1C,MAAI,IAAK,MAAK,SAAS;;AAEzB,KAAI,cAAc,MAAM;EACtB,MAAM,MAAM,iBAAiB,WAAW;AACxC,MAAI,IAAK,MAAK,OAAO;;AAGvB,QAAO,eAAe,KAAK;;AAG7B,YAAY,iBAAiB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
|
package/dist/styles/outline.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//#region src/styles/outline.d.ts
|
|
2
|
-
interface OutlineStyleProps {
|
|
3
|
-
outline?: string | boolean | number;
|
|
4
|
-
outlineOffset?: string | number;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Generates CSS for outline property with optional offset.
|
|
8
|
-
*
|
|
9
|
-
* Syntax:
|
|
10
|
-
* - `outline="2px solid #red"` - outline only
|
|
11
|
-
* - `outline="2px solid #red / 4px"` - outline with offset (slash separator)
|
|
12
|
-
* - `outline="2px / 4px"` - width with offset (simpler form)
|
|
13
|
-
* - `outline={true}` - default 1ow solid outline
|
|
14
|
-
* - `outlineOffset="4px"` - offset as separate prop (can be combined with outline)
|
|
15
|
-
*
|
|
16
|
-
* Priority: slash syntax in outline takes precedence over outlineOffset prop
|
|
17
|
-
*
|
|
18
|
-
* @return CSS properties for outline and optionally outline-offset
|
|
19
|
-
*/
|
|
20
|
-
declare function outlineStyle({
|
|
21
|
-
outline,
|
|
22
|
-
outlineOffset
|
|
23
|
-
}: OutlineStyleProps): Record<string, string> | undefined;
|
|
24
|
-
declare namespace outlineStyle {
|
|
25
|
-
var __lookupStyles: string[];
|
|
26
|
-
}
|
|
27
|
-
//#endregion
|
|
28
|
-
export { outlineStyle };
|
|
29
|
-
//# sourceMappingURL=outline.d.ts.map
|
package/dist/styles/outline.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/styles/padding.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
//#region src/styles/padding.d.ts
|
|
2
|
-
declare function paddingStyle({
|
|
3
|
-
padding,
|
|
4
|
-
paddingBlock,
|
|
5
|
-
paddingInline,
|
|
6
|
-
paddingTop,
|
|
7
|
-
paddingRight,
|
|
8
|
-
paddingBottom,
|
|
9
|
-
paddingLeft
|
|
10
|
-
}: {
|
|
11
|
-
padding?: string | number | boolean;
|
|
12
|
-
paddingBlock?: string | number | boolean;
|
|
13
|
-
paddingInline?: string | number | boolean;
|
|
14
|
-
paddingTop?: string | number | boolean;
|
|
15
|
-
paddingRight?: string | number | boolean;
|
|
16
|
-
paddingBottom?: string | number | boolean;
|
|
17
|
-
paddingLeft?: string | number | boolean;
|
|
18
|
-
}): {};
|
|
19
|
-
declare namespace paddingStyle {
|
|
20
|
-
var __lookupStyles: string[];
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
export { paddingStyle };
|
|
24
|
-
//# sourceMappingURL=padding.d.ts.map
|
package/dist/styles/padding.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { DIRECTIONS, filterMods, parseStyle } from "../utils/styles.js";
|
|
2
|
-
|
|
3
|
-
//#region src/styles/padding.ts
|
|
4
|
-
/**
|
|
5
|
-
* Parse a padding value and return the first processed value
|
|
6
|
-
*/
|
|
7
|
-
function parsePaddingValue(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
|
-
* Extract values and directions from a single parsed group.
|
|
16
|
-
*/
|
|
17
|
-
function extractGroupData(group) {
|
|
18
|
-
const { values = [], mods = [] } = group;
|
|
19
|
-
return {
|
|
20
|
-
values: values.length ? values : ["var(--gap)"],
|
|
21
|
-
directions: filterMods(mods, DIRECTIONS)
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Apply a single group's values and directions onto a direction map.
|
|
26
|
-
*/
|
|
27
|
-
function applyGroup(dirs, values, directions) {
|
|
28
|
-
if (!values.length) return;
|
|
29
|
-
if (directions.length === 0) {
|
|
30
|
-
dirs.top = values[0];
|
|
31
|
-
dirs.right = values[1] || values[0];
|
|
32
|
-
dirs.bottom = values[2] || values[0];
|
|
33
|
-
dirs.left = values[3] || values[1] || values[0];
|
|
34
|
-
} else directions.forEach((dir, i) => {
|
|
35
|
-
dirs[dir] = values[i] ?? values[0];
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Optimize padding output shorthand.
|
|
40
|
-
*/
|
|
41
|
-
function optimizePadding(dirs) {
|
|
42
|
-
const { top, right, bottom, left } = dirs;
|
|
43
|
-
if (top === right && right === bottom && bottom === left) return { padding: top };
|
|
44
|
-
if (top === bottom && left === right) return { padding: `${top} ${left}` };
|
|
45
|
-
return { padding: `${top} ${right} ${bottom} ${left}` };
|
|
46
|
-
}
|
|
47
|
-
function paddingStyle({ padding, paddingBlock, paddingInline, paddingTop, paddingRight, paddingBottom, paddingLeft }) {
|
|
48
|
-
if (padding == null && paddingBlock == null && paddingInline == null && paddingTop == null && paddingRight == null && paddingBottom == null && paddingLeft == null) return {};
|
|
49
|
-
const dirs = {
|
|
50
|
-
top: "0",
|
|
51
|
-
right: "0",
|
|
52
|
-
bottom: "0",
|
|
53
|
-
left: "0"
|
|
54
|
-
};
|
|
55
|
-
if (padding != null) {
|
|
56
|
-
if (typeof padding === "number") dirs.top = dirs.right = dirs.bottom = dirs.left = `${padding}px`;
|
|
57
|
-
else if (padding === true) padding = "1x";
|
|
58
|
-
if (typeof padding === "string" && padding) {
|
|
59
|
-
const groups = parseStyle(padding).groups ?? [];
|
|
60
|
-
for (const group of groups) {
|
|
61
|
-
const { values, directions } = extractGroupData(group);
|
|
62
|
-
applyGroup(dirs, values, directions);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
if (paddingBlock != null) {
|
|
67
|
-
const val = parsePaddingValue(paddingBlock);
|
|
68
|
-
if (val) dirs.top = dirs.bottom = val;
|
|
69
|
-
}
|
|
70
|
-
if (paddingInline != null) {
|
|
71
|
-
const val = parsePaddingValue(paddingInline);
|
|
72
|
-
if (val) dirs.left = dirs.right = val;
|
|
73
|
-
}
|
|
74
|
-
if (paddingTop != null) {
|
|
75
|
-
const val = parsePaddingValue(paddingTop);
|
|
76
|
-
if (val) dirs.top = val;
|
|
77
|
-
}
|
|
78
|
-
if (paddingRight != null) {
|
|
79
|
-
const val = parsePaddingValue(paddingRight);
|
|
80
|
-
if (val) dirs.right = val;
|
|
81
|
-
}
|
|
82
|
-
if (paddingBottom != null) {
|
|
83
|
-
const val = parsePaddingValue(paddingBottom);
|
|
84
|
-
if (val) dirs.bottom = val;
|
|
85
|
-
}
|
|
86
|
-
if (paddingLeft != null) {
|
|
87
|
-
const val = parsePaddingValue(paddingLeft);
|
|
88
|
-
if (val) dirs.left = val;
|
|
89
|
-
}
|
|
90
|
-
return optimizePadding(dirs);
|
|
91
|
-
}
|
|
92
|
-
paddingStyle.__lookupStyles = [
|
|
93
|
-
"padding",
|
|
94
|
-
"paddingTop",
|
|
95
|
-
"paddingRight",
|
|
96
|
-
"paddingBottom",
|
|
97
|
-
"paddingLeft",
|
|
98
|
-
"paddingBlock",
|
|
99
|
-
"paddingInline"
|
|
100
|
-
];
|
|
101
|
-
|
|
102
|
-
//#endregion
|
|
103
|
-
export { paddingStyle };
|
|
104
|
-
//# sourceMappingURL=padding.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"padding.js","names":[],"sources":["../../src/styles/padding.ts"],"sourcesContent":["import type { StyleDetails } from '../parser/types';\nimport { DIRECTIONS, filterMods, parseStyle } from '../utils/styles';\n\ntype Direction = (typeof DIRECTIONS)[number];\n\n/**\n * Parse a padding value and return the first processed value\n */\nfunction parsePaddingValue(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 * Extract values and directions from a single parsed group.\n */\nfunction extractGroupData(group: StyleDetails): {\n values: string[];\n directions: Direction[];\n} {\n const { values = [], mods = [] } = group;\n return {\n values: values.length ? values : ['var(--gap)'],\n directions: filterMods(mods, DIRECTIONS) as Direction[],\n };\n}\n\n/**\n * Apply a single group's values and directions onto a direction map.\n */\nfunction applyGroup(\n dirs: Record<Direction, string>,\n values: string[],\n directions: Direction[],\n): void {\n if (!values.length) return;\n\n if (directions.length === 0) {\n dirs.top = values[0];\n dirs.right = values[1] || values[0];\n dirs.bottom = values[2] || values[0];\n dirs.left = values[3] || values[1] || values[0];\n } else {\n directions.forEach((dir, i) => {\n dirs[dir] = values[i] ?? values[0];\n });\n }\n}\n\n/**\n * Optimize padding output shorthand.\n */\nfunction optimizePadding(dirs: Record<Direction, string>): {\n padding: string;\n} {\n const { top, right, bottom, left } = dirs;\n if (top === right && right === bottom && bottom === left) {\n return { padding: top };\n }\n if (top === bottom && left === right) {\n return { padding: `${top} ${left}` };\n }\n return { padding: `${top} ${right} ${bottom} ${left}` };\n}\n\nexport function paddingStyle({\n padding,\n paddingBlock,\n paddingInline,\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n}: {\n padding?: string | number | boolean;\n paddingBlock?: string | number | boolean;\n paddingInline?: string | number | boolean;\n paddingTop?: string | number | boolean;\n paddingRight?: string | number | boolean;\n paddingBottom?: string | number | boolean;\n paddingLeft?: string | number | boolean;\n}) {\n if (\n padding == null &&\n paddingBlock == null &&\n paddingInline == null &&\n paddingTop == null &&\n paddingRight == null &&\n paddingBottom == null &&\n paddingLeft == null\n ) {\n return {};\n }\n\n const dirs: Record<Direction, string> = {\n top: '0',\n right: '0',\n bottom: '0',\n left: '0',\n };\n\n // Priority 1 (lowest): padding\n if (padding != null) {\n if (typeof padding === 'number') {\n const v = `${padding}px`;\n dirs.top = dirs.right = dirs.bottom = dirs.left = v;\n } else if (padding === true) {\n padding = '1x';\n }\n\n if (typeof padding === 'string' && padding) {\n const processed = parseStyle(padding);\n const groups = processed.groups ?? [];\n\n for (const group of groups) {\n const { values, directions } = extractGroupData(group);\n applyGroup(dirs, values, directions);\n }\n }\n }\n\n // Priority 2 (medium): paddingBlock/paddingInline\n if (paddingBlock != null) {\n const val = parsePaddingValue(paddingBlock);\n if (val) dirs.top = dirs.bottom = val;\n }\n if (paddingInline != null) {\n const val = parsePaddingValue(paddingInline);\n if (val) dirs.left = dirs.right = val;\n }\n\n // Priority 3 (highest): individual directions\n if (paddingTop != null) {\n const val = parsePaddingValue(paddingTop);\n if (val) dirs.top = val;\n }\n if (paddingRight != null) {\n const val = parsePaddingValue(paddingRight);\n if (val) dirs.right = val;\n }\n if (paddingBottom != null) {\n const val = parsePaddingValue(paddingBottom);\n if (val) dirs.bottom = val;\n }\n if (paddingLeft != null) {\n const val = parsePaddingValue(paddingLeft);\n if (val) dirs.left = val;\n }\n\n return optimizePadding(dirs);\n}\n\npaddingStyle.__lookupStyles = [\n 'padding',\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n 'paddingBlock',\n 'paddingInline',\n];\n"],"mappings":";;;;;;AAQA,SAAS,kBAAkB,OAAiD;AAC1E,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,iBAAiB,OAGxB;CACA,MAAM,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,KAAK;AACnC,QAAO;EACL,QAAQ,OAAO,SAAS,SAAS,CAAC,aAAa;EAC/C,YAAY,WAAW,MAAM,WAAW;EACzC;;;;;AAMH,SAAS,WACP,MACA,QACA,YACM;AACN,KAAI,CAAC,OAAO,OAAQ;AAEpB,KAAI,WAAW,WAAW,GAAG;AAC3B,OAAK,MAAM,OAAO;AAClB,OAAK,QAAQ,OAAO,MAAM,OAAO;AACjC,OAAK,SAAS,OAAO,MAAM,OAAO;AAClC,OAAK,OAAO,OAAO,MAAM,OAAO,MAAM,OAAO;OAE7C,YAAW,SAAS,KAAK,MAAM;AAC7B,OAAK,OAAO,OAAO,MAAM,OAAO;GAChC;;;;;AAON,SAAS,gBAAgB,MAEvB;CACA,MAAM,EAAE,KAAK,OAAO,QAAQ,SAAS;AACrC,KAAI,QAAQ,SAAS,UAAU,UAAU,WAAW,KAClD,QAAO,EAAE,SAAS,KAAK;AAEzB,KAAI,QAAQ,UAAU,SAAS,MAC7B,QAAO,EAAE,SAAS,GAAG,IAAI,GAAG,QAAQ;AAEtC,QAAO,EAAE,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ;;AAGzD,SAAgB,aAAa,EAC3B,SACA,cACA,eACA,YACA,cACA,eACA,eASC;AACD,KACE,WAAW,QACX,gBAAgB,QAChB,iBAAiB,QACjB,cAAc,QACd,gBAAgB,QAChB,iBAAiB,QACjB,eAAe,KAEf,QAAO,EAAE;CAGX,MAAM,OAAkC;EACtC,KAAK;EACL,OAAO;EACP,QAAQ;EACR,MAAM;EACP;AAGD,KAAI,WAAW,MAAM;AACnB,MAAI,OAAO,YAAY,SAErB,MAAK,MAAM,KAAK,QAAQ,KAAK,SAAS,KAAK,OADjC,GAAG,QAAQ;WAEZ,YAAY,KACrB,WAAU;AAGZ,MAAI,OAAO,YAAY,YAAY,SAAS;GAE1C,MAAM,SADY,WAAW,QAAQ,CACZ,UAAU,EAAE;AAErC,QAAK,MAAM,SAAS,QAAQ;IAC1B,MAAM,EAAE,QAAQ,eAAe,iBAAiB,MAAM;AACtD,eAAW,MAAM,QAAQ,WAAW;;;;AAM1C,KAAI,gBAAgB,MAAM;EACxB,MAAM,MAAM,kBAAkB,aAAa;AAC3C,MAAI,IAAK,MAAK,MAAM,KAAK,SAAS;;AAEpC,KAAI,iBAAiB,MAAM;EACzB,MAAM,MAAM,kBAAkB,cAAc;AAC5C,MAAI,IAAK,MAAK,OAAO,KAAK,QAAQ;;AAIpC,KAAI,cAAc,MAAM;EACtB,MAAM,MAAM,kBAAkB,WAAW;AACzC,MAAI,IAAK,MAAK,MAAM;;AAEtB,KAAI,gBAAgB,MAAM;EACxB,MAAM,MAAM,kBAAkB,aAAa;AAC3C,MAAI,IAAK,MAAK,QAAQ;;AAExB,KAAI,iBAAiB,MAAM;EACzB,MAAM,MAAM,kBAAkB,cAAc;AAC5C,MAAI,IAAK,MAAK,SAAS;;AAEzB,KAAI,eAAe,MAAM;EACvB,MAAM,MAAM,kBAAkB,YAAY;AAC1C,MAAI,IAAK,MAAK,OAAO;;AAGvB,QAAO,gBAAgB,KAAK;;AAG9B,aAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { alignStyle } from "./align.js";
|
|
2
|
-
import { borderStyle } from "./border.js";
|
|
3
|
-
import { colorStyle } from "./color.js";
|
|
4
|
-
import { displayStyle } from "./display.js";
|
|
5
|
-
import { fadeStyle } from "./fade.js";
|
|
6
|
-
import { fillStyle, svgFillStyle } from "./fill.js";
|
|
7
|
-
import { flowStyle } from "./flow.js";
|
|
8
|
-
import { gapStyle } from "./gap.js";
|
|
9
|
-
import { heightStyle } from "./height.js";
|
|
10
|
-
import { insetStyle } from "./inset.js";
|
|
11
|
-
import { justifyStyle } from "./justify.js";
|
|
12
|
-
import { marginStyle } from "./margin.js";
|
|
13
|
-
import { outlineStyle } from "./outline.js";
|
|
14
|
-
import { paddingStyle } from "./padding.js";
|
|
15
|
-
import { presetStyle } from "./preset.js";
|
|
16
|
-
import { radiusStyle } from "./radius.js";
|
|
17
|
-
import { scrollbarStyle } from "./scrollbar.js";
|
|
18
|
-
import { shadowStyle } from "./shadow.js";
|
|
19
|
-
import { styledScrollbarStyle } from "./styledScrollbar.js";
|
|
20
|
-
import { transitionStyle } from "./transition.js";
|
|
21
|
-
import { widthStyle } from "./width.js";
|
|
22
|
-
|
|
23
|
-
//#region src/styles/predefined.d.ts
|
|
24
|
-
/**
|
|
25
|
-
* Exported object containing wrapped predefined style handlers.
|
|
26
|
-
* Users can import and call these to extend or delegate to built-in behavior.
|
|
27
|
-
*
|
|
28
|
-
* Internal handlers use *Style suffix for searchability.
|
|
29
|
-
* External API uses short names for convenience.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```ts
|
|
33
|
-
* import { styleHandlers, configure } from '@tenphi/tasty';
|
|
34
|
-
*
|
|
35
|
-
* configure({
|
|
36
|
-
* handlers: {
|
|
37
|
-
* fill: ({ fill }) => {
|
|
38
|
-
* if (fill?.startsWith('gradient:')) {
|
|
39
|
-
* return { background: fill.slice(9) };
|
|
40
|
-
* }
|
|
41
|
-
* return styleHandlers.fill({ fill });
|
|
42
|
-
* },
|
|
43
|
-
* },
|
|
44
|
-
* });
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
declare const styleHandlers: {
|
|
48
|
-
readonly align: typeof alignStyle;
|
|
49
|
-
readonly border: typeof borderStyle;
|
|
50
|
-
readonly color: typeof colorStyle;
|
|
51
|
-
readonly display: typeof displayStyle;
|
|
52
|
-
readonly fade: typeof fadeStyle;
|
|
53
|
-
readonly fill: typeof fillStyle;
|
|
54
|
-
readonly svgFill: typeof svgFillStyle;
|
|
55
|
-
readonly flow: typeof flowStyle;
|
|
56
|
-
readonly gap: typeof gapStyle;
|
|
57
|
-
readonly height: typeof heightStyle;
|
|
58
|
-
readonly inset: typeof insetStyle;
|
|
59
|
-
readonly justify: typeof justifyStyle;
|
|
60
|
-
readonly margin: typeof marginStyle;
|
|
61
|
-
readonly outline: typeof outlineStyle;
|
|
62
|
-
readonly padding: typeof paddingStyle;
|
|
63
|
-
readonly preset: typeof presetStyle;
|
|
64
|
-
readonly radius: typeof radiusStyle;
|
|
65
|
-
readonly scrollbar: typeof scrollbarStyle;
|
|
66
|
-
readonly shadow: typeof shadowStyle;
|
|
67
|
-
readonly styledScrollbar: typeof styledScrollbarStyle;
|
|
68
|
-
readonly transition: typeof transitionStyle;
|
|
69
|
-
readonly width: typeof widthStyle;
|
|
70
|
-
};
|
|
71
|
-
//#endregion
|
|
72
|
-
export { styleHandlers };
|
|
73
|
-
//# sourceMappingURL=predefined.d.ts.map
|