@neovici/cosmoz-utils 5.15.0 → 5.16.1
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/directives/portal.d.ts +3 -3
- package/dist/directives/portal.js +3 -2
- package/dist/directives/spread-props.d.ts +2 -2
- package/dist/directives/spread-props.js +2 -1
- package/dist/hooks/use-notify-property.d.ts +1 -1
- package/dist/hooks/use-notify-property.js +2 -2
- package/package.json +1 -1
|
@@ -4,12 +4,12 @@ declare class PortalDirective extends AsyncDirective {
|
|
|
4
4
|
_op?: ChildPart;
|
|
5
5
|
_outlet?: HTMLElement;
|
|
6
6
|
_content?: Part;
|
|
7
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
8
|
-
update(part: Part, [content, outlet]: [Part, HTMLElement]): import("lit-html").TemplateResult<1>;
|
|
7
|
+
render(content: Part, outlet?: HTMLElement): import("lit-html").TemplateResult<1>;
|
|
8
|
+
update(part: Part, [content, outlet]: [Part, HTMLElement?]): import("lit-html").TemplateResult<1>;
|
|
9
9
|
updateOutlet(outlet: HTMLElement, content: Part): void;
|
|
10
10
|
clearOutlet(): void;
|
|
11
11
|
disconnected(): void;
|
|
12
12
|
reconnected(): void;
|
|
13
13
|
}
|
|
14
|
-
export declare const portal: () => import("lit-html/directive").DirectiveResult<typeof PortalDirective>;
|
|
14
|
+
export declare const portal: (content: Part, outlet?: HTMLElement | undefined) => import("lit-html/directive").DirectiveResult<typeof PortalDirective>;
|
|
15
15
|
export {};
|
|
@@ -17,7 +17,8 @@ class PortalDirective extends AsyncDirective {
|
|
|
17
17
|
_op;
|
|
18
18
|
_outlet;
|
|
19
19
|
_content;
|
|
20
|
-
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
21
|
+
render(content, outlet = document.body) {
|
|
21
22
|
return html `<disconnect-observer
|
|
22
23
|
.onDisconnect=${() => {
|
|
23
24
|
this.isConnected = false;
|
|
@@ -27,7 +28,7 @@ class PortalDirective extends AsyncDirective {
|
|
|
27
28
|
}
|
|
28
29
|
update(part, [content, outlet = document.body]) {
|
|
29
30
|
this.updateOutlet(outlet, content);
|
|
30
|
-
return this.render();
|
|
31
|
+
return this.render(content, outlet);
|
|
31
32
|
}
|
|
32
33
|
updateOutlet(outlet, content) {
|
|
33
34
|
if (this._outlet !== outlet) {
|
|
@@ -2,8 +2,8 @@ import { AttributePart } from 'lit-html';
|
|
|
2
2
|
import { Directive } from 'lit-html/directive.js';
|
|
3
3
|
declare class SpreadPropsDirective<T extends object> extends Directive {
|
|
4
4
|
_props?: T;
|
|
5
|
-
render(): symbol;
|
|
5
|
+
render(props: T): symbol;
|
|
6
6
|
update(part: AttributePart, [props]: [T]): symbol;
|
|
7
7
|
}
|
|
8
|
-
export declare const spreadProps: () => import("lit-html/directive.js").DirectiveResult<typeof SpreadPropsDirective>;
|
|
8
|
+
export declare const spreadProps: (props: object) => import("lit-html/directive.js").DirectiveResult<typeof SpreadPropsDirective>;
|
|
9
9
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const notifyProperty: <K extends string, T extends HTMLElement & { [key in K]?: unknown; }>(host: T, name: K, value: T[K]) => void, useNotifyProperty: <T extends HTMLElement, K extends Extract<keyof T, string>, V extends T[K]>(name: K, value: V) => void;
|
|
1
|
+
declare const notifyProperty: <K extends string, T extends HTMLElement & { [key in K]?: unknown; }>(host: T, name: K, value: T[K]) => void, useNotifyProperty: <T extends HTMLElement, K extends Extract<keyof T, string>, V extends T[K]>(name: K, value: V, deps?: unknown[]) => void;
|
|
2
2
|
export { notifyProperty, useNotifyProperty };
|
|
@@ -10,10 +10,10 @@ notifyProperty = (host, name, value) => {
|
|
|
10
10
|
host.dispatchEvent(new CustomEvent(name.replace(UPPER, '-$1').toLowerCase() + '-changed', {
|
|
11
11
|
detail: { value },
|
|
12
12
|
}));
|
|
13
|
-
}, useNotifyProperty = (name, value) => {
|
|
13
|
+
}, useNotifyProperty = (name, value, deps = [value]) => {
|
|
14
14
|
const host = useHost();
|
|
15
15
|
useEffect(() => {
|
|
16
16
|
notifyProperty(host, name, value);
|
|
17
|
-
},
|
|
17
|
+
}, deps);
|
|
18
18
|
};
|
|
19
19
|
export { notifyProperty, useNotifyProperty };
|