@adukiorg/anza 0.4.0 → 0.4.1

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/CHANGELOG.md CHANGED
@@ -17,6 +17,14 @@ Versioning follows [Semantic Versioning](https://semver.org/).
17
17
 
18
18
  ---
19
19
 
20
+ ## [0.4.1] — 2026-06-14
21
+
22
+ ### Fixed
23
+
24
+ - **URL Detection Bug**: Fixed a critical bug in both the JS runtime (`utils.js`, `element.js`) and the Rust compiler (`parse.rs`) where inline CSS strings starting with `/*` or `<!--` were mistakenly identified as file URLs. This bug was bypassing inline CSS injection when providing CSS string arrays.
25
+
26
+ ---
27
+
20
28
  ## [0.4.0] — 2026-06-14
21
29
 
22
30
  ### Added
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adukiorg/anza",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Anza web platform library — reactive state, networking, offline, animations, custom elements. Instant build step. Pure browser ESM.",
5
5
  "author": "fescii",
6
6
  "license": "MIT",
@@ -49,14 +49,17 @@ export function element(tag, spec, base) {
49
49
  warnMissingBase(tag, 'style', spec.style, base);
50
50
  warnMissingBase(tag, 'template', spec.template, base);
51
51
 
52
+ const isStyleUrl = s => typeof s === 'string' && (s.endsWith('.css') || ((s.startsWith('./') || s.startsWith('/')) && !s.startsWith('/*') && !s.includes('{')));
53
+ const isTemplateUrl = s => typeof s === 'string' && (s.endsWith('.html') || ((s.startsWith('./') || s.startsWith('/')) && !s.startsWith('<!--') && !s.includes('<')));
54
+
52
55
  // Resolve absolute URLs relative to import.meta.url (base)
53
56
  const styleUrls = Array.isArray(spec.style)
54
- ? spec.style.filter(s => s && base && (s.endsWith('.css') || s.startsWith('./') || s.startsWith('/'))).map(s => new URL(s, base).href)
55
- : (spec.style && base && (spec.style.endsWith('.css') || spec.style.startsWith('./') || spec.style.startsWith('/'))
57
+ ? spec.style.filter(s => s && base && isStyleUrl(s)).map(s => new URL(s, base).href)
58
+ : (spec.style && base && isStyleUrl(spec.style)
56
59
  ? [new URL(spec.style, base).href]
57
60
  : []);
58
61
 
59
- const templateUrl = spec.template && base && (spec.template.endsWith('.html') || spec.template.startsWith('./') || spec.template.startsWith('/'))
62
+ const templateUrl = spec.template && base && isTemplateUrl(spec.template)
60
63
  ? new URL(spec.template, base).href
61
64
  : null;
62
65
 
@@ -51,12 +51,18 @@ export async function preloadResources(tag, styleUrls, templateUrl, inlineTempla
51
51
  }));
52
52
 
53
53
  if (inlineStyle) {
54
- if (supportsSheets) {
55
- const sheet = new CSSStyleSheet();
56
- sheet.replaceSync(inlineStyle);
57
- stylesheets.push(sheet);
58
- } else {
59
- cssTextAcc += inlineStyle + '\n';
54
+ const inlineStyles = Array.isArray(inlineStyle) ? inlineStyle : [inlineStyle];
55
+ // Filter out ones that are likely URLs (they were fetched above)
56
+ const isUrl = s => typeof s === 'string' && (s.endsWith('.css') || ((s.startsWith('./') || s.startsWith('/')) && !s.startsWith('/*') && !s.includes('{')));
57
+ const inlines = inlineStyles.filter(s => !isUrl(s));
58
+ for (const style of inlines) {
59
+ if (supportsSheets) {
60
+ const sheet = new CSSStyleSheet();
61
+ sheet.replaceSync(style);
62
+ stylesheets.push(sheet);
63
+ } else {
64
+ cssTextAcc += style + '\n';
65
+ }
60
66
  }
61
67
  }
62
68
 
@@ -99,7 +105,7 @@ export async function preloadResources(tag, styleUrls, templateUrl, inlineTempla
99
105
  templateNode = createTemplateFragment(inlineTemplate);
100
106
  }
101
107
 
102
- return { templateNode, stylesheet, cssText, tagsDescriptor };
108
+ return { templateNode, stylesheets, cssText, tagsDescriptor };
103
109
  }
104
110
 
105
111
  /**