mono-jsx 0.0.0-alpha.1
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/jsx-runtime.mjs +19 -0
- package/jsx.mjs +65 -0
- package/package.json +27 -0
- package/types/aria.d.ts +329 -0
- package/types/css.d.ts +12199 -0
- package/types/html.d.ts +1189 -0
- package/types/jsx-runtime.d.ts +9 -0
- package/types/jsx.d.ts +51 -0
- package/types/mono.d.ts +99 -0
package/types/jsx.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as Mono from "./mono.d.ts";
|
|
2
|
+
import { HTML } from "./html.d.ts";
|
|
3
|
+
export { BaseCSSProperties, CSSProperties } from "./mono.d.ts";
|
|
4
|
+
|
|
5
|
+
export type ChildType = VNode | string | number | bigint | boolean | null;
|
|
6
|
+
export type Child = ChildType | ChildType[] | Generator<ChildType> | AsyncGenerator<ChildType>;
|
|
7
|
+
|
|
8
|
+
export type VNode =
|
|
9
|
+
& {
|
|
10
|
+
tag: string | symbol | FC<any>;
|
|
11
|
+
props: Record<string, any> | null;
|
|
12
|
+
children?: Child[];
|
|
13
|
+
innerHTML?: string;
|
|
14
|
+
at?: string;
|
|
15
|
+
}
|
|
16
|
+
& Mono.Attributes
|
|
17
|
+
& Mono.AsyncComponentAttributes;
|
|
18
|
+
|
|
19
|
+
export type PropsWithChildren<P extends Record<string, any> = {}> = P & { children?: Child[] };
|
|
20
|
+
|
|
21
|
+
export interface FC<P = PropsWithChildren<{}>> {
|
|
22
|
+
(props: P): VNode | null | Promise<VNode | null> | Generator<VNode> | AsyncGenerator<VNode>;
|
|
23
|
+
displayName?: string;
|
|
24
|
+
rendering?: "eager" | "lazy" | (string | {});
|
|
25
|
+
}
|
|
26
|
+
export type TC = (strings: TemplateStringsArray, ...values: any[]) => VNode;
|
|
27
|
+
|
|
28
|
+
export const h: (tag: string | FC<any>, props: Record<string, any> | null, ...children: Child[]) => VNode;
|
|
29
|
+
export const Fragment: FC<PropsWithChildren<{ key?: string | number }>>;
|
|
30
|
+
export const customElements: typeof JSX.customElements;
|
|
31
|
+
export const html: TC, css: TC, js: TC, markdown: TC;
|
|
32
|
+
|
|
33
|
+
declare global {
|
|
34
|
+
namespace JSX {
|
|
35
|
+
type ElementType<P = any> =
|
|
36
|
+
| {
|
|
37
|
+
[K in keyof IntrinsicElements]: P extends IntrinsicElements[K] ? K : never;
|
|
38
|
+
}[keyof IntrinsicElements]
|
|
39
|
+
| FC<P>;
|
|
40
|
+
interface Element extends VNode {}
|
|
41
|
+
interface CustomElements {}
|
|
42
|
+
interface IntrinsicAttributes extends Mono.Attributes, Mono.AsyncComponentAttributes {}
|
|
43
|
+
interface IntrinsicElements extends HTML.Elements, HTML.SVGElements, Mono.Elements, CustomElements {}
|
|
44
|
+
const customElements: {
|
|
45
|
+
define(tagName: string, component: FC<any>): typeof customElements;
|
|
46
|
+
define(elements: Record<string, FC<any>>): typeof customElements;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
// deno-lint-ignore no-var
|
|
50
|
+
var html: TC, css: TC, js: TC, markdown: TC;
|
|
51
|
+
}
|
package/types/mono.d.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import * as CSS from "./css.d.ts";
|
|
2
|
+
|
|
3
|
+
type Num1_9 = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
4
|
+
type Num0_100 = 0 | Num1_9 | `${Num1_9}${0 | Num1_9}` | 100;
|
|
5
|
+
type TransitionProps = { delay?: number; ease?: CSS.DataType.EasingFunction };
|
|
6
|
+
|
|
7
|
+
export interface BaseCSSProperties extends CSS.Properties<string | number>, Partial<JSX.CustomCSSRules> {
|
|
8
|
+
"@apply"?: string | string[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface AtRuleCSSProperties {
|
|
12
|
+
[key: `@media${" " | "("}${string}`]: BaseCSSProperties;
|
|
13
|
+
[key: `@supports${" " | "("}${string}`]: BaseCSSProperties;
|
|
14
|
+
[key: `@keyframes ${string}`]: {
|
|
15
|
+
[key in "from" | "to" | `${Num0_100}%`]?: BaseCSSProperties;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface PseudoCSSProperties {
|
|
20
|
+
":active"?: BaseCSSProperties;
|
|
21
|
+
":focus"?: BaseCSSProperties;
|
|
22
|
+
":focus-visible"?: BaseCSSProperties;
|
|
23
|
+
":focus-within"?: BaseCSSProperties;
|
|
24
|
+
":hover"?: BaseCSSProperties;
|
|
25
|
+
":link"?: BaseCSSProperties;
|
|
26
|
+
":visited"?: BaseCSSProperties;
|
|
27
|
+
":checked"?: BaseCSSProperties;
|
|
28
|
+
":disabled"?: BaseCSSProperties;
|
|
29
|
+
":invalid"?: BaseCSSProperties;
|
|
30
|
+
":first-letter"?: BaseCSSProperties;
|
|
31
|
+
":first-line"?: BaseCSSProperties;
|
|
32
|
+
":first-child"?: BaseCSSProperties;
|
|
33
|
+
":first-of-type"?: BaseCSSProperties;
|
|
34
|
+
":last-child"?: BaseCSSProperties;
|
|
35
|
+
":last-of-type"?: BaseCSSProperties;
|
|
36
|
+
"::after"?: BaseCSSProperties;
|
|
37
|
+
"::backdrop"?: BaseCSSProperties;
|
|
38
|
+
"::before"?: BaseCSSProperties;
|
|
39
|
+
"::first-letter"?: BaseCSSProperties;
|
|
40
|
+
"::placeholder"?: BaseCSSProperties;
|
|
41
|
+
"::selection"?: BaseCSSProperties;
|
|
42
|
+
[key: `:nth-child(${string})`]: BaseCSSProperties;
|
|
43
|
+
[key: `:is(${string})`]: BaseCSSProperties;
|
|
44
|
+
[key: `:not(${string})`]: BaseCSSProperties;
|
|
45
|
+
[key: `:has(${string})`]: BaseCSSProperties;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface CSSProperties extends BaseCSSProperties, AtRuleCSSProperties, PseudoCSSProperties {
|
|
49
|
+
[key: `& ${string}`]: CSSProperties;
|
|
50
|
+
/** alias to `:nth-child(even)`. */
|
|
51
|
+
":even"?: BaseCSSProperties;
|
|
52
|
+
/** alias to `:nth-child(odd)`. */
|
|
53
|
+
":odd"?: BaseCSSProperties;
|
|
54
|
+
/** Mono page in. */
|
|
55
|
+
":in"?: BaseCSSProperties & TransitionProps;
|
|
56
|
+
/** Mono page out. */
|
|
57
|
+
":out"?: BaseCSSProperties & TransitionProps;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface Attributes {
|
|
61
|
+
key?: string | number;
|
|
62
|
+
slot?: string;
|
|
63
|
+
route?: `/${string}` | "404";
|
|
64
|
+
rendering?: "eager" | "lazy";
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface AsyncComponentAttributes {
|
|
68
|
+
pending?: JSX.Element;
|
|
69
|
+
catch?: (err: any) => JSX.Element;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface Elements {
|
|
73
|
+
cache:
|
|
74
|
+
& Attributes
|
|
75
|
+
& AsyncComponentAttributes
|
|
76
|
+
& {
|
|
77
|
+
/** The cache key is used to identify the cache. */
|
|
78
|
+
key: string;
|
|
79
|
+
/** The `etag` (or **entity tag**) is an identifier for a specific version of a rendering cache. */
|
|
80
|
+
etag?: string;
|
|
81
|
+
/** The `max-age=N` prop indicates that the cache remains fresh until N seconds after the cache is generated. */
|
|
82
|
+
maxAge?: number;
|
|
83
|
+
/** The `stale-while-revalidate` prop indicates that the cache could reuse a stale rendering while it revalidates it to a cache. */
|
|
84
|
+
swr?: number;
|
|
85
|
+
};
|
|
86
|
+
markdown:
|
|
87
|
+
& Attributes
|
|
88
|
+
& AsyncComponentAttributes
|
|
89
|
+
& {
|
|
90
|
+
src?: string | URL;
|
|
91
|
+
renderer?: (frontMatter: Record<string, any>) => JSX.Element;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
declare global {
|
|
96
|
+
namespace JSX {
|
|
97
|
+
interface CustomCSSRules {}
|
|
98
|
+
}
|
|
99
|
+
}
|