@pyreon/core 0.11.5 → 0.11.7
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 +2 -2
- package/lib/analysis/index.js.html +1 -1
- package/lib/index.js +33 -5
- package/lib/index.js.map +1 -1
- package/lib/jsx-dev-runtime.js.map +1 -1
- package/lib/jsx-runtime.js.map +1 -1
- package/lib/types/index.d.ts +145 -98
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/jsx-dev-runtime.d.ts +94 -94
- package/lib/types/jsx-runtime.d.ts +94 -94
- package/package.json +11 -11
- package/src/component.ts +2 -2
- package/src/context.ts +75 -4
- package/src/dynamic.ts +4 -4
- package/src/error-boundary.ts +10 -10
- package/src/for.ts +8 -2
- package/src/h.ts +4 -4
- package/src/index.ts +30 -27
- package/src/jsx-dev-runtime.ts +1 -1
- package/src/jsx-runtime.ts +108 -108
- package/src/lazy.ts +4 -4
- package/src/lifecycle.ts +6 -6
- package/src/portal.ts +2 -2
- package/src/show.ts +4 -4
- package/src/style.ts +51 -51
- package/src/suspense.ts +8 -8
- package/src/telemetry.ts +1 -1
- package/src/tests/component.test.ts +60 -60
- package/src/tests/context.test.ts +102 -102
- package/src/tests/core.test.ts +376 -376
- package/src/tests/cx.test.ts +34 -34
- package/src/tests/dynamic.test.ts +28 -28
- package/src/tests/error-boundary.test.ts +51 -51
- package/src/tests/for.test.ts +26 -26
- package/src/tests/h.test.ts +100 -100
- package/src/tests/jsx-compat.test.tsx +41 -41
- package/src/tests/lazy.test.ts +28 -28
- package/src/tests/lifecycle.test.ts +35 -35
- package/src/tests/map-array.test.ts +36 -36
- package/src/tests/portal.test.ts +21 -21
- package/src/tests/props-extended.test.ts +51 -51
- package/src/tests/props.test.ts +62 -62
- package/src/tests/ref.test.ts +20 -20
- package/src/tests/show.test.ts +94 -94
- package/src/tests/style.test.ts +101 -101
- package/src/tests/suspense.test.ts +44 -44
- package/src/tests/telemetry.test.ts +35 -35
package/src/index.ts
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
// @pyreon/core — component model, VNode types, lifecycle hooks
|
|
2
2
|
|
|
3
|
-
export { defineComponent, dispatchToErrorBoundary, propagateError, runWithHooks } from
|
|
4
|
-
export type { Context } from
|
|
3
|
+
export { defineComponent, dispatchToErrorBoundary, propagateError, runWithHooks } from './component'
|
|
4
|
+
export type { Context, ContextSnapshot, ReactiveContext } from './context'
|
|
5
5
|
export {
|
|
6
|
+
captureContextStack,
|
|
6
7
|
createContext,
|
|
8
|
+
createReactiveContext,
|
|
7
9
|
popContext,
|
|
8
10
|
provide,
|
|
9
11
|
pushContext,
|
|
12
|
+
restoreContextStack,
|
|
10
13
|
setContextStackProvider,
|
|
11
14
|
useContext,
|
|
12
15
|
withContext,
|
|
13
|
-
} from
|
|
14
|
-
export type { DynamicProps } from
|
|
15
|
-
export { Dynamic } from
|
|
16
|
-
export { ErrorBoundary } from
|
|
17
|
-
export type { ForProps } from
|
|
18
|
-
export { For, ForSymbol } from
|
|
19
|
-
export { EMPTY_PROPS, Fragment, h } from
|
|
16
|
+
} from './context'
|
|
17
|
+
export type { DynamicProps } from './dynamic'
|
|
18
|
+
export { Dynamic } from './dynamic'
|
|
19
|
+
export { ErrorBoundary } from './error-boundary'
|
|
20
|
+
export type { ForProps } from './for'
|
|
21
|
+
export { For, ForSymbol } from './for'
|
|
22
|
+
export { EMPTY_PROPS, Fragment, h } from './h'
|
|
20
23
|
export type {
|
|
21
24
|
AnchorAttributes,
|
|
22
25
|
ButtonAttributes,
|
|
@@ -30,23 +33,23 @@ export type {
|
|
|
30
33
|
SvgAttributes,
|
|
31
34
|
TargetedEvent,
|
|
32
35
|
TextareaAttributes,
|
|
33
|
-
} from
|
|
34
|
-
export { lazy } from
|
|
35
|
-
export { onErrorCaptured, onMount, onUnmount, onUpdate } from
|
|
36
|
-
export { mapArray } from
|
|
37
|
-
export type { PortalProps } from
|
|
38
|
-
export { Portal, PortalSymbol } from
|
|
39
|
-
export { createUniqueId, mergeProps, splitProps } from
|
|
40
|
-
export type { Ref, RefCallback, RefProp } from
|
|
41
|
-
export { createRef } from
|
|
42
|
-
export type { MatchProps, ShowProps, SwitchProps } from
|
|
43
|
-
export { Match, MatchSymbol, Show, Switch } from
|
|
44
|
-
export type { ClassValue } from
|
|
45
|
-
export { CSS_UNITLESS, cx, normalizeStyleValue, toKebabCase } from
|
|
46
|
-
export type { LazyComponent } from
|
|
47
|
-
export { Suspense } from
|
|
48
|
-
export type { ErrorContext, ErrorHandler } from
|
|
49
|
-
export { registerErrorHandler, reportError } from
|
|
36
|
+
} from './jsx-runtime'
|
|
37
|
+
export { lazy } from './lazy'
|
|
38
|
+
export { onErrorCaptured, onMount, onUnmount, onUpdate } from './lifecycle'
|
|
39
|
+
export { mapArray } from './map-array'
|
|
40
|
+
export type { PortalProps } from './portal'
|
|
41
|
+
export { Portal, PortalSymbol } from './portal'
|
|
42
|
+
export { createUniqueId, mergeProps, splitProps } from './props'
|
|
43
|
+
export type { Ref, RefCallback, RefProp } from './ref'
|
|
44
|
+
export { createRef } from './ref'
|
|
45
|
+
export type { MatchProps, ShowProps, SwitchProps } from './show'
|
|
46
|
+
export { Match, MatchSymbol, Show, Switch } from './show'
|
|
47
|
+
export type { ClassValue } from './style'
|
|
48
|
+
export { CSS_UNITLESS, cx, normalizeStyleValue, toKebabCase } from './style'
|
|
49
|
+
export type { LazyComponent } from './suspense'
|
|
50
|
+
export { Suspense } from './suspense'
|
|
51
|
+
export type { ErrorContext, ErrorHandler } from './telemetry'
|
|
52
|
+
export { registerErrorHandler, reportError } from './telemetry'
|
|
50
53
|
export type {
|
|
51
54
|
CleanupFn,
|
|
52
55
|
ComponentFn,
|
|
@@ -59,4 +62,4 @@ export type {
|
|
|
59
62
|
VNode,
|
|
60
63
|
VNodeChild,
|
|
61
64
|
VNodeChildAtom,
|
|
62
|
-
} from
|
|
65
|
+
} from './types'
|
package/src/jsx-dev-runtime.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Dev runtime — same as production but bundlers may inject extra debug info
|
|
2
|
-
export { Fragment, jsx as jsxDEV, jsxs } from
|
|
2
|
+
export { Fragment, jsx as jsxDEV, jsxs } from './jsx-runtime'
|
package/src/jsx-runtime.ts
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* rewrites JSX to imports from this file automatically:
|
|
6
6
|
* <div class="x" /> → jsx("div", { class: "x" })
|
|
7
7
|
*/
|
|
8
|
-
import { Fragment, h } from
|
|
9
|
-
import type { RefProp } from
|
|
10
|
-
import type { ClassValue } from
|
|
11
|
-
import type { ComponentFn, Props, VNode, VNodeChild } from
|
|
8
|
+
import { Fragment, h } from './h'
|
|
9
|
+
import type { RefProp } from './ref'
|
|
10
|
+
import type { ClassValue } from './style'
|
|
11
|
+
import type { ComponentFn, Props, VNode, VNodeChild } from './types'
|
|
12
12
|
|
|
13
13
|
export { Fragment }
|
|
14
14
|
|
|
@@ -20,7 +20,7 @@ export function jsx(
|
|
|
20
20
|
const { children, ...rest } = props
|
|
21
21
|
const propsWithKey = (key != null ? { ...rest, key } : rest) as Props
|
|
22
22
|
|
|
23
|
-
if (typeof type ===
|
|
23
|
+
if (typeof type === 'function') {
|
|
24
24
|
// Component: keep children in props.children so the component function can access them.
|
|
25
25
|
// Children must NOT be spread as h() rest args because mountComponent only passes vnode.props.
|
|
26
26
|
const componentProps = children !== undefined ? { ...propsWithKey, children } : propsWithKey
|
|
@@ -37,7 +37,7 @@ export const jsxs = jsx
|
|
|
37
37
|
|
|
38
38
|
// ─── JSX types ────────────────────────────────────────────────────────────────
|
|
39
39
|
|
|
40
|
-
type Booleanish = boolean |
|
|
40
|
+
type Booleanish = boolean | 'true' | 'false'
|
|
41
41
|
export type CSSProperties = { [K in keyof CSSStyleDeclaration]?: string | number }
|
|
42
42
|
export type StyleValue = string | CSSProperties
|
|
43
43
|
|
|
@@ -58,68 +58,68 @@ export interface PyreonHTMLAttributes<E extends Element = HTMLElement> {
|
|
|
58
58
|
tabIndex?: number | (() => number) | undefined
|
|
59
59
|
title?: string | (() => string) | undefined
|
|
60
60
|
lang?: string | undefined
|
|
61
|
-
dir?:
|
|
61
|
+
dir?: 'ltr' | 'rtl' | 'auto' | undefined
|
|
62
62
|
hidden?: boolean | (() => boolean) | undefined
|
|
63
63
|
draggable?: Booleanish | undefined
|
|
64
|
-
contentEditable?: Booleanish |
|
|
64
|
+
contentEditable?: Booleanish | 'inherit' | 'plaintext-only' | undefined
|
|
65
65
|
spellCheck?: Booleanish | undefined
|
|
66
|
-
autoCapitalize?:
|
|
67
|
-
translate?:
|
|
68
|
-
enterKeyHint?:
|
|
66
|
+
autoCapitalize?: 'off' | 'on' | 'sentences' | 'words' | 'characters' | undefined
|
|
67
|
+
translate?: 'yes' | 'no' | undefined
|
|
68
|
+
enterKeyHint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send' | undefined
|
|
69
69
|
inputMode?:
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
|
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
|
|
|
70
|
+
| 'none'
|
|
71
|
+
| 'text'
|
|
72
|
+
| 'decimal'
|
|
73
|
+
| 'numeric'
|
|
74
|
+
| 'tel'
|
|
75
|
+
| 'search'
|
|
76
|
+
| 'email'
|
|
77
|
+
| 'url'
|
|
78
78
|
| undefined
|
|
79
79
|
is?: string | undefined
|
|
80
80
|
slot?: string | undefined
|
|
81
81
|
part?: string | undefined
|
|
82
|
-
popover?:
|
|
82
|
+
popover?: 'auto' | 'manual' | undefined
|
|
83
83
|
popoverTarget?: string | undefined
|
|
84
|
-
popoverTargetAction?:
|
|
84
|
+
popoverTargetAction?: 'toggle' | 'show' | 'hide' | undefined
|
|
85
85
|
inert?: boolean | undefined
|
|
86
86
|
// ARIA
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
87
|
+
'aria-label'?: string | (() => string) | undefined
|
|
88
|
+
'aria-hidden'?: Booleanish | (() => Booleanish) | undefined
|
|
89
|
+
'aria-disabled'?: Booleanish | (() => Booleanish) | undefined
|
|
90
|
+
'aria-expanded'?: Booleanish | (() => Booleanish) | undefined
|
|
91
|
+
'aria-selected'?: Booleanish | (() => Booleanish) | undefined
|
|
92
|
+
'aria-checked'?: Booleanish | 'mixed' | (() => Booleanish | 'mixed') | undefined
|
|
93
|
+
'aria-current'?: Booleanish | 'page' | 'step' | 'location' | 'date' | 'time' | undefined
|
|
94
|
+
'aria-live'?: 'off' | 'assertive' | 'polite' | undefined
|
|
95
|
+
'aria-atomic'?: Booleanish | undefined
|
|
96
|
+
'aria-busy'?: Booleanish | undefined
|
|
97
|
+
'aria-controls'?: string | undefined
|
|
98
|
+
'aria-describedby'?: string | undefined
|
|
99
|
+
'aria-labelledby'?: string | undefined
|
|
100
|
+
'aria-placeholder'?: string | undefined
|
|
101
|
+
'aria-required'?: Booleanish | (() => Booleanish) | undefined
|
|
102
|
+
'aria-invalid'?: Booleanish | 'grammar' | 'spelling' | undefined
|
|
103
|
+
'aria-valuemin'?: number | undefined
|
|
104
|
+
'aria-valuemax'?: number | undefined
|
|
105
|
+
'aria-valuenow'?: number | undefined
|
|
106
|
+
'aria-valuetext'?: string | undefined
|
|
107
|
+
'aria-haspopup'?: Booleanish | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' | undefined
|
|
108
|
+
'aria-posinset'?: number | undefined
|
|
109
|
+
'aria-setsize'?: number | undefined
|
|
110
|
+
'aria-level'?: number | undefined
|
|
111
|
+
'aria-multiline'?: Booleanish | undefined
|
|
112
|
+
'aria-multiselectable'?: Booleanish | undefined
|
|
113
|
+
'aria-orientation'?: 'horizontal' | 'vertical' | undefined
|
|
114
|
+
'aria-readonly'?: Booleanish | (() => Booleanish) | undefined
|
|
115
|
+
'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other' | undefined
|
|
116
|
+
'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both' | undefined
|
|
117
|
+
'aria-colcount'?: number | undefined
|
|
118
|
+
'aria-colindex'?: number | undefined
|
|
119
|
+
'aria-colspan'?: number | undefined
|
|
120
|
+
'aria-rowcount'?: number | undefined
|
|
121
|
+
'aria-rowindex'?: number | undefined
|
|
122
|
+
'aria-rowspan'?: number | undefined
|
|
123
123
|
// DOM lifecycle ref — object ref or callback ref
|
|
124
124
|
ref?: RefProp<E> | undefined
|
|
125
125
|
// Key for list reconciliation
|
|
@@ -210,7 +210,7 @@ export interface InputAttributes extends PyreonHTMLAttributes<HTMLInputElement>
|
|
|
210
210
|
accept?: string | undefined
|
|
211
211
|
autoComplete?: string | undefined
|
|
212
212
|
autoFocus?: boolean | undefined
|
|
213
|
-
capture?:
|
|
213
|
+
capture?: 'user' | 'environment' | string | undefined
|
|
214
214
|
form?: string | undefined
|
|
215
215
|
formNoValidate?: boolean | undefined
|
|
216
216
|
list?: string | undefined
|
|
@@ -226,13 +226,13 @@ export interface AnchorAttributes extends PyreonHTMLAttributes<HTMLAnchorElement
|
|
|
226
226
|
hreflang?: string | undefined
|
|
227
227
|
ping?: string | undefined
|
|
228
228
|
referrerPolicy?: string | undefined
|
|
229
|
-
target?:
|
|
229
|
+
target?: '_blank' | '_self' | '_parent' | '_top' | string | undefined
|
|
230
230
|
rel?: string | undefined
|
|
231
231
|
download?: string | boolean | undefined
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
export interface ButtonAttributes extends PyreonHTMLAttributes<HTMLButtonElement> {
|
|
235
|
-
type?:
|
|
235
|
+
type?: 'button' | 'submit' | 'reset' | undefined
|
|
236
236
|
disabled?: boolean | (() => boolean) | undefined
|
|
237
237
|
name?: string | undefined
|
|
238
238
|
value?: string | undefined
|
|
@@ -258,7 +258,7 @@ export interface TextareaAttributes extends PyreonHTMLAttributes<HTMLTextAreaEle
|
|
|
258
258
|
name?: string | undefined
|
|
259
259
|
autoFocus?: boolean | undefined
|
|
260
260
|
form?: string | undefined
|
|
261
|
-
wrap?:
|
|
261
|
+
wrap?: 'hard' | 'soft' | undefined
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
export interface SelectAttributes extends PyreonHTMLAttributes<HTMLSelectElement> {
|
|
@@ -282,7 +282,7 @@ interface OptionAttributes extends PyreonHTMLAttributes<HTMLOptionElement> {
|
|
|
282
282
|
|
|
283
283
|
export interface FormAttributes extends PyreonHTMLAttributes<HTMLFormElement> {
|
|
284
284
|
action?: string | undefined
|
|
285
|
-
method?:
|
|
285
|
+
method?: 'get' | 'post' | undefined
|
|
286
286
|
encType?: string | undefined
|
|
287
287
|
noValidate?: boolean | undefined
|
|
288
288
|
target?: string | undefined
|
|
@@ -297,13 +297,13 @@ export interface ImgAttributes extends PyreonHTMLAttributes<HTMLImageElement> {
|
|
|
297
297
|
alt?: string | (() => string) | undefined
|
|
298
298
|
width?: number | string | (() => number | string) | undefined
|
|
299
299
|
height?: number | string | (() => number | string) | undefined
|
|
300
|
-
loading?:
|
|
301
|
-
decoding?:
|
|
302
|
-
crossOrigin?:
|
|
300
|
+
loading?: 'lazy' | 'eager' | undefined
|
|
301
|
+
decoding?: 'auto' | 'async' | 'sync' | undefined
|
|
302
|
+
crossOrigin?: 'anonymous' | 'use-credentials' | undefined
|
|
303
303
|
referrerPolicy?: string | undefined
|
|
304
304
|
srcSet?: string | (() => string) | undefined
|
|
305
305
|
sizes?: string | (() => string) | undefined
|
|
306
|
-
fetchPriority?:
|
|
306
|
+
fetchPriority?: 'high' | 'low' | 'auto' | undefined
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
interface VideoAttributes extends PyreonHTMLAttributes<HTMLVideoElement> {
|
|
@@ -315,9 +315,9 @@ interface VideoAttributes extends PyreonHTMLAttributes<HTMLVideoElement> {
|
|
|
315
315
|
muted?: boolean | undefined
|
|
316
316
|
loop?: boolean | undefined
|
|
317
317
|
poster?: string | (() => string) | undefined
|
|
318
|
-
preload?:
|
|
318
|
+
preload?: 'none' | 'metadata' | 'auto' | undefined
|
|
319
319
|
playsInline?: boolean | undefined
|
|
320
|
-
crossOrigin?:
|
|
320
|
+
crossOrigin?: 'anonymous' | 'use-credentials' | undefined
|
|
321
321
|
disablePictureInPicture?: boolean | undefined
|
|
322
322
|
disableRemotePlayback?: boolean | undefined
|
|
323
323
|
}
|
|
@@ -328,8 +328,8 @@ interface AudioAttributes extends PyreonHTMLAttributes<HTMLAudioElement> {
|
|
|
328
328
|
autoPlay?: boolean | undefined
|
|
329
329
|
muted?: boolean | undefined
|
|
330
330
|
loop?: boolean | undefined
|
|
331
|
-
preload?:
|
|
332
|
-
crossOrigin?:
|
|
331
|
+
preload?: 'none' | 'metadata' | 'auto' | undefined
|
|
332
|
+
crossOrigin?: 'anonymous' | 'use-credentials' | undefined
|
|
333
333
|
}
|
|
334
334
|
|
|
335
335
|
interface LabelAttributes extends PyreonHTMLAttributes<HTMLLabelElement> {
|
|
@@ -341,7 +341,7 @@ interface LabelAttributes extends PyreonHTMLAttributes<HTMLLabelElement> {
|
|
|
341
341
|
interface ThAttributes extends PyreonHTMLAttributes<HTMLTableCellElement> {
|
|
342
342
|
colSpan?: number | undefined
|
|
343
343
|
rowSpan?: number | undefined
|
|
344
|
-
scope?:
|
|
344
|
+
scope?: 'col' | 'row' | 'colgroup' | 'rowgroup' | undefined
|
|
345
345
|
abbr?: string | undefined
|
|
346
346
|
headers?: string | undefined
|
|
347
347
|
}
|
|
@@ -362,7 +362,7 @@ interface IframeAttributes extends PyreonHTMLAttributes<HTMLIFrameElement> {
|
|
|
362
362
|
height?: number | string | undefined
|
|
363
363
|
allow?: string | undefined
|
|
364
364
|
allowFullScreen?: boolean | undefined
|
|
365
|
-
loading?:
|
|
365
|
+
loading?: 'lazy' | 'eager' | undefined
|
|
366
366
|
name?: string | undefined
|
|
367
367
|
sandbox?: string | undefined
|
|
368
368
|
referrerPolicy?: string | undefined
|
|
@@ -375,7 +375,7 @@ interface LinkAttributes extends PyreonHTMLAttributes<HTMLLinkElement> {
|
|
|
375
375
|
type?: string | undefined
|
|
376
376
|
as?: string | undefined
|
|
377
377
|
media?: string | undefined
|
|
378
|
-
crossOrigin?:
|
|
378
|
+
crossOrigin?: 'anonymous' | 'use-credentials' | undefined
|
|
379
379
|
integrity?: string | undefined
|
|
380
380
|
referrerPolicy?: string | undefined
|
|
381
381
|
}
|
|
@@ -393,7 +393,7 @@ interface ScriptAttributes extends PyreonHTMLAttributes<HTMLScriptElement> {
|
|
|
393
393
|
type?: string | undefined
|
|
394
394
|
async?: boolean | undefined
|
|
395
395
|
defer?: boolean | undefined
|
|
396
|
-
crossOrigin?:
|
|
396
|
+
crossOrigin?: 'anonymous' | 'use-credentials' | undefined
|
|
397
397
|
integrity?: string | undefined
|
|
398
398
|
noModule?: boolean | undefined
|
|
399
399
|
referrerPolicy?: string | undefined
|
|
@@ -432,7 +432,7 @@ interface DialogAttributes extends PyreonHTMLAttributes<HTMLDialogElement> {
|
|
|
432
432
|
interface OlAttributes extends PyreonHTMLAttributes<HTMLOListElement> {
|
|
433
433
|
start?: number | undefined
|
|
434
434
|
reversed?: boolean | undefined
|
|
435
|
-
type?:
|
|
435
|
+
type?: '1' | 'a' | 'A' | 'i' | 'I' | undefined
|
|
436
436
|
}
|
|
437
437
|
|
|
438
438
|
interface CanvasAttributes extends PyreonHTMLAttributes<HTMLCanvasElement> {
|
|
@@ -445,12 +445,12 @@ export interface SvgAttributes extends PyreonHTMLAttributes<SVGElement> {
|
|
|
445
445
|
xmlns?: string | undefined
|
|
446
446
|
fill?: string | (() => string) | undefined
|
|
447
447
|
stroke?: string | (() => string) | undefined
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
448
|
+
'stroke-width'?: string | number | undefined
|
|
449
|
+
'stroke-linecap'?: 'butt' | 'round' | 'square' | undefined
|
|
450
|
+
'stroke-linejoin'?: 'miter' | 'round' | 'bevel' | undefined
|
|
451
|
+
'fill-rule'?: 'nonzero' | 'evenodd' | undefined
|
|
452
|
+
'clip-rule'?: 'nonzero' | 'evenodd' | undefined
|
|
453
|
+
'clip-path'?: string | undefined
|
|
454
454
|
d?: string | undefined
|
|
455
455
|
cx?: string | number | undefined
|
|
456
456
|
cy?: string | number | undefined
|
|
@@ -468,38 +468,38 @@ export interface SvgAttributes extends PyreonHTMLAttributes<SVGElement> {
|
|
|
468
468
|
transform?: string | (() => string) | undefined
|
|
469
469
|
opacity?: string | number | (() => string | number) | undefined
|
|
470
470
|
points?: string | undefined
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
471
|
+
'font-size'?: string | number | undefined
|
|
472
|
+
'text-anchor'?: 'start' | 'middle' | 'end' | undefined
|
|
473
|
+
'dominant-baseline'?: string | undefined
|
|
474
474
|
// Gradient & pattern
|
|
475
|
-
gradientUnits?:
|
|
475
|
+
gradientUnits?: 'userSpaceOnUse' | 'objectBoundingBox' | undefined
|
|
476
476
|
gradientTransform?: string | undefined
|
|
477
|
-
patternUnits?:
|
|
478
|
-
patternContentUnits?:
|
|
477
|
+
patternUnits?: 'userSpaceOnUse' | 'objectBoundingBox' | undefined
|
|
478
|
+
patternContentUnits?: 'userSpaceOnUse' | 'objectBoundingBox' | undefined
|
|
479
479
|
patternTransform?: string | undefined
|
|
480
|
-
spreadMethod?:
|
|
480
|
+
spreadMethod?: 'pad' | 'reflect' | 'repeat' | undefined
|
|
481
481
|
// Marker
|
|
482
482
|
markerWidth?: string | number | undefined
|
|
483
483
|
markerHeight?: string | number | undefined
|
|
484
|
-
markerUnits?:
|
|
484
|
+
markerUnits?: 'strokeWidth' | 'userSpaceOnUse' | undefined
|
|
485
485
|
orient?: string | number | undefined
|
|
486
486
|
refX?: string | number | undefined
|
|
487
487
|
refY?: string | number | undefined
|
|
488
488
|
// Clipping & masking
|
|
489
|
-
maskUnits?:
|
|
490
|
-
maskContentUnits?:
|
|
491
|
-
clipPathUnits?:
|
|
489
|
+
maskUnits?: 'userSpaceOnUse' | 'objectBoundingBox' | undefined
|
|
490
|
+
maskContentUnits?: 'userSpaceOnUse' | 'objectBoundingBox' | undefined
|
|
491
|
+
clipPathUnits?: 'userSpaceOnUse' | 'objectBoundingBox' | undefined
|
|
492
492
|
// Filter
|
|
493
|
-
filterUnits?:
|
|
494
|
-
primitiveUnits?:
|
|
493
|
+
filterUnits?: 'userSpaceOnUse' | 'objectBoundingBox' | undefined
|
|
494
|
+
primitiveUnits?: 'userSpaceOnUse' | 'objectBoundingBox' | undefined
|
|
495
495
|
// Presentation
|
|
496
496
|
preserveAspectRatio?: string | undefined
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
497
|
+
'color-interpolation'?: string | undefined
|
|
498
|
+
'color-interpolation-filters'?: string | undefined
|
|
499
|
+
'shape-rendering'?: string | undefined
|
|
500
|
+
'image-rendering'?: string | undefined
|
|
501
|
+
'text-rendering'?: string | undefined
|
|
502
|
+
'pointer-events'?: string | undefined
|
|
503
503
|
visibility?: string | undefined
|
|
504
504
|
display?: string | undefined
|
|
505
505
|
overflow?: string | undefined
|
|
@@ -508,10 +508,10 @@ export interface SvgAttributes extends PyreonHTMLAttributes<SVGElement> {
|
|
|
508
508
|
dx?: string | number | undefined
|
|
509
509
|
dy?: string | number | undefined
|
|
510
510
|
textLength?: string | number | undefined
|
|
511
|
-
lengthAdjust?:
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
511
|
+
lengthAdjust?: 'spacing' | 'spacingAndGlyphs' | undefined
|
|
512
|
+
'writing-mode'?: string | undefined
|
|
513
|
+
'letter-spacing'?: string | number | undefined
|
|
514
|
+
'word-spacing'?: string | number | undefined
|
|
515
515
|
// Path
|
|
516
516
|
pathLength?: number | undefined
|
|
517
517
|
// Use/href
|
|
@@ -521,14 +521,14 @@ export interface SvgAttributes extends PyreonHTMLAttributes<SVGElement> {
|
|
|
521
521
|
declare global {
|
|
522
522
|
namespace JSX {
|
|
523
523
|
/** The type that JSX expressions evaluate to */
|
|
524
|
-
type Element = import(
|
|
524
|
+
type Element = import('./types').VNode
|
|
525
525
|
|
|
526
526
|
/**
|
|
527
527
|
* Valid JSX tag types — intrinsic strings + component functions.
|
|
528
528
|
* Components may return VNode, null, strings, functions (reactive getters), etc.
|
|
529
529
|
* (TS 5.1+ feature)
|
|
530
530
|
*/
|
|
531
|
-
type ElementType = keyof IntrinsicElements | ((props: any) => import(
|
|
531
|
+
type ElementType = keyof IntrinsicElements | ((props: any) => import('./types').VNodeChild)
|
|
532
532
|
|
|
533
533
|
/** Props that can be passed to any JSX element (intrinsic or component) */
|
|
534
534
|
interface IntrinsicAttributes {
|
|
@@ -668,8 +668,8 @@ declare global {
|
|
|
668
668
|
radialGradient: SvgAttributes
|
|
669
669
|
stop: SvgAttributes & {
|
|
670
670
|
offset?: string | number
|
|
671
|
-
|
|
672
|
-
|
|
671
|
+
'stop-color'?: string
|
|
672
|
+
'stop-opacity'?: string | number
|
|
673
673
|
}
|
|
674
674
|
// Interactive / embedding
|
|
675
675
|
details: DetailsAttributes
|
package/src/lazy.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { signal } from
|
|
2
|
-
import { h } from
|
|
3
|
-
import type { LazyComponent } from
|
|
4
|
-
import type { ComponentFn, Props } from
|
|
1
|
+
import { signal } from '@pyreon/reactivity'
|
|
2
|
+
import { h } from './h'
|
|
3
|
+
import type { LazyComponent } from './suspense'
|
|
4
|
+
import type { ComponentFn, Props } from './types'
|
|
5
5
|
|
|
6
6
|
export function lazy<P extends Props>(
|
|
7
7
|
load: () => Promise<{ default: ComponentFn<P> }>,
|
package/src/lifecycle.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { CleanupFn, LifecycleHooks } from
|
|
1
|
+
import type { CleanupFn, LifecycleHooks } from './types'
|
|
2
2
|
|
|
3
|
-
const __DEV__ = typeof process !==
|
|
3
|
+
const __DEV__ = typeof process !== 'undefined' && process.env.NODE_ENV !== 'production'
|
|
4
4
|
|
|
5
5
|
// The currently-executing component's hook storage, set by the renderer
|
|
6
6
|
// before calling the component function, cleared immediately after.
|
|
@@ -30,7 +30,7 @@ function warnOutsideSetup(hookName: string): void {
|
|
|
30
30
|
*/
|
|
31
31
|
// biome-ignore lint/suspicious/noConfusingVoidType: void allows callbacks that return nothing
|
|
32
32
|
export function onMount(fn: () => CleanupFn | void | undefined) {
|
|
33
|
-
warnOutsideSetup(
|
|
33
|
+
warnOutsideSetup('onMount')
|
|
34
34
|
_current?.mount.push(fn)
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -38,7 +38,7 @@ export function onMount(fn: () => CleanupFn | void | undefined) {
|
|
|
38
38
|
* Register a callback to run when the component is removed from the DOM.
|
|
39
39
|
*/
|
|
40
40
|
export function onUnmount(fn: () => void) {
|
|
41
|
-
warnOutsideSetup(
|
|
41
|
+
warnOutsideSetup('onUnmount')
|
|
42
42
|
_current?.unmount.push(fn)
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -46,7 +46,7 @@ export function onUnmount(fn: () => void) {
|
|
|
46
46
|
* Register a callback to run after each reactive update.
|
|
47
47
|
*/
|
|
48
48
|
export function onUpdate(fn: () => void) {
|
|
49
|
-
warnOutsideSetup(
|
|
49
|
+
warnOutsideSetup('onUpdate')
|
|
50
50
|
_current?.update.push(fn)
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -64,6 +64,6 @@ export function onUpdate(fn: () => void) {
|
|
|
64
64
|
* })
|
|
65
65
|
*/
|
|
66
66
|
export function onErrorCaptured(fn: (err: unknown) => boolean | undefined) {
|
|
67
|
-
warnOutsideSetup(
|
|
67
|
+
warnOutsideSetup('onErrorCaptured')
|
|
68
68
|
_current?.error.push(fn)
|
|
69
69
|
}
|
package/src/portal.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { Props, VNode, VNodeChild } from
|
|
1
|
+
import type { Props, VNode, VNodeChild } from './types'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Symbol used as the VNode type for a Portal — runtime-dom mounts the
|
|
5
5
|
* children into `target` instead of the normal parent.
|
|
6
6
|
*/
|
|
7
|
-
export const PortalSymbol: unique symbol = Symbol(
|
|
7
|
+
export const PortalSymbol: unique symbol = Symbol('pyreon.Portal')
|
|
8
8
|
|
|
9
9
|
export interface PortalProps {
|
|
10
10
|
/** DOM element to render children into (e.g. document.body). */
|
package/src/show.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Props, VNode, VNodeChild, VNodeChildAtom } from
|
|
1
|
+
import type { Props, VNode, VNodeChild, VNodeChildAtom } from './types'
|
|
2
2
|
|
|
3
3
|
// ─── Show ─────────────────────────────────────────────────────────────────────
|
|
4
4
|
|
|
@@ -69,7 +69,7 @@ export interface SwitchProps extends Props {
|
|
|
69
69
|
function isMatchVNode(branch: VNodeChild): branch is VNode {
|
|
70
70
|
return (
|
|
71
71
|
branch !== null &&
|
|
72
|
-
typeof branch ===
|
|
72
|
+
typeof branch === 'object' &&
|
|
73
73
|
!Array.isArray(branch) &&
|
|
74
74
|
(branch as VNode).type === Match
|
|
75
75
|
)
|
|
@@ -83,7 +83,7 @@ function resolveMatchChildren(matchVNode: VNode): VNodeChildAtom {
|
|
|
83
83
|
return matchVNode.children as unknown as VNodeChildAtom
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
function normalizeBranches(children: SwitchProps[
|
|
86
|
+
function normalizeBranches(children: SwitchProps['children']): VNodeChild[] {
|
|
87
87
|
if (Array.isArray(children)) return children
|
|
88
88
|
if (children != null) return [children]
|
|
89
89
|
return []
|
|
@@ -105,4 +105,4 @@ export function Switch(props: SwitchProps): VNode | null {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
// Keep MatchSymbol export for any code that was using it
|
|
108
|
-
export const MatchSymbol: unique symbol = Symbol(
|
|
108
|
+
export const MatchSymbol: unique symbol = Symbol('pyreon.Match')
|