@fluixi/core 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.
- package/dist/cdn/core.global.js +2 -1
- package/dist/cli/generate.cjs +4117 -292
- package/dist/cli/generate.mjs +4122 -292
- package/dist/cli/index.cjs +4117 -292
- package/dist/cli/index.mjs +4122 -292
- package/dist/cli/run.cjs +63 -1
- package/dist/cli/run.mjs +39 -1
- package/dist/src/cdn/chunk-VNLCQBFQ.mjs +747 -0
- package/dist/src/cdn/core.cjs +1279 -1
- package/dist/src/cdn/core.d.ts +3 -3
- package/dist/src/cdn/core.js +3 -3
- package/dist/src/cdn/core.mjs +642 -1
- package/dist/src/cdn/router-WMN2AA7E.mjs +66 -0
- package/dist/src/index.cjs +1201 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -11
- package/dist/src/index.mjs +1313 -1
- package/dist/src/jsx-dev-runtime.cjs +26 -1
- package/dist/src/jsx-dev-runtime.mjs +24 -1
- package/dist/src/jsx-runtime.cjs +26 -1
- package/dist/src/jsx-runtime.js +0 -9
- package/dist/src/jsx-runtime.mjs +24 -1
- package/dist/src/lib/client/chunk-2C2KDDQV.mjs +133 -0
- package/dist/src/lib/client/index.cjs +870 -1
- package/dist/src/lib/client/index.d.ts +10 -14
- package/dist/src/lib/client/index.d.ts.map +1 -1
- package/dist/src/lib/client/index.js +36 -21
- package/dist/src/lib/client/index.mjs +222 -1
- package/dist/src/lib/client/router-X526HSWQ.mjs +548 -0
- package/dist/src/lib/context/context.cjs +118 -1
- package/dist/src/lib/context/context.d.ts +20 -38
- package/dist/src/lib/context/context.d.ts.map +1 -1
- package/dist/src/lib/context/context.js +10 -47
- package/dist/src/lib/context/context.mjs +99 -1
- package/dist/src/lib/context/index.cjs +120 -1
- package/dist/src/lib/context/index.mjs +99 -1
- package/dist/src/lib/control-flow.cjs +35 -1
- package/dist/src/lib/control-flow.mjs +25 -1
- package/dist/src/lib/core.cjs +1200 -1
- package/dist/src/lib/core.d.ts +0 -2
- package/dist/src/lib/core.d.ts.map +1 -1
- package/dist/src/lib/core.js +14 -48
- package/dist/src/lib/core.mjs +1313 -1
- package/dist/src/lib/env/index.cjs +60 -1
- package/dist/src/lib/env/index.d.ts +7 -8
- package/dist/src/lib/env/index.d.ts.map +1 -1
- package/dist/src/lib/env/index.js +14 -9
- package/dist/src/lib/env/index.mjs +39 -1
- package/dist/src/lib/i18n/index.cjs +108 -1
- package/dist/src/lib/i18n/index.d.ts +31 -10
- package/dist/src/lib/i18n/index.d.ts.map +1 -1
- package/dist/src/lib/i18n/index.js +31 -10
- package/dist/src/lib/i18n/index.mjs +88 -1
- package/dist/src/lib/index.cjs +633 -1
- package/dist/src/lib/index.d.ts +0 -2
- package/dist/src/lib/index.d.ts.map +1 -1
- package/dist/src/lib/index.js +5 -11
- package/dist/src/lib/index.mjs +721 -1
- package/dist/src/lib/isomorphic.cjs +85 -1
- package/dist/src/lib/isomorphic.d.ts +41 -8
- package/dist/src/lib/isomorphic.d.ts.map +1 -1
- package/dist/src/lib/isomorphic.js +38 -5
- package/dist/src/lib/isomorphic.mjs +64 -1
- package/dist/src/lib/jsx-runtime/index.cjs +21 -1
- package/dist/src/lib/jsx-runtime/index.d.ts +1 -1
- package/dist/src/lib/jsx-runtime/index.js +1 -11
- package/dist/src/lib/jsx-runtime/index.mjs +4 -1
- package/dist/src/lib/jsx-runtime/jsx-dev-runtime.cjs +21 -1
- package/dist/src/lib/jsx-runtime/jsx-dev-runtime.mjs +4 -1
- package/dist/src/lib/plugins/fluixi-routes-plugin.cjs +302 -8
- package/dist/src/lib/plugins/fluixi-routes-plugin.d.ts +15 -1
- package/dist/src/lib/plugins/fluixi-routes-plugin.d.ts.map +1 -1
- package/dist/src/lib/plugins/fluixi-routes-plugin.js +19 -5
- package/dist/src/lib/plugins/fluixi-routes-plugin.mjs +271 -8
- package/dist/src/lib/plugins/index.cjs +311 -8
- package/dist/src/lib/plugins/index.mjs +279 -8
- package/dist/src/lib/plugins/route-codegen.cjs +73 -8
- package/dist/src/lib/plugins/route-codegen.d.ts +0 -1
- package/dist/src/lib/plugins/route-codegen.d.ts.map +1 -1
- package/dist/src/lib/plugins/route-codegen.js +4 -5
- package/dist/src/lib/plugins/route-codegen.mjs +52 -8
- package/dist/src/lib/plugins/route-scanner.cjs +189 -1
- package/dist/src/lib/plugins/route-scanner.d.ts +1 -2
- package/dist/src/lib/plugins/route-scanner.d.ts.map +1 -1
- package/dist/src/lib/plugins/route-scanner.js +7 -8
- package/dist/src/lib/plugins/route-scanner.mjs +158 -1
- package/dist/src/lib/plugins/vite.cjs +27 -1
- package/dist/src/lib/plugins/vite.mjs +6 -1
- package/dist/src/lib/render/await.cjs +38 -1
- package/dist/src/lib/render/await.d.ts +18 -0
- package/dist/src/lib/render/await.d.ts.map +1 -1
- package/dist/src/lib/render/await.js +20 -2
- package/dist/src/lib/render/await.mjs +17 -1
- package/dist/src/lib/render/component.cjs +221 -1
- package/dist/src/lib/render/component.d.ts +3 -44
- package/dist/src/lib/render/component.d.ts.map +1 -1
- package/dist/src/lib/render/component.js +32 -59
- package/dist/src/lib/render/component.mjs +214 -1
- package/dist/src/lib/render/deferred.cjs +175 -1
- package/dist/src/lib/render/deferred.d.ts.map +1 -1
- package/dist/src/lib/render/deferred.js +8 -8
- package/dist/src/lib/render/deferred.mjs +158 -1
- package/dist/src/lib/render/index.cjs +573 -1
- package/dist/src/lib/render/index.d.ts +3 -17
- package/dist/src/lib/render/index.d.ts.map +1 -1
- package/dist/src/lib/render/index.js +12 -26
- package/dist/src/lib/render/index.mjs +590 -1
- package/dist/src/lib/render/lazy.cjs +67 -1
- package/dist/src/lib/render/lazy.d.ts +22 -1
- package/dist/src/lib/render/lazy.d.ts.map +1 -1
- package/dist/src/lib/render/lazy.js +47 -8
- package/dist/src/lib/render/lazy.mjs +50 -1
- package/dist/src/lib/render/suspense.cjs +141 -1
- package/dist/src/lib/render/suspense.d.ts +40 -0
- package/dist/src/lib/render/suspense.d.ts.map +1 -1
- package/dist/src/lib/render/suspense.js +47 -7
- package/dist/src/lib/render/suspense.mjs +136 -1
- package/dist/src/lib/render/versions.cjs +35 -1
- package/dist/src/lib/render/versions.js +6 -6
- package/dist/src/lib/render/versions.mjs +14 -1
- package/dist/src/lib/router/data.cjs +230 -1
- package/dist/src/lib/router/data.d.ts +1 -13
- package/dist/src/lib/router/data.d.ts.map +1 -1
- package/dist/src/lib/router/data.js +1 -13
- package/dist/src/lib/router/data.mjs +214 -1
- package/dist/src/lib/router/index.cjs +627 -1
- package/dist/src/lib/router/index.d.ts +62 -10
- package/dist/src/lib/router/index.d.ts.map +1 -1
- package/dist/src/lib/router/index.js +90 -39
- package/dist/src/lib/router/index.mjs +639 -1
- package/dist/src/lib/server/hydration.cjs +169 -1
- package/dist/src/lib/server/hydration.d.ts +15 -55
- package/dist/src/lib/server/hydration.d.ts.map +1 -1
- package/dist/src/lib/server/hydration.js +23 -62
- package/dist/src/lib/server/hydration.mjs +148 -1
- package/dist/src/lib/server/index.cjs +401 -11
- package/dist/src/lib/server/index.d.ts +30 -6
- package/dist/src/lib/server/index.d.ts.map +1 -1
- package/dist/src/lib/server/index.js +34 -11
- package/dist/src/lib/server/index.mjs +379 -11
- package/dist/src/lib/server/reactive.cjs +197 -1
- package/dist/src/lib/server/reactive.d.ts +18 -77
- package/dist/src/lib/server/reactive.d.ts.map +1 -1
- package/dist/src/lib/server/reactive.js +19 -78
- package/dist/src/lib/server/reactive.mjs +176 -1
- package/dist/src/lib/theme/index.cjs +110 -1
- package/dist/src/lib/theme/index.d.ts +19 -4
- package/dist/src/lib/theme/index.d.ts.map +1 -1
- package/dist/src/lib/theme/index.js +17 -2
- package/dist/src/lib/theme/index.mjs +89 -1
- package/dist/src/lib/utils/index.cjs +209 -1
- package/dist/src/lib/utils/index.d.ts +0 -93
- package/dist/src/lib/utils/index.d.ts.map +1 -1
- package/dist/src/lib/utils/index.js +0 -93
- package/dist/src/lib/utils/index.mjs +188 -1
- package/dist/src/routes.cjs +37 -1
- package/dist/src/routes.d.ts +1 -1
- package/dist/src/routes.js +2 -2
- package/dist/src/routes.mjs +17 -1
- package/dist/src/server.cjs +400 -11
- package/dist/src/server.d.ts +0 -1
- package/dist/src/server.d.ts.map +1 -1
- package/dist/src/server.js +0 -1
- package/dist/src/server.mjs +377 -11
- package/dist/src/utils.cjs +21 -1
- package/dist/src/utils.d.ts +1 -1
- package/dist/src/utils.js +1 -1
- package/dist/src/utils.mjs +4 -1
- package/dist/src/version.generated.cjs +26 -1
- package/dist/src/version.generated.d.ts +1 -1
- package/dist/src/version.generated.js +2 -2
- package/dist/src/version.generated.mjs +5 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +17 -16
- package/src/index.ts +2 -14
- package/dist/src/cdn/chunk-RN7C7HNS.mjs +0 -1
- package/dist/src/cdn/router-QB3W43UQ.mjs +0 -1
- package/dist/src/lib/client/chunk-FT22BLCQ.mjs +0 -1
- package/dist/src/lib/client/router-IH7JYMRU.mjs +0 -1
package/dist/src/cdn/core.d.ts
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* const [count, setCount] = Fluixi.createSignal(0);
|
|
6
6
|
* Fluixi.startClient(App); // or Fluixi.mount(App, root)
|
|
7
7
|
*
|
|
8
|
-
* Self-contained: the whole client runtime
|
|
8
|
+
* Self-contained: the whole client runtime: reactive (createSignal/createMemo/...),
|
|
9
9
|
* components + lifecycle, control flow (Show/For/Switch/Suspense), the router, and
|
|
10
|
-
* the client bootstrap (startClient/mount/hydrate)
|
|
11
|
-
* Server/compiler/vite tooling is
|
|
10
|
+
* the client bootstrap (startClient/mount/hydrate): bundled into one <script>.
|
|
11
|
+
* Server/compiler/vite tooling is not included (it isn't part of the browser runtime).
|
|
12
12
|
*/
|
|
13
13
|
export * from '../lib/index.js';
|
|
14
14
|
export { startClient, mount } from '../lib/client/index.js';
|
package/dist/src/cdn/core.js
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* const [count, setCount] = Fluixi.createSignal(0);
|
|
6
6
|
* Fluixi.startClient(App); // or Fluixi.mount(App, root)
|
|
7
7
|
*
|
|
8
|
-
* Self-contained: the whole client runtime
|
|
8
|
+
* Self-contained: the whole client runtime: reactive (createSignal/createMemo/...),
|
|
9
9
|
* components + lifecycle, control flow (Show/For/Switch/Suspense), the router, and
|
|
10
|
-
* the client bootstrap (startClient/mount/hydrate)
|
|
11
|
-
* Server/compiler/vite tooling is
|
|
10
|
+
* the client bootstrap (startClient/mount/hydrate): bundled into one <script>.
|
|
11
|
+
* Server/compiler/vite tooling is not included (it isn't part of the browser runtime).
|
|
12
12
|
*/
|
|
13
13
|
export * from '../lib/index.js';
|
|
14
14
|
export { startClient, mount } from '../lib/client/index.js';
|
package/dist/src/cdn/core.mjs
CHANGED
|
@@ -1 +1,642 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
A,
|
|
3
|
+
Link,
|
|
4
|
+
Outlet,
|
|
5
|
+
Redirect,
|
|
6
|
+
Router,
|
|
7
|
+
__reExport,
|
|
8
|
+
cleanupHydration,
|
|
9
|
+
composeProviders,
|
|
10
|
+
createBrowserHistory,
|
|
11
|
+
createConsumer,
|
|
12
|
+
createContext,
|
|
13
|
+
createContextWithProvider,
|
|
14
|
+
createMemoryHistory,
|
|
15
|
+
createProvider,
|
|
16
|
+
deserializeHydrationData,
|
|
17
|
+
lazy,
|
|
18
|
+
setHydrating,
|
|
19
|
+
useContext,
|
|
20
|
+
useLocation,
|
|
21
|
+
useMatch,
|
|
22
|
+
useNavigate,
|
|
23
|
+
useParam,
|
|
24
|
+
useParams,
|
|
25
|
+
useProvide,
|
|
26
|
+
useRouter,
|
|
27
|
+
useSearchParams
|
|
28
|
+
} from "./chunk-VNLCQBFQ.mjs";
|
|
29
|
+
|
|
30
|
+
// src/lib/index.ts
|
|
31
|
+
import {
|
|
32
|
+
createEffect as createEffect3,
|
|
33
|
+
createMemo as createMemo5,
|
|
34
|
+
createSignal as createSignal5,
|
|
35
|
+
createResource as createResource3,
|
|
36
|
+
createRoot as createRoot3,
|
|
37
|
+
createComputed as createComputed2,
|
|
38
|
+
createRenderEffect as createRenderEffect3,
|
|
39
|
+
onCleanup as onCleanup2,
|
|
40
|
+
getOwner as getOwner2,
|
|
41
|
+
runWithOwner as runWithOwner2,
|
|
42
|
+
batch as batch2,
|
|
43
|
+
untrack as untrack2,
|
|
44
|
+
createDeferred as createDeferred2,
|
|
45
|
+
setOwner
|
|
46
|
+
} from "@fluixi/reactive/signal";
|
|
47
|
+
import { createDebounce, createSelector } from "@fluixi/reactive/signal";
|
|
48
|
+
import {
|
|
49
|
+
readSignal,
|
|
50
|
+
reduceSignal
|
|
51
|
+
} from "@fluixi/reactive/operators";
|
|
52
|
+
import { createStore, untrackStore, Store } from "@fluixi/reactive/store";
|
|
53
|
+
|
|
54
|
+
// src/lib/render/index.ts
|
|
55
|
+
import { isServer as isServer3 } from "@fluixi/dom";
|
|
56
|
+
import { createRoot as createRoot2 } from "@fluixi/reactive/signal";
|
|
57
|
+
|
|
58
|
+
// src/lib/render/versions.ts
|
|
59
|
+
import { registerCoreVersion } from "@fluixi/dom";
|
|
60
|
+
|
|
61
|
+
// src/version.generated.ts
|
|
62
|
+
var VERSION = "1.0.0-alpha.84";
|
|
63
|
+
|
|
64
|
+
// src/lib/render/versions.ts
|
|
65
|
+
import { stampVersions, warnOnVersionSkew, versions } from "@fluixi/dom";
|
|
66
|
+
registerCoreVersion(VERSION);
|
|
67
|
+
|
|
68
|
+
// src/lib/render/index.ts
|
|
69
|
+
import {
|
|
70
|
+
isDOMNode,
|
|
71
|
+
delegateEvents,
|
|
72
|
+
insert
|
|
73
|
+
} from "@fluixi/dom";
|
|
74
|
+
|
|
75
|
+
// src/lib/render/component.ts
|
|
76
|
+
import { isServer } from "@fluixi/dom";
|
|
77
|
+
import {
|
|
78
|
+
createComponent as domCreateComponent,
|
|
79
|
+
asComponent
|
|
80
|
+
} from "@fluixi/dom";
|
|
81
|
+
import {
|
|
82
|
+
untrack,
|
|
83
|
+
onCleanup,
|
|
84
|
+
getOwner,
|
|
85
|
+
createEffect,
|
|
86
|
+
createMemo,
|
|
87
|
+
createSignal,
|
|
88
|
+
isSignal,
|
|
89
|
+
batch,
|
|
90
|
+
runWithOwner,
|
|
91
|
+
isOwnerDisposed
|
|
92
|
+
} from "@fluixi/reactive/signal";
|
|
93
|
+
var sharedConfig = {
|
|
94
|
+
context: null,
|
|
95
|
+
owner: null
|
|
96
|
+
};
|
|
97
|
+
function getSharedConfig() {
|
|
98
|
+
return sharedConfig;
|
|
99
|
+
}
|
|
100
|
+
var DEV = typeof process !== "undefined" && false;
|
|
101
|
+
var _LIFECYCLE = /* @__PURE__ */ Symbol.for("fluixi-lifecycle");
|
|
102
|
+
function getOwnerLifecycle() {
|
|
103
|
+
const owner = getOwner();
|
|
104
|
+
if (!owner) return null;
|
|
105
|
+
if (!owner[_LIFECYCLE]) {
|
|
106
|
+
const lc = { mounts: [], effects: [], scheduled: false };
|
|
107
|
+
owner[_LIFECYCLE] = lc;
|
|
108
|
+
}
|
|
109
|
+
return owner[_LIFECYCLE];
|
|
110
|
+
}
|
|
111
|
+
function scheduleLifecycleFlush(lc) {
|
|
112
|
+
if (lc.scheduled) return;
|
|
113
|
+
if (isServer()) {
|
|
114
|
+
lc.mounts = [];
|
|
115
|
+
lc.effects = [];
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
lc.scheduled = true;
|
|
119
|
+
const owner = getOwner();
|
|
120
|
+
queueMicrotask(() => {
|
|
121
|
+
if (isOwnerDisposed(owner)) {
|
|
122
|
+
lc.mounts = [];
|
|
123
|
+
lc.effects = [];
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
runWithOwner(owner, () => {
|
|
127
|
+
for (const cb of lc.mounts) {
|
|
128
|
+
try {
|
|
129
|
+
const cleanup = cb();
|
|
130
|
+
if (typeof cleanup === "function") {
|
|
131
|
+
onCleanup(cleanup);
|
|
132
|
+
}
|
|
133
|
+
} catch (e) {
|
|
134
|
+
console.error("Error in onMount callback:", e);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
for (const cb of lc.effects) {
|
|
138
|
+
let cleanup;
|
|
139
|
+
createEffect(() => {
|
|
140
|
+
if (cleanup) cleanup();
|
|
141
|
+
cleanup = cb();
|
|
142
|
+
});
|
|
143
|
+
onCleanup(() => {
|
|
144
|
+
if (cleanup) cleanup();
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
lc.mounts = [];
|
|
148
|
+
lc.effects = [];
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function createComponent(Comp, props) {
|
|
153
|
+
return domCreateComponent(Comp, props);
|
|
154
|
+
}
|
|
155
|
+
function $component(value, props) {
|
|
156
|
+
const component = typeof value === "function" ? untrack(() => value(props)) : value;
|
|
157
|
+
const nameable = component != null && (typeof component === "function" || typeof component === "object");
|
|
158
|
+
if (nameable) {
|
|
159
|
+
try {
|
|
160
|
+
component["$name"] = value.name;
|
|
161
|
+
} catch {
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (nameable && !isSignal(component)) {
|
|
165
|
+
return asComponent(component);
|
|
166
|
+
}
|
|
167
|
+
return component;
|
|
168
|
+
}
|
|
169
|
+
function onMount(fn, reactive = true) {
|
|
170
|
+
if (isServer()) return;
|
|
171
|
+
const lc = getOwnerLifecycle();
|
|
172
|
+
if (lc) {
|
|
173
|
+
if (!reactive) {
|
|
174
|
+
if (!lc.scheduled) {
|
|
175
|
+
fn();
|
|
176
|
+
}
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
lc.mounts.push(fn);
|
|
180
|
+
scheduleLifecycleFlush(lc);
|
|
181
|
+
} else {
|
|
182
|
+
if (!reactive) {
|
|
183
|
+
fn();
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
createEffect(() => {
|
|
187
|
+
const cleanup = untrack(fn);
|
|
188
|
+
if (typeof cleanup === "function") {
|
|
189
|
+
onCleanup(cleanup);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function onUnmount(fn) {
|
|
195
|
+
onCleanup(fn);
|
|
196
|
+
}
|
|
197
|
+
function useEffect(callback) {
|
|
198
|
+
const lc = getOwnerLifecycle();
|
|
199
|
+
if (lc) {
|
|
200
|
+
lc.effects.push(callback);
|
|
201
|
+
scheduleLifecycleFlush(lc);
|
|
202
|
+
} else {
|
|
203
|
+
let cleanup;
|
|
204
|
+
createEffect(() => {
|
|
205
|
+
if (cleanup) cleanup();
|
|
206
|
+
cleanup = callback();
|
|
207
|
+
});
|
|
208
|
+
onCleanup(() => {
|
|
209
|
+
if (cleanup) cleanup();
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
function useMemo(fn) {
|
|
214
|
+
return createMemo(fn);
|
|
215
|
+
}
|
|
216
|
+
function useRef(initialValue) {
|
|
217
|
+
const ref = { current: initialValue };
|
|
218
|
+
onCleanup(() => {
|
|
219
|
+
ref.current = null;
|
|
220
|
+
});
|
|
221
|
+
return ref;
|
|
222
|
+
}
|
|
223
|
+
function useReducer(reducer, initialState) {
|
|
224
|
+
const [state, setState] = createSignal(initialState);
|
|
225
|
+
const dispatch = (action) => {
|
|
226
|
+
setState(reducer(state(), action));
|
|
227
|
+
};
|
|
228
|
+
return [state, dispatch];
|
|
229
|
+
}
|
|
230
|
+
function useEventListener(target, event, handler, options) {
|
|
231
|
+
useEffect(() => {
|
|
232
|
+
const element = target && "current" in target ? target.current : target;
|
|
233
|
+
if (!element) return;
|
|
234
|
+
element.addEventListener(event, handler, options);
|
|
235
|
+
return () => {
|
|
236
|
+
element.removeEventListener(event, handler, options);
|
|
237
|
+
};
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
function useCallback(callback) {
|
|
241
|
+
return callback;
|
|
242
|
+
}
|
|
243
|
+
function isDev() {
|
|
244
|
+
return DEV;
|
|
245
|
+
}
|
|
246
|
+
function devOnly(fn) {
|
|
247
|
+
if (DEV) {
|
|
248
|
+
fn();
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// src/lib/render/suspense.ts
|
|
253
|
+
import {
|
|
254
|
+
createSignal as createSignal2,
|
|
255
|
+
createMemo as createMemo2,
|
|
256
|
+
createEffect as createEffect2,
|
|
257
|
+
createRenderEffect as createRenderEffect2,
|
|
258
|
+
isSignal as isSignal2,
|
|
259
|
+
readChildren,
|
|
260
|
+
useContext as useContext3,
|
|
261
|
+
createContext as createContext3,
|
|
262
|
+
createSuspenseBoundary,
|
|
263
|
+
provideSuspense
|
|
264
|
+
} from "@fluixi/reactive/signal";
|
|
265
|
+
import {
|
|
266
|
+
asSuspense,
|
|
267
|
+
isComponent,
|
|
268
|
+
createComponent as createComponent2,
|
|
269
|
+
runWithoutHydration
|
|
270
|
+
} from "@fluixi/dom";
|
|
271
|
+
function isPromise(value) {
|
|
272
|
+
return !!(value && typeof value === "object" && typeof value.then === "function" || value instanceof Promise);
|
|
273
|
+
}
|
|
274
|
+
var SuspenseListContext = createContext3(void 0, "suspense-list");
|
|
275
|
+
function Suspense(props) {
|
|
276
|
+
return createComponent2(SuspenseImpl, props);
|
|
277
|
+
}
|
|
278
|
+
function SuspenseImpl(props) {
|
|
279
|
+
const boundary = createSuspenseBoundary();
|
|
280
|
+
const listCtx = useContext3(SuspenseListContext);
|
|
281
|
+
const listState = listCtx ? listCtx.register(boundary.inFallback) : void 0;
|
|
282
|
+
function instantiateOnce(val) {
|
|
283
|
+
if (val == null || typeof val === "boolean") return null;
|
|
284
|
+
if (typeof val === "function" && isComponent(val) && !isSignal2(val)) return val();
|
|
285
|
+
return val;
|
|
286
|
+
}
|
|
287
|
+
const fallback = runWithoutHydration(() => instantiateOnce(props.fallback ?? null));
|
|
288
|
+
const children = provideSuspense(boundary, () => readChildren(() => props.children));
|
|
289
|
+
const track = (value, depth) => {
|
|
290
|
+
if (depth > 8) return;
|
|
291
|
+
if (Array.isArray(value)) {
|
|
292
|
+
for (const x of value) track(x, depth + 1);
|
|
293
|
+
} else if (typeof value === "function" && isSignal2(value)) {
|
|
294
|
+
track(value(), depth + 1);
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
provideSuspense(boundary, () => {
|
|
298
|
+
createRenderEffect2(() => track(children, 0));
|
|
299
|
+
});
|
|
300
|
+
const [resolved, setResolved] = createSignal2(void 0);
|
|
301
|
+
const childIsPromise = isPromise(children);
|
|
302
|
+
if (childIsPromise) {
|
|
303
|
+
boundary.increment();
|
|
304
|
+
children.then(
|
|
305
|
+
(v) => {
|
|
306
|
+
setResolved(() => v);
|
|
307
|
+
boundary.decrement();
|
|
308
|
+
},
|
|
309
|
+
() => boundary.decrement()
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
return createMemo2(() => {
|
|
313
|
+
const showFallback = listState ? listState.showFallback() : boundary.inFallback();
|
|
314
|
+
if (showFallback) return fallback;
|
|
315
|
+
if (childIsPromise) return resolved();
|
|
316
|
+
return children;
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
asSuspense(Suspense);
|
|
320
|
+
Object.defineProperty(Suspense, "__suspense", { value: true, enumerable: true });
|
|
321
|
+
|
|
322
|
+
// src/lib/render/deferred.ts
|
|
323
|
+
import { isServer as isServer2 } from "@fluixi/dom";
|
|
324
|
+
import { createMemo as createMemo3, createSignal as createSignal3 } from "@fluixi/reactive/signal";
|
|
325
|
+
import { observeIntersection } from "@fluixi/dom/utils";
|
|
326
|
+
|
|
327
|
+
// src/lib/render/await.ts
|
|
328
|
+
import { createResource as createResource2 } from "@fluixi/reactive/signal";
|
|
329
|
+
|
|
330
|
+
// src/lib/render/index.ts
|
|
331
|
+
function render(code, container, options = {}) {
|
|
332
|
+
delegateEvents(["click", "input", "change", "submit"]);
|
|
333
|
+
if (isServer3()) {
|
|
334
|
+
throw new Error(
|
|
335
|
+
"render() is for client-side only. Use renderToString() on server."
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
if (!container) {
|
|
339
|
+
throw new Error("Container element is required");
|
|
340
|
+
}
|
|
341
|
+
let disposer;
|
|
342
|
+
createRoot2((dispose) => {
|
|
343
|
+
disposer = dispose;
|
|
344
|
+
const result = typeof code === "function" ? code() : code;
|
|
345
|
+
container.textContent = "";
|
|
346
|
+
stampVersions(container);
|
|
347
|
+
warnOnVersionSkew();
|
|
348
|
+
insert(container, () => result);
|
|
349
|
+
});
|
|
350
|
+
return () => {
|
|
351
|
+
if (disposer) {
|
|
352
|
+
disposer();
|
|
353
|
+
disposer = void 0;
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
function isLitTemplateResult(value) {
|
|
358
|
+
return value && typeof value === "object" && (value["_$litType$"] !== void 0 || value["_$litDirective$"] !== void 0);
|
|
359
|
+
}
|
|
360
|
+
function portal(code, target, options = {}) {
|
|
361
|
+
const container = document.createElement("div");
|
|
362
|
+
container.setAttribute("data-portal", "true");
|
|
363
|
+
target.appendChild(container);
|
|
364
|
+
const dispose = render(code, container, options);
|
|
365
|
+
return () => {
|
|
366
|
+
dispose();
|
|
367
|
+
if (target.contains(container)) {
|
|
368
|
+
target.removeChild(container);
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
function isRenderable(value) {
|
|
373
|
+
if (value == null) return true;
|
|
374
|
+
if (typeof value === "function") return true;
|
|
375
|
+
if (isDOMNode(value)) return true;
|
|
376
|
+
if (isLitTemplateResult(value)) return true;
|
|
377
|
+
if (Array.isArray(value)) return true;
|
|
378
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
379
|
+
return true;
|
|
380
|
+
}
|
|
381
|
+
return false;
|
|
382
|
+
}
|
|
383
|
+
function initDelegation() {
|
|
384
|
+
if (isServer3()) return;
|
|
385
|
+
delegateEvents(["click", "input", "change", "submit"]);
|
|
386
|
+
}
|
|
387
|
+
function cleanupDelegation() {
|
|
388
|
+
if (isServer3()) return;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
// src/lib/isomorphic.ts
|
|
392
|
+
import { createSignal as createSignal4, createMemo as createMemo4 } from "@fluixi/reactive/signal";
|
|
393
|
+
import { getServerData } from "@fluixi/dom";
|
|
394
|
+
var REGISTRY_KEY = "__fluixi_iso_states__";
|
|
395
|
+
var SEED_PREFIX = "__iso:";
|
|
396
|
+
function registry() {
|
|
397
|
+
return globalThis[REGISTRY_KEY] ??= /* @__PURE__ */ new Map();
|
|
398
|
+
}
|
|
399
|
+
function readSeed(key) {
|
|
400
|
+
if (typeof window === "undefined") return void 0;
|
|
401
|
+
const data = getServerData();
|
|
402
|
+
return data ? data[SEED_PREFIX + key] : void 0;
|
|
403
|
+
}
|
|
404
|
+
function createIsomorphicState(key, options) {
|
|
405
|
+
const seed = readSeed(key);
|
|
406
|
+
const initial = seed !== void 0 ? seed : typeof window !== "undefined" && options.client ? options.client() : options.fallback;
|
|
407
|
+
const [value, set] = createSignal4(initial);
|
|
408
|
+
registry().set(key, { server: options.server, set });
|
|
409
|
+
return { value, set, key };
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// src/lib/index.ts
|
|
413
|
+
import {
|
|
414
|
+
classMap,
|
|
415
|
+
styleMap
|
|
416
|
+
} from "@fluixi/dom";
|
|
417
|
+
|
|
418
|
+
// src/lib/control-flow.ts
|
|
419
|
+
import {
|
|
420
|
+
Show,
|
|
421
|
+
For,
|
|
422
|
+
Index,
|
|
423
|
+
Switch,
|
|
424
|
+
Match,
|
|
425
|
+
Dynamic,
|
|
426
|
+
ErrorBoundary,
|
|
427
|
+
Portal,
|
|
428
|
+
ClientOnly,
|
|
429
|
+
NoSsr
|
|
430
|
+
} from "@fluixi/dom";
|
|
431
|
+
|
|
432
|
+
// src/lib/index.ts
|
|
433
|
+
import {
|
|
434
|
+
insert as insert2,
|
|
435
|
+
spread,
|
|
436
|
+
setAttribute,
|
|
437
|
+
setProperty,
|
|
438
|
+
addClass,
|
|
439
|
+
removeClass,
|
|
440
|
+
toggleClass,
|
|
441
|
+
delegateEvents as delegateEvents2,
|
|
442
|
+
isDOMNode as isDOMNode2,
|
|
443
|
+
isLitTemplateResult as isLitTemplateResult2,
|
|
444
|
+
hydrate
|
|
445
|
+
} from "@fluixi/dom";
|
|
446
|
+
|
|
447
|
+
// src/lib/jsx-runtime/index.ts
|
|
448
|
+
var jsx_runtime_exports = {};
|
|
449
|
+
__reExport(jsx_runtime_exports, jsx_runtime_star);
|
|
450
|
+
import * as jsx_runtime_star from "@fluixi/jsx/jsx-runtime";
|
|
451
|
+
|
|
452
|
+
// src/lib/index.ts
|
|
453
|
+
import {
|
|
454
|
+
createSignal as _createSignal,
|
|
455
|
+
createEffect as _createEffect,
|
|
456
|
+
createMemo as _createMemo,
|
|
457
|
+
createRoot as _createRoot,
|
|
458
|
+
batch as _batch,
|
|
459
|
+
untrack as _untrack,
|
|
460
|
+
onCleanup as _onCleanup
|
|
461
|
+
} from "@fluixi/reactive/signal";
|
|
462
|
+
var VERSION2 = "0.0.1";
|
|
463
|
+
var FRAMEWORK_NAME = "Fluixi";
|
|
464
|
+
function getFrameworkInfo() {
|
|
465
|
+
return {
|
|
466
|
+
name: FRAMEWORK_NAME,
|
|
467
|
+
version: VERSION2,
|
|
468
|
+
features: {
|
|
469
|
+
ssr: true,
|
|
470
|
+
hydration: true,
|
|
471
|
+
jsx: true,
|
|
472
|
+
litHtml: true,
|
|
473
|
+
signals: true,
|
|
474
|
+
fineGrained: true,
|
|
475
|
+
lazy: true,
|
|
476
|
+
hooks: true,
|
|
477
|
+
devMode: true
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
// src/lib/client/index.ts
|
|
483
|
+
import {
|
|
484
|
+
render as domRender,
|
|
485
|
+
hydrate as domHydrate
|
|
486
|
+
} from "@fluixi/dom";
|
|
487
|
+
import { createMemo as createMemo6 } from "@fluixi/reactive/signal";
|
|
488
|
+
import { createHead, setActiveHead, mountHead, stripHeadMarker } from "@fluixi/head";
|
|
489
|
+
import { hydrate as hydrate2 } from "@fluixi/dom";
|
|
490
|
+
function mount(App, container) {
|
|
491
|
+
if (!container) {
|
|
492
|
+
throw new Error("Container element not found for mount()");
|
|
493
|
+
}
|
|
494
|
+
domRender(() => App(), container);
|
|
495
|
+
}
|
|
496
|
+
var rootOf = (App) => createMemo6(() => createComponent(App));
|
|
497
|
+
async function startClient(App, options = {}) {
|
|
498
|
+
const container = typeof options.root === "string" ? document.querySelector(options.root) : options.root ?? document.querySelector("#app");
|
|
499
|
+
if (!container) {
|
|
500
|
+
throw new Error(
|
|
501
|
+
`[Fluixi] Mount container not found: ${options.root ?? "#app"}`
|
|
502
|
+
);
|
|
503
|
+
}
|
|
504
|
+
const hasServerDom = !!document.getElementById("__FLUIXI_HYDRATION__") || !!options.routes && container.firstElementChild != null;
|
|
505
|
+
const shouldHydrate = options.hydrate ?? hasServerDom;
|
|
506
|
+
const head = createHead();
|
|
507
|
+
setActiveHead(head);
|
|
508
|
+
stripHeadMarker(container);
|
|
509
|
+
if (shouldHydrate) {
|
|
510
|
+
if (options.routes && options.routes.length) {
|
|
511
|
+
const { preloadRoutes } = await import("./router-WMN2AA7E.mjs");
|
|
512
|
+
await preloadRoutes(options.routes, window.location.pathname);
|
|
513
|
+
}
|
|
514
|
+
deserializeHydrationData();
|
|
515
|
+
setHydrating(true);
|
|
516
|
+
domHydrate(rootOf(App), container);
|
|
517
|
+
replayEvents();
|
|
518
|
+
setTimeout(() => {
|
|
519
|
+
setHydrating(false);
|
|
520
|
+
cleanupHydration();
|
|
521
|
+
}, 100);
|
|
522
|
+
} else {
|
|
523
|
+
render(rootOf(App), container);
|
|
524
|
+
}
|
|
525
|
+
mountHead(head);
|
|
526
|
+
}
|
|
527
|
+
function replayEvents() {
|
|
528
|
+
if (typeof window === "undefined") return;
|
|
529
|
+
const w = window;
|
|
530
|
+
if (typeof w.__FX_REPLAY_STOP__ === "function") w.__FX_REPLAY_STOP__();
|
|
531
|
+
const queue = w.__FX_REPLAY__;
|
|
532
|
+
w.__FX_REPLAY__ = void 0;
|
|
533
|
+
w.__FX_REPLAY_STOP__ = void 0;
|
|
534
|
+
if (!Array.isArray(queue) || queue.length === 0) return;
|
|
535
|
+
for (const rec of queue) {
|
|
536
|
+
const target = rec && rec.target;
|
|
537
|
+
if (!target || target.isConnected === false || typeof target.dispatchEvent !== "function") continue;
|
|
538
|
+
const type = rec.type;
|
|
539
|
+
const ev = type === "click" ? new MouseEvent(type, { bubbles: true, cancelable: true }) : new Event(type, { bubbles: true, cancelable: true });
|
|
540
|
+
target.dispatchEvent(ev);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
var export_Fragment = jsx_runtime_exports.Fragment;
|
|
544
|
+
var export_jsx = jsx_runtime_exports.jsx;
|
|
545
|
+
var export_jsxs = jsx_runtime_exports.jsxs;
|
|
546
|
+
export {
|
|
547
|
+
$component,
|
|
548
|
+
A,
|
|
549
|
+
ClientOnly,
|
|
550
|
+
DEV,
|
|
551
|
+
Dynamic,
|
|
552
|
+
ErrorBoundary,
|
|
553
|
+
FRAMEWORK_NAME,
|
|
554
|
+
For,
|
|
555
|
+
export_Fragment as Fragment,
|
|
556
|
+
Index,
|
|
557
|
+
Link,
|
|
558
|
+
Match,
|
|
559
|
+
NoSsr,
|
|
560
|
+
Outlet,
|
|
561
|
+
Portal,
|
|
562
|
+
Redirect,
|
|
563
|
+
Router,
|
|
564
|
+
Show,
|
|
565
|
+
Store,
|
|
566
|
+
Suspense,
|
|
567
|
+
Switch,
|
|
568
|
+
VERSION2 as VERSION,
|
|
569
|
+
addClass,
|
|
570
|
+
batch2 as batch,
|
|
571
|
+
classMap,
|
|
572
|
+
cleanupDelegation,
|
|
573
|
+
composeProviders,
|
|
574
|
+
createBrowserHistory,
|
|
575
|
+
createComponent,
|
|
576
|
+
createComputed2 as createComputed,
|
|
577
|
+
createConsumer,
|
|
578
|
+
createContext,
|
|
579
|
+
createContextWithProvider,
|
|
580
|
+
createDebounce,
|
|
581
|
+
createDeferred2 as createDeferred,
|
|
582
|
+
createEffect3 as createEffect,
|
|
583
|
+
createIsomorphicState,
|
|
584
|
+
createMemo5 as createMemo,
|
|
585
|
+
createMemoryHistory,
|
|
586
|
+
createProvider,
|
|
587
|
+
createRenderEffect3 as createRenderEffect,
|
|
588
|
+
createResource3 as createResource,
|
|
589
|
+
createRoot3 as createRoot,
|
|
590
|
+
createSelector,
|
|
591
|
+
createSignal5 as createSignal,
|
|
592
|
+
createStore,
|
|
593
|
+
delegateEvents2 as delegateEvents,
|
|
594
|
+
devOnly,
|
|
595
|
+
getFrameworkInfo,
|
|
596
|
+
getOwner2 as getOwner,
|
|
597
|
+
getSharedConfig,
|
|
598
|
+
hydrate,
|
|
599
|
+
initDelegation,
|
|
600
|
+
insert2 as insert,
|
|
601
|
+
isDOMNode2 as isDOMNode,
|
|
602
|
+
isDev,
|
|
603
|
+
isLitTemplateResult2 as isLitTemplateResult,
|
|
604
|
+
isRenderable,
|
|
605
|
+
export_jsx as jsx,
|
|
606
|
+
export_jsxs as jsxs,
|
|
607
|
+
lazy,
|
|
608
|
+
mount,
|
|
609
|
+
onCleanup2 as onCleanup,
|
|
610
|
+
onMount,
|
|
611
|
+
onUnmount,
|
|
612
|
+
portal,
|
|
613
|
+
readSignal as read,
|
|
614
|
+
reduceSignal as reduce,
|
|
615
|
+
removeClass,
|
|
616
|
+
render,
|
|
617
|
+
runWithOwner2 as runWithOwner,
|
|
618
|
+
setAttribute,
|
|
619
|
+
setOwner,
|
|
620
|
+
setProperty,
|
|
621
|
+
spread,
|
|
622
|
+
startClient,
|
|
623
|
+
styleMap,
|
|
624
|
+
toggleClass,
|
|
625
|
+
untrack2 as untrack,
|
|
626
|
+
untrackStore,
|
|
627
|
+
useCallback,
|
|
628
|
+
useContext,
|
|
629
|
+
useEffect,
|
|
630
|
+
useEventListener,
|
|
631
|
+
useLocation,
|
|
632
|
+
useMatch,
|
|
633
|
+
useMemo,
|
|
634
|
+
useNavigate,
|
|
635
|
+
useParam,
|
|
636
|
+
useParams,
|
|
637
|
+
useProvide,
|
|
638
|
+
useReducer,
|
|
639
|
+
useRef,
|
|
640
|
+
useRouter,
|
|
641
|
+
useSearchParams
|
|
642
|
+
};
|