revojs 0.0.2 → 0.0.3

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.
@@ -1,8 +1,367 @@
1
- import { type Slot } from "../html";
1
+ import { type Primitiv, type Slot } from "../html";
2
+ export type EventAttributes = {
3
+ onScroll?: (event: Event) => void;
4
+ onScrollCapture?: (event: Event) => void;
5
+ onScrollEnd?: (event: Event) => void;
6
+ onScrollEndCapture?: (event: Event) => void;
7
+ onWheel?: (event: WheelEvent) => void;
8
+ onWheelCapture?: (event: WheelEvent) => void;
9
+ onAnimationCancel?: (event: AnimationEvent) => void;
10
+ onAnimationCancelCapture?: (event: AnimationEvent) => void;
11
+ onAnimationEnd?: (event: AnimationEvent) => void;
12
+ onAnimationEndCapture?: (event: AnimationEvent) => void;
13
+ onAnimationIteration?: (event: AnimationEvent) => void;
14
+ onAnimationIterationCapture?: (event: AnimationEvent) => void;
15
+ onAnimationStart?: (event: AnimationEvent) => void;
16
+ onAnimationStartCapture?: (event: AnimationEvent) => void;
17
+ onCopy?: (event: ClipboardEvent) => void;
18
+ onCopyCapture?: (event: ClipboardEvent) => void;
19
+ onCut?: (event: ClipboardEvent) => void;
20
+ onCutCapture?: (event: ClipboardEvent) => void;
21
+ onPaste?: (event: ClipboardEvent) => void;
22
+ onPasteCapture?: (event: ClipboardEvent) => void;
23
+ onCompositionEnd?: (event: CompositionEvent) => void;
24
+ onCompositionEndCapture?: (event: CompositionEvent) => void;
25
+ onCompositionStart?: (event: CompositionEvent) => void;
26
+ onCompositionStartCapture?: (event: CompositionEvent) => void;
27
+ onCompositionUpdate?: (event: CompositionEvent) => void;
28
+ onCompositionUpdateCapture?: (event: CompositionEvent) => void;
29
+ onBlur?: (event: FocusEvent) => void;
30
+ onBlurCapture?: (event: FocusEvent) => void;
31
+ onFocus?: (event: FocusEvent) => void;
32
+ onFocusCapture?: (event: FocusEvent) => void;
33
+ onFocusIn?: (event: FocusEvent) => void;
34
+ onFocusInCapture?: (event: FocusEvent) => void;
35
+ onFocusOut?: (event: FocusEvent) => void;
36
+ onFocusOutCapture?: (event: FocusEvent) => void;
37
+ onFullscreenChange?: (event: Event) => void;
38
+ onFullscreenChangeCapture?: (event: Event) => void;
39
+ onFullscreenError?: (event: Event) => void;
40
+ onFullscreenErrorCapture?: (event: Event) => void;
41
+ onKeyDown?: (event: KeyboardEvent) => void;
42
+ onKeyDownCapture?: (event: KeyboardEvent) => void;
43
+ onKeyPress?: (event: KeyboardEvent) => void;
44
+ onKeyPressCapture?: (event: KeyboardEvent) => void;
45
+ onKeyUp?: (event: KeyboardEvent) => void;
46
+ onKeyUpCapture?: (event: KeyboardEvent) => void;
47
+ onAuxClick?: (event: MouseEvent) => void;
48
+ onAuxClickCapture?: (event: MouseEvent) => void;
49
+ onClick?: (event: MouseEvent) => void;
50
+ onClickCapture?: (event: MouseEvent) => void;
51
+ onContextMenu?: (event: MouseEvent) => void;
52
+ onContextMenuCapture?: (event: MouseEvent) => void;
53
+ onDoubleClick?: (event: MouseEvent) => void;
54
+ onDoubleClickCapture?: (event: MouseEvent) => void;
55
+ onMouseDown?: (event: MouseEvent) => void;
56
+ onMouseDownCapture?: (event: MouseEvent) => void;
57
+ onMouseEnter?: (event: MouseEvent) => void;
58
+ onMouseEnterCapture?: (event: MouseEvent) => void;
59
+ onMouseLeave?: (event: MouseEvent) => void;
60
+ onMouseLeaveCapture?: (event: MouseEvent) => void;
61
+ onMouseMove?: (event: MouseEvent) => void;
62
+ onMouseMoveCapture?: (event: MouseEvent) => void;
63
+ onMouseOut?: (event: MouseEvent) => void;
64
+ onMouseOutCapture?: (event: MouseEvent) => void;
65
+ onMouseOver?: (event: MouseEvent) => void;
66
+ onMouseOverCapture?: (event: MouseEvent) => void;
67
+ onMouseUp?: (event: MouseEvent) => void;
68
+ onMouseUpCapture?: (event: MouseEvent) => void;
69
+ onMouseWheel?: (event: WheelEvent) => void;
70
+ onMouseWheelCapture?: (event: WheelEvent) => void;
71
+ onGotPointerCapture?: (event: PointerEvent) => void;
72
+ onGotPointerCaptureCapture?: (event: PointerEvent) => void;
73
+ onLostPointerCapture?: (event: PointerEvent) => void;
74
+ onLostPointerCaptureCapture?: (event: PointerEvent) => void;
75
+ onPointerCancel?: (event: PointerEvent) => void;
76
+ onPointerCancelCapture?: (event: PointerEvent) => void;
77
+ onPointerDown?: (event: PointerEvent) => void;
78
+ onPointerDownCapture?: (event: PointerEvent) => void;
79
+ onPointerEnter?: (event: PointerEvent) => void;
80
+ onPointerEnterCapture?: (event: PointerEvent) => void;
81
+ onPointerLeave?: (event: PointerEvent) => void;
82
+ onPointerLeaveCapture?: (event: PointerEvent) => void;
83
+ onPointerMove?: (event: PointerEvent) => void;
84
+ onPointerMoveCapture?: (event: PointerEvent) => void;
85
+ onPointerOut?: (event: PointerEvent) => void;
86
+ onPointerOutCapture?: (event: PointerEvent) => void;
87
+ onPointerOver?: (event: PointerEvent) => void;
88
+ onPointerOverCapture?: (event: PointerEvent) => void;
89
+ onPointerUp?: (event: PointerEvent) => void;
90
+ onPointerUpCapture?: (event: PointerEvent) => void;
91
+ onTouchCancel?: (event: TouchEvent) => void;
92
+ onTouchCancelCapture?: (event: TouchEvent) => void;
93
+ onTouchEnd?: (event: TouchEvent) => void;
94
+ onTouchEndCapture?: (event: TouchEvent) => void;
95
+ onTouchMove?: (event: TouchEvent) => void;
96
+ onTouchMoveCapture?: (event: TouchEvent) => void;
97
+ onTouchStart?: (event: TouchEvent) => void;
98
+ onTouchStartCapture?: (event: TouchEvent) => void;
99
+ onTransitionCancel?: (event: TransitionEvent) => void;
100
+ onTransitionCancelCapture?: (event: TransitionEvent) => void;
101
+ onTransitionEnd?: (event: TransitionEvent) => void;
102
+ onTransitionEndCapture?: (event: TransitionEvent) => void;
103
+ onTransitionRun?: (event: TransitionEvent) => void;
104
+ onTransitionRunCapture?: (event: TransitionEvent) => void;
105
+ onTransitionStart?: (event: TransitionEvent) => void;
106
+ onTransitionStartCapture?: (event: TransitionEvent) => void;
107
+ onFormData?: (event: FormDataEvent) => void;
108
+ onFormDataCapture?: (event: FormDataEvent) => void;
109
+ onReset?: (event: Event) => void;
110
+ onResetCapture?: (event: Event) => void;
111
+ onSubmit?: (event: Event) => void;
112
+ onSubmitCapture?: (event: Event) => void;
113
+ onInvalid?: (event: Event) => void;
114
+ onInvalidCapture?: (event: Event) => void;
115
+ onSelect?: (event: Event) => void;
116
+ onSelectCapture?: (event: Event) => void;
117
+ onSelectChange?: (event: Event) => void;
118
+ onSelectChangeCapture?: (event: Event) => void;
119
+ onInput?: (event: InputEvent) => void;
120
+ onInputCapture?: (event: InputEvent) => void;
121
+ onBeforeInput?: (event: InputEvent) => void;
122
+ onBeforeInputCapture?: (event: InputEvent) => void;
123
+ onChange?: (event: Event) => void;
124
+ onChangeCapture?: (event: Event) => void;
125
+ };
126
+ export type HtmlTags = Record<string, HtmlAttributes & EventAttributes>;
127
+ export type HtmlAttributes = Record<string, Primitiv>;
128
+ export type HtmlAnchorAttributes = HtmlAttributes & EventAttributes;
129
+ export type HtmlAbbrAttributes = HtmlAttributes & EventAttributes;
130
+ export type HtmlAddressAttributes = HtmlAttributes & EventAttributes;
131
+ export type HtmlAreaAttributes = HtmlAttributes & EventAttributes;
132
+ export type HtmlArticleAttributes = HtmlAttributes & EventAttributes;
133
+ export type HtmlAsideAttributes = HtmlAttributes & EventAttributes;
134
+ export type HtmlAudioAttributes = HtmlAttributes & EventAttributes;
135
+ export type HtmlBAttributes = HtmlAttributes & EventAttributes;
136
+ export type HtmlBaseAttributes = HtmlAttributes & EventAttributes;
137
+ export type HtmlBdiAttributes = HtmlAttributes & EventAttributes;
138
+ export type HtmlBdoAttributes = HtmlAttributes & EventAttributes;
139
+ export type HtmlBigAttributes = HtmlAttributes & EventAttributes;
140
+ export type HtmlBlockquoteAttributes = HtmlAttributes & EventAttributes;
141
+ export type HtmlBodyAttributes = HtmlAttributes & EventAttributes;
142
+ export type HtmlBrAttributes = HtmlAttributes & EventAttributes;
143
+ export type HtmlButtonAttributes = HtmlAttributes & EventAttributes;
144
+ export type HtmlCanvasAttributes = HtmlAttributes & EventAttributes;
145
+ export type HtmlCaptionAttributes = HtmlAttributes & EventAttributes;
146
+ export type HtmlCiteAttributes = HtmlAttributes & EventAttributes;
147
+ export type HtmlCodeAttributes = HtmlAttributes & EventAttributes;
148
+ export type HtmlColAttributes = HtmlAttributes & EventAttributes;
149
+ export type HtmlColgroupAttributes = HtmlAttributes & EventAttributes;
150
+ export type HtmlDataAttributes = HtmlAttributes & EventAttributes;
151
+ export type HtmlDatalistAttributes = HtmlAttributes & EventAttributes;
152
+ export type HtmlDdAttributes = HtmlAttributes & EventAttributes;
153
+ export type HtmlDelAttributes = HtmlAttributes & EventAttributes;
154
+ export type HtmlDetailsAttributes = HtmlAttributes & EventAttributes;
155
+ export type HtmlDfnAttributes = HtmlAttributes & EventAttributes;
156
+ export type HtmlDialogAttributes = HtmlAttributes & EventAttributes;
157
+ export type HtmlDivAttributes = HtmlAttributes & EventAttributes;
158
+ export type HtmlDlAttributes = HtmlAttributes & EventAttributes;
159
+ export type HtmlDtAttributes = HtmlAttributes & EventAttributes;
160
+ export type HtmlEmAttributes = HtmlAttributes & EventAttributes;
161
+ export type HtmlEmbedAttributes = HtmlAttributes & EventAttributes;
162
+ export type HtmlFieldsetAttributes = HtmlAttributes & EventAttributes;
163
+ export type HtmlFigcaptionAttributes = HtmlAttributes & EventAttributes;
164
+ export type HtmlFigureAttributes = HtmlAttributes & EventAttributes;
165
+ export type HtmlFooterAttributes = HtmlAttributes & EventAttributes;
166
+ export type HtmlFormAttributes = HtmlAttributes & EventAttributes;
167
+ export type HtmlH1Attributes = HtmlAttributes & EventAttributes;
168
+ export type HtmlH2Attributes = HtmlAttributes & EventAttributes;
169
+ export type HtmlH3Attributes = HtmlAttributes & EventAttributes;
170
+ export type HtmlH4Attributes = HtmlAttributes & EventAttributes;
171
+ export type HtmlH5Attributes = HtmlAttributes & EventAttributes;
172
+ export type HtmlH6Attributes = HtmlAttributes & EventAttributes;
173
+ export type HtmlHeadAttributes = HtmlAttributes & EventAttributes;
174
+ export type HtmlHeaderAttributes = HtmlAttributes & EventAttributes;
175
+ export type HtmlHgroupAttributes = HtmlAttributes & EventAttributes;
176
+ export type HtmlHrAttributes = HtmlAttributes & EventAttributes;
177
+ export type HtmlHtmlAttributes = HtmlAttributes & EventAttributes;
178
+ export type HtmlIAttributes = HtmlAttributes & EventAttributes;
179
+ export type HtmlIframeAttributes = HtmlAttributes & EventAttributes;
180
+ export type HtmlImgAttributes = HtmlAttributes & EventAttributes;
181
+ export type HtmlInputAttributes = HtmlAttributes & EventAttributes;
182
+ export type HtmlInsAttributes = HtmlAttributes & EventAttributes;
183
+ export type HtmlKbdAttributes = HtmlAttributes & EventAttributes;
184
+ export type HtmlKeygenAttributes = HtmlAttributes & EventAttributes;
185
+ export type HtmlLabelAttributes = HtmlAttributes & EventAttributes;
186
+ export type HtmlLegendAttributes = HtmlAttributes & EventAttributes;
187
+ export type HtmlLiAttributes = HtmlAttributes & EventAttributes;
188
+ export type HtmlLinkAttributes = HtmlAttributes & EventAttributes;
189
+ export type HtmlMainAttributes = HtmlAttributes & EventAttributes;
190
+ export type HtmlMapAttributes = HtmlAttributes & EventAttributes;
191
+ export type HtmlMarkAttributes = HtmlAttributes & EventAttributes;
192
+ export type HtmlMenuAttributes = HtmlAttributes & EventAttributes;
193
+ export type HtmlMenuitemAttributes = HtmlAttributes & EventAttributes;
194
+ export type HtmlMetaAttributes = HtmlAttributes & EventAttributes;
195
+ export type HtmlMeterAttributes = HtmlAttributes & EventAttributes;
196
+ export type HtmlNavAttributes = HtmlAttributes & EventAttributes;
197
+ export type HtmlNoindexAttributes = HtmlAttributes & EventAttributes;
198
+ export type HtmlNoscriptAttributes = HtmlAttributes & EventAttributes;
199
+ export type HtmlObjectAttributes = HtmlAttributes & EventAttributes;
200
+ export type HtmlOlAttributes = HtmlAttributes & EventAttributes;
201
+ export type HtmlOptgroupAttributes = HtmlAttributes & EventAttributes;
202
+ export type HtmlOptionAttributes = HtmlAttributes & EventAttributes;
203
+ export type HtmlOutputAttributes = HtmlAttributes & EventAttributes;
204
+ export type HtmlPAttributes = HtmlAttributes & EventAttributes;
205
+ export type HtmlParamAttributes = HtmlAttributes & EventAttributes;
206
+ export type HtmlPictureAttributes = HtmlAttributes & EventAttributes;
207
+ export type HtmlPreAttributes = HtmlAttributes & EventAttributes;
208
+ export type HtmlProgressAttributes = HtmlAttributes & EventAttributes;
209
+ export type HtmlQAttributes = HtmlAttributes & EventAttributes;
210
+ export type HtmlRpAttributes = HtmlAttributes & EventAttributes;
211
+ export type HtmlRtAttributes = HtmlAttributes & EventAttributes;
212
+ export type HtmlRubyAttributes = HtmlAttributes & EventAttributes;
213
+ export type HtmlSAttributes = HtmlAttributes & EventAttributes;
214
+ export type HtmlSampAttributes = HtmlAttributes & EventAttributes;
215
+ export type HtmlScriptAttributes = HtmlAttributes & EventAttributes;
216
+ export type HtmlSectionAttributes = HtmlAttributes & EventAttributes;
217
+ export type HtmlSelectAttributes = HtmlAttributes & EventAttributes;
218
+ export type HtmlSmallAttributes = HtmlAttributes & EventAttributes;
219
+ export type HtmlSourceAttributes = HtmlAttributes & EventAttributes;
220
+ export type HtmlSpanAttributes = HtmlAttributes & EventAttributes;
221
+ export type HtmlStrongAttributes = HtmlAttributes & EventAttributes;
222
+ export type HtmlStyleAttributes = HtmlAttributes & EventAttributes;
223
+ export type HtmlSubAttributes = HtmlAttributes & EventAttributes;
224
+ export type HtmlSummaryAttributes = HtmlAttributes & EventAttributes;
225
+ export type HtmlSupAttributes = HtmlAttributes & EventAttributes;
226
+ export type HtmlTableAttributes = HtmlAttributes & EventAttributes;
227
+ export type HtmlTbodyAttributes = HtmlAttributes & EventAttributes;
228
+ export type HtmlTdAttributes = HtmlAttributes & EventAttributes;
229
+ export type HtmlTemplateAttributes = HtmlAttributes & EventAttributes;
230
+ export type HtmlTextareaAttributes = HtmlAttributes & EventAttributes;
231
+ export type HtmlTfootAttributes = HtmlAttributes & EventAttributes;
232
+ export type HtmlThAttributes = HtmlAttributes & EventAttributes;
233
+ export type HtmlTheadAttributes = HtmlAttributes & EventAttributes;
234
+ export type HtmlTimeAttributes = HtmlAttributes & EventAttributes;
235
+ export type HtmlTitleAttributes = HtmlAttributes & EventAttributes;
236
+ export type HtmlTrAttributes = HtmlAttributes & EventAttributes;
237
+ export type HtmlTrackAttributes = HtmlAttributes & EventAttributes;
238
+ export type HtmlUAttributes = HtmlAttributes & EventAttributes;
239
+ export type HtmlUlAttributes = HtmlAttributes & EventAttributes;
240
+ export type HtmlVarAttributes = HtmlAttributes & EventAttributes;
241
+ export type HtmlVideoAttributes = HtmlAttributes & EventAttributes;
242
+ export type HtmlWbrAttributes = HtmlAttributes & EventAttributes;
243
+ export type HtmlSlotAttributes = HtmlAttributes & EventAttributes;
2
244
  export declare namespace JSX {
3
245
  type Element = Slot;
4
- interface IntrinsicElements {
5
- [key: string]: any;
246
+ interface IntrinsicElements extends HtmlTags {
247
+ a: HtmlAnchorAttributes;
248
+ abbr: HtmlAbbrAttributes;
249
+ address: HtmlAddressAttributes;
250
+ area: HtmlAreaAttributes;
251
+ article: HtmlArticleAttributes;
252
+ aside: HtmlAsideAttributes;
253
+ audio: HtmlAudioAttributes;
254
+ b: HtmlBAttributes;
255
+ base: HtmlBaseAttributes;
256
+ bdi: HtmlBdiAttributes;
257
+ bdo: HtmlBdoAttributes;
258
+ big: HtmlBigAttributes;
259
+ blockquote: HtmlBlockquoteAttributes;
260
+ body: HtmlBodyAttributes;
261
+ br: HtmlBrAttributes;
262
+ button: HtmlButtonAttributes;
263
+ canvas: HtmlCanvasAttributes;
264
+ caption: HtmlCaptionAttributes;
265
+ cite: HtmlCiteAttributes;
266
+ code: HtmlCodeAttributes;
267
+ col: HtmlColAttributes;
268
+ colgroup: HtmlColgroupAttributes;
269
+ data: HtmlDataAttributes;
270
+ datalist: HtmlDatalistAttributes;
271
+ dd: HtmlDdAttributes;
272
+ del: HtmlDelAttributes;
273
+ details: HtmlDetailsAttributes;
274
+ dfn: HtmlDfnAttributes;
275
+ dialog: HtmlDialogAttributes;
276
+ div: HtmlDivAttributes;
277
+ dl: HtmlDlAttributes;
278
+ dt: HtmlDtAttributes;
279
+ em: HtmlEmAttributes;
280
+ embed: HtmlEmbedAttributes;
281
+ fieldset: HtmlFieldsetAttributes;
282
+ figcaption: HtmlFigcaptionAttributes;
283
+ figure: HtmlFigureAttributes;
284
+ footer: HtmlFooterAttributes;
285
+ form: HtmlFormAttributes;
286
+ h1: HtmlH1Attributes;
287
+ h2: HtmlH2Attributes;
288
+ h3: HtmlH3Attributes;
289
+ h4: HtmlH4Attributes;
290
+ h5: HtmlH5Attributes;
291
+ h6: HtmlH6Attributes;
292
+ head: HtmlHeadAttributes;
293
+ header: HtmlHeaderAttributes;
294
+ hgroup: HtmlHgroupAttributes;
295
+ hr: HtmlHrAttributes;
296
+ html: HtmlHtmlAttributes;
297
+ i: HtmlIAttributes;
298
+ iframe: HtmlIframeAttributes;
299
+ img: HtmlImgAttributes;
300
+ input: HtmlInputAttributes;
301
+ ins: HtmlInsAttributes;
302
+ kbd: HtmlKbdAttributes;
303
+ keygen: HtmlKeygenAttributes;
304
+ label: HtmlLabelAttributes;
305
+ legend: HtmlLegendAttributes;
306
+ li: HtmlLiAttributes;
307
+ link: HtmlLinkAttributes;
308
+ main: HtmlMainAttributes;
309
+ map: HtmlMapAttributes;
310
+ mark: HtmlMarkAttributes;
311
+ menu: HtmlMenuAttributes;
312
+ menuitem: HtmlMenuitemAttributes;
313
+ meta: HtmlMetaAttributes;
314
+ meter: HtmlMeterAttributes;
315
+ nav: HtmlNavAttributes;
316
+ noindex: HtmlNoindexAttributes;
317
+ noscript: HtmlNoscriptAttributes;
318
+ object: HtmlObjectAttributes;
319
+ ol: HtmlOlAttributes;
320
+ optgroup: HtmlOptgroupAttributes;
321
+ option: HtmlOptionAttributes;
322
+ output: HtmlOutputAttributes;
323
+ p: HtmlPAttributes;
324
+ param: HtmlParamAttributes;
325
+ picture: HtmlPictureAttributes;
326
+ pre: HtmlPreAttributes;
327
+ progress: HtmlProgressAttributes;
328
+ q: HtmlQAttributes;
329
+ rp: HtmlRpAttributes;
330
+ rt: HtmlRtAttributes;
331
+ ruby: HtmlRubyAttributes;
332
+ s: HtmlSAttributes;
333
+ samp: HtmlSampAttributes;
334
+ script: HtmlScriptAttributes;
335
+ section: HtmlSectionAttributes;
336
+ select: HtmlSelectAttributes;
337
+ small: HtmlSmallAttributes;
338
+ source: HtmlSourceAttributes;
339
+ span: HtmlSpanAttributes;
340
+ strong: HtmlStrongAttributes;
341
+ style: HtmlStyleAttributes;
342
+ sub: HtmlSubAttributes;
343
+ summary: HtmlSummaryAttributes;
344
+ sup: HtmlSupAttributes;
345
+ table: HtmlTableAttributes;
346
+ tbody: HtmlTbodyAttributes;
347
+ td: HtmlTdAttributes;
348
+ template: HtmlTemplateAttributes;
349
+ textarea: HtmlTextareaAttributes;
350
+ tfoot: HtmlTfootAttributes;
351
+ th: HtmlThAttributes;
352
+ thead: HtmlTheadAttributes;
353
+ time: HtmlTimeAttributes;
354
+ title: HtmlTitleAttributes;
355
+ tr: HtmlTrAttributes;
356
+ track: HtmlTrackAttributes;
357
+ u: HtmlUAttributes;
358
+ ul: HtmlUlAttributes;
359
+ var: HtmlVarAttributes;
360
+ video: HtmlVideoAttributes;
361
+ wbr: HtmlWbrAttributes;
362
+ slot: HtmlSlotAttributes;
6
363
  }
7
364
  }
365
+ export declare const svgElements: Set<string>;
366
+ export declare const namespace: (tag: string) => "http://www.w3.org/1999/xhtml" | "http://www.w3.org/2000/svg";
8
367
  export declare const h: <TEvents extends import("..").Events, TAttributes extends import("..").Attributes>(input: string | import("..").ComponentConstructor<TEvents, TAttributes>, attributes?: import("..").AttributeInput<TAttributes>, ...children: Array<Slot>) => Slot;
package/dist/jsx/index.js CHANGED
@@ -10,7 +10,89 @@ const createElement = (input, attributes, ...children) => {
10
10
 
11
11
  //#endregion
12
12
  //#region src/jsx/index.ts
13
+ const svgElements = new Set([
14
+ "altGlyph",
15
+ "altGlyphDef",
16
+ "altGlyphItem",
17
+ "animate",
18
+ "animateColor",
19
+ "animateMotion",
20
+ "animateTransform",
21
+ "circle",
22
+ "clipPath",
23
+ "color-profile",
24
+ "cursor",
25
+ "defs",
26
+ "desc",
27
+ "ellipse",
28
+ "feBlend",
29
+ "feColorMatrix",
30
+ "feComponentTransfer",
31
+ "feComposite",
32
+ "feConvolveMatrix",
33
+ "feDiffuseLighting",
34
+ "feDisplacementMap",
35
+ "feDistantLight",
36
+ "feDropShadow",
37
+ "feFlood",
38
+ "feFuncA",
39
+ "feFuncB",
40
+ "feFuncG",
41
+ "feFuncR",
42
+ "feGaussianBlur",
43
+ "feImage",
44
+ "feMerge",
45
+ "feMergeNode",
46
+ "feMorphology",
47
+ "feOffset",
48
+ "fePointLight",
49
+ "feSpecularLighting",
50
+ "feSpotLight",
51
+ "feTile",
52
+ "feTurbulence",
53
+ "filter",
54
+ "font",
55
+ "font-face",
56
+ "font-face-format",
57
+ "font-face-name",
58
+ "font-face-src",
59
+ "font-face-uri",
60
+ "foreignObject",
61
+ "g",
62
+ "glyph",
63
+ "glyphRef",
64
+ "hkern",
65
+ "image",
66
+ "line",
67
+ "linearGradient",
68
+ "marker",
69
+ "mask",
70
+ "metadata",
71
+ "missing-glyph",
72
+ "mpath",
73
+ "path",
74
+ "pattern",
75
+ "polygon",
76
+ "polyline",
77
+ "radialGradient",
78
+ "rect",
79
+ "set",
80
+ "stop",
81
+ "svg",
82
+ "switch",
83
+ "symbol",
84
+ "text",
85
+ "textPath",
86
+ "tref",
87
+ "tspan",
88
+ "use",
89
+ "view",
90
+ "vkern"
91
+ ]);
92
+ const namespace = (tag) => {
93
+ return svgElements.has(tag) ? "http://www.w3.org/2000/svg" : "http://www.w3.org/1999/xhtml";
94
+ };
13
95
  const h = createElement;
14
96
 
15
97
  //#endregion
16
- export { h };
98
+ export { h, namespace, svgElements };
@@ -2,6 +2,11 @@ import { runtime } from "#virtual/runtime";
2
2
  import { serve } from "bun";
3
3
 
4
4
  //#region src/presets/bun.ts
5
- serve({ fetch: (request) => runtime.fetch(request, { inputs: {} }) });
5
+ serve({ fetch: (request) => {
6
+ return runtime.fetch(request, {
7
+ inputs: {},
8
+ variables: process.env
9
+ });
10
+ } });
6
11
 
7
12
  //#endregion
@@ -1,4 +1,4 @@
1
1
  declare const _default: {
2
- fetch: (request: Request, context: import("..").Context) => Promise<Response>;
2
+ fetch: <T>(request: Request, env: T) => Promise<Response>;
3
3
  };
4
4
  export default _default;
@@ -1,7 +1,12 @@
1
1
  import { runtime } from "#virtual/runtime";
2
2
 
3
3
  //#region src/presets/cloudflare.ts
4
- var cloudflare_default = { fetch: runtime.fetch };
4
+ var cloudflare_default = { fetch: (request, env) => {
5
+ return runtime.fetch(request, {
6
+ inputs: {},
7
+ variables: env
8
+ });
9
+ } };
5
10
 
6
11
  //#endregion
7
12
  export { cloudflare_default as default };
@@ -1,4 +1,3 @@
1
- import { type ComponentConstructor } from "../html";
2
- export declare const Outlet: ComponentConstructor<{}, {}>;
1
+ export declare const Outlet: import("..").ComponentConstructor<{}, {}>;
3
2
  export declare const navigate: (url: string) => void;
4
- export declare const anchorNavigate: (event: MouseEvent) => void;
3
+ export declare const anchorNavigate: (event: Event) => void;
@@ -1,18 +1,17 @@
1
- import type { Context, Event } from "../event";
2
- export type Route<T = Context> = {
3
- fetch: (event: Event<T>) => void | Response | Promise<void | Response>;
1
+ import { type Context, type Event, type Handle, type Middleware } from "../http";
2
+ import { Radix } from "../radix";
3
+ export type Route<T> = {
4
+ fetch: Handle<T>;
4
5
  };
5
- export type Socket<T = Context> = {
6
- open: (event: Event<T>) => void | Promise<void>;
7
- message: (event: Event<T>) => void | Promise<void>;
8
- close: (event: Event<T>) => void | Promise<void>;
6
+ export type Runtime<T> = {
7
+ radix: Radix<Route<T>>;
8
+ middlewares: Array<Middleware<T>>;
9
+ fetch: (request: Request, context: Context<T>) => Promise<Response>;
9
10
  };
10
- export type Runtime<T = Context> = {
11
- fetch: (request: Request, context: T) => Promise<Response>;
12
- };
13
- export declare const defineRoute: <T = Context>(route: Route<T>) => Route<T>;
14
- export declare const defineSocket: <T = Context>(socket: Socket<T>) => Socket<T>;
11
+ export declare const defineRoute: <T>(route: Route<T>) => Route<T>;
15
12
  export declare const fileName: (path: string) => string | undefined;
16
- export declare const toPath: (value: string) => string;
17
- export declare const createRuntime: <T = Context>() => Promise<Runtime<T>>;
18
- export declare let activeEvent: Event | undefined;
13
+ export declare const toPath: (value: string) => [string, string | undefined];
14
+ export declare const $fetch: <T>(input: string | URL, init?: RequestInit) => Promise<T>;
15
+ export declare const getVariables: <T>(event?: Event<T>) => T;
16
+ export declare const createRuntime: <T>() => Promise<Runtime<T>>;
17
+ export declare let activeEvent: Event<unknown> | undefined;
@@ -1,20 +1,29 @@
1
1
  export type Value<T> = T | State<T> | (() => Value<T>);
2
- export interface State<T = unknown> {
2
+ export interface State<T> {
3
3
  value: T;
4
4
  }
5
- export interface Compute<T = unknown> {
6
- invoke: () => T;
7
- cleanUps: Array<(compute: Compute) => void>;
8
- previous?: Compute;
5
+ export declare class Scope {
6
+ readonly dispose: Array<(scope: Scope) => void>;
7
+ constructor();
8
+ run<T>(invoke: () => T): T;
9
+ stop(): void;
10
+ }
11
+ export declare class Compute<T = void> {
12
+ readonly invoke: () => T;
13
+ readonly scope: Scope;
14
+ constructor(invoke: () => T);
15
+ run(): T;
9
16
  }
10
17
  export declare class Handler<T extends object> implements ProxyHandler<T> {
11
- get: <TValue>(target: T, path: string | symbol) => TValue;
12
- set: <TValue>(target: T, path: string | symbol, value: TValue) => boolean;
18
+ get(target: T, key: string | symbol): unknown;
19
+ set(target: T, key: string | symbol, value: unknown): boolean;
13
20
  }
14
- export declare const createState: <T>(value: T) => State<T>;
15
- export declare const createCompute: <T>(invoke: () => T) => T;
16
- export declare const runCompute: <T>(compute: Compute<T>) => T;
17
- export declare const fromValue: <T>(value: Value<T>) => T;
18
- export declare const onCleanUp: <T>(cleanUp: (compute: Compute) => T) => void;
19
- export declare const targets: WeakMap<object, Map<string | symbol, Set<Compute<unknown>>>>;
20
- export declare let runningCompute: Compute | undefined;
21
+ export declare function createState<T>(): State<T | undefined>;
22
+ export declare function createState<T>(value: T): State<T>;
23
+ export declare function createCompute<T>(invoke: () => T): T;
24
+ export declare function createMemo<T>(invoke: () => T): State<T>;
25
+ export declare function onCleanUp(invoke: (scope: Scope) => void): void;
26
+ export declare function fromValue<T>(value: Value<T>): T;
27
+ export declare let activeScope: Scope | undefined;
28
+ export declare let activeCompute: Compute | undefined;
29
+ export declare const targets: WeakMap<object, Map<string | symbol, Set<Compute<void>>>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "revojs",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "repository": "coverbase/revojs",
6
6
  "license": "MIT",
@@ -30,8 +30,8 @@
30
30
  "defu": "^6.1.4"
31
31
  },
32
32
  "devDependencies": {
33
- "@revojs/tsconfig": "0.0.1",
34
- "@revojs/rolldown": "0.0.1",
33
+ "@revojs/tsconfig": "0.0.2",
34
+ "@revojs/rolldown": "0.0.2",
35
35
  "rolldown": "^1.0.0-beta.1"
36
36
  }
37
37
  }
@@ -1,19 +0,0 @@
1
- import type { StatusCode } from "../http";
2
- export type Context = {
3
- inputs: Record<string, string>;
4
- };
5
- export type Set = {
6
- status?: StatusCode;
7
- message?: string;
8
- headers: Headers;
9
- };
10
- export type Event<T = Context> = {
11
- request: Request;
12
- response: Set;
13
- context: T;
14
- };
15
- export declare const createEvent: <T = Context>(request: Request, context: T) => Event<T>;
16
- export declare const sendText: <T = Context>(event: Event<T>, text?: string) => Response;
17
- export declare const sendHtml: <T = Context>(event: Event<T>, text: string) => Response;
18
- export declare const sendJson: <TValue, T = Context>(event: Event<T>, value: TValue) => Response;
19
- export declare const setHeader: <T>(event: Event<T>, name: string, value: string) => void;