@mulanjs/mulanjs 1.0.1-dev.20260301171012 → 1.0.1-dev.20260305165012

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.
@@ -248,7 +248,12 @@ function generateDOMInstruction(node, chunks, getUid, getHoistId, hoists, uidRef
248
248
  }
249
249
  }
250
250
  else if (key === 'id') {
251
- chunks.push(`if (${id}) ${id}.id = _va("id", ${JSON.stringify(value)});`);
251
+ if (value.includes('${')) {
252
+ chunks.push(`this._bindEffect(() => { if (${id}) ${id}.id = _va("id", \`${value}\`); }, ${id});`);
253
+ }
254
+ else {
255
+ chunks.push(`if (${id}) ${id}.id = _va("id", ${JSON.stringify(value)});`);
256
+ }
252
257
  }
253
258
  else if (key === 'data-mu-id') {
254
259
  // Ignore internal string compiler metadata
@@ -362,6 +367,11 @@ function transform(node, scriptResult, scopedId, localScope = [], filename) {
362
367
  domBindings.push({ type: 'event', name: eventName, expr });
363
368
  delete element.props[key];
364
369
  }
370
+ else {
371
+ if (typeof element.props[key] === 'string' && element.props[key].includes('${')) {
372
+ element.props[key] = element.props[key].replace(/\$\{(.*?)\}/g, (_, expr) => '${' + processBindings(expr, scriptResult.bindings, localScope) + '}');
373
+ }
374
+ }
365
375
  }
366
376
  element.children.forEach(child => transform(child, scriptResult, scopedId, childScope, filename));
367
377
  }
package/dist/mulan.esm.js CHANGED
@@ -1400,20 +1400,32 @@ class MuRouter {
1400
1400
  return { route, params: {} };
1401
1401
  // Regex match for params e.g. /user/:id
1402
1402
  for (const r of this.routes) {
1403
+ if (r.path === '*' || r.path === '/*')
1404
+ continue; // Skip wildcards for regex matching
1403
1405
  const paramNames = [];
1404
1406
  const regexPath = r.path.replace(/:([^/]+)/g, (_, key) => {
1405
1407
  paramNames.push(key);
1406
1408
  return '([^/]+)';
1407
1409
  });
1408
- const match = new RegExp(`^${regexPath}$`).exec(hash);
1409
- if (match) {
1410
- const params = {};
1411
- paramNames.forEach((name, i) => {
1412
- // SECURE: Automatically sanitize all route parameters
1413
- params[name] = Security.sanitize(match[i + 1]);
1414
- });
1415
- return { route: r, params };
1410
+ try {
1411
+ const match = new RegExp(`^${regexPath}$`).exec(hash);
1412
+ if (match) {
1413
+ const params = {};
1414
+ paramNames.forEach((name, i) => {
1415
+ // SECURE: Automatically sanitize all route parameters
1416
+ params[name] = Security.sanitize(match[i + 1]);
1417
+ });
1418
+ return { route: r, params };
1419
+ }
1416
1420
  }
1421
+ catch (e) {
1422
+ // Ignore invalid regex paths
1423
+ }
1424
+ }
1425
+ // Match wildcard / catch-all routes (*) as a fallback
1426
+ const wildcardRoute = this.routes.find((r) => r.path === '*' || r.path === '/*');
1427
+ if (wildcardRoute) {
1428
+ return { route: wildcardRoute, params: {} };
1417
1429
  }
1418
1430
  return { route: undefined, params: {} };
1419
1431
  }