@sigil-dev/types 0.7.7 → 0.8.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.
Files changed (2) hide show
  1. package/index.d.ts +50 -7
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -24,7 +24,7 @@ declare function $derived<T>(expression: T): T;
24
24
  /**
25
25
  * Declare a side effect
26
26
  */
27
- declare function $effect(fn: () => void | (() => void)): void;
27
+ declare function $effect(fn: () => undefined | (() => void)): void;
28
28
 
29
29
  declare namespace $effect {
30
30
  /**
@@ -34,7 +34,7 @@ declare namespace $effect {
34
34
  /**
35
35
  * Effect that flushes before DOM update
36
36
  */
37
- export function pre(fn: () => void | (() => void)): void;
37
+ export function pre(fn: () => undefined | (() => void)): void;
38
38
  }
39
39
 
40
40
  /**
@@ -42,14 +42,57 @@ declare namespace $effect {
42
42
  */
43
43
  declare function $inspect(...vals: unknown[]): void;
44
44
 
45
- type Component<P extends Record<string, unknown> = {}> = (
46
- props: P & { children?: React.ReactNode },
47
- ) => globalThis.Element;
45
+ type SigilNode =
46
+ | string
47
+ | number
48
+ | boolean
49
+ | null
50
+ | undefined
51
+ | SigilNode[]
52
+ | JSX.Element;
53
+
54
+ interface SigilBaseProps {
55
+ class?: string;
56
+ style?: React.CSSProperties | string;
57
+ children?: SigilNode;
58
+ bindThis?: unknown;
59
+ }
60
+
61
+ interface SigilBindProps {
62
+ bindValue?: string | number;
63
+ bindChecked?: boolean;
64
+ }
65
+
66
+ type LowercaseHandlers<T> = {
67
+ [K in keyof T as K extends `on${string}`
68
+ ? Lowercase<K & string>
69
+ : never]?: T[K];
70
+ };
71
+
72
+ type SigilIntrinsicElements = {
73
+ [K in keyof React.JSX.IntrinsicElements]: Omit<
74
+ React.JSX.IntrinsicElements[K],
75
+ "style" | "children"
76
+ > &
77
+ SigilBaseProps &
78
+ LowercaseHandlers<React.JSX.IntrinsicElements[K]>;
79
+ };
48
80
 
49
81
  declare namespace JSX {
50
- type Element = any;
82
+ type Element = React.JSX.Element;
83
+ interface ElementClass extends React.JSX.ElementClass {}
84
+ interface ElementAttributesProperty
85
+ extends React.JSX.ElementAttributesProperty {}
51
86
  interface ElementChildrenAttribute {
52
87
  children: {};
53
88
  }
54
- interface IntrinsicElements extends React.JSX.IntrinsicElements {}
89
+ interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {}
90
+
91
+ interface IntrinsicElements extends SigilIntrinsicElements {
92
+ input: SigilIntrinsicElements["input"] & SigilBindProps;
93
+ textarea: SigilIntrinsicElements["textarea"] & SigilBindProps;
94
+ select: SigilIntrinsicElements["select"] & SigilBindProps;
95
+ }
55
96
  }
97
+
98
+ export type { SigilNode };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sigil-dev/types",
3
- "version": "0.7.7",
3
+ "version": "0.8.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.d.ts"