ajo 0.1.30 → 0.1.32
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/LLMs.md +349 -0
- package/context.js +18 -0
- package/dist/html.cjs +1 -1
- package/dist/html.js +47 -45
- package/dist/index.cjs +1 -1
- package/dist/index.js +87 -70
- package/dist/jsx.cjs +1 -0
- package/dist/jsx.js +12 -0
- package/html.js +137 -0
- package/index.js +309 -0
- package/jsx.js +21 -0
- package/license +15 -15
- package/package.json +74 -54
- package/readme.md +447 -418
- package/types.ts +135 -90
package/types.ts
CHANGED
|
@@ -1,90 +1,135 @@
|
|
|
1
|
-
declare module 'ajo' {
|
|
2
|
-
|
|
3
|
-
type Tag = keyof (HTMLElementTagNameMap & SVGElementTagNameMap)
|
|
4
|
-
|
|
5
|
-
type Type
|
|
6
|
-
|
|
7
|
-
type
|
|
8
|
-
|
|
9
|
-
type Args = Record<string, unknown>
|
|
10
|
-
|
|
11
|
-
type VNode
|
|
12
|
-
nodeName:
|
|
13
|
-
children?: Children,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
type
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
1
|
+
declare module 'ajo' {
|
|
2
|
+
|
|
3
|
+
type Tag = keyof (HTMLElementTagNameMap & SVGElementTagNameMap)
|
|
4
|
+
|
|
5
|
+
type Type = Tag | (string & {}) | Stateless | Stateful
|
|
6
|
+
|
|
7
|
+
type Children = unknown
|
|
8
|
+
|
|
9
|
+
type Args = Record<string, unknown>
|
|
10
|
+
|
|
11
|
+
type VNode = {
|
|
12
|
+
nodeName: Type,
|
|
13
|
+
children?: Children,
|
|
14
|
+
[key: string]: unknown,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type ElementType<TTag> = TTag extends keyof HTMLElementTagNameMap
|
|
18
|
+
? HTMLElementTagNameMap[TTag]
|
|
19
|
+
: TTag extends keyof SVGElementTagNameMap
|
|
20
|
+
? SVGElementTagNameMap[TTag]
|
|
21
|
+
: object
|
|
22
|
+
|
|
23
|
+
type SpecialAttrs<TElement> = {
|
|
24
|
+
key: string | number,
|
|
25
|
+
skip: boolean,
|
|
26
|
+
memo: unknown,
|
|
27
|
+
ref: (el: TElement | null) => void,
|
|
28
|
+
} & ElementChildrenAttribute
|
|
29
|
+
|
|
30
|
+
type PropSetter<TTag> = {
|
|
31
|
+
[K in keyof ElementType<TTag> as `set:${Exclude<K, symbol>}`]: ElementType<TTag>[K]
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
type AttrSetter = {
|
|
35
|
+
[key: `attr:${string}`]: unknown
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface Defaults { }
|
|
39
|
+
|
|
40
|
+
type DefaultTag = Defaults extends { tag: infer T extends string } ? T : 'div'
|
|
41
|
+
|
|
42
|
+
const defaults: { tag: string }
|
|
43
|
+
|
|
44
|
+
type Stateless<TArgs extends Args = {}> = (args: TArgs) => Children
|
|
45
|
+
|
|
46
|
+
type Stateful<TArgs extends Args = {}, TTag extends string = DefaultTag> = {
|
|
47
|
+
(this: StatefulElement<TArgs, TTag>, args: TArgs): Iterator<Children>
|
|
48
|
+
} & (TTag extends DefaultTag ? { is?: TTag } : { is: TTag }) & {
|
|
49
|
+
attrs?: Partial<PropSetter<TTag>> & Args,
|
|
50
|
+
args?: Partial<TArgs>,
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
type Component<TArgs extends Args = {}> = Stateless<TArgs> | Stateful<TArgs>
|
|
54
|
+
|
|
55
|
+
type StatefulArgs<TArgs, TTag> =
|
|
56
|
+
Partial<SpecialAttrs<StatefulElement<TArgs, TTag>> & PropSetter<TTag>> &
|
|
57
|
+
AttrSetter &
|
|
58
|
+
TArgs
|
|
59
|
+
|
|
60
|
+
type StatefulElement<TArgs, TTag> = ElementType<TTag> & {
|
|
61
|
+
[Symbol.iterator](): Iterator<TArgs>,
|
|
62
|
+
signal: AbortSignal,
|
|
63
|
+
next: <R>(fn?: (this: StatefulElement<TArgs, TTag>, args: TArgs) => R) => R,
|
|
64
|
+
throw: (value?: unknown) => void,
|
|
65
|
+
return: (deep?: boolean) => void,
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
type HTMLIntrinsicElements = {
|
|
69
|
+
[TTag in Tag]: Partial<PropSetter<TTag> & SpecialAttrs<ElementType<TTag>>> & Args
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface IntrinsicElements extends HTMLIntrinsicElements { }
|
|
73
|
+
|
|
74
|
+
type ElementChildrenAttribute = { children: Children }
|
|
75
|
+
|
|
76
|
+
type WithChildren<T extends Args = {}> = T & Partial<ElementChildrenAttribute>
|
|
77
|
+
|
|
78
|
+
type ManagedAttributes<C, P> =
|
|
79
|
+
C extends (...args: any) => Iterator<any>
|
|
80
|
+
? C extends { is?: infer TTag }
|
|
81
|
+
? StatefulArgs<P, TTag & string>
|
|
82
|
+
: P
|
|
83
|
+
: P
|
|
84
|
+
|
|
85
|
+
function render(h: Children, el: ParentNode, child?: ChildNode, ref?: ChildNode): void
|
|
86
|
+
|
|
87
|
+
function stateful<TArgs extends Args, TTag extends string = DefaultTag>(
|
|
88
|
+
fn: (this: StatefulElement<TArgs, TTag>, args: TArgs) => Iterator<Children>,
|
|
89
|
+
is?: TTag
|
|
90
|
+
): Stateful<TArgs, TTag>
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
declare module 'ajo/context' {
|
|
94
|
+
function context<T>(fallback?: T): {
|
|
95
|
+
(): T
|
|
96
|
+
<V extends T>(value: V): V
|
|
97
|
+
}
|
|
98
|
+
function current(): import('ajo').StatefulElement<any, any> | null
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
declare module 'ajo/html' {
|
|
102
|
+
const defaults: { tag: string }
|
|
103
|
+
function render(h: import('ajo').Children): string
|
|
104
|
+
function html(h: import('ajo').Children, emit: (chunk: string) => void): void
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
declare module 'ajo/jsx-runtime' {
|
|
108
|
+
import { Type, Args, VNode, Children, ElementChildrenAttribute, IntrinsicElements as _IE } from 'ajo'
|
|
109
|
+
export function Fragment({ children }: ElementChildrenAttribute): typeof children
|
|
110
|
+
export function h(tag: Type, attrs?: Args | null, ...children: Children[]): VNode
|
|
111
|
+
export function jsx(type: Type, props: Args | null, key?: string | number): VNode
|
|
112
|
+
export function jsxs(type: Type, props: Args | null, key?: string | number): VNode
|
|
113
|
+
export function jsxDEV(type: Type, props: Args | null, key?: string | number): VNode
|
|
114
|
+
export namespace JSX {
|
|
115
|
+
type ElementChildrenAttribute = import('ajo').ElementChildrenAttribute
|
|
116
|
+
type LibraryManagedAttributes<C, P> = import('ajo').ManagedAttributes<C, P>
|
|
117
|
+
interface IntrinsicElements extends _IE { }
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
declare module 'ajo/jsx-dev-runtime' {
|
|
122
|
+
import { IntrinsicElements as _IE } from 'ajo'
|
|
123
|
+
export { Fragment, h, jsx, jsxs, jsxDEV } from 'ajo/jsx-runtime'
|
|
124
|
+
export namespace JSX {
|
|
125
|
+
type ElementChildrenAttribute = import('ajo').ElementChildrenAttribute
|
|
126
|
+
type LibraryManagedAttributes<C, P> = import('ajo').ManagedAttributes<C, P>
|
|
127
|
+
interface IntrinsicElements extends _IE { }
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
declare namespace JSX {
|
|
132
|
+
type ElementChildrenAttribute = import('ajo').ElementChildrenAttribute
|
|
133
|
+
type LibraryManagedAttributes<C, P> = import('ajo').ManagedAttributes<C, P>
|
|
134
|
+
type IntrinsicElements = import('ajo').IntrinsicElements
|
|
135
|
+
}
|