@rohal12/spindle 0.64.0 → 0.64.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/README.md +1 -1
- package/dist/pkg/format.js +1 -1
- package/dist/pkg/headless.js +155 -315
- package/dist/pkg/play-worker.js +4 -8
- package/dist/pkg/play.js +4 -8
- package/dist/pkg/story-variables.js +268 -352
- package/package.json +4 -4
- package/src/completion-context.ts +0 -1
- package/src/components/macros/PassageDisplay.tsx +1 -1
- package/src/components/macros/WidgetInvocation.tsx +1 -1
- package/src/components/macros/arg-utils.ts +5 -0
- package/src/index.tsx +1 -5
- package/src/js-bindings.ts +2 -1
- package/src/story-variables.ts +2 -3
package/dist/pkg/headless.js
CHANGED
|
@@ -9,7 +9,7 @@ import { Fragment as Fragment$1, jsx, jsxs } from "preact/jsx-runtime";
|
|
|
9
9
|
import { micromark } from "micromark";
|
|
10
10
|
import { gfmTable, gfmTableHtml } from "micromark-extension-gfm-table";
|
|
11
11
|
import { gfmStrikethrough, gfmStrikethroughHtml } from "micromark-extension-gfm-strikethrough";
|
|
12
|
-
|
|
12
|
+
// src/preact-store.ts
|
|
13
13
|
/**
|
|
14
14
|
* Zustand's `create()` for Preact.
|
|
15
15
|
*
|
|
@@ -31,8 +31,7 @@ function bindPreact(api) {
|
|
|
31
31
|
function create() {
|
|
32
32
|
return (initializer) => bindPreact(createStore()(initializer));
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
//#region src/utils/uuid.ts
|
|
34
|
+
// src/utils/uuid.ts
|
|
36
35
|
/**
|
|
37
36
|
* A random UUID (v4). `crypto.randomUUID` exists only in secure contexts, so
|
|
38
37
|
* on a plain HTTP origin the ID is built from `crypto.getRandomValues`.
|
|
@@ -51,8 +50,7 @@ function randomUUID() {
|
|
|
51
50
|
hex.slice(10).join("")
|
|
52
51
|
].join("-");
|
|
53
52
|
}
|
|
54
|
-
|
|
55
|
-
//#region src/utils/element-visibility.ts
|
|
53
|
+
// src/utils/element-visibility.ts
|
|
56
54
|
/** The parent in the rendered tree, including slots and shadow hosts. */
|
|
57
55
|
function composedParent(el) {
|
|
58
56
|
return el.assignedSlot ?? el.parentElement ?? el.getRootNode().host ?? null;
|
|
@@ -132,8 +130,7 @@ function isReaderVisible(el) {
|
|
|
132
130
|
for (let at = el; at; at = composedParent(at)) if (isHidden(at) || at.hasAttribute("inert")) return false;
|
|
133
131
|
return true;
|
|
134
132
|
}
|
|
135
|
-
|
|
136
|
-
//#region src/prng.ts
|
|
133
|
+
// src/prng.ts
|
|
137
134
|
/**
|
|
138
135
|
* Seedable PRNG for Spindle — Mulberry32 algorithm.
|
|
139
136
|
*
|
|
@@ -276,8 +273,7 @@ function getPRNGSeed() {
|
|
|
276
273
|
function getPRNGPull() {
|
|
277
274
|
return currentPull;
|
|
278
275
|
}
|
|
279
|
-
|
|
280
|
-
//#region node_modules/acorn/dist/acorn.mjs
|
|
276
|
+
// node_modules/acorn/dist/acorn.mjs
|
|
281
277
|
var astralIdentifierCodes = [
|
|
282
278
|
509,
|
|
283
279
|
0,
|
|
@@ -5477,8 +5473,7 @@ Parser.acorn = {
|
|
|
5477
5473
|
function parse$1(input, options) {
|
|
5478
5474
|
return Parser.parse(input, options);
|
|
5479
5475
|
}
|
|
5480
|
-
|
|
5481
|
-
//#region src/js-lexer.ts
|
|
5476
|
+
// src/js-lexer.ts
|
|
5482
5477
|
/** Code runs through `new Function`: a non-strict script body. */
|
|
5483
5478
|
var OPTIONS = {
|
|
5484
5479
|
ecmaVersion: "latest",
|
|
@@ -6397,8 +6392,7 @@ function scanStringLiteral(src, start) {
|
|
|
6397
6392
|
closed: false
|
|
6398
6393
|
};
|
|
6399
6394
|
}
|
|
6400
|
-
|
|
6401
|
-
//#region src/utils/namespace.ts
|
|
6395
|
+
// src/utils/namespace.ts
|
|
6402
6396
|
/** The variable name no namespace can hold. */
|
|
6403
6397
|
var RESERVED_NAME = "__proto__";
|
|
6404
6398
|
/**
|
|
@@ -6487,8 +6481,7 @@ function createCounts(source, name) {
|
|
|
6487
6481
|
if (name !== void 0) counts[name] = countOf(source, name) + 1;
|
|
6488
6482
|
return counts;
|
|
6489
6483
|
}
|
|
6490
|
-
|
|
6491
|
-
//#region src/transform.ts
|
|
6484
|
+
// src/transform.ts
|
|
6492
6485
|
/**
|
|
6493
6486
|
* The sigil transform: the story's code with its variable references
|
|
6494
6487
|
* (`$var`, `_var`, `@var`, `%var`) turned into the namespace lookups the
|
|
@@ -6553,8 +6546,7 @@ function transform(expr, goal = "expression") {
|
|
|
6553
6546
|
}
|
|
6554
6547
|
/** Transformed code by goal and source. */
|
|
6555
6548
|
var transformCache = /* @__PURE__ */ new Map();
|
|
6556
|
-
|
|
6557
|
-
//#region src/expression.ts
|
|
6549
|
+
// src/expression.ts
|
|
6558
6550
|
var FN_CACHE_MAX = 500;
|
|
6559
6551
|
var fnCache = /* @__PURE__ */ new Map();
|
|
6560
6552
|
var preamble = `const {currentPassage,previousPassage,visited,hasVisited,hasVisitedAny,hasVisitedAll,rendered,hasRendered,hasRenderedAny,hasRenderedAll,random,randomInt}=${FNS_BINDING};`;
|
|
@@ -6683,12 +6675,10 @@ function evaluateDisplay(expr, namespaces, displayOnly = false) {
|
|
|
6683
6675
|
function execute(code, ...namespaces) {
|
|
6684
6676
|
run$2(getOrCompile(code, "statements"), ...namespaces);
|
|
6685
6677
|
}
|
|
6686
|
-
|
|
6687
|
-
//#region node_modules/devalue/src/constants.js
|
|
6678
|
+
// node_modules/devalue/src/constants.js
|
|
6688
6679
|
var MAX_ARRAY_LEN = 2 ** 32 - 1;
|
|
6689
6680
|
var MAX_ARRAY_INDEX = MAX_ARRAY_LEN - 1;
|
|
6690
|
-
|
|
6691
|
-
//#region node_modules/devalue/src/utils.js
|
|
6681
|
+
// node_modules/devalue/src/utils.js
|
|
6692
6682
|
var DevalueError = class extends Error {
|
|
6693
6683
|
/**
|
|
6694
6684
|
* @param {string} message
|
|
@@ -6742,47 +6732,22 @@ function get_type(thing) {
|
|
|
6742
6732
|
function is_buffer(thing) {
|
|
6743
6733
|
return typeof Buffer !== "undefined" && Buffer.isBuffer(thing);
|
|
6744
6734
|
}
|
|
6735
|
+
var needs_escape = /["<\\\u0000-\u001f\u2028\u2029]/;
|
|
6736
|
+
var json_leaves_raw = /[<\u2028\u2029]/g;
|
|
6737
|
+
/** @type {Record<string, string>} */
|
|
6738
|
+
var raw_escapes = {
|
|
6739
|
+
"<": "\\u003C",
|
|
6740
|
+
"\u2028": "\\u2028",
|
|
6741
|
+
"\u2029": "\\u2029"
|
|
6742
|
+
};
|
|
6745
6743
|
/** @param {string} char */
|
|
6746
|
-
function
|
|
6747
|
-
|
|
6748
|
-
case "\"": return "\\\"";
|
|
6749
|
-
case "<": return "\\u003C";
|
|
6750
|
-
case "\\": return "\\\\";
|
|
6751
|
-
case "\n": return "\\n";
|
|
6752
|
-
case "\r": return "\\r";
|
|
6753
|
-
case " ": return "\\t";
|
|
6754
|
-
case "\b": return "\\b";
|
|
6755
|
-
case "\f": return "\\f";
|
|
6756
|
-
case "\u2028": return "\\u2028";
|
|
6757
|
-
case "\u2029": return "\\u2029";
|
|
6758
|
-
default: return char < " " ? `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}` : "";
|
|
6759
|
-
}
|
|
6744
|
+
function escape_raw(char) {
|
|
6745
|
+
return raw_escapes[char];
|
|
6760
6746
|
}
|
|
6761
|
-
var needs_escape = /["<\\\u0000-\u001f\u2028\u2029]/;
|
|
6762
6747
|
/** @param {string} str */
|
|
6763
6748
|
function stringify_string(str) {
|
|
6764
6749
|
if (!needs_escape.test(str) && str.isWellFormed()) return `"${str}"`;
|
|
6765
|
-
|
|
6766
|
-
let last_pos = 0;
|
|
6767
|
-
const len = str.length;
|
|
6768
|
-
for (let i = 0; i < len; i += 1) {
|
|
6769
|
-
const code = str.charCodeAt(i);
|
|
6770
|
-
if (code >= 55296 && code <= 57343) {
|
|
6771
|
-
if (code <= 56319 && i + 1 < len && (str.charCodeAt(i + 1) & 64512) === 56320) {
|
|
6772
|
-
i += 1;
|
|
6773
|
-
continue;
|
|
6774
|
-
}
|
|
6775
|
-
result += str.slice(last_pos, i) + `\\u${code.toString(16)}`;
|
|
6776
|
-
last_pos = i + 1;
|
|
6777
|
-
continue;
|
|
6778
|
-
}
|
|
6779
|
-
const replacement = get_escaped_char(str[i]);
|
|
6780
|
-
if (replacement) {
|
|
6781
|
-
result += str.slice(last_pos, i) + replacement;
|
|
6782
|
-
last_pos = i + 1;
|
|
6783
|
-
}
|
|
6784
|
-
}
|
|
6785
|
-
return `"${last_pos === 0 ? str : result + str.slice(last_pos)}"`;
|
|
6750
|
+
return JSON.stringify(str).replace(json_leaves_raw, escape_raw);
|
|
6786
6751
|
}
|
|
6787
6752
|
var MAX_CACHED_KEY_LENGTH = 64;
|
|
6788
6753
|
/** @type {Map<string, string>} */
|
|
@@ -6849,8 +6814,7 @@ function valid_array_indices(array) {
|
|
|
6849
6814
|
keys.length = array_index_cut(keys);
|
|
6850
6815
|
return keys;
|
|
6851
6816
|
}
|
|
6852
|
-
|
|
6853
|
-
//#region node_modules/devalue/src/base64.js
|
|
6817
|
+
// node_modules/devalue/src/base64.js
|
|
6854
6818
|
/** @type {(array_buffer: ArrayBuffer) => string} */
|
|
6855
6819
|
function encode_native(array_buffer) {
|
|
6856
6820
|
return new Uint8Array(array_buffer).toBase64();
|
|
@@ -6890,8 +6854,7 @@ var native = typeof Uint8Array.fromBase64 === "function";
|
|
|
6890
6854
|
var buffer = typeof process === "object" && process.versions?.node !== void 0;
|
|
6891
6855
|
var encode64 = native ? encode_native : buffer ? encode_buffer : encode_legacy;
|
|
6892
6856
|
var decode64 = native ? decode_native : buffer ? decode_buffer : decode_legacy;
|
|
6893
|
-
|
|
6894
|
-
//#region node_modules/devalue/src/operations.js
|
|
6857
|
+
// node_modules/devalue/src/operations.js
|
|
6895
6858
|
/**
|
|
6896
6859
|
* Merges caller-provided operation overrides over the defaults. Iterating the
|
|
6897
6860
|
* default keys (rather than the override's own keys) means nullish members
|
|
@@ -6999,8 +6962,7 @@ var default_parse_operations = /* @__PURE__ */ Object.freeze({
|
|
|
6999
6962
|
map.set(key, value);
|
|
7000
6963
|
}
|
|
7001
6964
|
});
|
|
7002
|
-
|
|
7003
|
-
//#region node_modules/devalue/src/parse.js
|
|
6965
|
+
// node_modules/devalue/src/parse.js
|
|
7004
6966
|
function invalid$1() {
|
|
7005
6967
|
throw new Error("Invalid input");
|
|
7006
6968
|
}
|
|
@@ -7181,8 +7143,7 @@ function unflatten(parsed, revivers, options) {
|
|
|
7181
7143
|
}
|
|
7182
7144
|
return hydrate(0);
|
|
7183
7145
|
}
|
|
7184
|
-
|
|
7185
|
-
//#region node_modules/devalue/src/stringify.js
|
|
7146
|
+
// node_modules/devalue/src/stringify.js
|
|
7186
7147
|
/**
|
|
7187
7148
|
* Turn a value into a JSON string that can be parsed with `devalue.parse`
|
|
7188
7149
|
* @param {any} value
|
|
@@ -7422,8 +7383,7 @@ function stringify_primitive(thing) {
|
|
|
7422
7383
|
if (type === "bigint") return `["BigInt","${thing}"]`;
|
|
7423
7384
|
return String(thing);
|
|
7424
7385
|
}
|
|
7425
|
-
|
|
7426
|
-
//#region src/utils/value-kinds.ts
|
|
7386
|
+
// src/utils/value-kinds.ts
|
|
7427
7387
|
var toStringTag = (value) => Object.prototype.toString.call(value).slice(8, -1);
|
|
7428
7388
|
/** Temporal values are immutable: copies may share them. */
|
|
7429
7389
|
var isTemporal = (value) => toStringTag(value).startsWith("Temporal.");
|
|
@@ -7509,8 +7469,7 @@ function mapSet(map, key, value) {
|
|
|
7509
7469
|
if (isDraft(map)) map.set(key, value);
|
|
7510
7470
|
else Map.prototype.set.call(map, key, value);
|
|
7511
7471
|
}
|
|
7512
|
-
|
|
7513
|
-
//#region src/class-registry.ts
|
|
7472
|
+
// src/class-registry.ts
|
|
7514
7473
|
var registry$1 = /* @__PURE__ */ new Map();
|
|
7515
7474
|
var ctorToName = /* @__PURE__ */ new Map();
|
|
7516
7475
|
/**
|
|
@@ -7891,8 +7850,7 @@ function serialize(value) {
|
|
|
7891
7850
|
function deserialize(text) {
|
|
7892
7851
|
return parse(text, revivers);
|
|
7893
7852
|
}
|
|
7894
|
-
|
|
7895
|
-
//#region src/utils/object-path.ts
|
|
7853
|
+
// src/utils/object-path.ts
|
|
7896
7854
|
/**
|
|
7897
7855
|
* Traverse dot-path segments on an object and return the nested value.
|
|
7898
7856
|
* Members of Object.prototype (`constructor`, `toString`, `__proto__`, ...)
|
|
@@ -8029,8 +7987,7 @@ function walkToParent(root, segments, createMissing) {
|
|
|
8029
7987
|
checkHolder(current, segments[segments.length - 1], segments, segments.length - 1, !copyOnWrite);
|
|
8030
7988
|
return current;
|
|
8031
7989
|
}
|
|
8032
|
-
|
|
8033
|
-
//#region src/structural.ts
|
|
7990
|
+
// src/structural.ts
|
|
8034
7991
|
function isPlainObject(value) {
|
|
8035
7992
|
if (typeof value !== "object" || value === null) return false;
|
|
8036
7993
|
const proto = Object.getPrototypeOf(value);
|
|
@@ -8788,8 +8745,7 @@ function applyChange(target, change) {
|
|
|
8788
8745
|
if (change.deleted) deleteByPath(root, change.path);
|
|
8789
8746
|
else setByPath(root, change.path, change.value);
|
|
8790
8747
|
}
|
|
8791
|
-
|
|
8792
|
-
//#region src/execute-mutation.ts
|
|
8748
|
+
// src/execute-mutation.ts
|
|
8793
8749
|
var NAMESPACES$1 = [
|
|
8794
8750
|
"variables",
|
|
8795
8751
|
"temporary",
|
|
@@ -9263,8 +9219,7 @@ function executeMutation(code, mergedLocals, scopeUpdate) {
|
|
|
9263
9219
|
for (const key of Object.keys(localsClone)) if (changed.has(key)) scopeUpdate(key, localsClone[key]);
|
|
9264
9220
|
for (const key of Object.keys(mergedLocals)) if (!hasOwn(localsClone, key)) scopeUpdate(key, void 0);
|
|
9265
9221
|
}
|
|
9266
|
-
|
|
9267
|
-
//#region src/event-emitter.ts
|
|
9222
|
+
// src/event-emitter.ts
|
|
9268
9223
|
var VALID_EVENTS = /* @__PURE__ */ new Set([
|
|
9269
9224
|
"storyinit",
|
|
9270
9225
|
"beforerestart",
|
|
@@ -9315,8 +9270,7 @@ function emitFromRender(event, ...args) {
|
|
|
9315
9270
|
}
|
|
9316
9271
|
});
|
|
9317
9272
|
}
|
|
9318
|
-
|
|
9319
|
-
//#region src/utils/field-checks.ts
|
|
9273
|
+
// src/utils/field-checks.ts
|
|
9320
9274
|
function isRecord$2(value) {
|
|
9321
9275
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9322
9276
|
}
|
|
@@ -9332,8 +9286,7 @@ var isBoolean = (v) => typeof v === "boolean";
|
|
|
9332
9286
|
function checkFields(obj, what, checks, fail) {
|
|
9333
9287
|
for (const [key, [valid, expected]] of Object.entries(checks)) if (key in obj && !valid(obj[key])) fail(`"${key}" of ${what} must be ${expected}`);
|
|
9334
9288
|
}
|
|
9335
|
-
|
|
9336
|
-
//#region src/action-registry.ts
|
|
9289
|
+
// src/action-registry.ts
|
|
9337
9290
|
/** The fields of a StoryAction that are left out when unset. */
|
|
9338
9291
|
var OPTIONAL_ACTION_FIELDS = [
|
|
9339
9292
|
"target",
|
|
@@ -9519,8 +9472,7 @@ function resetIdCounters() {
|
|
|
9519
9472
|
function notify() {
|
|
9520
9473
|
emit("actionsChanged");
|
|
9521
9474
|
}
|
|
9522
|
-
|
|
9523
|
-
//#region src/components/dialog-close-context.ts
|
|
9475
|
+
// src/components/dialog-close-context.ts
|
|
9524
9476
|
/**
|
|
9525
9477
|
* The function that closes the dialog the content renders in, or null
|
|
9526
9478
|
* outside any dialog. Each PassageDialog provides its own stable one, so it
|
|
@@ -9531,8 +9483,7 @@ function notify() {
|
|
|
9531
9483
|
var DialogCloseContext = createContext(null);
|
|
9532
9484
|
/** The dialog's own panel, for associating actions with its live controls. */
|
|
9533
9485
|
var DialogPanelContext = createContext(null);
|
|
9534
|
-
|
|
9535
|
-
//#region src/hooks/use-action.ts
|
|
9486
|
+
// src/hooks/use-action.ts
|
|
9536
9487
|
/** Register a built-in control with its own stable DOM association. */
|
|
9537
9488
|
function useControlAction(opts) {
|
|
9538
9489
|
const element = useRef(null);
|
|
@@ -9619,8 +9570,7 @@ function useAction(opts) {
|
|
|
9619
9570
|
]);
|
|
9620
9571
|
return disabled ? "" : id;
|
|
9621
9572
|
}
|
|
9622
|
-
|
|
9623
|
-
//#region src/markup/tokens.ts
|
|
9573
|
+
// src/markup/tokens.ts
|
|
9624
9574
|
/** Variable sigils: story ($), temporary (_), local (@), transient (%). */
|
|
9625
9575
|
var SIGIL_SCOPES$1 = {
|
|
9626
9576
|
$: "variable",
|
|
@@ -9641,8 +9591,7 @@ function withSelectors$1(target, from) {
|
|
|
9641
9591
|
if (from.id) target.id = from.id;
|
|
9642
9592
|
return target;
|
|
9643
9593
|
}
|
|
9644
|
-
|
|
9645
|
-
//#region src/markup/grammar-shared.ts
|
|
9594
|
+
// src/markup/grammar-shared.ts
|
|
9646
9595
|
/**
|
|
9647
9596
|
* What the grammar (spindle.peggy) imports from the rest of Spindle, so that
|
|
9648
9597
|
* it holds no second copy: the generated parser imports this module's
|
|
@@ -9652,8 +9601,7 @@ var grammar_shared_default = {
|
|
|
9652
9601
|
SIGIL_SCOPES: SIGIL_SCOPES$1,
|
|
9653
9602
|
withSelectors: withSelectors$1
|
|
9654
9603
|
};
|
|
9655
|
-
|
|
9656
|
-
//#region src/markup/spindle.peggy
|
|
9604
|
+
// src/markup/spindle.peggy
|
|
9657
9605
|
var LB = String.fromCharCode(123);
|
|
9658
9606
|
var RB = String.fromCharCode(125);
|
|
9659
9607
|
var { SIGIL_SCOPES, withSelectors } = grammar_shared_default;
|
|
@@ -13201,8 +13149,7 @@ function peg$parse(input, options) {
|
|
|
13201
13149
|
if (peg$success) return peg$result;
|
|
13202
13150
|
else peg$throw();
|
|
13203
13151
|
}
|
|
13204
|
-
|
|
13205
|
-
//#region src/utils/macro-names.ts
|
|
13152
|
+
// src/utils/macro-names.ts
|
|
13206
13153
|
/**
|
|
13207
13154
|
* Macro and widget names are case-insensitive: `{StatusBar}` invokes the
|
|
13208
13155
|
* widget defined as `statusbar`. A NameMap keys its entries by the lowercased
|
|
@@ -13247,8 +13194,7 @@ var NameSet = class {
|
|
|
13247
13194
|
this.names.clear();
|
|
13248
13195
|
}
|
|
13249
13196
|
};
|
|
13250
|
-
|
|
13251
|
-
//#region src/components/macros/option-clauses.ts
|
|
13197
|
+
// src/components/macros/option-clauses.ts
|
|
13252
13198
|
/** The direct value clauses read by the built-in choice controls. */
|
|
13253
13199
|
var OPTION_CLAUSE = "option";
|
|
13254
13200
|
function isOptionClause(name) {
|
|
@@ -13259,8 +13205,7 @@ function consumesOptionClauses(macro) {
|
|
|
13259
13205
|
const name = macro.name.toLowerCase();
|
|
13260
13206
|
return macro.source === "builtin" && !macro.widget && (name === "listbox" || name === "cycle");
|
|
13261
13207
|
}
|
|
13262
|
-
|
|
13263
|
-
//#region src/registry.ts
|
|
13208
|
+
// src/registry.ts
|
|
13264
13209
|
var registry = new NameMap();
|
|
13265
13210
|
function registerMacro(name, component) {
|
|
13266
13211
|
registry.set(name, component);
|
|
@@ -13400,8 +13345,7 @@ getMacroParameters.source = (name) => metadataRegistry.get(name)?.source;
|
|
|
13400
13345
|
function getMacroRegistry() {
|
|
13401
13346
|
return Array.from(metadataRegistry.values());
|
|
13402
13347
|
}
|
|
13403
|
-
|
|
13404
|
-
//#region src/markup/ast.ts
|
|
13348
|
+
// src/markup/ast.ts
|
|
13405
13349
|
/**
|
|
13406
13350
|
* The passage AST (built by parse.ts), and the registry of block macros:
|
|
13407
13351
|
* those whose body the parser nests up to their `{/name}`.
|
|
@@ -13537,8 +13481,7 @@ function astNode({ token, body }) {
|
|
|
13537
13481
|
}
|
|
13538
13482
|
}
|
|
13539
13483
|
}
|
|
13540
|
-
|
|
13541
|
-
//#region src/utils/sorted.ts
|
|
13484
|
+
// src/utils/sorted.ts
|
|
13542
13485
|
/** Index of the first sorted value greater than `value` (or the length). */
|
|
13543
13486
|
function upperBound(sorted, value) {
|
|
13544
13487
|
let low = 0;
|
|
@@ -13550,8 +13493,7 @@ function upperBound(sorted, value) {
|
|
|
13550
13493
|
}
|
|
13551
13494
|
return low;
|
|
13552
13495
|
}
|
|
13553
|
-
|
|
13554
|
-
//#region src/markup/line-column.ts
|
|
13496
|
+
// src/markup/line-column.ts
|
|
13555
13497
|
/** 1-based line and column of `offset` in `text`. */
|
|
13556
13498
|
function lineColumn(text, offset) {
|
|
13557
13499
|
let line = 1;
|
|
@@ -13578,8 +13520,7 @@ function sourcePositions(text) {
|
|
|
13578
13520
|
};
|
|
13579
13521
|
};
|
|
13580
13522
|
}
|
|
13581
|
-
|
|
13582
|
-
//#region src/markup/pair.ts
|
|
13523
|
+
// src/markup/pair.ts
|
|
13583
13524
|
/**
|
|
13584
13525
|
* Pairing: which closer closes which opener among the flat tokens of markup
|
|
13585
13526
|
* (parse.ts tokenizeMarkup), and which branch (`{else}`, `{case}`) belongs to
|
|
@@ -13771,8 +13712,7 @@ function lastEnd(body) {
|
|
|
13771
13712
|
const branch = last(body.branches);
|
|
13772
13713
|
return last(branch?.children ?? body.children)?.end ?? branch?.tag.end;
|
|
13773
13714
|
}
|
|
13774
|
-
|
|
13775
|
-
//#region src/markup/code-end.ts
|
|
13715
|
+
// src/markup/code-end.ts
|
|
13776
13716
|
/**
|
|
13777
13717
|
* A quote directly after a letter/digit is an apostrophe (don't), not a
|
|
13778
13718
|
* string; after a backslash it is an escaped attribute delimiter (\").
|
|
@@ -13942,8 +13882,7 @@ function indexCodeEnds(input) {
|
|
|
13942
13882
|
return end < 0 ? -1 : base + end;
|
|
13943
13883
|
};
|
|
13944
13884
|
}
|
|
13945
|
-
|
|
13946
|
-
//#region src/markup/code-attributes.ts
|
|
13885
|
+
// src/markup/code-attributes.ts
|
|
13947
13886
|
/**
|
|
13948
13887
|
* Attributes whose value is code with braces of its own, not text: event
|
|
13949
13888
|
* handlers (`on…`, JavaScript), `pattern` (a regular expression, as in
|
|
@@ -13995,8 +13934,7 @@ function splitSigilTemplate(template, incomplete = false) {
|
|
|
13995
13934
|
if (text) parts.push({ text });
|
|
13996
13935
|
return parts;
|
|
13997
13936
|
}
|
|
13998
|
-
|
|
13999
|
-
//#region src/markup/parse.ts
|
|
13937
|
+
// src/markup/parse.ts
|
|
14000
13938
|
/**
|
|
14001
13939
|
* Passage markup parser: the Peggy grammar (spindle.peggy) with Spindle's
|
|
14002
13940
|
* hooks plugged in. It builds the AST directly and reports malformed markup
|
|
@@ -14209,8 +14147,7 @@ function mapOffsets(token, map) {
|
|
|
14209
14147
|
function shiftOffsets(token, by) {
|
|
14210
14148
|
return by === 0 ? token : mapOffsets(token, (offset) => offset + by);
|
|
14211
14149
|
}
|
|
14212
|
-
|
|
14213
|
-
//#region src/widgets/widget-registry.ts
|
|
14150
|
+
// src/widgets/widget-registry.ts
|
|
14214
14151
|
var widgets = new NameMap();
|
|
14215
14152
|
/**
|
|
14216
14153
|
* Register a widget. A widget whose body renders {@children} takes a closing
|
|
@@ -14243,8 +14180,7 @@ function widgetMacros() {
|
|
|
14243
14180
|
}
|
|
14244
14181
|
}));
|
|
14245
14182
|
}
|
|
14246
|
-
|
|
14247
|
-
//#region src/utils/parse-delay.ts
|
|
14183
|
+
// src/utils/parse-delay.ts
|
|
14248
14184
|
/**
|
|
14249
14185
|
* Parse a delay string into milliseconds.
|
|
14250
14186
|
* Supports: "2s" → 2000, "500ms" → 500, bare number → ms
|
|
@@ -14255,8 +14191,7 @@ function parseDelay(str) {
|
|
|
14255
14191
|
if (trimmed.endsWith("s")) return parseFloat(trimmed.slice(0, -1)) * 1e3;
|
|
14256
14192
|
return parseFloat(trimmed);
|
|
14257
14193
|
}
|
|
14258
|
-
|
|
14259
|
-
//#region src/utils/error-message.ts
|
|
14194
|
+
// src/utils/error-message.ts
|
|
14260
14195
|
/**
|
|
14261
14196
|
* The message to show for a caught value. Anything can be thrown, not only
|
|
14262
14197
|
* Errors: an Error gives its message, a string is its own message, and any
|
|
@@ -14273,8 +14208,7 @@ function errorMessage(err, fallback) {
|
|
|
14273
14208
|
return fallback ?? "Unprintable error";
|
|
14274
14209
|
}
|
|
14275
14210
|
}
|
|
14276
|
-
|
|
14277
|
-
//#region src/utils/listeners.ts
|
|
14211
|
+
// src/utils/listeners.ts
|
|
14278
14212
|
/**
|
|
14279
14213
|
* A set of listeners to call when something happens: `subscribe` adds one and
|
|
14280
14214
|
* returns the function that removes it, `notify` calls each one. A listener
|
|
@@ -14295,8 +14229,7 @@ function createListeners() {
|
|
|
14295
14229
|
}
|
|
14296
14230
|
};
|
|
14297
14231
|
}
|
|
14298
|
-
|
|
14299
|
-
//#region src/runtime-errors.ts
|
|
14232
|
+
// src/runtime-errors.ts
|
|
14300
14233
|
var errors = [];
|
|
14301
14234
|
var nextId = 1;
|
|
14302
14235
|
var listeners$1 = createListeners();
|
|
@@ -14343,8 +14276,7 @@ function getRuntimeErrors() {
|
|
|
14343
14276
|
}
|
|
14344
14277
|
/** Call `listener` whenever the shown errors change; returns unsubscribe. */
|
|
14345
14278
|
var subscribeRuntimeErrors = listeners$1.subscribe;
|
|
14346
|
-
|
|
14347
|
-
//#region src/components/macros/arg-utils.ts
|
|
14279
|
+
// src/components/macros/arg-utils.ts
|
|
14348
14280
|
/**
|
|
14349
14281
|
* Shared helpers for macros that split or read their raw argument text by
|
|
14350
14282
|
* hand. Their lexical model is the expression lexer's (`js-lexer.ts`):
|
|
@@ -14533,8 +14465,11 @@ function splitArgSpans(raw) {
|
|
|
14533
14465
|
function splitArgs(raw) {
|
|
14534
14466
|
return splitArgSpans(raw).map(([a, b]) => raw.slice(a, b));
|
|
14535
14467
|
}
|
|
14536
|
-
|
|
14537
|
-
|
|
14468
|
+
/** `text` as a regular expression source that matches it literally. */
|
|
14469
|
+
function escapeRegExp(text) {
|
|
14470
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
14471
|
+
}
|
|
14472
|
+
// src/components/macros/macro-args.ts
|
|
14538
14473
|
/**
|
|
14539
14474
|
* The macro argument layer: reads a macro's raw argument text into the
|
|
14540
14475
|
* parameters its definition declares (see ParameterDef), so every macro
|
|
@@ -14892,8 +14827,7 @@ function parseBoundVariable(rawArgs) {
|
|
|
14892
14827
|
nameEnd: offsets[nameEnd - 1] === void 0 ? lead : offsets[nameEnd - 1] + 1
|
|
14893
14828
|
};
|
|
14894
14829
|
}
|
|
14895
|
-
|
|
14896
|
-
//#region src/components/macros/option-utils.ts
|
|
14830
|
+
// src/components/macros/option-utils.ts
|
|
14897
14831
|
/** `$var "placeholder"`, the arguments of the input macros. */
|
|
14898
14832
|
function parseVarArgs(rawArgs) {
|
|
14899
14833
|
const { variable = "", placeholder = "" } = parseMacroArgs(rawArgs, [{
|
|
@@ -14932,8 +14866,7 @@ function extractOptions(children) {
|
|
|
14932
14866
|
}
|
|
14933
14867
|
return options;
|
|
14934
14868
|
}
|
|
14935
|
-
|
|
14936
|
-
//#region src/markup/expansion-budget.ts
|
|
14869
|
+
// src/markup/expansion-budget.ts
|
|
14937
14870
|
/** Shared bounds for reparsing markup inside labels, selectors and attributes. */
|
|
14938
14871
|
var MarkupExpansionBudget = class MarkupExpansionBudget {
|
|
14939
14872
|
static {
|
|
@@ -14953,8 +14886,7 @@ var MarkupExpansionBudget = class MarkupExpansionBudget {
|
|
|
14953
14886
|
this.depth--;
|
|
14954
14887
|
}
|
|
14955
14888
|
};
|
|
14956
|
-
|
|
14957
|
-
//#region src/code-check.ts
|
|
14889
|
+
// src/code-check.ts
|
|
14958
14890
|
/** While a pass runs: the code it parsed so far, by goal and source. */
|
|
14959
14891
|
var parses = null;
|
|
14960
14892
|
/**
|
|
@@ -15543,8 +15475,7 @@ function locate(text, part, from) {
|
|
|
15543
15475
|
const anywhere = text.indexOf(part);
|
|
15544
15476
|
return anywhere >= 0 ? anywhere : from;
|
|
15545
15477
|
}
|
|
15546
|
-
|
|
15547
|
-
//#region src/widgets/ast-scanner.ts
|
|
15478
|
+
// src/widgets/ast-scanner.ts
|
|
15548
15479
|
/** The declared parameters of the macros registered so far. */
|
|
15549
15480
|
var registeredParameters = (name) => parameterLookup(getMacroRegistry())(name);
|
|
15550
15481
|
registeredParameters.source = getMacroParameters.source;
|
|
@@ -15617,8 +15548,7 @@ function astContainsChildren(nodes, parametersOf = registeredParameters, hooks,
|
|
|
15617
15548
|
}
|
|
15618
15549
|
return false;
|
|
15619
15550
|
}
|
|
15620
|
-
|
|
15621
|
-
//#region src/widgets/widget-def.ts
|
|
15551
|
+
// src/widgets/widget-def.ts
|
|
15622
15552
|
/**
|
|
15623
15553
|
* Reading widget definitions without rendering anything: the `{widget}`
|
|
15624
15554
|
* macro, startup and markup validation (also in tooling) share these.
|
|
@@ -15760,8 +15690,7 @@ function effectiveWidgetDefinitions(definitions) {
|
|
|
15760
15690
|
function effectiveWidgets(passages, parametersOf = registeredParameters) {
|
|
15761
15691
|
return effectiveWidgetDefinitions(widgetDefinitions(passages, parametersOf));
|
|
15762
15692
|
}
|
|
15763
|
-
|
|
15764
|
-
//#region src/widgets/register-widget-def.ts
|
|
15693
|
+
// src/widgets/register-widget-def.ts
|
|
15765
15694
|
/**
|
|
15766
15695
|
* Register the widget a definition declares, with its body. Widgets whose
|
|
15767
15696
|
* body renders {@children} take a closing tag, so they are registered as
|
|
@@ -15789,8 +15718,7 @@ function registerWidgetDefinitions(nodes, passageName) {
|
|
|
15789
15718
|
}
|
|
15790
15719
|
}
|
|
15791
15720
|
}
|
|
15792
|
-
|
|
15793
|
-
//#region src/hooks/use-story-fields.ts
|
|
15721
|
+
// src/hooks/use-story-fields.ts
|
|
15794
15722
|
/**
|
|
15795
15723
|
* Tells the components below when to keep the state they last rendered with,
|
|
15796
15724
|
* given the store's current state: an owner (a click body, see
|
|
@@ -15828,8 +15756,7 @@ function useStoryFields(...keys) {
|
|
|
15828
15756
|
return shallow(prev.current, next) ? prev.current : prev.current = next;
|
|
15829
15757
|
});
|
|
15830
15758
|
}
|
|
15831
|
-
|
|
15832
|
-
//#region src/utils/live-locals.ts
|
|
15759
|
+
// src/utils/live-locals.ts
|
|
15833
15760
|
/**
|
|
15834
15761
|
* Read-only view of a locals scope that always reflects its current values.
|
|
15835
15762
|
*
|
|
@@ -15852,8 +15779,7 @@ function liveLocalsView(getValues) {
|
|
|
15852
15779
|
}
|
|
15853
15780
|
});
|
|
15854
15781
|
}
|
|
15855
|
-
|
|
15856
|
-
//#region src/hooks/use-merged-locals.ts
|
|
15782
|
+
// src/hooks/use-merged-locals.ts
|
|
15857
15783
|
/**
|
|
15858
15784
|
* The locals in scope, read as they are when code looks (a local the
|
|
15859
15785
|
* preceding {set} assigned in this pass included, which the context value
|
|
@@ -15888,8 +15814,7 @@ function useMergedLocals() {
|
|
|
15888
15814
|
renderCounts
|
|
15889
15815
|
]);
|
|
15890
15816
|
}
|
|
15891
|
-
|
|
15892
|
-
//#region src/components/macros/display.ts
|
|
15817
|
+
// src/components/macros/display.ts
|
|
15893
15818
|
/** The text a value is shown as: nothing for null and undefined. */
|
|
15894
15819
|
function display(value) {
|
|
15895
15820
|
return value == null ? "" : String(value);
|
|
@@ -15905,8 +15830,7 @@ function wrapContent(className, id, content) {
|
|
|
15905
15830
|
}, content);
|
|
15906
15831
|
return h(Fragment, null, content);
|
|
15907
15832
|
}
|
|
15908
|
-
|
|
15909
|
-
//#region src/interpolation.ts
|
|
15833
|
+
// src/interpolation.ts
|
|
15910
15834
|
/**
|
|
15911
15835
|
* Text-only markup: HTML attribute values, image alt text and link titles,
|
|
15912
15836
|
* and macro labels resolve the inline markup of passage text (variables,
|
|
@@ -16188,8 +16112,7 @@ function interpolateCode(template, scope, decode) {
|
|
|
16188
16112
|
errors
|
|
16189
16113
|
};
|
|
16190
16114
|
}
|
|
16191
|
-
|
|
16192
|
-
//#region src/display-only.ts
|
|
16115
|
+
// src/display-only.ts
|
|
16193
16116
|
/**
|
|
16194
16117
|
* The macros that change the story, or act when they mount. A display-only
|
|
16195
16118
|
* passage may not use them (see storyContextErrors), and under
|
|
@@ -16216,8 +16139,7 @@ var DisplayOnlyContext = createContext(false);
|
|
|
16216
16139
|
function displayOnlyError(name) {
|
|
16217
16140
|
return /* @__PURE__ */ new Error(`StoryContext is display-only: {${name}} cannot change the story`);
|
|
16218
16141
|
}
|
|
16219
|
-
|
|
16220
|
-
//#region src/hooks/use-interpolate.ts
|
|
16142
|
+
// src/hooks/use-interpolate.ts
|
|
16221
16143
|
/**
|
|
16222
16144
|
* The scope text-only markup (attribute values, labels) is evaluated in:
|
|
16223
16145
|
* store variables, locals and the enclosing block widget's children. The
|
|
@@ -16257,8 +16179,7 @@ function useInterpolate() {
|
|
|
16257
16179
|
return text;
|
|
16258
16180
|
}, [scope]);
|
|
16259
16181
|
}
|
|
16260
|
-
|
|
16261
|
-
//#region src/utils/source-location.ts
|
|
16182
|
+
// src/utils/source-location.ts
|
|
16262
16183
|
/** Returns e.g. " (story.twee:5)" or "" if not available. */
|
|
16263
16184
|
function sourceLocationOf(passage) {
|
|
16264
16185
|
const file = passage.metadata["data-source-file"];
|
|
@@ -16274,8 +16195,7 @@ function currentSourceLocation() {
|
|
|
16274
16195
|
if (!passage) return "";
|
|
16275
16196
|
return sourceLocationOf(passage);
|
|
16276
16197
|
}
|
|
16277
|
-
|
|
16278
|
-
//#region src/components/macros/MacroError.tsx
|
|
16198
|
+
// src/components/macros/MacroError.tsx
|
|
16279
16199
|
function MacroError({ macro, error }) {
|
|
16280
16200
|
return /* @__PURE__ */ jsx("span", {
|
|
16281
16201
|
class: "error",
|
|
@@ -16315,8 +16235,7 @@ function useRunOnce(macro, rawArgs, effect) {
|
|
|
16315
16235
|
error: failure.current.error
|
|
16316
16236
|
});
|
|
16317
16237
|
}
|
|
16318
|
-
|
|
16319
|
-
//#region src/components/macros/VarDisplay.tsx
|
|
16238
|
+
// src/components/macros/VarDisplay.tsx
|
|
16320
16239
|
var STORE_NAMESPACES = {
|
|
16321
16240
|
variable: "variables",
|
|
16322
16241
|
temporary: "temporary",
|
|
@@ -16359,8 +16278,7 @@ function VarDisplay({ node }) {
|
|
|
16359
16278
|
}));
|
|
16360
16279
|
}
|
|
16361
16280
|
}
|
|
16362
|
-
|
|
16363
|
-
//#region src/components/macros/ExprDisplay.tsx
|
|
16281
|
+
// src/components/macros/ExprDisplay.tsx
|
|
16364
16282
|
/** An expression display: `{$hp + 1}`. */
|
|
16365
16283
|
function ExprDisplay({ node }) {
|
|
16366
16284
|
const { expression } = node;
|
|
@@ -16385,8 +16303,7 @@ function ExprDisplay({ node }) {
|
|
|
16385
16303
|
}
|
|
16386
16304
|
return wrapContent(className, id, text);
|
|
16387
16305
|
}
|
|
16388
|
-
|
|
16389
|
-
//#region src/hooks/use-render-options.ts
|
|
16306
|
+
// src/hooks/use-render-options.ts
|
|
16390
16307
|
/**
|
|
16391
16308
|
* The renderNodes() options of the enclosing content: nobr, inline and raw
|
|
16392
16309
|
* rendering and the locals in scope. A macro or widget body rendered with
|
|
@@ -16402,8 +16319,7 @@ function useRenderOptions() {
|
|
|
16402
16319
|
locals: useContext(LocalsValuesContext)
|
|
16403
16320
|
};
|
|
16404
16321
|
}
|
|
16405
|
-
|
|
16406
|
-
//#region src/components/macros/locals-scope.tsx
|
|
16322
|
+
// src/components/macros/locals-scope.tsx
|
|
16407
16323
|
/**
|
|
16408
16324
|
* Render `body` in a new locals scope: the locals of the enclosing scope,
|
|
16409
16325
|
* with `ownKeys` (an iteration's loop variables, a widget's parameters) on
|
|
@@ -16446,8 +16362,7 @@ function LocalsScope({ body, ownKeys }) {
|
|
|
16446
16362
|
})
|
|
16447
16363
|
});
|
|
16448
16364
|
}
|
|
16449
|
-
|
|
16450
|
-
//#region src/components/macros/WidgetInvocation.tsx
|
|
16365
|
+
// src/components/macros/WidgetInvocation.tsx
|
|
16451
16366
|
function WidgetInvocation(props) {
|
|
16452
16367
|
const resolve = useInterpolate();
|
|
16453
16368
|
return wrapContent(resolve(props.className), resolve(props.id), /* @__PURE__ */ jsx(WidgetContent, { ...props }));
|
|
@@ -16488,8 +16403,7 @@ function WidgetContent({ body, params, rawArgs, invocationChildren }) {
|
|
|
16488
16403
|
})
|
|
16489
16404
|
});
|
|
16490
16405
|
}
|
|
16491
|
-
|
|
16492
|
-
//#region src/markup/markdown.ts
|
|
16406
|
+
// src/markup/markdown.ts
|
|
16493
16407
|
/**
|
|
16494
16408
|
* micromark options for spindle's markdown: CommonMark with GFM tables and
|
|
16495
16409
|
* strikethrough, raw HTML passed through, and no indented code.
|
|
@@ -16659,8 +16573,7 @@ function unclosedHtml(text) {
|
|
|
16659
16573
|
}
|
|
16660
16574
|
} } };
|
|
16661
16575
|
}
|
|
16662
|
-
|
|
16663
|
-
//#region src/markup/render.tsx
|
|
16576
|
+
// src/markup/render.tsx
|
|
16664
16577
|
var defaultUpdater = {
|
|
16665
16578
|
update: (key) => {
|
|
16666
16579
|
throw new Error(`Cannot set @${key} — local variables require a {for}, widget, {link}, or {button} scope`);
|
|
@@ -17454,8 +17367,7 @@ function renderNodes(nodes, options) {
|
|
|
17454
17367
|
if (!MARKDOWN_SYNTAX_RE.test(textOnly) && !BLANK_LINE_RE.test(textOnly)) return edges(buildPlainTextVnodes(core, ph, unwrapParagraphs));
|
|
17455
17368
|
return edges(htmlToPreact(markdownToHtml(combined, { inline: options?.inline }), ph, unwrapParagraphs));
|
|
17456
17369
|
}
|
|
17457
|
-
|
|
17458
|
-
//#region src/watch-parameters.ts
|
|
17370
|
+
// src/watch-parameters.ts
|
|
17459
17371
|
/** Shared syntax for trusted story declarations and rendered watchers. */
|
|
17460
17372
|
var WATCH_PARAMETERS = [{
|
|
17461
17373
|
name: "condition",
|
|
@@ -17496,8 +17408,7 @@ var WATCH_PARAMETERS = [{
|
|
|
17496
17408
|
}
|
|
17497
17409
|
]
|
|
17498
17410
|
}];
|
|
17499
|
-
|
|
17500
|
-
//#region src/passage-render-state.ts
|
|
17411
|
+
// src/passage-render-state.ts
|
|
17501
17412
|
/** Initial render of a deferred passage subtree, until its first commit. */
|
|
17502
17413
|
var EntryRenderContext = createContext(null);
|
|
17503
17414
|
/**
|
|
@@ -17513,8 +17424,7 @@ function markPassageRendered(navigationId) {
|
|
|
17513
17424
|
function getRenderedNavigationId() {
|
|
17514
17425
|
return renderedNavigationId;
|
|
17515
17426
|
}
|
|
17516
|
-
|
|
17517
|
-
//#region src/triggers.ts
|
|
17427
|
+
// src/triggers.ts
|
|
17518
17428
|
var registrations = 0;
|
|
17519
17429
|
var triggers = [];
|
|
17520
17430
|
var checking = false;
|
|
@@ -18043,8 +17953,7 @@ function decodePayload(encoded) {
|
|
|
18043
17953
|
if (payload.renderCounts === void 0) delete payload.renderCounts;
|
|
18044
17954
|
return payload;
|
|
18045
17955
|
}
|
|
18046
|
-
|
|
18047
|
-
//#region src/saves/types.ts
|
|
17956
|
+
// src/saves/types.ts
|
|
18048
17957
|
var INVALID_FILE = "Invalid save file format";
|
|
18049
17958
|
function isRecord(value) {
|
|
18050
17959
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -18105,8 +18014,7 @@ function isSaveExport(value) {
|
|
|
18105
18014
|
function estimatePayloadBytes(payload) {
|
|
18106
18015
|
return JSON.stringify(payload).length;
|
|
18107
18016
|
}
|
|
18108
|
-
|
|
18109
|
-
//#region src/saves/storage.ts
|
|
18017
|
+
// src/saves/storage.ts
|
|
18110
18018
|
/** A backend's tables, made by its `table` function. */
|
|
18111
18019
|
function makeTables(table) {
|
|
18112
18020
|
return {
|
|
@@ -18459,8 +18367,7 @@ function resetBackend() {
|
|
|
18459
18367
|
function getBackendType() {
|
|
18460
18368
|
return _backend?.type ?? "memory";
|
|
18461
18369
|
}
|
|
18462
|
-
|
|
18463
|
-
//#region src/saves/save-manager.ts
|
|
18370
|
+
// src/saves/save-manager.ts
|
|
18464
18371
|
var titleGenerator = null;
|
|
18465
18372
|
var saveTitlePassageContent = null;
|
|
18466
18373
|
function setTitleGenerator(fn) {
|
|
@@ -19272,8 +19179,7 @@ function deletePlaythroughData(ifid, playthroughId, replacement) {
|
|
|
19272
19179
|
return false;
|
|
19273
19180
|
});
|
|
19274
19181
|
}
|
|
19275
|
-
|
|
19276
|
-
//#region src/story-init.ts
|
|
19182
|
+
// src/story-init.ts
|
|
19277
19183
|
/** Hidden container holding the currently mounted StoryInit tree. */
|
|
19278
19184
|
var storyInitContainer = null;
|
|
19279
19185
|
/**
|
|
@@ -19328,8 +19234,7 @@ function initializeStory(session) {
|
|
|
19328
19234
|
emit("storyinit");
|
|
19329
19235
|
if (!session) recordStoryInitState();
|
|
19330
19236
|
}
|
|
19331
|
-
|
|
19332
|
-
//#region src/passage-roles.ts
|
|
19237
|
+
// src/passage-roles.ts
|
|
19333
19238
|
/** Runtime-owned passage roles, shared with stateless authoring tools. */
|
|
19334
19239
|
var SPECIAL_PASSAGES = /* @__PURE__ */ new Set([
|
|
19335
19240
|
"StoryInit",
|
|
@@ -19348,8 +19253,7 @@ var SPECIAL_PASSAGES = /* @__PURE__ */ new Set([
|
|
|
19348
19253
|
function isSpecialPassage(name) {
|
|
19349
19254
|
return SPECIAL_PASSAGES.has(name);
|
|
19350
19255
|
}
|
|
19351
|
-
|
|
19352
|
-
//#region src/store.ts
|
|
19256
|
+
// src/store.ts
|
|
19353
19257
|
enablePatches();
|
|
19354
19258
|
enableMapSet();
|
|
19355
19259
|
/** Full variable snapshot at history index 0. */
|
|
@@ -20550,8 +20454,7 @@ var useStoryStore = create()(storyStore((set, get) => ({
|
|
|
20550
20454
|
});
|
|
20551
20455
|
}
|
|
20552
20456
|
})));
|
|
20553
|
-
|
|
20554
|
-
//#region src/components/StoryInterface.tsx
|
|
20457
|
+
// src/components/StoryInterface.tsx
|
|
20555
20458
|
var DEFAULT_MARKUP = "<header class=\"story-menubar\">{story-title}{back}{forward}{restart}{quicksave}{quickload}{saves}{settings}</header>\n{passage}";
|
|
20556
20459
|
function StoryInterface() {
|
|
20557
20460
|
const { storyData } = useStoryFields("storyData");
|
|
@@ -20578,8 +20481,7 @@ function StoryInterface() {
|
|
|
20578
20481
|
}) : rendered
|
|
20579
20482
|
});
|
|
20580
20483
|
}
|
|
20581
|
-
|
|
20582
|
-
//#region src/hooks/use-modal-focus.ts
|
|
20484
|
+
// src/hooks/use-modal-focus.ts
|
|
20583
20485
|
var FOCUSABLE = [
|
|
20584
20486
|
"a[href]",
|
|
20585
20487
|
"area[href]",
|
|
@@ -20934,8 +20836,7 @@ function useModalFocus(panelRef, bodySelector, dismissible, onClose) {
|
|
|
20934
20836
|
};
|
|
20935
20837
|
}, [dismissible, onClose]);
|
|
20936
20838
|
}
|
|
20937
|
-
|
|
20938
|
-
//#region src/components/PassageDialog.tsx
|
|
20839
|
+
// src/components/PassageDialog.tsx
|
|
20939
20840
|
function PassageDialog({ passageName, fallbackMarkup, panelClass, onClose, label, dismissible = true, showCloseButton = dismissible }) {
|
|
20940
20841
|
const onCloseRef = useRef(onClose);
|
|
20941
20842
|
onCloseRef.current = onClose;
|
|
@@ -21038,8 +20939,7 @@ function DialogCloseButton({ dialogName, passageName, onClose }) {
|
|
|
21038
20939
|
children: "✕"
|
|
21039
20940
|
});
|
|
21040
20941
|
}
|
|
21041
|
-
|
|
21042
|
-
//#region src/components/TriggerDialogHost.tsx
|
|
20942
|
+
// src/components/TriggerDialogHost.tsx
|
|
21043
20943
|
function TriggerDialogHost() {
|
|
21044
20944
|
const [stack, setStack] = useState([]);
|
|
21045
20945
|
const stackRef = useRef(stack);
|
|
@@ -21084,8 +20984,7 @@ function TriggerDialogHost() {
|
|
|
21084
20984
|
dismissible: dialog.dismissible
|
|
21085
20985
|
}, `${dialog.passageName}-${i}`)) });
|
|
21086
20986
|
}
|
|
21087
|
-
|
|
21088
|
-
//#region src/components/RuntimeErrors.tsx
|
|
20987
|
+
// src/components/RuntimeErrors.tsx
|
|
21089
20988
|
/**
|
|
21090
20989
|
* The runtime errors shown on the page (see showRuntimeError): one banner
|
|
21091
20990
|
* each, announced to screen readers (role="alert"), until the player
|
|
@@ -21128,8 +21027,7 @@ function RuntimeErrors() {
|
|
|
21128
21027
|
}, e.id))
|
|
21129
21028
|
});
|
|
21130
21029
|
}
|
|
21131
|
-
|
|
21132
|
-
//#region src/quick-actions.ts
|
|
21030
|
+
// src/quick-actions.ts
|
|
21133
21031
|
/**
|
|
21134
21032
|
* QuickSave and QuickLoad as the built-in buttons and hotkeys perform them:
|
|
21135
21033
|
* a failure is shown on the page (the Story API's save() and load() only
|
|
@@ -21149,8 +21047,7 @@ async function quickLoad() {
|
|
|
21149
21047
|
showRuntimeError("The saved game could not be loaded:", error);
|
|
21150
21048
|
}
|
|
21151
21049
|
}
|
|
21152
|
-
|
|
21153
|
-
//#region src/components/App.tsx
|
|
21050
|
+
// src/components/App.tsx
|
|
21154
21051
|
function App() {
|
|
21155
21052
|
const { storyData, currentPassage, nobr } = useStoryFields("storyData", "currentPassage", "nobr");
|
|
21156
21053
|
useEffect(() => {
|
|
@@ -21181,8 +21078,7 @@ function App() {
|
|
|
21181
21078
|
children: content
|
|
21182
21079
|
});
|
|
21183
21080
|
}
|
|
21184
|
-
|
|
21185
|
-
//#region src/parser.ts
|
|
21081
|
+
// src/parser.ts
|
|
21186
21082
|
var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
|
|
21187
21083
|
/** HTML elements written without content or end tag, as innerHTML does. */
|
|
21188
21084
|
var VOID_ELEMENTS = /* @__PURE__ */ new Set([
|
|
@@ -21344,8 +21240,7 @@ function parseStoryData() {
|
|
|
21344
21240
|
userScript
|
|
21345
21241
|
};
|
|
21346
21242
|
}
|
|
21347
|
-
|
|
21348
|
-
//#region src/settings.ts
|
|
21243
|
+
// src/settings.ts
|
|
21349
21244
|
var definitions = /* @__PURE__ */ new Map();
|
|
21350
21245
|
var values = createNamespace();
|
|
21351
21246
|
var storageLoaded = false;
|
|
@@ -21441,8 +21336,7 @@ var settings = {
|
|
|
21441
21336
|
return definitions.size > 0;
|
|
21442
21337
|
}
|
|
21443
21338
|
};
|
|
21444
|
-
|
|
21445
|
-
//#region src/utils/control-edits.ts
|
|
21339
|
+
// src/utils/control-edits.ts
|
|
21446
21340
|
/**
|
|
21447
21341
|
* Records the edits made to the items of a list from inside a {for}
|
|
21448
21342
|
* iteration, which {for} tells apart from a list that is replaced:
|
|
@@ -21524,16 +21418,14 @@ function editedItems(since, state) {
|
|
|
21524
21418
|
}
|
|
21525
21419
|
return (list, item, index) => typeof item === "object" && item !== null ? through.has(item) : ends.get(list)?.has(String(index)) === true;
|
|
21526
21420
|
}
|
|
21527
|
-
|
|
21528
|
-
//#region src/utils/extract-text.ts
|
|
21421
|
+
// src/utils/extract-text.ts
|
|
21529
21422
|
/**
|
|
21530
21423
|
* Collect plain text from AST nodes, ignoring non-text nodes.
|
|
21531
21424
|
*/
|
|
21532
21425
|
function collectText(nodes) {
|
|
21533
21426
|
return nodes.map((n) => n.type === "text" ? n.value : "").join("");
|
|
21534
21427
|
}
|
|
21535
|
-
|
|
21536
|
-
//#region src/define-macro.ts
|
|
21428
|
+
// src/define-macro.ts
|
|
21537
21429
|
function macroClass(type, className) {
|
|
21538
21430
|
const base = `macro-${type}`;
|
|
21539
21431
|
return className ? `${base} ${className}` : base;
|
|
@@ -21663,8 +21555,7 @@ function defineMacro(config, source = "builtin") {
|
|
|
21663
21555
|
});
|
|
21664
21556
|
setDefinedBlockMacro(config.name, isBlock);
|
|
21665
21557
|
}
|
|
21666
|
-
|
|
21667
|
-
//#region src/story-context-passage.ts
|
|
21558
|
+
// src/story-context-passage.ts
|
|
21668
21559
|
/**
|
|
21669
21560
|
* The macros a display-only passage may not use besides the input macros:
|
|
21670
21561
|
* they change the story, act when they mount, or are controls.
|
|
@@ -21750,8 +21641,7 @@ function storyContextElement() {
|
|
|
21750
21641
|
}
|
|
21751
21642
|
return el;
|
|
21752
21643
|
}
|
|
21753
|
-
|
|
21754
|
-
//#region src/observe/observable-text.ts
|
|
21644
|
+
// src/observe/observable-text.ts
|
|
21755
21645
|
/** Elements that start and end a line. */
|
|
21756
21646
|
var BLOCKS = /* @__PURE__ */ new Set([
|
|
21757
21647
|
"P",
|
|
@@ -21862,8 +21752,7 @@ function observableErrors(el, skip, visibilityRoot) {
|
|
|
21862
21752
|
};
|
|
21863
21753
|
return [...composedElements(el)].filter((e) => e.matches(".error") && !left(e) && isRendered(e, visibilityRoot)).map((e) => observableText(e, skip, visibilityRoot).trim());
|
|
21864
21754
|
}
|
|
21865
|
-
|
|
21866
|
-
//#region src/utils/stable-key.ts
|
|
21755
|
+
// src/utils/stable-key.ts
|
|
21867
21756
|
/**
|
|
21868
21757
|
* Content-derived string key for a value, used to remount components when
|
|
21869
21758
|
* the value's contents change (e.g. {for} iterations, #45).
|
|
@@ -21971,8 +21860,7 @@ function fieldsOf(obj, keys, seen) {
|
|
|
21971
21860
|
const record = obj;
|
|
21972
21861
|
return `{${keys.map((k) => `${JSON.stringify(k)}:${keyOf(record[k], seen)}`).join(",")}}`;
|
|
21973
21862
|
}
|
|
21974
|
-
|
|
21975
|
-
//#region src/observe/observe.ts
|
|
21863
|
+
// src/observe/observe.ts
|
|
21976
21864
|
/** JSON trees as snapshots; other values use the shared value description. */
|
|
21977
21865
|
function observedValue(value) {
|
|
21978
21866
|
const description = stableKey(value);
|
|
@@ -22066,8 +21954,7 @@ function observe() {
|
|
|
22066
21954
|
turn: navigationId
|
|
22067
21955
|
};
|
|
22068
21956
|
}
|
|
22069
|
-
|
|
22070
|
-
//#region src/story-api.ts
|
|
21957
|
+
// src/story-api.ts
|
|
22071
21958
|
var readyResolve = null;
|
|
22072
21959
|
var readyPromise = null;
|
|
22073
21960
|
/** Returns the current deferred-render promise, or null if not deferred. */
|
|
@@ -22368,8 +22255,7 @@ function createStoryAPI() {
|
|
|
22368
22255
|
function installStoryAPI() {
|
|
22369
22256
|
window.Story = createStoryAPI();
|
|
22370
22257
|
}
|
|
22371
|
-
|
|
22372
|
-
//#region src/markup/validate.ts
|
|
22258
|
+
// src/markup/validate.ts
|
|
22373
22259
|
/**
|
|
22374
22260
|
* Markup validation: parse every passage when the story starts and report
|
|
22375
22261
|
* malformed markup, unknown macros, syntax errors in the code it runs and
|
|
@@ -22596,8 +22482,7 @@ function validateMarkup(passages, options) {
|
|
|
22596
22482
|
for (const [passage, tokens] of parsed) withParseCache(() => checkPassage(passage, tokens));
|
|
22597
22483
|
return diagnostics;
|
|
22598
22484
|
}
|
|
22599
|
-
|
|
22600
|
-
//#region src/static-literal.ts
|
|
22485
|
+
// src/static-literal.ts
|
|
22601
22486
|
/**
|
|
22602
22487
|
* The shape of a JavaScript literal, read from its text without running it:
|
|
22603
22488
|
* what a StoryVariables initializer is when it is a literal, or an array or
|
|
@@ -23016,8 +22901,7 @@ var Reader = class {
|
|
|
23016
22901
|
return this.skipNested("`");
|
|
23017
22902
|
}
|
|
23018
22903
|
};
|
|
23019
|
-
|
|
23020
|
-
//#region src/story-variables.ts
|
|
22904
|
+
// src/story-variables.ts
|
|
23021
22905
|
/**
|
|
23022
22906
|
* The tokens of markup, or none if it is malformed (validateMarkup reports
|
|
23023
22907
|
* that, with its position); in tolerant mode, those of the well-formed parts.
|
|
@@ -23036,8 +22920,7 @@ function tokensOf(text, textMode, { tolerant, parametersOf } = {}) {
|
|
|
23036
22920
|
}
|
|
23037
22921
|
}
|
|
23038
22922
|
function declarationRegex(sigil) {
|
|
23039
|
-
|
|
23040
|
-
return new RegExp(`^${escaped}(\\w+)\\s*=\\s*(.+)$`);
|
|
22923
|
+
return new RegExp(`^${escapeRegExp(sigil)}(\\w+)\\s*=\\s*(.+)$`);
|
|
23041
22924
|
}
|
|
23042
22925
|
var VALID_VAR_TYPES = /* @__PURE__ */ new Set([
|
|
23043
22926
|
"number",
|
|
@@ -23555,8 +23438,7 @@ function extractDefaults(schema) {
|
|
|
23555
23438
|
for (const [name, varSchema] of schema) defaults[name] = varSchema.default;
|
|
23556
23439
|
return defaults;
|
|
23557
23440
|
}
|
|
23558
|
-
|
|
23559
|
-
//#region src/components/Passage.tsx
|
|
23441
|
+
// src/components/Passage.tsx
|
|
23560
23442
|
/**
|
|
23561
23443
|
* Parsed AST per passage. The renderer keys children by AST node identity,
|
|
23562
23444
|
* so re-rendering a passage (e.g. PassageReady on every PassageDisplay
|
|
@@ -23685,8 +23567,7 @@ function Passage({ passage, dataTransition, navigationId }) {
|
|
|
23685
23567
|
children: inner
|
|
23686
23568
|
}) : inner;
|
|
23687
23569
|
}
|
|
23688
|
-
|
|
23689
|
-
//#region src/transition.ts
|
|
23570
|
+
// src/transition.ts
|
|
23690
23571
|
var TRANSITION_TYPES = /* @__PURE__ */ new Set([
|
|
23691
23572
|
"none",
|
|
23692
23573
|
"fade",
|
|
@@ -23730,8 +23611,7 @@ function resolveTransition(targetTags, nextTransition, storeDefault) {
|
|
|
23730
23611
|
if (storeDefault) return fillDefaults(storeDefault);
|
|
23731
23612
|
return { ...BUILT_IN_DEFAULT };
|
|
23732
23613
|
}
|
|
23733
|
-
|
|
23734
|
-
//#region src/components/macros/PassageDisplay.tsx
|
|
23614
|
+
// src/components/macros/PassageDisplay.tsx
|
|
23735
23615
|
/** Input types whose `value` is not what the user sees or edits. */
|
|
23736
23616
|
var VALUELESS_INPUTS = /* @__PURE__ */ new Set([
|
|
23737
23617
|
"checkbox",
|
|
@@ -23934,7 +23814,7 @@ function installSnapshotSvgStyles(root, ids, marker, targetSheets = [...root.sty
|
|
|
23934
23814
|
let start = 0;
|
|
23935
23815
|
let depth = 0;
|
|
23936
23816
|
for (let i = 0; i <= rewritten.length; i++) {
|
|
23937
|
-
const ch = rewritten
|
|
23817
|
+
const ch = rewritten.charAt(i);
|
|
23938
23818
|
if (ch === "\\") i++;
|
|
23939
23819
|
else if (ch === "\"" || ch === "'") i = skipString(rewritten, i) - 1;
|
|
23940
23820
|
else if (ch === "(" || ch === "[") depth++;
|
|
@@ -24368,8 +24248,7 @@ defineMacro({
|
|
|
24368
24248
|
});
|
|
24369
24249
|
}
|
|
24370
24250
|
});
|
|
24371
|
-
|
|
24372
|
-
//#region src/components/macros/Set.tsx
|
|
24251
|
+
// src/components/macros/Set.tsx
|
|
24373
24252
|
defineMacro({
|
|
24374
24253
|
name: "set",
|
|
24375
24254
|
parameters: [{
|
|
@@ -24381,8 +24260,7 @@ defineMacro({
|
|
|
24381
24260
|
return useRunOnce("set", rawArgs, () => ctx.mutate(rawArgs));
|
|
24382
24261
|
}
|
|
24383
24262
|
});
|
|
24384
|
-
|
|
24385
|
-
//#region src/components/macros/Print.tsx
|
|
24263
|
+
// src/components/macros/Print.tsx
|
|
24386
24264
|
defineMacro({
|
|
24387
24265
|
name: "print",
|
|
24388
24266
|
parameters: [{
|
|
@@ -24406,8 +24284,7 @@ defineMacro({
|
|
|
24406
24284
|
return display(ctx.evaluate(rawArgs));
|
|
24407
24285
|
}
|
|
24408
24286
|
});
|
|
24409
|
-
|
|
24410
|
-
//#region src/components/macros/Computed.tsx
|
|
24287
|
+
// src/components/macros/Computed.tsx
|
|
24411
24288
|
/**
|
|
24412
24289
|
* The previous output before the first successful evaluation. Distinct from
|
|
24413
24290
|
* every value an expression can produce, so the first result is always
|
|
@@ -24516,8 +24393,7 @@ defineMacro({
|
|
|
24516
24393
|
return null;
|
|
24517
24394
|
}
|
|
24518
24395
|
});
|
|
24519
|
-
|
|
24520
|
-
//#region src/components/macros/Meter.tsx
|
|
24396
|
+
// src/components/macros/Meter.tsx
|
|
24521
24397
|
/** Check the arguments of `{meter currentExpr maxExpr ["label"]}`. */
|
|
24522
24398
|
function meterArgs(args) {
|
|
24523
24399
|
if (args.current === void 0 || args.max === void 0) throw new Error("meter requires two arguments: {meter currentExpr maxExpr}");
|
|
@@ -24584,8 +24460,7 @@ defineMacro({
|
|
|
24584
24460
|
}
|
|
24585
24461
|
}
|
|
24586
24462
|
});
|
|
24587
|
-
|
|
24588
|
-
//#region src/components/macros/branches.ts
|
|
24463
|
+
// src/components/macros/branches.ts
|
|
24589
24464
|
/**
|
|
24590
24465
|
* The branch a conditional block ({if}, {switch}) shows: the first of
|
|
24591
24466
|
* `branches` whose argument `matches`, else the last bare one ({else},
|
|
@@ -24604,8 +24479,7 @@ function selectBranch(branches, matches) {
|
|
|
24604
24479
|
function renderBranch(branch, ctx) {
|
|
24605
24480
|
return wrapContent(ctx.resolve(branch.className), ctx.resolve(branch.id), ctx.renderNodes(branch.children));
|
|
24606
24481
|
}
|
|
24607
|
-
|
|
24608
|
-
//#region src/components/macros/If.tsx
|
|
24482
|
+
// src/components/macros/If.tsx
|
|
24609
24483
|
/**
|
|
24610
24484
|
* The {if}/{elseif}/{else} branch whose condition holds, else the {else}
|
|
24611
24485
|
* branch, else null: the chain ends at its first bare branch. Throws what a
|
|
@@ -24639,8 +24513,7 @@ defineMacro({
|
|
|
24639
24513
|
return branch ? ctx.renderText(branch.children) : "";
|
|
24640
24514
|
}
|
|
24641
24515
|
});
|
|
24642
|
-
|
|
24643
|
-
//#region src/components/macros/For.tsx
|
|
24516
|
+
// src/components/macros/For.tsx
|
|
24644
24517
|
/**
|
|
24645
24518
|
* Check the arguments of "@item, @i of $list" or "@item of $list".
|
|
24646
24519
|
*/
|
|
@@ -24766,8 +24639,7 @@ defineMacro({
|
|
|
24766
24639
|
})).join("");
|
|
24767
24640
|
}
|
|
24768
24641
|
});
|
|
24769
|
-
|
|
24770
|
-
//#region src/components/macros/Do.tsx
|
|
24642
|
+
// src/components/macros/Do.tsx
|
|
24771
24643
|
defineMacro({
|
|
24772
24644
|
name: "do",
|
|
24773
24645
|
block: true,
|
|
@@ -24776,8 +24648,7 @@ defineMacro({
|
|
|
24776
24648
|
return useRunOnce("do", "", () => ctx.mutate(code));
|
|
24777
24649
|
}
|
|
24778
24650
|
});
|
|
24779
|
-
|
|
24780
|
-
//#region src/components/macros/Repeat.tsx
|
|
24651
|
+
// src/components/macros/Repeat.tsx
|
|
24781
24652
|
var RepeatContext = createContext({ stop: () => {} });
|
|
24782
24653
|
defineMacro({
|
|
24783
24654
|
name: "repeat",
|
|
@@ -24812,8 +24683,7 @@ defineMacro({
|
|
|
24812
24683
|
return content;
|
|
24813
24684
|
}
|
|
24814
24685
|
});
|
|
24815
|
-
|
|
24816
|
-
//#region src/components/macros/detached-body.tsx
|
|
24686
|
+
// src/components/macros/detached-body.tsx
|
|
24817
24687
|
var frozenAlways = () => true;
|
|
24818
24688
|
/**
|
|
24819
24689
|
* Macros whose work is over once their effects have run: a body made of
|
|
@@ -24959,8 +24829,7 @@ function useDetachedBody() {
|
|
|
24959
24829
|
};
|
|
24960
24830
|
return (children) => runWithCommittedMutations(() => run(children));
|
|
24961
24831
|
}
|
|
24962
|
-
|
|
24963
|
-
//#region src/components/macros/Button.tsx
|
|
24832
|
+
// src/components/macros/Button.tsx
|
|
24964
24833
|
defineMacro({
|
|
24965
24834
|
name: "button",
|
|
24966
24835
|
block: true,
|
|
@@ -24990,8 +24859,7 @@ defineMacro({
|
|
|
24990
24859
|
});
|
|
24991
24860
|
}
|
|
24992
24861
|
});
|
|
24993
|
-
|
|
24994
|
-
//#region src/components/macros/MacroLink.tsx
|
|
24862
|
+
// src/components/macros/MacroLink.tsx
|
|
24995
24863
|
defineMacro({
|
|
24996
24864
|
name: "link",
|
|
24997
24865
|
block: true,
|
|
@@ -25046,8 +24914,7 @@ defineMacro({
|
|
|
25046
24914
|
});
|
|
25047
24915
|
}
|
|
25048
24916
|
});
|
|
25049
|
-
|
|
25050
|
-
//#region src/components/macros/Switch.tsx
|
|
24917
|
+
// src/components/macros/Switch.tsx
|
|
25051
24918
|
/**
|
|
25052
24919
|
* The first {case} branch whose value equals `value`, else the {default}
|
|
25053
24920
|
* branch, else null. Throws what a case expression throws.
|
|
@@ -25092,8 +24959,7 @@ defineMacro({
|
|
|
25092
24959
|
return branch ? ctx.renderText(branch.children) : "";
|
|
25093
24960
|
}
|
|
25094
24961
|
});
|
|
25095
|
-
|
|
25096
|
-
//#region src/components/macros/Timed.tsx
|
|
24962
|
+
// src/components/macros/Timed.tsx
|
|
25097
24963
|
/** The parameters of {timed} and of each {next}: the delay before it shows. */
|
|
25098
24964
|
var TIMED_PARAMETERS = [DELAY_PARAMETER];
|
|
25099
24965
|
defineMacro({
|
|
@@ -25128,8 +24994,7 @@ defineMacro({
|
|
|
25128
24994
|
return ctx.wrap(wrapContent(ctx.resolve(section.className), ctx.resolve(section.id), ctx.renderNodes(section.nodes)));
|
|
25129
24995
|
}
|
|
25130
24996
|
});
|
|
25131
|
-
|
|
25132
|
-
//#region src/components/macros/Stop.tsx
|
|
24997
|
+
// src/components/macros/Stop.tsx
|
|
25133
24998
|
defineMacro({
|
|
25134
24999
|
name: "stop",
|
|
25135
25000
|
render(_props, ctx) {
|
|
@@ -25140,8 +25005,7 @@ defineMacro({
|
|
|
25140
25005
|
return null;
|
|
25141
25006
|
}
|
|
25142
25007
|
});
|
|
25143
|
-
|
|
25144
|
-
//#region src/components/macros/Type.tsx
|
|
25008
|
+
// src/components/macros/Type.tsx
|
|
25145
25009
|
/**
|
|
25146
25010
|
* The clip-path that shows the first `count` characters of `root`'s text in
|
|
25147
25011
|
* reading order: the boxes the browser laid out for them, each wrapped line
|
|
@@ -25252,8 +25116,7 @@ defineMacro({
|
|
|
25252
25116
|
});
|
|
25253
25117
|
}
|
|
25254
25118
|
});
|
|
25255
|
-
|
|
25256
|
-
//#region src/components/macros/Widget.tsx
|
|
25119
|
+
// src/components/macros/Widget.tsx
|
|
25257
25120
|
defineMacro({
|
|
25258
25121
|
name: "widget",
|
|
25259
25122
|
block: true,
|
|
@@ -25289,8 +25152,7 @@ defineMacro({
|
|
|
25289
25152
|
return null;
|
|
25290
25153
|
}
|
|
25291
25154
|
});
|
|
25292
|
-
|
|
25293
|
-
//#region src/components/macros/StoryTitle.tsx
|
|
25155
|
+
// src/components/macros/StoryTitle.tsx
|
|
25294
25156
|
defineMacro({
|
|
25295
25157
|
name: "story-title",
|
|
25296
25158
|
interpolate: true,
|
|
@@ -25305,8 +25167,7 @@ defineMacro({
|
|
|
25305
25167
|
},
|
|
25306
25168
|
text: () => useStoryStore.getState().storyData?.name || ""
|
|
25307
25169
|
});
|
|
25308
|
-
|
|
25309
|
-
//#region src/components/macros/MenubarButtons.tsx
|
|
25170
|
+
// src/components/macros/MenubarButtons.tsx
|
|
25310
25171
|
function hotkeyTitle(label, key) {
|
|
25311
25172
|
return key ? `${label} (${key})` : label;
|
|
25312
25173
|
}
|
|
@@ -25424,8 +25285,7 @@ defineMenubarAction({
|
|
|
25424
25285
|
panelClass: "dialog-settings"
|
|
25425
25286
|
}
|
|
25426
25287
|
});
|
|
25427
|
-
|
|
25428
|
-
//#region src/components/macros/Dialog.tsx
|
|
25288
|
+
// src/components/macros/Dialog.tsx
|
|
25429
25289
|
defineMacro({
|
|
25430
25290
|
name: "dialog",
|
|
25431
25291
|
block: true,
|
|
@@ -25465,8 +25325,7 @@ defineMacro({
|
|
|
25465
25325
|
})] });
|
|
25466
25326
|
}
|
|
25467
25327
|
});
|
|
25468
|
-
|
|
25469
|
-
//#region src/components/macros/SaveManager.tsx
|
|
25328
|
+
// src/components/macros/SaveManager.tsx
|
|
25470
25329
|
function relativeTime(iso) {
|
|
25471
25330
|
const diff = Date.now() - new Date(iso).getTime();
|
|
25472
25331
|
const secs = Math.floor(diff / 1e3);
|
|
@@ -25839,8 +25698,7 @@ defineMacro({
|
|
|
25839
25698
|
});
|
|
25840
25699
|
}
|
|
25841
25700
|
});
|
|
25842
|
-
|
|
25843
|
-
//#region src/components/macros/SettingsControls.tsx
|
|
25701
|
+
// src/components/macros/SettingsControls.tsx
|
|
25844
25702
|
function SettingControl({ name, def }) {
|
|
25845
25703
|
const [value, setValue] = useState(() => settings.get(name));
|
|
25846
25704
|
useEffect(() => {
|
|
@@ -25907,8 +25765,7 @@ defineMacro({
|
|
|
25907
25765
|
});
|
|
25908
25766
|
}
|
|
25909
25767
|
});
|
|
25910
|
-
|
|
25911
|
-
//#region src/components/macros/Include.tsx
|
|
25768
|
+
// src/components/macros/Include.tsx
|
|
25912
25769
|
defineMacro({
|
|
25913
25770
|
name: "include",
|
|
25914
25771
|
interpolate: true,
|
|
@@ -25954,8 +25811,7 @@ defineMacro({
|
|
|
25954
25811
|
return ctx.wrap(content);
|
|
25955
25812
|
}
|
|
25956
25813
|
});
|
|
25957
|
-
|
|
25958
|
-
//#region src/components/macros/Nobr.tsx
|
|
25814
|
+
// src/components/macros/Nobr.tsx
|
|
25959
25815
|
defineMacro({
|
|
25960
25816
|
name: "nobr",
|
|
25961
25817
|
block: true,
|
|
@@ -25965,8 +25821,7 @@ defineMacro({
|
|
|
25965
25821
|
},
|
|
25966
25822
|
text: ({ children = [] }, ctx) => ctx.renderText(children)
|
|
25967
25823
|
});
|
|
25968
|
-
|
|
25969
|
-
//#region src/components/macros/Goto.tsx
|
|
25824
|
+
// src/components/macros/Goto.tsx
|
|
25970
25825
|
defineMacro({
|
|
25971
25826
|
name: "goto",
|
|
25972
25827
|
merged: true,
|
|
@@ -25993,8 +25848,7 @@ defineMacro({
|
|
|
25993
25848
|
}) : null;
|
|
25994
25849
|
}
|
|
25995
25850
|
});
|
|
25996
|
-
|
|
25997
|
-
//#region src/components/macros/Unset.tsx
|
|
25851
|
+
// src/components/macros/Unset.tsx
|
|
25998
25852
|
/** What `name` is as a variable reference, or null if it is no reference. */
|
|
25999
25853
|
function referencePath(name) {
|
|
26000
25854
|
try {
|
|
@@ -26025,8 +25879,7 @@ defineMacro({
|
|
|
26025
25879
|
});
|
|
26026
25880
|
}
|
|
26027
25881
|
});
|
|
26028
|
-
|
|
26029
|
-
//#region src/components/macros/input-macro.ts
|
|
25882
|
+
// src/components/macros/input-macro.ts
|
|
26030
25883
|
/** The story variable a `storeVar` macro binds: its first parameter. */
|
|
26031
25884
|
var VARIABLE_PARAMETER = {
|
|
26032
25885
|
name: "variable",
|
|
@@ -26087,17 +25940,13 @@ function defineInputMacro(name, type, toValue = (input) => input !== void 0 ? St
|
|
|
26087
25940
|
}
|
|
26088
25941
|
});
|
|
26089
25942
|
}
|
|
26090
|
-
|
|
26091
|
-
//#region src/components/macros/Textbox.tsx
|
|
25943
|
+
// src/components/macros/Textbox.tsx
|
|
26092
25944
|
defineInputMacro("textbox", "text");
|
|
26093
|
-
|
|
26094
|
-
//#region src/components/macros/Numberbox.tsx
|
|
25945
|
+
// src/components/macros/Numberbox.tsx
|
|
26095
25946
|
defineInputMacro("numberbox", "number", (v) => v !== void 0 ? Number(v) : 0);
|
|
26096
|
-
|
|
26097
|
-
//#region src/components/macros/Textarea.tsx
|
|
25947
|
+
// src/components/macros/Textarea.tsx
|
|
26098
25948
|
defineInputMacro("textarea");
|
|
26099
|
-
|
|
26100
|
-
//#region src/components/macros/Checkbox.tsx
|
|
25949
|
+
// src/components/macros/Checkbox.tsx
|
|
26101
25950
|
defineMacro({
|
|
26102
25951
|
name: "checkbox",
|
|
26103
25952
|
interpolate: true,
|
|
@@ -26127,8 +25976,7 @@ defineMacro({
|
|
|
26127
25976
|
});
|
|
26128
25977
|
}
|
|
26129
25978
|
});
|
|
26130
|
-
|
|
26131
|
-
//#region src/components/macros/Radiobutton.tsx
|
|
25979
|
+
// src/components/macros/Radiobutton.tsx
|
|
26132
25980
|
defineMacro({
|
|
26133
25981
|
name: "radiobutton",
|
|
26134
25982
|
interpolate: true,
|
|
@@ -26171,8 +26019,7 @@ defineMacro({
|
|
|
26171
26019
|
});
|
|
26172
26020
|
}
|
|
26173
26021
|
});
|
|
26174
|
-
|
|
26175
|
-
//#region src/components/macros/Listbox.tsx
|
|
26022
|
+
// src/components/macros/Listbox.tsx
|
|
26176
26023
|
defineMacro({
|
|
26177
26024
|
name: "listbox",
|
|
26178
26025
|
interpolate: true,
|
|
@@ -26200,8 +26047,7 @@ defineMacro({
|
|
|
26200
26047
|
});
|
|
26201
26048
|
}
|
|
26202
26049
|
});
|
|
26203
|
-
|
|
26204
|
-
//#region src/components/macros/Cycle.tsx
|
|
26050
|
+
// src/components/macros/Cycle.tsx
|
|
26205
26051
|
defineMacro({
|
|
26206
26052
|
name: "cycle",
|
|
26207
26053
|
block: true,
|
|
@@ -26234,8 +26080,7 @@ defineMacro({
|
|
|
26234
26080
|
});
|
|
26235
26081
|
}
|
|
26236
26082
|
});
|
|
26237
|
-
|
|
26238
|
-
//#region src/components/macros/Span.tsx
|
|
26083
|
+
// src/components/macros/Span.tsx
|
|
26239
26084
|
defineMacro({
|
|
26240
26085
|
name: "span",
|
|
26241
26086
|
block: true,
|
|
@@ -26245,8 +26090,7 @@ defineMacro({
|
|
|
26245
26090
|
},
|
|
26246
26091
|
text: ({ children = [] }, ctx) => ctx.renderText(children)
|
|
26247
26092
|
});
|
|
26248
|
-
|
|
26249
|
-
//#region src/components/macros/Watch.tsx
|
|
26093
|
+
// src/components/macros/Watch.tsx
|
|
26250
26094
|
defineMacro({
|
|
26251
26095
|
name: "watch",
|
|
26252
26096
|
parameters: WATCH_PARAMETERS,
|
|
@@ -26286,11 +26130,9 @@ defineMacro({
|
|
|
26286
26130
|
return null;
|
|
26287
26131
|
}
|
|
26288
26132
|
});
|
|
26289
|
-
|
|
26290
|
-
//#region src/styles.css?inline
|
|
26133
|
+
// src/styles.css?inline
|
|
26291
26134
|
var styles_default = "*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\nhtml {\n font-size: 16px;\n -webkit-text-size-adjust: 100%;\n}\n\nbody {\n margin: 0;\n padding: 0;\n font-family: Georgia, 'Times New Roman', serif;\n line-height: 1.75;\n color: #e0e0e0;\n background-color: #1a1a2e;\n min-height: 100vh;\n}\n\ntw-storydata {\n display: none !important;\n}\n\n#story {\n max-width: 42em;\n margin: 0 auto;\n padding: 2em 1.5em;\n}\n\n/* Passage transitions */\n\n.passage-container {\n position: relative;\n}\n\n.passage-container--crossfading {\n display: grid;\n}\n\n.passage-container--crossfading > * {\n grid-area: 1 / 1;\n}\n\n.passage {\n animation: passage-fade-in var(--passage-in-duration, 0.3s) ease;\n}\n\n.passage[data-transition='none'] {\n animation: none;\n}\n\n.passage-snapshot {\n animation: passage-fade-out var(--passage-out-duration, 0.3s) ease forwards;\n pointer-events: none;\n user-select: none;\n}\n\n@keyframes passage-fade-in {\n from {\n opacity: 0;\n transform: translateY(8px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes passage-fade-out {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(-8px);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .passage,\n .passage-snapshot {\n animation-duration: 0.01s !important;\n }\n}\n\n.macro-button {\n background: rgba(100, 181, 246, 0.15);\n color: #64b5f6;\n border: 1px solid rgba(100, 181, 246, 0.4);\n border-radius: 4px;\n padding: 0.25em 0.75em;\n font: inherit;\n font-size: 0.95em;\n cursor: pointer;\n transition:\n background 0.2s,\n border-color 0.2s;\n}\n\n.macro-button:hover {\n background: rgba(100, 181, 246, 0.25);\n border-color: #90caf9;\n}\n\n.macro-button:active {\n background: rgba(100, 181, 246, 0.35);\n}\n\n.error {\n color: #ef5350;\n font-family: monospace;\n padding: 1em;\n border: 1px solid #ef5350;\n border-radius: 4px;\n background: rgba(239, 83, 80, 0.1);\n}\n\n/* Runtime errors shown on the page (see src/components/RuntimeErrors.tsx) */\n.spindle-error-banners {\n position: fixed;\n top: 0.75em;\n left: 50%;\n z-index: 300;\n display: flex;\n flex-direction: column;\n gap: 0.5em;\n width: min(42em, calc(100% - 1.5em));\n transform: translateX(-50%);\n}\n\n.spindle-error-banner {\n position: relative;\n padding: 0.75em 2.75em 0.75em 1em;\n border: 1px solid #ef5350;\n border-radius: 4px;\n background: #2b1a1e;\n color: #ffcdd2;\n font-size: 0.9em;\n line-height: 1.5;\n box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);\n}\n\n.spindle-error-banner-message {\n font-family: monospace;\n color: #ef9a9a;\n}\n\n.spindle-error-banner-dismiss {\n position: absolute;\n top: 0.5em;\n right: 0.5em;\n background: transparent;\n border: none;\n color: inherit;\n font-size: 1em;\n cursor: pointer;\n}\n\n.spindle-error-banner-dismiss:hover {\n color: #fff;\n}\n\n.loading {\n text-align: center;\n padding: 2em;\n opacity: 0.6;\n}\n\n/* Menu bar */\n\n.story-menubar {\n position: sticky;\n top: 0;\n z-index: 100;\n display: flex;\n align-items: center;\n gap: 0.5em;\n padding: 0.5em 1.5em;\n background: #16213e;\n border-bottom: 1px solid rgba(255, 255, 255, 0.08);\n font-family: system-ui, sans-serif;\n font-size: 0.9em;\n}\n\n@media (max-width: 600px) {\n .story-menubar {\n flex-wrap: wrap;\n padding: 0.5em 0.75em;\n }\n\n .story-menubar .story-title {\n flex: 1 1 100%;\n }\n}\n\n.story-title {\n flex: 1;\n font-weight: 600;\n color: #e0e0e0;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.menubar-button {\n background: transparent;\n color: #9e9e9e;\n border: 1px solid transparent;\n padding: 0.35em 0.7em;\n border-radius: 4px;\n cursor: pointer;\n font: inherit;\n transition:\n color 0.2s,\n background 0.2s;\n}\n\n.menubar-button:hover {\n color: #e0e0e0;\n background: rgba(255, 255, 255, 0.08);\n}\n\n.menubar-button:disabled {\n opacity: 0.4;\n cursor: default;\n}\n\n.menubar-button:disabled:hover {\n color: #9e9e9e;\n background: transparent;\n}\n\n/* Generic dialog */\n\n.dialog-overlay {\n position: fixed;\n inset: 0;\n z-index: 200;\n display: flex;\n align-items: center;\n justify-content: center;\n background: rgba(0, 0, 0, 0.6);\n}\n\n.dialog-panel {\n background: #16213e;\n border: 1px solid rgba(255, 255, 255, 0.1);\n border-radius: 8px;\n width: 90%;\n max-width: 500px;\n max-height: 80vh;\n display: flex;\n flex-direction: column;\n color: #e0e0e0;\n font-family: system-ui, sans-serif;\n position: relative;\n}\n\n/* Focused programmatically when the dialog has no focusable content */\n.dialog-panel:focus {\n outline: none;\n}\n\n.dialog-saves {\n max-width: 550px;\n}\n\n.dialog-settings {\n max-width: 400px;\n}\n\n/* Keep the first control clear of the close button above it */\n.dialog-settings .dialog-body {\n padding-top: 2.25em;\n}\n\n.dialog-close {\n position: absolute;\n top: 0.75em;\n right: 0.75em;\n z-index: 1;\n background: transparent;\n border: none;\n color: #9e9e9e;\n font-size: 1.1em;\n cursor: pointer;\n padding: 0.25em;\n line-height: 1;\n}\n\n.dialog-close:hover {\n color: #e0e0e0;\n}\n\n.dialog-body {\n overflow-y: auto;\n flex: 1;\n min-height: 0;\n}\n\n/* Settings controls */\n\n.settings-controls {\n padding: 1em 1.25em;\n display: flex;\n flex-direction: column;\n gap: 1em;\n}\n\n.settings-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 1em;\n}\n\n.settings-row select,\n.settings-row input[type='range'] {\n accent-color: #64b5f6;\n}\n\n.settings-row select {\n background: #1a1a2e;\n color: #e0e0e0;\n border: 1px solid rgba(255, 255, 255, 0.15);\n border-radius: 4px;\n padding: 0.3em 0.5em;\n font: inherit;\n}\n\n.settings-row input[type='checkbox'] {\n accent-color: #64b5f6;\n width: 1.1em;\n height: 1.1em;\n}\n\n/* Save manager */\n\n.save-manager {\n display: flex;\n flex-direction: column;\n flex: 1;\n min-height: 0;\n}\n\n.saves-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 1em 1.25em;\n padding-right: 3em;\n border-bottom: 1px solid rgba(255, 255, 255, 0.08);\n font-weight: 600;\n flex-shrink: 0;\n}\n\n.saves-header-left {\n display: flex;\n align-items: center;\n gap: 0.75em;\n}\n\n.saves-mode-toggle {\n display: flex;\n gap: 0;\n border: 1px solid rgba(255, 255, 255, 0.15);\n border-radius: 4px;\n overflow: hidden;\n}\n\n.saves-mode-toggle button {\n background: transparent;\n color: #9e9e9e;\n border: none;\n padding: 0.3em 0.8em;\n font: inherit;\n font-size: 0.85em;\n font-weight: 600;\n cursor: pointer;\n transition:\n background 0.2s,\n color 0.2s;\n}\n\n.saves-mode-toggle button.active {\n background: rgba(100, 181, 246, 0.2);\n color: #64b5f6;\n}\n\n.saves-mode-toggle button:hover:not(.active) {\n color: #e0e0e0;\n}\n\n.saves-body {\n padding: 0.75em 1.25em;\n overflow-y: auto;\n flex: 1;\n min-height: 0;\n}\n\n.saves-empty {\n text-align: center;\n padding: 2em 1em;\n opacity: 0.5;\n font-size: 0.9em;\n}\n\n.saves-toolbar {\n display: flex;\n gap: 0.5em;\n padding: 0.5em 1.25em;\n border-bottom: 1px solid rgba(255, 255, 255, 0.08);\n flex-shrink: 0;\n}\n\n.saves-toolbar-button {\n background: rgba(255, 255, 255, 0.05);\n color: #9e9e9e;\n border: 1px solid rgba(255, 255, 255, 0.1);\n border-radius: 4px;\n padding: 0.3em 0.7em;\n font: inherit;\n font-size: 0.8em;\n cursor: pointer;\n transition:\n background 0.2s,\n color 0.2s;\n}\n\n.saves-toolbar-button:hover {\n background: rgba(255, 255, 255, 0.1);\n color: #e0e0e0;\n}\n\n.playthrough-group {\n margin-bottom: 0.75em;\n}\n\n.playthrough-header {\n display: flex;\n width: 100%;\n border: 0;\n background: none;\n font-family: inherit;\n text-align: left;\n align-items: center;\n gap: 0.5em;\n padding: 0.4em 0;\n cursor: pointer;\n user-select: none;\n font-size: 0.85em;\n color: #9e9e9e;\n transition: color 0.2s;\n}\n\n.playthrough-header:hover {\n color: #e0e0e0;\n}\n\n.playthrough-chevron {\n display: inline-block;\n font-size: 0.7em;\n transition: transform 0.2s;\n}\n\n.playthrough-chevron.open {\n transform: rotate(90deg);\n}\n\n.playthrough-label {\n font-weight: 600;\n}\n\n.playthrough-date {\n opacity: 0.6;\n font-size: 0.9em;\n}\n\n.playthrough-saves {\n display: flex;\n flex-direction: column;\n gap: 0.4em;\n padding-left: 0.25em;\n}\n\n.save-slot {\n display: flex;\n align-items: center;\n gap: 0.75em;\n padding: 0.5em 0.6em;\n background: rgba(255, 255, 255, 0.03);\n border: 1px solid rgba(255, 255, 255, 0.06);\n border-radius: 6px;\n transition: background 0.15s;\n}\n\n.save-slot:hover {\n background: rgba(255, 255, 255, 0.06);\n}\n\n.save-slot-info {\n flex: 1;\n min-width: 0;\n}\n\n.save-slot-title {\n font-weight: 500;\n font-size: 0.9em;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.save-slot-meta {\n font-size: 0.75em;\n color: #9e9e9e;\n display: flex;\n gap: 0.75em;\n}\n\n.save-slot-actions {\n display: flex;\n gap: 0.3em;\n flex-shrink: 0;\n}\n\n.save-slot-action {\n background: transparent;\n color: #9e9e9e;\n border: 1px solid transparent;\n border-radius: 3px;\n padding: 0.2em 0.5em;\n font: inherit;\n font-size: 0.75em;\n cursor: pointer;\n transition:\n color 0.2s,\n background 0.2s;\n white-space: nowrap;\n}\n\n.save-slot-action:hover {\n color: #e0e0e0;\n background: rgba(255, 255, 255, 0.08);\n}\n\n.save-slot-action.primary {\n color: #64b5f6;\n border-color: rgba(100, 181, 246, 0.3);\n}\n\n.save-slot-action.primary:hover {\n background: rgba(100, 181, 246, 0.15);\n}\n\n.save-slot-action.danger:hover {\n color: #ef5350;\n background: rgba(239, 83, 80, 0.1);\n}\n\n.save-slot-new {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0.5em;\n margin-top: 0.25em;\n border: 1px dashed rgba(255, 255, 255, 0.12);\n border-radius: 6px;\n color: #9e9e9e;\n font: inherit;\n font-size: 0.8em;\n background: transparent;\n cursor: pointer;\n width: 100%;\n transition:\n color 0.2s,\n border-color 0.2s,\n background 0.2s;\n}\n\n.save-slot-new:hover {\n color: #64b5f6;\n border-color: rgba(100, 181, 246, 0.3);\n background: rgba(100, 181, 246, 0.05);\n}\n\n.saves-notice {\n padding: 0.5em 1.25em;\n font-size: 0.8em;\n color: #ffb74d;\n border-bottom: 1px solid rgba(255, 183, 77, 0.3);\n background: rgba(255, 183, 77, 0.08);\n flex-shrink: 0;\n}\n\n.saves-status {\n padding: 0.5em 1.25em;\n font-size: 0.8em;\n color: #81c784;\n border-top: 1px solid rgba(255, 255, 255, 0.08);\n flex-shrink: 0;\n text-align: center;\n}\n\n.saves-status.error {\n color: #ef5350;\n border: none;\n border-radius: 0;\n padding: 0.5em 1.25em;\n font-family: inherit;\n background: transparent;\n}\n\n.save-rename-input {\n background: #1a1a2e;\n color: #e0e0e0;\n border: 1px solid rgba(100, 181, 246, 0.4);\n border-radius: 3px;\n padding: 0.15em 0.4em;\n font: inherit;\n font-size: 0.9em;\n width: 100%;\n}\n\n.save-rename-input:focus {\n outline: none;\n border-color: #64b5f6;\n}\n\n/* Macro: link */\n\n.macro-link {\n color: #64b5f6;\n text-decoration: none;\n border-bottom: 1px solid rgba(100, 181, 246, 0.3);\n transition:\n color 0.2s,\n border-color 0.2s;\n cursor: pointer;\n}\n\n.macro-link:hover {\n color: #90caf9;\n border-bottom-color: #90caf9;\n}\n\n.macro-link:active {\n color: #42a5f5;\n}\n\n/* Macro: form inputs */\n\n.macro-textbox,\n.macro-numberbox,\n.macro-textarea {\n background: #1a1a2e;\n color: #e0e0e0;\n border: 1px solid rgba(255, 255, 255, 0.15);\n border-radius: 4px;\n padding: 0.3em 0.5em;\n font: inherit;\n}\n\n.macro-textbox:focus,\n.macro-numberbox:focus,\n.macro-textarea:focus {\n outline: none;\n border-color: #64b5f6;\n}\n\n.macro-textarea {\n min-height: 3em;\n resize: vertical;\n}\n\n.macro-checkbox,\n.macro-radiobutton {\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n gap: 0.3em;\n}\n\n.macro-checkbox input,\n.macro-radiobutton input {\n accent-color: #64b5f6;\n}\n\n/* Macro: listbox */\n\n.macro-listbox {\n background: #1a1a2e;\n color: #e0e0e0;\n border: 1px solid rgba(255, 255, 255, 0.15);\n border-radius: 4px;\n padding: 0.3em 0.5em;\n font: inherit;\n}\n\n/* Macro: cycle */\n\n.macro-cycle {\n background: rgba(100, 181, 246, 0.15);\n color: #64b5f6;\n border: 1px solid rgba(100, 181, 246, 0.4);\n border-radius: 4px;\n padding: 0.25em 0.75em;\n font: inherit;\n cursor: pointer;\n transition:\n background 0.2s,\n border-color 0.2s;\n}\n\n.macro-cycle:hover {\n background: rgba(100, 181, 246, 0.25);\n border-color: #90caf9;\n}\n\n/* Macro: meter */\n\n.macro-meter {\n position: relative;\n width: 100%;\n height: 1.4em;\n background: #2a2a3e;\n border-radius: 0.3em;\n overflow: hidden;\n border: 1px solid #444;\n}\n\n.macro-meter-fill {\n height: 100%;\n background: #64b5f6;\n transition: width 0.3s ease;\n}\n\n.macro-meter-label {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 0.85em;\n color: #e0e0e0;\n text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);\n pointer-events: none;\n}\n\n/* Markdown wrapper — invisible to layout */\n\n.md {\n display: contents;\n}\n\n/* Markdown block elements inside passages */\n\n.passage p {\n margin: 0.6em 0;\n}\n\n.passage p:first-child {\n margin-top: 0;\n}\n\n.passage p:last-child {\n margin-bottom: 0;\n}\n\n.passage h1,\n.passage h2,\n.passage h3,\n.passage h4,\n.passage h5,\n.passage h6 {\n margin: 1em 0 0.4em;\n line-height: 1.3;\n color: #f0f0f0;\n}\n\n.passage h1 {\n font-size: 1.8em;\n}\n.passage h2 {\n font-size: 1.5em;\n}\n.passage h3 {\n font-size: 1.25em;\n}\n.passage h4 {\n font-size: 1.1em;\n}\n.passage h5 {\n font-size: 1em;\n}\n.passage h6 {\n font-size: 0.9em;\n opacity: 0.8;\n}\n\n.passage code {\n font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;\n font-size: 0.9em;\n background: rgba(255, 255, 255, 0.08);\n padding: 0.15em 0.35em;\n border-radius: 3px;\n}\n\n.passage pre {\n background: rgba(0, 0, 0, 0.3);\n border: 1px solid rgba(255, 255, 255, 0.08);\n border-radius: 6px;\n padding: 1em;\n overflow-x: auto;\n margin: 0.8em 0;\n}\n\n.passage pre code {\n background: none;\n padding: 0;\n border-radius: 0;\n font-size: 0.85em;\n}\n\n.passage blockquote {\n border-left: 3px solid rgba(100, 181, 246, 0.5);\n margin: 0.8em 0;\n padding: 0.4em 1em;\n color: #b0b0b0;\n}\n\n.passage blockquote p {\n margin: 0.3em 0;\n}\n\n.passage ul,\n.passage ol {\n margin: 0.6em 0;\n padding-left: 1.8em;\n}\n\n.passage li {\n margin: 0.2em 0;\n}\n\n.passage hr {\n border: none;\n border-top: 1px solid rgba(255, 255, 255, 0.12);\n margin: 1.2em 0;\n}\n\n.passage table {\n border-collapse: collapse;\n width: 100%;\n margin: 0.8em 0;\n}\n\n.passage th,\n.passage td {\n border: 1px solid rgba(255, 255, 255, 0.12);\n padding: 0.5em 0.75em;\n text-align: left;\n}\n\n.passage th {\n background: rgba(255, 255, 255, 0.06);\n font-weight: 600;\n}\n\n.passage tr:nth-child(even) {\n background: rgba(255, 255, 255, 0.02);\n}\n\n.passage del {\n opacity: 0.5;\n}\n\n.passage strong {\n color: #f0f0f0;\n}\n\n/* Macro: type (typewriter) */\n\n.macro-type-cursor::after {\n content: '\\2588';\n animation: type-blink 0.7s step-end infinite;\n color: #64b5f6;\n}\n\n.macro-type-done .macro-type-cursor::after {\n display: none;\n}\n\n@keyframes type-blink {\n 50% {\n opacity: 0;\n }\n}\n";
|
|
26292
|
-
|
|
26293
|
-
//#region src/index.tsx
|
|
26135
|
+
// src/index.tsx
|
|
26294
26136
|
function renderErrors(root, errors) {
|
|
26295
26137
|
root.innerHTML = "";
|
|
26296
26138
|
const container = document.createElement("div");
|
|
@@ -26442,8 +26284,7 @@ function boot() {
|
|
|
26442
26284
|
document.dispatchEvent(new CustomEvent(":storyready"));
|
|
26443
26285
|
});
|
|
26444
26286
|
}
|
|
26445
|
-
|
|
26446
|
-
//#region src/headless.ts
|
|
26287
|
+
// src/headless.ts
|
|
26447
26288
|
/**
|
|
26448
26289
|
* Node entry point (`@rohal12/spindle/headless`): boot a compiled story in
|
|
26449
26290
|
* the DOM the caller provides (a vitest `happy-dom`/`jsdom` environment, or
|
|
@@ -26536,5 +26377,4 @@ function createTranscript(story, options = {}) {
|
|
|
26536
26377
|
}
|
|
26537
26378
|
};
|
|
26538
26379
|
}
|
|
26539
|
-
//#endregion
|
|
26540
26380
|
export { bootStory, createTranscript, gotoError, storyVariables };
|