@pandacss/shared 0.30.1 → 0.31.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 +138 -4
- package/dist/index.mjs +137 -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): 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): 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,123 @@ 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
|
+
return longhands.includes(property) ? 2 : 1;
|
|
740
|
+
}
|
|
741
|
+
|
|
623
742
|
// src/slot.ts
|
|
624
743
|
var getSlotRecipes = (recipe = {}) => {
|
|
625
744
|
const init = (slot) => ({
|
|
@@ -728,23 +847,37 @@ function mapToJson(map) {
|
|
|
728
847
|
|
|
729
848
|
// src/traverse.ts
|
|
730
849
|
var isObjectOrArray = (obj) => typeof obj === "object" && obj !== null;
|
|
731
|
-
var defaultOptions = {
|
|
850
|
+
var defaultOptions = {
|
|
851
|
+
separator: ".",
|
|
852
|
+
maxDepth: Infinity
|
|
853
|
+
};
|
|
732
854
|
function traverse(obj, callback2, options = defaultOptions) {
|
|
733
855
|
const maxDepth = options.maxDepth ?? defaultOptions.maxDepth;
|
|
734
856
|
const separator = options.separator ?? defaultOptions.separator;
|
|
735
|
-
const stack = [{ value: obj, path: "", depth: -1, parent: null, key: "" }];
|
|
857
|
+
const stack = [{ value: obj, path: "", paths: [], depth: -1, parent: null, key: "" }];
|
|
736
858
|
while (stack.length > 0) {
|
|
737
859
|
const currentItem = stack.pop();
|
|
738
860
|
if (currentItem.parent !== null) {
|
|
739
861
|
callback2(currentItem);
|
|
740
862
|
}
|
|
863
|
+
if (options.stop?.(currentItem)) {
|
|
864
|
+
continue;
|
|
865
|
+
}
|
|
741
866
|
if (isObjectOrArray(currentItem.value) && currentItem.depth < maxDepth) {
|
|
742
867
|
const keys = Object.keys(currentItem.value);
|
|
743
868
|
for (let i = keys.length - 1; i >= 0; i--) {
|
|
744
869
|
const key = keys[i];
|
|
745
870
|
const value = currentItem.value[key];
|
|
746
871
|
const path = currentItem.path ? currentItem.path + separator + key : key;
|
|
747
|
-
|
|
872
|
+
const paths = currentItem.paths.concat(key);
|
|
873
|
+
stack.push({
|
|
874
|
+
value,
|
|
875
|
+
path,
|
|
876
|
+
paths,
|
|
877
|
+
depth: currentItem.depth + 1,
|
|
878
|
+
parent: currentItem.value,
|
|
879
|
+
key
|
|
880
|
+
});
|
|
748
881
|
}
|
|
749
882
|
}
|
|
750
883
|
}
|
|
@@ -781,6 +914,7 @@ var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(
|
|
|
781
914
|
getNegativePath,
|
|
782
915
|
getOrCreateSet,
|
|
783
916
|
getPatternStyles,
|
|
917
|
+
getPropertyPriority,
|
|
784
918
|
getSlotCompoundVariant,
|
|
785
919
|
getSlotRecipes,
|
|
786
920
|
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,123 @@ 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
|
+
return longhands.includes(property) ? 2 : 1;
|
|
653
|
+
}
|
|
654
|
+
|
|
537
655
|
// src/slot.ts
|
|
538
656
|
var getSlotRecipes = (recipe = {}) => {
|
|
539
657
|
const init = (slot) => ({
|
|
@@ -642,23 +760,37 @@ function mapToJson(map) {
|
|
|
642
760
|
|
|
643
761
|
// src/traverse.ts
|
|
644
762
|
var isObjectOrArray = (obj) => typeof obj === "object" && obj !== null;
|
|
645
|
-
var defaultOptions = {
|
|
763
|
+
var defaultOptions = {
|
|
764
|
+
separator: ".",
|
|
765
|
+
maxDepth: Infinity
|
|
766
|
+
};
|
|
646
767
|
function traverse(obj, callback2, options = defaultOptions) {
|
|
647
768
|
const maxDepth = options.maxDepth ?? defaultOptions.maxDepth;
|
|
648
769
|
const separator = options.separator ?? defaultOptions.separator;
|
|
649
|
-
const stack = [{ value: obj, path: "", depth: -1, parent: null, key: "" }];
|
|
770
|
+
const stack = [{ value: obj, path: "", paths: [], depth: -1, parent: null, key: "" }];
|
|
650
771
|
while (stack.length > 0) {
|
|
651
772
|
const currentItem = stack.pop();
|
|
652
773
|
if (currentItem.parent !== null) {
|
|
653
774
|
callback2(currentItem);
|
|
654
775
|
}
|
|
776
|
+
if (options.stop?.(currentItem)) {
|
|
777
|
+
continue;
|
|
778
|
+
}
|
|
655
779
|
if (isObjectOrArray(currentItem.value) && currentItem.depth < maxDepth) {
|
|
656
780
|
const keys = Object.keys(currentItem.value);
|
|
657
781
|
for (let i = keys.length - 1; i >= 0; i--) {
|
|
658
782
|
const key = keys[i];
|
|
659
783
|
const value = currentItem.value[key];
|
|
660
784
|
const path = currentItem.path ? currentItem.path + separator + key : key;
|
|
661
|
-
|
|
785
|
+
const paths = currentItem.paths.concat(key);
|
|
786
|
+
stack.push({
|
|
787
|
+
value,
|
|
788
|
+
path,
|
|
789
|
+
paths,
|
|
790
|
+
depth: currentItem.depth + 1,
|
|
791
|
+
parent: currentItem.value,
|
|
792
|
+
key
|
|
793
|
+
});
|
|
662
794
|
}
|
|
663
795
|
}
|
|
664
796
|
}
|
|
@@ -694,6 +826,7 @@ export {
|
|
|
694
826
|
getNegativePath,
|
|
695
827
|
getOrCreateSet,
|
|
696
828
|
getPatternStyles,
|
|
829
|
+
getPropertyPriority,
|
|
697
830
|
getSlotCompoundVariant,
|
|
698
831
|
getSlotRecipes,
|
|
699
832
|
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) => {
|