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