@luxonis/depthai-pipeline-lib 1.4.13 → 1.5.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/panda.css +670 -809
- package/dist/src/styled-system/chunks/src__components__Node.css +1 -0
- package/dist/src/styled-system/chunks/src__components__PipelineCanvas.css +1 -0
- package/dist/src/styled-system/css/conditions.mjs +4 -2
- package/dist/src/styled-system/css/css.d.mts +15 -2
- package/dist/src/styled-system/css/css.mjs +2 -1
- package/dist/src/styled-system/css/cva.d.mts +1 -1
- package/dist/src/styled-system/css/cva.mjs +28 -4
- package/dist/src/styled-system/css/sva.mjs +9 -3
- package/dist/src/styled-system/helpers.mjs +109 -64
- package/dist/src/styled-system/patterns/aspect-ratio.d.mts +1 -1
- package/dist/src/styled-system/patterns/aspect-ratio.mjs +5 -2
- package/dist/src/styled-system/patterns/bleed.d.mts +3 -3
- package/dist/src/styled-system/patterns/bleed.mjs +12 -7
- package/dist/src/styled-system/patterns/box.d.mts +1 -1
- package/dist/src/styled-system/patterns/box.mjs +5 -2
- package/dist/src/styled-system/patterns/center.d.mts +1 -1
- package/dist/src/styled-system/patterns/center.mjs +5 -2
- package/dist/src/styled-system/patterns/circle.d.mts +2 -2
- package/dist/src/styled-system/patterns/circle.mjs +5 -2
- package/dist/src/styled-system/patterns/container.d.mts +1 -1
- package/dist/src/styled-system/patterns/container.mjs +5 -2
- package/dist/src/styled-system/patterns/cq.d.mts +22 -0
- package/dist/src/styled-system/patterns/cq.mjs +21 -0
- package/dist/src/styled-system/patterns/divider.d.mts +1 -1
- package/dist/src/styled-system/patterns/divider.mjs +8 -4
- package/dist/src/styled-system/patterns/flex.d.mts +8 -8
- package/dist/src/styled-system/patterns/flex.mjs +5 -2
- package/dist/src/styled-system/patterns/float.d.mts +1 -1
- package/dist/src/styled-system/patterns/float.mjs +10 -3
- package/dist/src/styled-system/patterns/grid-item.d.mts +1 -1
- package/dist/src/styled-system/patterns/grid-item.mjs +5 -2
- package/dist/src/styled-system/patterns/grid.d.mts +4 -4
- package/dist/src/styled-system/patterns/grid.mjs +12 -5
- package/dist/src/styled-system/patterns/hstack.d.mts +3 -3
- package/dist/src/styled-system/patterns/hstack.mjs +8 -4
- package/dist/src/styled-system/patterns/index.d.mts +2 -2
- package/dist/src/styled-system/patterns/index.mjs +2 -2
- package/dist/src/styled-system/patterns/link-overlay.d.mts +1 -1
- package/dist/src/styled-system/patterns/link-overlay.mjs +5 -5
- package/dist/src/styled-system/patterns/spacer.d.mts +1 -1
- package/dist/src/styled-system/patterns/spacer.mjs +5 -2
- package/dist/src/styled-system/patterns/square.d.mts +2 -2
- package/dist/src/styled-system/patterns/square.mjs +5 -2
- package/dist/src/styled-system/patterns/stack.d.mts +5 -5
- package/dist/src/styled-system/patterns/stack.mjs +8 -4
- package/dist/src/styled-system/patterns/visually-hidden.d.mts +1 -1
- package/dist/src/styled-system/patterns/visually-hidden.mjs +5 -2
- package/dist/src/styled-system/patterns/vstack.d.mts +3 -3
- package/dist/src/styled-system/patterns/vstack.mjs +8 -4
- package/dist/src/styled-system/patterns/wrap.d.mts +6 -6
- package/dist/src/styled-system/patterns/wrap.mjs +5 -2
- package/dist/src/styled-system/recipes/accordion.d.mts +8 -4
- package/dist/src/styled-system/recipes/accordion.mjs +6 -4
- package/dist/src/styled-system/recipes/alert-description.d.mts +8 -4
- package/dist/src/styled-system/recipes/alert-description.mjs +8 -3
- package/dist/src/styled-system/recipes/alert-dialog.d.mts +8 -4
- package/dist/src/styled-system/recipes/alert-dialog.mjs +6 -4
- package/dist/src/styled-system/recipes/alert-title.d.mts +8 -4
- package/dist/src/styled-system/recipes/alert-title.mjs +8 -3
- package/dist/src/styled-system/recipes/alert.d.mts +12 -5
- package/dist/src/styled-system/recipes/alert.mjs +8 -3
- package/dist/src/styled-system/recipes/avatar.d.mts +8 -4
- package/dist/src/styled-system/recipes/avatar.mjs +6 -4
- package/dist/src/styled-system/recipes/badge.d.mts +12 -5
- package/dist/src/styled-system/recipes/badge.mjs +8 -3
- package/dist/src/styled-system/recipes/blockquote.d.mts +8 -4
- package/dist/src/styled-system/recipes/blockquote.mjs +8 -3
- package/dist/src/styled-system/recipes/button.d.mts +15 -5
- package/dist/src/styled-system/recipes/button.mjs +8 -3
- package/dist/src/styled-system/recipes/calendar.d.mts +8 -4
- package/dist/src/styled-system/recipes/calendar.mjs +6 -4
- package/dist/src/styled-system/recipes/card-content.d.mts +8 -4
- package/dist/src/styled-system/recipes/card-content.mjs +8 -3
- package/dist/src/styled-system/recipes/card-description.d.mts +8 -4
- package/dist/src/styled-system/recipes/card-description.mjs +8 -3
- package/dist/src/styled-system/recipes/card-footer.d.mts +8 -4
- package/dist/src/styled-system/recipes/card-footer.mjs +8 -3
- package/dist/src/styled-system/recipes/card-header.d.mts +8 -4
- package/dist/src/styled-system/recipes/card-header.mjs +8 -3
- package/dist/src/styled-system/recipes/card-title.d.mts +8 -4
- package/dist/src/styled-system/recipes/card-title.mjs +8 -3
- package/dist/src/styled-system/recipes/card.d.mts +8 -4
- package/dist/src/styled-system/recipes/card.mjs +8 -3
- package/dist/src/styled-system/recipes/checkbox.d.mts +8 -4
- package/dist/src/styled-system/recipes/checkbox.mjs +6 -4
- package/dist/src/styled-system/recipes/collapsible.d.mts +8 -4
- package/dist/src/styled-system/recipes/collapsible.mjs +6 -4
- package/dist/src/styled-system/recipes/command-dialog.d.mts +8 -4
- package/dist/src/styled-system/recipes/command-dialog.mjs +6 -4
- package/dist/src/styled-system/recipes/command.d.mts +8 -4
- package/dist/src/styled-system/recipes/command.mjs +6 -4
- package/dist/src/styled-system/recipes/context-menu.d.mts +12 -5
- package/dist/src/styled-system/recipes/context-menu.mjs +6 -4
- package/dist/src/styled-system/recipes/create-recipe.mjs +39 -7
- package/dist/src/styled-system/recipes/dialog.d.mts +8 -4
- package/dist/src/styled-system/recipes/dialog.mjs +6 -4
- package/dist/src/styled-system/recipes/dropdown-menu.d.mts +8 -4
- package/dist/src/styled-system/recipes/dropdown-menu.mjs +6 -4
- package/dist/src/styled-system/recipes/form-control.d.mts +8 -4
- package/dist/src/styled-system/recipes/form-control.mjs +8 -3
- package/dist/src/styled-system/recipes/form-description.d.mts +8 -4
- package/dist/src/styled-system/recipes/form-description.mjs +8 -3
- package/dist/src/styled-system/recipes/form-item.d.mts +8 -4
- package/dist/src/styled-system/recipes/form-item.mjs +8 -3
- package/dist/src/styled-system/recipes/form-label.d.mts +8 -4
- package/dist/src/styled-system/recipes/form-label.mjs +8 -3
- package/dist/src/styled-system/recipes/form-message.d.mts +8 -4
- package/dist/src/styled-system/recipes/form-message.mjs +8 -3
- package/dist/src/styled-system/recipes/h1.d.mts +8 -4
- package/dist/src/styled-system/recipes/h1.mjs +8 -3
- package/dist/src/styled-system/recipes/h2.d.mts +8 -4
- package/dist/src/styled-system/recipes/h2.mjs +8 -3
- package/dist/src/styled-system/recipes/h3.d.mts +8 -4
- package/dist/src/styled-system/recipes/h3.mjs +8 -3
- package/dist/src/styled-system/recipes/h4.d.mts +8 -4
- package/dist/src/styled-system/recipes/h4.mjs +8 -3
- package/dist/src/styled-system/recipes/hover-card.d.mts +8 -4
- package/dist/src/styled-system/recipes/hover-card.mjs +6 -4
- package/dist/src/styled-system/recipes/icon.d.mts +24 -5
- package/dist/src/styled-system/recipes/icon.mjs +8 -3
- package/dist/src/styled-system/recipes/inline-code.d.mts +8 -4
- package/dist/src/styled-system/recipes/inline-code.mjs +8 -3
- package/dist/src/styled-system/recipes/input.d.mts +8 -4
- package/dist/src/styled-system/recipes/input.mjs +8 -3
- package/dist/src/styled-system/recipes/label.d.mts +8 -4
- package/dist/src/styled-system/recipes/label.mjs +8 -3
- package/dist/src/styled-system/recipes/large.d.mts +8 -4
- package/dist/src/styled-system/recipes/large.mjs +8 -3
- package/dist/src/styled-system/recipes/lead.d.mts +8 -4
- package/dist/src/styled-system/recipes/lead.mjs +8 -3
- package/dist/src/styled-system/recipes/link.d.mts +8 -4
- package/dist/src/styled-system/recipes/link.mjs +8 -3
- package/dist/src/styled-system/recipes/list.d.mts +8 -4
- package/dist/src/styled-system/recipes/list.mjs +8 -3
- package/dist/src/styled-system/recipes/menubar.d.mts +8 -4
- package/dist/src/styled-system/recipes/menubar.mjs +6 -4
- package/dist/src/styled-system/recipes/muted.d.mts +8 -4
- package/dist/src/styled-system/recipes/muted.mjs +8 -3
- package/dist/src/styled-system/recipes/navigation-menu.d.mts +8 -4
- package/dist/src/styled-system/recipes/navigation-menu.mjs +6 -4
- package/dist/src/styled-system/recipes/p.d.mts +8 -4
- package/dist/src/styled-system/recipes/p.mjs +8 -3
- package/dist/src/styled-system/recipes/popover.d.mts +8 -4
- package/dist/src/styled-system/recipes/popover.mjs +6 -4
- package/dist/src/styled-system/recipes/progress.d.mts +8 -4
- package/dist/src/styled-system/recipes/progress.mjs +6 -4
- package/dist/src/styled-system/recipes/radio-group.d.mts +8 -4
- package/dist/src/styled-system/recipes/radio-group.mjs +6 -4
- package/dist/src/styled-system/recipes/scroll-area.d.mts +8 -4
- package/dist/src/styled-system/recipes/scroll-area.mjs +6 -4
- package/dist/src/styled-system/recipes/select.d.mts +8 -4
- package/dist/src/styled-system/recipes/select.mjs +6 -4
- package/dist/src/styled-system/recipes/separator.d.mts +12 -5
- package/dist/src/styled-system/recipes/separator.mjs +8 -3
- package/dist/src/styled-system/recipes/sheet.d.mts +12 -5
- package/dist/src/styled-system/recipes/sheet.mjs +6 -4
- package/dist/src/styled-system/recipes/skeleton.d.mts +8 -4
- package/dist/src/styled-system/recipes/skeleton.mjs +8 -3
- package/dist/src/styled-system/recipes/slider.d.mts +8 -4
- package/dist/src/styled-system/recipes/slider.mjs +6 -4
- package/dist/src/styled-system/recipes/small.d.mts +8 -4
- package/dist/src/styled-system/recipes/small.mjs +8 -3
- package/dist/src/styled-system/recipes/switch-recipe.d.mts +8 -4
- package/dist/src/styled-system/recipes/switch-recipe.mjs +6 -4
- package/dist/src/styled-system/recipes/table-body.d.mts +8 -4
- package/dist/src/styled-system/recipes/table-body.mjs +8 -3
- package/dist/src/styled-system/recipes/table-caption.d.mts +8 -4
- package/dist/src/styled-system/recipes/table-caption.mjs +8 -3
- package/dist/src/styled-system/recipes/table-cell.d.mts +8 -4
- package/dist/src/styled-system/recipes/table-cell.mjs +8 -3
- package/dist/src/styled-system/recipes/table-container.d.mts +8 -4
- package/dist/src/styled-system/recipes/table-container.mjs +8 -3
- package/dist/src/styled-system/recipes/table-footer.d.mts +8 -4
- package/dist/src/styled-system/recipes/table-footer.mjs +8 -3
- package/dist/src/styled-system/recipes/table-head.d.mts +8 -4
- package/dist/src/styled-system/recipes/table-head.mjs +8 -3
- package/dist/src/styled-system/recipes/table-header.d.mts +8 -4
- package/dist/src/styled-system/recipes/table-header.mjs +8 -3
- package/dist/src/styled-system/recipes/table-row.d.mts +8 -4
- package/dist/src/styled-system/recipes/table-row.mjs +8 -3
- package/dist/src/styled-system/recipes/table.d.mts +8 -4
- package/dist/src/styled-system/recipes/table.mjs +8 -3
- package/dist/src/styled-system/recipes/tabs.d.mts +8 -4
- package/dist/src/styled-system/recipes/tabs.mjs +6 -4
- package/dist/src/styled-system/recipes/textarea.d.mts +8 -4
- package/dist/src/styled-system/recipes/textarea.mjs +8 -3
- package/dist/src/styled-system/recipes/toast-viewport.d.mts +8 -4
- package/dist/src/styled-system/recipes/toast-viewport.mjs +8 -3
- package/dist/src/styled-system/recipes/toast.d.mts +12 -5
- package/dist/src/styled-system/recipes/toast.mjs +6 -4
- package/dist/src/styled-system/recipes/toggle.d.mts +15 -5
- package/dist/src/styled-system/recipes/toggle.mjs +8 -3
- package/dist/src/styled-system/recipes/tooltip.d.mts +8 -4
- package/dist/src/styled-system/recipes/tooltip.mjs +6 -4
- package/dist/src/styled-system/recipes/typography-table-container.d.mts +8 -4
- package/dist/src/styled-system/recipes/typography-table-container.mjs +8 -3
- package/dist/src/styled-system/recipes/typography-table.d.mts +8 -4
- package/dist/src/styled-system/recipes/typography-table.mjs +8 -3
- package/dist/src/styled-system/tokens/index.mjs +271 -219
- package/dist/src/styled-system/tokens/tokens.d.mts +18 -18
- package/dist/src/styled-system/types/composition.d.mts +70 -17
- package/dist/src/styled-system/types/conditions.d.mts +105 -49
- package/dist/src/styled-system/types/csstype.d.mts +1270 -721
- package/dist/src/styled-system/types/global.d.mts +1 -0
- package/dist/src/styled-system/types/index.d.mts +1 -2
- package/dist/src/styled-system/types/parts.d.mts +3 -1
- package/dist/src/styled-system/types/pattern.d.mts +20 -3
- package/dist/src/styled-system/types/prop-type.d.mts +59 -135
- package/dist/src/styled-system/types/recipe.d.mts +42 -9
- package/dist/src/styled-system/types/selectors.d.mts +1 -1
- package/dist/src/styled-system/types/static-css.d.mts +56 -0
- package/dist/src/styled-system/types/style-props.d.mts +7540 -678
- package/dist/src/styled-system/types/system-types.d.mts +128 -20
- package/package.json +8 -8
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { withoutSpace } from '../helpers.mjs';
|
|
2
2
|
|
|
3
|
-
const conditionsStr = "_hover,_focus,_focusWithin,_focusVisible,_disabled,_active,_visited,_target,_readOnly,_readWrite,_empty,_checked,_enabled,_expanded,_highlighted,_before,_after,_firstLetter,_firstLine,_marker,_selection,_file,_backdrop,_first,_last,_only,_even,_odd,_firstOfType,_lastOfType,_onlyOfType,_peerFocus,_peerHover,_peerActive,_peerFocusWithin,_peerFocusVisible,_peerDisabled,_peerChecked,_peerInvalid,_peerExpanded,_peerPlaceholderShown,_groupFocus,_groupHover,_groupActive,_groupFocusWithin,_groupFocusVisible,_groupDisabled,_groupChecked,_groupExpanded,_groupInvalid,_indeterminate,_required,_valid,_invalid,_autofill,_inRange,_outOfRange,_placeholder,_placeholderShown,_pressed,_selected,_default,_optional,_open,_fullscreen,_loading,_currentPage,_currentStep,_motionReduce,_motionSafe,_print,_landscape,_portrait,_dark,_light,_osDark,_osLight,_highContrast,_lessContrast,_moreContrast,_ltr,_rtl,_scrollbar,_scrollbarThumb,_scrollbarTrack,_horizontal,_vertical,sm,smOnly,smDown,md,mdOnly,mdDown,lg,lgOnly,lgDown,2lg,2lgOnly,2lgDown,xl,xlOnly,xlDown,2xl,2xlOnly,2xlDown,smToMd,smToLg,smTo2lg,smToXl,smTo2xl,mdToLg,mdTo2lg,mdToXl,mdTo2xl,lgTo2lg,lgToXl,lgTo2xl,2lgToXl,2lgTo2xl,xlTo2xl,base"
|
|
3
|
+
const conditionsStr = "_hover,_focus,_focusWithin,_focusVisible,_disabled,_active,_visited,_target,_readOnly,_readWrite,_empty,_checked,_enabled,_expanded,_highlighted,_complete,_incomplete,_dragging,_before,_after,_firstLetter,_firstLine,_marker,_selection,_file,_backdrop,_first,_last,_only,_even,_odd,_firstOfType,_lastOfType,_onlyOfType,_peerFocus,_peerHover,_peerActive,_peerFocusWithin,_peerFocusVisible,_peerDisabled,_peerChecked,_peerInvalid,_peerExpanded,_peerPlaceholderShown,_groupFocus,_groupHover,_groupActive,_groupFocusWithin,_groupFocusVisible,_groupDisabled,_groupChecked,_groupExpanded,_groupInvalid,_indeterminate,_required,_valid,_invalid,_autofill,_inRange,_outOfRange,_placeholder,_placeholderShown,_pressed,_selected,_grabbed,_underValue,_overValue,_atValue,_default,_optional,_open,_closed,_fullscreen,_loading,_hidden,_current,_currentPage,_currentStep,_today,_unavailable,_rangeStart,_rangeEnd,_now,_topmost,_motionReduce,_motionSafe,_print,_landscape,_portrait,_dark,_light,_osDark,_osLight,_highContrast,_lessContrast,_moreContrast,_ltr,_rtl,_scrollbar,_scrollbarThumb,_scrollbarTrack,_horizontal,_vertical,_icon,_starting,sm,smOnly,smDown,md,mdOnly,mdDown,lg,lgOnly,lgDown,2lg,2lgOnly,2lgDown,xl,xlOnly,xlDown,2xl,2xlOnly,2xlDown,smToMd,smToLg,smTo2lg,smToXl,smTo2xl,mdToLg,mdTo2lg,mdToXl,mdTo2xl,lgTo2lg,lgToXl,lgTo2xl,2lgToXl,2lgTo2xl,xlTo2xl,@/xs,@/sm,@/md,@/lg,@/xl,@/2xl,@/3xl,@/4xl,@/5xl,@/6xl,@/7xl,@/8xl,base"
|
|
4
4
|
const conditions = new Set(conditionsStr.split(','))
|
|
5
5
|
|
|
6
|
+
const conditionRegex = /^@|&|&$/
|
|
7
|
+
|
|
6
8
|
export function isCondition(value){
|
|
7
|
-
return conditions.has(value) ||
|
|
9
|
+
return conditions.has(value) || conditionRegex.test(value)
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
const underscoreRegex = /^_/
|
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import type { SystemStyleObject } from '../types/index.d.mts';
|
|
3
3
|
|
|
4
|
+
type Styles = SystemStyleObject | undefined | null | false
|
|
5
|
+
|
|
6
|
+
interface CssRawFunction {
|
|
7
|
+
(styles: Styles): SystemStyleObject
|
|
8
|
+
(styles: Styles[]): SystemStyleObject
|
|
9
|
+
(...styles: Array<Styles | Styles[]>): SystemStyleObject
|
|
10
|
+
(styles: Styles): SystemStyleObject
|
|
11
|
+
}
|
|
12
|
+
|
|
4
13
|
interface CssFunction {
|
|
5
|
-
(
|
|
6
|
-
|
|
14
|
+
(styles: Styles): string
|
|
15
|
+
(styles: Styles[]): string
|
|
16
|
+
(...styles: Array<Styles | Styles[]>): string
|
|
17
|
+
(styles: Styles): string
|
|
18
|
+
|
|
19
|
+
raw: CssRawFunction
|
|
7
20
|
}
|
|
8
21
|
|
|
9
22
|
export declare const css: CssFunction;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createCss, createMergeCss, hypenateProperty, withoutSpace } from '../helpers.mjs';
|
|
2
2
|
import { sortConditions, finalizeConditions } from './conditions.mjs';
|
|
3
3
|
|
|
4
|
-
const utilities = "aspectRatio:
|
|
4
|
+
const utilities = "aspectRatio:asp,boxDecorationBreak:bx-db,zIndex:z,boxSizing:bx-s,objectPosition:obj-p,objectFit:obj-f,overscrollBehavior:ovs-b,overscrollBehaviorX:ovs-bx,overscrollBehaviorY:ovs-by,position:pos/1,top:top,left:left,inset:inset,insetInline:inset-x/insetX,insetBlock:inset-y/insetY,insetBlockEnd:inset-be,insetBlockStart:inset-bs,insetInlineEnd:inset-e/insetEnd/end,insetInlineStart:inset-s/insetStart/start,right:right,bottom:bottom,float:float,visibility:vis,display:d,hideFrom:hide,hideBelow:show,flexBasis:flex-b,flex:flex,flexDirection:flex-d/flexDir,flexGrow:flex-g,flexShrink:flex-sh,gridTemplateColumns:grid-tc,gridTemplateRows:grid-tr,gridColumn:grid-c,gridRow:grid-r,gridColumnStart:grid-cs,gridColumnEnd:grid-ce,gridAutoFlow:grid-af,gridAutoColumns:grid-ac,gridAutoRows:grid-ar,gap:gap,gridGap:grid-g,gridRowGap:grid-rg,gridColumnGap:grid-cg,rowGap:rg,columnGap:cg,justifyContent:jc,alignContent:ac,alignItems:ai,alignSelf:as,padding:p/1,paddingLeft:pl/1,paddingRight:pr/1,paddingTop:pt/1,paddingBottom:pb/1,paddingBlock:py/1/paddingY,paddingBlockEnd:pbe,paddingBlockStart:pbs,paddingInline:px/paddingX/1,paddingInlineEnd:pe/1/paddingEnd,paddingInlineStart:ps/1/paddingStart,marginLeft:ml/1,marginRight:mr/1,marginTop:mt/1,marginBottom:mb/1,margin:m/1,marginBlock:my/1/marginY,marginBlockEnd:mbe,marginBlockStart:mbs,marginInline:mx/1/marginX,marginInlineEnd:me/1/marginEnd,marginInlineStart:ms/1/marginStart,spaceX:space_x,spaceY:space_y,outlineWidth:ring-w/ringWidth,outlineColor:ring-c/ringColor,outline:ring/1,outlineOffset:ring-o/ringOffset,divideX:dvd-x,divideY:dvd-y,divideColor:dvd-c,divideStyle:dvd-s,width:w/1,inlineSize:w-is,minWidth:min-w/minW,minInlineSize:min-w-is,maxWidth:max-w/maxW,maxInlineSize:max-w-is,height:h/1,blockSize:h-bs,minHeight:min-h/minH,minBlockSize:min-h-bs,maxHeight:max-h/maxH,maxBlockSize:max-b,color:c,fontFamily:ff,fontSize:fs,fontSizeAdjust:fs-a,fontPalette:fp,fontKerning:fk,fontFeatureSettings:ff-s,fontWeight:fw,fontSmoothing:fsmt,fontVariant:fv,fontVariantAlternates:fv-alt,fontVariantCaps:fv-caps,fontVariationSettings:fv-s,fontVariantNumeric:fv-num,letterSpacing:tracking/1,lineHeight:leading/1,textAlign:ta,textDecoration:td,textDecorationColor:td-c,textEmphasisColor:te-c,textDecorationStyle:td-s,textDecorationThickness:td-t,textUnderlineOffset:tu-o,textTransform:tt,textIndent:ti,textShadow:tsh,textShadowColor:tsh-c/textShadowColor,textOverflow:tov,verticalAlign:va,wordBreak:wb,textWrap:tw,truncate:trunc,lineClamp:lc,listStyleType:li-t,listStylePosition:li-pos,listStyleImage:li-img,listStyle:li-s,backgroundPosition:bg-p/bgPosition,backgroundPositionX:bg-p-x/bgPositionX,backgroundPositionY:bg-p-y/bgPositionY,backgroundAttachment:bg-a/bgAttachment,backgroundClip:bg-cp/bgClip,background:bg/1,backgroundColor:bg-c/bgColor,backgroundOrigin:bg-o/bgOrigin,backgroundImage:bg-i/bgImage,backgroundRepeat:bg-r/bgRepeat,backgroundBlendMode:bg-bm/bgBlendMode,backgroundSize:bg-s/bgSize,backgroundGradient:bg-grad/bgGradient,textGradient:txt-grad,gradientFromPosition:grad-from-pos,gradientToPosition:grad-to-pos,gradientFrom:grad-from,gradientTo:grad-to,gradientVia:grad-via,gradientViaPosition:grad-via-pos,borderRadius:bdr/rounded,borderTopLeftRadius:bdr-tl/roundedTopLeft,borderTopRightRadius:bdr-tr/roundedTopRight,borderBottomRightRadius:bdr-br/roundedBottomRight,borderBottomLeftRadius:bdr-bl/roundedBottomLeft,borderTopRadius:bdr-t/roundedTop,borderRightRadius:bdr-r/roundedRight,borderBottomRadius:bdr-b/roundedBottom,borderLeftRadius:bdr-l/roundedLeft,borderStartStartRadius:bdr-ss/roundedStartStart,borderStartEndRadius:bdr-se/roundedStartEnd,borderStartRadius:bdr-s/roundedStart,borderEndStartRadius:bdr-es/roundedEndStart,borderEndEndRadius:bdr-ee/roundedEndEnd,borderEndRadius:bdr-e/roundedEnd,border:bd,borderWidth:bd-w,borderTopWidth:bd-t-w,borderLeftWidth:bd-l-w,borderRightWidth:bd-r-w,borderBottomWidth:bd-b-w,borderBlockStartWidth:bd-bs-w,borderBlockEndWidth:bd-be-w,borderColor:bd-c,borderInline:bd-x/borderX,borderInlineWidth:bd-x-w/borderXWidth,borderInlineColor:bd-x-c/borderXColor,borderBlock:bd-y/borderY,borderBlockWidth:bd-y-w/borderYWidth,borderBlockColor:bd-y-c/borderYColor,borderLeft:bd-l,borderLeftColor:bd-l-c,borderInlineStart:bd-s/borderStart,borderInlineStartWidth:bd-s-w/borderStartWidth,borderInlineStartColor:bd-s-c/borderStartColor,borderRight:bd-r,borderRightColor:bd-r-c,borderInlineEnd:bd-e/borderEnd,borderInlineEndWidth:bd-e-w/borderEndWidth,borderInlineEndColor:bd-e-c/borderEndColor,borderTop:bd-t,borderTopColor:bd-t-c,borderBottom:bd-b,borderBottomColor:bd-b-c,borderBlockEnd:bd-be,borderBlockEndColor:bd-be-c,borderBlockStart:bd-bs,borderBlockStartColor:bd-bs-c,opacity:op,boxShadow:bx-sh/shadow,boxShadowColor:bx-sh-c/shadowColor,mixBlendMode:mix-bm,filter:filter,brightness:brightness,contrast:contrast,grayscale:grayscale,hueRotate:hue-rotate,invert:invert,saturate:saturate,sepia:sepia,dropShadow:drop-shadow,blur:blur,backdropFilter:bkdp,backdropBlur:backdrop_blur,backdropBrightness:bkdp-brightness,backdropContrast:bkdp-contrast,backdropGrayscale:bkdp-grayscale,backdropHueRotate:bkdp-hue-rotate,backdropInvert:bkdp-invert,backdropOpacity:bkdp-opacity,backdropSaturate:bkdp-saturate,backdropSepia:bkdp-sepia,borderCollapse:bd-cl,borderSpacing:bd-sp,borderSpacingX:bd-sx,borderSpacingY:bd-sy,tableLayout:tbl,transitionTimingFunction:trs-tmf,transitionDelay:trs-dly,transitionDuration:trs-dur,transitionProperty:trs-prop,transition:trs,animation:anim,animationName:anim-n,animationTimingFunction:anim-tmf,animationDuration:anim-dur,animationDelay:anim-dly,animationPlayState:anim-ps,animationComposition:anim-comp,animationFillMode:anim-fm,animationDirection:anim-dir,animationIterationCount:anim-ic,animationRange:anim-r,animationState:anim-s,animationRangeStart:anim-rs,animationRangeEnd:anim-re,animationTimeline:anim-tl,transformOrigin:trf-o,transformBox:trf-b,transformStyle:trf-s,transform:trf,rotate:rotate,rotateX:rotate-x,rotateY:rotate-y,rotateZ:rotate-z,scale:scale,scaleX:scale-x,scaleY:scale-y,translate:translate,translateX:translate_x/x,translateY:translate_y/y,translateZ:translate-z/z,accentColor:ac-c,caretColor:ca-c,scrollBehavior:scr-bhv,scrollbar:scr-bar,scrollbarColor:scr-bar-c,scrollbarGutter:scr-bar-g,scrollbarWidth:scr-bar-w,scrollMargin:scr-m,scrollMarginLeft:scr-ml,scrollMarginRight:scr-mr,scrollMarginTop:scr-mt,scrollMarginBottom:scr-mb,scrollMarginBlock:scr-my/scrollMarginY,scrollMarginBlockEnd:scr-mbe,scrollMarginBlockStart:scr-mbt,scrollMarginInline:scr-mx/scrollMarginX,scrollMarginInlineEnd:scr-me,scrollMarginInlineStart:scr-ms,scrollPadding:scr-p,scrollPaddingBlock:scr-py/scrollPaddingY,scrollPaddingBlockStart:scr-pbs,scrollPaddingBlockEnd:scr-pbe,scrollPaddingInline:scr-px/scrollPaddingX,scrollPaddingInlineEnd:scr-pe,scrollPaddingInlineStart:scr-ps,scrollPaddingLeft:scr-pl,scrollPaddingRight:scr-pr,scrollPaddingTop:scr-pt,scrollPaddingBottom:scr-pb,scrollSnapAlign:scr-sa,scrollSnapStop:scrs-s,scrollSnapType:scrs-t,scrollSnapStrictness:scrs-strt,scrollSnapMargin:scrs-m,scrollSnapMarginTop:scrs-mt,scrollSnapMarginBottom:scrs-mb,scrollSnapMarginLeft:scrs-ml,scrollSnapMarginRight:scrs-mr,scrollSnapCoordinate:scrs-c,scrollSnapDestination:scrs-d,scrollSnapPointsX:scrs-px,scrollSnapPointsY:scrs-py,scrollSnapTypeX:scrs-tx,scrollSnapTypeY:scrs-ty,scrollTimeline:scrtl,scrollTimelineAxis:scrtl-a,scrollTimelineName:scrtl-n,touchAction:tch-a,userSelect:us,overflow:ov,overflowWrap:ov-wrap,overflowX:ov-x,overflowY:ov-y,overflowAnchor:ov-a,overflowBlock:ov-b,overflowInline:ov-i,overflowClipBox:ovcp-bx,overflowClipMargin:ovcp-m,overscrollBehaviorBlock:ovs-bb,overscrollBehaviorInline:ovs-bi,fill:fill,stroke:stk,strokeWidth:stk-w,strokeDasharray:stk-dsh,strokeDashoffset:stk-do,strokeLinecap:stk-lc,strokeLinejoin:stk-lj,strokeMiterlimit:stk-ml,strokeOpacity:stk-op,srOnly:sr,debug:debug,appearance:ap,backfaceVisibility:bfv,clipPath:cp-path,hyphens:hy,mask:msk,maskImage:msk-i,maskSize:msk-s,textSizeAdjust:txt-adj,container:container,containerName:cq-n,containerType:cq-t,cursor:cursor,animateIn:animate_in,animateOut:animate_out,fadeIn:animate_fade_in,fadeOut:animate_fade_out,zoomIn:animate_zoom_in,zoomOut:animate_zoom_out,spinIn:animate_spin_in,spinOut:animate_spin_out,slideInFromTop:animate_slide_in_from_top,slideInFromBottom:animate_slide_in_from_bottom,slideInFromLeft:animate_slide_in_from_left,slideInFromRight:animate_slide_in_from_right,slideOutToTop:animate_slide_out_to_top,slideOutToBottom:animate_slide_out_to_bottom,slideOutToLeft:animate_slide_out_to_left,slideOutToRight:animate_slide_out_to_right,backgroundAlpha:background-alpha/bga,gradientFromAlpha:from-alpha,gradientToAlpha:to-alpha,borderAlpha:border_color_alpha/bca,focusRingWidth:focus-ring-width,focusRingColor:focus-ring-color,focusRingOffsetWidth:focus-ring-offset-width,focusRingOffsetColor:focus-ring-offset-color,focusRingInset:focus-ring-inset,textAlpha:text_alpha/ca,textStyle:textStyle,layerStyle:layerStyle"
|
|
5
5
|
|
|
6
6
|
const classNameByProp = new Map()
|
|
7
7
|
const shorthands = new Map()
|
|
@@ -33,6 +33,7 @@ const context = {
|
|
|
33
33
|
return { className: `${propKey}_${withoutSpace(value)}` }
|
|
34
34
|
},
|
|
35
35
|
hasShorthand: true,
|
|
36
|
+
toHash: (path, hashFn) => hashFn(path.join(":")),
|
|
36
37
|
resolveShorthand: resolveShorthand,
|
|
37
38
|
}
|
|
38
39
|
}
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
import { compact, splitProps } from '../helpers.mjs';
|
|
1
|
+
import { compact, mergeProps, memo, splitProps, uniq } from '../helpers.mjs';
|
|
2
2
|
import { css, mergeCss } from './css.mjs';
|
|
3
3
|
|
|
4
|
+
const defaults = (conf) => ({
|
|
5
|
+
base: {},
|
|
6
|
+
variants: {},
|
|
7
|
+
defaultVariants: {},
|
|
8
|
+
compoundVariants: [],
|
|
9
|
+
...conf,
|
|
10
|
+
})
|
|
11
|
+
|
|
4
12
|
export function cva(config) {
|
|
5
|
-
const { base
|
|
13
|
+
const { base, variants, defaultVariants, compoundVariants } = defaults(config)
|
|
14
|
+
const getVariantProps = (variants) => ({ ...defaultVariants, ...compact(variants) })
|
|
6
15
|
|
|
7
16
|
function resolve(props = {}) {
|
|
8
|
-
const computedVariants =
|
|
17
|
+
const computedVariants = getVariantProps(props)
|
|
9
18
|
let variantCss = { ...base }
|
|
10
19
|
for (const [key, value] of Object.entries(computedVariants)) {
|
|
11
20
|
if (variants[key]?.[value]) {
|
|
@@ -16,6 +25,19 @@ export function cva(config) {
|
|
|
16
25
|
return mergeCss(variantCss, compoundVariantCss)
|
|
17
26
|
}
|
|
18
27
|
|
|
28
|
+
function merge(__cva) {
|
|
29
|
+
const override = defaults(__cva.config)
|
|
30
|
+
const variantKeys = uniq(__cva.variantKeys, Object.keys(variants))
|
|
31
|
+
return cva({
|
|
32
|
+
base: mergeCss(base, override.base),
|
|
33
|
+
variants: Object.fromEntries(
|
|
34
|
+
variantKeys.map((key) => [key, mergeCss(variants[key], override.variants[key])]),
|
|
35
|
+
),
|
|
36
|
+
defaultVariants: mergeProps(defaultVariants, override.defaultVariants),
|
|
37
|
+
compoundVariants: [...compoundVariants, ...override.compoundVariants],
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
19
41
|
function cvaFn(props) {
|
|
20
42
|
return css(resolve(props))
|
|
21
43
|
}
|
|
@@ -28,13 +50,15 @@ export function cva(config) {
|
|
|
28
50
|
|
|
29
51
|
const variantMap = Object.fromEntries(Object.entries(variants).map(([key, value]) => [key, Object.keys(value)]))
|
|
30
52
|
|
|
31
|
-
return Object.assign(cvaFn, {
|
|
53
|
+
return Object.assign(memo(cvaFn), {
|
|
32
54
|
__cva__: true,
|
|
33
55
|
variantMap,
|
|
34
56
|
variantKeys,
|
|
35
57
|
raw: resolve,
|
|
36
58
|
config,
|
|
59
|
+
merge,
|
|
37
60
|
splitVariantProps,
|
|
61
|
+
getVariantProps
|
|
38
62
|
})
|
|
39
63
|
}
|
|
40
64
|
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { getSlotRecipes, splitProps } from '../helpers.mjs';
|
|
1
|
+
import { compact, getSlotRecipes, memo, splitProps } from '../helpers.mjs';
|
|
2
2
|
import { cva } from './cva.mjs';
|
|
3
|
+
import { cx } from './cx.mjs';
|
|
4
|
+
|
|
5
|
+
const slotClass = (className, slot) => className + '__' + slot
|
|
3
6
|
|
|
4
7
|
export function sva(config) {
|
|
5
8
|
const slots = Object.entries(getSlotRecipes(config)).map(([slot, slotCva]) => [slot, cva(slotCva)])
|
|
9
|
+
const defaultVariants = config.defaultVariants ?? {}
|
|
6
10
|
|
|
7
11
|
function svaFn(props) {
|
|
8
|
-
const result = slots.map(([slot, cvaFn]) => [slot, cvaFn(props)])
|
|
12
|
+
const result = slots.map(([slot, cvaFn]) => [slot, cx(cvaFn(props), config.className && slotClass(config.className, slot))])
|
|
9
13
|
return Object.fromEntries(result)
|
|
10
14
|
}
|
|
11
15
|
|
|
@@ -20,16 +24,18 @@ export function sva(config) {
|
|
|
20
24
|
function splitVariantProps(props) {
|
|
21
25
|
return splitProps(props, variantKeys);
|
|
22
26
|
}
|
|
27
|
+
const getVariantProps = (variants) => ({ ...(defaultVariants || {}), ...compact(variants) })
|
|
23
28
|
|
|
24
29
|
const variantMap = Object.fromEntries(
|
|
25
30
|
Object.entries(variants).map(([key, value]) => [key, Object.keys(value)])
|
|
26
31
|
);
|
|
27
32
|
|
|
28
|
-
return Object.assign(svaFn, {
|
|
33
|
+
return Object.assign(memo(svaFn), {
|
|
29
34
|
__cva__: false,
|
|
30
35
|
raw,
|
|
31
36
|
variantMap,
|
|
32
37
|
variantKeys,
|
|
33
38
|
splitVariantProps,
|
|
39
|
+
getVariantProps,
|
|
34
40
|
})
|
|
35
41
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
function isObject(value) {
|
|
3
3
|
return typeof value === "object" && value != null && !Array.isArray(value);
|
|
4
4
|
}
|
|
5
|
+
var isObjectOrArray = (obj) => typeof obj === "object" && obj !== null;
|
|
5
6
|
|
|
6
7
|
// src/compact.ts
|
|
7
8
|
function compact(value) {
|
|
@@ -14,18 +15,6 @@ function filterBaseConditions(c) {
|
|
|
14
15
|
return c.slice().filter((v) => !isBaseCondition(v));
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
// src/css-important.ts
|
|
18
|
-
var importantRegex = /!(important)?$/;
|
|
19
|
-
function isImportant(value) {
|
|
20
|
-
return typeof value === "string" ? importantRegex.test(value) : false;
|
|
21
|
-
}
|
|
22
|
-
function withoutImportant(value) {
|
|
23
|
-
return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;
|
|
24
|
-
}
|
|
25
|
-
function withoutSpace(str) {
|
|
26
|
-
return typeof str === "string" ? str.replaceAll(" ", "_") : str;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
18
|
// src/hash.ts
|
|
30
19
|
function toChar(code) {
|
|
31
20
|
return String.fromCharCode(code + (code > 25 ? 39 : 97));
|
|
@@ -47,19 +36,52 @@ function toHash(value) {
|
|
|
47
36
|
return toName(toPhash(5381, value) >>> 0);
|
|
48
37
|
}
|
|
49
38
|
|
|
39
|
+
// src/important.ts
|
|
40
|
+
var importantRegex = /\s*!(important)?/i;
|
|
41
|
+
function isImportant(value) {
|
|
42
|
+
return typeof value === "string" ? importantRegex.test(value) : false;
|
|
43
|
+
}
|
|
44
|
+
function withoutImportant(value) {
|
|
45
|
+
return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;
|
|
46
|
+
}
|
|
47
|
+
function withoutSpace(str) {
|
|
48
|
+
return typeof str === "string" ? str.replaceAll(" ", "_") : str;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// src/memo.ts
|
|
52
|
+
var memo = (fn) => {
|
|
53
|
+
const cache = /* @__PURE__ */ new Map();
|
|
54
|
+
const get = (...args) => {
|
|
55
|
+
const key = JSON.stringify(args);
|
|
56
|
+
if (cache.has(key)) {
|
|
57
|
+
return cache.get(key);
|
|
58
|
+
}
|
|
59
|
+
const result = fn(...args);
|
|
60
|
+
cache.set(key, result);
|
|
61
|
+
return result;
|
|
62
|
+
};
|
|
63
|
+
return get;
|
|
64
|
+
};
|
|
65
|
+
|
|
50
66
|
// src/merge-props.ts
|
|
67
|
+
var MERGE_OMIT = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
51
68
|
function mergeProps(...sources) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
69
|
+
return sources.reduce((prev, obj) => {
|
|
70
|
+
if (!obj)
|
|
71
|
+
return prev;
|
|
72
|
+
Object.keys(obj).forEach((key) => {
|
|
73
|
+
if (MERGE_OMIT.has(key))
|
|
74
|
+
return;
|
|
75
|
+
const prevValue = prev[key];
|
|
76
|
+
const value = obj[key];
|
|
77
|
+
if (isObject(prevValue) && isObject(value)) {
|
|
78
|
+
prev[key] = mergeProps(prevValue, value);
|
|
57
79
|
} else {
|
|
58
|
-
|
|
80
|
+
prev[key] = value;
|
|
59
81
|
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
82
|
+
});
|
|
83
|
+
return prev;
|
|
84
|
+
}, {});
|
|
63
85
|
}
|
|
64
86
|
|
|
65
87
|
// src/walk-object.ts
|
|
@@ -67,10 +89,10 @@ var isNotNullish = (element) => element != null;
|
|
|
67
89
|
function walkObject(target, predicate, options = {}) {
|
|
68
90
|
const { stop, getKey } = options;
|
|
69
91
|
function inner(value, path = []) {
|
|
70
|
-
if (
|
|
92
|
+
if (isObjectOrArray(value)) {
|
|
71
93
|
const result = {};
|
|
72
94
|
for (const [prop, child] of Object.entries(value)) {
|
|
73
|
-
const key = getKey?.(prop) ?? prop;
|
|
95
|
+
const key = getKey?.(prop, child) ?? prop;
|
|
74
96
|
const childPath = [...path, key];
|
|
75
97
|
if (stop?.(value, childPath)) {
|
|
76
98
|
return predicate(value, path);
|
|
@@ -87,6 +109,8 @@ function walkObject(target, predicate, options = {}) {
|
|
|
87
109
|
return inner(target);
|
|
88
110
|
}
|
|
89
111
|
function mapObject(obj, fn) {
|
|
112
|
+
if (Array.isArray(obj))
|
|
113
|
+
return obj.map((value) => fn(value));
|
|
90
114
|
if (!isObject(obj))
|
|
91
115
|
return fn(obj);
|
|
92
116
|
return walkObject(obj, (value) => fn(value));
|
|
@@ -94,23 +118,18 @@ function mapObject(obj, fn) {
|
|
|
94
118
|
|
|
95
119
|
// src/normalize-style-object.ts
|
|
96
120
|
function toResponsiveObject(values, breakpoints) {
|
|
97
|
-
return values.reduce(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return walkObject(styles, (v) => v, {
|
|
108
|
-
getKey: (prop) => {
|
|
109
|
-
return hasShorthand ? resolveShorthand(prop) : prop;
|
|
110
|
-
}
|
|
111
|
-
});
|
|
121
|
+
return values.reduce(
|
|
122
|
+
(acc, current, index) => {
|
|
123
|
+
const key = breakpoints[index];
|
|
124
|
+
if (current != null) {
|
|
125
|
+
acc[key] = current;
|
|
126
|
+
}
|
|
127
|
+
return acc;
|
|
128
|
+
},
|
|
129
|
+
{}
|
|
130
|
+
);
|
|
112
131
|
}
|
|
113
|
-
function normalizeStyleObject(styles, context) {
|
|
132
|
+
function normalizeStyleObject(styles, context, shorthand = true) {
|
|
114
133
|
const { utility, conditions } = context;
|
|
115
134
|
const { hasShorthand, resolveShorthand } = utility;
|
|
116
135
|
return walkObject(
|
|
@@ -120,9 +139,7 @@ function normalizeStyleObject(styles, context) {
|
|
|
120
139
|
},
|
|
121
140
|
{
|
|
122
141
|
stop: (value) => Array.isArray(value),
|
|
123
|
-
getKey: (prop) =>
|
|
124
|
-
return hasShorthand ? resolveShorthand(prop) : prop;
|
|
125
|
-
}
|
|
142
|
+
getKey: shorthand ? (prop) => hasShorthand ? resolveShorthand(prop) : prop : void 0
|
|
126
143
|
}
|
|
127
144
|
);
|
|
128
145
|
}
|
|
@@ -141,20 +158,21 @@ function createCss(context) {
|
|
|
141
158
|
let result;
|
|
142
159
|
if (hash) {
|
|
143
160
|
const baseArray = [...conds.finalize(conditions), className];
|
|
144
|
-
result = formatClassName(toHash(baseArray
|
|
161
|
+
result = formatClassName(utility.toHash(baseArray, toHash));
|
|
145
162
|
} else {
|
|
146
163
|
const baseArray = [...conds.finalize(conditions), formatClassName(className)];
|
|
147
164
|
result = baseArray.join(":");
|
|
148
165
|
}
|
|
149
166
|
return result;
|
|
150
167
|
};
|
|
151
|
-
return (
|
|
168
|
+
return memo(({ base, ...styles } = {}) => {
|
|
169
|
+
const styleObject = Object.assign(styles, base);
|
|
152
170
|
const normalizedObject = normalizeStyleObject(styleObject, context);
|
|
153
171
|
const classNames = /* @__PURE__ */ new Set();
|
|
154
172
|
walkObject(normalizedObject, (value, paths) => {
|
|
155
|
-
const important = isImportant(value);
|
|
156
173
|
if (value == null)
|
|
157
174
|
return;
|
|
175
|
+
const important = isImportant(value);
|
|
158
176
|
const [prop, ...allConditions] = conds.shift(paths);
|
|
159
177
|
const conditions = filterBaseConditions(allConditions);
|
|
160
178
|
const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
|
|
@@ -164,17 +182,17 @@ function createCss(context) {
|
|
|
164
182
|
classNames.add(className);
|
|
165
183
|
});
|
|
166
184
|
return Array.from(classNames).join(" ");
|
|
167
|
-
};
|
|
185
|
+
});
|
|
168
186
|
}
|
|
169
187
|
function compactStyles(...styles) {
|
|
170
|
-
return styles.filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);
|
|
188
|
+
return styles.flat().filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);
|
|
171
189
|
}
|
|
172
190
|
function createMergeCss(context) {
|
|
173
191
|
function resolve(styles) {
|
|
174
192
|
const allStyles = compactStyles(...styles);
|
|
175
193
|
if (allStyles.length === 1)
|
|
176
194
|
return allStyles;
|
|
177
|
-
return allStyles.map((style) =>
|
|
195
|
+
return allStyles.map((style) => normalizeStyleObject(style, context));
|
|
178
196
|
}
|
|
179
197
|
function mergeCss(...styles) {
|
|
180
198
|
return mergeProps(...resolve(styles));
|
|
@@ -182,24 +200,9 @@ function createMergeCss(context) {
|
|
|
182
200
|
function assignCss(...styles) {
|
|
183
201
|
return Object.assign({}, ...resolve(styles));
|
|
184
202
|
}
|
|
185
|
-
return { mergeCss, assignCss };
|
|
203
|
+
return { mergeCss: memo(mergeCss), assignCss };
|
|
186
204
|
}
|
|
187
205
|
|
|
188
|
-
// src/memo.ts
|
|
189
|
-
var memo = (fn) => {
|
|
190
|
-
const cache = /* @__PURE__ */ new Map();
|
|
191
|
-
const get = (...args) => {
|
|
192
|
-
const key = JSON.stringify(args);
|
|
193
|
-
if (cache.has(key)) {
|
|
194
|
-
return cache.get(key);
|
|
195
|
-
}
|
|
196
|
-
const result = fn(...args);
|
|
197
|
-
cache.set(key, result);
|
|
198
|
-
return result;
|
|
199
|
-
};
|
|
200
|
-
return get;
|
|
201
|
-
};
|
|
202
|
-
|
|
203
206
|
// src/hypenate-property.ts
|
|
204
207
|
var wordRegex = /([A-Z])/g;
|
|
205
208
|
var msRegex = /^ms-/;
|
|
@@ -209,6 +212,34 @@ var hypenateProperty = memo((property) => {
|
|
|
209
212
|
return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
|
|
210
213
|
});
|
|
211
214
|
|
|
215
|
+
// src/is-css-function.ts
|
|
216
|
+
var fns = ["min", "max", "clamp", "calc"];
|
|
217
|
+
var fnRegExp = new RegExp(`^(${fns.join("|")})\\(.*\\)`);
|
|
218
|
+
var isCssFunction = (v) => typeof v === "string" && fnRegExp.test(v);
|
|
219
|
+
|
|
220
|
+
// src/is-css-unit.ts
|
|
221
|
+
var lengthUnits = "cm,mm,Q,in,pc,pt,px,em,ex,ch,rem,lh,rlh,vw,vh,vmin,vmax,vb,vi,svw,svh,lvw,lvh,dvw,dvh,cqw,cqh,cqi,cqb,cqmin,cqmax,%";
|
|
222
|
+
var lengthUnitsPattern = `(?:${lengthUnits.split(",").join("|")})`;
|
|
223
|
+
var lengthRegExp = new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${lengthUnitsPattern}$`);
|
|
224
|
+
var isCssUnit = (v) => typeof v === "string" && lengthRegExp.test(v);
|
|
225
|
+
|
|
226
|
+
// src/is-css-var.ts
|
|
227
|
+
var isCssVar = (v) => typeof v === "string" && /^var\(--.+\)$/.test(v);
|
|
228
|
+
|
|
229
|
+
// src/pattern-fns.ts
|
|
230
|
+
var patternFns = {
|
|
231
|
+
map: mapObject,
|
|
232
|
+
isCssFunction,
|
|
233
|
+
isCssVar,
|
|
234
|
+
isCssUnit
|
|
235
|
+
};
|
|
236
|
+
var getPatternStyles = (pattern, styles) => {
|
|
237
|
+
if (!pattern?.defaultValues)
|
|
238
|
+
return styles;
|
|
239
|
+
const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues;
|
|
240
|
+
return Object.assign({}, defaults, compact(styles));
|
|
241
|
+
};
|
|
242
|
+
|
|
212
243
|
// src/slot.ts
|
|
213
244
|
var getSlotRecipes = (recipe = {}) => {
|
|
214
245
|
const init = (slot) => ({
|
|
@@ -250,11 +281,23 @@ function splitProps(props, ...keys) {
|
|
|
250
281
|
const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));
|
|
251
282
|
return keys.map(fn).concat(split(dKeys));
|
|
252
283
|
}
|
|
284
|
+
|
|
285
|
+
// src/uniq.ts
|
|
286
|
+
var uniq = (...items) => {
|
|
287
|
+
const set = items.reduce((acc, currItems) => {
|
|
288
|
+
if (currItems) {
|
|
289
|
+
currItems.forEach((item) => acc.add(item));
|
|
290
|
+
}
|
|
291
|
+
return acc;
|
|
292
|
+
}, /* @__PURE__ */ new Set([]));
|
|
293
|
+
return Array.from(set);
|
|
294
|
+
};
|
|
253
295
|
export {
|
|
254
296
|
compact,
|
|
255
297
|
createCss,
|
|
256
298
|
createMergeCss,
|
|
257
299
|
filterBaseConditions,
|
|
300
|
+
getPatternStyles,
|
|
258
301
|
getSlotCompoundVariant,
|
|
259
302
|
getSlotRecipes,
|
|
260
303
|
hypenateProperty,
|
|
@@ -263,8 +306,10 @@ export {
|
|
|
263
306
|
mapObject,
|
|
264
307
|
memo,
|
|
265
308
|
mergeProps,
|
|
309
|
+
patternFns,
|
|
266
310
|
splitProps,
|
|
267
311
|
toHash,
|
|
312
|
+
uniq,
|
|
268
313
|
walkObject,
|
|
269
314
|
withoutSpace
|
|
270
315
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import type { SystemStyleObject, ConditionalValue } from '../types/index.d.mts';
|
|
3
3
|
import type { Properties } from '../types/csstype.d.mts';
|
|
4
|
-
import type {
|
|
4
|
+
import type { SystemProperties } from '../types/style-props.d.mts';
|
|
5
5
|
import type { DistributiveOmit } from '../types/system-types.d.mts';
|
|
6
6
|
import type { Tokens } from '../tokens/index.d.mts';
|
|
7
7
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const aspectRatioConfig = {
|
|
@@ -29,7 +29,10 @@ transform(props, { map }) {
|
|
|
29
29
|
};
|
|
30
30
|
}}
|
|
31
31
|
|
|
32
|
-
export const getAspectRatioStyle = (styles = {}) =>
|
|
32
|
+
export const getAspectRatioStyle = (styles = {}) => {
|
|
33
|
+
const _styles = getPatternStyles(aspectRatioConfig, styles)
|
|
34
|
+
return aspectRatioConfig.transform(_styles, patternFns)
|
|
35
|
+
}
|
|
33
36
|
|
|
34
37
|
export const aspectRatio = (styles) => css(getAspectRatioStyle(styles))
|
|
35
38
|
aspectRatio.raw = getAspectRatioStyle
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import type { SystemStyleObject, ConditionalValue } from '../types/index.d.mts';
|
|
3
3
|
import type { Properties } from '../types/csstype.d.mts';
|
|
4
|
-
import type {
|
|
4
|
+
import type { SystemProperties } from '../types/style-props.d.mts';
|
|
5
5
|
import type { DistributiveOmit } from '../types/system-types.d.mts';
|
|
6
6
|
import type { Tokens } from '../tokens/index.d.mts';
|
|
7
7
|
|
|
8
8
|
export interface BleedProperties {
|
|
9
|
-
inline?:
|
|
10
|
-
block?:
|
|
9
|
+
inline?: SystemProperties["marginInline"]
|
|
10
|
+
block?: SystemProperties["marginBlock"]
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
|
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const bleedConfig = {
|
|
5
|
-
transform(props) {
|
|
6
|
-
const { inline
|
|
5
|
+
transform(props, { map, isCssUnit, isCssVar }) {
|
|
6
|
+
const { inline, block, ...rest } = props;
|
|
7
|
+
const valueFn = (v) => isCssUnit(v) || isCssVar(v) ? v : `token(spacing.${v}, ${v})`;
|
|
7
8
|
return {
|
|
8
|
-
"--bleed-x":
|
|
9
|
-
"--bleed-y":
|
|
9
|
+
"--bleed-x": map(inline, valueFn),
|
|
10
|
+
"--bleed-y": map(block, valueFn),
|
|
10
11
|
marginInline: "calc(var(--bleed-x, 0) * -1)",
|
|
11
12
|
marginBlock: "calc(var(--bleed-y, 0) * -1)",
|
|
12
13
|
...rest
|
|
13
14
|
};
|
|
14
|
-
}
|
|
15
|
+
},
|
|
16
|
+
defaultValues:{inline:'0',block:'0'}}
|
|
15
17
|
|
|
16
|
-
export const getBleedStyle = (styles = {}) =>
|
|
18
|
+
export const getBleedStyle = (styles = {}) => {
|
|
19
|
+
const _styles = getPatternStyles(bleedConfig, styles)
|
|
20
|
+
return bleedConfig.transform(_styles, patternFns)
|
|
21
|
+
}
|
|
17
22
|
|
|
18
23
|
export const bleed = (styles) => css(getBleedStyle(styles))
|
|
19
24
|
bleed.raw = getBleedStyle
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import type { SystemStyleObject, ConditionalValue } from '../types/index.d.mts';
|
|
3
3
|
import type { Properties } from '../types/csstype.d.mts';
|
|
4
|
-
import type {
|
|
4
|
+
import type { SystemProperties } from '../types/style-props.d.mts';
|
|
5
5
|
import type { DistributiveOmit } from '../types/system-types.d.mts';
|
|
6
6
|
import type { Tokens } from '../tokens/index.d.mts';
|
|
7
7
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPatternStyles, patternFns } from '../helpers.mjs';
|
|
2
2
|
import { css } from '../css/index.mjs';
|
|
3
3
|
|
|
4
4
|
const boxConfig = {
|
|
@@ -6,7 +6,10 @@ transform(props) {
|
|
|
6
6
|
return props;
|
|
7
7
|
}}
|
|
8
8
|
|
|
9
|
-
export const getBoxStyle = (styles = {}) =>
|
|
9
|
+
export const getBoxStyle = (styles = {}) => {
|
|
10
|
+
const _styles = getPatternStyles(boxConfig, styles)
|
|
11
|
+
return boxConfig.transform(_styles, patternFns)
|
|
12
|
+
}
|
|
10
13
|
|
|
11
14
|
export const box = (styles) => css(getBoxStyle(styles))
|
|
12
15
|
box.raw = getBoxStyle
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import type { SystemStyleObject, ConditionalValue } from '../types/index.d.mts';
|
|
3
3
|
import type { Properties } from '../types/csstype.d.mts';
|
|
4
|
-
import type {
|
|
4
|
+
import type { SystemProperties } from '../types/style-props.d.mts';
|
|
5
5
|
import type { DistributiveOmit } from '../types/system-types.d.mts';
|
|
6
6
|
import type { Tokens } from '../tokens/index.d.mts';
|
|
7
7
|
|