@fluixi/jsx 1.0.0-alpha.100

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.
@@ -0,0 +1,208 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/lib/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ Fragment: () => Fragment,
24
+ cloneElement: () => cloneElement,
25
+ createElement: () => createElement,
26
+ createReactiveJSX: () => createReactiveJSX,
27
+ createRef: () => createRef,
28
+ default: () => index_default,
29
+ defineComponent: () => defineComponent,
30
+ delegateEvents: () => import_dom3.delegateEvents,
31
+ forwardRef: () => forwardRef,
32
+ hydrate: () => hydrate,
33
+ isValidElement: () => isValidElement,
34
+ jsx: () => jsx,
35
+ jsxComponent: () => jsxComponent,
36
+ jsxDEV: () => jsxDEV,
37
+ jsxs: () => jsxs,
38
+ memo: () => memo,
39
+ mergeProps: () => mergeProps,
40
+ renderToString: () => renderToString
41
+ });
42
+ module.exports = __toCommonJS(index_exports);
43
+
44
+ // src/lib/jsx-runtime.ts
45
+ var import_dom = require("@fluixi/dom");
46
+ var import_dom2 = require("@fluixi/dom");
47
+ var import_signal = require("@fluixi/reactive/signal");
48
+ var Fragment = /* @__PURE__ */ Symbol.for("fluixi.fragment");
49
+ var isSSR = typeof window === "undefined";
50
+ function normalizeChildren(children) {
51
+ if (children === void 0 || children === null || children === false) return null;
52
+ if (Array.isArray(children)) {
53
+ return children.map(normalizeChildren).flat();
54
+ }
55
+ return children;
56
+ }
57
+ function jsx(type, props, key) {
58
+ if (type == null) return null;
59
+ const p = props || {};
60
+ if (key !== void 0) p.key = key;
61
+ if (type === Fragment) {
62
+ return (0, import_signal.createMemo)(() => (0, import_dom.asComponent)(normalizeChildren(p.children)));
63
+ }
64
+ if (typeof type === "function") {
65
+ const { type: renderType } = (0, import_dom.checkRenderType)(type);
66
+ if (type.$$typeof === /* @__PURE__ */ Symbol.for("react.provider") || renderType === "provider") {
67
+ return type(p);
68
+ }
69
+ if (isSSR) return { type, props: p };
70
+ return (0, import_signal.createMemo)(() => (0, import_dom2.createComponent)(type, p), void 0, { name: "jsx component" });
71
+ }
72
+ if (typeof type === "string" && type.trim().length > 0) {
73
+ return createNativeElement(type, p);
74
+ }
75
+ return null;
76
+ }
77
+ var jsxs = jsx;
78
+ function createNativeElement(tag, props) {
79
+ if (isSSR) return { type: tag, props: props || {} };
80
+ return (0, import_dom2.createDynamicElement)(tag, props);
81
+ }
82
+ function createElement(type, props, ...children) {
83
+ const p = { ...props };
84
+ if (children.length > 0) p.children = children.length === 1 ? children[0] : children;
85
+ return jsx(type, p);
86
+ }
87
+ function isValidElement(object) {
88
+ return typeof object === "object" && object !== null && "type" in object;
89
+ }
90
+ function cloneElement(element, props, ...children) {
91
+ return jsx(element.type, {
92
+ ...element.props,
93
+ ...props,
94
+ children: children.length ? children : element.props.children
95
+ });
96
+ }
97
+ function createRef(initialValue) {
98
+ return { current: initialValue || null };
99
+ }
100
+ function mergeProps(...sources) {
101
+ const target = {};
102
+ for (const source of sources) {
103
+ if (!source) continue;
104
+ const descriptors = Object.getOwnPropertyDescriptors(source);
105
+ Object.defineProperties(target, descriptors);
106
+ }
107
+ return target;
108
+ }
109
+ function forwardRef(fn) {
110
+ return (props) => fn(props, props.ref);
111
+ }
112
+ async function renderToString(element) {
113
+ throw new Error("renderToString should be imported from server module");
114
+ }
115
+
116
+ // src/lib/jsx-dev-runtime.ts
117
+ function jsxDEV(type, props, key, isStaticChildren, source, self) {
118
+ return jsx(type, props, key);
119
+ }
120
+
121
+ // src/lib/index.ts
122
+ var import_dom3 = require("@fluixi/dom");
123
+ var import_dom4 = require("@fluixi/dom");
124
+ var import_signal2 = require("@fluixi/reactive/signal");
125
+ function createReactiveJSX(config) {
126
+ (0, import_dom4.initializeIntegration)({
127
+ signalSystem: config.signalSystem
128
+ });
129
+ return {
130
+ jsx,
131
+ jsxs,
132
+ jsxDEV,
133
+ Fragment,
134
+ render: (element, container) => {
135
+ if (!container) return;
136
+ (0, import_signal2.batch)(() => {
137
+ while (container.firstChild) {
138
+ container.removeChild(container.firstChild);
139
+ }
140
+ if (element instanceof Node) {
141
+ container.appendChild(element);
142
+ } else if (Array.isArray(element)) {
143
+ element.forEach((el) => {
144
+ if (el instanceof Node) {
145
+ container.appendChild(el);
146
+ }
147
+ });
148
+ }
149
+ });
150
+ },
151
+ batch: import_signal2.batch
152
+ };
153
+ }
154
+ function jsxComponent(fn) {
155
+ return fn;
156
+ }
157
+ function defineComponent(name, fn) {
158
+ Object.defineProperty(fn, "name", { value: name });
159
+ return fn;
160
+ }
161
+ function memo(component, equals) {
162
+ let lastProps;
163
+ let lastResult;
164
+ return (props) => {
165
+ if (lastProps !== void 0) {
166
+ if (equals ? equals(lastProps, props) : shallowEqual(lastProps, props)) {
167
+ return lastResult;
168
+ }
169
+ }
170
+ lastProps = props;
171
+ lastResult = component(props);
172
+ return lastResult;
173
+ };
174
+ }
175
+ function shallowEqual(a, b) {
176
+ if (a === b) return true;
177
+ if (typeof a !== "object" || typeof b !== "object") return false;
178
+ if (a === null || b === null) return false;
179
+ const keysA = Object.keys(a);
180
+ const keysB = Object.keys(b);
181
+ if (keysA.length !== keysB.length) return false;
182
+ for (const key of keysA) {
183
+ if (a[key] !== b[key]) return false;
184
+ }
185
+ return true;
186
+ }
187
+ function hydrate(element, container) {
188
+ return (0, import_dom4.render)(element, container);
189
+ }
190
+ var index_default = {
191
+ jsx,
192
+ jsxs,
193
+ jsxDEV,
194
+ Fragment,
195
+ createElement,
196
+ createRef,
197
+ forwardRef,
198
+ isValidElement,
199
+ cloneElement,
200
+ renderToString,
201
+ createPortal: import_dom4.createPortal,
202
+ render: import_dom4.render,
203
+ hydrate,
204
+ memo,
205
+ jsxComponent,
206
+ defineComponent,
207
+ createReactiveJSX
208
+ };
@@ -0,0 +1,72 @@
1
+ /**
2
+ * @fileoverview Main entry point for @fluixi/jsx package
3
+ * @module @fluixi/jsx
4
+ *
5
+ * This package provides a comprehensive JSX runtime with:
6
+ * - Fine-grained reactive updates similar to SolidJS
7
+ * - Support for both `html` templates and native JSX
8
+ * - Seamless integration with signal and store systems
9
+ * - Optimized DOM updates with compilation support
10
+ */
11
+ export { jsx, jsxs, Fragment, createElement, createRef, forwardRef, isValidElement, cloneElement, renderToString, } from './jsx-runtime.js';
12
+ export { jsxDEV } from './jsx-dev-runtime.js';
13
+ export type { JSXElement, JSXComponent, JSXProps, RefCallback, RefObject, } from './jsx-runtime.js';
14
+ export { delegateEvents } from '@fluixi/dom';
15
+ export interface ReactiveJSXConfig {
16
+ signalSystem: any;
17
+ }
18
+ export interface ReactiveJSXAPI<Element = any> {
19
+ jsx: typeof jsx;
20
+ jsxs: typeof jsxs;
21
+ jsxDEV: typeof jsxDEV;
22
+ Fragment: typeof Fragment;
23
+ render: (element: any, container: Element) => void;
24
+ batch: (fn: () => void) => void;
25
+ }
26
+ import { jsxDEV } from './jsx-dev-runtime.js';
27
+ import { jsx, jsxs, Fragment, createElement, createRef, forwardRef, isValidElement, cloneElement, renderToString } from './jsx-runtime.js';
28
+ export { mergeProps } from './jsx-runtime.js';
29
+ import { createPortal, render } from '@fluixi/dom';
30
+ /**
31
+ * Create a reactive JSX API with custom configuration
32
+ * @deprecated Use direct imports instead
33
+ */
34
+ export declare function createReactiveJSX(config: ReactiveJSXConfig): ReactiveJSXAPI;
35
+ /**
36
+ * Helper to create JSX-compatible components
37
+ */
38
+ export declare function jsxComponent<P = any>(fn: (props: P) => JSX.Element): (props: P) => JSX.Element;
39
+ /**
40
+ * Helper to create JSX-compatible functional components with props validation
41
+ */
42
+ export declare function defineComponent<P = any>(name: string, fn: (props: P) => JSX.Element): (props: P) => JSX.Element;
43
+ /**
44
+ * Memo wrapper for components
45
+ */
46
+ export declare function memo<P = any>(component: (props: P) => JSX.Element, equals?: (prev: P, next: P) => boolean): (props: P) => JSX.Element;
47
+ /**
48
+ * Hydrate a server-rendered element
49
+ */
50
+ export declare function hydrate(element: JSX.Element, container: Element): () => void;
51
+ export type { JSX } from './jsx.d.js';
52
+ declare const _default: {
53
+ jsx: typeof jsx;
54
+ jsxs: typeof jsx;
55
+ jsxDEV: typeof jsxDEV;
56
+ Fragment: symbol;
57
+ createElement: typeof createElement;
58
+ createRef: typeof createRef;
59
+ forwardRef: typeof forwardRef;
60
+ isValidElement: typeof isValidElement;
61
+ cloneElement: typeof cloneElement;
62
+ renderToString: typeof renderToString;
63
+ createPortal: typeof createPortal;
64
+ render: typeof render;
65
+ hydrate: typeof hydrate;
66
+ memo: typeof memo;
67
+ jsxComponent: typeof jsxComponent;
68
+ defineComponent: typeof defineComponent;
69
+ createReactiveJSX: typeof createReactiveJSX;
70
+ };
71
+ export default _default;
72
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,OAAO,EAEL,GAAG,EACH,IAAI,EACJ,QAAQ,EAGR,aAAa,EACb,SAAS,EACT,UAAU,EACV,cAAc,EACd,YAAY,EAGZ,cAAc,GAGf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,YAAY,EACV,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,SAAS,GACV,MAAM,kBAAkB,CAAC;AAa1B,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,GAAG,CAAC;CACnB;AAED,MAAM,WAAW,cAAc,CAAC,OAAO,GAAG,GAAG;IAC3C,GAAG,EAAE,OAAO,GAAG,CAAC;IAChB,IAAI,EAAE,OAAO,IAAI,CAAC;IAClB,MAAM,EAAE,OAAO,MAAM,CAAC;IACtB,QAAQ,EAAE,OAAO,QAAQ,CAAC;IAC1B,MAAM,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACnD,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;CACjC;AAED,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EACL,GAAG,EACH,IAAI,EACJ,QAAQ,EACR,aAAa,EACb,SAAS,EACT,UAAU,EACV,cAAc,EACd,YAAY,EACZ,cAAc,EAEf,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAyB,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1E;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,cAAc,CAgC3E;AAMD;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,GAAG,GAAG,EAClC,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,GAAG,CAAC,OAAO,GAC5B,CAAC,KAAK,EAAE,CAAC,KAAK,GAAG,CAAC,OAAO,CAE3B;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,GAAG,GAAG,EACrC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,GAAG,CAAC,OAAO,GAC5B,CAAC,KAAK,EAAE,CAAC,KAAK,GAAG,CAAC,OAAO,CAG3B;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,GAAG,GAAG,EAC1B,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,GAAG,CAAC,OAAO,EACpC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,KAAK,OAAO,GACrC,CAAC,KAAK,EAAE,CAAC,KAAK,GAAG,CAAC,OAAO,CAe3B;AAuBD;;GAEG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,IAAI,CAG5E;AAMD,YAAY,EAAC,GAAG,EAAC,MAAM,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;AAMpC,wBAkBE"}
@@ -0,0 +1,158 @@
1
+ /**
2
+ * @fileoverview Main entry point for @fluixi/jsx package
3
+ * @module @fluixi/jsx
4
+ *
5
+ * This package provides a comprehensive JSX runtime with:
6
+ * - Fine-grained reactive updates similar to SolidJS
7
+ * - Support for both `html` templates and native JSX
8
+ * - Seamless integration with signal and store systems
9
+ * - Optimized DOM updates with compilation support
10
+ */
11
+ // ============================================================================
12
+ // Core JSX Runtime
13
+ // ============================================================================
14
+ export {
15
+ // JSX factory functions
16
+ jsx, jsxs, Fragment,
17
+ // Element creation
18
+ createElement, createRef, forwardRef, isValidElement, cloneElement,
19
+ // Rendering
20
+ renderToString,
21
+ // delegateEvents,
22
+ // handleRef,
23
+ } from './jsx-runtime.js';
24
+ export { jsxDEV } from './jsx-dev-runtime.js';
25
+ // ============================================================================
26
+ // Compiler Utilities
27
+ // ============================================================================
28
+ // Build-time compiler utilities live in @fluixi/compiler (Node.js only):
29
+ // import { createVitePlugin } from '@fluixi/compiler/integrations'
30
+ // ============================================================================
31
+ // Legacy API (for backward compatibility)
32
+ // ============================================================================
33
+ export { delegateEvents } from '@fluixi/dom';
34
+ import { jsxDEV } from './jsx-dev-runtime.js';
35
+ import { jsx, jsxs, Fragment, createElement, createRef, forwardRef, isValidElement, cloneElement, renderToString,
36
+ // createPortal,
37
+ } from './jsx-runtime.js';
38
+ export { mergeProps } from './jsx-runtime.js';
39
+ import { createPortal, initializeIntegration, render } from '@fluixi/dom';
40
+ import { batch } from '@fluixi/reactive/signal';
41
+ /**
42
+ * Create a reactive JSX API with custom configuration
43
+ * @deprecated Use direct imports instead
44
+ */
45
+ export function createReactiveJSX(config) {
46
+ // Initialize integration with signal system
47
+ initializeIntegration({
48
+ signalSystem: config.signalSystem,
49
+ });
50
+ return {
51
+ jsx,
52
+ jsxs,
53
+ jsxDEV,
54
+ Fragment,
55
+ render: (element, container) => {
56
+ if (!container)
57
+ return;
58
+ batch(() => {
59
+ while (container.firstChild) {
60
+ container.removeChild(container.firstChild);
61
+ }
62
+ if (element instanceof Node) {
63
+ container.appendChild(element);
64
+ }
65
+ else if (Array.isArray(element)) {
66
+ element.forEach((el) => {
67
+ if (el instanceof Node) {
68
+ container.appendChild(el);
69
+ }
70
+ });
71
+ }
72
+ });
73
+ },
74
+ batch,
75
+ };
76
+ }
77
+ // ============================================================================
78
+ // Component Helpers
79
+ // ============================================================================
80
+ /**
81
+ * Helper to create JSX-compatible components
82
+ */
83
+ export function jsxComponent(fn) {
84
+ return fn;
85
+ }
86
+ /**
87
+ * Helper to create JSX-compatible functional components with props validation
88
+ */
89
+ export function defineComponent(name, fn) {
90
+ Object.defineProperty(fn, 'name', { value: name });
91
+ return fn;
92
+ }
93
+ /**
94
+ * Memo wrapper for components
95
+ */
96
+ export function memo(component, equals) {
97
+ let lastProps;
98
+ let lastResult;
99
+ return (props) => {
100
+ if (lastProps !== undefined) {
101
+ if (equals ? equals(lastProps, props) : shallowEqual(lastProps, props)) {
102
+ return lastResult;
103
+ }
104
+ }
105
+ lastProps = props;
106
+ lastResult = component(props);
107
+ return lastResult;
108
+ };
109
+ }
110
+ function shallowEqual(a, b) {
111
+ if (a === b)
112
+ return true;
113
+ if (typeof a !== 'object' || typeof b !== 'object')
114
+ return false;
115
+ if (a === null || b === null)
116
+ return false;
117
+ const keysA = Object.keys(a);
118
+ const keysB = Object.keys(b);
119
+ if (keysA.length !== keysB.length)
120
+ return false;
121
+ for (const key of keysA) {
122
+ if (a[key] !== b[key])
123
+ return false;
124
+ }
125
+ return true;
126
+ }
127
+ // ============================================================================
128
+ // Render Function
129
+ // ============================================================================
130
+ /**
131
+ * Hydrate a server-rendered element
132
+ */
133
+ export function hydrate(element, container) {
134
+ // For now, just render (full hydration would be more complex)
135
+ return render(element, container);
136
+ }
137
+ // ============================================================================
138
+ // Default Export
139
+ // ============================================================================
140
+ export default {
141
+ jsx,
142
+ jsxs,
143
+ jsxDEV,
144
+ Fragment,
145
+ createElement: createElement,
146
+ createRef: createRef,
147
+ forwardRef: forwardRef,
148
+ isValidElement: isValidElement,
149
+ cloneElement: cloneElement,
150
+ renderToString: renderToString,
151
+ createPortal: createPortal,
152
+ render,
153
+ hydrate,
154
+ memo,
155
+ jsxComponent,
156
+ defineComponent,
157
+ createReactiveJSX,
158
+ };
@@ -0,0 +1,188 @@
1
+ // src/lib/jsx-runtime.ts
2
+ import {
3
+ asComponent,
4
+ checkRenderType
5
+ } from "@fluixi/dom";
6
+ import { createComponent, createDynamicElement } from "@fluixi/dom";
7
+ import { createSignal, createMemo } from "@fluixi/reactive/signal";
8
+ var Fragment = /* @__PURE__ */ Symbol.for("fluixi.fragment");
9
+ var isSSR = typeof window === "undefined";
10
+ function normalizeChildren(children) {
11
+ if (children === void 0 || children === null || children === false) return null;
12
+ if (Array.isArray(children)) {
13
+ return children.map(normalizeChildren).flat();
14
+ }
15
+ return children;
16
+ }
17
+ function jsx(type, props, key) {
18
+ if (type == null) return null;
19
+ const p = props || {};
20
+ if (key !== void 0) p.key = key;
21
+ if (type === Fragment) {
22
+ return createMemo(() => asComponent(normalizeChildren(p.children)));
23
+ }
24
+ if (typeof type === "function") {
25
+ const { type: renderType } = checkRenderType(type);
26
+ if (type.$$typeof === /* @__PURE__ */ Symbol.for("react.provider") || renderType === "provider") {
27
+ return type(p);
28
+ }
29
+ if (isSSR) return { type, props: p };
30
+ return createMemo(() => createComponent(type, p), void 0, { name: "jsx component" });
31
+ }
32
+ if (typeof type === "string" && type.trim().length > 0) {
33
+ return createNativeElement(type, p);
34
+ }
35
+ return null;
36
+ }
37
+ var jsxs = jsx;
38
+ function createNativeElement(tag, props) {
39
+ if (isSSR) return { type: tag, props: props || {} };
40
+ return createDynamicElement(tag, props);
41
+ }
42
+ function createElement(type, props, ...children) {
43
+ const p = { ...props };
44
+ if (children.length > 0) p.children = children.length === 1 ? children[0] : children;
45
+ return jsx(type, p);
46
+ }
47
+ function isValidElement(object) {
48
+ return typeof object === "object" && object !== null && "type" in object;
49
+ }
50
+ function cloneElement(element, props, ...children) {
51
+ return jsx(element.type, {
52
+ ...element.props,
53
+ ...props,
54
+ children: children.length ? children : element.props.children
55
+ });
56
+ }
57
+ function createRef(initialValue) {
58
+ return { current: initialValue || null };
59
+ }
60
+ function mergeProps(...sources) {
61
+ const target = {};
62
+ for (const source of sources) {
63
+ if (!source) continue;
64
+ const descriptors = Object.getOwnPropertyDescriptors(source);
65
+ Object.defineProperties(target, descriptors);
66
+ }
67
+ return target;
68
+ }
69
+ function forwardRef(fn) {
70
+ return (props) => fn(props, props.ref);
71
+ }
72
+ async function renderToString(element) {
73
+ throw new Error("renderToString should be imported from server module");
74
+ }
75
+
76
+ // src/lib/jsx-dev-runtime.ts
77
+ function jsxDEV(type, props, key, isStaticChildren, source, self) {
78
+ return jsx(type, props, key);
79
+ }
80
+
81
+ // src/lib/index.ts
82
+ import { delegateEvents as delegateEvents2 } from "@fluixi/dom";
83
+ import { createPortal, initializeIntegration, render } from "@fluixi/dom";
84
+ import { batch } from "@fluixi/reactive/signal";
85
+ function createReactiveJSX(config) {
86
+ initializeIntegration({
87
+ signalSystem: config.signalSystem
88
+ });
89
+ return {
90
+ jsx,
91
+ jsxs,
92
+ jsxDEV,
93
+ Fragment,
94
+ render: (element, container) => {
95
+ if (!container) return;
96
+ batch(() => {
97
+ while (container.firstChild) {
98
+ container.removeChild(container.firstChild);
99
+ }
100
+ if (element instanceof Node) {
101
+ container.appendChild(element);
102
+ } else if (Array.isArray(element)) {
103
+ element.forEach((el) => {
104
+ if (el instanceof Node) {
105
+ container.appendChild(el);
106
+ }
107
+ });
108
+ }
109
+ });
110
+ },
111
+ batch
112
+ };
113
+ }
114
+ function jsxComponent(fn) {
115
+ return fn;
116
+ }
117
+ function defineComponent(name, fn) {
118
+ Object.defineProperty(fn, "name", { value: name });
119
+ return fn;
120
+ }
121
+ function memo(component, equals) {
122
+ let lastProps;
123
+ let lastResult;
124
+ return (props) => {
125
+ if (lastProps !== void 0) {
126
+ if (equals ? equals(lastProps, props) : shallowEqual(lastProps, props)) {
127
+ return lastResult;
128
+ }
129
+ }
130
+ lastProps = props;
131
+ lastResult = component(props);
132
+ return lastResult;
133
+ };
134
+ }
135
+ function shallowEqual(a, b) {
136
+ if (a === b) return true;
137
+ if (typeof a !== "object" || typeof b !== "object") return false;
138
+ if (a === null || b === null) return false;
139
+ const keysA = Object.keys(a);
140
+ const keysB = Object.keys(b);
141
+ if (keysA.length !== keysB.length) return false;
142
+ for (const key of keysA) {
143
+ if (a[key] !== b[key]) return false;
144
+ }
145
+ return true;
146
+ }
147
+ function hydrate(element, container) {
148
+ return render(element, container);
149
+ }
150
+ var index_default = {
151
+ jsx,
152
+ jsxs,
153
+ jsxDEV,
154
+ Fragment,
155
+ createElement,
156
+ createRef,
157
+ forwardRef,
158
+ isValidElement,
159
+ cloneElement,
160
+ renderToString,
161
+ createPortal,
162
+ render,
163
+ hydrate,
164
+ memo,
165
+ jsxComponent,
166
+ defineComponent,
167
+ createReactiveJSX
168
+ };
169
+ export {
170
+ Fragment,
171
+ cloneElement,
172
+ createElement,
173
+ createReactiveJSX,
174
+ createRef,
175
+ index_default as default,
176
+ defineComponent,
177
+ delegateEvents2 as delegateEvents,
178
+ forwardRef,
179
+ hydrate,
180
+ isValidElement,
181
+ jsx,
182
+ jsxComponent,
183
+ jsxDEV,
184
+ jsxs,
185
+ memo,
186
+ mergeProps,
187
+ renderToString
188
+ };
@@ -0,0 +1,73 @@
1
+ /*! @fluixi/jsx v1.0.0-alpha.100 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
+ "use strict";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/lib/jsx-dev-runtime.ts
22
+ var jsx_dev_runtime_exports = {};
23
+ __export(jsx_dev_runtime_exports, {
24
+ Fragment: () => Fragment,
25
+ jsx: () => jsx,
26
+ jsxDEV: () => jsxDEV,
27
+ jsxs: () => jsxs
28
+ });
29
+ module.exports = __toCommonJS(jsx_dev_runtime_exports);
30
+
31
+ // src/lib/jsx-runtime.ts
32
+ var import_dom = require("@fluixi/dom");
33
+ var import_dom2 = require("@fluixi/dom");
34
+ var import_signal = require("@fluixi/reactive/signal");
35
+ var Fragment = /* @__PURE__ */ Symbol.for("fluixi.fragment");
36
+ var isSSR = typeof window === "undefined";
37
+ function normalizeChildren(children) {
38
+ if (children === void 0 || children === null || children === false) return null;
39
+ if (Array.isArray(children)) {
40
+ return children.map(normalizeChildren).flat();
41
+ }
42
+ return children;
43
+ }
44
+ function jsx(type, props, key) {
45
+ if (type == null) return null;
46
+ const p = props || {};
47
+ if (key !== void 0) p.key = key;
48
+ if (type === Fragment) {
49
+ return (0, import_signal.createMemo)(() => (0, import_dom.asComponent)(normalizeChildren(p.children)));
50
+ }
51
+ if (typeof type === "function") {
52
+ const { type: renderType } = (0, import_dom.checkRenderType)(type);
53
+ if (type.$$typeof === /* @__PURE__ */ Symbol.for("react.provider") || renderType === "provider") {
54
+ return type(p);
55
+ }
56
+ if (isSSR) return { type, props: p };
57
+ return (0, import_signal.createMemo)(() => (0, import_dom2.createComponent)(type, p), void 0, { name: "jsx component" });
58
+ }
59
+ if (typeof type === "string" && type.trim().length > 0) {
60
+ return createNativeElement(type, p);
61
+ }
62
+ return null;
63
+ }
64
+ var jsxs = jsx;
65
+ function createNativeElement(tag, props) {
66
+ if (isSSR) return { type: tag, props: props || {} };
67
+ return (0, import_dom2.createDynamicElement)(tag, props);
68
+ }
69
+
70
+ // src/lib/jsx-dev-runtime.ts
71
+ function jsxDEV(type, props, key, isStaticChildren, source, self) {
72
+ return jsx(type, props, key);
73
+ }