baseline-kit 3.0.2 → 5.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.
Files changed (79) hide show
  1. package/CHANGELOG.md +235 -0
  2. package/README.md +226 -334
  3. package/dist/baseline-kit.css +7 -22
  4. package/dist/core.cjs +1 -0
  5. package/dist/core.d.ts +354 -0
  6. package/dist/core.mjs +2 -0
  7. package/dist/guide.cjs +2 -0
  8. package/dist/guide.cjs.map +1 -0
  9. package/dist/guide.css +2 -0
  10. package/dist/guide.d.ts +146 -0
  11. package/dist/guide.mjs +586 -0
  12. package/dist/guide.mjs.map +1 -0
  13. package/dist/index.cjs +2 -2
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.ts +204 -30
  16. package/dist/index.mjs +620 -1747
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/remix-server.d.ts +8 -0
  19. package/dist/remix-server.mjs +15 -0
  20. package/dist/remix-server.mjs.map +1 -0
  21. package/dist/remix.css +2 -0
  22. package/dist/remix.d.ts +177 -0
  23. package/dist/remix.mjs +989 -0
  24. package/dist/remix.mjs.map +1 -0
  25. package/dist/reset.css +43 -0
  26. package/dist/src-C-1u5WNS.cjs +2 -0
  27. package/dist/src-C-1u5WNS.cjs.map +1 -0
  28. package/dist/src-C3TICsw6.js +547 -0
  29. package/dist/src-C3TICsw6.js.map +1 -0
  30. package/dist/styles.css +1 -1
  31. package/dist/theme/dark.css +0 -8
  32. package/dist/theme/default.css +0 -10
  33. package/dist/theme/tokens.css +1 -11
  34. package/dist/theme.css +4 -19
  35. package/package.json +135 -46
  36. package/dist/README.md +0 -446
  37. package/dist/components/Baseline/Baseline.d.ts +0 -48
  38. package/dist/components/Baseline/index.d.ts +0 -6
  39. package/dist/components/Box/Box.d.ts +0 -73
  40. package/dist/components/Box/index.d.ts +0 -6
  41. package/dist/components/Config/Config.d.ts +0 -179
  42. package/dist/components/Config/defaults.d.ts +0 -25
  43. package/dist/components/Config/index.d.ts +0 -11
  44. package/dist/components/Guide/Guide.d.ts +0 -70
  45. package/dist/components/Guide/index.d.ts +0 -6
  46. package/dist/components/Guide/types.d.ts +0 -144
  47. package/dist/components/Guide/validation.d.ts +0 -82
  48. package/dist/components/Layout/Layout.d.ts +0 -73
  49. package/dist/components/Layout/index.d.ts +0 -10
  50. package/dist/components/Padder/Padder.d.ts +0 -67
  51. package/dist/components/Padder/index.d.ts +0 -10
  52. package/dist/components/Spacer/Spacer.d.ts +0 -48
  53. package/dist/components/Spacer/index.d.ts +0 -10
  54. package/dist/components/Stack/Stack.d.ts +0 -84
  55. package/dist/components/Stack/index.d.ts +0 -10
  56. package/dist/components/index.d.ts +0 -16
  57. package/dist/components/styles/index.d.ts +0 -11
  58. package/dist/components/types.d.ts +0 -102
  59. package/dist/hooks/index.d.ts +0 -11
  60. package/dist/hooks/useBaseline.d.ts +0 -55
  61. package/dist/hooks/useConfig.d.ts +0 -41
  62. package/dist/hooks/useDebug.d.ts +0 -49
  63. package/dist/hooks/useGuide.d.ts +0 -61
  64. package/dist/hooks/useIsClient.d.ts +0 -6
  65. package/dist/hooks/useMeasure.d.ts +0 -35
  66. package/dist/hooks/useVirtual.d.ts +0 -60
  67. package/dist/styles.d.ts +0 -6
  68. package/dist/theme.d.ts +0 -6
  69. package/dist/utils/convert.d.ts +0 -24
  70. package/dist/utils/grid.d.ts +0 -22
  71. package/dist/utils/index.d.ts +0 -15
  72. package/dist/utils/math.d.ts +0 -48
  73. package/dist/utils/merge.d.ts +0 -117
  74. package/dist/utils/normalize.d.ts +0 -30
  75. package/dist/utils/padding.d.ts +0 -11
  76. package/dist/utils/parse.d.ts +0 -18
  77. package/dist/utils/snapping.d.ts +0 -28
  78. package/dist/utils/ssr.d.ts +0 -26
  79. package/dist/utils/timing.d.ts +0 -45
package/dist/index.d.ts CHANGED
@@ -1,32 +1,206 @@
1
+ import * as React from 'react';
2
+
1
3
  /**
2
- * Baseline Kit
3
- * Lightweight development tool for visualizing and debugging grid systems and spacing in React
4
- * applications. It provides configurable overlays for both column-based and baseline grids, flexible spacing components,
5
- * and theme-aware configuration—all optimized for performance and built with TypeScript.
6
- *
7
- * Export Strategy:
8
- * - Only components and types required by consumers are exported
9
- * - Components are directly imported from their respective directories rather than through the components/index.ts barrel
10
- * - SSR utilities (isSSR, safeClientValue) are exported for advanced consumer use cases
11
- * - Internal utilities, helper functions, and implementation details are kept private
12
- *
13
- * @module baseline-kit
4
+ * @baseline-kit/core - Pure type definitions
5
+ * Framework-agnostic types for the baseline-kit system
14
6
  */
15
- export { Config } from './components/Config';
16
- export { Baseline } from './components/Baseline';
17
- export { Guide } from './components/Guide';
18
- export { Box } from './components/Box';
19
- export { Stack } from './components/Stack';
20
- export { Layout } from './components/Layout';
21
- export { Spacer } from './components/Spacer';
22
- export { Padder } from './components/Padder';
23
- export type { DebuggingMode, ConfigSchema } from './components/Config/Config';
24
- export type { GuideVariant, Spacing, SpacingProps } from './components/types';
25
- export type { BaselineProps } from './components/Baseline';
26
- export type { BoxProps } from './components/Box';
27
- export type { GuideProps } from './components/Guide';
28
- export type { LayoutProps } from './components/Layout';
29
- export type { StackProps } from './components/Stack';
30
- export type { IndicatorNode, SpacerProps } from './components/Spacer';
31
- export type { PadderProps } from './components/Padder';
32
- export { isSSR, safeClientValue } from './utils/ssr';
7
+ type Spacing = number | [number, number] | {
8
+ start?: number;
9
+ end?: number;
10
+ };
11
+ type PaddingValue = number | [number, number] | [number, number, number] | [number, number, number, number] | {
12
+ top?: number;
13
+ bottom?: number;
14
+ left?: number;
15
+ right?: number;
16
+ };
17
+ type SpacingProps = {
18
+ padding?: PaddingValue;
19
+ block?: Spacing;
20
+ inline?: Spacing;
21
+ };
22
+ type GuideVariant = 'line' | 'pattern' | 'fixed' | 'auto';
23
+ type GuideColumnValue = string | number | undefined | 'auto';
24
+ type GuideColumnsPattern = readonly GuideColumnValue[];
25
+ type Variant = 'line' | 'flat' | 'pattern';
26
+ type BaselineVariant = Exclude<Variant, 'pattern'>;
27
+ type SnappingMode = 'none' | 'height' | 'clamp';
28
+ type DebuggingMode = 'none' | 'hidden' | 'visible';
29
+ type BaseGuideConfig = {
30
+ gap?: number | string;
31
+ base?: number;
32
+ };
33
+ type PatternConfig = BaseGuideConfig & {
34
+ variant: 'pattern';
35
+ columns: GuideColumnsPattern;
36
+ columnWidth?: never;
37
+ };
38
+ type FixedConfig = BaseGuideConfig & {
39
+ variant: 'fixed';
40
+ columns: number;
41
+ columnWidth?: number | string;
42
+ };
43
+ type AutoConfig = BaseGuideConfig & {
44
+ variant: 'auto';
45
+ columnWidth: number | string;
46
+ columns?: never;
47
+ };
48
+ type LineConfig = BaseGuideConfig & {
49
+ variant?: 'line';
50
+ columns?: never;
51
+ columnWidth?: never;
52
+ };
53
+ type GuideConfig = PatternConfig | AutoConfig | FixedConfig | LineConfig;
54
+
55
+ type DebugColors = {
56
+ line: string;
57
+ flat: string;
58
+ text: string;
59
+ };
60
+ type ConfigSchema = {
61
+ base: number;
62
+ baseline: {
63
+ variant: BaselineVariant;
64
+ debugging: DebuggingMode;
65
+ colors: Record<BaselineVariant, string>;
66
+ };
67
+ guide: {
68
+ variant: GuideVariant;
69
+ debugging: DebuggingMode;
70
+ colors: Record<GuideVariant, string>;
71
+ };
72
+ spacer: {
73
+ variant: Variant;
74
+ debugging: DebuggingMode;
75
+ colors: DebugColors;
76
+ };
77
+ box: {
78
+ debugging: DebuggingMode;
79
+ colors: DebugColors;
80
+ };
81
+ padder: {
82
+ debugging: DebuggingMode;
83
+ color: string;
84
+ };
85
+ };
86
+
87
+ type PartialColors<T> = T extends {
88
+ colors: infer Colors;
89
+ } ? Omit<Partial<T>, 'colors'> & {
90
+ colors?: Partial<Colors>;
91
+ } : Partial<T>;
92
+ type ConfigOverrides = {
93
+ base?: number;
94
+ baseline?: PartialColors<ConfigSchema['baseline']>;
95
+ guide?: PartialColors<ConfigSchema['guide']>;
96
+ spacer?: PartialColors<ConfigSchema['spacer']>;
97
+ box?: PartialColors<ConfigSchema['box']>;
98
+ padder?: Partial<ConfigSchema['padder']>;
99
+ };
100
+
101
+ type ConfigProps = ConfigOverrides & {
102
+ children: React.ReactNode;
103
+ };
104
+ /**
105
+ * Configuration provider for baseline-kit components.
106
+ */
107
+ declare function Config({ children, base, baseline, guide, spacer, box, padder, }: ConfigProps): React.JSX.Element;
108
+
109
+ /**
110
+ * Common props shared across library components.
111
+ */
112
+ type ComponentsProps = {
113
+ debugging?: DebuggingMode;
114
+ className?: string;
115
+ style?: React.CSSProperties;
116
+ height?: React.CSSProperties['height'];
117
+ width?: React.CSSProperties['width'];
118
+ } & SpacingProps;
119
+
120
+ type BaselineProps = {
121
+ variant?: BaselineVariant;
122
+ width?: number | string;
123
+ height?: number | string;
124
+ base?: number;
125
+ color?: string;
126
+ ssrMode?: boolean;
127
+ } & ComponentsProps;
128
+ declare const Baseline: React.MemoExoticComponent<({ className, debugging, style, variant: variantProp, height: heightProp, width: widthProp, base: baseProp, color: colorProp, ssrMode, ...spacingProps }: BaselineProps) => React.JSX.Element>;
129
+
130
+ type GuideProps = {
131
+ align?: React.CSSProperties['justifyContent'];
132
+ variant?: GuideVariant;
133
+ columns?: number | readonly (string | number | undefined | 'auto')[];
134
+ columnWidth?: React.CSSProperties['width'];
135
+ maxWidth?: React.CSSProperties['maxWidth'];
136
+ color?: React.CSSProperties['color'];
137
+ children?: React.ReactNode;
138
+ gap?: number;
139
+ ssrMode?: boolean;
140
+ } & ComponentsProps & Omit<GuideConfig, 'columns' | 'columnWidth' | 'gap'>;
141
+ declare const Guide: React.MemoExoticComponent<({ className, debugging, style, variant: variantProp, align, gap: gapProp, height, width, columns, columnWidth, maxWidth, color, children, ssrMode, ...props }: GuideProps) => React.JSX.Element>;
142
+
143
+ type BoxProps = {
144
+ colSpan?: number;
145
+ rowSpan?: number;
146
+ span?: number;
147
+ snapping?: SnappingMode;
148
+ ssrMode?: boolean;
149
+ children?: React.ReactNode;
150
+ } & ComponentsProps;
151
+ declare const Box: React.NamedExoticComponent<{
152
+ colSpan?: number;
153
+ rowSpan?: number;
154
+ span?: number;
155
+ snapping?: SnappingMode;
156
+ ssrMode?: boolean;
157
+ children?: React.ReactNode;
158
+ } & {
159
+ debugging?: DebuggingMode;
160
+ className?: string;
161
+ style?: React.CSSProperties;
162
+ height?: React.CSSProperties["height"];
163
+ width?: React.CSSProperties["width"];
164
+ } & SpacingProps & React.RefAttributes<HTMLDivElement>>;
165
+
166
+ type IndicatorNode = (value: number, type: 'width' | 'height') => React.ReactNode;
167
+ type SpacerProps = {
168
+ width?: React.CSSProperties['width'];
169
+ height?: React.CSSProperties['height'];
170
+ variant?: Variant;
171
+ color?: string;
172
+ base?: number;
173
+ children?: React.ReactNode;
174
+ indicatorNode?: IndicatorNode;
175
+ ssrMode?: boolean;
176
+ } & ComponentsProps;
177
+ declare const Spacer: React.MemoExoticComponent<({ height: heightProp, width: widthProp, indicatorNode, debugging: debuggingProp, variant: variantProp, base: baseProp, color: colorProp, className, style, children, ssrMode, ...props }: SpacerProps) => React.JSX.Element>;
178
+
179
+ type PadderProps = {
180
+ indicatorNode?: IndicatorNode;
181
+ ssrMode?: boolean;
182
+ children?: React.ReactNode;
183
+ } & ComponentsProps;
184
+ declare const Padder: React.NamedExoticComponent<{
185
+ indicatorNode?: IndicatorNode;
186
+ ssrMode?: boolean;
187
+ children?: React.ReactNode;
188
+ } & {
189
+ debugging?: DebuggingMode;
190
+ className?: string;
191
+ style?: React.CSSProperties;
192
+ height?: React.CSSProperties["height"];
193
+ width?: React.CSSProperties["width"];
194
+ } & SpacingProps & React.RefAttributes<HTMLDivElement>>;
195
+
196
+ /**
197
+ * Detects if code is running in a server-side environment
198
+ */
199
+ declare const isSSR: boolean;
200
+ /**
201
+ * Safe window-using function that works in both server and client
202
+ */
203
+ declare function safeClientValue<T>(clientFn: () => T, fallback: T): T;
204
+
205
+ export { Baseline, Box, Config, Guide, Padder, Spacer, isSSR, safeClientValue };
206
+ export type { BaselineProps, BaselineVariant, BoxProps, ConfigSchema, DebuggingMode, GuideProps, GuideVariant, IndicatorNode, PadderProps, PaddingValue, SnappingMode, SpacerProps, Spacing, SpacingProps, Variant };