@fluixi/core 1.0.0-alpha.93 → 1.0.0-alpha.95
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 +1 -1
- package/dist/cdn/core.global.js +2 -2
- package/dist/src/cdn/{chunk-7XM7Q5VR.mjs → chunk-IFONZJWJ.mjs} +93 -2
- package/dist/src/cdn/core.cjs +99 -3
- package/dist/src/cdn/core.mjs +3 -3
- package/dist/src/cdn/{router-VOY43YNM.mjs → router-TU5CPI54.mjs} +1 -1
- package/dist/src/index.cjs +96 -4
- package/dist/src/index.mjs +97 -5
- package/dist/src/lib/client/{chunk-QT3RFKH6.mjs → chunk-AHNP3IWU.mjs} +1 -1
- package/dist/src/lib/client/index.cjs +100 -4
- package/dist/src/lib/client/index.mjs +4 -4
- package/dist/src/lib/client/{router-ADTS55OP.mjs → router-5C6FQJQ4.mjs} +95 -4
- package/dist/src/lib/core.cjs +95 -3
- package/dist/src/lib/core.d.ts +2 -2
- package/dist/src/lib/core.d.ts.map +1 -1
- package/dist/src/lib/core.js +1 -1
- package/dist/src/lib/core.mjs +96 -4
- package/dist/src/lib/i18n/index.cjs +1 -1
- package/dist/src/lib/i18n/index.mjs +1 -1
- package/dist/src/lib/index.cjs +1 -1
- package/dist/src/lib/index.mjs +1 -1
- package/dist/src/lib/jsx-runtime/index.cjs +1 -1
- package/dist/src/lib/jsx-runtime/index.mjs +1 -1
- package/dist/src/lib/jsx-runtime/jsx-dev-runtime.cjs +1 -1
- package/dist/src/lib/jsx-runtime/jsx-dev-runtime.mjs +1 -1
- package/dist/src/lib/plugins/index.cjs +1 -1
- package/dist/src/lib/plugins/index.mjs +1 -1
- package/dist/src/lib/render/index.cjs +1 -1
- package/dist/src/lib/render/index.mjs +1 -1
- package/dist/src/lib/render/versions.cjs +1 -1
- package/dist/src/lib/render/versions.mjs +1 -1
- package/dist/src/lib/router/index.cjs +94 -3
- package/dist/src/lib/router/index.d.ts.map +1 -1
- package/dist/src/lib/router/index.js +55 -0
- package/dist/src/lib/router/index.mjs +94 -3
- package/dist/src/lib/router/scroll.cjs +79 -0
- package/dist/src/lib/router/scroll.d.ts +19 -0
- package/dist/src/lib/router/scroll.d.ts.map +1 -0
- package/dist/src/lib/router/scroll.js +68 -0
- package/dist/src/lib/router/scroll.mjs +58 -0
- package/dist/src/lib/server/index.cjs +1 -1
- package/dist/src/lib/server/index.mjs +1 -1
- package/dist/src/lib/storage/index.cjs +1 -1
- package/dist/src/lib/storage/index.mjs +1 -1
- package/dist/src/routes.cjs +1 -1
- package/dist/src/routes.mjs +1 -1
- package/dist/src/utils.cjs +1 -1
- package/dist/src/utils.mjs +1 -1
- package/dist/src/version.generated.cjs +1 -1
- package/dist/src/version.generated.d.ts +1 -1
- package/dist/src/version.generated.js +1 -1
- package/dist/src/version.generated.mjs +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +16 -16
package/dist/src/lib/core.cjs
CHANGED
|
@@ -70,6 +70,7 @@ __export(core_exports, {
|
|
|
70
70
|
createSignal: () => import_signal18.createSignal,
|
|
71
71
|
createStore: () => import_store.createStore,
|
|
72
72
|
createTheme: () => createTheme,
|
|
73
|
+
css: () => import_dom17.css,
|
|
73
74
|
default: () => core_default,
|
|
74
75
|
deferred: () => deferred,
|
|
75
76
|
delegate: () => import_dom18.delegate,
|
|
@@ -151,7 +152,7 @@ var import_signal6 = require("@fluixi/reactive/signal");
|
|
|
151
152
|
var import_dom = require("@fluixi/dom");
|
|
152
153
|
|
|
153
154
|
// src/version.generated.ts
|
|
154
|
-
var VERSION = "1.0.0-alpha.
|
|
155
|
+
var VERSION = "1.0.0-alpha.95";
|
|
155
156
|
|
|
156
157
|
// src/lib/render/versions.ts
|
|
157
158
|
var import_dom2 = require("@fluixi/dom");
|
|
@@ -1176,6 +1177,64 @@ var import_dom15 = require("@fluixi/dom");
|
|
|
1176
1177
|
var import_signal16 = require("@fluixi/reactive/signal");
|
|
1177
1178
|
var import_object = require("@fluixi/utils/object");
|
|
1178
1179
|
var import_compare = require("@fluixi/utils/compare");
|
|
1180
|
+
|
|
1181
|
+
// src/lib/router/scroll.ts
|
|
1182
|
+
var STORE = "fx:scroll";
|
|
1183
|
+
var KEEP = 100;
|
|
1184
|
+
function keepScroll(initial) {
|
|
1185
|
+
const read3 = () => {
|
|
1186
|
+
try {
|
|
1187
|
+
return JSON.parse(sessionStorage.getItem(STORE) ?? "{}");
|
|
1188
|
+
} catch {
|
|
1189
|
+
return {};
|
|
1190
|
+
}
|
|
1191
|
+
};
|
|
1192
|
+
const positions = read3();
|
|
1193
|
+
const write = () => {
|
|
1194
|
+
const keys = Object.keys(positions);
|
|
1195
|
+
for (const key of keys.slice(0, Math.max(0, keys.length - KEEP))) delete positions[key];
|
|
1196
|
+
try {
|
|
1197
|
+
sessionStorage.setItem(STORE, JSON.stringify(positions));
|
|
1198
|
+
} catch {
|
|
1199
|
+
}
|
|
1200
|
+
};
|
|
1201
|
+
let current = initial.key;
|
|
1202
|
+
const save = () => {
|
|
1203
|
+
if (current === void 0) return;
|
|
1204
|
+
delete positions[current];
|
|
1205
|
+
positions[current] = window.scrollY;
|
|
1206
|
+
write();
|
|
1207
|
+
};
|
|
1208
|
+
const restoration = history.scrollRestoration;
|
|
1209
|
+
history.scrollRestoration = "manual";
|
|
1210
|
+
window.addEventListener("pagehide", save);
|
|
1211
|
+
const to = (top) => window.scrollTo({ top, left: 0, behavior: "instant" });
|
|
1212
|
+
const toHash = (hash) => {
|
|
1213
|
+
if (!hash || hash === "#") return false;
|
|
1214
|
+
const target = document.getElementById(decodeURIComponent(hash.slice(1)));
|
|
1215
|
+
target?.scrollIntoView({ behavior: "instant" });
|
|
1216
|
+
return target !== null;
|
|
1217
|
+
};
|
|
1218
|
+
return {
|
|
1219
|
+
leave: save,
|
|
1220
|
+
arrive(location, from) {
|
|
1221
|
+
current = location.key;
|
|
1222
|
+
if (location.action === "pop" || from === void 0) {
|
|
1223
|
+
const y = location.key === void 0 ? void 0 : positions[location.key];
|
|
1224
|
+
if (y !== void 0) to(y);
|
|
1225
|
+
return;
|
|
1226
|
+
}
|
|
1227
|
+
if (location.action === "replace" && location.pathname === from.pathname) return;
|
|
1228
|
+
if (!toHash(location.hash)) to(0);
|
|
1229
|
+
},
|
|
1230
|
+
dispose() {
|
|
1231
|
+
window.removeEventListener("pagehide", save);
|
|
1232
|
+
history.scrollRestoration = restoration;
|
|
1233
|
+
}
|
|
1234
|
+
};
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
// src/lib/router/index.ts
|
|
1179
1238
|
var import_router = require("@fluixi/router");
|
|
1180
1239
|
|
|
1181
1240
|
// src/lib/router/data.ts
|
|
@@ -1255,9 +1314,20 @@ function renderLayer(m, depth, base) {
|
|
|
1255
1314
|
return router ? router.trackLoad(result) : result;
|
|
1256
1315
|
});
|
|
1257
1316
|
(0, import_signal15.onCleanup)(onRevalidate(() => void refetch()));
|
|
1317
|
+
let loadedFor = (0, import_signal15.untrack)(() => JSON.stringify(base.matched()[depth]?.params ?? {}));
|
|
1318
|
+
(0, import_signal15.createEffect)(() => {
|
|
1319
|
+
const now = base.matched()[depth];
|
|
1320
|
+
if (now?.route !== m.route) return;
|
|
1321
|
+
const params = JSON.stringify(now.params ?? {});
|
|
1322
|
+
if (params === loadedFor) return;
|
|
1323
|
+
loadedFor = params;
|
|
1324
|
+
(0, import_signal15.untrack)(() => void refetch());
|
|
1325
|
+
});
|
|
1258
1326
|
data = () => {
|
|
1259
1327
|
const error = resource2.error;
|
|
1260
1328
|
if (error !== void 0 && error !== null) throw error;
|
|
1329
|
+
const r = resource2;
|
|
1330
|
+
if (r.state === "refreshing") return r.latest;
|
|
1261
1331
|
return resource2();
|
|
1262
1332
|
};
|
|
1263
1333
|
Object.defineProperty(data, "loading", { get: () => resource2.loading });
|
|
@@ -1362,16 +1432,19 @@ function buildDefaultNotFound() {
|
|
|
1362
1432
|
}
|
|
1363
1433
|
var pendingTransitionMode;
|
|
1364
1434
|
function Router(props) {
|
|
1365
|
-
const
|
|
1435
|
+
const history2 = props.history ?? (0, import_router.createBrowserHistory)();
|
|
1366
1436
|
const router = (0, import_router.createRouter)({
|
|
1367
1437
|
routes: props.routes,
|
|
1368
1438
|
base: props.base,
|
|
1369
|
-
history
|
|
1439
|
+
history: history2
|
|
1370
1440
|
});
|
|
1371
1441
|
const [state, setState] = (0, import_signal15.createSignal)(router.state());
|
|
1372
1442
|
const [navigating, setNavigating] = (0, import_signal15.createSignal)(false);
|
|
1373
1443
|
const [loads, setLoads] = (0, import_signal15.createSignal)(0);
|
|
1374
1444
|
let navigationId = 0;
|
|
1445
|
+
const scroll = history2.window ? keepScroll(router.state().location) : void 0;
|
|
1446
|
+
let arriving = scroll ? { id: 0, location: router.state().location, from: void 0 } : null;
|
|
1447
|
+
const [arrived, setArrived] = (0, import_signal15.createSignal)(0);
|
|
1375
1448
|
const takeMode = () => {
|
|
1376
1449
|
const mode = pendingTransitionMode ?? (props.transition ?? "auto");
|
|
1377
1450
|
pendingTransitionMode = void 0;
|
|
@@ -1381,6 +1454,10 @@ function Router(props) {
|
|
|
1381
1454
|
const id = ++navigationId;
|
|
1382
1455
|
const mode = takeMode();
|
|
1383
1456
|
setNavigating(true);
|
|
1457
|
+
if (scroll) {
|
|
1458
|
+
scroll.leave();
|
|
1459
|
+
arriving = { id, location: next.location, from: (0, import_signal15.untrack)(state).location };
|
|
1460
|
+
}
|
|
1384
1461
|
const prepared = prepareComponents(
|
|
1385
1462
|
(next.match?.matched ?? []).map((m) => m.component).filter(Boolean)
|
|
1386
1463
|
);
|
|
@@ -1388,6 +1465,7 @@ function Router(props) {
|
|
|
1388
1465
|
setState(next);
|
|
1389
1466
|
const flushed = (0, import_signal15.flush)();
|
|
1390
1467
|
if (id === navigationId) setNavigating(false);
|
|
1468
|
+
if (scroll) setArrived(id);
|
|
1391
1469
|
return flushed;
|
|
1392
1470
|
};
|
|
1393
1471
|
if (!prepared) {
|
|
@@ -1401,6 +1479,7 @@ function Router(props) {
|
|
|
1401
1479
|
});
|
|
1402
1480
|
(0, import_signal15.onCleanup)(() => {
|
|
1403
1481
|
unsub();
|
|
1482
|
+
scroll?.dispose();
|
|
1404
1483
|
router.destroy();
|
|
1405
1484
|
navigationId++;
|
|
1406
1485
|
});
|
|
@@ -1423,6 +1502,19 @@ function Router(props) {
|
|
|
1423
1502
|
return result;
|
|
1424
1503
|
}
|
|
1425
1504
|
};
|
|
1505
|
+
if (scroll) {
|
|
1506
|
+
const nextFrame = typeof requestAnimationFrame === "function" ? requestAnimationFrame : (fn) => setTimeout(fn, 0);
|
|
1507
|
+
(0, import_signal15.createEffect)(() => {
|
|
1508
|
+
const id = arrived();
|
|
1509
|
+
if (ctx.isRouting()) return;
|
|
1510
|
+
const next = arriving;
|
|
1511
|
+
if (!next || next.id !== id || id !== navigationId) return;
|
|
1512
|
+
arriving = null;
|
|
1513
|
+
nextFrame(() => {
|
|
1514
|
+
if (id === navigationId) scroll.arrive(next.location, next.from);
|
|
1515
|
+
});
|
|
1516
|
+
});
|
|
1517
|
+
}
|
|
1426
1518
|
const root = {
|
|
1427
1519
|
depth: -1,
|
|
1428
1520
|
matched,
|
package/dist/src/lib/core.d.ts
CHANGED
|
@@ -35,8 +35,8 @@ export { createTheme, type Theme, type ThemeOptions } from './theme/index.js';
|
|
|
35
35
|
export { createColorScheme, type ColorScheme, type ColorSchemeChoice, type ColorSchemeOptions } from './theme/color-scheme.js';
|
|
36
36
|
export { ThemeProvider, ColorSchemeProvider, useTheme, useColorScheme } from './theme/provider.js';
|
|
37
37
|
import { Link, Router, useNavigate, useRouter } from './router/index.js';
|
|
38
|
-
export { html, svg } from '@fluixi/dom';
|
|
39
|
-
export type { TemplateResult, Reactive } from '@fluixi/dom';
|
|
38
|
+
export { html, svg, css } from '@fluixi/dom';
|
|
39
|
+
export type { TemplateResult, Reactive, FluixiStyle } from '@fluixi/dom';
|
|
40
40
|
export { query, queryAll, closest, addClass, removeClass, toggleClass, hasClass, setAttribute, getAttribute, removeAttribute, setStyles, getStyle, createElement as domCreateElement, removeChildren, appendChildren, isVisible, scrollIntoView, getOffset, delegate, waitForElement, observeIntersection, observeResize, } from '@fluixi/dom';
|
|
41
41
|
export { classMap, styleMap, Island, hydrateIslands, type IslandProps, type IslandRegistry, mergeProps, splitProps, type ComponentFn, type ComponentChild, type ComponentOrElement, type FxComponent, type FxC, type FxParentProps, type FxParent, type FxVoidProps, type FxVoid, type FxFlowProps, type FxFlow, } from '@fluixi/dom';
|
|
42
42
|
export * from "./control-flow.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/lib/core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAEL,MAAM,EACN,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,cAAc,EACd,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,OAAO,EACP,cAAc,EACd,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,qBAAqB,EACrB,cAAc,EACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,UAAU,IAAI,IAAI,EAClB,YAAY,IAAI,MAAM,EACvB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAEL,eAAe,EAEf,OAAO,EACP,SAAS,EAGV,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC/D,cAAc,oBAAoB,CAAC;AAInC,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,sBAAsB,GAC5B,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EACL,QAAQ,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L,MAAM,EACN,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,cAAc,EACd,aAAa,EACb,UAAU,EACV,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,OAAO,EACP,UAAU,EACV,QAAQ,EACR,IAAI,EACJ,MAAM,GACP,CAAC;AACF;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACH,wBAiDE"}
|
package/dist/src/lib/core.js
CHANGED
|
@@ -56,7 +56,7 @@ import { Link, Router, useNavigate, useRouter, } from './router/index.js';
|
|
|
56
56
|
// html`` / svg`` template markers, the no-JSX authoring surface. They live in
|
|
57
57
|
// @fluixi/dom (compiled away by `format: 'lit'`/`both`); re-exported here so
|
|
58
58
|
// `import { html } from '@fluixi/core'` works. Inert typed functions, no lit runtime.
|
|
59
|
-
export { html, svg } from '@fluixi/dom';
|
|
59
|
+
export { html, svg, css } from '@fluixi/dom';
|
|
60
60
|
// createReactiveJSX (a deprecated legacy adapter) lived here but pulled the jsx-runtime
|
|
61
61
|
// `.` entry into the core graph. It's gone: compiled JSX uses the jsx-runtime subpath
|
|
62
62
|
// directly, and nothing in the framework needs the adapter.
|
package/dist/src/lib/core.mjs
CHANGED
|
@@ -38,7 +38,7 @@ import { createRoot as createRoot2 } from "@fluixi/reactive/signal";
|
|
|
38
38
|
import { registerCoreVersion } from "@fluixi/dom";
|
|
39
39
|
|
|
40
40
|
// src/version.generated.ts
|
|
41
|
-
var VERSION = "1.0.0-alpha.
|
|
41
|
+
var VERSION = "1.0.0-alpha.95";
|
|
42
42
|
|
|
43
43
|
// src/lib/render/versions.ts
|
|
44
44
|
import { stampVersions, warnOnVersionSkew, versions } from "@fluixi/dom";
|
|
@@ -1126,6 +1126,64 @@ import {
|
|
|
1126
1126
|
import { createContext as createContext5, useContext as useContext5 } from "@fluixi/reactive/signal";
|
|
1127
1127
|
import { get } from "@fluixi/utils/object";
|
|
1128
1128
|
import { deepEqual } from "@fluixi/utils/compare";
|
|
1129
|
+
|
|
1130
|
+
// src/lib/router/scroll.ts
|
|
1131
|
+
var STORE = "fx:scroll";
|
|
1132
|
+
var KEEP = 100;
|
|
1133
|
+
function keepScroll(initial) {
|
|
1134
|
+
const read3 = () => {
|
|
1135
|
+
try {
|
|
1136
|
+
return JSON.parse(sessionStorage.getItem(STORE) ?? "{}");
|
|
1137
|
+
} catch {
|
|
1138
|
+
return {};
|
|
1139
|
+
}
|
|
1140
|
+
};
|
|
1141
|
+
const positions = read3();
|
|
1142
|
+
const write = () => {
|
|
1143
|
+
const keys = Object.keys(positions);
|
|
1144
|
+
for (const key of keys.slice(0, Math.max(0, keys.length - KEEP))) delete positions[key];
|
|
1145
|
+
try {
|
|
1146
|
+
sessionStorage.setItem(STORE, JSON.stringify(positions));
|
|
1147
|
+
} catch {
|
|
1148
|
+
}
|
|
1149
|
+
};
|
|
1150
|
+
let current = initial.key;
|
|
1151
|
+
const save = () => {
|
|
1152
|
+
if (current === void 0) return;
|
|
1153
|
+
delete positions[current];
|
|
1154
|
+
positions[current] = window.scrollY;
|
|
1155
|
+
write();
|
|
1156
|
+
};
|
|
1157
|
+
const restoration = history.scrollRestoration;
|
|
1158
|
+
history.scrollRestoration = "manual";
|
|
1159
|
+
window.addEventListener("pagehide", save);
|
|
1160
|
+
const to = (top) => window.scrollTo({ top, left: 0, behavior: "instant" });
|
|
1161
|
+
const toHash = (hash) => {
|
|
1162
|
+
if (!hash || hash === "#") return false;
|
|
1163
|
+
const target = document.getElementById(decodeURIComponent(hash.slice(1)));
|
|
1164
|
+
target?.scrollIntoView({ behavior: "instant" });
|
|
1165
|
+
return target !== null;
|
|
1166
|
+
};
|
|
1167
|
+
return {
|
|
1168
|
+
leave: save,
|
|
1169
|
+
arrive(location, from) {
|
|
1170
|
+
current = location.key;
|
|
1171
|
+
if (location.action === "pop" || from === void 0) {
|
|
1172
|
+
const y = location.key === void 0 ? void 0 : positions[location.key];
|
|
1173
|
+
if (y !== void 0) to(y);
|
|
1174
|
+
return;
|
|
1175
|
+
}
|
|
1176
|
+
if (location.action === "replace" && location.pathname === from.pathname) return;
|
|
1177
|
+
if (!toHash(location.hash)) to(0);
|
|
1178
|
+
},
|
|
1179
|
+
dispose() {
|
|
1180
|
+
window.removeEventListener("pagehide", save);
|
|
1181
|
+
history.scrollRestoration = restoration;
|
|
1182
|
+
}
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
// src/lib/router/index.ts
|
|
1129
1187
|
import {
|
|
1130
1188
|
createRouter as createCoreRouter,
|
|
1131
1189
|
createBrowserHistory,
|
|
@@ -1218,9 +1276,20 @@ function renderLayer(m, depth, base) {
|
|
|
1218
1276
|
return router ? router.trackLoad(result) : result;
|
|
1219
1277
|
});
|
|
1220
1278
|
onCleanup4(onRevalidate(() => void refetch()));
|
|
1279
|
+
let loadedFor = untrack4(() => JSON.stringify(base.matched()[depth]?.params ?? {}));
|
|
1280
|
+
createEffect4(() => {
|
|
1281
|
+
const now = base.matched()[depth];
|
|
1282
|
+
if (now?.route !== m.route) return;
|
|
1283
|
+
const params = JSON.stringify(now.params ?? {});
|
|
1284
|
+
if (params === loadedFor) return;
|
|
1285
|
+
loadedFor = params;
|
|
1286
|
+
untrack4(() => void refetch());
|
|
1287
|
+
});
|
|
1221
1288
|
data = () => {
|
|
1222
1289
|
const error = resource2.error;
|
|
1223
1290
|
if (error !== void 0 && error !== null) throw error;
|
|
1291
|
+
const r = resource2;
|
|
1292
|
+
if (r.state === "refreshing") return r.latest;
|
|
1224
1293
|
return resource2();
|
|
1225
1294
|
};
|
|
1226
1295
|
Object.defineProperty(data, "loading", { get: () => resource2.loading });
|
|
@@ -1325,16 +1394,19 @@ function buildDefaultNotFound() {
|
|
|
1325
1394
|
}
|
|
1326
1395
|
var pendingTransitionMode;
|
|
1327
1396
|
function Router(props) {
|
|
1328
|
-
const
|
|
1397
|
+
const history2 = props.history ?? createBrowserHistory();
|
|
1329
1398
|
const router = createCoreRouter({
|
|
1330
1399
|
routes: props.routes,
|
|
1331
1400
|
base: props.base,
|
|
1332
|
-
history
|
|
1401
|
+
history: history2
|
|
1333
1402
|
});
|
|
1334
1403
|
const [state, setState] = createSignal8(router.state());
|
|
1335
1404
|
const [navigating, setNavigating] = createSignal8(false);
|
|
1336
1405
|
const [loads, setLoads] = createSignal8(0);
|
|
1337
1406
|
let navigationId = 0;
|
|
1407
|
+
const scroll = history2.window ? keepScroll(router.state().location) : void 0;
|
|
1408
|
+
let arriving = scroll ? { id: 0, location: router.state().location, from: void 0 } : null;
|
|
1409
|
+
const [arrived, setArrived] = createSignal8(0);
|
|
1338
1410
|
const takeMode = () => {
|
|
1339
1411
|
const mode = pendingTransitionMode ?? (props.transition ?? "auto");
|
|
1340
1412
|
pendingTransitionMode = void 0;
|
|
@@ -1344,6 +1416,10 @@ function Router(props) {
|
|
|
1344
1416
|
const id = ++navigationId;
|
|
1345
1417
|
const mode = takeMode();
|
|
1346
1418
|
setNavigating(true);
|
|
1419
|
+
if (scroll) {
|
|
1420
|
+
scroll.leave();
|
|
1421
|
+
arriving = { id, location: next.location, from: untrack4(state).location };
|
|
1422
|
+
}
|
|
1347
1423
|
const prepared = prepareComponents(
|
|
1348
1424
|
(next.match?.matched ?? []).map((m) => m.component).filter(Boolean)
|
|
1349
1425
|
);
|
|
@@ -1351,6 +1427,7 @@ function Router(props) {
|
|
|
1351
1427
|
setState(next);
|
|
1352
1428
|
const flushed = flush();
|
|
1353
1429
|
if (id === navigationId) setNavigating(false);
|
|
1430
|
+
if (scroll) setArrived(id);
|
|
1354
1431
|
return flushed;
|
|
1355
1432
|
};
|
|
1356
1433
|
if (!prepared) {
|
|
@@ -1364,6 +1441,7 @@ function Router(props) {
|
|
|
1364
1441
|
});
|
|
1365
1442
|
onCleanup4(() => {
|
|
1366
1443
|
unsub();
|
|
1444
|
+
scroll?.dispose();
|
|
1367
1445
|
router.destroy();
|
|
1368
1446
|
navigationId++;
|
|
1369
1447
|
});
|
|
@@ -1386,6 +1464,19 @@ function Router(props) {
|
|
|
1386
1464
|
return result;
|
|
1387
1465
|
}
|
|
1388
1466
|
};
|
|
1467
|
+
if (scroll) {
|
|
1468
|
+
const nextFrame = typeof requestAnimationFrame === "function" ? requestAnimationFrame : (fn) => setTimeout(fn, 0);
|
|
1469
|
+
createEffect4(() => {
|
|
1470
|
+
const id = arrived();
|
|
1471
|
+
if (ctx.isRouting()) return;
|
|
1472
|
+
const next = arriving;
|
|
1473
|
+
if (!next || next.id !== id || id !== navigationId) return;
|
|
1474
|
+
arriving = null;
|
|
1475
|
+
nextFrame(() => {
|
|
1476
|
+
if (id === navigationId) scroll.arrive(next.location, next.from);
|
|
1477
|
+
});
|
|
1478
|
+
});
|
|
1479
|
+
}
|
|
1389
1480
|
const root = {
|
|
1390
1481
|
depth: -1,
|
|
1391
1482
|
matched,
|
|
@@ -1499,7 +1590,7 @@ function Link(props) {
|
|
|
1499
1590
|
}
|
|
1500
1591
|
|
|
1501
1592
|
// src/lib/core.ts
|
|
1502
|
-
import { html, svg } from "@fluixi/dom";
|
|
1593
|
+
import { html, svg, css } from "@fluixi/dom";
|
|
1503
1594
|
import {
|
|
1504
1595
|
query,
|
|
1505
1596
|
queryAll,
|
|
@@ -1647,6 +1738,7 @@ export {
|
|
|
1647
1738
|
createSignal9 as createSignal,
|
|
1648
1739
|
createStore,
|
|
1649
1740
|
createTheme,
|
|
1741
|
+
css,
|
|
1650
1742
|
core_default as default,
|
|
1651
1743
|
deferred,
|
|
1652
1744
|
delegate,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fluixi/core v1.0.0-alpha.
|
|
1
|
+
/*! @fluixi/core v1.0.0-alpha.95 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fluixi/core v1.0.0-alpha.
|
|
1
|
+
/*! @fluixi/core v1.0.0-alpha.95 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
|
|
3
3
|
// src/lib/i18n/index.ts
|
|
4
4
|
import { createSignal } from "@fluixi/reactive/signal";
|
package/dist/src/lib/index.cjs
CHANGED
|
@@ -114,7 +114,7 @@ var import_signal6 = require("@fluixi/reactive/signal");
|
|
|
114
114
|
var import_dom = require("@fluixi/dom");
|
|
115
115
|
|
|
116
116
|
// src/version.generated.ts
|
|
117
|
-
var VERSION = "1.0.0-alpha.
|
|
117
|
+
var VERSION = "1.0.0-alpha.95";
|
|
118
118
|
|
|
119
119
|
// src/lib/render/versions.ts
|
|
120
120
|
var import_dom2 = require("@fluixi/dom");
|
package/dist/src/lib/index.mjs
CHANGED
|
@@ -44,7 +44,7 @@ import { createRoot as createRoot2 } from "@fluixi/reactive/signal";
|
|
|
44
44
|
import { registerCoreVersion } from "@fluixi/dom";
|
|
45
45
|
|
|
46
46
|
// src/version.generated.ts
|
|
47
|
-
var VERSION = "1.0.0-alpha.
|
|
47
|
+
var VERSION = "1.0.0-alpha.95";
|
|
48
48
|
|
|
49
49
|
// src/lib/render/versions.ts
|
|
50
50
|
import { stampVersions, warnOnVersionSkew, versions } from "@fluixi/dom";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fluixi/core v1.0.0-alpha.
|
|
1
|
+
/*! @fluixi/core v1.0.0-alpha.95 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fluixi/core v1.0.0-alpha.
|
|
1
|
+
/*! @fluixi/core v1.0.0-alpha.95 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fluixi/core v1.0.0-alpha.
|
|
1
|
+
/*! @fluixi/core v1.0.0-alpha.95 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
|
|
3
3
|
// src/lib/jsx-runtime/jsx-dev-runtime.ts
|
|
4
4
|
export * from "@fluixi/jsx/jsx-dev-runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fluixi/core v1.0.0-alpha.
|
|
1
|
+
/*! @fluixi/core v1.0.0-alpha.95 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fluixi/core v1.0.0-alpha.
|
|
1
|
+
/*! @fluixi/core v1.0.0-alpha.95 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
|
|
3
3
|
// src/lib/plugins/vite.ts
|
|
4
4
|
import { fluixi, createVitePlugin } from "@fluixi/vite-plugin";
|
|
@@ -63,7 +63,7 @@ var import_signal6 = require("@fluixi/reactive/signal");
|
|
|
63
63
|
var import_dom = require("@fluixi/dom");
|
|
64
64
|
|
|
65
65
|
// src/version.generated.ts
|
|
66
|
-
var VERSION = "1.0.0-alpha.
|
|
66
|
+
var VERSION = "1.0.0-alpha.95";
|
|
67
67
|
|
|
68
68
|
// src/lib/render/versions.ts
|
|
69
69
|
var import_dom2 = require("@fluixi/dom");
|
|
@@ -6,7 +6,7 @@ import { createRoot as createRoot2 } from "@fluixi/reactive/signal";
|
|
|
6
6
|
import { registerCoreVersion } from "@fluixi/dom";
|
|
7
7
|
|
|
8
8
|
// src/version.generated.ts
|
|
9
|
-
var VERSION = "1.0.0-alpha.
|
|
9
|
+
var VERSION = "1.0.0-alpha.95";
|
|
10
10
|
|
|
11
11
|
// src/lib/render/versions.ts
|
|
12
12
|
import { stampVersions, warnOnVersionSkew, versions } from "@fluixi/dom";
|
|
@@ -28,7 +28,7 @@ module.exports = __toCommonJS(versions_exports);
|
|
|
28
28
|
var import_dom = require("@fluixi/dom");
|
|
29
29
|
|
|
30
30
|
// src/version.generated.ts
|
|
31
|
-
var VERSION = "1.0.0-alpha.
|
|
31
|
+
var VERSION = "1.0.0-alpha.95";
|
|
32
32
|
|
|
33
33
|
// src/lib/render/versions.ts
|
|
34
34
|
var import_dom2 = require("@fluixi/dom");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fluixi/core v1.0.0-alpha.
|
|
1
|
+
/*! @fluixi/core v1.0.0-alpha.95 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -113,6 +113,64 @@ var import_dom3 = require("@fluixi/dom");
|
|
|
113
113
|
var import_signal6 = require("@fluixi/reactive/signal");
|
|
114
114
|
var import_object = require("@fluixi/utils/object");
|
|
115
115
|
var import_compare = require("@fluixi/utils/compare");
|
|
116
|
+
|
|
117
|
+
// src/lib/router/scroll.ts
|
|
118
|
+
var STORE = "fx:scroll";
|
|
119
|
+
var KEEP = 100;
|
|
120
|
+
function keepScroll(initial) {
|
|
121
|
+
const read2 = () => {
|
|
122
|
+
try {
|
|
123
|
+
return JSON.parse(sessionStorage.getItem(STORE) ?? "{}");
|
|
124
|
+
} catch {
|
|
125
|
+
return {};
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const positions = read2();
|
|
129
|
+
const write = () => {
|
|
130
|
+
const keys = Object.keys(positions);
|
|
131
|
+
for (const key of keys.slice(0, Math.max(0, keys.length - KEEP))) delete positions[key];
|
|
132
|
+
try {
|
|
133
|
+
sessionStorage.setItem(STORE, JSON.stringify(positions));
|
|
134
|
+
} catch {
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
let current = initial.key;
|
|
138
|
+
const save = () => {
|
|
139
|
+
if (current === void 0) return;
|
|
140
|
+
delete positions[current];
|
|
141
|
+
positions[current] = window.scrollY;
|
|
142
|
+
write();
|
|
143
|
+
};
|
|
144
|
+
const restoration = history.scrollRestoration;
|
|
145
|
+
history.scrollRestoration = "manual";
|
|
146
|
+
window.addEventListener("pagehide", save);
|
|
147
|
+
const to = (top) => window.scrollTo({ top, left: 0, behavior: "instant" });
|
|
148
|
+
const toHash = (hash) => {
|
|
149
|
+
if (!hash || hash === "#") return false;
|
|
150
|
+
const target = document.getElementById(decodeURIComponent(hash.slice(1)));
|
|
151
|
+
target?.scrollIntoView({ behavior: "instant" });
|
|
152
|
+
return target !== null;
|
|
153
|
+
};
|
|
154
|
+
return {
|
|
155
|
+
leave: save,
|
|
156
|
+
arrive(location, from) {
|
|
157
|
+
current = location.key;
|
|
158
|
+
if (location.action === "pop" || from === void 0) {
|
|
159
|
+
const y = location.key === void 0 ? void 0 : positions[location.key];
|
|
160
|
+
if (y !== void 0) to(y);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (location.action === "replace" && location.pathname === from.pathname) return;
|
|
164
|
+
if (!toHash(location.hash)) to(0);
|
|
165
|
+
},
|
|
166
|
+
dispose() {
|
|
167
|
+
window.removeEventListener("pagehide", save);
|
|
168
|
+
history.scrollRestoration = restoration;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// src/lib/router/index.ts
|
|
116
174
|
var import_router = require("@fluixi/router");
|
|
117
175
|
|
|
118
176
|
// src/lib/router/data.ts
|
|
@@ -383,9 +441,20 @@ function renderLayer(m, depth, base) {
|
|
|
383
441
|
return router ? router.trackLoad(result) : result;
|
|
384
442
|
});
|
|
385
443
|
(0, import_signal5.onCleanup)(onRevalidate(() => void refetch()));
|
|
444
|
+
let loadedFor = (0, import_signal5.untrack)(() => JSON.stringify(base.matched()[depth]?.params ?? {}));
|
|
445
|
+
(0, import_signal5.createEffect)(() => {
|
|
446
|
+
const now = base.matched()[depth];
|
|
447
|
+
if (now?.route !== m.route) return;
|
|
448
|
+
const params = JSON.stringify(now.params ?? {});
|
|
449
|
+
if (params === loadedFor) return;
|
|
450
|
+
loadedFor = params;
|
|
451
|
+
(0, import_signal5.untrack)(() => void refetch());
|
|
452
|
+
});
|
|
386
453
|
data = () => {
|
|
387
454
|
const error = resource.error;
|
|
388
455
|
if (error !== void 0 && error !== null) throw error;
|
|
456
|
+
const r = resource;
|
|
457
|
+
if (r.state === "refreshing") return r.latest;
|
|
389
458
|
return resource();
|
|
390
459
|
};
|
|
391
460
|
Object.defineProperty(data, "loading", { get: () => resource.loading });
|
|
@@ -490,16 +559,19 @@ function buildDefaultNotFound() {
|
|
|
490
559
|
}
|
|
491
560
|
var pendingTransitionMode;
|
|
492
561
|
function Router(props) {
|
|
493
|
-
const
|
|
562
|
+
const history2 = props.history ?? (0, import_router.createBrowserHistory)();
|
|
494
563
|
const router = (0, import_router.createRouter)({
|
|
495
564
|
routes: props.routes,
|
|
496
565
|
base: props.base,
|
|
497
|
-
history
|
|
566
|
+
history: history2
|
|
498
567
|
});
|
|
499
568
|
const [state, setState] = (0, import_signal5.createSignal)(router.state());
|
|
500
569
|
const [navigating, setNavigating] = (0, import_signal5.createSignal)(false);
|
|
501
570
|
const [loads, setLoads] = (0, import_signal5.createSignal)(0);
|
|
502
571
|
let navigationId = 0;
|
|
572
|
+
const scroll = history2.window ? keepScroll(router.state().location) : void 0;
|
|
573
|
+
let arriving = scroll ? { id: 0, location: router.state().location, from: void 0 } : null;
|
|
574
|
+
const [arrived, setArrived] = (0, import_signal5.createSignal)(0);
|
|
503
575
|
const takeMode = () => {
|
|
504
576
|
const mode = pendingTransitionMode ?? (props.transition ?? "auto");
|
|
505
577
|
pendingTransitionMode = void 0;
|
|
@@ -509,6 +581,10 @@ function Router(props) {
|
|
|
509
581
|
const id = ++navigationId;
|
|
510
582
|
const mode = takeMode();
|
|
511
583
|
setNavigating(true);
|
|
584
|
+
if (scroll) {
|
|
585
|
+
scroll.leave();
|
|
586
|
+
arriving = { id, location: next.location, from: (0, import_signal5.untrack)(state).location };
|
|
587
|
+
}
|
|
512
588
|
const prepared = prepareComponents(
|
|
513
589
|
(next.match?.matched ?? []).map((m) => m.component).filter(Boolean)
|
|
514
590
|
);
|
|
@@ -516,6 +592,7 @@ function Router(props) {
|
|
|
516
592
|
setState(next);
|
|
517
593
|
const flushed = (0, import_signal5.flush)();
|
|
518
594
|
if (id === navigationId) setNavigating(false);
|
|
595
|
+
if (scroll) setArrived(id);
|
|
519
596
|
return flushed;
|
|
520
597
|
};
|
|
521
598
|
if (!prepared) {
|
|
@@ -529,6 +606,7 @@ function Router(props) {
|
|
|
529
606
|
});
|
|
530
607
|
(0, import_signal5.onCleanup)(() => {
|
|
531
608
|
unsub();
|
|
609
|
+
scroll?.dispose();
|
|
532
610
|
router.destroy();
|
|
533
611
|
navigationId++;
|
|
534
612
|
});
|
|
@@ -551,6 +629,19 @@ function Router(props) {
|
|
|
551
629
|
return result;
|
|
552
630
|
}
|
|
553
631
|
};
|
|
632
|
+
if (scroll) {
|
|
633
|
+
const nextFrame = typeof requestAnimationFrame === "function" ? requestAnimationFrame : (fn) => setTimeout(fn, 0);
|
|
634
|
+
(0, import_signal5.createEffect)(() => {
|
|
635
|
+
const id = arrived();
|
|
636
|
+
if (ctx.isRouting()) return;
|
|
637
|
+
const next = arriving;
|
|
638
|
+
if (!next || next.id !== id || id !== navigationId) return;
|
|
639
|
+
arriving = null;
|
|
640
|
+
nextFrame(() => {
|
|
641
|
+
if (id === navigationId) scroll.arrive(next.location, next.from);
|
|
642
|
+
});
|
|
643
|
+
});
|
|
644
|
+
}
|
|
554
645
|
const root = {
|
|
555
646
|
depth: -1,
|
|
556
647
|
matched,
|