@pushwoosh/kit-helpers 4.10.1 → 4.11.1
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/ai-documentation.md +112 -6
- package/flex.d.ts +18 -0
- package/flex.js +22 -0
- package/grid.d.ts +45 -51
- package/grid.js +6 -135
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/navigation.d.ts +9 -0
- package/navigation.js +25 -0
- package/package.json +1 -1
- package/styled-helpers.d.ts +66 -0
- package/styled-helpers.js +151 -0
package/ai-documentation.md
CHANGED
|
@@ -24,15 +24,18 @@ React component library for building Pushwoosh products with TypeScript, styled-
|
|
|
24
24
|
- **Interface:**
|
|
25
25
|
```ts
|
|
26
26
|
GridContainer<{
|
|
27
|
-
$alignContent?: 'center' | 'start' | 'end' | 'space-between' | 'space-around' | 'space-evenly' | 'stretch';
|
|
27
|
+
$alignContent?: 'center' | 'start' | 'end' | 'space-between' | 'space-around' | 'space-evenly' | 'stretch' | 'baseline';
|
|
28
28
|
$alignItems?: 'center' | 'start' | 'end' | 'baseline' | 'stretch';
|
|
29
|
+
$basis?: StrNum;
|
|
29
30
|
$bgColor?: string;
|
|
30
31
|
$border?: string | CssBoxSides<string>;
|
|
31
32
|
$borderRadius?: StrNum;
|
|
32
33
|
$bottom?: StrNum;
|
|
33
34
|
$boxShadow?: string;
|
|
35
|
+
$flex?: StrNum;
|
|
34
36
|
$gap?: StrNum;
|
|
35
37
|
$gridAutoFlow?: 'row' | 'column' | 'dense' | 'row dense' | 'column dense';
|
|
38
|
+
$grow?: number;
|
|
36
39
|
$height?: StrNum;
|
|
37
40
|
$inset?: StrNum;
|
|
38
41
|
$justifyContent?: 'center' | 'start' | 'end' | 'space-between' | 'space-around' | 'space-evenly' | 'stretch';
|
|
@@ -47,9 +50,10 @@ GridContainer<{
|
|
|
47
50
|
$overflowX?: 'hidden' | 'auto' | 'scroll' | 'visible';
|
|
48
51
|
$overflowY?: 'hidden' | 'auto' | 'scroll' | 'visible';
|
|
49
52
|
$padding?: StrNum | CssBoxSides<StrNum>;
|
|
50
|
-
$placeItems?: 'center' | 'start' | 'end' | 'stretch';
|
|
53
|
+
$placeItems?: 'center' | 'start' | 'end' | 'baseline' | 'stretch';
|
|
51
54
|
$position?: 'static' | 'relative' | 'absolute' | 'fixed' | 'sticky';
|
|
52
55
|
$right?: StrNum;
|
|
56
|
+
$shrink?: number;
|
|
53
57
|
$top?: StrNum;
|
|
54
58
|
$width?: StrNum;
|
|
55
59
|
$zIndex?: number;
|
|
@@ -60,15 +64,18 @@ GridContainer<{
|
|
|
60
64
|
|
|
61
65
|
| Name | Type | Required | Default | Description | Values |
|
|
62
66
|
|---|---|:---:|:---:|---|---|
|
|
63
|
-
| `$alignContent` | enum | | | Aligns the grid content along the cross axis | `center`, `start`, `end`, `space-between`, `space-around`, `space-evenly`, `stretch` |
|
|
67
|
+
| `$alignContent` | enum | | | Aligns the grid content along the cross axis | `center`, `start`, `end`, `space-between`, `space-around`, `space-evenly`, `stretch`, `baseline` |
|
|
64
68
|
| `$alignItems` | enum | | | Aligns grid items along the cross axis | `center`, `start`, `end`, `baseline`, `stretch` |
|
|
69
|
+
| `$basis` | string\|number | | | `flex-basis` (only effective when parent is a flex container; number → px) | |
|
|
65
70
|
| `$bgColor` | string | | | Background color of the grid container | |
|
|
66
71
|
| `$border` | object | | | Border styling, can be string or object with top/right/bottom/left properties | |
|
|
67
72
|
| `$borderRadius` | string\|number | | | Border radius, accepts number (converted to px) or string | |
|
|
68
73
|
| `$bottom` | string\|number | | | `bottom` offset (number → px) | |
|
|
69
74
|
| `$boxShadow` | string | | | CSS box shadow property | |
|
|
75
|
+
| `$flex` | string\|number | | | `flex` shorthand (only effective when parent is a flex container) | |
|
|
70
76
|
| `$gap` | string\|number | | | Gap between grid items, accepts number (converted to px) or string | |
|
|
71
77
|
| `$gridAutoFlow` | enum | | | Controls how auto-placed items are inserted in the grid | `row`, `column`, `dense`, `row dense`, `column dense` |
|
|
78
|
+
| `$grow` | number | | | `flex-grow` (only effective when parent is a flex container) | |
|
|
72
79
|
| `$height` | string\|number | | | `height` (number → px; strings like `'100%'` / `'auto'` / `'fit-content'` pass through) | |
|
|
73
80
|
| `$inset` | string\|number | | | `inset` CSS shorthand (number → px, string passes through, e.g. `'10px 20px'`) | |
|
|
74
81
|
| `$justifyContent` | enum | | | Aligns the grid content along the main axis | `center`, `start`, `end`, `space-between`, `space-around`, `space-evenly`, `stretch` |
|
|
@@ -83,9 +90,10 @@ GridContainer<{
|
|
|
83
90
|
| `$overflowX` | enum | | | `overflow-x` | `hidden`, `auto`, `scroll`, `visible` |
|
|
84
91
|
| `$overflowY` | enum | | | `overflow-y` | `hidden`, `auto`, `scroll`, `visible` |
|
|
85
92
|
| `$padding` | object | | | Padding spacing, can be number/string or object with directional properties | |
|
|
86
|
-
| `$placeItems` | enum | | | Shorthand for align-items and justify-items | `center`, `start`, `end`, `stretch` |
|
|
93
|
+
| `$placeItems` | enum | | | Shorthand for align-items and justify-items | `center`, `start`, `end`, `baseline`, `stretch` |
|
|
87
94
|
| `$position` | enum | | | `position` | `static`, `relative`, `absolute`, `fixed`, `sticky` |
|
|
88
95
|
| `$right` | string\|number | | | `right` offset (number → px) | |
|
|
96
|
+
| `$shrink` | number | | | `flex-shrink` (only effective when parent is a flex container) | |
|
|
89
97
|
| `$top` | string\|number | | | `top` offset (number → px) | |
|
|
90
98
|
| `$width` | string\|number | | | `width` (number → px; strings pass through) | |
|
|
91
99
|
| `$zIndex` | number | | | `z-index` | |
|
|
@@ -230,6 +238,77 @@ GridContainer<{
|
|
|
230
238
|
|
|
231
239
|
---
|
|
232
240
|
|
|
241
|
+
### FlexContainer
|
|
242
|
+
- **Path:** `~/src/flex`
|
|
243
|
+
- **Description:** Base flex container component using CSS Flexbox for one-dimensional layouts
|
|
244
|
+
- **Interface:**
|
|
245
|
+
```ts
|
|
246
|
+
FlexContainer<{
|
|
247
|
+
// Layout (flex-specific)
|
|
248
|
+
$flexDirection?: 'row' | 'row-reverse' | 'column' | 'column-reverse';
|
|
249
|
+
$flexWrap?: 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
250
|
+
// Container alignment (shared with GridContainer)
|
|
251
|
+
$alignContent?: 'center' | 'start' | 'end' | 'space-between' | 'space-around' | 'space-evenly' | 'stretch' | 'baseline';
|
|
252
|
+
$alignItems?: 'center' | 'start' | 'end' | 'baseline' | 'stretch';
|
|
253
|
+
$gap?: StrNum;
|
|
254
|
+
$justifyContent?: 'center' | 'start' | 'end' | 'space-between' | 'space-around' | 'space-evenly' | 'stretch';
|
|
255
|
+
// Plus all CommonBoxProps: sizing ($width/$height/$min*/$max*), spacing ($padding/$margin),
|
|
256
|
+
// appearance ($bgColor/$border/$borderRadius/$boxShadow), position ($position/$top/$right/$bottom/$left/$inset/$zIndex),
|
|
257
|
+
// overflow ($overflow/$overflowX/$overflowY), flex-item ($flex/$grow/$shrink/$basis)
|
|
258
|
+
}>
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
**Props**
|
|
262
|
+
|
|
263
|
+
| Name | Type | Required | Default | Description | Values |
|
|
264
|
+
|---|---|:---:|:---:|---|---|
|
|
265
|
+
| `$flexDirection` | enum | | `row` (browser default) | `flex-direction` — main axis direction | `row`, `row-reverse`, `column`, `column-reverse` |
|
|
266
|
+
| `$flexWrap` | enum | | `nowrap` (browser default) | `flex-wrap` — whether items wrap onto multiple lines | `nowrap`, `wrap`, `wrap-reverse` |
|
|
267
|
+
|
|
268
|
+
Plus everything from `CommonContainerProps` (`$alignContent`, `$alignItems`, `$justifyContent`, `$gap`) and `CommonBoxProps` — see `GridContainer` props table for the full shared list. Grid-specific props (`$gridAutoFlow`, `$justifyItems`, `$placeItems`) are NOT available on `FlexContainer`.
|
|
269
|
+
|
|
270
|
+
**Examples**
|
|
271
|
+
```tsx
|
|
272
|
+
<FlexContainer $gap={8} $alignItems="center">
|
|
273
|
+
<Icon />
|
|
274
|
+
<span>Label</span>
|
|
275
|
+
</FlexContainer>
|
|
276
|
+
```
|
|
277
|
+
```tsx
|
|
278
|
+
// Column with growing child filling remaining space
|
|
279
|
+
<FlexContainer $flexDirection="column" $height="100vh">
|
|
280
|
+
<Header />
|
|
281
|
+
<Main $flex={1} $overflow="auto" />
|
|
282
|
+
<Footer />
|
|
283
|
+
</FlexContainer>
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
**Notes**
|
|
287
|
+
- Use when items have content-driven sizes or need to wrap; prefer `GridContainer` for explicit 2D tracks
|
|
288
|
+
- Children can use `$flex` / `$grow` / `$shrink` / `$basis` from `CommonBoxProps` to control sizing — this works on any `GridContainer`/`FlexContainer` child too
|
|
289
|
+
- Prefer the `Cluster` preset for wrap-based layouts (tags/chips)
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
### Cluster
|
|
294
|
+
- **Path:** `~/src/flex`
|
|
295
|
+
- **Description:** Flex container with wrapping enabled — for tag/chip/badge groups
|
|
296
|
+
- **Interface:** `Cluster<FlexContainerProps>`
|
|
297
|
+
|
|
298
|
+
**Example**
|
|
299
|
+
```tsx
|
|
300
|
+
<Cluster $gap={8}>
|
|
301
|
+
{tags.map((tag) => <Tag key={tag.id}>{tag.label}</Tag>)}
|
|
302
|
+
</Cluster>
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
**Notes**
|
|
306
|
+
- Pre-configured with `$flexWrap: 'wrap'`
|
|
307
|
+
- Inherits all `FlexContainer` props (override `$flexWrap` if needed)
|
|
308
|
+
- Perfect for chip/tag rows that need to wrap on narrow widths
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
233
312
|
### Collapse
|
|
234
313
|
- **Path:** `~/src/expand`
|
|
235
314
|
- **Description:** Animated collapsible component with height transition
|
|
@@ -601,7 +680,7 @@ formatNumber(999, 'short') // '999'
|
|
|
601
680
|
---
|
|
602
681
|
|
|
603
682
|
### toCssValue
|
|
604
|
-
- **Path:** `~/src/grid`
|
|
683
|
+
- **Path:** `~/src/styled-helpers` (also re-exported from `~/src/grid` for back-compat)
|
|
605
684
|
- **Description:** Converts number to px string or returns string as-is
|
|
606
685
|
- **Signature:** `toCssValue(value: string | number): string`
|
|
607
686
|
|
|
@@ -612,7 +691,7 @@ toCssValue('2rem') // '2rem'
|
|
|
612
691
|
```
|
|
613
692
|
|
|
614
693
|
**Notes**
|
|
615
|
-
- Used internally by grid components
|
|
694
|
+
- Used internally by grid and flex components
|
|
616
695
|
- Numbers become pixels
|
|
617
696
|
- Strings pass through unchanged
|
|
618
697
|
- Enables flexible prop values
|
|
@@ -687,6 +766,30 @@ type CssBoxSides<T> =
|
|
|
687
766
|
```
|
|
688
767
|
- **Description:** Flexible type for directional CSS properties like margin/padding
|
|
689
768
|
|
|
769
|
+
### CommonBoxProps
|
|
770
|
+
- **Path:** `~/src/styled-helpers`
|
|
771
|
+
- **Description:** Shared box-model/positioning/flex-item props consumed by both `GridContainer` and `FlexContainer`. Covers sizing (`$width`, `$height`, `$minWidth`/`$minHeight`, `$maxWidth`/`$maxHeight`), spacing (`$padding`, `$margin`), appearance (`$bgColor`, `$border`, `$borderRadius`, `$boxShadow`), position (`$position`, `$top`/`$right`/`$bottom`/`$left`, `$inset`, `$zIndex`), overflow (`$overflow`/`$overflowX`/`$overflowY`), and flex-item sizing (`$flex`, `$grow`, `$shrink`, `$basis`)
|
|
772
|
+
|
|
773
|
+
### CommonContainerProps
|
|
774
|
+
- **Path:** `~/src/styled-helpers`
|
|
775
|
+
- **Definition:** `CommonBoxProps & { $alignContent?: AlignContentValue; $alignItems?: ItemAlignmentValue; $gap?: StrNum; $justifyContent?: JustifyContentValue }`
|
|
776
|
+
- **Description:** Extends `CommonBoxProps` with alignment props that work in both grid and flex contexts. Used as the base for `GridContainer` and `FlexContainer` props
|
|
777
|
+
|
|
778
|
+
### ItemAlignmentValue
|
|
779
|
+
- **Path:** `~/src/styled-helpers`
|
|
780
|
+
- **Definition:** `'center' | 'start' | 'end' | 'baseline' | 'stretch'`
|
|
781
|
+
- **Description:** Valid values for item-level alignment props: `$alignItems`, `$justifyItems`, `$placeItems`
|
|
782
|
+
|
|
783
|
+
### JustifyContentValue
|
|
784
|
+
- **Path:** `~/src/styled-helpers`
|
|
785
|
+
- **Definition:** `'center' | 'start' | 'end' | 'space-between' | 'space-around' | 'space-evenly' | 'stretch'`
|
|
786
|
+
- **Description:** Valid values for `$justifyContent`. Per CSS Box Alignment L3, `justify-content` does NOT accept `baseline` — use `AlignContentValue` for `$alignContent`
|
|
787
|
+
|
|
788
|
+
### AlignContentValue
|
|
789
|
+
- **Path:** `~/src/styled-helpers`
|
|
790
|
+
- **Definition:** `JustifyContentValue | 'baseline'`
|
|
791
|
+
- **Description:** Valid values for `$alignContent`. Same as `JustifyContentValue` plus `baseline` (which is spec-valid only for the cross-axis content distribution)
|
|
792
|
+
|
|
690
793
|
### AsyncState
|
|
691
794
|
- **Definition:** `type AsyncState<T> = { loading: boolean; error?: Error; value?: T }`
|
|
692
795
|
- **Description:** State shape for async operations with loading, error, and value
|
|
@@ -723,6 +826,9 @@ type CssBoxSides<T> =
|
|
|
723
826
|
|
|
724
827
|
## Best Practices
|
|
725
828
|
- Use specific layout components (Columns, Horizontal, Vertical) over generic GridContainer
|
|
829
|
+
- Use the `Cluster` preset for wrap-based layouts; reach for `FlexContainer` for everything else
|
|
830
|
+
- Prefer `FlexContainer` over `GridContainer` when item sizes are content-driven or you need wrapping; prefer Grid when you have explicit row/column tracks
|
|
831
|
+
- Set `$flex` / `$grow` / `$shrink` / `$basis` on any `GridContainer`/`FlexContainer` child to control its size inside a flex parent — no extra wrapper needed
|
|
726
832
|
- Prefix all styled-component props with `$` to avoid DOM prop warnings
|
|
727
833
|
- Use `usePersistentFunction` for callbacks passed to memoized components
|
|
728
834
|
- Check `isMounted()` before state updates in async operations
|
package/flex.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CommonContainerProps } from './styled-helpers';
|
|
2
|
+
type FlexContainerProps = CommonContainerProps & {
|
|
3
|
+
$flexDirection?: 'row' | 'row-reverse' | 'column' | 'column-reverse';
|
|
4
|
+
$flexWrap?: 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
5
|
+
};
|
|
6
|
+
export declare const FlexContainer: import("styled-components").StyledComponent<"div", any, FlexContainerProps, never>;
|
|
7
|
+
export declare const Cluster: import("styled-components").StyledComponent<"div", any, import("./styled-helpers").CommonBoxProps & {
|
|
8
|
+
$alignContent?: import("./styled-helpers").AlignContentValue | undefined;
|
|
9
|
+
$alignItems?: import("./styled-helpers").ItemAlignmentValue | undefined;
|
|
10
|
+
$gap?: import("./styled-helpers").StrNum | undefined;
|
|
11
|
+
$justifyContent?: import("./styled-helpers").JustifyContentValue | undefined;
|
|
12
|
+
} & {
|
|
13
|
+
$flexDirection?: "row" | "row-reverse" | "column" | "column-reverse" | undefined;
|
|
14
|
+
$flexWrap?: "wrap" | "nowrap" | "wrap-reverse" | undefined;
|
|
15
|
+
} & {
|
|
16
|
+
$flexWrap: string;
|
|
17
|
+
}, "$flexWrap">;
|
|
18
|
+
export {};
|
package/flex.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { commonContainerDeclarations, renderDeclarations } from './styled-helpers';
|
|
3
|
+
const flexDeclarations = {
|
|
4
|
+
...commonContainerDeclarations,
|
|
5
|
+
$flexDirection: {
|
|
6
|
+
property: 'flex-direction'
|
|
7
|
+
},
|
|
8
|
+
$flexWrap: {
|
|
9
|
+
property: 'flex-wrap'
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const renderFlexCss = renderDeclarations(flexDeclarations);
|
|
13
|
+
export const FlexContainer = styled.div.withConfig({
|
|
14
|
+
displayName: "FlexContainer",
|
|
15
|
+
componentId: "sc-vvrarn-0"
|
|
16
|
+
})(["display:flex;", ""], renderFlexCss);
|
|
17
|
+
export const Cluster = styled(FlexContainer).attrs({
|
|
18
|
+
$flexWrap: 'wrap'
|
|
19
|
+
}).withConfig({
|
|
20
|
+
displayName: "Cluster",
|
|
21
|
+
componentId: "sc-vvrarn-1"
|
|
22
|
+
})([""]);
|
package/grid.d.ts
CHANGED
|
@@ -1,62 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
type
|
|
4
|
-
top?: T;
|
|
5
|
-
right?: T;
|
|
6
|
-
bottom?: T;
|
|
7
|
-
left?: T;
|
|
8
|
-
} | {
|
|
9
|
-
horizontal: T;
|
|
10
|
-
top?: T;
|
|
11
|
-
bottom?: T;
|
|
12
|
-
} | {
|
|
13
|
-
vertical: T;
|
|
14
|
-
right?: T;
|
|
15
|
-
left?: T;
|
|
16
|
-
};
|
|
17
|
-
type OverflowValue = 'hidden' | 'auto' | 'scroll' | 'visible';
|
|
18
|
-
type GridContainerProps = {
|
|
19
|
-
$alignContent?: 'center' | 'start' | 'end' | 'space-between' | 'space-around' | 'space-evenly' | 'stretch';
|
|
20
|
-
$alignItems?: 'center' | 'start' | 'end' | 'baseline' | 'stretch';
|
|
21
|
-
$bgColor?: string;
|
|
22
|
-
$border?: string | CssBoxSides<string>;
|
|
23
|
-
$borderRadius?: StrNum;
|
|
24
|
-
$bottom?: StrNum;
|
|
25
|
-
$boxShadow?: string;
|
|
26
|
-
$gap?: StrNum;
|
|
1
|
+
import { StrNum, ItemAlignmentValue, CommonContainerProps } from './styled-helpers';
|
|
2
|
+
export { toCssValue } from './styled-helpers';
|
|
3
|
+
type GridContainerProps = CommonContainerProps & {
|
|
27
4
|
$gridAutoFlow?: 'row' | 'column' | 'dense' | 'row dense' | 'column dense';
|
|
28
|
-
$
|
|
29
|
-
$
|
|
30
|
-
$justifyContent?: 'center' | 'start' | 'end' | 'space-between' | 'space-around' | 'space-evenly' | 'stretch';
|
|
31
|
-
$justifyItems?: 'center' | 'start' | 'end' | 'baseline' | 'stretch';
|
|
32
|
-
$left?: StrNum;
|
|
33
|
-
$margin?: StrNum | CssBoxSides<StrNum>;
|
|
34
|
-
$maxHeight?: StrNum;
|
|
35
|
-
$maxWidth?: StrNum;
|
|
36
|
-
$minHeight?: StrNum;
|
|
37
|
-
$minWidth?: StrNum;
|
|
38
|
-
$overflow?: OverflowValue;
|
|
39
|
-
$overflowX?: OverflowValue;
|
|
40
|
-
$overflowY?: OverflowValue;
|
|
41
|
-
$padding?: StrNum | CssBoxSides<StrNum>;
|
|
42
|
-
$placeItems?: 'center' | 'start' | 'end' | 'stretch';
|
|
43
|
-
$position?: 'static' | 'relative' | 'absolute' | 'fixed' | 'sticky';
|
|
44
|
-
$right?: StrNum;
|
|
45
|
-
$top?: StrNum;
|
|
46
|
-
$width?: StrNum;
|
|
47
|
-
$zIndex?: number;
|
|
5
|
+
$justifyItems?: ItemAlignmentValue;
|
|
6
|
+
$placeItems?: ItemAlignmentValue;
|
|
48
7
|
};
|
|
49
8
|
export declare const GridContainer: import("styled-components").StyledComponent<"div", any, GridContainerProps, never>;
|
|
50
|
-
export declare const Columns: import("styled-components").StyledComponent<"div", any,
|
|
9
|
+
export declare const Columns: import("styled-components").StyledComponent<"div", any, import("./styled-helpers").CommonBoxProps & {
|
|
10
|
+
$alignContent?: import("./styled-helpers").AlignContentValue | undefined;
|
|
11
|
+
$alignItems?: ItemAlignmentValue | undefined;
|
|
12
|
+
$gap?: StrNum | undefined;
|
|
13
|
+
$justifyContent?: import("./styled-helpers").JustifyContentValue | undefined;
|
|
14
|
+
} & {
|
|
15
|
+
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
|
|
16
|
+
$justifyItems?: ItemAlignmentValue | undefined;
|
|
17
|
+
$placeItems?: ItemAlignmentValue | undefined;
|
|
18
|
+
} & {
|
|
51
19
|
$sizes: StrNum;
|
|
52
20
|
}, never>;
|
|
53
|
-
export declare const Rows: import("styled-components").StyledComponent<"div", any,
|
|
21
|
+
export declare const Rows: import("styled-components").StyledComponent<"div", any, import("./styled-helpers").CommonBoxProps & {
|
|
22
|
+
$alignContent?: import("./styled-helpers").AlignContentValue | undefined;
|
|
23
|
+
$alignItems?: ItemAlignmentValue | undefined;
|
|
24
|
+
$gap?: StrNum | undefined;
|
|
25
|
+
$justifyContent?: import("./styled-helpers").JustifyContentValue | undefined;
|
|
26
|
+
} & {
|
|
27
|
+
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
|
|
28
|
+
$justifyItems?: ItemAlignmentValue | undefined;
|
|
29
|
+
$placeItems?: ItemAlignmentValue | undefined;
|
|
30
|
+
} & {
|
|
54
31
|
$sizes: StrNum;
|
|
55
32
|
}, never>;
|
|
56
|
-
export declare const Horizontal: import("styled-components").StyledComponent<"div", any,
|
|
33
|
+
export declare const Horizontal: import("styled-components").StyledComponent<"div", any, import("./styled-helpers").CommonBoxProps & {
|
|
34
|
+
$alignContent?: import("./styled-helpers").AlignContentValue | undefined;
|
|
35
|
+
$alignItems?: ItemAlignmentValue | undefined;
|
|
36
|
+
$gap?: StrNum | undefined;
|
|
37
|
+
$justifyContent?: import("./styled-helpers").JustifyContentValue | undefined;
|
|
38
|
+
} & {
|
|
39
|
+
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
|
|
40
|
+
$justifyItems?: ItemAlignmentValue | undefined;
|
|
41
|
+
$placeItems?: ItemAlignmentValue | undefined;
|
|
42
|
+
} & {
|
|
57
43
|
$gridAutoFlow: string;
|
|
58
44
|
}, "$gridAutoFlow">;
|
|
59
|
-
export declare const Vertical: import("styled-components").StyledComponent<"div", any,
|
|
45
|
+
export declare const Vertical: import("styled-components").StyledComponent<"div", any, import("./styled-helpers").CommonBoxProps & {
|
|
46
|
+
$alignContent?: import("./styled-helpers").AlignContentValue | undefined;
|
|
47
|
+
$alignItems?: ItemAlignmentValue | undefined;
|
|
48
|
+
$gap?: StrNum | undefined;
|
|
49
|
+
$justifyContent?: import("./styled-helpers").JustifyContentValue | undefined;
|
|
50
|
+
} & {
|
|
51
|
+
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
|
|
52
|
+
$justifyItems?: ItemAlignmentValue | undefined;
|
|
53
|
+
$placeItems?: ItemAlignmentValue | undefined;
|
|
54
|
+
} & {
|
|
60
55
|
$gridAutoFlow: string;
|
|
61
56
|
}, "$gridAutoFlow">;
|
|
62
|
-
export {};
|
package/grid.js
CHANGED
|
@@ -1,153 +1,24 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
|
-
|
|
3
|
-
export
|
|
2
|
+
import { isNumber, commonContainerDeclarations, renderDeclarations } from './styled-helpers';
|
|
3
|
+
export { toCssValue } from './styled-helpers';
|
|
4
4
|
const gridTemplate = value => isNumber(value) ? `repeat(${value}, 1fr)` : value;
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
return `${property}: ${valueConvert ? valueConvert(value) : value};`;
|
|
8
|
-
}
|
|
9
|
-
return undefined;
|
|
10
|
-
};
|
|
11
|
-
function createCssBoxDeclaration(property, value, valueConvert) {
|
|
12
|
-
if (typeof value === 'object') {
|
|
13
|
-
const declarations = [];
|
|
14
|
-
const {
|
|
15
|
-
horizontal,
|
|
16
|
-
vertical,
|
|
17
|
-
...rest
|
|
18
|
-
} = value;
|
|
19
|
-
if (horizontal) {
|
|
20
|
-
declarations.push(createCssDeclaration(`${property}-left`, horizontal, valueConvert), createCssDeclaration(`${property}-right`, horizontal, valueConvert));
|
|
21
|
-
}
|
|
22
|
-
if (vertical) {
|
|
23
|
-
declarations.push(createCssDeclaration(`${property}-top`, vertical, valueConvert), createCssDeclaration(`${property}-bottom`, vertical, valueConvert));
|
|
24
|
-
}
|
|
25
|
-
Object.entries(rest).forEach(([key, keyValue]) => {
|
|
26
|
-
declarations.push(createCssDeclaration(`${property}-${key}`, keyValue, valueConvert));
|
|
27
|
-
});
|
|
28
|
-
return declarations.join('');
|
|
29
|
-
}
|
|
30
|
-
return createCssDeclaration(property, value, valueConvert);
|
|
31
|
-
}
|
|
32
|
-
const cssDeclarations = {
|
|
33
|
-
$alignContent: {
|
|
34
|
-
property: 'align-content'
|
|
35
|
-
},
|
|
36
|
-
$alignItems: {
|
|
37
|
-
property: 'align-items'
|
|
38
|
-
},
|
|
39
|
-
$bgColor: {
|
|
40
|
-
property: 'background-color'
|
|
41
|
-
},
|
|
42
|
-
$border: {
|
|
43
|
-
property: 'border',
|
|
44
|
-
box: true
|
|
45
|
-
},
|
|
46
|
-
$borderRadius: {
|
|
47
|
-
property: 'border-radius',
|
|
48
|
-
convert: toCssValue
|
|
49
|
-
},
|
|
50
|
-
$boxShadow: {
|
|
51
|
-
property: 'box-shadow'
|
|
52
|
-
},
|
|
53
|
-
$gap: {
|
|
54
|
-
property: 'gap',
|
|
55
|
-
convert: toCssValue
|
|
56
|
-
},
|
|
5
|
+
const gridDeclarations = {
|
|
6
|
+
...commonContainerDeclarations,
|
|
57
7
|
$gridAutoFlow: {
|
|
58
8
|
property: 'grid-auto-flow'
|
|
59
9
|
},
|
|
60
|
-
$height: {
|
|
61
|
-
property: 'height',
|
|
62
|
-
convert: toCssValue
|
|
63
|
-
},
|
|
64
|
-
$justifyContent: {
|
|
65
|
-
property: 'justify-content'
|
|
66
|
-
},
|
|
67
10
|
$justifyItems: {
|
|
68
11
|
property: 'justify-items'
|
|
69
12
|
},
|
|
70
|
-
$margin: {
|
|
71
|
-
property: 'margin',
|
|
72
|
-
box: true,
|
|
73
|
-
convert: toCssValue
|
|
74
|
-
},
|
|
75
|
-
$maxHeight: {
|
|
76
|
-
property: 'max-height',
|
|
77
|
-
convert: toCssValue
|
|
78
|
-
},
|
|
79
|
-
$maxWidth: {
|
|
80
|
-
property: 'max-width',
|
|
81
|
-
convert: toCssValue
|
|
82
|
-
},
|
|
83
|
-
$minHeight: {
|
|
84
|
-
property: 'min-height',
|
|
85
|
-
convert: toCssValue
|
|
86
|
-
},
|
|
87
|
-
$minWidth: {
|
|
88
|
-
property: 'min-width',
|
|
89
|
-
convert: toCssValue
|
|
90
|
-
},
|
|
91
|
-
$overflow: {
|
|
92
|
-
property: 'overflow'
|
|
93
|
-
},
|
|
94
|
-
$overflowX: {
|
|
95
|
-
property: 'overflow-x'
|
|
96
|
-
},
|
|
97
|
-
$overflowY: {
|
|
98
|
-
property: 'overflow-y'
|
|
99
|
-
},
|
|
100
|
-
$padding: {
|
|
101
|
-
property: 'padding',
|
|
102
|
-
box: true,
|
|
103
|
-
convert: toCssValue
|
|
104
|
-
},
|
|
105
13
|
$placeItems: {
|
|
106
14
|
property: 'place-items'
|
|
107
|
-
},
|
|
108
|
-
$position: {
|
|
109
|
-
property: 'position'
|
|
110
|
-
},
|
|
111
|
-
$inset: {
|
|
112
|
-
property: 'inset',
|
|
113
|
-
convert: toCssValue
|
|
114
|
-
},
|
|
115
|
-
$top: {
|
|
116
|
-
property: 'top',
|
|
117
|
-
convert: toCssValue
|
|
118
|
-
},
|
|
119
|
-
$right: {
|
|
120
|
-
property: 'right',
|
|
121
|
-
convert: toCssValue
|
|
122
|
-
},
|
|
123
|
-
$bottom: {
|
|
124
|
-
property: 'bottom',
|
|
125
|
-
convert: toCssValue
|
|
126
|
-
},
|
|
127
|
-
$left: {
|
|
128
|
-
property: 'left',
|
|
129
|
-
convert: toCssValue
|
|
130
|
-
},
|
|
131
|
-
$width: {
|
|
132
|
-
property: 'width',
|
|
133
|
-
convert: toCssValue
|
|
134
|
-
},
|
|
135
|
-
$zIndex: {
|
|
136
|
-
property: 'z-index'
|
|
137
15
|
}
|
|
138
16
|
};
|
|
139
|
-
const
|
|
140
|
-
const config = cssDeclarations[key];
|
|
141
|
-
if (!config || value === undefined) return undefined;
|
|
142
|
-
if (config.box) {
|
|
143
|
-
return createCssBoxDeclaration(config.property, value, config.convert);
|
|
144
|
-
}
|
|
145
|
-
return createCssDeclaration(config.property, value, config.convert);
|
|
146
|
-
}).filter(Boolean).join('\n');
|
|
17
|
+
const renderGridCss = renderDeclarations(gridDeclarations);
|
|
147
18
|
export const GridContainer = styled.div.withConfig({
|
|
148
19
|
displayName: "GridContainer",
|
|
149
20
|
componentId: "sc-1mpmh7u-0"
|
|
150
|
-
})(["display:grid;", ""],
|
|
21
|
+
})(["display:grid;", ""], renderGridCss);
|
|
151
22
|
export const Columns = styled(GridContainer).withConfig({
|
|
152
23
|
displayName: "Columns",
|
|
153
24
|
componentId: "sc-1mpmh7u-1"
|
package/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export * from './grid';
|
|
2
|
+
export * from './flex';
|
|
2
3
|
export * from './expand';
|
|
3
4
|
export * from './hooks/useClickAway';
|
|
4
5
|
export { identifyOpenReplaySession } from './analytics/identifyOpenReplay';
|
|
5
6
|
export { trackEvent } from './analytics/trackEvent';
|
|
6
7
|
export { formatNumber } from './formatNumber';
|
|
8
|
+
export { readNavigationHistory, writeNavigationHistory } from './navigation';
|
|
7
9
|
export { default as usePersistentFunction } from './hooks/usePersistentFunction';
|
|
8
10
|
export { default as useEffectOnce } from './hooks/useEffectOnce';
|
|
9
11
|
export { default as useMountedState } from './hooks/useMountedState';
|
package/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export * from './grid';
|
|
2
|
+
export * from './flex';
|
|
2
3
|
export * from './expand';
|
|
3
4
|
export * from './hooks/useClickAway';
|
|
4
5
|
export { identifyOpenReplaySession } from './analytics/identifyOpenReplay';
|
|
5
6
|
export { trackEvent } from './analytics/trackEvent';
|
|
6
7
|
export { formatNumber } from './formatNumber';
|
|
8
|
+
export { readNavigationHistory, writeNavigationHistory } from './navigation';
|
|
7
9
|
export { default as usePersistentFunction } from './hooks/usePersistentFunction';
|
|
8
10
|
export { default as useEffectOnce } from './hooks/useEffectOnce';
|
|
9
11
|
export { default as useMountedState } from './hooks/useMountedState';
|
package/navigation.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads the navigation stack from sessionStorage.
|
|
3
|
+
* The last element is the current page.
|
|
4
|
+
*/
|
|
5
|
+
export declare function readNavigationHistory(): string[];
|
|
6
|
+
/**
|
|
7
|
+
* Persists the navigation stack to sessionStorage.
|
|
8
|
+
*/
|
|
9
|
+
export declare function writeNavigationHistory(entries: string[]): void;
|
package/navigation.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const STORAGE_KEY = 'pw_navigation_history';
|
|
2
|
+
const MAX_ENTRIES = 50;
|
|
3
|
+
/**
|
|
4
|
+
* Reads the navigation stack from sessionStorage.
|
|
5
|
+
* The last element is the current page.
|
|
6
|
+
*/
|
|
7
|
+
export function readNavigationHistory() {
|
|
8
|
+
try {
|
|
9
|
+
const raw = sessionStorage.getItem(STORAGE_KEY);
|
|
10
|
+
const parsed = raw ? JSON.parse(raw) : null;
|
|
11
|
+
return Array.isArray(parsed) && parsed.every(e => typeof e === 'string') ? parsed.slice(-MAX_ENTRIES) : [];
|
|
12
|
+
} catch {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Persists the navigation stack to sessionStorage.
|
|
18
|
+
*/
|
|
19
|
+
export function writeNavigationHistory(entries) {
|
|
20
|
+
try {
|
|
21
|
+
sessionStorage.setItem(STORAGE_KEY, JSON.stringify(entries.slice(-MAX_ENTRIES)));
|
|
22
|
+
} catch {
|
|
23
|
+
// sessionStorage is unavailable (private mode / quota exceeded) — silently ignore.
|
|
24
|
+
}
|
|
25
|
+
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export type StrNum = string | number;
|
|
2
|
+
export declare const isNumber: (value: unknown) => value is number;
|
|
3
|
+
export declare const toCssValue: (value: StrNum) => string;
|
|
4
|
+
export declare const createCssDeclaration: (property: string, value: any, valueConvert?: (v: any) => any) => string | undefined;
|
|
5
|
+
export type CssBoxSides<T> = {
|
|
6
|
+
top?: T;
|
|
7
|
+
right?: T;
|
|
8
|
+
bottom?: T;
|
|
9
|
+
left?: T;
|
|
10
|
+
} | {
|
|
11
|
+
horizontal: T;
|
|
12
|
+
top?: T;
|
|
13
|
+
bottom?: T;
|
|
14
|
+
} | {
|
|
15
|
+
vertical: T;
|
|
16
|
+
right?: T;
|
|
17
|
+
left?: T;
|
|
18
|
+
};
|
|
19
|
+
export declare function createCssBoxDeclaration<T>(property: string, value?: StrNum | CssBoxSides<T>, valueConvert?: (v: any) => any): string | undefined;
|
|
20
|
+
export type OverflowValue = 'hidden' | 'auto' | 'scroll' | 'visible';
|
|
21
|
+
export type PositionValue = 'static' | 'relative' | 'absolute' | 'fixed' | 'sticky';
|
|
22
|
+
export type ItemAlignmentValue = 'center' | 'start' | 'end' | 'baseline' | 'stretch';
|
|
23
|
+
export type JustifyContentValue = 'center' | 'start' | 'end' | 'space-between' | 'space-around' | 'space-evenly' | 'stretch';
|
|
24
|
+
export type AlignContentValue = JustifyContentValue | 'baseline';
|
|
25
|
+
export type CommonBoxProps = {
|
|
26
|
+
$bgColor?: string;
|
|
27
|
+
$basis?: StrNum;
|
|
28
|
+
$border?: string | CssBoxSides<string>;
|
|
29
|
+
$borderRadius?: StrNum;
|
|
30
|
+
$bottom?: StrNum;
|
|
31
|
+
$boxShadow?: string;
|
|
32
|
+
$flex?: StrNum;
|
|
33
|
+
$grow?: number;
|
|
34
|
+
$height?: StrNum;
|
|
35
|
+
$inset?: StrNum;
|
|
36
|
+
$left?: StrNum;
|
|
37
|
+
$margin?: StrNum | CssBoxSides<StrNum>;
|
|
38
|
+
$maxHeight?: StrNum;
|
|
39
|
+
$maxWidth?: StrNum;
|
|
40
|
+
$minHeight?: StrNum;
|
|
41
|
+
$minWidth?: StrNum;
|
|
42
|
+
$overflow?: OverflowValue;
|
|
43
|
+
$overflowX?: OverflowValue;
|
|
44
|
+
$overflowY?: OverflowValue;
|
|
45
|
+
$padding?: StrNum | CssBoxSides<StrNum>;
|
|
46
|
+
$position?: PositionValue;
|
|
47
|
+
$right?: StrNum;
|
|
48
|
+
$shrink?: number;
|
|
49
|
+
$top?: StrNum;
|
|
50
|
+
$width?: StrNum;
|
|
51
|
+
$zIndex?: number;
|
|
52
|
+
};
|
|
53
|
+
export type CommonContainerProps = CommonBoxProps & {
|
|
54
|
+
$alignContent?: AlignContentValue;
|
|
55
|
+
$alignItems?: ItemAlignmentValue;
|
|
56
|
+
$gap?: StrNum;
|
|
57
|
+
$justifyContent?: JustifyContentValue;
|
|
58
|
+
};
|
|
59
|
+
export type CssDeclarationConfig = {
|
|
60
|
+
property: string;
|
|
61
|
+
box?: boolean;
|
|
62
|
+
convert?: (v: any) => any;
|
|
63
|
+
};
|
|
64
|
+
export declare const commonBoxDeclarations: Partial<Record<keyof CommonBoxProps, CssDeclarationConfig>>;
|
|
65
|
+
export declare const commonContainerDeclarations: Partial<Record<keyof CommonContainerProps, CssDeclarationConfig>>;
|
|
66
|
+
export declare const renderDeclarations: <T extends Record<string, any>>(declarations: Partial<Record<keyof T, CssDeclarationConfig>>) => (props: T) => string;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
export const isNumber = value => typeof value === 'number';
|
|
2
|
+
export const toCssValue = value => isNumber(value) ? `${value}px` : value;
|
|
3
|
+
export const createCssDeclaration = (property, value, valueConvert) => {
|
|
4
|
+
if (value !== undefined) {
|
|
5
|
+
return `${property}: ${valueConvert ? valueConvert(value) : value};`;
|
|
6
|
+
}
|
|
7
|
+
return undefined;
|
|
8
|
+
};
|
|
9
|
+
export function createCssBoxDeclaration(property, value, valueConvert) {
|
|
10
|
+
if (typeof value === 'object') {
|
|
11
|
+
const declarations = [];
|
|
12
|
+
const {
|
|
13
|
+
horizontal,
|
|
14
|
+
vertical,
|
|
15
|
+
...rest
|
|
16
|
+
} = value;
|
|
17
|
+
if (horizontal) {
|
|
18
|
+
declarations.push(createCssDeclaration(`${property}-left`, horizontal, valueConvert), createCssDeclaration(`${property}-right`, horizontal, valueConvert));
|
|
19
|
+
}
|
|
20
|
+
if (vertical) {
|
|
21
|
+
declarations.push(createCssDeclaration(`${property}-top`, vertical, valueConvert), createCssDeclaration(`${property}-bottom`, vertical, valueConvert));
|
|
22
|
+
}
|
|
23
|
+
Object.entries(rest).forEach(([key, keyValue]) => {
|
|
24
|
+
declarations.push(createCssDeclaration(`${property}-${key}`, keyValue, valueConvert));
|
|
25
|
+
});
|
|
26
|
+
return declarations.join('');
|
|
27
|
+
}
|
|
28
|
+
return createCssDeclaration(property, value, valueConvert);
|
|
29
|
+
}
|
|
30
|
+
export const commonBoxDeclarations = {
|
|
31
|
+
$bgColor: {
|
|
32
|
+
property: 'background-color'
|
|
33
|
+
},
|
|
34
|
+
$basis: {
|
|
35
|
+
property: 'flex-basis',
|
|
36
|
+
convert: toCssValue
|
|
37
|
+
},
|
|
38
|
+
$border: {
|
|
39
|
+
property: 'border',
|
|
40
|
+
box: true
|
|
41
|
+
},
|
|
42
|
+
$borderRadius: {
|
|
43
|
+
property: 'border-radius',
|
|
44
|
+
convert: toCssValue
|
|
45
|
+
},
|
|
46
|
+
$bottom: {
|
|
47
|
+
property: 'bottom',
|
|
48
|
+
convert: toCssValue
|
|
49
|
+
},
|
|
50
|
+
$boxShadow: {
|
|
51
|
+
property: 'box-shadow'
|
|
52
|
+
},
|
|
53
|
+
$flex: {
|
|
54
|
+
property: 'flex'
|
|
55
|
+
},
|
|
56
|
+
$grow: {
|
|
57
|
+
property: 'flex-grow'
|
|
58
|
+
},
|
|
59
|
+
$height: {
|
|
60
|
+
property: 'height',
|
|
61
|
+
convert: toCssValue
|
|
62
|
+
},
|
|
63
|
+
$inset: {
|
|
64
|
+
property: 'inset',
|
|
65
|
+
convert: toCssValue
|
|
66
|
+
},
|
|
67
|
+
$left: {
|
|
68
|
+
property: 'left',
|
|
69
|
+
convert: toCssValue
|
|
70
|
+
},
|
|
71
|
+
$margin: {
|
|
72
|
+
property: 'margin',
|
|
73
|
+
box: true,
|
|
74
|
+
convert: toCssValue
|
|
75
|
+
},
|
|
76
|
+
$maxHeight: {
|
|
77
|
+
property: 'max-height',
|
|
78
|
+
convert: toCssValue
|
|
79
|
+
},
|
|
80
|
+
$maxWidth: {
|
|
81
|
+
property: 'max-width',
|
|
82
|
+
convert: toCssValue
|
|
83
|
+
},
|
|
84
|
+
$minHeight: {
|
|
85
|
+
property: 'min-height',
|
|
86
|
+
convert: toCssValue
|
|
87
|
+
},
|
|
88
|
+
$minWidth: {
|
|
89
|
+
property: 'min-width',
|
|
90
|
+
convert: toCssValue
|
|
91
|
+
},
|
|
92
|
+
$overflow: {
|
|
93
|
+
property: 'overflow'
|
|
94
|
+
},
|
|
95
|
+
$overflowX: {
|
|
96
|
+
property: 'overflow-x'
|
|
97
|
+
},
|
|
98
|
+
$overflowY: {
|
|
99
|
+
property: 'overflow-y'
|
|
100
|
+
},
|
|
101
|
+
$padding: {
|
|
102
|
+
property: 'padding',
|
|
103
|
+
box: true,
|
|
104
|
+
convert: toCssValue
|
|
105
|
+
},
|
|
106
|
+
$position: {
|
|
107
|
+
property: 'position'
|
|
108
|
+
},
|
|
109
|
+
$right: {
|
|
110
|
+
property: 'right',
|
|
111
|
+
convert: toCssValue
|
|
112
|
+
},
|
|
113
|
+
$shrink: {
|
|
114
|
+
property: 'flex-shrink'
|
|
115
|
+
},
|
|
116
|
+
$top: {
|
|
117
|
+
property: 'top',
|
|
118
|
+
convert: toCssValue
|
|
119
|
+
},
|
|
120
|
+
$width: {
|
|
121
|
+
property: 'width',
|
|
122
|
+
convert: toCssValue
|
|
123
|
+
},
|
|
124
|
+
$zIndex: {
|
|
125
|
+
property: 'z-index'
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
export const commonContainerDeclarations = {
|
|
129
|
+
...commonBoxDeclarations,
|
|
130
|
+
$alignContent: {
|
|
131
|
+
property: 'align-content'
|
|
132
|
+
},
|
|
133
|
+
$alignItems: {
|
|
134
|
+
property: 'align-items'
|
|
135
|
+
},
|
|
136
|
+
$gap: {
|
|
137
|
+
property: 'gap',
|
|
138
|
+
convert: toCssValue
|
|
139
|
+
},
|
|
140
|
+
$justifyContent: {
|
|
141
|
+
property: 'justify-content'
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
export const renderDeclarations = declarations => props => Object.entries(props).map(([key, value]) => {
|
|
145
|
+
const config = declarations[key];
|
|
146
|
+
if (!config || value === undefined) return undefined;
|
|
147
|
+
if (config.box) {
|
|
148
|
+
return createCssBoxDeclaration(config.property, value, config.convert);
|
|
149
|
+
}
|
|
150
|
+
return createCssDeclaration(config.property, value, config.convert);
|
|
151
|
+
}).filter(Boolean).join('\n');
|