@novely/solid-renderer 0.29.1-beta.1 → 0.29.1-beta.3
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 +343 -328
- package/dist/styles/index.css +7 -0
- 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";
|
|
@@ -5396,15 +5509,18 @@ var Save = (props) => {
|
|
|
5396
5509
|
storageDataUpdate,
|
|
5397
5510
|
removeContext
|
|
5398
5511
|
} = useData();
|
|
5399
|
-
const [li, setLi] = createSignal();
|
|
5400
5512
|
const [iframe, setIframe] = createSignal();
|
|
5401
|
-
const
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
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
|
+
});
|
|
5405
5521
|
const [timestamp, type] = props.save[2];
|
|
5406
5522
|
const date = new Date(timestamp);
|
|
5407
|
-
const KEY = `save-${
|
|
5523
|
+
const KEY = `save-${timestamp}-${type}`;
|
|
5408
5524
|
const $contextState = useContextState(KEY);
|
|
5409
5525
|
const context = getContext2(KEY);
|
|
5410
5526
|
const year = date.getFullYear();
|
|
@@ -5430,6 +5546,12 @@ var Save = (props) => {
|
|
|
5430
5546
|
const loadSave = () => {
|
|
5431
5547
|
options.set(props.save);
|
|
5432
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
|
+
};
|
|
5433
5555
|
const onIframeLoaded = () => {
|
|
5434
5556
|
const {
|
|
5435
5557
|
contentDocument
|
|
@@ -5439,33 +5561,36 @@ var Save = (props) => {
|
|
|
5439
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>`);
|
|
5440
5562
|
context.root = contentDocument.body;
|
|
5441
5563
|
contentDocument.body.appendChild(game);
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5564
|
+
setIframeLoaded(true);
|
|
5565
|
+
};
|
|
5566
|
+
createEffect(() => {
|
|
5567
|
+
if (props.observed && iframeLoaded() && !previewStarted()) {
|
|
5568
|
+
setPreviewStarted(true);
|
|
5447
5569
|
options.preview(props.save, KEY).then(() => {
|
|
5448
5570
|
const background = useContextState(KEY).get().background.background;
|
|
5449
5571
|
if (!background || !isCSSImage(background)) {
|
|
5450
|
-
return
|
|
5572
|
+
return previewDone();
|
|
5451
5573
|
}
|
|
5452
5574
|
if (PRELOADED_IMAGE_MAP.has(background)) {
|
|
5453
|
-
return
|
|
5575
|
+
return previewDone();
|
|
5454
5576
|
}
|
|
5455
5577
|
const backgroundElement = context.root.querySelector("img.background");
|
|
5456
5578
|
if (!backgroundElement) {
|
|
5457
|
-
return
|
|
5579
|
+
return previewDone();
|
|
5458
5580
|
}
|
|
5459
5581
|
if (backgroundElement.complete && backgroundElement.naturalHeight !== 0) {
|
|
5460
|
-
return
|
|
5582
|
+
return previewDone();
|
|
5461
5583
|
}
|
|
5462
|
-
|
|
5463
|
-
|
|
5584
|
+
const onLoadingStatusChange = () => {
|
|
5585
|
+
backgroundElement.removeEventListener("load", onLoadingStatusChange);
|
|
5586
|
+
backgroundElement.removeEventListener("error", onLoadingStatusChange);
|
|
5587
|
+
previewDone();
|
|
5464
5588
|
};
|
|
5589
|
+
backgroundElement.addEventListener("load", onLoadingStatusChange);
|
|
5590
|
+
backgroundElement.addEventListener("error", onLoadingStatusChange);
|
|
5465
5591
|
});
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
};
|
|
5592
|
+
}
|
|
5593
|
+
});
|
|
5469
5594
|
createEffect(() => {
|
|
5470
5595
|
const iframeElement = iframe();
|
|
5471
5596
|
if (!iframeElement)
|
|
@@ -5492,15 +5617,12 @@ var Save = (props) => {
|
|
|
5492
5617
|
options.removeContext(KEY);
|
|
5493
5618
|
removeShared(KEY);
|
|
5494
5619
|
});
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
return prev;
|
|
5499
|
-
});
|
|
5500
|
-
};
|
|
5620
|
+
onCleanup(() => {
|
|
5621
|
+
clearTimeout(previewDoneTimeoutId);
|
|
5622
|
+
});
|
|
5501
5623
|
return (() => {
|
|
5502
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;
|
|
5503
|
-
|
|
5625
|
+
setAttribute(_el$, "data-timestamp", timestamp);
|
|
5504
5626
|
_el$2.$$keyup = (event) => {
|
|
5505
5627
|
if (event.code === "Space") {
|
|
5506
5628
|
loadSave();
|
|
@@ -5517,7 +5639,7 @@ var Save = (props) => {
|
|
|
5517
5639
|
get children() {
|
|
5518
5640
|
return createComponent(Show, {
|
|
5519
5641
|
get when() {
|
|
5520
|
-
return
|
|
5642
|
+
return props.overlayShown;
|
|
5521
5643
|
},
|
|
5522
5644
|
get children() {
|
|
5523
5645
|
return _tmpl$17();
|
|
@@ -5733,7 +5855,7 @@ var createTypewriter = ({
|
|
|
5733
5855
|
};
|
|
5734
5856
|
};
|
|
5735
5857
|
|
|
5736
|
-
// ../../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
|
|
5737
5859
|
var isReactiveObject = (value) => typeof value === "object" && value !== null;
|
|
5738
5860
|
function createProxyCache(obj, get) {
|
|
5739
5861
|
return new Proxy(
|
|
@@ -5807,7 +5929,7 @@ var Game = (props) => {
|
|
|
5807
5929
|
choice,
|
|
5808
5930
|
input,
|
|
5809
5931
|
background,
|
|
5810
|
-
custom
|
|
5932
|
+
custom
|
|
5811
5933
|
} = destructure(contextState());
|
|
5812
5934
|
const rendererState = from(data.$rendererState);
|
|
5813
5935
|
const {
|
|
@@ -5847,8 +5969,8 @@ var Game = (props) => {
|
|
|
5847
5969
|
cleanup?.();
|
|
5848
5970
|
resolve?.();
|
|
5849
5971
|
};
|
|
5850
|
-
const
|
|
5851
|
-
return Object.values(
|
|
5972
|
+
const customs = () => {
|
|
5973
|
+
return Object.values(custom());
|
|
5852
5974
|
};
|
|
5853
5975
|
const speed = () => data.storageData().meta[1];
|
|
5854
5976
|
const onWriterEnd = (cb) => {
|
|
@@ -5925,14 +6047,12 @@ var Game = (props) => {
|
|
|
5925
6047
|
let img = PRELOADED_IMAGE_MAP.get(src());
|
|
5926
6048
|
if (img) {
|
|
5927
6049
|
const clone = img.cloneNode(true);
|
|
5928
|
-
console.log("Using cloned image");
|
|
5929
6050
|
return Object.assign(clone, {
|
|
5930
6051
|
className: "background"
|
|
5931
6052
|
});
|
|
5932
6053
|
}
|
|
5933
6054
|
img = createImage(src());
|
|
5934
6055
|
img.addEventListener("load", () => {
|
|
5935
|
-
console.log("Loading image");
|
|
5936
6056
|
PRELOADED_IMAGE_MAP.set(src(), img);
|
|
5937
6057
|
});
|
|
5938
6058
|
return Object.assign(img, {
|
|
@@ -6081,7 +6201,7 @@ var Game = (props) => {
|
|
|
6081
6201
|
setAttribute(_el$26, "data-custom", true);
|
|
6082
6202
|
insert(_el$26, createComponent(For, {
|
|
6083
6203
|
get each() {
|
|
6084
|
-
return
|
|
6204
|
+
return customs();
|
|
6085
6205
|
},
|
|
6086
6206
|
children: (value) => value.dom
|
|
6087
6207
|
}));
|
|
@@ -6295,138 +6415,6 @@ var MainMenu = () => {
|
|
|
6295
6415
|
};
|
|
6296
6416
|
delegateEvents(["click"]);
|
|
6297
6417
|
|
|
6298
|
-
// ../../node_modules/.pnpm/@solid-primitives+intersection-observer@2.1.6_solid-js@1.8.5/node_modules/@solid-primitives/intersection-observer/dist/index.js
|
|
6299
|
-
function observe(el, instance) {
|
|
6300
|
-
if (DEV && el instanceof HTMLElement && el.style.display === "contents") {
|
|
6301
|
-
console.warn(
|
|
6302
|
-
`[@solid-primitives/intersection-observer] IntersectionObserver is not able to observe elements with 'display: "contents"' style:`,
|
|
6303
|
-
el
|
|
6304
|
-
);
|
|
6305
|
-
}
|
|
6306
|
-
instance.observe(el);
|
|
6307
|
-
}
|
|
6308
|
-
function makeIntersectionObserver(elements, onChange, options) {
|
|
6309
|
-
if (isServer)
|
|
6310
|
-
return {
|
|
6311
|
-
add: () => void 0,
|
|
6312
|
-
remove: () => void 0,
|
|
6313
|
-
start: () => void 0,
|
|
6314
|
-
reset: () => void 0,
|
|
6315
|
-
stop: () => void 0,
|
|
6316
|
-
instance: {}
|
|
6317
|
-
};
|
|
6318
|
-
const instance = new IntersectionObserver(onChange, options);
|
|
6319
|
-
const add = (el) => observe(el, instance);
|
|
6320
|
-
const remove = (el) => instance.unobserve(el);
|
|
6321
|
-
const start = () => elements.forEach(add);
|
|
6322
|
-
const reset2 = () => instance.takeRecords().forEach((el) => remove(el.target));
|
|
6323
|
-
start();
|
|
6324
|
-
return { add, remove, start, stop: onCleanup(() => instance.disconnect()), reset: reset2, instance };
|
|
6325
|
-
}
|
|
6326
|
-
function createViewportObserver(...a) {
|
|
6327
|
-
if (isServer) {
|
|
6328
|
-
return [() => void 0, { start: () => void 0, stop: () => void 0 }];
|
|
6329
|
-
}
|
|
6330
|
-
let initial = [];
|
|
6331
|
-
let options = {};
|
|
6332
|
-
if (Array.isArray(a[0]) || a[0] instanceof Function) {
|
|
6333
|
-
if (a[1] instanceof Function) {
|
|
6334
|
-
initial = access(a[0]).map((el) => [el, a[1]]);
|
|
6335
|
-
options = a[2];
|
|
6336
|
-
} else {
|
|
6337
|
-
initial = access(a[0]);
|
|
6338
|
-
options = a[1];
|
|
6339
|
-
}
|
|
6340
|
-
} else
|
|
6341
|
-
options = a[0];
|
|
6342
|
-
const callbacks = /* @__PURE__ */ new WeakMap();
|
|
6343
|
-
const onChange = (entries2, instance2) => entries2.forEach((entry) => {
|
|
6344
|
-
const cb = callbacks.get(entry.target)?.(entry, instance2);
|
|
6345
|
-
cb instanceof Function && cb(entry, instance2);
|
|
6346
|
-
});
|
|
6347
|
-
const { add, remove, stop, instance } = makeIntersectionObserver([], onChange, options);
|
|
6348
|
-
const addEntry = (el, callback) => {
|
|
6349
|
-
add(el);
|
|
6350
|
-
callbacks.set(el, callback);
|
|
6351
|
-
};
|
|
6352
|
-
const removeEntry = (el) => {
|
|
6353
|
-
callbacks.delete(el);
|
|
6354
|
-
remove(el);
|
|
6355
|
-
};
|
|
6356
|
-
const start = () => initial.forEach(([el, cb]) => addEntry(el, cb));
|
|
6357
|
-
onMount(start);
|
|
6358
|
-
return [addEntry, { remove: removeEntry, start, stop, instance }];
|
|
6359
|
-
}
|
|
6360
|
-
|
|
6361
|
-
// ../../node_modules/.pnpm/@solid-primitives+scheduled@1.4.3_solid-js@1.8.5/node_modules/@solid-primitives/scheduled/dist/index.js
|
|
6362
|
-
var debounce = (callback, wait) => {
|
|
6363
|
-
if (isServer) {
|
|
6364
|
-
return Object.assign(() => void 0, { clear: () => void 0 });
|
|
6365
|
-
}
|
|
6366
|
-
let timeoutId;
|
|
6367
|
-
const clear = () => clearTimeout(timeoutId);
|
|
6368
|
-
if (getOwner())
|
|
6369
|
-
onCleanup(clear);
|
|
6370
|
-
const debounced = (...args) => {
|
|
6371
|
-
if (timeoutId !== void 0)
|
|
6372
|
-
clear();
|
|
6373
|
-
timeoutId = setTimeout(() => callback(...args), wait);
|
|
6374
|
-
};
|
|
6375
|
-
return Object.assign(debounced, { clear });
|
|
6376
|
-
};
|
|
6377
|
-
var throttle = (callback, wait) => {
|
|
6378
|
-
if (isServer) {
|
|
6379
|
-
return Object.assign(() => void 0, { clear: () => void 0 });
|
|
6380
|
-
}
|
|
6381
|
-
let isThrottled = false, timeoutId, lastArgs;
|
|
6382
|
-
const throttled = (...args) => {
|
|
6383
|
-
lastArgs = args;
|
|
6384
|
-
if (isThrottled)
|
|
6385
|
-
return;
|
|
6386
|
-
isThrottled = true;
|
|
6387
|
-
timeoutId = setTimeout(() => {
|
|
6388
|
-
callback(...lastArgs);
|
|
6389
|
-
isThrottled = false;
|
|
6390
|
-
}, wait);
|
|
6391
|
-
};
|
|
6392
|
-
const clear = () => {
|
|
6393
|
-
clearTimeout(timeoutId);
|
|
6394
|
-
isThrottled = false;
|
|
6395
|
-
};
|
|
6396
|
-
if (getOwner())
|
|
6397
|
-
onCleanup(clear);
|
|
6398
|
-
return Object.assign(throttled, { clear });
|
|
6399
|
-
};
|
|
6400
|
-
var scheduleIdle = isServer ? () => Object.assign(() => void 0, { clear: () => void 0 }) : (
|
|
6401
|
-
// requestIdleCallback is not supported in Safari
|
|
6402
|
-
window.requestIdleCallback ? (callback, maxWait) => {
|
|
6403
|
-
let isDeferred = false, id, lastArgs;
|
|
6404
|
-
const deferred = (...args) => {
|
|
6405
|
-
lastArgs = args;
|
|
6406
|
-
if (isDeferred)
|
|
6407
|
-
return;
|
|
6408
|
-
isDeferred = true;
|
|
6409
|
-
id = requestIdleCallback(
|
|
6410
|
-
() => {
|
|
6411
|
-
callback(...lastArgs);
|
|
6412
|
-
isDeferred = false;
|
|
6413
|
-
},
|
|
6414
|
-
{ timeout: maxWait }
|
|
6415
|
-
);
|
|
6416
|
-
};
|
|
6417
|
-
const clear = () => {
|
|
6418
|
-
cancelIdleCallback(id);
|
|
6419
|
-
isDeferred = false;
|
|
6420
|
-
};
|
|
6421
|
-
if (getOwner())
|
|
6422
|
-
onCleanup(clear);
|
|
6423
|
-
return Object.assign(deferred, { clear });
|
|
6424
|
-
} : (
|
|
6425
|
-
// fallback to setTimeout (throttle)
|
|
6426
|
-
(callback) => throttle(callback)
|
|
6427
|
-
)
|
|
6428
|
-
);
|
|
6429
|
-
|
|
6430
6418
|
// src/screens/saves.tsx
|
|
6431
6419
|
var _tmpl$27 = /* @__PURE__ */ template(`<ol class="saves__list">`);
|
|
6432
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">`);
|
|
@@ -6437,46 +6425,69 @@ var Saves = () => {
|
|
|
6437
6425
|
storageData,
|
|
6438
6426
|
$rendererState
|
|
6439
6427
|
} = useData();
|
|
6440
|
-
const [
|
|
6428
|
+
const [list, setList] = createSignal();
|
|
6429
|
+
const [loadingAllowed, setLoadingAllowed] = createSignal([]);
|
|
6430
|
+
const [previewCompleted, setPreviewCompleted] = createSignal([]);
|
|
6431
|
+
const [observedTargets, setObservedTargets] = createSignal([]);
|
|
6441
6432
|
const saves = () => storageData().saves;
|
|
6442
6433
|
const language = () => storageData().meta[0];
|
|
6443
|
-
const [add] = createViewportObserver();
|
|
6444
6434
|
const processed = /* @__PURE__ */ new Set();
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
if (!currentGroup)
|
|
6435
|
+
onMount(() => {
|
|
6436
|
+
const listElement = list();
|
|
6437
|
+
if (!listElement)
|
|
6449
6438
|
return;
|
|
6450
|
-
|
|
6451
|
-
|
|
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
|
|
6452
6469
|
});
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
if (processed.has(entry.target))
|
|
6459
|
-
return;
|
|
6460
|
-
processed.add(entry.target);
|
|
6461
|
-
const promise = load();
|
|
6462
|
-
if (entryGroups.has(entry.time)) {
|
|
6463
|
-
const entryGroup = entryGroups.get(entry.time);
|
|
6464
|
-
entryGroup.dates.push(date);
|
|
6465
|
-
entryGroup.promises.push(promise);
|
|
6466
|
-
} else {
|
|
6467
|
-
entryGroups.set(entry.time, {
|
|
6468
|
-
promises: [promise],
|
|
6469
|
-
dates: [date]
|
|
6470
|
+
listElement.childNodes.forEach((childNode) => {
|
|
6471
|
+
if (childNode instanceof HTMLElement) {
|
|
6472
|
+
observer.observe(childNode);
|
|
6473
|
+
onCleanup(() => {
|
|
6474
|
+
observer.unobserve(childNode);
|
|
6470
6475
|
});
|
|
6471
6476
|
}
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
onCleanup(() => {
|
|
6477
|
-
processed.clear();
|
|
6478
|
-
entryGroups.clear();
|
|
6477
|
+
});
|
|
6478
|
+
onCleanup(() => {
|
|
6479
|
+
observer.disconnect();
|
|
6480
|
+
});
|
|
6479
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));
|
|
6490
|
+
};
|
|
6480
6491
|
return (() => {
|
|
6481
6492
|
const _el$ = _tmpl$28(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$2.nextSibling;
|
|
6482
6493
|
_el$3.$$click = () => {
|
|
@@ -6496,6 +6507,7 @@ var Saves = () => {
|
|
|
6496
6507
|
},
|
|
6497
6508
|
get children() {
|
|
6498
6509
|
const _el$5 = _tmpl$27();
|
|
6510
|
+
use(setList, _el$5);
|
|
6499
6511
|
insert(_el$5, createComponent(For, {
|
|
6500
6512
|
get each() {
|
|
6501
6513
|
return saves();
|
|
@@ -6505,11 +6517,14 @@ var Saves = () => {
|
|
|
6505
6517
|
get language() {
|
|
6506
6518
|
return language();
|
|
6507
6519
|
},
|
|
6520
|
+
get observed() {
|
|
6521
|
+
return loadingAllowed().includes(save[2][0]);
|
|
6522
|
+
},
|
|
6508
6523
|
get overlayShown() {
|
|
6509
|
-
return
|
|
6524
|
+
return isOverlayShown(save[2][0]);
|
|
6510
6525
|
},
|
|
6511
|
-
|
|
6512
|
-
|
|
6526
|
+
onPreviewDone: () => {
|
|
6527
|
+
setPreviewCompleted((completed) => [...completed, save[2][0]]);
|
|
6513
6528
|
}
|
|
6514
6529
|
})
|
|
6515
6530
|
}));
|
package/dist/styles/index.css
CHANGED
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.3",
|
|
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",
|