@zeus-js/runtime-dom 0.1.0-beta.7 → 0.1.0-beta.9
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/runtime-dom.cjs.js +1810 -214
- package/dist/runtime-dom.cjs.prod.js +1746 -213
- package/dist/runtime-dom.d.ts +33 -5
- package/dist/runtime-dom.esm-browser.js +437 -198
- package/dist/runtime-dom.esm-browser.prod.js +1 -1
- package/dist/runtime-dom.esm-bundler.js +1785 -195
- package/dist/runtime-dom.global.js +442 -197
- package/dist/runtime-dom.global.prod.js +1 -1
- package/package.json +2 -2
package/dist/runtime-dom.d.ts
CHANGED
|
@@ -137,6 +137,30 @@ export type ForProps<T, K = unknown> = {
|
|
|
137
137
|
export declare function For<T, K = unknown>(props: ForProps<T, K>): JSXValue;
|
|
138
138
|
export declare function mountFor<T, K = unknown>(parent: Node, marker: Node, each: () => readonly T[] | null | undefined, key: ((item: T, index: number) => K) | undefined, render: (item: T, index: number) => JSXValue): void;
|
|
139
139
|
|
|
140
|
+
export type CustomElementPropType = 'string' | 'number' | 'boolean' | 'object' | 'array' | 'function' | 'unknown';
|
|
141
|
+
export interface CustomElementPropSchema {
|
|
142
|
+
name: string;
|
|
143
|
+
attrName?: string | false;
|
|
144
|
+
type: CustomElementPropType;
|
|
145
|
+
reflect?: boolean;
|
|
146
|
+
serialize?: true | ((value: unknown) => string | null | undefined);
|
|
147
|
+
deserialize?: true | ((value: string | null) => unknown);
|
|
148
|
+
}
|
|
149
|
+
export interface CustomElementMount {
|
|
150
|
+
dispose(): void;
|
|
151
|
+
}
|
|
152
|
+
export interface CustomElementMountLifecycle<M extends CustomElementMount> {
|
|
153
|
+
connect(): M;
|
|
154
|
+
disconnect(): void;
|
|
155
|
+
current(): M | undefined;
|
|
156
|
+
}
|
|
157
|
+
export declare function getCustomElementAttributeName(prop: CustomElementPropSchema): string | undefined;
|
|
158
|
+
export declare function getCustomElementObservedAttributes(props: readonly CustomElementPropSchema[]): string[];
|
|
159
|
+
export declare function findCustomElementPropByAttribute(props: readonly CustomElementPropSchema[], attrName: string): CustomElementPropSchema | undefined;
|
|
160
|
+
export declare function coerceCustomElementAttribute(prop: CustomElementPropSchema, value: string | null): unknown;
|
|
161
|
+
export declare function reflectCustomElementProperty(element: HTMLElement, prop: CustomElementPropSchema, value: unknown, reflectingAttrs?: Set<string>): void;
|
|
162
|
+
export declare function createCustomElementMountLifecycle<M extends CustomElementMount>(mount: () => M): CustomElementMountLifecycle<M>;
|
|
163
|
+
|
|
140
164
|
export type ElementPropConstructor = StringConstructor | NumberConstructor | BooleanConstructor | ObjectConstructor | ArrayConstructor | FunctionConstructor;
|
|
141
165
|
export type PropSerializer<T = unknown> = {
|
|
142
166
|
bivarianceHack(value: T | undefined): string | null | undefined;
|
|
@@ -249,10 +273,8 @@ export interface DefineElementContext<E extends HTMLElement = HTMLElement, Emits
|
|
|
249
273
|
expose(methods: Record<string, Function>): void;
|
|
250
274
|
}
|
|
251
275
|
export type DefineElementSetup<P extends object, E extends HTMLElement = HTMLElement, Emits extends EmitsOptions = EmitsOptions> = (props: Readonly<P>, context: DefineElementContext<E, Emits>) => JSXValue;
|
|
252
|
-
export type NormalizedPropDefinition = {
|
|
253
|
-
|
|
254
|
-
attr: string | false;
|
|
255
|
-
type?: ElementPropConstructor;
|
|
276
|
+
export type NormalizedPropDefinition = CustomElementPropSchema & {
|
|
277
|
+
attrName: string | false;
|
|
256
278
|
reflect: boolean;
|
|
257
279
|
default?: unknown;
|
|
258
280
|
serialize?: (value: unknown) => string | null | undefined;
|
|
@@ -333,12 +355,18 @@ export declare function Host(props: HostProps): JSXValue;
|
|
|
333
355
|
export declare function Slot(props: SlotProps): JSXValue;
|
|
334
356
|
|
|
335
357
|
export declare function createSlot(name?: string, fallback?: () => JSXValue): JSXValue;
|
|
358
|
+
interface LightDomProjection {
|
|
359
|
+
createSlot(name?: string, fallback?: () => JSXValue): DocumentFragment;
|
|
360
|
+
connect(): void;
|
|
361
|
+
disconnect(): void;
|
|
362
|
+
}
|
|
336
363
|
|
|
337
364
|
export type HostRenderMode = 'light' | 'shadow';
|
|
338
365
|
export interface HostRenderContext {
|
|
339
366
|
host: HTMLElement;
|
|
340
367
|
mode: HostRenderMode;
|
|
341
|
-
lightChildren:
|
|
368
|
+
lightChildren: Node[];
|
|
369
|
+
projection?: LightDomProjection;
|
|
342
370
|
}
|
|
343
371
|
export declare function getCurrentHostContext(): HostRenderContext | undefined;
|
|
344
372
|
export declare function withHostContext<T>(context: HostRenderContext | undefined, fn: () => T): T;
|