marko 5.39.23 → 5.39.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.
@@ -191,12 +191,10 @@ exports.p = function (domCompat) {
191
191
 
192
192
  for (const key in rawInput) {
193
193
  const value = rawInput[key];
194
- if (/^on[-A-Z]/.test(key)) {
195
- if (typeof value === "function") {
196
- (customEvents || (customEvents = {}))[
197
- key[2] === "-" ? key.slice(3) : key.slice(2).toLowerCase()] =
198
- [value];
199
- }
194
+ if (/^on[-A-Z]/.test(key) && typeof value === "function") {
195
+ (customEvents || (customEvents = {}))[toCustomEventName(key)] = [
196
+ value];
197
+
200
198
  } else {
201
199
  normalizedInput[key === "content" ? "renderBody" : key] = value;
202
200
  }
@@ -260,4 +258,12 @@ exports.p = function (domCompat) {
260
258
  _: RenderBodyComponent,
261
259
  Component: defineComponent({}, RenderBodyComponent)
262
260
  }));
263
- };
261
+ };
262
+
263
+ function toCustomEventName(key) {
264
+ return key[2] === "-" ?
265
+ key.slice(3) :
266
+ key.
267
+ slice(2).
268
+ replace(/[A-Z]/g, (m, i) => (i ? "-" : "") + m.toLowerCase());
269
+ }
@@ -187,15 +187,13 @@ exports.p = function (htmlCompat) {
187
187
 
188
188
  for (const key in originalInput) {
189
189
  const value = originalInput[key];
190
- if (/^on[-A-Z]/.test(key)) {
191
- if (typeof value === "function") {
192
- (customEvents || (customEvents = [])).push([
193
- key[2] === "-" ? key.slice(3) : key.slice(2).toLowerCase(),
194
- value]
195
- );
196
- forceBoundary = true;
197
- value.toJSON = htmlCompat.toJSON(state);
198
- }
190
+ if (/^on[-A-Z]/.test(key) && typeof value === "function") {
191
+ (customEvents || (customEvents = [])).push([
192
+ toCustomEventName(key),
193
+ value]
194
+ );
195
+ forceBoundary = true;
196
+ value.toJSON = htmlCompat.toJSON(state);
199
197
  } else {
200
198
  input[key === "content" ? "renderBody" : key] = value;
201
199
  }
@@ -243,6 +241,14 @@ exports.p = function (htmlCompat) {
243
241
  };
244
242
  };
245
243
 
244
+ function toCustomEventName(key) {
245
+ return key[2] === "-" ?
246
+ key.slice(3) :
247
+ key.
248
+ slice(2).
249
+ replace(/[A-Z]/g, (m, i) => (i ? "-" : "") + m.toLowerCase());
250
+ }
251
+
246
252
  function hasBridgedClassEvent(input) {
247
253
  if (input && typeof input === "object" && !Array.isArray(input)) {
248
254
  for (const key in input) {
@@ -186,7 +186,7 @@ export interface Input {
186
186
  renderBody: Marko.Body<[number]>
187
187
  }
188
188
 
189
- <for|i| from=0 to=input.to by=2>
189
+ <for|i| from=0 to=input.to step=2>
190
190
  <${input.renderBody}(i)/>
191
191
  </for>
192
192
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "5.39.23",
3
+ "version": "5.39.25",
4
4
  "private": false,
5
5
  "description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
6
6
  "keywords": [
@@ -71,7 +71,7 @@
71
71
  },
72
72
  "dependencies": {
73
73
  "@marko/compiler": "^5.41.0",
74
- "@marko/runtime-tags": "^6.3.14",
74
+ "@marko/runtime-tags": "^6.3.16",
75
75
  "app-module-path": "^2.2.0",
76
76
  "argly": "^1.2.0",
77
77
  "browser-refresh-client": "1.1.4",
@@ -191,12 +191,10 @@ exports.p = function (domCompat) {
191
191
 
192
192
  for (const key in rawInput) {
193
193
  const value = rawInput[key];
194
- if (/^on[-A-Z]/.test(key)) {
195
- if (typeof value === "function") {
196
- (customEvents || (customEvents = {}))[
197
- key[2] === "-" ? key.slice(3) : key.slice(2).toLowerCase()
198
- ] = [value];
199
- }
194
+ if (/^on[-A-Z]/.test(key) && typeof value === "function") {
195
+ (customEvents || (customEvents = {}))[toCustomEventName(key)] = [
196
+ value,
197
+ ];
200
198
  } else {
201
199
  normalizedInput[key === "content" ? "renderBody" : key] = value;
202
200
  }
@@ -261,3 +259,11 @@ exports.p = function (domCompat) {
261
259
  Component: defineComponent({}, RenderBodyComponent),
262
260
  }));
263
261
  };
262
+
263
+ function toCustomEventName(key) {
264
+ return key[2] === "-"
265
+ ? key.slice(3)
266
+ : key
267
+ .slice(2)
268
+ .replace(/[A-Z]/g, (m, i) => (i ? "-" : "") + m.toLowerCase());
269
+ }
@@ -187,15 +187,13 @@ exports.p = function (htmlCompat) {
187
187
 
188
188
  for (const key in originalInput) {
189
189
  const value = originalInput[key];
190
- if (/^on[-A-Z]/.test(key)) {
191
- if (typeof value === "function") {
192
- (customEvents || (customEvents = [])).push([
193
- key[2] === "-" ? key.slice(3) : key.slice(2).toLowerCase(),
194
- value,
195
- ]);
196
- forceBoundary = true;
197
- value.toJSON = htmlCompat.toJSON(state);
198
- }
190
+ if (/^on[-A-Z]/.test(key) && typeof value === "function") {
191
+ (customEvents || (customEvents = [])).push([
192
+ toCustomEventName(key),
193
+ value,
194
+ ]);
195
+ forceBoundary = true;
196
+ value.toJSON = htmlCompat.toJSON(state);
199
197
  } else {
200
198
  input[key === "content" ? "renderBody" : key] = value;
201
199
  }
@@ -243,6 +241,14 @@ exports.p = function (htmlCompat) {
243
241
  };
244
242
  };
245
243
 
244
+ function toCustomEventName(key) {
245
+ return key[2] === "-"
246
+ ? key.slice(3)
247
+ : key
248
+ .slice(2)
249
+ .replace(/[A-Z]/g, (m, i) => (i ? "-" : "") + m.toLowerCase());
250
+ }
251
+
246
252
  function hasBridgedClassEvent(input) {
247
253
  if (input && typeof input === "object" && !Array.isArray(input)) {
248
254
  for (const key in input) {