marko 6.0.157 → 6.0.159

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.
@@ -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
@@ -255,6 +255,7 @@ function forUntil(until, from, step, cb) {
255
255
  }
256
256
 
257
257
  // src/common/helpers.ts
258
+ var htmlAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
258
259
  function _call(fn, v) {
259
260
  fn(v);
260
261
  return v;
@@ -548,6 +549,9 @@ function _const(valueAccessor, fn) {
548
549
  };
549
550
  }
550
551
  function _or(id, fn, defaultPending = 1, scopeIdAccessor = "#Id" /* Id */) {
552
+ if (false) {
553
+ scopeIdAccessor = decodeAccessor(scopeIdAccessor);
554
+ }
551
555
  return (scope) => {
552
556
  if (scope["#Creating" /* Creating */]) {
553
557
  if (id in scope) {
@@ -1642,6 +1646,11 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
1642
1646
  _attr_style(el, value);
1643
1647
  break;
1644
1648
  default: {
1649
+ if (true) {
1650
+ if (htmlAttrNameReg.test(name)) {
1651
+ throw new Error(`Invalid attribute name: ${JSON.stringify(name)}`);
1652
+ }
1653
+ }
1645
1654
  if (isEventHandler(name)) {
1646
1655
  (events ||= scope["EventAttributes:" /* EventAttributes */ + nodeAccessor] = {})[getEventHandlerName(name)] = value;
1647
1656
  } else if (!(skip?.test(name) || name === "content" && el.tagName !== "META")) {
@@ -139,6 +139,7 @@ function forUntil(until, from, step, cb) {
139
139
  }
140
140
 
141
141
  // src/common/helpers.ts
142
+ var htmlAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
142
143
  function _call(fn, v) {
143
144
  fn(v);
144
145
  return v;
@@ -432,6 +433,9 @@ function _const(valueAccessor, fn) {
432
433
  };
433
434
  }
434
435
  function _or(id, fn, defaultPending = 1, scopeIdAccessor = "#Id" /* Id */) {
436
+ if (false) {
437
+ scopeIdAccessor = decodeAccessor(scopeIdAccessor);
438
+ }
435
439
  return (scope) => {
436
440
  if (scope["#Creating" /* Creating */]) {
437
441
  if (id in scope) {
@@ -1526,6 +1530,11 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
1526
1530
  _attr_style(el, value);
1527
1531
  break;
1528
1532
  default: {
1533
+ if (true) {
1534
+ if (htmlAttrNameReg.test(name)) {
1535
+ throw new Error(`Invalid attribute name: ${JSON.stringify(name)}`);
1536
+ }
1537
+ }
1529
1538
  if (isEventHandler(name)) {
1530
1539
  (events ||= scope["EventAttributes:" /* EventAttributes */ + nodeAccessor] = {})[getEventHandlerName(name)] = value;
1531
1540
  } else if (!(skip?.test(name) || name === "content" && el.tagName !== "META")) {
@@ -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 = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/;
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);
@@ -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 = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/;
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);
@@ -5,7 +5,7 @@ export type Signal<T> = ((scope: Scope, value: T) => void) & {
5
5
  };
6
6
  export declare function _let<T>(id: EncodedAccessor, fn?: SignalFn): (scope: Scope, value: T, valueChange?: (v: T) => void) => T;
7
7
  export declare function _const<T>(valueAccessor: EncodedAccessor, fn?: SignalFn): Signal<T>;
8
- export declare function _or(id: number, fn: SignalFn, defaultPending?: number, scopeIdAccessor?: Accessor): Signal<never>;
8
+ export declare function _or(id: number, fn: SignalFn, defaultPending?: number, scopeIdAccessor?: EncodedAccessor): Signal<never>;
9
9
  export declare function _for_closure(ownerLoopNodeAccessor: EncodedAccessor, fn: SignalFn): SignalFn;
10
10
  export declare function _if_closure(ownerConditionalNodeAccessor: EncodedAccessor, branch: number, fn: SignalFn): SignalFn;
11
11
  export declare function subscribeToScopeSet(ownerScope: Scope, accessor: Accessor, scope: Scope): void;
package/dist/dom.js CHANGED
@@ -341,7 +341,7 @@ function _const(valueAccessor, fn) {
341
341
  };
342
342
  }
343
343
  function _or(id, fn, defaultPending = 1, scopeIdAccessor = "L" /* Id */) {
344
- return (scope) => {
344
+ return scopeIdAccessor !== "L" /* Id */ && (scopeIdAccessor = decodeAccessor(scopeIdAccessor)), (scope) => {
345
345
  scope.H ? id in scope ? --scope[id] || fn(scope) : scope[id] = defaultPending : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
346
346
  };
347
347
  }
package/dist/dom.mjs CHANGED
@@ -228,7 +228,7 @@ function _const(valueAccessor, fn) {
228
228
  };
229
229
  }
230
230
  function _or(id, fn, defaultPending = 1, scopeIdAccessor = "L" /* Id */) {
231
- return (scope) => {
231
+ return scopeIdAccessor !== "L" /* Id */ && (scopeIdAccessor = decodeAccessor(scopeIdAccessor)), (scope) => {
232
232
  scope.H ? id in scope ? --scope[id] || fn(scope) : scope[id] = defaultPending : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
233
233
  };
234
234
  }
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 = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
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 = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
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) || {};