@freelygive/canvas-utils 0.3.4-dev.3b4d338c → 0.3.4-dev.b8018f0b

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@freelygive/canvas-utils",
3
- "version": "0.3.4-dev.3b4d338c",
3
+ "version": "0.3.4-dev.b8018f0b",
4
4
  "description": "Canvas utility components and test helpers for Drupal Canvas projects.",
5
5
  "type": "module",
6
6
  "files": [
@@ -42,7 +42,9 @@ const parseCanvasSlot = (slot) => {
42
42
  // Use DOMParser for reliable HTML parsing
43
43
  const parser = new DOMParser();
44
44
  const doc = parser.parseFromString(html, 'text/html');
45
- const islands = doc.querySelectorAll('canvas-island[props]');
45
+ const islands = Array.from(doc.body.children).filter(
46
+ (child) => child.tagName === 'CANVAS-ISLAND' && child.hasAttribute('props'),
47
+ );
46
48
 
47
49
  if (islands.length === 0) return null;
48
50
 
@@ -64,7 +66,20 @@ const parseCanvasSlot = (slot) => {
64
66
  }
65
67
  }
66
68
 
67
- results.push({ props });
69
+ const slots = {};
70
+ island
71
+ .querySelectorAll('template[data-astro-template]')
72
+ .forEach((template) => {
73
+ const slotName = template.getAttribute('data-astro-template');
74
+
75
+ if (!slotName) {
76
+ return;
77
+ }
78
+
79
+ slots[slotName] = template.innerHTML;
80
+ });
81
+
82
+ results.push({ props, slots });
68
83
  } catch {
69
84
  // Skip malformed entries
70
85
  }