@jasonshimmy/custom-elements-runtime 0.0.10 → 0.0.11

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.
@@ -1,43 +0,0 @@
1
- import type { CompiledTemplate } from './template-compiler.js';
2
- /**
3
- * TemplateResult type for template helpers
4
- */
5
- export type TemplateResult = string | CompiledTemplate | ((state?: any) => string);
6
- /**
7
- * Tagged template literal for HTML strings.
8
- * Returns a pure function for rendering with state and api.
9
- * @param strings - Template strings
10
- * @param values - Dynamic values (functions or primitives)
11
- */
12
- export declare function html(strings: TemplateStringsArray, ...values: unknown[]): (state?: any, api?: any) => string | Promise<string>;
13
- /**
14
- * CompiledTemplateFn type for compiled templates
15
- */
16
- export interface CompiledTemplateFn {
17
- (state: any, api?: any): string;
18
- id: string;
19
- }
20
- /**
21
- * compile helper: returns a compiled template function with a unique id property.
22
- * Accepts tagged template literals and dynamic values (functions or primitives).
23
- * @param strings - Template strings
24
- * @param values - Dynamic values
25
- */
26
- export declare function compile(strings: TemplateStringsArray, ...values: any[]): CompiledTemplateFn;
27
- /**
28
- * Tagged template literal for CSS strings.
29
- * Returns a pure string for use in style blocks.
30
- * @param strings - Template strings
31
- * @param values - Dynamic values
32
- */
33
- export declare function css(strings: TemplateStringsArray, ...values: unknown[]): string;
34
- /**
35
- * Helper for conditional classes. Returns a space-separated string of class names.
36
- * @param obj - Object with class names as keys and boolean conditions as values
37
- */
38
- export declare function classes(obj: Record<string, boolean>): string;
39
- /**
40
- * Helper for inline styles. Returns a CSS string for use in style attributes.
41
- * @param obj - Object with style properties and values
42
- */
43
- export declare function styles(obj: Record<string, string | number>): string;
package/dist/v-dom.d.ts DELETED
@@ -1,54 +0,0 @@
1
- /**
2
- * Utility: Generate a stable key for a VNode
3
- */
4
- export declare function getVNodeKey(type: string, parentPath: string, childIndex: number, model?: string, value?: string): string;
5
- /**
6
- * Virtual Node (VNode) structure for incremental migration
7
- */
8
- export interface VNode {
9
- type: string;
10
- key?: string;
11
- props: Record<string, any>;
12
- children: VNode[];
13
- dom?: Element | Text;
14
- }
15
- /**
16
- * Safely replaces a child node, guarding against NotFoundError and out-of-sync trees.
17
- * Falls back to appendChild if oldChild is not present.
18
- * Logs mutation for debugging if enabled.
19
- * @param parent - Parent node
20
- * @param newChild - New node to insert
21
- * @param oldChild - Old node to replace
22
- */
23
- export declare function safeReplaceChild(parent: Node | null, newChild: Node, oldChild: Node): void;
24
- /**
25
- * Mounts a VNode to the DOM and returns the created node.
26
- * Handles text, fragment, and element nodes.
27
- * @param vnode - Virtual node to mount
28
- * @returns DOM node or null
29
- */
30
- export declare function mountVNode(vnode: VNode): Element | Text | null;
31
- /**
32
- * Parses an HTML string into a VNode tree.
33
- * Supports basic tags, attributes, text, and key/data-model.
34
- * @param html - HTML string
35
- * @returns VNode tree
36
- */
37
- export declare function parseVNodeFromHTML(html: string): VNode;
38
- /**
39
- * Creates a VNode from a DOM ChildNode (Element or Text).
40
- * Assigns a stable, deterministic key for VDOM reconciliation.
41
- * @param node - DOM node
42
- * @param parentPath - Path for key generation
43
- * @param childIndex - Index for key generation
44
- * @returns VNode
45
- */
46
- export declare function createVNodeFromElement(node: ChildNode, parentPath?: string, childIndex?: number): VNode;
47
- /**
48
- * Patches two VNodes and updates the DOM, preserving controlled inputs.
49
- * Handles keyed and index-based reconciliation.
50
- * @param parent - Parent DOM element
51
- * @param oldVNode - Previous VNode
52
- * @param newVNode - New VNode
53
- */
54
- export declare function patchVNode(parent: Element, oldVNode: VNode, newVNode: VNode): void;