@pandacss/shared 0.30.2 → 0.32.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/dist/index.d.mts +32 -8
- package/dist/index.d.ts +32 -8
- package/dist/index.js +140 -4
- package/dist/index.mjs +139 -4
- package/dist/{shared-z3agWt4M.d.mts → shared-4wnn7ulW.d.mts} +1 -1
- package/dist/{shared-z3agWt4M.d.ts → shared-4wnn7ulW.d.ts} +1 -1
- package/dist/shared.d.mts +1 -1
- package/dist/shared.d.ts +1 -1
- package/dist/shared.js +2 -1
- package/dist/shared.mjs +2 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-
|
|
2
|
-
export { x as WalkObjectOptions, f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getPatternStyles, s as getSlotCompoundVariant, r as getSlotRecipes, l as hypenateProperty, g as isBaseCondition, a as isBoolean, b as isFunction, j as isImportant, c as isObject, i as isString, z as mapObject, m as markImportant, n as memo, o as mergeProps, p as patternFns, u as splitProps, t as toHash, v as uniq, y as walkObject, w as withoutImportant, k as withoutSpace } from './shared-
|
|
1
|
+
import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-4wnn7ulW.mjs';
|
|
2
|
+
export { x as WalkObjectOptions, f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getPatternStyles, s as getSlotCompoundVariant, r as getSlotRecipes, l as hypenateProperty, g as isBaseCondition, a as isBoolean, b as isFunction, j as isImportant, c as isObject, i as isString, z as mapObject, m as markImportant, n as memo, o as mergeProps, p as patternFns, u as splitProps, t as toHash, v as uniq, y as walkObject, w as withoutImportant, k as withoutSpace } from './shared-4wnn7ulW.mjs';
|
|
3
3
|
export { astish } from './astish.mjs';
|
|
4
4
|
|
|
5
5
|
declare const getArbitraryValue: (_value: string) => string;
|
|
@@ -78,6 +78,27 @@ declare const createRegex: (item: Array<string | RegExp>) => RegExp;
|
|
|
78
78
|
declare const stringifyJson: (config: Record<string, any>) => string;
|
|
79
79
|
declare const parseJson: (config: string) => any;
|
|
80
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Get the property priority: the higher the priority, the higher the resulting
|
|
83
|
+
* specificity of the atom. For example, if we had:
|
|
84
|
+
*
|
|
85
|
+
* ```tsx
|
|
86
|
+
* import { css } from '@pandacss/dev';
|
|
87
|
+
*
|
|
88
|
+
* css({
|
|
89
|
+
* backgroundColor: 'blue',
|
|
90
|
+
* background: 'red',
|
|
91
|
+
* })
|
|
92
|
+
*
|
|
93
|
+
* ```
|
|
94
|
+
*
|
|
95
|
+
* and so the more specific selector would win
|
|
96
|
+
*
|
|
97
|
+
* Taken from
|
|
98
|
+
* @see https://github.com/callstack/linaria/blob/049a4ccb77e29f3628353352db21bd446fa04a2e/packages/atomic/src/processors/helpers/propertyPriority.ts
|
|
99
|
+
*/
|
|
100
|
+
declare function getPropertyPriority(property: string): 0 | 1 | 2;
|
|
101
|
+
|
|
81
102
|
declare function splitBy(value: string, separator?: string): any[];
|
|
82
103
|
declare function splitDotPath(path: string): string[];
|
|
83
104
|
declare function getNegativePath(path: string[]): string[];
|
|
@@ -89,19 +110,22 @@ type MapToRecord<K extends Map<string, any>> = {
|
|
|
89
110
|
declare function mapToJson<T extends Map<string, any>>(map: T): MapToRecord<T>;
|
|
90
111
|
|
|
91
112
|
type CallbackFn = (args: CallbackItem) => void;
|
|
92
|
-
|
|
113
|
+
interface CallbackItem {
|
|
93
114
|
value: any;
|
|
94
115
|
path: string;
|
|
116
|
+
paths: string[];
|
|
95
117
|
depth: number;
|
|
96
118
|
parent: any[] | Record<string, unknown>;
|
|
97
119
|
key: string;
|
|
98
|
-
}
|
|
120
|
+
}
|
|
99
121
|
declare const isObjectOrArray: (obj: unknown) => boolean;
|
|
100
|
-
|
|
101
|
-
separator
|
|
122
|
+
interface TraverseOptions {
|
|
123
|
+
separator?: string;
|
|
102
124
|
maxDepth?: number;
|
|
103
|
-
|
|
125
|
+
stop?: (args: CallbackItem) => boolean;
|
|
126
|
+
}
|
|
127
|
+
declare function traverse(obj: any, callback: CallbackFn, options?: TraverseOptions): void;
|
|
104
128
|
|
|
105
129
|
declare function unionType(values: IterableIterator<string> | string[] | readonly string[] | Set<string>): string;
|
|
106
130
|
|
|
107
|
-
export { CreateCssContext, type CssVar, type CssVarOptions, type MapToRecord, MappedObject, PandaError, type PandaErrorCode, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, deepSet, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getUnit, isCssFunction, isCssUnit, isCssVar, isObjectOrArray, mapEntries, mapToJson, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
|
|
131
|
+
export { CreateCssContext, type CssVar, type CssVarOptions, type MapToRecord, MappedObject, PandaError, type PandaErrorCode, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, deepSet, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getPropertyPriority, getUnit, isCssFunction, isCssUnit, isCssVar, isObjectOrArray, mapEntries, mapToJson, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-
|
|
2
|
-
export { x as WalkObjectOptions, f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getPatternStyles, s as getSlotCompoundVariant, r as getSlotRecipes, l as hypenateProperty, g as isBaseCondition, a as isBoolean, b as isFunction, j as isImportant, c as isObject, i as isString, z as mapObject, m as markImportant, n as memo, o as mergeProps, p as patternFns, u as splitProps, t as toHash, v as uniq, y as walkObject, w as withoutImportant, k as withoutSpace } from './shared-
|
|
1
|
+
import { W as WalkObjectStopFn, M as MappedObject, C as CreateCssContext } from './shared-4wnn7ulW.js';
|
|
2
|
+
export { x as WalkObjectOptions, f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getPatternStyles, s as getSlotCompoundVariant, r as getSlotRecipes, l as hypenateProperty, g as isBaseCondition, a as isBoolean, b as isFunction, j as isImportant, c as isObject, i as isString, z as mapObject, m as markImportant, n as memo, o as mergeProps, p as patternFns, u as splitProps, t as toHash, v as uniq, y as walkObject, w as withoutImportant, k as withoutSpace } from './shared-4wnn7ulW.js';
|
|
3
3
|
export { astish } from './astish.js';
|
|
4
4
|
|
|
5
5
|
declare const getArbitraryValue: (_value: string) => string;
|
|
@@ -78,6 +78,27 @@ declare const createRegex: (item: Array<string | RegExp>) => RegExp;
|
|
|
78
78
|
declare const stringifyJson: (config: Record<string, any>) => string;
|
|
79
79
|
declare const parseJson: (config: string) => any;
|
|
80
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Get the property priority: the higher the priority, the higher the resulting
|
|
83
|
+
* specificity of the atom. For example, if we had:
|
|
84
|
+
*
|
|
85
|
+
* ```tsx
|
|
86
|
+
* import { css } from '@pandacss/dev';
|
|
87
|
+
*
|
|
88
|
+
* css({
|
|
89
|
+
* backgroundColor: 'blue',
|
|
90
|
+
* background: 'red',
|
|
91
|
+
* })
|
|
92
|
+
*
|
|
93
|
+
* ```
|
|
94
|
+
*
|
|
95
|
+
* and so the more specific selector would win
|
|
96
|
+
*
|
|
97
|
+
* Taken from
|
|
98
|
+
* @see https://github.com/callstack/linaria/blob/049a4ccb77e29f3628353352db21bd446fa04a2e/packages/atomic/src/processors/helpers/propertyPriority.ts
|
|
99
|
+
*/
|
|
100
|
+
declare function getPropertyPriority(property: string): 0 | 1 | 2;
|
|
101
|
+
|
|
81
102
|
declare function splitBy(value: string, separator?: string): any[];
|
|
82
103
|
declare function splitDotPath(path: string): string[];
|
|
83
104
|
declare function getNegativePath(path: string[]): string[];
|
|
@@ -89,19 +110,22 @@ type MapToRecord<K extends Map<string, any>> = {
|
|
|
89
110
|
declare function mapToJson<T extends Map<string, any>>(map: T): MapToRecord<T>;
|
|
90
111
|
|
|
91
112
|
type CallbackFn = (args: CallbackItem) => void;
|
|
92
|
-
|
|
113
|
+
interface CallbackItem {
|
|
93
114
|
value: any;
|
|
94
115
|
path: string;
|
|
116
|
+
paths: string[];
|
|
95
117
|
depth: number;
|
|
96
118
|
parent: any[] | Record<string, unknown>;
|
|
97
119
|
key: string;
|
|
98
|
-
}
|
|
120
|
+
}
|
|
99
121
|
declare const isObjectOrArray: (obj: unknown) => boolean;
|
|
100
|
-
|
|
101
|
-
separator
|
|
122
|
+
interface TraverseOptions {
|
|
123
|
+
separator?: string;
|
|
102
124
|
maxDepth?: number;
|
|
103
|
-
|
|
125
|
+
stop?: (args: CallbackItem) => boolean;
|
|
126
|
+
}
|
|
127
|
+
declare function traverse(obj: any, callback: CallbackFn, options?: TraverseOptions): void;
|
|
104
128
|
|
|
105
129
|
declare function unionType(values: IterableIterator<string> | string[] | readonly string[] | Set<string>): string;
|
|
106
130
|
|
|
107
|
-
export { CreateCssContext, type CssVar, type CssVarOptions, type MapToRecord, MappedObject, PandaError, type PandaErrorCode, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, deepSet, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getUnit, isCssFunction, isCssUnit, isCssVar, isObjectOrArray, mapEntries, mapToJson, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
|
|
131
|
+
export { CreateCssContext, type CssVar, type CssVarOptions, type MapToRecord, MappedObject, PandaError, type PandaErrorCode, WalkObjectStopFn, calc, camelCaseProperty, capitalize, createRegex, cssVar, dashCase, deepSet, entries, esc, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getPropertyPriority, getUnit, isCssFunction, isCssUnit, isCssVar, isObjectOrArray, mapEntries, mapToJson, normalizeStyleObject, parseJson, splitBy, splitDotPath, stringifyJson, toEm, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType };
|
package/dist/index.js
CHANGED
|
@@ -42,6 +42,7 @@ __export(src_exports, {
|
|
|
42
42
|
getNegativePath: () => getNegativePath,
|
|
43
43
|
getOrCreateSet: () => getOrCreateSet,
|
|
44
44
|
getPatternStyles: () => getPatternStyles,
|
|
45
|
+
getPropertyPriority: () => getPropertyPriority,
|
|
45
46
|
getSlotCompoundVariant: () => getSlotCompoundVariant,
|
|
46
47
|
getSlotRecipes: () => getSlotRecipes,
|
|
47
48
|
getUnit: () => getUnit,
|
|
@@ -351,7 +352,8 @@ function createCss(context) {
|
|
|
351
352
|
}
|
|
352
353
|
return result;
|
|
353
354
|
};
|
|
354
|
-
return memo((
|
|
355
|
+
return memo(({ base, ...styles } = {}) => {
|
|
356
|
+
const styleObject = Object.assign(styles, base);
|
|
355
357
|
const normalizedObject = normalizeStyleObject(styleObject, context);
|
|
356
358
|
const classNames = /* @__PURE__ */ new Set();
|
|
357
359
|
walkObject(normalizedObject, (value, paths) => {
|
|
@@ -620,6 +622,125 @@ var parseJson = (config) => {
|
|
|
620
622
|
return JSON.parse(config);
|
|
621
623
|
};
|
|
622
624
|
|
|
625
|
+
// src/shorthand-properties.ts
|
|
626
|
+
var shorthandProperties = {
|
|
627
|
+
animation: [
|
|
628
|
+
"animationName",
|
|
629
|
+
"animationDuration",
|
|
630
|
+
"animationTimingFunction",
|
|
631
|
+
"animationDelay",
|
|
632
|
+
"animationIterationCount",
|
|
633
|
+
"animationDirection",
|
|
634
|
+
"animationFillMode",
|
|
635
|
+
"animationPlayState"
|
|
636
|
+
],
|
|
637
|
+
background: [
|
|
638
|
+
"backgroundImage",
|
|
639
|
+
"backgroundPosition",
|
|
640
|
+
"backgroundSize",
|
|
641
|
+
"backgroundRepeat",
|
|
642
|
+
"backgroundAttachment",
|
|
643
|
+
"backgroundOrigin",
|
|
644
|
+
"backgroundClip",
|
|
645
|
+
"backgroundColor"
|
|
646
|
+
],
|
|
647
|
+
backgroundPosition: ["backgroundPositionX", "backgroundPositionY"],
|
|
648
|
+
border: ["borderWidth", "borderStyle", "borderColor"],
|
|
649
|
+
borderBlockEnd: ["borderBlockEndWidth", "borderBlockEndStyle", "borderBlockEndColor"],
|
|
650
|
+
borderBlockStart: ["borderBlockStartWidth", "borderBlockStartStyle", "borderBlockStartColor"],
|
|
651
|
+
borderBottom: ["borderBottomWidth", "borderBottomStyle", "borderBottomColor"],
|
|
652
|
+
borderColor: ["borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor"],
|
|
653
|
+
borderImage: ["borderImageSource", "borderImageSlice", "borderImageWidth", "borderImageOutset", "borderImageRepeat"],
|
|
654
|
+
borderInlineEnd: ["borderInlineEndWidth", "borderInlineEndStyle", "borderInlineEndColor"],
|
|
655
|
+
borderInlineStart: ["borderInlineStartWidth", "borderInlineStartStyle", "borderInlineStartColor"],
|
|
656
|
+
borderLeft: ["borderLeftWidth", "borderLeftStyle", "borderLeftColor"],
|
|
657
|
+
borderRadius: ["borderTopLeftRadius", "borderTopRightRadius", "borderBottomRightRadius", "borderBottomLeftRadius"],
|
|
658
|
+
borderRight: ["borderRightWidth", "borderRightStyle", "borderRightColor"],
|
|
659
|
+
borderStyle: ["borderTopStyle", "borderRightStyle", "borderBottomStyle", "borderLeftStyle"],
|
|
660
|
+
borderTop: ["borderTopWidth", "borderTopStyle", "borderTopColor"],
|
|
661
|
+
borderWidth: ["borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth"],
|
|
662
|
+
columnRule: ["columnRuleWidth", "columnRuleStyle", "columnRuleColor"],
|
|
663
|
+
columns: ["columnWidth", "columnCount"],
|
|
664
|
+
container: ["contain", "content"],
|
|
665
|
+
containIntrinsicSize: ["containIntrinsicSizeInline", "containIntrinsicSizeBlock"],
|
|
666
|
+
cue: ["cueBefore", "cueAfter"],
|
|
667
|
+
flex: ["flexGrow", "flexShrink", "flexBasis"],
|
|
668
|
+
flexFlow: ["flexDirection", "flexWrap"],
|
|
669
|
+
font: [
|
|
670
|
+
"fontStyle",
|
|
671
|
+
"fontVariantCaps",
|
|
672
|
+
"fontVariantEastAsian",
|
|
673
|
+
"fontVariantLigatures",
|
|
674
|
+
"fontVariantNumeric",
|
|
675
|
+
"fontVariantPosition",
|
|
676
|
+
"fontWeight",
|
|
677
|
+
"fontStretch",
|
|
678
|
+
"fontSize",
|
|
679
|
+
"lineHeight",
|
|
680
|
+
"fontFamily"
|
|
681
|
+
],
|
|
682
|
+
fontSynthesis: ["fontSynthesisWeight", "fontSynthesisStyle", "fontSynthesisSmallCaps"],
|
|
683
|
+
fontVariant: [
|
|
684
|
+
"fontVariantCaps",
|
|
685
|
+
"fontVariantEastAsian",
|
|
686
|
+
"fontVariantLigatures",
|
|
687
|
+
"fontVariantNumeric",
|
|
688
|
+
"fontVariantPosition"
|
|
689
|
+
],
|
|
690
|
+
gap: ["columnGap", "rowGap"],
|
|
691
|
+
grid: [
|
|
692
|
+
"gridTemplateColumns",
|
|
693
|
+
"gridTemplateRows",
|
|
694
|
+
"gridTemplateAreas",
|
|
695
|
+
"gridAutoColumns",
|
|
696
|
+
"gridAutoRows",
|
|
697
|
+
"gridAutoFlow"
|
|
698
|
+
],
|
|
699
|
+
gridArea: ["gridRowStart", "gridColumnStart", "gridRowEnd", "gridColumnEnd"],
|
|
700
|
+
gridColumn: ["gridColumnStart", "gridColumnEnd"],
|
|
701
|
+
gridGap: ["gridColumnGap", "gridRowGap"],
|
|
702
|
+
gridRow: ["gridRowStart", "gridRowEnd"],
|
|
703
|
+
gridTemplate: ["gridTemplateColumns", "gridTemplateRows", "gridTemplateAreas"],
|
|
704
|
+
inset: ["top", "right", "bottom", "left"],
|
|
705
|
+
listStyle: ["listStyleType", "listStylePosition", "listStyleImage"],
|
|
706
|
+
margin: ["marginTop", "marginRight", "marginBottom", "marginLeft"],
|
|
707
|
+
mask: ["maskImage", "maskMode", "maskRepeat", "maskPosition", "maskClip", "maskOrigin", "maskSize", "maskComposite"],
|
|
708
|
+
maskBorder: [
|
|
709
|
+
"maskBorderSource",
|
|
710
|
+
"maskBorderMode",
|
|
711
|
+
"maskBorderSlice",
|
|
712
|
+
"maskBorderWidth",
|
|
713
|
+
"maskBorderOutset",
|
|
714
|
+
"maskBorderRepeat"
|
|
715
|
+
],
|
|
716
|
+
offset: ["offsetPosition", "offsetPath", "offsetDistance", "offsetRotate", "offsetAnchor"],
|
|
717
|
+
outline: ["outlineWidth", "outlineStyle", "outlineColor"],
|
|
718
|
+
overflow: ["overflowX", "overflowY"],
|
|
719
|
+
padding: ["paddingTop", "paddingRight", "paddingBottom", "paddingLeft"],
|
|
720
|
+
pause: ["pauseBefore", "pauseAfter"],
|
|
721
|
+
placeContent: ["alignContent", "justifyContent"],
|
|
722
|
+
placeItems: ["alignItems", "justifyItems"],
|
|
723
|
+
placeSelf: ["alignSelf", "justifySelf"],
|
|
724
|
+
rest: ["restBefore", "restAfter"],
|
|
725
|
+
scrollMargin: ["scrollMarginTop", "scrollMarginRight", "scrollMarginBottom", "scrollMarginLeft"],
|
|
726
|
+
scrollPadding: ["scrollPaddingTop", "scrollPaddingRight", "scrollPaddingBottom", "scrollPaddingLeft"],
|
|
727
|
+
scrollPaddingBlock: ["scrollPaddingBlockStart", "scrollPaddingBlockEnd"],
|
|
728
|
+
scrollPaddingInline: ["scrollPaddingInlineStart", "scrollPaddingInlineEnd"],
|
|
729
|
+
scrollSnapMargin: ["scrollSnapMarginTop", "scrollSnapMarginRight", "scrollSnapMarginBottom", "scrollSnapMarginLeft"],
|
|
730
|
+
scrollSnapMarginBlock: ["scrollSnapMarginBlockStart", "scrollSnapMarginBlockEnd"],
|
|
731
|
+
scrollSnapMarginInline: ["scrollSnapMarginInlineStart", "scrollSnapMarginInlineEnd"],
|
|
732
|
+
scrollTimeline: ["scrollTimelineSource", "scrollTimelineOrientation"],
|
|
733
|
+
textDecoration: ["textDecorationLine", "textDecorationStyle", "textDecorationColor"],
|
|
734
|
+
textEmphasis: ["textEmphasisStyle", "textEmphasisColor"],
|
|
735
|
+
transition: ["transitionProperty", "transitionDuration", "transitionTimingFunction", "transitionDelay"]
|
|
736
|
+
};
|
|
737
|
+
var longhands = Object.values(shorthandProperties).reduce((a, b) => [...a, ...b], []);
|
|
738
|
+
function getPropertyPriority(property) {
|
|
739
|
+
if (property === "all")
|
|
740
|
+
return 0;
|
|
741
|
+
return longhands.includes(property) ? 2 : 1;
|
|
742
|
+
}
|
|
743
|
+
|
|
623
744
|
// src/slot.ts
|
|
624
745
|
var getSlotRecipes = (recipe = {}) => {
|
|
625
746
|
const init = (slot) => ({
|
|
@@ -728,23 +849,37 @@ function mapToJson(map) {
|
|
|
728
849
|
|
|
729
850
|
// src/traverse.ts
|
|
730
851
|
var isObjectOrArray = (obj) => typeof obj === "object" && obj !== null;
|
|
731
|
-
var defaultOptions = {
|
|
852
|
+
var defaultOptions = {
|
|
853
|
+
separator: ".",
|
|
854
|
+
maxDepth: Infinity
|
|
855
|
+
};
|
|
732
856
|
function traverse(obj, callback2, options = defaultOptions) {
|
|
733
857
|
const maxDepth = options.maxDepth ?? defaultOptions.maxDepth;
|
|
734
858
|
const separator = options.separator ?? defaultOptions.separator;
|
|
735
|
-
const stack = [{ value: obj, path: "", depth: -1, parent: null, key: "" }];
|
|
859
|
+
const stack = [{ value: obj, path: "", paths: [], depth: -1, parent: null, key: "" }];
|
|
736
860
|
while (stack.length > 0) {
|
|
737
861
|
const currentItem = stack.pop();
|
|
738
862
|
if (currentItem.parent !== null) {
|
|
739
863
|
callback2(currentItem);
|
|
740
864
|
}
|
|
865
|
+
if (options.stop?.(currentItem)) {
|
|
866
|
+
continue;
|
|
867
|
+
}
|
|
741
868
|
if (isObjectOrArray(currentItem.value) && currentItem.depth < maxDepth) {
|
|
742
869
|
const keys = Object.keys(currentItem.value);
|
|
743
870
|
for (let i = keys.length - 1; i >= 0; i--) {
|
|
744
871
|
const key = keys[i];
|
|
745
872
|
const value = currentItem.value[key];
|
|
746
873
|
const path = currentItem.path ? currentItem.path + separator + key : key;
|
|
747
|
-
|
|
874
|
+
const paths = currentItem.paths.concat(key);
|
|
875
|
+
stack.push({
|
|
876
|
+
value,
|
|
877
|
+
path,
|
|
878
|
+
paths,
|
|
879
|
+
depth: currentItem.depth + 1,
|
|
880
|
+
parent: currentItem.value,
|
|
881
|
+
key
|
|
882
|
+
});
|
|
748
883
|
}
|
|
749
884
|
}
|
|
750
885
|
}
|
|
@@ -781,6 +916,7 @@ var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(
|
|
|
781
916
|
getNegativePath,
|
|
782
917
|
getOrCreateSet,
|
|
783
918
|
getPatternStyles,
|
|
919
|
+
getPropertyPriority,
|
|
784
920
|
getSlotCompoundVariant,
|
|
785
921
|
getSlotRecipes,
|
|
786
922
|
getUnit,
|
package/dist/index.mjs
CHANGED
|
@@ -265,7 +265,8 @@ function createCss(context) {
|
|
|
265
265
|
}
|
|
266
266
|
return result;
|
|
267
267
|
};
|
|
268
|
-
return memo((
|
|
268
|
+
return memo(({ base, ...styles } = {}) => {
|
|
269
|
+
const styleObject = Object.assign(styles, base);
|
|
269
270
|
const normalizedObject = normalizeStyleObject(styleObject, context);
|
|
270
271
|
const classNames = /* @__PURE__ */ new Set();
|
|
271
272
|
walkObject(normalizedObject, (value, paths) => {
|
|
@@ -534,6 +535,125 @@ var parseJson = (config) => {
|
|
|
534
535
|
return JSON.parse(config);
|
|
535
536
|
};
|
|
536
537
|
|
|
538
|
+
// src/shorthand-properties.ts
|
|
539
|
+
var shorthandProperties = {
|
|
540
|
+
animation: [
|
|
541
|
+
"animationName",
|
|
542
|
+
"animationDuration",
|
|
543
|
+
"animationTimingFunction",
|
|
544
|
+
"animationDelay",
|
|
545
|
+
"animationIterationCount",
|
|
546
|
+
"animationDirection",
|
|
547
|
+
"animationFillMode",
|
|
548
|
+
"animationPlayState"
|
|
549
|
+
],
|
|
550
|
+
background: [
|
|
551
|
+
"backgroundImage",
|
|
552
|
+
"backgroundPosition",
|
|
553
|
+
"backgroundSize",
|
|
554
|
+
"backgroundRepeat",
|
|
555
|
+
"backgroundAttachment",
|
|
556
|
+
"backgroundOrigin",
|
|
557
|
+
"backgroundClip",
|
|
558
|
+
"backgroundColor"
|
|
559
|
+
],
|
|
560
|
+
backgroundPosition: ["backgroundPositionX", "backgroundPositionY"],
|
|
561
|
+
border: ["borderWidth", "borderStyle", "borderColor"],
|
|
562
|
+
borderBlockEnd: ["borderBlockEndWidth", "borderBlockEndStyle", "borderBlockEndColor"],
|
|
563
|
+
borderBlockStart: ["borderBlockStartWidth", "borderBlockStartStyle", "borderBlockStartColor"],
|
|
564
|
+
borderBottom: ["borderBottomWidth", "borderBottomStyle", "borderBottomColor"],
|
|
565
|
+
borderColor: ["borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor"],
|
|
566
|
+
borderImage: ["borderImageSource", "borderImageSlice", "borderImageWidth", "borderImageOutset", "borderImageRepeat"],
|
|
567
|
+
borderInlineEnd: ["borderInlineEndWidth", "borderInlineEndStyle", "borderInlineEndColor"],
|
|
568
|
+
borderInlineStart: ["borderInlineStartWidth", "borderInlineStartStyle", "borderInlineStartColor"],
|
|
569
|
+
borderLeft: ["borderLeftWidth", "borderLeftStyle", "borderLeftColor"],
|
|
570
|
+
borderRadius: ["borderTopLeftRadius", "borderTopRightRadius", "borderBottomRightRadius", "borderBottomLeftRadius"],
|
|
571
|
+
borderRight: ["borderRightWidth", "borderRightStyle", "borderRightColor"],
|
|
572
|
+
borderStyle: ["borderTopStyle", "borderRightStyle", "borderBottomStyle", "borderLeftStyle"],
|
|
573
|
+
borderTop: ["borderTopWidth", "borderTopStyle", "borderTopColor"],
|
|
574
|
+
borderWidth: ["borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth"],
|
|
575
|
+
columnRule: ["columnRuleWidth", "columnRuleStyle", "columnRuleColor"],
|
|
576
|
+
columns: ["columnWidth", "columnCount"],
|
|
577
|
+
container: ["contain", "content"],
|
|
578
|
+
containIntrinsicSize: ["containIntrinsicSizeInline", "containIntrinsicSizeBlock"],
|
|
579
|
+
cue: ["cueBefore", "cueAfter"],
|
|
580
|
+
flex: ["flexGrow", "flexShrink", "flexBasis"],
|
|
581
|
+
flexFlow: ["flexDirection", "flexWrap"],
|
|
582
|
+
font: [
|
|
583
|
+
"fontStyle",
|
|
584
|
+
"fontVariantCaps",
|
|
585
|
+
"fontVariantEastAsian",
|
|
586
|
+
"fontVariantLigatures",
|
|
587
|
+
"fontVariantNumeric",
|
|
588
|
+
"fontVariantPosition",
|
|
589
|
+
"fontWeight",
|
|
590
|
+
"fontStretch",
|
|
591
|
+
"fontSize",
|
|
592
|
+
"lineHeight",
|
|
593
|
+
"fontFamily"
|
|
594
|
+
],
|
|
595
|
+
fontSynthesis: ["fontSynthesisWeight", "fontSynthesisStyle", "fontSynthesisSmallCaps"],
|
|
596
|
+
fontVariant: [
|
|
597
|
+
"fontVariantCaps",
|
|
598
|
+
"fontVariantEastAsian",
|
|
599
|
+
"fontVariantLigatures",
|
|
600
|
+
"fontVariantNumeric",
|
|
601
|
+
"fontVariantPosition"
|
|
602
|
+
],
|
|
603
|
+
gap: ["columnGap", "rowGap"],
|
|
604
|
+
grid: [
|
|
605
|
+
"gridTemplateColumns",
|
|
606
|
+
"gridTemplateRows",
|
|
607
|
+
"gridTemplateAreas",
|
|
608
|
+
"gridAutoColumns",
|
|
609
|
+
"gridAutoRows",
|
|
610
|
+
"gridAutoFlow"
|
|
611
|
+
],
|
|
612
|
+
gridArea: ["gridRowStart", "gridColumnStart", "gridRowEnd", "gridColumnEnd"],
|
|
613
|
+
gridColumn: ["gridColumnStart", "gridColumnEnd"],
|
|
614
|
+
gridGap: ["gridColumnGap", "gridRowGap"],
|
|
615
|
+
gridRow: ["gridRowStart", "gridRowEnd"],
|
|
616
|
+
gridTemplate: ["gridTemplateColumns", "gridTemplateRows", "gridTemplateAreas"],
|
|
617
|
+
inset: ["top", "right", "bottom", "left"],
|
|
618
|
+
listStyle: ["listStyleType", "listStylePosition", "listStyleImage"],
|
|
619
|
+
margin: ["marginTop", "marginRight", "marginBottom", "marginLeft"],
|
|
620
|
+
mask: ["maskImage", "maskMode", "maskRepeat", "maskPosition", "maskClip", "maskOrigin", "maskSize", "maskComposite"],
|
|
621
|
+
maskBorder: [
|
|
622
|
+
"maskBorderSource",
|
|
623
|
+
"maskBorderMode",
|
|
624
|
+
"maskBorderSlice",
|
|
625
|
+
"maskBorderWidth",
|
|
626
|
+
"maskBorderOutset",
|
|
627
|
+
"maskBorderRepeat"
|
|
628
|
+
],
|
|
629
|
+
offset: ["offsetPosition", "offsetPath", "offsetDistance", "offsetRotate", "offsetAnchor"],
|
|
630
|
+
outline: ["outlineWidth", "outlineStyle", "outlineColor"],
|
|
631
|
+
overflow: ["overflowX", "overflowY"],
|
|
632
|
+
padding: ["paddingTop", "paddingRight", "paddingBottom", "paddingLeft"],
|
|
633
|
+
pause: ["pauseBefore", "pauseAfter"],
|
|
634
|
+
placeContent: ["alignContent", "justifyContent"],
|
|
635
|
+
placeItems: ["alignItems", "justifyItems"],
|
|
636
|
+
placeSelf: ["alignSelf", "justifySelf"],
|
|
637
|
+
rest: ["restBefore", "restAfter"],
|
|
638
|
+
scrollMargin: ["scrollMarginTop", "scrollMarginRight", "scrollMarginBottom", "scrollMarginLeft"],
|
|
639
|
+
scrollPadding: ["scrollPaddingTop", "scrollPaddingRight", "scrollPaddingBottom", "scrollPaddingLeft"],
|
|
640
|
+
scrollPaddingBlock: ["scrollPaddingBlockStart", "scrollPaddingBlockEnd"],
|
|
641
|
+
scrollPaddingInline: ["scrollPaddingInlineStart", "scrollPaddingInlineEnd"],
|
|
642
|
+
scrollSnapMargin: ["scrollSnapMarginTop", "scrollSnapMarginRight", "scrollSnapMarginBottom", "scrollSnapMarginLeft"],
|
|
643
|
+
scrollSnapMarginBlock: ["scrollSnapMarginBlockStart", "scrollSnapMarginBlockEnd"],
|
|
644
|
+
scrollSnapMarginInline: ["scrollSnapMarginInlineStart", "scrollSnapMarginInlineEnd"],
|
|
645
|
+
scrollTimeline: ["scrollTimelineSource", "scrollTimelineOrientation"],
|
|
646
|
+
textDecoration: ["textDecorationLine", "textDecorationStyle", "textDecorationColor"],
|
|
647
|
+
textEmphasis: ["textEmphasisStyle", "textEmphasisColor"],
|
|
648
|
+
transition: ["transitionProperty", "transitionDuration", "transitionTimingFunction", "transitionDelay"]
|
|
649
|
+
};
|
|
650
|
+
var longhands = Object.values(shorthandProperties).reduce((a, b) => [...a, ...b], []);
|
|
651
|
+
function getPropertyPriority(property) {
|
|
652
|
+
if (property === "all")
|
|
653
|
+
return 0;
|
|
654
|
+
return longhands.includes(property) ? 2 : 1;
|
|
655
|
+
}
|
|
656
|
+
|
|
537
657
|
// src/slot.ts
|
|
538
658
|
var getSlotRecipes = (recipe = {}) => {
|
|
539
659
|
const init = (slot) => ({
|
|
@@ -642,23 +762,37 @@ function mapToJson(map) {
|
|
|
642
762
|
|
|
643
763
|
// src/traverse.ts
|
|
644
764
|
var isObjectOrArray = (obj) => typeof obj === "object" && obj !== null;
|
|
645
|
-
var defaultOptions = {
|
|
765
|
+
var defaultOptions = {
|
|
766
|
+
separator: ".",
|
|
767
|
+
maxDepth: Infinity
|
|
768
|
+
};
|
|
646
769
|
function traverse(obj, callback2, options = defaultOptions) {
|
|
647
770
|
const maxDepth = options.maxDepth ?? defaultOptions.maxDepth;
|
|
648
771
|
const separator = options.separator ?? defaultOptions.separator;
|
|
649
|
-
const stack = [{ value: obj, path: "", depth: -1, parent: null, key: "" }];
|
|
772
|
+
const stack = [{ value: obj, path: "", paths: [], depth: -1, parent: null, key: "" }];
|
|
650
773
|
while (stack.length > 0) {
|
|
651
774
|
const currentItem = stack.pop();
|
|
652
775
|
if (currentItem.parent !== null) {
|
|
653
776
|
callback2(currentItem);
|
|
654
777
|
}
|
|
778
|
+
if (options.stop?.(currentItem)) {
|
|
779
|
+
continue;
|
|
780
|
+
}
|
|
655
781
|
if (isObjectOrArray(currentItem.value) && currentItem.depth < maxDepth) {
|
|
656
782
|
const keys = Object.keys(currentItem.value);
|
|
657
783
|
for (let i = keys.length - 1; i >= 0; i--) {
|
|
658
784
|
const key = keys[i];
|
|
659
785
|
const value = currentItem.value[key];
|
|
660
786
|
const path = currentItem.path ? currentItem.path + separator + key : key;
|
|
661
|
-
|
|
787
|
+
const paths = currentItem.paths.concat(key);
|
|
788
|
+
stack.push({
|
|
789
|
+
value,
|
|
790
|
+
path,
|
|
791
|
+
paths,
|
|
792
|
+
depth: currentItem.depth + 1,
|
|
793
|
+
parent: currentItem.value,
|
|
794
|
+
key
|
|
795
|
+
});
|
|
662
796
|
}
|
|
663
797
|
}
|
|
664
798
|
}
|
|
@@ -694,6 +828,7 @@ export {
|
|
|
694
828
|
getNegativePath,
|
|
695
829
|
getOrCreateSet,
|
|
696
830
|
getPatternStyles,
|
|
831
|
+
getPropertyPriority,
|
|
697
832
|
getSlotCompoundVariant,
|
|
698
833
|
getSlotRecipes,
|
|
699
834
|
getUnit,
|
|
@@ -29,7 +29,7 @@ interface CreateCssContext {
|
|
|
29
29
|
finalize: (paths: string[]) => string[];
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
declare function createCss(context: CreateCssContext): (
|
|
32
|
+
declare function createCss(context: CreateCssContext): ({ base, ...styles }?: Record<string, any>) => string;
|
|
33
33
|
interface StyleObject {
|
|
34
34
|
[key: string]: any;
|
|
35
35
|
}
|
|
@@ -29,7 +29,7 @@ interface CreateCssContext {
|
|
|
29
29
|
finalize: (paths: string[]) => string[];
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
declare function createCss(context: CreateCssContext): (
|
|
32
|
+
declare function createCss(context: CreateCssContext): ({ base, ...styles }?: Record<string, any>) => string;
|
|
33
33
|
interface StyleObject {
|
|
34
34
|
[key: string]: any;
|
|
35
35
|
}
|
package/dist/shared.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getPatternStyles, s as getSlotCompoundVariant, r as getSlotRecipes, l as hypenateProperty, g as isBaseCondition, c as isObject, z as mapObject, n as memo, o as mergeProps, p as patternFns, u as splitProps, t as toHash, v as uniq, y as walkObject, k as withoutSpace } from './shared-
|
|
1
|
+
export { f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getPatternStyles, s as getSlotCompoundVariant, r as getSlotRecipes, l as hypenateProperty, g as isBaseCondition, c as isObject, z as mapObject, n as memo, o as mergeProps, p as patternFns, u as splitProps, t as toHash, v as uniq, y as walkObject, k as withoutSpace } from './shared-4wnn7ulW.mjs';
|
package/dist/shared.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getPatternStyles, s as getSlotCompoundVariant, r as getSlotRecipes, l as hypenateProperty, g as isBaseCondition, c as isObject, z as mapObject, n as memo, o as mergeProps, p as patternFns, u as splitProps, t as toHash, v as uniq, y as walkObject, k as withoutSpace } from './shared-
|
|
1
|
+
export { f as compact, d as createCss, e as createMergeCss, h as filterBaseConditions, q as getPatternStyles, s as getSlotCompoundVariant, r as getSlotRecipes, l as hypenateProperty, g as isBaseCondition, c as isObject, z as mapObject, n as memo, o as mergeProps, p as patternFns, u as splitProps, t as toHash, v as uniq, y as walkObject, k as withoutSpace } from './shared-4wnn7ulW.js';
|
package/dist/shared.js
CHANGED
|
@@ -201,7 +201,8 @@ function createCss(context) {
|
|
|
201
201
|
}
|
|
202
202
|
return result;
|
|
203
203
|
};
|
|
204
|
-
return memo((
|
|
204
|
+
return memo(({ base, ...styles } = {}) => {
|
|
205
|
+
const styleObject = Object.assign(styles, base);
|
|
205
206
|
const normalizedObject = normalizeStyleObject(styleObject, context);
|
|
206
207
|
const classNames = /* @__PURE__ */ new Set();
|
|
207
208
|
walkObject(normalizedObject, (value, paths) => {
|
package/dist/shared.mjs
CHANGED
|
@@ -157,7 +157,8 @@ function createCss(context) {
|
|
|
157
157
|
}
|
|
158
158
|
return result;
|
|
159
159
|
};
|
|
160
|
-
return memo((
|
|
160
|
+
return memo(({ base, ...styles } = {}) => {
|
|
161
|
+
const styleObject = Object.assign(styles, base);
|
|
161
162
|
const normalizedObject = normalizeStyleObject(styleObject, context);
|
|
162
163
|
const classNames = /* @__PURE__ */ new Set();
|
|
163
164
|
walkObject(normalizedObject, (value, paths) => {
|