baseline-kit 3.0.1 → 5.0.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 +99 -63
- package/dist/README.md +99 -63
- package/dist/baseline-kit.css +3 -21
- package/dist/core/src/config/defaults.d.ts +2 -0
- package/dist/core/src/config/index.d.ts +3 -0
- package/dist/core/src/config/merge.d.ts +21 -0
- package/dist/core/src/config/schema.d.ts +33 -0
- package/dist/core/src/descriptors/baseline.d.ts +26 -0
- package/dist/core/src/descriptors/box.d.ts +20 -0
- package/dist/core/src/descriptors/guide.d.ts +44 -0
- package/dist/core/src/descriptors/index.d.ts +5 -0
- package/dist/core/src/descriptors/padder.d.ts +19 -0
- package/dist/core/src/descriptors/spacer.d.ts +24 -0
- package/dist/core/src/index.d.ts +10 -0
- package/dist/core/src/types.d.ts +62 -0
- package/dist/core/src/utils/convert.d.ts +10 -0
- package/dist/core/src/utils/grid.d.ts +18 -0
- package/dist/{utils → core/src/utils}/index.d.ts +2 -9
- package/dist/core/src/utils/math.d.ts +9 -0
- package/dist/core/src/utils/merge.d.ts +28 -0
- package/dist/core/src/utils/normalize.d.ts +13 -0
- package/dist/core/src/utils/padding.d.ts +2 -0
- package/dist/core/src/utils/parse.d.ts +5 -0
- package/dist/core/src/utils/snapping.d.ts +2 -0
- package/dist/core/src/validation/guide.d.ts +3 -0
- package/dist/core/src/validation/index.d.ts +1 -0
- package/dist/core.cjs +1 -0
- package/dist/core.d.ts +344 -0
- package/dist/core.mjs +2 -0
- package/dist/dom/src/index.d.ts +11 -0
- package/dist/dom/src/measure.d.ts +18 -0
- package/dist/dom/src/observers.d.ts +5 -0
- package/dist/{utils → dom/src}/ssr.d.ts +0 -6
- package/dist/dom/src/timing.d.ts +2 -0
- package/dist/dom/src/viewport.d.ts +7 -0
- package/dist/dom/src/virtual.d.ts +23 -0
- package/dist/guide.cjs +2 -0
- package/dist/guide.cjs.map +1 -0
- package/dist/guide.css +2 -0
- package/dist/guide.d.ts +146 -0
- package/dist/guide.mjs +589 -0
- package/dist/guide.mjs.map +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +197 -30
- package/dist/index.mjs +614 -1747
- package/dist/index.mjs.map +1 -1
- package/dist/react/src/components/Baseline/Baseline.d.ts +13 -0
- package/dist/react/src/components/Baseline/index.d.ts +1 -0
- package/dist/react/src/components/Box/Box.d.ts +26 -0
- package/dist/react/src/components/Box/index.d.ts +1 -0
- package/dist/react/src/components/Config/Config.d.ts +20 -0
- package/dist/react/src/components/Config/index.d.ts +2 -0
- package/dist/react/src/components/Guide/Guide.d.ts +16 -0
- package/dist/react/src/components/Guide/index.d.ts +1 -0
- package/dist/react/src/components/Padder/Padder.d.ts +20 -0
- package/dist/react/src/components/Padder/index.d.ts +1 -0
- package/dist/react/src/components/Spacer/Spacer.d.ts +14 -0
- package/dist/react/src/components/Spacer/index.d.ts +1 -0
- package/dist/{components → react/src/components}/index.d.ts +1 -5
- package/dist/react/src/components/types.d.ts +29 -0
- package/dist/react/src/guide.d.ts +10 -0
- package/dist/{hooks → react/src/hooks}/index.d.ts +2 -3
- package/dist/react/src/hooks/useBaseline.d.ts +26 -0
- package/dist/react/src/hooks/useConfig.d.ts +9 -0
- package/dist/react/src/hooks/useDebug.d.ts +6 -0
- package/dist/react/src/hooks/useGuide.d.ts +7 -0
- package/dist/{hooks → react/src/hooks}/useIsClient.d.ts +0 -2
- package/dist/react/src/hooks/useMeasure.d.ts +10 -0
- package/dist/react/src/hooks/useVirtual.d.ts +14 -0
- package/dist/react/src/index.d.ts +21 -0
- package/dist/react/src/utils/index.d.ts +9 -0
- package/dist/react/src/utils/merge.d.ts +10 -0
- package/dist/react/src/utils/ssr.d.ts +1 -0
- package/dist/reset.css +43 -0
- package/dist/src-CMjyHjX5.cjs +2 -0
- package/dist/src-CMjyHjX5.cjs.map +1 -0
- package/dist/src-QHaSfgVe.js +619 -0
- package/dist/src-QHaSfgVe.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/theme/dark.css +0 -8
- package/dist/theme/default.css +0 -9
- package/dist/theme/tokens.css +1 -10
- package/dist/theme.css +0 -18
- package/package.json +82 -42
- package/dist/components/Baseline/Baseline.d.ts +0 -48
- package/dist/components/Baseline/index.d.ts +0 -6
- package/dist/components/Box/Box.d.ts +0 -73
- package/dist/components/Box/index.d.ts +0 -6
- package/dist/components/Config/Config.d.ts +0 -179
- package/dist/components/Config/defaults.d.ts +0 -25
- package/dist/components/Config/index.d.ts +0 -11
- package/dist/components/Guide/Guide.d.ts +0 -70
- package/dist/components/Guide/index.d.ts +0 -6
- package/dist/components/Guide/types.d.ts +0 -144
- package/dist/components/Guide/validation.d.ts +0 -82
- package/dist/components/Layout/Layout.d.ts +0 -73
- package/dist/components/Layout/index.d.ts +0 -10
- package/dist/components/Padder/Padder.d.ts +0 -67
- package/dist/components/Padder/index.d.ts +0 -10
- package/dist/components/Spacer/Spacer.d.ts +0 -48
- package/dist/components/Spacer/index.d.ts +0 -10
- package/dist/components/Stack/Stack.d.ts +0 -84
- package/dist/components/Stack/index.d.ts +0 -10
- package/dist/components/styles/index.d.ts +0 -11
- package/dist/components/types.d.ts +0 -102
- package/dist/hooks/useBaseline.d.ts +0 -55
- package/dist/hooks/useConfig.d.ts +0 -41
- package/dist/hooks/useDebug.d.ts +0 -49
- package/dist/hooks/useGuide.d.ts +0 -61
- package/dist/hooks/useMeasure.d.ts +0 -35
- package/dist/hooks/useVirtual.d.ts +0 -60
- package/dist/styles.d.ts +0 -6
- package/dist/theme.d.ts +0 -6
- package/dist/utils/convert.d.ts +0 -24
- package/dist/utils/grid.d.ts +0 -22
- package/dist/utils/math.d.ts +0 -48
- package/dist/utils/merge.d.ts +0 -117
- package/dist/utils/normalize.d.ts +0 -30
- package/dist/utils/padding.d.ts +0 -11
- package/dist/utils/parse.d.ts +0 -18
- package/dist/utils/snapping.d.ts +0 -28
- package/dist/utils/timing.d.ts +0 -45
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { BaselineVariant } from '@/components';
|
|
3
|
-
import type { GuideVariant, Variant } from '../types';
|
|
4
|
-
/**
|
|
5
|
-
* Controls component debugging visibility and behavior.
|
|
6
|
-
*
|
|
7
|
-
* @remarks
|
|
8
|
-
* - `none`: Debug features are fully disabled
|
|
9
|
-
* - `hidden`: Debug elements exist in DOM but are not visible
|
|
10
|
-
* - `visible`: Debug elements are fully rendered and visible
|
|
11
|
-
*/
|
|
12
|
-
export type DebuggingMode = 'none' | 'hidden' | 'visible';
|
|
13
|
-
/** Color configuration for component themes. */
|
|
14
|
-
type Colors = {
|
|
15
|
-
/** Color for line-based visuals */
|
|
16
|
-
line: string;
|
|
17
|
-
/** Color for flat surface visuals */
|
|
18
|
-
flat: string;
|
|
19
|
-
/** Color for measurement indicators */
|
|
20
|
-
text: string;
|
|
21
|
-
};
|
|
22
|
-
/** Complete configuration schema for baseline-kit. */
|
|
23
|
-
export type ConfigSchema = {
|
|
24
|
-
/** Base unit for spacing calculations */
|
|
25
|
-
base: number;
|
|
26
|
-
/** Guide component configuration */
|
|
27
|
-
guide: {
|
|
28
|
-
variant: GuideVariant;
|
|
29
|
-
debugging: DebuggingMode;
|
|
30
|
-
colors: Record<GuideVariant, string>;
|
|
31
|
-
};
|
|
32
|
-
/** Baseline component configuration */
|
|
33
|
-
baseline: {
|
|
34
|
-
variant: BaselineVariant;
|
|
35
|
-
debugging: DebuggingMode;
|
|
36
|
-
colors: Record<BaselineVariant, string>;
|
|
37
|
-
};
|
|
38
|
-
/** Stack component configuration */
|
|
39
|
-
stack: {
|
|
40
|
-
colors: Colors;
|
|
41
|
-
debugging: DebuggingMode;
|
|
42
|
-
};
|
|
43
|
-
/** Layout component configuration */
|
|
44
|
-
layout: {
|
|
45
|
-
colors: Colors;
|
|
46
|
-
debugging: DebuggingMode;
|
|
47
|
-
};
|
|
48
|
-
/** Spacer component configuration */
|
|
49
|
-
spacer: {
|
|
50
|
-
variant: Variant;
|
|
51
|
-
debugging: DebuggingMode;
|
|
52
|
-
colors: Colors;
|
|
53
|
-
};
|
|
54
|
-
/** Box component configuration */
|
|
55
|
-
box: {
|
|
56
|
-
colors: Colors;
|
|
57
|
-
debugging: DebuggingMode;
|
|
58
|
-
};
|
|
59
|
-
/** Padder component configuration */
|
|
60
|
-
padder: {
|
|
61
|
-
color: string;
|
|
62
|
-
debugging: DebuggingMode;
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
export declare const useDefaultConfig: () => ConfigSchema;
|
|
66
|
-
type ConfigProps = {
|
|
67
|
-
children: React.ReactNode;
|
|
68
|
-
/** Base unit for spacing calculations */
|
|
69
|
-
base?: number;
|
|
70
|
-
/** Baseline component overrides */
|
|
71
|
-
baseline?: Partial<ConfigSchema['baseline']>;
|
|
72
|
-
/** Flex component overrides */
|
|
73
|
-
stack?: Partial<ConfigSchema['stack']>;
|
|
74
|
-
/** Layout component overrides */
|
|
75
|
-
layout?: Partial<ConfigSchema['layout']>;
|
|
76
|
-
/** Guide component overrides */
|
|
77
|
-
guide?: Partial<ConfigSchema['guide']>;
|
|
78
|
-
/** Spacer component overrides */
|
|
79
|
-
spacer?: Partial<ConfigSchema['spacer']>;
|
|
80
|
-
/** Box component overrides */
|
|
81
|
-
box?: Partial<ConfigSchema['box']>;
|
|
82
|
-
/** Padder component overrides */
|
|
83
|
-
padder?: Partial<ConfigSchema['padder']>;
|
|
84
|
-
};
|
|
85
|
-
/** Parameters for creating CSS variables */
|
|
86
|
-
type CSSVariablesParams = {
|
|
87
|
-
/** Base unit for spacing calculations */
|
|
88
|
-
base: number;
|
|
89
|
-
/** Baseline component configuration */
|
|
90
|
-
baseline: ConfigSchema['baseline'];
|
|
91
|
-
/** Guide component configuration */
|
|
92
|
-
guide: ConfigSchema['guide'];
|
|
93
|
-
/** Stack component configuration */
|
|
94
|
-
stack: ConfigSchema['stack'];
|
|
95
|
-
/** Spacer component configuration */
|
|
96
|
-
spacer: ConfigSchema['spacer'];
|
|
97
|
-
/** Layout component configuration */
|
|
98
|
-
layout: ConfigSchema['layout'];
|
|
99
|
-
/** Box component configuration */
|
|
100
|
-
box: ConfigSchema['box'];
|
|
101
|
-
/** Padder component configuration */
|
|
102
|
-
padder: ConfigSchema['padder'];
|
|
103
|
-
};
|
|
104
|
-
/**
|
|
105
|
-
* Creates CSS variables from the configuration object.
|
|
106
|
-
* These variables are used throughout the component library.
|
|
107
|
-
*/
|
|
108
|
-
export declare const createCSSVariables: (params: CSSVariablesParams) => Record<string, string>;
|
|
109
|
-
/** Parameters for merging configuration */
|
|
110
|
-
type MergeConfigParams = {
|
|
111
|
-
/** Parent configuration to extend */
|
|
112
|
-
parentConfig: ConfigSchema;
|
|
113
|
-
/** Base unit override */
|
|
114
|
-
base?: number;
|
|
115
|
-
/** Baseline component overrides */
|
|
116
|
-
baseline?: Partial<ConfigSchema['baseline']>;
|
|
117
|
-
/** Guide component overrides */
|
|
118
|
-
guide?: Partial<ConfigSchema['guide']>;
|
|
119
|
-
/** Spacer component overrides */
|
|
120
|
-
spacer?: Partial<ConfigSchema['spacer']>;
|
|
121
|
-
/** Box component overrides */
|
|
122
|
-
box?: Partial<ConfigSchema['box']>;
|
|
123
|
-
/** Stack component overrides */
|
|
124
|
-
stack?: Partial<ConfigSchema['stack']>;
|
|
125
|
-
/** Layout component overrides */
|
|
126
|
-
layout?: Partial<ConfigSchema['layout']>;
|
|
127
|
-
/** Padder component overrides */
|
|
128
|
-
padder?: Partial<ConfigSchema['padder']>;
|
|
129
|
-
};
|
|
130
|
-
/**
|
|
131
|
-
* Merges parent config with overrides.
|
|
132
|
-
* Creates a new config object without mutating the parent.
|
|
133
|
-
*/
|
|
134
|
-
export declare const mergeConfig: (params: MergeConfigParams) => ConfigSchema;
|
|
135
|
-
/**
|
|
136
|
-
* Configuration provider for baseline-kit components.
|
|
137
|
-
*
|
|
138
|
-
* @remarks
|
|
139
|
-
* Config provides theme and debugging settings to all nested components.
|
|
140
|
-
* It allows for:
|
|
141
|
-
* - Global base unit configuration
|
|
142
|
-
* - Component-specific color themes
|
|
143
|
-
* - Debug mode control
|
|
144
|
-
* - Visual style customization
|
|
145
|
-
*
|
|
146
|
-
* Configs can be nested to override settings for specific sections.
|
|
147
|
-
*
|
|
148
|
-
* @example
|
|
149
|
-
* ```tsx
|
|
150
|
-
* // Basic global configuration
|
|
151
|
-
* <Config base={8}>
|
|
152
|
-
* <App />
|
|
153
|
-
* </Config>
|
|
154
|
-
*
|
|
155
|
-
* // Component-specific overrides
|
|
156
|
-
* <Config
|
|
157
|
-
* base={8}
|
|
158
|
-
* guide={{
|
|
159
|
-
* debugging: "visible",
|
|
160
|
-
* colors: {
|
|
161
|
-
* line: "rgba(255,0,0,0.2)",
|
|
162
|
-
* pattern: "rgba(0,0,255,0.2)"
|
|
163
|
-
* }
|
|
164
|
-
* }}
|
|
165
|
-
* >
|
|
166
|
-
* <Layout>...</Layout>
|
|
167
|
-
* </Config>
|
|
168
|
-
*
|
|
169
|
-
* // Nested configurations
|
|
170
|
-
* <Config base={8}>
|
|
171
|
-
* <div>Uses 8px base</div>
|
|
172
|
-
* <Config base={4}>
|
|
173
|
-
* <div>Uses 4px base</div>
|
|
174
|
-
* </Config>
|
|
175
|
-
* </Config>
|
|
176
|
-
* ```
|
|
177
|
-
*/
|
|
178
|
-
export declare function Config({ children, base, stack, baseline, guide, layout, spacer, box, padder, }: ConfigProps): import("react/jsx-runtime").JSX.Element;
|
|
179
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file defaults.ts
|
|
3
|
-
* @description Default theme and configuration values for baseline-kit
|
|
4
|
-
* @module baseline-kit/components/Config
|
|
5
|
-
*/
|
|
6
|
-
import type { ConfigSchema } from './Config';
|
|
7
|
-
/**
|
|
8
|
-
* Default configuration for baseline-kit.
|
|
9
|
-
*
|
|
10
|
-
* @remarks
|
|
11
|
-
* Provides the base configuration for all components including:
|
|
12
|
-
* - Base unit for spacing calculations (8px default)
|
|
13
|
-
* - Default component variants
|
|
14
|
-
* - Initial debugging modes
|
|
15
|
-
* - Theme color assignments
|
|
16
|
-
*
|
|
17
|
-
* Each component section includes:
|
|
18
|
-
* - Visual variant selection (where applicable)
|
|
19
|
-
* - Debugging mode setting
|
|
20
|
-
* - Color theme assignments
|
|
21
|
-
*
|
|
22
|
-
* The configuration is marked as const to ensure type safety
|
|
23
|
-
* and prevent accidental modifications.
|
|
24
|
-
*/
|
|
25
|
-
export declare const DEFAULT_CONFIG: ConfigSchema;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Config Component Entry (components/Config/index.ts)
|
|
3
|
-
* @description Theme and configuration provider
|
|
4
|
-
* @module baseline-kit/components/Config
|
|
5
|
-
*
|
|
6
|
-
* @remarks
|
|
7
|
-
* Central configuration system for baseline-kit, managing
|
|
8
|
-
* theme values and default settings.
|
|
9
|
-
*/
|
|
10
|
-
export * from './Config';
|
|
11
|
-
export { DEFAULT_CONFIG } from './defaults';
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ComponentsProps } from '@components';
|
|
3
|
-
import { AutoConfig, FixedConfig, LineConfig, PatternConfig } from './types';
|
|
4
|
-
import type { GuideVariant } from '../types';
|
|
5
|
-
/** Merged configuration types that support various grid layout strategies */
|
|
6
|
-
export type GuideConfig = PatternConfig | AutoConfig | FixedConfig | LineConfig;
|
|
7
|
-
export type GuideProps = {
|
|
8
|
-
/** Controls horizontal alignment of columns within the container */
|
|
9
|
-
align?: React.CSSProperties['justifyContent'];
|
|
10
|
-
/** Visual style of the guide */
|
|
11
|
-
variant?: GuideVariant;
|
|
12
|
-
/** Number of columns (for fixed/auto variants) */
|
|
13
|
-
columns?: number | readonly (string | number | undefined | 'auto')[];
|
|
14
|
-
/** Column width (for fixed variant) */
|
|
15
|
-
columnWidth?: React.CSSProperties['width'];
|
|
16
|
-
/** Maximum width of the guide */
|
|
17
|
-
maxWidth?: React.CSSProperties['maxWidth'];
|
|
18
|
-
/** Color override for guide lines */
|
|
19
|
-
color?: React.CSSProperties['color'];
|
|
20
|
-
/** Content to render inside the guide */
|
|
21
|
-
children?: React.ReactNode;
|
|
22
|
-
/** Gap between columns */
|
|
23
|
-
gap?: number;
|
|
24
|
-
/** Flag to enable SSR-compatible mode (simplified initial render) */
|
|
25
|
-
ssrMode?: boolean;
|
|
26
|
-
} & ComponentsProps & Omit<GuideConfig, 'columns' | 'columnWidth' | 'gap'>;
|
|
27
|
-
/**
|
|
28
|
-
* A developer tool component that provides visual grid overlays for alignment.
|
|
29
|
-
*
|
|
30
|
-
* @remarks
|
|
31
|
-
* Guide renders a configurable grid overlay that helps visualize:
|
|
32
|
-
* - Column layouts and spacing
|
|
33
|
-
* - Content alignment
|
|
34
|
-
* - Layout patterns
|
|
35
|
-
*
|
|
36
|
-
* The component supports multiple variants:
|
|
37
|
-
* - "line": Simple evenly-spaced vertical lines
|
|
38
|
-
* - "pattern": Custom repeating column width patterns
|
|
39
|
-
* - "fixed": Fixed number of equal or custom-width columns
|
|
40
|
-
* - "auto": Dynamically calculated columns based on container width
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* ```tsx
|
|
44
|
-
* // Basic column guide
|
|
45
|
-
* <Guide
|
|
46
|
-
* variant="line"
|
|
47
|
-
* gap={8}
|
|
48
|
-
* debugging="visible"
|
|
49
|
-
* />
|
|
50
|
-
*
|
|
51
|
-
* // Custom column pattern
|
|
52
|
-
* <Guide
|
|
53
|
-
* variant="pattern"
|
|
54
|
-
* columns={['100px', '1fr', '2fr']}
|
|
55
|
-
* gap={16}
|
|
56
|
-
* align="center"
|
|
57
|
-
* debugging="visible"
|
|
58
|
-
* />
|
|
59
|
-
*
|
|
60
|
-
* // Fixed columns with custom width
|
|
61
|
-
* <Guide
|
|
62
|
-
* variant="fixed"
|
|
63
|
-
* columns={12}
|
|
64
|
-
* columnWidth="60px"
|
|
65
|
-
* gap={8}
|
|
66
|
-
* debugging="visible"
|
|
67
|
-
* />
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
export declare const Guide: React.NamedExoticComponent<GuideProps>;
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file types.ts
|
|
3
|
-
* @description Type definitions for Guide component configurations
|
|
4
|
-
* @module baseline-kit/components/Guide/types
|
|
5
|
-
*/
|
|
6
|
-
import * as React from 'react';
|
|
7
|
-
import { GuideColumnsPattern } from '../types';
|
|
8
|
-
/**
|
|
9
|
-
* Base configuration shared by all guide variants.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* const baseConfig: BaseGuideConfig = {
|
|
14
|
-
* gap: 2, // 2px gap
|
|
15
|
-
* base: 8 // 8px base unit
|
|
16
|
-
* }
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
type BaseGuideConfig = {
|
|
20
|
-
/** Gap between columnms. */
|
|
21
|
-
gap?: React.CSSProperties['gap'];
|
|
22
|
-
/**
|
|
23
|
-
* Base unit in pixels for spacing calculations.
|
|
24
|
-
* Typically inherited from theme configuration.
|
|
25
|
-
*/
|
|
26
|
-
base?: number;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Pattern-based grid configuration.
|
|
30
|
-
* Defines repeating column width patterns.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```ts
|
|
34
|
-
* // Three-column pattern: 100px | 200px | 100px
|
|
35
|
-
* const pattern: PatternConfig = {
|
|
36
|
-
* variant: 'pattern',
|
|
37
|
-
* columns: [100, '200px', '1fr'],
|
|
38
|
-
* gap: 2
|
|
39
|
-
* }
|
|
40
|
-
*
|
|
41
|
-
* // Responsive pattern with mixed units
|
|
42
|
-
* const responsive: PatternConfig = {
|
|
43
|
-
* variant: 'pattern',
|
|
44
|
-
* columns: ['20%', '1fr', '200px'],
|
|
45
|
-
* gap: 2
|
|
46
|
-
* }
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
export type PatternConfig = BaseGuideConfig & {
|
|
50
|
-
/** Identifies this as a pattern-based configuration */
|
|
51
|
-
variant: 'pattern';
|
|
52
|
-
/** Array of column widths that repeat */
|
|
53
|
-
columns: GuideColumnsPattern;
|
|
54
|
-
/** Not applicable in pattern mode */
|
|
55
|
-
columnWidth?: never;
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Fixed-column grid configuration.
|
|
59
|
-
* Specifies exact number of equal-width columns.
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* ```ts
|
|
63
|
-
* // Basic 12-column grid
|
|
64
|
-
* const grid: FixedConfig = {
|
|
65
|
-
* variant: 'fixed',
|
|
66
|
-
* columns: 12,
|
|
67
|
-
* gap: 2
|
|
68
|
-
* }
|
|
69
|
-
*
|
|
70
|
-
* // Fixed-width columns
|
|
71
|
-
* const fixed: FixedConfig = {
|
|
72
|
-
* variant: 'fixed',
|
|
73
|
-
* columns: 6,
|
|
74
|
-
* columnWidth: '160px',
|
|
75
|
-
* gap: 2
|
|
76
|
-
* }
|
|
77
|
-
* ```
|
|
78
|
-
*/
|
|
79
|
-
export type FixedConfig = BaseGuideConfig & {
|
|
80
|
-
/** Identifies this as a fixed-column configuration */
|
|
81
|
-
variant: 'fixed';
|
|
82
|
-
/** Number of columns to create */
|
|
83
|
-
columns: number;
|
|
84
|
-
/** Optional fixed width for all columns */
|
|
85
|
-
columnWidth?: React.CSSProperties['width'];
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* Auto-calculated grid configuration.
|
|
89
|
-
* Creates as many columns as will fit given a column width.
|
|
90
|
-
*
|
|
91
|
-
* @example
|
|
92
|
-
* ```ts
|
|
93
|
-
* // Auto-fill columns of 200px
|
|
94
|
-
* const auto: AutoConfig = {
|
|
95
|
-
* variant: 'auto',
|
|
96
|
-
* columnWidth: '200px',
|
|
97
|
-
* gap: 2
|
|
98
|
-
* }
|
|
99
|
-
*
|
|
100
|
-
* // Responsive columns with minimum width
|
|
101
|
-
* const responsive: AutoConfig = {
|
|
102
|
-
* variant: 'auto',
|
|
103
|
-
* columnWidth: 'minmax(200px, 1fr)',
|
|
104
|
-
* gap: 2
|
|
105
|
-
* }
|
|
106
|
-
* ```
|
|
107
|
-
*/
|
|
108
|
-
export type AutoConfig = BaseGuideConfig & {
|
|
109
|
-
/** Identifies this as an auto-calculated configuration */
|
|
110
|
-
variant: 'auto';
|
|
111
|
-
/** Desired width for each column */
|
|
112
|
-
columnWidth: React.CSSProperties['columnWidth'];
|
|
113
|
-
/** Not applicable in auto mode */
|
|
114
|
-
columns?: never;
|
|
115
|
-
};
|
|
116
|
-
/**
|
|
117
|
-
* Simple line-based guide configuration.
|
|
118
|
-
* Creates evenly-spaced vertical lines.
|
|
119
|
-
*
|
|
120
|
-
* @example
|
|
121
|
-
* ```ts
|
|
122
|
-
* // Basic line guide
|
|
123
|
-
* const lines: LineConfig = {
|
|
124
|
-
* variant: 'line',
|
|
125
|
-
* gap: 1
|
|
126
|
-
* }
|
|
127
|
-
*
|
|
128
|
-
* // Custom-spaced lines
|
|
129
|
-
* const wideLines: LineConfig = {
|
|
130
|
-
* variant: 'line',
|
|
131
|
-
* gap: 4,
|
|
132
|
-
* base: 8
|
|
133
|
-
* }
|
|
134
|
-
* ```
|
|
135
|
-
*/
|
|
136
|
-
export type LineConfig = BaseGuideConfig & {
|
|
137
|
-
/** Optional variant identifier (defaults to 'line') */
|
|
138
|
-
variant?: 'line';
|
|
139
|
-
/** Not applicable in line mode */
|
|
140
|
-
columns?: never;
|
|
141
|
-
/** Not applicable in line mode */
|
|
142
|
-
columnWidth?: never;
|
|
143
|
-
};
|
|
144
|
-
export {};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file validation.ts
|
|
3
|
-
* @description Validation utilities for Guide component configurations
|
|
4
|
-
* @module baseline-kit/components/Guide/validation
|
|
5
|
-
*/
|
|
6
|
-
import { GridAlignment, GuideColumnsPattern, GuideColumnValue, GuideConfig } from '@components';
|
|
7
|
-
/**
|
|
8
|
-
* Validates individual grid column values.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* isValidGuideColumnValue(100) // true
|
|
13
|
-
* isValidGuideColumnValue('100px') // true
|
|
14
|
-
* isValidGuideColumnValue('auto') // true
|
|
15
|
-
* isValidGuideColumnValue('foo') // false
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare const isValidGuideColumnValue: (value: unknown) => value is GuideColumnValue;
|
|
19
|
-
/**
|
|
20
|
-
* Validates an array of column values as a grid pattern.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```ts
|
|
24
|
-
* isValidGuidePattern(['100px', '1fr']) // true
|
|
25
|
-
* isValidGuidePattern([100, 200]) // true
|
|
26
|
-
* isValidGuidePattern(['invalid']) // false
|
|
27
|
-
* isValidGuidePattern([]) // false
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export declare const isValidGuidePattern: (pattern: unknown) => pattern is GuideColumnsPattern;
|
|
31
|
-
/**
|
|
32
|
-
* Validates CSS grid values against supported units.
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```ts
|
|
36
|
-
* isGuideValue('100px') // true
|
|
37
|
-
* isGuideValue('2rem') // true
|
|
38
|
-
* isGuideValue('foo') // false
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
export declare const isGuideValue: (value: unknown) => boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Validates grid alignment values.
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* ```ts
|
|
47
|
-
* isGuideAlignment('start') // true
|
|
48
|
-
* isGuideAlignment('center') // true
|
|
49
|
-
* isGuideAlignment('foo') // false
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
export declare const isGuideAlignment: (value: unknown) => value is GridAlignment;
|
|
53
|
-
/**
|
|
54
|
-
* Validates line-based guide configurations.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```ts
|
|
58
|
-
* isGuideLineConfig({ variant: 'line' }) // true
|
|
59
|
-
* isGuideLineConfig({ variant: 'pattern' }) // false
|
|
60
|
-
* ```
|
|
61
|
-
*/
|
|
62
|
-
export declare const isGuideLineConfig: (config: unknown) => config is GuideConfig;
|
|
63
|
-
/**
|
|
64
|
-
* Validates column-based guide configurations.
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* ```ts
|
|
68
|
-
* isGuideColumnConfig({ columns: 12 }) // true
|
|
69
|
-
* isGuideColumnConfig({ variant: 'line' }) // false
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
export declare const isGuideColumnConfig: (config: unknown) => config is GuideConfig;
|
|
73
|
-
/**
|
|
74
|
-
* Validates auto-calculated guide configurations.
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* ```ts
|
|
78
|
-
* isAutoCalculatedGuide({ columnWidth: '200px' }) // true
|
|
79
|
-
* isAutoCalculatedGuide({ columns: 12 }) // false
|
|
80
|
-
* ```
|
|
81
|
-
*/
|
|
82
|
-
export declare const isAutoCalculatedGuide: (config: unknown) => config is GuideConfig;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { Gaps } from '@components';
|
|
3
|
-
import { Spacer } from '../Spacer';
|
|
4
|
-
import { ComponentsProps, Variant } from '../types';
|
|
5
|
-
type IndicatorNode = NonNullable<React.ComponentProps<typeof Spacer>['indicatorNode']>;
|
|
6
|
-
export type LayoutProps = {
|
|
7
|
-
/**
|
|
8
|
-
* Grid column definition. Supports:
|
|
9
|
-
* - Number: Equal columns (3 → repeat(3, 1fr))
|
|
10
|
-
* - String: Raw template ("1fr auto 200px")
|
|
11
|
-
* - Array: Mixed values ([100, '1fr'] → "100px 1fr")
|
|
12
|
-
*/
|
|
13
|
-
columns?: number | string | Array<number | string>;
|
|
14
|
-
/** Grid row definition (same format as columns) */
|
|
15
|
-
rows?: number | string | Array<number | string>;
|
|
16
|
-
/** Controls item alignment along column axis */
|
|
17
|
-
justifyItems?: React.CSSProperties['justifyItems'];
|
|
18
|
-
/** Controls item alignment along row axis */
|
|
19
|
-
alignItems?: React.CSSProperties['alignItems'];
|
|
20
|
-
/** Controls content distribution along row axis */
|
|
21
|
-
justifyContent?: React.CSSProperties['justifyContent'];
|
|
22
|
-
/** Controls content distribution along column axis */
|
|
23
|
-
alignContent?: React.CSSProperties['alignContent'];
|
|
24
|
-
/** Custom measurement indicator renderer */
|
|
25
|
-
indicatorNode?: IndicatorNode;
|
|
26
|
-
/** Visual style in debug mode */
|
|
27
|
-
variant?: Variant;
|
|
28
|
-
/** Flag to enable SSR-compatible mode (simplified initial render) */
|
|
29
|
-
ssrMode?: boolean;
|
|
30
|
-
/** Container width (defaults to "auto") */
|
|
31
|
-
width?: React.CSSProperties['width'];
|
|
32
|
-
/** Container height (defaults to "auto") */
|
|
33
|
-
height?: React.CSSProperties['height'];
|
|
34
|
-
children?: React.ReactNode;
|
|
35
|
-
} & ComponentsProps & Gaps;
|
|
36
|
-
/**
|
|
37
|
-
* A grid-based layout component with baseline alignment and responsive columns.
|
|
38
|
-
*
|
|
39
|
-
* @remarks
|
|
40
|
-
* Layout provides a CSS Grid container that:
|
|
41
|
-
* - Supports flexible column definitions
|
|
42
|
-
* - Maintains baseline grid alignment
|
|
43
|
-
* - Includes gap management
|
|
44
|
-
* - Offers comprehensive alignment controls
|
|
45
|
-
* - Provides debug overlays for visual verification
|
|
46
|
-
*
|
|
47
|
-
* When no explicit dimensions are provided, Layout defaults to "auto"
|
|
48
|
-
* for both width and height.
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* ```tsx
|
|
52
|
-
* // Basic equal columns
|
|
53
|
-
* <Layout columns={3} gap={16}>
|
|
54
|
-
* <div>Column 1</div>
|
|
55
|
-
* <div>Column 2</div>
|
|
56
|
-
* <div>Column 3</div>
|
|
57
|
-
* </Layout>
|
|
58
|
-
*
|
|
59
|
-
* // Mixed column widths with alignment
|
|
60
|
-
* <Layout
|
|
61
|
-
* columns={['200px', '1fr', '2fr']}
|
|
62
|
-
* gap={24}
|
|
63
|
-
* alignItems="center"
|
|
64
|
-
* justifyContent="space-between"
|
|
65
|
-
* >
|
|
66
|
-
* <div>Fixed</div>
|
|
67
|
-
* <div>Flexible</div>
|
|
68
|
-
* <div>Double width</div>
|
|
69
|
-
* </Layout>
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
export declare const Layout: React.NamedExoticComponent<LayoutProps>;
|
|
73
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Layout Component Entry (components/Layout/index.ts)
|
|
3
|
-
* @description Grid-based layout component with baseline alignment
|
|
4
|
-
* @module baseline-kit/components/Layout
|
|
5
|
-
*
|
|
6
|
-
* @remarks
|
|
7
|
-
* Provides CSS Grid functionality with built-in baseline grid
|
|
8
|
-
* alignment and debugging features.
|
|
9
|
-
*/
|
|
10
|
-
export * from './Layout';
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ComponentsProps } from '../types';
|
|
3
|
-
import { IndicatorNode } from '../Spacer';
|
|
4
|
-
import { DebuggingMode } from '@/components';
|
|
5
|
-
export type PadderProps = {
|
|
6
|
-
/** Render function for custom measurement indicators */
|
|
7
|
-
indicatorNode?: IndicatorNode;
|
|
8
|
-
/** Flag to enable SSR-compatible mode (simplified initial render) */
|
|
9
|
-
ssrMode?: boolean;
|
|
10
|
-
children?: React.ReactNode;
|
|
11
|
-
} & ComponentsProps;
|
|
12
|
-
/**
|
|
13
|
-
* A foundational component that manages consistent padding with visual debugging.
|
|
14
|
-
*
|
|
15
|
-
* @remarks
|
|
16
|
-
* Padder is a low-level utility that:
|
|
17
|
-
* - Applies consistent padding around content
|
|
18
|
-
* - Supports visual debugging of spacing
|
|
19
|
-
* - Maintains baseline grid alignment
|
|
20
|
-
* - Uses Spacer components for visual padding representation
|
|
21
|
-
*
|
|
22
|
-
* When debugging is enabled (`"visible"` or `"hidden"`), padding is represented
|
|
23
|
-
* using Spacer components. When debugging is `"none"`, direct CSS padding is
|
|
24
|
-
* applied for better performance.
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```tsx
|
|
28
|
-
* // Basic usage
|
|
29
|
-
* <Padder block={16} inline={8}>
|
|
30
|
-
* <div>Content with consistent padding</div>
|
|
31
|
-
* </Padder>
|
|
32
|
-
*
|
|
33
|
-
* // With debug visuals and custom indicators
|
|
34
|
-
* <Padder
|
|
35
|
-
* block={[8, 16]}
|
|
36
|
-
* inline={[16, 24]}
|
|
37
|
-
* debugging="visible"
|
|
38
|
-
* indicatorNode={(value, dim) => (
|
|
39
|
-
* <span className="text-sm">{dim}: {value}px</span>
|
|
40
|
-
* )}
|
|
41
|
-
* >
|
|
42
|
-
* <div>Content with visible padding guides</div>
|
|
43
|
-
* </Padder>
|
|
44
|
-
*
|
|
45
|
-
* // Direct padding mode
|
|
46
|
-
* <Padder
|
|
47
|
-
* block={16}
|
|
48
|
-
* inline={24}
|
|
49
|
-
* debugging="none"
|
|
50
|
-
* >
|
|
51
|
-
* <div>Content with direct CSS padding</div>
|
|
52
|
-
* </Padder>
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
export declare const Padder: React.NamedExoticComponent<{
|
|
56
|
-
/** Render function for custom measurement indicators */
|
|
57
|
-
indicatorNode?: IndicatorNode;
|
|
58
|
-
/** Flag to enable SSR-compatible mode (simplified initial render) */
|
|
59
|
-
ssrMode?: boolean;
|
|
60
|
-
children?: React.ReactNode;
|
|
61
|
-
} & {
|
|
62
|
-
debugging?: DebuggingMode;
|
|
63
|
-
className?: string;
|
|
64
|
-
style?: React.CSSProperties;
|
|
65
|
-
height?: React.CSSProperties["height"];
|
|
66
|
-
width?: React.CSSProperties["width"];
|
|
67
|
-
} & import("@/components").SpacingProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Padder Component Entry (components/Padder/index.ts)
|
|
3
|
-
* @description Low-level padding management with debugging support
|
|
4
|
-
* @module baseline-kit/components/Padder
|
|
5
|
-
*
|
|
6
|
-
* @remarks
|
|
7
|
-
* Core component for managing padding and spacing visualization
|
|
8
|
-
* in the baseline grid system.
|
|
9
|
-
*/
|
|
10
|
-
export * from './Padder';
|