@rohal12/spindle 0.59.25 → 0.59.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pkg/format.js +1 -1
- package/dist/pkg/headless.js +339 -285
- package/dist/pkg/story-variables.js +141 -100
- package/package.json +23 -24
- package/src/automation/load-yaml.ts +1 -1
- package/src/components/macros/MacroError.tsx +1 -1
- package/src/components/macros/SaveManager.tsx +2 -2
- package/src/components/macros/macro-args.ts +1 -2
- package/src/execute-mutation.ts +4 -3
- package/src/hooks/use-modal-focus.ts +1 -1
- package/src/hooks/use-story-fields.ts +1 -1
- package/src/markup/ast.ts +1 -5
- package/src/markup/code-attributes.ts +1 -3
- package/src/markup/code-end.ts +1 -1
- package/src/markup/line-column.ts +1 -1
- package/src/markup/pair.ts +1 -4
- package/src/markup/render.tsx +10 -9
- package/src/static-literal.ts +1 -6
- package/src/store.ts +1 -1
- package/src/story-variables.ts +1 -6
- package/types/index.d.ts +2 -10
- package/types/tooling.d.ts +4 -17
|
@@ -34,7 +34,7 @@ var grammar_shared_default = {
|
|
|
34
34
|
var LB = String.fromCharCode(123);
|
|
35
35
|
var RB = String.fromCharCode(125);
|
|
36
36
|
var { SIGIL_SCOPES: SIGIL_SCOPES$1, withSelectors } = grammar_shared_default;
|
|
37
|
-
var VOID_TAGS = new Set([
|
|
37
|
+
var VOID_TAGS = /* @__PURE__ */ new Set([
|
|
38
38
|
"area",
|
|
39
39
|
"base",
|
|
40
40
|
"br",
|
|
@@ -696,7 +696,7 @@ function peg$parse(input, options) {
|
|
|
696
696
|
return withSelectors(node, s);
|
|
697
697
|
}
|
|
698
698
|
function peg$f35() {
|
|
699
|
-
fail("Unclosed " +
|
|
699
|
+
fail("Unclosed {" + input.substr(location().end.offset, 1) + "…: no } ends it", location(), "unclosed-expression");
|
|
700
700
|
}
|
|
701
701
|
function peg$f36(start) {
|
|
702
702
|
return skipTo(hooks.closeBrace(input, start, start));
|
|
@@ -728,13 +728,13 @@ function peg$parse(input, options) {
|
|
|
728
728
|
tag.nameStart = nameEnd - name.length;
|
|
729
729
|
tag.nameEnd = nameEnd;
|
|
730
730
|
tag.selectorSpan = selectorSpan(s, ss, start);
|
|
731
|
-
if (tail === null) fail("Unclosed " +
|
|
731
|
+
if (tail === null) fail("Unclosed {" + (close ? "/" : "") + name + "…: no } ends the macro", loc, "unclosed-macro");
|
|
732
732
|
tag.rawArgs = tail.trim();
|
|
733
733
|
tag.argsStart = tag.rawArgs ? nameEnd + tail.length - tail.trimStart().length : nameEnd;
|
|
734
734
|
tag.argsEnd = tag.argsStart + tag.rawArgs.length;
|
|
735
735
|
if (close) {
|
|
736
736
|
if (s !== NO_SELECTORS) fail("A closing tag takes no selectors: " + label(tag), loc, "closer-with-selectors");
|
|
737
|
-
if (tag.rawArgs) fail("A closing tag takes no arguments:
|
|
737
|
+
if (tag.rawArgs) fail("A closing tag takes no arguments: {/" + name + " " + tag.rawArgs + RB, loc, "closer-with-arguments");
|
|
738
738
|
tag.kind = "close";
|
|
739
739
|
} else {
|
|
740
740
|
withSelectors(tag, s);
|
|
@@ -743,7 +743,7 @@ function peg$parse(input, options) {
|
|
|
743
743
|
return tag;
|
|
744
744
|
}
|
|
745
745
|
function peg$f43(s) {
|
|
746
|
-
fail("A closing tag starts with a letter after
|
|
746
|
+
fail("A closing tag starts with a letter after {/", location(), "invalid-closer");
|
|
747
747
|
}
|
|
748
748
|
function peg$f44(value) {
|
|
749
749
|
return EMAIL_AUTOLINK.test(value);
|
|
@@ -1622,12 +1622,14 @@ function peg$parse(input, options) {
|
|
|
1622
1622
|
s3 = peg$FAILED;
|
|
1623
1623
|
if (peg$silentFails === 0) peg$fail(peg$e13);
|
|
1624
1624
|
}
|
|
1625
|
-
if (s3 === peg$FAILED)
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1625
|
+
if (s3 === peg$FAILED) {
|
|
1626
|
+
if (input.substr(peg$currPos, 2) === peg$c8) {
|
|
1627
|
+
s3 = peg$c8;
|
|
1628
|
+
peg$currPos += 2;
|
|
1629
|
+
} else {
|
|
1630
|
+
s3 = peg$FAILED;
|
|
1631
|
+
if (peg$silentFails === 0) peg$fail(peg$e12);
|
|
1632
|
+
}
|
|
1631
1633
|
}
|
|
1632
1634
|
peg$silentFails--;
|
|
1633
1635
|
if (s3 === peg$FAILED) s2 = void 0;
|
|
@@ -1666,12 +1668,14 @@ function peg$parse(input, options) {
|
|
|
1666
1668
|
s3 = peg$FAILED;
|
|
1667
1669
|
if (peg$silentFails === 0) peg$fail(peg$e13);
|
|
1668
1670
|
}
|
|
1669
|
-
if (s3 === peg$FAILED)
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1671
|
+
if (s3 === peg$FAILED) {
|
|
1672
|
+
if (input.substr(peg$currPos, 2) === peg$c8) {
|
|
1673
|
+
s3 = peg$c8;
|
|
1674
|
+
peg$currPos += 2;
|
|
1675
|
+
} else {
|
|
1676
|
+
s3 = peg$FAILED;
|
|
1677
|
+
if (peg$silentFails === 0) peg$fail(peg$e12);
|
|
1678
|
+
}
|
|
1675
1679
|
}
|
|
1676
1680
|
peg$silentFails--;
|
|
1677
1681
|
if (s3 === peg$FAILED) s2 = void 0;
|
|
@@ -3354,7 +3358,7 @@ var BLOCK_MACROS = new NameSet([
|
|
|
3354
3358
|
"nobr"
|
|
3355
3359
|
]);
|
|
3356
3360
|
/** Macros whose body is JavaScript source, kept verbatim. */
|
|
3357
|
-
var RAW_BODY_MACROS = new Set(["do"]);
|
|
3361
|
+
var RAW_BODY_MACROS = /* @__PURE__ */ new Set(["do"]);
|
|
3358
3362
|
/** Whether a macro's body is JavaScript, kept verbatim (`{do}`). */
|
|
3359
3363
|
function isRawMacro(name) {
|
|
3360
3364
|
return RAW_BODY_MACROS.has(name);
|
|
@@ -3364,7 +3368,7 @@ function isBlockMacro(name) {
|
|
|
3364
3368
|
return BLOCK_MACROS.has(name);
|
|
3365
3369
|
}
|
|
3366
3370
|
/** Macros whose branches render as one: the node holds one per branch. */
|
|
3367
|
-
var BRANCHING = new Set([
|
|
3371
|
+
var BRANCHING = /* @__PURE__ */ new Set([
|
|
3368
3372
|
"if",
|
|
3369
3373
|
"switch",
|
|
3370
3374
|
"timed"
|
|
@@ -4669,7 +4673,8 @@ function binop(name, prec) {
|
|
|
4669
4673
|
binop: prec
|
|
4670
4674
|
});
|
|
4671
4675
|
}
|
|
4672
|
-
var beforeExpr = { beforeExpr: true }
|
|
4676
|
+
var beforeExpr = { beforeExpr: true };
|
|
4677
|
+
var startsExpr = { startsExpr: true };
|
|
4673
4678
|
var keywords = {};
|
|
4674
4679
|
function kw(name, options) {
|
|
4675
4680
|
if (options === void 0) options = {};
|
|
@@ -4924,11 +4929,27 @@ function pushComment(options, array) {
|
|
|
4924
4929
|
array.push(comment);
|
|
4925
4930
|
};
|
|
4926
4931
|
}
|
|
4927
|
-
var SCOPE_TOP = 1
|
|
4932
|
+
var SCOPE_TOP = 1;
|
|
4933
|
+
var SCOPE_FUNCTION = 2;
|
|
4934
|
+
var SCOPE_ASYNC = 4;
|
|
4935
|
+
var SCOPE_GENERATOR = 8;
|
|
4936
|
+
var SCOPE_ARROW = 16;
|
|
4937
|
+
var SCOPE_SIMPLE_CATCH = 32;
|
|
4938
|
+
var SCOPE_SUPER = 64;
|
|
4939
|
+
var SCOPE_DIRECT_SUPER = 128;
|
|
4940
|
+
var SCOPE_CLASS_STATIC_BLOCK = 256;
|
|
4941
|
+
var SCOPE_CLASS_FIELD_INIT = 512;
|
|
4942
|
+
var SCOPE_SWITCH = 1024;
|
|
4943
|
+
var SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;
|
|
4928
4944
|
function functionFlags(async, generator) {
|
|
4929
4945
|
return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0);
|
|
4930
4946
|
}
|
|
4931
|
-
var BIND_NONE = 0
|
|
4947
|
+
var BIND_NONE = 0;
|
|
4948
|
+
var BIND_VAR = 1;
|
|
4949
|
+
var BIND_LEXICAL = 2;
|
|
4950
|
+
var BIND_FUNCTION = 3;
|
|
4951
|
+
var BIND_SIMPLE_CATCH = 4;
|
|
4952
|
+
var BIND_OUTSIDE = 5;
|
|
4932
4953
|
var Parser = function Parser(options, input, startPos) {
|
|
4933
4954
|
this.options = options = getOptions(options);
|
|
4934
4955
|
this.sourceFile = options.sourceFile;
|
|
@@ -5183,7 +5204,8 @@ pp$8.parseTopLevel = function(node) {
|
|
|
5183
5204
|
node.sourceType = this.options.sourceType === "commonjs" ? "script" : this.options.sourceType;
|
|
5184
5205
|
return this.finishNode(node, "Program");
|
|
5185
5206
|
};
|
|
5186
|
-
var loopLabel = { kind: "loop" }
|
|
5207
|
+
var loopLabel = { kind: "loop" };
|
|
5208
|
+
var switchLabel = { kind: "switch" };
|
|
5187
5209
|
pp$8.isLet = function(context) {
|
|
5188
5210
|
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) return false;
|
|
5189
5211
|
skipWhiteSpace.lastIndex = this.pos;
|
|
@@ -5612,7 +5634,9 @@ pp$8.parseVarId = function(decl, kind) {
|
|
|
5612
5634
|
decl.id = kind === "using" || kind === "await using" ? this.parseIdent() : this.parseBindingAtom();
|
|
5613
5635
|
this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
|
|
5614
5636
|
};
|
|
5615
|
-
var FUNC_STATEMENT = 1
|
|
5637
|
+
var FUNC_STATEMENT = 1;
|
|
5638
|
+
var FUNC_HANGING_STATEMENT = 2;
|
|
5639
|
+
var FUNC_NULLABLE_ID = 4;
|
|
5616
5640
|
pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {
|
|
5617
5641
|
this.initFunction(node);
|
|
5618
5642
|
if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
|
|
@@ -5687,13 +5711,17 @@ pp$8.parseClassElement = function(constructorAllowsSuper) {
|
|
|
5687
5711
|
else keyName = "static";
|
|
5688
5712
|
}
|
|
5689
5713
|
node.static = isStatic;
|
|
5690
|
-
if (!keyName && ecmaVersion >= 8 && this.eatContextual("async"))
|
|
5691
|
-
|
|
5714
|
+
if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) {
|
|
5715
|
+
if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) isAsync = true;
|
|
5716
|
+
else keyName = "async";
|
|
5717
|
+
}
|
|
5692
5718
|
if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) isGenerator = true;
|
|
5693
5719
|
if (!keyName && !isAsync && !isGenerator) {
|
|
5694
5720
|
var lastValue = this.value;
|
|
5695
|
-
if (this.eatContextual("get") || this.eatContextual("set"))
|
|
5696
|
-
|
|
5721
|
+
if (this.eatContextual("get") || this.eatContextual("set")) {
|
|
5722
|
+
if (this.isClassElementNameStart()) kind = lastValue;
|
|
5723
|
+
else keyName = lastValue;
|
|
5724
|
+
}
|
|
5697
5725
|
}
|
|
5698
5726
|
if (keyName) {
|
|
5699
5727
|
node.computed = false;
|
|
@@ -5786,8 +5814,10 @@ pp$8.exitClassBody = function() {
|
|
|
5786
5814
|
var parent = len === 0 ? null : this.privateNameStack[len - 1];
|
|
5787
5815
|
for (var i = 0; i < used.length; ++i) {
|
|
5788
5816
|
var id = used[i];
|
|
5789
|
-
if (!hasOwn(declared, id.name))
|
|
5790
|
-
|
|
5817
|
+
if (!hasOwn(declared, id.name)) {
|
|
5818
|
+
if (parent) parent.used.push(id);
|
|
5819
|
+
else this.raiseRecoverable(id.start, "Private field '#" + id.name + "' must be declared in an enclosing class");
|
|
5820
|
+
}
|
|
5791
5821
|
}
|
|
5792
5822
|
};
|
|
5793
5823
|
function isPrivateNameConflicted(privateNameMap, element) {
|
|
@@ -5809,10 +5839,12 @@ function checkKeyName(node, name) {
|
|
|
5809
5839
|
return !computed && (key.type === "Identifier" && key.name === name || key.type === "Literal" && key.value === name);
|
|
5810
5840
|
}
|
|
5811
5841
|
pp$8.parseExportAllDeclaration = function(node, exports$1) {
|
|
5812
|
-
if (this.options.ecmaVersion >= 11)
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5842
|
+
if (this.options.ecmaVersion >= 11) {
|
|
5843
|
+
if (this.eatContextual("as")) {
|
|
5844
|
+
node.exported = this.parseModuleExportName();
|
|
5845
|
+
this.checkExport(exports$1, node.exported, this.lastTokStart);
|
|
5846
|
+
} else node.exported = null;
|
|
5847
|
+
}
|
|
5816
5848
|
this.expectContextual("from");
|
|
5817
5849
|
if (this.type !== types$1.string) this.unexpected();
|
|
5818
5850
|
node.source = this.parseExprAtom();
|
|
@@ -6330,9 +6362,11 @@ pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
|
6330
6362
|
var kind = prop.kind;
|
|
6331
6363
|
if (this.options.ecmaVersion >= 6) {
|
|
6332
6364
|
if (name === "__proto__" && kind === "init") {
|
|
6333
|
-
if (propHash.proto)
|
|
6334
|
-
if (refDestructuringErrors
|
|
6335
|
-
|
|
6365
|
+
if (propHash.proto) {
|
|
6366
|
+
if (refDestructuringErrors) {
|
|
6367
|
+
if (refDestructuringErrors.doubleProto < 0) refDestructuringErrors.doubleProto = key.start;
|
|
6368
|
+
} else this.raiseRecoverable(key.start, "Redefinition of __proto__ property");
|
|
6369
|
+
}
|
|
6336
6370
|
propHash.proto = true;
|
|
6337
6371
|
}
|
|
6338
6372
|
return;
|
|
@@ -6366,8 +6400,10 @@ pp$5.parseExpression = function(forInit, refDestructuringErrors) {
|
|
|
6366
6400
|
});
|
|
6367
6401
|
};
|
|
6368
6402
|
pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
|
|
6369
|
-
if (this.isContextual("yield"))
|
|
6370
|
-
|
|
6403
|
+
if (this.isContextual("yield")) {
|
|
6404
|
+
if (this.inGenerator) return this.parseYield(forInit);
|
|
6405
|
+
else this.exprAllowed = false;
|
|
6406
|
+
}
|
|
6371
6407
|
var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1;
|
|
6372
6408
|
if (refDestructuringErrors) {
|
|
6373
6409
|
oldParenAssign = refDestructuringErrors.parenthesizedAssign;
|
|
@@ -6486,9 +6522,10 @@ pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
|
|
|
6486
6522
|
expr = this.finishNode(node$1, "UpdateExpression");
|
|
6487
6523
|
}
|
|
6488
6524
|
}
|
|
6489
|
-
if (!incDec && !(expr.type === "ArrowFunctionExpression" && expr.start === startPos) && this.eat(types$1.starstar))
|
|
6490
|
-
|
|
6491
|
-
|
|
6525
|
+
if (!incDec && !(expr.type === "ArrowFunctionExpression" && expr.start === startPos) && this.eat(types$1.starstar)) {
|
|
6526
|
+
if (sawUnary) this.unexpected(this.lastTokStart);
|
|
6527
|
+
else return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false, false, forInit), "**", false);
|
|
6528
|
+
} else return expr;
|
|
6492
6529
|
};
|
|
6493
6530
|
function isLocalVariableAccess(node) {
|
|
6494
6531
|
return node.type === "Identifier" || node.type === "ParenthesizedExpression" && isLocalVariableAccess(node.expression);
|
|
@@ -6686,17 +6723,18 @@ pp$5.parseExprImport = function(forNew) {
|
|
|
6686
6723
|
pp$5.parseDynamicImport = function(node) {
|
|
6687
6724
|
this.next();
|
|
6688
6725
|
node.source = this.parseMaybeAssign();
|
|
6689
|
-
if (this.options.ecmaVersion >= 16)
|
|
6690
|
-
this.
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
this.
|
|
6695
|
-
|
|
6696
|
-
|
|
6726
|
+
if (this.options.ecmaVersion >= 16) {
|
|
6727
|
+
if (!this.eat(types$1.parenR)) {
|
|
6728
|
+
this.expect(types$1.comma);
|
|
6729
|
+
if (!this.afterTrailingComma(types$1.parenR)) {
|
|
6730
|
+
node.options = this.parseMaybeAssign();
|
|
6731
|
+
if (!this.eat(types$1.parenR)) {
|
|
6732
|
+
this.expect(types$1.comma);
|
|
6733
|
+
if (!this.afterTrailingComma(types$1.parenR)) this.unexpected();
|
|
6734
|
+
}
|
|
6735
|
+
} else node.options = null;
|
|
6697
6736
|
} else node.options = null;
|
|
6698
|
-
} else
|
|
6699
|
-
else if (!this.eat(types$1.parenR)) {
|
|
6737
|
+
} else if (!this.eat(types$1.parenR)) {
|
|
6700
6738
|
var errorPos = this.start;
|
|
6701
6739
|
if (this.eat(types$1.comma) && this.eat(types$1.parenR)) this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
|
|
6702
6740
|
else this.unexpected(errorPos);
|
|
@@ -6930,12 +6968,14 @@ pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
6930
6968
|
} else this.unexpected();
|
|
6931
6969
|
};
|
|
6932
6970
|
pp$5.parsePropertyName = function(prop) {
|
|
6933
|
-
if (this.options.ecmaVersion >= 6)
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
|
|
6937
|
-
|
|
6938
|
-
|
|
6971
|
+
if (this.options.ecmaVersion >= 6) {
|
|
6972
|
+
if (this.eat(types$1.bracketL)) {
|
|
6973
|
+
prop.computed = true;
|
|
6974
|
+
prop.key = this.parseMaybeAssign();
|
|
6975
|
+
this.expect(types$1.bracketR);
|
|
6976
|
+
return prop.key;
|
|
6977
|
+
} else prop.computed = false;
|
|
6978
|
+
}
|
|
6939
6979
|
return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never");
|
|
6940
6980
|
};
|
|
6941
6981
|
pp$5.initFunction = function(node) {
|
|
@@ -7070,8 +7110,10 @@ pp$5.parsePrivateIdent = function() {
|
|
|
7070
7110
|
else this.unexpected();
|
|
7071
7111
|
this.next();
|
|
7072
7112
|
this.finishNode(node, "PrivateIdentifier");
|
|
7073
|
-
if (this.options.checkPrivateFields)
|
|
7074
|
-
|
|
7113
|
+
if (this.options.checkPrivateFields) {
|
|
7114
|
+
if (this.privateNameStack.length === 0) this.raise(node.start, "Private field '#" + node.name + "' must be declared in an enclosing class");
|
|
7115
|
+
else this.privateNameStack[this.privateNameStack.length - 1].used.push(node);
|
|
7116
|
+
}
|
|
7075
7117
|
return node;
|
|
7076
7118
|
};
|
|
7077
7119
|
pp$5.parseYield = function(forInit) {
|
|
@@ -7207,23 +7249,21 @@ var ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic";
|
|
|
7207
7249
|
var ecma11BinaryProperties = ecma10BinaryProperties;
|
|
7208
7250
|
var ecma12BinaryProperties = ecma11BinaryProperties + " EBase EComp EMod EPres ExtPict";
|
|
7209
7251
|
var ecma13BinaryProperties = ecma12BinaryProperties;
|
|
7210
|
-
var ecma14BinaryProperties = ecma13BinaryProperties;
|
|
7211
7252
|
var unicodeBinaryProperties = {
|
|
7212
7253
|
9: ecma9BinaryProperties,
|
|
7213
7254
|
10: ecma10BinaryProperties,
|
|
7214
7255
|
11: ecma11BinaryProperties,
|
|
7215
7256
|
12: ecma12BinaryProperties,
|
|
7216
7257
|
13: ecma13BinaryProperties,
|
|
7217
|
-
14:
|
|
7258
|
+
14: ecma13BinaryProperties
|
|
7218
7259
|
};
|
|
7219
|
-
var ecma14BinaryPropertiesOfStrings = "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji";
|
|
7220
7260
|
var unicodeBinaryPropertiesOfStrings = {
|
|
7221
7261
|
9: "",
|
|
7222
7262
|
10: "",
|
|
7223
7263
|
11: "",
|
|
7224
7264
|
12: "",
|
|
7225
7265
|
13: "",
|
|
7226
|
-
14:
|
|
7266
|
+
14: "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji"
|
|
7227
7267
|
};
|
|
7228
7268
|
var unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu";
|
|
7229
7269
|
var ecma9ScriptValues = "Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb";
|
|
@@ -7231,14 +7271,13 @@ var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Han
|
|
|
7231
7271
|
var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
|
|
7232
7272
|
var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi";
|
|
7233
7273
|
var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith";
|
|
7234
|
-
var ecma14ScriptValues = ecma13ScriptValues + " " + scriptValuesAddedInUnicode;
|
|
7235
7274
|
var unicodeScriptValues = {
|
|
7236
7275
|
9: ecma9ScriptValues,
|
|
7237
7276
|
10: ecma10ScriptValues,
|
|
7238
7277
|
11: ecma11ScriptValues,
|
|
7239
7278
|
12: ecma12ScriptValues,
|
|
7240
7279
|
13: ecma13ScriptValues,
|
|
7241
|
-
14:
|
|
7280
|
+
14: ecma13ScriptValues + " " + scriptValuesAddedInUnicode
|
|
7242
7281
|
};
|
|
7243
7282
|
var data = {};
|
|
7244
7283
|
function buildUnicodeData(ecmaVersion) {
|
|
@@ -7609,9 +7648,11 @@ pp$1.regexp_groupSpecifier = function(state) {
|
|
|
7609
7648
|
if (!this.regexp_eatGroupName(state)) state.raise("Invalid group");
|
|
7610
7649
|
var trackDisjunction = this.options.ecmaVersion >= 16;
|
|
7611
7650
|
var known = state.groupNames[state.lastStringValue];
|
|
7612
|
-
if (known)
|
|
7613
|
-
|
|
7614
|
-
|
|
7651
|
+
if (known) {
|
|
7652
|
+
if (trackDisjunction) {
|
|
7653
|
+
for (var i = 0, list = known; i < list.length; i += 1) if (!list[i].separatedFrom(state.branchID)) state.raise("Duplicate capture group name");
|
|
7654
|
+
} else state.raise("Duplicate capture group name");
|
|
7655
|
+
}
|
|
7615
7656
|
if (trackDisjunction) (known || (state.groupNames[state.lastStringValue] = [])).push(state.branchID);
|
|
7616
7657
|
else state.groupNames[state.lastStringValue] = true;
|
|
7617
7658
|
}
|
|
@@ -8625,12 +8666,14 @@ pp.readTmplToken = function() {
|
|
|
8625
8666
|
if (this.pos >= this.input.length) this.raise(this.start, "Unterminated template");
|
|
8626
8667
|
var ch = this.input.charCodeAt(this.pos);
|
|
8627
8668
|
if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) {
|
|
8628
|
-
if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate))
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8669
|
+
if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate)) {
|
|
8670
|
+
if (ch === 36) {
|
|
8671
|
+
this.pos += 2;
|
|
8672
|
+
return this.finishToken(types$1.dollarBraceL);
|
|
8673
|
+
} else {
|
|
8674
|
+
++this.pos;
|
|
8675
|
+
return this.finishToken(types$1.backQuote);
|
|
8676
|
+
}
|
|
8634
8677
|
}
|
|
8635
8678
|
out += this.input.slice(chunkStart, this.pos);
|
|
8636
8679
|
return this.finishToken(types$1.template, out);
|
|
@@ -8647,9 +8690,7 @@ pp.readTmplToken = function() {
|
|
|
8647
8690
|
case 10:
|
|
8648
8691
|
out += "\n";
|
|
8649
8692
|
break;
|
|
8650
|
-
default:
|
|
8651
|
-
out += String.fromCharCode(ch);
|
|
8652
|
-
break;
|
|
8693
|
+
default: out += String.fromCharCode(ch);
|
|
8653
8694
|
}
|
|
8654
8695
|
if (this.options.locations) {
|
|
8655
8696
|
++this.curLine;
|
|
@@ -8672,7 +8713,6 @@ pp.readInvalidTemplateToken = function() {
|
|
|
8672
8713
|
case "\u2029":
|
|
8673
8714
|
++this.curLine;
|
|
8674
8715
|
this.lineStart = this.pos + 1;
|
|
8675
|
-
break;
|
|
8676
8716
|
}
|
|
8677
8717
|
this.raise(this.start, "Unterminated template");
|
|
8678
8718
|
};
|
|
@@ -8831,7 +8871,7 @@ function notABody(src, pos) {
|
|
|
8831
8871
|
return NOT_A_BODY_RE.test(src);
|
|
8832
8872
|
}
|
|
8833
8873
|
/** Tokens that may end an operand, and so a statement before a line break. */
|
|
8834
|
-
var OPERAND_ENDS = new Set([
|
|
8874
|
+
var OPERAND_ENDS = /* @__PURE__ */ new Set([
|
|
8835
8875
|
types$1.name,
|
|
8836
8876
|
types$1.num,
|
|
8837
8877
|
types$1.string,
|
|
@@ -8957,13 +8997,13 @@ function transientAssignment(p, end) {
|
|
|
8957
8997
|
return false;
|
|
8958
8998
|
}
|
|
8959
8999
|
}
|
|
8960
|
-
var OPENERS = new Set([
|
|
9000
|
+
var OPENERS = /* @__PURE__ */ new Set([
|
|
8961
9001
|
types$1.parenL,
|
|
8962
9002
|
types$1.bracketL,
|
|
8963
9003
|
types$1.braceL,
|
|
8964
9004
|
types$1.dollarBraceL
|
|
8965
9005
|
]);
|
|
8966
|
-
var CLOSERS = new Set([
|
|
9006
|
+
var CLOSERS = /* @__PURE__ */ new Set([
|
|
8967
9007
|
types$1.parenR,
|
|
8968
9008
|
types$1.bracketR,
|
|
8969
9009
|
types$1.braceR
|
|
@@ -9260,7 +9300,7 @@ var WORD_RE$1 = /[\p{ID_Continue}$.]*/uy;
|
|
|
9260
9300
|
/** The flags after a regex literal, whatever they are. */
|
|
9261
9301
|
var FLAGS_RE = /[\p{ID_Continue}$]*/uy;
|
|
9262
9302
|
/** Words a string may follow with no space between (`of'x'`, `get"y"`). */
|
|
9263
|
-
var WORDS_BEFORE_STRING = new Set([
|
|
9303
|
+
var WORDS_BEFORE_STRING = /* @__PURE__ */ new Set([
|
|
9264
9304
|
"of",
|
|
9265
9305
|
"get",
|
|
9266
9306
|
"set",
|
|
@@ -10444,7 +10484,7 @@ function evaluatePassageName(expr, evaluate, { storyData, currentPassage }) {
|
|
|
10444
10484
|
return name;
|
|
10445
10485
|
}
|
|
10446
10486
|
/** The parameters of the built-in sub-macros that take arguments. */
|
|
10447
|
-
var SUB_MACRO_PARAMETERS = new Map([["option", [{
|
|
10487
|
+
var SUB_MACRO_PARAMETERS = /* @__PURE__ */ new Map([["option", [{
|
|
10448
10488
|
name: "value",
|
|
10449
10489
|
type: "string",
|
|
10450
10490
|
holds: "text",
|
|
@@ -10494,13 +10534,13 @@ function extentOf(piece) {
|
|
|
10494
10534
|
return piece.kind === "code" ? piece.code.length : piece.kind === "text" ? piece.text.length : piece.length;
|
|
10495
10535
|
}
|
|
10496
10536
|
/** Macros whose whole argument text is one expression: branch conditions. */
|
|
10497
|
-
var CONDITION_MACROS = new Set([
|
|
10537
|
+
var CONDITION_MACROS = /* @__PURE__ */ new Set([
|
|
10498
10538
|
"if",
|
|
10499
10539
|
"elseif",
|
|
10500
10540
|
"case"
|
|
10501
10541
|
]);
|
|
10502
10542
|
/** Block macros whose body is the name of a passage. */
|
|
10503
|
-
var PASSAGE_BODIES = new Set(["dialog"]);
|
|
10543
|
+
var PASSAGE_BODIES = /* @__PURE__ */ new Set(["dialog"]);
|
|
10504
10544
|
/**
|
|
10505
10545
|
* `params` with each `string` and `text` parameter (options too) saying
|
|
10506
10546
|
* what it holds: what it declares, else `holds`.
|
|
@@ -11108,18 +11148,19 @@ function widgetDefinitions$1(passages, parametersOf = registeredParameters) {
|
|
|
11108
11148
|
if (passage.name !== "StoryInit" && !passage.tags?.includes("widget")) continue;
|
|
11109
11149
|
const open = [];
|
|
11110
11150
|
const done = [];
|
|
11111
|
-
for (const token of tokenizeMarkupTolerant(passage.content).tokens) if (token.type === "macro" && token.name.toLowerCase() === "widget")
|
|
11112
|
-
token
|
|
11113
|
-
|
|
11114
|
-
|
|
11115
|
-
else {
|
|
11116
|
-
const def = open.pop();
|
|
11117
|
-
if (def) done.push({
|
|
11118
|
-
...def,
|
|
11119
|
-
closeStart: token.start
|
|
11151
|
+
for (const token of tokenizeMarkupTolerant(passage.content).tokens) if (token.type === "macro" && token.name.toLowerCase() === "widget") {
|
|
11152
|
+
if (!token.isClose) open.push({
|
|
11153
|
+
token,
|
|
11154
|
+
isBlock: false
|
|
11120
11155
|
});
|
|
11121
|
-
|
|
11122
|
-
|
|
11156
|
+
else {
|
|
11157
|
+
const def = open.pop();
|
|
11158
|
+
if (def) done.push({
|
|
11159
|
+
...def,
|
|
11160
|
+
closeStart: token.start
|
|
11161
|
+
});
|
|
11162
|
+
}
|
|
11163
|
+
} else if (open.length > 0 && (token.type === "variable" && token.scope === "local" && token.name === "children" || tokenTextContainsChildren(token, parametersOf))) open[open.length - 1].isBlock = true;
|
|
11123
11164
|
done.push(...open);
|
|
11124
11165
|
const defs = [];
|
|
11125
11166
|
for (const { token, isBlock, closeStart } of done) try {
|
|
@@ -11161,14 +11202,14 @@ function blockWidgetNames(passages, parametersOf = registeredParameters) {
|
|
|
11161
11202
|
* Passages that hold no markup: declarations, and the JavaScript function
|
|
11162
11203
|
* body of SaveTitle.
|
|
11163
11204
|
*/
|
|
11164
|
-
var NOT_MARKUP = new Set([
|
|
11205
|
+
var NOT_MARKUP = /* @__PURE__ */ new Set([
|
|
11165
11206
|
"StoryVariables",
|
|
11166
11207
|
"StoryTransients",
|
|
11167
11208
|
"SaveTitle"
|
|
11168
11209
|
]);
|
|
11169
11210
|
var NOT_MARKUP_TAGS$1 = ["script", "stylesheet"];
|
|
11170
11211
|
/** Branch macros, which their parent macro renders. */
|
|
11171
|
-
var BRANCH_MACROS = new Set([
|
|
11212
|
+
var BRANCH_MACROS = /* @__PURE__ */ new Set([
|
|
11172
11213
|
"elseif",
|
|
11173
11214
|
"else",
|
|
11174
11215
|
"case",
|
|
@@ -11636,7 +11677,7 @@ function declarationRegex(sigil) {
|
|
|
11636
11677
|
var VAR_PATH_RE = /([$%])(\w+(?:\.\w+)*)/y;
|
|
11637
11678
|
/** Quoted first argument of an input macro naming a story variable. */
|
|
11638
11679
|
var QUOTED_VAR_ARG_RE = /^["']\$(\w+(?:\.\w+)*)["']?$/;
|
|
11639
|
-
var VALID_VAR_TYPES = new Set([
|
|
11680
|
+
var VALID_VAR_TYPES = /* @__PURE__ */ new Set([
|
|
11640
11681
|
"number",
|
|
11641
11682
|
"string",
|
|
11642
11683
|
"boolean"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rohal12/spindle",
|
|
3
|
-
"version": "0.59.
|
|
3
|
+
"version": "0.59.26",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A Preact-based story format for Twine 2.",
|
|
6
6
|
"license": "Unlicense",
|
|
@@ -69,40 +69,39 @@
|
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"acorn": "^8.19.0",
|
|
72
|
-
"devalue": "^6",
|
|
73
|
-
"immer": "^11.1.
|
|
74
|
-
"micromark": "^4.0.
|
|
72
|
+
"devalue": "^6.0.2",
|
|
73
|
+
"immer": "^11.1.21",
|
|
74
|
+
"micromark": "^4.0.3",
|
|
75
75
|
"micromark-extension-gfm-strikethrough": "^2.1.0",
|
|
76
|
-
"micromark-extension-gfm-table": "^2.1.
|
|
77
|
-
"preact": "^
|
|
78
|
-
"zustand": "^5.0.
|
|
76
|
+
"micromark-extension-gfm-table": "^2.1.2",
|
|
77
|
+
"preact": "^11.0.1",
|
|
78
|
+
"zustand": "^5.0.15"
|
|
79
79
|
},
|
|
80
80
|
"lint-staged": {
|
|
81
81
|
"*": "prettier --write --ignore-unknown"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@fast-check/vitest": "^0.5.0",
|
|
85
|
-
"@preact/preset-vite": "^2.10.
|
|
86
|
-
"@rohal12/twee-ts": "^1.
|
|
87
|
-
"@types/
|
|
88
|
-
"@types/
|
|
89
|
-
"@
|
|
90
|
-
"@vitest/coverage-v8": "^4.1.2",
|
|
85
|
+
"@preact/preset-vite": "^2.10.6",
|
|
86
|
+
"@rohal12/twee-ts": "^1.18.2",
|
|
87
|
+
"@types/node": "^26.6.5",
|
|
88
|
+
"@types/react": "^19.3.0",
|
|
89
|
+
"@vitest/coverage-v8": "^5.0.3",
|
|
91
90
|
"fake-indexeddb": "^6.2.5",
|
|
92
|
-
"fallow": "3.
|
|
91
|
+
"fallow": "3.33.1",
|
|
93
92
|
"fast-check": "^4.10.2",
|
|
94
|
-
"happy-dom": "^20.
|
|
93
|
+
"happy-dom": "^20.14.6",
|
|
95
94
|
"husky": "^9.1.7",
|
|
96
|
-
"js-yaml": "^4.
|
|
97
|
-
"jscpd": "5.4.
|
|
98
|
-
"lint-staged": "^
|
|
95
|
+
"js-yaml": "^5.4.3",
|
|
96
|
+
"jscpd": "5.4.1",
|
|
97
|
+
"lint-staged": "^17.6.0",
|
|
99
98
|
"peggy": "5.1.0",
|
|
100
|
-
"playwright": "^1.
|
|
101
|
-
"prettier": "^3.
|
|
102
|
-
"typescript": "^
|
|
103
|
-
"vite": "^8.
|
|
104
|
-
"vite-plugin-singlefile": "^2.3.
|
|
99
|
+
"playwright": "^1.64.0",
|
|
100
|
+
"prettier": "^3.9.9",
|
|
101
|
+
"typescript": "^7.0.2",
|
|
102
|
+
"vite": "^8.3.4",
|
|
103
|
+
"vite-plugin-singlefile": "^2.3.3",
|
|
105
104
|
"vitepress": "^1.6.4",
|
|
106
|
-
"vitest": "^
|
|
105
|
+
"vitest": "^5.0.3"
|
|
107
106
|
}
|
|
108
107
|
}
|
|
@@ -41,7 +41,7 @@ export function logMacroError(
|
|
|
41
41
|
export function useRunOnce(macro: string, rawArgs: string, effect: () => void) {
|
|
42
42
|
// Unset until the effect has run. Boxed: anything can be thrown,
|
|
43
43
|
// including null and other falsy values.
|
|
44
|
-
const failure = useRef<{ error: unknown } | null>();
|
|
44
|
+
const failure = useRef<{ error: unknown } | null | undefined>(undefined);
|
|
45
45
|
if (failure.current === undefined) {
|
|
46
46
|
failure.current = null;
|
|
47
47
|
const location = currentSourceLocation();
|
|
@@ -112,8 +112,8 @@ export function SaveManagerContent() {
|
|
|
112
112
|
// Actions are async and may finish after the manager closed: once
|
|
113
113
|
// unmounted, no status is shown and no timer is left behind.
|
|
114
114
|
const mounted = useRef(true);
|
|
115
|
-
const statusTimer = useRef<number>();
|
|
116
|
-
const closeTimer = useRef<number>();
|
|
115
|
+
const statusTimer = useRef<number | undefined>(undefined);
|
|
116
|
+
const closeTimer = useRef<number | undefined>(undefined);
|
|
117
117
|
const showStatus = (text: string, type: 'success' | 'error' = 'success') => {
|
|
118
118
|
if (!mounted.current) return;
|
|
119
119
|
clearTimeout(statusTimer.current);
|
|
@@ -344,8 +344,7 @@ export function parseMacroArgs<const P extends readonly ParameterDef[]>(
|
|
|
344
344
|
|
|
345
345
|
/** What a `passage` argument is: a quoted name, or an expression. */
|
|
346
346
|
export type PassageTarget =
|
|
347
|
-
|
|
348
|
-
| { kind: 'expression'; expression: string };
|
|
347
|
+
{ kind: 'name'; name: string } | { kind: 'expression'; expression: string };
|
|
349
348
|
|
|
350
349
|
/**
|
|
351
350
|
* Read a `passage` argument as written (`{goto "Hall"}`, `{goto $room}`): a
|
package/src/execute-mutation.ts
CHANGED
|
@@ -340,9 +340,10 @@ export function routeStoreUpdate<S extends VariableNamespaces>(
|
|
|
340
340
|
const changes = NAMESPACES.flatMap((ns) => {
|
|
341
341
|
const own = patches.filter((p) => p.path[0] === ns);
|
|
342
342
|
return own.length
|
|
343
|
-
? writtenPaths(view[ns], next[ns], own).map(
|
|
344
|
-
|
|
345
|
-
|
|
343
|
+
? writtenPaths(view[ns], next[ns], own).map((change): PathChange => ({
|
|
344
|
+
...change,
|
|
345
|
+
path: [ns, ...change.path],
|
|
346
|
+
}))
|
|
346
347
|
: [];
|
|
347
348
|
});
|
|
348
349
|
// Each target takes its own copies, which share what the written values do,
|