@cntrl-site/sdk-nextjs 1.0.19-alpha.2 → 1.0.19-alpha.4
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/lib/components/Article.js +1 -1
- package/lib/components/Item.js +31 -36
- package/lib/components/items/CodeEmbedItem.js +11 -15
- package/lib/components/items/CustomItem.js +7 -12
- package/lib/components/items/GroupItem.js +11 -15
- package/lib/components/items/ImageItem.js +21 -24
- package/lib/components/items/RectangleItem.js +24 -18
- package/lib/components/items/RichTextItem.js +19 -14
- package/lib/components/items/VideoItem.js +22 -23
- package/lib/components/items/VimeoEmbed.js +16 -22
- package/lib/components/items/YoutubeEmbed.js +16 -23
- package/lib/components/useItemPosition.js +10 -5
- package/lib/interactions/CSSPropertyNameMap.js +38 -0
- package/lib/interactions/InteractionsRegistry.js +158 -0
- package/lib/interactions/ItemInteractionCtrl.js +55 -0
- package/lib/interactions/getTransition.js +21 -0
- package/lib/interactions/types.js +2 -0
- package/lib/interactions/useItemInteractionCtrl.js +17 -0
- package/lib/provider/InteractionsContext.js +17 -39
- package/lib/utils/getStyleFromItemStateAndParams.js +9 -0
- package/package.json +1 -1
- package/src/components/Article.tsx +2 -2
- package/src/components/Item.tsx +40 -34
- package/src/components/items/CodeEmbedItem.tsx +11 -14
- package/src/components/items/CustomItem.tsx +8 -13
- package/src/components/items/GroupItem.tsx +12 -14
- package/src/components/items/ImageItem.tsx +29 -25
- package/src/components/items/RectangleItem.tsx +30 -16
- package/src/components/items/RichTextItem.tsx +26 -20
- package/src/components/items/VideoItem.tsx +31 -25
- package/src/components/items/VimeoEmbed.tsx +21 -21
- package/src/components/items/YoutubeEmbed.tsx +17 -23
- package/src/components/useItemPosition.ts +12 -5
- package/src/interactions/CSSPropertyNameMap.ts +38 -0
- package/src/interactions/InteractionsRegistry.ts +193 -0
- package/src/interactions/ItemInteractionCtrl.ts +56 -0
- package/src/interactions/getTransition.ts +27 -0
- package/src/interactions/types.ts +32 -0
- package/src/interactions/useItemInteractionCtrl.ts +18 -0
- package/src/provider/InteractionsContext.old.tsx +65 -0
- package/src/provider/InteractionsContext.test.tsx +7 -7
- package/src/provider/InteractionsContext.tsx +17 -54
- package/src/utils/getStyleFromItemStateAndParams.ts +8 -0
- package/lib/components/useStatesClassNames.js +0 -18
- package/lib/components/useStatesTransitions.js +0 -89
- package/lib/utils/StateStyles/StateStyles.js +0 -89
- package/lib/utils/getStatesCSS.js +0 -16
- package/src/components/useStatesClassNames.ts +0 -23
- package/src/components/useStatesTransitions.ts +0 -95
- package/src/utils/StateStyles/StateStyles.ts +0 -99
- package/src/utils/getStatesCSS.ts +0 -24
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTransitions = exports.getStateStyles = void 0;
|
|
4
|
-
const color_1 = require("@cntrl-site/color");
|
|
5
|
-
const getItemTopStyle_1 = require("../getItemTopStyle");
|
|
6
|
-
const stateTransformationMap = {
|
|
7
|
-
'width': (width) => `width: ${width * 100}vw !important;`,
|
|
8
|
-
'height': (height) => `height: ${height * 100}vw !important;`,
|
|
9
|
-
'top': (top, anchorSide) => `top: ${(0, getItemTopStyle_1.getItemTopStyle)(top, anchorSide)} !important;`,
|
|
10
|
-
'left': (left) => `left: ${left * 100}vw !important;`,
|
|
11
|
-
'scale': (scale) => `transform: scale(${scale}) !important;`,
|
|
12
|
-
'angle': (angle) => `transform: rotate(${angle}deg) !important;`,
|
|
13
|
-
'opacity': (opacity) => `opacity: ${opacity} !important;`,
|
|
14
|
-
'radius': (radius) => `border-radius: ${radius * 100}vw !important;`,
|
|
15
|
-
'strokeWidth': (strokeWidth) => `border-width: ${strokeWidth * 100}vw !important;`,
|
|
16
|
-
'strokeColor': (strokeColor) => `border-color: ${color_1.CntrlColor.parse(strokeColor).toCss()} !important;`,
|
|
17
|
-
'fillColor': (fillColor) => `background-color: ${color_1.CntrlColor.parse(fillColor).toCss()} !important;`,
|
|
18
|
-
'blur': (blur) => `filter: blur(${blur * 100}vw) !important;`,
|
|
19
|
-
'backdropBlur': (backdropBlur) => `backdrop-filter: blur(${backdropBlur * 100}vw) !important;`,
|
|
20
|
-
'color': (color) => `color: ${color_1.CntrlColor.parse(color).toCss()} !important;`,
|
|
21
|
-
'letterSpacing': (letterSpacing) => `letter-spacing: ${letterSpacing * 100}vw !important;`,
|
|
22
|
-
'wordSpacing': (wordSpacing) => `word-spacing: ${wordSpacing * 100}vw !important;`
|
|
23
|
-
};
|
|
24
|
-
const CSSPropertyNameMap = {
|
|
25
|
-
'width': 'width',
|
|
26
|
-
'height': 'height',
|
|
27
|
-
'top': 'top',
|
|
28
|
-
'left': 'left',
|
|
29
|
-
'scale': 'transform',
|
|
30
|
-
'angle': 'transform',
|
|
31
|
-
'opacity': 'opacity',
|
|
32
|
-
'radius': 'border-radius',
|
|
33
|
-
'strokeWidth': 'border-width',
|
|
34
|
-
'strokeColor': 'border-color',
|
|
35
|
-
'fillColor': 'background-color',
|
|
36
|
-
'blur': 'filter',
|
|
37
|
-
'backdropBlur': 'backdrop-filter',
|
|
38
|
-
'letterSpacing': 'letter-spacing',
|
|
39
|
-
'wordSpacing': 'word-spacing',
|
|
40
|
-
'color': 'color'
|
|
41
|
-
};
|
|
42
|
-
function getStateStyles(values, state, anchorSide) {
|
|
43
|
-
if (!state)
|
|
44
|
-
return '';
|
|
45
|
-
const stateValues = values.reduce((acc, valueName) => {
|
|
46
|
-
// @ts-ignore
|
|
47
|
-
if (valueName in state && state[valueName] !== undefined) {
|
|
48
|
-
// @ts-ignore
|
|
49
|
-
const stateProperties = state[valueName];
|
|
50
|
-
const getter = stateTransformationMap[valueName];
|
|
51
|
-
return [
|
|
52
|
-
...acc,
|
|
53
|
-
getter(stateProperties.value, anchorSide)
|
|
54
|
-
];
|
|
55
|
-
}
|
|
56
|
-
return acc;
|
|
57
|
-
}, []);
|
|
58
|
-
if (!stateValues.length)
|
|
59
|
-
return '';
|
|
60
|
-
// @ts-ignore
|
|
61
|
-
const transitionStr = getTransitions(values, state);
|
|
62
|
-
stateValues.push(`transition: ${transitionStr};`);
|
|
63
|
-
return stateValues.join('\n');
|
|
64
|
-
}
|
|
65
|
-
exports.getStateStyles = getStateStyles;
|
|
66
|
-
function getTransitions(values, state) {
|
|
67
|
-
if (!state)
|
|
68
|
-
return 'unset';
|
|
69
|
-
const transitionValues = values.reduce((acc, valueName) => {
|
|
70
|
-
// @ts-ignore TODO
|
|
71
|
-
if (valueName in state && state[valueName] !== undefined) {
|
|
72
|
-
// @ts-ignore TODO
|
|
73
|
-
const stateProperties = state[valueName];
|
|
74
|
-
return [
|
|
75
|
-
...acc,
|
|
76
|
-
// @ts-ignore
|
|
77
|
-
`${CSSPropertyNameMap[valueName]} ${stateProperties.duration}ms ${stateProperties.timing} ${stateProperties.delay}ms`
|
|
78
|
-
];
|
|
79
|
-
}
|
|
80
|
-
return acc;
|
|
81
|
-
}, []);
|
|
82
|
-
if (!transitionValues.length)
|
|
83
|
-
return 'unset';
|
|
84
|
-
return transitionValues.join(', ');
|
|
85
|
-
}
|
|
86
|
-
exports.getTransitions = getTransitions;
|
|
87
|
-
// export function getStateTransitions<T extends ArticleItemType>(
|
|
88
|
-
//
|
|
89
|
-
// )
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getStatesCSS = void 0;
|
|
4
|
-
const StateStyles_1 = require("./StateStyles/StateStyles");
|
|
5
|
-
function getStatesCSS(itemId, classNamePrefix, keys, states, anchorSide) {
|
|
6
|
-
return states
|
|
7
|
-
? Object.entries(states).map(([stateId, params]) => {
|
|
8
|
-
return `
|
|
9
|
-
.${classNamePrefix}-${itemId}-state-${stateId} {
|
|
10
|
-
${(0, StateStyles_1.getStateStyles)(keys, params, anchorSide)};
|
|
11
|
-
}
|
|
12
|
-
`;
|
|
13
|
-
}).join('\n')
|
|
14
|
-
: '';
|
|
15
|
-
}
|
|
16
|
-
exports.getStatesCSS = getStatesCSS;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ItemStateParams } from '@cntrl-site/sdk';
|
|
2
|
-
import { useContext } from 'react';
|
|
3
|
-
import { InteractionsContext } from '../provider/InteractionsContext';
|
|
4
|
-
import { useCurrentLayout } from '../common/useCurrentLayout';
|
|
5
|
-
|
|
6
|
-
export function useStatesClassNames(
|
|
7
|
-
itemId: string,
|
|
8
|
-
itemStates: Record<LayoutId, Record<StateId, ItemStateParams>>,
|
|
9
|
-
uniquePrefix: string, // unique in terms of item type, ie. rectangle, code-embed, group etc
|
|
10
|
-
): string {
|
|
11
|
-
const { interactionsStatesMap } = useContext(InteractionsContext);
|
|
12
|
-
const { layoutId } = useCurrentLayout();
|
|
13
|
-
const activeStates = Object.values(interactionsStatesMap);
|
|
14
|
-
const statesForLayout = layoutId ? itemStates[layoutId] : {};
|
|
15
|
-
const stateClassNames = Object.keys(statesForLayout ?? {})
|
|
16
|
-
.filter((stateId) => activeStates.includes(stateId))
|
|
17
|
-
.map((stateId) => `${uniquePrefix}-${itemId}-state-${stateId}`)
|
|
18
|
-
.join(' ');
|
|
19
|
-
return stateClassNames;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
type StateId = string;
|
|
23
|
-
type LayoutId = string;
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { ArticleItemType, ItemState, ItemStateParams, ItemStatesMap } from '@cntrl-site/sdk';
|
|
2
|
-
import { useContext, useEffect, useMemo } from 'react';
|
|
3
|
-
import { InteractionsContext } from '../provider/InteractionsContext';
|
|
4
|
-
import { useCurrentLayout } from '../common/useCurrentLayout';
|
|
5
|
-
|
|
6
|
-
type AllKeys<T> = T extends any ? keyof T : never;
|
|
7
|
-
type StatePropertyKey = AllKeys<ItemStatesMap[keyof ItemStatesMap]>;
|
|
8
|
-
|
|
9
|
-
export function useStatesTransitions(
|
|
10
|
-
el: HTMLElement | null,
|
|
11
|
-
state: ItemState<ArticleItemType>,
|
|
12
|
-
values: StatePropertyKey[]
|
|
13
|
-
) {
|
|
14
|
-
const { interactionsStatesMap } = useContext(InteractionsContext);
|
|
15
|
-
const { layoutId } = useCurrentLayout();
|
|
16
|
-
const activeStates = Object.values(interactionsStatesMap);
|
|
17
|
-
const statesForLayout = useMemo(() => layoutId ? state[layoutId] : {}, [state, layoutId]);
|
|
18
|
-
const itemStatesIds = statesForLayout ? Object.keys(statesForLayout) : [];
|
|
19
|
-
const itemActiveStateId = activeStates.find((stateId) => itemStatesIds.includes(stateId));
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (!itemActiveStateId || !el) return;
|
|
22
|
-
const state = statesForLayout[itemActiveStateId];
|
|
23
|
-
const transitionStr = getTransition(state, 'in', values);
|
|
24
|
-
const slowestProp = getSlowestProperty(state, 'in', values);
|
|
25
|
-
if (!transitionStr) return;
|
|
26
|
-
el.style.transition = transitionStr;
|
|
27
|
-
el.ontransitionend = (e) => {
|
|
28
|
-
e.stopPropagation();
|
|
29
|
-
if (e.target !== el || e.propertyName !== slowestProp) return;
|
|
30
|
-
el.style.transition = 'none';
|
|
31
|
-
};
|
|
32
|
-
return () => {
|
|
33
|
-
const transitionStr = getTransition(state, 'out', values);
|
|
34
|
-
const slowestProp = getSlowestProperty(state, 'out', values);
|
|
35
|
-
if (!transitionStr) return;
|
|
36
|
-
el.style.transition = transitionStr;
|
|
37
|
-
el.ontransitionend = (e) => {
|
|
38
|
-
e.stopPropagation();
|
|
39
|
-
if (e.target !== el || e.propertyName !== slowestProp) return;
|
|
40
|
-
el.style.transition = 'none';
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
}, [itemActiveStateId, statesForLayout, el]);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const CSSPropertyNameMap: Record<keyof ItemState<ArticleItemType>, string> = {
|
|
47
|
-
'width': 'width',
|
|
48
|
-
'height': 'height',
|
|
49
|
-
'top': 'top',
|
|
50
|
-
'left': 'left',
|
|
51
|
-
'scale': 'transform',
|
|
52
|
-
'angle': 'transform',
|
|
53
|
-
'opacity': 'opacity',
|
|
54
|
-
'radius': 'border-radius',
|
|
55
|
-
'strokeWidth': 'border-width',
|
|
56
|
-
'strokeColor': 'border-color',
|
|
57
|
-
'fillColor': 'background-color',
|
|
58
|
-
'blur': 'filter',
|
|
59
|
-
'backdropBlur': 'backdrop-filter',
|
|
60
|
-
'letterSpacing': 'letter-spacing',
|
|
61
|
-
'wordSpacing': 'word-spacing',
|
|
62
|
-
'color': 'color'
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
function getTransition(
|
|
66
|
-
state: ItemStateParams,
|
|
67
|
-
direction: 'in' | 'out',
|
|
68
|
-
values: string[]
|
|
69
|
-
) {
|
|
70
|
-
return Object.entries(state)
|
|
71
|
-
.filter(([key]) => values.includes(key))
|
|
72
|
-
.map(([key, params]) => {
|
|
73
|
-
const cssKey = CSSPropertyNameMap[key];
|
|
74
|
-
if (!cssKey) {
|
|
75
|
-
throw new Error(`Cannot translate "${key}" to a CSS property.`);
|
|
76
|
-
}
|
|
77
|
-
return `${cssKey} ${params[direction].duration}ms ${params[direction].timing} ${params[direction].delay}ms`;
|
|
78
|
-
}, [])
|
|
79
|
-
.join(', ');
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function getSlowestProperty(state: ItemStateParams, direction: 'in' | 'out', values: string[]): string {
|
|
83
|
-
const mappedEntries = Object.entries(state)
|
|
84
|
-
.filter(([key]) => values.includes(key))
|
|
85
|
-
.map(([key, params]) => {
|
|
86
|
-
const transitionParams = params[direction];
|
|
87
|
-
return {
|
|
88
|
-
key,
|
|
89
|
-
time: transitionParams.duration + transitionParams.delay
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
if (mappedEntries.length === 0) return '';
|
|
93
|
-
const { key } = mappedEntries.reduce((slowest, current) => current.time > slowest.time ? current : slowest);
|
|
94
|
-
return CSSPropertyNameMap[key];
|
|
95
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { StateParams, ArticleItemType, AnchorSide, ItemState, ItemStatesMap } from '@cntrl-site/sdk';
|
|
2
|
-
import { CntrlColor } from '@cntrl-site/color';
|
|
3
|
-
import { getItemTopStyle } from '../getItemTopStyle';
|
|
4
|
-
|
|
5
|
-
type StateParamsGetter = (value: any, anchorSide?: AnchorSide) => string;
|
|
6
|
-
type AllKeys<T> = T extends any ? keyof T : never;
|
|
7
|
-
type StatePropertyKey = AllKeys<ItemStatesMap[keyof ItemStatesMap]>;
|
|
8
|
-
|
|
9
|
-
const stateTransformationMap: Record<StatePropertyKey, StateParamsGetter> = {
|
|
10
|
-
'width': (width: number) => `width: ${width * 100}vw !important;`,
|
|
11
|
-
'height': (height: number) => `height: ${height * 100}vw !important;`,
|
|
12
|
-
'top': (top: number, anchorSide?: AnchorSide) => `top: ${getItemTopStyle(top, anchorSide)} !important;`,
|
|
13
|
-
'left': (left: number) => `left: ${left * 100}vw !important;`,
|
|
14
|
-
'scale': (scale: number) => `transform: scale(${scale}) !important;`,
|
|
15
|
-
'angle': (angle: number) => `transform: rotate(${angle}deg) !important;`,
|
|
16
|
-
'opacity': (opacity: number) => `opacity: ${opacity} !important;`,
|
|
17
|
-
'radius': (radius: number) => `border-radius: ${radius * 100}vw !important;`,
|
|
18
|
-
'strokeWidth': (strokeWidth: number) => `border-width: ${strokeWidth * 100}vw !important;`,
|
|
19
|
-
'strokeColor': (strokeColor: string) => `border-color: ${CntrlColor.parse(strokeColor).toCss()} !important;`,
|
|
20
|
-
'fillColor': (fillColor: string) => `background-color: ${CntrlColor.parse(fillColor).toCss()} !important;`,
|
|
21
|
-
'blur': (blur: number) => `filter: blur(${blur * 100}vw) !important;`,
|
|
22
|
-
'backdropBlur': (backdropBlur: number) => `backdrop-filter: blur(${backdropBlur * 100}vw) !important;`,
|
|
23
|
-
'color': (color: string) => `color: ${CntrlColor.parse(color).toCss()} !important;`,
|
|
24
|
-
'letterSpacing': (letterSpacing: number) => `letter-spacing: ${letterSpacing * 100}vw !important;`,
|
|
25
|
-
'wordSpacing': (wordSpacing: number) => `word-spacing: ${wordSpacing * 100}vw !important;`
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const CSSPropertyNameMap: Record<keyof ItemState<ArticleItemType>, string> = {
|
|
29
|
-
'width': 'width',
|
|
30
|
-
'height': 'height',
|
|
31
|
-
'top': 'top',
|
|
32
|
-
'left': 'left',
|
|
33
|
-
'scale': 'transform',
|
|
34
|
-
'angle': 'transform',
|
|
35
|
-
'opacity': 'opacity',
|
|
36
|
-
'radius': 'border-radius',
|
|
37
|
-
'strokeWidth': 'border-width',
|
|
38
|
-
'strokeColor': 'border-color',
|
|
39
|
-
'fillColor': 'background-color',
|
|
40
|
-
'blur': 'filter',
|
|
41
|
-
'backdropBlur': 'backdrop-filter',
|
|
42
|
-
'letterSpacing': 'letter-spacing',
|
|
43
|
-
'wordSpacing': 'word-spacing',
|
|
44
|
-
'color': 'color'
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export function getStateStyles<T extends ArticleItemType>(
|
|
48
|
-
values: Array<StatePropertyKey>,
|
|
49
|
-
state?: ItemStatesMap[T],
|
|
50
|
-
anchorSide?: AnchorSide
|
|
51
|
-
): string {
|
|
52
|
-
if (!state) return '';
|
|
53
|
-
|
|
54
|
-
const stateValues = values.reduce<string[]>((acc, valueName) => {
|
|
55
|
-
// @ts-ignore
|
|
56
|
-
if (valueName in state && state[valueName] !== undefined) {
|
|
57
|
-
// @ts-ignore
|
|
58
|
-
const stateProperties = state[valueName] as StateParams<string | number>;
|
|
59
|
-
const getter = stateTransformationMap[valueName] as StateParamsGetter;
|
|
60
|
-
return [
|
|
61
|
-
...acc,
|
|
62
|
-
getter(stateProperties.value, anchorSide)
|
|
63
|
-
];
|
|
64
|
-
}
|
|
65
|
-
return acc;
|
|
66
|
-
}, []);
|
|
67
|
-
|
|
68
|
-
if (!stateValues.length) return '';
|
|
69
|
-
// @ts-ignore
|
|
70
|
-
const transitionStr = getTransitions(values, state);
|
|
71
|
-
stateValues.push(`transition: ${transitionStr};`);
|
|
72
|
-
return stateValues.join('\n');
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export function getTransitions<T extends ArticleItemType>(
|
|
76
|
-
values: Array<StatePropertyKey>,
|
|
77
|
-
state?: ItemStatesMap[T]
|
|
78
|
-
): string {
|
|
79
|
-
if (!state) return 'unset';
|
|
80
|
-
const transitionValues = values.reduce<string[]>((acc, valueName) => {
|
|
81
|
-
// @ts-ignore TODO
|
|
82
|
-
if (valueName in state && state[valueName] !== undefined) {
|
|
83
|
-
// @ts-ignore TODO
|
|
84
|
-
const stateProperties = state[valueName] as StateParams<string | number>;
|
|
85
|
-
return [
|
|
86
|
-
...acc,
|
|
87
|
-
// @ts-ignore
|
|
88
|
-
`${CSSPropertyNameMap[valueName]} ${stateProperties!.duration}ms ${stateProperties!.timing} ${stateProperties!.delay}ms`
|
|
89
|
-
];
|
|
90
|
-
}
|
|
91
|
-
return acc;
|
|
92
|
-
}, []);
|
|
93
|
-
if (!transitionValues.length) return 'unset';
|
|
94
|
-
return transitionValues.join(', ');
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// export function getStateTransitions<T extends ArticleItemType>(
|
|
98
|
-
//
|
|
99
|
-
// )
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { AnchorSide, ArticleItemType, ItemStatesMap } from '@cntrl-site/sdk';
|
|
2
|
-
import { getStateStyles } from './StateStyles/StateStyles';
|
|
3
|
-
|
|
4
|
-
type AllKeys<T> = T extends any ? keyof T : never;
|
|
5
|
-
type StatePropertyKey = AllKeys<ItemStatesMap[keyof ItemStatesMap]>;
|
|
6
|
-
|
|
7
|
-
export function getStatesCSS<T extends ArticleItemType>(
|
|
8
|
-
itemId: string,
|
|
9
|
-
classNamePrefix: string,
|
|
10
|
-
keys: Array<StatePropertyKey>,
|
|
11
|
-
states: Record<string, ItemStatesMap[T]> | undefined,
|
|
12
|
-
anchorSide?: AnchorSide
|
|
13
|
-
) {
|
|
14
|
-
return states
|
|
15
|
-
? Object.entries(states).map(([stateId, params]) => {
|
|
16
|
-
return `
|
|
17
|
-
.${classNamePrefix}-${itemId}-state-${stateId} {
|
|
18
|
-
${getStateStyles(keys, params, anchorSide)};
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
21
|
-
}).join('\n')
|
|
22
|
-
: '';
|
|
23
|
-
}
|
|
24
|
-
|