@lvce-editor/virtual-dom 1.43.0 → 2.0.0

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/index.d.ts CHANGED
@@ -1,35 +1,66 @@
1
- export const render: (elements: any[], eventMap?: any) => HTMLElement
1
+ // Generated by dts-bundle-generator v9.5.1
2
2
 
3
- export const renderInto: (
4
- $Parent: HTMLElement,
5
- elements: any[],
6
- eventMap?: any,
7
- ) => void
3
+ export interface VirtualDomNode {
4
+ readonly type: number;
5
+ readonly [key: string]: any;
6
+ }
7
+ export interface AddPatch {
8
+ readonly type: 6;
9
+ readonly nodes: readonly VirtualDomNode[];
10
+ }
11
+ export interface AttributePatch {
12
+ readonly type: 3;
13
+ readonly key: string;
14
+ readonly value: any;
15
+ }
16
+ export type NavigateChildPatch = {
17
+ readonly type: 7;
18
+ readonly index: number;
19
+ };
20
+ export type NavigateParentPatch = {
21
+ readonly type: 8;
22
+ };
23
+ export type NavigateSiblingPatch = {
24
+ readonly type: 10;
25
+ readonly index: number;
26
+ };
27
+ export interface RemoveAttributePatch {
28
+ readonly type: 4;
29
+ readonly key: string;
30
+ }
31
+ export interface RemoveChildPatch {
32
+ readonly type: 9;
33
+ readonly index: number;
34
+ }
35
+ export interface RemovePatch {
36
+ readonly type: 5;
37
+ readonly index: number;
38
+ }
39
+ export interface ReplacePatch {
40
+ readonly type: 2;
41
+ readonly index: number;
42
+ readonly node: VirtualDomNode;
43
+ }
44
+ export interface TextPatch {
45
+ readonly type: 1;
46
+ readonly value: string;
47
+ }
48
+ export type Patch = TextPatch | AttributePatch | ReplacePatch | RemoveAttributePatch | RemovePatch | AddPatch | NavigateChildPatch | NavigateParentPatch | RemoveChildPatch | NavigateSiblingPatch;
49
+ export declare const applyPatch: ($Element: Node, patches: readonly Patch[]) => void;
50
+ export declare const setComponentUid: ($Element: any, uid: any) => void;
51
+ export declare const getComponentUid: ($Element: any) => number;
52
+ export declare const getComponentUidFromEvent: (event: any) => number;
53
+ export declare const getFileHandles: (ids: readonly number[]) => Promise<readonly FileSystemHandle[]>;
54
+ export declare const addFileHandle: (fileHandle: FileSystemHandle) => number;
55
+ export declare const setIpc: (value: any) => void;
56
+ export declare const registerEventListeners: (id: any, eventListeners: any) => void;
57
+ export declare const rememberFocus: ($Viewlet: HTMLElement, dom: any[], eventMap: any, uid?: number) => any;
58
+ export declare const renderInto: ($Parent: any, dom: any, eventMap?: {}) => void;
59
+ /**
60
+ *
61
+ * @param {any[]} elements
62
+ * @returns
63
+ */
64
+ export declare const render: (elements: any, eventMap?: {}, newEventMap?: {}) => HTMLElement;
8
65
 
9
- export const setIpc: (ipc: any) => void
10
-
11
- export const setComponentUid: ($Element: HTMLElement, uid: number) => void
12
-
13
- export const getComponentUid: ($Element: HTMLElement) => number
14
-
15
- export const getComponentUidFromEvent: (event: Event) => number
16
-
17
- export const rememberFocus: (
18
- $Viewlet: HTMLElement,
19
- dom: any[],
20
- eventMap: any,
21
- uid: number,
22
- ) => void
23
-
24
- export const registerEventListeners: any
25
-
26
- export const applyPatch: (
27
- $Element: HTMLElement,
28
- patches: readonly any[],
29
- ) => void
30
-
31
- export const getFileHandles: (
32
- ids: readonly number[],
33
- ) => Promise<readonly FileSystemHandle[]>
34
-
35
- export const addFileHandle: (fileHandle: FileSystemHandle) => number
66
+ export {};
package/dist/index.js CHANGED
@@ -50,6 +50,7 @@ const TextArea$1 = 'textarea';
50
50
  const Select$1 = 'select';
51
51
  const Option$1 = 'option';
52
52
  const Code$1 = 'code';
53
+ const Label$1 = 'label';
53
54
 
54
55
  const Audio = 0;
55
56
  const Button = 1;
@@ -104,6 +105,7 @@ const TextArea = 62;
104
105
  const Select = 63;
105
106
  const Option = 64;
106
107
  const Code = 65;
108
+ const Label = 66;
107
109
 
108
110
  const getElementTag = type => {
109
111
  switch (type) {
@@ -211,6 +213,8 @@ const getElementTag = type => {
211
213
  return Option$1;
212
214
  case Code:
213
215
  return Code$1;
216
+ case Label:
217
+ return Label$1;
214
218
  default:
215
219
  throw new Error(`element tag not found ${type}`);
216
220
  }
@@ -631,6 +635,8 @@ const getEventListenerArg = (param, event) => {
631
635
  return event.defaultPrevented;
632
636
  case 'event.target.dataset.name':
633
637
  return event.target.dataset.name;
638
+ case 'event.target.dataset.index':
639
+ return event.target.dataset.index;
634
640
  default:
635
641
  return param;
636
642
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/virtual-dom",
3
- "version": "1.43.0",
3
+ "version": "2.0.0",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "keywords": [],
@@ -107,6 +107,8 @@ export const getElementTag = (type: number): string => {
107
107
  return ElementTag.Option
108
108
  case VirtualDomElements.Code:
109
109
  return ElementTag.Code
110
+ case VirtualDomElements.Label:
111
+ return ElementTag.Label
110
112
  default:
111
113
  throw new Error(`element tag not found ${type}`)
112
114
  }
@@ -51,3 +51,4 @@ export const TextArea = 'textarea'
51
51
  export const Select = 'select'
52
52
  export const Option = 'option'
53
53
  export const Code = 'code'
54
+ export const Label = 'label'
@@ -59,6 +59,8 @@ export const getEventListenerArg = (param: string, event: any): any => {
59
59
  return event.defaultPrevented
60
60
  case 'event.target.dataset.name':
61
61
  return event.target.dataset.name
62
+ case 'event.target.dataset.index':
63
+ return event.target.dataset.index
62
64
  default:
63
65
  return param
64
66
  }
@@ -53,3 +53,4 @@ export const TextArea = 62
53
53
  export const Select = 63
54
54
  export const Option = 64
55
55
  export const Code = 65
56
+ export const Label = 66