@neovici/cosmoz-utils 6.2.0 → 6.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.
@@ -0,0 +1 @@
1
+ export declare const useStyleSheet: (css: string) => void;
@@ -0,0 +1,15 @@
1
+ import { useEffect, useMemo } from '@pionjs/pion';
2
+ import { useHost } from './use-host';
3
+ export const useStyleSheet = (css) => {
4
+ const host = useHost();
5
+ const cs = useMemo(() => new CSSStyleSheet(), []);
6
+ useEffect(() => {
7
+ host.shadowRoot.adoptedStyleSheets = [
8
+ ...host.shadowRoot.adoptedStyleSheets,
9
+ cs,
10
+ ];
11
+ }, []);
12
+ useEffect(() => {
13
+ cs.replaceSync(css);
14
+ }, [css]);
15
+ };
package/dist/promise.d.ts CHANGED
@@ -5,7 +5,7 @@ export declare class ManagedPromise<T> extends Promise<T> {
5
5
  }
6
6
  export declare const timeout$: (ms?: number) => Promise<unknown>;
7
7
  type Predicate<T extends Event> = (e: T) => boolean;
8
- export declare const event$: <E extends Event, P extends Predicate<E>>(target: EventTarget, type: string, predicate?: P | undefined, timeout?: number) => Promise<unknown>;
8
+ export declare const event$: <E extends Event, P extends Predicate<E> = Predicate<E>>(target: EventTarget, type: string, predicate?: P | undefined, timeout?: number) => Promise<E>;
9
9
  export declare const limit$: <T extends unknown[], P>(fn: (...args: T) => PromiseLike<P>, limit: number) => (...args: T) => Promise<P>;
10
10
  export declare const debounce$: <T extends unknown[], P>(fn: (...args: T) => P | PromiseLike<P>, ms?: number) => (...args: T) => Promise<P>;
11
11
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-utils",
3
- "version": "6.2.0",
3
+ "version": "6.4.0",
4
4
  "description": "Date, money and template management functions commonly needed in Cosmoz views.",
5
5
  "keywords": [
6
6
  "polymer",