@fluixi/jsx 1.0.0-alpha.82 → 1.0.0-alpha.84

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.
@@ -1 +1,188 @@
1
- import{asComponent as P,checkRenderType as j}from"@fluixi/dom";import{createComponent as J,createDynamicElement as X}from"@fluixi/dom";import{createSignal as te,createMemo as y}from"@fluixi/reactive/signal";var i=Symbol.for("fluixi.fragment"),x=typeof window>"u";function S(e){return e==null||e===!1?null:Array.isArray(e)?e.map(S).flat():e}function s(e,t,n){if(e==null)return null;let r=t||{};if(n!==void 0&&(r.key=n),e===i)return y(()=>P(S(r.children)));if(typeof e=="function"){let{type:o}=j(e);return e.$$typeof===Symbol.for("react.provider")||o==="provider"?e(r):x?{type:e,props:r}:y(()=>J(e,r),void 0,{name:"jsx component"})}return typeof e=="string"&&e.trim().length>0?b(e,r):null}var a=s;function b(e,t){return x?{type:e,props:t||{}}:X(e,t)}function f(e,t,...n){let r={...t};return n.length>0&&(r.children=n.length===1?n[0]:n),s(e,r)}function p(e){return typeof e=="object"&&e!==null&&"type"in e}function c(e,t,...n){return s(e.type,{...e.props,...t,children:n.length?n:e.props.children})}function m(e){return{current:e||null}}function h(...e){let t={};for(let n of e){if(!n)continue;let r=Object.getOwnPropertyDescriptors(n);Object.defineProperties(t,r)}return t}function u(e){return t=>e(t,t.ref)}async function d(e){throw new Error("renderToString should be imported from server module")}function l(e,t,n,r,o,V){return s(e,t,n)}import{delegateEvents as Ee}from"@fluixi/dom";import{createPortal as v,initializeIntegration as T,render as E}from"@fluixi/dom";import{batch as g}from"@fluixi/reactive/signal";function R(e){return T({signalSystem:e.signalSystem}),{jsx:s,jsxs:a,jsxDEV:l,Fragment:i,render:(t,n)=>{n&&g(()=>{for(;n.firstChild;)n.removeChild(n.firstChild);t instanceof Node?n.appendChild(t):Array.isArray(t)&&t.forEach(r=>{r instanceof Node&&n.appendChild(r)})})},batch:g}}function C(e){return e}function k(e,t){return Object.defineProperty(t,"name",{value:e}),t}function w(e,t){let n,r;return o=>(n!==void 0&&(t?t(n,o):O(n,o))||(n=o,r=e(o)),r)}function O(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o of n)if(e[o]!==t[o])return!1;return!0}function D(e,t){return E(e,t)}var de={jsx:s,jsxs:a,jsxDEV:l,Fragment:i,createElement:f,createRef:m,forwardRef:u,isValidElement:p,cloneElement:c,renderToString:d,createPortal:v,render:E,hydrate:D,memo:w,jsxComponent:C,defineComponent:k,createReactiveJSX:R};export{i as Fragment,c as cloneElement,f as createElement,R as createReactiveJSX,m as createRef,de as default,k as defineComponent,Ee as delegateEvents,u as forwardRef,D as hydrate,p as isValidElement,s as jsx,C as jsxComponent,l as jsxDEV,a as jsxs,w as memo,h as mergeProps,d as renderToString};
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
+ };
@@ -1 +1,73 @@
1
- "use strict";var c=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var S=(e,n)=>{for(var r in n)c(e,r,{get:n[r],enumerable:!0})},x=(e,n,r,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of y(n))!g.call(e,o)&&o!==r&&c(e,o,{get:()=>n[o],enumerable:!(t=d(n,o))||t.enumerable});return e};var E=e=>x(c({},"__esModule",{value:!0}),e);var P={};S(P,{Fragment:()=>p,jsx:()=>l,jsxDEV:()=>b,jsxs:()=>m});module.exports=E(P);var i=require("@fluixi/dom"),a=require("@fluixi/dom"),s=require("@fluixi/reactive/signal"),p=Symbol.for("fluixi.fragment"),u=typeof window>"u";function f(e){return e==null||e===!1?null:Array.isArray(e)?e.map(f).flat():e}function l(e,n,r){if(e==null)return null;let t=n||{};if(r!==void 0&&(t.key=r),e===p)return(0,s.createMemo)(()=>(0,i.asComponent)(f(t.children)));if(typeof e=="function"){let{type:o}=(0,i.checkRenderType)(e);return e.$$typeof===Symbol.for("react.provider")||o==="provider"?e(t):u?{type:e,props:t}:(0,s.createMemo)(()=>(0,a.createComponent)(e,t),void 0,{name:"jsx component"})}return typeof e=="string"&&e.trim().length>0?T(e,t):null}var m=l;function T(e,n){return u?{type:e,props:n||{}}:(0,a.createDynamicElement)(e,n)}function b(e,n,r,t,o,J){return l(e,n,r)}
1
+ /*! @fluixi/jsx v1.0.0-alpha.84 | (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
+ }
@@ -1 +1,54 @@
1
- import{asComponent as p,checkRenderType as u}from"@fluixi/dom";import{createComponent as f,createDynamicElement as m}from"@fluixi/dom";import{createSignal as F,createMemo as i}from"@fluixi/reactive/signal";var a=Symbol.for("fluixi.fragment"),l=typeof window>"u";function c(e){return e==null||e===!1?null:Array.isArray(e)?e.map(c).flat():e}function o(e,t,r){if(e==null)return null;let n=t||{};if(r!==void 0&&(n.key=r),e===a)return i(()=>p(c(n.children)));if(typeof e=="function"){let{type:s}=u(e);return e.$$typeof===Symbol.for("react.provider")||s==="provider"?e(n):l?{type:e,props:n}:i(()=>f(e,n),void 0,{name:"jsx component"})}return typeof e=="string"&&e.trim().length>0?y(e,n):null}var d=o;function y(e,t){return l?{type:e,props:t||{}}:m(e,t)}function G(e,t,r,n,s,g){return o(e,t,r)}export{a as Fragment,o as jsx,G as jsxDEV,d as jsxs};
1
+ /*! @fluixi/jsx v1.0.0-alpha.84 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
+
3
+ // src/lib/jsx-runtime.ts
4
+ import {
5
+ asComponent,
6
+ checkRenderType
7
+ } from "@fluixi/dom";
8
+ import { createComponent, createDynamicElement } from "@fluixi/dom";
9
+ import { createSignal, createMemo } from "@fluixi/reactive/signal";
10
+ var Fragment = /* @__PURE__ */ Symbol.for("fluixi.fragment");
11
+ var isSSR = typeof window === "undefined";
12
+ function normalizeChildren(children) {
13
+ if (children === void 0 || children === null || children === false) return null;
14
+ if (Array.isArray(children)) {
15
+ return children.map(normalizeChildren).flat();
16
+ }
17
+ return children;
18
+ }
19
+ function jsx(type, props, key) {
20
+ if (type == null) return null;
21
+ const p = props || {};
22
+ if (key !== void 0) p.key = key;
23
+ if (type === Fragment) {
24
+ return createMemo(() => asComponent(normalizeChildren(p.children)));
25
+ }
26
+ if (typeof type === "function") {
27
+ const { type: renderType } = checkRenderType(type);
28
+ if (type.$$typeof === /* @__PURE__ */ Symbol.for("react.provider") || renderType === "provider") {
29
+ return type(p);
30
+ }
31
+ if (isSSR) return { type, props: p };
32
+ return createMemo(() => createComponent(type, p), void 0, { name: "jsx component" });
33
+ }
34
+ if (typeof type === "string" && type.trim().length > 0) {
35
+ return createNativeElement(type, p);
36
+ }
37
+ return null;
38
+ }
39
+ var jsxs = jsx;
40
+ function createNativeElement(tag, props) {
41
+ if (isSSR) return { type: tag, props: props || {} };
42
+ return createDynamicElement(tag, props);
43
+ }
44
+
45
+ // src/lib/jsx-dev-runtime.ts
46
+ function jsxDEV(type, props, key, isStaticChildren, source, self) {
47
+ return jsx(type, props, key);
48
+ }
49
+ export {
50
+ Fragment,
51
+ jsx,
52
+ jsxDEV,
53
+ jsxs
54
+ };
@@ -1 +1,138 @@
1
- "use strict";var f=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var S=(e,n)=>{for(var t in n)f(e,t,{get:n[t],enumerable:!0})},T=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of g(n))!x.call(e,o)&&o!==t&&f(e,o,{get:()=>n[o],enumerable:!(r=m(n,o))||r.enumerable});return e};var E=e=>T(f({},"__esModule",{value:!0}),e);var K={};S(K,{Fragment:()=>p,cloneElement:()=>k,createElement:()=>X,createRef:()=>v,delegatedSet:()=>b,forwardRef:()=>C,isValidElement:()=>R,jsx:()=>a,jsxDEV:()=>j,jsxs:()=>P,mergeProps:()=>w,renderToString:()=>D,splitProps:()=>h,useRef:()=>O});module.exports=E(K);var l=require("@fluixi/dom"),u=require("@fluixi/dom"),i=require("@fluixi/reactive/signal"),p=Symbol.for("fluixi.fragment"),d=typeof window>"u",b=new Set;function y(e){return e==null||e===!1?null:Array.isArray(e)?e.map(y).flat():e}function a(e,n,t){if(e==null)return null;let r=n||{};if(t!==void 0&&(r.key=t),e===p)return(0,i.createMemo)(()=>(0,l.asComponent)(y(r.children)));if(typeof e=="function"){let{type:o}=(0,l.checkRenderType)(e);return e.$$typeof===Symbol.for("react.provider")||o==="provider"?e(r):d?{type:e,props:r}:(0,i.createMemo)(()=>(0,u.createComponent)(e,r),void 0,{name:"jsx component"})}return typeof e=="string"&&e.trim().length>0?J(e,r):null}var P=a;function j(e,n,t,r){return a(e,n,t)}function J(e,n){return d?{type:e,props:n||{}}:(0,u.createDynamicElement)(e,n)}function X(e,n,...t){let r={...n};return t.length>0&&(r.children=t.length===1?t[0]:t),a(e,r)}function R(e){return typeof e=="object"&&e!==null&&"type"in e}function k(e,n,...t){return a(e.type,{...e.props,...n,children:t.length?t:e.props.children})}function v(e){return{current:e||null}}function O(e){let[n,t]=(0,i.createSignal)(e??null);return{get current(){return n()},set current(r){t(r)}}}function w(...e){let n={};for(let t of e){if(!t)continue;let r=Object.getOwnPropertyDescriptors(t);Object.defineProperties(n,r)}return n}function h(e,n){let t={},r={},o=new Set(n),c=Object.getOwnPropertyDescriptors(e);for(let s in c)o.has(s)?Object.defineProperty(t,s,c[s]):Object.defineProperty(r,s,c[s]);return[t,r]}function C(e){return n=>e(n,n.ref)}async function D(e){throw new Error("renderToString should be imported from server module")}
1
+ /*! @fluixi/jsx v1.0.0-alpha.84 | (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-runtime.ts
22
+ var jsx_runtime_exports = {};
23
+ __export(jsx_runtime_exports, {
24
+ Fragment: () => Fragment,
25
+ cloneElement: () => cloneElement,
26
+ createElement: () => createElement,
27
+ createRef: () => createRef,
28
+ delegatedSet: () => globalDelegatedSet,
29
+ forwardRef: () => forwardRef,
30
+ isValidElement: () => isValidElement,
31
+ jsx: () => jsx,
32
+ jsxDEV: () => jsxDEV,
33
+ jsxs: () => jsxs,
34
+ mergeProps: () => mergeProps,
35
+ renderToString: () => renderToString,
36
+ splitProps: () => splitProps,
37
+ useRef: () => useRef
38
+ });
39
+ module.exports = __toCommonJS(jsx_runtime_exports);
40
+ var import_dom = require("@fluixi/dom");
41
+ var import_dom2 = require("@fluixi/dom");
42
+ var import_signal = require("@fluixi/reactive/signal");
43
+ var Fragment = /* @__PURE__ */ Symbol.for("fluixi.fragment");
44
+ var isSSR = typeof window === "undefined";
45
+ var globalDelegatedSet = /* @__PURE__ */ new Set();
46
+ function normalizeChildren(children) {
47
+ if (children === void 0 || children === null || children === false) return null;
48
+ if (Array.isArray(children)) {
49
+ return children.map(normalizeChildren).flat();
50
+ }
51
+ return children;
52
+ }
53
+ function jsx(type, props, key) {
54
+ if (type == null) return null;
55
+ const p = props || {};
56
+ if (key !== void 0) p.key = key;
57
+ if (type === Fragment) {
58
+ return (0, import_signal.createMemo)(() => (0, import_dom.asComponent)(normalizeChildren(p.children)));
59
+ }
60
+ if (typeof type === "function") {
61
+ const { type: renderType } = (0, import_dom.checkRenderType)(type);
62
+ if (type.$$typeof === /* @__PURE__ */ Symbol.for("react.provider") || renderType === "provider") {
63
+ return type(p);
64
+ }
65
+ if (isSSR) return { type, props: p };
66
+ return (0, import_signal.createMemo)(() => (0, import_dom2.createComponent)(type, p), void 0, { name: "jsx component" });
67
+ }
68
+ if (typeof type === "string" && type.trim().length > 0) {
69
+ return createNativeElement(type, p);
70
+ }
71
+ return null;
72
+ }
73
+ var jsxs = jsx;
74
+ function jsxDEV(type, props, key, _isStaticChildren) {
75
+ return jsx(type, props, key);
76
+ }
77
+ function createNativeElement(tag, props) {
78
+ if (isSSR) return { type: tag, props: props || {} };
79
+ return (0, import_dom2.createDynamicElement)(tag, props);
80
+ }
81
+ function createElement(type, props, ...children) {
82
+ const p = { ...props };
83
+ if (children.length > 0) p.children = children.length === 1 ? children[0] : children;
84
+ return jsx(type, p);
85
+ }
86
+ function isValidElement(object) {
87
+ return typeof object === "object" && object !== null && "type" in object;
88
+ }
89
+ function cloneElement(element, props, ...children) {
90
+ return jsx(element.type, {
91
+ ...element.props,
92
+ ...props,
93
+ children: children.length ? children : element.props.children
94
+ });
95
+ }
96
+ function createRef(initialValue) {
97
+ return { current: initialValue || null };
98
+ }
99
+ function useRef(initialValue) {
100
+ const [get, set] = (0, import_signal.createSignal)(initialValue ?? null);
101
+ return {
102
+ get current() {
103
+ return get();
104
+ },
105
+ set current(v) {
106
+ set(v);
107
+ }
108
+ };
109
+ }
110
+ function mergeProps(...sources) {
111
+ const target = {};
112
+ for (const source of sources) {
113
+ if (!source) continue;
114
+ const descriptors = Object.getOwnPropertyDescriptors(source);
115
+ Object.defineProperties(target, descriptors);
116
+ }
117
+ return target;
118
+ }
119
+ function splitProps(props, keys) {
120
+ const picked = {};
121
+ const rest = {};
122
+ const keySet = new Set(keys);
123
+ const descriptors = Object.getOwnPropertyDescriptors(props);
124
+ for (const key in descriptors) {
125
+ if (keySet.has(key)) {
126
+ Object.defineProperty(picked, key, descriptors[key]);
127
+ } else {
128
+ Object.defineProperty(rest, key, descriptors[key]);
129
+ }
130
+ }
131
+ return [picked, rest];
132
+ }
133
+ function forwardRef(fn) {
134
+ return (props) => fn(props, props.ref);
135
+ }
136
+ async function renderToString(element) {
137
+ throw new Error("renderToString should be imported from server module");
138
+ }
@@ -1 +1,121 @@
1
- import{asComponent as f,checkRenderType as p}from"@fluixi/dom";import{createComponent as d,createDynamicElement as y}from"@fluixi/dom";import{createSignal as m,createMemo as l}from"@fluixi/reactive/signal";var g=Symbol.for("fluixi.fragment"),u=typeof window>"u",$=new Set;function c(e){return e==null||e===!1?null:Array.isArray(e)?e.map(c).flat():e}function s(e,n,t){if(e==null)return null;let r=n||{};if(t!==void 0&&(r.key=t),e===g)return l(()=>f(c(r.children)));if(typeof e=="function"){let{type:i}=p(e);return e.$$typeof===Symbol.for("react.provider")||i==="provider"?e(r):u?{type:e,props:r}:l(()=>d(e,r),void 0,{name:"jsx component"})}return typeof e=="string"&&e.trim().length>0?x(e,r):null}var z=s;function G(e,n,t,r){return s(e,n,t)}function x(e,n){return u?{type:e,props:n||{}}:y(e,n)}function M(e,n,...t){let r={...n};return t.length>0&&(r.children=t.length===1?t[0]:t),s(e,r)}function _(e){return typeof e=="object"&&e!==null&&"type"in e}function q(e,n,...t){return s(e.type,{...e.props,...n,children:t.length?t:e.props.children})}function B(e){return{current:e||null}}function H(e){let[n,t]=m(e??null);return{get current(){return n()},set current(r){t(r)}}}function I(...e){let n={};for(let t of e){if(!t)continue;let r=Object.getOwnPropertyDescriptors(t);Object.defineProperties(n,r)}return n}function Q(e,n){let t={},r={},i=new Set(n),a=Object.getOwnPropertyDescriptors(e);for(let o in a)i.has(o)?Object.defineProperty(t,o,a[o]):Object.defineProperty(r,o,a[o]);return[t,r]}function U(e){return n=>e(n,n.ref)}async function W(e){throw new Error("renderToString should be imported from server module")}export{g as Fragment,q as cloneElement,M as createElement,B as createRef,$ as delegatedSet,U as forwardRef,_ as isValidElement,s as jsx,G as jsxDEV,z as jsxs,I as mergeProps,W as renderToString,Q as splitProps,H as useRef};
1
+ /*! @fluixi/jsx v1.0.0-alpha.84 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
+
3
+ // src/lib/jsx-runtime.ts
4
+ import {
5
+ asComponent,
6
+ checkRenderType
7
+ } from "@fluixi/dom";
8
+ import { createComponent, createDynamicElement } from "@fluixi/dom";
9
+ import { createSignal, createMemo } from "@fluixi/reactive/signal";
10
+ var Fragment = /* @__PURE__ */ Symbol.for("fluixi.fragment");
11
+ var isSSR = typeof window === "undefined";
12
+ var globalDelegatedSet = /* @__PURE__ */ new Set();
13
+ function normalizeChildren(children) {
14
+ if (children === void 0 || children === null || children === false) return null;
15
+ if (Array.isArray(children)) {
16
+ return children.map(normalizeChildren).flat();
17
+ }
18
+ return children;
19
+ }
20
+ function jsx(type, props, key) {
21
+ if (type == null) return null;
22
+ const p = props || {};
23
+ if (key !== void 0) p.key = key;
24
+ if (type === Fragment) {
25
+ return createMemo(() => asComponent(normalizeChildren(p.children)));
26
+ }
27
+ if (typeof type === "function") {
28
+ const { type: renderType } = checkRenderType(type);
29
+ if (type.$$typeof === /* @__PURE__ */ Symbol.for("react.provider") || renderType === "provider") {
30
+ return type(p);
31
+ }
32
+ if (isSSR) return { type, props: p };
33
+ return createMemo(() => createComponent(type, p), void 0, { name: "jsx component" });
34
+ }
35
+ if (typeof type === "string" && type.trim().length > 0) {
36
+ return createNativeElement(type, p);
37
+ }
38
+ return null;
39
+ }
40
+ var jsxs = jsx;
41
+ function jsxDEV(type, props, key, _isStaticChildren) {
42
+ return jsx(type, props, key);
43
+ }
44
+ function createNativeElement(tag, props) {
45
+ if (isSSR) return { type: tag, props: props || {} };
46
+ return createDynamicElement(tag, props);
47
+ }
48
+ function createElement(type, props, ...children) {
49
+ const p = { ...props };
50
+ if (children.length > 0) p.children = children.length === 1 ? children[0] : children;
51
+ return jsx(type, p);
52
+ }
53
+ function isValidElement(object) {
54
+ return typeof object === "object" && object !== null && "type" in object;
55
+ }
56
+ function cloneElement(element, props, ...children) {
57
+ return jsx(element.type, {
58
+ ...element.props,
59
+ ...props,
60
+ children: children.length ? children : element.props.children
61
+ });
62
+ }
63
+ function createRef(initialValue) {
64
+ return { current: initialValue || null };
65
+ }
66
+ function useRef(initialValue) {
67
+ const [get, set] = createSignal(initialValue ?? null);
68
+ return {
69
+ get current() {
70
+ return get();
71
+ },
72
+ set current(v) {
73
+ set(v);
74
+ }
75
+ };
76
+ }
77
+ function mergeProps(...sources) {
78
+ const target = {};
79
+ for (const source of sources) {
80
+ if (!source) continue;
81
+ const descriptors = Object.getOwnPropertyDescriptors(source);
82
+ Object.defineProperties(target, descriptors);
83
+ }
84
+ return target;
85
+ }
86
+ function splitProps(props, keys) {
87
+ const picked = {};
88
+ const rest = {};
89
+ const keySet = new Set(keys);
90
+ const descriptors = Object.getOwnPropertyDescriptors(props);
91
+ for (const key in descriptors) {
92
+ if (keySet.has(key)) {
93
+ Object.defineProperty(picked, key, descriptors[key]);
94
+ } else {
95
+ Object.defineProperty(rest, key, descriptors[key]);
96
+ }
97
+ }
98
+ return [picked, rest];
99
+ }
100
+ function forwardRef(fn) {
101
+ return (props) => fn(props, props.ref);
102
+ }
103
+ async function renderToString(element) {
104
+ throw new Error("renderToString should be imported from server module");
105
+ }
106
+ export {
107
+ Fragment,
108
+ cloneElement,
109
+ createElement,
110
+ createRef,
111
+ globalDelegatedSet as delegatedSet,
112
+ forwardRef,
113
+ isValidElement,
114
+ jsx,
115
+ jsxDEV,
116
+ jsxs,
117
+ mergeProps,
118
+ renderToString,
119
+ splitProps,
120
+ useRef
121
+ };
package/dist/lib/jsx.d.ts CHANGED
@@ -87,9 +87,10 @@ export namespace JSX {
87
87
  // ============================================================================
88
88
 
89
89
  export interface IntrinsicElements extends A.IntrinsicElements {}
90
- interface ElementChildrenAttribute {
91
- children: {};
92
- }
90
+
91
+ export interface ElementChildrenAttribute {
92
+ children: {};
93
+ }
93
94
  }
94
95
 
95
96
 
@@ -118,15 +119,20 @@ declare global {
118
119
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
119
120
  interface FluixiElements {}
120
121
 
122
+ // Each name declared once, off the element types themselves.
123
+ //
124
+ // These used to be a type alias and an interface of the same name, where the interface
125
+ // extended `JSX.X` — which inside `declare global { namespace JSX }` is the name being
126
+ // declared. Extending itself makes it empty, so `JSX.IntrinsicElements` had no elements in
127
+ // it and every `<div>` in an application was "Property 'div' does not exist".
128
+ //
129
+ // `Element` stays an alias, and exactly what the dom can insert: a node, a string, a list,
130
+ // a function returning one. An interface cannot extend that union, and widening it — even
131
+ // by one member — makes `<b/>` unassignable to a `children` typed ComponentChild, which is
132
+ // the error every nested element produced.
121
133
  namespace JSX {
122
- type Element = import('./jsx.d').JSX.Element;
123
- type IntrinsicElements = import('./jsx.d').JSX.IntrinsicElements;
124
- interface Element extends JSX.Element, FluixiElements {
125
- strings?: TemplateStringsArray;
126
- values?: readonly unknown[];
127
- _$litType$?: number;
128
- }
129
- interface IntrinsicElements extends JSX.IntrinsicElements, FluixiElements {}
134
+ type Element = A.FxElement;
135
+ interface IntrinsicElements extends A.IntrinsicElements, FluixiElements {}
130
136
  interface ElementChildrenAttribute {
131
137
  children: {};
132
138
  }