@dooboostore/simple-web-component 1.0.38 → 1.0.39
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 +31 -833
- package/dist/cjs/decorators/applyNode.js +26 -39
- package/dist/cjs/decorators/applyNode.js.map +2 -2
- package/dist/cjs/decorators/applySlot.js +69 -64
- package/dist/cjs/decorators/applySlot.js.map +3 -3
- package/dist/cjs/decorators/elementDefine.js +0 -7
- package/dist/cjs/decorators/elementDefine.js.map +2 -2
- package/dist/cjs/decorators/state.js +0 -1
- package/dist/cjs/decorators/state.js.map +2 -2
- package/dist/esm/decorators/applyNode.js +26 -39
- package/dist/esm/decorators/applyNode.js.map +2 -2
- package/dist/esm/decorators/applySlot.js +69 -64
- package/dist/esm/decorators/applySlot.js.map +3 -3
- package/dist/esm/decorators/elementDefine.js +0 -7
- package/dist/esm/decorators/elementDefine.js.map +2 -2
- package/dist/esm/decorators/state.js +0 -1
- package/dist/esm/decorators/state.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +124 -139
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
- package/dist/types/decorators/applyNode.d.ts +2 -2
- package/dist/types/decorators/applyNode.d.ts.map +1 -1
- package/dist/types/decorators/applySlot.d.ts +14 -12
- package/dist/types/decorators/applySlot.d.ts.map +1 -1
- package/dist/types/decorators/state.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +124 -139
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +3 -3
- package/src/decorators/applyNode.ts +43 -51
- package/src/decorators/applySlot.ts +97 -86
- package/src/decorators/elementDefine.ts +6 -6
- package/src/decorators/state.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dooboostore/simple-web-component",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -92,10 +92,10 @@
|
|
|
92
92
|
"webpack": "^5.93.0",
|
|
93
93
|
"webpack-cli": "^5.1.4",
|
|
94
94
|
"webpack-dev-server": "^5.2.0",
|
|
95
|
-
"@dooboostore/core": "1.0.32",
|
|
96
95
|
"@dooboostore/core-node": "1.0.12",
|
|
97
96
|
"@dooboostore/core-web": "1.0.12",
|
|
98
|
-
"@dooboostore/simple-boot": "1.0.56"
|
|
97
|
+
"@dooboostore/simple-boot": "1.0.56",
|
|
98
|
+
"@dooboostore/core": "1.0.32"
|
|
99
99
|
},
|
|
100
100
|
"scripts": {
|
|
101
101
|
"clean": "rm -rf dist",
|
|
@@ -37,69 +37,60 @@ export interface ApplyNodeMetadata {
|
|
|
37
37
|
|
|
38
38
|
export const APPLY_NODE_METADATA_KEY = Symbol.for('simple-web-component:apply-node');
|
|
39
39
|
|
|
40
|
-
const normalizeNodes = (res: any, doc: Document): Node[] => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const applyToDom = (currentThis: any, targetEl: HTMLElement, res:
|
|
40
|
+
// const normalizeNodes = (res: any, doc: Document): Node[] => {
|
|
41
|
+
// const items = Array.isArray(res) ? res : [res];
|
|
42
|
+
// return items.map(it => {
|
|
43
|
+
// if (it instanceof Node) return it;
|
|
44
|
+
// return doc.createTextNode(it !== undefined && it !== null ? String(it) : '');
|
|
45
|
+
// });
|
|
46
|
+
// };
|
|
47
|
+
|
|
48
|
+
const applyToDom = (currentThis: any, targetEl: HTMLElement, res: Node | string, pos: ApplyNodePosition, win: Window, host?: any) => {
|
|
49
49
|
if (!targetEl) return;
|
|
50
|
-
|
|
51
|
-
// console.log('------------',currentThis.tagName, res)
|
|
52
50
|
const doc = win.document;
|
|
53
51
|
const hostSet = SwcUtils.getHelperAndHostSet(win, currentThis);
|
|
54
52
|
const id = currentThis._swcId;
|
|
55
|
-
// Allow processHtml to run here so all DOM insertions go through a single
|
|
56
|
-
// processing point. processHtml may mutate Node[] in-place or return a
|
|
57
|
-
// transformed string result for text processing.
|
|
58
|
-
try {
|
|
59
|
-
if (typeof res === 'string') {
|
|
60
|
-
const processed = SwcUtils.projectProcessHtml(id, res as string, doc);
|
|
61
|
-
if (processed !== undefined) res = processed;
|
|
62
|
-
} else if (res) {
|
|
63
|
-
SwcUtils.projectProcessHtml(id, res, doc);
|
|
64
|
-
}
|
|
65
|
-
} catch (e) {
|
|
66
|
-
// swallow and proceed with original res
|
|
67
|
-
}
|
|
68
53
|
|
|
69
|
-
if (pos === 'innerHtml') {
|
|
70
|
-
targetEl.innerHTML = res !== undefined && res !== null ? String(res) : '';
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
54
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
55
|
+
const nodes: Node[] = [];
|
|
56
|
+
|
|
57
|
+
if (typeof res === 'string' && pos === 'innerHtml') {
|
|
58
|
+
const t = win.document.createElement('template');
|
|
59
|
+
t.innerHTML = res;
|
|
60
|
+
nodes.push(...Array.from(t.content.childNodes));
|
|
61
|
+
} else if (typeof res === 'string' && pos === 'innerText') {
|
|
62
|
+
nodes.push(win.document.createTextNode(res));
|
|
79
63
|
}
|
|
80
64
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
stateContext[it.name] = currentThis[it.propertyKey]
|
|
84
|
-
})
|
|
85
|
-
new ElementApply(currentThis, {id: currentThis._swcId}).apply({target: 'noInitialized', context: stateContext, bind: currentThis});
|
|
65
|
+
SwcUtils.projectProcessHtml(id, nodes, doc);
|
|
66
|
+
|
|
86
67
|
|
|
87
68
|
|
|
88
69
|
const isShadowRoot = targetEl instanceof win.ShadowRoot;
|
|
89
|
-
const nodes = normalizeNodes(res, doc);
|
|
70
|
+
// const nodes = normalizeNodes(res, doc);
|
|
90
71
|
if (pos === 'replace') {
|
|
91
72
|
if (!isShadowRoot) targetEl.replaceWith(...nodes);
|
|
73
|
+
} else if (pos === 'innerHtml') {
|
|
74
|
+
targetEl.replaceChildren(...nodes);
|
|
75
|
+
} else if (pos === 'innerText') {
|
|
76
|
+
targetEl.replaceChildren(...nodes);
|
|
92
77
|
} else if (pos === 'replaceChildren') {
|
|
93
78
|
targetEl.replaceChildren(...nodes);
|
|
94
79
|
} else {
|
|
95
80
|
if (pos === 'beforeEnd') {
|
|
96
|
-
console.log('tarbbbbbbbbbbbbbb')
|
|
97
81
|
targetEl.append(...nodes)
|
|
98
82
|
}
|
|
99
83
|
else if (pos === 'afterBegin') targetEl.prepend(...nodes);
|
|
100
84
|
else if (pos === 'beforeBegin' && !isShadowRoot) targetEl.before(...nodes);
|
|
101
85
|
else if (pos === 'afterEnd' && !isShadowRoot) targetEl.after(...nodes);
|
|
102
86
|
}
|
|
87
|
+
|
|
88
|
+
const stateContext: any = {...hostSet};
|
|
89
|
+
findAllStateMetadata(currentThis).forEach(it => {
|
|
90
|
+
stateContext[it.name] = currentThis[it.propertyKey]
|
|
91
|
+
})
|
|
92
|
+
new ElementApply(targetEl, {id: id}).apply({target: 'noInitialized', context: stateContext, bind: currentThis});
|
|
93
|
+
return nodes;
|
|
103
94
|
};
|
|
104
95
|
|
|
105
96
|
/**
|
|
@@ -164,16 +155,17 @@ export function applyNode(selector: string, options: ApplyNodeOptions = {positio
|
|
|
164
155
|
}
|
|
165
156
|
};
|
|
166
157
|
|
|
167
|
-
if (res instanceof Promise) {
|
|
168
|
-
// 비동기일 때만 로딩 표시
|
|
169
|
-
if (targetEl && options.fallback) {
|
|
170
|
-
const loadingRes = options.fallback.call(this, hostSet);
|
|
171
|
-
// applyToDom expects a Window as the 4th argument
|
|
172
|
-
applyToDom(this, targetEl, loadingRes, options.position || 'beforeEnd', currentWin);
|
|
173
|
-
}
|
|
174
158
|
|
|
159
|
+
const fallbackNodes: Node[] = [];
|
|
160
|
+
if (targetEl && options.fallback) {
|
|
161
|
+
const loadingRes = options.fallback.call(this, hostSet);
|
|
162
|
+
// applyToDom expects a Window as the 4th argument
|
|
163
|
+
fallbackNodes.push(...applyToDom(this, targetEl, loadingRes, options.position || 'beforeEnd', currentWin));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (res instanceof Promise) {
|
|
175
167
|
return res.then(finalRes => {
|
|
176
|
-
|
|
168
|
+
fallbackNodes.forEach((it: any)=>it.remove());
|
|
177
169
|
if (finalRes !== undefined && targetEl) runApply(targetEl, finalRes);
|
|
178
170
|
return finalRes;
|
|
179
171
|
});
|
|
@@ -267,9 +259,9 @@ export function applyNodeThisAfterBeginLightDom(targetOrOptions?: any, propertyK
|
|
|
267
259
|
return applyNode('$this', {...opt, ...option});
|
|
268
260
|
}
|
|
269
261
|
|
|
270
|
-
export function
|
|
271
|
-
export function
|
|
272
|
-
export function
|
|
262
|
+
export function applyNodeThisInnerHtml(options: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
263
|
+
export function applyNodeThisInnerHtml(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
|
|
264
|
+
export function applyNodeThisInnerHtml(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {
|
|
273
265
|
const option: ApplyNodeOptions = {position: 'innerHtml'}
|
|
274
266
|
if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);
|
|
275
267
|
const opt = targetOrOptions || {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {ReflectUtils} from '@dooboostore/core';
|
|
1
|
+
import {OptionalType, ReflectUtils} from '@dooboostore/core';
|
|
2
2
|
import {ensureInit, getElementConfig} from './elementDefine';
|
|
3
3
|
import {SwcUtils} from "../utils/Utils";
|
|
4
4
|
import {NodeSlot} from "@dooboostore/core-web";
|
|
5
|
+
import {HelperHostSet} from "../types";
|
|
5
6
|
/*
|
|
6
7
|
<!-- beforebegin -->
|
|
7
8
|
<p> <-- it's me
|
|
@@ -11,10 +12,11 @@ import {NodeSlot} from "@dooboostore/core-web";
|
|
|
11
12
|
</p>
|
|
12
13
|
<!-- afterend -->
|
|
13
14
|
*/
|
|
14
|
-
export type ApplySlotPosition = 'prependHtml' | 'prependText' | 'appendHtml' | 'appendText' | 'replaceChildrenHtml' | 'replaceChildrenText' | 'clear';
|
|
15
|
+
export type ApplySlotPosition = 'prepend' | 'prependHtml' | 'prependText' | 'append' | 'appendHtml' | 'appendText' | 'replaceChildren' | 'replaceChildrenHtml' | 'replaceChildrenText' | 'clear';
|
|
15
16
|
|
|
16
17
|
export interface ApplySlotOptions {
|
|
17
|
-
position
|
|
18
|
+
position: ApplySlotPosition;
|
|
19
|
+
fallback?: (helper: HelperHostSet) => string | Node;
|
|
18
20
|
// root?: SwcRootType;
|
|
19
21
|
/**
|
|
20
22
|
* Filter function to determine whether to perform DOM operation.
|
|
@@ -29,8 +31,8 @@ export interface ApplySlotOptions {
|
|
|
29
31
|
|
|
30
32
|
export interface ApplySlotMetadata {
|
|
31
33
|
propertyKey: string | symbol;
|
|
32
|
-
|
|
33
|
-
type: 'method' | 'property';
|
|
34
|
+
targetId: string;
|
|
35
|
+
// type: 'method' | 'property';
|
|
34
36
|
options: ApplySlotOptions;
|
|
35
37
|
}
|
|
36
38
|
|
|
@@ -75,33 +77,27 @@ export const APPLY_SLOT_METADATA_KEY = Symbol.for('simple-web-component:apply-sl
|
|
|
75
77
|
// }
|
|
76
78
|
// };
|
|
77
79
|
|
|
80
|
+
const applyToDom = (swcId: string, id: string, pos: ApplySlotPosition, nodes: Node[]) => {
|
|
81
|
+
const nodeSlot = new NodeSlot(this, swcId);
|
|
82
|
+
if (pos === 'replaceChildrenText' || pos === 'replaceChildren' || pos === 'replaceChildrenHtml') {
|
|
83
|
+
nodeSlot.replaceChildren(id, ...nodes);
|
|
84
|
+
} else if (pos === 'appendHtml' || pos === 'append' || pos === 'appendText') {
|
|
85
|
+
nodeSlot.append(id, ...nodes);
|
|
86
|
+
} else if (pos === 'prependHtml' || pos === 'prepend' || pos === 'prependText') {
|
|
87
|
+
nodeSlot.prepend(id, ...nodes);
|
|
88
|
+
} else if (pos === 'clear') {
|
|
89
|
+
nodeSlot.clear(id);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
78
92
|
/**
|
|
79
93
|
* @applyNode decorator to surgically add/replace nodes to a target element.
|
|
80
94
|
*/
|
|
81
|
-
export function applySlot(
|
|
82
|
-
return (targetObj: Object, propertyKey: string | symbol, descriptor
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
get(this: any) {
|
|
88
|
-
const nodeSlot = new NodeSlot(this, `${this._swcId}-${id}`);
|
|
89
|
-
return nodeSlot;
|
|
90
|
-
},
|
|
91
|
-
set(this: any, nv: any) {
|
|
92
|
-
if(nv) {
|
|
93
|
-
// 있을때 아무일도안함
|
|
94
|
-
} else {
|
|
95
|
-
const nodeSlot = new NodeSlot(this, `${this._swcId}-${id}`);
|
|
96
|
-
nodeSlot.clear();
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
configurable: true,
|
|
100
|
-
enumerable: true,
|
|
101
|
-
})
|
|
102
|
-
// return nodeSlot;
|
|
103
|
-
// return;
|
|
104
|
-
}
|
|
95
|
+
export function applySlot(targetId: string, opt: OptionalType<ApplySlotOptions, 'position'>): MethodDecorator {
|
|
96
|
+
return (targetObj: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<any>) => {
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
const options: ApplySlotOptions = {position: 'replaceChildrenHtml', ...opt};
|
|
100
|
+
|
|
105
101
|
|
|
106
102
|
const constructor = targetObj.constructor;
|
|
107
103
|
let metaList = ReflectUtils.getOwnMetadata(APPLY_SLOT_METADATA_KEY, constructor) as ApplySlotMetadata[];
|
|
@@ -109,50 +105,56 @@ export function applySlot(id: string, options: ApplySlotOptions = { position: 'r
|
|
|
109
105
|
metaList = []
|
|
110
106
|
ReflectUtils.defineMetadata(APPLY_SLOT_METADATA_KEY, metaList, constructor);
|
|
111
107
|
}
|
|
112
|
-
metaList.push({
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
} else if (pos === 'appendText') {
|
|
138
|
-
nodeSlot.appendText(id, res);
|
|
139
|
-
} else if (pos === 'prependHtml') {
|
|
140
|
-
nodeSlot.prependHtml(id, res);
|
|
141
|
-
} else if (pos === 'prependText') {
|
|
142
|
-
nodeSlot.prependText(id, res);
|
|
143
|
-
} else if (pos === 'clear') {
|
|
144
|
-
nodeSlot.clear(id);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// const stateContext: any = {...hostSet};
|
|
148
|
-
// getStateMetadata(this).forEach(it => {
|
|
149
|
-
// stateContext[it.name] = this[it.propertyKey]
|
|
150
|
-
// })
|
|
151
|
-
// new ElementApply(this, {id: this._swcId}).apply({target:'noInitialized', context: stateContext, bind: this});
|
|
108
|
+
metaList.push({propertyKey, targetId, options});
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
const original = descriptor.value;
|
|
112
|
+
descriptor.value = function (...args: any[]) {
|
|
113
|
+
ensureInit(this);
|
|
114
|
+
|
|
115
|
+
const conf = getElementConfig(this);
|
|
116
|
+
const currentWin = conf.window;
|
|
117
|
+
const swcId = this._swcId;
|
|
118
|
+
const currentDoc = currentWin.document;
|
|
119
|
+
const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);
|
|
120
|
+
const pos = options.position;
|
|
121
|
+
|
|
122
|
+
const resToNodes = (res: string | Node) => {
|
|
123
|
+
const nodes: Node[] = [];
|
|
124
|
+
|
|
125
|
+
if (typeof res === 'string' && (pos === 'replaceChildrenHtml' || pos === 'appendHtml' || pos === 'prependHtml')) {
|
|
126
|
+
const t = currentWin.document.createElement('template');
|
|
127
|
+
t.innerHTML = res;
|
|
128
|
+
nodes.push(...Array.from(t.content.childNodes));
|
|
129
|
+
} else if (typeof res === 'string' && (pos === 'replaceChildrenText' || pos === 'prependText' || pos === 'appendText')) {
|
|
130
|
+
nodes.push(currentWin.document.createTextNode(res));
|
|
131
|
+
} else if (typeof res === 'object') {
|
|
132
|
+
nodes.push(res);
|
|
152
133
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
134
|
+
SwcUtils.projectProcessHtml(swcId, nodes, currentDoc);
|
|
135
|
+
return nodes;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const fallbackNodes: Node[] = [];
|
|
139
|
+
if (options.fallback) {
|
|
140
|
+
const res: string | Node = options.fallback.call(this, hostSet);
|
|
141
|
+
const nodes: Node[] = resToNodes(res);
|
|
142
|
+
fallbackNodes.push(...nodes);
|
|
143
|
+
applyToDom(swcId, targetId, options.position, nodes);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
let res = original.apply(this, args);
|
|
147
|
+
if (res instanceof Promise) {
|
|
148
|
+
return res.then(asyncRes => {
|
|
149
|
+
const nodes = resToNodes(asyncRes)
|
|
150
|
+
fallbackNodes.forEach((it: any)=>it.remove());
|
|
151
|
+
applyToDom(swcId, targetId, options.position, nodes);
|
|
152
|
+
})
|
|
153
|
+
} else {
|
|
154
|
+
const nodes: Node[] = resToNodes(res);
|
|
155
|
+
applyToDom(swcId, targetId, options.position, nodes);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
156
158
|
};
|
|
157
159
|
}
|
|
158
160
|
|
|
@@ -162,27 +164,36 @@ export const findAllApplySlotMetadata = (target: any): ApplySlotMetadata[] => {
|
|
|
162
164
|
return ReflectUtils.getMetadata(APPLY_SLOT_METADATA_KEY, constructor);
|
|
163
165
|
};
|
|
164
166
|
|
|
165
|
-
export function applySlotClear(
|
|
166
|
-
return applySlot(
|
|
167
|
+
export function applySlotClear(targetId: string): MethodDecorator {
|
|
168
|
+
return applySlot(targetId, {position: 'clear'});
|
|
167
169
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
+
|
|
171
|
+
export function applySlotPrependHtml(targetId: string): MethodDecorator {
|
|
172
|
+
return applySlot(targetId, {position: 'prependHtml'});
|
|
170
173
|
}
|
|
174
|
+
|
|
171
175
|
export const applySlotPrepend = applySlotPrependHtml;
|
|
172
|
-
|
|
173
|
-
|
|
176
|
+
|
|
177
|
+
export function applySlotPrependText(targetId: string): MethodDecorator {
|
|
178
|
+
return applySlot(targetId, {position: 'prependText'});
|
|
174
179
|
}
|
|
175
|
-
|
|
176
|
-
|
|
180
|
+
|
|
181
|
+
export function applySlotAppendHtml(targetId: string): MethodDecorator {
|
|
182
|
+
return applySlot(targetId, {position: 'appendHtml'});
|
|
177
183
|
}
|
|
178
|
-
|
|
179
|
-
|
|
184
|
+
|
|
185
|
+
export function applySlotAppendText(targetId: string): MethodDecorator {
|
|
186
|
+
return applySlot(targetId, {position: 'appendText'});
|
|
180
187
|
}
|
|
188
|
+
|
|
181
189
|
export const applySlotAppend = applySlotAppendHtml;
|
|
182
|
-
|
|
183
|
-
|
|
190
|
+
|
|
191
|
+
export function applySlotReplaceChildrenHtml(targetId: string): MethodDecorator {
|
|
192
|
+
return applySlot(targetId, {position: 'replaceChildrenHtml'});
|
|
184
193
|
}
|
|
194
|
+
|
|
185
195
|
export const applySlotReplaceChildren = applySlotReplaceChildrenHtml;
|
|
186
|
-
|
|
187
|
-
|
|
196
|
+
|
|
197
|
+
export function applySlotReplaceChildrenText(targetId: string): MethodDecorator {
|
|
198
|
+
return applySlot(targetId, {position: 'replaceChildrenText'});
|
|
188
199
|
}
|
|
@@ -95,12 +95,12 @@ export const ensureInit = (inst: any) => { // HTMLElement
|
|
|
95
95
|
delete (inst as any)[meta.propertyKey];
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
|
-
const slotAllList = findAllApplySlotMetadata(target);
|
|
99
|
-
if (slotAllList) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
98
|
+
// const slotAllList = findAllApplySlotMetadata(target);
|
|
99
|
+
// if (slotAllList) {
|
|
100
|
+
// slotAllList.filter(it => it.type === 'property').forEach(meta => {
|
|
101
|
+
// delete (inst as any)[meta.propertyKey];
|
|
102
|
+
// });
|
|
103
|
+
// }
|
|
104
104
|
const stateAllList = findAllStateMetadata(target);
|
|
105
105
|
if (stateAllList) {
|
|
106
106
|
stateAllList.forEach(meta => {
|
package/src/decorators/state.ts
CHANGED
|
@@ -28,7 +28,6 @@ export function state(nameOrTarget?: string | Object, propertyKey?: string | sym
|
|
|
28
28
|
// console.log('ssssssssssssssss', storage, stateMetadata.propertyKey)
|
|
29
29
|
Object.defineProperty(targetObj, stateMetadata.propertyKey, {
|
|
30
30
|
set(this: any, nv: string) {
|
|
31
|
-
console.log('setState!!', nv)
|
|
32
31
|
storage = nv;
|
|
33
32
|
const config = getElementConfig(this)
|
|
34
33
|
const ea = new ElementApply(this, {id: this._swcId});
|