crelte 0.5.5 → 0.5.7
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 @@
|
|
|
1
|
-
{"version":3,"file":"ClientRouter.d.ts","sourceRoot":"","sources":["../../../src/routing/router/ClientRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,UAAU,EAAE,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG7C,MAAM,MAAM,mBAAmB,GAAG;IACjC,kBAAkB,EAAE,OAAO,CAAC;CAC5B,GAAG,iBAAiB,CAAC;AAEtB,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,UAAU;IACnD,OAAO,CAAC,qBAAqB,CAAa;IAC1C,OAAO,CAAC,kBAAkB,CAAU;IAEpC,OAAO,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;gBAE5B,KAAK,EAAE,eAAe,EAAE,EAAE,IAAI,EAAE,mBAAmB;IAQ/D;;OAEG;IACG,IAAI;
|
|
1
|
+
{"version":3,"file":"ClientRouter.d.ts","sourceRoot":"","sources":["../../../src/routing/router/ClientRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,UAAU,EAAE,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG7C,MAAM,MAAM,mBAAmB,GAAG;IACjC,kBAAkB,EAAE,OAAO,CAAC;CAC5B,GAAG,iBAAiB,CAAC;AAEtB,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,UAAU;IACnD,OAAO,CAAC,qBAAqB,CAAa;IAC1C,OAAO,CAAC,kBAAkB,CAAU;IAEpC,OAAO,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;gBAE5B,KAAK,EAAE,eAAe,EAAE,EAAE,IAAI,EAAE,mBAAmB;IAQ/D;;OAEG;IACG,IAAI;IA8BV;;OAEG;IACG,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IA6ChD,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,GAAE,cAAmB;IAYpD,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,GAAE,cAAmB;IAiB7D,IAAI,IAAI,IAAI;IAIZ;;;OAGG;IACG,qBAAqB,CAC1B,GAAG,EAAE,OAAO,EACZ,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GACnC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IASxB,MAAM;IAgEN,QAAQ;IAgCR,YAAY,CAAC,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,GAAG,IAAI;CA8DpD"}
|
|
@@ -21,6 +21,10 @@ export default class ClientRouter extends BaseRouter {
|
|
|
21
21
|
disableScroll: true,
|
|
22
22
|
});
|
|
23
23
|
req.z_fillFromState(window.history.state);
|
|
24
|
+
if (req.inLivePreview()) {
|
|
25
|
+
const scrollY = parseInt(sessionStorage.getItem('live-preview-scroll') ?? '');
|
|
26
|
+
req.scrollY = Number.isInteger(scrollY) ? scrollY : null;
|
|
27
|
+
}
|
|
24
28
|
window.history.scrollRestoration = 'manual';
|
|
25
29
|
if (req.scrollY) {
|
|
26
30
|
// restore scroll position instantly (instead of waiting until svelte
|
|
@@ -187,19 +191,8 @@ export default class ClientRouter extends BaseRouter {
|
|
|
187
191
|
return;
|
|
188
192
|
// scroll to target
|
|
189
193
|
let scrollTo = null;
|
|
190
|
-
// if
|
|
191
|
-
|
|
192
|
-
if (req.inLivePreview()) {
|
|
193
|
-
const scrollY = sessionStorage.getItem('live-preview-scroll');
|
|
194
|
-
if (scrollY) {
|
|
195
|
-
scrollTo = {
|
|
196
|
-
top: parseInt(scrollY),
|
|
197
|
-
behavior: 'instant',
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
// if we have a hash and the route was not visited
|
|
201
|
-
}
|
|
202
|
-
else if (req.hash &&
|
|
194
|
+
// if we have a hash and the route was not visited
|
|
195
|
+
if (req.hash &&
|
|
203
196
|
((req.origin === 'init' && typeof req.scrollY !== 'number') ||
|
|
204
197
|
req.origin === 'click')) {
|
|
205
198
|
const el = document.getElementById(req.hash.substring(1));
|
package/dist/vite/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vite/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAEN,MAAM,EAMN,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vite/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAEN,MAAM,EAMN,MAAM,MAAM,CAAC;AA8Id,MAAM,MAAM,aAAa,GAAG;IAC3B,kEAAkE;IAClE,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,IAAI,CAAC,EAAE,aAAa,GAAG,MAAM,CAyK3D"}
|
package/dist/vite/index.js
CHANGED
|
@@ -22,16 +22,21 @@ function usedSsrComponents(code, id, options, svelte5) {
|
|
|
22
22
|
const file = relative('.', id);
|
|
23
23
|
let idx;
|
|
24
24
|
if (svelte5) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const initFnSign = '($$renderer, $$props) {';
|
|
28
|
-
idx = code.indexOf(initFnSign);
|
|
25
|
+
const defFnSign = 'export default function ';
|
|
26
|
+
idx = code.indexOf(defFnSign);
|
|
29
27
|
if (idx < 0)
|
|
30
28
|
return;
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
const withPropsIdx = code.indexOf('($$renderer, $$props) {', idx);
|
|
30
|
+
const noPropsIdx = code.indexOf('($$renderer) {', idx);
|
|
31
|
+
idx = withPropsIdx >= 0 ? withPropsIdx : noPropsIdx;
|
|
32
|
+
if (idx < 0) {
|
|
33
|
+
console.error('could not find svelte5 init', id);
|
|
34
34
|
return;
|
|
35
|
+
}
|
|
36
|
+
const renderCompSign = '$$renderer.component(($$renderer) => {';
|
|
37
|
+
const renderCompIdx = code.indexOf(renderCompSign, idx);
|
|
38
|
+
if (renderCompIdx >= 0)
|
|
39
|
+
idx = renderCompIdx;
|
|
35
40
|
// Find the end of the line where the pattern was found
|
|
36
41
|
idx = code.indexOf('\n', idx);
|
|
37
42
|
if (idx < 0)
|
package/package.json
CHANGED
|
@@ -36,6 +36,13 @@ export default class ClientRouter extends BaseRouter {
|
|
|
36
36
|
});
|
|
37
37
|
req.z_fillFromState(window.history.state);
|
|
38
38
|
|
|
39
|
+
if (req.inLivePreview()) {
|
|
40
|
+
const scrollY = parseInt(
|
|
41
|
+
sessionStorage.getItem('live-preview-scroll') ?? '',
|
|
42
|
+
);
|
|
43
|
+
req.scrollY = Number.isInteger(scrollY) ? scrollY : null;
|
|
44
|
+
}
|
|
45
|
+
|
|
39
46
|
window.history.scrollRestoration = 'manual';
|
|
40
47
|
if (req.scrollY) {
|
|
41
48
|
// restore scroll position instantly (instead of waiting until svelte
|
|
@@ -253,18 +260,8 @@ export default class ClientRouter extends BaseRouter {
|
|
|
253
260
|
| { intoView: HTMLElement; behavior: ScrollBehavior }
|
|
254
261
|
| null = null;
|
|
255
262
|
|
|
256
|
-
// if
|
|
257
|
-
|
|
258
|
-
if (req.inLivePreview()) {
|
|
259
|
-
const scrollY = sessionStorage.getItem('live-preview-scroll');
|
|
260
|
-
if (scrollY) {
|
|
261
|
-
scrollTo = {
|
|
262
|
-
top: parseInt(scrollY),
|
|
263
|
-
behavior: 'instant',
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
// if we have a hash and the route was not visited
|
|
267
|
-
} else if (
|
|
263
|
+
// if we have a hash and the route was not visited
|
|
264
|
+
if (
|
|
268
265
|
req.hash &&
|
|
269
266
|
((req.origin === 'init' && typeof req.scrollY !== 'number') ||
|
|
270
267
|
req.origin === 'click')
|
package/src/vite/index.ts
CHANGED
|
@@ -48,15 +48,21 @@ function usedSsrComponents(
|
|
|
48
48
|
|
|
49
49
|
let idx;
|
|
50
50
|
if (svelte5) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const initFnSign = '($$renderer, $$props) {';
|
|
54
|
-
idx = code.indexOf(initFnSign);
|
|
51
|
+
const defFnSign = 'export default function ';
|
|
52
|
+
idx = code.indexOf(defFnSign);
|
|
55
53
|
if (idx < 0) return;
|
|
56
54
|
|
|
55
|
+
const withPropsIdx = code.indexOf('($$renderer, $$props) {', idx);
|
|
56
|
+
const noPropsIdx = code.indexOf('($$renderer) {', idx);
|
|
57
|
+
idx = withPropsIdx >= 0 ? withPropsIdx : noPropsIdx;
|
|
58
|
+
if (idx < 0) {
|
|
59
|
+
console.error('could not find svelte5 init', id);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
57
63
|
const renderCompSign = '$$renderer.component(($$renderer) => {';
|
|
58
|
-
|
|
59
|
-
if (
|
|
64
|
+
const renderCompIdx = code.indexOf(renderCompSign, idx);
|
|
65
|
+
if (renderCompIdx >= 0) idx = renderCompIdx;
|
|
60
66
|
|
|
61
67
|
// Find the end of the line where the pattern was found
|
|
62
68
|
idx = code.indexOf('\n', idx);
|