marko 6.0.156 → 6.0.158
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/common/errors.d.ts +2 -0
- package/dist/common/helpers.d.ts +2 -0
- package/dist/debug/dom.js +22 -15
- package/dist/debug/dom.mjs +22 -15
- package/dist/debug/html.js +12 -1
- package/dist/debug/html.mjs +12 -1
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +4 -0
- package/dist/dom.mjs +4 -0
- package/dist/html/writer.d.ts +1 -1
- package/dist/html.js +4 -1
- package/dist/html.mjs +4 -1
- package/dist/translator/index.js +444 -346
- package/dist/translator/util/known-tag.d.ts +1 -1
- package/dist/translator/util/references.d.ts +5 -1
- package/index.d.ts +1 -1
- package/package.json +2 -2
- package/tags-html.d.ts +1 -1
package/dist/common/errors.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { type Scope } from "./types";
|
|
1
2
|
export declare function _el_read_error(): void;
|
|
2
3
|
export declare function _hoist_read_error(): void;
|
|
3
4
|
export declare function _assert_hoist(value: unknown): void;
|
|
5
|
+
export declare function _assert_init(scope: Scope, accessor: string): any;
|
|
4
6
|
export declare function assertExclusiveAttrs(attrs: Record<string, unknown> | undefined, onError?: typeof throwErr): void;
|
|
5
7
|
export declare function assertValidTagName(tagName: string): void;
|
|
6
8
|
declare function throwErr(msg: string): void;
|
package/dist/common/helpers.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export declare const htmlAttrNameReg: RegExp;
|
|
2
|
+
export declare const userAttrNameReg: RegExp;
|
|
1
3
|
export declare function _call<T>(fn: (v: T) => unknown, v: T): T;
|
|
2
4
|
export declare function classValue(classValue: unknown): string;
|
|
3
5
|
export declare function styleValue(styleValue: unknown): string;
|
package/dist/debug/dom.js
CHANGED
|
@@ -23,6 +23,7 @@ __export(dom_exports, {
|
|
|
23
23
|
$signal: () => $signal,
|
|
24
24
|
$signalReset: () => $signalReset,
|
|
25
25
|
_assert_hoist: () => _assert_hoist,
|
|
26
|
+
_assert_init: () => _assert_init,
|
|
26
27
|
_attr: () => _attr,
|
|
27
28
|
_attr_class: () => _attr_class,
|
|
28
29
|
_attr_class_item: () => _attr_class_item,
|
|
@@ -159,6 +160,21 @@ function _assert_hoist(value) {
|
|
|
159
160
|
);
|
|
160
161
|
}
|
|
161
162
|
}
|
|
163
|
+
function _assert_init(scope, accessor) {
|
|
164
|
+
if (scope["#Creating" /* Creating */] || !(accessor in scope)) {
|
|
165
|
+
try {
|
|
166
|
+
__UNINITIALIZED__;
|
|
167
|
+
const __UNINITIALIZED__ = 1;
|
|
168
|
+
} catch (err) {
|
|
169
|
+
err.message = err.message.replaceAll("__UNINITIALIZED__", accessor);
|
|
170
|
+
throw err;
|
|
171
|
+
}
|
|
172
|
+
throw new ReferenceError(
|
|
173
|
+
`Cannot access "${accessor}" before initialization.`
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
return scope[accessor];
|
|
177
|
+
}
|
|
162
178
|
function assertExclusiveAttrs(attrs, onError = throwErr) {
|
|
163
179
|
if (attrs) {
|
|
164
180
|
let exclusiveAttrs;
|
|
@@ -239,6 +255,7 @@ function forUntil(until, from, step, cb) {
|
|
|
239
255
|
}
|
|
240
256
|
|
|
241
257
|
// src/common/helpers.ts
|
|
258
|
+
var htmlAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
|
|
242
259
|
function _call(fn, v) {
|
|
243
260
|
fn(v);
|
|
244
261
|
return v;
|
|
@@ -619,11 +636,6 @@ function _closure(...closureSignals) {
|
|
|
619
636
|
function _closure_get(valueAccessor, fn, getOwnerScope, resumeId) {
|
|
620
637
|
if (false) valueAccessor = decodeAccessor(valueAccessor);
|
|
621
638
|
const closureSignal = ((scope) => {
|
|
622
|
-
if (true) {
|
|
623
|
-
if (!(valueAccessor in (getOwnerScope ? getOwnerScope(scope) : scope["_" /* Owner */]))) {
|
|
624
|
-
throwUninitialized(valueAccessor);
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
639
|
scope[closureSignal.___signalIndexAccessor] = closureSignal.___index;
|
|
628
640
|
fn(scope);
|
|
629
641
|
subscribeToScopeSet(
|
|
@@ -708,16 +720,6 @@ function _hoist(...path) {
|
|
|
708
720
|
function _hoist_resume(id, ...path) {
|
|
709
721
|
return _resume(id, _hoist(...path));
|
|
710
722
|
}
|
|
711
|
-
function throwUninitialized(name) {
|
|
712
|
-
try {
|
|
713
|
-
__UNINITIALIZED__;
|
|
714
|
-
let __UNINITIALIZED__;
|
|
715
|
-
} catch (err) {
|
|
716
|
-
err.message = err.message.replaceAll("__UNINITIALIZED__", name);
|
|
717
|
-
throw err;
|
|
718
|
-
}
|
|
719
|
-
throw new ReferenceError(`Cannot access '${name}' before initialization`);
|
|
720
|
-
}
|
|
721
723
|
|
|
722
724
|
// src/dom/walker.ts
|
|
723
725
|
var walker = /* @__PURE__ */ document.createTreeWalker(document);
|
|
@@ -1641,6 +1643,11 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
1641
1643
|
_attr_style(el, value);
|
|
1642
1644
|
break;
|
|
1643
1645
|
default: {
|
|
1646
|
+
if (true) {
|
|
1647
|
+
if (htmlAttrNameReg.test(name)) {
|
|
1648
|
+
throw new Error(`Invalid attribute name: ${JSON.stringify(name)}`);
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1644
1651
|
if (isEventHandler(name)) {
|
|
1645
1652
|
(events ||= scope["EventAttributes:" /* EventAttributes */ + nodeAccessor] = {})[getEventHandlerName(name)] = value;
|
|
1646
1653
|
} else if (!(skip?.test(name) || name === "content" && el.tagName !== "META")) {
|
package/dist/debug/dom.mjs
CHANGED
|
@@ -44,6 +44,21 @@ function _assert_hoist(value) {
|
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
+
function _assert_init(scope, accessor) {
|
|
48
|
+
if (scope["#Creating" /* Creating */] || !(accessor in scope)) {
|
|
49
|
+
try {
|
|
50
|
+
__UNINITIALIZED__;
|
|
51
|
+
const __UNINITIALIZED__ = 1;
|
|
52
|
+
} catch (err) {
|
|
53
|
+
err.message = err.message.replaceAll("__UNINITIALIZED__", accessor);
|
|
54
|
+
throw err;
|
|
55
|
+
}
|
|
56
|
+
throw new ReferenceError(
|
|
57
|
+
`Cannot access "${accessor}" before initialization.`
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
return scope[accessor];
|
|
61
|
+
}
|
|
47
62
|
function assertExclusiveAttrs(attrs, onError = throwErr) {
|
|
48
63
|
if (attrs) {
|
|
49
64
|
let exclusiveAttrs;
|
|
@@ -124,6 +139,7 @@ function forUntil(until, from, step, cb) {
|
|
|
124
139
|
}
|
|
125
140
|
|
|
126
141
|
// src/common/helpers.ts
|
|
142
|
+
var htmlAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
|
|
127
143
|
function _call(fn, v) {
|
|
128
144
|
fn(v);
|
|
129
145
|
return v;
|
|
@@ -504,11 +520,6 @@ function _closure(...closureSignals) {
|
|
|
504
520
|
function _closure_get(valueAccessor, fn, getOwnerScope, resumeId) {
|
|
505
521
|
if (false) valueAccessor = decodeAccessor(valueAccessor);
|
|
506
522
|
const closureSignal = ((scope) => {
|
|
507
|
-
if (true) {
|
|
508
|
-
if (!(valueAccessor in (getOwnerScope ? getOwnerScope(scope) : scope["_" /* Owner */]))) {
|
|
509
|
-
throwUninitialized(valueAccessor);
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
523
|
scope[closureSignal.___signalIndexAccessor] = closureSignal.___index;
|
|
513
524
|
fn(scope);
|
|
514
525
|
subscribeToScopeSet(
|
|
@@ -593,16 +604,6 @@ function _hoist(...path) {
|
|
|
593
604
|
function _hoist_resume(id, ...path) {
|
|
594
605
|
return _resume(id, _hoist(...path));
|
|
595
606
|
}
|
|
596
|
-
function throwUninitialized(name) {
|
|
597
|
-
try {
|
|
598
|
-
__UNINITIALIZED__;
|
|
599
|
-
let __UNINITIALIZED__;
|
|
600
|
-
} catch (err) {
|
|
601
|
-
err.message = err.message.replaceAll("__UNINITIALIZED__", name);
|
|
602
|
-
throw err;
|
|
603
|
-
}
|
|
604
|
-
throw new ReferenceError(`Cannot access '${name}' before initialization`);
|
|
605
|
-
}
|
|
606
607
|
|
|
607
608
|
// src/dom/walker.ts
|
|
608
609
|
var walker = /* @__PURE__ */ document.createTreeWalker(document);
|
|
@@ -1526,6 +1527,11 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
1526
1527
|
_attr_style(el, value);
|
|
1527
1528
|
break;
|
|
1528
1529
|
default: {
|
|
1530
|
+
if (true) {
|
|
1531
|
+
if (htmlAttrNameReg.test(name)) {
|
|
1532
|
+
throw new Error(`Invalid attribute name: ${JSON.stringify(name)}`);
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1529
1535
|
if (isEventHandler(name)) {
|
|
1530
1536
|
(events ||= scope["EventAttributes:" /* EventAttributes */ + nodeAccessor] = {})[getEventHandlerName(name)] = value;
|
|
1531
1537
|
} else if (!(skip?.test(name) || name === "content" && el.tagName !== "META")) {
|
|
@@ -2592,6 +2598,7 @@ export {
|
|
|
2592
2598
|
$signal,
|
|
2593
2599
|
$signalReset,
|
|
2594
2600
|
_assert_hoist,
|
|
2601
|
+
_assert_init,
|
|
2595
2602
|
_attr,
|
|
2596
2603
|
_attr_class,
|
|
2597
2604
|
_attr_class_item,
|
package/dist/debug/html.js
CHANGED
|
@@ -188,6 +188,7 @@ function joinWithAnd(a) {
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
// src/common/helpers.ts
|
|
191
|
+
var htmlAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
|
|
191
192
|
function classValue(classValue2) {
|
|
192
193
|
return toDelimitedString(classValue2, " ", stringifyClassObject);
|
|
193
194
|
}
|
|
@@ -3083,6 +3084,13 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
3083
3084
|
break;
|
|
3084
3085
|
default:
|
|
3085
3086
|
if (name && !(isVoid(value) || skip.test(name) || name === "content" && tagName !== "meta")) {
|
|
3087
|
+
if (true) {
|
|
3088
|
+
if (htmlAttrNameReg.test(name)) {
|
|
3089
|
+
throw new Error(
|
|
3090
|
+
`Invalid attribute name: ${JSON.stringify(name)}`
|
|
3091
|
+
);
|
|
3092
|
+
}
|
|
3093
|
+
}
|
|
3086
3094
|
if (isEventHandler(name)) {
|
|
3087
3095
|
if (!events) {
|
|
3088
3096
|
events = {};
|
|
@@ -3200,7 +3208,10 @@ var DEFAULT_RENDER_ID = "_";
|
|
|
3200
3208
|
var DYNAMIC_TAG_SCRIPT_REGISTER_ID = true ? "_dynamicTagScript" : "d";
|
|
3201
3209
|
|
|
3202
3210
|
// src/html/dynamic-tag.ts
|
|
3203
|
-
var voidElementsReg =
|
|
3211
|
+
var voidElementsReg = (
|
|
3212
|
+
/* cspell:disable-next-line */
|
|
3213
|
+
/^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/
|
|
3214
|
+
);
|
|
3204
3215
|
var _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
|
|
3205
3216
|
const shouldResume = serializeReason !== 0;
|
|
3206
3217
|
const renderer = normalizeDynamicRenderer(tag);
|
package/dist/debug/html.mjs
CHANGED
|
@@ -95,6 +95,7 @@ function joinWithAnd(a) {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
// src/common/helpers.ts
|
|
98
|
+
var htmlAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
|
|
98
99
|
function classValue(classValue2) {
|
|
99
100
|
return toDelimitedString(classValue2, " ", stringifyClassObject);
|
|
100
101
|
}
|
|
@@ -2990,6 +2991,13 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
2990
2991
|
break;
|
|
2991
2992
|
default:
|
|
2992
2993
|
if (name && !(isVoid(value) || skip.test(name) || name === "content" && tagName !== "meta")) {
|
|
2994
|
+
if (true) {
|
|
2995
|
+
if (htmlAttrNameReg.test(name)) {
|
|
2996
|
+
throw new Error(
|
|
2997
|
+
`Invalid attribute name: ${JSON.stringify(name)}`
|
|
2998
|
+
);
|
|
2999
|
+
}
|
|
3000
|
+
}
|
|
2993
3001
|
if (isEventHandler(name)) {
|
|
2994
3002
|
if (!events) {
|
|
2995
3003
|
events = {};
|
|
@@ -3107,7 +3115,10 @@ var DEFAULT_RENDER_ID = "_";
|
|
|
3107
3115
|
var DYNAMIC_TAG_SCRIPT_REGISTER_ID = true ? "_dynamicTagScript" : "d";
|
|
3108
3116
|
|
|
3109
3117
|
// src/html/dynamic-tag.ts
|
|
3110
|
-
var voidElementsReg =
|
|
3118
|
+
var voidElementsReg = (
|
|
3119
|
+
/* cspell:disable-next-line */
|
|
3120
|
+
/^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/
|
|
3121
|
+
);
|
|
3111
3122
|
var _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
|
|
3112
3123
|
const shouldResume = serializeReason !== 0;
|
|
3113
3124
|
const renderer = normalizeDynamicRenderer(tag);
|
package/dist/dom.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { attrTag, attrTags } from "./common/attr-tag";
|
|
2
|
-
export { _assert_hoist } from "./common/errors";
|
|
2
|
+
export { _assert_hoist, _assert_init } from "./common/errors";
|
|
3
3
|
export { forIn, forOf, forTo, forUntil } from "./common/for";
|
|
4
4
|
export { _call } from "./common/helpers";
|
|
5
5
|
export { $signal, $signalReset } from "./dom/abort-signal";
|
package/dist/dom.js
CHANGED
|
@@ -20,6 +20,7 @@ __export(dom_exports, {
|
|
|
20
20
|
$signal: () => $signal,
|
|
21
21
|
$signalReset: () => $signalReset,
|
|
22
22
|
_assert_hoist: () => _assert_hoist,
|
|
23
|
+
_assert_init: () => _assert_init,
|
|
23
24
|
_attr: () => _attr,
|
|
24
25
|
_attr_class: () => _attr_class,
|
|
25
26
|
_attr_class_item: () => _attr_class_item,
|
|
@@ -125,6 +126,9 @@ function* attrTagIterator() {
|
|
|
125
126
|
// src/common/errors.ts
|
|
126
127
|
function _assert_hoist(value) {
|
|
127
128
|
}
|
|
129
|
+
function _assert_init(scope, accessor) {
|
|
130
|
+
return scope[accessor];
|
|
131
|
+
}
|
|
128
132
|
|
|
129
133
|
// src/common/for.ts
|
|
130
134
|
function forIn(obj, cb) {
|
package/dist/dom.mjs
CHANGED
|
@@ -13,6 +13,9 @@ function* attrTagIterator() {
|
|
|
13
13
|
// src/common/errors.ts
|
|
14
14
|
function _assert_hoist(value) {
|
|
15
15
|
}
|
|
16
|
+
function _assert_init(scope, accessor) {
|
|
17
|
+
return scope[accessor];
|
|
18
|
+
}
|
|
16
19
|
|
|
17
20
|
// src/common/for.ts
|
|
18
21
|
function forIn(obj, cb) {
|
|
@@ -1575,6 +1578,7 @@ export {
|
|
|
1575
1578
|
$signal,
|
|
1576
1579
|
$signalReset,
|
|
1577
1580
|
_assert_hoist,
|
|
1581
|
+
_assert_init,
|
|
1578
1582
|
_attr,
|
|
1579
1583
|
_attr_class,
|
|
1580
1584
|
_attr_class_item,
|
package/dist/html/writer.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export declare function getScopeById(scopeId: number | undefined): PartialScope
|
|
|
34
34
|
export declare function _set_serialize_reason(reason: undefined | 0 | 1): void;
|
|
35
35
|
export declare function _scope_reason(): 0 | 1 | undefined;
|
|
36
36
|
export declare function _serialize_if(condition: undefined | 1 | Record<string, 1>, key: string): 1 | undefined;
|
|
37
|
-
export declare function _serialize_guard(condition: undefined | 1 | Record<string, 1>, key: string):
|
|
37
|
+
export declare function _serialize_guard(condition: undefined | 1 | Record<string, 1>, key: string): 0 | 1;
|
|
38
38
|
export declare function _el_resume(scopeId: number, accessor: Accessor, shouldResume?: 0 | 1): string;
|
|
39
39
|
export declare function _sep(shouldResume: 0 | 1): "" | "<!>";
|
|
40
40
|
export declare function _el(scopeId: number, id: string): () => void;
|
package/dist/html.js
CHANGED
|
@@ -2019,7 +2019,10 @@ function normalizeBoolAttrValue(value) {
|
|
|
2019
2019
|
var RENDERER_REGISTER_ID = "$C_r", SET_SCOPE_REGISTER_ID = "$C_s", RENDER_BODY_ID = "$C_b";
|
|
2020
2020
|
|
|
2021
2021
|
// src/html/dynamic-tag.ts
|
|
2022
|
-
var voidElementsReg =
|
|
2022
|
+
var voidElementsReg = (
|
|
2023
|
+
/* cspell:disable-next-line */
|
|
2024
|
+
/^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/
|
|
2025
|
+
), _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
|
|
2023
2026
|
let shouldResume = serializeReason !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered, result;
|
|
2024
2027
|
if (typeof renderer == "string") {
|
|
2025
2028
|
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
package/dist/html.mjs
CHANGED
|
@@ -1929,7 +1929,10 @@ function normalizeBoolAttrValue(value) {
|
|
|
1929
1929
|
var RENDERER_REGISTER_ID = "$C_r", SET_SCOPE_REGISTER_ID = "$C_s", RENDER_BODY_ID = "$C_b";
|
|
1930
1930
|
|
|
1931
1931
|
// src/html/dynamic-tag.ts
|
|
1932
|
-
var voidElementsReg =
|
|
1932
|
+
var voidElementsReg = (
|
|
1933
|
+
/* cspell:disable-next-line */
|
|
1934
|
+
/^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/
|
|
1935
|
+
), _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
|
|
1933
1936
|
let shouldResume = serializeReason !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered, result;
|
|
1934
1937
|
if (typeof renderer == "string") {
|
|
1935
1938
|
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|