@apisurf/wireui 0.1.2
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 +15 -0
- package/README.md +157 -0
- package/bin/wireui.mjs +233 -0
- package/dist/nitro.json +17 -0
- package/dist/public/assets/collections-CLHcfRfi.js +1 -0
- package/dist/public/assets/globals-CZiNFGaK.css +1 -0
- package/dist/public/assets/index-D5VFd_3H.js +14 -0
- package/dist/public/assets/kv-table-oB5gcq0i.js +2 -0
- package/dist/public/assets/query-BKAhHNIi.js +19 -0
- package/dist/public/assets/requests._requestId-Bu7E2eoI.js +1 -0
- package/dist/public/assets/routes-DDY2CfzA.js +1 -0
- package/dist/public/assets/runs._runId-CzwtVjYq.js +1 -0
- package/dist/public/assets/scoped-DB8raIWx.js +1 -0
- package/dist/public/assets/split-Br1RX2I4.js +1 -0
- package/dist/public/favicon.svg +1 -0
- package/dist/server/_chunks/ssr-renderer.mjs +26 -0
- package/dist/server/_libs/@tanstack/react-router+[...].mjs +15246 -0
- package/dist/server/_libs/h3+rou3+srvx.mjs +2086 -0
- package/dist/server/_libs/hookable.mjs +41 -0
- package/dist/server/_libs/tanstack__history.mjs +369 -0
- package/dist/server/_libs/ufo.mjs +64 -0
- package/dist/server/_runtime.mjs +35 -0
- package/dist/server/_ssr/api-Dw1Zb_PK.mjs +931 -0
- package/dist/server/_ssr/collections-CqidTQpw.mjs +495 -0
- package/dist/server/_ssr/empty-plugin-adapters-CCuiUfKt.mjs +5 -0
- package/dist/server/_ssr/kv-table-DQUkoItO.mjs +458 -0
- package/dist/server/_ssr/query-D4so9xiY.mjs +416 -0
- package/dist/server/_ssr/requests._requestId-BFukRwqL.mjs +942 -0
- package/dist/server/_ssr/router-CPcgc_kh.mjs +3176 -0
- package/dist/server/_ssr/routes-DaV9vGHn.mjs +375 -0
- package/dist/server/_ssr/runs._runId-Df_LmPHa.mjs +836 -0
- package/dist/server/_ssr/scoped-CnQ56K8h.mjs +42 -0
- package/dist/server/_ssr/split-DWrMIs7K.mjs +115 -0
- package/dist/server/_ssr/ssr.mjs +6827 -0
- package/dist/server/_ssr/start-zk_ZfrWl.mjs +4 -0
- package/dist/server/_tanstack-start-manifest_v-CARKjHfs.mjs +50 -0
- package/dist/server/index.mjs +368 -0
- package/package.json +71 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/hookable@6.1.2/node_modules/hookable/dist/index.mjs
|
|
2
|
+
function callHooks(hooks, args, startIndex, task) {
|
|
3
|
+
for (let i = startIndex; i < hooks.length; i += 1) try {
|
|
4
|
+
const result = task ? task.run(() => hooks[i](...args)) : hooks[i](...args);
|
|
5
|
+
if (result && typeof result.then === "function") return Promise.resolve(result).then(() => callHooks(hooks, args, i + 1, task));
|
|
6
|
+
} catch (error) {
|
|
7
|
+
return Promise.reject(error);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
var HookableCore = class {
|
|
11
|
+
_hooks;
|
|
12
|
+
constructor() {
|
|
13
|
+
this._hooks = {};
|
|
14
|
+
}
|
|
15
|
+
hook(name, fn) {
|
|
16
|
+
if (!name || typeof fn !== "function") return () => {};
|
|
17
|
+
this._hooks[name] = this._hooks[name] || [];
|
|
18
|
+
this._hooks[name].push(fn);
|
|
19
|
+
return () => {
|
|
20
|
+
if (fn) {
|
|
21
|
+
this.removeHook(name, fn);
|
|
22
|
+
fn = void 0;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
removeHook(name, function_) {
|
|
27
|
+
const hooks = this._hooks[name];
|
|
28
|
+
if (hooks) {
|
|
29
|
+
const index = hooks.indexOf(function_);
|
|
30
|
+
if (index !== -1) hooks.splice(index, 1);
|
|
31
|
+
if (hooks.length === 0) this._hooks[name] = void 0;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
callHook(name, ...args) {
|
|
35
|
+
const hooks = this._hooks[name];
|
|
36
|
+
if (!hooks || hooks.length === 0) return;
|
|
37
|
+
return callHooks(hooks.slice(), args, 0);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
41
|
+
export { HookableCore };
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/@tanstack+history@1.162.4/node_modules/@tanstack/history/dist/esm/index.js
|
|
2
|
+
var stateIndexKey = "__TSR_index";
|
|
3
|
+
var popStateEvent = "popstate";
|
|
4
|
+
var beforeUnloadEvent = "beforeunload";
|
|
5
|
+
/**
|
|
6
|
+
* Turn protocol-relative inputs such as "//evil.example" into paths
|
|
7
|
+
* such as "/evil.example", keeping navigation on the current origin.
|
|
8
|
+
*
|
|
9
|
+
* For HTTP(S) URLs, WHATWG parsing ignores leading C0 controls and spaces,
|
|
10
|
+
* removes tabs/newlines, and treats backslashes as slashes, so inputs like
|
|
11
|
+
* "/\evil.example" also need normalization. This only allocates when those
|
|
12
|
+
* rules would make the input protocol-relative.
|
|
13
|
+
*/
|
|
14
|
+
var protocolRelativePrefix = /^[\x00-\x20]*(?:[\\/][\t\n\r]*){2,}/;
|
|
15
|
+
function normalizeProtocolRelative(url) {
|
|
16
|
+
const match = protocolRelativePrefix.exec(url);
|
|
17
|
+
return match ? "/" + url.slice(match[0].length) : url;
|
|
18
|
+
}
|
|
19
|
+
function normalizeHref(href) {
|
|
20
|
+
if (/[\x00-\x1f\x7f]/.test(href)) href = href.replace(/[\x00-\x1f\x7f]/g, (character) => " \n\r".includes(character) ? "" : encodeURIComponent(character));
|
|
21
|
+
return normalizeProtocolRelative(href);
|
|
22
|
+
}
|
|
23
|
+
function createHistory(opts) {
|
|
24
|
+
let location = opts.getLocation();
|
|
25
|
+
const subscribers = /* @__PURE__ */ new Set();
|
|
26
|
+
const notify = (action) => {
|
|
27
|
+
location = opts.getLocation();
|
|
28
|
+
subscribers.forEach((subscriber) => subscriber({
|
|
29
|
+
location,
|
|
30
|
+
action
|
|
31
|
+
}));
|
|
32
|
+
};
|
|
33
|
+
const handleIndexChange = (action) => {
|
|
34
|
+
if (opts.notifyOnIndexChange ?? true) notify(action);
|
|
35
|
+
else location = opts.getLocation();
|
|
36
|
+
};
|
|
37
|
+
const tryNavigation = async ({ task, navigateOpts, ...actionInfo }) => {
|
|
38
|
+
if (navigateOpts?.ignoreBlocker ?? false) {
|
|
39
|
+
task();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const blockers = opts.getBlockers?.() ?? [];
|
|
43
|
+
const isPushOrReplace = actionInfo.type === "PUSH" || actionInfo.type === "REPLACE";
|
|
44
|
+
if (typeof document !== "undefined" && blockers.length && isPushOrReplace) for (const blocker of blockers) {
|
|
45
|
+
const nextLocation = parseHref(actionInfo.path, actionInfo.state);
|
|
46
|
+
if (await blocker.blockerFn({
|
|
47
|
+
currentLocation: location,
|
|
48
|
+
nextLocation,
|
|
49
|
+
action: actionInfo.type
|
|
50
|
+
})) {
|
|
51
|
+
opts.onBlocked?.();
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
task();
|
|
56
|
+
};
|
|
57
|
+
return {
|
|
58
|
+
get location() {
|
|
59
|
+
return location;
|
|
60
|
+
},
|
|
61
|
+
get length() {
|
|
62
|
+
return opts.getLength();
|
|
63
|
+
},
|
|
64
|
+
subscribers,
|
|
65
|
+
subscribe: (cb) => {
|
|
66
|
+
subscribers.add(cb);
|
|
67
|
+
return () => {
|
|
68
|
+
subscribers.delete(cb);
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
push: (path, state, navigateOpts) => {
|
|
72
|
+
const currentIndex = location.state[stateIndexKey];
|
|
73
|
+
state = assignKeyAndIndex(currentIndex + 1, state);
|
|
74
|
+
tryNavigation({
|
|
75
|
+
task: () => {
|
|
76
|
+
opts.pushState(path, state);
|
|
77
|
+
notify({ type: "PUSH" });
|
|
78
|
+
},
|
|
79
|
+
navigateOpts,
|
|
80
|
+
type: "PUSH",
|
|
81
|
+
path,
|
|
82
|
+
state
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
replace: (path, state, navigateOpts) => {
|
|
86
|
+
const currentIndex = location.state[stateIndexKey];
|
|
87
|
+
state = assignKeyAndIndex(currentIndex, state);
|
|
88
|
+
tryNavigation({
|
|
89
|
+
task: () => {
|
|
90
|
+
opts.replaceState(path, state);
|
|
91
|
+
notify({ type: "REPLACE" });
|
|
92
|
+
},
|
|
93
|
+
navigateOpts,
|
|
94
|
+
type: "REPLACE",
|
|
95
|
+
path,
|
|
96
|
+
state
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
go: (index, navigateOpts) => {
|
|
100
|
+
tryNavigation({
|
|
101
|
+
task: () => {
|
|
102
|
+
opts.go(index, navigateOpts?.ignoreBlocker ?? false);
|
|
103
|
+
handleIndexChange({
|
|
104
|
+
type: "GO",
|
|
105
|
+
index
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
navigateOpts,
|
|
109
|
+
type: "GO"
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
back: (navigateOpts) => {
|
|
113
|
+
tryNavigation({
|
|
114
|
+
task: () => {
|
|
115
|
+
opts.back(navigateOpts?.ignoreBlocker ?? false);
|
|
116
|
+
handleIndexChange({ type: "BACK" });
|
|
117
|
+
},
|
|
118
|
+
navigateOpts,
|
|
119
|
+
type: "BACK"
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
forward: (navigateOpts) => {
|
|
123
|
+
tryNavigation({
|
|
124
|
+
task: () => {
|
|
125
|
+
opts.forward(navigateOpts?.ignoreBlocker ?? false);
|
|
126
|
+
handleIndexChange({ type: "FORWARD" });
|
|
127
|
+
},
|
|
128
|
+
navigateOpts,
|
|
129
|
+
type: "FORWARD"
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
canGoBack: () => location.state[stateIndexKey] !== 0,
|
|
133
|
+
createHref: (str) => opts.createHref(str),
|
|
134
|
+
block: (blocker) => {
|
|
135
|
+
if (!opts.setBlockers) return () => {};
|
|
136
|
+
const blockers = opts.getBlockers?.() ?? [];
|
|
137
|
+
opts.setBlockers([...blockers, blocker]);
|
|
138
|
+
return () => {
|
|
139
|
+
const blockers = opts.getBlockers?.() ?? [];
|
|
140
|
+
opts.setBlockers?.(blockers.filter((b) => b !== blocker));
|
|
141
|
+
};
|
|
142
|
+
},
|
|
143
|
+
flush: () => opts.flush?.(),
|
|
144
|
+
destroy: () => opts.destroy?.(),
|
|
145
|
+
notify,
|
|
146
|
+
_getBlockers: () => opts.getBlockers?.() ?? []
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function assignKeyAndIndex(index, state) {
|
|
150
|
+
const key = createRandomKey();
|
|
151
|
+
return {
|
|
152
|
+
...state,
|
|
153
|
+
key,
|
|
154
|
+
__TSR_key: key,
|
|
155
|
+
[stateIndexKey]: index
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Creates a history object that can be used to interact with the browser's
|
|
160
|
+
* navigation. This is a lightweight API wrapping the browser's native methods.
|
|
161
|
+
* It is designed to work with TanStack Router, but could be used as a standalone API as well.
|
|
162
|
+
* IMPORTANT: This API implements history throttling via a microtask to prevent
|
|
163
|
+
* excessive calls to the history API. In some browsers, calling history.pushState or
|
|
164
|
+
* history.replaceState in quick succession can cause the browser to ignore subsequent
|
|
165
|
+
* calls. This API smooths out those differences and ensures that your application
|
|
166
|
+
* state will *eventually* match the browser state. In most cases, this is not a problem,
|
|
167
|
+
* but if you need to ensure that the browser state is up to date, you can use the
|
|
168
|
+
* `history.flush` method to immediately flush all pending state changes to the browser URL.
|
|
169
|
+
* @param opts
|
|
170
|
+
* @param opts.getHref A function that returns the current href (path + search + hash)
|
|
171
|
+
* @param opts.createHref A function that takes a path and returns a href (path + search + hash)
|
|
172
|
+
* @returns A history instance
|
|
173
|
+
*/
|
|
174
|
+
function createBrowserHistory(opts) {
|
|
175
|
+
const win = opts?.window ?? (typeof document !== "undefined" ? window : void 0);
|
|
176
|
+
const originalPushState = win.history.pushState;
|
|
177
|
+
const originalReplaceState = win.history.replaceState;
|
|
178
|
+
let blockers = [];
|
|
179
|
+
const _getBlockers = () => blockers;
|
|
180
|
+
const _setBlockers = (newBlockers) => blockers = newBlockers;
|
|
181
|
+
const createHref = (path) => normalizeHref(opts?.createHref ? opts.createHref(path) : path);
|
|
182
|
+
const parseLocation = opts?.parseLocation ?? (() => parseHref(`${win.location.pathname}${win.location.search}${win.location.hash}`, win.history.state));
|
|
183
|
+
if (!win.history.state?.__TSR_key && !win.history.state?.key) {
|
|
184
|
+
const addedKey = createRandomKey();
|
|
185
|
+
win.history.replaceState({
|
|
186
|
+
[stateIndexKey]: 0,
|
|
187
|
+
key: addedKey,
|
|
188
|
+
__TSR_key: addedKey
|
|
189
|
+
}, "");
|
|
190
|
+
}
|
|
191
|
+
let currentLocation = parseLocation();
|
|
192
|
+
let rollbackLocation;
|
|
193
|
+
let nextPopIsGo = false;
|
|
194
|
+
let ignoreNextPop = false;
|
|
195
|
+
let skipBlockerNextPop = false;
|
|
196
|
+
let ignoreNextBeforeUnload = false;
|
|
197
|
+
const getLocation = () => currentLocation;
|
|
198
|
+
let next;
|
|
199
|
+
const flush = () => {
|
|
200
|
+
if (!next) return;
|
|
201
|
+
history._ignoreSubscribers = true;
|
|
202
|
+
(next[2] ? win.history.pushState : win.history.replaceState)(next[1], "", next[0]);
|
|
203
|
+
history._ignoreSubscribers = false;
|
|
204
|
+
next = void 0;
|
|
205
|
+
rollbackLocation = void 0;
|
|
206
|
+
};
|
|
207
|
+
const queueHistoryAction = (isPush, destHref, state) => {
|
|
208
|
+
const href = opts?.createHref ? createHref(destHref) : void 0;
|
|
209
|
+
const hasPendingAction = !!next;
|
|
210
|
+
if (!hasPendingAction) rollbackLocation = currentLocation;
|
|
211
|
+
currentLocation = parseHref(destHref, state);
|
|
212
|
+
next = [
|
|
213
|
+
href ?? currentLocation.href,
|
|
214
|
+
state,
|
|
215
|
+
next?.[2] || isPush
|
|
216
|
+
];
|
|
217
|
+
if (!hasPendingAction) queueMicrotask(() => flush());
|
|
218
|
+
};
|
|
219
|
+
const onPushPop = (type) => {
|
|
220
|
+
currentLocation = parseLocation();
|
|
221
|
+
history.notify({ type });
|
|
222
|
+
};
|
|
223
|
+
const onPushPopEvent = async () => {
|
|
224
|
+
ignoreNextBeforeUnload = false;
|
|
225
|
+
if (ignoreNextPop) {
|
|
226
|
+
ignoreNextPop = false;
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
const nextLocation = parseLocation();
|
|
230
|
+
const delta = nextLocation.state[stateIndexKey] - currentLocation.state[stateIndexKey];
|
|
231
|
+
const isForward = delta === 1;
|
|
232
|
+
const isBack = delta === -1;
|
|
233
|
+
const isGo = !isForward && !isBack || nextPopIsGo;
|
|
234
|
+
nextPopIsGo = false;
|
|
235
|
+
const action = isGo ? "GO" : isBack ? "BACK" : "FORWARD";
|
|
236
|
+
const notify = isGo ? {
|
|
237
|
+
type: "GO",
|
|
238
|
+
index: delta
|
|
239
|
+
} : { type: isBack ? "BACK" : "FORWARD" };
|
|
240
|
+
if (skipBlockerNextPop) skipBlockerNextPop = false;
|
|
241
|
+
else {
|
|
242
|
+
const blockers = _getBlockers();
|
|
243
|
+
if (typeof document !== "undefined" && blockers.length) {
|
|
244
|
+
for (const blocker of blockers) if (await blocker.blockerFn({
|
|
245
|
+
currentLocation,
|
|
246
|
+
nextLocation,
|
|
247
|
+
action
|
|
248
|
+
})) {
|
|
249
|
+
ignoreNextPop = true;
|
|
250
|
+
win.history.go(-delta);
|
|
251
|
+
history.notify(notify);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
currentLocation = parseLocation();
|
|
257
|
+
history.notify(notify);
|
|
258
|
+
};
|
|
259
|
+
const onBeforeUnload = (e) => {
|
|
260
|
+
if (ignoreNextBeforeUnload) {
|
|
261
|
+
ignoreNextBeforeUnload = false;
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
let shouldBlock = false;
|
|
265
|
+
const blockers = _getBlockers();
|
|
266
|
+
if (typeof document !== "undefined" && blockers.length) for (const blocker of blockers) {
|
|
267
|
+
const shouldHaveBeforeUnload = blocker.enableBeforeUnload ?? true;
|
|
268
|
+
if (shouldHaveBeforeUnload === true) {
|
|
269
|
+
shouldBlock = true;
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
if (typeof shouldHaveBeforeUnload === "function" && shouldHaveBeforeUnload() === true) {
|
|
273
|
+
shouldBlock = true;
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
if (shouldBlock) {
|
|
278
|
+
e.preventDefault();
|
|
279
|
+
return e.returnValue = "";
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
const history = createHistory({
|
|
283
|
+
getLocation,
|
|
284
|
+
getLength: () => win.history.length,
|
|
285
|
+
pushState: (href, state) => queueHistoryAction(true, href, state),
|
|
286
|
+
replaceState: (href, state) => queueHistoryAction(false, href, state),
|
|
287
|
+
back: (ignoreBlocker) => {
|
|
288
|
+
if (ignoreBlocker) {
|
|
289
|
+
skipBlockerNextPop = true;
|
|
290
|
+
ignoreNextBeforeUnload = true;
|
|
291
|
+
}
|
|
292
|
+
return win.history.back();
|
|
293
|
+
},
|
|
294
|
+
forward: (ignoreBlocker) => {
|
|
295
|
+
if (ignoreBlocker) {
|
|
296
|
+
skipBlockerNextPop = true;
|
|
297
|
+
ignoreNextBeforeUnload = true;
|
|
298
|
+
}
|
|
299
|
+
win.history.forward();
|
|
300
|
+
},
|
|
301
|
+
go: (n, ignoreBlocker) => {
|
|
302
|
+
nextPopIsGo = true;
|
|
303
|
+
if (ignoreBlocker) {
|
|
304
|
+
skipBlockerNextPop = true;
|
|
305
|
+
ignoreNextBeforeUnload = true;
|
|
306
|
+
}
|
|
307
|
+
win.history.go(n);
|
|
308
|
+
},
|
|
309
|
+
createHref: (href) => createHref(href),
|
|
310
|
+
flush,
|
|
311
|
+
destroy: () => {
|
|
312
|
+
win.history.pushState = originalPushState;
|
|
313
|
+
win.history.replaceState = originalReplaceState;
|
|
314
|
+
win.removeEventListener(beforeUnloadEvent, onBeforeUnload, { capture: true });
|
|
315
|
+
win.removeEventListener(popStateEvent, onPushPopEvent);
|
|
316
|
+
},
|
|
317
|
+
onBlocked: () => {
|
|
318
|
+
if (rollbackLocation && currentLocation !== rollbackLocation) currentLocation = rollbackLocation;
|
|
319
|
+
},
|
|
320
|
+
getBlockers: _getBlockers,
|
|
321
|
+
setBlockers: _setBlockers,
|
|
322
|
+
notifyOnIndexChange: false
|
|
323
|
+
});
|
|
324
|
+
history._ignoreNextBeforeUnload = (href) => {
|
|
325
|
+
ignoreNextBeforeUnload = false;
|
|
326
|
+
try {
|
|
327
|
+
href = new URL(href, win.document.baseURI).href;
|
|
328
|
+
ignoreNextBeforeUnload = /^https?:/.test(href) && (!href.includes("#") || href.split("#")[0] !== win.location.href.split("#")[0]);
|
|
329
|
+
} catch {}
|
|
330
|
+
};
|
|
331
|
+
win.addEventListener(beforeUnloadEvent, onBeforeUnload, { capture: true });
|
|
332
|
+
win.addEventListener(popStateEvent, onPushPopEvent);
|
|
333
|
+
win.history.pushState = function(...args) {
|
|
334
|
+
const res = originalPushState.apply(win.history, args);
|
|
335
|
+
if (!history._ignoreSubscribers) onPushPop("PUSH");
|
|
336
|
+
return res;
|
|
337
|
+
};
|
|
338
|
+
win.history.replaceState = function(...args) {
|
|
339
|
+
const res = originalReplaceState.apply(win.history, args);
|
|
340
|
+
if (!history._ignoreSubscribers) onPushPop("REPLACE");
|
|
341
|
+
return res;
|
|
342
|
+
};
|
|
343
|
+
return history;
|
|
344
|
+
}
|
|
345
|
+
function parseHref(href, state) {
|
|
346
|
+
const sanitizedHref = normalizeHref(href);
|
|
347
|
+
const hashIndex = sanitizedHref.indexOf("#");
|
|
348
|
+
const searchIndex = sanitizedHref.indexOf("?");
|
|
349
|
+
if (!state) {
|
|
350
|
+
const key = createRandomKey();
|
|
351
|
+
state = {
|
|
352
|
+
[stateIndexKey]: 0,
|
|
353
|
+
key,
|
|
354
|
+
__TSR_key: key
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
return {
|
|
358
|
+
href: sanitizedHref,
|
|
359
|
+
pathname: sanitizedHref.substring(0, hashIndex > 0 ? searchIndex > 0 ? Math.min(hashIndex, searchIndex) : hashIndex : searchIndex > 0 ? searchIndex : sanitizedHref.length),
|
|
360
|
+
hash: hashIndex > -1 ? sanitizedHref.substring(hashIndex) : "",
|
|
361
|
+
search: searchIndex > -1 ? sanitizedHref.slice(searchIndex, hashIndex === -1 ? void 0 : hashIndex) : "",
|
|
362
|
+
state
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
function createRandomKey() {
|
|
366
|
+
return (Math.random() + 1).toString(36).substring(7);
|
|
367
|
+
}
|
|
368
|
+
//#endregion
|
|
369
|
+
export { createBrowserHistory, normalizeProtocolRelative, parseHref };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
String.fromCharCode;
|
|
2
|
+
var ENC_SLASH_RE = /%2f/gi;
|
|
3
|
+
function decode(text = "") {
|
|
4
|
+
try {
|
|
5
|
+
return decodeURIComponent("" + text);
|
|
6
|
+
} catch {
|
|
7
|
+
return "" + text;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function decodePath(text) {
|
|
11
|
+
return decode(text.replace(ENC_SLASH_RE, "%252F"));
|
|
12
|
+
}
|
|
13
|
+
var TRAILING_SLASH_RE = /\/$|\/\?|\/#/;
|
|
14
|
+
var JOIN_LEADING_SLASH_RE = /^\.?\//;
|
|
15
|
+
function hasTrailingSlash(input = "", respectQueryAndFragment) {
|
|
16
|
+
if (!respectQueryAndFragment) return input.endsWith("/");
|
|
17
|
+
return TRAILING_SLASH_RE.test(input);
|
|
18
|
+
}
|
|
19
|
+
function withoutTrailingSlash(input = "", respectQueryAndFragment) {
|
|
20
|
+
if (!respectQueryAndFragment) return (hasTrailingSlash(input) ? input.slice(0, -1) : input) || "/";
|
|
21
|
+
if (!hasTrailingSlash(input, true)) return input || "/";
|
|
22
|
+
let path = input;
|
|
23
|
+
let fragment = "";
|
|
24
|
+
const fragmentIndex = input.indexOf("#");
|
|
25
|
+
if (fragmentIndex !== -1) {
|
|
26
|
+
path = input.slice(0, fragmentIndex);
|
|
27
|
+
fragment = input.slice(fragmentIndex);
|
|
28
|
+
}
|
|
29
|
+
const [s0, ...s] = path.split("?");
|
|
30
|
+
return ((s0.endsWith("/") ? s0.slice(0, -1) : s0) || "/") + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
|
|
31
|
+
}
|
|
32
|
+
function withTrailingSlash(input = "", respectQueryAndFragment) {
|
|
33
|
+
if (!respectQueryAndFragment) return input.endsWith("/") ? input : input + "/";
|
|
34
|
+
if (hasTrailingSlash(input, true)) return input || "/";
|
|
35
|
+
let path = input;
|
|
36
|
+
let fragment = "";
|
|
37
|
+
const fragmentIndex = input.indexOf("#");
|
|
38
|
+
if (fragmentIndex !== -1) {
|
|
39
|
+
path = input.slice(0, fragmentIndex);
|
|
40
|
+
fragment = input.slice(fragmentIndex);
|
|
41
|
+
if (!path) return fragment;
|
|
42
|
+
}
|
|
43
|
+
const [s0, ...s] = path.split("?");
|
|
44
|
+
return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
|
|
45
|
+
}
|
|
46
|
+
function hasLeadingSlash(input = "") {
|
|
47
|
+
return input.startsWith("/");
|
|
48
|
+
}
|
|
49
|
+
function withLeadingSlash(input = "") {
|
|
50
|
+
return hasLeadingSlash(input) ? input : "/" + input;
|
|
51
|
+
}
|
|
52
|
+
function isNonEmptyURL(url) {
|
|
53
|
+
return url && url !== "/";
|
|
54
|
+
}
|
|
55
|
+
function joinURL(base, ...input) {
|
|
56
|
+
let url = base || "";
|
|
57
|
+
for (const segment of input.filter((url2) => isNonEmptyURL(url2))) if (url) {
|
|
58
|
+
const _segment = segment.replace(JOIN_LEADING_SLASH_RE, "");
|
|
59
|
+
url = withTrailingSlash(url) + _segment;
|
|
60
|
+
} else url = segment;
|
|
61
|
+
return url;
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
export { decodePath, joinURL, withLeadingSlash, withoutTrailingSlash };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
10
|
+
var __exportAll = (all, no_symbols) => {
|
|
11
|
+
let target = {};
|
|
12
|
+
for (var name in all) __defProp(target, name, {
|
|
13
|
+
get: all[name],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
17
|
+
return target;
|
|
18
|
+
};
|
|
19
|
+
var __copyProps = (to, from, except, desc) => {
|
|
20
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
21
|
+
key = keys[i];
|
|
22
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
23
|
+
get: ((k) => from[k]).bind(null, key),
|
|
24
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return to;
|
|
28
|
+
};
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
30
|
+
value: mod,
|
|
31
|
+
enumerable: true
|
|
32
|
+
}) : target, mod));
|
|
33
|
+
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
34
|
+
//#endregion
|
|
35
|
+
export { __commonJSMin, __exportAll, __require, __toESM };
|