@esportsplus/template 0.41.0 → 0.41.2
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/event/index.js +1 -1
- package/build/html.d.ts +1 -1
- package/build/index.d.ts +1 -3
- package/build/index.js +1 -3
- package/build/render.d.ts +2 -2
- package/build/slot/index.d.ts +6 -2
- package/build/slot/index.js +12 -2
- package/build/types.d.ts +2 -14
- package/package.json +2 -2
- package/src/event/index.ts +1 -1
- package/src/html.ts +1 -1
- package/src/index.ts +1 -3
- package/src/render.ts +2 -2
- package/src/slot/index.ts +13 -3
- package/src/types.ts +2 -16
package/build/event/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { root } from '@esportsplus/reactivity';
|
|
2
2
|
import { defineProperty } from '@esportsplus/utilities';
|
|
3
|
-
import { ondisconnect as disconnect } from '../slot/
|
|
3
|
+
import { ondisconnect as disconnect } from '../slot/index.js';
|
|
4
4
|
import onconnect from './onconnect.js';
|
|
5
5
|
import onresize from './onresize.js';
|
|
6
6
|
import ontick from './ontick.js';
|
package/build/html.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Reactive } from '@esportsplus/reactivity';
|
|
2
2
|
import { Attribute, Attributes, Renderable } from './types.js';
|
|
3
|
-
import { ArraySlot } from './slot/
|
|
3
|
+
import { ArraySlot } from './slot/index.js';
|
|
4
4
|
type Values<T> = ArraySlot<T extends unknown[] ? T : never> | Attribute | Attributes<any> | Renderable<T>;
|
|
5
5
|
declare const html: {
|
|
6
6
|
<T>(_literals: TemplateStringsArray, ..._values: (Values<T> | Values<T>[])[]): DocumentFragment;
|
package/build/index.d.ts
CHANGED
|
@@ -5,7 +5,5 @@ export * from './utilities.js';
|
|
|
5
5
|
export { default as html } from './html.js';
|
|
6
6
|
export { default as render } from './render.js';
|
|
7
7
|
export { default as svg } from './svg.js';
|
|
8
|
-
export { ArraySlot } from './slot/
|
|
9
|
-
export { EffectSlot } from './slot/effect.js';
|
|
10
|
-
export { default as slot } from './slot/index.js';
|
|
8
|
+
export { ArraySlot, EffectSlot } from './slot/index.js';
|
|
11
9
|
export type { Attributes, Element, Renderable } from './types.js';
|
package/build/index.js
CHANGED
|
@@ -10,6 +10,4 @@ export * from './utilities.js';
|
|
|
10
10
|
export { default as html } from './html.js';
|
|
11
11
|
export { default as render } from './render.js';
|
|
12
12
|
export { default as svg } from './svg.js';
|
|
13
|
-
export { ArraySlot } from './slot/
|
|
14
|
-
export { EffectSlot } from './slot/effect.js';
|
|
15
|
-
export { default as slot } from './slot/index.js';
|
|
13
|
+
export { ArraySlot, EffectSlot } from './slot/index.js';
|
package/build/render.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const _default: <T>(parent: HTMLElement, renderable:
|
|
1
|
+
import { Renderable } from './types.js';
|
|
2
|
+
declare const _default: <T>(parent: HTMLElement, renderable: Renderable<T>) => void;
|
|
3
3
|
export default _default;
|
package/build/slot/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import { Element } from '../types.js';
|
|
2
|
-
declare const _default: (anchor: Element,
|
|
1
|
+
import { Element, Renderable } from '../types.js';
|
|
2
|
+
declare const _default: <T>(anchor: Element, renderable: Renderable<T>) => void;
|
|
3
3
|
export default _default;
|
|
4
|
+
export * from './array.js';
|
|
5
|
+
export * from './cleanup.js';
|
|
6
|
+
export * from './effect.js';
|
|
7
|
+
export { default as render } from './render.js';
|
package/build/slot/index.js
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
+
import { EffectSlot } from './effect.js';
|
|
1
2
|
import render from './render.js';
|
|
2
|
-
export default (anchor,
|
|
3
|
-
|
|
3
|
+
export default (anchor, renderable) => {
|
|
4
|
+
if (typeof renderable === 'function') {
|
|
5
|
+
new EffectSlot(anchor, renderable);
|
|
6
|
+
}
|
|
7
|
+
else {
|
|
8
|
+
anchor.after(render(anchor, renderable));
|
|
9
|
+
}
|
|
4
10
|
};
|
|
11
|
+
export * from './array.js';
|
|
12
|
+
export * from './cleanup.js';
|
|
13
|
+
export * from './effect.js';
|
|
14
|
+
export { default as render } from './render.js';
|
package/build/types.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { ArraySlot } from './slot/
|
|
2
|
-
import { setProperties } from './attributes.js';
|
|
3
|
-
import slot from './slot/index.js';
|
|
1
|
+
import { ArraySlot } from './slot/index.js';
|
|
4
2
|
type Attribute = Effect<Primitive | Primitive[]> | ((...args: any[]) => void) | Primitive;
|
|
5
3
|
type Attributes<T extends HTMLElement = Element> = {
|
|
6
4
|
class?: Attribute | Attribute[];
|
|
@@ -22,14 +20,4 @@ type SlotGroup = {
|
|
|
22
20
|
head: Element;
|
|
23
21
|
tail: Element;
|
|
24
22
|
};
|
|
25
|
-
type
|
|
26
|
-
fragment: DocumentFragment;
|
|
27
|
-
html: string;
|
|
28
|
-
literals: TemplateStringsArray;
|
|
29
|
-
slots: {
|
|
30
|
-
fn: typeof setProperties | typeof slot;
|
|
31
|
-
name: string | null;
|
|
32
|
-
path: (() => ChildNode | null)[];
|
|
33
|
-
}[] | null;
|
|
34
|
-
};
|
|
35
|
-
export type { Attribute, Attributes, Effect, Element, Renderable, SlotGroup, Template };
|
|
23
|
+
export type { Attribute, Attributes, Effect, Element, Renderable, SlotGroup };
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"author": "ICJR",
|
|
3
3
|
"dependencies": {
|
|
4
4
|
"@esportsplus/queue": "^0.2.0",
|
|
5
|
-
"@esportsplus/reactivity": "^0.29.
|
|
5
|
+
"@esportsplus/reactivity": "^0.29.14",
|
|
6
6
|
"@esportsplus/typescript": "^0.27.3",
|
|
7
7
|
"@esportsplus/utilities": "^0.27.2",
|
|
8
8
|
"serve": "^14.2.5"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"type": "module",
|
|
41
41
|
"types": "./build/index.d.ts",
|
|
42
|
-
"version": "0.41.
|
|
42
|
+
"version": "0.41.2",
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "tsc",
|
|
45
45
|
"build:test": "vite build --config test/vite.config.ts",
|
package/src/event/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { root } from '@esportsplus/reactivity';
|
|
2
2
|
import { defineProperty } from '@esportsplus/utilities';
|
|
3
|
+
import { ondisconnect as disconnect } from '~/slot';
|
|
3
4
|
import { Attributes, Element } from '~/types';
|
|
4
|
-
import { ondisconnect as disconnect } from '~/slot/cleanup';
|
|
5
5
|
import onconnect from './onconnect';
|
|
6
6
|
import onresize from './onresize';
|
|
7
7
|
import ontick from './ontick';
|
package/src/html.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Reactive } from '@esportsplus/reactivity';
|
|
2
2
|
import { Attribute, Attributes, Renderable } from '~/types';
|
|
3
|
-
import { ArraySlot } from '~/slot
|
|
3
|
+
import { ArraySlot } from '~/slot';
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
type Values<T> = ArraySlot<T extends unknown[] ? T : never> | Attribute | Attributes<any> | Renderable<T>;
|
package/src/index.ts
CHANGED
|
@@ -17,7 +17,5 @@ export * from './utilities';
|
|
|
17
17
|
export { default as html } from './html';
|
|
18
18
|
export { default as render } from './render';
|
|
19
19
|
export { default as svg } from './svg';
|
|
20
|
-
export { ArraySlot } from './slot
|
|
21
|
-
export { EffectSlot } from './slot/effect';
|
|
22
|
-
export { default as slot } from './slot';
|
|
20
|
+
export { ArraySlot, EffectSlot } from './slot';
|
|
23
21
|
export type { Attributes, Element, Renderable } from './types';
|
package/src/render.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Element, Renderable } from './types';
|
|
2
2
|
import { marker } from './utilities';
|
|
3
3
|
import slot from './slot';
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
export default <T>(parent: HTMLElement, renderable:
|
|
6
|
+
export default <T>(parent: HTMLElement, renderable: Renderable<T>) => {
|
|
7
7
|
let anchor = marker.cloneNode() as unknown as Element;
|
|
8
8
|
|
|
9
9
|
parent.nodeValue = '';
|
package/src/slot/index.ts
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EffectSlot } from './effect';
|
|
2
|
+
import { Element, Renderable } from '~/types';
|
|
2
3
|
import render from './render';
|
|
3
4
|
|
|
4
5
|
|
|
5
|
-
export default (anchor: Element,
|
|
6
|
-
|
|
6
|
+
export default <T>(anchor: Element, renderable: Renderable<T>) => {
|
|
7
|
+
if (typeof renderable === 'function') {
|
|
8
|
+
new EffectSlot(anchor, renderable);
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
anchor.after( render(anchor, renderable) );
|
|
12
|
+
}
|
|
7
13
|
};
|
|
14
|
+
export * from './array';
|
|
15
|
+
export * from './cleanup';
|
|
16
|
+
export * from './effect';
|
|
17
|
+
export { default as render } from './render';
|
package/src/types.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { ArraySlot } from './slot
|
|
2
|
-
import { setProperties } from './attributes';
|
|
3
|
-
import slot from './slot';
|
|
1
|
+
import { ArraySlot } from './slot';
|
|
4
2
|
|
|
5
3
|
|
|
6
4
|
type Attribute = Effect<Primitive | Primitive[]> | ((...args: any[]) => void) | Primitive;
|
|
@@ -33,22 +31,10 @@ type SlotGroup = {
|
|
|
33
31
|
tail: Element;
|
|
34
32
|
};
|
|
35
33
|
|
|
36
|
-
type Template = {
|
|
37
|
-
fragment: DocumentFragment;
|
|
38
|
-
html: string;
|
|
39
|
-
literals: TemplateStringsArray;
|
|
40
|
-
slots: {
|
|
41
|
-
fn: typeof setProperties | typeof slot;
|
|
42
|
-
name: string | null;
|
|
43
|
-
path: (() => ChildNode | null)[];
|
|
44
|
-
}[] | null;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
34
|
|
|
48
35
|
export type {
|
|
49
36
|
Attribute, Attributes,
|
|
50
37
|
Effect, Element,
|
|
51
38
|
Renderable,
|
|
52
|
-
SlotGroup
|
|
53
|
-
Template
|
|
39
|
+
SlotGroup
|
|
54
40
|
};
|