@rohal12/spindle 0.64.24 → 0.64.25
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 +440 -195
- package/dist/pkg/story-variables.js +375 -174
- package/package.json +1 -1
- package/src/components/macros/PassageDisplay.tsx +75 -17
- package/src/markup/spindle.peggy +27 -14
- package/src/observe/observable-text.ts +26 -8
- package/src/utils/element-visibility.ts +13 -0
package/dist/pkg/headless.js
CHANGED
|
@@ -81,12 +81,23 @@ var NOT_TEXT = /* @__PURE__ */ new Set([
|
|
|
81
81
|
"template",
|
|
82
82
|
"noscript"
|
|
83
83
|
]);
|
|
84
|
+
var SVG_NOT_TEXT = /* @__PURE__ */ new Set([
|
|
85
|
+
"title",
|
|
86
|
+
"desc",
|
|
87
|
+
"metadata",
|
|
88
|
+
"defs",
|
|
89
|
+
"symbol",
|
|
90
|
+
"clippath",
|
|
91
|
+
"mask",
|
|
92
|
+
"pattern",
|
|
93
|
+
"marker"
|
|
94
|
+
]);
|
|
84
95
|
/**
|
|
85
96
|
* Whether the element hides its whole subtree, including stylesheet rules.
|
|
86
97
|
* This needs computed styles but no layout, so it also works headlessly.
|
|
87
98
|
*/
|
|
88
99
|
function isHidden(el) {
|
|
89
|
-
return el.hasAttribute("hidden") || el.getAttribute("aria-hidden") === "true" || /(^|;)\s*display\s*:\s*none\b/i.test(el.getAttribute("style") ?? "") || el.ownerDocument.defaultView?.getComputedStyle(el).display === "none" || NOT_TEXT.has(el.localName.toLowerCase()) || el.parentElement?.tagName === "DETAILS" && !el.parentElement.hasAttribute("open") && el !== Array.from(el.parentElement.children).find((c) => c.tagName === "SUMMARY");
|
|
100
|
+
return el.hasAttribute("hidden") || el.getAttribute("aria-hidden") === "true" || /(^|;)\s*display\s*:\s*none\b/i.test(el.getAttribute("style") ?? "") || el.ownerDocument.defaultView?.getComputedStyle(el).display === "none" || NOT_TEXT.has(el.localName.toLowerCase()) || el.namespaceURI === "http://www.w3.org/2000/svg" && SVG_NOT_TEXT.has(el.localName.toLowerCase()) || el.parentElement?.tagName === "DETAILS" && !el.parentElement.hasAttribute("open") && el !== Array.from(el.parentElement.children).find((c) => c.tagName === "SUMMARY");
|
|
90
101
|
}
|
|
91
102
|
/**
|
|
92
103
|
* Whether `el` is in a closed `<details>`, other than in the summary that
|
|
@@ -9953,9 +9964,9 @@ function peg$parse(input, options) {
|
|
|
9953
9964
|
const peg$c7 = "[";
|
|
9954
9965
|
const peg$c8 = "[[";
|
|
9955
9966
|
const peg$c9 = "]]";
|
|
9956
|
-
const peg$c10 = "
|
|
9967
|
+
const peg$c10 = "/";
|
|
9957
9968
|
const peg$c11 = "}";
|
|
9958
|
-
const peg$c12 = "
|
|
9969
|
+
const peg$c12 = " ";
|
|
9959
9970
|
const peg$c13 = "@";
|
|
9960
9971
|
const peg$c14 = ":";
|
|
9961
9972
|
const peg$c15 = "</";
|
|
@@ -9991,38 +10002,38 @@ function peg$parse(input, options) {
|
|
|
9991
10002
|
const peg$e11 = peg$literalExpectation("[", false);
|
|
9992
10003
|
const peg$e12 = peg$literalExpectation("[[", false);
|
|
9993
10004
|
const peg$e13 = peg$literalExpectation("]]", false);
|
|
9994
|
-
const peg$e14 = peg$literalExpectation("
|
|
9995
|
-
const peg$e15 = peg$classExpectation([
|
|
9996
|
-
|
|
10005
|
+
const peg$e14 = peg$literalExpectation("/", false);
|
|
10006
|
+
const peg$e15 = peg$classExpectation([
|
|
10007
|
+
"$",
|
|
10008
|
+
"_",
|
|
10009
|
+
"@",
|
|
10010
|
+
"%",
|
|
10011
|
+
"(",
|
|
10012
|
+
"!"
|
|
10013
|
+
], false, false, false);
|
|
10014
|
+
const peg$e16 = peg$literalExpectation("}", false);
|
|
10015
|
+
const peg$e17 = peg$literalExpectation(" ", false);
|
|
10016
|
+
const peg$e18 = peg$classExpectation([".", "#"], false, false, false);
|
|
10017
|
+
const peg$e19 = peg$classExpectation([
|
|
9997
10018
|
["a", "z"],
|
|
9998
10019
|
["A", "Z"],
|
|
9999
10020
|
["0", "9"],
|
|
10000
10021
|
"_",
|
|
10001
10022
|
"-"
|
|
10002
10023
|
], false, false, false);
|
|
10003
|
-
const peg$
|
|
10024
|
+
const peg$e20 = peg$classExpectation([
|
|
10004
10025
|
"$",
|
|
10005
10026
|
"_",
|
|
10006
10027
|
"@",
|
|
10007
10028
|
"%"
|
|
10008
10029
|
], false, false, false);
|
|
10009
|
-
const peg$
|
|
10030
|
+
const peg$e21 = peg$classExpectation([
|
|
10010
10031
|
["a", "z"],
|
|
10011
10032
|
["A", "Z"],
|
|
10012
10033
|
["0", "9"],
|
|
10013
10034
|
"_",
|
|
10014
10035
|
"."
|
|
10015
10036
|
], false, false, false);
|
|
10016
|
-
const peg$e19 = peg$literalExpectation("}", false);
|
|
10017
|
-
const peg$e20 = peg$classExpectation([
|
|
10018
|
-
"$",
|
|
10019
|
-
"_",
|
|
10020
|
-
"@",
|
|
10021
|
-
"%",
|
|
10022
|
-
"(",
|
|
10023
|
-
"!"
|
|
10024
|
-
], false, false, false);
|
|
10025
|
-
const peg$e21 = peg$literalExpectation("/", false);
|
|
10026
10037
|
const peg$e22 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false, false);
|
|
10027
10038
|
const peg$e23 = peg$classExpectation([
|
|
10028
10039
|
" ",
|
|
@@ -10296,7 +10307,7 @@ function peg$parse(input, options) {
|
|
|
10296
10307
|
return !textMode;
|
|
10297
10308
|
}
|
|
10298
10309
|
function peg$f34(ss, s, at, inner) {
|
|
10299
|
-
const link = lexeme("link", location(), parseLink(inner, at, (separator) => linkSeparatorIndex(inner, at, separator)));
|
|
10310
|
+
const link = lexeme("link", location(), parseLink(inner.value, at, (separator) => linkSeparatorIndex(inner.value, at, separator, inner.spans)));
|
|
10300
10311
|
link.selectorSpan = selectorSpan(s, ss, at);
|
|
10301
10312
|
return withSelectors(link, s);
|
|
10302
10313
|
}
|
|
@@ -10306,22 +10317,56 @@ function peg$parse(input, options) {
|
|
|
10306
10317
|
function peg$f36() {
|
|
10307
10318
|
fail("Unclosed link: [[ without ]]", location(), "unclosed-link");
|
|
10308
10319
|
}
|
|
10309
|
-
function peg$f37(
|
|
10320
|
+
function peg$f37(start) {
|
|
10321
|
+
const close = input.indexOf("]]", start);
|
|
10322
|
+
const nested = input.indexOf("[[", start);
|
|
10323
|
+
linkTextEnd = Math.min(close < 0 ? input.length : close, nested < 0 ? input.length : nested);
|
|
10324
|
+
return true;
|
|
10325
|
+
}
|
|
10326
|
+
function peg$f38(start, part) {
|
|
10327
|
+
return typeof part === "string" ? null : part;
|
|
10328
|
+
}
|
|
10329
|
+
function peg$f39(start, parts, end) {
|
|
10330
|
+
return {
|
|
10331
|
+
value: input.slice(start, end),
|
|
10332
|
+
spans: parts.filter(Boolean)
|
|
10333
|
+
};
|
|
10334
|
+
}
|
|
10335
|
+
function peg$f40(start, end) {
|
|
10336
|
+
return {
|
|
10337
|
+
start,
|
|
10338
|
+
end
|
|
10339
|
+
};
|
|
10340
|
+
}
|
|
10341
|
+
function peg$f41(start, codeStart, nameEnd) {
|
|
10342
|
+
const close = hooks.closeBrace(input, nameEnd, codeStart);
|
|
10343
|
+
return close >= 0 && close < linkTextEnd && skipTo(close);
|
|
10344
|
+
}
|
|
10345
|
+
function peg$f42(start, codeStart, nameEnd) {
|
|
10346
|
+
return skipEnd - offset();
|
|
10347
|
+
}
|
|
10348
|
+
function peg$f43(start, codeStart, nameEnd, end) {
|
|
10349
|
+
return {
|
|
10350
|
+
start,
|
|
10351
|
+
end
|
|
10352
|
+
};
|
|
10353
|
+
}
|
|
10354
|
+
function peg$f44(parts) {
|
|
10310
10355
|
return selectorsOf(parts);
|
|
10311
10356
|
}
|
|
10312
|
-
function peg$
|
|
10357
|
+
function peg$f45() {
|
|
10313
10358
|
return NO_SELECTORS;
|
|
10314
10359
|
}
|
|
10315
|
-
function peg$
|
|
10360
|
+
function peg$f46(s, end) {
|
|
10316
10361
|
return {
|
|
10317
10362
|
...s,
|
|
10318
10363
|
end
|
|
10319
10364
|
};
|
|
10320
10365
|
}
|
|
10321
|
-
function peg$
|
|
10366
|
+
function peg$f47(prefix, name) {
|
|
10322
10367
|
return [prefix, name];
|
|
10323
10368
|
}
|
|
10324
|
-
function peg$
|
|
10369
|
+
function peg$f48(ss, s, sigil, nameStart, name) {
|
|
10325
10370
|
const variable = lexeme("variable", location(), {
|
|
10326
10371
|
name,
|
|
10327
10372
|
nameStart,
|
|
@@ -10331,7 +10376,7 @@ function peg$parse(input, options) {
|
|
|
10331
10376
|
variable.selectorSpan = selectorSpan(s, ss, nameStart - 1);
|
|
10332
10377
|
return withSelectors(variable, s);
|
|
10333
10378
|
}
|
|
10334
|
-
function peg$
|
|
10379
|
+
function peg$f49(ss, s, after, expression) {
|
|
10335
10380
|
const node = lexeme("expression", location(), {
|
|
10336
10381
|
expression,
|
|
10337
10382
|
expressionStart: after,
|
|
@@ -10340,33 +10385,33 @@ function peg$parse(input, options) {
|
|
|
10340
10385
|
node.selectorSpan = selectorSpan(s, ss, after);
|
|
10341
10386
|
return withSelectors(node, s);
|
|
10342
10387
|
}
|
|
10343
|
-
function peg$
|
|
10388
|
+
function peg$f50() {
|
|
10344
10389
|
fail("Unclosed {" + input.substr(location().end.offset, 1) + "…: no } ends it", location(), "unclosed-expression");
|
|
10345
10390
|
}
|
|
10346
|
-
function peg$
|
|
10391
|
+
function peg$f51(start) {
|
|
10347
10392
|
const end = hooks.closeBrace(input, start, start);
|
|
10348
10393
|
return skipTo(end < 0 && completionMode ? input.length : end);
|
|
10349
10394
|
}
|
|
10350
|
-
function peg$
|
|
10395
|
+
function peg$f52(start) {
|
|
10351
10396
|
return skipEnd - offset();
|
|
10352
10397
|
}
|
|
10353
|
-
function peg$
|
|
10398
|
+
function peg$f53(start, code) {
|
|
10354
10399
|
return code;
|
|
10355
10400
|
}
|
|
10356
|
-
function peg$
|
|
10401
|
+
function peg$f54() {
|
|
10357
10402
|
return completionMode;
|
|
10358
10403
|
}
|
|
10359
|
-
function peg$
|
|
10404
|
+
function peg$f55(ss, s, start, close, name, nameEnd) {
|
|
10360
10405
|
const end = hooks.closeBrace(input, nameEnd, start);
|
|
10361
10406
|
return skipTo(end < 0 && completionMode ? input.length : end);
|
|
10362
10407
|
}
|
|
10363
|
-
function peg$
|
|
10408
|
+
function peg$f56(ss, s, start, close, name, nameEnd) {
|
|
10364
10409
|
return skipEnd - offset();
|
|
10365
10410
|
}
|
|
10366
|
-
function peg$
|
|
10411
|
+
function peg$f57(ss, s, start, close, name, nameEnd, args) {
|
|
10367
10412
|
return args;
|
|
10368
10413
|
}
|
|
10369
|
-
function peg$
|
|
10414
|
+
function peg$f58(ss, s, start, close, name, nameEnd, tail) {
|
|
10370
10415
|
const loc = location();
|
|
10371
10416
|
const lower = name.toLowerCase();
|
|
10372
10417
|
const tag = lexeme("macro", loc, {
|
|
@@ -10392,19 +10437,19 @@ function peg$parse(input, options) {
|
|
|
10392
10437
|
}
|
|
10393
10438
|
return tag;
|
|
10394
10439
|
}
|
|
10395
|
-
function peg$
|
|
10440
|
+
function peg$f59(s) {
|
|
10396
10441
|
fail("A closing tag starts with a letter after {/", location(), "invalid-closer");
|
|
10397
10442
|
}
|
|
10398
|
-
function peg$
|
|
10443
|
+
function peg$f60(value) {
|
|
10399
10444
|
return EMAIL_AUTOLINK.test(value);
|
|
10400
10445
|
}
|
|
10401
|
-
function peg$
|
|
10446
|
+
function peg$f61(value) {
|
|
10402
10447
|
return lexeme("text", location(), { value });
|
|
10403
10448
|
}
|
|
10404
|
-
function peg$
|
|
10449
|
+
function peg$f62(value) {
|
|
10405
10450
|
return lexeme("text", location(), { value });
|
|
10406
10451
|
}
|
|
10407
|
-
function peg$
|
|
10452
|
+
function peg$f63(tagStart, tag, list, slash) {
|
|
10408
10453
|
const lower = tag.toLowerCase();
|
|
10409
10454
|
return lexeme("html", location(), {
|
|
10410
10455
|
tag,
|
|
@@ -10417,7 +10462,7 @@ function peg$parse(input, options) {
|
|
|
10417
10462
|
isSelfClose: !!slash || VOID_TAGS.has(lower)
|
|
10418
10463
|
});
|
|
10419
10464
|
}
|
|
10420
|
-
function peg$
|
|
10465
|
+
function peg$f64(tag, bad) {
|
|
10421
10466
|
const c = input.charAt(bad);
|
|
10422
10467
|
if (!c) fail("Unclosed tag <" + tag + ": no > ends it (write < for a < that starts no tag)", location(), "unclosed-tag");
|
|
10423
10468
|
const at = {
|
|
@@ -10435,7 +10480,7 @@ function peg$parse(input, options) {
|
|
|
10435
10480
|
};
|
|
10436
10481
|
fail("Unexpected " + JSON.stringify(c) + " in the tag <" + tag + ">: expected an attribute, or > to end the tag", at, "unexpected-character");
|
|
10437
10482
|
}
|
|
10438
|
-
function peg$
|
|
10483
|
+
function peg$f65(tagStart, tag) {
|
|
10439
10484
|
return lexeme("html", location(), {
|
|
10440
10485
|
tag,
|
|
10441
10486
|
lower: tag.toLowerCase(),
|
|
@@ -10447,14 +10492,14 @@ function peg$parse(input, options) {
|
|
|
10447
10492
|
isSelfClose: false
|
|
10448
10493
|
});
|
|
10449
10494
|
}
|
|
10450
|
-
function peg$
|
|
10495
|
+
function peg$f66(nameStart, name) {
|
|
10451
10496
|
attrCode = hooks.isCodeAttribute(name);
|
|
10452
10497
|
return true;
|
|
10453
10498
|
}
|
|
10454
|
-
function peg$
|
|
10499
|
+
function peg$f67(nameStart, name, v) {
|
|
10455
10500
|
return v;
|
|
10456
10501
|
}
|
|
10457
|
-
function peg$
|
|
10502
|
+
function peg$f68(nameStart, name, value) {
|
|
10458
10503
|
const attribute = {
|
|
10459
10504
|
name,
|
|
10460
10505
|
value: value ? value.value : "",
|
|
@@ -10468,7 +10513,7 @@ function peg$parse(input, options) {
|
|
|
10468
10513
|
}
|
|
10469
10514
|
return attribute;
|
|
10470
10515
|
}
|
|
10471
|
-
function peg$
|
|
10516
|
+
function peg$f69(start, value, end) {
|
|
10472
10517
|
return {
|
|
10473
10518
|
value,
|
|
10474
10519
|
start,
|
|
@@ -10476,7 +10521,7 @@ function peg$parse(input, options) {
|
|
|
10476
10521
|
quote: "\""
|
|
10477
10522
|
};
|
|
10478
10523
|
}
|
|
10479
|
-
function peg$
|
|
10524
|
+
function peg$f70(start, value, end) {
|
|
10480
10525
|
return {
|
|
10481
10526
|
value,
|
|
10482
10527
|
start,
|
|
@@ -10484,36 +10529,36 @@ function peg$parse(input, options) {
|
|
|
10484
10529
|
quote: "'"
|
|
10485
10530
|
};
|
|
10486
10531
|
}
|
|
10487
|
-
function peg$
|
|
10532
|
+
function peg$f71(q) {
|
|
10488
10533
|
fail("Unclosed attribute value: the " + q + " here has no closing " + q, location(), "unclosed-attribute");
|
|
10489
10534
|
}
|
|
10490
|
-
function peg$
|
|
10535
|
+
function peg$f72(start, value, end) {
|
|
10491
10536
|
return {
|
|
10492
10537
|
value,
|
|
10493
10538
|
start,
|
|
10494
10539
|
end
|
|
10495
10540
|
};
|
|
10496
10541
|
}
|
|
10497
|
-
function peg$
|
|
10542
|
+
function peg$f73() {
|
|
10498
10543
|
return !attrCode;
|
|
10499
10544
|
}
|
|
10500
|
-
function peg$
|
|
10545
|
+
function peg$f74(bs) {
|
|
10501
10546
|
return bs.length % 2 === 1;
|
|
10502
10547
|
}
|
|
10503
|
-
function peg$
|
|
10548
|
+
function peg$f75() {
|
|
10504
10549
|
return !attrCode;
|
|
10505
10550
|
}
|
|
10506
|
-
function peg$
|
|
10551
|
+
function peg$f76(start, nameEnd) {
|
|
10507
10552
|
const end = hooks.closeBrace(input, nameEnd, start);
|
|
10508
10553
|
return skipTo(end < 0 && completionMode ? input.length : end);
|
|
10509
10554
|
}
|
|
10510
|
-
function peg$
|
|
10555
|
+
function peg$f77(start, nameEnd) {
|
|
10511
10556
|
return skipEnd - offset();
|
|
10512
10557
|
}
|
|
10513
|
-
function peg$
|
|
10558
|
+
function peg$f78() {
|
|
10514
10559
|
return !attrCode;
|
|
10515
10560
|
}
|
|
10516
|
-
function peg$
|
|
10561
|
+
function peg$f79() {
|
|
10517
10562
|
return attrCode;
|
|
10518
10563
|
}
|
|
10519
10564
|
let peg$currPos = options.peg$currPos | 0;
|
|
@@ -11284,20 +11329,23 @@ function peg$parse(input, options) {
|
|
|
11284
11329
|
s4 = peg$parseSelectors();
|
|
11285
11330
|
if (s4 !== peg$FAILED) {
|
|
11286
11331
|
s5 = peg$parseHere();
|
|
11287
|
-
s6 = peg$
|
|
11288
|
-
|
|
11289
|
-
|
|
11290
|
-
|
|
11291
|
-
|
|
11292
|
-
|
|
11293
|
-
|
|
11294
|
-
|
|
11295
|
-
|
|
11296
|
-
|
|
11297
|
-
|
|
11298
|
-
|
|
11299
|
-
|
|
11300
|
-
|
|
11332
|
+
s6 = peg$parseLinkText();
|
|
11333
|
+
if (s6 !== peg$FAILED) {
|
|
11334
|
+
if (input.substr(peg$currPos, 2) === peg$c9) {
|
|
11335
|
+
s7 = peg$c9;
|
|
11336
|
+
peg$currPos += 2;
|
|
11337
|
+
} else {
|
|
11338
|
+
s7 = peg$FAILED;
|
|
11339
|
+
if (peg$silentFails === 0) peg$fail(peg$e13);
|
|
11340
|
+
}
|
|
11341
|
+
if (s7 === peg$FAILED) s7 = peg$parseOpenEnd();
|
|
11342
|
+
if (s7 !== peg$FAILED) {
|
|
11343
|
+
peg$savedPos = s0;
|
|
11344
|
+
s0 = peg$f34(s3, s4, s5, s6);
|
|
11345
|
+
} else {
|
|
11346
|
+
peg$currPos = s0;
|
|
11347
|
+
s0 = peg$FAILED;
|
|
11348
|
+
}
|
|
11301
11349
|
} else {
|
|
11302
11350
|
peg$currPos = s0;
|
|
11303
11351
|
s0 = peg$FAILED;
|
|
@@ -11343,55 +11391,224 @@ function peg$parse(input, options) {
|
|
|
11343
11391
|
return s0;
|
|
11344
11392
|
}
|
|
11345
11393
|
function peg$parseLinkText() {
|
|
11346
|
-
let s0, s1, s2, s3;
|
|
11347
|
-
s0 =
|
|
11348
|
-
|
|
11349
|
-
|
|
11350
|
-
|
|
11351
|
-
|
|
11352
|
-
|
|
11353
|
-
|
|
11354
|
-
|
|
11355
|
-
|
|
11356
|
-
|
|
11357
|
-
|
|
11358
|
-
|
|
11359
|
-
|
|
11360
|
-
|
|
11361
|
-
s3 = peg$c8;
|
|
11394
|
+
let s0, s1, s2, s3, s4, s5, s6;
|
|
11395
|
+
s0 = peg$currPos;
|
|
11396
|
+
s1 = peg$parseHere();
|
|
11397
|
+
peg$savedPos = peg$currPos;
|
|
11398
|
+
s2 = peg$f37(s1);
|
|
11399
|
+
if (s2) s2 = void 0;
|
|
11400
|
+
else s2 = peg$FAILED;
|
|
11401
|
+
if (s2 !== peg$FAILED) {
|
|
11402
|
+
s3 = [];
|
|
11403
|
+
for (;;) {
|
|
11404
|
+
s4 = peg$currPos;
|
|
11405
|
+
s5 = peg$currPos;
|
|
11406
|
+
peg$silentFails++;
|
|
11407
|
+
if (input.substr(peg$currPos, 2) === peg$c9) {
|
|
11408
|
+
s6 = peg$c9;
|
|
11362
11409
|
peg$currPos += 2;
|
|
11363
11410
|
} else {
|
|
11364
|
-
|
|
11365
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
11411
|
+
s6 = peg$FAILED;
|
|
11412
|
+
if (peg$silentFails === 0) peg$fail(peg$e13);
|
|
11413
|
+
}
|
|
11414
|
+
if (s6 === peg$FAILED) {
|
|
11415
|
+
if (input.substr(peg$currPos, 2) === peg$c8) {
|
|
11416
|
+
s6 = peg$c8;
|
|
11417
|
+
peg$currPos += 2;
|
|
11418
|
+
} else {
|
|
11419
|
+
s6 = peg$FAILED;
|
|
11420
|
+
if (peg$silentFails === 0) peg$fail(peg$e12);
|
|
11421
|
+
}
|
|
11366
11422
|
}
|
|
11423
|
+
peg$silentFails--;
|
|
11424
|
+
if (s6 === peg$FAILED) s5 = void 0;
|
|
11425
|
+
else {
|
|
11426
|
+
peg$currPos = s5;
|
|
11427
|
+
s5 = peg$FAILED;
|
|
11428
|
+
}
|
|
11429
|
+
if (s5 !== peg$FAILED) {
|
|
11430
|
+
s6 = peg$parseLinkLabelCode();
|
|
11431
|
+
if (s6 === peg$FAILED) {
|
|
11432
|
+
if (input.length > peg$currPos) {
|
|
11433
|
+
s6 = input.charAt(peg$currPos);
|
|
11434
|
+
peg$currPos++;
|
|
11435
|
+
} else {
|
|
11436
|
+
s6 = peg$FAILED;
|
|
11437
|
+
if (peg$silentFails === 0) peg$fail(peg$e0);
|
|
11438
|
+
}
|
|
11439
|
+
}
|
|
11440
|
+
if (s6 !== peg$FAILED) {
|
|
11441
|
+
peg$savedPos = s4;
|
|
11442
|
+
s4 = peg$f38(s1, s6);
|
|
11443
|
+
} else {
|
|
11444
|
+
peg$currPos = s4;
|
|
11445
|
+
s4 = peg$FAILED;
|
|
11446
|
+
}
|
|
11447
|
+
} else {
|
|
11448
|
+
peg$currPos = s4;
|
|
11449
|
+
s4 = peg$FAILED;
|
|
11450
|
+
}
|
|
11451
|
+
if (s4 === peg$FAILED) break;
|
|
11452
|
+
s3.push(s4);
|
|
11367
11453
|
}
|
|
11368
|
-
peg$
|
|
11369
|
-
|
|
11454
|
+
s4 = peg$parseHere();
|
|
11455
|
+
peg$savedPos = s0;
|
|
11456
|
+
s0 = peg$f39(s1, s3, s4);
|
|
11457
|
+
} else {
|
|
11458
|
+
peg$currPos = s0;
|
|
11459
|
+
s0 = peg$FAILED;
|
|
11460
|
+
}
|
|
11461
|
+
return s0;
|
|
11462
|
+
}
|
|
11463
|
+
function peg$parseLinkLabelCode() {
|
|
11464
|
+
let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12;
|
|
11465
|
+
s0 = peg$currPos;
|
|
11466
|
+
s1 = peg$parseHere();
|
|
11467
|
+
if (input.charCodeAt(peg$currPos) === 92) {
|
|
11468
|
+
s2 = peg$c4;
|
|
11469
|
+
peg$currPos++;
|
|
11470
|
+
} else {
|
|
11471
|
+
s2 = peg$FAILED;
|
|
11472
|
+
if (peg$silentFails === 0) peg$fail(peg$e6);
|
|
11473
|
+
}
|
|
11474
|
+
if (s2 !== peg$FAILED) {
|
|
11475
|
+
s3 = input.charAt(peg$currPos);
|
|
11476
|
+
if (peg$charCode = s3.charCodeAt(0), peg$charCode === 123 || peg$charCode === 125) peg$currPos++;
|
|
11370
11477
|
else {
|
|
11371
|
-
|
|
11478
|
+
s3 = peg$FAILED;
|
|
11479
|
+
if (peg$silentFails === 0) peg$fail(peg$e7);
|
|
11480
|
+
}
|
|
11481
|
+
if (s3 !== peg$FAILED) {
|
|
11482
|
+
s4 = peg$parseHere();
|
|
11483
|
+
peg$savedPos = s0;
|
|
11484
|
+
s0 = peg$f40(s1, s4);
|
|
11485
|
+
} else {
|
|
11486
|
+
peg$currPos = s0;
|
|
11487
|
+
s0 = peg$FAILED;
|
|
11488
|
+
}
|
|
11489
|
+
} else {
|
|
11490
|
+
peg$currPos = s0;
|
|
11491
|
+
s0 = peg$FAILED;
|
|
11492
|
+
}
|
|
11493
|
+
if (s0 === peg$FAILED) {
|
|
11494
|
+
s0 = peg$currPos;
|
|
11495
|
+
s1 = peg$parseHere();
|
|
11496
|
+
if (input.charCodeAt(peg$currPos) === 123) {
|
|
11497
|
+
s2 = peg$c5;
|
|
11498
|
+
peg$currPos++;
|
|
11499
|
+
} else {
|
|
11372
11500
|
s2 = peg$FAILED;
|
|
11501
|
+
if (peg$silentFails === 0) peg$fail(peg$e8);
|
|
11373
11502
|
}
|
|
11374
11503
|
if (s2 !== peg$FAILED) {
|
|
11375
|
-
|
|
11376
|
-
s3 = input.charAt(peg$currPos);
|
|
11377
|
-
peg$currPos++;
|
|
11378
|
-
} else {
|
|
11379
|
-
s3 = peg$FAILED;
|
|
11380
|
-
if (peg$silentFails === 0) peg$fail(peg$e0);
|
|
11381
|
-
}
|
|
11504
|
+
s3 = peg$parseSelectors();
|
|
11382
11505
|
if (s3 !== peg$FAILED) {
|
|
11383
|
-
|
|
11384
|
-
|
|
11506
|
+
s4 = peg$parseHere();
|
|
11507
|
+
s5 = peg$currPos;
|
|
11508
|
+
if (input.charCodeAt(peg$currPos) === 47) {
|
|
11509
|
+
s6 = peg$c10;
|
|
11510
|
+
peg$currPos++;
|
|
11511
|
+
} else {
|
|
11512
|
+
s6 = peg$FAILED;
|
|
11513
|
+
if (peg$silentFails === 0) peg$fail(peg$e14);
|
|
11514
|
+
}
|
|
11515
|
+
if (s6 === peg$FAILED) s6 = null;
|
|
11516
|
+
s7 = peg$parseMacroName();
|
|
11517
|
+
if (s7 !== peg$FAILED) {
|
|
11518
|
+
s6 = [s6, s7];
|
|
11519
|
+
s5 = s6;
|
|
11520
|
+
} else {
|
|
11521
|
+
peg$currPos = s5;
|
|
11522
|
+
s5 = peg$FAILED;
|
|
11523
|
+
}
|
|
11524
|
+
if (s5 === peg$FAILED) {
|
|
11525
|
+
s5 = peg$currPos;
|
|
11526
|
+
peg$silentFails++;
|
|
11527
|
+
s6 = input.charAt(peg$currPos);
|
|
11528
|
+
if (peg$charCode = s6.charCodeAt(0), peg$charCode === 36 || peg$charCode === 95 || peg$charCode === 64 || peg$charCode === 37 || peg$charCode === 40 || peg$charCode === 33) peg$currPos++;
|
|
11529
|
+
else {
|
|
11530
|
+
s6 = peg$FAILED;
|
|
11531
|
+
if (peg$silentFails === 0) peg$fail(peg$e15);
|
|
11532
|
+
}
|
|
11533
|
+
peg$silentFails--;
|
|
11534
|
+
if (s6 !== peg$FAILED) {
|
|
11535
|
+
peg$currPos = s5;
|
|
11536
|
+
s5 = void 0;
|
|
11537
|
+
} else s5 = peg$FAILED;
|
|
11538
|
+
}
|
|
11539
|
+
if (s5 !== peg$FAILED) {
|
|
11540
|
+
s6 = peg$parseHere();
|
|
11541
|
+
peg$savedPos = peg$currPos;
|
|
11542
|
+
s7 = peg$f41(s1, s4, s6);
|
|
11543
|
+
if (s7) s7 = void 0;
|
|
11544
|
+
else s7 = peg$FAILED;
|
|
11545
|
+
if (s7 !== peg$FAILED) {
|
|
11546
|
+
s8 = peg$currPos;
|
|
11547
|
+
s9 = peg$f42(s1, s4, s6);
|
|
11548
|
+
s10 = peg$currPos;
|
|
11549
|
+
s11 = [];
|
|
11550
|
+
if (s11.length >= (s9 | 0)) s12 = peg$FAILED;
|
|
11551
|
+
else if (input.length > peg$currPos) {
|
|
11552
|
+
s12 = input.charAt(peg$currPos);
|
|
11553
|
+
peg$currPos++;
|
|
11554
|
+
} else {
|
|
11555
|
+
s12 = peg$FAILED;
|
|
11556
|
+
if (peg$silentFails === 0) peg$fail(peg$e0);
|
|
11557
|
+
}
|
|
11558
|
+
while (s12 !== peg$FAILED) {
|
|
11559
|
+
s11.push(s12);
|
|
11560
|
+
if (s11.length >= (s9 | 0)) s12 = peg$FAILED;
|
|
11561
|
+
else if (input.length > peg$currPos) {
|
|
11562
|
+
s12 = input.charAt(peg$currPos);
|
|
11563
|
+
peg$currPos++;
|
|
11564
|
+
} else {
|
|
11565
|
+
s12 = peg$FAILED;
|
|
11566
|
+
if (peg$silentFails === 0) peg$fail(peg$e0);
|
|
11567
|
+
}
|
|
11568
|
+
}
|
|
11569
|
+
if (s11.length < (s9 | 0)) {
|
|
11570
|
+
peg$currPos = s10;
|
|
11571
|
+
s10 = peg$FAILED;
|
|
11572
|
+
} else s10 = s11;
|
|
11573
|
+
s9 = s10;
|
|
11574
|
+
if (s9 !== peg$FAILED) s8 = input.substring(s8, peg$currPos);
|
|
11575
|
+
else s8 = s9;
|
|
11576
|
+
if (s8 !== peg$FAILED) {
|
|
11577
|
+
if (input.charCodeAt(peg$currPos) === 125) {
|
|
11578
|
+
s9 = peg$c11;
|
|
11579
|
+
peg$currPos++;
|
|
11580
|
+
} else {
|
|
11581
|
+
s9 = peg$FAILED;
|
|
11582
|
+
if (peg$silentFails === 0) peg$fail(peg$e16);
|
|
11583
|
+
}
|
|
11584
|
+
if (s9 !== peg$FAILED) {
|
|
11585
|
+
s10 = peg$parseHere();
|
|
11586
|
+
peg$savedPos = s0;
|
|
11587
|
+
s0 = peg$f43(s1, s4, s6, s10);
|
|
11588
|
+
} else {
|
|
11589
|
+
peg$currPos = s0;
|
|
11590
|
+
s0 = peg$FAILED;
|
|
11591
|
+
}
|
|
11592
|
+
} else {
|
|
11593
|
+
peg$currPos = s0;
|
|
11594
|
+
s0 = peg$FAILED;
|
|
11595
|
+
}
|
|
11596
|
+
} else {
|
|
11597
|
+
peg$currPos = s0;
|
|
11598
|
+
s0 = peg$FAILED;
|
|
11599
|
+
}
|
|
11600
|
+
} else {
|
|
11601
|
+
peg$currPos = s0;
|
|
11602
|
+
s0 = peg$FAILED;
|
|
11603
|
+
}
|
|
11385
11604
|
} else {
|
|
11386
|
-
peg$currPos =
|
|
11387
|
-
|
|
11605
|
+
peg$currPos = s0;
|
|
11606
|
+
s0 = peg$FAILED;
|
|
11388
11607
|
}
|
|
11389
11608
|
} else {
|
|
11390
|
-
peg$currPos =
|
|
11391
|
-
|
|
11609
|
+
peg$currPos = s0;
|
|
11610
|
+
s0 = peg$FAILED;
|
|
11392
11611
|
}
|
|
11393
|
-
if (s1 === peg$FAILED) break;
|
|
11394
|
-
s0.push(s1);
|
|
11395
11612
|
}
|
|
11396
11613
|
return s0;
|
|
11397
11614
|
}
|
|
@@ -11407,15 +11624,15 @@ function peg$parse(input, options) {
|
|
|
11407
11624
|
if (s1.length < 1) s1 = peg$FAILED;
|
|
11408
11625
|
if (s1 !== peg$FAILED) {
|
|
11409
11626
|
if (input.charCodeAt(peg$currPos) === 32) {
|
|
11410
|
-
s2 = peg$
|
|
11627
|
+
s2 = peg$c12;
|
|
11411
11628
|
peg$currPos++;
|
|
11412
11629
|
} else {
|
|
11413
11630
|
s2 = peg$FAILED;
|
|
11414
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
11631
|
+
if (peg$silentFails === 0) peg$fail(peg$e17);
|
|
11415
11632
|
}
|
|
11416
11633
|
if (s2 === peg$FAILED) s2 = null;
|
|
11417
11634
|
peg$savedPos = s0;
|
|
11418
|
-
s0 = peg$
|
|
11635
|
+
s0 = peg$f44(s1);
|
|
11419
11636
|
} else {
|
|
11420
11637
|
peg$currPos = s0;
|
|
11421
11638
|
s0 = peg$FAILED;
|
|
@@ -11424,7 +11641,7 @@ function peg$parse(input, options) {
|
|
|
11424
11641
|
s0 = peg$currPos;
|
|
11425
11642
|
s1 = "";
|
|
11426
11643
|
peg$savedPos = s0;
|
|
11427
|
-
s1 = peg$
|
|
11644
|
+
s1 = peg$f45();
|
|
11428
11645
|
s0 = s1;
|
|
11429
11646
|
}
|
|
11430
11647
|
return s0;
|
|
@@ -11448,7 +11665,7 @@ function peg$parse(input, options) {
|
|
|
11448
11665
|
s3.push(s4);
|
|
11449
11666
|
}
|
|
11450
11667
|
peg$savedPos = s0;
|
|
11451
|
-
s0 = peg$
|
|
11668
|
+
s0 = peg$f46(s1, s2);
|
|
11452
11669
|
} else {
|
|
11453
11670
|
peg$currPos = s0;
|
|
11454
11671
|
s0 = peg$FAILED;
|
|
@@ -11462,7 +11679,7 @@ function peg$parse(input, options) {
|
|
|
11462
11679
|
if (peg$charCode = s1.charCodeAt(0), peg$charCode === 46 || peg$charCode === 35) peg$currPos++;
|
|
11463
11680
|
else {
|
|
11464
11681
|
s1 = peg$FAILED;
|
|
11465
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
11682
|
+
if (peg$silentFails === 0) peg$fail(peg$e18);
|
|
11466
11683
|
}
|
|
11467
11684
|
if (s1 !== peg$FAILED) {
|
|
11468
11685
|
s2 = peg$currPos;
|
|
@@ -11474,7 +11691,7 @@ function peg$parse(input, options) {
|
|
|
11474
11691
|
}
|
|
11475
11692
|
s2 = input.substring(s2, peg$currPos);
|
|
11476
11693
|
peg$savedPos = s0;
|
|
11477
|
-
s0 = peg$
|
|
11694
|
+
s0 = peg$f47(s1, s2);
|
|
11478
11695
|
} else {
|
|
11479
11696
|
peg$currPos = s0;
|
|
11480
11697
|
s0 = peg$FAILED;
|
|
@@ -11487,7 +11704,7 @@ function peg$parse(input, options) {
|
|
|
11487
11704
|
if (peg$charCode = s0.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 95 || peg$charCode === 45) peg$currPos++;
|
|
11488
11705
|
else {
|
|
11489
11706
|
s0 = peg$FAILED;
|
|
11490
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
11707
|
+
if (peg$silentFails === 0) peg$fail(peg$e19);
|
|
11491
11708
|
}
|
|
11492
11709
|
if (s0 === peg$FAILED) {
|
|
11493
11710
|
s0 = peg$currPos;
|
|
@@ -11503,7 +11720,7 @@ function peg$parse(input, options) {
|
|
|
11503
11720
|
if (peg$charCode = s2.charCodeAt(0), peg$charCode === 36 || peg$charCode === 95 || peg$charCode === 64 || peg$charCode === 37) peg$currPos++;
|
|
11504
11721
|
else {
|
|
11505
11722
|
s2 = peg$FAILED;
|
|
11506
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
11723
|
+
if (peg$silentFails === 0) peg$fail(peg$e20);
|
|
11507
11724
|
}
|
|
11508
11725
|
if (s2 !== peg$FAILED) {
|
|
11509
11726
|
s3 = [];
|
|
@@ -11512,7 +11729,7 @@ function peg$parse(input, options) {
|
|
|
11512
11729
|
if (peg$charCode = s4.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 95 || peg$charCode === 46) peg$currPos++;
|
|
11513
11730
|
else {
|
|
11514
11731
|
s4 = peg$FAILED;
|
|
11515
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
11732
|
+
if (peg$silentFails === 0) peg$fail(peg$e21);
|
|
11516
11733
|
}
|
|
11517
11734
|
if (s4 === peg$FAILED) break;
|
|
11518
11735
|
s3.push(s4);
|
|
@@ -11522,7 +11739,7 @@ function peg$parse(input, options) {
|
|
|
11522
11739
|
peg$currPos++;
|
|
11523
11740
|
} else {
|
|
11524
11741
|
s4 = peg$FAILED;
|
|
11525
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
11742
|
+
if (peg$silentFails === 0) peg$fail(peg$e16);
|
|
11526
11743
|
}
|
|
11527
11744
|
if (s4 !== peg$FAILED) {
|
|
11528
11745
|
s1 = [
|
|
@@ -11565,7 +11782,7 @@ function peg$parse(input, options) {
|
|
|
11565
11782
|
if (peg$charCode = s4.charCodeAt(0), peg$charCode === 36 || peg$charCode === 95 || peg$charCode === 64 || peg$charCode === 37) peg$currPos++;
|
|
11566
11783
|
else {
|
|
11567
11784
|
s4 = peg$FAILED;
|
|
11568
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
11785
|
+
if (peg$silentFails === 0) peg$fail(peg$e20);
|
|
11569
11786
|
}
|
|
11570
11787
|
if (s4 !== peg$FAILED) {
|
|
11571
11788
|
s5 = peg$parseHere();
|
|
@@ -11576,7 +11793,7 @@ function peg$parse(input, options) {
|
|
|
11576
11793
|
if (peg$charCode = s8.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 95 || peg$charCode === 46) peg$currPos++;
|
|
11577
11794
|
else {
|
|
11578
11795
|
s8 = peg$FAILED;
|
|
11579
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
11796
|
+
if (peg$silentFails === 0) peg$fail(peg$e21);
|
|
11580
11797
|
}
|
|
11581
11798
|
if (s8 === peg$FAILED) break;
|
|
11582
11799
|
s7.push(s8);
|
|
@@ -11585,7 +11802,7 @@ function peg$parse(input, options) {
|
|
|
11585
11802
|
s7 = peg$parseBraceEnd();
|
|
11586
11803
|
if (s7 !== peg$FAILED) {
|
|
11587
11804
|
peg$savedPos = s0;
|
|
11588
|
-
s0 = peg$
|
|
11805
|
+
s0 = peg$f48(s2, s3, s4, s5, s6);
|
|
11589
11806
|
} else {
|
|
11590
11807
|
peg$currPos = s0;
|
|
11591
11808
|
s0 = peg$FAILED;
|
|
@@ -11622,7 +11839,7 @@ function peg$parse(input, options) {
|
|
|
11622
11839
|
if (peg$charCode = s6.charCodeAt(0), peg$charCode === 36 || peg$charCode === 95 || peg$charCode === 64 || peg$charCode === 37 || peg$charCode === 40 || peg$charCode === 33) peg$currPos++;
|
|
11623
11840
|
else {
|
|
11624
11841
|
s6 = peg$FAILED;
|
|
11625
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
11842
|
+
if (peg$silentFails === 0) peg$fail(peg$e15);
|
|
11626
11843
|
}
|
|
11627
11844
|
peg$silentFails--;
|
|
11628
11845
|
if (s6 !== peg$FAILED) {
|
|
@@ -11635,7 +11852,7 @@ function peg$parse(input, options) {
|
|
|
11635
11852
|
s7 = peg$parseBraceEnd();
|
|
11636
11853
|
if (s7 !== peg$FAILED) {
|
|
11637
11854
|
peg$savedPos = s0;
|
|
11638
|
-
s0 = peg$
|
|
11855
|
+
s0 = peg$f49(s2, s3, s4, s6);
|
|
11639
11856
|
} else {
|
|
11640
11857
|
peg$currPos = s0;
|
|
11641
11858
|
s0 = peg$FAILED;
|
|
@@ -11674,7 +11891,7 @@ function peg$parse(input, options) {
|
|
|
11674
11891
|
if (peg$charCode = s4.charCodeAt(0), peg$charCode === 36 || peg$charCode === 95 || peg$charCode === 64 || peg$charCode === 37 || peg$charCode === 40 || peg$charCode === 33) peg$currPos++;
|
|
11675
11892
|
else {
|
|
11676
11893
|
s4 = peg$FAILED;
|
|
11677
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
11894
|
+
if (peg$silentFails === 0) peg$fail(peg$e15);
|
|
11678
11895
|
}
|
|
11679
11896
|
peg$silentFails--;
|
|
11680
11897
|
if (s4 !== peg$FAILED) {
|
|
@@ -11683,7 +11900,7 @@ function peg$parse(input, options) {
|
|
|
11683
11900
|
} else s3 = peg$FAILED;
|
|
11684
11901
|
if (s3 !== peg$FAILED) {
|
|
11685
11902
|
peg$savedPos = s0;
|
|
11686
|
-
s0 = peg$
|
|
11903
|
+
s0 = peg$f50();
|
|
11687
11904
|
} else {
|
|
11688
11905
|
peg$currPos = s0;
|
|
11689
11906
|
s0 = peg$FAILED;
|
|
@@ -11705,12 +11922,12 @@ function peg$parse(input, options) {
|
|
|
11705
11922
|
s0 = peg$currPos;
|
|
11706
11923
|
s1 = peg$parseHere();
|
|
11707
11924
|
peg$savedPos = peg$currPos;
|
|
11708
|
-
s2 = peg$
|
|
11925
|
+
s2 = peg$f51(s1);
|
|
11709
11926
|
if (s2) s2 = void 0;
|
|
11710
11927
|
else s2 = peg$FAILED;
|
|
11711
11928
|
if (s2 !== peg$FAILED) {
|
|
11712
11929
|
s3 = peg$currPos;
|
|
11713
|
-
s4 = peg$
|
|
11930
|
+
s4 = peg$f52(s1);
|
|
11714
11931
|
s5 = peg$currPos;
|
|
11715
11932
|
s6 = [];
|
|
11716
11933
|
if (s6.length >= (s4 | 0)) s7 = peg$FAILED;
|
|
@@ -11741,7 +11958,7 @@ function peg$parse(input, options) {
|
|
|
11741
11958
|
else s3 = s4;
|
|
11742
11959
|
if (s3 !== peg$FAILED) {
|
|
11743
11960
|
peg$savedPos = s0;
|
|
11744
|
-
s0 = peg$
|
|
11961
|
+
s0 = peg$f53(s1, s3);
|
|
11745
11962
|
} else {
|
|
11746
11963
|
peg$currPos = s0;
|
|
11747
11964
|
s0 = peg$FAILED;
|
|
@@ -11756,7 +11973,7 @@ function peg$parse(input, options) {
|
|
|
11756
11973
|
let s0, s1, s2, s3;
|
|
11757
11974
|
s0 = peg$currPos;
|
|
11758
11975
|
peg$savedPos = peg$currPos;
|
|
11759
|
-
s1 = peg$
|
|
11976
|
+
s1 = peg$f54();
|
|
11760
11977
|
if (s1) s1 = void 0;
|
|
11761
11978
|
else s1 = peg$FAILED;
|
|
11762
11979
|
if (s1 !== peg$FAILED) {
|
|
@@ -11795,7 +12012,7 @@ function peg$parse(input, options) {
|
|
|
11795
12012
|
peg$currPos++;
|
|
11796
12013
|
} else {
|
|
11797
12014
|
s0 = peg$FAILED;
|
|
11798
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
12015
|
+
if (peg$silentFails === 0) peg$fail(peg$e16);
|
|
11799
12016
|
}
|
|
11800
12017
|
if (s0 === peg$FAILED) s0 = peg$parseOpenEnd();
|
|
11801
12018
|
return s0;
|
|
@@ -11816,11 +12033,11 @@ function peg$parse(input, options) {
|
|
|
11816
12033
|
if (s3 !== peg$FAILED) {
|
|
11817
12034
|
s4 = peg$parseHere();
|
|
11818
12035
|
if (input.charCodeAt(peg$currPos) === 47) {
|
|
11819
|
-
s5 = peg$
|
|
12036
|
+
s5 = peg$c10;
|
|
11820
12037
|
peg$currPos++;
|
|
11821
12038
|
} else {
|
|
11822
12039
|
s5 = peg$FAILED;
|
|
11823
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
12040
|
+
if (peg$silentFails === 0) peg$fail(peg$e14);
|
|
11824
12041
|
}
|
|
11825
12042
|
if (s5 === peg$FAILED) s5 = null;
|
|
11826
12043
|
s6 = peg$parseMacroName();
|
|
@@ -11828,12 +12045,12 @@ function peg$parse(input, options) {
|
|
|
11828
12045
|
s7 = peg$parseHere();
|
|
11829
12046
|
s8 = peg$currPos;
|
|
11830
12047
|
peg$savedPos = peg$currPos;
|
|
11831
|
-
s9 = peg$
|
|
12048
|
+
s9 = peg$f55(s2, s3, s4, s5, s6, s7);
|
|
11832
12049
|
if (s9) s9 = void 0;
|
|
11833
12050
|
else s9 = peg$FAILED;
|
|
11834
12051
|
if (s9 !== peg$FAILED) {
|
|
11835
12052
|
s10 = peg$currPos;
|
|
11836
|
-
s11 = peg$
|
|
12053
|
+
s11 = peg$f56(s2, s3, s4, s5, s6, s7);
|
|
11837
12054
|
s12 = peg$currPos;
|
|
11838
12055
|
s13 = [];
|
|
11839
12056
|
if (s13.length >= (s11 | 0)) s14 = peg$FAILED;
|
|
@@ -11866,7 +12083,7 @@ function peg$parse(input, options) {
|
|
|
11866
12083
|
s11 = peg$parseBraceEnd();
|
|
11867
12084
|
if (s11 !== peg$FAILED) {
|
|
11868
12085
|
peg$savedPos = s8;
|
|
11869
|
-
s8 = peg$
|
|
12086
|
+
s8 = peg$f57(s2, s3, s4, s5, s6, s7, s10);
|
|
11870
12087
|
} else {
|
|
11871
12088
|
peg$currPos = s8;
|
|
11872
12089
|
s8 = peg$FAILED;
|
|
@@ -11881,7 +12098,7 @@ function peg$parse(input, options) {
|
|
|
11881
12098
|
}
|
|
11882
12099
|
if (s8 === peg$FAILED) s8 = null;
|
|
11883
12100
|
peg$savedPos = s0;
|
|
11884
|
-
s0 = peg$
|
|
12101
|
+
s0 = peg$f58(s2, s3, s4, s5, s6, s7, s8);
|
|
11885
12102
|
} else {
|
|
11886
12103
|
peg$currPos = s0;
|
|
11887
12104
|
s0 = peg$FAILED;
|
|
@@ -11907,15 +12124,15 @@ function peg$parse(input, options) {
|
|
|
11907
12124
|
s2 = peg$parseSelectors();
|
|
11908
12125
|
if (s2 !== peg$FAILED) {
|
|
11909
12126
|
if (input.charCodeAt(peg$currPos) === 47) {
|
|
11910
|
-
s3 = peg$
|
|
12127
|
+
s3 = peg$c10;
|
|
11911
12128
|
peg$currPos++;
|
|
11912
12129
|
} else {
|
|
11913
12130
|
s3 = peg$FAILED;
|
|
11914
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
12131
|
+
if (peg$silentFails === 0) peg$fail(peg$e14);
|
|
11915
12132
|
}
|
|
11916
12133
|
if (s3 !== peg$FAILED) {
|
|
11917
12134
|
peg$savedPos = s0;
|
|
11918
|
-
s0 = peg$
|
|
12135
|
+
s0 = peg$f59(s2);
|
|
11919
12136
|
} else {
|
|
11920
12137
|
peg$currPos = s0;
|
|
11921
12138
|
s0 = peg$FAILED;
|
|
@@ -12050,12 +12267,12 @@ function peg$parse(input, options) {
|
|
|
12050
12267
|
else s1 = s2;
|
|
12051
12268
|
if (s1 !== peg$FAILED) {
|
|
12052
12269
|
peg$savedPos = peg$currPos;
|
|
12053
|
-
s2 = peg$
|
|
12270
|
+
s2 = peg$f60(s1);
|
|
12054
12271
|
if (s2) s2 = void 0;
|
|
12055
12272
|
else s2 = peg$FAILED;
|
|
12056
12273
|
if (s2 !== peg$FAILED) {
|
|
12057
12274
|
peg$savedPos = s0;
|
|
12058
|
-
s0 = peg$
|
|
12275
|
+
s0 = peg$f61(s1);
|
|
12059
12276
|
} else {
|
|
12060
12277
|
peg$currPos = s0;
|
|
12061
12278
|
s0 = peg$FAILED;
|
|
@@ -12199,7 +12416,7 @@ function peg$parse(input, options) {
|
|
|
12199
12416
|
else s1 = s2;
|
|
12200
12417
|
if (s1 !== peg$FAILED) {
|
|
12201
12418
|
peg$savedPos = s0;
|
|
12202
|
-
s1 = peg$
|
|
12419
|
+
s1 = peg$f62(s1);
|
|
12203
12420
|
}
|
|
12204
12421
|
s0 = s1;
|
|
12205
12422
|
return s0;
|
|
@@ -12226,11 +12443,11 @@ function peg$parse(input, options) {
|
|
|
12226
12443
|
}
|
|
12227
12444
|
s5 = peg$parse_();
|
|
12228
12445
|
if (input.charCodeAt(peg$currPos) === 47) {
|
|
12229
|
-
s6 = peg$
|
|
12446
|
+
s6 = peg$c10;
|
|
12230
12447
|
peg$currPos++;
|
|
12231
12448
|
} else {
|
|
12232
12449
|
s6 = peg$FAILED;
|
|
12233
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
12450
|
+
if (peg$silentFails === 0) peg$fail(peg$e14);
|
|
12234
12451
|
}
|
|
12235
12452
|
if (s6 === peg$FAILED) s6 = null;
|
|
12236
12453
|
if (input.charCodeAt(peg$currPos) === 62) {
|
|
@@ -12243,7 +12460,7 @@ function peg$parse(input, options) {
|
|
|
12243
12460
|
if (s7 === peg$FAILED) s7 = peg$parseOpenEnd();
|
|
12244
12461
|
if (s7 !== peg$FAILED) {
|
|
12245
12462
|
peg$savedPos = s0;
|
|
12246
|
-
s0 = peg$
|
|
12463
|
+
s0 = peg$f63(s2, s3, s4, s6);
|
|
12247
12464
|
} else {
|
|
12248
12465
|
peg$currPos = s0;
|
|
12249
12466
|
s0 = peg$FAILED;
|
|
@@ -12308,7 +12525,7 @@ function peg$parse(input, options) {
|
|
|
12308
12525
|
s5 = peg$parse_();
|
|
12309
12526
|
s6 = peg$parseHere();
|
|
12310
12527
|
peg$savedPos = s0;
|
|
12311
|
-
s0 = peg$
|
|
12528
|
+
s0 = peg$f64(s2, s6);
|
|
12312
12529
|
} else {
|
|
12313
12530
|
peg$currPos = s0;
|
|
12314
12531
|
s0 = peg$FAILED;
|
|
@@ -12348,7 +12565,7 @@ function peg$parse(input, options) {
|
|
|
12348
12565
|
}
|
|
12349
12566
|
if (s5 !== peg$FAILED) {
|
|
12350
12567
|
peg$savedPos = s0;
|
|
12351
|
-
s0 = peg$
|
|
12568
|
+
s0 = peg$f65(s2, s3);
|
|
12352
12569
|
} else {
|
|
12353
12570
|
peg$currPos = s0;
|
|
12354
12571
|
s0 = peg$FAILED;
|
|
@@ -12445,7 +12662,7 @@ function peg$parse(input, options) {
|
|
|
12445
12662
|
else s3 = s4;
|
|
12446
12663
|
if (s3 !== peg$FAILED) {
|
|
12447
12664
|
peg$savedPos = peg$currPos;
|
|
12448
|
-
s4 = peg$
|
|
12665
|
+
s4 = peg$f66(s2, s3);
|
|
12449
12666
|
if (s4) s4 = void 0;
|
|
12450
12667
|
else s4 = peg$FAILED;
|
|
12451
12668
|
if (s4 !== peg$FAILED) {
|
|
@@ -12463,7 +12680,7 @@ function peg$parse(input, options) {
|
|
|
12463
12680
|
s9 = peg$parseAttrValue();
|
|
12464
12681
|
if (s9 !== peg$FAILED) {
|
|
12465
12682
|
peg$savedPos = s5;
|
|
12466
|
-
s5 = peg$
|
|
12683
|
+
s5 = peg$f67(s2, s3, s9);
|
|
12467
12684
|
} else {
|
|
12468
12685
|
peg$currPos = s5;
|
|
12469
12686
|
s5 = peg$FAILED;
|
|
@@ -12474,7 +12691,7 @@ function peg$parse(input, options) {
|
|
|
12474
12691
|
}
|
|
12475
12692
|
if (s5 === peg$FAILED) s5 = null;
|
|
12476
12693
|
peg$savedPos = s0;
|
|
12477
|
-
s0 = peg$
|
|
12694
|
+
s0 = peg$f68(s2, s3, s5);
|
|
12478
12695
|
} else {
|
|
12479
12696
|
peg$currPos = s0;
|
|
12480
12697
|
s0 = peg$FAILED;
|
|
@@ -12524,7 +12741,7 @@ function peg$parse(input, options) {
|
|
|
12524
12741
|
if (s5 === peg$FAILED) s5 = peg$parseOpenEnd();
|
|
12525
12742
|
if (s5 !== peg$FAILED) {
|
|
12526
12743
|
peg$savedPos = s0;
|
|
12527
|
-
s0 = peg$
|
|
12744
|
+
s0 = peg$f69(s2, s3, s4);
|
|
12528
12745
|
} else {
|
|
12529
12746
|
peg$currPos = s0;
|
|
12530
12747
|
s0 = peg$FAILED;
|
|
@@ -12571,7 +12788,7 @@ function peg$parse(input, options) {
|
|
|
12571
12788
|
if (s5 === peg$FAILED) s5 = peg$parseOpenEnd();
|
|
12572
12789
|
if (s5 !== peg$FAILED) {
|
|
12573
12790
|
peg$savedPos = s0;
|
|
12574
|
-
s0 = peg$
|
|
12791
|
+
s0 = peg$f70(s2, s3, s4);
|
|
12575
12792
|
} else {
|
|
12576
12793
|
peg$currPos = s0;
|
|
12577
12794
|
s0 = peg$FAILED;
|
|
@@ -12590,7 +12807,7 @@ function peg$parse(input, options) {
|
|
|
12590
12807
|
}
|
|
12591
12808
|
if (s1 !== peg$FAILED) {
|
|
12592
12809
|
peg$savedPos = s0;
|
|
12593
|
-
s1 = peg$
|
|
12810
|
+
s1 = peg$f71(s1);
|
|
12594
12811
|
}
|
|
12595
12812
|
s0 = s1;
|
|
12596
12813
|
if (s0 === peg$FAILED) {
|
|
@@ -12611,7 +12828,7 @@ function peg$parse(input, options) {
|
|
|
12611
12828
|
s2 = input.substring(s2, peg$currPos);
|
|
12612
12829
|
s3 = peg$parseHere();
|
|
12613
12830
|
peg$savedPos = s0;
|
|
12614
|
-
s0 = peg$
|
|
12831
|
+
s0 = peg$f72(s1, s2, s3);
|
|
12615
12832
|
}
|
|
12616
12833
|
}
|
|
12617
12834
|
}
|
|
@@ -12621,7 +12838,7 @@ function peg$parse(input, options) {
|
|
|
12621
12838
|
let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13;
|
|
12622
12839
|
s0 = peg$currPos;
|
|
12623
12840
|
peg$savedPos = peg$currPos;
|
|
12624
|
-
s1 = peg$
|
|
12841
|
+
s1 = peg$f73();
|
|
12625
12842
|
if (s1) s1 = void 0;
|
|
12626
12843
|
else s1 = peg$FAILED;
|
|
12627
12844
|
if (s1 !== peg$FAILED) {
|
|
@@ -12644,7 +12861,7 @@ function peg$parse(input, options) {
|
|
|
12644
12861
|
if (s2 !== peg$FAILED) {
|
|
12645
12862
|
s3 = peg$currPos;
|
|
12646
12863
|
peg$savedPos = peg$currPos;
|
|
12647
|
-
s4 = peg$
|
|
12864
|
+
s4 = peg$f74(s2);
|
|
12648
12865
|
if (s4) s4 = void 0;
|
|
12649
12866
|
else s4 = peg$FAILED;
|
|
12650
12867
|
if (s4 !== peg$FAILED) {
|
|
@@ -12683,7 +12900,7 @@ function peg$parse(input, options) {
|
|
|
12683
12900
|
if (s0 === peg$FAILED) {
|
|
12684
12901
|
s0 = peg$currPos;
|
|
12685
12902
|
peg$savedPos = peg$currPos;
|
|
12686
|
-
s1 = peg$
|
|
12903
|
+
s1 = peg$f75();
|
|
12687
12904
|
if (s1) s1 = void 0;
|
|
12688
12905
|
else s1 = peg$FAILED;
|
|
12689
12906
|
if (s1 !== peg$FAILED) {
|
|
@@ -12699,23 +12916,23 @@ function peg$parse(input, options) {
|
|
|
12699
12916
|
if (s3 !== peg$FAILED) {
|
|
12700
12917
|
s4 = peg$parseHere();
|
|
12701
12918
|
if (input.charCodeAt(peg$currPos) === 47) {
|
|
12702
|
-
s5 = peg$
|
|
12919
|
+
s5 = peg$c10;
|
|
12703
12920
|
peg$currPos++;
|
|
12704
12921
|
} else {
|
|
12705
12922
|
s5 = peg$FAILED;
|
|
12706
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
12923
|
+
if (peg$silentFails === 0) peg$fail(peg$e14);
|
|
12707
12924
|
}
|
|
12708
12925
|
if (s5 === peg$FAILED) s5 = null;
|
|
12709
12926
|
s6 = peg$parseMacroName();
|
|
12710
12927
|
if (s6 !== peg$FAILED) {
|
|
12711
12928
|
s7 = peg$parseHere();
|
|
12712
12929
|
peg$savedPos = peg$currPos;
|
|
12713
|
-
s8 = peg$
|
|
12930
|
+
s8 = peg$f76(s4, s7);
|
|
12714
12931
|
if (s8) s8 = void 0;
|
|
12715
12932
|
else s8 = peg$FAILED;
|
|
12716
12933
|
if (s8 !== peg$FAILED) {
|
|
12717
12934
|
s9 = peg$currPos;
|
|
12718
|
-
s10 = peg$
|
|
12935
|
+
s10 = peg$f77(s4, s7);
|
|
12719
12936
|
s11 = peg$currPos;
|
|
12720
12937
|
s12 = [];
|
|
12721
12938
|
if (s12.length >= (s10 | 0)) s13 = peg$FAILED;
|
|
@@ -12791,7 +13008,7 @@ function peg$parse(input, options) {
|
|
|
12791
13008
|
if (s0 === peg$FAILED) {
|
|
12792
13009
|
s0 = peg$currPos;
|
|
12793
13010
|
peg$savedPos = peg$currPos;
|
|
12794
|
-
s1 = peg$
|
|
13011
|
+
s1 = peg$f78();
|
|
12795
13012
|
if (s1) s1 = void 0;
|
|
12796
13013
|
else s1 = peg$FAILED;
|
|
12797
13014
|
if (s1 !== peg$FAILED) {
|
|
@@ -12809,11 +13026,11 @@ function peg$parse(input, options) {
|
|
|
12809
13026
|
peg$silentFails++;
|
|
12810
13027
|
s5 = peg$currPos;
|
|
12811
13028
|
if (input.charCodeAt(peg$currPos) === 47) {
|
|
12812
|
-
s6 = peg$
|
|
13029
|
+
s6 = peg$c10;
|
|
12813
13030
|
peg$currPos++;
|
|
12814
13031
|
} else {
|
|
12815
13032
|
s6 = peg$FAILED;
|
|
12816
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
13033
|
+
if (peg$silentFails === 0) peg$fail(peg$e14);
|
|
12817
13034
|
}
|
|
12818
13035
|
if (s6 === peg$FAILED) s6 = null;
|
|
12819
13036
|
s7 = input.charAt(peg$currPos);
|
|
@@ -12876,7 +13093,7 @@ function peg$parse(input, options) {
|
|
|
12876
13093
|
if (s0 === peg$FAILED) {
|
|
12877
13094
|
s0 = peg$currPos;
|
|
12878
13095
|
peg$savedPos = peg$currPos;
|
|
12879
|
-
s1 = peg$
|
|
13096
|
+
s1 = peg$f79();
|
|
12880
13097
|
if (s1) s1 = void 0;
|
|
12881
13098
|
else s1 = peg$FAILED;
|
|
12882
13099
|
if (s1 !== peg$FAILED) {
|
|
@@ -12894,7 +13111,7 @@ function peg$parse(input, options) {
|
|
|
12894
13111
|
if (peg$charCode = s4.charCodeAt(0), peg$charCode === 36 || peg$charCode === 95 || peg$charCode === 64 || peg$charCode === 37) peg$currPos++;
|
|
12895
13112
|
else {
|
|
12896
13113
|
s4 = peg$FAILED;
|
|
12897
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
13114
|
+
if (peg$silentFails === 0) peg$fail(peg$e20);
|
|
12898
13115
|
}
|
|
12899
13116
|
peg$silentFails--;
|
|
12900
13117
|
if (s4 !== peg$FAILED) {
|
|
@@ -12971,22 +13188,17 @@ function peg$parse(input, options) {
|
|
|
12971
13188
|
let rawName = "";
|
|
12972
13189
|
/** The HTML text-only body being read; its own closer ends this context. */
|
|
12973
13190
|
let htmlTextTag = "";
|
|
13191
|
+
/** First bracket boundary of the current (non-nesting) link label. */
|
|
13192
|
+
let linkTextEnd = -1;
|
|
12974
13193
|
/**
|
|
12975
13194
|
* The index in `inner` (at `at` in the input) of the first `separator` that
|
|
12976
13195
|
* is not inside a {…} of the label: its code (`{if $a || $b}`, a string with
|
|
12977
13196
|
* a pipe) belongs to the label, not to the link's syntax.
|
|
12978
13197
|
*/
|
|
12979
|
-
function linkSeparatorIndex(inner, at, separator) {
|
|
12980
|
-
|
|
12981
|
-
|
|
12982
|
-
|
|
12983
|
-
else if (c === LB) {
|
|
12984
|
-
const head = /^(?:[.#][\w-]*)* ?(\/?[a-zA-Z][\w-]*|(?=[$_@%(!]))/.exec(inner.slice(i + 1));
|
|
12985
|
-
if (!head) continue;
|
|
12986
|
-
const close = hooks.closeBrace(input, at + i + 1 + head[0].length, at + i + 1);
|
|
12987
|
-
if (close !== -1 && close < at + inner.length) i = close - at;
|
|
12988
|
-
} else if (inner.startsWith(separator, i)) return i;
|
|
12989
|
-
}
|
|
13198
|
+
function linkSeparatorIndex(inner, at, separator, spans) {
|
|
13199
|
+
let span = 0;
|
|
13200
|
+
for (let i = 0; i < inner.length; i++) if (span < spans.length && i === spans[span].start - at) i = spans[span++].end - at - 1;
|
|
13201
|
+
else if (inner.startsWith(separator, i)) return i;
|
|
12990
13202
|
return -1;
|
|
12991
13203
|
}
|
|
12992
13204
|
/**
|
|
@@ -21869,25 +22081,29 @@ function formatValue(value) {
|
|
|
21869
22081
|
}
|
|
21870
22082
|
}
|
|
21871
22083
|
}
|
|
21872
|
-
|
|
22084
|
+
function selectedLabels(el) {
|
|
22085
|
+
const labels = Array.from(el.options).filter((option) => option.selected).map((option) => option.getAttribute("label") || (option.textContent ?? "").trim().replace(/\s+/g, " "));
|
|
22086
|
+
return el.multiple ? labels : labels[0] ?? "";
|
|
22087
|
+
}
|
|
22088
|
+
/** What a control shows: its type, optional action variable and live value. */
|
|
21873
22089
|
function controlMarker(el) {
|
|
21874
22090
|
const own = el;
|
|
21875
22091
|
const action = getAction(el.getAttribute("data-action") ?? "");
|
|
21876
|
-
const type = action?.type ?? el.getAttribute("type") ?? el.localName;
|
|
22092
|
+
const type = action?.type ?? el.getAttribute("type")?.toLowerCase() ?? el.localName;
|
|
21877
22093
|
const isCheckbox = type === "checkbox";
|
|
21878
|
-
const value = action?.value !== void 0 ? action.value : isCheckbox ? !!own.checked : own.value ?? "";
|
|
22094
|
+
const value = action?.value !== void 0 ? action.value : isCheckbox ? !!own.checked : el.localName === "select" && !el.hasAttribute("data-action") ? selectedLabels(el) : own.value ?? "";
|
|
21879
22095
|
const shown = isCheckbox ? value ? "checked" : "unchecked" : formatValue(value);
|
|
21880
22096
|
const variable = action?.variable;
|
|
21881
22097
|
const name = variable && !variable.startsWith("$") ? `$${variable}` : variable;
|
|
21882
|
-
if (type === "radiobutton" && own.value !== void 0) {
|
|
21883
|
-
const state = action?.value === own.value ? "selected" : "unselected";
|
|
22098
|
+
if ((type === "radiobutton" || type === "radio") && own.value !== void 0) {
|
|
22099
|
+
const state = (action?.value !== void 0 ? action.value === own.value : !!own.checked) ? "selected" : "unselected";
|
|
21884
22100
|
return `[${type}${name ? ` ${name}` : ""} = ${formatValue(own.value)}: ${state}]`;
|
|
21885
22101
|
}
|
|
21886
22102
|
return `[${type}${name ? ` ${name}` : ""}: ${shown}]`;
|
|
21887
22103
|
}
|
|
21888
22104
|
/**
|
|
21889
22105
|
* The text a reader sees in the element, as lines: blocks and `<br>` break
|
|
21890
|
-
* lines, hidden elements are left out, and a
|
|
22106
|
+
* lines, hidden elements are left out, and a native or action-associated control
|
|
21891
22107
|
* becomes a marker such as `[textbox $name: "Alice"]`. Elements inside `el`
|
|
21892
22108
|
* that match `skip` are left out with their content. `visibilityRoot` bounds
|
|
21893
22109
|
* ancestor checks when reading StoryContext inside its hidden host.
|
|
@@ -21912,7 +22128,8 @@ function observableText(el, skip, visibilityRoot) {
|
|
|
21912
22128
|
if (node.nodeType !== 1) return;
|
|
21913
22129
|
const child = node;
|
|
21914
22130
|
if (isHidden(child) || skip && child !== el && child.matches(skip)) return;
|
|
21915
|
-
if (child.
|
|
22131
|
+
if (child.matches("input, textarea, select") || child.hasAttribute("data-action") && getAction(child.getAttribute("data-action"))?.type === "cycle") {
|
|
22132
|
+
if (child.matches("input[type=\"hidden\" i]")) return;
|
|
21916
22133
|
if (!isRendered(child, visibilityRoot)) return;
|
|
21917
22134
|
out += controlMarker(child);
|
|
21918
22135
|
return;
|
|
@@ -24015,6 +24232,16 @@ function snapshotUrls(value, ids, base) {
|
|
|
24015
24232
|
* definitions would replace that inheritance (and resolve currentColor).
|
|
24016
24233
|
*/
|
|
24017
24234
|
var snapshotSvgRules = /* @__PURE__ */ new WeakSet();
|
|
24235
|
+
/** Keep only snapshot aliases, retaining their media/layer/nesting context. */
|
|
24236
|
+
function snapshotRuleText(rules) {
|
|
24237
|
+
const text = [];
|
|
24238
|
+
for (const rule of rules) if (snapshotSvgRules.has(rule)) text.push(rule.cssText);
|
|
24239
|
+
else if ("cssRules" in rule && !(rule instanceof CSSKeyframesRule)) {
|
|
24240
|
+
const body = snapshotRuleText(rule.cssRules);
|
|
24241
|
+
if (body) text.push(`${rule.cssText.slice(0, rule.cssText.indexOf("{"))}{${body}}`);
|
|
24242
|
+
}
|
|
24243
|
+
return text.join("\n");
|
|
24244
|
+
}
|
|
24018
24245
|
/** A detached style element has no sheet yet. Carry its CSSOM, including
|
|
24019
24246
|
* script-inserted rules and imported styles, into the passive tree.
|
|
24020
24247
|
*/
|
|
@@ -24143,11 +24370,15 @@ var snapshotPseudoId = 0;
|
|
|
24143
24370
|
* as ordinary native elements, without an `is` option (even if the original
|
|
24144
24371
|
* has since removed its `is` attribute).
|
|
24145
24372
|
*/
|
|
24146
|
-
function cloneSnapshotTree(source, ids, pseudoRules = [], svgMarker = String(++snapshotPseudoId), cleanups = []
|
|
24373
|
+
function cloneSnapshotTree(source, ids, pseudoRules = [], svgMarker = String(++snapshotPseudoId), cleanups = [], svgState = {
|
|
24374
|
+
opaqueRoots: /* @__PURE__ */ new Set(),
|
|
24375
|
+
copies: []
|
|
24376
|
+
}) {
|
|
24147
24377
|
const html = source.namespaceURI === "http://www.w3.org/1999/xhtml";
|
|
24148
24378
|
const svg = source.namespaceURI === "http://www.w3.org/2000/svg";
|
|
24149
24379
|
const custom = html && source.localName.includes("-");
|
|
24150
|
-
const
|
|
24380
|
+
const linkedSheet = html && source.localName === "link" && source.relList.contains("stylesheet");
|
|
24381
|
+
const clone = document.createElementNS(source.namespaceURI, linkedSheet ? "style" : custom ? "span" : source.localName);
|
|
24151
24382
|
for (const attr of [...source.attributes]) {
|
|
24152
24383
|
if (attr.name === "id" || attr.name === "data-action" || attr.name === "is" || attr.name.toLowerCase().startsWith("on")) continue;
|
|
24153
24384
|
const value = svg && attr.localName === "href" ? snapshotFragment(attr.value, ids) : svg || attr.localName === "style" ? snapshotUrls(attr.value, ids) : attr.value;
|
|
@@ -24159,6 +24390,15 @@ function cloneSnapshotTree(source, ids, pseudoRules = [], svgMarker = String(++s
|
|
|
24159
24390
|
if (source.id) clone.setAttribute("data-spindle-snapshot-original-id", source.id);
|
|
24160
24391
|
if (custom) clone.setAttribute("data-spindle-snapshot-tag", source.localName);
|
|
24161
24392
|
if (svg) clone.setAttribute("data-spindle-snapshot-svg", svgMarker);
|
|
24393
|
+
if (svg) svgState.copies.push({
|
|
24394
|
+
source,
|
|
24395
|
+
clone,
|
|
24396
|
+
ids
|
|
24397
|
+
});
|
|
24398
|
+
if (html && source.localName === "input" && source.type === "radio") {
|
|
24399
|
+
clone.removeAttribute("name");
|
|
24400
|
+
clone.removeAttribute("form");
|
|
24401
|
+
}
|
|
24162
24402
|
const computed = getComputedStyle(source);
|
|
24163
24403
|
if (!svg) copyComputedStyle(computed, clone.style, ids);
|
|
24164
24404
|
let pseudoId;
|
|
@@ -24179,21 +24419,21 @@ function cloneSnapshotTree(source, ids, pseudoRules = [], svgMarker = String(++s
|
|
|
24179
24419
|
const from = source instanceof HTMLTemplateElement ? source.content : source;
|
|
24180
24420
|
const to = clone instanceof HTMLTemplateElement ? clone.content : clone;
|
|
24181
24421
|
const copyChildren = (from, to, rules = pseudoRules, localIds = ids) => {
|
|
24182
|
-
for (const node of from.childNodes) to.appendChild(node instanceof Element ? cloneSnapshotTree(node, localIds, rules, svgMarker, cleanups) : node.cloneNode(false));
|
|
24422
|
+
for (const node of from.childNodes) to.appendChild(node instanceof Element ? cloneSnapshotTree(node, localIds, rules, svgMarker, cleanups, svgState) : node.cloneNode(false));
|
|
24183
24423
|
};
|
|
24184
24424
|
copyChildren(from, to, pseudoRules, source instanceof HTMLTemplateElement ? snapshotIds(from) : ids);
|
|
24185
|
-
if (source
|
|
24425
|
+
if (source.localName === "style" || linkedSheet) {
|
|
24426
|
+
const sourceSheet = source.sheet;
|
|
24427
|
+
clone.textContent = "";
|
|
24186
24428
|
const root = source.getRootNode();
|
|
24187
|
-
if (root.querySelector("svg")) {
|
|
24188
|
-
|
|
24189
|
-
|
|
24190
|
-
opaque = true;
|
|
24429
|
+
if (sourceSheet && root.querySelector("svg")) {
|
|
24430
|
+
const copy = copySnapshotSheet(sourceSheet, ids, () => {
|
|
24431
|
+
svgState.opaqueRoots.add(root);
|
|
24191
24432
|
});
|
|
24192
|
-
const
|
|
24193
|
-
|
|
24194
|
-
clone.textContent = snapshotUrls([...sheet.cssRules].map((rule) => rule.cssText).join("\n"), ids, source.sheet.href ?? document.baseURI);
|
|
24433
|
+
const dispose = installSnapshotSvgStyles(root, ids, svgMarker, [copy]);
|
|
24434
|
+
clone.textContent = snapshotRuleText(copy.cssRules);
|
|
24195
24435
|
dispose();
|
|
24196
|
-
if (
|
|
24436
|
+
if (sourceSheet.disabled) clone.setAttribute("media", "not all");
|
|
24197
24437
|
}
|
|
24198
24438
|
}
|
|
24199
24439
|
if (source.shadowRoot) {
|
|
@@ -24252,7 +24492,12 @@ function createSnapshot(passageEl, transitionType) {
|
|
|
24252
24492
|
const cleanups = [];
|
|
24253
24493
|
const ids = snapshotIds(passageEl);
|
|
24254
24494
|
const svgMarker = String(++snapshotPseudoId);
|
|
24255
|
-
const
|
|
24495
|
+
const svgState = {
|
|
24496
|
+
opaqueRoots: /* @__PURE__ */ new Set(),
|
|
24497
|
+
copies: []
|
|
24498
|
+
};
|
|
24499
|
+
const clone = cloneSnapshotTree(passageEl, ids, pseudoRules, svgMarker, cleanups, svgState);
|
|
24500
|
+
for (const { source, clone: copy, ids: localIds } of svgState.copies) if (svgState.opaqueRoots.has(source.getRootNode()) && !source.closest("defs, symbol, clipPath, mask, pattern, marker")) copyComputedStyle(getComputedStyle(source), copy.style, localIds);
|
|
24256
24501
|
clone.style.removeProperty("animation");
|
|
24257
24502
|
clone.style.removeProperty("grid-area");
|
|
24258
24503
|
for (const name of ["opacity", "transform"]) clone.style.setProperty(name, clone.style.getPropertyValue(name));
|