@damarkuncoro/layout-engine 0.1.0 → 0.1.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/README.md +16 -2
- package/lib/cjs/core/index.js +19 -0
- package/lib/cjs/core/render.js +45 -0
- package/lib/cjs/core/responsiveSystem.js +45 -0
- package/lib/cjs/core/spacingSystem.js +21 -0
- package/lib/cjs/core/styleResolver.js +14 -0
- package/lib/cjs/index.d.ts +9 -0
- package/lib/cjs/index.js +28 -0
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/patterns/AuthLayout.d.ts +17 -0
- package/lib/cjs/patterns/AuthLayout.js +34 -0
- package/lib/cjs/patterns/DashboardLayout.js +14 -0
- package/lib/cjs/patterns/LandingLayout.d.ts +20 -0
- package/lib/cjs/patterns/LandingLayout.js +42 -0
- package/lib/cjs/patterns/index.d.ts +3 -0
- package/lib/cjs/patterns/index.js +19 -0
- package/lib/cjs/presets/index.d.ts +1 -0
- package/lib/cjs/presets/index.js +17 -0
- package/lib/cjs/presets/presets.d.ts +159 -0
- package/lib/cjs/presets/presets.js +229 -0
- package/lib/cjs/primitives/Box.js +26 -0
- package/lib/cjs/primitives/Center.d.ts +10 -0
- package/lib/cjs/primitives/Center.js +7 -0
- package/lib/cjs/primitives/Container.d.ts +17 -0
- package/lib/cjs/primitives/Container.js +27 -0
- package/lib/cjs/primitives/Flex.js +30 -0
- package/lib/cjs/primitives/Grid.d.ts +16 -0
- package/lib/cjs/primitives/Grid.js +37 -0
- package/lib/cjs/primitives/Spacer.d.ts +19 -0
- package/lib/cjs/primitives/Spacer.js +20 -0
- package/lib/cjs/primitives/Stack.js +24 -0
- package/lib/cjs/primitives/index.d.ts +7 -0
- package/lib/cjs/primitives/index.js +23 -0
- package/lib/cjs/structures/HeaderContentFooter.d.ts +13 -0
- package/lib/cjs/structures/HeaderContentFooter.js +10 -0
- package/lib/cjs/structures/HeaderLayout.d.ts +14 -0
- package/lib/cjs/structures/HeaderLayout.js +24 -0
- package/lib/cjs/structures/SidebarLayout.js +19 -0
- package/lib/cjs/structures/SplitLayout.d.ts +18 -0
- package/lib/cjs/structures/SplitLayout.js +30 -0
- package/lib/cjs/structures/index.d.ts +4 -0
- package/lib/cjs/structures/index.js +20 -0
- package/{dist → lib/cjs}/system/contracts.d.ts +20 -0
- package/lib/cjs/system/contracts.js +2 -0
- package/{dist → lib/cjs}/system/index.d.ts +1 -0
- package/lib/cjs/system/index.js +19 -0
- package/lib/cjs/system/theme.d.ts +134 -0
- package/lib/cjs/system/theme.js +195 -0
- package/lib/cjs/system/types.js +2 -0
- package/lib/cjs/tests/basic.test.js +72 -0
- package/lib/cjs/tests/structures.test.js +59 -0
- package/lib/esm/core/index.js +3 -0
- package/lib/esm/core/render.d.ts +5 -0
- package/lib/esm/core/responsiveSystem.d.ts +11 -0
- package/lib/esm/core/spacingSystem.d.ts +2 -0
- package/lib/esm/core/styleResolver.d.ts +5 -0
- package/lib/esm/index.d.ts +9 -0
- package/lib/esm/index.js +9 -0
- package/lib/esm/patterns/AuthLayout.d.ts +17 -0
- package/lib/esm/patterns/AuthLayout.js +31 -0
- package/lib/esm/patterns/DashboardLayout.d.ts +8 -0
- package/lib/esm/patterns/LandingLayout.d.ts +20 -0
- package/lib/esm/patterns/LandingLayout.js +39 -0
- package/lib/esm/patterns/index.d.ts +3 -0
- package/lib/esm/patterns/index.js +3 -0
- package/lib/esm/presets/index.d.ts +1 -0
- package/lib/esm/presets/index.js +1 -0
- package/lib/esm/presets/presets.d.ts +159 -0
- package/lib/esm/presets/presets.js +214 -0
- package/lib/esm/primitives/Box.d.ts +15 -0
- package/lib/esm/primitives/Center.d.ts +10 -0
- package/lib/esm/primitives/Center.js +4 -0
- package/lib/esm/primitives/Container.d.ts +17 -0
- package/lib/esm/primitives/Container.js +24 -0
- package/lib/esm/primitives/Flex.d.ts +20 -0
- package/lib/esm/primitives/Grid.d.ts +16 -0
- package/{dist → lib/esm}/primitives/Grid.js +10 -3
- package/lib/esm/primitives/Spacer.d.ts +19 -0
- package/lib/esm/primitives/Spacer.js +17 -0
- package/lib/esm/primitives/Stack.d.ts +13 -0
- package/lib/esm/primitives/index.d.ts +7 -0
- package/lib/esm/primitives/index.js +7 -0
- package/lib/esm/structures/HeaderContentFooter.d.ts +13 -0
- package/lib/esm/structures/HeaderContentFooter.js +7 -0
- package/lib/esm/structures/HeaderLayout.d.ts +14 -0
- package/lib/esm/structures/HeaderLayout.js +21 -0
- package/lib/esm/structures/SidebarLayout.d.ts +13 -0
- package/lib/esm/structures/SplitLayout.d.ts +18 -0
- package/lib/esm/structures/SplitLayout.js +27 -0
- package/lib/esm/structures/index.d.ts +4 -0
- package/lib/esm/structures/index.js +4 -0
- package/lib/esm/system/contracts.d.ts +37 -0
- package/lib/esm/system/index.d.ts +3 -0
- package/{dist → lib/esm}/system/index.js +1 -0
- package/lib/esm/system/theme.d.ts +134 -0
- package/lib/esm/system/theme.js +190 -0
- package/lib/esm/system/types.d.ts +38 -0
- package/lib/esm/tests/basic.test.d.ts +1 -0
- package/lib/esm/tests/structures.test.d.ts +1 -0
- package/package.json +21 -13
- package/dist/index.d.ts +0 -12
- package/dist/index.js +0 -12
- package/dist/primitives/Grid.d.ts +0 -15
- package/dist/primitives/index.d.ts +0 -4
- package/dist/primitives/index.js +0 -4
- /package/{dist → lib/cjs}/core/index.d.ts +0 -0
- /package/{dist → lib/cjs}/core/render.d.ts +0 -0
- /package/{dist → lib/cjs}/core/responsiveSystem.d.ts +0 -0
- /package/{dist → lib/cjs}/core/spacingSystem.d.ts +0 -0
- /package/{dist → lib/cjs}/core/styleResolver.d.ts +0 -0
- /package/{dist → lib/cjs}/patterns/DashboardLayout.d.ts +0 -0
- /package/{dist → lib/cjs}/primitives/Box.d.ts +0 -0
- /package/{dist → lib/cjs}/primitives/Flex.d.ts +0 -0
- /package/{dist → lib/cjs}/primitives/Stack.d.ts +0 -0
- /package/{dist → lib/cjs}/structures/SidebarLayout.d.ts +0 -0
- /package/{dist → lib/cjs}/system/types.d.ts +0 -0
- /package/{dist → lib/cjs}/tests/basic.test.d.ts +0 -0
- /package/{dist → lib/cjs}/tests/structures.test.d.ts +0 -0
- /package/{dist/core/index.js → lib/esm/core/index.d.ts} +0 -0
- /package/{dist → lib/esm}/core/render.js +0 -0
- /package/{dist → lib/esm}/core/responsiveSystem.js +0 -0
- /package/{dist → lib/esm}/core/spacingSystem.js +0 -0
- /package/{dist → lib/esm}/core/styleResolver.js +0 -0
- /package/{dist → lib/esm}/patterns/DashboardLayout.js +0 -0
- /package/{dist → lib/esm}/primitives/Box.js +0 -0
- /package/{dist → lib/esm}/primitives/Flex.js +0 -0
- /package/{dist → lib/esm}/primitives/Stack.js +0 -0
- /package/{dist → lib/esm}/structures/SidebarLayout.js +0 -0
- /package/{dist → lib/esm}/system/contracts.js +0 -0
- /package/{dist → lib/esm}/system/types.js +0 -0
- /package/{dist → lib/esm}/tests/basic.test.js +0 -0
- /package/{dist → lib/esm}/tests/structures.test.js +0 -0
|
@@ -15,3 +15,23 @@ export interface DashboardLayoutContract {
|
|
|
15
15
|
sidebar: NodeLike;
|
|
16
16
|
children: NodeLike;
|
|
17
17
|
}
|
|
18
|
+
export interface SplitLayoutContract {
|
|
19
|
+
left: NodeLike;
|
|
20
|
+
right: NodeLike;
|
|
21
|
+
leftWidth?: CSSLength | ResponsiveValue<CSSLength>;
|
|
22
|
+
splitRatio?: string;
|
|
23
|
+
viewportWidth?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface AuthLayoutContract {
|
|
26
|
+
children: NodeLike;
|
|
27
|
+
logo?: NodeLike;
|
|
28
|
+
subtitle?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface LandingLayoutContract {
|
|
31
|
+
header?: NodeLike;
|
|
32
|
+
hero?: NodeLike;
|
|
33
|
+
features?: NodeLike;
|
|
34
|
+
pricing?: NodeLike;
|
|
35
|
+
footer?: NodeLike;
|
|
36
|
+
children?: NodeLike;
|
|
37
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types.js"), exports);
|
|
18
|
+
__exportStar(require("./contracts.js"), exports);
|
|
19
|
+
__exportStar(require("./theme.js"), exports);
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme System untuk layout-engine
|
|
3
|
+
* Menyediakan tokens untuk colors, typography, spacing, dan dark mode
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Theme colors
|
|
7
|
+
*/
|
|
8
|
+
export interface ThemeColors {
|
|
9
|
+
primary: string;
|
|
10
|
+
primaryHover: string;
|
|
11
|
+
primaryFg: string;
|
|
12
|
+
secondary: string;
|
|
13
|
+
secondaryHover: string;
|
|
14
|
+
secondaryFg: string;
|
|
15
|
+
bg: string;
|
|
16
|
+
bgSubtle: string;
|
|
17
|
+
bgMuted: string;
|
|
18
|
+
fg: string;
|
|
19
|
+
fgMuted: string;
|
|
20
|
+
fgSubtle: string;
|
|
21
|
+
border: string;
|
|
22
|
+
borderFocus: string;
|
|
23
|
+
success: string;
|
|
24
|
+
warning: string;
|
|
25
|
+
error: string;
|
|
26
|
+
info: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Theme typography
|
|
30
|
+
*/
|
|
31
|
+
export interface ThemeTypography {
|
|
32
|
+
fontSans: string;
|
|
33
|
+
fontMono: string;
|
|
34
|
+
textXs: string;
|
|
35
|
+
textSm: string;
|
|
36
|
+
textBase: string;
|
|
37
|
+
textLg: string;
|
|
38
|
+
textXl: string;
|
|
39
|
+
text2xl: string;
|
|
40
|
+
text3xl: string;
|
|
41
|
+
text4xl: string;
|
|
42
|
+
fontNormal: number;
|
|
43
|
+
fontMedium: number;
|
|
44
|
+
fontSemibold: number;
|
|
45
|
+
fontBold: number;
|
|
46
|
+
leadingTight: number;
|
|
47
|
+
leadingNormal: number;
|
|
48
|
+
leadingRelaxed: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Theme border radii
|
|
52
|
+
*/
|
|
53
|
+
export interface ThemeRadii {
|
|
54
|
+
radiusNone: string;
|
|
55
|
+
radiusSm: string;
|
|
56
|
+
radiusBase: string;
|
|
57
|
+
radiusMd: string;
|
|
58
|
+
radiusLg: string;
|
|
59
|
+
radiusXl: string;
|
|
60
|
+
radiusFull: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Theme shadows
|
|
64
|
+
*/
|
|
65
|
+
export interface ThemeShadows {
|
|
66
|
+
shadowSm: string;
|
|
67
|
+
shadowBase: string;
|
|
68
|
+
shadowMd: string;
|
|
69
|
+
shadowLg: string;
|
|
70
|
+
shadowXl: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Theme spacing (spacing tokens)
|
|
74
|
+
*/
|
|
75
|
+
export interface ThemeSpacing {
|
|
76
|
+
space0: string;
|
|
77
|
+
space1: string;
|
|
78
|
+
space2: string;
|
|
79
|
+
space3: string;
|
|
80
|
+
space4: string;
|
|
81
|
+
space5: string;
|
|
82
|
+
space6: string;
|
|
83
|
+
space8: string;
|
|
84
|
+
space10: string;
|
|
85
|
+
space12: string;
|
|
86
|
+
space16: string;
|
|
87
|
+
space20: string;
|
|
88
|
+
space24: string;
|
|
89
|
+
space32: string;
|
|
90
|
+
space40: string;
|
|
91
|
+
space48: string;
|
|
92
|
+
space64: string;
|
|
93
|
+
space80: string;
|
|
94
|
+
space96: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Theme breakpoints
|
|
98
|
+
*/
|
|
99
|
+
export interface ThemeBreakpoints {
|
|
100
|
+
bpSm: number;
|
|
101
|
+
bpMd: number;
|
|
102
|
+
bpLg: number;
|
|
103
|
+
bpXl: number;
|
|
104
|
+
bp2xl: number;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Complete theme type
|
|
108
|
+
*/
|
|
109
|
+
export interface Theme extends ThemeColors, ThemeTypography, ThemeRadii, ThemeShadows, ThemeSpacing, ThemeBreakpoints {
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Light theme
|
|
113
|
+
*/
|
|
114
|
+
export declare const themeLight: Theme;
|
|
115
|
+
/**
|
|
116
|
+
* Dark theme
|
|
117
|
+
*/
|
|
118
|
+
export declare const themeDark: Theme;
|
|
119
|
+
/**
|
|
120
|
+
* Default theme (light)
|
|
121
|
+
*/
|
|
122
|
+
export declare const theme: Theme;
|
|
123
|
+
/**
|
|
124
|
+
* Color scheme type
|
|
125
|
+
*/
|
|
126
|
+
export type ColorScheme = "light" | "dark" | "system";
|
|
127
|
+
/**
|
|
128
|
+
* Detect system color scheme preference
|
|
129
|
+
*/
|
|
130
|
+
export declare function getSystemColorScheme(): "light" | "dark";
|
|
131
|
+
/**
|
|
132
|
+
* Get theme based on color scheme
|
|
133
|
+
*/
|
|
134
|
+
export declare function getTheme(colorScheme?: ColorScheme): Theme;
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Theme System untuk layout-engine
|
|
4
|
+
* Menyediakan tokens untuk colors, typography, spacing, dan dark mode
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.theme = exports.themeDark = exports.themeLight = void 0;
|
|
8
|
+
exports.getSystemColorScheme = getSystemColorScheme;
|
|
9
|
+
exports.getTheme = getTheme;
|
|
10
|
+
/**
|
|
11
|
+
* Light theme
|
|
12
|
+
*/
|
|
13
|
+
exports.themeLight = {
|
|
14
|
+
// Colors
|
|
15
|
+
primary: "#3b82f6",
|
|
16
|
+
primaryHover: "#2563eb",
|
|
17
|
+
primaryFg: "#ffffff",
|
|
18
|
+
secondary: "#64748b",
|
|
19
|
+
secondaryHover: "#475569",
|
|
20
|
+
secondaryFg: "#ffffff",
|
|
21
|
+
bg: "#ffffff",
|
|
22
|
+
bgSubtle: "#f8fafc",
|
|
23
|
+
bgMuted: "#f1f5f9",
|
|
24
|
+
fg: "#0f172a",
|
|
25
|
+
fgMuted: "#475569",
|
|
26
|
+
fgSubtle: "#94a3b8",
|
|
27
|
+
border: "#e2e8f0",
|
|
28
|
+
borderFocus: "#3b82f6",
|
|
29
|
+
success: "#22c55e",
|
|
30
|
+
warning: "#f59e0b",
|
|
31
|
+
error: "#ef4444",
|
|
32
|
+
info: "#3b82f6",
|
|
33
|
+
// Typography
|
|
34
|
+
fontSans: "system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
|
|
35
|
+
fontMono: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",
|
|
36
|
+
textXs: "0.75rem",
|
|
37
|
+
textSm: "0.875rem",
|
|
38
|
+
textBase: "1rem",
|
|
39
|
+
textLg: "1.125rem",
|
|
40
|
+
textXl: "1.25rem",
|
|
41
|
+
text2xl: "1.5rem",
|
|
42
|
+
text3xl: "1.875rem",
|
|
43
|
+
text4xl: "2.25rem",
|
|
44
|
+
fontNormal: 400,
|
|
45
|
+
fontMedium: 500,
|
|
46
|
+
fontSemibold: 600,
|
|
47
|
+
fontBold: 700,
|
|
48
|
+
leadingTight: 1.25,
|
|
49
|
+
leadingNormal: 1.5,
|
|
50
|
+
leadingRelaxed: 1.625,
|
|
51
|
+
// Radii
|
|
52
|
+
radiusNone: "0",
|
|
53
|
+
radiusSm: "0.125rem",
|
|
54
|
+
radiusBase: "0.25rem",
|
|
55
|
+
radiusMd: "0.375rem",
|
|
56
|
+
radiusLg: "0.5rem",
|
|
57
|
+
radiusXl: "0.75rem",
|
|
58
|
+
radiusFull: "9999px",
|
|
59
|
+
// Shadows
|
|
60
|
+
shadowSm: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
61
|
+
shadowBase: "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
|
|
62
|
+
shadowMd: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
|
|
63
|
+
shadowLg: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",
|
|
64
|
+
shadowXl: "0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)",
|
|
65
|
+
// Spacing
|
|
66
|
+
space0: "0",
|
|
67
|
+
space1: "0.25rem",
|
|
68
|
+
space2: "0.5rem",
|
|
69
|
+
space3: "0.75rem",
|
|
70
|
+
space4: "1rem",
|
|
71
|
+
space5: "1.25rem",
|
|
72
|
+
space6: "1.5rem",
|
|
73
|
+
space8: "2rem",
|
|
74
|
+
space10: "2.5rem",
|
|
75
|
+
space12: "3rem",
|
|
76
|
+
space16: "4rem",
|
|
77
|
+
space20: "5rem",
|
|
78
|
+
space24: "6rem",
|
|
79
|
+
space32: "8rem",
|
|
80
|
+
space40: "10rem",
|
|
81
|
+
space48: "12rem",
|
|
82
|
+
space64: "16rem",
|
|
83
|
+
space80: "20rem",
|
|
84
|
+
space96: "24rem",
|
|
85
|
+
// Breakpoints
|
|
86
|
+
bpSm: 640,
|
|
87
|
+
bpMd: 768,
|
|
88
|
+
bpLg: 1024,
|
|
89
|
+
bpXl: 1280,
|
|
90
|
+
bp2xl: 1536,
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Dark theme
|
|
94
|
+
*/
|
|
95
|
+
exports.themeDark = {
|
|
96
|
+
// Colors
|
|
97
|
+
primary: "#3b82f6",
|
|
98
|
+
primaryHover: "#60a5fa",
|
|
99
|
+
primaryFg: "#ffffff",
|
|
100
|
+
secondary: "#64748b",
|
|
101
|
+
secondaryHover: "#94a3b8",
|
|
102
|
+
secondaryFg: "#ffffff",
|
|
103
|
+
bg: "#0f172a",
|
|
104
|
+
bgSubtle: "#1e293b",
|
|
105
|
+
bgMuted: "#334155",
|
|
106
|
+
fg: "#f8fafc",
|
|
107
|
+
fgMuted: "#cbd5e1",
|
|
108
|
+
fgSubtle: "#64748b",
|
|
109
|
+
border: "#334155",
|
|
110
|
+
borderFocus: "#3b82f6",
|
|
111
|
+
success: "#22c55e",
|
|
112
|
+
warning: "#f59e0b",
|
|
113
|
+
error: "#ef4444",
|
|
114
|
+
info: "#3b82f6",
|
|
115
|
+
// Typography
|
|
116
|
+
fontSans: "system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
|
|
117
|
+
fontMono: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",
|
|
118
|
+
textXs: "0.75rem",
|
|
119
|
+
textSm: "0.875rem",
|
|
120
|
+
textBase: "1rem",
|
|
121
|
+
textLg: "1.125rem",
|
|
122
|
+
textXl: "1.25rem",
|
|
123
|
+
text2xl: "1.5rem",
|
|
124
|
+
text3xl: "1.875rem",
|
|
125
|
+
text4xl: "2.25rem",
|
|
126
|
+
fontNormal: 400,
|
|
127
|
+
fontMedium: 500,
|
|
128
|
+
fontSemibold: 600,
|
|
129
|
+
fontBold: 700,
|
|
130
|
+
leadingTight: 1.25,
|
|
131
|
+
leadingNormal: 1.5,
|
|
132
|
+
leadingRelaxed: 1.625,
|
|
133
|
+
// Radii
|
|
134
|
+
radiusNone: "0",
|
|
135
|
+
radiusSm: "0.125rem",
|
|
136
|
+
radiusBase: "0.25rem",
|
|
137
|
+
radiusMd: "0.375rem",
|
|
138
|
+
radiusLg: "0.5rem",
|
|
139
|
+
radiusXl: "0.75rem",
|
|
140
|
+
radiusFull: "9999px",
|
|
141
|
+
// Shadows - lebih terang untuk dark mode
|
|
142
|
+
shadowSm: "0 1px 2px 0 rgb(0 0 0 / 0.3)",
|
|
143
|
+
shadowBase: "0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.4)",
|
|
144
|
+
shadowMd: "0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4)",
|
|
145
|
+
shadowLg: "0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4)",
|
|
146
|
+
shadowXl: "0 20px 25px -5px rgb(0 0 0 / 0.4), 0 8px 10px -6px rgb(0 0 0 / 0.4)",
|
|
147
|
+
// Spacing
|
|
148
|
+
space0: "0",
|
|
149
|
+
space1: "0.25rem",
|
|
150
|
+
space2: "0.5rem",
|
|
151
|
+
space3: "0.75rem",
|
|
152
|
+
space4: "1rem",
|
|
153
|
+
space5: "1.25rem",
|
|
154
|
+
space6: "1.5rem",
|
|
155
|
+
space8: "2rem",
|
|
156
|
+
space10: "2.5rem",
|
|
157
|
+
space12: "3rem",
|
|
158
|
+
space16: "4rem",
|
|
159
|
+
space20: "5rem",
|
|
160
|
+
space24: "6rem",
|
|
161
|
+
space32: "8rem",
|
|
162
|
+
space40: "10rem",
|
|
163
|
+
space48: "12rem",
|
|
164
|
+
space64: "16rem",
|
|
165
|
+
space80: "20rem",
|
|
166
|
+
space96: "24rem",
|
|
167
|
+
// Breakpoints
|
|
168
|
+
bpSm: 640,
|
|
169
|
+
bpMd: 768,
|
|
170
|
+
bpLg: 1024,
|
|
171
|
+
bpXl: 1280,
|
|
172
|
+
bp2xl: 1536,
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Default theme (light)
|
|
176
|
+
*/
|
|
177
|
+
exports.theme = exports.themeLight;
|
|
178
|
+
/**
|
|
179
|
+
* Detect system color scheme preference
|
|
180
|
+
*/
|
|
181
|
+
function getSystemColorScheme() {
|
|
182
|
+
var _a;
|
|
183
|
+
if (typeof window === "undefined")
|
|
184
|
+
return "light";
|
|
185
|
+
return ((_a = window.matchMedia) === null || _a === void 0 ? void 0 : _a.call(window, "(prefers-color-scheme: dark)").matches) ? "dark" : "light";
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Get theme based on color scheme
|
|
189
|
+
*/
|
|
190
|
+
function getTheme(colorScheme = "system") {
|
|
191
|
+
if (colorScheme === "system") {
|
|
192
|
+
return getSystemColorScheme() === "dark" ? exports.themeDark : exports.themeLight;
|
|
193
|
+
}
|
|
194
|
+
return colorScheme === "dark" ? exports.themeDark : exports.themeLight;
|
|
195
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const assert = (cond, msg) => {
|
|
37
|
+
if (!cond) {
|
|
38
|
+
throw new Error(`Test failed: ${msg}`);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const run = async () => {
|
|
42
|
+
const api = await Promise.resolve(`${new URL("../index.js", import.meta.url).href}`).then(s => __importStar(require(s)));
|
|
43
|
+
const { normalizeUnit, space, resolveResponsive, Flex, Box, renderToString } = api;
|
|
44
|
+
// normalizeUnit
|
|
45
|
+
assert(normalizeUnit(16) === "16px", "normalizeUnit number to px");
|
|
46
|
+
assert(normalizeUnit("2rem") === "2rem", "normalizeUnit keeps string");
|
|
47
|
+
// spacing tokens
|
|
48
|
+
assert(space(2) === "8px", "spacing index 2 is 8px");
|
|
49
|
+
// responsive resolver (object form)
|
|
50
|
+
assert(resolveResponsive({ base: 8, md: 16, xl: 24 }, 800) === 16, "resolveResponsive picks md at width 800");
|
|
51
|
+
assert(resolveResponsive({ base: 8, md: 16, xl: 24 }, 1300) === 24, "resolveResponsive picks xl at width 1300");
|
|
52
|
+
// primitives mapping + render
|
|
53
|
+
const node = Flex({
|
|
54
|
+
direction: "row",
|
|
55
|
+
gap: 16,
|
|
56
|
+
children: [
|
|
57
|
+
Box({ width: 240, children: "Sidebar" }),
|
|
58
|
+
Box({ style: { flex: 1 }, children: "Content" })
|
|
59
|
+
]
|
|
60
|
+
});
|
|
61
|
+
const html = renderToString(node);
|
|
62
|
+
assert(html.includes("display:flex"), "Flex renders display flex");
|
|
63
|
+
assert(html.includes("flex-direction:row"), "Flex renders direction");
|
|
64
|
+
assert(html.includes("gap:16px"), "Flex renders gap 16px");
|
|
65
|
+
assert(html.includes("width:240px"), "Box width 240px");
|
|
66
|
+
assert(html.includes("flex:1"), "Box flex:1 in style");
|
|
67
|
+
console.log("All tests passed");
|
|
68
|
+
};
|
|
69
|
+
run().catch((e) => {
|
|
70
|
+
console.error(e);
|
|
71
|
+
process.exit(1);
|
|
72
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const assert = (cond, msg) => {
|
|
37
|
+
if (!cond) {
|
|
38
|
+
throw new Error(`Test failed: ${msg}`);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const run = async () => {
|
|
42
|
+
const api = await Promise.resolve(`${new URL("../index.js", import.meta.url).href}`).then(s => __importStar(require(s)));
|
|
43
|
+
const { SidebarLayout, DashboardLayout, renderToString, Box } = api;
|
|
44
|
+
const sidebar = Box({ children: "SIDE" });
|
|
45
|
+
const content = Box({ children: "MAIN" });
|
|
46
|
+
const header = Box({ children: "HEAD" });
|
|
47
|
+
const node1 = SidebarLayout({ sidebar, children: content, sidebarWidth: 200 });
|
|
48
|
+
const html1 = renderToString(node1);
|
|
49
|
+
assert(html1.includes("width:200px"), "Sidebar width applied");
|
|
50
|
+
assert(html1.indexOf("SIDE") < html1.indexOf("MAIN"), "Sidebar before content");
|
|
51
|
+
const node2 = DashboardLayout({ header, sidebar, children: content });
|
|
52
|
+
const html2 = renderToString(node2);
|
|
53
|
+
assert(html2.indexOf("HEAD") < html2.indexOf("SIDE"), "Header before sidebar/content");
|
|
54
|
+
console.log("Structures tests passed");
|
|
55
|
+
};
|
|
56
|
+
run().catch((e) => {
|
|
57
|
+
console.error(e);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type BreakpointKey = "sm" | "md" | "lg" | "xl" | "2xl";
|
|
2
|
+
export declare const breakpoints: Record<BreakpointKey, number>;
|
|
3
|
+
export type ResponsiveValue<T> = T | {
|
|
4
|
+
base?: T;
|
|
5
|
+
sm?: T;
|
|
6
|
+
md?: T;
|
|
7
|
+
lg?: T;
|
|
8
|
+
xl?: T;
|
|
9
|
+
"2xl"?: T;
|
|
10
|
+
} | T[];
|
|
11
|
+
export declare const resolveResponsive: <T>(value: ResponsiveValue<T> | undefined, width: number) => T | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./system/index.js";
|
|
2
|
+
export * from "./primitives/index.js";
|
|
3
|
+
export * from "./structures/index.js";
|
|
4
|
+
export * from "./patterns/index.js";
|
|
5
|
+
export * from "./presets/index.js";
|
|
6
|
+
export { resolveResponsive, breakpoints, type BreakpointKey } from "./core/responsiveSystem.js";
|
|
7
|
+
export * from "./core/spacingSystem.js";
|
|
8
|
+
export * from "./core/styleResolver.js";
|
|
9
|
+
export * from "./core/render.js";
|
package/lib/esm/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./system/index.js";
|
|
2
|
+
export * from "./primitives/index.js";
|
|
3
|
+
export * from "./structures/index.js";
|
|
4
|
+
export * from "./patterns/index.js";
|
|
5
|
+
export * from "./presets/index.js";
|
|
6
|
+
export { resolveResponsive, breakpoints } from "./core/responsiveSystem.js";
|
|
7
|
+
export * from "./core/spacingSystem.js";
|
|
8
|
+
export * from "./core/styleResolver.js";
|
|
9
|
+
export * from "./core/render.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { NodeLike } from "../system/contracts.js";
|
|
2
|
+
export interface AuthLayoutProps {
|
|
3
|
+
children: NodeLike;
|
|
4
|
+
logo?: NodeLike;
|
|
5
|
+
subtitle?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* AuthLayout - layout untuk halaman login/register
|
|
9
|
+
* Konsisten centered dengan form di tengah layar
|
|
10
|
+
*/
|
|
11
|
+
export declare function AuthLayout({ children, logo, subtitle }: AuthLayoutProps): {
|
|
12
|
+
type: string;
|
|
13
|
+
props: {
|
|
14
|
+
children: any;
|
|
15
|
+
style: Record<string, any>;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Flex } from "../primitives/Flex.js";
|
|
2
|
+
import { Box } from "../primitives/Box.js";
|
|
3
|
+
/**
|
|
4
|
+
* AuthLayout - layout untuk halaman login/register
|
|
5
|
+
* Konsisten centered dengan form di tengah layar
|
|
6
|
+
*/
|
|
7
|
+
export function AuthLayout({ children, logo, subtitle }) {
|
|
8
|
+
return Flex({
|
|
9
|
+
style: {
|
|
10
|
+
minHeight: "100vh",
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
justifyContent: "center"
|
|
13
|
+
},
|
|
14
|
+
children: Box({
|
|
15
|
+
style: {
|
|
16
|
+
width: "100%",
|
|
17
|
+
maxWidth: "400px",
|
|
18
|
+
padding: "24px"
|
|
19
|
+
},
|
|
20
|
+
children: Flex({
|
|
21
|
+
direction: "column",
|
|
22
|
+
gap: 4,
|
|
23
|
+
children: [
|
|
24
|
+
logo ? Box({ children: logo }) : null,
|
|
25
|
+
subtitle ? Box({ children: subtitle }) : null,
|
|
26
|
+
children
|
|
27
|
+
].filter(Boolean)
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { NodeLike } from "../system/contracts.js";
|
|
2
|
+
export interface LandingLayoutProps {
|
|
3
|
+
header?: NodeLike;
|
|
4
|
+
hero?: NodeLike;
|
|
5
|
+
features?: NodeLike;
|
|
6
|
+
pricing?: NodeLike;
|
|
7
|
+
footer?: NodeLike;
|
|
8
|
+
children?: NodeLike;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* LandingLayout - layout untuk halaman landing page
|
|
12
|
+
* Dengan section hero, features, pricing, dan footer
|
|
13
|
+
*/
|
|
14
|
+
export declare function LandingLayout({ header, hero, features, pricing, footer, children }: LandingLayoutProps): {
|
|
15
|
+
type: string;
|
|
16
|
+
props: {
|
|
17
|
+
children: any;
|
|
18
|
+
style: Record<string, any>;
|
|
19
|
+
};
|
|
20
|
+
};
|