@o.z/zui 0.4.2 → 0.4.3

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.
@@ -1,12 +1,11 @@
1
1
  import { SafeHTML } from '../html';
2
+ import { UpdateMethods } from './types';
2
3
  export interface DefineElementOptions {
3
4
  tagName: string;
4
5
  html: string | SafeHTML;
5
6
  css?: string;
6
7
  options?: ElementDefinitionOptions;
7
8
  }
8
- export declare const defineElement: ({ tagName, html, css, options }: DefineElementOptions) => <T extends CustomElementConstructor>(originalClass: T, context: ClassDecoratorContext<T>) => T & {
9
- prototype: {
10
- zcolor: string;
11
- };
12
- };
9
+ export declare const defineElement: ({ tagName, html, css, options }: DefineElementOptions) => <T extends CustomElementConstructor>(originalClass: T & {
10
+ prototype: UpdateMethods<InstanceType<T>>;
11
+ }, context: ClassDecoratorContext<T>) => T;
@@ -1,3 +1,7 @@
1
+ export type PropertyUpdateMethod<T> = T extends number ? (oldValue: number, newValue: number) => void : T extends string ? (oldValue: string, newValue: string) => void : T extends boolean ? (oldValue: boolean, newValue: boolean) => void : (oldValue: T, newValue: T) => void;
2
+ export type UpdateMethods<T> = {
3
+ [K in keyof T as `${string & K}Update`]?: K extends keyof T ? PropertyUpdateMethod<T[K]> : never;
4
+ };
1
5
  export interface ZuiComponent extends HTMLElement {
2
6
  connected?(): void;
3
7
  disconnected?(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o.z/zui",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Next-generation Web Component framework leveraging TypeScript Stage 3 standard decorators.",
5
5
  "homepage": "https://github.com/z-npm/zui#readme",
6
6
  "docs": "https://github.com/z-npm/zui#readme",