@sigil-dev/types 0.7.6 → 0.8.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.
Files changed (2) hide show
  1. package/index.d.ts +41 -8
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -42,14 +42,47 @@ 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 | number | boolean
47
+ | null | undefined
48
+ | SigilNode[]
49
+ | JSX.Element;
50
+
51
+ interface SigilBaseProps {
52
+ class?: string;
53
+ style?: React.CSSProperties | string;
54
+ children?: SigilNode;
55
+ bindThis?: unknown;
56
+ }
57
+
58
+ interface SigilBindProps {
59
+ bindValue?: string | number;
60
+ bindChecked?: boolean;
61
+ }
62
+
63
+ type LowercaseHandlers<T> = {
64
+ [K in keyof T as K extends `on${string}` ? Lowercase<K & string> : never]?: T[K];
65
+ };
66
+
67
+ type SigilIntrinsicElements = {
68
+ [K in keyof React.JSX.IntrinsicElements]:
69
+ Omit<React.JSX.IntrinsicElements[K], "style" | "children">
70
+ & SigilBaseProps
71
+ & LowercaseHandlers<React.JSX.IntrinsicElements[K]>;
72
+ };
48
73
 
49
74
  declare namespace JSX {
50
- type Element = any;
51
- interface ElementChildrenAttribute {
52
- children: {};
53
- }
54
- interface IntrinsicElements extends React.JSX.IntrinsicElements {}
75
+ type Element = React.JSX.Element;
76
+ interface ElementClass extends React.JSX.ElementClass {}
77
+ interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {}
78
+ interface ElementChildrenAttribute { children: {}; }
79
+ interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {}
80
+
81
+ interface IntrinsicElements extends SigilIntrinsicElements {
82
+ input: SigilIntrinsicElements["input"] & SigilBindProps;
83
+ textarea: SigilIntrinsicElements["textarea"] & SigilBindProps;
84
+ select: SigilIntrinsicElements["select"] & SigilBindProps;
85
+ }
55
86
  }
87
+
88
+ export type { SigilNode };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sigil-dev/types",
3
- "version": "0.7.6",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.d.ts"