baseline-kit 2.0.1 → 2.1.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/README.md +126 -102
- package/dist/README.md +126 -102
- package/dist/components/Baseline/Baseline.d.ts +27 -5
- package/dist/components/Box/Box.d.ts +26 -5
- package/dist/components/Config/Config.d.ts +51 -8
- package/dist/components/Guide/Guide.d.ts +35 -12
- package/dist/components/Layout/Layout.d.ts +20 -6
- package/dist/components/Padder/Padder.d.ts +24 -7
- package/dist/components/Spacer/Spacer.d.ts +44 -11
- package/dist/components/Stack/Stack.d.ts +24 -8
- package/dist/components/types.d.ts +1 -1
- package/dist/hooks/useBaseline.d.ts +13 -18
- package/dist/hooks/useConfig.d.ts +0 -5
- package/dist/hooks/useDebug.d.ts +1 -6
- package/dist/hooks/useGuide.d.ts +2 -7
- package/dist/hooks/useVirtual.d.ts +0 -5
- package/dist/index.cjs +11 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1447 -1038
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/theme.css +140 -0
- package/dist/utils/convert.d.ts +0 -5
- package/dist/utils/grid.d.ts +22 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/math.d.ts +26 -5
- package/dist/utils/merge.d.ts +54 -5
- package/dist/utils/parse.d.ts +0 -5
- package/dist/utils/snapping.d.ts +0 -5
- package/dist/utils/ssr.d.ts +33 -0
- package/dist/utils/timing.d.ts +0 -5
- package/package.json +43 -32
package/dist/styles.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
.spr_zbcF6{position:relative;width:var(--bksw);height:var(--bksh);flex-shrink:0}.line_qHW69:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;border:1px solid var(--bkscl);z-index:calc(var(--bkzi))}.flat_gqixr{background-color:var(--bkscf)}.pad_w2-sL{position:relative;display:grid;grid-template-columns:auto 1fr auto;grid-template-rows:auto 1fr auto;width:var(--bkpw, auto);height:var(--bkph, auto)}.lay_Ew8za .line_ESlzk:after,.stk_7SJoE .line_ESlzk:after{border:none}.v_lhGBy:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;border:1px solid var(--bkpc, var(--bk-padder-color-theme));pointer-events:none;z-index:var(--bkzi)}.lay_5cMu5{display:grid;position:relative;box-sizing:border-box;width:var(--bklw, auto);height:var(--bklh, auto);grid-template-columns:var(--bklgtc, repeat(auto-fit, minmax(100px, 1fr)));grid-template-rows:var(--bklgtr, auto);gap:var(--bklg);column-gap:var(--bklcg);row-gap:var(--bklrg);justify-items:var(--bklji);align-items:var(--bklai);justify-content:var(--bkljc);align-content:var(--bklac)}.lay_5cMu5 .line_j2f8-:after,.stk_3Spwo .line_j2f8-:after{border:none}.v_dprVE:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;border:1px solid var(--bklcl);pointer-events:none;z-index:var(--bkzio)}.box_rDCRX{position:relative;width:var(--bkxw);height:var(--bkxh)}.v_0MMHD:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;border:1px solid var(--bkxcl);pointer-events:none;z-index:var(--bkzi)}.stk_l-58l{display:flex;position:relative;width:var(--bkkw, auto);height:var(--bkkh, auto)}.lay_zNlaC .line_THMgb:after,.stk_l-58l .line_THMgb:after{border:none}.v_-k3qw:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;border:1px solid var(--bkkcl);pointer-events:none;z-index:var(--bkzio)}.gde_-Naxo{position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none;padding:var(--bkgpb) var(--bkgpi)}.line_-VS-e{left:-.5px}.cols_8lD6D{position:absolute;top:0;right:0;bottom:0;left:0;display:grid;gap:var(--bkgg);grid-template-columns:var(--bkgt);justify-content:var(--bkgj);width:var(--bkwf);height:var(--bkhf)}.col_rlbsL{min-width:0;width:var(--bkwf);height:var(--bkhf)}.col_rlbsL[data-variant=line]{width:1px;background-color:var(--bkgcl)}.col_rlbsL[data-variant=pattern]{background-color:var(--bkgcp)}.col_rlbsL[data-variant=auto]{background-color:var(--bkgca)}.col_rlbsL[data-variant=fixed]{background-color:var(--bkgcf)}.bas_e-SXr{position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none;width:var(--bkbw);height:var(--bkbh);overflow:hidden}.row_q-FZb{left:0;right:0;position:absolute;top:var(--bkrt);height:var(--bkrh);background-color:var(--bkbcl)}
|
package/dist/theme.css
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Baseline Kit Theme System
|
|
3
|
+
*
|
|
4
|
+
* Organization:
|
|
5
|
+
* 1. Color Palette (HSL values)
|
|
6
|
+
* 2. Component Theme Colors
|
|
7
|
+
* 3. Dark Mode Overrides
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
:root {
|
|
11
|
+
/* ───────────────────────────────────────────────────────
|
|
12
|
+
Color Palette - Light Theme
|
|
13
|
+
- Primary: More muted/dimmed colors
|
|
14
|
+
- Secondary: Brighter, more vibrant colors
|
|
15
|
+
─────────────────────────────────────────────────────── */
|
|
16
|
+
|
|
17
|
+
/* Neutral Colors */
|
|
18
|
+
--bk-color-black-primary: 0, 0%, 10%; /* #1A1A1A */
|
|
19
|
+
--bk-color-black-secondary: 0, 10%, 30%; /* #544545 */
|
|
20
|
+
--bk-color-white-primary: 0, 100%, 90%; /* #FFCCCC */
|
|
21
|
+
--bk-color-white-secondary: 0, 0%, 90%; /* #E6E6E6 */
|
|
22
|
+
|
|
23
|
+
/* Brand Colors */
|
|
24
|
+
--bk-color-pink-primary: 300, 60%, 40%; /* #A329A3 */
|
|
25
|
+
--bk-color-pink-secondary: 260, 100%, 70%; /* #9966FF */
|
|
26
|
+
--bk-color-purple-primary: 270, 60%, 40%; /* #6629A3 */
|
|
27
|
+
--bk-color-purple-secondary: 230, 100%, 70%; /* #6680FF */
|
|
28
|
+
--bk-color-blue-primary: 240, 60%, 40%; /* #2929A3 */
|
|
29
|
+
--bk-color-blue-secondary: 200, 100%, 70%; /* #66CCFF */
|
|
30
|
+
|
|
31
|
+
/* Supporting Colors */
|
|
32
|
+
--bk-color-cyan-primary: 200, 60%, 40%; /* #297AA3 */
|
|
33
|
+
--bk-color-cyan-secondary: 160, 100%, 70%; /* #66FFCC */
|
|
34
|
+
--bk-color-green-primary: 160, 60%, 40%; /* #29A37A */
|
|
35
|
+
--bk-color-green-secondary: 110, 100%, 70%; /* #80FF66 */
|
|
36
|
+
--bk-color-yellow-primary: 30, 60%, 40%; /* #A36629 */
|
|
37
|
+
--bk-color-yellow-secondary: 70, 100%, 70%; /* #A36629 */
|
|
38
|
+
--bk-color-orange-primary: 10, 60%, 40%; /* #A33D29 */
|
|
39
|
+
--bk-color-orange-secondary: 30, 100%, 70%; /* #FFB266 */
|
|
40
|
+
--bk-color-red-primary: 330, 60%, 40%; /* #A32966 */
|
|
41
|
+
--bk-color-red-secondary: 0, 100%, 70%; /* #FF6666 */
|
|
42
|
+
|
|
43
|
+
/* ───────────────────────────────────────────────────────
|
|
44
|
+
Component Theme Colors - Light
|
|
45
|
+
Using consistent alpha values:
|
|
46
|
+
- Line: 0.6 (borders)
|
|
47
|
+
- Flat: 0.2 (backgrounds)
|
|
48
|
+
- text: 0.9-1.0 (indicators)
|
|
49
|
+
─────────────────────────────────────────────────────── */
|
|
50
|
+
|
|
51
|
+
/* Guide Component Theme */
|
|
52
|
+
--bk-guide-color-line-theme: hsla(var(--bk-color-blue-primary), 0.15);
|
|
53
|
+
--bk-guide-color-pattern-theme: hsla(var(--bk-color-purple-secondary), 0.2);
|
|
54
|
+
--bk-guide-color-auto-theme: hsla(var(--bk-color-blue-secondary), 0.15);
|
|
55
|
+
--bk-guide-color-fixed-theme: hsla(var(--bk-color-blue-secondary), 0.15);
|
|
56
|
+
|
|
57
|
+
/* Baseline Component Theme */
|
|
58
|
+
--bk-baseline-color-line-theme: hsla(var(--bk-color-blue-primary), 0.15);
|
|
59
|
+
--bk-baseline-color-flat-theme: hsla(var(--bk-color-purple-secondary), 0.2);
|
|
60
|
+
|
|
61
|
+
/* Spacer Component Theme */
|
|
62
|
+
--bk-spacer-color-line-theme: hsla(var(--bk-color-purple-primary), 0.6);
|
|
63
|
+
--bk-spacer-color-flat-theme: hsla(var(--bk-color-purple-secondary), 0.2);
|
|
64
|
+
--bk-spacer-color-text-theme: hsla(var(--bk-color-purple-primary), 1);
|
|
65
|
+
|
|
66
|
+
/* Box Component Theme */
|
|
67
|
+
--bk-box-color-line-theme: hsla(var(--bk-color-pink-primary), 0.6);
|
|
68
|
+
--bk-box-color-flat-theme: hsla(var(--bk-color-pink-secondary), 0.2);
|
|
69
|
+
--bk-box-color-text-theme: hsla(var(--bk-color-pink-primary), 0.9);
|
|
70
|
+
|
|
71
|
+
/* Stack Component Theme */
|
|
72
|
+
--bk-stack-color-line-theme: hsla(var(--bk-color-red-primary), 0.6);
|
|
73
|
+
--bk-stack-color-flat-theme: hsla(var(--bk-color-red-secondary), 0.2);
|
|
74
|
+
--bk-stack-color-text-theme: hsla(var(--bk-color-red-primary), 0.9);
|
|
75
|
+
|
|
76
|
+
/* Layout Component Theme */
|
|
77
|
+
--bk-layout-color-line-theme: hsla(var(--bk-color-red-primary), 0.6);
|
|
78
|
+
--bk-layout-color-flat-theme: hsla(var(--bk-color-red-secondary), 0.2);
|
|
79
|
+
--bk-layout-color-text-theme: hsla(var(--bk-color-red-primary), 0.9);
|
|
80
|
+
|
|
81
|
+
/* Padder Component Theme */
|
|
82
|
+
--bk-padder-color-theme: hsla(var(--bk-color-purple-primary), 0.6);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* ───────────────────────────────────────────────────────
|
|
86
|
+
Dark Theme
|
|
87
|
+
- Inverts Primary/Secondary relationships
|
|
88
|
+
- Adjusts alpha values for better contrast
|
|
89
|
+
─────────────────────────────────────────────────────── */
|
|
90
|
+
|
|
91
|
+
@media (prefers-color-scheme: dark) {
|
|
92
|
+
:root {
|
|
93
|
+
/* Neutral Colors - Dark */
|
|
94
|
+
--bk-color-black-primary: 0, 10%, 30%; /* #544545 */
|
|
95
|
+
--bk-color-black-secondary: 0, 0%, 10%; /* #1A1A1A */
|
|
96
|
+
--bk-color-white-primary: 0, 0%, 90%; /* #E6E6E6 */
|
|
97
|
+
--bk-color-white-secondary: 0, 100%, 90%; /* #FFCCCC */
|
|
98
|
+
|
|
99
|
+
/* Brand Colors - Dark */
|
|
100
|
+
--bk-color-pink-primary: 260, 100%, 70%; /* #9966FF */
|
|
101
|
+
--bk-color-pink-secondary: 300, 60%, 40%; /* #A329A3 */
|
|
102
|
+
--bk-color-purple-primary: 230, 100%, 70%; /* #6680FF */
|
|
103
|
+
--bk-color-purple-secondary: 270, 60%, 40%; /* #6629A3 */
|
|
104
|
+
--bk-color-blue-primary: 200, 100%, 70%; /* #66CCFF */
|
|
105
|
+
--bk-color-blue-secondary: 240, 60%, 40%; /* #2929A3 */
|
|
106
|
+
|
|
107
|
+
/* Supporting Colors - Dark */
|
|
108
|
+
--bk-color-cyan-primary: 160, 100%, 70%; /* #66FFCC */
|
|
109
|
+
--bk-color-cyan-secondary: 200, 60%, 40%; /* #297AA3 */
|
|
110
|
+
--bk-color-green-primary: 110, 100%, 70%; /* #80FF66 */
|
|
111
|
+
--bk-color-green-secondary: 160, 60%, 40%; /* #29A37A */
|
|
112
|
+
--bk-color-yellow-primary: 70, 100%, 70%; /* #A36629 */
|
|
113
|
+
--bk-color-yellow-secondary: 30, 60%, 40%; /* #A36629 */
|
|
114
|
+
--bk-color-orange-primary: 30, 100%, 70%; /* #FFB266 */
|
|
115
|
+
--bk-color-orange-secondary: 10, 60%, 40%; /* #A33D29 */
|
|
116
|
+
--bk-color-red-primary: 0, 100%, 70%; /* #FF6666 */
|
|
117
|
+
--bk-color-red-secondary: 330, 60%, 40%; /* #A32966 */
|
|
118
|
+
|
|
119
|
+
/* Component Theme Overrides - Dark */
|
|
120
|
+
--bk-baseline-color-line-theme: hsla(var(--bk-color-white-primary), 0.1);
|
|
121
|
+
--bk-baseline-color-flat-theme: hsla(var(--bk-color-white-secondary), 0.2);
|
|
122
|
+
|
|
123
|
+
--bk-box-color-line-theme: hsla(var(--bk-color-pink-primary), 0.6);
|
|
124
|
+
--bk-box-color-flat-theme: hsla(var(--bk-color-pink-secondary), 0.3);
|
|
125
|
+
--bk-box-color-text-theme: hsla(var(--bk-color-pink-primary), 0.9);
|
|
126
|
+
|
|
127
|
+
--bk-guide-color-line-theme: hsla(var(--bk-color-white-primary), 0.1);
|
|
128
|
+
--bk-guide-color-pattern-theme: hsla(var(--bk-color-purple-secondary), 0.25);
|
|
129
|
+
--bk-guide-color-auto-theme: hsla(var(--bk-color-blue-secondary), 0.2);
|
|
130
|
+
--bk-guide-color-fixed-theme: hsla(var(--bk-color-blue-secondary), 0.2);
|
|
131
|
+
|
|
132
|
+
--bk-stack-color-line-theme: hsla(var(--bk-color-red-primary), 0.6);
|
|
133
|
+
--bk-stack-color-flat-theme: hsla(var(--bk-color-red-secondary), 0.3);
|
|
134
|
+
--bk-stack-color-text-theme: hsla(var(--bk-color-red-primary), 0.9);
|
|
135
|
+
|
|
136
|
+
--bk-layout-color-line-theme: hsla(var(--bk-color-red-primary), 0.6);
|
|
137
|
+
--bk-layout-color-flat-theme: hsla(var(--bk-color-red-secondary), 0.3);
|
|
138
|
+
--bk-layout-color-text-theme: hsla(var(--bk-color-red-primary), 0.9);
|
|
139
|
+
}
|
|
140
|
+
}
|
package/dist/utils/convert.d.ts
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file grid.ts
|
|
3
|
+
* @description Grid layout utilities
|
|
4
|
+
* @module utils
|
|
5
|
+
*/
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
/**
|
|
8
|
+
* Creates grid span styles based on span props.
|
|
9
|
+
* Handles both combined span and individual col/row span values.
|
|
10
|
+
*
|
|
11
|
+
* @param span - Optional equal span for both rows and columns
|
|
12
|
+
* @param colSpan - Optional column span value
|
|
13
|
+
* @param rowSpan - Optional row span value
|
|
14
|
+
* @returns CSS properties object with grid span values
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* createGridSpanStyles(2) // => { gridColumn: "span 2", gridRow: "span 2" }
|
|
19
|
+
* createGridSpanStyles(undefined, 3, 2) // => { gridColumn: "span 3", gridRow: "span 2" }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare const createGridSpanStyles: (span?: number, colSpan?: number, rowSpan?: number) => React.CSSProperties;
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/math.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file math.ts
|
|
3
|
-
* @description Mathematical calculation utilities
|
|
4
|
-
* @module utils
|
|
5
|
-
*/
|
|
6
1
|
/**
|
|
7
2
|
* Calculates the modulo (remainder) of a CSS value when divided by a base unit.
|
|
8
3
|
*
|
|
@@ -62,3 +57,29 @@ export declare function clamp(value: number, min: number, max: number): number;
|
|
|
62
57
|
* ```
|
|
63
58
|
*/
|
|
64
59
|
export declare function round(value: number, precision?: number): number;
|
|
60
|
+
/** Parameters for row count calculation */
|
|
61
|
+
type RowCountParams = {
|
|
62
|
+
/** Available height for the container */
|
|
63
|
+
height?: number;
|
|
64
|
+
/** Top padding/offset value */
|
|
65
|
+
top: number;
|
|
66
|
+
/** Bottom padding/offset value */
|
|
67
|
+
bottom: number;
|
|
68
|
+
/** Base unit for calculations */
|
|
69
|
+
base: number;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Calculates the number of rows that fit in the available space.
|
|
73
|
+
* Ensures at least one row is always returned.
|
|
74
|
+
*
|
|
75
|
+
* @param params - Parameters for calculation
|
|
76
|
+
* @returns Number of rows that fit in the space
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* calculateRowCount({ height: 100, top: 10, bottom: 10, base: 8 }) // => 10
|
|
81
|
+
* calculateRowCount({ height: 20, top: 0, bottom: 0, base: 8 }) // => 2
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare function calculateRowCount(params: RowCountParams): number;
|
|
85
|
+
export {};
|
package/dist/utils/merge.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file merge.ts
|
|
3
|
-
* @description Style and class merging utilities
|
|
4
|
-
* @module utils
|
|
5
|
-
*/
|
|
6
1
|
import * as React from 'react';
|
|
7
2
|
/**
|
|
8
3
|
* Combines class names, filtering out falsy values.
|
|
@@ -66,3 +61,57 @@ export declare const mergeStyles: <T extends React.CSSProperties>(...styles: Arr
|
|
|
66
61
|
* ```
|
|
67
62
|
*/
|
|
68
63
|
export declare function mergeRefs<T>(...refs: Array<React.Ref<T> | null | undefined>): React.RefCallback<T>;
|
|
64
|
+
/**
|
|
65
|
+
* Parameters for creating a style override
|
|
66
|
+
*/
|
|
67
|
+
export type StyleOverrideParams = {
|
|
68
|
+
/** CSS variable key to potentially override */
|
|
69
|
+
key: string;
|
|
70
|
+
/** Value to use if override is needed */
|
|
71
|
+
value: string;
|
|
72
|
+
/** Default styles to compare against */
|
|
73
|
+
defaultStyles: Record<string, string>;
|
|
74
|
+
/** Special case dimensions that should be skipped for specific values */
|
|
75
|
+
skipDimensions?: {
|
|
76
|
+
/** Dimensions that should be skipped when they're set to "fit-content" */
|
|
77
|
+
fitContent?: string[];
|
|
78
|
+
/** Dimensions that should be skipped when they're set to "auto" */
|
|
79
|
+
auto?: string[];
|
|
80
|
+
/** Dimensions that should be skipped when they're set to % values (like "100%") */
|
|
81
|
+
fullSize?: string[];
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Creates style overrides for CSS variables, conditionally based on comparison to defaults.
|
|
86
|
+
* Only applies overrides when the value differs from the default, optimizing style objects.
|
|
87
|
+
*
|
|
88
|
+
* @param params - Style override parameters or individual arguments
|
|
89
|
+
* @param value
|
|
90
|
+
* @param defaultStyles
|
|
91
|
+
* @returns Style object with override (if needed)
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* // Object parameter style:
|
|
96
|
+
* createStyleOverride({
|
|
97
|
+
* key: '--color',
|
|
98
|
+
* value: 'red',
|
|
99
|
+
* defaultStyles: { '--color': 'blue' }
|
|
100
|
+
* })
|
|
101
|
+
* // => { '--color': 'red' }
|
|
102
|
+
*
|
|
103
|
+
* // With dimension skipping:
|
|
104
|
+
* createStyleOverride({
|
|
105
|
+
* key: '--width',
|
|
106
|
+
* value: 'fit-content',
|
|
107
|
+
* defaultStyles: { '--width': 'auto' },
|
|
108
|
+
* skipDimensions: { fitContent: ['--width', '--height'] }
|
|
109
|
+
* })
|
|
110
|
+
* // => {}
|
|
111
|
+
*
|
|
112
|
+
* // Legacy style with separate arguments:
|
|
113
|
+
* createStyleOverride('--color', 'red', { '--color': 'blue' })
|
|
114
|
+
* // => { '--color': 'red' }
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
export declare function createStyleOverride(params: StyleOverrideParams | string, value?: string, defaultStyles?: Record<string, string>): Record<string, string | number>;
|
package/dist/utils/parse.d.ts
CHANGED
package/dist/utils/snapping.d.ts
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSR (Server-Side Rendering) utility functions for baseline-kit.
|
|
3
|
+
* These functions help ensure consistent rendering between server and client.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Detects if code is running in a server-side environment
|
|
7
|
+
*/
|
|
8
|
+
export declare const isSSR: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Default dimensions to use during server-side rendering
|
|
11
|
+
* These values provide stable rendering between server and client
|
|
12
|
+
* during the initial hydration phase.
|
|
13
|
+
*/
|
|
14
|
+
export declare const SSR_DIMENSIONS: {
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Safe window-using function that works in both server and client
|
|
20
|
+
* @param clientFn Function that uses window/browser APIs
|
|
21
|
+
* @param fallback Fallback value to use in SSR environment
|
|
22
|
+
* @returns Result of clientFn in browser, fallback in SSR
|
|
23
|
+
*/
|
|
24
|
+
export declare function safeClientValue<T>(clientFn: () => T, fallback: T): T;
|
|
25
|
+
/**
|
|
26
|
+
* Returns a stable value during SSR and initial render, then switches to
|
|
27
|
+
* the dynamic value after hydration
|
|
28
|
+
* @param isHydrated Boolean indicating if component is hydrated
|
|
29
|
+
* @param ssrValue Value to use during SSR/initial render
|
|
30
|
+
* @param dynamicValue Value to use after hydration
|
|
31
|
+
* @returns Appropriate value based on hydration state
|
|
32
|
+
*/
|
|
33
|
+
export declare function hydratedValue<T>(isHydrated: boolean, ssrValue: T, dynamicValue: T): T;
|
package/dist/utils/timing.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"scripts": {
|
|
3
|
-
"
|
|
3
|
+
"build": "vite build && bun run build:type",
|
|
4
4
|
"build:type": "tsc -p tsconfig.build.json",
|
|
5
|
-
"
|
|
6
|
-
"version": "changeset version",
|
|
7
|
-
"test:coverage": "vitest run --coverage",
|
|
8
|
-
"release": "changeset publish",
|
|
9
|
-
"typecheck": "tsc --noEmit",
|
|
10
|
-
"test:ui": "vitest --ui",
|
|
5
|
+
"changeset": "changeset",
|
|
11
6
|
"dev": "vite",
|
|
12
|
-
"
|
|
13
|
-
"
|
|
7
|
+
"format": "prettier --write \"src/**/*.{ts,tsx,css}\"",
|
|
8
|
+
"lint": "eslint src --fix",
|
|
9
|
+
"prepare": "bun run build && bun run build:type",
|
|
14
10
|
"prepublishOnly": "bun run build && bun run build:type",
|
|
15
|
-
"
|
|
11
|
+
"release": "changeset publish",
|
|
16
12
|
"test": "vitest",
|
|
17
|
-
"
|
|
13
|
+
"test:coverage": "vitest run --coverage",
|
|
14
|
+
"typecheck": "tsc --noEmit",
|
|
15
|
+
"version": "changeset version"
|
|
18
16
|
},
|
|
19
17
|
"peerDependencies": {
|
|
20
|
-
"react": "^
|
|
21
|
-
"react-dom": "^
|
|
18
|
+
"react": "^19",
|
|
19
|
+
"react-dom": "^19",
|
|
22
20
|
"typescript": "^5.7.3"
|
|
23
21
|
},
|
|
24
22
|
"main": "dist/index.cjs",
|
|
@@ -48,16 +46,16 @@
|
|
|
48
46
|
"url": "git+https://github.com/dnvt/baseline-kit.git"
|
|
49
47
|
},
|
|
50
48
|
"devDependencies": {
|
|
51
|
-
"@changesets/cli": "^2.
|
|
49
|
+
"@changesets/cli": "^2.28.1",
|
|
52
50
|
"@testing-library/jest-dom": "^6.6.3",
|
|
53
51
|
"@testing-library/react": "^16.2.0",
|
|
54
|
-
"@types/node": "^22.13.
|
|
55
|
-
"@types/react": "^19.0.
|
|
56
|
-
"@types/react-dom": "^19.0.
|
|
57
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
58
|
-
"@typescript-eslint/parser": "^
|
|
59
|
-
"@vitejs/plugin-react-swc": "^3.
|
|
60
|
-
"@vitest/coverage-v8": "^2.1.
|
|
52
|
+
"@types/node": "^22.13.5",
|
|
53
|
+
"@types/react": "^19.0.10",
|
|
54
|
+
"@types/react-dom": "^19.0.4",
|
|
55
|
+
"@typescript-eslint/eslint-plugin": "^8.25.0",
|
|
56
|
+
"@typescript-eslint/parser": "^8.25.0",
|
|
57
|
+
"@vitejs/plugin-react-swc": "^3.8.0",
|
|
58
|
+
"@vitest/coverage-v8": "^2.1.9",
|
|
61
59
|
"autoprefixer": "^10.4.20",
|
|
62
60
|
"cssnano": "^7.0.6",
|
|
63
61
|
"eslint": "^8.57.1",
|
|
@@ -65,16 +63,16 @@
|
|
|
65
63
|
"eslint-plugin-react": "^7.37.4",
|
|
66
64
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
67
65
|
"jsdom": "^25.0.1",
|
|
68
|
-
"prettier": "^3.
|
|
69
|
-
"rollup": "^4.34.
|
|
66
|
+
"prettier": "^3.5.2",
|
|
67
|
+
"rollup": "^4.34.8",
|
|
70
68
|
"rollup-plugin-dts": "^6.1.1",
|
|
71
69
|
"rollup-plugin-visualizer": "^5.14.0",
|
|
72
|
-
"vite": "^6.
|
|
70
|
+
"vite": "^6.2.0",
|
|
73
71
|
"vite-plugin-static-copy": "^2.2.0",
|
|
74
|
-
"vitest": "^
|
|
72
|
+
"vitest": "^3.0.7"
|
|
75
73
|
},
|
|
76
74
|
"name": "baseline-kit",
|
|
77
|
-
"version": "2.0
|
|
75
|
+
"version": "2.1.0",
|
|
78
76
|
"type": "module",
|
|
79
77
|
"homepage": "https://github.com/dnvt/baseline-kit#readme",
|
|
80
78
|
"types": "dist/index.d.ts",
|
|
@@ -82,9 +80,22 @@
|
|
|
82
80
|
".": {
|
|
83
81
|
"types": "./dist/index.d.ts",
|
|
84
82
|
"import": "./dist/index.mjs",
|
|
85
|
-
"require": "./dist/index.cjs"
|
|
83
|
+
"require": "./dist/index.cjs",
|
|
84
|
+
"default": "./dist/index.mjs"
|
|
85
|
+
},
|
|
86
|
+
"./styles": {
|
|
87
|
+
"import": "./dist/styles.css",
|
|
88
|
+
"require": "./dist/styles.css",
|
|
89
|
+
"default": "./dist/styles.css"
|
|
90
|
+
},
|
|
91
|
+
"./theme": {
|
|
92
|
+
"import": "./dist/theme.css",
|
|
93
|
+
"require": "./dist/theme.css",
|
|
94
|
+
"default": "./dist/theme.css"
|
|
86
95
|
},
|
|
87
|
-
"./styles.css": "./dist/styles.css"
|
|
96
|
+
"./dist/styles.css": "./dist/styles.css",
|
|
97
|
+
"./dist/theme.css": "./dist/theme.css",
|
|
98
|
+
"./package.json": "./package.json"
|
|
88
99
|
},
|
|
89
100
|
"files": [
|
|
90
101
|
"dist",
|
|
@@ -93,7 +104,8 @@
|
|
|
93
104
|
],
|
|
94
105
|
"style": "dist/styles.css",
|
|
95
106
|
"sideEffects": [
|
|
96
|
-
"dist/styles.css"
|
|
107
|
+
"dist/styles.css",
|
|
108
|
+
"dist/theme.css"
|
|
97
109
|
],
|
|
98
110
|
"bugs": {
|
|
99
111
|
"url": "https://github.com/dnvt/baseline-kit/issues"
|
|
@@ -101,13 +113,12 @@
|
|
|
101
113
|
"license": "MIT",
|
|
102
114
|
"module": "dist/index.mjs",
|
|
103
115
|
"publishConfig": {
|
|
104
|
-
"access": "public"
|
|
105
|
-
"registry": "https://registry.npmjs.org/"
|
|
116
|
+
"access": "public"
|
|
106
117
|
},
|
|
107
118
|
"author": "Francois Denavaut",
|
|
108
119
|
"description": "Baseline Kit is a lightweight development tool for visualizing and debugging grid systems and spacing in React applications. It provides configurable overlays for both column-based and baseline grids, flexible spacing components, and theme-aware configuration—all optimized for performance and built with TypeScript.",
|
|
109
120
|
"dependencies": {
|
|
110
121
|
"esbuild": "^0.24.2",
|
|
111
|
-
"postcss-preset-env": "^10.1.
|
|
122
|
+
"postcss-preset-env": "^10.1.5"
|
|
112
123
|
}
|
|
113
124
|
}
|