@sigil-dev/types 0.9.16 → 0.9.18
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/README.md +7 -1
- package/index.d.ts +26 -1
- package/package.json +9 -2
- package/sigil-node.d.ts +0 -2
package/README.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
# @sigil-dev/types
|
|
2
2
|
|
|
3
|
-
TypeScript
|
|
3
|
+
TypeScript types for [Sigil](https://sigil.cane1712.dev): the JSX namespace and the compile-time macros `$state`, `$derived` and `$effect`, plus the `Component` type. Projects made with `sigil create` already have it; install it yourself only when setting up a project by hand.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
bun add -d @sigil-dev/types
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
**Docs:** [sigil.cane1712.dev/docs/reference/macros](https://sigil.cane1712.dev/docs/reference/macros)
|
package/index.d.ts
CHANGED
|
@@ -47,14 +47,31 @@ declare namespace $effect {
|
|
|
47
47
|
*/
|
|
48
48
|
declare function $inspect(...vals: unknown[]): void;
|
|
49
49
|
|
|
50
|
+
/** `use={fn}`: called with the element when it is created; may return a cleanup. */
|
|
51
|
+
type SigilDirective = (element: any, ...args: any[]) => unknown;
|
|
52
|
+
|
|
50
53
|
interface SigilBaseProps {
|
|
51
54
|
class?: string;
|
|
52
55
|
style?: React.CSSProperties | string;
|
|
53
|
-
|
|
56
|
+
/** Anything renderable: nodes, text, numbers, arrays, nothing. */
|
|
57
|
+
children?: unknown;
|
|
58
|
+
/** Identifies an item in a list, so it is moved rather than rebuilt. */
|
|
59
|
+
key?: string | number;
|
|
60
|
+
/** `use={fn}`, `use={[fn, options]}`, or several: `use={[a, [b, options]]}`. */
|
|
61
|
+
use?: SigilDirective | readonly unknown[];
|
|
62
|
+
/** The element itself, assigned to a `$state`. */
|
|
63
|
+
"bind:this"?: unknown;
|
|
54
64
|
bindThis?: unknown;
|
|
65
|
+
/** An animation played when the element appears and disappears. */
|
|
66
|
+
[transition: `transition:${string}`]: unknown;
|
|
67
|
+
[enter: `in:${string}`]: unknown;
|
|
68
|
+
[leave: `out:${string}`]: unknown;
|
|
55
69
|
}
|
|
56
70
|
|
|
57
71
|
interface SigilBindProps {
|
|
72
|
+
"bind:value"?: unknown;
|
|
73
|
+
"bind:checked"?: unknown;
|
|
74
|
+
"bind:group"?: unknown;
|
|
58
75
|
bindValue?: string | number;
|
|
59
76
|
bindChecked?: boolean;
|
|
60
77
|
}
|
|
@@ -105,6 +122,14 @@ interface Window {
|
|
|
105
122
|
|
|
106
123
|
declare namespace JSX {
|
|
107
124
|
type Element = React.JSX.Element;
|
|
125
|
+
/**
|
|
126
|
+
* What may be used as a component. A Sigil component returns DOM nodes,
|
|
127
|
+
* text or nothing rather than a React element, so any function counts.
|
|
128
|
+
*/
|
|
129
|
+
type ElementType =
|
|
130
|
+
| keyof IntrinsicElements
|
|
131
|
+
| ((props: any) => unknown)
|
|
132
|
+
| (new (props: any) => unknown);
|
|
108
133
|
interface ElementClass extends React.JSX.ElementClass {}
|
|
109
134
|
interface ElementAttributesProperty
|
|
110
135
|
extends React.JSX.ElementAttributesProperty {}
|
package/package.json
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sigil-dev/types",
|
|
3
|
-
"description": "JSX
|
|
4
|
-
"
|
|
3
|
+
"description": "TypeScript types for Sigil's JSX and compile-time macros ($state, $derived, $effect)",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"homepage": "https://sigil.cane1712.dev/docs/reference/macros",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://git.cane1712.dev/sigil/sigil.git",
|
|
9
|
+
"directory": "packages/types"
|
|
10
|
+
},
|
|
11
|
+
"version": "0.9.18",
|
|
5
12
|
"type": "module",
|
|
6
13
|
"exports": {
|
|
7
14
|
".": "./index.d.ts"
|