@tanstack/router-devtools-core 1.132.37 → 1.132.44
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/cjs/node_modules/.pnpm/solid-js@1.9.5/node_modules/solid-js/dist/solid.cjs +792 -0
- package/dist/cjs/node_modules/.pnpm/solid-js@1.9.5/node_modules/solid-js/dist/solid.cjs.map +1 -0
- package/dist/cjs/node_modules/.pnpm/solid-js@1.9.5/node_modules/solid-js/web/dist/web.cjs +675 -0
- package/dist/cjs/node_modules/.pnpm/solid-js@1.9.5/node_modules/solid-js/web/dist/web.cjs.map +1 -0
- package/dist/cjs/{AgeTicker.cjs → packages/router-devtools-core/src/AgeTicker.cjs} +3 -2
- package/dist/cjs/packages/router-devtools-core/src/AgeTicker.cjs.map +1 -0
- package/dist/cjs/{BaseTanStackRouterDevtoolsPanel.cjs → packages/router-devtools-core/src/BaseTanStackRouterDevtoolsPanel.cjs} +66 -66
- package/dist/cjs/packages/router-devtools-core/src/BaseTanStackRouterDevtoolsPanel.cjs.map +1 -0
- package/dist/cjs/{Explorer.cjs → packages/router-devtools-core/src/Explorer.cjs} +27 -27
- package/dist/cjs/packages/router-devtools-core/src/Explorer.cjs.map +1 -0
- package/dist/cjs/{FloatingTanStackRouterDevtools.cjs → packages/router-devtools-core/src/FloatingTanStackRouterDevtools.cjs} +19 -19
- package/dist/cjs/packages/router-devtools-core/src/FloatingTanStackRouterDevtools.cjs.map +1 -0
- package/dist/cjs/{NavigateButton.cjs → packages/router-devtools-core/src/NavigateButton.cjs} +3 -2
- package/dist/cjs/packages/router-devtools-core/src/NavigateButton.cjs.map +1 -0
- package/dist/cjs/{TanStackRouterDevtoolsCore.cjs → packages/router-devtools-core/src/TanStackRouterDevtoolsCore.cjs} +7 -7
- package/dist/cjs/packages/router-devtools-core/src/TanStackRouterDevtoolsCore.cjs.map +1 -0
- package/dist/cjs/{TanStackRouterDevtoolsPanelCore.cjs → packages/router-devtools-core/src/TanStackRouterDevtoolsPanelCore.cjs} +10 -10
- package/dist/cjs/packages/router-devtools-core/src/TanStackRouterDevtoolsPanelCore.cjs.map +1 -0
- package/dist/cjs/{context.cjs → packages/router-devtools-core/src/context.cjs} +4 -4
- package/dist/cjs/packages/router-devtools-core/src/context.cjs.map +1 -0
- package/dist/cjs/{logo.cjs → packages/router-devtools-core/src/logo.cjs} +3 -3
- package/dist/cjs/packages/router-devtools-core/src/logo.cjs.map +1 -0
- package/dist/cjs/packages/router-devtools-core/src/tokens.cjs.map +1 -0
- package/dist/cjs/{useLocalStorage.cjs → packages/router-devtools-core/src/useLocalStorage.cjs} +3 -3
- package/dist/cjs/packages/router-devtools-core/src/useLocalStorage.cjs.map +1 -0
- package/dist/cjs/{useStyles.cjs → packages/router-devtools-core/src/useStyles.cjs} +3 -3
- package/dist/cjs/packages/router-devtools-core/src/useStyles.cjs.map +1 -0
- package/dist/cjs/{utils.cjs → packages/router-devtools-core/src/utils.cjs} +3 -4
- package/dist/cjs/packages/router-devtools-core/src/utils.cjs.map +1 -0
- package/dist/esm/node_modules/.pnpm/solid-js@1.9.5/node_modules/solid-js/dist/solid.js +792 -0
- package/dist/esm/node_modules/.pnpm/solid-js@1.9.5/node_modules/solid-js/dist/solid.js.map +1 -0
- package/dist/esm/node_modules/.pnpm/solid-js@1.9.5/node_modules/solid-js/web/dist/web.js +676 -0
- package/dist/esm/node_modules/.pnpm/solid-js@1.9.5/node_modules/solid-js/web/dist/web.js.map +1 -0
- package/dist/esm/{AgeTicker.js → packages/router-devtools-core/src/AgeTicker.js} +3 -2
- package/dist/esm/packages/router-devtools-core/src/AgeTicker.js.map +1 -0
- package/dist/esm/{BaseTanStackRouterDevtoolsPanel.js → packages/router-devtools-core/src/BaseTanStackRouterDevtoolsPanel.js} +33 -33
- package/dist/esm/packages/router-devtools-core/src/BaseTanStackRouterDevtoolsPanel.js.map +1 -0
- package/dist/esm/{Explorer.js → packages/router-devtools-core/src/Explorer.js} +15 -15
- package/dist/esm/packages/router-devtools-core/src/Explorer.js.map +1 -0
- package/dist/esm/{FloatingTanStackRouterDevtools.js → packages/router-devtools-core/src/FloatingTanStackRouterDevtools.js} +3 -3
- package/dist/esm/packages/router-devtools-core/src/FloatingTanStackRouterDevtools.js.map +1 -0
- package/dist/esm/{NavigateButton.js → packages/router-devtools-core/src/NavigateButton.js} +3 -2
- package/dist/esm/packages/router-devtools-core/src/NavigateButton.js.map +1 -0
- package/dist/esm/{TanStackRouterDevtoolsCore.js → packages/router-devtools-core/src/TanStackRouterDevtoolsCore.js} +2 -2
- package/dist/esm/packages/router-devtools-core/src/TanStackRouterDevtoolsCore.js.map +1 -0
- package/dist/esm/{TanStackRouterDevtoolsPanelCore.js → packages/router-devtools-core/src/TanStackRouterDevtoolsPanelCore.js} +3 -3
- package/dist/esm/packages/router-devtools-core/src/TanStackRouterDevtoolsPanelCore.js.map +1 -0
- package/dist/esm/{context.js → packages/router-devtools-core/src/context.js} +1 -1
- package/dist/esm/packages/router-devtools-core/src/context.js.map +1 -0
- package/dist/esm/{logo.js → packages/router-devtools-core/src/logo.js} +2 -2
- package/dist/esm/packages/router-devtools-core/src/logo.js.map +1 -0
- package/dist/esm/packages/router-devtools-core/src/tokens.js.map +1 -0
- package/dist/esm/{useLocalStorage.js → packages/router-devtools-core/src/useLocalStorage.js} +1 -1
- package/dist/esm/packages/router-devtools-core/src/useLocalStorage.js.map +1 -0
- package/dist/esm/{useStyles.js → packages/router-devtools-core/src/useStyles.js} +1 -1
- package/dist/esm/packages/router-devtools-core/src/useStyles.js.map +1 -0
- package/dist/esm/{utils.js → packages/router-devtools-core/src/utils.js} +1 -2
- package/dist/esm/packages/router-devtools-core/src/utils.js.map +1 -0
- package/package.json +7 -8
- package/dist/cjs/AgeTicker.cjs.map +0 -1
- package/dist/cjs/BaseTanStackRouterDevtoolsPanel.cjs.map +0 -1
- package/dist/cjs/Explorer.cjs.map +0 -1
- package/dist/cjs/FloatingTanStackRouterDevtools.cjs.map +0 -1
- package/dist/cjs/NavigateButton.cjs.map +0 -1
- package/dist/cjs/TanStackRouterDevtoolsCore.cjs.map +0 -1
- package/dist/cjs/TanStackRouterDevtoolsPanelCore.cjs.map +0 -1
- package/dist/cjs/context.cjs.map +0 -1
- package/dist/cjs/logo.cjs.map +0 -1
- package/dist/cjs/tokens.cjs.map +0 -1
- package/dist/cjs/useLocalStorage.cjs.map +0 -1
- package/dist/cjs/useStyles.cjs.map +0 -1
- package/dist/cjs/utils.cjs.map +0 -1
- package/dist/esm/AgeTicker.js.map +0 -1
- package/dist/esm/BaseTanStackRouterDevtoolsPanel.js.map +0 -1
- package/dist/esm/Explorer.js.map +0 -1
- package/dist/esm/FloatingTanStackRouterDevtools.js.map +0 -1
- package/dist/esm/NavigateButton.js.map +0 -1
- package/dist/esm/TanStackRouterDevtoolsCore.js.map +0 -1
- package/dist/esm/TanStackRouterDevtoolsPanelCore.js.map +0 -1
- package/dist/esm/context.js.map +0 -1
- package/dist/esm/logo.js.map +0 -1
- package/dist/esm/tokens.js.map +0 -1
- package/dist/esm/useLocalStorage.js.map +0 -1
- package/dist/esm/useStyles.js.map +0 -1
- package/dist/esm/utils.js.map +0 -1
- /package/dist/cjs/{index.cjs → packages/router-devtools-core/src/index.cjs} +0 -0
- /package/dist/cjs/{index.cjs.map → packages/router-devtools-core/src/index.cjs.map} +0 -0
- /package/dist/cjs/{tokens.cjs → packages/router-devtools-core/src/tokens.cjs} +0 -0
- /package/dist/esm/{index.js → packages/router-devtools-core/src/index.js} +0 -0
- /package/dist/esm/{index.js.map → packages/router-devtools-core/src/index.js.map} +0 -0
- /package/dist/esm/{tokens.js → packages/router-devtools-core/src/tokens.js} +0 -0
|
@@ -0,0 +1,792 @@
|
|
|
1
|
+
const sharedConfig = {
|
|
2
|
+
context: void 0,
|
|
3
|
+
registry: void 0,
|
|
4
|
+
effects: void 0,
|
|
5
|
+
done: false,
|
|
6
|
+
getContextId() {
|
|
7
|
+
return getContextId(this.context.count);
|
|
8
|
+
},
|
|
9
|
+
getNextContextId() {
|
|
10
|
+
return getContextId(this.context.count++);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
function getContextId(count) {
|
|
14
|
+
const num = String(count), len = num.length - 1;
|
|
15
|
+
return sharedConfig.context.id + (len ? String.fromCharCode(96 + len) : "") + num;
|
|
16
|
+
}
|
|
17
|
+
function setHydrateContext(context) {
|
|
18
|
+
sharedConfig.context = context;
|
|
19
|
+
}
|
|
20
|
+
const IS_DEV = false;
|
|
21
|
+
const equalFn = (a, b) => a === b;
|
|
22
|
+
const $PROXY = Symbol("solid-proxy");
|
|
23
|
+
const SUPPORTS_PROXY = typeof Proxy === "function";
|
|
24
|
+
const signalOptions = {
|
|
25
|
+
equals: equalFn
|
|
26
|
+
};
|
|
27
|
+
let runEffects = runQueue;
|
|
28
|
+
const STALE = 1;
|
|
29
|
+
const PENDING = 2;
|
|
30
|
+
const UNOWNED = {
|
|
31
|
+
owned: null,
|
|
32
|
+
cleanups: null,
|
|
33
|
+
context: null,
|
|
34
|
+
owner: null
|
|
35
|
+
};
|
|
36
|
+
const NO_INIT = {};
|
|
37
|
+
var Owner = null;
|
|
38
|
+
let Transition = null;
|
|
39
|
+
let ExternalSourceConfig = null;
|
|
40
|
+
let Listener = null;
|
|
41
|
+
let Updates = null;
|
|
42
|
+
let Effects = null;
|
|
43
|
+
let ExecCount = 0;
|
|
44
|
+
function createRoot(fn, detachedOwner) {
|
|
45
|
+
const listener = Listener, owner = Owner, unowned = fn.length === 0, current = detachedOwner === void 0 ? owner : detachedOwner, root = unowned ? UNOWNED : {
|
|
46
|
+
owned: null,
|
|
47
|
+
cleanups: null,
|
|
48
|
+
context: current ? current.context : null,
|
|
49
|
+
owner: current
|
|
50
|
+
}, updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
|
|
51
|
+
Owner = root;
|
|
52
|
+
Listener = null;
|
|
53
|
+
try {
|
|
54
|
+
return runUpdates(updateFn, true);
|
|
55
|
+
} finally {
|
|
56
|
+
Listener = listener;
|
|
57
|
+
Owner = owner;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function createSignal(value, options) {
|
|
61
|
+
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
62
|
+
const s = {
|
|
63
|
+
value,
|
|
64
|
+
observers: null,
|
|
65
|
+
observerSlots: null,
|
|
66
|
+
comparator: options.equals || void 0
|
|
67
|
+
};
|
|
68
|
+
const setter = (value2) => {
|
|
69
|
+
if (typeof value2 === "function") {
|
|
70
|
+
value2 = value2(s.value);
|
|
71
|
+
}
|
|
72
|
+
return writeSignal(s, value2);
|
|
73
|
+
};
|
|
74
|
+
return [readSignal.bind(s), setter];
|
|
75
|
+
}
|
|
76
|
+
function createComputed(fn, value, options) {
|
|
77
|
+
const c = createComputation(fn, value, true, STALE);
|
|
78
|
+
updateComputation(c);
|
|
79
|
+
}
|
|
80
|
+
function createRenderEffect(fn, value, options) {
|
|
81
|
+
const c = createComputation(fn, value, false, STALE);
|
|
82
|
+
updateComputation(c);
|
|
83
|
+
}
|
|
84
|
+
function createEffect(fn, value, options) {
|
|
85
|
+
runEffects = runUserEffects;
|
|
86
|
+
const c = createComputation(fn, value, false, STALE);
|
|
87
|
+
if (!options || !options.render) c.user = true;
|
|
88
|
+
Effects ? Effects.push(c) : updateComputation(c);
|
|
89
|
+
}
|
|
90
|
+
function createMemo(fn, value, options) {
|
|
91
|
+
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
92
|
+
const c = createComputation(fn, value, true, 0);
|
|
93
|
+
c.observers = null;
|
|
94
|
+
c.observerSlots = null;
|
|
95
|
+
c.comparator = options.equals || void 0;
|
|
96
|
+
updateComputation(c);
|
|
97
|
+
return readSignal.bind(c);
|
|
98
|
+
}
|
|
99
|
+
function isPromise(v) {
|
|
100
|
+
return v && typeof v === "object" && "then" in v;
|
|
101
|
+
}
|
|
102
|
+
function createResource(pSource, pFetcher, pOptions) {
|
|
103
|
+
let source;
|
|
104
|
+
let fetcher;
|
|
105
|
+
let options;
|
|
106
|
+
{
|
|
107
|
+
source = true;
|
|
108
|
+
fetcher = pSource;
|
|
109
|
+
options = {};
|
|
110
|
+
}
|
|
111
|
+
let pr = null, initP = NO_INIT, id = null, scheduled = false, resolved = "initialValue" in options, dynamic = typeof source === "function" && createMemo(source);
|
|
112
|
+
const contexts = /* @__PURE__ */ new Set(), [value, setValue] = (options.storage || createSignal)(options.initialValue), [error, setError] = createSignal(void 0), [track, trigger] = createSignal(void 0, {
|
|
113
|
+
equals: false
|
|
114
|
+
}), [state, setState] = createSignal(resolved ? "ready" : "unresolved");
|
|
115
|
+
if (sharedConfig.context) {
|
|
116
|
+
id = sharedConfig.getNextContextId();
|
|
117
|
+
if (options.ssrLoadFrom === "initial") initP = options.initialValue;
|
|
118
|
+
else if (sharedConfig.load && sharedConfig.has(id)) initP = sharedConfig.load(id);
|
|
119
|
+
}
|
|
120
|
+
function loadEnd(p, v, error2, key) {
|
|
121
|
+
if (pr === p) {
|
|
122
|
+
pr = null;
|
|
123
|
+
key !== void 0 && (resolved = true);
|
|
124
|
+
if ((p === initP || v === initP) && options.onHydrated)
|
|
125
|
+
queueMicrotask(
|
|
126
|
+
() => options.onHydrated(key, {
|
|
127
|
+
value: v
|
|
128
|
+
})
|
|
129
|
+
);
|
|
130
|
+
initP = NO_INIT;
|
|
131
|
+
completeLoad(v, error2);
|
|
132
|
+
}
|
|
133
|
+
return v;
|
|
134
|
+
}
|
|
135
|
+
function completeLoad(v, err) {
|
|
136
|
+
runUpdates(() => {
|
|
137
|
+
if (err === void 0) setValue(() => v);
|
|
138
|
+
setState(err !== void 0 ? "errored" : resolved ? "ready" : "unresolved");
|
|
139
|
+
setError(err);
|
|
140
|
+
for (const c of contexts.keys()) c.decrement();
|
|
141
|
+
contexts.clear();
|
|
142
|
+
}, false);
|
|
143
|
+
}
|
|
144
|
+
function read() {
|
|
145
|
+
const c = SuspenseContext, v = value(), err = error();
|
|
146
|
+
if (err !== void 0 && !pr) throw err;
|
|
147
|
+
if (Listener && !Listener.user && c) ;
|
|
148
|
+
return v;
|
|
149
|
+
}
|
|
150
|
+
function load(refetching = true) {
|
|
151
|
+
if (refetching !== false && scheduled) return;
|
|
152
|
+
scheduled = false;
|
|
153
|
+
const lookup = dynamic ? dynamic() : source;
|
|
154
|
+
if (lookup == null || lookup === false) {
|
|
155
|
+
loadEnd(pr, untrack(value));
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const p = initP !== NO_INIT ? initP : untrack(
|
|
159
|
+
() => fetcher(lookup, {
|
|
160
|
+
value: value(),
|
|
161
|
+
refetching
|
|
162
|
+
})
|
|
163
|
+
);
|
|
164
|
+
if (!isPromise(p)) {
|
|
165
|
+
loadEnd(pr, p, void 0, lookup);
|
|
166
|
+
return p;
|
|
167
|
+
}
|
|
168
|
+
pr = p;
|
|
169
|
+
if ("value" in p) {
|
|
170
|
+
if (p.status === "success") loadEnd(pr, p.value, void 0, lookup);
|
|
171
|
+
else loadEnd(pr, void 0, castError(p.value), lookup);
|
|
172
|
+
return p;
|
|
173
|
+
}
|
|
174
|
+
scheduled = true;
|
|
175
|
+
queueMicrotask(() => scheduled = false);
|
|
176
|
+
runUpdates(() => {
|
|
177
|
+
setState(resolved ? "refreshing" : "pending");
|
|
178
|
+
trigger();
|
|
179
|
+
}, false);
|
|
180
|
+
return p.then(
|
|
181
|
+
(v) => loadEnd(p, v, void 0, lookup),
|
|
182
|
+
(e) => loadEnd(p, void 0, castError(e), lookup)
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
Object.defineProperties(read, {
|
|
186
|
+
state: {
|
|
187
|
+
get: () => state()
|
|
188
|
+
},
|
|
189
|
+
error: {
|
|
190
|
+
get: () => error()
|
|
191
|
+
},
|
|
192
|
+
loading: {
|
|
193
|
+
get() {
|
|
194
|
+
const s = state();
|
|
195
|
+
return s === "pending" || s === "refreshing";
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
latest: {
|
|
199
|
+
get() {
|
|
200
|
+
if (!resolved) return read();
|
|
201
|
+
const err = error();
|
|
202
|
+
if (err && !pr) throw err;
|
|
203
|
+
return value();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
if (dynamic) createComputed(() => load(false));
|
|
208
|
+
else load(false);
|
|
209
|
+
return [
|
|
210
|
+
read,
|
|
211
|
+
{
|
|
212
|
+
refetch: load,
|
|
213
|
+
mutate: setValue
|
|
214
|
+
}
|
|
215
|
+
];
|
|
216
|
+
}
|
|
217
|
+
function untrack(fn) {
|
|
218
|
+
if (Listener === null) return fn();
|
|
219
|
+
const listener = Listener;
|
|
220
|
+
Listener = null;
|
|
221
|
+
try {
|
|
222
|
+
if (ExternalSourceConfig) ;
|
|
223
|
+
return fn();
|
|
224
|
+
} finally {
|
|
225
|
+
Listener = listener;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
function onCleanup(fn) {
|
|
229
|
+
if (Owner === null) ;
|
|
230
|
+
else if (Owner.cleanups === null) Owner.cleanups = [fn];
|
|
231
|
+
else Owner.cleanups.push(fn);
|
|
232
|
+
return fn;
|
|
233
|
+
}
|
|
234
|
+
const [transPending, setTransPending] = /* @__PURE__ */ createSignal(false);
|
|
235
|
+
function createContext(defaultValue, options) {
|
|
236
|
+
const id = Symbol("context");
|
|
237
|
+
return {
|
|
238
|
+
id,
|
|
239
|
+
Provider: createProvider(id),
|
|
240
|
+
defaultValue
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
function useContext(context) {
|
|
244
|
+
let value;
|
|
245
|
+
return Owner && Owner.context && (value = Owner.context[context.id]) !== void 0 ? value : context.defaultValue;
|
|
246
|
+
}
|
|
247
|
+
function children(fn) {
|
|
248
|
+
const children2 = createMemo(fn);
|
|
249
|
+
const memo = createMemo(() => resolveChildren(children2()));
|
|
250
|
+
memo.toArray = () => {
|
|
251
|
+
const c = memo();
|
|
252
|
+
return Array.isArray(c) ? c : c != null ? [c] : [];
|
|
253
|
+
};
|
|
254
|
+
return memo;
|
|
255
|
+
}
|
|
256
|
+
let SuspenseContext;
|
|
257
|
+
function readSignal() {
|
|
258
|
+
if (this.sources && this.state) {
|
|
259
|
+
if (this.state === STALE) updateComputation(this);
|
|
260
|
+
else {
|
|
261
|
+
const updates = Updates;
|
|
262
|
+
Updates = null;
|
|
263
|
+
runUpdates(() => lookUpstream(this), false);
|
|
264
|
+
Updates = updates;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if (Listener) {
|
|
268
|
+
const sSlot = this.observers ? this.observers.length : 0;
|
|
269
|
+
if (!Listener.sources) {
|
|
270
|
+
Listener.sources = [this];
|
|
271
|
+
Listener.sourceSlots = [sSlot];
|
|
272
|
+
} else {
|
|
273
|
+
Listener.sources.push(this);
|
|
274
|
+
Listener.sourceSlots.push(sSlot);
|
|
275
|
+
}
|
|
276
|
+
if (!this.observers) {
|
|
277
|
+
this.observers = [Listener];
|
|
278
|
+
this.observerSlots = [Listener.sources.length - 1];
|
|
279
|
+
} else {
|
|
280
|
+
this.observers.push(Listener);
|
|
281
|
+
this.observerSlots.push(Listener.sources.length - 1);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
return this.value;
|
|
285
|
+
}
|
|
286
|
+
function writeSignal(node, value, isComp) {
|
|
287
|
+
let current = node.value;
|
|
288
|
+
if (!node.comparator || !node.comparator(current, value)) {
|
|
289
|
+
node.value = value;
|
|
290
|
+
if (node.observers && node.observers.length) {
|
|
291
|
+
runUpdates(() => {
|
|
292
|
+
for (let i = 0; i < node.observers.length; i += 1) {
|
|
293
|
+
const o = node.observers[i];
|
|
294
|
+
const TransitionRunning = Transition && Transition.running;
|
|
295
|
+
if (TransitionRunning && Transition.disposed.has(o)) ;
|
|
296
|
+
if (TransitionRunning ? !o.tState : !o.state) {
|
|
297
|
+
if (o.pure) Updates.push(o);
|
|
298
|
+
else Effects.push(o);
|
|
299
|
+
if (o.observers) markDownstream(o);
|
|
300
|
+
}
|
|
301
|
+
if (!TransitionRunning) o.state = STALE;
|
|
302
|
+
}
|
|
303
|
+
if (Updates.length > 1e6) {
|
|
304
|
+
Updates = [];
|
|
305
|
+
if (IS_DEV) ;
|
|
306
|
+
throw new Error();
|
|
307
|
+
}
|
|
308
|
+
}, false);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return value;
|
|
312
|
+
}
|
|
313
|
+
function updateComputation(node) {
|
|
314
|
+
if (!node.fn) return;
|
|
315
|
+
cleanNode(node);
|
|
316
|
+
const time = ExecCount;
|
|
317
|
+
runComputation(
|
|
318
|
+
node,
|
|
319
|
+
node.value,
|
|
320
|
+
time
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
function runComputation(node, value, time) {
|
|
324
|
+
let nextValue;
|
|
325
|
+
const owner = Owner, listener = Listener;
|
|
326
|
+
Listener = Owner = node;
|
|
327
|
+
try {
|
|
328
|
+
nextValue = node.fn(value);
|
|
329
|
+
} catch (err) {
|
|
330
|
+
if (node.pure) {
|
|
331
|
+
{
|
|
332
|
+
node.state = STALE;
|
|
333
|
+
node.owned && node.owned.forEach(cleanNode);
|
|
334
|
+
node.owned = null;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
node.updatedAt = time + 1;
|
|
338
|
+
return handleError(err);
|
|
339
|
+
} finally {
|
|
340
|
+
Listener = listener;
|
|
341
|
+
Owner = owner;
|
|
342
|
+
}
|
|
343
|
+
if (!node.updatedAt || node.updatedAt <= time) {
|
|
344
|
+
if (node.updatedAt != null && "observers" in node) {
|
|
345
|
+
writeSignal(node, nextValue);
|
|
346
|
+
} else node.value = nextValue;
|
|
347
|
+
node.updatedAt = time;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
function createComputation(fn, init, pure, state = STALE, options) {
|
|
351
|
+
const c = {
|
|
352
|
+
fn,
|
|
353
|
+
state,
|
|
354
|
+
updatedAt: null,
|
|
355
|
+
owned: null,
|
|
356
|
+
sources: null,
|
|
357
|
+
sourceSlots: null,
|
|
358
|
+
cleanups: null,
|
|
359
|
+
value: init,
|
|
360
|
+
owner: Owner,
|
|
361
|
+
context: Owner ? Owner.context : null,
|
|
362
|
+
pure
|
|
363
|
+
};
|
|
364
|
+
if (Owner === null) ;
|
|
365
|
+
else if (Owner !== UNOWNED) {
|
|
366
|
+
{
|
|
367
|
+
if (!Owner.owned) Owner.owned = [c];
|
|
368
|
+
else Owner.owned.push(c);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
return c;
|
|
372
|
+
}
|
|
373
|
+
function runTop(node) {
|
|
374
|
+
if (node.state === 0) return;
|
|
375
|
+
if (node.state === PENDING) return lookUpstream(node);
|
|
376
|
+
if (node.suspense && untrack(node.suspense.inFallback)) return node.suspense.effects.push(node);
|
|
377
|
+
const ancestors = [node];
|
|
378
|
+
while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
|
|
379
|
+
if (node.state) ancestors.push(node);
|
|
380
|
+
}
|
|
381
|
+
for (let i = ancestors.length - 1; i >= 0; i--) {
|
|
382
|
+
node = ancestors[i];
|
|
383
|
+
if (node.state === STALE) {
|
|
384
|
+
updateComputation(node);
|
|
385
|
+
} else if (node.state === PENDING) {
|
|
386
|
+
const updates = Updates;
|
|
387
|
+
Updates = null;
|
|
388
|
+
runUpdates(() => lookUpstream(node, ancestors[0]), false);
|
|
389
|
+
Updates = updates;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
function runUpdates(fn, init) {
|
|
394
|
+
if (Updates) return fn();
|
|
395
|
+
let wait = false;
|
|
396
|
+
if (!init) Updates = [];
|
|
397
|
+
if (Effects) wait = true;
|
|
398
|
+
else Effects = [];
|
|
399
|
+
ExecCount++;
|
|
400
|
+
try {
|
|
401
|
+
const res = fn();
|
|
402
|
+
completeUpdates(wait);
|
|
403
|
+
return res;
|
|
404
|
+
} catch (err) {
|
|
405
|
+
if (!wait) Effects = null;
|
|
406
|
+
Updates = null;
|
|
407
|
+
handleError(err);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
function completeUpdates(wait) {
|
|
411
|
+
if (Updates) {
|
|
412
|
+
runQueue(Updates);
|
|
413
|
+
Updates = null;
|
|
414
|
+
}
|
|
415
|
+
if (wait) return;
|
|
416
|
+
const e = Effects;
|
|
417
|
+
Effects = null;
|
|
418
|
+
if (e.length) runUpdates(() => runEffects(e), false);
|
|
419
|
+
}
|
|
420
|
+
function runQueue(queue) {
|
|
421
|
+
for (let i = 0; i < queue.length; i++) runTop(queue[i]);
|
|
422
|
+
}
|
|
423
|
+
function runUserEffects(queue) {
|
|
424
|
+
let i, userLength = 0;
|
|
425
|
+
for (i = 0; i < queue.length; i++) {
|
|
426
|
+
const e = queue[i];
|
|
427
|
+
if (!e.user) runTop(e);
|
|
428
|
+
else queue[userLength++] = e;
|
|
429
|
+
}
|
|
430
|
+
if (sharedConfig.context) {
|
|
431
|
+
if (sharedConfig.count) {
|
|
432
|
+
sharedConfig.effects || (sharedConfig.effects = []);
|
|
433
|
+
sharedConfig.effects.push(...queue.slice(0, userLength));
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
setHydrateContext();
|
|
437
|
+
}
|
|
438
|
+
if (sharedConfig.effects && (sharedConfig.done || !sharedConfig.count)) {
|
|
439
|
+
queue = [...sharedConfig.effects, ...queue];
|
|
440
|
+
userLength += sharedConfig.effects.length;
|
|
441
|
+
delete sharedConfig.effects;
|
|
442
|
+
}
|
|
443
|
+
for (i = 0; i < userLength; i++) runTop(queue[i]);
|
|
444
|
+
}
|
|
445
|
+
function lookUpstream(node, ignore) {
|
|
446
|
+
node.state = 0;
|
|
447
|
+
for (let i = 0; i < node.sources.length; i += 1) {
|
|
448
|
+
const source = node.sources[i];
|
|
449
|
+
if (source.sources) {
|
|
450
|
+
const state = source.state;
|
|
451
|
+
if (state === STALE) {
|
|
452
|
+
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
|
|
453
|
+
runTop(source);
|
|
454
|
+
} else if (state === PENDING) lookUpstream(source, ignore);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
function markDownstream(node) {
|
|
459
|
+
for (let i = 0; i < node.observers.length; i += 1) {
|
|
460
|
+
const o = node.observers[i];
|
|
461
|
+
if (!o.state) {
|
|
462
|
+
o.state = PENDING;
|
|
463
|
+
if (o.pure) Updates.push(o);
|
|
464
|
+
else Effects.push(o);
|
|
465
|
+
o.observers && markDownstream(o);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
function cleanNode(node) {
|
|
470
|
+
let i;
|
|
471
|
+
if (node.sources) {
|
|
472
|
+
while (node.sources.length) {
|
|
473
|
+
const source = node.sources.pop(), index = node.sourceSlots.pop(), obs = source.observers;
|
|
474
|
+
if (obs && obs.length) {
|
|
475
|
+
const n = obs.pop(), s = source.observerSlots.pop();
|
|
476
|
+
if (index < obs.length) {
|
|
477
|
+
n.sourceSlots[s] = index;
|
|
478
|
+
obs[index] = n;
|
|
479
|
+
source.observerSlots[index] = s;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
if (node.tOwned) {
|
|
485
|
+
for (i = node.tOwned.length - 1; i >= 0; i--) cleanNode(node.tOwned[i]);
|
|
486
|
+
delete node.tOwned;
|
|
487
|
+
}
|
|
488
|
+
if (node.owned) {
|
|
489
|
+
for (i = node.owned.length - 1; i >= 0; i--) cleanNode(node.owned[i]);
|
|
490
|
+
node.owned = null;
|
|
491
|
+
}
|
|
492
|
+
if (node.cleanups) {
|
|
493
|
+
for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
|
|
494
|
+
node.cleanups = null;
|
|
495
|
+
}
|
|
496
|
+
node.state = 0;
|
|
497
|
+
}
|
|
498
|
+
function castError(err) {
|
|
499
|
+
if (err instanceof Error) return err;
|
|
500
|
+
return new Error(typeof err === "string" ? err : "Unknown error", {
|
|
501
|
+
cause: err
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
function handleError(err, owner = Owner) {
|
|
505
|
+
const error = castError(err);
|
|
506
|
+
throw error;
|
|
507
|
+
}
|
|
508
|
+
function resolveChildren(children2) {
|
|
509
|
+
if (typeof children2 === "function" && !children2.length) return resolveChildren(children2());
|
|
510
|
+
if (Array.isArray(children2)) {
|
|
511
|
+
const results = [];
|
|
512
|
+
for (let i = 0; i < children2.length; i++) {
|
|
513
|
+
const result = resolveChildren(children2[i]);
|
|
514
|
+
Array.isArray(result) ? results.push.apply(results, result) : results.push(result);
|
|
515
|
+
}
|
|
516
|
+
return results;
|
|
517
|
+
}
|
|
518
|
+
return children2;
|
|
519
|
+
}
|
|
520
|
+
function createProvider(id, options) {
|
|
521
|
+
return function provider(props) {
|
|
522
|
+
let res;
|
|
523
|
+
createRenderEffect(
|
|
524
|
+
() => res = untrack(() => {
|
|
525
|
+
Owner.context = {
|
|
526
|
+
...Owner.context,
|
|
527
|
+
[id]: props.value
|
|
528
|
+
};
|
|
529
|
+
return children(() => props.children);
|
|
530
|
+
}),
|
|
531
|
+
void 0
|
|
532
|
+
);
|
|
533
|
+
return res;
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
function createComponent(Comp, props) {
|
|
537
|
+
return untrack(() => Comp(props || {}));
|
|
538
|
+
}
|
|
539
|
+
function trueFn() {
|
|
540
|
+
return true;
|
|
541
|
+
}
|
|
542
|
+
const propTraps = {
|
|
543
|
+
get(_, property, receiver) {
|
|
544
|
+
if (property === $PROXY) return receiver;
|
|
545
|
+
return _.get(property);
|
|
546
|
+
},
|
|
547
|
+
has(_, property) {
|
|
548
|
+
if (property === $PROXY) return true;
|
|
549
|
+
return _.has(property);
|
|
550
|
+
},
|
|
551
|
+
set: trueFn,
|
|
552
|
+
deleteProperty: trueFn,
|
|
553
|
+
getOwnPropertyDescriptor(_, property) {
|
|
554
|
+
return {
|
|
555
|
+
configurable: true,
|
|
556
|
+
enumerable: true,
|
|
557
|
+
get() {
|
|
558
|
+
return _.get(property);
|
|
559
|
+
},
|
|
560
|
+
set: trueFn,
|
|
561
|
+
deleteProperty: trueFn
|
|
562
|
+
};
|
|
563
|
+
},
|
|
564
|
+
ownKeys(_) {
|
|
565
|
+
return _.keys();
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
function resolveSource(s) {
|
|
569
|
+
return !(s = typeof s === "function" ? s() : s) ? {} : s;
|
|
570
|
+
}
|
|
571
|
+
function resolveSources() {
|
|
572
|
+
for (let i = 0, length = this.length; i < length; ++i) {
|
|
573
|
+
const v = this[i]();
|
|
574
|
+
if (v !== void 0) return v;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
function mergeProps(...sources) {
|
|
578
|
+
let proxy = false;
|
|
579
|
+
for (let i = 0; i < sources.length; i++) {
|
|
580
|
+
const s = sources[i];
|
|
581
|
+
proxy = proxy || !!s && $PROXY in s;
|
|
582
|
+
sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
|
|
583
|
+
}
|
|
584
|
+
if (SUPPORTS_PROXY && proxy) {
|
|
585
|
+
return new Proxy(
|
|
586
|
+
{
|
|
587
|
+
get(property) {
|
|
588
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
589
|
+
const v = resolveSource(sources[i])[property];
|
|
590
|
+
if (v !== void 0) return v;
|
|
591
|
+
}
|
|
592
|
+
},
|
|
593
|
+
has(property) {
|
|
594
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
595
|
+
if (property in resolveSource(sources[i])) return true;
|
|
596
|
+
}
|
|
597
|
+
return false;
|
|
598
|
+
},
|
|
599
|
+
keys() {
|
|
600
|
+
const keys = [];
|
|
601
|
+
for (let i = 0; i < sources.length; i++)
|
|
602
|
+
keys.push(...Object.keys(resolveSource(sources[i])));
|
|
603
|
+
return [...new Set(keys)];
|
|
604
|
+
}
|
|
605
|
+
},
|
|
606
|
+
propTraps
|
|
607
|
+
);
|
|
608
|
+
}
|
|
609
|
+
const sourcesMap = {};
|
|
610
|
+
const defined = /* @__PURE__ */ Object.create(null);
|
|
611
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
612
|
+
const source = sources[i];
|
|
613
|
+
if (!source) continue;
|
|
614
|
+
const sourceKeys = Object.getOwnPropertyNames(source);
|
|
615
|
+
for (let i2 = sourceKeys.length - 1; i2 >= 0; i2--) {
|
|
616
|
+
const key = sourceKeys[i2];
|
|
617
|
+
if (key === "__proto__" || key === "constructor") continue;
|
|
618
|
+
const desc = Object.getOwnPropertyDescriptor(source, key);
|
|
619
|
+
if (!defined[key]) {
|
|
620
|
+
defined[key] = desc.get ? {
|
|
621
|
+
enumerable: true,
|
|
622
|
+
configurable: true,
|
|
623
|
+
get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
|
|
624
|
+
} : desc.value !== void 0 ? desc : void 0;
|
|
625
|
+
} else {
|
|
626
|
+
const sources2 = sourcesMap[key];
|
|
627
|
+
if (sources2) {
|
|
628
|
+
if (desc.get) sources2.push(desc.get.bind(source));
|
|
629
|
+
else if (desc.value !== void 0) sources2.push(() => desc.value);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
const target = {};
|
|
635
|
+
const definedKeys = Object.keys(defined);
|
|
636
|
+
for (let i = definedKeys.length - 1; i >= 0; i--) {
|
|
637
|
+
const key = definedKeys[i], desc = defined[key];
|
|
638
|
+
if (desc && desc.get) Object.defineProperty(target, key, desc);
|
|
639
|
+
else target[key] = desc ? desc.value : void 0;
|
|
640
|
+
}
|
|
641
|
+
return target;
|
|
642
|
+
}
|
|
643
|
+
function splitProps(props, ...keys) {
|
|
644
|
+
if (SUPPORTS_PROXY && $PROXY in props) {
|
|
645
|
+
const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
|
|
646
|
+
const res = keys.map((k) => {
|
|
647
|
+
return new Proxy(
|
|
648
|
+
{
|
|
649
|
+
get(property) {
|
|
650
|
+
return k.includes(property) ? props[property] : void 0;
|
|
651
|
+
},
|
|
652
|
+
has(property) {
|
|
653
|
+
return k.includes(property) && property in props;
|
|
654
|
+
},
|
|
655
|
+
keys() {
|
|
656
|
+
return k.filter((property) => property in props);
|
|
657
|
+
}
|
|
658
|
+
},
|
|
659
|
+
propTraps
|
|
660
|
+
);
|
|
661
|
+
});
|
|
662
|
+
res.push(
|
|
663
|
+
new Proxy(
|
|
664
|
+
{
|
|
665
|
+
get(property) {
|
|
666
|
+
return blocked.has(property) ? void 0 : props[property];
|
|
667
|
+
},
|
|
668
|
+
has(property) {
|
|
669
|
+
return blocked.has(property) ? false : property in props;
|
|
670
|
+
},
|
|
671
|
+
keys() {
|
|
672
|
+
return Object.keys(props).filter((k) => !blocked.has(k));
|
|
673
|
+
}
|
|
674
|
+
},
|
|
675
|
+
propTraps
|
|
676
|
+
)
|
|
677
|
+
);
|
|
678
|
+
return res;
|
|
679
|
+
}
|
|
680
|
+
const otherObject = {};
|
|
681
|
+
const objects = keys.map(() => ({}));
|
|
682
|
+
for (const propName of Object.getOwnPropertyNames(props)) {
|
|
683
|
+
const desc = Object.getOwnPropertyDescriptor(props, propName);
|
|
684
|
+
const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
|
|
685
|
+
let blocked = false;
|
|
686
|
+
let objectIndex = 0;
|
|
687
|
+
for (const k of keys) {
|
|
688
|
+
if (k.includes(propName)) {
|
|
689
|
+
blocked = true;
|
|
690
|
+
isDefaultDesc ? objects[objectIndex][propName] = desc.value : Object.defineProperty(objects[objectIndex], propName, desc);
|
|
691
|
+
}
|
|
692
|
+
++objectIndex;
|
|
693
|
+
}
|
|
694
|
+
if (!blocked) {
|
|
695
|
+
isDefaultDesc ? otherObject[propName] = desc.value : Object.defineProperty(otherObject, propName, desc);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
return [...objects, otherObject];
|
|
699
|
+
}
|
|
700
|
+
function lazy(fn) {
|
|
701
|
+
let comp;
|
|
702
|
+
let p;
|
|
703
|
+
const wrap = (props) => {
|
|
704
|
+
const ctx = sharedConfig.context;
|
|
705
|
+
if (ctx) {
|
|
706
|
+
const [s, set] = createSignal();
|
|
707
|
+
sharedConfig.count || (sharedConfig.count = 0);
|
|
708
|
+
sharedConfig.count++;
|
|
709
|
+
(p || (p = fn())).then((mod) => {
|
|
710
|
+
!sharedConfig.done && setHydrateContext(ctx);
|
|
711
|
+
sharedConfig.count--;
|
|
712
|
+
set(() => mod.default);
|
|
713
|
+
setHydrateContext();
|
|
714
|
+
});
|
|
715
|
+
comp = s;
|
|
716
|
+
} else if (!comp) {
|
|
717
|
+
const [s] = createResource(() => (p || (p = fn())).then((mod) => mod.default));
|
|
718
|
+
comp = s;
|
|
719
|
+
}
|
|
720
|
+
let Comp;
|
|
721
|
+
return createMemo(
|
|
722
|
+
() => (Comp = comp()) ? untrack(() => {
|
|
723
|
+
if (IS_DEV) ;
|
|
724
|
+
if (!ctx || sharedConfig.done) return Comp(props);
|
|
725
|
+
const c = sharedConfig.context;
|
|
726
|
+
setHydrateContext(ctx);
|
|
727
|
+
const r = Comp(props);
|
|
728
|
+
setHydrateContext(c);
|
|
729
|
+
return r;
|
|
730
|
+
}) : ""
|
|
731
|
+
);
|
|
732
|
+
};
|
|
733
|
+
wrap.preload = () => p || ((p = fn()).then((mod) => comp = () => mod.default), p);
|
|
734
|
+
return wrap;
|
|
735
|
+
}
|
|
736
|
+
let counter = 0;
|
|
737
|
+
function createUniqueId() {
|
|
738
|
+
const ctx = sharedConfig.context;
|
|
739
|
+
return ctx ? sharedConfig.getNextContextId() : `cl-${counter++}`;
|
|
740
|
+
}
|
|
741
|
+
const narrowedError = (name) => `Stale read from <${name}>.`;
|
|
742
|
+
function Show(props) {
|
|
743
|
+
const keyed = props.keyed;
|
|
744
|
+
const conditionValue = createMemo(() => props.when, void 0, void 0);
|
|
745
|
+
const condition = keyed ? conditionValue : createMemo(conditionValue, void 0, {
|
|
746
|
+
equals: (a, b) => !a === !b
|
|
747
|
+
});
|
|
748
|
+
return createMemo(
|
|
749
|
+
() => {
|
|
750
|
+
const c = condition();
|
|
751
|
+
if (c) {
|
|
752
|
+
const child = props.children;
|
|
753
|
+
const fn = typeof child === "function" && child.length > 0;
|
|
754
|
+
return fn ? untrack(
|
|
755
|
+
() => child(
|
|
756
|
+
keyed ? c : () => {
|
|
757
|
+
if (!untrack(condition)) throw narrowedError("Show");
|
|
758
|
+
return conditionValue();
|
|
759
|
+
}
|
|
760
|
+
)
|
|
761
|
+
) : child;
|
|
762
|
+
}
|
|
763
|
+
return props.fallback;
|
|
764
|
+
},
|
|
765
|
+
void 0,
|
|
766
|
+
void 0
|
|
767
|
+
);
|
|
768
|
+
}
|
|
769
|
+
export {
|
|
770
|
+
$PROXY,
|
|
771
|
+
Show,
|
|
772
|
+
children,
|
|
773
|
+
createComponent,
|
|
774
|
+
createComputed,
|
|
775
|
+
createContext,
|
|
776
|
+
createEffect,
|
|
777
|
+
createMemo,
|
|
778
|
+
createRenderEffect,
|
|
779
|
+
createResource,
|
|
780
|
+
createRoot,
|
|
781
|
+
createSignal,
|
|
782
|
+
createUniqueId,
|
|
783
|
+
equalFn,
|
|
784
|
+
lazy,
|
|
785
|
+
mergeProps,
|
|
786
|
+
onCleanup,
|
|
787
|
+
sharedConfig,
|
|
788
|
+
splitProps,
|
|
789
|
+
untrack,
|
|
790
|
+
useContext
|
|
791
|
+
};
|
|
792
|
+
//# sourceMappingURL=solid.js.map
|