@tenphi/tasty 0.0.0-snapshot.056b911
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 +635 -0
- package/dist/_virtual/_rolldown/runtime.js +7 -0
- package/dist/chunks/cacheKey.d.ts +1 -0
- package/dist/chunks/cacheKey.js +77 -0
- package/dist/chunks/cacheKey.js.map +1 -0
- package/dist/chunks/definitions.d.ts +37 -0
- package/dist/chunks/definitions.js +258 -0
- package/dist/chunks/definitions.js.map +1 -0
- package/dist/chunks/index.d.ts +1 -0
- package/dist/chunks/renderChunk.d.ts +1 -0
- package/dist/chunks/renderChunk.js +59 -0
- package/dist/chunks/renderChunk.js.map +1 -0
- package/dist/compute-styles.d.ts +31 -0
- package/dist/compute-styles.js +335 -0
- package/dist/compute-styles.js.map +1 -0
- package/dist/config.d.ts +409 -0
- package/dist/config.js +584 -0
- package/dist/config.js.map +1 -0
- package/dist/core/index.d.ts +34 -0
- package/dist/core/index.js +27 -0
- package/dist/counter-style/index.js +51 -0
- package/dist/counter-style/index.js.map +1 -0
- package/dist/debug.d.ts +89 -0
- package/dist/debug.js +453 -0
- package/dist/debug.js.map +1 -0
- package/dist/font-face/index.js +63 -0
- package/dist/font-face/index.js.map +1 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/useCounterStyle.d.ts +36 -0
- package/dist/hooks/useCounterStyle.js +64 -0
- package/dist/hooks/useCounterStyle.js.map +1 -0
- package/dist/hooks/useFontFace.d.ts +45 -0
- package/dist/hooks/useFontFace.js +66 -0
- package/dist/hooks/useFontFace.js.map +1 -0
- package/dist/hooks/useGlobalStyles.d.ts +46 -0
- package/dist/hooks/useGlobalStyles.js +88 -0
- package/dist/hooks/useGlobalStyles.js.map +1 -0
- package/dist/hooks/useKeyframes.d.ts +58 -0
- package/dist/hooks/useKeyframes.js +54 -0
- package/dist/hooks/useKeyframes.js.map +1 -0
- package/dist/hooks/useProperty.d.ts +81 -0
- package/dist/hooks/useProperty.js +96 -0
- package/dist/hooks/useProperty.js.map +1 -0
- package/dist/hooks/useRawCSS.d.ts +22 -0
- package/dist/hooks/useRawCSS.js +103 -0
- package/dist/hooks/useRawCSS.js.map +1 -0
- package/dist/hooks/useStyles.d.ts +40 -0
- package/dist/hooks/useStyles.js +31 -0
- package/dist/hooks/useStyles.js.map +1 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.js +36 -0
- package/dist/injector/index.d.ts +182 -0
- package/dist/injector/index.js +185 -0
- package/dist/injector/index.js.map +1 -0
- package/dist/injector/injector.d.ts +193 -0
- package/dist/injector/injector.js +564 -0
- package/dist/injector/injector.js.map +1 -0
- package/dist/injector/sheet-manager.d.ts +132 -0
- package/dist/injector/sheet-manager.js +698 -0
- package/dist/injector/sheet-manager.js.map +1 -0
- package/dist/injector/types.d.ts +228 -0
- package/dist/keyframes/index.js +206 -0
- package/dist/keyframes/index.js.map +1 -0
- package/dist/parser/classify.js +319 -0
- package/dist/parser/classify.js.map +1 -0
- package/dist/parser/const.js +60 -0
- package/dist/parser/const.js.map +1 -0
- package/dist/parser/lru.js +109 -0
- package/dist/parser/lru.js.map +1 -0
- package/dist/parser/parser.d.ts +25 -0
- package/dist/parser/parser.js +115 -0
- package/dist/parser/parser.js.map +1 -0
- package/dist/parser/tokenizer.js +69 -0
- package/dist/parser/tokenizer.js.map +1 -0
- package/dist/parser/types.d.ts +51 -0
- package/dist/parser/types.js +46 -0
- package/dist/parser/types.js.map +1 -0
- package/dist/pipeline/conditions.d.ts +134 -0
- package/dist/pipeline/conditions.js +406 -0
- package/dist/pipeline/conditions.js.map +1 -0
- package/dist/pipeline/exclusive.js +230 -0
- package/dist/pipeline/exclusive.js.map +1 -0
- package/dist/pipeline/index.d.ts +55 -0
- package/dist/pipeline/index.js +708 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/pipeline/materialize.js +1103 -0
- package/dist/pipeline/materialize.js.map +1 -0
- package/dist/pipeline/parseStateKey.d.ts +15 -0
- package/dist/pipeline/parseStateKey.js +446 -0
- package/dist/pipeline/parseStateKey.js.map +1 -0
- package/dist/pipeline/simplify.js +515 -0
- package/dist/pipeline/simplify.js.map +1 -0
- package/dist/pipeline/warnings.js +18 -0
- package/dist/pipeline/warnings.js.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 +97 -0
- package/dist/plugins/okhsl-plugin.js.map +1 -0
- package/dist/plugins/types.d.ts +87 -0
- package/dist/properties/index.js +222 -0
- package/dist/properties/index.js.map +1 -0
- package/dist/properties/property-type-resolver.d.ts +24 -0
- package/dist/properties/property-type-resolver.js +90 -0
- package/dist/properties/property-type-resolver.js.map +1 -0
- package/dist/rsc-cache.js +81 -0
- package/dist/rsc-cache.js.map +1 -0
- package/dist/ssr/astro-client.d.ts +1 -0
- package/dist/ssr/astro-client.js +24 -0
- package/dist/ssr/astro-client.js.map +1 -0
- package/dist/ssr/astro-middleware.d.ts +15 -0
- package/dist/ssr/astro-middleware.js +19 -0
- package/dist/ssr/astro-middleware.js.map +1 -0
- package/dist/ssr/astro.d.ts +106 -0
- package/dist/ssr/astro.js +149 -0
- package/dist/ssr/astro.js.map +1 -0
- package/dist/ssr/async-storage.d.ts +17 -0
- package/dist/ssr/async-storage.js +44 -0
- package/dist/ssr/async-storage.js.map +1 -0
- package/dist/ssr/collect-auto-properties.js +58 -0
- package/dist/ssr/collect-auto-properties.js.map +1 -0
- package/dist/ssr/collector.d.ts +102 -0
- package/dist/ssr/collector.js +227 -0
- package/dist/ssr/collector.js.map +1 -0
- package/dist/ssr/context.js +16 -0
- package/dist/ssr/context.js.map +1 -0
- package/dist/ssr/format-global-rules.js +22 -0
- package/dist/ssr/format-global-rules.js.map +1 -0
- package/dist/ssr/format-keyframes.js +69 -0
- package/dist/ssr/format-keyframes.js.map +1 -0
- package/dist/ssr/format-property.js +49 -0
- package/dist/ssr/format-property.js.map +1 -0
- package/dist/ssr/format-rules.js +73 -0
- package/dist/ssr/format-rules.js.map +1 -0
- package/dist/ssr/hydrate.d.ts +22 -0
- package/dist/ssr/hydrate.js +49 -0
- package/dist/ssr/hydrate.js.map +1 -0
- package/dist/ssr/index.d.ts +4 -0
- package/dist/ssr/index.js +10 -0
- package/dist/ssr/index.js.map +1 -0
- package/dist/ssr/next.d.ts +45 -0
- package/dist/ssr/next.js +75 -0
- package/dist/ssr/next.js.map +1 -0
- package/dist/ssr/ssr-collector-ref.js +29 -0
- package/dist/ssr/ssr-collector-ref.js.map +1 -0
- package/dist/states/index.d.ts +49 -0
- package/dist/states/index.js +170 -0
- package/dist/states/index.js.map +1 -0
- package/dist/static/index.d.ts +5 -0
- package/dist/static/index.js +4 -0
- package/dist/static/inject.d.ts +5 -0
- package/dist/static/inject.js +17 -0
- package/dist/static/inject.js.map +1 -0
- package/dist/static/tastyStatic.d.ts +46 -0
- package/dist/static/tastyStatic.js +30 -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/border.d.ts +25 -0
- package/dist/styles/border.js +120 -0
- package/dist/styles/border.js.map +1 -0
- package/dist/styles/color.d.ts +14 -0
- package/dist/styles/color.js +26 -0
- package/dist/styles/color.js.map +1 -0
- package/dist/styles/const.js +17 -0
- package/dist/styles/const.js.map +1 -0
- package/dist/styles/createStyle.js +79 -0
- package/dist/styles/createStyle.js.map +1 -0
- package/dist/styles/dimension.js +109 -0
- package/dist/styles/dimension.js.map +1 -0
- package/dist/styles/directional.js +133 -0
- package/dist/styles/directional.js.map +1 -0
- package/dist/styles/display.d.ts +30 -0
- package/dist/styles/display.js +73 -0
- package/dist/styles/display.js.map +1 -0
- package/dist/styles/fade.d.ts +15 -0
- package/dist/styles/fade.js +62 -0
- package/dist/styles/fade.js.map +1 -0
- package/dist/styles/fill.d.ts +42 -0
- package/dist/styles/fill.js +51 -0
- package/dist/styles/fill.js.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/gap.d.ts +31 -0
- package/dist/styles/gap.js +38 -0
- package/dist/styles/gap.js.map +1 -0
- package/dist/styles/height.d.ts +17 -0
- package/dist/styles/height.js +19 -0
- package/dist/styles/height.js.map +1 -0
- package/dist/styles/index.d.ts +1 -0
- package/dist/styles/index.js +8 -0
- package/dist/styles/index.js.map +1 -0
- package/dist/styles/inset.d.ts +24 -0
- package/dist/styles/inset.js +34 -0
- package/dist/styles/inset.js.map +1 -0
- package/dist/styles/list.d.ts +16 -0
- package/dist/styles/list.js +100 -0
- package/dist/styles/list.js.map +1 -0
- package/dist/styles/margin.d.ts +24 -0
- package/dist/styles/margin.js +32 -0
- package/dist/styles/margin.js.map +1 -0
- package/dist/styles/outline.d.ts +29 -0
- package/dist/styles/outline.js +55 -0
- package/dist/styles/outline.js.map +1 -0
- package/dist/styles/padding.d.ts +24 -0
- package/dist/styles/padding.js +32 -0
- package/dist/styles/padding.js.map +1 -0
- package/dist/styles/placement.d.ts +37 -0
- package/dist/styles/placement.js +74 -0
- package/dist/styles/placement.js.map +1 -0
- package/dist/styles/predefined.d.ts +71 -0
- package/dist/styles/predefined.js +237 -0
- package/dist/styles/predefined.js.map +1 -0
- package/dist/styles/preset.d.ts +52 -0
- package/dist/styles/preset.js +127 -0
- package/dist/styles/preset.js.map +1 -0
- package/dist/styles/radius.d.ts +12 -0
- package/dist/styles/radius.js +83 -0
- package/dist/styles/radius.js.map +1 -0
- package/dist/styles/scrollMargin.d.ts +24 -0
- package/dist/styles/scrollMargin.js +32 -0
- package/dist/styles/scrollMargin.js.map +1 -0
- package/dist/styles/scrollbar.d.ts +25 -0
- package/dist/styles/scrollbar.js +51 -0
- package/dist/styles/scrollbar.js.map +1 -0
- package/dist/styles/shadow.d.ts +14 -0
- package/dist/styles/shadow.js +25 -0
- package/dist/styles/shadow.js.map +1 -0
- package/dist/styles/shared.js +17 -0
- package/dist/styles/shared.js.map +1 -0
- package/dist/styles/transition.d.ts +14 -0
- package/dist/styles/transition.js +159 -0
- package/dist/styles/transition.js.map +1 -0
- package/dist/styles/types.d.ts +564 -0
- package/dist/styles/width.d.ts +17 -0
- package/dist/styles/width.js +19 -0
- package/dist/styles/width.js.map +1 -0
- package/dist/tasty.d.ts +134 -0
- package/dist/tasty.js +243 -0
- package/dist/tasty.js.map +1 -0
- package/dist/types.d.ts +184 -0
- package/dist/utils/cache-wrapper.js +21 -0
- package/dist/utils/cache-wrapper.js.map +1 -0
- package/dist/utils/case-converter.js +8 -0
- package/dist/utils/case-converter.js.map +1 -0
- package/dist/utils/color-math.d.ts +46 -0
- package/dist/utils/color-math.js +749 -0
- package/dist/utils/color-math.js.map +1 -0
- package/dist/utils/color-space.d.ts +5 -0
- package/dist/utils/color-space.js +228 -0
- package/dist/utils/color-space.js.map +1 -0
- package/dist/utils/colors.d.ts +5 -0
- package/dist/utils/colors.js +10 -0
- package/dist/utils/colors.js.map +1 -0
- package/dist/utils/css-types.d.ts +7 -0
- package/dist/utils/deps-equal.js +15 -0
- package/dist/utils/deps-equal.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/has-keys.js +13 -0
- package/dist/utils/has-keys.js.map +1 -0
- package/dist/utils/hash.js +14 -0
- package/dist/utils/hash.js.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-valid-element-type.js +15 -0
- package/dist/utils/is-valid-element-type.js.map +1 -0
- package/dist/utils/merge-styles.d.ts +7 -0
- package/dist/utils/merge-styles.js +145 -0
- package/dist/utils/merge-styles.js.map +1 -0
- package/dist/utils/mod-attrs.d.ts +6 -0
- package/dist/utils/mod-attrs.js +20 -0
- package/dist/utils/mod-attrs.js.map +1 -0
- package/dist/utils/process-tokens.d.ts +17 -0
- package/dist/utils/process-tokens.js +83 -0
- package/dist/utils/process-tokens.js.map +1 -0
- package/dist/utils/resolve-recipes.d.ts +17 -0
- package/dist/utils/resolve-recipes.js +146 -0
- package/dist/utils/resolve-recipes.js.map +1 -0
- package/dist/utils/selector-transform.js +32 -0
- package/dist/utils/selector-transform.js.map +1 -0
- package/dist/utils/string.js +8 -0
- package/dist/utils/string.js.map +1 -0
- package/dist/utils/styles.d.ts +99 -0
- package/dist/utils/styles.js +220 -0
- package/dist/utils/styles.js.map +1 -0
- package/dist/utils/typography.d.ts +58 -0
- package/dist/utils/typography.js +51 -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.ts +195 -0
- package/dist/zero/babel.js +456 -0
- package/dist/zero/babel.js.map +1 -0
- package/dist/zero/css-writer.d.ts +45 -0
- package/dist/zero/css-writer.js +73 -0
- package/dist/zero/css-writer.js.map +1 -0
- package/dist/zero/extractor.d.ts +24 -0
- package/dist/zero/extractor.js +266 -0
- package/dist/zero/extractor.js.map +1 -0
- package/dist/zero/index.d.ts +3 -0
- package/dist/zero/index.js +3 -0
- package/dist/zero/next.d.ts +86 -0
- package/dist/zero/next.js +143 -0
- package/dist/zero/next.js.map +1 -0
- package/docs/PIPELINE.md +519 -0
- package/docs/README.md +31 -0
- package/docs/adoption.md +298 -0
- package/docs/comparison.md +419 -0
- package/docs/configuration.md +389 -0
- package/docs/debug.md +318 -0
- package/docs/design-system.md +436 -0
- package/docs/dsl.md +688 -0
- package/docs/getting-started.md +217 -0
- package/docs/injector.md +544 -0
- package/docs/methodology.md +616 -0
- package/docs/react-api.md +557 -0
- package/docs/ssr.md +440 -0
- package/docs/styles.md +596 -0
- package/docs/tasty-static.md +532 -0
- package/package.json +221 -0
- package/tasty.config.ts +14 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//#region src/utils/typography.ts
|
|
2
|
+
const RESERVED_PRESET_NAMES = new Set([
|
|
3
|
+
"strong",
|
|
4
|
+
"bold",
|
|
5
|
+
"italic",
|
|
6
|
+
"icon",
|
|
7
|
+
"tight"
|
|
8
|
+
]);
|
|
9
|
+
/**
|
|
10
|
+
* Generate typography tokens with $ prefix for CSS custom properties.
|
|
11
|
+
*
|
|
12
|
+
* Each preset generates the following CSS custom properties:
|
|
13
|
+
* - `${name}-font-size`
|
|
14
|
+
* - `${name}-line-height`
|
|
15
|
+
* - `${name}-letter-spacing`
|
|
16
|
+
* - `${name}-font-weight`
|
|
17
|
+
* - `${name}-bold-font-weight` (if defined)
|
|
18
|
+
* - `${name}-icon-size` (if defined)
|
|
19
|
+
* - `${name}-text-transform` (if defined)
|
|
20
|
+
* - `${name}-font-family` (if defined)
|
|
21
|
+
* - `${name}-font-style` (if defined)
|
|
22
|
+
*
|
|
23
|
+
* @param presets - Typography presets object
|
|
24
|
+
* @returns ConfigTokens object with $ prefixed keys
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* const customTokens = generateTypographyTokens({
|
|
28
|
+
* myHeading: { fontSize: '24px', lineHeight: '32px', fontWeight: '700' },
|
|
29
|
+
* body: { fontSize: '16px', lineHeight: '24px', fontWeight: '400' },
|
|
30
|
+
* });
|
|
31
|
+
*/
|
|
32
|
+
function generateTypographyTokens(presets) {
|
|
33
|
+
const tokens = {};
|
|
34
|
+
for (const [name, preset] of Object.entries(presets)) {
|
|
35
|
+
if (RESERVED_PRESET_NAMES.has(name)) throw new Error(`Invalid typography preset name "${name}". This name is reserved as a preset modifier.`);
|
|
36
|
+
tokens[`$${name}-font-size`] = preset.fontSize;
|
|
37
|
+
tokens[`$${name}-line-height`] = preset.lineHeight;
|
|
38
|
+
tokens[`$${name}-letter-spacing`] = preset.letterSpacing ?? "0";
|
|
39
|
+
tokens[`$${name}-font-weight`] = preset.fontWeight;
|
|
40
|
+
if (preset.boldFontWeight !== void 0) tokens[`$${name}-bold-font-weight`] = preset.boldFontWeight;
|
|
41
|
+
if (preset.iconSize !== void 0) tokens[`$${name}-icon-size`] = preset.iconSize;
|
|
42
|
+
if (preset.textTransform !== void 0) tokens[`$${name}-text-transform`] = preset.textTransform;
|
|
43
|
+
if (preset.fontFamily !== void 0) tokens[`$${name}-font-family`] = preset.fontFamily;
|
|
44
|
+
if (preset.fontStyle !== void 0) tokens[`$${name}-font-style`] = preset.fontStyle;
|
|
45
|
+
}
|
|
46
|
+
return tokens;
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
export { generateTypographyTokens };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=typography.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typography.js","names":[],"sources":["../../src/utils/typography.ts"],"sourcesContent":["import type { ConfigTokens, ConfigTokenValue } from '../styles/types';\n\nconst RESERVED_PRESET_NAMES = new Set([\n 'strong',\n 'bold',\n 'italic',\n 'icon',\n 'tight',\n]);\n\n/**\n * A typography token value: plain value or a state map for responsive/theme-aware presets.\n *\n * @example\n * // Plain value\n * fontWeight: '400'\n * // State map\n * fontWeight: { '': '400', '@dark': '300' }\n */\nexport type TypographyTokenValue =\n | string\n | number\n | Record<string, string | number | undefined | null | '@inherit'>;\n\n/**\n * Typography preset configuration.\n * Each preset defines font properties that get expanded into CSS custom properties.\n * All fields accept plain values or state maps for responsive/theme-aware tokens.\n *\n * Use with `generateTypographyTokens()` to create typography tokens for your design system.\n */\nexport interface TypographyPreset {\n fontSize: TypographyTokenValue;\n lineHeight: TypographyTokenValue;\n letterSpacing?: TypographyTokenValue;\n fontWeight: TypographyTokenValue;\n boldFontWeight?: TypographyTokenValue;\n iconSize?: TypographyTokenValue;\n textTransform?: TypographyTokenValue;\n fontFamily?: TypographyTokenValue;\n fontStyle?: TypographyTokenValue;\n}\n\n/**\n * Generate typography tokens with $ prefix for CSS custom properties.\n *\n * Each preset generates the following CSS custom properties:\n * - `${name}-font-size`\n * - `${name}-line-height`\n * - `${name}-letter-spacing`\n * - `${name}-font-weight`\n * - `${name}-bold-font-weight` (if defined)\n * - `${name}-icon-size` (if defined)\n * - `${name}-text-transform` (if defined)\n * - `${name}-font-family` (if defined)\n * - `${name}-font-style` (if defined)\n *\n * @param presets - Typography presets object\n * @returns ConfigTokens object with $ prefixed keys\n *\n * @example\n * const customTokens = generateTypographyTokens({\n * myHeading: { fontSize: '24px', lineHeight: '32px', fontWeight: '700' },\n * body: { fontSize: '16px', lineHeight: '24px', fontWeight: '400' },\n * });\n */\nexport function generateTypographyTokens(\n presets: Record<string, TypographyPreset>,\n): ConfigTokens {\n const tokens: Record<`$${string}`, ConfigTokenValue> = {};\n\n for (const [name, preset] of Object.entries(presets)) {\n if (RESERVED_PRESET_NAMES.has(name)) {\n throw new Error(\n `Invalid typography preset name \"${name}\". This name is reserved as a preset modifier.`,\n );\n }\n\n tokens[`$${name}-font-size`] = preset.fontSize;\n tokens[`$${name}-line-height`] = preset.lineHeight;\n tokens[`$${name}-letter-spacing`] = preset.letterSpacing ?? '0';\n tokens[`$${name}-font-weight`] = preset.fontWeight;\n\n if (preset.boldFontWeight !== undefined) {\n tokens[`$${name}-bold-font-weight`] = preset.boldFontWeight;\n }\n\n if (preset.iconSize !== undefined) {\n tokens[`$${name}-icon-size`] = preset.iconSize;\n }\n\n if (preset.textTransform !== undefined) {\n tokens[`$${name}-text-transform`] = preset.textTransform;\n }\n\n if (preset.fontFamily !== undefined) {\n tokens[`$${name}-font-family`] = preset.fontFamily;\n }\n\n if (preset.fontStyle !== undefined) {\n tokens[`$${name}-font-style`] = preset.fontStyle;\n }\n }\n\n return tokens as ConfigTokens;\n}\n"],"mappings":";AAEA,MAAM,wBAAwB,IAAI,IAAI;CACpC;CACA;CACA;CACA;CACA;CACD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;AA0DF,SAAgB,yBACd,SACc;CACd,MAAM,SAAiD,EAAE;AAEzD,MAAK,MAAM,CAAC,MAAM,WAAW,OAAO,QAAQ,QAAQ,EAAE;AACpD,MAAI,sBAAsB,IAAI,KAAK,CACjC,OAAM,IAAI,MACR,mCAAmC,KAAK,gDACzC;AAGH,SAAO,IAAI,KAAK,eAAe,OAAO;AACtC,SAAO,IAAI,KAAK,iBAAiB,OAAO;AACxC,SAAO,IAAI,KAAK,oBAAoB,OAAO,iBAAiB;AAC5D,SAAO,IAAI,KAAK,iBAAiB,OAAO;AAExC,MAAI,OAAO,mBAAmB,KAAA,EAC5B,QAAO,IAAI,KAAK,sBAAsB,OAAO;AAG/C,MAAI,OAAO,aAAa,KAAA,EACtB,QAAO,IAAI,KAAK,eAAe,OAAO;AAGxC,MAAI,OAAO,kBAAkB,KAAA,EAC3B,QAAO,IAAI,KAAK,oBAAoB,OAAO;AAG7C,MAAI,OAAO,eAAe,KAAA,EACxB,QAAO,IAAI,KAAK,iBAAiB,OAAO;AAG1C,MAAI,OAAO,cAAc,KAAA,EACvB,QAAO,IAAI,KAAK,gBAAgB,OAAO;;AAI3C,QAAO"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/utils/warnings.d.ts
|
|
2
|
+
declare function warn(...args: unknown[]): void;
|
|
3
|
+
declare function deprecationWarning(condition: unknown, {
|
|
4
|
+
property,
|
|
5
|
+
name,
|
|
6
|
+
betterAlternative,
|
|
7
|
+
reason
|
|
8
|
+
}: {
|
|
9
|
+
property: string;
|
|
10
|
+
name: string;
|
|
11
|
+
betterAlternative: (() => string) | string;
|
|
12
|
+
reason?: (() => string) | string;
|
|
13
|
+
}): void;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { deprecationWarning, warn };
|
|
16
|
+
//# sourceMappingURL=warnings.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/utils/warnings.ts
|
|
2
|
+
const PREFIX = "Tasty";
|
|
3
|
+
function warn(...args) {
|
|
4
|
+
console.warn(`${PREFIX}:`, ...args);
|
|
5
|
+
}
|
|
6
|
+
function deprecationWarning(condition, { property, name, betterAlternative, reason }) {
|
|
7
|
+
if (condition) return;
|
|
8
|
+
console.group(`⚠️ ${PREFIX}: Deprecation in ${name}`);
|
|
9
|
+
warn(`"${property}" is deprecated, consider better alternative: ${typeof betterAlternative === "function" ? betterAlternative() : betterAlternative}`);
|
|
10
|
+
if (reason) warn(`Reason: ${typeof reason === "function" ? reason() : reason}`);
|
|
11
|
+
console.groupEnd();
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { deprecationWarning, warn };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=warnings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warnings.js","names":[],"sources":["../../src/utils/warnings.ts"],"sourcesContent":["/* eslint-disable no-console */\nconst PREFIX = 'Tasty';\n\nexport function warn(...args: unknown[]) {\n console.warn(`${PREFIX}:`, ...args);\n}\n\nexport function deprecationWarning(\n condition: unknown,\n {\n property,\n name,\n betterAlternative,\n reason,\n }: {\n property: string;\n name: string;\n betterAlternative: (() => string) | string;\n reason?: (() => string) | string;\n },\n) {\n if (condition) return;\n\n if (process.env.NODE_ENV === 'production') {\n return warn(\n `DEPRECATION ${name} \"${property}\" -> ${\n typeof betterAlternative === 'function'\n ? betterAlternative()\n : betterAlternative\n }`,\n );\n }\n\n // we can make deprecations even better if we add the md syntax in the console.\n // anyway, everything down below will be stripped in the production build\n console.group(`⚠️ ${PREFIX}: Deprecation in ${name}`);\n warn(\n `\"${property}\" is deprecated, consider better alternative: ${\n typeof betterAlternative === 'function'\n ? betterAlternative()\n : betterAlternative\n }`,\n );\n if (reason) {\n warn(`Reason: ${typeof reason === 'function' ? reason() : reason}`);\n }\n console.groupEnd();\n}\n"],"mappings":";AACA,MAAM,SAAS;AAEf,SAAgB,KAAK,GAAG,MAAiB;AACvC,SAAQ,KAAK,GAAG,OAAO,IAAI,GAAG,KAAK;;AAGrC,SAAgB,mBACd,WACA,EACE,UACA,MACA,mBACA,UAOF;AACA,KAAI,UAAW;AAcf,SAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO;AACrD,MACE,IAAI,SAAS,gDACX,OAAO,sBAAsB,aACzB,mBAAmB,GACnB,oBAEP;AACD,KAAI,OACF,MAAK,WAAW,OAAO,WAAW,aAAa,QAAQ,GAAG,SAAS;AAErE,SAAQ,UAAU"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { CounterStyleDescriptors, FontFaceInput, KeyframesSteps } from "../injector/types.js";
|
|
2
|
+
import { StyleDetails, UnitHandler } from "../parser/types.js";
|
|
3
|
+
import { StyleHandlerDefinition } from "../utils/styles.js";
|
|
4
|
+
import { ConfigTokens, RecipeStyles, Styles } from "../styles/types.js";
|
|
5
|
+
import { TypographyPreset } from "../utils/typography.js";
|
|
6
|
+
import { TastyPlugin } from "../plugins/types.js";
|
|
7
|
+
import * as _$_babel_core0 from "@babel/core";
|
|
8
|
+
import { PluginPass } from "@babel/core";
|
|
9
|
+
|
|
10
|
+
//#region src/zero/babel.d.ts
|
|
11
|
+
/**
|
|
12
|
+
* Build-time configuration for zero-runtime mode.
|
|
13
|
+
* Subset of TastyConfig that applies at build time.
|
|
14
|
+
*/
|
|
15
|
+
interface TastyZeroConfig {
|
|
16
|
+
/**
|
|
17
|
+
* Global predefined states for advanced state mapping.
|
|
18
|
+
* Example: { '@mobile': '@media(w < 768px)', '@dark': '@root(theme=dark)' }
|
|
19
|
+
*/
|
|
20
|
+
states?: Record<string, string>;
|
|
21
|
+
/**
|
|
22
|
+
* Enable development mode features: source comments in generated CSS.
|
|
23
|
+
* Default: false
|
|
24
|
+
*/
|
|
25
|
+
devMode?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Parser LRU cache size (default: 1000).
|
|
28
|
+
* Larger values improve performance for builds with many unique style values.
|
|
29
|
+
*/
|
|
30
|
+
parserCacheSize?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Custom units for the style parser (merged with built-in units).
|
|
33
|
+
* Units transform numeric values like `2x` → `calc(2 * var(--gap))`.
|
|
34
|
+
* @example { em: 'em', vw: 'vw', custom: (n) => `${n * 10}px` }
|
|
35
|
+
*/
|
|
36
|
+
units?: Record<string, string | UnitHandler>;
|
|
37
|
+
/**
|
|
38
|
+
* Custom functions for the style parser (merged with existing).
|
|
39
|
+
* Functions process parsed style groups and return CSS values.
|
|
40
|
+
* @example { myFunc: (groups) => groups.map(g => g.output).join(' ') }
|
|
41
|
+
*/
|
|
42
|
+
funcs?: Record<string, (groups: StyleDetails[]) => string>;
|
|
43
|
+
/**
|
|
44
|
+
* Plugins that extend tasty with custom functions, units, states, and handlers.
|
|
45
|
+
* Plugins are processed in order, with later plugins overriding earlier ones.
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* import { okhslPlugin } from '@tenphi/tasty';
|
|
49
|
+
*
|
|
50
|
+
* // babel.config.js
|
|
51
|
+
* module.exports = {
|
|
52
|
+
* plugins: [
|
|
53
|
+
* ['@tenphi/tasty/babel-plugin', {
|
|
54
|
+
* config: { plugins: [okhslPlugin()] }
|
|
55
|
+
* }]
|
|
56
|
+
* ]
|
|
57
|
+
* };
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
plugins?: TastyPlugin[];
|
|
61
|
+
/**
|
|
62
|
+
* Global keyframes definitions for static extraction.
|
|
63
|
+
* Keys are animation names, values are keyframes step definitions.
|
|
64
|
+
* @example { fadeIn: { from: { opacity: 0 }, to: { opacity: 1 } } }
|
|
65
|
+
*/
|
|
66
|
+
keyframes?: Record<string, KeyframesSteps>;
|
|
67
|
+
/**
|
|
68
|
+
* Global @font-face definitions for static extraction.
|
|
69
|
+
* Keys are font-family names, values are descriptors or arrays of descriptors.
|
|
70
|
+
*/
|
|
71
|
+
fontFace?: Record<string, FontFaceInput>;
|
|
72
|
+
/**
|
|
73
|
+
* Global @counter-style definitions for static extraction.
|
|
74
|
+
* Keys are counter-style names, values are descriptor objects.
|
|
75
|
+
*/
|
|
76
|
+
counterStyle?: Record<string, CounterStyleDescriptors>;
|
|
77
|
+
/**
|
|
78
|
+
* Custom style handlers that transform style properties into CSS declarations.
|
|
79
|
+
* Handlers replace built-in handlers for the same style name.
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* handlers: {
|
|
83
|
+
* fill: ({ fill }) => fill ? { 'background-color': fill } : undefined,
|
|
84
|
+
* elevation: ({ elevation }) => ({
|
|
85
|
+
* 'box-shadow': `0 ${elevation}px ${elevation * 2}px rgba(0,0,0,0.1)`,
|
|
86
|
+
* }),
|
|
87
|
+
* }
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
handlers?: Record<string, StyleHandlerDefinition>;
|
|
91
|
+
/**
|
|
92
|
+
* Design tokens injected as CSS custom properties on `:root`.
|
|
93
|
+
* Values are parsed through the Tasty DSL. Supports state maps.
|
|
94
|
+
* @example { '$gap': '4px', '#primary': { '': '#purple', '@dark': '#light-purple' } }
|
|
95
|
+
*/
|
|
96
|
+
tokens?: ConfigTokens;
|
|
97
|
+
/**
|
|
98
|
+
* Predefined tokens replaced during style parsing (parse-time substitution).
|
|
99
|
+
* Use `$name` for custom properties and `#name` for color tokens.
|
|
100
|
+
* @example { $spacing: '2x', '#accent': '#purple' }
|
|
101
|
+
*/
|
|
102
|
+
replaceTokens?: Record<`$${string}` | `#${string}`, string | number>;
|
|
103
|
+
/**
|
|
104
|
+
* Predefined style recipes -- named style bundles that can be applied via `recipe` style property.
|
|
105
|
+
* Recipe values are flat tasty styles (no sub-element keys).
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* recipes: {
|
|
109
|
+
* card: { padding: '4x', fill: '#surface', radius: '1r', border: true },
|
|
110
|
+
* elevated: { shadow: '2x 2x 4x #shadow' },
|
|
111
|
+
* }
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
recipes?: Record<string, RecipeStyles>;
|
|
115
|
+
/**
|
|
116
|
+
* Typography presets — shorthand for `generateTypographyTokens()`.
|
|
117
|
+
* Generated tokens are merged under explicit `tokens` (tokens win on conflict).
|
|
118
|
+
* @example { h1: { fontSize: '32px', lineHeight: '1.2', fontWeight: '700' } }
|
|
119
|
+
*/
|
|
120
|
+
presets?: Record<string, TypographyPreset>;
|
|
121
|
+
/**
|
|
122
|
+
* Tasty styles applied to the `body` tag.
|
|
123
|
+
* Supports the full Tasty style syntax.
|
|
124
|
+
* @example { fill: '#surface', color: '#text', preset: 't2', margin: 0 }
|
|
125
|
+
*/
|
|
126
|
+
bodyStyles?: Styles;
|
|
127
|
+
/**
|
|
128
|
+
* Automatically infer and register CSS @property declarations from values.
|
|
129
|
+
* @default true
|
|
130
|
+
*/
|
|
131
|
+
autoPropertyTypes?: boolean;
|
|
132
|
+
}
|
|
133
|
+
interface TastyZeroBabelOptions {
|
|
134
|
+
/** Output path for generated CSS (default: 'tasty.css') */
|
|
135
|
+
output?: string;
|
|
136
|
+
/**
|
|
137
|
+
* Tasty configuration for build-time processing.
|
|
138
|
+
* Can be a static object or a factory function that returns fresh config.
|
|
139
|
+
* A factory is called on each plugin invocation, enabling hot reload
|
|
140
|
+
* of config values that depend on external files (e.g. theme tokens).
|
|
141
|
+
*/
|
|
142
|
+
config?: TastyZeroConfig | (() => TastyZeroConfig);
|
|
143
|
+
/**
|
|
144
|
+
* Absolute path to a TypeScript/JavaScript module that default-exports
|
|
145
|
+
* a `TastyZeroConfig` object. The module is loaded via jiti on each
|
|
146
|
+
* plugin invocation, enabling hot reload when the file changes.
|
|
147
|
+
*
|
|
148
|
+
* This option is JSON-serializable and is the primary way Turbopack
|
|
149
|
+
* passes config to the Babel plugin (since Turbopack loader options
|
|
150
|
+
* must be plain primitives/objects/arrays).
|
|
151
|
+
*
|
|
152
|
+
* When both `config` and `configFile` are set, `config` takes precedence.
|
|
153
|
+
*
|
|
154
|
+
* @example '/absolute/path/to/tasty-zero.config.ts'
|
|
155
|
+
*/
|
|
156
|
+
configFile?: string;
|
|
157
|
+
/**
|
|
158
|
+
* Absolute file paths whose content affects the generated CSS.
|
|
159
|
+
* When any of these files change, babel-loader invalidates its cache
|
|
160
|
+
* and re-runs the plugin with fresh config values.
|
|
161
|
+
*
|
|
162
|
+
* Typically includes theme files that define Glaze palettes or token values.
|
|
163
|
+
* Paths must be absolute (resolved by the Next.js wrapper).
|
|
164
|
+
*/
|
|
165
|
+
configDeps?: string[];
|
|
166
|
+
/**
|
|
167
|
+
* Automatically replace `@tenphi/tasty/static` imports with an import
|
|
168
|
+
* of the generated CSS file. This eliminates the need for users to
|
|
169
|
+
* manually import the CSS in their app entry point.
|
|
170
|
+
*
|
|
171
|
+
* @default true
|
|
172
|
+
*/
|
|
173
|
+
injectImport?: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Output mode for extracted CSS.
|
|
176
|
+
*
|
|
177
|
+
* - `'file'` (default): CSS is written to a single output file and
|
|
178
|
+
* the `@tenphi/tasty/static` import is rewritten to import that file.
|
|
179
|
+
* - `'inject'`: CSS is embedded inline in the JS output and injected
|
|
180
|
+
* at runtime via a tiny injector from `@tenphi/tasty/static/inject`.
|
|
181
|
+
* No CSS file is written. Each `tastyStatic` call becomes
|
|
182
|
+
* self-contained. Best for reusable components and extensions.
|
|
183
|
+
*
|
|
184
|
+
* When `mode` is `'inject'`, `output` and `injectImport` are ignored.
|
|
185
|
+
*
|
|
186
|
+
* @default 'file'
|
|
187
|
+
*/
|
|
188
|
+
mode?: 'file' | 'inject';
|
|
189
|
+
}
|
|
190
|
+
/** Clear the shared CSSWriter cache. Exposed for testing. */
|
|
191
|
+
declare function clearWriterCache(): void;
|
|
192
|
+
declare const _default: (api: object, options: TastyZeroBabelOptions | null | undefined, dirname: string) => _$_babel_core0.PluginObj<PluginPass>;
|
|
193
|
+
//#endregion
|
|
194
|
+
export { TastyZeroBabelOptions, TastyZeroConfig, clearWriterCache, _default as default };
|
|
195
|
+
//# sourceMappingURL=babel.d.ts.map
|