@tenphi/tasty 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +236 -0
- package/dist/_virtual/_rolldown/runtime.mjs +7 -0
- package/dist/chunks/cacheKey.d.ts +1 -0
- package/dist/chunks/cacheKey.js +70 -0
- package/dist/chunks/cacheKey.js.map +1 -0
- package/dist/chunks/cacheKey.mjs +70 -0
- package/dist/chunks/cacheKey.mjs.map +1 -0
- package/dist/chunks/definitions.d.ts +37 -0
- package/dist/chunks/definitions.js +260 -0
- package/dist/chunks/definitions.js.map +1 -0
- package/dist/chunks/definitions.mjs +260 -0
- package/dist/chunks/definitions.mjs.map +1 -0
- package/dist/chunks/index.d.ts +3 -0
- package/dist/chunks/renderChunk.d.ts +2 -0
- package/dist/chunks/renderChunk.js +61 -0
- package/dist/chunks/renderChunk.js.map +1 -0
- package/dist/chunks/renderChunk.mjs +61 -0
- package/dist/chunks/renderChunk.mjs.map +1 -0
- package/dist/config.d.ts +279 -0
- package/dist/config.js +400 -0
- package/dist/config.js.map +1 -0
- package/dist/config.mjs +231 -0
- package/dist/config.mjs.map +1 -0
- package/dist/css-writer.d.mts +45 -0
- package/dist/css-writer.mjs +74 -0
- package/dist/css-writer.mjs.map +1 -0
- package/dist/debug.d.ts +204 -0
- package/dist/debug.js +733 -0
- package/dist/debug.js.map +1 -0
- package/dist/extractor.d.mts +24 -0
- package/dist/extractor.mjs +150 -0
- package/dist/extractor.mjs.map +1 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/useGlobalStyles.d.ts +27 -0
- package/dist/hooks/useGlobalStyles.js +56 -0
- package/dist/hooks/useGlobalStyles.js.map +1 -0
- package/dist/hooks/useKeyframes.d.ts +56 -0
- package/dist/hooks/useKeyframes.js +54 -0
- package/dist/hooks/useKeyframes.js.map +1 -0
- package/dist/hooks/useProperty.d.ts +79 -0
- package/dist/hooks/useProperty.js +91 -0
- package/dist/hooks/useProperty.js.map +1 -0
- package/dist/hooks/useRawCSS.d.ts +53 -0
- package/dist/hooks/useRawCSS.js +28 -0
- package/dist/hooks/useRawCSS.js.map +1 -0
- package/dist/hooks/useStyles.d.ts +40 -0
- package/dist/hooks/useStyles.js +169 -0
- package/dist/hooks/useStyles.js.map +1 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +30 -0
- package/dist/injector/index.d.ts +157 -0
- package/dist/injector/index.js +154 -0
- package/dist/injector/index.js.map +1 -0
- package/dist/injector/injector.d.ts +139 -0
- package/dist/injector/injector.js +404 -0
- package/dist/injector/injector.js.map +1 -0
- package/dist/injector/injector.mjs +404 -0
- package/dist/injector/injector.mjs.map +1 -0
- package/dist/injector/sheet-manager.d.ts +127 -0
- package/dist/injector/sheet-manager.js +714 -0
- package/dist/injector/sheet-manager.js.map +1 -0
- package/dist/injector/sheet-manager.mjs +714 -0
- package/dist/injector/sheet-manager.mjs.map +1 -0
- package/dist/injector/types.d.mts +18 -0
- package/dist/injector/types.d.ts +135 -0
- package/dist/keyframes/index.js +206 -0
- package/dist/keyframes/index.js.map +1 -0
- package/dist/keyframes/index.mjs +156 -0
- package/dist/keyframes/index.mjs.map +1 -0
- package/dist/parser/classify.js +319 -0
- package/dist/parser/classify.js.map +1 -0
- package/dist/parser/classify.mjs +319 -0
- package/dist/parser/classify.mjs.map +1 -0
- package/dist/parser/const.js +33 -0
- package/dist/parser/const.js.map +1 -0
- package/dist/parser/const.mjs +33 -0
- package/dist/parser/const.mjs.map +1 -0
- package/dist/parser/lru.js +109 -0
- package/dist/parser/lru.js.map +1 -0
- package/dist/parser/lru.mjs +109 -0
- package/dist/parser/lru.mjs.map +1 -0
- package/dist/parser/parser.d.ts +25 -0
- package/dist/parser/parser.js +116 -0
- package/dist/parser/parser.js.map +1 -0
- package/dist/parser/parser.mjs +116 -0
- package/dist/parser/parser.mjs.map +1 -0
- package/dist/parser/tokenizer.js +69 -0
- package/dist/parser/tokenizer.js.map +1 -0
- package/dist/parser/tokenizer.mjs +69 -0
- package/dist/parser/tokenizer.mjs.map +1 -0
- package/dist/parser/types.d.mts +37 -0
- package/dist/parser/types.d.ts +46 -0
- package/dist/parser/types.js +46 -0
- package/dist/parser/types.js.map +1 -0
- package/dist/parser/types.mjs +46 -0
- package/dist/parser/types.mjs.map +1 -0
- package/dist/pipeline/conditions.js +377 -0
- package/dist/pipeline/conditions.js.map +1 -0
- package/dist/pipeline/conditions.mjs +377 -0
- package/dist/pipeline/conditions.mjs.map +1 -0
- package/dist/pipeline/exclusive.d.ts +1 -0
- package/dist/pipeline/exclusive.js +231 -0
- package/dist/pipeline/exclusive.js.map +1 -0
- package/dist/pipeline/exclusive.mjs +231 -0
- package/dist/pipeline/exclusive.mjs.map +1 -0
- package/dist/pipeline/index.d.ts +53 -0
- package/dist/pipeline/index.js +641 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/pipeline/index.mjs +635 -0
- package/dist/pipeline/index.mjs.map +1 -0
- package/dist/pipeline/materialize.js +821 -0
- package/dist/pipeline/materialize.js.map +1 -0
- package/dist/pipeline/materialize.mjs +821 -0
- package/dist/pipeline/materialize.mjs.map +1 -0
- package/dist/pipeline/parseStateKey.d.ts +1 -0
- package/dist/pipeline/parseStateKey.js +418 -0
- package/dist/pipeline/parseStateKey.js.map +1 -0
- package/dist/pipeline/parseStateKey.mjs +418 -0
- package/dist/pipeline/parseStateKey.mjs.map +1 -0
- package/dist/pipeline/simplify.js +557 -0
- package/dist/pipeline/simplify.js.map +1 -0
- package/dist/pipeline/simplify.mjs +557 -0
- package/dist/pipeline/simplify.mjs.map +1 -0
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/okhsl-plugin.d.ts +35 -0
- package/dist/plugins/okhsl-plugin.js +371 -0
- package/dist/plugins/okhsl-plugin.js.map +1 -0
- package/dist/plugins/okhsl-plugin.mjs +345 -0
- package/dist/plugins/okhsl-plugin.mjs.map +1 -0
- package/dist/plugins/types.d.mts +49 -0
- package/dist/plugins/types.d.ts +69 -0
- package/dist/properties/index.js +158 -0
- package/dist/properties/index.js.map +1 -0
- package/dist/properties/index.mjs +141 -0
- package/dist/properties/index.mjs.map +1 -0
- package/dist/states/index.d.ts +45 -0
- package/dist/states/index.js +389 -0
- package/dist/states/index.js.map +1 -0
- package/dist/states/index.mjs +161 -0
- package/dist/states/index.mjs.map +1 -0
- package/dist/static/index.d.ts +5 -0
- package/dist/static/index.js +5 -0
- package/dist/static/tastyStatic.d.ts +46 -0
- package/dist/static/tastyStatic.js +31 -0
- package/dist/static/tastyStatic.js.map +1 -0
- package/dist/static/types.d.ts +49 -0
- package/dist/static/types.js +24 -0
- package/dist/static/types.js.map +1 -0
- package/dist/styles/align.d.ts +15 -0
- package/dist/styles/align.js +14 -0
- package/dist/styles/align.js.map +1 -0
- package/dist/styles/align.mjs +14 -0
- package/dist/styles/align.mjs.map +1 -0
- package/dist/styles/border.d.ts +25 -0
- package/dist/styles/border.js +114 -0
- package/dist/styles/border.js.map +1 -0
- package/dist/styles/border.mjs +114 -0
- package/dist/styles/border.mjs.map +1 -0
- package/dist/styles/color.d.ts +14 -0
- package/dist/styles/color.js +23 -0
- package/dist/styles/color.js.map +1 -0
- package/dist/styles/color.mjs +23 -0
- package/dist/styles/color.mjs.map +1 -0
- package/dist/styles/createStyle.js +77 -0
- package/dist/styles/createStyle.js.map +1 -0
- package/dist/styles/createStyle.mjs +77 -0
- package/dist/styles/createStyle.mjs.map +1 -0
- package/dist/styles/dimension.js +97 -0
- package/dist/styles/dimension.js.map +1 -0
- package/dist/styles/dimension.mjs +97 -0
- package/dist/styles/dimension.mjs.map +1 -0
- package/dist/styles/display.d.ts +37 -0
- package/dist/styles/display.js +67 -0
- package/dist/styles/display.js.map +1 -0
- package/dist/styles/display.mjs +67 -0
- package/dist/styles/display.mjs.map +1 -0
- package/dist/styles/fade.d.ts +15 -0
- package/dist/styles/fade.js +58 -0
- package/dist/styles/fade.js.map +1 -0
- package/dist/styles/fade.mjs +58 -0
- package/dist/styles/fade.mjs.map +1 -0
- package/dist/styles/fill.d.ts +44 -0
- package/dist/styles/fill.js +51 -0
- package/dist/styles/fill.js.map +1 -0
- package/dist/styles/fill.mjs +51 -0
- package/dist/styles/fill.mjs.map +1 -0
- package/dist/styles/flow.d.ts +16 -0
- package/dist/styles/flow.js +12 -0
- package/dist/styles/flow.js.map +1 -0
- package/dist/styles/flow.mjs +12 -0
- package/dist/styles/flow.mjs.map +1 -0
- package/dist/styles/gap.d.ts +31 -0
- package/dist/styles/gap.js +37 -0
- package/dist/styles/gap.js.map +1 -0
- package/dist/styles/gap.mjs +37 -0
- package/dist/styles/gap.mjs.map +1 -0
- package/dist/styles/height.d.ts +17 -0
- package/dist/styles/height.js +20 -0
- package/dist/styles/height.js.map +1 -0
- package/dist/styles/height.mjs +20 -0
- package/dist/styles/height.mjs.map +1 -0
- package/dist/styles/index.d.ts +2 -0
- package/dist/styles/index.js +9 -0
- package/dist/styles/index.js.map +1 -0
- package/dist/styles/index.mjs +9 -0
- package/dist/styles/index.mjs.map +1 -0
- package/dist/styles/inset.d.ts +50 -0
- package/dist/styles/inset.js +142 -0
- package/dist/styles/inset.js.map +1 -0
- package/dist/styles/inset.mjs +142 -0
- package/dist/styles/inset.mjs.map +1 -0
- package/dist/styles/justify.d.ts +15 -0
- package/dist/styles/justify.js +14 -0
- package/dist/styles/justify.js.map +1 -0
- package/dist/styles/justify.mjs +14 -0
- package/dist/styles/justify.mjs.map +1 -0
- package/dist/styles/list.d.ts +16 -0
- package/dist/styles/list.js +98 -0
- package/dist/styles/list.js.map +1 -0
- package/dist/styles/margin.d.ts +28 -0
- package/dist/styles/margin.js +96 -0
- package/dist/styles/margin.js.map +1 -0
- package/dist/styles/margin.mjs +96 -0
- package/dist/styles/margin.mjs.map +1 -0
- package/dist/styles/outline.d.ts +29 -0
- package/dist/styles/outline.js +65 -0
- package/dist/styles/outline.js.map +1 -0
- package/dist/styles/outline.mjs +65 -0
- package/dist/styles/outline.mjs.map +1 -0
- package/dist/styles/padding.d.ts +28 -0
- package/dist/styles/padding.js +96 -0
- package/dist/styles/padding.js.map +1 -0
- package/dist/styles/padding.mjs +96 -0
- package/dist/styles/padding.mjs.map +1 -0
- package/dist/styles/predefined.d.ts +74 -0
- package/dist/styles/predefined.js +241 -0
- package/dist/styles/predefined.js.map +1 -0
- package/dist/styles/predefined.mjs +232 -0
- package/dist/styles/predefined.mjs.map +1 -0
- package/dist/styles/preset.d.ts +47 -0
- package/dist/styles/preset.js +126 -0
- package/dist/styles/preset.js.map +1 -0
- package/dist/styles/preset.mjs +126 -0
- package/dist/styles/preset.mjs.map +1 -0
- package/dist/styles/radius.d.ts +14 -0
- package/dist/styles/radius.js +51 -0
- package/dist/styles/radius.js.map +1 -0
- package/dist/styles/radius.mjs +51 -0
- package/dist/styles/radius.mjs.map +1 -0
- package/dist/styles/scrollbar.d.ts +21 -0
- package/dist/styles/scrollbar.js +105 -0
- package/dist/styles/scrollbar.js.map +1 -0
- package/dist/styles/scrollbar.mjs +105 -0
- package/dist/styles/scrollbar.mjs.map +1 -0
- package/dist/styles/shadow.d.ts +14 -0
- package/dist/styles/shadow.js +24 -0
- package/dist/styles/shadow.js.map +1 -0
- package/dist/styles/shadow.mjs +24 -0
- package/dist/styles/shadow.mjs.map +1 -0
- package/dist/styles/styledScrollbar.d.ts +47 -0
- package/dist/styles/styledScrollbar.js +38 -0
- package/dist/styles/styledScrollbar.js.map +1 -0
- package/dist/styles/styledScrollbar.mjs +38 -0
- package/dist/styles/styledScrollbar.mjs.map +1 -0
- package/dist/styles/transition.d.ts +14 -0
- package/dist/styles/transition.js +138 -0
- package/dist/styles/transition.js.map +1 -0
- package/dist/styles/transition.mjs +138 -0
- package/dist/styles/transition.mjs.map +1 -0
- package/dist/styles/types.d.mts +492 -0
- package/dist/styles/types.d.ts +496 -0
- package/dist/styles/width.d.ts +17 -0
- package/dist/styles/width.js +20 -0
- package/dist/styles/width.js.map +1 -0
- package/dist/styles/width.mjs +20 -0
- package/dist/styles/width.mjs.map +1 -0
- package/dist/tasty.d.ts +983 -0
- package/dist/tasty.js +191 -0
- package/dist/tasty.js.map +1 -0
- package/dist/tokens/typography.d.ts +19 -0
- package/dist/tokens/typography.js +237 -0
- package/dist/tokens/typography.js.map +1 -0
- package/dist/types.d.ts +182 -0
- package/dist/utils/cache-wrapper.js +26 -0
- package/dist/utils/cache-wrapper.js.map +1 -0
- package/dist/utils/cache-wrapper.mjs +26 -0
- package/dist/utils/cache-wrapper.mjs.map +1 -0
- package/dist/utils/case-converter.js +8 -0
- package/dist/utils/case-converter.js.map +1 -0
- package/dist/utils/case-converter.mjs +8 -0
- package/dist/utils/case-converter.mjs.map +1 -0
- package/dist/utils/colors.d.ts +5 -0
- package/dist/utils/colors.js +9 -0
- package/dist/utils/colors.js.map +1 -0
- package/dist/utils/dotize.d.ts +26 -0
- package/dist/utils/dotize.js +122 -0
- package/dist/utils/dotize.js.map +1 -0
- package/dist/utils/filter-base-props.d.ts +15 -0
- package/dist/utils/filter-base-props.js +45 -0
- package/dist/utils/filter-base-props.js.map +1 -0
- package/dist/utils/get-display-name.d.ts +7 -0
- package/dist/utils/get-display-name.js +10 -0
- package/dist/utils/get-display-name.js.map +1 -0
- package/dist/utils/hsl-to-rgb.js +38 -0
- package/dist/utils/hsl-to-rgb.js.map +1 -0
- package/dist/utils/hsl-to-rgb.mjs +38 -0
- package/dist/utils/hsl-to-rgb.mjs.map +1 -0
- package/dist/utils/is-dev-env.js +19 -0
- package/dist/utils/is-dev-env.js.map +1 -0
- package/dist/utils/is-dev-env.mjs +19 -0
- package/dist/utils/is-dev-env.mjs.map +1 -0
- package/dist/utils/merge-styles.d.ts +7 -0
- package/dist/utils/merge-styles.js +146 -0
- package/dist/utils/merge-styles.js.map +1 -0
- package/dist/utils/merge-styles.mjs +146 -0
- package/dist/utils/merge-styles.mjs.map +1 -0
- package/dist/utils/mod-attrs.d.ts +8 -0
- package/dist/utils/mod-attrs.js +21 -0
- package/dist/utils/mod-attrs.js.map +1 -0
- package/dist/utils/okhsl-to-rgb.js +296 -0
- package/dist/utils/okhsl-to-rgb.js.map +1 -0
- package/dist/utils/okhsl-to-rgb.mjs +296 -0
- package/dist/utils/okhsl-to-rgb.mjs.map +1 -0
- package/dist/utils/process-tokens.d.ts +31 -0
- package/dist/utils/process-tokens.js +171 -0
- package/dist/utils/process-tokens.js.map +1 -0
- package/dist/utils/process-tokens.mjs +28 -0
- package/dist/utils/process-tokens.mjs.map +1 -0
- package/dist/utils/resolve-recipes.d.ts +17 -0
- package/dist/utils/resolve-recipes.js +143 -0
- package/dist/utils/resolve-recipes.js.map +1 -0
- package/dist/utils/resolve-recipes.mjs +143 -0
- package/dist/utils/resolve-recipes.mjs.map +1 -0
- package/dist/utils/string.js +8 -0
- package/dist/utils/string.js.map +1 -0
- package/dist/utils/string.mjs +8 -0
- package/dist/utils/string.mjs.map +1 -0
- package/dist/utils/styles.d.mts +18 -0
- package/dist/utils/styles.d.ts +183 -0
- package/dist/utils/styles.js +585 -0
- package/dist/utils/styles.js.map +1 -0
- package/dist/utils/styles.mjs +346 -0
- package/dist/utils/styles.mjs.map +1 -0
- package/dist/utils/typography.d.ts +36 -0
- package/dist/utils/typography.js +53 -0
- package/dist/utils/typography.js.map +1 -0
- package/dist/utils/warnings.d.ts +16 -0
- package/dist/utils/warnings.js +16 -0
- package/dist/utils/warnings.js.map +1 -0
- package/dist/zero/babel.d.mts +108 -0
- package/dist/zero/babel.mjs +282 -0
- package/dist/zero/babel.mjs.map +1 -0
- package/dist/zero/index.d.mts +3 -0
- package/dist/zero/index.mjs +4 -0
- package/dist/zero/next.d.mts +60 -0
- package/dist/zero/next.mjs +78 -0
- package/dist/zero/next.mjs.map +1 -0
- package/package.json +127 -0
package/dist/tasty.js
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { processTokens, stringifyTokens } from "./utils/process-tokens.js";
|
|
2
|
+
import { mergeStyles } from "./utils/merge-styles.js";
|
|
3
|
+
import { useStyles } from "./hooks/useStyles.js";
|
|
4
|
+
import { BASE_STYLES } from "./styles/list.js";
|
|
5
|
+
import { getDisplayName } from "./utils/get-display-name.js";
|
|
6
|
+
import { _modAttrs } from "./utils/mod-attrs.js";
|
|
7
|
+
import { createElement, forwardRef, useMemo } from "react";
|
|
8
|
+
import { isValidElementType } from "react-is";
|
|
9
|
+
|
|
10
|
+
//#region src/tasty.tsx
|
|
11
|
+
/**
|
|
12
|
+
* Precalculated entries for performance optimization
|
|
13
|
+
*/
|
|
14
|
+
const IS_PROPERTIES_ENTRIES = Object.entries({
|
|
15
|
+
isDisabled: "disabled",
|
|
16
|
+
isHidden: "hidden",
|
|
17
|
+
isChecked: "checked"
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* Helper function to handle is* properties consistently
|
|
21
|
+
* Transforms is* props to HTML attributes and adds corresponding data-* attributes
|
|
22
|
+
*/
|
|
23
|
+
function handleIsProperties(props) {
|
|
24
|
+
for (const [isProperty, targetAttribute] of IS_PROPERTIES_ENTRIES) {
|
|
25
|
+
if (isProperty in props) {
|
|
26
|
+
props[targetAttribute] = props[isProperty];
|
|
27
|
+
delete props[isProperty];
|
|
28
|
+
}
|
|
29
|
+
const dataAttribute = `data-${targetAttribute}`;
|
|
30
|
+
if (!(dataAttribute in props) && props[targetAttribute]) props[dataAttribute] = "";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Creates a sub-element component for compound component patterns.
|
|
35
|
+
* Sub-elements are lightweight components with data-element attribute for CSS targeting.
|
|
36
|
+
*/
|
|
37
|
+
function createSubElement(elementName, definition) {
|
|
38
|
+
const config = typeof definition === "string" ? { as: definition } : definition;
|
|
39
|
+
const tag = config.as ?? "div";
|
|
40
|
+
const defaultQa = config.qa;
|
|
41
|
+
const defaultQaVal = config.qaVal;
|
|
42
|
+
const SubElement = forwardRef((props, ref) => {
|
|
43
|
+
const { qa, qaVal, mods, tokens, isDisabled, isHidden, isChecked, className, style, ...htmlProps } = props;
|
|
44
|
+
let modProps;
|
|
45
|
+
if (mods) modProps = _modAttrs(mods);
|
|
46
|
+
const tokenStyle = tokens ? processTokens(tokens) : void 0;
|
|
47
|
+
let mergedStyle;
|
|
48
|
+
if (tokenStyle || style) mergedStyle = tokenStyle && style ? {
|
|
49
|
+
...tokenStyle,
|
|
50
|
+
...style
|
|
51
|
+
} : tokenStyle ?? style;
|
|
52
|
+
const elementProps = {
|
|
53
|
+
"data-element": elementName,
|
|
54
|
+
"data-qa": qa ?? defaultQa,
|
|
55
|
+
"data-qaval": qaVal ?? defaultQaVal,
|
|
56
|
+
...modProps || {},
|
|
57
|
+
...htmlProps,
|
|
58
|
+
className,
|
|
59
|
+
style: mergedStyle,
|
|
60
|
+
isDisabled,
|
|
61
|
+
isHidden,
|
|
62
|
+
isChecked,
|
|
63
|
+
ref
|
|
64
|
+
};
|
|
65
|
+
handleIsProperties(elementProps);
|
|
66
|
+
if (elementProps["data-qa"] === void 0) delete elementProps["data-qa"];
|
|
67
|
+
if (elementProps["data-qaval"] === void 0) delete elementProps["data-qaval"];
|
|
68
|
+
return createElement(tag, elementProps);
|
|
69
|
+
});
|
|
70
|
+
SubElement.displayName = `SubElement(${elementName})`;
|
|
71
|
+
return SubElement;
|
|
72
|
+
}
|
|
73
|
+
function tasty(Component, options) {
|
|
74
|
+
if (isValidElementType(Component)) return tastyWrap(Component, options);
|
|
75
|
+
return tastyElement(Component);
|
|
76
|
+
}
|
|
77
|
+
function tastyWrap(Component, options) {
|
|
78
|
+
const { as: extendTag, element: extendElement, ...defaultProps } = options ?? {};
|
|
79
|
+
const propsWithStyles = ["styles"].concat(Object.keys(defaultProps).filter((prop) => prop.endsWith("Styles")));
|
|
80
|
+
const _WrappedComponent = forwardRef((props, ref) => {
|
|
81
|
+
const { as, element, ...restProps } = props;
|
|
82
|
+
const mergedStylesMap = useMemo(() => {
|
|
83
|
+
return propsWithStyles.reduce((map, prop) => {
|
|
84
|
+
const restValue = restProps[prop];
|
|
85
|
+
const defaultValue = defaultProps[prop];
|
|
86
|
+
if (restValue != null && defaultValue != null) map[prop] = mergeStyles(defaultValue, restValue);
|
|
87
|
+
else map[prop] = restValue ?? defaultValue;
|
|
88
|
+
return map;
|
|
89
|
+
}, {});
|
|
90
|
+
}, [propsWithStyles.map((prop) => props[prop])]);
|
|
91
|
+
return createElement(Component, {
|
|
92
|
+
...defaultProps,
|
|
93
|
+
...restProps,
|
|
94
|
+
...mergedStylesMap,
|
|
95
|
+
as: as ?? extendTag,
|
|
96
|
+
element: element || extendElement,
|
|
97
|
+
ref
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
_WrappedComponent.displayName = `TastyWrappedComponent(${getDisplayName(Component, defaultProps.qa ?? extendTag ?? "Anonymous")})`;
|
|
101
|
+
return _WrappedComponent;
|
|
102
|
+
}
|
|
103
|
+
function tastyElement(tastyOptions) {
|
|
104
|
+
const { as: originalAs = "div", element: defaultElement, styles: defaultStyles, styleProps, variants, tokens: defaultTokens, elements, ...defaultProps } = tastyOptions;
|
|
105
|
+
let variantStylesMap;
|
|
106
|
+
if (variants) {
|
|
107
|
+
variantStylesMap = Object.entries(variants).reduce((map, [variant, variantStyles]) => {
|
|
108
|
+
map[variant] = mergeStyles(defaultStyles, variantStyles);
|
|
109
|
+
return map;
|
|
110
|
+
}, {});
|
|
111
|
+
if (!variantStylesMap["default"]) variantStylesMap["default"] = defaultStyles;
|
|
112
|
+
}
|
|
113
|
+
const { qa: defaultQa, qaVal: defaultQaVal, ...otherDefaultProps } = defaultProps ?? {};
|
|
114
|
+
const _TastyComponent = forwardRef((allProps, ref) => {
|
|
115
|
+
const { as, styles: rawStyles, variant, mods, element, qa, qaVal, className: userClassName, tokens, style, ...otherProps } = allProps;
|
|
116
|
+
let styles = rawStyles;
|
|
117
|
+
let propStyles = null;
|
|
118
|
+
const propsToCheck = styleProps ? styleProps.concat(BASE_STYLES) : BASE_STYLES;
|
|
119
|
+
for (const prop of propsToCheck) {
|
|
120
|
+
const key = prop;
|
|
121
|
+
if (!propStyles) propStyles = {};
|
|
122
|
+
if (key in otherProps) {
|
|
123
|
+
propStyles[key] = otherProps[key];
|
|
124
|
+
delete otherProps[key];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (!styles || styles && Object.keys(styles).length === 0) styles = void 0;
|
|
128
|
+
const baseStyles = variantStylesMap ? variantStylesMap[variant || "default"] ?? variantStylesMap["default"] : defaultStyles;
|
|
129
|
+
const { className: stylesClassName } = useStyles(useMemo(() => {
|
|
130
|
+
const hasStyles = styles && Object.keys(styles).length > 0;
|
|
131
|
+
const hasPropStyles = propStyles && Object.keys(propStyles).length > 0;
|
|
132
|
+
if (!hasStyles && !hasPropStyles) return baseStyles;
|
|
133
|
+
return mergeStyles(baseStyles, styles, propStyles);
|
|
134
|
+
}, [
|
|
135
|
+
baseStyles,
|
|
136
|
+
styles,
|
|
137
|
+
propStyles
|
|
138
|
+
]));
|
|
139
|
+
const mergedTokens = useMemo(() => {
|
|
140
|
+
if (!defaultTokens && !tokens) return void 0;
|
|
141
|
+
if (!defaultTokens) return tokens;
|
|
142
|
+
if (!tokens) return defaultTokens;
|
|
143
|
+
return {
|
|
144
|
+
...defaultTokens,
|
|
145
|
+
...tokens
|
|
146
|
+
};
|
|
147
|
+
}, [stringifyTokens(tokens)]);
|
|
148
|
+
const processedTokenStyle = useMemo(() => {
|
|
149
|
+
return processTokens(mergedTokens);
|
|
150
|
+
}, [mergedTokens]);
|
|
151
|
+
const mergedStyle = useMemo(() => {
|
|
152
|
+
if (!processedTokenStyle && !style) return void 0;
|
|
153
|
+
if (!processedTokenStyle) return style;
|
|
154
|
+
if (!style) return processedTokenStyle;
|
|
155
|
+
return {
|
|
156
|
+
...processedTokenStyle,
|
|
157
|
+
...style
|
|
158
|
+
};
|
|
159
|
+
}, [processedTokenStyle, style]);
|
|
160
|
+
let modProps;
|
|
161
|
+
if (mods) modProps = _modAttrs(mods);
|
|
162
|
+
const finalClassName = [userClassName || "", stylesClassName].filter(Boolean).join(" ");
|
|
163
|
+
const elementProps = {
|
|
164
|
+
"data-element": element || defaultElement,
|
|
165
|
+
"data-qa": qa || defaultQa,
|
|
166
|
+
"data-qaval": qaVal || defaultQaVal,
|
|
167
|
+
...otherDefaultProps,
|
|
168
|
+
...modProps || {},
|
|
169
|
+
...otherProps,
|
|
170
|
+
className: finalClassName,
|
|
171
|
+
style: mergedStyle,
|
|
172
|
+
ref
|
|
173
|
+
};
|
|
174
|
+
handleIsProperties(elementProps);
|
|
175
|
+
return createElement(as ?? originalAs, elementProps);
|
|
176
|
+
});
|
|
177
|
+
_TastyComponent.displayName = `TastyComponent(${defaultProps.qa || originalAs})`;
|
|
178
|
+
if (elements) {
|
|
179
|
+
const subElements = Object.entries(elements).reduce((acc, [name, definition]) => {
|
|
180
|
+
acc[name] = createSubElement(name, definition);
|
|
181
|
+
return acc;
|
|
182
|
+
}, {});
|
|
183
|
+
return Object.assign(_TastyComponent, subElements);
|
|
184
|
+
}
|
|
185
|
+
return _TastyComponent;
|
|
186
|
+
}
|
|
187
|
+
const Element = tasty({});
|
|
188
|
+
|
|
189
|
+
//#endregion
|
|
190
|
+
export { Element, tasty };
|
|
191
|
+
//# sourceMappingURL=tasty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasty.js","names":["modAttrs"],"sources":["../src/tasty.tsx"],"sourcesContent":["import type {\n AllHTMLAttributes,\n ComponentType,\n ForwardRefExoticComponent,\n JSX,\n PropsWithoutRef,\n RefAttributes} from 'react';\nimport {\n createElement,\n forwardRef,\n useMemo,\n} from 'react';\nimport { isValidElementType } from 'react-is';\n\nimport { useStyles } from './hooks/useStyles';\nimport { BASE_STYLES } from './styles/list';\nimport type { Styles, StylesInterface } from './styles/types';\nimport type {\n AllBaseProps,\n BaseProps,\n BaseStyleProps,\n Mods,\n Props,\n Tokens,\n} from './types';\nimport { getDisplayName } from './utils/get-display-name';\nimport { mergeStyles } from './utils/merge-styles';\nimport { modAttrs } from './utils/mod-attrs';\nimport { processTokens, stringifyTokens } from './utils/process-tokens';\n\nimport type { StyleValue, StyleValueStateMap } from './utils/styles';\n\n/**\n * Mapping of is* properties to their corresponding HTML attributes\n */\nconst IS_PROPERTIES_MAP = {\n isDisabled: 'disabled',\n isHidden: 'hidden',\n isChecked: 'checked',\n} as const;\n\n/**\n * Precalculated entries for performance optimization\n */\nconst IS_PROPERTIES_ENTRIES = Object.entries(IS_PROPERTIES_MAP);\n\n/**\n * Helper function to handle is* properties consistently\n * Transforms is* props to HTML attributes and adds corresponding data-* attributes\n */\nfunction handleIsProperties(props: Record<string, unknown>) {\n for (const [isProperty, targetAttribute] of IS_PROPERTIES_ENTRIES) {\n if (isProperty in props) {\n props[targetAttribute] = props[isProperty];\n delete props[isProperty];\n }\n\n // Add data-* attribute if target attribute is truthy and doesn't already exist\n const dataAttribute = `data-${targetAttribute}`;\n if (!(dataAttribute in props) && props[targetAttribute]) {\n props[dataAttribute] = '';\n }\n }\n}\n\n/**\n * Creates a sub-element component for compound component patterns.\n * Sub-elements are lightweight components with data-element attribute for CSS targeting.\n */\nfunction createSubElement<Tag extends keyof JSX.IntrinsicElements>(\n elementName: string,\n definition: SubElementDefinition<Tag>,\n): ForwardRefExoticComponent<\n PropsWithoutRef<SubElementProps<Tag>> & RefAttributes<unknown>\n> {\n // Normalize definition to object form\n const config =\n typeof definition === 'string'\n ? { as: definition as Tag }\n : (definition as { as?: Tag; qa?: string; qaVal?: string | number });\n\n const tag = config.as ?? ('div' as Tag);\n const defaultQa = config.qa;\n const defaultQaVal = config.qaVal;\n\n const SubElement = forwardRef<unknown, SubElementProps<Tag>>((props, ref) => {\n const {\n qa,\n qaVal,\n mods,\n tokens,\n isDisabled,\n isHidden,\n isChecked,\n className,\n style,\n ...htmlProps\n } = props as SubElementProps<Tag> & {\n className?: string;\n style?: Record<string, unknown>;\n };\n\n // Build mod attributes\n let modProps: Record<string, unknown> | undefined;\n if (mods) {\n modProps = modAttrs(mods as Mods) as Record<string, unknown>;\n }\n\n // Process tokens into inline style properties\n const tokenStyle = tokens\n ? (processTokens(tokens) as Record<string, unknown>)\n : undefined;\n\n // Merge token styles with explicit style prop (style has priority)\n let mergedStyle: Record<string, unknown> | undefined;\n if (tokenStyle || style) {\n mergedStyle =\n tokenStyle && style\n ? { ...tokenStyle, ...style }\n : ((tokenStyle ?? style) as Record<string, unknown>);\n }\n\n const elementProps = {\n 'data-element': elementName,\n 'data-qa': qa ?? defaultQa,\n 'data-qaval': qaVal ?? defaultQaVal,\n ...(modProps || {}),\n ...htmlProps,\n className,\n style: mergedStyle,\n isDisabled,\n isHidden,\n isChecked,\n ref,\n } as Record<string, unknown>;\n\n // Handle is* properties (isDisabled -> disabled + data-disabled, etc.)\n handleIsProperties(elementProps);\n\n // Clean up undefined data attributes\n if (elementProps['data-qa'] === undefined) delete elementProps['data-qa'];\n if (elementProps['data-qaval'] === undefined)\n delete elementProps['data-qaval'];\n\n return createElement(tag, elementProps);\n });\n\n SubElement.displayName = `SubElement(${elementName})`;\n\n return SubElement as ForwardRefExoticComponent<\n PropsWithoutRef<SubElementProps<Tag>> & RefAttributes<unknown>\n >;\n}\n\ntype StyleList = readonly (keyof {\n [key in keyof StylesInterface]: StylesInterface[key];\n})[];\n\nexport type PropsWithStyles = {\n styles?: Styles;\n} & Omit<Props, 'styles'>;\n\nexport type VariantMap = Record<string, Styles>;\n\nexport interface WithVariant<V extends VariantMap> {\n variant?: keyof V;\n}\n\n// ============================================================================\n// Sub-element types for compound components\n// ============================================================================\n\n/**\n * Definition for a sub-element. Can be either:\n * - A tag name string (e.g., 'div', 'span')\n * - An object with configuration options\n */\nexport type SubElementDefinition<\n Tag extends keyof JSX.IntrinsicElements = 'div',\n> =\n | Tag\n | {\n as?: Tag;\n qa?: string;\n qaVal?: string | number;\n };\n\n/**\n * Map of sub-element definitions.\n * Keys become the sub-component names (e.g., { Icon: 'span' } -> Component.Icon)\n */\nexport type ElementsDefinition = Record<\n string,\n SubElementDefinition<keyof JSX.IntrinsicElements>\n>;\n\n/**\n * Resolves the tag from a SubElementDefinition\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype ResolveElementTag<T extends SubElementDefinition<any>> = T extends string\n ? T\n : T extends { as?: infer Tag }\n ? Tag extends keyof JSX.IntrinsicElements\n ? Tag\n : 'div'\n : 'div';\n\n/**\n * Props for sub-element components.\n * Combines HTML attributes with tasty-specific props (qa, qaVal, mods, tokens, isDisabled, etc.)\n */\nexport type SubElementProps<Tag extends keyof JSX.IntrinsicElements = 'div'> =\n Omit<\n JSX.IntrinsicElements[Tag],\n 'ref' | 'color' | 'content' | 'translate'\n > & {\n qa?: string;\n qaVal?: string | number;\n mods?: Mods;\n tokens?: Tokens;\n isDisabled?: boolean;\n isHidden?: boolean;\n isChecked?: boolean;\n };\n\n/**\n * Generates the sub-element component types from an ElementsDefinition\n */\ntype SubElementComponents<E extends ElementsDefinition> = {\n [K in keyof E]: ForwardRefExoticComponent<\n PropsWithoutRef<SubElementProps<ResolveElementTag<E[K]>>> &\n RefAttributes<\n ResolveElementTag<E[K]> extends keyof HTMLElementTagNameMap\n ? HTMLElementTagNameMap[ResolveElementTag<E[K]>]\n : Element\n >\n >;\n};\n\n/**\n * Base type containing common properties shared between TastyProps and TastyElementOptions.\n * Separated to avoid code duplication while allowing different type constraints.\n */\ntype TastyBaseProps<\n K extends StyleList,\n V extends VariantMap,\n E extends ElementsDefinition = Record<string, never>,\n> = {\n /** Default styles of the element. */\n styles?: Styles;\n /** The list of styles that can be provided by props */\n styleProps?: K;\n element?: BaseProps['element'];\n variants?: V;\n /** Default tokens for inline CSS custom properties */\n tokens?: Tokens;\n /** Sub-element definitions for compound components */\n elements?: E;\n} & Pick<BaseProps, 'qa' | 'qaVal'> &\n WithVariant<V>;\n\nexport type TastyProps<\n K extends StyleList,\n V extends VariantMap,\n E extends ElementsDefinition = Record<string, never>,\n DefaultProps = Props,\n> = TastyBaseProps<K, V, E> & {\n /** The tag name of the element or a React component. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n as?: string | ComponentType<any>;\n} & Partial<Omit<DefaultProps, 'as' | 'styles' | 'styleProps' | 'tokens'>>;\n\n/**\n * TastyElementOptions is used for the element-creation overload of tasty().\n * It includes a Tag generic that allows TypeScript to infer the correct\n * HTML element type from the `as` prop.\n *\n * Note: Uses a separate index signature with `unknown` instead of inheriting\n * from Props (which has `any`) to ensure strict type checking for styles.\n */\nexport type TastyElementOptions<\n K extends StyleList,\n V extends VariantMap,\n E extends ElementsDefinition = Record<string, never>,\n Tag extends keyof JSX.IntrinsicElements = 'div',\n> = TastyBaseProps<K, V, E> & {\n /** The tag name of the element or a React component. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n as?: Tag | ComponentType<any>;\n} & Record<string, unknown>;\n\nexport type AllBasePropsWithMods<K extends StyleList> = AllBaseProps & {\n [key in K[number]]?:\n | StyleValue<StylesInterface[key]>\n | StyleValueStateMap<StylesInterface[key]>;\n} & BaseStyleProps;\n\n/**\n * Keys from BasePropsWithoutChildren that should be omitted from HTML attributes.\n * This excludes event handlers so they can be properly typed from JSX.IntrinsicElements.\n */\ntype TastySpecificKeys =\n | 'as'\n | 'qa'\n | 'qaVal'\n | 'element'\n | 'styles'\n | 'breakpoints'\n | 'block'\n | 'inline'\n | 'mods'\n | 'isHidden'\n | 'isDisabled'\n | 'css'\n | 'style'\n | 'theme'\n | 'tokens'\n | 'ref'\n | 'color';\n\n/**\n * Props type for tasty elements that combines:\n * - AllBasePropsWithMods for style props with strict tokens type\n * - HTML attributes for flexibility (properly typed based on tag)\n * - Variant support\n *\n * Uses AllHTMLAttributes as base for common attributes (like disabled),\n * but overrides event handlers with tag-specific types from JSX.IntrinsicElements.\n */\nexport type TastyElementProps<\n K extends StyleList,\n V extends VariantMap,\n Tag extends keyof JSX.IntrinsicElements = 'div',\n> = AllBasePropsWithMods<K> &\n WithVariant<V> &\n Omit<\n Omit<AllHTMLAttributes<HTMLElement>, keyof JSX.IntrinsicElements[Tag]> &\n JSX.IntrinsicElements[Tag],\n TastySpecificKeys | K[number]\n >;\n\ntype TastyComponentPropsWithDefaults<\n Props extends PropsWithStyles,\n DefaultProps extends Partial<Props>,\n> = keyof DefaultProps extends never\n ? Props\n : {\n [key in Extract<keyof Props, keyof DefaultProps>]?: Props[key];\n } & {\n [key in keyof Omit<Props, keyof DefaultProps>]: Props[key];\n };\n\nexport function tasty<\n K extends StyleList,\n V extends VariantMap,\n E extends ElementsDefinition = Record<string, never>,\n Tag extends keyof JSX.IntrinsicElements = 'div',\n>(\n options: TastyElementOptions<K, V, E, Tag>,\n secondArg?: never,\n): ForwardRefExoticComponent<\n PropsWithoutRef<TastyElementProps<K, V, Tag>> & RefAttributes<unknown>\n> &\n SubElementComponents<E>;\nexport function tasty<\n Props extends PropsWithStyles,\n DefaultProps extends Partial<Props> = Partial<Props>,\n>(\n Component: ComponentType<Props>,\n options?: TastyProps<never, never, Record<string, never>, Props>,\n): ComponentType<TastyComponentPropsWithDefaults<Props, DefaultProps>>;\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n// Implementation\nexport function tasty<\n K extends StyleList,\n V extends VariantMap,\n \n _C = Record<string, unknown>,\n>(Component: any, options?: any) {\n if (isValidElementType(Component)) {\n return tastyWrap(Component as ComponentType<any>, options);\n }\n\n return tastyElement(Component as TastyProps<K, V>);\n}\n\nfunction tastyWrap<\n P extends PropsWithStyles,\n DefaultProps extends Partial<P> = Partial<P>,\n>(\n Component: ComponentType<P>,\n options?: TastyProps<never, never, P>,\n): ComponentType<TastyComponentPropsWithDefaults<P, DefaultProps>> {\n const {\n as: extendTag,\n element: extendElement,\n ...defaultProps\n } = (options ?? {}) as TastyProps<never, never, P>;\n\n const propsWithStyles = ['styles'].concat(\n Object.keys(defaultProps).filter((prop) => prop.endsWith('Styles')),\n );\n\n const _WrappedComponent = forwardRef<any, any>((props, ref) => {\n const { as, element, ...restProps } = props as Record<string, unknown>;\n const propsWithStylesValues = propsWithStyles.map(\n (prop) => (props as any)[prop],\n );\n\n const mergedStylesMap: Styles | undefined = useMemo(() => {\n return propsWithStyles.reduce((map, prop) => {\n const restValue = (restProps as any)[prop];\n const defaultValue = (defaultProps as any)[prop];\n\n if (restValue != null && defaultValue != null) {\n (map as any)[prop] = mergeStyles(defaultValue, restValue);\n } else {\n (map as any)[prop] = restValue ?? defaultValue;\n }\n\n return map;\n }, {} as Styles);\n }, [propsWithStylesValues]);\n\n const elementProps = {\n ...(defaultProps as unknown as Record<string, unknown>),\n ...(restProps as unknown as Record<string, unknown>),\n ...(mergedStylesMap as unknown as Record<string, unknown>),\n as: (as as string | undefined) ?? extendTag,\n element: (element as string | undefined) || extendElement,\n ref,\n } as unknown as P;\n\n return createElement(Component as ComponentType<P>, elementProps);\n });\n\n _WrappedComponent.displayName = `TastyWrappedComponent(${getDisplayName(\n Component,\n (defaultProps as any).qa ?? (extendTag as any) ?? 'Anonymous',\n )})`;\n\n return _WrappedComponent as unknown as ComponentType<\n TastyComponentPropsWithDefaults<P, DefaultProps>\n >;\n}\n\nfunction tastyElement<\n K extends StyleList,\n V extends VariantMap,\n E extends ElementsDefinition,\n>(tastyOptions: TastyProps<K, V, E>) {\n const {\n as: originalAs = 'div',\n element: defaultElement,\n styles: defaultStyles,\n styleProps,\n variants,\n tokens: defaultTokens,\n elements,\n ...defaultProps\n } = tastyOptions;\n\n // Pre-compute merged styles for each variant (if variants are defined)\n // This avoids creating separate component instances per variant\n let variantStylesMap: Record<string, Styles | undefined> | undefined;\n if (variants) {\n const variantEntries = Object.entries(variants) as [string, Styles][];\n variantStylesMap = variantEntries.reduce(\n (map, [variant, variantStyles]) => {\n map[variant] = mergeStyles(defaultStyles, variantStyles);\n return map;\n },\n {} as Record<string, Styles | undefined>,\n );\n // Ensure 'default' variant always exists\n if (!variantStylesMap['default']) {\n variantStylesMap['default'] = defaultStyles;\n }\n }\n\n const {\n qa: defaultQa,\n qaVal: defaultQaVal,\n ...otherDefaultProps\n } = defaultProps ?? {};\n\n const _TastyComponent = forwardRef<\n unknown,\n AllBasePropsWithMods<K> & WithVariant<V>\n >((allProps, ref) => {\n const {\n as,\n styles: rawStyles,\n variant,\n mods,\n element,\n qa,\n qaVal,\n className: userClassName,\n tokens,\n style,\n ...otherProps\n } = allProps as Record<string, unknown> as AllBasePropsWithMods<K> &\n WithVariant<V> & {\n className?: string;\n tokens?: Tokens;\n style?: Record<string, unknown>;\n };\n\n let styles = rawStyles;\n\n // Optimize propStyles extraction - avoid creating empty objects\n let propStyles: Styles | null = null;\n const propsToCheck = styleProps\n ? (styleProps as StyleList).concat(BASE_STYLES)\n : BASE_STYLES;\n\n for (const prop of propsToCheck) {\n const key = prop as unknown as string;\n\n if (!propStyles) propStyles = {};\n\n if (key in otherProps) {\n (propStyles as any)[key] = (otherProps as any)[key];\n delete (otherProps as any)[key];\n }\n }\n\n if (\n !styles ||\n (styles && Object.keys(styles as Record<string, unknown>).length === 0)\n ) {\n styles = undefined as unknown as Styles;\n }\n\n // Determine base styles: use variant styles if available, otherwise default styles\n const baseStyles = variantStylesMap\n ? variantStylesMap[(variant as string) || 'default'] ??\n variantStylesMap['default']\n : defaultStyles;\n\n // Merge base styles with instance styles and prop styles\n const allStyles = useMemo(() => {\n const hasStyles =\n styles && Object.keys(styles as Record<string, unknown>).length > 0;\n const hasPropStyles = propStyles && Object.keys(propStyles).length > 0;\n\n if (!hasStyles && !hasPropStyles) {\n return baseStyles;\n }\n\n return mergeStyles(baseStyles, styles as Styles, propStyles as Styles);\n }, [baseStyles, styles, propStyles]);\n\n // Use the useStyles hook for style generation and injection\n const { className: stylesClassName } = useStyles(allStyles);\n\n // Merge default tokens with instance tokens (instance overrides defaults)\n const tokensKey = stringifyTokens(tokens as Tokens | undefined);\n const mergedTokens = useMemo(() => {\n if (!defaultTokens && !tokens) return undefined;\n if (!defaultTokens) return tokens as Tokens;\n if (!tokens) return defaultTokens;\n return { ...defaultTokens, ...tokens } as Tokens;\n }, [tokensKey]);\n\n // Process merged tokens into inline style properties\n const processedTokenStyle = useMemo(() => {\n return processTokens(mergedTokens);\n }, [mergedTokens]);\n\n // Merge processed tokens with explicit style prop (style has priority)\n const mergedStyle = useMemo(() => {\n if (!processedTokenStyle && !style) return undefined;\n if (!processedTokenStyle) return style;\n if (!style) return processedTokenStyle;\n return { ...processedTokenStyle, ...style };\n }, [processedTokenStyle, style]);\n\n let modProps: Record<string, unknown> | undefined;\n if (mods) {\n const modsObject = mods as unknown as Record<string, unknown>;\n modProps = modAttrs(modsObject as any) as Record<string, unknown>;\n }\n\n // Merge user className with generated className\n const finalClassName = [(userClassName as string) || '', stylesClassName]\n .filter(Boolean)\n .join(' ');\n\n const elementProps = {\n 'data-element': (element as string | undefined) || defaultElement,\n 'data-qa': (qa as string | undefined) || defaultQa,\n 'data-qaval': (qaVal as string | undefined) || defaultQaVal,\n ...(otherDefaultProps as unknown as Record<string, unknown>),\n ...(modProps || {}),\n ...(otherProps as unknown as Record<string, unknown>),\n className: finalClassName,\n style: mergedStyle,\n ref,\n } as Record<string, unknown>;\n\n // Apply the helper to handle is* properties\n handleIsProperties(elementProps);\n\n const renderedElement = createElement(\n (as as string | 'div') ?? originalAs,\n elementProps,\n );\n\n return renderedElement;\n });\n\n _TastyComponent.displayName = `TastyComponent(${\n (defaultProps as any).qa || originalAs\n })`;\n\n // Attach sub-element components if elements are defined\n if (elements) {\n const subElements = Object.entries(elements).reduce(\n (acc, [name, definition]) => {\n acc[name] = createSubElement(\n name,\n definition as SubElementDefinition<keyof JSX.IntrinsicElements>,\n );\n return acc;\n },\n {} as Record<string, ForwardRefExoticComponent<any>>,\n );\n\n return Object.assign(_TastyComponent, subElements);\n }\n\n return _TastyComponent;\n}\n\nexport const Element = tasty({});\n"],"mappings":";;;;;;;;;;;;;AA4CA,MAAM,wBAAwB,OAAO,QATX;CACxB,YAAY;CACZ,UAAU;CACV,WAAW;CACZ,CAK8D;;;;;AAM/D,SAAS,mBAAmB,OAAgC;AAC1D,MAAK,MAAM,CAAC,YAAY,oBAAo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mB;EAIxC,MAAM,iBAAiB,CAAE,iBAA4B,IAAI,gBAAgB,CACtE,OAAO,QAAQ,CACf,KAAK,IAAI;EAEZ,MAAM,eAAe;GACnB,gBAAiB,WAAkC;GACnD,WAAY,MAA6B;GACzC,cAAe,SAAgC;GAC/C,GAAI;GACJ,GAAI,YAAY,EAAE;GAClB,GAAI;GACJ,WAAW;GACX,OAAO;GACP;GACD;AAGD,qBAAmB,aAAa;AAOhC,SALwB,cACrB,MAAyB,YAC1B,aACD;GAGD;AAEF,iBAAgB,cAAc,kBAC3B,aAAqB,MAAM,WAC7B;AAGD,KAAI,UAAU;EACZ,MAAM,cAAc,OAAO,QAAQ,SAAS,CAAC,QAC1C,KAAK,CAAC,MAAM,gBAAgB;AAC3B,OAAI,QAAQ,iBACV,MACA,WACD;AACD,UAAO;KAET,EAAE,CACH;AAED,SAAO,OAAO,OAAO,iBAAiB,YAAY;;AAGpD,QAAO;;AAGT,MAAa,UAAU,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/tokens/typography.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Typography preset configuration.
|
|
4
|
+
* Each preset defines font properties that get expanded into CSS custom properties.
|
|
5
|
+
*/
|
|
6
|
+
interface TypographyPreset {
|
|
7
|
+
fontSize: string;
|
|
8
|
+
lineHeight: string;
|
|
9
|
+
letterSpacing?: string;
|
|
10
|
+
fontWeight: string | number;
|
|
11
|
+
boldFontWeight?: string | number;
|
|
12
|
+
iconSize?: string;
|
|
13
|
+
textTransform?: string;
|
|
14
|
+
fontFamily?: string;
|
|
15
|
+
fontStyle?: string;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { TypographyPreset };
|
|
19
|
+
//# sourceMappingURL=typography.d.ts.map
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
//#region src/tokens/typography.ts
|
|
2
|
+
/**
|
|
3
|
+
* Typography presets for headings, text, and special styles.
|
|
4
|
+
*
|
|
5
|
+
* Naming conventions:
|
|
6
|
+
* - `h1`-`h6`: Headings (bold by default)
|
|
7
|
+
* - `t1`-`t4`: Text styles (regular weight)
|
|
8
|
+
* - `t1m`-`t4m`: Text styles medium weight
|
|
9
|
+
* - `m1`-`m3`: Markdown/prose styles (larger line-height)
|
|
10
|
+
* - `p1`-`p4`: Paragraph styles
|
|
11
|
+
* - `c1`-`c2`: Caption/uppercase styles
|
|
12
|
+
* - `tag`: Tag/badge typography
|
|
13
|
+
* - `strong`, `em`: Inline semantic styles
|
|
14
|
+
* - `default`: Base text style
|
|
15
|
+
*/
|
|
16
|
+
const TYPOGRAPHY_PRESETS = {
|
|
17
|
+
text: {
|
|
18
|
+
fontSize: "14px",
|
|
19
|
+
lineHeight: "20px",
|
|
20
|
+
letterSpacing: "0",
|
|
21
|
+
fontWeight: "400"
|
|
22
|
+
},
|
|
23
|
+
h1: {
|
|
24
|
+
fontSize: "36px",
|
|
25
|
+
lineHeight: "44px",
|
|
26
|
+
letterSpacing: "-0.01em",
|
|
27
|
+
fontWeight: "600",
|
|
28
|
+
boldFontWeight: "700",
|
|
29
|
+
iconSize: "40px"
|
|
30
|
+
},
|
|
31
|
+
h2: {
|
|
32
|
+
fontSize: "24px",
|
|
33
|
+
lineHeight: "32px",
|
|
34
|
+
letterSpacing: "0em",
|
|
35
|
+
fontWeight: "600",
|
|
36
|
+
boldFontWeight: "700",
|
|
37
|
+
iconSize: "28px"
|
|
38
|
+
},
|
|
39
|
+
h3: {
|
|
40
|
+
fontSize: "20px",
|
|
41
|
+
lineHeight: "28px",
|
|
42
|
+
letterSpacing: "0em",
|
|
43
|
+
fontWeight: "600",
|
|
44
|
+
boldFontWeight: "700",
|
|
45
|
+
iconSize: "24px"
|
|
46
|
+
},
|
|
47
|
+
h4: {
|
|
48
|
+
fontSize: "18px",
|
|
49
|
+
lineHeight: "24px",
|
|
50
|
+
letterSpacing: "0",
|
|
51
|
+
fontWeight: "600",
|
|
52
|
+
boldFontWeight: "700",
|
|
53
|
+
iconSize: "22px"
|
|
54
|
+
},
|
|
55
|
+
h5: {
|
|
56
|
+
fontSize: "16px",
|
|
57
|
+
lineHeight: "22px",
|
|
58
|
+
letterSpacing: "0",
|
|
59
|
+
fontWeight: "600",
|
|
60
|
+
boldFontWeight: "700",
|
|
61
|
+
iconSize: "20px"
|
|
62
|
+
},
|
|
63
|
+
h6: {
|
|
64
|
+
fontSize: "14px",
|
|
65
|
+
lineHeight: "20px",
|
|
66
|
+
letterSpacing: "0.01em",
|
|
67
|
+
fontWeight: "600",
|
|
68
|
+
boldFontWeight: "700",
|
|
69
|
+
iconSize: "20px"
|
|
70
|
+
},
|
|
71
|
+
t1: {
|
|
72
|
+
fontSize: "18px",
|
|
73
|
+
lineHeight: "24px",
|
|
74
|
+
letterSpacing: "0",
|
|
75
|
+
fontWeight: "400",
|
|
76
|
+
boldFontWeight: "600",
|
|
77
|
+
iconSize: "20px"
|
|
78
|
+
},
|
|
79
|
+
t2: {
|
|
80
|
+
fontSize: "16px",
|
|
81
|
+
lineHeight: "22px",
|
|
82
|
+
letterSpacing: "0",
|
|
83
|
+
fontWeight: "400",
|
|
84
|
+
boldFontWeight: "600",
|
|
85
|
+
iconSize: "20px"
|
|
86
|
+
},
|
|
87
|
+
t2m: {
|
|
88
|
+
fontSize: "16px",
|
|
89
|
+
lineHeight: "22px",
|
|
90
|
+
letterSpacing: "0",
|
|
91
|
+
fontWeight: "500",
|
|
92
|
+
boldFontWeight: "600",
|
|
93
|
+
iconSize: "20px"
|
|
94
|
+
},
|
|
95
|
+
t3: {
|
|
96
|
+
fontSize: "14px",
|
|
97
|
+
lineHeight: "20px",
|
|
98
|
+
letterSpacing: "0",
|
|
99
|
+
fontWeight: "400",
|
|
100
|
+
boldFontWeight: "600",
|
|
101
|
+
iconSize: "18px"
|
|
102
|
+
},
|
|
103
|
+
t3m: {
|
|
104
|
+
fontSize: "14px",
|
|
105
|
+
lineHeight: "20px",
|
|
106
|
+
letterSpacing: "0",
|
|
107
|
+
fontWeight: "500",
|
|
108
|
+
boldFontWeight: "600",
|
|
109
|
+
iconSize: "18px"
|
|
110
|
+
},
|
|
111
|
+
t4: {
|
|
112
|
+
fontSize: "12px",
|
|
113
|
+
lineHeight: "18px",
|
|
114
|
+
letterSpacing: "0",
|
|
115
|
+
fontWeight: "500",
|
|
116
|
+
boldFontWeight: "600",
|
|
117
|
+
iconSize: "16px"
|
|
118
|
+
},
|
|
119
|
+
t4m: {
|
|
120
|
+
fontSize: "12px",
|
|
121
|
+
lineHeight: "18px",
|
|
122
|
+
letterSpacing: "0",
|
|
123
|
+
fontWeight: "600",
|
|
124
|
+
boldFontWeight: "700",
|
|
125
|
+
iconSize: "16px"
|
|
126
|
+
},
|
|
127
|
+
m1: {
|
|
128
|
+
fontSize: "18px",
|
|
129
|
+
lineHeight: "32px",
|
|
130
|
+
letterSpacing: "0",
|
|
131
|
+
fontWeight: "400",
|
|
132
|
+
boldFontWeight: "600",
|
|
133
|
+
iconSize: "22px"
|
|
134
|
+
},
|
|
135
|
+
m2: {
|
|
136
|
+
fontSize: "16px",
|
|
137
|
+
lineHeight: "28px",
|
|
138
|
+
letterSpacing: "0",
|
|
139
|
+
fontWeight: "400",
|
|
140
|
+
boldFontWeight: "600",
|
|
141
|
+
iconSize: "20px"
|
|
142
|
+
},
|
|
143
|
+
m3: {
|
|
144
|
+
fontSize: "14px",
|
|
145
|
+
lineHeight: "24px",
|
|
146
|
+
letterSpacing: "0",
|
|
147
|
+
fontWeight: "400",
|
|
148
|
+
boldFontWeight: "600",
|
|
149
|
+
iconSize: "20px"
|
|
150
|
+
},
|
|
151
|
+
p1: {
|
|
152
|
+
fontSize: "18px",
|
|
153
|
+
lineHeight: "28px",
|
|
154
|
+
letterSpacing: "0",
|
|
155
|
+
fontWeight: "400",
|
|
156
|
+
boldFontWeight: "600",
|
|
157
|
+
iconSize: "22px"
|
|
158
|
+
},
|
|
159
|
+
p2: {
|
|
160
|
+
fontSize: "16px",
|
|
161
|
+
lineHeight: "24px",
|
|
162
|
+
letterSpacing: "0",
|
|
163
|
+
fontWeight: "400",
|
|
164
|
+
boldFontWeight: "600",
|
|
165
|
+
iconSize: "20px"
|
|
166
|
+
},
|
|
167
|
+
p3: {
|
|
168
|
+
fontSize: "14px",
|
|
169
|
+
lineHeight: "22px",
|
|
170
|
+
letterSpacing: "0",
|
|
171
|
+
fontWeight: "400",
|
|
172
|
+
boldFontWeight: "600",
|
|
173
|
+
iconSize: "18px"
|
|
174
|
+
},
|
|
175
|
+
p4: {
|
|
176
|
+
fontSize: "12px",
|
|
177
|
+
lineHeight: "20px",
|
|
178
|
+
letterSpacing: "0",
|
|
179
|
+
fontWeight: "500",
|
|
180
|
+
boldFontWeight: "600",
|
|
181
|
+
iconSize: "16px"
|
|
182
|
+
},
|
|
183
|
+
c1: {
|
|
184
|
+
fontSize: "14px",
|
|
185
|
+
lineHeight: "20px",
|
|
186
|
+
letterSpacing: "0",
|
|
187
|
+
fontWeight: "600",
|
|
188
|
+
boldFontWeight: "700",
|
|
189
|
+
textTransform: "uppercase",
|
|
190
|
+
iconSize: "18px"
|
|
191
|
+
},
|
|
192
|
+
c2: {
|
|
193
|
+
fontSize: "12px",
|
|
194
|
+
lineHeight: "18px",
|
|
195
|
+
letterSpacing: "0.01em",
|
|
196
|
+
fontWeight: "600",
|
|
197
|
+
boldFontWeight: "700",
|
|
198
|
+
textTransform: "uppercase",
|
|
199
|
+
iconSize: "16px"
|
|
200
|
+
},
|
|
201
|
+
tag: {
|
|
202
|
+
fontSize: "12px",
|
|
203
|
+
lineHeight: "18px",
|
|
204
|
+
letterSpacing: "0.01em",
|
|
205
|
+
fontWeight: "600",
|
|
206
|
+
boldFontWeight: "700",
|
|
207
|
+
iconSize: "16px"
|
|
208
|
+
},
|
|
209
|
+
strong: {
|
|
210
|
+
fontSize: "inherit",
|
|
211
|
+
lineHeight: "inherit",
|
|
212
|
+
letterSpacing: "inherit",
|
|
213
|
+
fontFamily: "inherit",
|
|
214
|
+
fontStyle: "inherit",
|
|
215
|
+
fontWeight: "var(--bold-font-weight, var(--default-bold-font-weight, 600))"
|
|
216
|
+
},
|
|
217
|
+
em: {
|
|
218
|
+
fontSize: "inherit",
|
|
219
|
+
lineHeight: "inherit",
|
|
220
|
+
letterSpacing: "inherit",
|
|
221
|
+
fontFamily: "inherit",
|
|
222
|
+
fontStyle: "italic",
|
|
223
|
+
fontWeight: "inherit"
|
|
224
|
+
},
|
|
225
|
+
default: {
|
|
226
|
+
fontSize: "var(--t3-font-size)",
|
|
227
|
+
lineHeight: "var(--t3-line-height)",
|
|
228
|
+
letterSpacing: "var(--t3-letter-spacing)",
|
|
229
|
+
fontWeight: "var(--t3-font-weight)",
|
|
230
|
+
boldFontWeight: "600",
|
|
231
|
+
iconSize: "inherit"
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
//#endregion
|
|
236
|
+
export { TYPOGRAPHY_PRESETS };
|
|
237
|
+
//# sourceMappingURL=typography.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typography.js","names":[],"sources":["../../src/tokens/typography.ts"],"sourcesContent":["/**\n * Typography preset configuration.\n * Each preset defines font properties that get expanded into CSS custom properties.\n */\nexport interface TypographyPreset {\n fontSize: string;\n lineHeight: string;\n letterSpacing?: string;\n fontWeight: string | number;\n boldFontWeight?: string | number;\n iconSize?: string;\n textTransform?: string;\n fontFamily?: string;\n fontStyle?: string;\n}\n\n/**\n * Typography presets for headings, text, and special styles.\n *\n * Naming conventions:\n * - `h1`-`h6`: Headings (bold by default)\n * - `t1`-`t4`: Text styles (regular weight)\n * - `t1m`-`t4m`: Text styles medium weight\n * - `m1`-`m3`: Markdown/prose styles (larger line-height)\n * - `p1`-`p4`: Paragraph styles\n * - `c1`-`c2`: Caption/uppercase styles\n * - `tag`: Tag/badge typography\n * - `strong`, `em`: Inline semantic styles\n * - `default`: Base text style\n */\nexport const TYPOGRAPHY_PRESETS: Record<string, TypographyPreset> = {\n // Text (basic)\n text: {\n fontSize: '14px',\n lineHeight: '20px',\n letterSpacing: '0',\n fontWeight: '400',\n },\n\n // Headings (h1-h6)\n h1: {\n fontSize: '36px',\n lineHeight: '44px',\n letterSpacing: '-0.01em',\n fontWeight: '600',\n boldFontWeight: '700',\n iconSize: '40px',\n },\n h2: {\n fontSize: '24px',\n lineHeight: '32px',\n letterSpacing: '0em',\n fontWeight: '600',\n boldFontWeight: '700',\n iconSize: '28px',\n },\n h3: {\n fontSize: '20px',\n lineHeight: '28px',\n letterSpacing: '0em',\n fontWeight: '600',\n boldFontWeight: '700',\n iconSize: '24px',\n },\n h4: {\n fontSize: '18px',\n lineHeight: '24px',\n letterSpacing: '0',\n fontWeight: '600',\n boldFontWeight: '700',\n iconSize: '22px',\n },\n h5: {\n fontSize: '16px',\n lineHeight: '22px',\n letterSpacing: '0',\n fontWeight: '600',\n boldFontWeight: '700',\n iconSize: '20px',\n },\n h6: {\n fontSize: '14px',\n lineHeight: '20px',\n letterSpacing: '0.01em',\n fontWeight: '600',\n boldFontWeight: '700',\n iconSize: '20px',\n },\n\n // Text styles (t1-t4)\n t1: {\n fontSize: '18px',\n lineHeight: '24px',\n letterSpacing: '0',\n fontWeight: '400',\n boldFontWeight: '600',\n iconSize: '20px',\n },\n t2: {\n fontSize: '16px',\n lineHeight: '22px',\n letterSpacing: '0',\n fontWeight: '400',\n boldFontWeight: '600',\n iconSize: '20px',\n },\n t2m: {\n fontSize: '16px',\n lineHeight: '22px',\n letterSpacing: '0',\n fontWeight: '500',\n boldFontWeight: '600',\n iconSize: '20px',\n },\n t3: {\n fontSize: '14px',\n lineHeight: '20px',\n letterSpacing: '0',\n fontWeight: '400',\n boldFontWeight: '600',\n iconSize: '18px',\n },\n t3m: {\n fontSize: '14px',\n lineHeight: '20px',\n letterSpacing: '0',\n fontWeight: '500',\n boldFontWeight: '600',\n iconSize: '18px',\n },\n t4: {\n fontSize: '12px',\n lineHeight: '18px',\n letterSpacing: '0',\n fontWeight: '500',\n boldFontWeight: '600',\n iconSize: '16px',\n },\n t4m: {\n fontSize: '12px',\n lineHeight: '18px',\n letterSpacing: '0',\n fontWeight: '600',\n boldFontWeight: '700',\n iconSize: '16px',\n },\n\n // Markdown/prose styles (m1-m3)\n m1: {\n fontSize: '18px',\n lineHeight: '32px',\n letterSpacing: '0',\n fontWeight: '400',\n boldFontWeight: '600',\n iconSize: '22px',\n },\n m2: {\n fontSize: '16px',\n lineHeight: '28px',\n letterSpacing: '0',\n fontWeight: '400',\n boldFontWeight: '600',\n iconSize: '20px',\n },\n m3: {\n fontSize: '14px',\n lineHeight: '24px',\n letterSpacing: '0',\n fontWeight: '400',\n boldFontWeight: '600',\n iconSize: '20px',\n },\n\n // Paragraph styles (p1-p4)\n p1: {\n fontSize: '18px',\n lineHeight: '28px',\n letterSpacing: '0',\n fontWeight: '400',\n boldFontWeight: '600',\n iconSize: '22px',\n },\n p2: {\n fontSize: '16px',\n lineHeight: '24px',\n letterSpacing: '0',\n fontWeight: '400',\n boldFontWeight: '600',\n iconSize: '20px',\n },\n p3: {\n fontSize: '14px',\n lineHeight: '22px',\n letterSpacing: '0',\n fontWeight: '400',\n boldFontWeight: '600',\n iconSize: '18px',\n },\n p4: {\n fontSize: '12px',\n lineHeight: '20px',\n letterSpacing: '0',\n fontWeight: '500',\n boldFontWeight: '600',\n iconSize: '16px',\n },\n\n // Caption/uppercase styles (c1-c2)\n c1: {\n fontSize: '14px',\n lineHeight: '20px',\n letterSpacing: '0',\n fontWeight: '600',\n boldFontWeight: '700',\n textTransform: 'uppercase',\n iconSize: '18px',\n },\n c2: {\n fontSize: '12px',\n lineHeight: '18px',\n letterSpacing: '0.01em',\n fontWeight: '600',\n boldFontWeight: '700',\n textTransform: 'uppercase',\n iconSize: '16px',\n },\n\n // Tag typography\n tag: {\n fontSize: '12px',\n lineHeight: '18px',\n letterSpacing: '0.01em',\n fontWeight: '600',\n boldFontWeight: '700',\n iconSize: '16px',\n },\n\n // Inline semantic styles\n strong: {\n fontSize: 'inherit',\n lineHeight: 'inherit',\n letterSpacing: 'inherit',\n fontFamily: 'inherit',\n fontStyle: 'inherit',\n fontWeight: 'var(--bold-font-weight, var(--default-bold-font-weight, 600))',\n },\n em: {\n fontSize: 'inherit',\n lineHeight: 'inherit',\n letterSpacing: 'inherit',\n fontFamily: 'inherit',\n fontStyle: 'italic',\n fontWeight: 'inherit',\n },\n\n // Default text style (references t3)\n default: {\n fontSize: 'var(--t3-font-size)',\n lineHeight: 'var(--t3-line-height)',\n letterSpacing: 'var(--t3-letter-spacing)',\n fontWeight: 'var(--t3-font-weight)',\n boldFontWeight: '600',\n iconSize: 'inherit',\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;AA8BA,MAAa,qBAAuD;CAElE,MAAM;EACJ,UAAU;EACV,YAAY;EACZ,eAAe;EACf,YAAY;EACb;CAGD,IAAI;EACF,UAAU;EACV,YAAY;EACZ,eAAe;EACf,YAAY;EACZ,gBAAgB;EAChB,UAAU;EACX;CACD,IAAI;EACF,UAAU;EACV,YAAY;EACZ,eAAe;EACf,YAAY;EACZ,gBAAgB;EAChB,UAAU;EACX;CACD,IAAI;EACF,UAAU;EACV,YAAY;EACZ,eAAe;EACf,YAAY;EACZ,gBAAgB;EAChB,UAAU;EACX;CACD,IAAI;EACF,UAAU;EACV,YAAY;EACZ,eAAe;EACf,YAAY;EACZ,gBAAgB;EAChB,UAAU;EACX;CACD,IAAI;EACF,UAAU;EACV,YAAY;EACZ,eAAe;EACf,YAAY;EACZ,gBAAgB;EAChB,UAAU;EACX;CACD,IAAI;EACF,UAAU;EACV,YAAY;EACZ,eAAe;EACf,YAAY;EACZ,gBAAgB;EAChB,UAAU;EACX;CAGD,IAAI;EACF,UAAU;EACV,YAAY;EACZ,eAAe;EACf,YAAY;EACZ,gBAAgB;EAChB,UAAU;EACX;CACD,IAAI;EACF,UAAU;EACV,YAAY;EACZ,eAAe;EACf,YAAY;EACZ,gBAAgB;EAChB,UAAU;EACX;CACD,KAAK;EACH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