@megabudino/stack-utils 1.3.0 → 1.4.0

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.
@@ -42,6 +42,13 @@ export function applyDomActions(html, actions) {
42
42
  if (action.setHtml !== undefined) {
43
43
  elements.html(action.setHtml);
44
44
  }
45
+ // Insertions compose with content replacement in the same action.
46
+ if (action.prependHtml !== undefined) {
47
+ elements.prepend(action.prependHtml);
48
+ }
49
+ if (action.appendHtml !== undefined) {
50
+ elements.append(action.appendHtml);
51
+ }
45
52
  }
46
53
  return $.html();
47
54
  }
@@ -14,6 +14,20 @@ export interface DomAction {
14
14
  setText?: string;
15
15
  /** Replace the inner HTML of every matched element. */
16
16
  setHtml?: string;
17
+ /**
18
+ * Insert HTML inside every matched element before its existing children.
19
+ *
20
+ * When combined with `setText` or `setHtml`, the content replacement runs
21
+ * first and `prependHtml` is inserted into the resulting element contents.
22
+ */
23
+ prependHtml?: string;
24
+ /**
25
+ * Insert HTML inside every matched element after its existing children.
26
+ *
27
+ * When combined with `setText` or `setHtml`, the content replacement runs
28
+ * first and `appendHtml` is inserted into the resulting element contents.
29
+ */
30
+ appendHtml?: string;
17
31
  /**
18
32
  * Remove every matched element.
19
33
  * When true, removal takes precedence over all other fields in the same action.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megabudino/stack-utils",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Reusable utilities for a SvelteKit stack, including a reverse proxy and static image pipeline",
5
5
  "type": "module",
6
6
  "exports": {