@puzzmo/sdk 1.0.70 → 1.0.72
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/README.md +20 -6
- package/dist/bootstrapPayload.spec.d.ts +2 -0
- package/dist/bootstrapPayload.spec.d.ts.map +1 -0
- package/dist/{createSimulator-Ce3StrQI.cjs → createSimulator-C3cLppcW.cjs} +33 -33
- package/dist/createSimulator-C3cLppcW.cjs.map +1 -0
- package/dist/{createSimulator-DUZOd1Hx.js → createSimulator-C5RgI7Gg.js} +165 -129
- package/dist/createSimulator-C5RgI7Gg.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.global.js +1 -1
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +174 -118
- package/dist/index.js.map +1 -1
- package/dist/pico8/index.cjs.map +1 -1
- package/dist/pico8/index.d.ts +2 -2
- package/dist/pico8/index.d.ts.map +1 -1
- package/dist/pico8/index.js.map +1 -1
- package/dist/sdk.d.ts +77 -8
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.gameReady.spec.d.ts +2 -0
- package/dist/sdk.gameReady.spec.d.ts.map +1 -0
- package/dist/sdk.session.spec.d.ts +2 -0
- package/dist/sdk.session.spec.d.ts.map +1 -0
- package/dist/simulator/createSimulator.d.ts.map +1 -1
- package/dist/simulator/index.cjs +1 -1
- package/dist/simulator/index.js +1 -1
- package/dist/simulator/standalone.cjs +1 -1
- package/dist/simulator/standalone.js +1 -1
- package/dist/simulator/state.d.ts.map +1 -1
- package/dist/simulator/types.d.ts +10 -0
- package/dist/simulator/types.d.ts.map +1 -1
- package/dist/types.d.ts +57 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.ts +5 -0
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js.map +1 -1
- package/package.json +1 -1
- package/dist/createSimulator-Ce3StrQI.cjs.map +0 -1
- package/dist/createSimulator-DUZOd1Hx.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -270,13 +270,12 @@ function S() {
|
|
|
270
270
|
};
|
|
271
271
|
}
|
|
272
272
|
/**
|
|
273
|
-
* The host<->game contract this SDK
|
|
274
|
-
*
|
|
275
|
-
* sees a contract it doesn't know.
|
|
273
|
+
* The host<->game contract this SDK speaks, declared in READY and READY_GAME_LOADED: games read
|
|
274
|
+
* `game` and `session`, and handle `session` being absent. Hosts on "1.0" always send a session.
|
|
276
275
|
*/
|
|
277
|
-
var C = "1.
|
|
276
|
+
var C = "1.1", w = S(), T = 1e4;
|
|
278
277
|
/** Creates a Puzzmo SDK instance for communicating with the Puzzmo host */
|
|
279
|
-
const
|
|
278
|
+
const E = (r = {}) => {
|
|
280
279
|
var i;
|
|
281
280
|
let a = null, s = null, c = () => {
|
|
282
281
|
var e;
|
|
@@ -285,53 +284,66 @@ const T = (r = {}) => {
|
|
|
285
284
|
var e, t;
|
|
286
285
|
return (e = (t = c()) == null ? void 0 : t.id) == null ? null : e;
|
|
287
286
|
}, u = () => {
|
|
288
|
-
var e, t;
|
|
289
|
-
return (e = a == null || (
|
|
287
|
+
var e, t, n, r;
|
|
288
|
+
return (e = (t = a == null || (n = a.session) == null ? void 0 : n.puzzle.puzzle) == null ? a == null || (r = a.repeatablePuzzle) == null ? void 0 : r.puzzle : t) == null ? null : e;
|
|
290
289
|
}, p = () => {
|
|
291
290
|
var e, t;
|
|
292
291
|
return (e = (t = c()) == null ? void 0 : t.boardState) == null ? null : e;
|
|
293
292
|
}, m = () => {
|
|
294
293
|
var e;
|
|
295
294
|
return (e = a == null ? void 0 : a.theme) == null ? null : e;
|
|
296
|
-
}, h = () => {
|
|
295
|
+
}, h = null, g = 0, _ = !1, v = () => {
|
|
297
296
|
var e, t;
|
|
298
297
|
return (e = (t = c()) == null ? void 0 : t.completed) == null ? !1 : e;
|
|
299
|
-
},
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
298
|
+
}, b = !1, S = (e) => {
|
|
299
|
+
if (b) return;
|
|
300
|
+
b = !0;
|
|
301
|
+
let t = a ? "the host sent no play session, so there is no gameplay to save to" : "it was called before gameReady() resolved";
|
|
302
|
+
console.warn(`[Puzzmo SDK] ${e}() was ignored: ${t}`);
|
|
303
|
+
}, E = /* @__PURE__ */ new Map(), k = null, A = null, j = !1, M = (e, t) => {
|
|
304
|
+
j || A == null || A.trackEvent(e, t);
|
|
305
|
+
}, N = x(), P = null, F = null, I = () => {
|
|
306
|
+
P || (P = setInterval(() => {
|
|
307
|
+
if (N.isPaused()) return;
|
|
308
|
+
let [e, t] = N.display();
|
|
305
309
|
w.sendMessage("TIMER_TICK", { display: [e, t] });
|
|
306
|
-
}, 500),
|
|
307
|
-
|
|
310
|
+
}, 500), F = setInterval(() => {
|
|
311
|
+
N.isPaused() || w.sendMessage("TIMER_SYNC", Math.floor(N.timeWithoutPenaltySecs()));
|
|
308
312
|
}, 1e4));
|
|
309
|
-
},
|
|
310
|
-
|
|
311
|
-
},
|
|
312
|
-
let n =
|
|
313
|
+
}, L = () => {
|
|
314
|
+
P && (clearInterval(P), P = null), F && (clearInterval(F), F = null);
|
|
315
|
+
}, R = (e, t) => {
|
|
316
|
+
let n = E.get(e);
|
|
313
317
|
n && n.forEach((e) => e(t));
|
|
314
318
|
};
|
|
315
319
|
w.onMessage("START_GAME", () => {
|
|
316
|
-
|
|
320
|
+
N._init(), I(), R("start");
|
|
317
321
|
});
|
|
318
|
-
let
|
|
319
|
-
let e =
|
|
320
|
-
|
|
321
|
-
},
|
|
322
|
-
let e =
|
|
323
|
-
|
|
322
|
+
let z = () => {
|
|
323
|
+
let e = N.isPaused();
|
|
324
|
+
N._pause(), N.isPaused() !== e && R("pause");
|
|
325
|
+
}, B = () => {
|
|
326
|
+
let e = N.isPaused();
|
|
327
|
+
N._resume(), N.isPaused() !== e && R("resume");
|
|
324
328
|
};
|
|
325
|
-
w.onMessage("PAUSE_GAME",
|
|
326
|
-
|
|
327
|
-
}), w.onMessage("KEYBOARD_KEY_PRESS", (e) =>
|
|
328
|
-
|
|
329
|
+
w.onMessage("PAUSE_GAME", z), w.onMessage("RESUME_GAME", B), w.onMessage("SETTINGS_UPDATE", (e) => {
|
|
330
|
+
k = t(t({}, k), e), R("settingsUpdate", k);
|
|
331
|
+
}), w.onMessage("KEYBOARD_KEY_PRESS", (e) => R("keyboardKeyPress", e)), w.onMessage("KEYBOARD_CURSOR_CHANGE", (e) => R("keyboardCursorChange", e)), w.onMessage("KEYBOARD_CURSOR_END", () => R("keyboardCursorEnd"));
|
|
332
|
+
let V = /* @__PURE__ */ new Map(), H = 0;
|
|
333
|
+
w.onMessage("PUZZLE_DATA", (e) => {
|
|
334
|
+
let t = V.get(e.nonce);
|
|
335
|
+
t && (V.delete(e.nonce), "failed" in e ? t.reject(Error(e.error)) : t.resolve({
|
|
336
|
+
puzzleKey: e.puzzle.key,
|
|
337
|
+
puzzleString: e.puzzle.puzzle
|
|
338
|
+
}));
|
|
339
|
+
}), w.onMessage("RETRY_PUZZLE", () => {
|
|
340
|
+
N._reset(), L(), R("retry");
|
|
329
341
|
}), w.onMessage("READY_DATA", (e) => {
|
|
330
342
|
var t;
|
|
331
343
|
let n = o(e);
|
|
332
344
|
a = n;
|
|
333
345
|
let r = (t = n.session) == null ? void 0 : t.gameplay;
|
|
334
|
-
if (
|
|
346
|
+
if (k === null) {
|
|
335
347
|
var i, c;
|
|
336
348
|
let e = n.game.slug, t = e ? (i = n.userState) == null || (i = i.gameSettings) == null ? void 0 : i[e] : null;
|
|
337
349
|
if (typeof t == "string") try {
|
|
@@ -339,73 +351,64 @@ const T = (r = {}) => {
|
|
|
339
351
|
} catch (e) {
|
|
340
352
|
t = null;
|
|
341
353
|
}
|
|
342
|
-
|
|
354
|
+
k = (c = t) == null ? {} : c;
|
|
343
355
|
}
|
|
344
356
|
if (r) {
|
|
345
357
|
var l, u;
|
|
346
358
|
let e = ((l = r.elapsedTimeSecs) == null ? 0 : l) * 1e3, t = ((u = r.additionalTimeAddedSecs) == null ? 0 : u) * 1e3;
|
|
347
|
-
|
|
359
|
+
N._reset(e, t);
|
|
348
360
|
}
|
|
349
|
-
if (!
|
|
361
|
+
if (!A) {
|
|
350
362
|
var p;
|
|
351
|
-
|
|
363
|
+
A = d(n), j = (p = r == null ? void 0 : r.completed) == null ? !1 : p, A && f((e) => A.trackLinkClick(e));
|
|
352
364
|
}
|
|
353
365
|
s && (s(n), s = null);
|
|
354
366
|
});
|
|
355
|
-
let
|
|
356
|
-
timeMs: () =>
|
|
357
|
-
timeSecs: () =>
|
|
358
|
-
addedTimeMs: () =>
|
|
359
|
-
addedTimeSecs: () =>
|
|
360
|
-
timeWithoutPenaltySecs: () =>
|
|
361
|
-
display: () =>
|
|
362
|
-
addPenalty: (e) =>
|
|
363
|
-
setPenalty: (e) =>
|
|
364
|
-
isPaused: () =>
|
|
365
|
-
isRunning: () =>
|
|
366
|
-
pause:
|
|
367
|
-
resume:
|
|
368
|
-
},
|
|
367
|
+
let U = {
|
|
368
|
+
timeMs: () => N.timeMs(),
|
|
369
|
+
timeSecs: () => N.timeSecs(),
|
|
370
|
+
addedTimeMs: () => N.addedTimeMs(),
|
|
371
|
+
addedTimeSecs: () => N.addedTimeSecs(),
|
|
372
|
+
timeWithoutPenaltySecs: () => N.timeWithoutPenaltySecs(),
|
|
373
|
+
display: () => N.display(),
|
|
374
|
+
addPenalty: (e) => N.addPenalty(e),
|
|
375
|
+
setPenalty: (e) => N.setPenalty(e),
|
|
376
|
+
isPaused: () => N.isPaused(),
|
|
377
|
+
isRunning: () => N.isRunning(),
|
|
378
|
+
pause: z,
|
|
379
|
+
resume: B
|
|
380
|
+
}, W = {
|
|
369
381
|
send: (e, t) => w.sendMessage(e, t),
|
|
370
382
|
on: (e, t) => w.onMessage(e, t),
|
|
371
|
-
timer:
|
|
383
|
+
timer: U,
|
|
372
384
|
bootstrap: () => a
|
|
373
|
-
},
|
|
374
|
-
for (let e of (i = r.plugins) == null ? [] : i)
|
|
385
|
+
}, G = {};
|
|
386
|
+
for (let e of (i = r.plugins) == null ? [] : i) G[e.name] = e.setup(W);
|
|
375
387
|
return {
|
|
376
|
-
timer:
|
|
377
|
-
plugins:
|
|
388
|
+
timer: U,
|
|
389
|
+
plugins: G,
|
|
378
390
|
gameReady: function() {
|
|
379
391
|
var e = n(function* () {
|
|
380
|
-
var e;
|
|
381
|
-
if (w.sendMessage("READY", { runtimeContract: C }),
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
readyData: a
|
|
390
|
-
};
|
|
392
|
+
var e, n;
|
|
393
|
+
if (w.sendMessage("READY", { runtimeContract: C }), !a) {
|
|
394
|
+
var i;
|
|
395
|
+
let e = (i = r.timeout) == null ? 5e3 : i;
|
|
396
|
+
yield new Promise((t, n) => {
|
|
397
|
+
s = t, setTimeout(() => {
|
|
398
|
+
s && (s = null, n(/* @__PURE__ */ Error(`Timeout waiting for READY_DATA after ${e}ms`)));
|
|
399
|
+
}, e);
|
|
400
|
+
});
|
|
391
401
|
}
|
|
392
|
-
let
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
let n = u();
|
|
399
|
-
if (!n) throw Error("READY_DATA received but no puzzle data found");
|
|
400
|
-
let i = p();
|
|
401
|
-
return {
|
|
402
|
-
puzzleString: n,
|
|
403
|
-
inputString: i,
|
|
404
|
-
boardState: i,
|
|
402
|
+
let o = p();
|
|
403
|
+
return t(t({}, {
|
|
404
|
+
mode: a != null && a.repeatable ? "repeatable" : "puzzle",
|
|
405
|
+
puzzleString: u(),
|
|
406
|
+
puzzleKey: a != null && a.repeatable ? (e = (n = a.repeatablePuzzle) == null ? void 0 : n.key) == null ? null : e : null,
|
|
407
|
+
inputString: o,
|
|
405
408
|
theme: m(),
|
|
406
|
-
completed:
|
|
409
|
+
completed: v(),
|
|
407
410
|
readyData: a
|
|
408
|
-
};
|
|
411
|
+
}), {}, { boardState: o });
|
|
409
412
|
});
|
|
410
413
|
return function() {
|
|
411
414
|
return e.apply(this, arguments);
|
|
@@ -416,50 +419,51 @@ const T = (r = {}) => {
|
|
|
416
419
|
state: e,
|
|
417
420
|
gameRuntimeContract: C,
|
|
418
421
|
embedRuntimeContract: "1.0"
|
|
419
|
-
}),
|
|
422
|
+
}), M("READY_GAME_LOADED");
|
|
420
423
|
},
|
|
421
|
-
on: (e, t) => (
|
|
424
|
+
on: (e, t) => (E.has(e) || E.set(e, /* @__PURE__ */ new Set()), E.get(e).add(t), () => {
|
|
422
425
|
var n;
|
|
423
|
-
(n =
|
|
426
|
+
(n = E.get(e)) == null || n.delete(t);
|
|
424
427
|
}),
|
|
425
428
|
off: (e, t) => {
|
|
426
429
|
var n;
|
|
427
|
-
(n =
|
|
430
|
+
(n = E.get(e)) == null || n.delete(t);
|
|
428
431
|
},
|
|
429
432
|
updateGameState: (e, t) => {
|
|
430
433
|
var n, r;
|
|
431
434
|
let i = l();
|
|
432
|
-
i
|
|
435
|
+
if (!i) return S("updateGameState");
|
|
436
|
+
w.sendMessage("UPLOAD_NEW_GAME_STATE", {
|
|
433
437
|
id: i,
|
|
434
438
|
input: {
|
|
435
439
|
boardState: e,
|
|
436
|
-
elapsedTimeSecs: (n = t == null ? void 0 : t.elapsedTimeSecs) == null ?
|
|
437
|
-
additionalTimeAddedSecs: (r = t == null ? void 0 : t.additionalTimeAddedSecs) == null ?
|
|
440
|
+
elapsedTimeSecs: (n = t == null ? void 0 : t.elapsedTimeSecs) == null ? N.timeWithoutPenaltySecs() : n,
|
|
441
|
+
additionalTimeAddedSecs: (r = t == null ? void 0 : t.additionalTimeAddedSecs) == null ? N.addedTimeSecs() : r,
|
|
438
442
|
collabUserReferences: []
|
|
439
443
|
}
|
|
440
|
-
}),
|
|
444
|
+
}), M("UPLOAD_NEW_GAME_STATE");
|
|
441
445
|
},
|
|
442
446
|
gameCompleted: (n, r) => {
|
|
443
|
-
var i,
|
|
444
|
-
|
|
445
|
-
let { inputString:
|
|
446
|
-
boardState:
|
|
447
|
-
elapsedTimeSecs: (i = n.elapsedTimeSecs) == null ?
|
|
448
|
-
additionalTimeAddedSecs: (
|
|
449
|
-
}),
|
|
450
|
-
|
|
447
|
+
var i, o, s, c, u;
|
|
448
|
+
N._conclude(), L();
|
|
449
|
+
let { inputString: d } = n, f = t(t({}, e(n, y)), {}, {
|
|
450
|
+
boardState: d == null ? n.boardState : d,
|
|
451
|
+
elapsedTimeSecs: (i = n.elapsedTimeSecs) == null ? N.timeWithoutPenaltySecs() : i,
|
|
452
|
+
additionalTimeAddedSecs: (o = n.additionalTimeAddedSecs) == null ? N.addedTimeSecs() : o
|
|
453
|
+
}), p = (s = r == null ? void 0 : r.deeds) == null ? [] : s;
|
|
454
|
+
p.push({
|
|
451
455
|
id: "points",
|
|
452
456
|
value: n.pointsAwarded
|
|
453
|
-
}),
|
|
457
|
+
}), p.push({
|
|
454
458
|
id: "time",
|
|
455
|
-
value: Math.round((
|
|
459
|
+
value: Math.round((c = f.elapsedTimeSecs) == null ? 0 : c) + Math.round((u = f.additionalTimeAddedSecs) == null ? 0 : u)
|
|
456
460
|
});
|
|
457
|
-
let
|
|
458
|
-
|
|
459
|
-
id:
|
|
460
|
-
input:
|
|
461
|
+
let m = l(), h = a && !a.session && a.appRuntimeContract === "1.1";
|
|
462
|
+
m || h ? (w.sendMessage("GAME_COMPLETED", {
|
|
463
|
+
id: m == null ? void 0 : m,
|
|
464
|
+
input: f,
|
|
461
465
|
config: r
|
|
462
|
-
}),
|
|
466
|
+
}), M("GAME_COMPLETED", { input: f })) : S("gameCompleted");
|
|
463
467
|
},
|
|
464
468
|
showCompletionScreen: (e) => {
|
|
465
469
|
w.sendMessage("SHOW_GAME_COMPLETE_SCREEN", {
|
|
@@ -469,10 +473,10 @@ const T = (r = {}) => {
|
|
|
469
473
|
},
|
|
470
474
|
hitCheckpoint: (e, t, n) => {
|
|
471
475
|
var r;
|
|
472
|
-
if (!l()) return;
|
|
476
|
+
if (!l()) return S("hitCheckpoint");
|
|
473
477
|
let i = (r = p()) == null ? "" : r, a = {
|
|
474
|
-
elapsedTimeSecs:
|
|
475
|
-
additionalTimeAddedSecs:
|
|
478
|
+
elapsedTimeSecs: N.timeWithoutPenaltySecs(),
|
|
479
|
+
additionalTimeAddedSecs: N.addedTimeSecs()
|
|
476
480
|
};
|
|
477
481
|
w.sendMessage("HIT_CHECKPOINT", {
|
|
478
482
|
checkpointName: e,
|
|
@@ -484,16 +488,66 @@ const T = (r = {}) => {
|
|
|
484
488
|
augConfig: n == null ? {} : n
|
|
485
489
|
});
|
|
486
490
|
},
|
|
491
|
+
completeRepeatableRun: (e, n) => {
|
|
492
|
+
var r, i;
|
|
493
|
+
let a = N.timeWithoutPenaltySecs(), o = a >= g ? a - g : a;
|
|
494
|
+
g = a;
|
|
495
|
+
let s = Math.round((r = e == null ? void 0 : e.elapsedTimeSecs) == null ? o : r), c = [...((i = n == null ? void 0 : n.deeds) == null ? [] : i).filter((e) => e.id !== "time"), {
|
|
496
|
+
id: "time",
|
|
497
|
+
value: s
|
|
498
|
+
}], l = e == null ? void 0 : e.puzzleKey;
|
|
499
|
+
w.sendMessage("COMPLETE_REPEATABLE_RUN", { input: t({
|
|
500
|
+
deedValues: c,
|
|
501
|
+
elapsedTimeSecs: s
|
|
502
|
+
}, l ? { puzzleKey: l } : {}) }), M("COMPLETE_REPEATABLE_RUN", { elapsedTimeSecs: s });
|
|
503
|
+
},
|
|
504
|
+
requestPuzzle: (e) => new Promise((t, n) => {
|
|
505
|
+
let r = `puzzle-${++H}`, i = setTimeout(() => {
|
|
506
|
+
V.delete(r) && n(/* @__PURE__ */ Error(`Timeout waiting for PUZZLE_DATA after ${T}ms`));
|
|
507
|
+
}, T), a = (e) => (t) => {
|
|
508
|
+
clearTimeout(i), e(t);
|
|
509
|
+
};
|
|
510
|
+
V.set(r, {
|
|
511
|
+
resolve: a(t),
|
|
512
|
+
reject: a(n)
|
|
513
|
+
}), w.sendMessage("REQUEST_PUZZLE", {
|
|
514
|
+
nonce: r,
|
|
515
|
+
buckets: e != null && e.buckets ? [...e.buckets] : void 0,
|
|
516
|
+
exclude: e != null && e.exclude ? [...e.exclude] : void 0
|
|
517
|
+
});
|
|
518
|
+
}),
|
|
519
|
+
storage: {
|
|
520
|
+
get: () => {
|
|
521
|
+
if (h) return h;
|
|
522
|
+
let e = a == null ? void 0 : a.viewerStorage;
|
|
523
|
+
return e && e.state != null ? {
|
|
524
|
+
state: e.state,
|
|
525
|
+
stateVersion: e.stateVersion
|
|
526
|
+
} : null;
|
|
527
|
+
},
|
|
528
|
+
set: (e, t = 1) => {
|
|
529
|
+
let n = new TextEncoder().encode(e).length;
|
|
530
|
+
if (n > O) throw Error(`[sdk.storage] State is ${n} bytes, over the ${O} byte cap`);
|
|
531
|
+
if (!Number.isInteger(t) || t < 1) throw Error("[sdk.storage] stateVersion must be a positive integer");
|
|
532
|
+
a && !a.repeatable && !_ && (_ = !0, console.warn("[sdk.storage] Only repeat play saves storage for now; this write lasts until the page reloads")), h = {
|
|
533
|
+
state: e,
|
|
534
|
+
stateVersion: t
|
|
535
|
+
}, w.sendMessage("UPDATE_GAME_USER_STATE", {
|
|
536
|
+
state: e,
|
|
537
|
+
stateVersion: t
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
},
|
|
487
541
|
settings: {
|
|
488
|
-
initialize: (e) => (
|
|
542
|
+
initialize: (e) => (k = t(t({}, D(e)), k), w.sendMessage("INITIALIZE_SETTINGS", {
|
|
489
543
|
components: e,
|
|
490
|
-
settings:
|
|
491
|
-
}),
|
|
544
|
+
settings: k
|
|
545
|
+
}), k),
|
|
492
546
|
get: () => {
|
|
493
547
|
var e;
|
|
494
|
-
return (e =
|
|
548
|
+
return (e = k) == null ? {} : e;
|
|
495
549
|
},
|
|
496
|
-
update: (e) => (
|
|
550
|
+
update: (e) => (k = t(t({}, k), e), w.sendMessage("UPDATE_SETTINGS_FROM_EMBED", { settings: k }), k)
|
|
497
551
|
},
|
|
498
552
|
keyboard: {
|
|
499
553
|
show: (e) => {
|
|
@@ -522,11 +576,13 @@ const T = (r = {}) => {
|
|
|
522
576
|
};
|
|
523
577
|
};
|
|
524
578
|
/** Walks settings UI components (recursing into split groups) collecting name → defaultValue pairs */
|
|
525
|
-
function
|
|
579
|
+
function D(e) {
|
|
526
580
|
let t = {};
|
|
527
|
-
for (let n of e) n.type === "split" ? Object.assign(t,
|
|
581
|
+
for (let n of e) n.type === "split" ? Object.assign(t, D(n.content)) : "name" in n && (t[n.name] = n.defaultValue);
|
|
528
582
|
return t;
|
|
529
583
|
}
|
|
584
|
+
/** The largest state `sdk.storage.set()` takes, matching the API's cap */
|
|
585
|
+
var O = 64 * 1024;
|
|
530
586
|
/**
|
|
531
587
|
* A standard QWERTY layout with Enter and Backspace — a reasonable default for
|
|
532
588
|
* any game that needs text input. Customize from here by spreading and overriding.
|
|
@@ -539,7 +595,7 @@ function E(e) {
|
|
|
539
595
|
* // Extend with dynamic disabled letters
|
|
540
596
|
* sdk.keyboard.show({ ...defaultKeyboardConfig, disabled: usedLetters })
|
|
541
597
|
*/
|
|
542
|
-
const
|
|
598
|
+
const k = {
|
|
543
599
|
layout: [
|
|
544
600
|
"qwertyuiop",
|
|
545
601
|
"asdfghjkl",
|
|
@@ -555,7 +611,7 @@ const D = {
|
|
|
555
611
|
xl: [],
|
|
556
612
|
l: ["↵", "⌫"],
|
|
557
613
|
supportsDragCursor: !1
|
|
558
|
-
},
|
|
614
|
+
}, A = (e) => {
|
|
559
615
|
let n = {};
|
|
560
616
|
for (let a of e) for (let e of a.keys) {
|
|
561
617
|
var r, i;
|
|
@@ -565,11 +621,11 @@ const D = {
|
|
|
565
621
|
return n;
|
|
566
622
|
};
|
|
567
623
|
/** Custom error class for workshop import failures */
|
|
568
|
-
var
|
|
624
|
+
var j = class extends Error {
|
|
569
625
|
constructor(e, t, n) {
|
|
570
626
|
super(t), this.type = e, this.originalError = n, this.name = "EditorImportError";
|
|
571
627
|
}
|
|
572
628
|
};
|
|
573
|
-
export {
|
|
629
|
+
export { j as EditorImportError, E as createPuzzmoSDK, k as defaultKeyboardConfig, A as keyStylesFromRules };
|
|
574
630
|
|
|
575
631
|
//# sourceMappingURL=index.js.map
|