@esportsplus/template 0.41.2 → 0.41.4

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/build/index.d.ts CHANGED
@@ -4,6 +4,6 @@ export * from './event/index.js';
4
4
  export * from './utilities.js';
5
5
  export { default as html } from './html.js';
6
6
  export { default as render } from './render.js';
7
+ export { default as slot, ArraySlot, EffectSlot } from './slot/index.js';
7
8
  export { default as svg } from './svg.js';
8
- export { ArraySlot, EffectSlot } from './slot/index.js';
9
9
  export type { Attributes, Element, Renderable } from './types.js';
package/build/index.js CHANGED
@@ -9,5 +9,5 @@ export * from './event/index.js';
9
9
  export * from './utilities.js';
10
10
  export { default as html } from './html.js';
11
11
  export { default as render } from './render.js';
12
+ export { default as slot, ArraySlot, EffectSlot } from './slot/index.js';
12
13
  export { default as svg } from './svg.js';
13
- export { ArraySlot, EffectSlot } from './slot/index.js';
package/build/svg.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import html from './html.js';
2
2
  declare const svg: typeof html & {
3
- sprite: (href: string) => ReturnType<typeof html>;
3
+ sprite: (href: string) => DocumentFragment;
4
4
  };
5
5
  export default svg;
package/build/svg.js CHANGED
@@ -1,9 +1,14 @@
1
+ import { setProperty } from './attributes.js';
2
+ import { template } from './utilities.js';
1
3
  import html from './html.js';
4
+ let factory = template('<svg><use /></svg>');
2
5
  const svg = html.bind(null);
3
6
  svg.sprite = (href) => {
4
7
  if (href[0] !== '#') {
5
8
  href = '#' + href;
6
9
  }
7
- return html `<svg><use ${{ ['href']: href }} /></svg>`;
10
+ let root = factory();
11
+ setProperty(root.firstChild.firstChild, 'href', href);
12
+ return root;
8
13
  };
9
14
  export default svg;
package/package.json CHANGED
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "type": "module",
41
41
  "types": "./build/index.d.ts",
42
- "version": "0.41.2",
42
+ "version": "0.41.4",
43
43
  "scripts": {
44
44
  "build": "tsc",
45
45
  "build:test": "vite build --config test/vite.config.ts",
package/src/index.ts CHANGED
@@ -16,6 +16,6 @@ export * from './utilities';
16
16
 
17
17
  export { default as html } from './html';
18
18
  export { default as render } from './render';
19
+ export { default as slot, ArraySlot, EffectSlot } from './slot';
19
20
  export { default as svg } from './svg';
20
- export { ArraySlot, EffectSlot } from './slot';
21
21
  export type { Attributes, Element, Renderable } from './types';
package/src/svg.ts CHANGED
@@ -1,8 +1,14 @@
1
+ import { setProperty } from './attributes';
2
+ import { template } from './utilities';
3
+ import { Element } from './types';
1
4
  import html from './html';
2
5
 
3
6
 
7
+ let factory = template('<svg><use /></svg>');
8
+
9
+
4
10
  const svg = html.bind(null) as typeof html & {
5
- sprite: (href: string) => ReturnType<typeof html>
11
+ sprite: (href: string) => DocumentFragment
6
12
  };
7
13
 
8
14
  svg.sprite = (href: string) => {
@@ -10,7 +16,11 @@ svg.sprite = (href: string) => {
10
16
  href = '#' + href;
11
17
  }
12
18
 
13
- return html`<svg><use ${{ ['href']: href }} /></svg>`;
19
+ let root = factory();
20
+
21
+ setProperty(root.firstChild!.firstChild as Element, 'href', href);
22
+
23
+ return root;
14
24
  };
15
25
 
16
26