@tenphi/tasty 0.0.0-snapshot.01d8a9e
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 +336 -0
- package/dist/compute-styles.js.map +1 -0
- package/dist/config.d.ts +407 -0
- package/dist/config.js +591 -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 +65 -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 +55 -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 +198 -0
- package/dist/injector/injector.js +651 -0
- package/dist/injector/injector.js.map +1 -0
- package/dist/injector/sheet-manager.d.ts +132 -0
- package/dist/injector/sheet-manager.js +699 -0
- package/dist/injector/sheet-manager.js.map +1 -0
- package/dist/injector/types.d.ts +235 -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 +283 -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 +1157 -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 +690 -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 +79 -0
- package/dist/rsc-cache.js.map +1 -0
- package/dist/ssr/astro-client.d.ts +1 -0
- package/dist/ssr/astro-client.js +19 -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 +108 -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 +94 -0
- package/dist/ssr/collector.js +233 -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 +29 -0
- package/dist/ssr/hydrate.js +45 -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 +46 -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 +248 -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 +81 -0
- package/dist/zero/babel.js +462 -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 +394 -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 +442 -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,45 @@
|
|
|
1
|
+
//#region src/utils/filter-base-props.ts
|
|
2
|
+
const DOMPropNames = new Set(["id"]);
|
|
3
|
+
const BasePropNames = new Set([
|
|
4
|
+
"role",
|
|
5
|
+
"as",
|
|
6
|
+
"element",
|
|
7
|
+
"css",
|
|
8
|
+
"qa",
|
|
9
|
+
"mods",
|
|
10
|
+
"qaVal",
|
|
11
|
+
"hidden",
|
|
12
|
+
"isHidden",
|
|
13
|
+
"disabled",
|
|
14
|
+
"isDisabled",
|
|
15
|
+
"children",
|
|
16
|
+
"style",
|
|
17
|
+
"className",
|
|
18
|
+
"href",
|
|
19
|
+
"target",
|
|
20
|
+
"tabIndex"
|
|
21
|
+
]);
|
|
22
|
+
const ignoreEventPropsNames = new Set([
|
|
23
|
+
"onPress",
|
|
24
|
+
"onHoverStart",
|
|
25
|
+
"onHoverEnd",
|
|
26
|
+
"onPressStart",
|
|
27
|
+
"onPressEnd"
|
|
28
|
+
]);
|
|
29
|
+
const propRe = /^((data-).*)$/;
|
|
30
|
+
const eventRe = /^on[A-Z].+$/;
|
|
31
|
+
/**
|
|
32
|
+
* Filters out all props that aren't valid DOM props or defined via override prop obj.
|
|
33
|
+
* @param props - The component props to be filtered.
|
|
34
|
+
* @param opts - Props to override.
|
|
35
|
+
*/
|
|
36
|
+
function filterBaseProps(props, opts = {}) {
|
|
37
|
+
const { propNames, eventProps } = opts;
|
|
38
|
+
const filteredProps = {};
|
|
39
|
+
for (const prop in props) if (Object.prototype.hasOwnProperty.call(props, prop) && (DOMPropNames.has(prop) || BasePropNames.has(prop) || prop.startsWith("aria-") || eventProps && eventRe.test(prop) && !ignoreEventPropsNames.has(prop) || propNames?.has(prop) || propRe.test(prop))) filteredProps[prop] = props[prop];
|
|
40
|
+
return filteredProps;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { filterBaseProps };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=filter-base-props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-base-props.js","names":[],"sources":["../../src/utils/filter-base-props.ts"],"sourcesContent":["const DOMPropNames = new Set(['id']);\n\nconst BasePropNames = new Set([\n 'role',\n 'as',\n 'element',\n 'css',\n 'qa',\n 'mods',\n 'qaVal',\n 'hidden',\n 'isHidden',\n 'disabled',\n 'isDisabled',\n 'children',\n 'style',\n 'className',\n 'href',\n 'target',\n 'tabIndex',\n]);\n\nconst ignoreEventPropsNames = new Set([\n 'onPress',\n 'onHoverStart',\n 'onHoverEnd',\n 'onPressStart',\n 'onPressEnd',\n]);\n\nconst propRe = /^((data-).*)$/;\nconst eventRe = /^on[A-Z].+$/;\n\ninterface PropsFilterOptions {\n // @deprecated\n labelable?: boolean;\n propNames?: Set<string>;\n eventProps?: boolean;\n}\n\n/**\n * Filters out all props that aren't valid DOM props or defined via override prop obj.\n * @param props - The component props to be filtered.\n * @param opts - Props to override.\n */\nexport function filterBaseProps<T extends object>(\n props: T,\n opts: PropsFilterOptions = {},\n): Partial<T> {\n const { propNames, eventProps } = opts;\n const filteredProps: Partial<T> = {};\n\n for (const prop in props) {\n if (\n Object.prototype.hasOwnProperty.call(props, prop) &&\n (DOMPropNames.has(prop) ||\n BasePropNames.has(prop) ||\n // Always preserve any ARIA attributes to maintain accessibility support.\n prop.startsWith('aria-') ||\n (eventProps &&\n eventRe.test(prop) &&\n !ignoreEventPropsNames.has(prop)) ||\n propNames?.has(prop) ||\n propRe.test(prop))\n ) {\n filteredProps[prop] = props[prop];\n }\n }\n\n return filteredProps;\n}\n"],"mappings":";AAAA,MAAM,eAAe,IAAI,IAAI,CAAC,KAAK,CAAC;AAEpC,MAAM,gBAAgB,IAAI,IAAI;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAEF,MAAM,wBAAwB,IAAI,IAAI;CACpC;CACA;CACA;CACA;CACA;CACD,CAAC;AAEF,MAAM,SAAS;AACf,MAAM,UAAU;;;;;;AAchB,SAAgB,gBACd,OACA,OAA2B,EAAE,EACjB;CACZ,MAAM,EAAE,WAAW,eAAe;CAClC,MAAM,gBAA4B,EAAE;AAEpC,MAAK,MAAM,QAAQ,MACjB,KACE,OAAO,UAAU,eAAe,KAAK,OAAO,KAAK,KAChD,aAAa,IAAI,KAAK,IACrB,cAAc,IAAI,KAAK,IAEvB,KAAK,WAAW,QAAQ,IACvB,cACC,QAAQ,KAAK,KAAK,IAClB,CAAC,sBAAsB,IAAI,KAAK,IAClC,WAAW,IAAI,KAAK,IACpB,OAAO,KAAK,KAAK,EAEnB,eAAc,QAAQ,MAAM;AAIhC,QAAO"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ElementType } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/get-display-name.d.ts
|
|
4
|
+
declare function getDisplayName<T>(Component: ElementType<T>, fallbackName?: string): string;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { getDisplayName };
|
|
7
|
+
//# sourceMappingURL=get-display-name.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/utils/get-display-name.ts
|
|
2
|
+
const DEFAULT_NAME = "Anonymous";
|
|
3
|
+
function getDisplayName(Component, fallbackName = DEFAULT_NAME) {
|
|
4
|
+
if (typeof Component === "function") return Component.displayName ?? Component.name ?? fallbackName;
|
|
5
|
+
return fallbackName;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { getDisplayName };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=get-display-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-display-name.js","names":[],"sources":["../../src/utils/get-display-name.ts"],"sourcesContent":["import type { ElementType } from 'react';\n\nconst DEFAULT_NAME = 'Anonymous';\n\nexport function getDisplayName<T>(\n Component: ElementType<T>,\n fallbackName = DEFAULT_NAME,\n): string {\n if (typeof Component === 'function') {\n return Component.displayName ?? Component.name ?? fallbackName;\n }\n\n return fallbackName;\n}\n"],"mappings":";AAEA,MAAM,eAAe;AAErB,SAAgB,eACd,WACA,eAAe,cACP;AACR,KAAI,OAAO,cAAc,WACvB,QAAO,UAAU,eAAe,UAAU,QAAQ;AAGpD,QAAO"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/utils/has-keys.ts
|
|
2
|
+
/**
|
|
3
|
+
* Check if an object has any own enumerable keys.
|
|
4
|
+
* Avoids the array allocation of Object.keys(obj).length > 0.
|
|
5
|
+
*/
|
|
6
|
+
function hasKeys(obj) {
|
|
7
|
+
for (const _ in obj) return true;
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { hasKeys };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=has-keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-keys.js","names":[],"sources":["../../src/utils/has-keys.ts"],"sourcesContent":["/**\n * Check if an object has any own enumerable keys.\n * Avoids the array allocation of Object.keys(obj).length > 0.\n */\nexport function hasKeys(obj: object): boolean {\n for (const _ in obj) return true;\n return false;\n}\n"],"mappings":";;;;;AAIA,SAAgB,QAAQ,KAAsB;AAC5C,MAAK,MAAM,KAAK,IAAK,QAAO;AAC5B,QAAO"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/utils/hash.ts
|
|
2
|
+
/**
|
|
3
|
+
* Fast string hash (djb2) for deduplication keys.
|
|
4
|
+
* Not cryptographic — just collision-resistant enough for cache keys.
|
|
5
|
+
*/
|
|
6
|
+
function hashString(str) {
|
|
7
|
+
let hash = 5381;
|
|
8
|
+
for (let i = 0; i < str.length; i++) hash = (hash << 5) + hash + str.charCodeAt(i) | 0;
|
|
9
|
+
return (hash >>> 0).toString(36);
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { hashString };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=hash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.js","names":[],"sources":["../../src/utils/hash.ts"],"sourcesContent":["/**\n * Fast string hash (djb2) for deduplication keys.\n * Not cryptographic — just collision-resistant enough for cache keys.\n */\nexport function hashString(str: string): string {\n let hash = 5381;\n for (let i = 0; i < str.length; i++) {\n hash = ((hash << 5) + hash + str.charCodeAt(i)) | 0;\n }\n return (hash >>> 0).toString(36);\n}\n"],"mappings":";;;;;AAIA,SAAgB,WAAW,KAAqB;CAC9C,IAAI,OAAO;AACX,MAAK,IAAI,IAAI,GAAG,IAAI,IAAI,QAAQ,IAC9B,SAAS,QAAQ,KAAK,OAAO,IAAI,WAAW,EAAE,GAAI;AAEpD,SAAQ,SAAS,GAAG,SAAS,GAAG"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/utils/is-dev-env.ts
|
|
2
|
+
/**
|
|
3
|
+
* Check if we're in a development environment at runtime
|
|
4
|
+
* Uses bracket notation to avoid bundler compilation
|
|
5
|
+
* Also checks for TASTY_DEBUG localStorage setting
|
|
6
|
+
*/
|
|
7
|
+
function isDevEnv() {
|
|
8
|
+
if (typeof window !== "undefined" && window.localStorage) try {
|
|
9
|
+
const forceTastyDebug = window.localStorage.getItem("TASTY_DEBUG");
|
|
10
|
+
if (forceTastyDebug !== null && forceTastyDebug.toLowerCase() === "true") return true;
|
|
11
|
+
} catch {}
|
|
12
|
+
if (typeof process === "undefined") return false;
|
|
13
|
+
const nodeEnv = "development";
|
|
14
|
+
return nodeEnv !== "test" && nodeEnv !== "production";
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { isDevEnv };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=is-dev-env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-dev-env.js","names":[],"sources":["../../src/utils/is-dev-env.ts"],"sourcesContent":["/**\n * Check if we're in a development environment at runtime\n * Uses bracket notation to avoid bundler compilation\n * Also checks for TASTY_DEBUG localStorage setting\n */\nexport function isDevEnv(): boolean {\n // Check localStorage for DEBUG_TASTY setting (browser environment)\n if (typeof window !== 'undefined' && window.localStorage) {\n try {\n const forceTastyDebug = window.localStorage.getItem('TASTY_DEBUG');\n if (\n forceTastyDebug !== null &&\n forceTastyDebug.toLowerCase() === 'true'\n ) {\n return true;\n }\n } catch {\n // localStorage might not be available (private browsing, etc.)\n // Continue with other checks\n }\n }\n\n // Check NODE_ENV for Node.js environments\n if (typeof process === 'undefined') return false;\n\n // Use bracket notation to avoid bundler replacement\n const nodeEnv = process.env?.['NODE_ENV'];\n return nodeEnv !== 'test' && nodeEnv !== 'production';\n}\n"],"mappings":";;;;;;AAKA,SAAgB,WAAoB;AAElC,KAAI,OAAO,WAAW,eAAe,OAAO,aAC1C,KAAI;EACF,MAAM,kBAAkB,OAAO,aAAa,QAAQ,cAAc;AAClE,MACE,oBAAoB,QACpB,gBAAgB,aAAa,KAAK,OAElC,QAAO;SAEH;AAOV,KAAI,OAAO,YAAY,YAAa,QAAO;CAG3C,MAAM,UAAA;AACN,QAAO,YAAY,UAAU,YAAY"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/utils/is-valid-element-type.ts
|
|
2
|
+
/**
|
|
3
|
+
* Lightweight replacement for `react-is`'s isValidElementType.
|
|
4
|
+
* Detects string tags, function/class components, and React exotic types
|
|
5
|
+
* (forwardRef, memo, lazy, etc.) via their internal $$typeof symbol.
|
|
6
|
+
*/
|
|
7
|
+
function isValidElementType(value) {
|
|
8
|
+
if (typeof value === "string" || typeof value === "function") return true;
|
|
9
|
+
if (typeof value === "object" && value !== null) return typeof value.$$typeof === "symbol";
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { isValidElementType };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=is-valid-element-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-valid-element-type.js","names":[],"sources":["../../src/utils/is-valid-element-type.ts"],"sourcesContent":["/**\n * Lightweight replacement for `react-is`'s isValidElementType.\n * Detects string tags, function/class components, and React exotic types\n * (forwardRef, memo, lazy, etc.) via their internal $$typeof symbol.\n */\nexport function isValidElementType(value: unknown): boolean {\n if (typeof value === 'string' || typeof value === 'function') {\n return true;\n }\n\n if (typeof value === 'object' && value !== null) {\n return typeof (value as { $$typeof?: unknown }).$$typeof === 'symbol';\n }\n\n return false;\n}\n"],"mappings":";;;;;;AAKA,SAAgB,mBAAmB,OAAyB;AAC1D,KAAI,OAAO,UAAU,YAAY,OAAO,UAAU,WAChD,QAAO;AAGT,KAAI,OAAO,UAAU,YAAY,UAAU,KACzC,QAAO,OAAQ,MAAiC,aAAa;AAG/D,QAAO"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { isDevEnv } from "./is-dev-env.js";
|
|
2
|
+
import { isSelector } from "../pipeline/index.js";
|
|
3
|
+
//#region src/utils/merge-styles.ts
|
|
4
|
+
const devMode = isDevEnv();
|
|
5
|
+
const INHERIT_VALUE = "@inherit";
|
|
6
|
+
/**
|
|
7
|
+
* Check if a value is a state map (object, not array).
|
|
8
|
+
*/
|
|
9
|
+
function isStateMap(value) {
|
|
10
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Normalize a parent value to a state map.
|
|
14
|
+
* - Already a state map → return as-is
|
|
15
|
+
* - Non-null, non-false primitive → wrap as `{ '': value }`
|
|
16
|
+
* - null / undefined / false → return null (no parent to merge with)
|
|
17
|
+
*/
|
|
18
|
+
function normalizeToStateMap(value) {
|
|
19
|
+
if (isStateMap(value)) return value;
|
|
20
|
+
if (value != null && value !== false) return { "": value };
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Resolve a child state map against a parent value.
|
|
25
|
+
*
|
|
26
|
+
* Mode is determined by whether the child contains a `''` (default) key:
|
|
27
|
+
* - No `''` → extend mode: parent entries preserved, child adds/overrides/repositions
|
|
28
|
+
* - Has `''` → replace mode: child defines everything, `@inherit` cherry-picks from parent
|
|
29
|
+
*
|
|
30
|
+
* In both modes:
|
|
31
|
+
* - `@inherit` value → resolve from parent state map
|
|
32
|
+
* - `null` value → remove this state from the result
|
|
33
|
+
* - `false` value → tombstone, persists through all layers, blocks recipe
|
|
34
|
+
*/
|
|
35
|
+
function resolveStateMap(parentValue, childMap) {
|
|
36
|
+
const isExtend = !("" in childMap);
|
|
37
|
+
const parentMap = normalizeToStateMap(parentValue);
|
|
38
|
+
if (!parentMap) {
|
|
39
|
+
const result = {};
|
|
40
|
+
for (const key of Object.keys(childMap)) {
|
|
41
|
+
const val = childMap[key];
|
|
42
|
+
if (val === null || val === INHERIT_VALUE) continue;
|
|
43
|
+
result[key] = val;
|
|
44
|
+
}
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
if (isExtend) return resolveExtendMode(parentMap, childMap);
|
|
48
|
+
return resolveReplaceMode(parentMap, childMap);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Extend mode: parent entries are preserved, child entries add/override/reposition.
|
|
52
|
+
*/
|
|
53
|
+
function resolveExtendMode(parentMap, childMap) {
|
|
54
|
+
const inheritKeys = /* @__PURE__ */ new Set();
|
|
55
|
+
const removeKeys = /* @__PURE__ */ new Set();
|
|
56
|
+
const overrideKeys = /* @__PURE__ */ new Map();
|
|
57
|
+
for (const key of Object.keys(childMap)) {
|
|
58
|
+
const val = childMap[key];
|
|
59
|
+
if (val === INHERIT_VALUE) {
|
|
60
|
+
if (key in parentMap) inheritKeys.add(key);
|
|
61
|
+
else if (devMode) console.warn(`[Tasty] @inherit used for state '${key}' that does not exist in the parent style map. Entry skipped.`);
|
|
62
|
+
} else if (val === null) removeKeys.add(key);
|
|
63
|
+
else if (key in parentMap) overrideKeys.set(key, val);
|
|
64
|
+
}
|
|
65
|
+
const result = {};
|
|
66
|
+
for (const key of Object.keys(parentMap)) {
|
|
67
|
+
if (removeKeys.has(key)) continue;
|
|
68
|
+
if (inheritKeys.has(key)) continue;
|
|
69
|
+
if (overrideKeys.has(key)) result[key] = overrideKeys.get(key);
|
|
70
|
+
else result[key] = parentMap[key];
|
|
71
|
+
}
|
|
72
|
+
for (const key of Object.keys(childMap)) if (inheritKeys.has(key)) result[key] = parentMap[key];
|
|
73
|
+
else if (!removeKeys.has(key) && !overrideKeys.has(key) && childMap[key] !== INHERIT_VALUE) result[key] = childMap[key];
|
|
74
|
+
return result;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Replace mode: child entries define the result, `@inherit` pulls from parent.
|
|
78
|
+
*/
|
|
79
|
+
function resolveReplaceMode(parentMap, childMap) {
|
|
80
|
+
const result = {};
|
|
81
|
+
for (const key of Object.keys(childMap)) {
|
|
82
|
+
const val = childMap[key];
|
|
83
|
+
if (val === INHERIT_VALUE) {
|
|
84
|
+
if (key in parentMap) result[key] = parentMap[key];
|
|
85
|
+
else if (devMode) console.warn(`[Tasty] @inherit used for state '${key}' that does not exist in the parent style map. Entry skipped.`);
|
|
86
|
+
} else if (val !== null) result[key] = val;
|
|
87
|
+
}
|
|
88
|
+
return result;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Merge sub-element properties with state map / null / undefined support.
|
|
92
|
+
*/
|
|
93
|
+
function mergeSubElementStyles(parentSub, childSub) {
|
|
94
|
+
const parent = parentSub;
|
|
95
|
+
const child = childSub;
|
|
96
|
+
const merged = {
|
|
97
|
+
...parent,
|
|
98
|
+
...child
|
|
99
|
+
};
|
|
100
|
+
for (const key of Object.keys(child)) {
|
|
101
|
+
const val = child[key];
|
|
102
|
+
if (val === void 0) {
|
|
103
|
+
if (parent && key in parent) merged[key] = parent[key];
|
|
104
|
+
} else if (val === null) delete merged[key];
|
|
105
|
+
else if (isStateMap(val)) merged[key] = resolveStateMap(parent ? parent[key] : void 0, val);
|
|
106
|
+
}
|
|
107
|
+
return merged;
|
|
108
|
+
}
|
|
109
|
+
function mergeStyles(...objects) {
|
|
110
|
+
let styles = objects[0] ? { ...objects[0] } : {};
|
|
111
|
+
let pos = 1;
|
|
112
|
+
while (pos in objects) {
|
|
113
|
+
const selectorKeys = Object.keys(styles).filter((key) => isSelector(key) && styles[key]);
|
|
114
|
+
const newStyles = objects[pos];
|
|
115
|
+
if (newStyles) {
|
|
116
|
+
const resultStyles = {
|
|
117
|
+
...styles,
|
|
118
|
+
...newStyles
|
|
119
|
+
};
|
|
120
|
+
const newSelectorKeys = Object.keys(newStyles).filter(isSelector);
|
|
121
|
+
const allSelectorKeys = new Set([...selectorKeys, ...newSelectorKeys]);
|
|
122
|
+
for (const key of allSelectorKeys) {
|
|
123
|
+
const newValue = newStyles?.[key];
|
|
124
|
+
if (newValue === false || newValue === null) delete resultStyles[key];
|
|
125
|
+
else if (newValue === void 0) resultStyles[key] = styles[key];
|
|
126
|
+
else if (newValue) resultStyles[key] = mergeSubElementStyles(styles[key], newValue);
|
|
127
|
+
}
|
|
128
|
+
for (const key of Object.keys(newStyles)) {
|
|
129
|
+
if (isSelector(key)) continue;
|
|
130
|
+
const newValue = newStyles[key];
|
|
131
|
+
if (newValue === void 0) if (key in styles) resultStyles[key] = styles[key];
|
|
132
|
+
else delete resultStyles[key];
|
|
133
|
+
else if (newValue === null) delete resultStyles[key];
|
|
134
|
+
else if (isStateMap(newValue)) resultStyles[key] = resolveStateMap(styles[key], newValue);
|
|
135
|
+
}
|
|
136
|
+
styles = resultStyles;
|
|
137
|
+
}
|
|
138
|
+
pos++;
|
|
139
|
+
}
|
|
140
|
+
return styles;
|
|
141
|
+
}
|
|
142
|
+
//#endregion
|
|
143
|
+
export { mergeStyles };
|
|
144
|
+
|
|
145
|
+
//# sourceMappingURL=merge-styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-styles.js","names":[],"sources":["../../src/utils/merge-styles.ts"],"sourcesContent":["import { isSelector } from '../pipeline';\nimport type { Styles, StylesWithoutSelectors } from '../styles/types';\n\nimport { isDevEnv } from './is-dev-env';\n\nconst devMode = isDevEnv();\n\nconst INHERIT_VALUE = '@inherit';\n\n/**\n * Check if a value is a state map (object, not array).\n */\nfunction isStateMap(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * Normalize a parent value to a state map.\n * - Already a state map → return as-is\n * - Non-null, non-false primitive → wrap as `{ '': value }`\n * - null / undefined / false → return null (no parent to merge with)\n */\nfunction normalizeToStateMap(value: unknown): Record<string, unknown> | null {\n if (isStateMap(value)) return value as Record<string, unknown>;\n if (value != null && value !== false) return { '': value };\n return null;\n}\n\n/**\n * Resolve a child state map against a parent value.\n *\n * Mode is determined by whether the child contains a `''` (default) key:\n * - No `''` → extend mode: parent entries preserved, child adds/overrides/repositions\n * - Has `''` → replace mode: child defines everything, `@inherit` cherry-picks from parent\n *\n * In both modes:\n * - `@inherit` value → resolve from parent state map\n * - `null` value → remove this state from the result\n * - `false` value → tombstone, persists through all layers, blocks recipe\n */\nfunction resolveStateMap(\n parentValue: unknown,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const isExtend = !('' in childMap);\n const parentMap = normalizeToStateMap(parentValue);\n\n if (!parentMap) {\n // No parent to merge with — strip nulls and @inherit, return child entries\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === null || val === INHERIT_VALUE) continue;\n result[key] = val;\n }\n return result;\n }\n\n if (isExtend) {\n return resolveExtendMode(parentMap, childMap);\n }\n\n return resolveReplaceMode(parentMap, childMap);\n}\n\n/**\n * Extend mode: parent entries are preserved, child entries add/override/reposition.\n */\nfunction resolveExtendMode(\n parentMap: Record<string, unknown>,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const inheritKeys = new Set<string>();\n const removeKeys = new Set<string>();\n const overrideKeys = new Map<string, unknown>();\n\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === INHERIT_VALUE) {\n if (key in parentMap) {\n inheritKeys.add(key);\n } else if (devMode) {\n console.warn(\n `[Tasty] @inherit used for state '${key}' that does not exist in the parent style map. Entry skipped.`,\n );\n }\n } else if (val === null) {\n removeKeys.add(key);\n } else if (key in parentMap) {\n overrideKeys.set(key, val);\n }\n }\n\n // 1. Parent entries in order (skip removed, skip repositioned, apply overrides)\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(parentMap)) {\n if (removeKeys.has(key)) continue;\n if (inheritKeys.has(key)) continue;\n if (overrideKeys.has(key)) {\n result[key] = overrideKeys.get(key);\n } else {\n result[key] = parentMap[key];\n }\n }\n\n // 2. Append new + repositioned entries in child declaration order\n for (const key of Object.keys(childMap)) {\n if (inheritKeys.has(key)) {\n result[key] = parentMap[key];\n } else if (\n !removeKeys.has(key) &&\n !overrideKeys.has(key) &&\n // Skip @inherit for keys that weren't in the parent (already warned above)\n childMap[key] !== INHERIT_VALUE\n ) {\n result[key] = childMap[key];\n }\n }\n\n return result;\n}\n\n/**\n * Replace mode: child entries define the result, `@inherit` pulls from parent.\n */\nfunction resolveReplaceMode(\n parentMap: Record<string, unknown>,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === INHERIT_VALUE) {\n if (key in parentMap) {\n result[key] = parentMap[key];\n } else if (devMode) {\n console.warn(\n `[Tasty] @inherit used for state '${key}' that does not exist in the parent style map. Entry skipped.`,\n );\n }\n } else if (val !== null) {\n result[key] = val;\n }\n }\n\n return result;\n}\n\n/**\n * Merge sub-element properties with state map / null / undefined support.\n */\nfunction mergeSubElementStyles(\n parentSub: StylesWithoutSelectors | undefined,\n childSub: StylesWithoutSelectors,\n): StylesWithoutSelectors {\n const parent = parentSub as Record<string, unknown> | undefined;\n const child = childSub as Record<string, unknown>;\n const merged: Record<string, unknown> = { ...parent, ...child };\n\n for (const key of Object.keys(child)) {\n const val = child[key];\n\n if (val === undefined) {\n if (parent && key in parent) {\n merged[key] = parent[key];\n }\n } else if (val === null) {\n delete merged[key];\n } else if (isStateMap(val)) {\n merged[key] = resolveStateMap(\n parent ? parent[key] : undefined,\n val as Record<string, unknown>,\n );\n }\n }\n\n return merged as StylesWithoutSelectors;\n}\n\nexport function mergeStyles(...objects: (Styles | undefined | null)[]): Styles {\n let styles: Styles = objects[0] ? { ...objects[0] } : {};\n let pos = 1;\n\n while (pos in objects) {\n const selectorKeys = Object.keys(styles).filter(\n (key) => isSelector(key) && styles[key],\n );\n const newStyles = objects[pos];\n\n if (newStyles) {\n const resultStyles = { ...styles, ...newStyles };\n\n // Collect all selector keys from both parent and child\n const newSelectorKeys = Object.keys(newStyles).filter(isSelector);\n const allSelectorKeys = new Set([...selectorKeys, ...newSelectorKeys]);\n\n for (const key of allSelectorKeys) {\n const newValue = newStyles?.[key];\n\n if (newValue === false || newValue === null) {\n delete resultStyles[key];\n } else if (newValue === undefined) {\n resultStyles[key] = styles[key];\n } else if (newValue) {\n resultStyles[key] = mergeSubElementStyles(\n styles[key] as StylesWithoutSelectors,\n newValue as StylesWithoutSelectors,\n );\n }\n }\n\n // Handle non-selector properties: state maps, null, undefined\n for (const key of Object.keys(newStyles)) {\n if (isSelector(key)) continue;\n\n const newValue = newStyles[key];\n\n if (newValue === undefined) {\n if (key in styles) {\n resultStyles[key] = styles[key];\n } else {\n delete resultStyles[key];\n }\n } else if (newValue === null) {\n delete resultStyles[key];\n } else if (isStateMap(newValue)) {\n (resultStyles as Record<string, unknown>)[key] = resolveStateMap(\n styles[key],\n newValue as Record<string, unknown>,\n );\n }\n }\n\n styles = resultStyles;\n }\n\n pos++;\n }\n\n return styles;\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ModValue } from "../types.js";
|
|
2
|
+
//#region src/utils/mod-attrs.d.ts
|
|
3
|
+
declare const _modAttrs: (firstArg: Record<string, ModValue> | undefined, secondArg?: unknown) => Record<string, string> | null;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { _modAttrs };
|
|
6
|
+
//# sourceMappingURL=mod-attrs.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { camelToKebab } from "./case-converter.js";
|
|
2
|
+
import { cacheWrapper } from "./cache-wrapper.js";
|
|
3
|
+
//#region src/utils/mod-attrs.ts
|
|
4
|
+
function modAttrs(map) {
|
|
5
|
+
return map ? Object.keys(map).reduce((attrs, key) => {
|
|
6
|
+
const value = map[key];
|
|
7
|
+
if (value == null || value === false) return attrs;
|
|
8
|
+
const attrName = `data-${camelToKebab(key)}`;
|
|
9
|
+
if (value === true) attrs[attrName] = "";
|
|
10
|
+
else if (typeof value === "string") attrs[attrName] = value;
|
|
11
|
+
else if (typeof value === "number") attrs[attrName] = String(value);
|
|
12
|
+
else console.warn(`Tasty: Invalid mod value for "${key}". Expected boolean, string, or number, got ${typeof value}`);
|
|
13
|
+
return attrs;
|
|
14
|
+
}, {}) : null;
|
|
15
|
+
}
|
|
16
|
+
const _modAttrs = cacheWrapper(modAttrs);
|
|
17
|
+
//#endregion
|
|
18
|
+
export { _modAttrs };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=mod-attrs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod-attrs.js","names":[],"sources":["../../src/utils/mod-attrs.ts"],"sourcesContent":["/**\n * Generate data DOM attributes from modifier map.\n */\nimport type { AllBaseProps } from '../types';\n\nimport { cacheWrapper } from './cache-wrapper';\nimport { camelToKebab } from './case-converter';\n\nfunction modAttrs(map: AllBaseProps['mods']): Record<string, string> | null {\n return map\n ? Object.keys(map).reduce(\n (attrs, key) => {\n const value = map[key];\n\n // Skip null, undefined, false\n if (value == null || value === false) {\n return attrs;\n }\n\n const attrName = `data-${camelToKebab(key)}`;\n\n if (value === true) {\n // Boolean true: data-{name}=\"\"\n attrs[attrName] = '';\n } else if (typeof value === 'string') {\n // String value: data-{name}=\"value\"\n attrs[attrName] = value;\n } else if (typeof value === 'number') {\n // Number: convert to string\n attrs[attrName] = String(value);\n } else {\n // Reject other types (objects, arrays, functions)\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Tasty: Invalid mod value for \"${key}\". Expected boolean, string, or number, got ${typeof value}`,\n );\n }\n }\n\n return attrs;\n },\n {} as Record<string, string>,\n )\n : null;\n}\n\nconst _modAttrs = cacheWrapper(modAttrs);\n\nexport { _modAttrs as modAttrs };\n"],"mappings":";;;AAQA,SAAS,SAAS,KAA0D;AAC1E,QAAO,MACH,OAAO,KAAK,IAAI,CAAC,QACd,OAAO,QAAQ;EACd,MAAM,QAAQ,IAAI;AAGlB,MAAI,SAAS,QAAQ,UAAU,MAC7B,QAAO;EAGT,MAAM,WAAW,QAAQ,aAAa,IAAI;AAE1C,MAAI,UAAU,KAEZ,OAAM,YAAY;WACT,OAAO,UAAU,SAE1B,OAAM,YAAY;WACT,OAAO,UAAU,SAE1B,OAAM,YAAY,OAAO,MAAM;MAI7B,SAAQ,KACN,iCAAiC,IAAI,8CAA8C,OAAO,QAC3F;AAIL,SAAO;IAET,EAAE,CACH,GACD;;AAGN,MAAM,YAAY,aAAa,SAAS"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CSSProperties } from "./css-types.js";
|
|
2
|
+
import { hslToRgbValues } from "./color-math.js";
|
|
3
|
+
import { Tokens } from "../types.js";
|
|
4
|
+
|
|
5
|
+
//#region src/utils/process-tokens.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Process tokens object into inline style properties.
|
|
8
|
+
* - $name -> --name with parsed value
|
|
9
|
+
* - #name -> --name-color AND --name-color-{colorSpace} with parsed values
|
|
10
|
+
*
|
|
11
|
+
* @param tokens - The tokens object to process
|
|
12
|
+
* @returns CSSProperties object or undefined if no tokens to process
|
|
13
|
+
*/
|
|
14
|
+
declare function processTokens(tokens: Tokens | undefined): CSSProperties | undefined;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { processTokens };
|
|
17
|
+
//# sourceMappingURL=process-tokens.d.ts.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import "./color-math.js";
|
|
2
|
+
import { getColorSpaceComponents, getColorSpaceSuffix } from "./color-space.js";
|
|
3
|
+
import { normalizeColorTokenValue, parseStyle } from "./styles.js";
|
|
4
|
+
//#region src/utils/process-tokens.ts
|
|
5
|
+
/**
|
|
6
|
+
* Extract color components in the configured color space.
|
|
7
|
+
* Returns a CSS variable reference for token colors, or decomposed
|
|
8
|
+
* components as a space-separated string.
|
|
9
|
+
*/
|
|
10
|
+
function extractColorSpaceValue(colorValue, parsedOutput) {
|
|
11
|
+
const suffix = getColorSpaceSuffix();
|
|
12
|
+
const varMatch = parsedOutput.match(/var\(--([a-z0-9-]+)-color\)/);
|
|
13
|
+
if (varMatch) return `var(--${varMatch[1]}-color-${suffix})`;
|
|
14
|
+
const components = getColorSpaceComponents(colorValue);
|
|
15
|
+
if (components !== colorValue) return components;
|
|
16
|
+
const componentsFromParsed = getColorSpaceComponents(parsedOutput);
|
|
17
|
+
if (componentsFromParsed !== parsedOutput) return componentsFromParsed;
|
|
18
|
+
return parsedOutput;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Check if a value is a valid token value (string, number, or boolean - not object).
|
|
22
|
+
* Returns false for `false` values (they mean "skip this token").
|
|
23
|
+
*/
|
|
24
|
+
function isValidTokenValue(value) {
|
|
25
|
+
if (value === void 0 || value === null || value === false) return false;
|
|
26
|
+
if (typeof value === "object") {
|
|
27
|
+
console.warn("Tasty: Object values are not allowed in tokens prop. Tokens do not support state-based styling. Use a primitive value instead.");
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Process a single token value through the tasty parser.
|
|
34
|
+
* Numbers are converted to strings; 0 stays as "0".
|
|
35
|
+
*/
|
|
36
|
+
function processTokenValue(value) {
|
|
37
|
+
if (typeof value === "number") {
|
|
38
|
+
if (value === 0) return "0";
|
|
39
|
+
return parseStyle(String(value)).output;
|
|
40
|
+
}
|
|
41
|
+
return parseStyle(value).output;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Process tokens object into inline style properties.
|
|
45
|
+
* - $name -> --name with parsed value
|
|
46
|
+
* - #name -> --name-color AND --name-color-{colorSpace} with parsed values
|
|
47
|
+
*
|
|
48
|
+
* @param tokens - The tokens object to process
|
|
49
|
+
* @returns CSSProperties object or undefined if no tokens to process
|
|
50
|
+
*/
|
|
51
|
+
function processTokens(tokens) {
|
|
52
|
+
if (!tokens) return;
|
|
53
|
+
const keys = Object.keys(tokens);
|
|
54
|
+
if (keys.length === 0) return;
|
|
55
|
+
let result;
|
|
56
|
+
for (const key of keys) {
|
|
57
|
+
const value = tokens[key];
|
|
58
|
+
if (!isValidTokenValue(value)) continue;
|
|
59
|
+
if (key.startsWith("$")) {
|
|
60
|
+
const propName = `--${key.slice(1)}`;
|
|
61
|
+
const processedValue = processTokenValue(value === true ? "" : value);
|
|
62
|
+
if (!result) result = {};
|
|
63
|
+
result[propName] = processedValue;
|
|
64
|
+
} else if (key.startsWith("#")) {
|
|
65
|
+
const colorName = key.slice(1);
|
|
66
|
+
const suffix = getColorSpaceSuffix();
|
|
67
|
+
const effectiveValue = normalizeColorTokenValue(value);
|
|
68
|
+
if (effectiveValue === null) continue;
|
|
69
|
+
const originalValue = typeof effectiveValue === "number" ? String(effectiveValue) : effectiveValue;
|
|
70
|
+
const lowerValue = originalValue.toLowerCase();
|
|
71
|
+
const processedValue = processTokenValue(effectiveValue);
|
|
72
|
+
if (!result) result = {};
|
|
73
|
+
result[`--${colorName}-color`] = processedValue;
|
|
74
|
+
if (/^#current(?:\.|$)/i.test(lowerValue)) continue;
|
|
75
|
+
result[`--${colorName}-color-${suffix}`] = extractColorSpaceValue(originalValue, processedValue);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
export { processTokens };
|
|
82
|
+
|
|
83
|
+
//# sourceMappingURL=process-tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-tokens.js","names":[],"sources":["../../src/utils/process-tokens.ts"],"sourcesContent":["import type { Tokens, TokenValue } from '../types';\n\nimport type { CSSProperties } from './css-types';\n\nimport { getColorSpaceComponents, getColorSpaceSuffix } from './color-space';\nimport { normalizeColorTokenValue, parseStyle } from './styles';\n\nexport { hslToRgbValues } from './color-math';\n\nconst devMode = process.env.NODE_ENV !== 'production';\n\n/**\n * Extract color components in the configured color space.\n * Returns a CSS variable reference for token colors, or decomposed\n * components as a space-separated string.\n */\nfunction extractColorSpaceValue(\n colorValue: string,\n parsedOutput: string,\n): string {\n const suffix = getColorSpaceSuffix();\n\n // If the parsed output references a color variable, use the companion variant\n const varMatch = parsedOutput.match(/var\\(--([a-z0-9-]+)-color\\)/);\n if (varMatch) {\n return `var(--${varMatch[1]}-color-${suffix})`;\n }\n\n // Try the original color value first, then parsed output\n const components = getColorSpaceComponents(colorValue);\n if (components !== colorValue) return components;\n\n const componentsFromParsed = getColorSpaceComponents(parsedOutput);\n if (componentsFromParsed !== parsedOutput) return componentsFromParsed;\n\n // Fallback: return the parsed output\n return parsedOutput;\n}\n\n/**\n * Check if a value is a valid token value (string, number, or boolean - not object).\n * Returns false for `false` values (they mean \"skip this token\").\n */\nfunction isValidTokenValue(\n value: unknown,\n): value is Exclude<TokenValue, undefined | null | false> {\n if (value === undefined || value === null || value === false) {\n return false;\n }\n\n if (typeof value === 'object') {\n if (devMode) {\n console.warn(\n 'Tasty: Object values are not allowed in tokens prop. ' +\n 'Tokens do not support state-based styling. Use a primitive value instead.',\n );\n }\n return false;\n }\n\n return (\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean'\n );\n}\n\n/**\n * Process a single token value through the tasty parser.\n * Numbers are converted to strings; 0 stays as \"0\".\n */\nfunction processTokenValue(value: string | number): string {\n if (typeof value === 'number') {\n // 0 should remain as \"0\", not converted to any unit\n if (value === 0) {\n return '0';\n }\n return parseStyle(String(value)).output;\n }\n return parseStyle(value).output;\n}\n\n/**\n * Process tokens object into inline style properties.\n * - $name -> --name with parsed value\n * - #name -> --name-color AND --name-color-{colorSpace} with parsed values\n *\n * @param tokens - The tokens object to process\n * @returns CSSProperties object or undefined if no tokens to process\n */\nexport function processTokens(\n tokens: Tokens | undefined,\n): CSSProperties | undefined {\n if (!tokens) {\n return undefined;\n }\n\n const keys = Object.keys(tokens);\n if (keys.length === 0) {\n return undefined;\n }\n\n let result: Record<string, string> | undefined;\n\n for (const key of keys) {\n const value = tokens[key as keyof Tokens];\n\n // Skip undefined/null values\n if (!isValidTokenValue(value)) {\n continue;\n }\n\n if (key.startsWith('$')) {\n // Custom property token: $name -> --name\n const propName = `--${key.slice(1)}`;\n // Boolean true for custom properties converts to empty string (valid CSS value)\n const effectiveValue = value === true ? '' : value;\n const processedValue = processTokenValue(effectiveValue);\n\n if (!result) result = {};\n result[propName] = processedValue;\n } else if (key.startsWith('#')) {\n const colorName = key.slice(1);\n const suffix = getColorSpaceSuffix();\n\n // Normalize color token value (true → 'transparent', false is already filtered by isValidTokenValue)\n const effectiveValue = normalizeColorTokenValue(value);\n // Skip if normalized to null (shouldn't happen since false is filtered by isValidTokenValue)\n if (effectiveValue === null) continue;\n\n const originalValue =\n typeof effectiveValue === 'number'\n ? String(effectiveValue)\n : effectiveValue;\n const lowerValue = originalValue.toLowerCase();\n const processedValue = processTokenValue(effectiveValue);\n\n if (!result) result = {};\n result[`--${colorName}-color`] = processedValue;\n\n // Skip component generation for #current values (currentcolor is dynamic, cannot decompose)\n if (/^#current(?:\\.|$)/i.test(lowerValue)) {\n continue;\n }\n\n result[`--${colorName}-color-${suffix}`] = extractColorSpaceValue(\n originalValue,\n processedValue,\n );\n }\n }\n\n return result as CSSProperties | undefined;\n}\n"],"mappings":";;;;;;;;;AAgBA,SAAS,uBACP,YACA,cACQ;CACR,MAAM,SAAS,qBAAqB;CAGpC,MAAM,WAAW,aAAa,MAAM,8BAA8B;AAClE,KAAI,SACF,QAAO,SAAS,SAAS,GAAG,SAAS,OAAO;CAI9C,MAAM,aAAa,wBAAwB,WAAW;AACtD,KAAI,eAAe,WAAY,QAAO;CAEtC,MAAM,uBAAuB,wBAAwB,aAAa;AAClE,KAAI,yBAAyB,aAAc,QAAO;AAGlD,QAAO;;;;;;AAOT,SAAS,kBACP,OACwD;AACxD,KAAI,UAAU,KAAA,KAAa,UAAU,QAAQ,UAAU,MACrD,QAAO;AAGT,KAAI,OAAO,UAAU,UAAU;AAE3B,UAAQ,KACN,iIAED;AAEH,SAAO;;AAGT,QACE,OAAO,UAAU,YACjB,OAAO,UAAU,YACjB,OAAO,UAAU;;;;;;AAQrB,SAAS,kBAAkB,OAAgC;AACzD,KAAI,OAAO,UAAU,UAAU;AAE7B,MAAI,UAAU,EACZ,QAAO;AAET,SAAO,WAAW,OAAO,MAAM,CAAC,CAAC;;AAEnC,QAAO,WAAW,MAAM,CAAC;;;;;;;;;;AAW3B,SAAgB,cACd,QAC2B;AAC3B,KAAI,CAAC,OACH;CAGF,MAAM,OAAO,OAAO,KAAK,OAAO;AAChC,KAAI,KAAK,WAAW,EAClB;CAGF,IAAI;AAEJ,MAAK,MAAM,OAAO,MAAM;EACtB,MAAM,QAAQ,OAAO;AAGrB,MAAI,CAAC,kBAAkB,MAAM,CAC3B;AAGF,MAAI,IAAI,WAAW,IAAI,EAAE;GAEvB,MAAM,WAAW,KAAK,IAAI,MAAM,EAAE;GAGlC,MAAM,iBAAiB,kBADA,UAAU,OAAO,KAAK,MACW;AAExD,OAAI,CAAC,OAAQ,UAAS,EAAE;AACxB,UAAO,YAAY;aACV,IAAI,WAAW,IAAI,EAAE;GAC9B,MAAM,YAAY,IAAI,MAAM,EAAE;GAC9B,MAAM,SAAS,qBAAqB;GAGpC,MAAM,iBAAiB,yBAAyB,MAAM;AAEtD,OAAI,mBAAmB,KAAM;GAE7B,MAAM,gBACJ,OAAO,mBAAmB,WACtB,OAAO,eAAe,GACtB;GACN,MAAM,aAAa,cAAc,aAAa;GAC9C,MAAM,iBAAiB,kBAAkB,eAAe;AAExD,OAAI,CAAC,OAAQ,UAAS,EAAE;AACxB,UAAO,KAAK,UAAU,WAAW;AAGjC,OAAI,qBAAqB,KAAK,WAAW,CACvC;AAGF,UAAO,KAAK,UAAU,SAAS,YAAY,uBACzC,eACA,eACD;;;AAIL,QAAO"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Styles } from "../styles/types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/resolve-recipes.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Resolve all `recipe` style properties in a styles object.
|
|
6
|
+
*
|
|
7
|
+
* Handles both top-level and sub-element recipe references.
|
|
8
|
+
* Returns the same object reference if no recipes are present anywhere
|
|
9
|
+
* (zero overhead for the common case).
|
|
10
|
+
*
|
|
11
|
+
* @param styles - The styles object potentially containing `recipe` keys
|
|
12
|
+
* @returns Resolved styles with recipe values merged in, or the original object if unchanged
|
|
13
|
+
*/
|
|
14
|
+
declare function resolveRecipes(styles: Styles): Styles;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { resolveRecipes };
|
|
17
|
+
//# sourceMappingURL=resolve-recipes.d.ts.map
|