rask-ui 0.22.0 → 0.24.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.
- package/dist/compiler.d.ts +3 -1
- package/dist/compiler.d.ts.map +1 -1
- package/dist/compiler.js +7 -1
- package/dist/component.d.ts +4 -18
- package/dist/component.d.ts.map +1 -1
- package/dist/component.js +14 -67
- package/dist/createComputed.d.ts +4 -0
- package/dist/createComputed.d.ts.map +1 -0
- package/dist/createComputed.js +69 -0
- package/dist/createContext.d.ts +26 -9
- package/dist/createContext.d.ts.map +1 -1
- package/dist/createContext.js +47 -30
- package/dist/createEffect.d.ts +2 -0
- package/dist/createEffect.d.ts.map +1 -0
- package/dist/createEffect.js +29 -0
- package/dist/createRouter.d.ts +8 -0
- package/dist/createRouter.d.ts.map +1 -0
- package/dist/createRouter.js +27 -0
- package/dist/createState.d.ts +2 -0
- package/dist/createState.d.ts.map +1 -1
- package/dist/createState.js +40 -5
- package/dist/createTask.d.ts +31 -0
- package/dist/createTask.d.ts.map +1 -0
- package/dist/createTask.js +79 -0
- package/dist/createView.d.ts +18 -44
- package/dist/createView.d.ts.map +1 -1
- package/dist/createView.js +57 -48
- package/dist/error.d.ts +3 -14
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +14 -15
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/jsx.d.ts +10 -256
- package/dist/observation.d.ts +1 -1
- package/dist/observation.d.ts.map +1 -1
- package/dist/patchInferno.d.ts +6 -0
- package/dist/patchInferno.d.ts.map +1 -0
- package/dist/patchInferno.js +53 -0
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +14 -26
- package/dist/scheduler.d.ts +4 -0
- package/dist/scheduler.d.ts.map +1 -0
- package/dist/scheduler.js +107 -0
- package/dist/tests/batch.test.d.ts +2 -0
- package/dist/tests/batch.test.d.ts.map +1 -0
- package/dist/tests/batch.test.js +244 -0
- package/dist/tests/createComputed.test.d.ts +2 -0
- package/dist/tests/createComputed.test.d.ts.map +1 -0
- package/dist/tests/createComputed.test.js +257 -0
- package/dist/tests/createContext.test.d.ts +2 -0
- package/dist/tests/createContext.test.d.ts.map +1 -0
- package/dist/tests/createContext.test.js +136 -0
- package/dist/tests/createEffect.test.d.ts +2 -0
- package/dist/tests/createEffect.test.d.ts.map +1 -0
- package/dist/tests/createEffect.test.js +467 -0
- package/dist/tests/createState.test.d.ts.map +1 -0
- package/dist/tests/createState.test.js +144 -0
- package/dist/tests/createTask.test.d.ts +2 -0
- package/dist/tests/createTask.test.d.ts.map +1 -0
- package/dist/tests/createTask.test.js +322 -0
- package/dist/tests/createView.test.d.ts.map +1 -0
- package/dist/{createView.test.js → tests/createView.test.js} +40 -40
- package/dist/tests/error.test.d.ts +2 -0
- package/dist/tests/error.test.d.ts.map +1 -0
- package/dist/tests/error.test.js +168 -0
- package/dist/tests/observation.test.d.ts.map +1 -0
- package/dist/tests/observation.test.js +341 -0
- package/dist/useCatchError.d.ts +6 -3
- package/dist/useCatchError.d.ts.map +1 -1
- package/dist/useCatchError.js +2 -2
- package/dist/useComputed.d.ts +5 -0
- package/dist/useComputed.d.ts.map +1 -0
- package/dist/useComputed.js +69 -0
- package/dist/useQuery.d.ts +25 -0
- package/dist/useQuery.d.ts.map +1 -0
- package/dist/useQuery.js +25 -0
- package/dist/useSuspendAsync.d.ts +18 -0
- package/dist/useSuspendAsync.d.ts.map +1 -0
- package/dist/useSuspendAsync.js +37 -0
- package/dist/useTask.d.ts +25 -0
- package/dist/useTask.d.ts.map +1 -0
- package/dist/useTask.js +70 -0
- package/package.json +1 -1
- package/swc-plugin/target/wasm32-wasip1/release/swc_plugin_rask_component.wasm +0 -0
- package/dist/asyncState.d.ts +0 -16
- package/dist/asyncState.d.ts.map +0 -1
- package/dist/asyncState.js +0 -24
- package/dist/context.d.ts +0 -5
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js +0 -29
- package/dist/createAsync.test.d.ts +0 -2
- package/dist/createAsync.test.d.ts.map +0 -1
- package/dist/createAsync.test.js +0 -110
- package/dist/createMutation.test.d.ts +0 -2
- package/dist/createMutation.test.d.ts.map +0 -1
- package/dist/createMutation.test.js +0 -168
- package/dist/createQuery.test.d.ts +0 -2
- package/dist/createQuery.test.d.ts.map +0 -1
- package/dist/createQuery.test.js +0 -156
- package/dist/createRef.d.ts +0 -6
- package/dist/createRef.d.ts.map +0 -1
- package/dist/createRef.js +0 -8
- package/dist/createState.test.d.ts.map +0 -1
- package/dist/createState.test.js +0 -111
- package/dist/createView.test.d.ts.map +0 -1
- package/dist/observation.test.d.ts.map +0 -1
- package/dist/observation.test.js +0 -150
- package/dist/suspense.d.ts +0 -25
- package/dist/suspense.d.ts.map +0 -1
- package/dist/suspense.js +0 -97
- package/dist/test-setup.d.ts +0 -16
- package/dist/test-setup.d.ts.map +0 -1
- package/dist/test-setup.js +0 -40
- package/dist/test.d.ts +0 -2
- package/dist/test.d.ts.map +0 -1
- package/dist/test.js +0 -24
- /package/dist/{createState.test.d.ts → tests/createState.test.d.ts} +0 -0
- /package/dist/{createView.test.d.ts → tests/createView.test.d.ts} +0 -0
- /package/dist/{observation.test.d.ts → tests/observation.test.d.ts} +0 -0
package/dist/jsx.d.ts
CHANGED
|
@@ -1,257 +1,11 @@
|
|
|
1
1
|
// JSX type definitions
|
|
2
|
-
//
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export interface ElementChildrenAttribute {
|
|
13
|
-
children: {};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface IntrinsicAttributes {
|
|
17
|
-
key?: any;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// CSS Properties
|
|
21
|
-
export type CSSProperties = {
|
|
22
|
-
[key: string]: string | number | undefined;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
// Common HTML Attributes
|
|
26
|
-
export interface HTMLAttributes<T = HTMLElement> {
|
|
27
|
-
ref?: Ref<T> | ((element: T | null) => void);
|
|
28
|
-
id?: string;
|
|
29
|
-
class?: string | Record<string, boolean>;
|
|
30
|
-
style?: string | CSSProperties;
|
|
31
|
-
title?: string;
|
|
32
|
-
role?: string;
|
|
33
|
-
tabIndex?: number;
|
|
34
|
-
|
|
35
|
-
onClick?: (event: MouseEvent) => void;
|
|
36
|
-
onDblClick?: (event: MouseEvent) => void;
|
|
37
|
-
onChange?: (event: Event) => void;
|
|
38
|
-
onInput?: (event: Event) => void;
|
|
39
|
-
onSubmit?: (event: Event) => void;
|
|
40
|
-
onFocus?: (event: FocusEvent) => void;
|
|
41
|
-
onBlur?: (event: FocusEvent) => void;
|
|
42
|
-
onKeyDown?: (event: KeyboardEvent) => void;
|
|
43
|
-
onKeyUp?: (event: KeyboardEvent) => void;
|
|
44
|
-
onKeyPress?: (event: KeyboardEvent) => void;
|
|
45
|
-
onMouseDown?: (event: MouseEvent) => void;
|
|
46
|
-
onMouseUp?: (event: MouseEvent) => void;
|
|
47
|
-
onMouseEnter?: (event: MouseEvent) => void;
|
|
48
|
-
onMouseLeave?: (event: MouseEvent) => void;
|
|
49
|
-
onMouseMove?: (event: MouseEvent) => void;
|
|
50
|
-
onMouseOver?: (event: MouseEvent) => void;
|
|
51
|
-
onMouseOut?: (event: MouseEvent) => void;
|
|
52
|
-
onWheel?: (event: WheelEvent) => void;
|
|
53
|
-
onScroll?: (event: Event) => void;
|
|
54
|
-
onTouchStart?: (event: TouchEvent) => void;
|
|
55
|
-
onTouchEnd?: (event: TouchEvent) => void;
|
|
56
|
-
onTouchMove?: (event: TouchEvent) => void;
|
|
57
|
-
onTouchCancel?: (event: TouchEvent) => void;
|
|
58
|
-
|
|
59
|
-
[key: `aria-${string}`]: string | boolean | number | undefined;
|
|
60
|
-
[key: `data-${string}`]: string | boolean | number | undefined;
|
|
61
|
-
|
|
62
|
-
children?: any;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface AnchorHTMLAttributes<T = HTMLAnchorElement>
|
|
66
|
-
extends HTMLAttributes<T> {
|
|
67
|
-
href?: string;
|
|
68
|
-
target?: "_blank" | "_self" | "_parent" | "_top";
|
|
69
|
-
rel?: string;
|
|
70
|
-
download?: string;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export interface ButtonHTMLAttributes<T = HTMLButtonElement>
|
|
74
|
-
extends HTMLAttributes<T> {
|
|
75
|
-
type?: "button" | "submit" | "reset";
|
|
76
|
-
disabled?: boolean;
|
|
77
|
-
name?: string;
|
|
78
|
-
value?: string;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface FormHTMLAttributes<T = HTMLFormElement>
|
|
82
|
-
extends HTMLAttributes<T> {
|
|
83
|
-
action?: string;
|
|
84
|
-
method?: "get" | "post";
|
|
85
|
-
enctype?: string;
|
|
86
|
-
target?: string;
|
|
87
|
-
noValidate?: boolean;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export interface InputHTMLAttributes<T = HTMLInputElement>
|
|
91
|
-
extends HTMLAttributes<T> {
|
|
92
|
-
type?:
|
|
93
|
-
| "button"
|
|
94
|
-
| "checkbox"
|
|
95
|
-
| "color"
|
|
96
|
-
| "date"
|
|
97
|
-
| "datetime-local"
|
|
98
|
-
| "email"
|
|
99
|
-
| "file"
|
|
100
|
-
| "hidden"
|
|
101
|
-
| "image"
|
|
102
|
-
| "month"
|
|
103
|
-
| "number"
|
|
104
|
-
| "password"
|
|
105
|
-
| "radio"
|
|
106
|
-
| "range"
|
|
107
|
-
| "reset"
|
|
108
|
-
| "search"
|
|
109
|
-
| "submit"
|
|
110
|
-
| "tel"
|
|
111
|
-
| "text"
|
|
112
|
-
| "time"
|
|
113
|
-
| "url"
|
|
114
|
-
| "week";
|
|
115
|
-
value?: string | number;
|
|
116
|
-
defaultValue?: string | number;
|
|
117
|
-
placeholder?: string;
|
|
118
|
-
disabled?: boolean;
|
|
119
|
-
required?: boolean;
|
|
120
|
-
readOnly?: boolean;
|
|
121
|
-
name?: string;
|
|
122
|
-
checked?: boolean;
|
|
123
|
-
defaultChecked?: boolean;
|
|
124
|
-
min?: string | number;
|
|
125
|
-
max?: string | number;
|
|
126
|
-
step?: string | number;
|
|
127
|
-
pattern?: string;
|
|
128
|
-
accept?: string;
|
|
129
|
-
multiple?: boolean;
|
|
130
|
-
autoComplete?: string;
|
|
131
|
-
autoFocus?: boolean;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export interface LabelHTMLAttributes<T = HTMLLabelElement>
|
|
135
|
-
extends HTMLAttributes<T> {
|
|
136
|
-
htmlFor?: string;
|
|
137
|
-
for?: string;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export interface SelectHTMLAttributes<T = HTMLSelectElement>
|
|
141
|
-
extends HTMLAttributes<T> {
|
|
142
|
-
value?: string | string[];
|
|
143
|
-
defaultValue?: string | string[];
|
|
144
|
-
disabled?: boolean;
|
|
145
|
-
required?: boolean;
|
|
146
|
-
name?: string;
|
|
147
|
-
multiple?: boolean;
|
|
148
|
-
size?: number;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export interface OptionHTMLAttributes<T = HTMLOptionElement>
|
|
152
|
-
extends HTMLAttributes<T> {
|
|
153
|
-
value?: string | number;
|
|
154
|
-
selected?: boolean;
|
|
155
|
-
disabled?: boolean;
|
|
156
|
-
label?: string;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export interface TextareaHTMLAttributes<T = HTMLTextAreaElement>
|
|
160
|
-
extends HTMLAttributes<T> {
|
|
161
|
-
value?: string;
|
|
162
|
-
defaultValue?: string;
|
|
163
|
-
placeholder?: string;
|
|
164
|
-
disabled?: boolean;
|
|
165
|
-
required?: boolean;
|
|
166
|
-
readOnly?: boolean;
|
|
167
|
-
name?: string;
|
|
168
|
-
rows?: number;
|
|
169
|
-
cols?: number;
|
|
170
|
-
maxLength?: number;
|
|
171
|
-
wrap?: "soft" | "hard";
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export interface FieldsetHTMLAttributes<T = HTMLFieldSetElement>
|
|
175
|
-
extends HTMLAttributes<T> {
|
|
176
|
-
disabled?: boolean;
|
|
177
|
-
name?: string;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
export interface ImgHTMLAttributes<T = HTMLImageElement>
|
|
181
|
-
extends HTMLAttributes<T> {
|
|
182
|
-
src?: string;
|
|
183
|
-
alt?: string;
|
|
184
|
-
width?: number | string;
|
|
185
|
-
height?: number | string;
|
|
186
|
-
loading?: "eager" | "lazy";
|
|
187
|
-
crossOrigin?: "anonymous" | "use-credentials";
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export interface SVGAttributes<T = SVGElement> extends HTMLAttributes<T> {
|
|
191
|
-
xmlns?: string;
|
|
192
|
-
viewBox?: string;
|
|
193
|
-
width?: number | string;
|
|
194
|
-
height?: number | string;
|
|
195
|
-
fill?: string;
|
|
196
|
-
stroke?: string;
|
|
197
|
-
strokeWidth?: number | string;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// Intrinsic Elements
|
|
201
|
-
export interface IntrinsicElements {
|
|
202
|
-
a: AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
203
|
-
abbr: HTMLAttributes<HTMLElement>;
|
|
204
|
-
address: HTMLAttributes<HTMLElement>;
|
|
205
|
-
article: HTMLAttributes<HTMLElement>;
|
|
206
|
-
aside: HTMLAttributes<HTMLElement>;
|
|
207
|
-
b: HTMLAttributes<HTMLElement>;
|
|
208
|
-
blockquote: HTMLAttributes<HTMLQuoteElement>;
|
|
209
|
-
body: HTMLAttributes<HTMLBodyElement>;
|
|
210
|
-
br: HTMLAttributes<HTMLBRElement>;
|
|
211
|
-
button: ButtonHTMLAttributes<HTMLButtonElement>;
|
|
212
|
-
canvas: HTMLAttributes<HTMLCanvasElement>;
|
|
213
|
-
code: HTMLAttributes<HTMLElement>;
|
|
214
|
-
div: HTMLAttributes<HTMLDivElement>;
|
|
215
|
-
em: HTMLAttributes<HTMLElement>;
|
|
216
|
-
fieldset: FieldsetHTMLAttributes<HTMLFieldSetElement>;
|
|
217
|
-
footer: HTMLAttributes<HTMLElement>;
|
|
218
|
-
form: FormHTMLAttributes<HTMLFormElement>;
|
|
219
|
-
h1: HTMLAttributes<HTMLHeadingElement>;
|
|
220
|
-
h2: HTMLAttributes<HTMLHeadingElement>;
|
|
221
|
-
h3: HTMLAttributes<HTMLHeadingElement>;
|
|
222
|
-
h4: HTMLAttributes<HTMLHeadingElement>;
|
|
223
|
-
h5: HTMLAttributes<HTMLHeadingElement>;
|
|
224
|
-
h6: HTMLAttributes<HTMLHeadingElement>;
|
|
225
|
-
head: HTMLAttributes<HTMLHeadElement>;
|
|
226
|
-
header: HTMLAttributes<HTMLElement>;
|
|
227
|
-
hr: HTMLAttributes<HTMLHRElement>;
|
|
228
|
-
html: HTMLAttributes<HTMLHtmlElement>;
|
|
229
|
-
i: HTMLAttributes<HTMLElement>;
|
|
230
|
-
img: ImgHTMLAttributes<HTMLImageElement>;
|
|
231
|
-
input: InputHTMLAttributes<HTMLInputElement>;
|
|
232
|
-
label: LabelHTMLAttributes<HTMLLabelElement>;
|
|
233
|
-
legend: HTMLAttributes<HTMLLegendElement>;
|
|
234
|
-
li: HTMLAttributes<HTMLLIElement>;
|
|
235
|
-
main: HTMLAttributes<HTMLElement>;
|
|
236
|
-
nav: HTMLAttributes<HTMLElement>;
|
|
237
|
-
ol: HTMLAttributes<HTMLOListElement>;
|
|
238
|
-
option: OptionHTMLAttributes<HTMLOptionElement>;
|
|
239
|
-
p: HTMLAttributes<HTMLParagraphElement>;
|
|
240
|
-
pre: HTMLAttributes<HTMLPreElement>;
|
|
241
|
-
section: HTMLAttributes<HTMLElement>;
|
|
242
|
-
select: SelectHTMLAttributes<HTMLSelectElement>;
|
|
243
|
-
small: HTMLAttributes<HTMLElement>;
|
|
244
|
-
span: HTMLAttributes<HTMLSpanElement>;
|
|
245
|
-
strong: HTMLAttributes<HTMLElement>;
|
|
246
|
-
style: HTMLAttributes<HTMLStyleElement>;
|
|
247
|
-
textarea: TextareaHTMLAttributes<HTMLTextAreaElement>;
|
|
248
|
-
ul: HTMLAttributes<HTMLUListElement>;
|
|
249
|
-
|
|
250
|
-
// SVG
|
|
251
|
-
svg: SVGAttributes<SVGSVGElement>;
|
|
252
|
-
circle: SVGAttributes<SVGCircleElement>;
|
|
253
|
-
line: SVGAttributes<SVGLineElement>;
|
|
254
|
-
path: SVGAttributes<SVGPathElement>;
|
|
255
|
-
rect: SVGAttributes<SVGRectElement>;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
2
|
+
// Re-export Inferno's comprehensive JSX types
|
|
3
|
+
import 'inferno';
|
|
4
|
+
|
|
5
|
+
// Re-export useful Inferno types for convenience
|
|
6
|
+
export type {
|
|
7
|
+
InfernoNode,
|
|
8
|
+
InfernoChild,
|
|
9
|
+
Component,
|
|
10
|
+
ComponentType,
|
|
11
|
+
} from 'inferno';
|
package/dist/observation.d.ts
CHANGED
|
@@ -83,7 +83,7 @@ export declare class Observer {
|
|
|
83
83
|
/** Subscribe this observer to a signal */
|
|
84
84
|
subscribeSignal(signal: Signal): void;
|
|
85
85
|
/** Remove all signal subscriptions (fast + safe) */
|
|
86
|
-
|
|
86
|
+
clearSignals(): void;
|
|
87
87
|
/** Begin dependency collection */
|
|
88
88
|
observe(): () => void;
|
|
89
89
|
/** Dispose the observer completely */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observation.d.ts","sourceRoot":"","sources":["../src/observation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AASH,wBAAgB,kBAAkB,yBAEjC;AAED;;;GAGG;AACH,cAAM,YAAY;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC;IAGnB,YAAY,EAAE,YAAY,GAAG,IAAI,CAAQ;IACzC,YAAY,EAAE,YAAY,GAAG,IAAI,CAAQ;IAGzC,cAAc,EAAE,YAAY,GAAG,IAAI,CAAQ;IAC3C,cAAc,EAAE,YAAY,GAAG,IAAI,CAAQ;IAG3C,MAAM,UAAQ;IAGd,cAAc,EAAE,MAAM,CAAC;gBAEX,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM;CAK9D;AAED;;GAEG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,IAAI,CAA6B;IACzC,OAAO,CAAC,IAAI,CAA6B;IAGzC,OAAO,CAAC,KAAK,CAAK;IAElB,8DAA8D;IAC9D,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,YAAY;IAe5C,wDAAwD;IACxD,YAAY,CAAC,GAAG,EAAE,YAAY;IAe9B;;OAEG;IACH,MAAM;CAgBP;AAED;;;GAGG;AACH,qBAAa,QAAQ;IACnB,UAAU,UAAS;IAGnB,OAAO,CAAC,QAAQ,CAA6B;IAC7C,OAAO,CAAC,QAAQ,CAA6B;IAG7C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAa;gBAE1B,QAAQ,EAAE,MAAM,IAAI,EAAE,WAAW,UAAO;IAcpD,kCAAkC;IAClC,OAAO;IAMP,0CAA0C;IAC1C,eAAe,CAAC,MAAM,EAAE,MAAM;IAe9B,oDAAoD;IACpD,
|
|
1
|
+
{"version":3,"file":"observation.d.ts","sourceRoot":"","sources":["../src/observation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AASH,wBAAgB,kBAAkB,yBAEjC;AAED;;;GAGG;AACH,cAAM,YAAY;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC;IAGnB,YAAY,EAAE,YAAY,GAAG,IAAI,CAAQ;IACzC,YAAY,EAAE,YAAY,GAAG,IAAI,CAAQ;IAGzC,cAAc,EAAE,YAAY,GAAG,IAAI,CAAQ;IAC3C,cAAc,EAAE,YAAY,GAAG,IAAI,CAAQ;IAG3C,MAAM,UAAQ;IAGd,cAAc,EAAE,MAAM,CAAC;gBAEX,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM;CAK9D;AAED;;GAEG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,IAAI,CAA6B;IACzC,OAAO,CAAC,IAAI,CAA6B;IAGzC,OAAO,CAAC,KAAK,CAAK;IAElB,8DAA8D;IAC9D,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,YAAY;IAe5C,wDAAwD;IACxD,YAAY,CAAC,GAAG,EAAE,YAAY;IAe9B;;OAEG;IACH,MAAM;CAgBP;AAED;;;GAGG;AACH,qBAAa,QAAQ;IACnB,UAAU,UAAS;IAGnB,OAAO,CAAC,QAAQ,CAA6B;IAC7C,OAAO,CAAC,QAAQ,CAA6B;IAG7C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAa;gBAE1B,QAAQ,EAAE,MAAM,IAAI,EAAE,WAAW,UAAO;IAcpD,kCAAkC;IAClC,OAAO;IAMP,0CAA0C;IAC1C,eAAe,CAAC,MAAM,EAAE,MAAM;IAe9B,oDAAoD;IACpD,YAAY;IAiBZ,kCAAkC;IAClC,OAAO;IAUP,sCAAsC;IACtC,OAAO;CAKR"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Temporarily patches document.addEventListener during render to capture
|
|
3
|
+
* and wrap Inferno's delegated event listeners with syncBatch
|
|
4
|
+
*/
|
|
5
|
+
export declare function patchInfernoEventHandling(renderFn: () => void): void;
|
|
6
|
+
//# sourceMappingURL=patchInferno.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patchInferno.d.ts","sourceRoot":"","sources":["../src/patchInferno.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,IAAI,QA0D7D"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { syncBatch } from "./batch";
|
|
2
|
+
/**
|
|
3
|
+
* Temporarily patches document.addEventListener during render to capture
|
|
4
|
+
* and wrap Inferno's delegated event listeners with syncBatch
|
|
5
|
+
*/
|
|
6
|
+
export function patchInfernoEventHandling(renderFn) {
|
|
7
|
+
const originalAddEventListener = document.addEventListener.bind(document);
|
|
8
|
+
const patchedEvents = new Set();
|
|
9
|
+
// Inferno's delegated events
|
|
10
|
+
const INFERNO_EVENTS = [
|
|
11
|
+
"click",
|
|
12
|
+
"dblclick",
|
|
13
|
+
"focusin",
|
|
14
|
+
"focusout",
|
|
15
|
+
"keydown",
|
|
16
|
+
"keypress",
|
|
17
|
+
"keyup",
|
|
18
|
+
"mousedown",
|
|
19
|
+
"mousemove",
|
|
20
|
+
"mouseup",
|
|
21
|
+
"touchend",
|
|
22
|
+
"touchmove",
|
|
23
|
+
"touchstart",
|
|
24
|
+
"change",
|
|
25
|
+
"input",
|
|
26
|
+
"submit",
|
|
27
|
+
];
|
|
28
|
+
// Temporarily replace addEventListener
|
|
29
|
+
document.addEventListener = function (type, listener, options) {
|
|
30
|
+
// Only wrap Inferno's delegated event listeners
|
|
31
|
+
if (INFERNO_EVENTS.includes(type) &&
|
|
32
|
+
typeof listener === "function" &&
|
|
33
|
+
!patchedEvents.has(type)) {
|
|
34
|
+
patchedEvents.add(type);
|
|
35
|
+
const wrappedListener = function (event) {
|
|
36
|
+
syncBatch(() => {
|
|
37
|
+
listener.call(this, event);
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
return originalAddEventListener(type, wrappedListener, options);
|
|
41
|
+
}
|
|
42
|
+
// @ts-ignore
|
|
43
|
+
return originalAddEventListener(type, listener, options);
|
|
44
|
+
};
|
|
45
|
+
try {
|
|
46
|
+
// Call render - Inferno will synchronously attach its listeners
|
|
47
|
+
renderFn();
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
// Restore original addEventListener
|
|
51
|
+
document.addEventListener = originalAddEventListener;
|
|
52
|
+
}
|
|
53
|
+
}
|
package/dist/plugin.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface RaskPluginOptions {
|
|
|
8
8
|
importSource?: string;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* Vite plugin for transforming JSX to Inferno
|
|
11
|
+
* Vite plugin for transforming JSX to Inferno with rask-ui/compiler imports
|
|
12
12
|
*/
|
|
13
13
|
export default function raskPlugin(options?: RaskPluginOptions): Plugin;
|
|
14
14
|
//# sourceMappingURL=plugin.d.ts.map
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAInC,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,MAAM,CAsE1E"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { fileURLToPath } from "url";
|
|
3
1
|
import { createRequire } from "module";
|
|
4
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
5
|
-
const __dirname = path.dirname(__filename);
|
|
6
2
|
const require = createRequire(import.meta.url);
|
|
7
3
|
/**
|
|
8
|
-
* Vite plugin for transforming JSX to Inferno
|
|
4
|
+
* Vite plugin for transforming JSX to Inferno with rask-ui/compiler imports
|
|
9
5
|
*/
|
|
10
6
|
export default function raskPlugin(options = {}) {
|
|
11
7
|
const importSource = options.importSource || "rask-ui";
|
|
12
8
|
// Resolve the path to swc-plugin-inferno WASM file
|
|
13
9
|
const infernoPluginPath = require.resolve("swc-plugin-inferno/swc_plugin_inferno.wasm");
|
|
14
|
-
// Resolve the path to our RaskComponent plugin
|
|
15
|
-
const componentPluginPath = path.resolve(__dirname, "../swc-plugin/target/wasm32-wasip1/release/swc_plugin_rask_component.wasm");
|
|
16
10
|
return {
|
|
17
11
|
name: "rask-plugin",
|
|
18
12
|
enforce: "pre",
|
|
@@ -35,23 +29,7 @@ export default function raskPlugin(options = {}) {
|
|
|
35
29
|
}
|
|
36
30
|
// Use SWC for transformation
|
|
37
31
|
const swc = await import("@swc/core");
|
|
38
|
-
|
|
39
|
-
// 1. FIRST: Inferno JSX transformation
|
|
40
|
-
[
|
|
41
|
-
infernoPluginPath,
|
|
42
|
-
{
|
|
43
|
-
importSource: `${importSource}/compiler`,
|
|
44
|
-
defineAllArguments: false,
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
];
|
|
48
|
-
// 2. SECOND: RaskComponent transformation (if enabled)
|
|
49
|
-
plugins.push([
|
|
50
|
-
componentPluginPath,
|
|
51
|
-
{
|
|
52
|
-
importSource: importSource,
|
|
53
|
-
},
|
|
54
|
-
]);
|
|
32
|
+
// First, run the inferno plugin to transform JSX
|
|
55
33
|
const result = await swc.transform(code, {
|
|
56
34
|
filename: id,
|
|
57
35
|
jsc: {
|
|
@@ -62,13 +40,23 @@ export default function raskPlugin(options = {}) {
|
|
|
62
40
|
},
|
|
63
41
|
target: "es2020",
|
|
64
42
|
experimental: {
|
|
65
|
-
plugins
|
|
43
|
+
plugins: [
|
|
44
|
+
// Inferno JSX transformation
|
|
45
|
+
[
|
|
46
|
+
infernoPluginPath,
|
|
47
|
+
{
|
|
48
|
+
defineAllArguments: false,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
],
|
|
66
52
|
},
|
|
67
53
|
},
|
|
68
54
|
sourceMaps: true,
|
|
69
55
|
});
|
|
56
|
+
// Then, replace inferno imports with rask-ui/compiler
|
|
57
|
+
const transformedCode = result.code.replace(/from\s+(['"])inferno\1/g, `from $1${importSource}/compiler$1`);
|
|
70
58
|
return {
|
|
71
|
-
code:
|
|
59
|
+
code: transformedCode,
|
|
72
60
|
map: result.map,
|
|
73
61
|
};
|
|
74
62
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../src/scheduler.ts"],"names":[],"mappings":"AAIA,wBAAgB,SAAS,SAExB;AAeD,wBAAgB,uBAAuB,SAWtC;AAmED,wBAAgB,qBAAqB,CAAC,MAAM,GAAE,WAAoB,cAoBjE"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
let depth = 0; // batching scope nesting
|
|
2
|
+
let dirty = false; // has any state update been enqueued?
|
|
3
|
+
let scheduled = false; // async flush scheduled?
|
|
4
|
+
export function markDirty() {
|
|
5
|
+
dirty = true;
|
|
6
|
+
}
|
|
7
|
+
function performWork() {
|
|
8
|
+
// TODO: call your Inferno render/commit once.
|
|
9
|
+
// infernoRender(vnode, container);
|
|
10
|
+
}
|
|
11
|
+
function flushNow() {
|
|
12
|
+
scheduled = false;
|
|
13
|
+
if (!dirty)
|
|
14
|
+
return;
|
|
15
|
+
dirty = false;
|
|
16
|
+
performWork();
|
|
17
|
+
}
|
|
18
|
+
// Called by setters after enqueueing their state change
|
|
19
|
+
export function enqueueUpdateFromSetter() {
|
|
20
|
+
dirty = true;
|
|
21
|
+
if (depth > 0) {
|
|
22
|
+
// We're inside a batched input event; we'll flush on exit (same frame).
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (!scheduled) {
|
|
26
|
+
scheduled = true;
|
|
27
|
+
queueMicrotask(flushNow); // one flush per task
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// Batch-scope control used by the global capture listeners
|
|
31
|
+
function enter() {
|
|
32
|
+
depth++;
|
|
33
|
+
}
|
|
34
|
+
function exit() {
|
|
35
|
+
if (--depth === 0) {
|
|
36
|
+
// End of the event propagation; commit now (before next paint).
|
|
37
|
+
flushNow();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// eventBatching.ts
|
|
41
|
+
const INTERACTIVE_EVENTS = [
|
|
42
|
+
// Pointer + mouse
|
|
43
|
+
"click",
|
|
44
|
+
"dblclick",
|
|
45
|
+
"contextmenu",
|
|
46
|
+
"mousedown",
|
|
47
|
+
"mouseup",
|
|
48
|
+
"mousemove",
|
|
49
|
+
"pointerdown",
|
|
50
|
+
"pointerup",
|
|
51
|
+
"pointermove",
|
|
52
|
+
"touchstart",
|
|
53
|
+
"touchmove",
|
|
54
|
+
"touchend",
|
|
55
|
+
"touchcancel",
|
|
56
|
+
"dragstart",
|
|
57
|
+
"drag",
|
|
58
|
+
"dragend",
|
|
59
|
+
"dragenter",
|
|
60
|
+
"dragleave",
|
|
61
|
+
"dragover",
|
|
62
|
+
"drop",
|
|
63
|
+
"wheel",
|
|
64
|
+
// Keyboard
|
|
65
|
+
"keydown",
|
|
66
|
+
"keypress",
|
|
67
|
+
"keyup",
|
|
68
|
+
// Focus & input
|
|
69
|
+
"focus",
|
|
70
|
+
"blur",
|
|
71
|
+
"focusin",
|
|
72
|
+
"focusout",
|
|
73
|
+
"input",
|
|
74
|
+
"beforeinput",
|
|
75
|
+
"change",
|
|
76
|
+
"compositionstart",
|
|
77
|
+
"compositionupdate",
|
|
78
|
+
"compositionend",
|
|
79
|
+
// Forms
|
|
80
|
+
"submit",
|
|
81
|
+
"reset",
|
|
82
|
+
// Selection / clipboard
|
|
83
|
+
"select",
|
|
84
|
+
"selectionchange",
|
|
85
|
+
"copy",
|
|
86
|
+
"cut",
|
|
87
|
+
"paste",
|
|
88
|
+
];
|
|
89
|
+
export function installGlobalBatching(target = window) {
|
|
90
|
+
const handlers = [];
|
|
91
|
+
INTERACTIVE_EVENTS.forEach((type) => {
|
|
92
|
+
const onCapture = () => {
|
|
93
|
+
enter();
|
|
94
|
+
// Close the scope after all handlers (capture→target→bubble) have run.
|
|
95
|
+
queueMicrotask(exit);
|
|
96
|
+
};
|
|
97
|
+
target.addEventListener(type, onCapture, { capture: true });
|
|
98
|
+
handlers.push([onCapture, { capture: true }]);
|
|
99
|
+
});
|
|
100
|
+
// Return a disposer so you can remove on unmount
|
|
101
|
+
return () => {
|
|
102
|
+
INTERACTIVE_EVENTS.forEach((type, i) => {
|
|
103
|
+
const [fn, opts] = handlers[i];
|
|
104
|
+
target.removeEventListener(type, fn, opts);
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch.test.d.ts","sourceRoot":"","sources":["../../src/tests/batch.test.ts"],"names":[],"mappings":""}
|