kubetsx 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +371 -0
- package/dist/components/index.d.ts +46 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +155 -0
- package/dist/components/index.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/jsx-runtime.d.ts +33 -0
- package/dist/jsx-runtime.d.ts.map +1 -0
- package/dist/jsx-runtime.js +58 -0
- package/dist/jsx-runtime.js.map +1 -0
- package/dist/render.d.ts +12 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +746 -0
- package/dist/render.js.map +1 -0
- package/dist/types.d.ts +339 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/examples/basic.tsx +71 -0
- package/examples/full-stack.tsx +339 -0
- package/examples/tsconfig.json +21 -0
- package/package.json +57 -0
- package/src/components/index.ts +241 -0
- package/src/index.ts +123 -0
- package/src/jsx-runtime.ts +71 -0
- package/src/render.ts +862 -0
- package/src/types.ts +362 -0
- package/tsconfig.examples.json +18 -0
- package/tsconfig.json +22 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🎯 Kubetsx - JSX Runtime
|
|
3
|
+
*
|
|
4
|
+
* Custom JSX factory for Kubernetes components
|
|
5
|
+
*/
|
|
6
|
+
import type { KubexElement, KubexNode, KubexComponent } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* JSX Element Factory
|
|
9
|
+
*/
|
|
10
|
+
export declare function h(type: string | KubexComponent, props: Record<string, unknown> | null, ...children: KubexNode[]): KubexElement;
|
|
11
|
+
/**
|
|
12
|
+
* Fragment support
|
|
13
|
+
*/
|
|
14
|
+
export declare function Fragment(props: {
|
|
15
|
+
children?: KubexNode;
|
|
16
|
+
}): KubexElement;
|
|
17
|
+
/**
|
|
18
|
+
* JSX automatic runtime exports
|
|
19
|
+
*/
|
|
20
|
+
export declare function jsx(type: string | KubexComponent, props: Record<string, unknown> & {
|
|
21
|
+
children?: KubexNode;
|
|
22
|
+
}): KubexElement;
|
|
23
|
+
export declare const jsxs: typeof jsx;
|
|
24
|
+
export declare const jsxDEV: typeof jsx;
|
|
25
|
+
declare const _default: {
|
|
26
|
+
h: typeof h;
|
|
27
|
+
Fragment: typeof Fragment;
|
|
28
|
+
jsx: typeof jsx;
|
|
29
|
+
jsxs: typeof jsx;
|
|
30
|
+
jsxDEV: typeof jsx;
|
|
31
|
+
};
|
|
32
|
+
export default _default;
|
|
33
|
+
//# sourceMappingURL=jsx-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAe1E;;GAEG;AACH,wBAAgB,CAAC,CACf,IAAI,EAAE,MAAM,GAAG,cAAc,EAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACrC,GAAG,QAAQ,EAAE,SAAS,EAAE,GACvB,YAAY,CAMd;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG,YAAY,CAOtE;AAED;;GAEG;AACH,wBAAgB,GAAG,CACjB,IAAI,EAAE,MAAM,GAAG,cAAc,EAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,GACxD,YAAY,CAUd;AAED,eAAO,MAAM,IAAI,YAAM,CAAC;AACxB,eAAO,MAAM,MAAM,YAAM,CAAC;;;;;;;;AAG1B,wBAAkD"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🎯 Kubetsx - JSX Runtime
|
|
3
|
+
*
|
|
4
|
+
* Custom JSX factory for Kubernetes components
|
|
5
|
+
*/
|
|
6
|
+
// Helper to flatten children
|
|
7
|
+
function flattenChildren(children) {
|
|
8
|
+
const result = [];
|
|
9
|
+
for (const child of children) {
|
|
10
|
+
if (Array.isArray(child)) {
|
|
11
|
+
result.push(...flattenChildren(child));
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
result.push(child);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* JSX Element Factory
|
|
21
|
+
*/
|
|
22
|
+
export function h(type, props, ...children) {
|
|
23
|
+
return {
|
|
24
|
+
type,
|
|
25
|
+
props: props || {},
|
|
26
|
+
children: flattenChildren(children),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Fragment support
|
|
31
|
+
*/
|
|
32
|
+
export function Fragment(props) {
|
|
33
|
+
const children = props.children;
|
|
34
|
+
return {
|
|
35
|
+
type: 'Fragment',
|
|
36
|
+
props: {},
|
|
37
|
+
children: Array.isArray(children) ? children : children ? [children] : [],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* JSX automatic runtime exports
|
|
42
|
+
*/
|
|
43
|
+
export function jsx(type, props) {
|
|
44
|
+
const { children, ...restProps } = props;
|
|
45
|
+
const childArray = children !== undefined
|
|
46
|
+
? (Array.isArray(children) ? children : [children])
|
|
47
|
+
: [];
|
|
48
|
+
return {
|
|
49
|
+
type,
|
|
50
|
+
props: restProps,
|
|
51
|
+
children: flattenChildren(childArray),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export const jsxs = jsx;
|
|
55
|
+
export const jsxDEV = jsx;
|
|
56
|
+
// Default export for compatibility
|
|
57
|
+
export default { h, Fragment, jsx, jsxs, jsxDEV };
|
|
58
|
+
//# sourceMappingURL=jsx-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-runtime.js","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,6BAA6B;AAC7B,SAAS,eAAe,CAAC,QAAqB;IAC5C,MAAM,MAAM,GAAgB,EAAE,CAAC;IAC/B,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;QAC7B,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,MAAM,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;QACzC,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,CAAC,CACf,IAA6B,EAC7B,KAAqC,EACrC,GAAG,QAAqB;IAExB,OAAO;QACL,IAAI;QACJ,KAAK,EAAE,KAAK,IAAI,EAAE;QAClB,QAAQ,EAAE,eAAe,CAAC,QAAQ,CAAC;KACpC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,KAA+B;IACtD,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;IAChC,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE;KAC1E,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,GAAG,CACjB,IAA6B,EAC7B,KAAyD;IAEzD,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IACzC,MAAM,UAAU,GAAG,QAAQ,KAAK,SAAS;QACvC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QACnD,CAAC,CAAC,EAAE,CAAC;IACP,OAAO;QACL,IAAI;QACJ,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC;KACtC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAC;AAE1B,mCAAmC;AACnC,eAAe,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC"}
|
package/dist/render.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🎯 Kubetsx - YAML Render Engine
|
|
3
|
+
*
|
|
4
|
+
* Transforms JSX element tree into Kubernetes YAML manifests
|
|
5
|
+
*/
|
|
6
|
+
import type { KubexElement, RenderOptions } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Render a Kubex JSX tree to Kubernetes YAML
|
|
9
|
+
*/
|
|
10
|
+
export declare function render(element: KubexElement, options?: RenderOptions): string;
|
|
11
|
+
export default render;
|
|
12
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EACV,YAAY,EAGZ,aAAa,EAGd,MAAM,YAAY,CAAC;AAMpB;;GAEG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,GAAE,aAAkB,GAAG,MAAM,CA0BjF;AAyyBD,eAAe,MAAM,CAAC"}
|