@dooboostore/simple-web-component 1.0.34 → 1.0.36
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 +44 -51
- package/dist/cjs/decorators/addEventListener.js +12 -4
- package/dist/cjs/decorators/addEventListener.js.map +2 -2
- package/dist/cjs/decorators/applyAttribute.js +19 -18
- package/dist/cjs/decorators/applyAttribute.js.map +2 -2
- package/dist/cjs/decorators/applyClass.js +23 -22
- package/dist/cjs/decorators/applyClass.js.map +2 -2
- package/dist/cjs/decorators/applyNode.js +22 -17
- package/dist/cjs/decorators/applyNode.js.map +2 -2
- package/dist/cjs/decorators/applyStyle.js +20 -19
- package/dist/cjs/decorators/applyStyle.js.map +2 -2
- package/dist/cjs/decorators/attribute.js +17 -16
- package/dist/cjs/decorators/attribute.js.map +2 -2
- package/dist/cjs/decorators/{changedAttributeHost.js → changedAttributeThis.js} +6 -6
- package/dist/cjs/decorators/changedAttributeThis.js.map +7 -0
- package/dist/cjs/decorators/elementDefine.js +234 -188
- package/dist/cjs/decorators/elementDefine.js.map +2 -2
- package/dist/cjs/decorators/emitCustomEvent.js +24 -16
- package/dist/cjs/decorators/emitCustomEvent.js.map +2 -2
- package/dist/cjs/decorators/index.js +1 -1
- package/dist/cjs/decorators/index.js.map +1 -1
- package/dist/cjs/decorators/lifecycles.js +15 -17
- package/dist/cjs/decorators/lifecycles.js.map +2 -2
- package/dist/cjs/decorators/query.js +38 -60
- package/dist/cjs/decorators/query.js.map +2 -2
- package/dist/cjs/decorators/queryAll.js +31 -63
- package/dist/cjs/decorators/queryAll.js.map +2 -2
- package/dist/cjs/decorators/setProperty.js +13 -12
- package/dist/cjs/decorators/setProperty.js.map +2 -2
- package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js +2 -2
- package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
- package/dist/cjs/elements/SwcAppEngine.js +8 -2
- package/dist/cjs/elements/SwcAppEngine.js.map +2 -2
- package/dist/cjs/elements/SwcAppMixin.js +120 -65
- package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
- package/dist/cjs/elements/SwcAsync.js +31 -21
- package/dist/cjs/elements/SwcAsync.js.map +2 -2
- package/dist/cjs/elements/SwcChoose.js +53 -34
- package/dist/cjs/elements/SwcChoose.js.map +2 -2
- package/dist/cjs/elements/SwcIf.js +54 -32
- package/dist/cjs/elements/SwcIf.js.map +2 -2
- package/dist/cjs/elements/SwcLoop.js +111 -37
- package/dist/cjs/elements/SwcLoop.js.map +2 -2
- package/dist/cjs/elements/register.js +249 -122
- package/dist/cjs/elements/register.js.map +2 -2
- package/dist/cjs/router/ElementRouter.js +4 -2
- package/dist/cjs/router/ElementRouter.js.map +1 -1
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/utils/Utils.js +31 -17
- package/dist/cjs/utils/Utils.js.map +2 -2
- package/dist/esm/decorators/addEventListener.js +12 -4
- package/dist/esm/decorators/addEventListener.js.map +2 -2
- package/dist/esm/decorators/applyAttribute.js +19 -18
- package/dist/esm/decorators/applyAttribute.js.map +2 -2
- package/dist/esm/decorators/applyClass.js +23 -22
- package/dist/esm/decorators/applyClass.js.map +2 -2
- package/dist/esm/decorators/applyNode.js +22 -17
- package/dist/esm/decorators/applyNode.js.map +2 -2
- package/dist/esm/decorators/applyStyle.js +20 -19
- package/dist/esm/decorators/applyStyle.js.map +2 -2
- package/dist/esm/decorators/attribute.js +17 -16
- package/dist/esm/decorators/attribute.js.map +2 -2
- package/dist/esm/decorators/{changedAttributeHost.js → changedAttributeThis.js} +3 -3
- package/dist/esm/decorators/changedAttributeThis.js.map +7 -0
- package/dist/esm/decorators/elementDefine.js +233 -187
- package/dist/esm/decorators/elementDefine.js.map +2 -2
- package/dist/esm/decorators/emitCustomEvent.js +24 -16
- package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
- package/dist/esm/decorators/index.js +1 -1
- package/dist/esm/decorators/index.js.map +1 -1
- package/dist/esm/decorators/lifecycles.js +15 -17
- package/dist/esm/decorators/lifecycles.js.map +2 -2
- package/dist/esm/decorators/query.js +38 -60
- package/dist/esm/decorators/query.js.map +2 -2
- package/dist/esm/decorators/queryAll.js +31 -63
- package/dist/esm/decorators/queryAll.js.map +2 -2
- package/dist/esm/decorators/setProperty.js +13 -12
- package/dist/esm/decorators/setProperty.js.map +2 -2
- package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js +2 -2
- package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
- package/dist/esm/elements/SwcAppEngine.js +9 -2
- package/dist/esm/elements/SwcAppEngine.js.map +2 -2
- package/dist/esm/elements/SwcAppMixin.js +122 -66
- package/dist/esm/elements/SwcAppMixin.js.map +2 -2
- package/dist/esm/elements/SwcAsync.js +32 -22
- package/dist/esm/elements/SwcAsync.js.map +2 -2
- package/dist/esm/elements/SwcChoose.js +54 -35
- package/dist/esm/elements/SwcChoose.js.map +2 -2
- package/dist/esm/elements/SwcIf.js +55 -33
- package/dist/esm/elements/SwcIf.js.map +2 -2
- package/dist/esm/elements/SwcLoop.js +112 -38
- package/dist/esm/elements/SwcLoop.js.map +2 -2
- package/dist/esm/elements/register.js +250 -123
- package/dist/esm/elements/register.js.map +2 -2
- package/dist/esm/router/ElementRouter.js +5 -2
- package/dist/esm/router/ElementRouter.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils/Utils.js +31 -17
- package/dist/esm/utils/Utils.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +563 -557
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
- package/dist/types/decorators/addEventListener.d.ts +5 -7
- package/dist/types/decorators/addEventListener.d.ts.map +1 -1
- package/dist/types/decorators/applyAttribute.d.ts +4 -4
- package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
- package/dist/types/decorators/applyClass.d.ts +6 -6
- package/dist/types/decorators/applyClass.d.ts.map +1 -1
- package/dist/types/decorators/applyNode.d.ts +7 -6
- package/dist/types/decorators/applyNode.d.ts.map +1 -1
- package/dist/types/decorators/applyStyle.d.ts +4 -4
- package/dist/types/decorators/applyStyle.d.ts.map +1 -1
- package/dist/types/decorators/attribute.d.ts +5 -5
- package/dist/types/decorators/attribute.d.ts.map +1 -1
- package/dist/types/decorators/changedAttributeThis.d.ts +18 -0
- package/dist/types/decorators/changedAttributeThis.d.ts.map +1 -0
- package/dist/types/decorators/elementDefine.d.ts.map +1 -1
- package/dist/types/decorators/emitCustomEvent.d.ts +11 -12
- package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
- package/dist/types/decorators/index.d.ts +1 -1
- package/dist/types/decorators/lifecycles.d.ts +10 -7
- package/dist/types/decorators/lifecycles.d.ts.map +1 -1
- package/dist/types/decorators/query.d.ts +17 -63
- package/dist/types/decorators/query.d.ts.map +1 -1
- package/dist/types/decorators/queryAll.d.ts +6 -63
- package/dist/types/decorators/queryAll.d.ts.map +1 -1
- package/dist/types/decorators/setProperty.d.ts +1 -1
- package/dist/types/decorators/setProperty.d.ts.map +1 -1
- package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts +4 -5
- package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +1 -1
- package/dist/types/elements/SwcAppEngine.d.ts +4 -1
- package/dist/types/elements/SwcAppEngine.d.ts.map +1 -1
- package/dist/types/elements/SwcAppMixin.d.ts +11 -8
- package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
- package/dist/types/elements/register.d.ts.map +1 -1
- package/dist/types/types.d.ts +3 -2
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/Utils.d.ts +11 -8
- package/dist/types/utils/Utils.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +563 -557
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +3 -3
- package/src/decorators/addEventListener.ts +11 -9
- package/src/decorators/applyAttribute.ts +16 -15
- package/src/decorators/applyClass.ts +18 -17
- package/src/decorators/applyNode.ts +34 -21
- package/src/decorators/applyStyle.ts +17 -16
- package/src/decorators/attribute.ts +21 -20
- package/src/decorators/{changedAttributeHost.ts → changedAttributeThis.ts} +13 -14
- package/src/decorators/elementDefine.ts +402 -358
- package/src/decorators/emitCustomEvent.ts +40 -31
- package/src/decorators/index.ts +1 -1
- package/src/decorators/lifecycles.ts +11 -10
- package/src/decorators/query.ts +51 -124
- package/src/decorators/queryAll.ts +30 -127
- package/src/decorators/setProperty.ts +12 -11
- package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +10 -10
- package/src/elements/SwcAppEngine.ts +10 -3
- package/src/elements/SwcAppMixin.ts +177 -97
- package/src/elements/SwcAsync.ts +32 -21
- package/src/elements/SwcChoose.ts +74 -37
- package/src/elements/SwcIf.ts +60 -23
- package/src/elements/SwcLoop.ts +141 -28
- package/src/elements/register.ts +300 -102
- package/src/types.ts +6 -5
- package/src/utils/Utils.ts +40 -23
- package/tsconfig.json +2 -2
- package/dist/cjs/decorators/changedAttributeHost.js.map +0 -7
- package/dist/esm/decorators/changedAttributeHost.js.map +0 -7
- package/dist/types/decorators/changedAttributeHost.d.ts +0 -19
- package/dist/types/decorators/changedAttributeHost.d.ts.map +0 -1
|
@@ -7,11 +7,11 @@ var __decorate = function(decorators, target, key, desc) {
|
|
|
7
7
|
var __metadata = function(k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { changedAttributeThis } from "../decorators/changedAttributeThis.js";
|
|
11
11
|
import { SwcUtils } from "../utils/Utils.js";
|
|
12
12
|
import { FunctionUtils, ActionExpression } from "@dooboostore/core";
|
|
13
13
|
import { ConvertUtils } from "@dooboostore/core-web";
|
|
14
|
-
import {
|
|
14
|
+
import { attributeThis, getAttributeValue, getElementConfig } from "../decorators/index.js";
|
|
15
15
|
class SwcChoose extends HTMLTemplateElement {
|
|
16
16
|
get value() {
|
|
17
17
|
return this._value;
|
|
@@ -31,18 +31,28 @@ class SwcChoose extends HTMLTemplateElement {
|
|
|
31
31
|
attributeChangedCallback(na, o, n) {
|
|
32
32
|
}
|
|
33
33
|
setValue(value, o, n) {
|
|
34
|
+
console.log("chooooooose value", value);
|
|
34
35
|
this._value = value;
|
|
35
36
|
this.refresh(this._value);
|
|
36
37
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
// @changedAttributeThis('replace-wrap')
|
|
39
|
+
// private setReplaceWrap(replaceWrapAttr?: string | null) {
|
|
40
|
+
// this.refresh();
|
|
41
|
+
// }
|
|
40
42
|
replaceExpressions(html, groupArgs, context, wrap) {
|
|
41
|
-
|
|
43
|
+
let config = void 0;
|
|
44
|
+
if (wrap) {
|
|
45
|
+
config = {
|
|
46
|
+
expression: {
|
|
47
|
+
replace: { start: `${wrap.start}`, end: `${wrap.end}` },
|
|
48
|
+
callReturn: { start: `${wrap.start}=`, end: `${wrap.end}` },
|
|
49
|
+
call: { start: `${wrap.start}@`, end: `${wrap.end}` }
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
42
53
|
const ae = new ActionExpression(html, config);
|
|
43
|
-
const filterOptions = wrap ? { type: "replace", wrap } : "replace";
|
|
44
54
|
const win = this.ownerDocument?.defaultView || window;
|
|
45
|
-
for (const expr of ae.getExpressions(
|
|
55
|
+
for (const expr of ae.getExpressions("replace")) {
|
|
46
56
|
try {
|
|
47
57
|
const value = FunctionUtils.executeReturn({
|
|
48
58
|
script: ConvertUtils.decodeHtmlEntity(expr.script, win.document),
|
|
@@ -58,31 +68,27 @@ class SwcChoose extends HTMLTemplateElement {
|
|
|
58
68
|
}
|
|
59
69
|
refresh(value) {
|
|
60
70
|
value = getAttributeValue(this, "value") ?? this._value;
|
|
61
|
-
|
|
62
|
-
|
|
71
|
+
console.log("[DEBUG] SwcChoose.refresh called, value:", value);
|
|
72
|
+
const portal = SwcUtils.getParentContainer(this);
|
|
73
|
+
if (!portal) {
|
|
74
|
+
console.log("[DEBUG] SwcChoose portal is null!");
|
|
63
75
|
return;
|
|
76
|
+
}
|
|
64
77
|
const win = (getElementConfig(this).window ?? this.ownerDocument?.defaultView) || window;
|
|
65
78
|
const helperSet = SwcUtils.getHelperAndHostSet(win, this);
|
|
66
|
-
const groupArgs = { ...helperSet, $value: value };
|
|
79
|
+
const groupArgs = { ...helperSet, $value: value, $templateHost: this };
|
|
67
80
|
const templates = Array.from(this.content.querySelectorAll("template"));
|
|
68
81
|
let selected = null;
|
|
69
82
|
for (const t of templates) {
|
|
70
83
|
if (t.getAttribute("is") === "swc-when") {
|
|
71
|
-
const attrVal = t.getAttribute("
|
|
84
|
+
const attrVal = t.getAttribute("test") || "";
|
|
72
85
|
let matches = false;
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
context: t,
|
|
80
|
-
args: groupArgs
|
|
81
|
-
});
|
|
82
|
-
matches = !!result;
|
|
83
|
-
} else {
|
|
84
|
-
matches = String(attrVal) === String(value);
|
|
85
|
-
}
|
|
86
|
+
const result = FunctionUtils.executeReturn({
|
|
87
|
+
script: attrVal,
|
|
88
|
+
context: t,
|
|
89
|
+
args: groupArgs
|
|
90
|
+
});
|
|
91
|
+
matches = !!result;
|
|
86
92
|
if (matches) {
|
|
87
93
|
selected = t;
|
|
88
94
|
break;
|
|
@@ -101,12 +107,27 @@ class SwcChoose extends HTMLTemplateElement {
|
|
|
101
107
|
this._previousTemplate = target;
|
|
102
108
|
if (target) {
|
|
103
109
|
let htmlString = target.innerHTML;
|
|
104
|
-
htmlString = this.replaceExpressions(htmlString, groupArgs, this, this.
|
|
110
|
+
htmlString = this.replaceExpressions(htmlString, groupArgs, this, { start: this._replaceWrapStart ?? "{#{", end: this._replaceWrapEnd ?? "}#}" });
|
|
105
111
|
const result = this.ownerDocument?.createElement("template") || document.createElement("template");
|
|
106
112
|
result.innerHTML = htmlString;
|
|
107
113
|
const processedFragment = result.content;
|
|
108
114
|
this._nodes = Array.from(processedFragment.childNodes);
|
|
115
|
+
const setTemplateHost = (element) => {
|
|
116
|
+
element.__swc_template_host = this;
|
|
117
|
+
Array.from(element.children).forEach((child) => {
|
|
118
|
+
if (child instanceof HTMLElement) {
|
|
119
|
+
setTemplateHost(child);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
this._nodes.forEach((node) => {
|
|
124
|
+
if (node instanceof HTMLElement) {
|
|
125
|
+
setTemplateHost(node);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
console.log(`[DEBUG] SwcChoose before insertBefore, portal: ${portal?.tagName}, isConnected: ${portal?.isConnected}`);
|
|
109
129
|
portal.insertBefore(processedFragment, this.nextSibling);
|
|
130
|
+
console.log("[DEBUG] SwcChoose after insertBefore");
|
|
110
131
|
}
|
|
111
132
|
}
|
|
112
133
|
cleanup() {
|
|
@@ -118,19 +139,17 @@ class SwcChoose extends HTMLTemplateElement {
|
|
|
118
139
|
}
|
|
119
140
|
}
|
|
120
141
|
__decorate([
|
|
121
|
-
|
|
142
|
+
attributeThis("replace-wrap-start"),
|
|
143
|
+
__metadata("design:type", String)
|
|
144
|
+
], SwcChoose.prototype, "_replaceWrapStart", void 0);
|
|
145
|
+
__decorate([
|
|
146
|
+
attributeThis("replace-wrap-end"),
|
|
122
147
|
__metadata("design:type", String)
|
|
123
|
-
], SwcChoose.prototype, "
|
|
148
|
+
], SwcChoose.prototype, "_replaceWrapEnd", void 0);
|
|
124
149
|
__decorate([
|
|
125
|
-
|
|
150
|
+
changedAttributeThis("value"),
|
|
126
151
|
__metadata("design:type", Function),
|
|
127
152
|
__metadata("design:paramtypes", [Object, String, String]),
|
|
128
153
|
__metadata("design:returntype", void 0)
|
|
129
154
|
], SwcChoose.prototype, "setValue", null);
|
|
130
|
-
__decorate([
|
|
131
|
-
changedAttributeHost("replace-wrap"),
|
|
132
|
-
__metadata("design:type", Function),
|
|
133
|
-
__metadata("design:paramtypes", [String]),
|
|
134
|
-
__metadata("design:returntype", void 0)
|
|
135
|
-
], SwcChoose.prototype, "setReplaceWrap", null);
|
|
136
155
|
//# sourceMappingURL=SwcChoose.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/elements/SwcChoose.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": ";;;;;;;;;AAAA,SAAS,4BAA4B;AACrC,SAAS,gBAAgB;AACzB,SAAS,eAAe,wBAAwB;AAChD,SAAS,oBAAoB;AAE7B,SAAS,eAAe,mBAAmB,wBAAwB;AAEnE,MAAM,kBAAkB,oBAAmB;
|
|
4
|
+
"sourcesContent": ["import { changedAttributeThis } from '../decorators/changedAttributeThis';\nimport { SwcUtils } from '../utils/Utils';\nimport { FunctionUtils, ActionExpression } from '@dooboostore/core';\nimport { ConvertUtils } from '@dooboostore/core-web';\nimport { SwcChooseInterface } from '../types';\nimport { attributeThis, getAttributeValue, getElementConfig } from '../decorators';\n\nclass SwcChoose extends HTMLTemplateElement implements SwcChooseInterface {\n _value: any;\n\n @attributeThis('replace-wrap-start')\n _replaceWrapStart: string | null;\n @attributeThis('replace-wrap-end')\n _replaceWrapEnd: string | null;\n\n private _nodes: Node[] = [];\n private _previousTemplate: HTMLTemplateElement | null = null;\n\n get value(): any {\n return this._value;\n }\n\n set value(nv: any) {\n this._value = nv;\n this.refresh(this._value);\n }\n\n constructor() {\n super();\n // console.log('swc chooooooooooooooooooooooooose constructor called!');\n // console.log('swc cccccccss', this.getAttribute('value'));\n }\n\n // static get observedAttributes() {\n // return ['value'];\n // }\n\n attributeChangedCallback(na, o, n) {\n // console.log('-----------------choooooooose attr origin', na, o, n);\n }\n\n @changedAttributeThis('value')\n private setValue(value: any, o: string, n: string) {\n console.log('chooooooose value', value)\n this._value = value;\n this.refresh(this._value);\n }\n\n // @changedAttributeThis('replace-wrap')\n // private setReplaceWrap(replaceWrapAttr?: string | null) {\n // this.refresh();\n // }\n\n private replaceExpressions(html: string, groupArgs: any, context: any, wrap: {start: string, end: string}): string {\n let config: any = undefined;\n if (wrap) {\n config = {\n expression: {\n replace: { start: `${wrap.start}`, end: `${wrap.end}` },\n callReturn: { start: `${wrap.start}=`, end: `${wrap.end}` },\n call: { start: `${wrap.start}@`, end: `${wrap.end}` }\n }\n };\n }\n const ae = new ActionExpression(html, config);\n const win = this.ownerDocument?.defaultView || window;\n\n // @ts-ignore\n for (const expr of ae.getExpressions('replace')) {\n try {\n const value = FunctionUtils.executeReturn({\n script: ConvertUtils.decodeHtmlEntity(expr.script, win.document),\n context,\n args: groupArgs\n });\n ae.replace(expr, String(value));\n } catch (e) {\n console.error(`[SWC] Failed to execute ${expr.original}:`, e);\n }\n }\n return ae.getUnprocessedTemplate();\n }\n\n refresh(value?: any) {\n value = getAttributeValue(this, 'value') ?? this._value;\n console.log('[DEBUG] SwcChoose.refresh called, value:', value);\n const portal = SwcUtils.getParentContainer(this);\n if (!portal) {\n console.log('[DEBUG] SwcChoose portal is null!');\n return;\n }\n\n const win = (getElementConfig(this).window ?? this.ownerDocument?.defaultView) || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n const groupArgs = { ...helperSet, $value: value, $templateHost: this };\n\n const templates = Array.from(this.content.querySelectorAll('template'));\n let selected: HTMLTemplateElement | null = null;\n\n for (const t of templates) {\n if (t.getAttribute('is') === 'swc-when') {\n const attrVal = t.getAttribute('test') || '';\n let matches = false;\n\n\n\n const result = FunctionUtils.executeReturn({\n script: attrVal,\n context: t,\n args: groupArgs\n });\n matches = !!result;\n // Use ActionExpression to parse and extract script from value attribute\n // const ae = new ActionExpression(attrVal);\n // const expr = ae.getFirstExpression('replace');\n\n // if (expr) {\n // const decodedScript = ConvertUtils.decodeHtmlEntity(expr.script, win.document);\n // const result = FunctionUtils.executeReturn({\n // script: decodedScript,\n // context: t,\n // args: groupArgs\n // });\n // matches = !!result;\n // } else {\n // matches = String(attrVal) === String(value);\n // }\n\n if (matches) {\n selected = t;\n break;\n }\n }\n }\n\n const target = selected || (this.content.querySelector('template[is=\"swc-otherwise\"]') as HTMLTemplateElement);\n\n const skipValue = target?.getAttribute?.('skip-if-same');\n const skipValue2 = this._previousTemplate?.getAttribute?.('skip-if-same');\n const hasSkipIfSame = target?.hasAttribute?.('skip-if-same');\n const isSame = this._previousTemplate === target;\n // console.log('---rrrr---', this._previousTemplate, target, hasSkipIfSame, isSame, skipValue, skipValue2);\n if (hasSkipIfSame && isSame) {\n return;\n }\n\n this.cleanup();\n this._previousTemplate = target;\n\n if (target) {\n let htmlString = target.innerHTML;\n htmlString = this.replaceExpressions(htmlString, groupArgs, this, {start:this._replaceWrapStart ?? '{#{', end: this._replaceWrapEnd ?? '}#}'});\n\n const result = this.ownerDocument?.createElement('template') || document.createElement('template');\n result.innerHTML = htmlString;\n const processedFragment = result.content;\n\n // console.log('[DEBUG] SwcChoose processedFragment children:', processedFragment._childNodesInternal?.length);\n this._nodes = Array.from(processedFragment.childNodes);\n \n const setTemplateHost = (element: HTMLElement) => {\n (element as any).__swc_template_host = this;\n Array.from(element.children).forEach((child: any) => {\n if (child instanceof HTMLElement) {\n setTemplateHost(child);\n }\n });\n };\n \n this._nodes.forEach((node: any) => {\n if (node instanceof HTMLElement) {\n setTemplateHost(node as HTMLElement);\n }\n });\n\n console.log(`[DEBUG] SwcChoose before insertBefore, portal: ${portal?.tagName}, isConnected: ${(portal as any)?.isConnected}`);\n portal.insertBefore(processedFragment, this.nextSibling);\n console.log('[DEBUG] SwcChoose after insertBefore');\n }\n }\n\n private cleanup() {\n this._nodes.forEach(n => n.parentElement?.removeChild(n));\n this._nodes = [];\n }\n\n disconnectedCallback() {\n this.cleanup();\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAAA,SAAS,4BAA4B;AACrC,SAAS,gB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U;AACjG,aAAO,YAAY;AACnB,YAAM,oBAAoB,OAAO;AAGjC,WAAK,SAAS,MAAM,KAAK,kBAAkB,UAAU;AAErD,YAAM,kBAAkB,CAAC,YAAwB;AAC9C,gBAAgB,sBAAsB;AACvC,cAAM,KAAK,QAAQ,QAAQ,EAAE,QAAQ,CAAC,UAAc;AAClD,cAAI,iBAAiB,aAAa;AAChC,4BAAgB,KAAK;UACvB;QACF,CAAC;MACH;AAEA,WAAK,OAAO,QAAQ,CAAC,SAAa;AAChC,YAAI,gBAAgB,aAAa;AAC/B,0BAAgB,IAAmB;QACrC;MACF,CAAC;AAED,cAAQ,IAAI,kDAAkD,QAAQ,OAAO,kBAAmB,QAAgB,WAAW,EAAE;AAC7H,aAAO,aAAa,mBAAmB,KAAK,WAAW;AACvD,cAAQ,IAAI,sCAAsC;IACpD;EACF;EAEQ,UAAO;AACb,SAAK,OAAO,QAAQ,OAAK,EAAE,eAAe,YAAY,CAAC,CAAC;AACxD,SAAK,SAAS,CAAA;EAChB;EAEA,uBAAoB;AAClB,SAAK,QAAO;EACd;;AAjLA,WAAA;EADC,cAAc,oBAAoB;;;AAGnC,WAAA;EADC,cAAc,kBAAkB;;;AA8BzB,WAAA;EADP,qBAAqB,OAAO;;;;;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -7,28 +7,44 @@ var __decorate = function(decorators, target, key, desc) {
|
|
|
7
7
|
var __metadata = function(k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { changedAttributeThis } from "../decorators/changedAttributeThis.js";
|
|
11
11
|
import { SwcUtils } from "../utils/Utils.js";
|
|
12
12
|
import { FunctionUtils, ActionExpression } from "@dooboostore/core";
|
|
13
13
|
import { ConvertUtils } from "@dooboostore/core-web";
|
|
14
|
-
import {
|
|
14
|
+
import { attributeThis, getAttributeValue } from "../decorators/index.js";
|
|
15
15
|
class SwcIf extends HTMLTemplateElement {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(...arguments);
|
|
18
|
-
this._nodes = [];
|
|
19
|
-
}
|
|
20
16
|
get value() {
|
|
21
17
|
return this._value;
|
|
22
18
|
}
|
|
23
19
|
set value(nv) {
|
|
24
20
|
this.refresh(nv);
|
|
25
21
|
}
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
this._nodes = [];
|
|
25
|
+
}
|
|
26
|
+
setValue(value, o, n) {
|
|
27
|
+
this._value = value;
|
|
28
|
+
this.refresh(this._value);
|
|
29
|
+
}
|
|
30
|
+
// @changedAttributeThis('replace-wrap')
|
|
31
|
+
// private setReplaceWrap(replaceWrapAttr?: string | null) {
|
|
32
|
+
// this.refresh();
|
|
33
|
+
// }
|
|
26
34
|
replaceExpressions(html, groupArgs, context, wrap) {
|
|
27
|
-
|
|
35
|
+
let config = void 0;
|
|
36
|
+
if (wrap) {
|
|
37
|
+
config = {
|
|
38
|
+
expression: {
|
|
39
|
+
replace: { start: `${wrap.start}`, end: `${wrap.end}` },
|
|
40
|
+
callReturn: { start: `${wrap.start}=`, end: `${wrap.end}` },
|
|
41
|
+
call: { start: `${wrap.start}@`, end: `${wrap.end}` }
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
28
45
|
const ae = new ActionExpression(html, config);
|
|
29
|
-
const filterOptions = wrap ? { type: "replace", wrap } : "replace";
|
|
30
46
|
const win = this.ownerDocument?.defaultView || window;
|
|
31
|
-
for (const expr of ae.getExpressions(
|
|
47
|
+
for (const expr of ae.getExpressions("replace")) {
|
|
32
48
|
try {
|
|
33
49
|
const value = FunctionUtils.executeReturn({
|
|
34
50
|
script: ConvertUtils.decodeHtmlEntity(expr.script, win.document),
|
|
@@ -42,30 +58,38 @@ class SwcIf extends HTMLTemplateElement {
|
|
|
42
58
|
}
|
|
43
59
|
return ae.getUnprocessedTemplate();
|
|
44
60
|
}
|
|
45
|
-
|
|
46
|
-
this.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
refresh(value = this._value) {
|
|
61
|
+
refresh(value) {
|
|
62
|
+
const targetValue = value !== void 0 ? value : getAttributeValue(this, "value") ?? this._value;
|
|
63
|
+
if (this.hasAttribute("skip-if-same") && this._value === targetValue && this._nodes.length > 0) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
52
66
|
this.cleanup();
|
|
67
|
+
this._value = targetValue;
|
|
53
68
|
const portal = this.parentElement;
|
|
54
|
-
if (!portal || !
|
|
69
|
+
if (!portal || !this._value)
|
|
55
70
|
return;
|
|
56
71
|
const win = this.ownerDocument?.defaultView || window;
|
|
57
72
|
const helperSet = SwcUtils.getHelperAndHostSet(win, this);
|
|
58
73
|
let htmlString = this.innerHTML;
|
|
59
|
-
const groupArgs = { ...helperSet, $value:
|
|
60
|
-
htmlString = this.replaceExpressions(htmlString, groupArgs, this, this.
|
|
74
|
+
const groupArgs = { ...helperSet, $value: this._value, $templateHost: this };
|
|
75
|
+
htmlString = this.replaceExpressions(htmlString, groupArgs, this, { start: this._replaceWrapStart ?? "{#{", end: this._replaceWrapEnd ?? "}#}" });
|
|
61
76
|
const result = this.ownerDocument?.createElement("template") || document.createElement("template");
|
|
62
77
|
result.innerHTML = htmlString;
|
|
63
78
|
const processedFragment = result.content;
|
|
64
79
|
this._nodes = Array.from(processedFragment.childNodes);
|
|
80
|
+
this._nodes.forEach((node) => {
|
|
81
|
+
if (node instanceof HTMLElement)
|
|
82
|
+
node.__swc_template_host = this;
|
|
83
|
+
});
|
|
65
84
|
portal.insertBefore(processedFragment, this.nextSibling);
|
|
66
85
|
}
|
|
67
86
|
cleanup() {
|
|
68
|
-
this._nodes.forEach((n) =>
|
|
87
|
+
this._nodes.forEach((n) => {
|
|
88
|
+
const realNode = n.__upgraded_instance || n;
|
|
89
|
+
if (realNode.parentElement) {
|
|
90
|
+
realNode.parentElement.removeChild(realNode);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
69
93
|
this._nodes = [];
|
|
70
94
|
}
|
|
71
95
|
disconnectedCallback() {
|
|
@@ -73,23 +97,21 @@ class SwcIf extends HTMLTemplateElement {
|
|
|
73
97
|
}
|
|
74
98
|
}
|
|
75
99
|
__decorate([
|
|
76
|
-
|
|
77
|
-
__metadata("design:type",
|
|
78
|
-
], SwcIf.prototype, "
|
|
100
|
+
attributeThis("replace-wrap-start"),
|
|
101
|
+
__metadata("design:type", String)
|
|
102
|
+
], SwcIf.prototype, "_replaceWrapStart", void 0);
|
|
79
103
|
__decorate([
|
|
80
|
-
|
|
104
|
+
attributeThis("replace-wrap-end"),
|
|
81
105
|
__metadata("design:type", String)
|
|
82
|
-
], SwcIf.prototype, "
|
|
106
|
+
], SwcIf.prototype, "_replaceWrapEnd", void 0);
|
|
83
107
|
__decorate([
|
|
84
|
-
|
|
85
|
-
__metadata("design:type",
|
|
86
|
-
|
|
87
|
-
__metadata("design:returntype", void 0)
|
|
88
|
-
], SwcIf.prototype, "setValue", null);
|
|
108
|
+
attributeThis("skip-if-same"),
|
|
109
|
+
__metadata("design:type", String)
|
|
110
|
+
], SwcIf.prototype, "_skipIfSame", void 0);
|
|
89
111
|
__decorate([
|
|
90
|
-
|
|
112
|
+
changedAttributeThis("value"),
|
|
91
113
|
__metadata("design:type", Function),
|
|
92
|
-
__metadata("design:paramtypes", [String]),
|
|
114
|
+
__metadata("design:paramtypes", [Object, String, String]),
|
|
93
115
|
__metadata("design:returntype", void 0)
|
|
94
|
-
], SwcIf.prototype, "
|
|
116
|
+
], SwcIf.prototype, "setValue", null);
|
|
95
117
|
//# sourceMappingURL=SwcIf.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/elements/SwcIf.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": ";;;;;;;;;AAAA,SAAS,4BAA4B;AACrC,SAAS,gBAAgB;AACzB,SAAS,eAAe,wBAAwB;AAChD,SAAS,oBAAoB;AAE7B,SAAS,
|
|
4
|
+
"sourcesContent": ["import { changedAttributeThis } from '../decorators/changedAttributeThis';\nimport { SwcUtils } from '../utils/Utils';\nimport { FunctionUtils, ActionExpression } from '@dooboostore/core';\nimport { ConvertUtils } from '@dooboostore/core-web';\nimport { SwcIfInterface } from '../types';\nimport { attributeThis, getAttributeValue } from '../decorators';\n\nclass SwcIf extends HTMLTemplateElement implements SwcIfInterface {\n // id =\n // @attributeThis('value')\n _value: any;\n\n @attributeThis('replace-wrap-start')\n _replaceWrapStart: string | null;\n @attributeThis('replace-wrap-end')\n _replaceWrapEnd: string | null;\n\n @attributeThis('skip-if-same')\n _skipIfSame: string | null;\n\n private _nodes: Node[] = [];\n\n get value(): boolean {\n return this._value;\n }\n\n set value(nv: any) {\n // this._value = nv;\n this.refresh(nv);\n }\n\n constructor() {\n super();\n }\n\n @changedAttributeThis('value')\n private setValue(value: any, o: string, n: string) {\n this._value = value;\n this.refresh(this._value);\n }\n\n // @changedAttributeThis('replace-wrap')\n // private setReplaceWrap(replaceWrapAttr?: string | null) {\n // this.refresh();\n // }\n\n private replaceExpressions(html: string, groupArgs: any, context: any, wrap: {start: string, end: string}): string {\n let config: any = undefined;\n if (wrap) {\n config = {\n expression: {\n replace: { start: `${wrap.start}`, end: `${wrap.end}` },\n callReturn: { start: `${wrap.start}=`, end: `${wrap.end}` },\n call: { start: `${wrap.start}@`, end: `${wrap.end}` }\n }\n };\n }\n const ae = new ActionExpression(html, config);\n const win = this.ownerDocument?.defaultView || window;\n\n // @ts-ignore\n for (const expr of ae.getExpressions('replace')) {\n try {\n const value = FunctionUtils.executeReturn({\n script: ConvertUtils.decodeHtmlEntity(expr.script, win.document),\n context,\n args: groupArgs\n });\n ae.replace(expr, String(value));\n } catch (e) {\n console.error(`[SWC] Failed to execute ${expr.original}:`, e);\n }\n }\n return ae.getUnprocessedTemplate();\n }\n\n refresh(value?: any) {\n const targetValue = value !== undefined ? value : (getAttributeValue(this, 'value') ?? this._value);\n\n // skip-if-same 속성이 존재하고(true/빈 문자열), 이전 값과 새로운 값이 완전히 동일하면 렌더링 스킵!\n if (this.hasAttribute('skip-if-same') && this._value === targetValue && this._nodes.length > 0) {\n return;\n }\n\n this.cleanup();\n this._value = targetValue;\n\n const portal = this.parentElement;\n if (!portal || !this._value) return;\n\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n\n let htmlString = this.innerHTML;\n const groupArgs = { ...helperSet, $value: this._value, $templateHost: this };\n\n htmlString = this.replaceExpressions(htmlString, groupArgs, this, {start:this._replaceWrapStart ?? '{#{', end: this._replaceWrapEnd ?? '}#}'});\n\n const result = this.ownerDocument?.createElement('template') || document.createElement('template');\n result.innerHTML = htmlString;\n const processedFragment = result.content;\n\n this._nodes = Array.from(processedFragment.childNodes);\n this._nodes.forEach((node: any) => {\n if (node instanceof HTMLElement) (node as any).__swc_template_host = this;\n });\n\n portal.insertBefore(processedFragment, this.nextSibling);\n }\n\n private cleanup() {\n this._nodes.forEach(n => {\n const realNode = (n as any).__upgraded_instance || n;\n if (realNode.parentElement) {\n realNode.parentElement.removeChild(realNode);\n }\n });\n this._nodes = [];\n }\n\n disconnectedCallback() {\n this.cleanup();\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAAA,SAAS,4BAA4B;AACrC,SAAS,gBAAgB;AACzB,SAAS,eAAe,wBAAwB;AAChD,SAAS,oBAAoB;AAE7B,SAAS,eAAe,yBAAyB;AAEjD,MAAM,cAAc,oBAAmB;EAerC,IAAI,QAAK;AACP,WAAO,KAAK;EACd;EAEA,IAAI,MAAM,IAAO;AAEf,SAAK,QAAQ,EAAE;EACjB;EAEA,cAAA;AACE,UAAK;AAZC,SAAA,SAAiB,CAAA;EAazB;EAGQ,SAAS,OAAY,GAAW,GAAS;AAC/C,SAAK,SAAS;AACd,SAAK,QAAQ,KAAK,MAAM;EAC1B;;;;;EAOQ,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AAW,MAAM,EAAC,OAAM,KAAK,qBAAqB,OAAO,KAAK,KAAK,mBAAmB,MAAK,CAAC;AAE7I,UAAM,SAAS,KAAK,eAAe,cAAc,UAAU,KAAK,SAAS,cAAc,UAAU;AACjG,WAAO,YAAY;AACnB,UAAM,oBAAoB,OAAO;AAEjC,SAAK,SAAS,MAAM,KAAK,kBAAkB,UAAU;AACrD,SAAK,OAAO,QAAQ,CAAC,SAAa;AAChC,UAAI,gBAAgB;AAAc,aAAa,sBAAsB;IACvE,CAAC;AAED,WAAO,aAAa,mBAAmB,KAAK,WAAW;EACzD;EAEQ,UAAO;AACb,SAAK,OAAO,QAAQ,OAAI;AACtB,YAAM,WAAY,EAAU,uBAAuB;AACnD,UAAI,SAAS,eAAe;AAC1B,iBAAS,cAAc,YAAY,QAAQ;MAC7C;IACF,CAAC;AACD,SAAK,SAAS,CAAA;EAChB;EAEA,uBAAoB;AAClB,SAAK,QAAO;EACd;;AA7GA,WAAA;EADC,cAAc,oBAAoB;;;AAGnC,WAAA;EADC,cAAc,kBAAkB;;;AAIjC,WAAA;EADC,cAAc,cAAc;;;AAmBrB,WAAA;EADP,qBAAqB,OAAO;;;;;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -7,37 +7,52 @@ var __decorate = function(decorators, target, key, desc) {
|
|
|
7
7
|
var __metadata = function(k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { changedAttributeThis } from "../decorators/changedAttributeThis.js";
|
|
11
11
|
import { SwcUtils } from "../utils/Utils.js";
|
|
12
12
|
import { FunctionUtils, ActionExpression } from "@dooboostore/core";
|
|
13
13
|
import { ConvertUtils } from "@dooboostore/core-web";
|
|
14
|
-
import {
|
|
14
|
+
import { attributeThis, getAttributeValue } from "../decorators/index.js";
|
|
15
15
|
class SwcLoop extends HTMLTemplateElement {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(...arguments);
|
|
18
|
-
this._nodeGroups = [];
|
|
19
|
-
}
|
|
20
16
|
get value() {
|
|
21
17
|
return this._value;
|
|
22
18
|
}
|
|
23
19
|
set value(nv) {
|
|
20
|
+
this._value = nv;
|
|
24
21
|
this.refresh(nv);
|
|
25
22
|
}
|
|
26
|
-
|
|
27
|
-
this.
|
|
23
|
+
getValue(index) {
|
|
24
|
+
return this._value?.[index];
|
|
25
|
+
}
|
|
26
|
+
constructor() {
|
|
27
|
+
super();
|
|
28
|
+
this._value = [];
|
|
29
|
+
this._nodeGroups = [];
|
|
28
30
|
}
|
|
29
|
-
|
|
30
|
-
this.
|
|
31
|
+
setValue(value, o, n) {
|
|
32
|
+
this._value = value;
|
|
33
|
+
this.refresh(this._value);
|
|
31
34
|
}
|
|
35
|
+
// @changedAttributeThis('replace-wrap')
|
|
36
|
+
// private setReplaceWrap(replaceWrapAttr?: string | null) {
|
|
37
|
+
// this.refresh();
|
|
38
|
+
// }
|
|
32
39
|
replaceExpressions(html, groupArgs, context, wrap) {
|
|
33
|
-
|
|
40
|
+
let config = void 0;
|
|
41
|
+
config = {
|
|
42
|
+
expression: {
|
|
43
|
+
replace: { start: `${wrap.start}`, end: `${wrap.end}` },
|
|
44
|
+
callReturn: { start: `${wrap.start}=`, end: `${wrap.end}` },
|
|
45
|
+
call: { start: `${wrap.start}@`, end: `${wrap.end}` }
|
|
46
|
+
}
|
|
47
|
+
};
|
|
34
48
|
const ae = new ActionExpression(html, config);
|
|
35
|
-
const filterOptions = wrap ? { type: "replace", wrap } : "replace";
|
|
36
49
|
const win = this.ownerDocument?.defaultView || window;
|
|
37
|
-
|
|
50
|
+
const expressions = ae.getExpressions("replace");
|
|
51
|
+
for (const expr of expressions) {
|
|
52
|
+
const script = ConvertUtils.decodeHtmlEntity(expr.script, win.document);
|
|
38
53
|
try {
|
|
39
54
|
const value = FunctionUtils.executeReturn({
|
|
40
|
-
script
|
|
55
|
+
script,
|
|
41
56
|
context,
|
|
42
57
|
args: groupArgs
|
|
43
58
|
});
|
|
@@ -48,30 +63,95 @@ class SwcLoop extends HTMLTemplateElement {
|
|
|
48
63
|
}
|
|
49
64
|
return ae.getUnprocessedTemplate();
|
|
50
65
|
}
|
|
51
|
-
|
|
52
|
-
this.cleanup();
|
|
53
|
-
if (value?.length <= 0)
|
|
54
|
-
return;
|
|
55
|
-
const portal = this.parentElement;
|
|
56
|
-
if (!portal)
|
|
57
|
-
return;
|
|
66
|
+
createFragmentAndNodes(items, helperSet, startIndex = 0) {
|
|
58
67
|
const win = this.ownerDocument?.defaultView || window;
|
|
59
|
-
const helperSet = SwcUtils.getHelperAndHostSet(win, this);
|
|
60
68
|
const fragment = win.document.createDocumentFragment();
|
|
61
|
-
|
|
69
|
+
const newNodesGroup = [];
|
|
70
|
+
items.forEach((item, i) => {
|
|
71
|
+
const index = startIndex + i;
|
|
62
72
|
let htmlString = this.innerHTML;
|
|
63
73
|
const groupArgs = { ...helperSet, $item: item, $index: index, $value: this._value };
|
|
64
|
-
htmlString = this.replaceExpressions(htmlString, groupArgs, this, this.
|
|
74
|
+
htmlString = this.replaceExpressions(htmlString, groupArgs, this, { start: this._replaceWrapStart ?? "{#{", end: this._replaceWrapEnd ?? "}#}" });
|
|
65
75
|
const temp = this.ownerDocument?.createElement("template") || document.createElement("template");
|
|
66
76
|
temp.innerHTML = htmlString;
|
|
67
77
|
const content = temp.content;
|
|
68
78
|
const nodes = Array.from(content.childNodes);
|
|
69
|
-
|
|
79
|
+
const setTemplateHost = (element) => {
|
|
80
|
+
element.__swc_template_host = this;
|
|
81
|
+
Array.from(element.children).forEach((child) => {
|
|
82
|
+
if (child instanceof HTMLElement) {
|
|
83
|
+
setTemplateHost(child);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
nodes.forEach((node) => {
|
|
88
|
+
if (node instanceof HTMLElement) {
|
|
89
|
+
setTemplateHost(node);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
newNodesGroup.push(nodes);
|
|
70
93
|
fragment.appendChild(content);
|
|
71
94
|
});
|
|
95
|
+
return { fragment, newNodesGroup };
|
|
96
|
+
}
|
|
97
|
+
appendItem(...items) {
|
|
98
|
+
if (!items || items.length <= 0)
|
|
99
|
+
return;
|
|
100
|
+
const portal = SwcUtils.getParentContainer(this);
|
|
101
|
+
if (!portal)
|
|
102
|
+
return;
|
|
103
|
+
const win = this.ownerDocument?.defaultView || window;
|
|
104
|
+
const helperSet = SwcUtils.getHelperAndHostSet(win, this);
|
|
105
|
+
const startIndex = this._value ? this._value.length : 0;
|
|
106
|
+
if (this._value !== items) {
|
|
107
|
+
this._value = [...this._value || [], ...items];
|
|
108
|
+
}
|
|
109
|
+
const { fragment, newNodesGroup } = this.createFragmentAndNodes(items, helperSet, startIndex);
|
|
110
|
+
this._nodeGroups.push(...newNodesGroup);
|
|
111
|
+
console.log("\uBB50\uC57C \uC528\uBC1C");
|
|
112
|
+
let insertReference = this.nextSibling;
|
|
113
|
+
if (this._nodeGroups.length > items.length) {
|
|
114
|
+
const lastExistingGroup = this._nodeGroups[this._nodeGroups.length - items.length - 1];
|
|
115
|
+
if (lastExistingGroup && lastExistingGroup.length > 0) {
|
|
116
|
+
const lastNode = lastExistingGroup[lastExistingGroup.length - 1];
|
|
117
|
+
insertReference = lastNode.nextSibling;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
portal.insertBefore(fragment, insertReference);
|
|
121
|
+
}
|
|
122
|
+
async prependItem(...items) {
|
|
123
|
+
if (!items || items.length <= 0)
|
|
124
|
+
return;
|
|
125
|
+
const portal = SwcUtils.getParentContainer(this);
|
|
126
|
+
if (!portal)
|
|
127
|
+
return;
|
|
128
|
+
const win = this.ownerDocument?.defaultView || window;
|
|
129
|
+
const helperSet = SwcUtils.getHelperAndHostSet(win, this);
|
|
130
|
+
if (this._value !== items) {
|
|
131
|
+
this._value = [...items, ...this._value || []];
|
|
132
|
+
}
|
|
133
|
+
const { fragment, newNodesGroup } = this.createFragmentAndNodes(items, helperSet, 0);
|
|
134
|
+
this._nodeGroups = [...newNodesGroup, ...this._nodeGroups];
|
|
72
135
|
portal.insertBefore(fragment, this.nextSibling);
|
|
73
136
|
}
|
|
137
|
+
refresh(value) {
|
|
138
|
+
const targetValue = value !== void 0 ? value : getAttributeValue(this, "value") ?? this._value ?? [];
|
|
139
|
+
this.cleanup();
|
|
140
|
+
this._value = targetValue;
|
|
141
|
+
if (!this._value || this._value.length <= 0)
|
|
142
|
+
return;
|
|
143
|
+
const win = this.ownerDocument?.defaultView || window;
|
|
144
|
+
const helperSet = SwcUtils.getHelperAndHostSet(win, this);
|
|
145
|
+
helperSet.$templateHost = this;
|
|
146
|
+
const { fragment, newNodesGroup } = this.createFragmentAndNodes(this._value, helperSet, 0);
|
|
147
|
+
this._nodeGroups = newNodesGroup;
|
|
148
|
+
const portal = SwcUtils.getParentContainer(this);
|
|
149
|
+
if (portal) {
|
|
150
|
+
portal.insertBefore(fragment, this.nextSibling);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
74
153
|
cleanup() {
|
|
154
|
+
console.log("\uB204\uAC00 cleanup");
|
|
75
155
|
this._nodeGroups.forEach((nodes) => nodes.forEach((n) => n.parentElement?.removeChild(n)));
|
|
76
156
|
this._nodeGroups = [];
|
|
77
157
|
}
|
|
@@ -80,23 +160,17 @@ class SwcLoop extends HTMLTemplateElement {
|
|
|
80
160
|
}
|
|
81
161
|
}
|
|
82
162
|
__decorate([
|
|
83
|
-
|
|
84
|
-
__metadata("design:type",
|
|
85
|
-
], SwcLoop.prototype, "
|
|
163
|
+
attributeThis("replace-wrap-start"),
|
|
164
|
+
__metadata("design:type", String)
|
|
165
|
+
], SwcLoop.prototype, "_replaceWrapStart", void 0);
|
|
86
166
|
__decorate([
|
|
87
|
-
|
|
167
|
+
attributeThis("replace-wrap-end"),
|
|
88
168
|
__metadata("design:type", String)
|
|
89
|
-
], SwcLoop.prototype, "
|
|
169
|
+
], SwcLoop.prototype, "_replaceWrapEnd", void 0);
|
|
90
170
|
__decorate([
|
|
91
|
-
|
|
171
|
+
changedAttributeThis("value"),
|
|
92
172
|
__metadata("design:type", Function),
|
|
93
|
-
__metadata("design:paramtypes", []),
|
|
173
|
+
__metadata("design:paramtypes", [Object, String, String]),
|
|
94
174
|
__metadata("design:returntype", void 0)
|
|
95
175
|
], SwcLoop.prototype, "setValue", null);
|
|
96
|
-
__decorate([
|
|
97
|
-
changedAttributeHost("replace-wrap"),
|
|
98
|
-
__metadata("design:type", Function),
|
|
99
|
-
__metadata("design:paramtypes", []),
|
|
100
|
-
__metadata("design:returntype", void 0)
|
|
101
|
-
], SwcLoop.prototype, "setReplaceWrap", null);
|
|
102
176
|
//# sourceMappingURL=SwcLoop.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/elements/SwcLoop.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": ";;;;;;;;;AAAA,SAAS,4BAA4B;AACrC,SAAS,gBAAgB;AACzB,SAAS,eAAe,wBAAwB;AAChD,SAAS,oBAAoB;AAC7B,SAAS,
|
|
4
|
+
"sourcesContent": ["import { changedAttributeThis } from '../decorators/changedAttributeThis';\nimport { SwcUtils } from '../utils/Utils';\nimport { FunctionUtils, ActionExpression } from '@dooboostore/core';\nimport { ConvertUtils } from '@dooboostore/core-web';\nimport { attributeThis, getAttributeValue } from '../decorators';\n\nclass SwcLoop extends HTMLTemplateElement {\n _value: any[] = [];\n\n @attributeThis('replace-wrap-start')\n _replaceWrapStart: string | null;\n @attributeThis('replace-wrap-end')\n _replaceWrapEnd: string | null;\n\n private _nodeGroups: Node[][] = [];\n\n get value(): any[] {\n return this._value;\n }\n\n set value(nv: any[]) {\n this._value = nv;\n this.refresh(nv);\n }\n\n getValue(index: number) {\n return this._value?.[index];\n }\n\n constructor() {\n super();\n // console.log('swc SwcLoop constructor called!');\n // console.log('swc SwcLoop', this.getAttribute('value'));\n }\n\n @changedAttributeThis('value')\n private setValue(value: any, o: string, n: string) {\n this._value = value;\n this.refresh(this._value);\n }\n\n // @changedAttributeThis('replace-wrap')\n // private setReplaceWrap(replaceWrapAttr?: string | null) {\n // this.refresh();\n // }\n\n private replaceExpressions(html: string, groupArgs: any, context: any, wrap: {start: string, end: string}): string {\n let config: any = undefined;\n config = {\n expression: {\n replace: { start: `${wrap.start}`, end: `${wrap.end}` },\n callReturn: { start: `${wrap.start}=`, end: `${wrap.end}` },\n call: { start: `${wrap.start}@`, end: `${wrap.end}` }\n }\n };\n const ae = new ActionExpression(html, config);\n const win = this.ownerDocument?.defaultView || window;\n\n // @ts-ignore\n const expressions = ae.getExpressions('replace');\n for (const expr of expressions) {\n const script = ConvertUtils.decodeHtmlEntity(expr.script, win.document);\n try {\n const value = FunctionUtils.executeReturn({\n script: script,\n context,\n args: groupArgs\n });\n ae.replace(expr, String(value));\n } catch (e) {\n console.error(`[SWC] Failed to execute ${expr.original}:`, e);\n }\n }\n return ae.getUnprocessedTemplate();\n }\n\n private createFragmentAndNodes(items: any[], helperSet: any, startIndex: number = 0): { fragment: DocumentFragment; newNodesGroup: Node[][] } {\n const win = this.ownerDocument?.defaultView || window;\n const fragment = win.document.createDocumentFragment();\n const newNodesGroup: Node[][] = [];\n\n items.forEach((item, i) => {\n const index = startIndex + i;\n let htmlString = this.innerHTML;\n const groupArgs = { ...helperSet, $item: item, $index: index, $value: this._value };\n\n htmlString = this.replaceExpressions(htmlString, groupArgs, this, {start:this._replaceWrapStart ?? '{#{', end: this._replaceWrapEnd ?? '}#}'});\n\n const temp = this.ownerDocument?.createElement('template') || document.createElement('template');\n temp.innerHTML = htmlString;\n\n const content = temp.content;\n const nodes = Array.from(content.childNodes);\n\n const setTemplateHost = (element: HTMLElement) => {\n (element as any).__swc_template_host = this;\n Array.from(element.children).forEach((child: any) => {\n if (child instanceof HTMLElement) {\n setTemplateHost(child);\n }\n });\n };\n\n nodes.forEach((node: any) => {\n if (node instanceof HTMLElement) {\n setTemplateHost(node as HTMLElement);\n }\n });\n newNodesGroup.push(nodes);\n fragment.appendChild(content);\n });\n\n return { fragment, newNodesGroup };\n }\n\n appendItem(...items: any[]) {\n if (!items || items.length <= 0) return;\n const portal = SwcUtils.getParentContainer(this);\n if (!portal) return;\n\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n\n const startIndex = this._value ? this._value.length : 0;\n\n // 내부 상태(value) 업데이트 (기존 배열에 새 아이템 추가)\n if (this._value !== items) {\n this._value = [...(this._value || []), ...items];\n }\n\n const { fragment, newNodesGroup } = this.createFragmentAndNodes(items, helperSet, startIndex);\n this._nodeGroups.push(...newNodesGroup);\n\n console.log('뭐야 씨발');\n // append 위치 계산: 기존에 그려진 마지막 노드 뒤에 삽입, 없으면 템플릿 바로 뒤에 삽입\n let insertReference: Node | null = this.nextSibling;\n if (this._nodeGroups.length > items.length) {\n const lastExistingGroup = this._nodeGroups[this._nodeGroups.length - items.length - 1];\n if (lastExistingGroup && lastExistingGroup.length > 0) {\n const lastNode = lastExistingGroup[lastExistingGroup.length - 1];\n insertReference = lastNode.nextSibling;\n }\n }\n\n portal.insertBefore(fragment, insertReference);\n }\n\n async prependItem(...items: any[]) {\n if (!items || items.length <= 0) return;\n const portal = SwcUtils.getParentContainer(this);\n if (!portal) return;\n\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n\n // 내부 상태(value) 업데이트 (기존 배열의 앞쪽에 새 아이템 추가)\n if (this._value !== items) {\n this._value = [...items, ...(this._value || [])];\n }\n\n const { fragment, newNodesGroup } = this.createFragmentAndNodes(items, helperSet, 0);\n\n // 기존의 nodeGroups 배열 맨 앞에 새로운 그룹들을 추가\n this._nodeGroups = [...newNodesGroup, ...this._nodeGroups];\n\n // prepend 위치: 이 템플릿(SwcLoop) 노드의 바로 다음 위치 (가장 위)\n portal.insertBefore(fragment, this.nextSibling);\n }\n\n refresh(value?: any) {\n // 1. 그릴 대상 확정\n const targetValue = value !== undefined ? value : (getAttributeValue(this, 'value') ?? this._value ?? []);\n\n // 2. 화면 정리\n this.cleanup();\n\n // 3. 상태 완전 교체 (이어붙이지 않음!)\n this._value = targetValue;\n\n if (!this._value || this._value.length <= 0) return;\n\n // 4. 화면 다시 그리기 (appendItem을 쓰지 않고 바로 그리기)\n const win = this.ownerDocument?.defaultView || window;\n const helperSet = SwcUtils.getHelperAndHostSet(win, this);\n helperSet.$templateHost = this;\n const { fragment, newNodesGroup } = this.createFragmentAndNodes(this._value, helperSet, 0);\n\n this._nodeGroups = newNodesGroup;\n const portal = SwcUtils.getParentContainer(this);\n if (portal) {\n // console.log('append????!~~~~~!?',fragment)\n portal.insertBefore(fragment, this.nextSibling);\n }\n }\n\n private cleanup() {\n console.log('누가 cleanup');\n this._nodeGroups.forEach(nodes => nodes.forEach(n => n.parentElement?.removeChild(n)));\n this._nodeGroups = [];\n }\n\n disconnectedCallback() {\n this.cleanup();\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAAA,SAAS,4BAA4B;AACrC,SAAS,gBAAgB;AACzB,SAAS,eAAe,wBAAwB;AAChD,SAAS,oBAAoB;AAC7B,SAAS,eAAe,yBAAyB;AAEjD,MAAM,gBAAgB,oBAAmB;EAUvC,IAAI,QAAK;AACP,WAAO,KAAK;EACd;EAEA,IAAI,MAAM,IAAS;AACjB,SAAK,SAAS;AACd,SAAK,QAAQ,EAAE;EACjB;EAEA,SAAS,OAAa;AACpB,WAAO,KAAK,SAAS,KAAK;EAC5B;EAEA,cAAA;AACE,UAAK;AAvBP,SAAA,SAAgB,CAAA;AAOR,SAAA,cAAwB,CAAA;EAmBhC;EAGQ,SAAS,OAAY,GAAW,GAAS;AAC/C,SAAK,SAAS;AACd,SAAK,QAAQ,KAAK,MAAM;EAC1B;;;;;EAOQ,mBAAmB,MAAc,WAAgB,SAAc,MAAkC;AACvG,QAAI,SAAc;AAClB,aAA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