@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
|
@@ -43,8 +43,8 @@ export declare function applyNodeThisAfterBegin(options: Omit<ApplyNodeOptions,
|
|
|
43
43
|
export declare function applyNodeThisAfterBegin(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
|
|
44
44
|
export declare function applyNodeThisAfterBeginLightDom(options: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
45
45
|
export declare function applyNodeThisAfterBeginLightDom(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
|
|
46
|
-
export declare function
|
|
47
|
-
export declare function
|
|
46
|
+
export declare function applyNodeThisInnerHtml(options: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
47
|
+
export declare function applyNodeThisInnerHtml(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
|
|
48
48
|
export declare function applyThisInnerHtmlNodeLightDom(options: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
49
49
|
export declare function applyThisInnerHtmlNodeLightDom(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
|
|
50
50
|
export declare function applyThisReplaceChildrenNodeLightDom(options: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyNode.d.ts","sourceRoot":"","sources":["../../../src/decorators/applyNode.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmC,aAAa,EAAE,WAAW,EAAC,MAAM,UAAU,CAAC;AAatF,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG,YAAY,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,iBAAiB,GAAG,WAAW,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE/J,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,GAAG,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE;QAAE,WAAW,EAAE,GAAG,CAAC;QAAC,MAAM,EAAE,aAAa,CAAA;KAAE,KAAK,OAAO,CAAC;IACzH;;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AE,UAAU,GAAG,MAAM,CAAC,GAAG,eAAe,CAAC;AAC5H,wBAAgB,oCAAoC,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,UAAU,EAAE,kBAAkB,GAAG,IAAI,CAAC;AAQzI,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAM,GAAG,eAAe,CAE5H;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAM,GAAG,eAAe,CAEtH;AAMD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAM,GAAG,eAAe,CAEtH"}
|
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
import { OptionalType } from '@dooboostore/core';
|
|
2
|
+
import { HelperHostSet } from "../types";
|
|
3
|
+
export type ApplySlotPosition = 'prepend' | 'prependHtml' | 'prependText' | 'append' | 'appendHtml' | 'appendText' | 'replaceChildren' | 'replaceChildrenHtml' | 'replaceChildrenText' | 'clear';
|
|
2
4
|
export interface ApplySlotOptions {
|
|
3
|
-
position
|
|
5
|
+
position: ApplySlotPosition;
|
|
6
|
+
fallback?: (helper: HelperHostSet) => string | Node;
|
|
4
7
|
}
|
|
5
8
|
export interface ApplySlotMetadata {
|
|
6
9
|
propertyKey: string | symbol;
|
|
7
|
-
|
|
8
|
-
type: 'method' | 'property';
|
|
10
|
+
targetId: string;
|
|
9
11
|
options: ApplySlotOptions;
|
|
10
12
|
}
|
|
11
13
|
export declare const APPLY_SLOT_METADATA_KEY: unique symbol;
|
|
12
14
|
/**
|
|
13
15
|
* @applyNode decorator to surgically add/replace nodes to a target element.
|
|
14
16
|
*/
|
|
15
|
-
export declare function applySlot(
|
|
17
|
+
export declare function applySlot(targetId: string, opt: OptionalType<ApplySlotOptions, 'position'>): MethodDecorator;
|
|
16
18
|
export declare const findAllApplySlotMetadata: (target: any) => ApplySlotMetadata[];
|
|
17
|
-
export declare function applySlotClear(
|
|
18
|
-
export declare function applySlotPrependHtml(
|
|
19
|
+
export declare function applySlotClear(targetId: string): MethodDecorator;
|
|
20
|
+
export declare function applySlotPrependHtml(targetId: string): MethodDecorator;
|
|
19
21
|
export declare const applySlotPrepend: typeof applySlotPrependHtml;
|
|
20
|
-
export declare function applySlotPrependText(
|
|
21
|
-
export declare function applySlotAppendHtml(
|
|
22
|
-
export declare function applySlotAppendText(
|
|
22
|
+
export declare function applySlotPrependText(targetId: string): MethodDecorator;
|
|
23
|
+
export declare function applySlotAppendHtml(targetId: string): MethodDecorator;
|
|
24
|
+
export declare function applySlotAppendText(targetId: string): MethodDecorator;
|
|
23
25
|
export declare const applySlotAppend: typeof applySlotAppendHtml;
|
|
24
|
-
export declare function applySlotReplaceChildrenHtml(
|
|
26
|
+
export declare function applySlotReplaceChildrenHtml(targetId: string): MethodDecorator;
|
|
25
27
|
export declare const applySlotReplaceChildren: typeof applySlotReplaceChildrenHtml;
|
|
26
|
-
export declare function applySlotReplaceChildrenText(
|
|
28
|
+
export declare function applySlotReplaceChildrenText(targetId: string): MethodDecorator;
|
|
27
29
|
//# sourceMappingURL=applySlot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applySlot.d.ts","sourceRoot":"","sources":["../../../src/decorators/applySlot.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"applySlot.d.ts","sourceRoot":"","sources":["../../../src/decorators/applySlot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAe,MAAM,mBAAmB,CAAC;AAI7D,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAUvC,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,aAAa,GAAG,aAAa,GAAG,QAAQ,GAAG,Y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
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/decorators/state.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,kBAAkB,eAA2C,CAAC;AAI3E,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;AAC1E,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/decorators/state.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,kBAAkB,eAA2C,CAAC;AAI3E,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;AAC1E,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAAC;AAgEvD,eAAO,MAAM,oBAAoB,GAAI,QAAQ,GAAG,KAAG,aAAa,EAG/D,CAAC"}
|
|
@@ -1193,6 +1193,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1193
1193
|
applyNodeThisBeforeEnd: () => applyNodeThisBeforeEnd,
|
|
1194
1194
|
applyNodeThisBeforeEndLightDom: () => applyNodeThisBeforeEndLightDom,
|
|
1195
1195
|
applyNodeThisBeforeEndShadow: () => applyNodeThisBeforeEndShadow,
|
|
1196
|
+
applyNodeThisInnerHtml: () => applyNodeThisInnerHtml,
|
|
1196
1197
|
applyNodeThisReplaceChildren: () => applyNodeThisReplaceChildren,
|
|
1197
1198
|
applyNodeThisReplaceChildrenLightDom: () => applyNodeThisReplaceChildrenLightDom,
|
|
1198
1199
|
applySlot: () => applySlot,
|
|
@@ -1208,7 +1209,6 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1208
1209
|
applySlotReplaceChildrenText: () => applySlotReplaceChildrenText,
|
|
1209
1210
|
applyStyle: () => applyStyle,
|
|
1210
1211
|
applyStyleThis: () => applyStyleThis,
|
|
1211
|
-
applyThisInnerHtmlNode: () => applyThisInnerHtmlNode,
|
|
1212
1212
|
applyThisInnerHtmlNodeLightDom: () => applyThisInnerHtmlNodeLightDom,
|
|
1213
1213
|
applyThisReplaceChildrenNodeLightDom: () => applyThisReplaceChildrenNodeLightDom,
|
|
1214
1214
|
attribute: () => attribute,
|
|
@@ -9664,98 +9664,6 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
9664
9664
|
return InjectSituationType2;
|
|
9665
9665
|
})(InjectSituationType || {});
|
|
9666
9666
|
|
|
9667
|
-
// src/decorators/applySlot.ts
|
|
9668
|
-
var APPLY_SLOT_METADATA_KEY = Symbol.for("simple-web-component:apply-slot");
|
|
9669
|
-
function applySlot(id, options = { position: "replaceChildrenHtml" }) {
|
|
9670
|
-
return (targetObj, propertyKey, descriptor) => {
|
|
9671
|
-
const type = descriptor === void 0 ? "property" : "method";
|
|
9672
|
-
if (type === "property") {
|
|
9673
|
-
Object.defineProperty(targetObj, propertyKey, {
|
|
9674
|
-
get() {
|
|
9675
|
-
const nodeSlot = new NodeSlot(this, `${this._swcId}-${id}`);
|
|
9676
|
-
return nodeSlot;
|
|
9677
|
-
},
|
|
9678
|
-
set(nv) {
|
|
9679
|
-
if (nv) {
|
|
9680
|
-
} else {
|
|
9681
|
-
const nodeSlot = new NodeSlot(this, `${this._swcId}-${id}`);
|
|
9682
|
-
nodeSlot.clear();
|
|
9683
|
-
}
|
|
9684
|
-
},
|
|
9685
|
-
configurable: true,
|
|
9686
|
-
enumerable: true
|
|
9687
|
-
});
|
|
9688
|
-
}
|
|
9689
|
-
const constructor = targetObj.constructor;
|
|
9690
|
-
let metaList = ReflectUtils.getOwnMetadata(APPLY_SLOT_METADATA_KEY, constructor);
|
|
9691
|
-
if (!metaList) {
|
|
9692
|
-
metaList = [];
|
|
9693
|
-
ReflectUtils.defineMetadata(APPLY_SLOT_METADATA_KEY, metaList, constructor);
|
|
9694
|
-
}
|
|
9695
|
-
metaList.push({ propertyKey, id, type, options });
|
|
9696
|
-
if (type === "method") {
|
|
9697
|
-
const original = descriptor.value;
|
|
9698
|
-
descriptor.value = function(...args) {
|
|
9699
|
-
ensureInit(this);
|
|
9700
|
-
const conf = getElementConfig(this);
|
|
9701
|
-
const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
|
|
9702
|
-
const currentDoc = currentWin.document;
|
|
9703
|
-
const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);
|
|
9704
|
-
let res = original.apply(this, args);
|
|
9705
|
-
if (res) {
|
|
9706
|
-
const nodeSlot = new NodeSlot(this, this._swcId);
|
|
9707
|
-
const pos = options.position || "replaceChildrenHtml";
|
|
9708
|
-
const doc = currentWin.document;
|
|
9709
|
-
if (pos === "replaceChildrenHtml") {
|
|
9710
|
-
nodeSlot.replaceChildrenHtml(id, res);
|
|
9711
|
-
} else if (pos === "replaceChildrenText") {
|
|
9712
|
-
nodeSlot.replaceChildrenText(id, res);
|
|
9713
|
-
} else if (pos === "appendHtml") {
|
|
9714
|
-
nodeSlot.appendHtml(id, res);
|
|
9715
|
-
} else if (pos === "appendText") {
|
|
9716
|
-
nodeSlot.appendText(id, res);
|
|
9717
|
-
} else if (pos === "prependHtml") {
|
|
9718
|
-
nodeSlot.prependHtml(id, res);
|
|
9719
|
-
} else if (pos === "prependText") {
|
|
9720
|
-
nodeSlot.prependText(id, res);
|
|
9721
|
-
} else if (pos === "clear") {
|
|
9722
|
-
nodeSlot.clear(id);
|
|
9723
|
-
}
|
|
9724
|
-
}
|
|
9725
|
-
return res;
|
|
9726
|
-
};
|
|
9727
|
-
}
|
|
9728
|
-
};
|
|
9729
|
-
}
|
|
9730
|
-
var findAllApplySlotMetadata = (target) => {
|
|
9731
|
-
const constructor = target instanceof Function ? target : target.constructor;
|
|
9732
|
-
return ReflectUtils.getMetadata(APPLY_SLOT_METADATA_KEY, constructor);
|
|
9733
|
-
};
|
|
9734
|
-
function applySlotClear(id) {
|
|
9735
|
-
return applySlot(id, { position: "clear" });
|
|
9736
|
-
}
|
|
9737
|
-
function applySlotPrependHtml(id) {
|
|
9738
|
-
return applySlot(id, { position: "prependHtml" });
|
|
9739
|
-
}
|
|
9740
|
-
var applySlotPrepend = applySlotPrependHtml;
|
|
9741
|
-
function applySlotPrependText(id) {
|
|
9742
|
-
return applySlot(id, { position: "prependText" });
|
|
9743
|
-
}
|
|
9744
|
-
function applySlotAppendHtml(id) {
|
|
9745
|
-
return applySlot(id, { position: "appendHtml" });
|
|
9746
|
-
}
|
|
9747
|
-
function applySlotAppendText(id) {
|
|
9748
|
-
return applySlot(id, { position: "appendText" });
|
|
9749
|
-
}
|
|
9750
|
-
var applySlotAppend = applySlotAppendHtml;
|
|
9751
|
-
function applySlotReplaceChildrenHtml(id) {
|
|
9752
|
-
return applySlot(id, { position: "replaceChildrenHtml" });
|
|
9753
|
-
}
|
|
9754
|
-
var applySlotReplaceChildren = applySlotReplaceChildrenHtml;
|
|
9755
|
-
function applySlotReplaceChildrenText(id) {
|
|
9756
|
-
return applySlot(id, { position: "replaceChildrenText" });
|
|
9757
|
-
}
|
|
9758
|
-
|
|
9759
9667
|
// src/decorators/state.ts
|
|
9760
9668
|
var STATE_METADATA_KEY = Symbol.for("simple-web-component:state");
|
|
9761
9669
|
function state(nameOrTarget, propertyKey) {
|
|
@@ -9763,7 +9671,6 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
9763
9671
|
let storage = targetObj[stateMetadata.propertyKey];
|
|
9764
9672
|
Object.defineProperty(targetObj, stateMetadata.propertyKey, {
|
|
9765
9673
|
set(nv) {
|
|
9766
|
-
console.log("setState!!", nv);
|
|
9767
9674
|
storage = nv;
|
|
9768
9675
|
const config = getElementConfig(this);
|
|
9769
9676
|
const ea = new ElementApply(this, { id: this._swcId });
|
|
@@ -9845,12 +9752,6 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
9845
9752
|
delete inst[meta.propertyKey];
|
|
9846
9753
|
});
|
|
9847
9754
|
}
|
|
9848
|
-
const slotAllList = findAllApplySlotMetadata(target);
|
|
9849
|
-
if (slotAllList) {
|
|
9850
|
-
slotAllList.filter((it) => it.type === "property").forEach((meta) => {
|
|
9851
|
-
delete inst[meta.propertyKey];
|
|
9852
|
-
});
|
|
9853
|
-
}
|
|
9854
9755
|
const stateAllList = findAllStateMetadata(target);
|
|
9855
9756
|
if (stateAllList) {
|
|
9856
9757
|
stateAllList.forEach((meta) => {
|
|
@@ -10537,56 +10438,42 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10537
10438
|
|
|
10538
10439
|
// src/decorators/applyNode.ts
|
|
10539
10440
|
var APPLY_NODE_METADATA_KEY = Symbol.for("simple-web-component:apply-node");
|
|
10540
|
-
var normalizeNodes = (res, doc) => {
|
|
10541
|
-
const items = Array.isArray(res) ? res : [res];
|
|
10542
|
-
return items.map((it) => {
|
|
10543
|
-
if (it instanceof Node) return it;
|
|
10544
|
-
return doc.createTextNode(it !== void 0 && it !== null ? String(it) : "");
|
|
10545
|
-
});
|
|
10546
|
-
};
|
|
10547
10441
|
var applyToDom = (currentThis, targetEl, res, pos, win, host) => {
|
|
10548
10442
|
if (!targetEl) return;
|
|
10549
10443
|
const doc = win.document;
|
|
10550
10444
|
const hostSet = SwcUtils.getHelperAndHostSet(win, currentThis);
|
|
10551
10445
|
const id = currentThis._swcId;
|
|
10552
|
-
|
|
10553
|
-
|
|
10554
|
-
|
|
10555
|
-
|
|
10556
|
-
|
|
10557
|
-
|
|
10558
|
-
|
|
10559
|
-
}
|
|
10560
|
-
|
|
10561
|
-
if (pos === "innerHtml") {
|
|
10562
|
-
targetEl.innerHTML = res !== void 0 && res !== null ? String(res) : "";
|
|
10563
|
-
return;
|
|
10564
|
-
}
|
|
10565
|
-
if (pos === "innerText") {
|
|
10566
|
-
if (targetEl.innerText !== void 0) {
|
|
10567
|
-
targetEl.innerText = res !== void 0 && res !== null ? String(res) : "";
|
|
10568
|
-
}
|
|
10569
|
-
return;
|
|
10570
|
-
}
|
|
10571
|
-
const stateContext = { ...hostSet };
|
|
10572
|
-
findAllStateMetadata(currentThis).forEach((it) => {
|
|
10573
|
-
stateContext[it.name] = currentThis[it.propertyKey];
|
|
10574
|
-
});
|
|
10575
|
-
new ElementApply(currentThis, { id: currentThis._swcId }).apply({ target: "noInitialized", context: stateContext, bind: currentThis });
|
|
10446
|
+
const nodes = [];
|
|
10447
|
+
if (typeof res === "string" && pos === "innerHtml") {
|
|
10448
|
+
const t = win.document.createElement("template");
|
|
10449
|
+
t.innerHTML = res;
|
|
10450
|
+
nodes.push(...Array.from(t.content.childNodes));
|
|
10451
|
+
} else if (typeof res === "string" && pos === "innerText") {
|
|
10452
|
+
nodes.push(win.document.createTextNode(res));
|
|
10453
|
+
}
|
|
10454
|
+
SwcUtils.projectProcessHtml(id, nodes, doc);
|
|
10576
10455
|
const isShadowRoot = targetEl instanceof win.ShadowRoot;
|
|
10577
|
-
const nodes = normalizeNodes(res, doc);
|
|
10578
10456
|
if (pos === "replace") {
|
|
10579
10457
|
if (!isShadowRoot) targetEl.replaceWith(...nodes);
|
|
10458
|
+
} else if (pos === "innerHtml") {
|
|
10459
|
+
targetEl.replaceChildren(...nodes);
|
|
10460
|
+
} else if (pos === "innerText") {
|
|
10461
|
+
targetEl.replaceChildren(...nodes);
|
|
10580
10462
|
} else if (pos === "replaceChildren") {
|
|
10581
10463
|
targetEl.replaceChildren(...nodes);
|
|
10582
10464
|
} else {
|
|
10583
10465
|
if (pos === "beforeEnd") {
|
|
10584
|
-
console.log("tarbbbbbbbbbbbbbb");
|
|
10585
10466
|
targetEl.append(...nodes);
|
|
10586
10467
|
} else if (pos === "afterBegin") targetEl.prepend(...nodes);
|
|
10587
10468
|
else if (pos === "beforeBegin" && !isShadowRoot) targetEl.before(...nodes);
|
|
10588
10469
|
else if (pos === "afterEnd" && !isShadowRoot) targetEl.after(...nodes);
|
|
10589
10470
|
}
|
|
10471
|
+
const stateContext = { ...hostSet };
|
|
10472
|
+
findAllStateMetadata(currentThis).forEach((it) => {
|
|
10473
|
+
stateContext[it.name] = currentThis[it.propertyKey];
|
|
10474
|
+
});
|
|
10475
|
+
new ElementApply(targetEl, { id }).apply({ target: "noInitialized", context: stateContext, bind: currentThis });
|
|
10476
|
+
return nodes;
|
|
10590
10477
|
};
|
|
10591
10478
|
function applyNode(selector, options = { position: "replaceChildren" }) {
|
|
10592
10479
|
return (targetObj, propertyKey, descriptor) => {
|
|
@@ -10633,13 +10520,14 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10633
10520
|
applyToDom(this, target, processedVal, pos, currentWin);
|
|
10634
10521
|
}
|
|
10635
10522
|
};
|
|
10523
|
+
const fallbackNodes = [];
|
|
10524
|
+
if (targetEl && options.fallback) {
|
|
10525
|
+
const loadingRes = options.fallback.call(this, hostSet);
|
|
10526
|
+
fallbackNodes.push(...applyToDom(this, targetEl, loadingRes, options.position || "beforeEnd", currentWin));
|
|
10527
|
+
}
|
|
10636
10528
|
if (res instanceof Promise) {
|
|
10637
|
-
if (targetEl && options.fallback) {
|
|
10638
|
-
const loadingRes = options.fallback.call(this, hostSet);
|
|
10639
|
-
applyToDom(this, targetEl, loadingRes, options.position || "beforeEnd", currentWin);
|
|
10640
|
-
}
|
|
10641
10529
|
return res.then((finalRes) => {
|
|
10642
|
-
|
|
10530
|
+
fallbackNodes.forEach((it) => it.remove());
|
|
10643
10531
|
if (finalRes !== void 0 && targetEl) runApply(targetEl, finalRes);
|
|
10644
10532
|
return finalRes;
|
|
10645
10533
|
});
|
|
@@ -10708,7 +10596,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
10708
10596
|
const opt = targetOrOptions || {};
|
|
10709
10597
|
return applyNode("$this", { ...opt, ...option });
|
|
10710
10598
|
}
|
|
10711
|
-
function
|
|
10599
|
+
function applyNodeThisInnerHtml(targetOrOptions, propertyKey, descriptor) {
|
|
10712
10600
|
const option = { position: "innerHtml" };
|
|
10713
10601
|
if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
|
|
10714
10602
|
const opt = targetOrOptions || {};
|
|
@@ -11204,6 +11092,103 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
11204
11092
|
return ReflectUtils.getOwnMetadata(PUBLISH_SWC_APP_MESSAGE_METADATA_KEY, constructor);
|
|
11205
11093
|
};
|
|
11206
11094
|
|
|
11095
|
+
// src/decorators/applySlot.ts
|
|
11096
|
+
var APPLY_SLOT_METADATA_KEY = Symbol.for("simple-web-component:apply-slot");
|
|
11097
|
+
var applyToDom2 = (swcId, id, pos, nodes) => {
|
|
11098
|
+
const nodeSlot = new NodeSlot(void 0, swcId);
|
|
11099
|
+
if (pos === "replaceChildrenText" || pos === "replaceChildren" || pos === "replaceChildrenHtml") {
|
|
11100
|
+
nodeSlot.replaceChildren(id, ...nodes);
|
|
11101
|
+
} else if (pos === "appendHtml" || pos === "append" || pos === "appendText") {
|
|
11102
|
+
nodeSlot.append(id, ...nodes);
|
|
11103
|
+
} else if (pos === "prependHtml" || pos === "prepend" || pos === "prependText") {
|
|
11104
|
+
nodeSlot.prepend(id, ...nodes);
|
|
11105
|
+
} else if (pos === "clear") {
|
|
11106
|
+
nodeSlot.clear(id);
|
|
11107
|
+
}
|
|
11108
|
+
};
|
|
11109
|
+
function applySlot(targetId, opt) {
|
|
11110
|
+
return (targetObj, propertyKey, descriptor) => {
|
|
11111
|
+
const options = { position: "replaceChildrenHtml", ...opt };
|
|
11112
|
+
const constructor = targetObj.constructor;
|
|
11113
|
+
let metaList = ReflectUtils.getOwnMetadata(APPLY_SLOT_METADATA_KEY, constructor);
|
|
11114
|
+
if (!metaList) {
|
|
11115
|
+
metaList = [];
|
|
11116
|
+
ReflectUtils.defineMetadata(APPLY_SLOT_METADATA_KEY, metaList, constructor);
|
|
11117
|
+
}
|
|
11118
|
+
metaList.push({ propertyKey, targetId, options });
|
|
11119
|
+
const original = descriptor.value;
|
|
11120
|
+
descriptor.value = function(...args) {
|
|
11121
|
+
ensureInit(this);
|
|
11122
|
+
const conf = getElementConfig(this);
|
|
11123
|
+
const currentWin = conf.window;
|
|
11124
|
+
const swcId = this._swcId;
|
|
11125
|
+
const currentDoc = currentWin.document;
|
|
11126
|
+
const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);
|
|
11127
|
+
const pos = options.position;
|
|
11128
|
+
const resToNodes = (res2) => {
|
|
11129
|
+
const nodes = [];
|
|
11130
|
+
if (typeof res2 === "string" && (pos === "replaceChildrenHtml" || pos === "appendHtml" || pos === "prependHtml")) {
|
|
11131
|
+
const t = currentWin.document.createElement("template");
|
|
11132
|
+
t.innerHTML = res2;
|
|
11133
|
+
nodes.push(...Array.from(t.content.childNodes));
|
|
11134
|
+
} else if (typeof res2 === "string" && (pos === "replaceChildrenText" || pos === "prependText" || pos === "appendText")) {
|
|
11135
|
+
nodes.push(currentWin.document.createTextNode(res2));
|
|
11136
|
+
} else if (typeof res2 === "object") {
|
|
11137
|
+
nodes.push(res2);
|
|
11138
|
+
}
|
|
11139
|
+
SwcUtils.projectProcessHtml(swcId, nodes, currentDoc);
|
|
11140
|
+
return nodes;
|
|
11141
|
+
};
|
|
11142
|
+
const fallbackNodes = [];
|
|
11143
|
+
if (options.fallback) {
|
|
11144
|
+
const res2 = options.fallback.call(this, hostSet);
|
|
11145
|
+
const nodes = resToNodes(res2);
|
|
11146
|
+
fallbackNodes.push(...nodes);
|
|
11147
|
+
applyToDom2(swcId, targetId, options.position, nodes);
|
|
11148
|
+
}
|
|
11149
|
+
let res = original.apply(this, args);
|
|
11150
|
+
if (res instanceof Promise) {
|
|
11151
|
+
return res.then((asyncRes) => {
|
|
11152
|
+
const nodes = resToNodes(asyncRes);
|
|
11153
|
+
fallbackNodes.forEach((it) => it.remove());
|
|
11154
|
+
applyToDom2(swcId, targetId, options.position, nodes);
|
|
11155
|
+
});
|
|
11156
|
+
} else {
|
|
11157
|
+
const nodes = resToNodes(res);
|
|
11158
|
+
applyToDom2(swcId, targetId, options.position, nodes);
|
|
11159
|
+
}
|
|
11160
|
+
};
|
|
11161
|
+
};
|
|
11162
|
+
}
|
|
11163
|
+
var findAllApplySlotMetadata = (target) => {
|
|
11164
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
11165
|
+
return ReflectUtils.getMetadata(APPLY_SLOT_METADATA_KEY, constructor);
|
|
11166
|
+
};
|
|
11167
|
+
function applySlotClear(targetId) {
|
|
11168
|
+
return applySlot(targetId, { position: "clear" });
|
|
11169
|
+
}
|
|
11170
|
+
function applySlotPrependHtml(targetId) {
|
|
11171
|
+
return applySlot(targetId, { position: "prependHtml" });
|
|
11172
|
+
}
|
|
11173
|
+
var applySlotPrepend = applySlotPrependHtml;
|
|
11174
|
+
function applySlotPrependText(targetId) {
|
|
11175
|
+
return applySlot(targetId, { position: "prependText" });
|
|
11176
|
+
}
|
|
11177
|
+
function applySlotAppendHtml(targetId) {
|
|
11178
|
+
return applySlot(targetId, { position: "appendHtml" });
|
|
11179
|
+
}
|
|
11180
|
+
function applySlotAppendText(targetId) {
|
|
11181
|
+
return applySlot(targetId, { position: "appendText" });
|
|
11182
|
+
}
|
|
11183
|
+
var applySlotAppend = applySlotAppendHtml;
|
|
11184
|
+
function applySlotReplaceChildrenHtml(targetId) {
|
|
11185
|
+
return applySlot(targetId, { position: "replaceChildrenHtml" });
|
|
11186
|
+
}
|
|
11187
|
+
var applySlotReplaceChildren = applySlotReplaceChildrenHtml;
|
|
11188
|
+
function applySlotReplaceChildrenText(targetId) {
|
|
11189
|
+
return applySlot(targetId, { position: "replaceChildrenText" });
|
|
11190
|
+
}
|
|
11191
|
+
|
|
11207
11192
|
// ../simple-boot/dist/esm/index.js
|
|
11208
11193
|
var import_reflect_metadata = __toESM(require_Reflect(), 1);
|
|
11209
11194
|
|