@novely/solid-renderer 0.29.1-beta.0 → 0.29.1-beta.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/dist/components/Save.d.ts +2 -1
- package/dist/index.jsx +355 -327
- package/dist/utils.d.ts +6 -1
- package/package.json +2 -4
|
@@ -3,8 +3,9 @@ import type { Save as NovelySave } from '@novely/core';
|
|
|
3
3
|
interface SaveProps {
|
|
4
4
|
save: NovelySave;
|
|
5
5
|
language: string;
|
|
6
|
+
observed: boolean;
|
|
6
7
|
overlayShown: boolean;
|
|
7
|
-
|
|
8
|
+
onPreviewDone: () => void;
|
|
8
9
|
}
|
|
9
10
|
declare const Save: VoidComponent<SaveProps>;
|
|
10
11
|
export { Save };
|
package/dist/index.jsx
CHANGED
|
@@ -1299,11 +1299,11 @@ var require_howler = __commonJS({
|
|
|
1299
1299
|
* @param {Number} once (INTERNAL) Marks event to fire only once.
|
|
1300
1300
|
* @return {Howl}
|
|
1301
1301
|
*/
|
|
1302
|
-
on: function(event, fn, id,
|
|
1302
|
+
on: function(event, fn, id, once2) {
|
|
1303
1303
|
var self = this;
|
|
1304
1304
|
var events = self["_on" + event];
|
|
1305
1305
|
if (typeof fn === "function") {
|
|
1306
|
-
events.push(
|
|
1306
|
+
events.push(once2 ? { id, fn, once: once2 } : { id, fn });
|
|
1307
1307
|
}
|
|
1308
1308
|
return self;
|
|
1309
1309
|
},
|
|
@@ -2236,7 +2236,7 @@ var require_howler = __commonJS({
|
|
|
2236
2236
|
}
|
|
2237
2237
|
});
|
|
2238
2238
|
|
|
2239
|
-
// ../../node_modules/.pnpm/solid-js@1.8.
|
|
2239
|
+
// ../../node_modules/.pnpm/solid-js@1.8.17/node_modules/solid-js/dist/solid.js
|
|
2240
2240
|
var sharedConfig = {
|
|
2241
2241
|
context: void 0,
|
|
2242
2242
|
registry: void 0
|
|
@@ -2271,12 +2271,11 @@ var UNOWNED = {
|
|
|
2271
2271
|
var Owner = null;
|
|
2272
2272
|
var Transition = null;
|
|
2273
2273
|
var Scheduler = null;
|
|
2274
|
-
var
|
|
2274
|
+
var ExternalSourceConfig = null;
|
|
2275
2275
|
var Listener = null;
|
|
2276
2276
|
var Updates = null;
|
|
2277
2277
|
var Effects = null;
|
|
2278
2278
|
var ExecCount = 0;
|
|
2279
|
-
var [transPending, setTransPending] = /* @__PURE__ */ createSignal(false);
|
|
2280
2279
|
function createRoot(fn, detachedOwner) {
|
|
2281
2280
|
const listener = Listener, owner = Owner, unowned = fn.length === 0, current = detachedOwner === void 0 ? owner : detachedOwner, root = unowned ? UNOWNED : {
|
|
2282
2281
|
owned: null,
|
|
@@ -2352,11 +2351,13 @@ function batch(fn) {
|
|
|
2352
2351
|
return runUpdates(fn, false);
|
|
2353
2352
|
}
|
|
2354
2353
|
function untrack(fn) {
|
|
2355
|
-
if (Listener === null)
|
|
2354
|
+
if (!ExternalSourceConfig && Listener === null)
|
|
2356
2355
|
return fn();
|
|
2357
2356
|
const listener = Listener;
|
|
2358
2357
|
Listener = null;
|
|
2359
2358
|
try {
|
|
2359
|
+
if (ExternalSourceConfig)
|
|
2360
|
+
return ExternalSourceConfig.untrack(fn);
|
|
2360
2361
|
return fn();
|
|
2361
2362
|
} finally {
|
|
2362
2363
|
Listener = listener;
|
|
@@ -2376,7 +2377,7 @@ function on(deps, fn, options) {
|
|
|
2376
2377
|
input = deps();
|
|
2377
2378
|
if (defer2) {
|
|
2378
2379
|
defer2 = false;
|
|
2379
|
-
return
|
|
2380
|
+
return prevValue;
|
|
2380
2381
|
}
|
|
2381
2382
|
const result = untrack(() => fn(input, prevInput, prevValue));
|
|
2382
2383
|
prevInput = input;
|
|
@@ -2440,6 +2441,7 @@ function startTransition(fn) {
|
|
|
2440
2441
|
return t ? t.done : void 0;
|
|
2441
2442
|
});
|
|
2442
2443
|
}
|
|
2444
|
+
var [transPending, setTransPending] = /* @__PURE__ */ createSignal(false);
|
|
2443
2445
|
function useTransition() {
|
|
2444
2446
|
return [transPending, startTransition];
|
|
2445
2447
|
}
|
|
@@ -2545,9 +2547,12 @@ function updateComputation(node) {
|
|
|
2545
2547
|
if (!node.fn)
|
|
2546
2548
|
return;
|
|
2547
2549
|
cleanNode(node);
|
|
2548
|
-
const
|
|
2549
|
-
|
|
2550
|
-
|
|
2550
|
+
const time = ExecCount;
|
|
2551
|
+
runComputation(
|
|
2552
|
+
node,
|
|
2553
|
+
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
|
|
2554
|
+
time
|
|
2555
|
+
);
|
|
2551
2556
|
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
2552
2557
|
queueMicrotask(() => {
|
|
2553
2558
|
runUpdates(() => {
|
|
@@ -2558,11 +2563,11 @@ function updateComputation(node) {
|
|
|
2558
2563
|
}, false);
|
|
2559
2564
|
});
|
|
2560
2565
|
}
|
|
2561
|
-
Listener = listener;
|
|
2562
|
-
Owner = owner;
|
|
2563
2566
|
}
|
|
2564
2567
|
function runComputation(node, value, time) {
|
|
2565
2568
|
let nextValue;
|
|
2569
|
+
const owner = Owner, listener = Listener;
|
|
2570
|
+
Listener = Owner = node;
|
|
2566
2571
|
try {
|
|
2567
2572
|
nextValue = node.fn(value);
|
|
2568
2573
|
} catch (err) {
|
|
@@ -2579,6 +2584,9 @@ function runComputation(node, value, time) {
|
|
|
2579
2584
|
}
|
|
2580
2585
|
node.updatedAt = time + 1;
|
|
2581
2586
|
return handleError(err);
|
|
2587
|
+
} finally {
|
|
2588
|
+
Listener = listener;
|
|
2589
|
+
Owner = owner;
|
|
2582
2590
|
}
|
|
2583
2591
|
if (!node.updatedAt || node.updatedAt <= time) {
|
|
2584
2592
|
if (node.updatedAt != null && "observers" in node) {
|
|
@@ -2624,14 +2632,14 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
2624
2632
|
Owner.owned.push(c);
|
|
2625
2633
|
}
|
|
2626
2634
|
}
|
|
2627
|
-
if (
|
|
2635
|
+
if (ExternalSourceConfig && c.fn) {
|
|
2628
2636
|
const [track, trigger] = createSignal(void 0, {
|
|
2629
2637
|
equals: false
|
|
2630
2638
|
});
|
|
2631
|
-
const ordinary =
|
|
2639
|
+
const ordinary = ExternalSourceConfig.factory(c.fn, trigger);
|
|
2632
2640
|
onCleanup(() => ordinary.dispose());
|
|
2633
2641
|
const triggerInTransition = () => startTransition(trigger).then(() => inTransition.dispose());
|
|
2634
|
-
const inTransition =
|
|
2642
|
+
const inTransition = ExternalSourceConfig.factory(c.fn, triggerInTransition);
|
|
2635
2643
|
c.fn = (x) => {
|
|
2636
2644
|
track();
|
|
2637
2645
|
return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x);
|
|
@@ -2922,13 +2930,16 @@ function resolveChildren(children2) {
|
|
|
2922
2930
|
function createProvider(id, options) {
|
|
2923
2931
|
return function provider(props) {
|
|
2924
2932
|
let res;
|
|
2925
|
-
createRenderEffect(
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2933
|
+
createRenderEffect(
|
|
2934
|
+
() => res = untrack(() => {
|
|
2935
|
+
Owner.context = {
|
|
2936
|
+
...Owner.context,
|
|
2937
|
+
[id]: props.value
|
|
2938
|
+
};
|
|
2939
|
+
return children(() => props.children);
|
|
2940
|
+
}),
|
|
2941
|
+
void 0
|
|
2942
|
+
);
|
|
2932
2943
|
return res;
|
|
2933
2944
|
};
|
|
2934
2945
|
}
|
|
@@ -3102,68 +3113,70 @@ function mergeProps(...sources) {
|
|
|
3102
3113
|
sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
|
|
3103
3114
|
}
|
|
3104
3115
|
if (proxy) {
|
|
3105
|
-
return new Proxy(
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3116
|
+
return new Proxy(
|
|
3117
|
+
{
|
|
3118
|
+
get(property) {
|
|
3119
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
3120
|
+
const v = resolveSource(sources[i])[property];
|
|
3121
|
+
if (v !== void 0)
|
|
3122
|
+
return v;
|
|
3123
|
+
}
|
|
3124
|
+
},
|
|
3125
|
+
has(property) {
|
|
3126
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
3127
|
+
if (property in resolveSource(sources[i]))
|
|
3128
|
+
return true;
|
|
3129
|
+
}
|
|
3130
|
+
return false;
|
|
3131
|
+
},
|
|
3132
|
+
keys() {
|
|
3133
|
+
const keys2 = [];
|
|
3134
|
+
for (let i = 0; i < sources.length; i++)
|
|
3135
|
+
keys2.push(...Object.keys(resolveSource(sources[i])));
|
|
3136
|
+
return [...new Set(keys2)];
|
|
3117
3137
|
}
|
|
3118
|
-
return false;
|
|
3119
3138
|
},
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
for (let i = 0; i < sources.length; i++)
|
|
3123
|
-
keys2.push(...Object.keys(resolveSource(sources[i])));
|
|
3124
|
-
return [...new Set(keys2)];
|
|
3125
|
-
}
|
|
3126
|
-
}, propTraps);
|
|
3139
|
+
propTraps
|
|
3140
|
+
);
|
|
3127
3141
|
}
|
|
3128
|
-
const target = {};
|
|
3129
3142
|
const sourcesMap = {};
|
|
3130
|
-
const defined = /* @__PURE__ */
|
|
3143
|
+
const defined = /* @__PURE__ */ Object.create(null);
|
|
3131
3144
|
for (let i = sources.length - 1; i >= 0; i--) {
|
|
3132
3145
|
const source = sources[i];
|
|
3133
3146
|
if (!source)
|
|
3134
3147
|
continue;
|
|
3135
3148
|
const sourceKeys = Object.getOwnPropertyNames(source);
|
|
3136
|
-
for (let i2 =
|
|
3149
|
+
for (let i2 = sourceKeys.length - 1; i2 >= 0; i2--) {
|
|
3137
3150
|
const key = sourceKeys[i2];
|
|
3138
3151
|
if (key === "__proto__" || key === "constructor")
|
|
3139
3152
|
continue;
|
|
3140
3153
|
const desc = Object.getOwnPropertyDescriptor(source, key);
|
|
3141
|
-
if (!defined
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
|
|
3148
|
-
});
|
|
3149
|
-
} else {
|
|
3150
|
-
if (desc.value !== void 0)
|
|
3151
|
-
defined.add(key);
|
|
3152
|
-
target[key] = desc.value;
|
|
3153
|
-
}
|
|
3154
|
+
if (!defined[key]) {
|
|
3155
|
+
defined[key] = desc.get ? {
|
|
3156
|
+
enumerable: true,
|
|
3157
|
+
configurable: true,
|
|
3158
|
+
get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
|
|
3159
|
+
} : desc.value !== void 0 ? desc : void 0;
|
|
3154
3160
|
} else {
|
|
3155
3161
|
const sources2 = sourcesMap[key];
|
|
3156
3162
|
if (sources2) {
|
|
3157
|
-
if (desc.get)
|
|
3163
|
+
if (desc.get)
|
|
3158
3164
|
sources2.push(desc.get.bind(source));
|
|
3159
|
-
|
|
3165
|
+
else if (desc.value !== void 0)
|
|
3160
3166
|
sources2.push(() => desc.value);
|
|
3161
|
-
|
|
3162
|
-
} else if (target[key] === void 0)
|
|
3163
|
-
target[key] = desc.value;
|
|
3167
|
+
}
|
|
3164
3168
|
}
|
|
3165
3169
|
}
|
|
3166
3170
|
}
|
|
3171
|
+
const target = {};
|
|
3172
|
+
const definedKeys = Object.keys(defined);
|
|
3173
|
+
for (let i = definedKeys.length - 1; i >= 0; i--) {
|
|
3174
|
+
const key = definedKeys[i], desc = defined[key];
|
|
3175
|
+
if (desc && desc.get)
|
|
3176
|
+
Object.defineProperty(target, key, desc);
|
|
3177
|
+
else
|
|
3178
|
+
target[key] = desc ? desc.value : void 0;
|
|
3179
|
+
}
|
|
3167
3180
|
return target;
|
|
3168
3181
|
}
|
|
3169
3182
|
var counter = 0;
|
|
@@ -3183,61 +3196,120 @@ function Show(props) {
|
|
|
3183
3196
|
const condition = createMemo(() => props.when, void 0, {
|
|
3184
3197
|
equals: (a, b) => keyed ? a === b : !a === !b
|
|
3185
3198
|
});
|
|
3186
|
-
return createMemo(
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
+
return createMemo(
|
|
3200
|
+
() => {
|
|
3201
|
+
const c = condition();
|
|
3202
|
+
if (c) {
|
|
3203
|
+
const child = props.children;
|
|
3204
|
+
const fn = typeof child === "function" && child.length > 0;
|
|
3205
|
+
return fn ? untrack(
|
|
3206
|
+
() => child(
|
|
3207
|
+
keyed ? c : () => {
|
|
3208
|
+
if (!untrack(condition))
|
|
3209
|
+
throw narrowedError("Show");
|
|
3210
|
+
return props.when;
|
|
3211
|
+
}
|
|
3212
|
+
)
|
|
3213
|
+
) : child;
|
|
3214
|
+
}
|
|
3215
|
+
return props.fallback;
|
|
3216
|
+
},
|
|
3217
|
+
void 0,
|
|
3218
|
+
void 0
|
|
3219
|
+
);
|
|
3199
3220
|
}
|
|
3200
3221
|
function Switch(props) {
|
|
3201
3222
|
let keyed = false;
|
|
3202
|
-
const equals = (a, b) =>
|
|
3203
|
-
const conditions = children(() => props.children), evalConditions = createMemo(
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3223
|
+
const equals = (a, b) => (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
|
|
3224
|
+
const conditions = children(() => props.children), evalConditions = createMemo(
|
|
3225
|
+
() => {
|
|
3226
|
+
let conds = conditions();
|
|
3227
|
+
if (!Array.isArray(conds))
|
|
3228
|
+
conds = [conds];
|
|
3229
|
+
for (let i = 0; i < conds.length; i++) {
|
|
3230
|
+
const c = conds[i].when;
|
|
3231
|
+
if (c) {
|
|
3232
|
+
keyed = !!conds[i].keyed;
|
|
3233
|
+
return [i, c, conds[i]];
|
|
3234
|
+
}
|
|
3212
3235
|
}
|
|
3236
|
+
return [-1];
|
|
3237
|
+
},
|
|
3238
|
+
void 0,
|
|
3239
|
+
{
|
|
3240
|
+
equals
|
|
3213
3241
|
}
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3242
|
+
);
|
|
3243
|
+
return createMemo(
|
|
3244
|
+
() => {
|
|
3245
|
+
const [index, when, cond] = evalConditions();
|
|
3246
|
+
if (index < 0)
|
|
3247
|
+
return props.fallback;
|
|
3248
|
+
const c = cond.children;
|
|
3249
|
+
const fn = typeof c === "function" && c.length > 0;
|
|
3250
|
+
return fn ? untrack(
|
|
3251
|
+
() => c(
|
|
3252
|
+
keyed ? when : () => {
|
|
3253
|
+
if (untrack(evalConditions)[0] !== index)
|
|
3254
|
+
throw narrowedError("Match");
|
|
3255
|
+
return cond.when;
|
|
3256
|
+
}
|
|
3257
|
+
)
|
|
3258
|
+
) : c;
|
|
3259
|
+
},
|
|
3260
|
+
void 0,
|
|
3261
|
+
void 0
|
|
3262
|
+
);
|
|
3230
3263
|
}
|
|
3231
3264
|
function Match(props) {
|
|
3232
3265
|
return props;
|
|
3233
3266
|
}
|
|
3234
3267
|
var SuspenseListContext = createContext();
|
|
3235
|
-
var DEV = void 0;
|
|
3236
3268
|
|
|
3237
|
-
// ../../node_modules/.pnpm/solid-js@1.8.
|
|
3238
|
-
var booleans = [
|
|
3239
|
-
|
|
3240
|
-
|
|
3269
|
+
// ../../node_modules/.pnpm/solid-js@1.8.17/node_modules/solid-js/web/dist/web.js
|
|
3270
|
+
var booleans = [
|
|
3271
|
+
"allowfullscreen",
|
|
3272
|
+
"async",
|
|
3273
|
+
"autofocus",
|
|
3274
|
+
"autoplay",
|
|
3275
|
+
"checked",
|
|
3276
|
+
"controls",
|
|
3277
|
+
"default",
|
|
3278
|
+
"disabled",
|
|
3279
|
+
"formnovalidate",
|
|
3280
|
+
"hidden",
|
|
3281
|
+
"indeterminate",
|
|
3282
|
+
"inert",
|
|
3283
|
+
"ismap",
|
|
3284
|
+
"loop",
|
|
3285
|
+
"multiple",
|
|
3286
|
+
"muted",
|
|
3287
|
+
"nomodule",
|
|
3288
|
+
"novalidate",
|
|
3289
|
+
"open",
|
|
3290
|
+
"playsinline",
|
|
3291
|
+
"readonly",
|
|
3292
|
+
"required",
|
|
3293
|
+
"reversed",
|
|
3294
|
+
"seamless",
|
|
3295
|
+
"selected"
|
|
3296
|
+
];
|
|
3297
|
+
var Properties = /* @__PURE__ */ new Set([
|
|
3298
|
+
"className",
|
|
3299
|
+
"value",
|
|
3300
|
+
"readOnly",
|
|
3301
|
+
"formNoValidate",
|
|
3302
|
+
"isMap",
|
|
3303
|
+
"noModule",
|
|
3304
|
+
"playsInline",
|
|
3305
|
+
...booleans
|
|
3306
|
+
]);
|
|
3307
|
+
var ChildProperties = /* @__PURE__ */ new Set([
|
|
3308
|
+
"innerHTML",
|
|
3309
|
+
"textContent",
|
|
3310
|
+
"innerText",
|
|
3311
|
+
"children"
|
|
3312
|
+
]);
|
|
3241
3313
|
var Aliases = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
3242
3314
|
className: "class",
|
|
3243
3315
|
htmlFor: "for"
|
|
@@ -3271,7 +3343,30 @@ function getPropAlias(prop, tagName) {
|
|
|
3271
3343
|
const a = PropAliases[prop];
|
|
3272
3344
|
return typeof a === "object" ? a[tagName] ? a["$"] : void 0 : a;
|
|
3273
3345
|
}
|
|
3274
|
-
var DelegatedEvents = /* @__PURE__ */ new Set([
|
|
3346
|
+
var DelegatedEvents = /* @__PURE__ */ new Set([
|
|
3347
|
+
"beforeinput",
|
|
3348
|
+
"click",
|
|
3349
|
+
"dblclick",
|
|
3350
|
+
"contextmenu",
|
|
3351
|
+
"focusin",
|
|
3352
|
+
"focusout",
|
|
3353
|
+
"input",
|
|
3354
|
+
"keydown",
|
|
3355
|
+
"keyup",
|
|
3356
|
+
"mousedown",
|
|
3357
|
+
"mousemove",
|
|
3358
|
+
"mouseout",
|
|
3359
|
+
"mouseover",
|
|
3360
|
+
"mouseup",
|
|
3361
|
+
"pointerdown",
|
|
3362
|
+
"pointermove",
|
|
3363
|
+
"pointerout",
|
|
3364
|
+
"pointerover",
|
|
3365
|
+
"pointerup",
|
|
3366
|
+
"touchend",
|
|
3367
|
+
"touchmove",
|
|
3368
|
+
"touchstart"
|
|
3369
|
+
]);
|
|
3275
3370
|
var SVGNamespace = {
|
|
3276
3371
|
xlink: "http://www.w3.org/1999/xlink",
|
|
3277
3372
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
@@ -3366,7 +3461,7 @@ function delegateEvents(eventNames, document2 = window.document) {
|
|
|
3366
3461
|
}
|
|
3367
3462
|
}
|
|
3368
3463
|
function setAttribute(node, name, value) {
|
|
3369
|
-
if (sharedConfig.context)
|
|
3464
|
+
if (!!sharedConfig.context && node.isConnected)
|
|
3370
3465
|
return;
|
|
3371
3466
|
if (value == null)
|
|
3372
3467
|
node.removeAttribute(name);
|
|
@@ -3374,7 +3469,7 @@ function setAttribute(node, name, value) {
|
|
|
3374
3469
|
node.setAttribute(name, value);
|
|
3375
3470
|
}
|
|
3376
3471
|
function setAttributeNS(node, namespace, name, value) {
|
|
3377
|
-
if (sharedConfig.context)
|
|
3472
|
+
if (!!sharedConfig.context && node.isConnected)
|
|
3378
3473
|
return;
|
|
3379
3474
|
if (value == null)
|
|
3380
3475
|
node.removeAttributeNS(namespace, name);
|
|
@@ -3382,7 +3477,7 @@ function setAttributeNS(node, namespace, name, value) {
|
|
|
3382
3477
|
node.setAttributeNS(namespace, name, value);
|
|
3383
3478
|
}
|
|
3384
3479
|
function className(node, value) {
|
|
3385
|
-
if (sharedConfig.context)
|
|
3480
|
+
if (!!sharedConfig.context && node.isConnected)
|
|
3386
3481
|
return;
|
|
3387
3482
|
if (value == null)
|
|
3388
3483
|
node.removeAttribute("class");
|
|
@@ -3447,9 +3542,13 @@ function style(node, value, prev) {
|
|
|
3447
3542
|
function spread(node, props = {}, isSVG, skipChildren) {
|
|
3448
3543
|
const prevProps = {};
|
|
3449
3544
|
if (!skipChildren) {
|
|
3450
|
-
createRenderEffect(
|
|
3545
|
+
createRenderEffect(
|
|
3546
|
+
() => prevProps.children = insertExpression(node, props.children, prevProps.children)
|
|
3547
|
+
);
|
|
3451
3548
|
}
|
|
3452
|
-
createRenderEffect(
|
|
3549
|
+
createRenderEffect(
|
|
3550
|
+
() => typeof props.ref === "function" ? use(props.ref, node) : props.ref = node
|
|
3551
|
+
);
|
|
3453
3552
|
createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
3454
3553
|
return prevProps;
|
|
3455
3554
|
}
|
|
@@ -3526,7 +3625,7 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
3526
3625
|
if (forceProp) {
|
|
3527
3626
|
prop = prop.slice(5);
|
|
3528
3627
|
isProp = true;
|
|
3529
|
-
} else if (sharedConfig.context)
|
|
3628
|
+
} else if (!!sharedConfig.context && node.isConnected)
|
|
3530
3629
|
return value;
|
|
3531
3630
|
if (prop === "class" || prop === "className")
|
|
3532
3631
|
className(node, value);
|
|
@@ -3572,7 +3671,8 @@ function eventHandler(e) {
|
|
|
3572
3671
|
}
|
|
3573
3672
|
}
|
|
3574
3673
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
3575
|
-
|
|
3674
|
+
const hydrating = !!sharedConfig.context && parent.isConnected;
|
|
3675
|
+
if (hydrating) {
|
|
3576
3676
|
!current && (current = [...parent.childNodes]);
|
|
3577
3677
|
let cleaned = [];
|
|
3578
3678
|
for (let i = 0; i < current.length; i++) {
|
|
@@ -3591,14 +3691,14 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
3591
3691
|
const t = typeof value, multi = marker !== void 0;
|
|
3592
3692
|
parent = multi && current[0] && current[0].parentNode || parent;
|
|
3593
3693
|
if (t === "string" || t === "number") {
|
|
3594
|
-
if (
|
|
3694
|
+
if (hydrating)
|
|
3595
3695
|
return current;
|
|
3596
3696
|
if (t === "number")
|
|
3597
3697
|
value = value.toString();
|
|
3598
3698
|
if (multi) {
|
|
3599
3699
|
let node = current[0];
|
|
3600
3700
|
if (node && node.nodeType === 3) {
|
|
3601
|
-
node.data = value;
|
|
3701
|
+
node.data !== value && (node.data = value);
|
|
3602
3702
|
} else
|
|
3603
3703
|
node = document.createTextNode(value);
|
|
3604
3704
|
current = cleanChildren(parent, current, marker, node);
|
|
@@ -3609,7 +3709,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
3609
3709
|
current = parent.textContent = value;
|
|
3610
3710
|
}
|
|
3611
3711
|
} else if (value == null || t === "boolean") {
|
|
3612
|
-
if (
|
|
3712
|
+
if (hydrating)
|
|
3613
3713
|
return current;
|
|
3614
3714
|
current = cleanChildren(parent, current, marker);
|
|
3615
3715
|
} else if (t === "function") {
|
|
@@ -3627,7 +3727,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
3627
3727
|
createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
3628
3728
|
return () => current;
|
|
3629
3729
|
}
|
|
3630
|
-
if (
|
|
3730
|
+
if (hydrating) {
|
|
3631
3731
|
if (!array.length)
|
|
3632
3732
|
return current;
|
|
3633
3733
|
if (marker === void 0)
|
|
@@ -3653,7 +3753,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
3653
3753
|
}
|
|
3654
3754
|
current = array;
|
|
3655
3755
|
} else if (value.nodeType) {
|
|
3656
|
-
if (
|
|
3756
|
+
if (hydrating && value.parentNode)
|
|
3657
3757
|
return current = multi ? [value] : value;
|
|
3658
3758
|
if (Array.isArray(current)) {
|
|
3659
3759
|
if (multi)
|
|
@@ -3671,7 +3771,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
3671
3771
|
function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
3672
3772
|
let dynamic = false;
|
|
3673
3773
|
for (let i = 0, len = array.length; i < len; i++) {
|
|
3674
|
-
let item = array[i], prev = current && current[
|
|
3774
|
+
let item = array[i], prev = current && current[normalized.length], t;
|
|
3675
3775
|
if (item == null || item === true || item === false)
|
|
3676
3776
|
;
|
|
3677
3777
|
else if ((t = typeof item) === "object" && item.nodeType) {
|
|
@@ -3682,7 +3782,11 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
|
3682
3782
|
if (unwrap) {
|
|
3683
3783
|
while (typeof item === "function")
|
|
3684
3784
|
item = item();
|
|
3685
|
-
dynamic = normalizeIncomingArray(
|
|
3785
|
+
dynamic = normalizeIncomingArray(
|
|
3786
|
+
normalized,
|
|
3787
|
+
Array.isArray(item) ? item : [item],
|
|
3788
|
+
Array.isArray(prev) ? prev : [prev]
|
|
3789
|
+
) || dynamic;
|
|
3686
3790
|
} else {
|
|
3687
3791
|
normalized.push(item);
|
|
3688
3792
|
dynamic = true;
|
|
@@ -4845,6 +4949,15 @@ var getDocumentStyles = () => {
|
|
|
4845
4949
|
}
|
|
4846
4950
|
return css;
|
|
4847
4951
|
};
|
|
4952
|
+
var once = (fn) => {
|
|
4953
|
+
let ran = false;
|
|
4954
|
+
return () => {
|
|
4955
|
+
if (ran)
|
|
4956
|
+
return;
|
|
4957
|
+
ran = true;
|
|
4958
|
+
fn();
|
|
4959
|
+
};
|
|
4960
|
+
};
|
|
4848
4961
|
|
|
4849
4962
|
// src/shared.ts
|
|
4850
4963
|
var PRELOADED_IMAGE_MAP = /* @__PURE__ */ new Map();
|
|
@@ -5182,7 +5295,7 @@ var Modal = (props) => {
|
|
|
5182
5295
|
});
|
|
5183
5296
|
};
|
|
5184
5297
|
|
|
5185
|
-
// ../../node_modules/.pnpm/@solid-primitives+transition-group@1.0.5_solid-js@1.8.
|
|
5298
|
+
// ../../node_modules/.pnpm/@solid-primitives+transition-group@1.0.5_solid-js@1.8.17/node_modules/@solid-primitives/transition-group/dist/index.js
|
|
5186
5299
|
var noop2 = () => {
|
|
5187
5300
|
};
|
|
5188
5301
|
var noopTransition = (el, done) => done();
|
|
@@ -5250,10 +5363,10 @@ function createSwitchTransition(source, options) {
|
|
|
5250
5363
|
return returned;
|
|
5251
5364
|
}
|
|
5252
5365
|
|
|
5253
|
-
// ../../node_modules/.pnpm/@solid-primitives+utils@6.2.3_solid-js@1.8.
|
|
5366
|
+
// ../../node_modules/.pnpm/@solid-primitives+utils@6.2.3_solid-js@1.8.17/node_modules/@solid-primitives/utils/dist/chunk/R5675YMU.js
|
|
5254
5367
|
var access = (v) => typeof v === "function" && !v.length ? v() : v;
|
|
5255
5368
|
|
|
5256
|
-
// ../../node_modules/.pnpm/@solid-primitives+refs@1.0.8_solid-js@1.8.
|
|
5369
|
+
// ../../node_modules/.pnpm/@solid-primitives+refs@1.0.8_solid-js@1.8.17/node_modules/@solid-primitives/refs/dist/index.js
|
|
5257
5370
|
var defaultElementPredicate = isServer ? (item) => item != null && typeof item === "object" && "t" in item : (item) => item instanceof Element;
|
|
5258
5371
|
function getFirstChild(value, predicate) {
|
|
5259
5372
|
if (predicate(value))
|
|
@@ -5274,7 +5387,7 @@ function resolveFirst(fn, predicate = defaultElementPredicate, serverPredicate =
|
|
|
5274
5387
|
return createMemo(() => getFirstChild(children2(), isServer ? serverPredicate : predicate));
|
|
5275
5388
|
}
|
|
5276
5389
|
|
|
5277
|
-
// ../../node_modules/.pnpm/solid-transition-group@0.2.3_solid-js@1.8.
|
|
5390
|
+
// ../../node_modules/.pnpm/solid-transition-group@0.2.3_solid-js@1.8.17/node_modules/solid-transition-group/dist/index.js
|
|
5278
5391
|
function createClassnames(props) {
|
|
5279
5392
|
return createMemo(() => {
|
|
5280
5393
|
const name = props.name || "s";
|
|
@@ -5397,13 +5510,17 @@ var Save = (props) => {
|
|
|
5397
5510
|
removeContext
|
|
5398
5511
|
} = useData();
|
|
5399
5512
|
const [iframe, setIframe] = createSignal();
|
|
5400
|
-
const
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5513
|
+
const [iframeLoaded, setIframeLoaded] = createSignal(false);
|
|
5514
|
+
const [previewStarted, setPreviewStarted] = createSignal(false);
|
|
5515
|
+
let previewDoneTimeoutId;
|
|
5516
|
+
const previewDone = once(() => {
|
|
5517
|
+
previewDoneTimeoutId = setTimeout(() => {
|
|
5518
|
+
untrack(props.onPreviewDone);
|
|
5519
|
+
}, 150);
|
|
5520
|
+
});
|
|
5404
5521
|
const [timestamp, type] = props.save[2];
|
|
5405
5522
|
const date = new Date(timestamp);
|
|
5406
|
-
const KEY = `save-${
|
|
5523
|
+
const KEY = `save-${timestamp}-${type}`;
|
|
5407
5524
|
const $contextState = useContextState(KEY);
|
|
5408
5525
|
const context = getContext2(KEY);
|
|
5409
5526
|
const year = date.getFullYear();
|
|
@@ -5429,6 +5546,12 @@ var Save = (props) => {
|
|
|
5429
5546
|
const loadSave = () => {
|
|
5430
5547
|
options.set(props.save);
|
|
5431
5548
|
};
|
|
5549
|
+
const removeSave = (date2) => {
|
|
5550
|
+
storageDataUpdate((prev) => {
|
|
5551
|
+
prev.saves = untrack(storageData).saves.filter((save) => save[2][0] !== date2);
|
|
5552
|
+
return prev;
|
|
5553
|
+
});
|
|
5554
|
+
};
|
|
5432
5555
|
const onIframeLoaded = () => {
|
|
5433
5556
|
const {
|
|
5434
5557
|
contentDocument
|
|
@@ -5438,26 +5561,36 @@ var Save = (props) => {
|
|
|
5438
5561
|
contentDocument.head.insertAdjacentHTML("beforeend", `<style>:root { font-size: 30%; background: black; cursor: pointer; } * { pointer-events: none; } *, *::before, *::after { animation-play-state: paused !important; }</style><style>${stylesheet()}</style>`);
|
|
5439
5562
|
context.root = contentDocument.body;
|
|
5440
5563
|
contentDocument.body.appendChild(game);
|
|
5441
|
-
|
|
5442
|
-
const background = useContextState(KEY).get().background.background;
|
|
5443
|
-
if (!background || !isCSSImage(background)) {
|
|
5444
|
-
return resolve();
|
|
5445
|
-
}
|
|
5446
|
-
if (PRELOADED_IMAGE_MAP.has(background)) {
|
|
5447
|
-
return resolve();
|
|
5448
|
-
}
|
|
5449
|
-
const backgroundElement = context.root.querySelector("img.background");
|
|
5450
|
-
if (!backgroundElement) {
|
|
5451
|
-
return resolve();
|
|
5452
|
-
}
|
|
5453
|
-
if (backgroundElement.complete && backgroundElement.naturalHeight !== 0) {
|
|
5454
|
-
return resolve();
|
|
5455
|
-
}
|
|
5456
|
-
backgroundElement.onload = backgroundElement.onerror = () => {
|
|
5457
|
-
resolve();
|
|
5458
|
-
};
|
|
5459
|
-
});
|
|
5564
|
+
setIframeLoaded(true);
|
|
5460
5565
|
};
|
|
5566
|
+
createEffect(() => {
|
|
5567
|
+
if (props.observed && iframeLoaded() && !previewStarted()) {
|
|
5568
|
+
setPreviewStarted(true);
|
|
5569
|
+
options.preview(props.save, KEY).then(() => {
|
|
5570
|
+
const background = useContextState(KEY).get().background.background;
|
|
5571
|
+
if (!background || !isCSSImage(background)) {
|
|
5572
|
+
return previewDone();
|
|
5573
|
+
}
|
|
5574
|
+
if (PRELOADED_IMAGE_MAP.has(background)) {
|
|
5575
|
+
return previewDone();
|
|
5576
|
+
}
|
|
5577
|
+
const backgroundElement = context.root.querySelector("img.background");
|
|
5578
|
+
if (!backgroundElement) {
|
|
5579
|
+
return previewDone();
|
|
5580
|
+
}
|
|
5581
|
+
if (backgroundElement.complete && backgroundElement.naturalHeight !== 0) {
|
|
5582
|
+
return previewDone();
|
|
5583
|
+
}
|
|
5584
|
+
const onLoadingStatusChange = () => {
|
|
5585
|
+
backgroundElement.removeEventListener("load", onLoadingStatusChange);
|
|
5586
|
+
backgroundElement.removeEventListener("error", onLoadingStatusChange);
|
|
5587
|
+
previewDone();
|
|
5588
|
+
};
|
|
5589
|
+
backgroundElement.addEventListener("load", onLoadingStatusChange);
|
|
5590
|
+
backgroundElement.addEventListener("error", onLoadingStatusChange);
|
|
5591
|
+
});
|
|
5592
|
+
}
|
|
5593
|
+
});
|
|
5461
5594
|
createEffect(() => {
|
|
5462
5595
|
const iframeElement = iframe();
|
|
5463
5596
|
if (!iframeElement)
|
|
@@ -5484,17 +5617,12 @@ var Save = (props) => {
|
|
|
5484
5617
|
options.removeContext(KEY);
|
|
5485
5618
|
removeShared(KEY);
|
|
5486
5619
|
});
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
return prev;
|
|
5491
|
-
});
|
|
5492
|
-
};
|
|
5620
|
+
onCleanup(() => {
|
|
5621
|
+
clearTimeout(previewDoneTimeoutId);
|
|
5622
|
+
});
|
|
5493
5623
|
return (() => {
|
|
5494
5624
|
const _el$ = _tmpl$24(), _el$2 = _el$.firstChild, _el$4 = _el$2.firstChild, _el$5 = _el$2.nextSibling, _el$6 = _el$5.firstChild, _el$7 = _el$6.nextSibling, _el$8 = _el$5.nextSibling, _el$9 = _el$8.firstChild;
|
|
5495
|
-
|
|
5496
|
-
props.setup(element, promise);
|
|
5497
|
-
}, _el$);
|
|
5625
|
+
setAttribute(_el$, "data-timestamp", timestamp);
|
|
5498
5626
|
_el$2.$$keyup = (event) => {
|
|
5499
5627
|
if (event.code === "Space") {
|
|
5500
5628
|
loadSave();
|
|
@@ -5511,7 +5639,7 @@ var Save = (props) => {
|
|
|
5511
5639
|
get children() {
|
|
5512
5640
|
return createComponent(Show, {
|
|
5513
5641
|
get when() {
|
|
5514
|
-
return
|
|
5642
|
+
return props.overlayShown;
|
|
5515
5643
|
},
|
|
5516
5644
|
get children() {
|
|
5517
5645
|
return _tmpl$17();
|
|
@@ -5727,7 +5855,7 @@ var createTypewriter = ({
|
|
|
5727
5855
|
};
|
|
5728
5856
|
};
|
|
5729
5857
|
|
|
5730
|
-
// ../../node_modules/.pnpm/@solid-primitives+destructure@0.1.17_solid-js@1.8.
|
|
5858
|
+
// ../../node_modules/.pnpm/@solid-primitives+destructure@0.1.17_solid-js@1.8.17/node_modules/@solid-primitives/destructure/dist/index.js
|
|
5731
5859
|
var isReactiveObject = (value) => typeof value === "object" && value !== null;
|
|
5732
5860
|
function createProxyCache(obj, get) {
|
|
5733
5861
|
return new Proxy(
|
|
@@ -5801,7 +5929,7 @@ var Game = (props) => {
|
|
|
5801
5929
|
choice,
|
|
5802
5930
|
input,
|
|
5803
5931
|
background,
|
|
5804
|
-
custom
|
|
5932
|
+
custom
|
|
5805
5933
|
} = destructure(contextState());
|
|
5806
5934
|
const rendererState = from(data.$rendererState);
|
|
5807
5935
|
const {
|
|
@@ -5841,8 +5969,8 @@ var Game = (props) => {
|
|
|
5841
5969
|
cleanup?.();
|
|
5842
5970
|
resolve?.();
|
|
5843
5971
|
};
|
|
5844
|
-
const
|
|
5845
|
-
return Object.values(
|
|
5972
|
+
const customs = () => {
|
|
5973
|
+
return Object.values(custom());
|
|
5846
5974
|
};
|
|
5847
5975
|
const speed = () => data.storageData().meta[1];
|
|
5848
5976
|
const onWriterEnd = (cb) => {
|
|
@@ -6073,7 +6201,7 @@ var Game = (props) => {
|
|
|
6073
6201
|
setAttribute(_el$26, "data-custom", true);
|
|
6074
6202
|
insert(_el$26, createComponent(For, {
|
|
6075
6203
|
get each() {
|
|
6076
|
-
return
|
|
6204
|
+
return customs();
|
|
6077
6205
|
},
|
|
6078
6206
|
children: (value) => value.dom
|
|
6079
6207
|
}));
|
|
@@ -6287,138 +6415,6 @@ var MainMenu = () => {
|
|
|
6287
6415
|
};
|
|
6288
6416
|
delegateEvents(["click"]);
|
|
6289
6417
|
|
|
6290
|
-
// ../../node_modules/.pnpm/@solid-primitives+intersection-observer@2.1.6_solid-js@1.8.5/node_modules/@solid-primitives/intersection-observer/dist/index.js
|
|
6291
|
-
function observe(el, instance) {
|
|
6292
|
-
if (DEV && el instanceof HTMLElement && el.style.display === "contents") {
|
|
6293
|
-
console.warn(
|
|
6294
|
-
`[@solid-primitives/intersection-observer] IntersectionObserver is not able to observe elements with 'display: "contents"' style:`,
|
|
6295
|
-
el
|
|
6296
|
-
);
|
|
6297
|
-
}
|
|
6298
|
-
instance.observe(el);
|
|
6299
|
-
}
|
|
6300
|
-
function makeIntersectionObserver(elements, onChange, options) {
|
|
6301
|
-
if (isServer)
|
|
6302
|
-
return {
|
|
6303
|
-
add: () => void 0,
|
|
6304
|
-
remove: () => void 0,
|
|
6305
|
-
start: () => void 0,
|
|
6306
|
-
reset: () => void 0,
|
|
6307
|
-
stop: () => void 0,
|
|
6308
|
-
instance: {}
|
|
6309
|
-
};
|
|
6310
|
-
const instance = new IntersectionObserver(onChange, options);
|
|
6311
|
-
const add = (el) => observe(el, instance);
|
|
6312
|
-
const remove = (el) => instance.unobserve(el);
|
|
6313
|
-
const start = () => elements.forEach(add);
|
|
6314
|
-
const reset2 = () => instance.takeRecords().forEach((el) => remove(el.target));
|
|
6315
|
-
start();
|
|
6316
|
-
return { add, remove, start, stop: onCleanup(() => instance.disconnect()), reset: reset2, instance };
|
|
6317
|
-
}
|
|
6318
|
-
function createViewportObserver(...a) {
|
|
6319
|
-
if (isServer) {
|
|
6320
|
-
return [() => void 0, { start: () => void 0, stop: () => void 0 }];
|
|
6321
|
-
}
|
|
6322
|
-
let initial = [];
|
|
6323
|
-
let options = {};
|
|
6324
|
-
if (Array.isArray(a[0]) || a[0] instanceof Function) {
|
|
6325
|
-
if (a[1] instanceof Function) {
|
|
6326
|
-
initial = access(a[0]).map((el) => [el, a[1]]);
|
|
6327
|
-
options = a[2];
|
|
6328
|
-
} else {
|
|
6329
|
-
initial = access(a[0]);
|
|
6330
|
-
options = a[1];
|
|
6331
|
-
}
|
|
6332
|
-
} else
|
|
6333
|
-
options = a[0];
|
|
6334
|
-
const callbacks = /* @__PURE__ */ new WeakMap();
|
|
6335
|
-
const onChange = (entries2, instance2) => entries2.forEach((entry) => {
|
|
6336
|
-
const cb = callbacks.get(entry.target)?.(entry, instance2);
|
|
6337
|
-
cb instanceof Function && cb(entry, instance2);
|
|
6338
|
-
});
|
|
6339
|
-
const { add, remove, stop, instance } = makeIntersectionObserver([], onChange, options);
|
|
6340
|
-
const addEntry = (el, callback) => {
|
|
6341
|
-
add(el);
|
|
6342
|
-
callbacks.set(el, callback);
|
|
6343
|
-
};
|
|
6344
|
-
const removeEntry = (el) => {
|
|
6345
|
-
callbacks.delete(el);
|
|
6346
|
-
remove(el);
|
|
6347
|
-
};
|
|
6348
|
-
const start = () => initial.forEach(([el, cb]) => addEntry(el, cb));
|
|
6349
|
-
onMount(start);
|
|
6350
|
-
return [addEntry, { remove: removeEntry, start, stop, instance }];
|
|
6351
|
-
}
|
|
6352
|
-
|
|
6353
|
-
// ../../node_modules/.pnpm/@solid-primitives+scheduled@1.4.3_solid-js@1.8.5/node_modules/@solid-primitives/scheduled/dist/index.js
|
|
6354
|
-
var debounce = (callback, wait) => {
|
|
6355
|
-
if (isServer) {
|
|
6356
|
-
return Object.assign(() => void 0, { clear: () => void 0 });
|
|
6357
|
-
}
|
|
6358
|
-
let timeoutId;
|
|
6359
|
-
const clear = () => clearTimeout(timeoutId);
|
|
6360
|
-
if (getOwner())
|
|
6361
|
-
onCleanup(clear);
|
|
6362
|
-
const debounced = (...args) => {
|
|
6363
|
-
if (timeoutId !== void 0)
|
|
6364
|
-
clear();
|
|
6365
|
-
timeoutId = setTimeout(() => callback(...args), wait);
|
|
6366
|
-
};
|
|
6367
|
-
return Object.assign(debounced, { clear });
|
|
6368
|
-
};
|
|
6369
|
-
var throttle = (callback, wait) => {
|
|
6370
|
-
if (isServer) {
|
|
6371
|
-
return Object.assign(() => void 0, { clear: () => void 0 });
|
|
6372
|
-
}
|
|
6373
|
-
let isThrottled = false, timeoutId, lastArgs;
|
|
6374
|
-
const throttled = (...args) => {
|
|
6375
|
-
lastArgs = args;
|
|
6376
|
-
if (isThrottled)
|
|
6377
|
-
return;
|
|
6378
|
-
isThrottled = true;
|
|
6379
|
-
timeoutId = setTimeout(() => {
|
|
6380
|
-
callback(...lastArgs);
|
|
6381
|
-
isThrottled = false;
|
|
6382
|
-
}, wait);
|
|
6383
|
-
};
|
|
6384
|
-
const clear = () => {
|
|
6385
|
-
clearTimeout(timeoutId);
|
|
6386
|
-
isThrottled = false;
|
|
6387
|
-
};
|
|
6388
|
-
if (getOwner())
|
|
6389
|
-
onCleanup(clear);
|
|
6390
|
-
return Object.assign(throttled, { clear });
|
|
6391
|
-
};
|
|
6392
|
-
var scheduleIdle = isServer ? () => Object.assign(() => void 0, { clear: () => void 0 }) : (
|
|
6393
|
-
// requestIdleCallback is not supported in Safari
|
|
6394
|
-
window.requestIdleCallback ? (callback, maxWait) => {
|
|
6395
|
-
let isDeferred = false, id, lastArgs;
|
|
6396
|
-
const deferred = (...args) => {
|
|
6397
|
-
lastArgs = args;
|
|
6398
|
-
if (isDeferred)
|
|
6399
|
-
return;
|
|
6400
|
-
isDeferred = true;
|
|
6401
|
-
id = requestIdleCallback(
|
|
6402
|
-
() => {
|
|
6403
|
-
callback(...lastArgs);
|
|
6404
|
-
isDeferred = false;
|
|
6405
|
-
},
|
|
6406
|
-
{ timeout: maxWait }
|
|
6407
|
-
);
|
|
6408
|
-
};
|
|
6409
|
-
const clear = () => {
|
|
6410
|
-
cancelIdleCallback(id);
|
|
6411
|
-
isDeferred = false;
|
|
6412
|
-
};
|
|
6413
|
-
if (getOwner())
|
|
6414
|
-
onCleanup(clear);
|
|
6415
|
-
return Object.assign(deferred, { clear });
|
|
6416
|
-
} : (
|
|
6417
|
-
// fallback to setTimeout (throttle)
|
|
6418
|
-
(callback) => throttle(callback)
|
|
6419
|
-
)
|
|
6420
|
-
);
|
|
6421
|
-
|
|
6422
6418
|
// src/screens/saves.tsx
|
|
6423
6419
|
var _tmpl$27 = /* @__PURE__ */ template(`<ol class="saves__list">`);
|
|
6424
6420
|
var _tmpl$28 = /* @__PURE__ */ template(`<div class="saves"><div class="saves__controls"><button type="button" class="button saves__button"></button></div><div class="saves__list-container">`);
|
|
@@ -6429,40 +6425,68 @@ var Saves = () => {
|
|
|
6429
6425
|
storageData,
|
|
6430
6426
|
$rendererState
|
|
6431
6427
|
} = useData();
|
|
6432
|
-
const [
|
|
6428
|
+
const [list, setList] = createSignal();
|
|
6429
|
+
const [loadingAllowed, setLoadingAllowed] = createSignal([]);
|
|
6430
|
+
const [previewCompleted, setPreviewCompleted] = createSignal([]);
|
|
6431
|
+
const [observedTargets, setObservedTargets] = createSignal([]);
|
|
6433
6432
|
const saves = () => storageData().saves;
|
|
6434
6433
|
const language = () => storageData().meta[0];
|
|
6435
|
-
const [add] = createViewportObserver();
|
|
6436
6434
|
const processed = /* @__PURE__ */ new Set();
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
if (!currentGroup)
|
|
6435
|
+
onMount(() => {
|
|
6436
|
+
const listElement = list();
|
|
6437
|
+
if (!listElement)
|
|
6441
6438
|
return;
|
|
6442
|
-
|
|
6443
|
-
|
|
6439
|
+
const observer = new IntersectionObserver((entries2) => {
|
|
6440
|
+
const currentEntryTimestamps = [];
|
|
6441
|
+
entries2.forEach((entry) => {
|
|
6442
|
+
if (!entry.isIntersecting)
|
|
6443
|
+
return;
|
|
6444
|
+
if (processed.has(entry.target))
|
|
6445
|
+
return;
|
|
6446
|
+
if (!(entry.target instanceof HTMLElement))
|
|
6447
|
+
return;
|
|
6448
|
+
processed.add(entry.target);
|
|
6449
|
+
setLoadingAllowed((prev) => {
|
|
6450
|
+
if (entry.target instanceof HTMLElement) {
|
|
6451
|
+
const timestamp = entry.target.dataset.timestamp;
|
|
6452
|
+
if (timestamp) {
|
|
6453
|
+
const parsed = Number(timestamp);
|
|
6454
|
+
if (Number.isFinite(parsed)) {
|
|
6455
|
+
currentEntryTimestamps.push(parsed);
|
|
6456
|
+
return [...prev, Number(timestamp)];
|
|
6457
|
+
}
|
|
6458
|
+
return prev;
|
|
6459
|
+
}
|
|
6460
|
+
}
|
|
6461
|
+
return prev;
|
|
6462
|
+
});
|
|
6463
|
+
});
|
|
6464
|
+
if (currentEntryTimestamps.length > 0) {
|
|
6465
|
+
setObservedTargets((targets) => [...targets, currentEntryTimestamps]);
|
|
6466
|
+
}
|
|
6467
|
+
}, {
|
|
6468
|
+
root: listElement
|
|
6444
6469
|
});
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
if (processed.has(entry.target))
|
|
6451
|
-
return;
|
|
6452
|
-
processed.add(entry.target);
|
|
6453
|
-
if (entryGroups.has(entry.time)) {
|
|
6454
|
-
const entryGroup = entryGroups.get(entry.time);
|
|
6455
|
-
entryGroup.dates.push(date);
|
|
6456
|
-
entryGroup.promises.push(promise);
|
|
6457
|
-
} else {
|
|
6458
|
-
entryGroups.set(entry.time, {
|
|
6459
|
-
promises: [promise],
|
|
6460
|
-
dates: [date]
|
|
6470
|
+
listElement.childNodes.forEach((childNode) => {
|
|
6471
|
+
if (childNode instanceof HTMLElement) {
|
|
6472
|
+
observer.observe(childNode);
|
|
6473
|
+
onCleanup(() => {
|
|
6474
|
+
observer.unobserve(childNode);
|
|
6461
6475
|
});
|
|
6462
6476
|
}
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6477
|
+
});
|
|
6478
|
+
onCleanup(() => {
|
|
6479
|
+
observer.disconnect();
|
|
6480
|
+
});
|
|
6481
|
+
});
|
|
6482
|
+
const isOverlayShown = (timestamp) => {
|
|
6483
|
+
const observed = observedTargets();
|
|
6484
|
+
const completed = previewCompleted();
|
|
6485
|
+
const targets = observed.find((array) => array.includes(timestamp));
|
|
6486
|
+
if (!targets) {
|
|
6487
|
+
return true;
|
|
6488
|
+
}
|
|
6489
|
+
return !targets.every((item) => completed.includes(item));
|
|
6466
6490
|
};
|
|
6467
6491
|
return (() => {
|
|
6468
6492
|
const _el$ = _tmpl$28(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$2.nextSibling;
|
|
@@ -6483,6 +6507,7 @@ var Saves = () => {
|
|
|
6483
6507
|
},
|
|
6484
6508
|
get children() {
|
|
6485
6509
|
const _el$5 = _tmpl$27();
|
|
6510
|
+
use(setList, _el$5);
|
|
6486
6511
|
insert(_el$5, createComponent(For, {
|
|
6487
6512
|
get each() {
|
|
6488
6513
|
return saves();
|
|
@@ -6492,11 +6517,14 @@ var Saves = () => {
|
|
|
6492
6517
|
get language() {
|
|
6493
6518
|
return language();
|
|
6494
6519
|
},
|
|
6520
|
+
get observed() {
|
|
6521
|
+
return loadingAllowed().includes(save[2][0]);
|
|
6522
|
+
},
|
|
6495
6523
|
get overlayShown() {
|
|
6496
|
-
return
|
|
6524
|
+
return isOverlayShown(save[2][0]);
|
|
6497
6525
|
},
|
|
6498
|
-
|
|
6499
|
-
|
|
6526
|
+
onPreviewDone: () => {
|
|
6527
|
+
setPreviewCompleted((completed) => [...completed, save[2][0]]);
|
|
6500
6528
|
}
|
|
6501
6529
|
})
|
|
6502
6530
|
}));
|
package/dist/utils.d.ts
CHANGED
|
@@ -14,4 +14,9 @@ declare const url: <T extends string>(str: T) => `url(${T})`;
|
|
|
14
14
|
declare const onKey: (cb: (event: KeyboardEvent) => void, ...keys: string[]) => (e: KeyboardEvent) => void;
|
|
15
15
|
declare const simple: <T extends unknown[], R>(fn: (...args: T) => R) => (...args: T) => R;
|
|
16
16
|
declare const getDocumentStyles: () => string;
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* A wrapper on `fn` to make it run only once!
|
|
19
|
+
* @param fn Function that needed to run no more than one time
|
|
20
|
+
*/
|
|
21
|
+
declare const once: (fn: () => void) => () => void;
|
|
22
|
+
export { isCSSImage, canvasDrawImages, url, createImage, capitalize, onKey, findLast, simple, getDocumentStyles, once };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novely/solid-renderer",
|
|
3
|
-
"version": "0.29.1-beta.
|
|
3
|
+
"version": "0.29.1-beta.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -16,10 +16,8 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@solid-primitives/destructure": "^0.1.17",
|
|
19
|
-
"@solid-primitives/intersection-observer": "^2.1.6",
|
|
20
|
-
"@solid-primitives/scheduled": "^1.4.3",
|
|
21
19
|
"retrieved": "^0.1.0",
|
|
22
|
-
"solid-js": "1.8.
|
|
20
|
+
"solid-js": "1.8.17",
|
|
23
21
|
"solid-transition-group": "^0.2.3",
|
|
24
22
|
"@novely/core": "0.32.0",
|
|
25
23
|
"@novely/renderer-toolkit": "0.3.2",
|