j20 0.0.19 → 0.0.21

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/index.d.ts CHANGED
@@ -190,7 +190,6 @@ declare global {
190
190
  [k: string]: boolean | undefined;
191
191
  }
192
192
  | undefined;
193
- $ServerOnly?: boolean | undefined;
194
193
  }
195
194
  type Accessor<T> = () => T;
196
195
  interface Directives {}
@@ -4607,17 +4606,49 @@ interface RefObject<T> {
4607
4606
  declare function ref<T>(init: T): RefObject<T>;
4608
4607
  declare function ref<T>(): RefObject<T>;
4609
4608
 
4610
- declare const wc: () => {
4611
- host: Element;
4612
- emit: (name: string, detail: any) => void;
4613
- onConnectedCallback: (callback: () => void) => void;
4614
- onDisconnectedCallback: (callback: () => void) => void;
4609
+ type FC<P extends Record<string, any> = {}> = {
4610
+ isLogic?: boolean;
4611
+ } & ((props: P) => JSX.Element);
4612
+ type AttrValueType = string | number | boolean;
4613
+ type CustomElement<P extends Record<string, any> = {}> = {
4614
+ tag: string;
4615
+ mode?: "open" | "closed";
4616
+ style?: string | CSSStyleSheet;
4617
+ props?: {
4618
+ [K in keyof P as P[K] extends AttrValueType ? K : never]?: {
4619
+ type: P[K] extends string ? "string" : P[K] extends number ? "number" : P[K] extends boolean ? "boolean" : never;
4620
+ attribute: string;
4621
+ };
4622
+ };
4615
4623
  };
4624
+ type WC<P extends Record<string, string | boolean | number> = {}, E extends Record<string, any> = {}> = {
4625
+ customElement: CustomElement<P>;
4626
+ } & ((props: JSX.HTMLAttributes<HTMLElement> & {
4627
+ children?: JSX.Element;
4628
+ } & P & {
4629
+ [K in keyof E as `on${Capitalize<K & string>}`]: (e: E[K]) => void;
4630
+ }) => JSX.Element);
4631
+ type ExtractClasses<T extends string> = T extends `${string}.${infer Name} {${infer Body}${infer _Brace}${infer Rest}` ? Name | ExtractClasses<Body> | ExtractClasses<Rest> : T extends `${string}\n${infer Rest}` ? ExtractClasses<Rest> : never;
4616
4632
 
4617
4633
  interface SignalLike<T = any> {
4618
4634
  value: T;
4619
4635
  }
4620
4636
 
4637
+ declare const registerWebComponent: <C extends WC<any, any>>(Comp: C) => void;
4638
+ declare abstract class WebComponentClass extends HTMLElement {
4639
+ abstract customElement: CustomElement;
4640
+ constructor();
4641
+ addStyleSheet(styleSheet: CSSStyleSheet): void;
4642
+ removeStyleSheet(styleSheet: CSSStyleSheet): void;
4643
+ }
4644
+
4645
+ declare const wc: () => {
4646
+ host: WebComponentClass;
4647
+ emit: (name: string, detail: any) => void;
4648
+ onConnectedCallback: (callback: () => void) => void;
4649
+ onDisconnectedCallback: (callback: () => void) => void;
4650
+ };
4651
+
4621
4652
  declare const $: <T>(val: T) => T extends SignalLike ? (typeof val)["value"] : SignalLike<T>;
4622
4653
 
4623
4654
  declare const createContext: <T>(defaultValue: T) => {
@@ -4648,32 +4679,8 @@ declare const onMount: (callback: () => (() => void) | void) => void;
4648
4679
 
4649
4680
  declare const onDestroy: (callback: () => void) => _j20org_signal.Effect;
4650
4681
 
4651
- type FC<P extends Record<string, any> = {}> = {
4652
- isLogic?: boolean;
4653
- } & ((props: P) => JSX.Element);
4654
- type AttrValueType = string | number | boolean;
4655
- type CustomElement<P extends Record<string, any> = {}> = {
4656
- tag: string;
4657
- mode?: "open" | "closed";
4658
- style?: string | CSSStyleSheet;
4659
- props?: {
4660
- [K in keyof P as P[K] extends AttrValueType ? K : never]?: {
4661
- type: P[K] extends string ? "string" : P[K] extends number ? "number" : P[K] extends boolean ? "boolean" : never;
4662
- attribute: string;
4663
- };
4664
- };
4665
- };
4666
- type WC<P extends Record<string, string | boolean | number> = {}, E extends Record<string, any> = {}> = {
4667
- customElement: CustomElement<P>;
4668
- } & ((props: JSX.HTMLAttributes<HTMLElement> & {
4669
- children?: JSX.Element;
4670
- } & P & {
4671
- [K in keyof E as `on${Capitalize<K & string>}`]: (e: E[K]) => void;
4672
- }) => JSX.Element);
4673
- type ExtractClasses<T extends string> = T extends `${string}.${infer Name} {${infer Body}${infer _Brace}${infer Rest}` ? Name | ExtractClasses<Body> | ExtractClasses<Rest> : T extends `${string}\n${infer Rest}` ? ExtractClasses<Rest> : never;
4674
-
4675
- declare const sheet: (css?: string) => CSSStyleSheet;
4676
- declare const css: <T extends string>(css: T) => { [K in ExtractClasses<T>]: string; };
4682
+ declare const createCss: <T extends string>(css: T) => () => { [K in ExtractClasses<T>]: string; };
4683
+ declare const styleSheet: (id: string, css?: string) => CSSStyleSheet;
4677
4684
 
4678
4685
  interface ListProps<T> {
4679
4686
  of: T[];
@@ -4735,7 +4742,7 @@ interface Instance {
4735
4742
  id: string;
4736
4743
  range: Text[];
4737
4744
  root?: Element;
4738
- host?: Element;
4745
+ host?: WebComponentClass;
4739
4746
  disposes?: (() => void)[];
4740
4747
  children?: Instance[];
4741
4748
  mounts?: (() => void)[];
@@ -4749,7 +4756,7 @@ declare const instanceCreate: (runner: () => any, parent?: Instance) => readonly
4749
4756
  declare const instanceGetElements: (instance: Instance) => Node[];
4750
4757
  declare const instanceDestroy: (parent: Instance, instance: Instance) => void;
4751
4758
 
4752
- declare const createRoot: (boot: () => JSX.Element, rootElement: Element) => Instance;
4759
+ declare const createRoot: (boot: (...args: any[]) => JSX.Element, rootElement: Element) => Instance;
4753
4760
 
4754
4761
  declare const h2: (tag: any, props: any, children: any) => JSX.Element;
4755
4762
  declare const jsx: (tag: any, props: any, children: any) => JSX.Element;
@@ -4759,8 +4766,6 @@ declare const Fragment: (props: {
4759
4766
  }) => any;
4760
4767
  declare const template: (template: string) => (isSvg: boolean) => any;
4761
4768
 
4762
- declare const registerWebComponent: <C extends WC<any, any>>(Comp: C) => void;
4763
-
4764
- export { $, $useContext, Case, Default, For, Fragment, If, Replace, Some, Switch, createComponent, createContext, createDom, createElement, createLogicComponent, createRoot, css, effect, getCurrentInstance, h2, id, instanceCreate, instanceCreateElement, instanceDestroy, instanceGetElements, instanceInit, jsx, jsxs, mounts, onDestroy, onMount, ref, registerWebComponent, securityGetCurrentInstance, sheet, template, wc };
4769
+ export { $, $useContext, Case, Default, For, Fragment, If, Replace, Some, Switch, createComponent, createContext, createCss, createDom, createElement, createLogicComponent, createRoot, effect, getCurrentInstance, h2, id, instanceCreate, instanceCreateElement, instanceDestroy, instanceGetElements, instanceInit, jsx, jsxs, mounts, onDestroy, onMount, ref, registerWebComponent, securityGetCurrentInstance, styleSheet, template, wc };
4765
4770
  export type { AttrValueType, CaseProps, CustomElement, DOMElement, DefaultProps, ExtractClasses, FC, IfProps, Instance, ListProps, RefObject, ReplaceProps, ReplacePropsInner, SomeProps, SwitchProps, WC };
4766
4771
  //# sourceMappingURL=index.d.ts.map