@nifrajs/web-svelte 2.5.0 → 2.6.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.
package/dist/svg.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"svg.d.ts","sourceRoot":"","sources":["../src/svg.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAGpC,qGAAqG;AACrG,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAS/C;AAED;wBACwB;AACxB,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,KAAK,GAAG,KAAK,GAAG,SAAS,CAe9E"}
1
+ {"version":3,"file":"svg.d.ts","sourceRoot":"","sources":["../src/svg.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAGpC,qGAAqG;AACrG,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED;wBACwB;AACxB,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,KAAK,GAAG,KAAK,GAAG,SAAS,CAe9E"}
package/dist/svg.js CHANGED
@@ -8,15 +8,11 @@
8
8
  * project's `svelte` compiler. Pass `"dom"` for the client bundle and preload `"ssr"` for the server;
9
9
  * a plain `import "./icon.svg"` (asset URL) is untouched - only `?component` matches.
10
10
  */
11
- import { SVG_COMPONENT_FILTER } from "@nifrajs/web/plugins/svg";
11
+ import { SVG_COMPONENT_FILTER, stripSvgPreamble } from "@nifrajs/web/plugins/svg";
12
12
  import { compile } from "svelte/compiler";
13
13
  /** Wrap raw SVG XML in a Svelte 5 component: strip XML noise, spread props onto the root `<svg>`. */
14
14
  export function svgToSvelte(xml) {
15
- const cleaned = xml
16
- .replace(/<\?xml[\s\S]*?\?>/g, "")
17
- .replace(/<!--[\s\S]*?-->/g, "")
18
- .replace(/<!DOCTYPE[^>]*>/gi, "")
19
- .trim();
15
+ const cleaned = stripSvgPreamble(xml);
20
16
  // `$props()` opts the component into runes (Svelte 5); spread onto the root so user attrs win.
21
17
  const withSpread = cleaned.replace(/^(<svg\b[^>]*?)>/, "$1 {...props}>");
22
18
  return `<script>const props = $props()</script>\n${withSpread}\n`;
package/dist/svg.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"svg.js","sourceRoot":"","sources":["../src/svg.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAE/D,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEzC,qGAAqG;AACrG,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,MAAM,OAAO,GAAG,GAAG;SAChB,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC;SACjC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC;SAC/B,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC;SAChC,IAAI,EAAE,CAAA;IACT,+FAA+F;IAC/F,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACxE,OAAO,4CAA4C,UAAU,IAAI,CAAA;AACnE,CAAC;AAED;wBACwB;AACxB,MAAM,UAAU,2BAA2B,CAAC,QAAuB;IACjE,OAAO;QACL,IAAI,EAAE,oBAAoB,QAAQ,EAAE;QACpC,KAAK,CAAC,KAAK;YACT,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,oBAAoB,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;gBAC5D,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAA;gBACjD,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAA;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C,CAAC,IAAI,EAAE,CAAA;gBACvC,MAAM,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE;oBACvC,QAAQ,EAAE,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ;oBAClD,QAAQ,EAAE,IAAI;iBACf,CAAC,CAAA;gBACF,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;YAC5C,CAAC,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nifrajs/web-svelte",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "description": "Svelte 5 render adapter for @nifrajs/web - SSR + hydration + the .svelte compiler Bun-plugin.",
5
5
  "keywords": [
6
6
  "bun",
@@ -98,10 +98,10 @@
98
98
  "access": "public"
99
99
  },
100
100
  "dependencies": {
101
- "@nifrajs/core": "2.5.0",
102
- "@nifrajs/i18n": "2.5.0",
103
- "@nifrajs/image": "2.5.0",
104
- "@nifrajs/web": "2.5.0"
101
+ "@nifrajs/core": "2.6.0",
102
+ "@nifrajs/i18n": "2.6.0",
103
+ "@nifrajs/image": "2.6.0",
104
+ "@nifrajs/web": "2.6.0"
105
105
  },
106
106
  "peerDependencies": {
107
107
  "mdsvex": "^0.12",
package/src/svg.ts CHANGED
@@ -8,17 +8,13 @@
8
8
  * project's `svelte` compiler. Pass `"dom"` for the client bundle and preload `"ssr"` for the server;
9
9
  * a plain `import "./icon.svg"` (asset URL) is untouched - only `?component` matches.
10
10
  */
11
- import { SVG_COMPONENT_FILTER } from "@nifrajs/web/plugins/svg"
11
+ import { SVG_COMPONENT_FILTER, stripSvgPreamble } from "@nifrajs/web/plugins/svg"
12
12
  import type { BunPlugin } from "bun"
13
13
  import { compile } from "svelte/compiler"
14
14
 
15
15
  /** Wrap raw SVG XML in a Svelte 5 component: strip XML noise, spread props onto the root `<svg>`. */
16
16
  export function svgToSvelte(xml: string): string {
17
- const cleaned = xml
18
- .replace(/<\?xml[\s\S]*?\?>/g, "")
19
- .replace(/<!--[\s\S]*?-->/g, "")
20
- .replace(/<!DOCTYPE[^>]*>/gi, "")
21
- .trim()
17
+ const cleaned = stripSvgPreamble(xml)
22
18
  // `$props()` opts the component into runes (Svelte 5); spread onto the root so user attrs win.
23
19
  const withSpread = cleaned.replace(/^(<svg\b[^>]*?)>/, "$1 {...props}>")
24
20
  return `<script>const props = $props()</script>\n${withSpread}\n`