@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
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Flex } from "../primitives/Flex.js";
|
|
2
|
+
import { Box } from "../primitives/Box.js";
|
|
3
|
+
import { Container } from "../primitives/Container.js";
|
|
4
|
+
/**
|
|
5
|
+
* LandingLayout - layout untuk halaman landing page
|
|
6
|
+
* Dengan section hero, features, pricing, dan footer
|
|
7
|
+
*/
|
|
8
|
+
export function LandingLayout({ header, hero, features, pricing, footer, children }) {
|
|
9
|
+
return Flex({
|
|
10
|
+
direction: "column",
|
|
11
|
+
children: [
|
|
12
|
+
// Sticky header
|
|
13
|
+
header ? Box({
|
|
14
|
+
style: { position: "sticky", top: 0, zIndex: 10 },
|
|
15
|
+
children: Container({
|
|
16
|
+
children: header
|
|
17
|
+
})
|
|
18
|
+
}) : null,
|
|
19
|
+
// Main content
|
|
20
|
+
Box({
|
|
21
|
+
children: children !== null && children !== void 0 ? children : Flex({
|
|
22
|
+
direction: "column",
|
|
23
|
+
children: [
|
|
24
|
+
hero ? Box({ children: hero }) : null,
|
|
25
|
+
features ? Box({ children: features }) : null,
|
|
26
|
+
pricing ? Box({ children: pricing }) : null
|
|
27
|
+
].filter(Boolean)
|
|
28
|
+
})
|
|
29
|
+
}),
|
|
30
|
+
// Footer
|
|
31
|
+
footer ? Box({
|
|
32
|
+
children: Container({
|
|
33
|
+
padding: 6,
|
|
34
|
+
children: footer
|
|
35
|
+
})
|
|
36
|
+
}) : null
|
|
37
|
+
].filter(Boolean)
|
|
38
|
+
});
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./presets.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./presets.js";
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout Presets - Pre-built layouts yang siap pakai
|
|
3
|
+
*/
|
|
4
|
+
import type { NodeLike } from "../system/contracts.js";
|
|
5
|
+
export interface BlogPostPresetProps {
|
|
6
|
+
title: NodeLike;
|
|
7
|
+
meta: NodeLike;
|
|
8
|
+
content: NodeLike;
|
|
9
|
+
sidebar?: NodeLike;
|
|
10
|
+
maxWidth?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function BlogPostPreset({ title, meta, content, sidebar, maxWidth }: BlogPostPresetProps): {
|
|
13
|
+
type: string;
|
|
14
|
+
props: {
|
|
15
|
+
children: any;
|
|
16
|
+
style: Record<string, any>;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export interface BlogListPresetProps {
|
|
20
|
+
posts: NodeLike[];
|
|
21
|
+
sidebar?: NodeLike;
|
|
22
|
+
columns?: number;
|
|
23
|
+
}
|
|
24
|
+
export declare function BlogListPreset({ posts, sidebar, columns }: BlogListPresetProps): {
|
|
25
|
+
type: string;
|
|
26
|
+
props: {
|
|
27
|
+
children: any;
|
|
28
|
+
style: Record<string, any>;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export interface ProductGridPresetProps {
|
|
32
|
+
products: NodeLike[];
|
|
33
|
+
columns?: number;
|
|
34
|
+
}
|
|
35
|
+
export declare function ProductGridPreset({ products, columns }: ProductGridPresetProps): {
|
|
36
|
+
type: string;
|
|
37
|
+
props: {
|
|
38
|
+
children: any;
|
|
39
|
+
style: Record<string, any>;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export interface ProductDetailPresetProps {
|
|
43
|
+
image: NodeLike;
|
|
44
|
+
title: NodeLike;
|
|
45
|
+
price: NodeLike;
|
|
46
|
+
description: NodeLike;
|
|
47
|
+
actions: NodeLike;
|
|
48
|
+
specs?: NodeLike;
|
|
49
|
+
}
|
|
50
|
+
export declare function ProductDetailPreset({ image, title, price, description, actions, specs }: ProductDetailPresetProps): {
|
|
51
|
+
type: string;
|
|
52
|
+
props: {
|
|
53
|
+
children: any;
|
|
54
|
+
style: Record<string, any>;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export interface CartPresetProps {
|
|
58
|
+
items: NodeLike;
|
|
59
|
+
summary: NodeLike;
|
|
60
|
+
}
|
|
61
|
+
export declare function CartPreset({ items, summary }: CartPresetProps): {
|
|
62
|
+
type: string;
|
|
63
|
+
props: {
|
|
64
|
+
children: any;
|
|
65
|
+
style: Record<string, any>;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export interface StatsGridPresetProps {
|
|
69
|
+
stats: NodeLike[];
|
|
70
|
+
columns?: number;
|
|
71
|
+
}
|
|
72
|
+
export declare function StatsGridPreset({ stats, columns }: StatsGridPresetProps): {
|
|
73
|
+
type: string;
|
|
74
|
+
props: {
|
|
75
|
+
children: any;
|
|
76
|
+
style: Record<string, any>;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
export interface DataTablePresetProps {
|
|
80
|
+
headers: NodeLike;
|
|
81
|
+
rows: NodeLike[];
|
|
82
|
+
pagination?: NodeLike;
|
|
83
|
+
}
|
|
84
|
+
export declare function DataTablePreset({ headers, rows, pagination }: DataTablePresetProps): {
|
|
85
|
+
type: string;
|
|
86
|
+
props: {
|
|
87
|
+
children: any;
|
|
88
|
+
style: Record<string, any>;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
export interface DashboardWidgetPresetProps {
|
|
92
|
+
title: NodeLike;
|
|
93
|
+
content: NodeLike;
|
|
94
|
+
action?: NodeLike;
|
|
95
|
+
}
|
|
96
|
+
export declare function DashboardWidgetPreset({ title, content, action }: DashboardWidgetPresetProps): {
|
|
97
|
+
type: string;
|
|
98
|
+
props: {
|
|
99
|
+
children: any;
|
|
100
|
+
style: Record<string, any>;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
export interface SettingsPagePresetProps {
|
|
104
|
+
sidebar: NodeLike;
|
|
105
|
+
content: NodeLike;
|
|
106
|
+
}
|
|
107
|
+
export declare function SettingsPagePreset({ sidebar, content }: SettingsPagePresetProps): {
|
|
108
|
+
type: string;
|
|
109
|
+
props: {
|
|
110
|
+
children: any;
|
|
111
|
+
style: Record<string, any>;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
export interface SettingsSectionPresetProps {
|
|
115
|
+
title: NodeLike;
|
|
116
|
+
description?: NodeLike;
|
|
117
|
+
children: NodeLike;
|
|
118
|
+
}
|
|
119
|
+
export declare function SettingsSectionPreset({ title, description, children }: SettingsSectionPresetProps): {
|
|
120
|
+
type: string;
|
|
121
|
+
props: {
|
|
122
|
+
children: any;
|
|
123
|
+
style: Record<string, any>;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
export interface DocsPagePresetProps {
|
|
127
|
+
nav: NodeLike;
|
|
128
|
+
content: NodeLike;
|
|
129
|
+
toc?: NodeLike;
|
|
130
|
+
}
|
|
131
|
+
export declare function DocsPagePreset({ nav, content, toc }: DocsPagePresetProps): {
|
|
132
|
+
type: string;
|
|
133
|
+
props: {
|
|
134
|
+
children: any;
|
|
135
|
+
style: Record<string, any>;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
export interface DocsSidebarPresetProps {
|
|
139
|
+
sections: NodeLike[];
|
|
140
|
+
}
|
|
141
|
+
export declare function DocsSidebarPreset({ sections }: DocsSidebarPresetProps): {
|
|
142
|
+
type: string;
|
|
143
|
+
props: {
|
|
144
|
+
children: any;
|
|
145
|
+
style: Record<string, any>;
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
export interface ProfilePagePresetProps {
|
|
149
|
+
header: NodeLike;
|
|
150
|
+
tabs: NodeLike;
|
|
151
|
+
content: NodeLike;
|
|
152
|
+
}
|
|
153
|
+
export declare function ProfilePagePreset({ header, tabs, content }: ProfilePagePresetProps): {
|
|
154
|
+
type: string;
|
|
155
|
+
props: {
|
|
156
|
+
children: any;
|
|
157
|
+
style: Record<string, any>;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout Presets - Pre-built layouts yang siap pakai
|
|
3
|
+
*/
|
|
4
|
+
import { Flex } from "../primitives/Flex.js";
|
|
5
|
+
import { Box } from "../primitives/Box.js";
|
|
6
|
+
import { Grid } from "../primitives/Grid.js";
|
|
7
|
+
import { Container } from "../primitives/Container.js";
|
|
8
|
+
export function BlogPostPreset({ title, meta, content, sidebar, maxWidth = 800 }) {
|
|
9
|
+
if (sidebar) {
|
|
10
|
+
return Flex({
|
|
11
|
+
gap: 6,
|
|
12
|
+
children: [
|
|
13
|
+
Box({
|
|
14
|
+
width: maxWidth,
|
|
15
|
+
children: Flex({
|
|
16
|
+
direction: "column",
|
|
17
|
+
gap: 4,
|
|
18
|
+
children: [
|
|
19
|
+
Box({ children: title }),
|
|
20
|
+
Box({ children: meta }),
|
|
21
|
+
Box({ children: content })
|
|
22
|
+
]
|
|
23
|
+
})
|
|
24
|
+
}),
|
|
25
|
+
Box({
|
|
26
|
+
style: { width: "300px", flexShrink: 0 },
|
|
27
|
+
children: sidebar
|
|
28
|
+
})
|
|
29
|
+
]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return Container({
|
|
33
|
+
maxWidth,
|
|
34
|
+
children: Flex({
|
|
35
|
+
direction: "column",
|
|
36
|
+
gap: 4,
|
|
37
|
+
children: [
|
|
38
|
+
Box({ children: title }),
|
|
39
|
+
Box({ children: meta }),
|
|
40
|
+
Box({ children: content })
|
|
41
|
+
]
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export function BlogListPreset({ posts, sidebar, columns = 2 }) {
|
|
46
|
+
return Flex({
|
|
47
|
+
gap: 6,
|
|
48
|
+
children: [
|
|
49
|
+
Grid({
|
|
50
|
+
columns,
|
|
51
|
+
gap: 4,
|
|
52
|
+
children: posts
|
|
53
|
+
}),
|
|
54
|
+
sidebar ? Box({
|
|
55
|
+
style: { width: "280px", flexShrink: 0 },
|
|
56
|
+
children: sidebar
|
|
57
|
+
}) : null
|
|
58
|
+
].filter(Boolean)
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
export function ProductGridPreset({ products, columns = 3 }) {
|
|
62
|
+
return Grid({
|
|
63
|
+
columns,
|
|
64
|
+
gap: 4,
|
|
65
|
+
children: products
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
export function ProductDetailPreset({ image, title, price, description, actions, specs }) {
|
|
69
|
+
return Flex({
|
|
70
|
+
gap: 6,
|
|
71
|
+
children: [
|
|
72
|
+
Box({
|
|
73
|
+
style: { flex: "0 0 50%" },
|
|
74
|
+
children: image
|
|
75
|
+
}),
|
|
76
|
+
Box({
|
|
77
|
+
children: Flex({
|
|
78
|
+
direction: "column",
|
|
79
|
+
gap: 4,
|
|
80
|
+
children: [
|
|
81
|
+
Box({ children: title }),
|
|
82
|
+
Box({ children: price }),
|
|
83
|
+
Box({ children: description }),
|
|
84
|
+
Box({ children: actions }),
|
|
85
|
+
specs ? Box({ children: specs }) : null
|
|
86
|
+
].filter(Boolean)
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
export function CartPreset({ items, summary }) {
|
|
93
|
+
return Flex({
|
|
94
|
+
gap: 6,
|
|
95
|
+
children: [
|
|
96
|
+
Box({
|
|
97
|
+
style: { flex: 1 },
|
|
98
|
+
children: items
|
|
99
|
+
}),
|
|
100
|
+
Box({
|
|
101
|
+
style: { width: "320px", flexShrink: 0 },
|
|
102
|
+
children: summary
|
|
103
|
+
})
|
|
104
|
+
]
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
export function StatsGridPreset({ stats, columns = 4 }) {
|
|
108
|
+
return Grid({
|
|
109
|
+
columns,
|
|
110
|
+
gap: 4,
|
|
111
|
+
children: stats
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
export function DataTablePreset({ headers, rows, pagination }) {
|
|
115
|
+
return Flex({
|
|
116
|
+
direction: "column",
|
|
117
|
+
gap: 4,
|
|
118
|
+
children: [
|
|
119
|
+
Box({
|
|
120
|
+
style: { overflowX: "auto" },
|
|
121
|
+
children: Flex({
|
|
122
|
+
direction: "column",
|
|
123
|
+
children: [
|
|
124
|
+
Box({ children: headers }),
|
|
125
|
+
...rows,
|
|
126
|
+
pagination ? Box({ children: pagination }) : null
|
|
127
|
+
].filter(Boolean)
|
|
128
|
+
})
|
|
129
|
+
})
|
|
130
|
+
]
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
export function DashboardWidgetPreset({ title, content, action }) {
|
|
134
|
+
return Box({
|
|
135
|
+
children: Flex({
|
|
136
|
+
direction: "column",
|
|
137
|
+
gap: 3,
|
|
138
|
+
children: [
|
|
139
|
+
Flex({
|
|
140
|
+
justify: "space-between",
|
|
141
|
+
align: "center",
|
|
142
|
+
children: [
|
|
143
|
+
Box({ children: title }),
|
|
144
|
+
action ? Box({ children: action }) : null
|
|
145
|
+
].filter(Boolean)
|
|
146
|
+
}),
|
|
147
|
+
Box({ children: content })
|
|
148
|
+
]
|
|
149
|
+
})
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
export function SettingsPagePreset({ sidebar, content }) {
|
|
153
|
+
return Flex({
|
|
154
|
+
gap: 6,
|
|
155
|
+
children: [
|
|
156
|
+
Box({
|
|
157
|
+
style: { width: "250px", flexShrink: 0 },
|
|
158
|
+
children: sidebar
|
|
159
|
+
}),
|
|
160
|
+
Box({
|
|
161
|
+
style: { flex: 1 },
|
|
162
|
+
children: content
|
|
163
|
+
})
|
|
164
|
+
]
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
export function SettingsSectionPreset({ title, description, children }) {
|
|
168
|
+
return Flex({
|
|
169
|
+
direction: "column",
|
|
170
|
+
gap: 4,
|
|
171
|
+
children: [
|
|
172
|
+
Box({ children: title }),
|
|
173
|
+
description ? Box({ children: description }) : null,
|
|
174
|
+
Box({ children: children })
|
|
175
|
+
].filter(Boolean)
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
export function DocsPagePreset({ nav, content, toc }) {
|
|
179
|
+
return Flex({
|
|
180
|
+
gap: 6,
|
|
181
|
+
children: [
|
|
182
|
+
Box({
|
|
183
|
+
style: { width: "240px", flexShrink: 0 },
|
|
184
|
+
children: nav
|
|
185
|
+
}),
|
|
186
|
+
Box({
|
|
187
|
+
style: { flex: 1, minWidth: 0 },
|
|
188
|
+
children: content
|
|
189
|
+
}),
|
|
190
|
+
toc ? Box({
|
|
191
|
+
style: { width: "200px", flexShrink: 0 },
|
|
192
|
+
children: toc
|
|
193
|
+
}) : null
|
|
194
|
+
].filter(Boolean)
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
export function DocsSidebarPreset({ sections }) {
|
|
198
|
+
return Flex({
|
|
199
|
+
direction: "column",
|
|
200
|
+
gap: 3,
|
|
201
|
+
children: sections
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
export function ProfilePagePreset({ header, tabs, content }) {
|
|
205
|
+
return Flex({
|
|
206
|
+
direction: "column",
|
|
207
|
+
gap: 4,
|
|
208
|
+
children: [
|
|
209
|
+
Box({ children: header }),
|
|
210
|
+
Box({ children: tabs }),
|
|
211
|
+
Box({ children: content })
|
|
212
|
+
]
|
|
213
|
+
});
|
|
214
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { LayoutProps } from "../system/types.js";
|
|
2
|
+
export { type LayoutProps };
|
|
3
|
+
/**
|
|
4
|
+
* Komponen blok dasar yang memetakan LayoutProps → inline style.
|
|
5
|
+
* Gunakan untuk membangun primitive lainnya.
|
|
6
|
+
*/
|
|
7
|
+
export declare function Box({ children, padding, margin, width, height, display, style, ...rest }: LayoutProps & {
|
|
8
|
+
children?: any;
|
|
9
|
+
}): {
|
|
10
|
+
type: string;
|
|
11
|
+
props: {
|
|
12
|
+
children: any;
|
|
13
|
+
style: Record<string, any>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { LayoutProps, CSSLength } from "../system/types.js";
|
|
2
|
+
export interface ContainerProps extends LayoutProps {
|
|
3
|
+
maxWidth?: CSSLength;
|
|
4
|
+
centerContent?: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Container - wrapper dengan max-width dan centering
|
|
8
|
+
*/
|
|
9
|
+
export declare function Container({ children, maxWidth, centerContent, padding, margin, width, height, display, style, ...rest }: ContainerProps & {
|
|
10
|
+
children?: any;
|
|
11
|
+
}): {
|
|
12
|
+
type: string;
|
|
13
|
+
props: {
|
|
14
|
+
children: any;
|
|
15
|
+
style: Record<string, any>;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { normalizeUnit } from "../core/styleResolver.js";
|
|
2
|
+
/**
|
|
3
|
+
* Container - wrapper dengan max-width dan centering
|
|
4
|
+
*/
|
|
5
|
+
export function Container({ children, maxWidth = 1280, centerContent = true, padding = 4, margin, width, height, display, style, ...rest }) {
|
|
6
|
+
const resolved = {
|
|
7
|
+
padding: normalizeUnit(padding),
|
|
8
|
+
margin: margin ? normalizeUnit(margin) : "0 auto",
|
|
9
|
+
width: width !== null && width !== void 0 ? width : "100%",
|
|
10
|
+
height: normalizeUnit(height),
|
|
11
|
+
maxWidth: normalizeUnit(maxWidth),
|
|
12
|
+
display: display !== null && display !== void 0 ? display : "block",
|
|
13
|
+
...(centerContent && { marginLeft: "auto", marginRight: "auto" }),
|
|
14
|
+
...style
|
|
15
|
+
};
|
|
16
|
+
return {
|
|
17
|
+
type: "div",
|
|
18
|
+
props: {
|
|
19
|
+
style: resolved,
|
|
20
|
+
...rest,
|
|
21
|
+
children
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { LayoutProps, CSSLength } from "../system/types.js";
|
|
2
|
+
export interface FlexProps extends LayoutProps {
|
|
3
|
+
justify?: string;
|
|
4
|
+
align?: string;
|
|
5
|
+
gap?: CSSLength;
|
|
6
|
+
direction?: "row" | "row-reverse" | "column" | "column-reverse";
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Kontainer fleksibel berbasis style inline (tanpa dependency React).
|
|
10
|
+
* Menghasilkan struktur objek yang merepresentasikan node 'div' dengan style flex.
|
|
11
|
+
*/
|
|
12
|
+
export declare function Flex({ children, justify, align, gap, direction, padding, margin, width, height, display, style, ...rest }: FlexProps & {
|
|
13
|
+
children?: any;
|
|
14
|
+
}): {
|
|
15
|
+
type: string;
|
|
16
|
+
props: {
|
|
17
|
+
children: any;
|
|
18
|
+
style: Record<string, any>;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CSSLength, LayoutProps, ResponsiveValue } from "../system/types.js";
|
|
2
|
+
export interface GridProps extends LayoutProps {
|
|
3
|
+
columns?: number | string | ResponsiveValue<number>;
|
|
4
|
+
rows?: number | string;
|
|
5
|
+
gap?: CSSLength | ResponsiveValue<CSSLength>;
|
|
6
|
+
viewportWidth?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function Grid({ children, columns, rows, gap, padding, margin, width, height, display, style, viewportWidth, ...rest }: GridProps & {
|
|
9
|
+
children?: any;
|
|
10
|
+
}): {
|
|
11
|
+
type: string;
|
|
12
|
+
props: {
|
|
13
|
+
children: any;
|
|
14
|
+
style: Record<string, any>;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
import { normalizeUnit } from "../core/styleResolver.js";
|
|
2
|
+
import { resolveResponsive } from "../core/responsiveSystem.js";
|
|
2
3
|
const toTemplate = (v) => {
|
|
3
4
|
if (typeof v === "number")
|
|
4
5
|
return `repeat(${v}, minmax(0, 1fr))`;
|
|
5
6
|
return v;
|
|
6
7
|
};
|
|
7
|
-
export function Grid({ children, columns, rows, gap, padding, margin, width, height, display, style, ...rest }) {
|
|
8
|
+
export function Grid({ children, columns, rows, gap, padding, margin, width, height, display, style, viewportWidth = 1024, ...rest }) {
|
|
9
|
+
const resolvedColumns = typeof columns === "object"
|
|
10
|
+
? resolveResponsive(columns, viewportWidth)
|
|
11
|
+
: toTemplate(columns);
|
|
12
|
+
const resolvedGap = typeof gap === "object"
|
|
13
|
+
? normalizeUnit(resolveResponsive(gap, viewportWidth))
|
|
14
|
+
: normalizeUnit(gap);
|
|
8
15
|
const resolved = {
|
|
9
16
|
padding: normalizeUnit(padding),
|
|
10
17
|
margin: normalizeUnit(margin),
|
|
11
18
|
width: normalizeUnit(width),
|
|
12
19
|
height: normalizeUnit(height),
|
|
13
20
|
display: display !== null && display !== void 0 ? display : "grid",
|
|
14
|
-
gridTemplateColumns:
|
|
21
|
+
gridTemplateColumns: resolvedColumns,
|
|
15
22
|
gridTemplateRows: toTemplate(rows),
|
|
16
|
-
gap:
|
|
23
|
+
gap: resolvedGap,
|
|
17
24
|
...style
|
|
18
25
|
};
|
|
19
26
|
return {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { LayoutProps, CSSLength } from "../system/types.js";
|
|
2
|
+
export interface SpacerProps extends LayoutProps {
|
|
3
|
+
size?: CSSLength;
|
|
4
|
+
axis?: "x" | "y";
|
|
5
|
+
}
|
|
6
|
+
export declare function Spacer({ size, axis, style, ...rest }: SpacerProps & {
|
|
7
|
+
children?: any;
|
|
8
|
+
}): {
|
|
9
|
+
type: string;
|
|
10
|
+
props: {
|
|
11
|
+
padding?: CSSLength;
|
|
12
|
+
margin?: CSSLength;
|
|
13
|
+
width?: CSSLength;
|
|
14
|
+
height?: CSSLength;
|
|
15
|
+
display?: string;
|
|
16
|
+
children?: any;
|
|
17
|
+
style: Record<string, any>;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { normalizeUnit } from "../core/styleResolver.js";
|
|
2
|
+
export function Spacer({ size = 8, axis = "y", style, ...rest }) {
|
|
3
|
+
var _a, _b;
|
|
4
|
+
const resolved = {
|
|
5
|
+
width: axis === "x" ? normalizeUnit(size) : (_a = normalizeUnit(rest.width)) !== null && _a !== void 0 ? _a : "100%",
|
|
6
|
+
height: axis === "y" ? normalizeUnit(size) : (_b = normalizeUnit(rest.height)) !== null && _b !== void 0 ? _b : "100%",
|
|
7
|
+
display: "block",
|
|
8
|
+
...style
|
|
9
|
+
};
|
|
10
|
+
return {
|
|
11
|
+
type: "div",
|
|
12
|
+
props: {
|
|
13
|
+
style: resolved,
|
|
14
|
+
...rest
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CSSLength, LayoutProps } from "../system/types.js";
|
|
2
|
+
export interface StackProps extends LayoutProps {
|
|
3
|
+
gap?: CSSLength;
|
|
4
|
+
}
|
|
5
|
+
export declare function Stack({ children, gap, padding, margin, width, height, display, style, ...rest }: StackProps & {
|
|
6
|
+
children?: any;
|
|
7
|
+
}): {
|
|
8
|
+
type: string;
|
|
9
|
+
props: {
|
|
10
|
+
children: any;
|
|
11
|
+
style: Record<string, any>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { NodeLike } from "../system/contracts.js";
|
|
2
|
+
export interface HeaderContentFooterContract {
|
|
3
|
+
header: NodeLike;
|
|
4
|
+
content: NodeLike;
|
|
5
|
+
footer: NodeLike;
|
|
6
|
+
}
|
|
7
|
+
export declare function HeaderContentFooter({ header, content, footer }: HeaderContentFooterContract): {
|
|
8
|
+
type: string;
|
|
9
|
+
props: {
|
|
10
|
+
children: any;
|
|
11
|
+
style: Record<string, any>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HeaderLayoutContract } from "../system/contracts.js";
|
|
2
|
+
export interface HeaderLayoutProps extends HeaderLayoutContract {
|
|
3
|
+
headerHeight?: string | number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* HeaderLayout - layout dengan header di atas dan content di bawah
|
|
7
|
+
*/
|
|
8
|
+
export declare function HeaderLayout({ header, children, headerHeight }: HeaderLayoutProps): {
|
|
9
|
+
type: string;
|
|
10
|
+
props: {
|
|
11
|
+
children: any;
|
|
12
|
+
style: Record<string, any>;
|
|
13
|
+
};
|
|
14
|
+
};
|