@vesk/compiler 0.2.33 → 0.2.34
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/typecheck.d.ts +1 -1
- package/dist/typecheck.d.ts.map +1 -1
- package/dist/typecheck.js +14 -1
- package/dist/vsk-tsx.d.ts.map +1 -1
- package/dist/vsk-tsx.js +174 -15
- package/package.json +2 -2
package/dist/typecheck.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface TypecheckError {
|
|
|
9
9
|
code: string;
|
|
10
10
|
message: string;
|
|
11
11
|
}
|
|
12
|
-
export declare const AMBIENT = "\ndeclare namespace JSX {\n type VeskEventHandler<E extends Event = Event> = (event: E) => void;\n interface VeskCommonAttributes {\n key?: string | number;\n class?: string;\n id?: string;\n style?: string;\n title?: string;\n hidden?: boolean | string;\n lang?: string;\n dir?: 'ltr' | 'rtl' | 'auto';\n tabIndex?: number;\n role?: string;\n }\n interface VeskEventAttributes {\n onClick?: VeskEventHandler<MouseEvent>;\n onDblClick?: VeskEventHandler<MouseEvent>;\n onMouseDown?: VeskEventHandler<MouseEvent>;\n onMouseUp?: VeskEventHandler<MouseEvent>;\n onMouseEnter?: VeskEventHandler<MouseEvent>;\n onMouseLeave?: VeskEventHandler<MouseEvent>;\n onMouseMove?: VeskEventHandler<MouseEvent>;\n onKeyDown?: VeskEventHandler<KeyboardEvent>;\n onKeyUp?: VeskEventHandler<KeyboardEvent>;\n onFocus?: VeskEventHandler<FocusEvent>;\n onBlur?: VeskEventHandler<FocusEvent>;\n onInput?: VeskEventHandler<InputEvent>;\n onChange?: VeskEventHandler<Event>;\n onSubmit?: VeskEventHandler<SubmitEvent>;\n onScroll?: VeskEventHandler<UIEvent>;\n onWheel?: VeskEventHandler<WheelEvent>;\n // Lowercase aliases \u2014 HTML attribute names are case-insensitive and real\n // code writes onclick=/oninput=. Keep in sync with the camelCase members.\n onclick?: VeskEventHandler<MouseEvent>;\n ondblclick?: VeskEventHandler<MouseEvent>;\n onmousedown?: VeskEventHandler<MouseEvent>;\n onmouseup?: VeskEventHandler<MouseEvent>;\n onmouseenter?: VeskEventHandler<MouseEvent>;\n onmouseleave?: VeskEventHandler<MouseEvent>;\n onmousemove?: VeskEventHandler<MouseEvent>;\n onkeydown?: VeskEventHandler<KeyboardEvent>;\n onkeyup?: VeskEventHandler<KeyboardEvent>;\n onfocus?: VeskEventHandler<FocusEvent>;\n onblur?: VeskEventHandler<FocusEvent>;\n oninput?: VeskEventHandler<InputEvent>;\n onchange?: VeskEventHandler<Event>;\n onsubmit?: VeskEventHandler<SubmitEvent>;\n }\n type Component = string | number | boolean | null | undefined | Component[];\n interface VeskGlobalAttributes extends VeskCommonAttributes, VeskEventAttributes {\n children?: Component;\n }\n interface VeskAnchorAttributes extends VeskGlobalAttributes {\n href?: string;\n target?: string;\n rel?: string;\n download?: string | boolean;\n type?: string;\n hreflang?: string;\n }\n interface VeskMediaAttributes extends VeskGlobalAttributes {\n src?: string;\n width?: string | number;\n height?: string | number;\n }\n interface VeskInputAttributes extends VeskGlobalAttributes {\n type?: string;\n name?: string;\n value?: string | number | readonly string[];\n placeholder?: string;\n checked?: boolean | string;\n disabled?: boolean | string;\n readOnly?: boolean | string;\n required?: boolean | string;\n min?: string | number;\n max?: string | number;\n step?: string | number;\n pattern?: string;\n autoComplete?: string;\n autoFocus?: boolean | string;\n multiple?: boolean | string;\n accept?: string;\n size?: number;\n list?: string;\n }\n interface IntrinsicElements {\n html?: VeskGlobalAttributes & { manifest?: string };\n head?: VeskGlobalAttributes;\n body?: VeskGlobalAttributes;\n div?: VeskGlobalAttributes;\n span?: VeskGlobalAttributes;\n p?: VeskGlobalAttributes;\n h1?: VeskGlobalAttributes;\n h2?: VeskGlobalAttributes;\n h3?: VeskGlobalAttributes;\n h4?: VeskGlobalAttributes;\n h5?: VeskGlobalAttributes;\n h6?: VeskGlobalAttributes;\n a?: VeskAnchorAttributes;\n nav?: VeskGlobalAttributes;\n header?: VeskGlobalAttributes;\n footer?: VeskGlobalAttributes;\n main?: VeskGlobalAttributes;\n section?: VeskGlobalAttributes;\n article?: VeskGlobalAttributes;\n aside?: VeskGlobalAttributes;\n button?: VeskGlobalAttributes & {\n type?: 'button' | 'submit' | 'reset';\n disabled?: boolean | string;\n name?: string;\n value?: string | number;\n };\n form?: VeskGlobalAttributes & {\n action?: string;\n method?: 'get' | 'post';\n target?: string;\n encType?: string;\n noValidate?: boolean | string;\n name?: string;\n autoComplete?: string;\n };\n input?: VeskInputAttributes;\n textarea?: VeskGlobalAttributes & {\n rows?: number;\n cols?: number;\n placeholder?: string;\n value?: string | number;\n disabled?: boolean | string;\n readOnly?: boolean | string;\n required?: boolean | string;\n name?: string;\n };\n select?: VeskGlobalAttributes & {\n name?: string;\n value?: string | number | readonly string[];\n disabled?: boolean | string;\n required?: boolean | string;\n multiple?: boolean | string;\n size?: number;\n autoComplete?: string;\n };\n option?: VeskGlobalAttributes & {\n value?: string | number;\n selected?: boolean | string;\n disabled?: boolean | string;\n label?: string;\n };\n optgroup?: VeskGlobalAttributes & { label?: string; disabled?: boolean | string };\n label?: VeskGlobalAttributes & { htmlFor?: string };\n fieldset?: VeskGlobalAttributes & { disabled?: boolean | string; name?: string; form?: string };\n legend?: VeskGlobalAttributes;\n datalist?: VeskGlobalAttributes;\n img?: VeskGlobalAttributes & {\n src?: string;\n alt?: string;\n width?: string | number;\n height?: string | number;\n srcSet?: string;\n sizes?: string;\n loading?: 'eager' | 'lazy';\n decoding?: 'sync' | 'async' | 'auto';\n };\n picture?: VeskGlobalAttributes;\n source?: VeskGlobalAttributes & { src?: string; srcSet?: string; sizes?: string; media?: string; type?: string };\n video?: VeskMediaAttributes & {\n controls?: boolean | string;\n autoPlay?: boolean | string;\n loop?: boolean | string;\n muted?: boolean | string;\n preload?: 'none' | 'metadata' | 'auto' | '';\n poster?: string;\n playsInline?: boolean | string;\n };\n audio?: VeskGlobalAttributes & {\n src?: string;\n controls?: boolean | string;\n autoPlay?: boolean | string;\n loop?: boolean | string;\n muted?: boolean | string;\n preload?: 'none' | 'metadata' | 'auto' | '';\n };\n track?: VeskGlobalAttributes & {\n src?: string;\n kind?: string;\n srclang?: string;\n label?: string;\n default?: boolean | string;\n };\n canvas?: VeskGlobalAttributes & { width?: number; height?: number };\n iframe?: VeskGlobalAttributes & {\n src?: string;\n srcDoc?: string;\n width?: string | number;\n height?: string | number;\n allow?: string;\n loading?: 'eager' | 'lazy';\n sandbox?: string;\n allowFullScreen?: boolean | string;\n referrerPolicy?: string;\n };\n embed?: VeskGlobalAttributes & { src?: string; type?: string; width?: string | number; height?: string | number };\n object?: VeskGlobalAttributes & { data?: string; type?: string; name?: string; width?: string | number; height?: string | number };\n table?: VeskGlobalAttributes;\n caption?: VeskGlobalAttributes;\n thead?: VeskGlobalAttributes;\n tbody?: VeskGlobalAttributes;\n tfoot?: VeskGlobalAttributes;\n tr?: VeskGlobalAttributes;\n th?: VeskGlobalAttributes & { colSpan?: number; rowSpan?: number; scope?: string; headers?: string };\n td?: VeskGlobalAttributes & { colSpan?: number; rowSpan?: number; headers?: string };\n col?: VeskGlobalAttributes & { span?: number };\n colgroup?: VeskGlobalAttributes & { span?: number };\n ul?: VeskGlobalAttributes;\n ol?: VeskGlobalAttributes & { start?: number; reversed?: boolean | string; type?: string };\n li?: VeskGlobalAttributes & { value?: number };\n dl?: VeskGlobalAttributes;\n dt?: VeskGlobalAttributes;\n dd?: VeskGlobalAttributes;\n br?: VeskGlobalAttributes;\n hr?: VeskGlobalAttributes;\n pre?: VeskGlobalAttributes;\n code?: VeskGlobalAttributes;\n blockquote?: VeskGlobalAttributes & { cite?: string };\n q?: VeskGlobalAttributes & { cite?: string };\n strong?: VeskGlobalAttributes;\n em?: VeskGlobalAttributes;\n small?: VeskGlobalAttributes;\n s?: VeskGlobalAttributes;\n cite?: VeskGlobalAttributes;\n dfn?: VeskGlobalAttributes;\n abbr?: VeskGlobalAttributes & { title?: string };\n time?: VeskGlobalAttributes & { dateTime?: string };\n data?: VeskGlobalAttributes & { value?: string | number };\n mark?: VeskGlobalAttributes;\n del?: VeskGlobalAttributes & { cite?: string; dateTime?: string };\n ins?: VeskGlobalAttributes & { cite?: string; dateTime?: string };\n sub?: VeskGlobalAttributes;\n sup?: VeskGlobalAttributes;\n u?: VeskGlobalAttributes;\n kbd?: VeskGlobalAttributes;\n samp?: VeskGlobalAttributes;\n var?: VeskGlobalAttributes;\n figure?: VeskGlobalAttributes;\n figcaption?: VeskGlobalAttributes;\n details?: VeskGlobalAttributes & { open?: boolean | string };\n summary?: VeskGlobalAttributes;\n dialog?: VeskGlobalAttributes & { open?: boolean | string };\n menu?: VeskGlobalAttributes;\n address?: VeskGlobalAttributes;\n b?: VeskGlobalAttributes;\n i?: VeskGlobalAttributes;\n ruby?: VeskGlobalAttributes;\n rt?: VeskGlobalAttributes;\n rp?: VeskGlobalAttributes;\n bdi?: VeskGlobalAttributes;\n bdo?: VeskGlobalAttributes;\n wbr?: VeskGlobalAttributes;\n area?: VeskGlobalAttributes & {\n coords?: string;\n shape?: string;\n href?: string;\n target?: string;\n alt?: string;\n };\n map?: VeskGlobalAttributes & { name?: string };\n noscript?: VeskGlobalAttributes;\n template?: VeskGlobalAttributes;\n slot?: VeskGlobalAttributes & { name?: string };\n meta?: VeskGlobalAttributes & { name?: string; content?: string; charSet?: string; httpEquiv?: string };\n title?: VeskGlobalAttributes;\n base?: VeskGlobalAttributes & { href?: string; target?: string };\n link?: VeskGlobalAttributes & {\n rel?: string;\n href?: string;\n sizes?: string;\n media?: string;\n as?: string;\n crossOrigin?: string;\n integrity?: string;\n type?: string;\n };\n style?: VeskGlobalAttributes & { media?: string };\n script?: VeskGlobalAttributes & {\n src?: string;\n async?: boolean | string;\n defer?: boolean | string;\n type?: string;\n crossOrigin?: string;\n integrity?: string;\n nonce?: string;\n noModule?: boolean | string;\n };\n svg?: VeskGlobalAttributes & {\n viewBox?: string;\n xmlns?: string;\n width?: string | number;\n height?: string | number;\n fill?: string;\n stroke?: string;\n strokeWidth?: string | number;\n };\n g?: VeskGlobalAttributes & { transform?: string; fill?: string; stroke?: string; strokeWidth?: string | number };\n path?: VeskGlobalAttributes & {\n d?: string;\n fill?: string;\n stroke?: string;\n strokeWidth?: string | number;\n fillRule?: string;\n clipRule?: string;\n };\n circle?: VeskGlobalAttributes & {\n cx?: string | number;\n cy?: string | number;\n r?: string | number;\n fill?: string;\n stroke?: string;\n strokeWidth?: string | number;\n };\n ellipse?: VeskGlobalAttributes & {\n cx?: string | number;\n cy?: string | number;\n rx?: string | number;\n ry?: string | number;\n fill?: string;\n };\n rect?: VeskGlobalAttributes & {\n x?: string | number;\n y?: string | number;\n width?: string | number;\n height?: string | number;\n rx?: string | number;\n ry?: string | number;\n fill?: string;\n };\n line?: VeskGlobalAttributes & {\n x1?: string | number;\n y1?: string | number;\n x2?: string | number;\n y2?: string | number;\n stroke?: string;\n strokeWidth?: string | number;\n };\n polyline?: VeskGlobalAttributes & { points?: string; fill?: string; stroke?: string };\n polygon?: VeskGlobalAttributes & { points?: string; fill?: string; stroke?: string };\n text?: VeskGlobalAttributes & { x?: string | number; y?: string | number; fill?: string; fontSize?: string | number };\n defs?: VeskGlobalAttributes;\n linearGradient?: VeskGlobalAttributes;\n radialGradient?: VeskGlobalAttributes;\n stop?: VeskGlobalAttributes & { offset?: string | number; stopColor?: string; stopOpacity?: string | number };\n\n // Unknown/custom tags stay permissive \u2014 components and web components\n // resolve through the index signature, known tags get the typed members.\n [elemName: string]: unknown;\n }\n type Component = string | number | boolean | null | undefined | Component[];\n}\ndeclare type Component = string | number | boolean | null | undefined | Component[];\ndeclare const Head: (props: { children?: Component }) => Component;\ninterface Tracked<T> {\n get(): T;\n set(value: T): void;\n}\ninterface Derived<T> {\n get(): T;\n set(value: T): void;\n}\ndeclare function track<T>(initialValue: T): Tracked<T>;\ndeclare function track<T>(fn: () => T): Derived<T>;\ndeclare function derived<T>(fn: () => T): Derived<T>;\ndeclare function effect(fn: () => void): unknown;\ndeclare function untrack<T>(fn: () => T): T;\ndeclare function peek<T>(fn: () => T): T;\ndeclare function tick(): Promise<void>;\ndeclare function flushSync(fn: () => void): void;\ndeclare function on_destroy(fn: () => void): void;\ndeclare function createContext<T>(defaultValue?: T): { id: symbol; defaultValue: T | undefined };\n// useFetch returns a THENABLE resource, not the data itself. In async\n// components you must `await` it before reading/iterating the payload;\n// passing `into: <tracked cell>` writes the payload into the cell and makes\n// awaiting unnecessary (the return value can be ignored).\ninterface VeskResource<T> {\n loading: boolean;\n error: unknown;\n data: T | undefined;\n refresh(): void;\n abort(): void;\n then<TResult1 = T, TResult2 = never>(\n onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null,\n onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | undefined | null,\n ): PromiseLike<TResult1 | TResult2>;\n}\ninterface VeskUseFetchOptions<T> {\n /** Cache/SSR key \u2014 defaults to the URL string. */\n key?: string;\n /** Target tracked cell (from track<T>()) \u2014 the payload is written into it, so awaiting is unnecessary. */\n into?: Tracked<T>;\n staleTime?: number;\n keepPreviousData?: boolean;\n retry?: number;\n retryDelay?: number;\n timeout?: number;\n enabled?: boolean;\n dedupe?: boolean;\n method?: string;\n headers?: Record<string, string>;\n body?: unknown;\n credentials?: 'omit' | 'same-origin' | 'include';\n signal?: { readonly aborted: boolean };\n}\ndeclare function useFetch<T = unknown>(\n urlOrFn: string | (() => Promise<T>),\n options?: VeskUseFetchOptions<T>,\n): VeskResource<T>;\ndeclare namespace useFetch {\n function text<T = string>(url: string, options?: Omit<VeskUseFetchOptions<T>, 'body'>): VeskResource<T>;\n function json<T = unknown>(url: string, options?: Omit<VeskUseFetchOptions<T>, 'body'>): VeskResource<T>;\n function arrayBuffer<T = ArrayBuffer>(url: string, options?: Omit<VeskUseFetchOptions<T>, 'body'>): VeskResource<T>;\n}\ndeclare function useRouter(): unknown;\ndeclare function useParams(): Record<string, string>;\ndeclare function usePathname(): string;\ndeclare function useSearchParams(): URLSearchParams;\ndeclare function useNavigate(): (to: string) => void;\ndeclare function defineAction(...args: unknown[]): unknown;\ndeclare const Form: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const Field: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare function required(...args: unknown[]): unknown;\ndeclare function email(...args: unknown[]): unknown;\ndeclare function minLength(...args: unknown[]): unknown;\ndeclare function maxLength(...args: unknown[]): unknown;\ndeclare function pattern(...args: unknown[]): unknown;\ndeclare function custom(...args: unknown[]): unknown;\ndeclare const Link: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const NavLink: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const Outlet: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const Image: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const Portal: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const Experiment: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare function useLoadingIndicator(options?: {\n duration?: number;\n throttle?: number;\n hideDelay?: number;\n resetDelay?: number;\n estimatedProgress?: (duration: number, elapsed: number) => number;\n}): {\n progress: Tracked<number>;\n isLoading: Tracked<boolean>;\n error: Tracked<boolean>;\n start(opts?: { force?: boolean }): void;\n set(value: number, opts?: { force?: boolean }): void;\n finish(opts?: { force?: boolean; error?: boolean }): void;\n clear(): void;\n};\ndeclare const LoadingIndicator: (props: {\n color?: string | false;\n errorColor?: string;\n height?: number | string;\n position?: 'top' | 'bottom';\n zIndex?: number;\n duration?: number;\n throttle?: number;\n hideDelay?: number;\n resetDelay?: number;\n estimatedProgress?: (duration: number, elapsed: number) => number;\n class?: string;\n className?: string;\n style?: string;\n children?: Component;\n [k: string]: unknown;\n}) => Component;\ndeclare const JsonLd: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const ArticleSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const ProductSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const FAQPageSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const BreadcrumbListSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const OrganizationSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const LocalBusinessSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const VideoSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare function redirect(...args: unknown[]): unknown;\ndeclare function permanentRedirect(...args: unknown[]): unknown;\ndeclare function notFound(...args: unknown[]): never;\ndeclare class NotFoundError extends Error {}\ndeclare function createResource(...args: unknown[]): unknown;\ndeclare function getAction(...args: unknown[]): unknown;\ndeclare function validateActionInput(...args: unknown[]): unknown;\ndeclare function issuesToFieldMap(...args: unknown[]): unknown;\ndeclare function isFormAction(...args: unknown[]): unknown;\n";
|
|
12
|
+
export declare const AMBIENT = "\ndeclare namespace JSX {\n type VeskEventHandler<E extends Event = Event> = (event: E) => void;\n interface VeskCommonAttributes {\n key?: string | number;\n class?: string;\n id?: string;\n style?: string;\n title?: string;\n hidden?: boolean | string;\n lang?: string;\n dir?: 'ltr' | 'rtl' | 'auto';\n tabIndex?: number;\n role?: string;\n }\n interface VeskEventAttributes {\n onClick?: VeskEventHandler<MouseEvent>;\n onDblClick?: VeskEventHandler<MouseEvent>;\n onMouseDown?: VeskEventHandler<MouseEvent>;\n onMouseUp?: VeskEventHandler<MouseEvent>;\n onMouseEnter?: VeskEventHandler<MouseEvent>;\n onMouseLeave?: VeskEventHandler<MouseEvent>;\n onMouseMove?: VeskEventHandler<MouseEvent>;\n onKeyDown?: VeskEventHandler<KeyboardEvent>;\n onKeyUp?: VeskEventHandler<KeyboardEvent>;\n onFocus?: VeskEventHandler<FocusEvent>;\n onBlur?: VeskEventHandler<FocusEvent>;\n onInput?: VeskEventHandler<InputEvent>;\n onChange?: VeskEventHandler<Event>;\n onSubmit?: VeskEventHandler<SubmitEvent>;\n onScroll?: VeskEventHandler<UIEvent>;\n onWheel?: VeskEventHandler<WheelEvent>;\n // Lowercase aliases \u2014 HTML attribute names are case-insensitive and real\n // code writes onclick=/oninput=. Keep in sync with the camelCase members.\n onclick?: VeskEventHandler<MouseEvent>;\n ondblclick?: VeskEventHandler<MouseEvent>;\n onmousedown?: VeskEventHandler<MouseEvent>;\n onmouseup?: VeskEventHandler<MouseEvent>;\n onmouseenter?: VeskEventHandler<MouseEvent>;\n onmouseleave?: VeskEventHandler<MouseEvent>;\n onmousemove?: VeskEventHandler<MouseEvent>;\n onkeydown?: VeskEventHandler<KeyboardEvent>;\n onkeyup?: VeskEventHandler<KeyboardEvent>;\n onfocus?: VeskEventHandler<FocusEvent>;\n onblur?: VeskEventHandler<FocusEvent>;\n oninput?: VeskEventHandler<InputEvent>;\n onchange?: VeskEventHandler<Event>;\n onsubmit?: VeskEventHandler<SubmitEvent>;\n }\n type Component = string | number | boolean | null | undefined | Component[];\n interface VeskGlobalAttributes extends VeskCommonAttributes, VeskEventAttributes {\n children?: Component;\n }\n interface VeskAnchorAttributes extends VeskGlobalAttributes {\n href?: string;\n target?: string;\n rel?: string;\n download?: string | boolean;\n type?: string;\n hreflang?: string;\n }\n interface VeskMediaAttributes extends VeskGlobalAttributes {\n src?: string;\n width?: string | number;\n height?: string | number;\n }\n interface VeskInputAttributes extends VeskGlobalAttributes {\n type?: string;\n name?: string;\n value?: string | number | readonly string[];\n placeholder?: string;\n checked?: boolean | string;\n disabled?: boolean | string;\n readOnly?: boolean | string;\n required?: boolean | string;\n min?: string | number;\n max?: string | number;\n step?: string | number;\n pattern?: string;\n autoComplete?: string;\n autoFocus?: boolean | string;\n multiple?: boolean | string;\n accept?: string;\n size?: number;\n list?: string;\n }\n interface IntrinsicElements {\n html?: VeskGlobalAttributes & { manifest?: string };\n head?: VeskGlobalAttributes;\n body?: VeskGlobalAttributes;\n div?: VeskGlobalAttributes;\n span?: VeskGlobalAttributes;\n p?: VeskGlobalAttributes;\n h1?: VeskGlobalAttributes;\n h2?: VeskGlobalAttributes;\n h3?: VeskGlobalAttributes;\n h4?: VeskGlobalAttributes;\n h5?: VeskGlobalAttributes;\n h6?: VeskGlobalAttributes;\n a?: VeskAnchorAttributes;\n nav?: VeskGlobalAttributes;\n header?: VeskGlobalAttributes;\n footer?: VeskGlobalAttributes;\n main?: VeskGlobalAttributes;\n section?: VeskGlobalAttributes;\n article?: VeskGlobalAttributes;\n aside?: VeskGlobalAttributes;\n button?: VeskGlobalAttributes & {\n type?: 'button' | 'submit' | 'reset';\n disabled?: boolean | string;\n name?: string;\n value?: string | number;\n };\n form?: VeskGlobalAttributes & {\n action?: string;\n method?: 'get' | 'post';\n target?: string;\n encType?: string;\n noValidate?: boolean | string;\n name?: string;\n autoComplete?: string;\n };\n input?: VeskInputAttributes;\n textarea?: VeskGlobalAttributes & {\n rows?: number;\n cols?: number;\n placeholder?: string;\n value?: string | number;\n disabled?: boolean | string;\n readOnly?: boolean | string;\n required?: boolean | string;\n name?: string;\n };\n select?: VeskGlobalAttributes & {\n name?: string;\n value?: string | number | readonly string[];\n disabled?: boolean | string;\n required?: boolean | string;\n multiple?: boolean | string;\n size?: number;\n autoComplete?: string;\n };\n option?: VeskGlobalAttributes & {\n value?: string | number;\n selected?: boolean | string;\n disabled?: boolean | string;\n label?: string;\n };\n optgroup?: VeskGlobalAttributes & { label?: string; disabled?: boolean | string };\n label?: VeskGlobalAttributes & { htmlFor?: string };\n fieldset?: VeskGlobalAttributes & { disabled?: boolean | string; name?: string; form?: string };\n legend?: VeskGlobalAttributes;\n datalist?: VeskGlobalAttributes;\n img?: VeskGlobalAttributes & {\n src?: string;\n alt?: string;\n width?: string | number;\n height?: string | number;\n srcSet?: string;\n sizes?: string;\n loading?: 'eager' | 'lazy';\n decoding?: 'sync' | 'async' | 'auto';\n };\n picture?: VeskGlobalAttributes;\n source?: VeskGlobalAttributes & { src?: string; srcSet?: string; sizes?: string; media?: string; type?: string };\n video?: VeskMediaAttributes & {\n controls?: boolean | string;\n autoPlay?: boolean | string;\n loop?: boolean | string;\n muted?: boolean | string;\n preload?: 'none' | 'metadata' | 'auto' | '';\n poster?: string;\n playsInline?: boolean | string;\n };\n audio?: VeskGlobalAttributes & {\n src?: string;\n controls?: boolean | string;\n autoPlay?: boolean | string;\n loop?: boolean | string;\n muted?: boolean | string;\n preload?: 'none' | 'metadata' | 'auto' | '';\n };\n track?: VeskGlobalAttributes & {\n src?: string;\n kind?: string;\n srclang?: string;\n label?: string;\n default?: boolean | string;\n };\n canvas?: VeskGlobalAttributes & { width?: number; height?: number };\n iframe?: VeskGlobalAttributes & {\n src?: string;\n srcDoc?: string;\n width?: string | number;\n height?: string | number;\n allow?: string;\n loading?: 'eager' | 'lazy';\n sandbox?: string;\n allowFullScreen?: boolean | string;\n referrerPolicy?: string;\n };\n embed?: VeskGlobalAttributes & { src?: string; type?: string; width?: string | number; height?: string | number };\n object?: VeskGlobalAttributes & { data?: string; type?: string; name?: string; width?: string | number; height?: string | number };\n table?: VeskGlobalAttributes;\n caption?: VeskGlobalAttributes;\n thead?: VeskGlobalAttributes;\n tbody?: VeskGlobalAttributes;\n tfoot?: VeskGlobalAttributes;\n tr?: VeskGlobalAttributes;\n th?: VeskGlobalAttributes & { colSpan?: number; rowSpan?: number; scope?: string; headers?: string };\n td?: VeskGlobalAttributes & { colSpan?: number; rowSpan?: number; headers?: string };\n col?: VeskGlobalAttributes & { span?: number };\n colgroup?: VeskGlobalAttributes & { span?: number };\n ul?: VeskGlobalAttributes;\n ol?: VeskGlobalAttributes & { start?: number; reversed?: boolean | string; type?: string };\n li?: VeskGlobalAttributes & { value?: number };\n dl?: VeskGlobalAttributes;\n dt?: VeskGlobalAttributes;\n dd?: VeskGlobalAttributes;\n br?: VeskGlobalAttributes;\n hr?: VeskGlobalAttributes;\n pre?: VeskGlobalAttributes;\n code?: VeskGlobalAttributes;\n blockquote?: VeskGlobalAttributes & { cite?: string };\n q?: VeskGlobalAttributes & { cite?: string };\n strong?: VeskGlobalAttributes;\n em?: VeskGlobalAttributes;\n small?: VeskGlobalAttributes;\n s?: VeskGlobalAttributes;\n cite?: VeskGlobalAttributes;\n dfn?: VeskGlobalAttributes;\n abbr?: VeskGlobalAttributes & { title?: string };\n time?: VeskGlobalAttributes & { dateTime?: string };\n data?: VeskGlobalAttributes & { value?: string | number };\n mark?: VeskGlobalAttributes;\n del?: VeskGlobalAttributes & { cite?: string; dateTime?: string };\n ins?: VeskGlobalAttributes & { cite?: string; dateTime?: string };\n sub?: VeskGlobalAttributes;\n sup?: VeskGlobalAttributes;\n u?: VeskGlobalAttributes;\n kbd?: VeskGlobalAttributes;\n samp?: VeskGlobalAttributes;\n var?: VeskGlobalAttributes;\n figure?: VeskGlobalAttributes;\n figcaption?: VeskGlobalAttributes;\n details?: VeskGlobalAttributes & { open?: boolean | string };\n summary?: VeskGlobalAttributes;\n dialog?: VeskGlobalAttributes & { open?: boolean | string };\n menu?: VeskGlobalAttributes;\n address?: VeskGlobalAttributes;\n b?: VeskGlobalAttributes;\n i?: VeskGlobalAttributes;\n ruby?: VeskGlobalAttributes;\n rt?: VeskGlobalAttributes;\n rp?: VeskGlobalAttributes;\n bdi?: VeskGlobalAttributes;\n bdo?: VeskGlobalAttributes;\n wbr?: VeskGlobalAttributes;\n area?: VeskGlobalAttributes & {\n coords?: string;\n shape?: string;\n href?: string;\n target?: string;\n alt?: string;\n };\n map?: VeskGlobalAttributes & { name?: string };\n noscript?: VeskGlobalAttributes;\n template?: VeskGlobalAttributes;\n slot?: VeskGlobalAttributes & { name?: string };\n meta?: VeskGlobalAttributes & {\n name?: string;\n content?: string;\n charSet?: string;\n httpEquiv?: string;\n // Lowercase aliases \u2014 HTML attribute names are case-insensitive and\n // real code (and SSR output) writes charset. Keep in sync with the\n // camelCase members.\n charset?: string;\n };\n title?: VeskGlobalAttributes;\n base?: VeskGlobalAttributes & { href?: string; target?: string };\n link?: VeskGlobalAttributes & {\n rel?: string;\n href?: string;\n sizes?: string;\n media?: string;\n as?: string;\n crossOrigin?: string;\n integrity?: string;\n type?: string;\n // Lowercase alias \u2014 see the meta note above.\n crossorigin?: string | boolean;\n };\n style?: VeskGlobalAttributes & { media?: string };\n script?: VeskGlobalAttributes & {\n src?: string;\n async?: boolean | string;\n defer?: boolean | string;\n type?: string;\n crossOrigin?: string;\n integrity?: string;\n nonce?: string;\n noModule?: boolean | string;\n // Lowercase aliases \u2014 see the meta note above.\n crossorigin?: boolean | string;\n };\n svg?: VeskGlobalAttributes & {\n viewBox?: string;\n xmlns?: string;\n width?: string | number;\n height?: string | number;\n fill?: string;\n stroke?: string;\n strokeWidth?: string | number;\n };\n g?: VeskGlobalAttributes & { transform?: string; fill?: string; stroke?: string; strokeWidth?: string | number };\n path?: VeskGlobalAttributes & {\n d?: string;\n fill?: string;\n stroke?: string;\n strokeWidth?: string | number;\n fillRule?: string;\n clipRule?: string;\n };\n circle?: VeskGlobalAttributes & {\n cx?: string | number;\n cy?: string | number;\n r?: string | number;\n fill?: string;\n stroke?: string;\n strokeWidth?: string | number;\n };\n ellipse?: VeskGlobalAttributes & {\n cx?: string | number;\n cy?: string | number;\n rx?: string | number;\n ry?: string | number;\n fill?: string;\n };\n rect?: VeskGlobalAttributes & {\n x?: string | number;\n y?: string | number;\n width?: string | number;\n height?: string | number;\n rx?: string | number;\n ry?: string | number;\n fill?: string;\n };\n line?: VeskGlobalAttributes & {\n x1?: string | number;\n y1?: string | number;\n x2?: string | number;\n y2?: string | number;\n stroke?: string;\n strokeWidth?: string | number;\n };\n polyline?: VeskGlobalAttributes & { points?: string; fill?: string; stroke?: string };\n polygon?: VeskGlobalAttributes & { points?: string; fill?: string; stroke?: string };\n text?: VeskGlobalAttributes & { x?: string | number; y?: string | number; fill?: string; fontSize?: string | number };\n defs?: VeskGlobalAttributes;\n linearGradient?: VeskGlobalAttributes;\n radialGradient?: VeskGlobalAttributes;\n stop?: VeskGlobalAttributes & { offset?: string | number; stopColor?: string; stopOpacity?: string | number };\n\n // Unknown/custom tags stay permissive \u2014 components and web components\n // resolve through the index signature, known tags get the typed members.\n [elemName: string]: unknown;\n }\n type Component = string | number | boolean | null | undefined | Component[];\n}\ndeclare type Component = string | number | boolean | null | undefined | Component[];\ndeclare const Head: (props: { children?: Component }) => Component;\ninterface Tracked<T> {\n get(): T;\n set(value: T): void;\n}\ninterface Derived<T> {\n get(): T;\n set(value: T): void;\n}\ndeclare function track<T>(initialValue: T): Tracked<T>;\ndeclare function track<T>(fn: () => T): Derived<T>;\ndeclare function derived<T>(fn: () => T): Derived<T>;\ndeclare function effect(fn: () => void): unknown;\ndeclare function untrack<T>(fn: () => T): T;\ndeclare function peek<T>(fn: () => T): T;\ndeclare function tick(): Promise<void>;\ndeclare function flushSync(fn: () => void): void;\ndeclare function on_destroy(fn: () => void): void;\ndeclare function createContext<T>(defaultValue?: T): { id: symbol; defaultValue: T | undefined };\n// useFetch returns a THENABLE resource, not the data itself. In async\n// components you must `await` it before reading/iterating the payload;\n// passing `into: <tracked cell>` writes the payload into the cell and makes\n// awaiting unnecessary (the return value can be ignored).\ninterface VeskResource<T> {\n loading: boolean;\n error: unknown;\n data: T | undefined;\n refresh(): void;\n abort(): void;\n then<TResult1 = T, TResult2 = never>(\n onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null,\n onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | undefined | null,\n ): PromiseLike<TResult1 | TResult2>;\n}\ninterface VeskUseFetchOptions<T> {\n /** Cache/SSR key \u2014 defaults to the URL string. */\n key?: string;\n /** Target tracked cell (from track<T>()) \u2014 the payload is written into it, so awaiting is unnecessary. */\n into?: Tracked<T>;\n staleTime?: number;\n keepPreviousData?: boolean;\n retry?: number;\n retryDelay?: number;\n timeout?: number;\n enabled?: boolean;\n dedupe?: boolean;\n method?: string;\n headers?: Record<string, string>;\n body?: unknown;\n credentials?: 'omit' | 'same-origin' | 'include';\n signal?: { readonly aborted: boolean };\n}\ndeclare function useFetch<T = unknown>(\n urlOrFn: string | (() => Promise<T>),\n options?: VeskUseFetchOptions<T>,\n): VeskResource<T>;\ndeclare namespace useFetch {\n function text<T = string>(url: string, options?: Omit<VeskUseFetchOptions<T>, 'body'>): VeskResource<T>;\n function json<T = unknown>(url: string, options?: Omit<VeskUseFetchOptions<T>, 'body'>): VeskResource<T>;\n function arrayBuffer<T = ArrayBuffer>(url: string, options?: Omit<VeskUseFetchOptions<T>, 'body'>): VeskResource<T>;\n}\ndeclare function useRouter(): unknown;\ndeclare function useParams(): Record<string, string>;\ndeclare function usePathname(): string;\ndeclare function useSearchParams(): URLSearchParams;\ndeclare function useNavigate(): (to: string) => void;\ndeclare function defineAction(...args: unknown[]): unknown;\ndeclare const Form: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const Field: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare function required(...args: unknown[]): unknown;\ndeclare function email(...args: unknown[]): unknown;\ndeclare function minLength(...args: unknown[]): unknown;\ndeclare function maxLength(...args: unknown[]): unknown;\ndeclare function pattern(...args: unknown[]): unknown;\ndeclare function custom(...args: unknown[]): unknown;\ndeclare const Link: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const NavLink: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const Outlet: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const Image: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const Portal: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const Experiment: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare function useLoadingIndicator(options?: {\n duration?: number;\n throttle?: number;\n hideDelay?: number;\n resetDelay?: number;\n estimatedProgress?: (duration: number, elapsed: number) => number;\n}): {\n progress: Tracked<number>;\n isLoading: Tracked<boolean>;\n error: Tracked<boolean>;\n start(opts?: { force?: boolean }): void;\n set(value: number, opts?: { force?: boolean }): void;\n finish(opts?: { force?: boolean; error?: boolean }): void;\n clear(): void;\n};\ndeclare const LoadingIndicator: (props: {\n color?: string | false;\n errorColor?: string;\n height?: number | string;\n position?: 'top' | 'bottom';\n zIndex?: number;\n duration?: number;\n throttle?: number;\n hideDelay?: number;\n resetDelay?: number;\n estimatedProgress?: (duration: number, elapsed: number) => number;\n class?: string;\n className?: string;\n style?: string;\n children?: Component;\n [k: string]: unknown;\n}) => Component;\ndeclare const JsonLd: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const ArticleSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const ProductSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const FAQPageSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const BreadcrumbListSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const OrganizationSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const LocalBusinessSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare const VideoSchema: (props: { [k: string]: unknown; children?: Component }) => Component;\ndeclare function redirect(...args: unknown[]): unknown;\ndeclare function permanentRedirect(...args: unknown[]): unknown;\ndeclare function notFound(...args: unknown[]): never;\ndeclare class NotFoundError extends Error {}\ndeclare function createResource(...args: unknown[]): unknown;\ndeclare function getAction(...args: unknown[]): unknown;\ndeclare function validateActionInput(...args: unknown[]): unknown;\ndeclare function issuesToFieldMap(...args: unknown[]): unknown;\ndeclare function isFormAction(...args: unknown[]): unknown;\n";
|
|
13
13
|
export declare const RUNTIME_OVERRIDE = "\nimport '@vesk/runtime';\ndeclare module '@vesk/runtime' {\n export function track<T>(initialValue: T): Tracked<T>;\n export function track<T>(fn: () => T): Derived<T>;\n export function derived<T>(fn: () => T): Derived<T>;\n}\n";
|
|
14
14
|
export interface TypecheckResult {
|
|
15
15
|
errors: TypecheckError[];
|
package/dist/typecheck.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typecheck.d.ts","sourceRoot":"","sources":["../src/typecheck.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAKD,eAAO,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"typecheck.d.ts","sourceRoot":"","sources":["../src/typecheck.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAKD,eAAO,MAAM,OAAO,utmBAqfnB,CAAC;AAEF,eAAO,MAAM,gBAAgB,6OAO5B,CAAC;AAyLF,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC5B;AAED,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,GAAE,gBAAqB,GAAG,eAAe,CA0FlG;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAItE;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,MAAM,CAI1E"}
|
package/dist/typecheck.js
CHANGED
|
@@ -274,7 +274,16 @@ declare namespace JSX {
|
|
|
274
274
|
noscript?: VeskGlobalAttributes;
|
|
275
275
|
template?: VeskGlobalAttributes;
|
|
276
276
|
slot?: VeskGlobalAttributes & { name?: string };
|
|
277
|
-
meta?: VeskGlobalAttributes & {
|
|
277
|
+
meta?: VeskGlobalAttributes & {
|
|
278
|
+
name?: string;
|
|
279
|
+
content?: string;
|
|
280
|
+
charSet?: string;
|
|
281
|
+
httpEquiv?: string;
|
|
282
|
+
// Lowercase aliases — HTML attribute names are case-insensitive and
|
|
283
|
+
// real code (and SSR output) writes charset. Keep in sync with the
|
|
284
|
+
// camelCase members.
|
|
285
|
+
charset?: string;
|
|
286
|
+
};
|
|
278
287
|
title?: VeskGlobalAttributes;
|
|
279
288
|
base?: VeskGlobalAttributes & { href?: string; target?: string };
|
|
280
289
|
link?: VeskGlobalAttributes & {
|
|
@@ -286,6 +295,8 @@ declare namespace JSX {
|
|
|
286
295
|
crossOrigin?: string;
|
|
287
296
|
integrity?: string;
|
|
288
297
|
type?: string;
|
|
298
|
+
// Lowercase alias — see the meta note above.
|
|
299
|
+
crossorigin?: string | boolean;
|
|
289
300
|
};
|
|
290
301
|
style?: VeskGlobalAttributes & { media?: string };
|
|
291
302
|
script?: VeskGlobalAttributes & {
|
|
@@ -297,6 +308,8 @@ declare namespace JSX {
|
|
|
297
308
|
integrity?: string;
|
|
298
309
|
nonce?: string;
|
|
299
310
|
noModule?: boolean | string;
|
|
311
|
+
// Lowercase aliases — see the meta note above.
|
|
312
|
+
crossorigin?: boolean | string;
|
|
300
313
|
};
|
|
301
314
|
svg?: VeskGlobalAttributes & {
|
|
302
315
|
viewBox?: string;
|
package/dist/vsk-tsx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vsk-tsx.d.ts","sourceRoot":"","sources":["../src/vsk-tsx.ts"],"names":[],"mappings":"AAiBA;;;;;;;;GAQG;AAEH,MAAM,WAAW,QAAQ;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,GAAG;QAAE,YAAY,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAClD,QAAQ,CAAC,EAAE,OAAO,GAAG;QAAE,eAAe,CAAC,EAAE,OAAO,CAAC;QAAC,YAAY,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAC3E,UAAU,CAAC,EAAE,OAAO,GAAG;QAAE,YAAY,CAAC,EAAE,OAAO,CAAC;QAAC,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAA;KAAE,CAAC;IACtG,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,WAAW;IAC1B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;
|
|
1
|
+
{"version":3,"file":"vsk-tsx.d.ts","sourceRoot":"","sources":["../src/vsk-tsx.ts"],"names":[],"mappings":"AAiBA;;;;;;;;GAQG;AAEH,MAAM,WAAW,QAAQ;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,GAAG;QAAE,YAAY,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAClD,QAAQ,CAAC,EAAE,OAAO,GAAG;QAAE,eAAe,CAAC,EAAE,OAAO,CAAC;QAAC,YAAY,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAC3E,UAAU,CAAC,EAAE,OAAO,GAAG;QAAE,YAAY,CAAC,EAAE,OAAO,CAAC;QAAC,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAA;KAAE,CAAC;IACtG,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,WAAW;IAC1B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAmqCD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,iBAAsB,GAAG,gBAAgB,CA0ChG;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE/C;AAWD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAmDrD"}
|
package/dist/vsk-tsx.js
CHANGED
|
@@ -91,6 +91,42 @@ function getJSXTagName(el) {
|
|
|
91
91
|
return name.namespace.name + ':' + name.name.name;
|
|
92
92
|
return null;
|
|
93
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Emits JSX text children. The parser has already decoded HTML entities in
|
|
96
|
+
* the value (`<` → `<`, `{` → `{`), so before re-emitting into a TSX
|
|
97
|
+
* surface we must re-escape the characters that tsc would otherwise read as
|
|
98
|
+
* syntax: `<` opens a tag, `>` and `{`/`}` are rejected in text, and `&`
|
|
99
|
+
* starts a fresh entity. @vesk/compiler's SSR and client codegen emit the
|
|
100
|
+
* same text through their own escaping/createTextNode paths, so this only
|
|
101
|
+
* affects the typecheck/LSP surface.
|
|
102
|
+
*/
|
|
103
|
+
function emitJSXText(g, text, start, end) {
|
|
104
|
+
if (text.indexOf('<') === -1 &&
|
|
105
|
+
text.indexOf('>') === -1 &&
|
|
106
|
+
text.indexOf('&') === -1 &&
|
|
107
|
+
text.indexOf('{') === -1 &&
|
|
108
|
+
text.indexOf('}') === -1) {
|
|
109
|
+
g.add(text, start, end);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
let out = '';
|
|
113
|
+
for (let i = 0; i < text.length; i++) {
|
|
114
|
+
const c = text[i];
|
|
115
|
+
if (c === '<')
|
|
116
|
+
out += '<';
|
|
117
|
+
else if (c === '>')
|
|
118
|
+
out += '>';
|
|
119
|
+
else if (c === '&')
|
|
120
|
+
out += '&';
|
|
121
|
+
else if (c === '{')
|
|
122
|
+
out += '{';
|
|
123
|
+
else if (c === '}')
|
|
124
|
+
out += '}';
|
|
125
|
+
else
|
|
126
|
+
out += c;
|
|
127
|
+
}
|
|
128
|
+
g.add(out, start, end);
|
|
129
|
+
}
|
|
94
130
|
/** Collapses newline+whitespace runs to single spaces and records the raw index of every kept character. */
|
|
95
131
|
function collapseWithMap(value) {
|
|
96
132
|
let out = '';
|
|
@@ -371,7 +407,7 @@ function emitJSXAttr(g, source, attr) {
|
|
|
371
407
|
g.add(source.slice(v.start, v.end), v.start, v.end);
|
|
372
408
|
}
|
|
373
409
|
}
|
|
374
|
-
function emitJSXElement(g, source, el, opts) {
|
|
410
|
+
function emitJSXElement(g, source, el, opts, hoist) {
|
|
375
411
|
const op = el.openingElement;
|
|
376
412
|
const name = op.name;
|
|
377
413
|
let prev;
|
|
@@ -401,7 +437,7 @@ function emitJSXElement(g, source, el, opts) {
|
|
|
401
437
|
}
|
|
402
438
|
if (op.selfClosing)
|
|
403
439
|
return;
|
|
404
|
-
emitJSXChildren(g, source, el.children ?? [], opts);
|
|
440
|
+
emitJSXChildren(g, source, el.children ?? [], opts, hoist);
|
|
405
441
|
if (el.closingElement) {
|
|
406
442
|
g.add(source.slice(el.closingElement.start, el.closingElement.end), el.closingElement.start, el.closingElement.end);
|
|
407
443
|
}
|
|
@@ -413,9 +449,9 @@ function emitJSXExprBody(g, source, expr, opts) {
|
|
|
413
449
|
return emitJSXFragment(g, source, expr, opts);
|
|
414
450
|
g.add(source.slice(expr.start, expr.end), expr.start, expr.end);
|
|
415
451
|
}
|
|
416
|
-
function emitJSXFragment(g, source, frag, opts) {
|
|
452
|
+
function emitJSXFragment(g, source, frag, opts, hoist) {
|
|
417
453
|
g.addRaw('<>');
|
|
418
|
-
emitJSXChildren(g, source, frag.children ?? [], opts);
|
|
454
|
+
emitJSXChildren(g, source, frag.children ?? [], opts, hoist);
|
|
419
455
|
g.addRaw('</>');
|
|
420
456
|
}
|
|
421
457
|
/**
|
|
@@ -478,7 +514,7 @@ function emitForClauseMap(g, source, child, text, map, clauseStart, bodyEmit, em
|
|
|
478
514
|
}
|
|
479
515
|
return true;
|
|
480
516
|
}
|
|
481
|
-
function emitJSXChildren(g, source, children, opts) {
|
|
517
|
+
function emitJSXChildren(g, source, children, opts, hoist) {
|
|
482
518
|
let i = 0;
|
|
483
519
|
let forPending = false;
|
|
484
520
|
while (i < children.length) {
|
|
@@ -541,7 +577,7 @@ function emitJSXChildren(g, source, children, opts) {
|
|
|
541
577
|
continue;
|
|
542
578
|
}
|
|
543
579
|
forPending = false;
|
|
544
|
-
g
|
|
580
|
+
emitJSXText(g, text, child.start, child.end);
|
|
545
581
|
i++;
|
|
546
582
|
}
|
|
547
583
|
else if (child.type === 'JSXExpressionContainer') {
|
|
@@ -562,11 +598,11 @@ function emitJSXChildren(g, source, children, opts) {
|
|
|
562
598
|
i++;
|
|
563
599
|
continue;
|
|
564
600
|
}
|
|
565
|
-
emitJSXElement(g, source, child, opts);
|
|
601
|
+
emitJSXElement(g, source, child, opts, hoist);
|
|
566
602
|
i++;
|
|
567
603
|
}
|
|
568
604
|
else if (child.type === 'JSXFragment') {
|
|
569
|
-
emitJSXFragment(g, source, child, opts);
|
|
605
|
+
emitJSXFragment(g, source, child, opts, hoist);
|
|
570
606
|
i++;
|
|
571
607
|
}
|
|
572
608
|
else if (child.type === 'IfStatement' || child.type === 'ForOfStatement' ||
|
|
@@ -576,6 +612,13 @@ function emitJSXChildren(g, source, children, opts) {
|
|
|
576
612
|
child.type === 'VariableDeclaration' || child.type === 'ExpressionStatement') {
|
|
577
613
|
// Statement-mode control flow nested among JSX children: TSX has no
|
|
578
614
|
// statement children, so wrap each in an IIFE expression container.
|
|
615
|
+
// Bare declarations/expression statements are instead hoisted to the
|
|
616
|
+
// component body scope (see emitBodyCore) so later interpolations can
|
|
617
|
+
// reference them, mirroring the runtime IR which scopes them there too.
|
|
618
|
+
if (hoist && hoist.set.has(child)) {
|
|
619
|
+
i++;
|
|
620
|
+
continue;
|
|
621
|
+
}
|
|
579
622
|
g.addRaw('{(() => { ');
|
|
580
623
|
emitBody(g, source, [child], '', opts);
|
|
581
624
|
g.addRaw(' })()}');
|
|
@@ -700,7 +743,7 @@ function emitPlainStatement(g, source, stmt, indent, isLast) {
|
|
|
700
743
|
if (!text.endsWith('}') && !isLast)
|
|
701
744
|
g.addRaw(';');
|
|
702
745
|
}
|
|
703
|
-
function emitStatement(g, source, stmt, indent, isLast, opts) {
|
|
746
|
+
function emitStatement(g, source, stmt, indent, isLast, opts, hoist) {
|
|
704
747
|
switch (stmt.type) {
|
|
705
748
|
case 'JSXElement':
|
|
706
749
|
if (getJSXTagName(stmt) === 'style') {
|
|
@@ -710,13 +753,13 @@ function emitStatement(g, source, stmt, indent, isLast, opts) {
|
|
|
710
753
|
return;
|
|
711
754
|
}
|
|
712
755
|
g.add(indent);
|
|
713
|
-
emitJSXElement(g, source, stmt, opts);
|
|
756
|
+
emitJSXElement(g, source, stmt, opts, hoist);
|
|
714
757
|
if (!isLast)
|
|
715
758
|
g.addRaw(';');
|
|
716
759
|
return;
|
|
717
760
|
case 'JSXFragment':
|
|
718
761
|
g.add(indent);
|
|
719
|
-
emitJSXFragment(g, source, stmt, opts);
|
|
762
|
+
emitJSXFragment(g, source, stmt, opts, hoist);
|
|
720
763
|
if (!isLast)
|
|
721
764
|
g.addRaw(';');
|
|
722
765
|
return;
|
|
@@ -738,7 +781,7 @@ function emitStatement(g, source, stmt, indent, isLast, opts) {
|
|
|
738
781
|
let firstLine = true;
|
|
739
782
|
for (let i = 0; i < innerStmts.length; i++) {
|
|
740
783
|
const before = g.code.length;
|
|
741
|
-
emitStatement(g, source, innerStmts[i], indent, isLast && i === innerStmts.length - 1, opts);
|
|
784
|
+
emitStatement(g, source, innerStmts[i], indent, isLast && i === innerStmts.length - 1, opts, hoist);
|
|
742
785
|
if (g.code.length > before) {
|
|
743
786
|
if (!firstLine)
|
|
744
787
|
g.addRaw('\n');
|
|
@@ -780,7 +823,7 @@ function emitStatement(g, source, stmt, indent, isLast, opts) {
|
|
|
780
823
|
return emitPlainStatement(g, source, stmt, indent, isLast);
|
|
781
824
|
}
|
|
782
825
|
}
|
|
783
|
-
function emitBody(g, source, stmts, indent, opts) {
|
|
826
|
+
function emitBody(g, source, stmts, indent, opts, hoist) {
|
|
784
827
|
let firstLine = true;
|
|
785
828
|
let i = 0;
|
|
786
829
|
while (i < stmts.length) {
|
|
@@ -809,7 +852,7 @@ function emitBody(g, source, stmts, indent, opts) {
|
|
|
809
852
|
continue;
|
|
810
853
|
}
|
|
811
854
|
const before = g.code.length;
|
|
812
|
-
emitStatement(g, source, stmt, indent, isLast, opts);
|
|
855
|
+
emitStatement(g, source, stmt, indent, isLast, opts, hoist);
|
|
813
856
|
if (g.code.length > before) {
|
|
814
857
|
if (!firstLine)
|
|
815
858
|
g.addRaw('\n');
|
|
@@ -865,6 +908,26 @@ function emitReturn(g, source, stmt, opts) {
|
|
|
865
908
|
emitChunkMapped(g, source, arg.start, arg.end);
|
|
866
909
|
emitChunkMapped(g, source, arg.end, stmt.end);
|
|
867
910
|
}
|
|
911
|
+
function collectHoistEligible(children, set, list) {
|
|
912
|
+
for (const child of children ?? []) {
|
|
913
|
+
if (child.type === 'JSXElement') {
|
|
914
|
+
if (getJSXTagName(child) === 'style')
|
|
915
|
+
continue;
|
|
916
|
+
collectHoistEligible(child.children ?? [], set, list);
|
|
917
|
+
continue;
|
|
918
|
+
}
|
|
919
|
+
if (child.type === 'JSXFragment') {
|
|
920
|
+
collectHoistEligible(child.children ?? [], set, list);
|
|
921
|
+
continue;
|
|
922
|
+
}
|
|
923
|
+
if (child.type === 'VariableDeclaration' || child.type === 'ExpressionStatement') {
|
|
924
|
+
set.add(child);
|
|
925
|
+
if (list)
|
|
926
|
+
list.push(child);
|
|
927
|
+
continue;
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
}
|
|
868
931
|
/**
|
|
869
932
|
* Emits a statement-mode component body (bare JSX, control flow,
|
|
870
933
|
* guard-clause returns). The body text starts directly with the first
|
|
@@ -872,7 +935,103 @@ function emitReturn(g, source, stmt, opts) {
|
|
|
872
935
|
* by the caller.
|
|
873
936
|
*/
|
|
874
937
|
function emitBodyCore(g, source, stmts, opts) {
|
|
875
|
-
|
|
938
|
+
const hoistSet = new Set();
|
|
939
|
+
const byRoot = new Map();
|
|
940
|
+
const collectRoot = (root) => {
|
|
941
|
+
const list = [];
|
|
942
|
+
collectHoistEligible(root.children ?? [], hoistSet, list);
|
|
943
|
+
if (list.length > 0)
|
|
944
|
+
byRoot.set(root, list);
|
|
945
|
+
};
|
|
946
|
+
const scanRoots = (list) => {
|
|
947
|
+
for (const s of list) {
|
|
948
|
+
if (!s)
|
|
949
|
+
continue;
|
|
950
|
+
if (s.type === 'JSXElement' && getJSXTagName(s) !== 'style') {
|
|
951
|
+
collectRoot(s);
|
|
952
|
+
}
|
|
953
|
+
else if (s.type === 'JSXFragment') {
|
|
954
|
+
collectRoot(s);
|
|
955
|
+
}
|
|
956
|
+
else if (s.type === 'VeskBlock') {
|
|
957
|
+
scanRoots(s.body ?? []);
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
};
|
|
961
|
+
scanRoots(stmts);
|
|
962
|
+
const ctx = { set: hoistSet };
|
|
963
|
+
const isRoot = (st) => (st.type === 'JSXElement' && getJSXTagName(st) !== 'style') || st.type === 'JSXFragment';
|
|
964
|
+
const units = [];
|
|
965
|
+
const pushStmts = (list) => {
|
|
966
|
+
for (let i = 0; i < list.length; i++) {
|
|
967
|
+
const s = list[i];
|
|
968
|
+
if (!s)
|
|
969
|
+
continue;
|
|
970
|
+
if (s.type === 'ForOfStatement' &&
|
|
971
|
+
list[i + 1] &&
|
|
972
|
+
list[i + 1].type === 'VeskBlock' &&
|
|
973
|
+
list[i + 1].tag === 'empty') {
|
|
974
|
+
units.push({ node: s, isHoisted: false, empty: list[i + 1] });
|
|
975
|
+
i++;
|
|
976
|
+
continue;
|
|
977
|
+
}
|
|
978
|
+
units.push({ node: s, isHoisted: isRoot(s) });
|
|
979
|
+
}
|
|
980
|
+
};
|
|
981
|
+
for (const s of stmts) {
|
|
982
|
+
if (!s)
|
|
983
|
+
continue;
|
|
984
|
+
if (s.type === 'VeskBlock') {
|
|
985
|
+
pushStmts(s.body ?? []);
|
|
986
|
+
continue;
|
|
987
|
+
}
|
|
988
|
+
pushStmts([s]);
|
|
989
|
+
}
|
|
990
|
+
const emitUnit = (u, isLast) => {
|
|
991
|
+
if (u.isHoisted) {
|
|
992
|
+
// Bare statements among this root element's JSX children must be visible
|
|
993
|
+
// to later interpolations, so emit them immediately before the root —
|
|
994
|
+
// after any body-level declarations they may depend on.
|
|
995
|
+
const list = byRoot.get(u.node);
|
|
996
|
+
if (list) {
|
|
997
|
+
byRoot.delete(u.node);
|
|
998
|
+
const n = list.length;
|
|
999
|
+
for (let k = 0; k < n; k++) {
|
|
1000
|
+
const before = g.code.length;
|
|
1001
|
+
emitStatement(g, source, list[k], '', false, opts, ctx);
|
|
1002
|
+
// Separator newline after every hoisted statement — the last one
|
|
1003
|
+
// separates it from its own root element.
|
|
1004
|
+
if (g.code.length > before)
|
|
1005
|
+
g.addRaw('\n');
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
if (u.empty !== undefined) {
|
|
1010
|
+
emitForOf(g, source, u.node, '', opts);
|
|
1011
|
+
const inner = u.empty.body ?? [];
|
|
1012
|
+
if (inner.length > 0) {
|
|
1013
|
+
g.addRaw('\n');
|
|
1014
|
+
g.add('');
|
|
1015
|
+
g.add(source.slice(u.node.right.start, u.node.right.end), u.node.right.start, u.node.right.end);
|
|
1016
|
+
g.addRaw('.length === 0 && (() => {');
|
|
1017
|
+
g.addRaw('\n');
|
|
1018
|
+
emitBody(g, source, inner, ' ', opts);
|
|
1019
|
+
g.addRaw('\n');
|
|
1020
|
+
g.add('');
|
|
1021
|
+
g.addRaw('})();');
|
|
1022
|
+
}
|
|
1023
|
+
return;
|
|
1024
|
+
}
|
|
1025
|
+
const before = g.code.length;
|
|
1026
|
+
emitStatement(g, source, u.node, '', isLast, opts, ctx);
|
|
1027
|
+
// Separator newline between body statements — every unit except the last
|
|
1028
|
+
// one. The single-statement body keeps `{ <jsx> }` untouched.
|
|
1029
|
+
if (g.code.length > before && !isLast)
|
|
1030
|
+
g.addRaw('\n');
|
|
1031
|
+
};
|
|
1032
|
+
for (let i = 0; i < units.length; i++) {
|
|
1033
|
+
emitUnit(units[i], i === units.length - 1);
|
|
1034
|
+
}
|
|
876
1035
|
}
|
|
877
1036
|
/** Emits an expression-mode component body (`return <jsx>` or a bare expression). */
|
|
878
1037
|
function emitExpressionBody(g, source, coreStart, coreEnd, stmts, opts) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vesk/compiler",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.34",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Vesk compiler — lexer, parser, semantic analysis, IR, codegen",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@sveltejs/acorn-typescript": "^1.0.0",
|
|
23
|
-
"@vesk/types": "^0.2.
|
|
23
|
+
"@vesk/types": "^0.2.34",
|
|
24
24
|
"acorn": "^8.15.0",
|
|
25
25
|
"esrap": "^2.3.0",
|
|
26
26
|
"is-reference": "^3.0.0",
|