@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
package/README.md
CHANGED
|
@@ -14,6 +14,20 @@ npm install @damarkuncoro/layout-engine
|
|
|
14
14
|
- Structures: SidebarLayout.
|
|
15
15
|
- Sistem responsive berbasis breakpoints (sm, md, lg, xl, 2xl).
|
|
16
16
|
|
|
17
|
+
## Import ESM & CJS
|
|
18
|
+
|
|
19
|
+
- ESM (direkomendasikan):
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
import { Box, Grid, renderToString } from "@damarkuncoro/layout-engine"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- CJS:
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
const { Box, Grid, renderToString } = require("@damarkuncoro/layout-engine")
|
|
29
|
+
```
|
|
30
|
+
|
|
17
31
|
## Penggunaan Dasar
|
|
18
32
|
|
|
19
33
|
Render headless ke HTML:
|
|
@@ -34,12 +48,12 @@ console.log(renderToString(page))
|
|
|
34
48
|
Responsive utility:
|
|
35
49
|
|
|
36
50
|
```js
|
|
37
|
-
import { resolveResponsive } from "layout-engine"
|
|
51
|
+
import { resolveResponsive } from "@damarkuncoro/layout-engine"
|
|
38
52
|
const gap = resolveResponsive({ base: 8, md: 16, xl: 24 }, 768) // 16
|
|
39
53
|
```
|
|
40
54
|
|
|
41
55
|
## TypeScript
|
|
42
|
-
-
|
|
56
|
+
- Deklarasi tipe tersedia pada `lib/esm/index.d.ts`.
|
|
43
57
|
|
|
44
58
|
## Lisensi
|
|
45
59
|
MIT
|
|
@@ -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("./styleResolver.js"), exports);
|
|
18
|
+
__exportStar(require("./spacingSystem.js"), exports);
|
|
19
|
+
__exportStar(require("./responsiveSystem.js"), exports);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderToString = void 0;
|
|
4
|
+
const styleToString = (style) => {
|
|
5
|
+
if (!style)
|
|
6
|
+
return "";
|
|
7
|
+
const entries = Object.entries(style)
|
|
8
|
+
.filter(([_, v]) => v !== undefined && v !== null && v !== "")
|
|
9
|
+
.map(([k, v]) => {
|
|
10
|
+
const prop = k.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
11
|
+
return `${prop}:${String(v)}`;
|
|
12
|
+
});
|
|
13
|
+
return entries.join(";");
|
|
14
|
+
};
|
|
15
|
+
const escapeHtml = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
16
|
+
const renderChild = (child) => {
|
|
17
|
+
if (child === null || child === undefined || child === false)
|
|
18
|
+
return "";
|
|
19
|
+
if (Array.isArray(child))
|
|
20
|
+
return child.map(renderChild).join("");
|
|
21
|
+
if (typeof child === "object" && child.type && child.props) {
|
|
22
|
+
return (0, exports.renderToString)(child);
|
|
23
|
+
}
|
|
24
|
+
return escapeHtml(String(child));
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Merender HeadlessNode menjadi string HTML dengan inline style.
|
|
28
|
+
*/
|
|
29
|
+
const renderToString = (node) => {
|
|
30
|
+
const { type, props } = node;
|
|
31
|
+
const { children, style, className, ...rest } = props || {};
|
|
32
|
+
const styleStr = styleToString(style);
|
|
33
|
+
const attr = (className ? ` class="${className}"` : "") +
|
|
34
|
+
(styleStr ? ` style="${styleStr}"` : "") +
|
|
35
|
+
Object.entries(rest)
|
|
36
|
+
.map(([k, v]) => {
|
|
37
|
+
if (v === undefined || v === null || typeof v === "object")
|
|
38
|
+
return "";
|
|
39
|
+
return ` ${k}="${String(v)}"`;
|
|
40
|
+
})
|
|
41
|
+
.join("");
|
|
42
|
+
const inner = renderChild(children);
|
|
43
|
+
return `<${type}${attr}>${inner}</${type}>`;
|
|
44
|
+
};
|
|
45
|
+
exports.renderToString = renderToString;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveResponsive = exports.breakpoints = void 0;
|
|
4
|
+
exports.breakpoints = {
|
|
5
|
+
sm: 640,
|
|
6
|
+
md: 768,
|
|
7
|
+
lg: 1024,
|
|
8
|
+
xl: 1280,
|
|
9
|
+
"2xl": 1536
|
|
10
|
+
};
|
|
11
|
+
const resolveResponsive = (value, width) => {
|
|
12
|
+
if (value === undefined)
|
|
13
|
+
return undefined;
|
|
14
|
+
if (!Array.isArray(value) && typeof value !== "object")
|
|
15
|
+
return value;
|
|
16
|
+
const order = [
|
|
17
|
+
{ min: 0 },
|
|
18
|
+
{ key: "sm", min: exports.breakpoints.sm },
|
|
19
|
+
{ key: "md", min: exports.breakpoints.md },
|
|
20
|
+
{ key: "lg", min: exports.breakpoints.lg },
|
|
21
|
+
{ key: "xl", min: exports.breakpoints.xl },
|
|
22
|
+
{ key: "2xl", min: exports.breakpoints["2xl"] }
|
|
23
|
+
];
|
|
24
|
+
let resolved = undefined;
|
|
25
|
+
if (Array.isArray(value)) {
|
|
26
|
+
for (let i = 0; i < order.length; i++) {
|
|
27
|
+
if (width >= order[i].min && i < value.length) {
|
|
28
|
+
resolved = value[i];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return resolved;
|
|
32
|
+
}
|
|
33
|
+
const obj = value;
|
|
34
|
+
if (obj.base !== undefined)
|
|
35
|
+
resolved = obj.base;
|
|
36
|
+
for (const it of order) {
|
|
37
|
+
if (!it.key)
|
|
38
|
+
continue;
|
|
39
|
+
if (width >= it.min && obj[it.key] !== undefined) {
|
|
40
|
+
resolved = obj[it.key];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return resolved;
|
|
44
|
+
};
|
|
45
|
+
exports.resolveResponsive = resolveResponsive;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.space = exports.spacingScale = void 0;
|
|
4
|
+
exports.spacingScale = {
|
|
5
|
+
0: 0,
|
|
6
|
+
1: 4,
|
|
7
|
+
2: 8,
|
|
8
|
+
3: 12,
|
|
9
|
+
4: 16,
|
|
10
|
+
5: 24,
|
|
11
|
+
6: 32,
|
|
12
|
+
7: 40,
|
|
13
|
+
8: 48,
|
|
14
|
+
9: 64
|
|
15
|
+
};
|
|
16
|
+
const space = (i) => {
|
|
17
|
+
const v = exports.spacingScale[i];
|
|
18
|
+
const n = typeof v === "number" ? v : i;
|
|
19
|
+
return `${n}px`;
|
|
20
|
+
};
|
|
21
|
+
exports.space = space;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeUnit = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Mengubah nilai panjang CSS: angka → px, string tetap.
|
|
6
|
+
* Contoh: 16 -> "16px", "2rem" -> "2rem", undefined -> undefined
|
|
7
|
+
*/
|
|
8
|
+
const normalizeUnit = (value) => {
|
|
9
|
+
if (typeof value === "number") {
|
|
10
|
+
return `${value}px`;
|
|
11
|
+
}
|
|
12
|
+
return value;
|
|
13
|
+
};
|
|
14
|
+
exports.normalizeUnit = normalizeUnit;
|
|
@@ -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/cjs/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
exports.breakpoints = exports.resolveResponsive = void 0;
|
|
18
|
+
__exportStar(require("./system/index.js"), exports);
|
|
19
|
+
__exportStar(require("./primitives/index.js"), exports);
|
|
20
|
+
__exportStar(require("./structures/index.js"), exports);
|
|
21
|
+
__exportStar(require("./patterns/index.js"), exports);
|
|
22
|
+
__exportStar(require("./presets/index.js"), exports);
|
|
23
|
+
var responsiveSystem_js_1 = require("./core/responsiveSystem.js");
|
|
24
|
+
Object.defineProperty(exports, "resolveResponsive", { enumerable: true, get: function () { return responsiveSystem_js_1.resolveResponsive; } });
|
|
25
|
+
Object.defineProperty(exports, "breakpoints", { enumerable: true, get: function () { return responsiveSystem_js_1.breakpoints; } });
|
|
26
|
+
__exportStar(require("./core/spacingSystem.js"), exports);
|
|
27
|
+
__exportStar(require("./core/styleResolver.js"), exports);
|
|
28
|
+
__exportStar(require("./core/render.js"), exports);
|
|
@@ -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,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthLayout = AuthLayout;
|
|
4
|
+
const Flex_js_1 = require("../primitives/Flex.js");
|
|
5
|
+
const Box_js_1 = require("../primitives/Box.js");
|
|
6
|
+
/**
|
|
7
|
+
* AuthLayout - layout untuk halaman login/register
|
|
8
|
+
* Konsisten centered dengan form di tengah layar
|
|
9
|
+
*/
|
|
10
|
+
function AuthLayout({ children, logo, subtitle }) {
|
|
11
|
+
return (0, Flex_js_1.Flex)({
|
|
12
|
+
style: {
|
|
13
|
+
minHeight: "100vh",
|
|
14
|
+
alignItems: "center",
|
|
15
|
+
justifyContent: "center"
|
|
16
|
+
},
|
|
17
|
+
children: (0, Box_js_1.Box)({
|
|
18
|
+
style: {
|
|
19
|
+
width: "100%",
|
|
20
|
+
maxWidth: "400px",
|
|
21
|
+
padding: "24px"
|
|
22
|
+
},
|
|
23
|
+
children: (0, Flex_js_1.Flex)({
|
|
24
|
+
direction: "column",
|
|
25
|
+
gap: 4,
|
|
26
|
+
children: [
|
|
27
|
+
logo ? (0, Box_js_1.Box)({ children: logo }) : null,
|
|
28
|
+
subtitle ? (0, Box_js_1.Box)({ children: subtitle }) : null,
|
|
29
|
+
children
|
|
30
|
+
].filter(Boolean)
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DashboardLayout = DashboardLayout;
|
|
4
|
+
const Flex_js_1 = require("../primitives/Flex.js");
|
|
5
|
+
const SidebarLayout_js_1 = require("../structures/SidebarLayout.js");
|
|
6
|
+
function DashboardLayout({ header, sidebar, children }) {
|
|
7
|
+
return (0, Flex_js_1.Flex)({
|
|
8
|
+
direction: "column",
|
|
9
|
+
children: [
|
|
10
|
+
header,
|
|
11
|
+
(0, SidebarLayout_js_1.SidebarLayout)({ sidebar, children })
|
|
12
|
+
]
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LandingLayout = LandingLayout;
|
|
4
|
+
const Flex_js_1 = require("../primitives/Flex.js");
|
|
5
|
+
const Box_js_1 = require("../primitives/Box.js");
|
|
6
|
+
const Container_js_1 = require("../primitives/Container.js");
|
|
7
|
+
/**
|
|
8
|
+
* LandingLayout - layout untuk halaman landing page
|
|
9
|
+
* Dengan section hero, features, pricing, dan footer
|
|
10
|
+
*/
|
|
11
|
+
function LandingLayout({ header, hero, features, pricing, footer, children }) {
|
|
12
|
+
return (0, Flex_js_1.Flex)({
|
|
13
|
+
direction: "column",
|
|
14
|
+
children: [
|
|
15
|
+
// Sticky header
|
|
16
|
+
header ? (0, Box_js_1.Box)({
|
|
17
|
+
style: { position: "sticky", top: 0, zIndex: 10 },
|
|
18
|
+
children: (0, Container_js_1.Container)({
|
|
19
|
+
children: header
|
|
20
|
+
})
|
|
21
|
+
}) : null,
|
|
22
|
+
// Main content
|
|
23
|
+
(0, Box_js_1.Box)({
|
|
24
|
+
children: children !== null && children !== void 0 ? children : (0, Flex_js_1.Flex)({
|
|
25
|
+
direction: "column",
|
|
26
|
+
children: [
|
|
27
|
+
hero ? (0, Box_js_1.Box)({ children: hero }) : null,
|
|
28
|
+
features ? (0, Box_js_1.Box)({ children: features }) : null,
|
|
29
|
+
pricing ? (0, Box_js_1.Box)({ children: pricing }) : null
|
|
30
|
+
].filter(Boolean)
|
|
31
|
+
})
|
|
32
|
+
}),
|
|
33
|
+
// Footer
|
|
34
|
+
footer ? (0, Box_js_1.Box)({
|
|
35
|
+
children: (0, Container_js_1.Container)({
|
|
36
|
+
padding: 6,
|
|
37
|
+
children: footer
|
|
38
|
+
})
|
|
39
|
+
}) : null
|
|
40
|
+
].filter(Boolean)
|
|
41
|
+
});
|
|
42
|
+
}
|
|
@@ -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("./DashboardLayout.js"), exports);
|
|
18
|
+
__exportStar(require("./AuthLayout.js"), exports);
|
|
19
|
+
__exportStar(require("./LandingLayout.js"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./presets.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
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("./presets.js"), exports);
|
|
@@ -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
|
+
};
|