@dooboostore/simple-web-component 1.0.18 → 1.0.21
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 +2065 -164
- package/dist/cjs/config/config.js +2 -0
- package/dist/cjs/config/config.js.map +2 -2
- package/dist/cjs/decorators/addEventListener.js +8 -8
- package/dist/cjs/decorators/addEventListener.js.map +2 -2
- package/dist/cjs/decorators/appendChild.js +53 -9
- package/dist/cjs/decorators/appendChild.js.map +2 -2
- package/dist/cjs/decorators/attribute.js +141 -0
- package/dist/cjs/decorators/attribute.js.map +7 -0
- package/dist/cjs/decorators/changedAttribute.js +5 -5
- package/dist/cjs/decorators/changedAttribute.js.map +2 -2
- package/dist/cjs/decorators/classList.js +104 -0
- package/dist/cjs/decorators/classList.js.map +7 -0
- package/dist/cjs/decorators/elementDefine.js +334 -425
- package/dist/cjs/decorators/elementDefine.js.map +3 -3
- package/dist/cjs/decorators/emitCustomEvent.js +65 -13
- package/dist/cjs/decorators/emitCustomEvent.js.map +2 -2
- package/dist/cjs/decorators/index.js +4 -0
- package/dist/cjs/decorators/index.js.map +2 -2
- package/dist/cjs/decorators/lifecycles.js +4 -4
- package/dist/cjs/decorators/lifecycles.js.map +2 -2
- package/dist/cjs/decorators/onConnectedInnerHtml.js +4 -4
- package/dist/cjs/decorators/onConnectedInnerHtml.js.map +2 -2
- package/dist/cjs/decorators/query.js +60 -36
- package/dist/cjs/decorators/query.js.map +2 -2
- package/dist/cjs/decorators/queryAll.js +47 -23
- package/dist/cjs/decorators/queryAll.js.map +2 -2
- package/dist/cjs/decorators/replaceChildren.js +32 -6
- package/dist/cjs/decorators/replaceChildren.js.map +2 -2
- package/dist/cjs/decorators/setAttribute.js +64 -10
- package/dist/cjs/decorators/setAttribute.js.map +2 -2
- package/dist/cjs/decorators/style.js +88 -0
- package/dist/cjs/decorators/style.js.map +7 -0
- package/dist/cjs/elements/SwcAppEngine.js +30 -15
- package/dist/cjs/elements/SwcAppEngine.js.map +3 -3
- package/dist/cjs/elements/SwcAppMixin.js +79 -0
- package/dist/cjs/elements/SwcAppMixin.js.map +7 -0
- package/dist/cjs/elements/SwcAsync.js +58 -123
- package/dist/cjs/elements/SwcAsync.js.map +3 -3
- package/dist/cjs/elements/SwcChoose.js +52 -76
- package/dist/cjs/elements/SwcChoose.js.map +3 -3
- package/dist/cjs/elements/SwcIf.js +66 -94
- package/dist/cjs/elements/SwcIf.js.map +3 -3
- package/dist/cjs/elements/SwcLoop.js +73 -174
- package/dist/cjs/elements/SwcLoop.js.map +3 -3
- package/dist/cjs/elements/SwcSubTemplates.js +12 -37
- package/dist/cjs/elements/SwcSubTemplates.js.map +3 -3
- package/dist/cjs/elements/index.js +1 -8
- package/dist/cjs/elements/index.js.map +2 -2
- package/dist/cjs/elements/register.js +831 -0
- package/dist/cjs/elements/register.js.map +7 -0
- package/dist/cjs/index.js +14 -3
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/router/ElementRouter.js +7 -7
- package/dist/cjs/router/ElementRouter.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/utils/TemplateUtils.js +103 -0
- package/dist/cjs/utils/TemplateUtils.js.map +7 -0
- package/dist/cjs/utils/Utils.js +10 -7
- package/dist/cjs/utils/Utils.js.map +2 -2
- package/dist/esm/config/config.js +2 -0
- package/dist/esm/config/config.js.map +2 -2
- package/dist/esm/decorators/addEventListener.js +5 -5
- package/dist/esm/decorators/addEventListener.js.map +2 -2
- package/dist/esm/decorators/appendChild.js +52 -8
- package/dist/esm/decorators/appendChild.js.map +2 -2
- package/dist/esm/decorators/attribute.js +122 -0
- package/dist/esm/decorators/attribute.js.map +7 -0
- package/dist/esm/decorators/changedAttribute.js +1 -1
- package/dist/esm/decorators/changedAttribute.js.map +1 -1
- package/dist/esm/decorators/classList.js +85 -0
- package/dist/esm/decorators/classList.js.map +7 -0
- package/dist/esm/decorators/elementDefine.js +334 -425
- package/dist/esm/decorators/elementDefine.js.map +3 -3
- package/dist/esm/decorators/emitCustomEvent.js +62 -10
- package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
- package/dist/esm/decorators/index.js +4 -0
- package/dist/esm/decorators/index.js.map +2 -2
- package/dist/esm/decorators/lifecycles.js +1 -1
- package/dist/esm/decorators/lifecycles.js.map +1 -1
- package/dist/esm/decorators/onConnectedInnerHtml.js +1 -1
- package/dist/esm/decorators/onConnectedInnerHtml.js.map +1 -1
- package/dist/esm/decorators/query.js +58 -34
- package/dist/esm/decorators/query.js.map +2 -2
- package/dist/esm/decorators/queryAll.js +45 -21
- package/dist/esm/decorators/queryAll.js.map +2 -2
- package/dist/esm/decorators/replaceChildren.js +28 -2
- package/dist/esm/decorators/replaceChildren.js.map +2 -2
- package/dist/esm/decorators/setAttribute.js +62 -8
- package/dist/esm/decorators/setAttribute.js.map +2 -2
- package/dist/esm/decorators/style.js +69 -0
- package/dist/esm/decorators/style.js.map +7 -0
- package/dist/esm/elements/SwcAppEngine.js +27 -12
- package/dist/esm/elements/SwcAppEngine.js.map +2 -2
- package/dist/esm/elements/SwcAppMixin.js +60 -0
- package/dist/esm/elements/SwcAppMixin.js.map +7 -0
- package/dist/esm/elements/SwcAsync.js +58 -123
- package/dist/esm/elements/SwcAsync.js.map +3 -3
- package/dist/esm/elements/SwcChoose.js +52 -76
- package/dist/esm/elements/SwcChoose.js.map +3 -3
- package/dist/esm/elements/SwcIf.js +66 -94
- package/dist/esm/elements/SwcIf.js.map +3 -3
- package/dist/esm/elements/SwcLoop.js +72 -173
- package/dist/esm/elements/SwcLoop.js.map +3 -3
- package/dist/esm/elements/SwcSubTemplates.js +12 -37
- package/dist/esm/elements/SwcSubTemplates.js.map +3 -3
- package/dist/esm/elements/index.js +1 -8
- package/dist/esm/elements/index.js.map +2 -2
- package/dist/esm/elements/register.js +812 -0
- package/dist/esm/elements/register.js.map +7 -0
- package/dist/esm/index.js +14 -3
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/router/ElementRouter.js +2 -2
- package/dist/esm/router/ElementRouter.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils/TemplateUtils.js +84 -0
- package/dist/esm/utils/TemplateUtils.js.map +7 -0
- package/dist/esm/utils/Utils.js +6 -3
- package/dist/esm/utils/Utils.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +4910 -7463
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
- package/dist/types/config/config.d.ts +1 -0
- package/dist/types/config/config.d.ts.map +1 -1
- package/dist/types/decorators/addEventListener.d.ts +11 -11
- package/dist/types/decorators/addEventListener.d.ts.map +1 -1
- package/dist/types/decorators/appendChild.d.ts +1 -1
- package/dist/types/decorators/appendChild.d.ts.map +1 -1
- package/dist/types/decorators/attribute.d.ts +23 -0
- package/dist/types/decorators/attribute.d.ts.map +1 -0
- package/dist/types/decorators/classList.d.ts +34 -0
- package/dist/types/decorators/classList.d.ts.map +1 -0
- package/dist/types/decorators/elementDefine.d.ts +9 -5
- package/dist/types/decorators/elementDefine.d.ts.map +1 -1
- package/dist/types/decorators/emitCustomEvent.d.ts +7 -4
- package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
- package/dist/types/decorators/index.d.ts +4 -0
- package/dist/types/decorators/index.d.ts.map +1 -1
- package/dist/types/decorators/query.d.ts +7 -8
- package/dist/types/decorators/query.d.ts.map +1 -1
- package/dist/types/decorators/queryAll.d.ts +5 -9
- package/dist/types/decorators/queryAll.d.ts.map +1 -1
- package/dist/types/decorators/replaceChildren.d.ts.map +1 -1
- package/dist/types/decorators/setAttribute.d.ts +16 -3
- package/dist/types/decorators/setAttribute.d.ts.map +1 -1
- package/dist/types/decorators/style.d.ts +24 -0
- package/dist/types/decorators/style.d.ts.map +1 -0
- package/dist/types/elements/SwcAppEngine.d.ts +6 -5
- package/dist/types/elements/SwcAppEngine.d.ts.map +1 -1
- package/dist/types/elements/SwcAppMixin.d.ts +364 -0
- package/dist/types/elements/SwcAppMixin.d.ts.map +1 -0
- package/dist/types/elements/SwcAsync.d.ts +2 -6
- package/dist/types/elements/SwcAsync.d.ts.map +1 -1
- package/dist/types/elements/SwcChoose.d.ts +2 -1
- package/dist/types/elements/SwcChoose.d.ts.map +1 -1
- package/dist/types/elements/SwcIf.d.ts +5 -6
- package/dist/types/elements/SwcIf.d.ts.map +1 -1
- package/dist/types/elements/SwcLoop.d.ts +4 -10
- package/dist/types/elements/SwcLoop.d.ts.map +1 -1
- package/dist/types/elements/SwcSubTemplates.d.ts.map +1 -1
- package/dist/types/elements/index.d.ts +1 -8
- package/dist/types/elements/index.d.ts.map +1 -1
- package/dist/types/elements/register.d.ts +2 -0
- package/dist/types/elements/register.d.ts.map +1 -0
- package/dist/types/index.d.ts +8 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/router/ElementRouter.d.ts +1 -1
- package/dist/types/router/ElementRouter.d.ts.map +1 -1
- package/dist/types/types.d.ts +8 -2
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/TemplateUtils.d.ts +54 -0
- package/dist/types/utils/TemplateUtils.d.ts.map +1 -0
- package/dist/types/utils/Utils.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +4910 -7463
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +11 -6
- package/src/config/config.ts +2 -0
- package/src/decorators/addEventListener.ts +13 -12
- package/src/decorators/appendChild.ts +53 -9
- package/src/decorators/attribute.ts +158 -0
- package/src/decorators/changedAttribute.ts +1 -1
- package/src/decorators/classList.ts +117 -0
- package/src/decorators/elementDefine.ts +371 -425
- package/src/decorators/emitCustomEvent.ts +77 -13
- package/src/decorators/index.ts +4 -0
- package/src/decorators/lifecycles.ts +1 -1
- package/src/decorators/onConnectedInnerHtml.ts +1 -1
- package/src/decorators/query.ts +58 -38
- package/src/decorators/queryAll.ts +45 -29
- package/src/decorators/replaceChildren.ts +31 -2
- package/src/decorators/setAttribute.ts +86 -12
- package/src/decorators/style.ts +89 -0
- package/src/elements/SwcAppEngine.ts +34 -18
- package/src/elements/SwcAppMixin.ts +65 -0
- package/src/elements/SwcAsync.ts +58 -128
- package/src/elements/SwcChoose.ts +51 -77
- package/src/elements/SwcIf.ts +64 -86
- package/src/elements/SwcLoop.ts +71 -168
- package/src/elements/SwcSubTemplates.ts +0 -13
- package/src/elements/index.ts +1 -8
- package/src/elements/register.ts +735 -0
- package/src/index.ts +17 -5
- package/src/router/ElementRouter.ts +2 -2
- package/src/types.ts +15 -6
- package/src/utils/TemplateUtils.ts +83 -0
- package/src/utils/Utils.ts +6 -3
- package/dist/cjs/elements/SwcApp.js +0 -55
- package/dist/cjs/elements/SwcApp.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppAnchor.js +0 -55
- package/dist/cjs/elements/is/SwcAppAnchor.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppArea.js +0 -55
- package/dist/cjs/elements/is/SwcAppArea.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppAudio.js +0 -55
- package/dist/cjs/elements/is/SwcAppAudio.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppBase.js +0 -55
- package/dist/cjs/elements/is/SwcAppBase.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppBody.js +0 -55
- package/dist/cjs/elements/is/SwcAppBody.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppButton.js +0 -55
- package/dist/cjs/elements/is/SwcAppButton.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppCanvas.js +0 -55
- package/dist/cjs/elements/is/SwcAppCanvas.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppData.js +0 -55
- package/dist/cjs/elements/is/SwcAppData.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppDataList.js +0 -55
- package/dist/cjs/elements/is/SwcAppDataList.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppDetails.js +0 -55
- package/dist/cjs/elements/is/SwcAppDetails.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppDialog.js +0 -55
- package/dist/cjs/elements/is/SwcAppDialog.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppDiv.js +0 -55
- package/dist/cjs/elements/is/SwcAppDiv.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppDl.js +0 -55
- package/dist/cjs/elements/is/SwcAppDl.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppEmbed.js +0 -55
- package/dist/cjs/elements/is/SwcAppEmbed.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppFieldSet.js +0 -55
- package/dist/cjs/elements/is/SwcAppFieldSet.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppForm.js +0 -55
- package/dist/cjs/elements/is/SwcAppForm.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppHeading.js +0 -55
- package/dist/cjs/elements/is/SwcAppHeading.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppHr.js +0 -55
- package/dist/cjs/elements/is/SwcAppHr.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppIFrame.js +0 -55
- package/dist/cjs/elements/is/SwcAppIFrame.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppImage.js +0 -55
- package/dist/cjs/elements/is/SwcAppImage.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppInput.js +0 -55
- package/dist/cjs/elements/is/SwcAppInput.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppLabel.js +0 -55
- package/dist/cjs/elements/is/SwcAppLabel.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppLegend.js +0 -55
- package/dist/cjs/elements/is/SwcAppLegend.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppLi.js +0 -55
- package/dist/cjs/elements/is/SwcAppLi.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppLink.js +0 -55
- package/dist/cjs/elements/is/SwcAppLink.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppMap.js +0 -55
- package/dist/cjs/elements/is/SwcAppMap.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppMeta.js +0 -55
- package/dist/cjs/elements/is/SwcAppMeta.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppMeter.js +0 -55
- package/dist/cjs/elements/is/SwcAppMeter.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppMod.js +0 -55
- package/dist/cjs/elements/is/SwcAppMod.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppObject.js +0 -55
- package/dist/cjs/elements/is/SwcAppObject.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppOl.js +0 -55
- package/dist/cjs/elements/is/SwcAppOl.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppOptGroup.js +0 -55
- package/dist/cjs/elements/is/SwcAppOptGroup.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppOption.js +0 -55
- package/dist/cjs/elements/is/SwcAppOption.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppOutput.js +0 -55
- package/dist/cjs/elements/is/SwcAppOutput.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppParagraph.js +0 -55
- package/dist/cjs/elements/is/SwcAppParagraph.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppParam.js +0 -55
- package/dist/cjs/elements/is/SwcAppParam.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppPicture.js +0 -55
- package/dist/cjs/elements/is/SwcAppPicture.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppPre.js +0 -55
- package/dist/cjs/elements/is/SwcAppPre.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppProgress.js +0 -55
- package/dist/cjs/elements/is/SwcAppProgress.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppQuote.js +0 -55
- package/dist/cjs/elements/is/SwcAppQuote.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppScript.js +0 -55
- package/dist/cjs/elements/is/SwcAppScript.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppSelect.js +0 -55
- package/dist/cjs/elements/is/SwcAppSelect.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppSlot.js +0 -55
- package/dist/cjs/elements/is/SwcAppSlot.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppSource.js +0 -55
- package/dist/cjs/elements/is/SwcAppSource.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppSpan.js +0 -55
- package/dist/cjs/elements/is/SwcAppSpan.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppStyle.js +0 -55
- package/dist/cjs/elements/is/SwcAppStyle.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppTable.js +0 -55
- package/dist/cjs/elements/is/SwcAppTable.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppTableCell.js +0 -55
- package/dist/cjs/elements/is/SwcAppTableCell.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppTableRow.js +0 -55
- package/dist/cjs/elements/is/SwcAppTableRow.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppTableSection.js +0 -55
- package/dist/cjs/elements/is/SwcAppTableSection.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppTemplate.js +0 -55
- package/dist/cjs/elements/is/SwcAppTemplate.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppTextArea.js +0 -55
- package/dist/cjs/elements/is/SwcAppTextArea.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppTime.js +0 -55
- package/dist/cjs/elements/is/SwcAppTime.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppTitle.js +0 -55
- package/dist/cjs/elements/is/SwcAppTitle.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppTrack.js +0 -55
- package/dist/cjs/elements/is/SwcAppTrack.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppUl.js +0 -55
- package/dist/cjs/elements/is/SwcAppUl.js.map +0 -7
- package/dist/cjs/elements/is/SwcAppVideo.js +0 -55
- package/dist/cjs/elements/is/SwcAppVideo.js.map +0 -7
- package/dist/cjs/elements/is/index.js +0 -74
- package/dist/cjs/elements/is/index.js.map +0 -7
- package/dist/esm/elements/SwcApp.js +0 -36
- package/dist/esm/elements/SwcApp.js.map +0 -7
- package/dist/esm/elements/is/SwcAppAnchor.js +0 -36
- package/dist/esm/elements/is/SwcAppAnchor.js.map +0 -7
- package/dist/esm/elements/is/SwcAppArea.js +0 -36
- package/dist/esm/elements/is/SwcAppArea.js.map +0 -7
- package/dist/esm/elements/is/SwcAppAudio.js +0 -36
- package/dist/esm/elements/is/SwcAppAudio.js.map +0 -7
- package/dist/esm/elements/is/SwcAppBase.js +0 -36
- package/dist/esm/elements/is/SwcAppBase.js.map +0 -7
- package/dist/esm/elements/is/SwcAppBody.js +0 -36
- package/dist/esm/elements/is/SwcAppBody.js.map +0 -7
- package/dist/esm/elements/is/SwcAppButton.js +0 -36
- package/dist/esm/elements/is/SwcAppButton.js.map +0 -7
- package/dist/esm/elements/is/SwcAppCanvas.js +0 -36
- package/dist/esm/elements/is/SwcAppCanvas.js.map +0 -7
- package/dist/esm/elements/is/SwcAppData.js +0 -36
- package/dist/esm/elements/is/SwcAppData.js.map +0 -7
- package/dist/esm/elements/is/SwcAppDataList.js +0 -36
- package/dist/esm/elements/is/SwcAppDataList.js.map +0 -7
- package/dist/esm/elements/is/SwcAppDetails.js +0 -36
- package/dist/esm/elements/is/SwcAppDetails.js.map +0 -7
- package/dist/esm/elements/is/SwcAppDialog.js +0 -36
- package/dist/esm/elements/is/SwcAppDialog.js.map +0 -7
- package/dist/esm/elements/is/SwcAppDiv.js +0 -36
- package/dist/esm/elements/is/SwcAppDiv.js.map +0 -7
- package/dist/esm/elements/is/SwcAppDl.js +0 -36
- package/dist/esm/elements/is/SwcAppDl.js.map +0 -7
- package/dist/esm/elements/is/SwcAppEmbed.js +0 -36
- package/dist/esm/elements/is/SwcAppEmbed.js.map +0 -7
- package/dist/esm/elements/is/SwcAppFieldSet.js +0 -36
- package/dist/esm/elements/is/SwcAppFieldSet.js.map +0 -7
- package/dist/esm/elements/is/SwcAppForm.js +0 -36
- package/dist/esm/elements/is/SwcAppForm.js.map +0 -7
- package/dist/esm/elements/is/SwcAppHeading.js +0 -36
- package/dist/esm/elements/is/SwcAppHeading.js.map +0 -7
- package/dist/esm/elements/is/SwcAppHr.js +0 -36
- package/dist/esm/elements/is/SwcAppHr.js.map +0 -7
- package/dist/esm/elements/is/SwcAppIFrame.js +0 -36
- package/dist/esm/elements/is/SwcAppIFrame.js.map +0 -7
- package/dist/esm/elements/is/SwcAppImage.js +0 -36
- package/dist/esm/elements/is/SwcAppImage.js.map +0 -7
- package/dist/esm/elements/is/SwcAppInput.js +0 -36
- package/dist/esm/elements/is/SwcAppInput.js.map +0 -7
- package/dist/esm/elements/is/SwcAppLabel.js +0 -36
- package/dist/esm/elements/is/SwcAppLabel.js.map +0 -7
- package/dist/esm/elements/is/SwcAppLegend.js +0 -36
- package/dist/esm/elements/is/SwcAppLegend.js.map +0 -7
- package/dist/esm/elements/is/SwcAppLi.js +0 -36
- package/dist/esm/elements/is/SwcAppLi.js.map +0 -7
- package/dist/esm/elements/is/SwcAppLink.js +0 -36
- package/dist/esm/elements/is/SwcAppLink.js.map +0 -7
- package/dist/esm/elements/is/SwcAppMap.js +0 -36
- package/dist/esm/elements/is/SwcAppMap.js.map +0 -7
- package/dist/esm/elements/is/SwcAppMeta.js +0 -36
- package/dist/esm/elements/is/SwcAppMeta.js.map +0 -7
- package/dist/esm/elements/is/SwcAppMeter.js +0 -36
- package/dist/esm/elements/is/SwcAppMeter.js.map +0 -7
- package/dist/esm/elements/is/SwcAppMod.js +0 -36
- package/dist/esm/elements/is/SwcAppMod.js.map +0 -7
- package/dist/esm/elements/is/SwcAppObject.js +0 -36
- package/dist/esm/elements/is/SwcAppObject.js.map +0 -7
- package/dist/esm/elements/is/SwcAppOl.js +0 -36
- package/dist/esm/elements/is/SwcAppOl.js.map +0 -7
- package/dist/esm/elements/is/SwcAppOptGroup.js +0 -36
- package/dist/esm/elements/is/SwcAppOptGroup.js.map +0 -7
- package/dist/esm/elements/is/SwcAppOption.js +0 -36
- package/dist/esm/elements/is/SwcAppOption.js.map +0 -7
- package/dist/esm/elements/is/SwcAppOutput.js +0 -36
- package/dist/esm/elements/is/SwcAppOutput.js.map +0 -7
- package/dist/esm/elements/is/SwcAppParagraph.js +0 -36
- package/dist/esm/elements/is/SwcAppParagraph.js.map +0 -7
- package/dist/esm/elements/is/SwcAppParam.js +0 -36
- package/dist/esm/elements/is/SwcAppParam.js.map +0 -7
- package/dist/esm/elements/is/SwcAppPicture.js +0 -36
- package/dist/esm/elements/is/SwcAppPicture.js.map +0 -7
- package/dist/esm/elements/is/SwcAppPre.js +0 -36
- package/dist/esm/elements/is/SwcAppPre.js.map +0 -7
- package/dist/esm/elements/is/SwcAppProgress.js +0 -36
- package/dist/esm/elements/is/SwcAppProgress.js.map +0 -7
- package/dist/esm/elements/is/SwcAppQuote.js +0 -36
- package/dist/esm/elements/is/SwcAppQuote.js.map +0 -7
- package/dist/esm/elements/is/SwcAppScript.js +0 -36
- package/dist/esm/elements/is/SwcAppScript.js.map +0 -7
- package/dist/esm/elements/is/SwcAppSelect.js +0 -36
- package/dist/esm/elements/is/SwcAppSelect.js.map +0 -7
- package/dist/esm/elements/is/SwcAppSlot.js +0 -36
- package/dist/esm/elements/is/SwcAppSlot.js.map +0 -7
- package/dist/esm/elements/is/SwcAppSource.js +0 -36
- package/dist/esm/elements/is/SwcAppSource.js.map +0 -7
- package/dist/esm/elements/is/SwcAppSpan.js +0 -36
- package/dist/esm/elements/is/SwcAppSpan.js.map +0 -7
- package/dist/esm/elements/is/SwcAppStyle.js +0 -36
- package/dist/esm/elements/is/SwcAppStyle.js.map +0 -7
- package/dist/esm/elements/is/SwcAppTable.js +0 -36
- package/dist/esm/elements/is/SwcAppTable.js.map +0 -7
- package/dist/esm/elements/is/SwcAppTableCell.js +0 -36
- package/dist/esm/elements/is/SwcAppTableCell.js.map +0 -7
- package/dist/esm/elements/is/SwcAppTableRow.js +0 -36
- package/dist/esm/elements/is/SwcAppTableRow.js.map +0 -7
- package/dist/esm/elements/is/SwcAppTableSection.js +0 -36
- package/dist/esm/elements/is/SwcAppTableSection.js.map +0 -7
- package/dist/esm/elements/is/SwcAppTemplate.js +0 -36
- package/dist/esm/elements/is/SwcAppTemplate.js.map +0 -7
- package/dist/esm/elements/is/SwcAppTextArea.js +0 -36
- package/dist/esm/elements/is/SwcAppTextArea.js.map +0 -7
- package/dist/esm/elements/is/SwcAppTime.js +0 -36
- package/dist/esm/elements/is/SwcAppTime.js.map +0 -7
- package/dist/esm/elements/is/SwcAppTitle.js +0 -36
- package/dist/esm/elements/is/SwcAppTitle.js.map +0 -7
- package/dist/esm/elements/is/SwcAppTrack.js +0 -36
- package/dist/esm/elements/is/SwcAppTrack.js.map +0 -7
- package/dist/esm/elements/is/SwcAppUl.js +0 -36
- package/dist/esm/elements/is/SwcAppUl.js.map +0 -7
- package/dist/esm/elements/is/SwcAppVideo.js +0 -36
- package/dist/esm/elements/is/SwcAppVideo.js.map +0 -7
- package/dist/esm/elements/is/index.js +0 -58
- package/dist/esm/elements/is/index.js.map +0 -7
- package/dist/types/elements/SwcApp.d.ts +0 -9
- package/dist/types/elements/SwcApp.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppAnchor.d.ts +0 -9
- package/dist/types/elements/is/SwcAppAnchor.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppArea.d.ts +0 -9
- package/dist/types/elements/is/SwcAppArea.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppAudio.d.ts +0 -9
- package/dist/types/elements/is/SwcAppAudio.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppBase.d.ts +0 -9
- package/dist/types/elements/is/SwcAppBase.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppBody.d.ts +0 -9
- package/dist/types/elements/is/SwcAppBody.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppButton.d.ts +0 -9
- package/dist/types/elements/is/SwcAppButton.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppCanvas.d.ts +0 -9
- package/dist/types/elements/is/SwcAppCanvas.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppData.d.ts +0 -9
- package/dist/types/elements/is/SwcAppData.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppDataList.d.ts +0 -9
- package/dist/types/elements/is/SwcAppDataList.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppDetails.d.ts +0 -9
- package/dist/types/elements/is/SwcAppDetails.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppDialog.d.ts +0 -9
- package/dist/types/elements/is/SwcAppDialog.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppDiv.d.ts +0 -9
- package/dist/types/elements/is/SwcAppDiv.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppDl.d.ts +0 -9
- package/dist/types/elements/is/SwcAppDl.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppEmbed.d.ts +0 -9
- package/dist/types/elements/is/SwcAppEmbed.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppFieldSet.d.ts +0 -9
- package/dist/types/elements/is/SwcAppFieldSet.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppForm.d.ts +0 -9
- package/dist/types/elements/is/SwcAppForm.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppHeading.d.ts +0 -9
- package/dist/types/elements/is/SwcAppHeading.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppHr.d.ts +0 -9
- package/dist/types/elements/is/SwcAppHr.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppIFrame.d.ts +0 -9
- package/dist/types/elements/is/SwcAppIFrame.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppImage.d.ts +0 -9
- package/dist/types/elements/is/SwcAppImage.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppInput.d.ts +0 -9
- package/dist/types/elements/is/SwcAppInput.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppLabel.d.ts +0 -9
- package/dist/types/elements/is/SwcAppLabel.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppLegend.d.ts +0 -9
- package/dist/types/elements/is/SwcAppLegend.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppLi.d.ts +0 -9
- package/dist/types/elements/is/SwcAppLi.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppLink.d.ts +0 -9
- package/dist/types/elements/is/SwcAppLink.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppMap.d.ts +0 -9
- package/dist/types/elements/is/SwcAppMap.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppMeta.d.ts +0 -9
- package/dist/types/elements/is/SwcAppMeta.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppMeter.d.ts +0 -9
- package/dist/types/elements/is/SwcAppMeter.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppMod.d.ts +0 -9
- package/dist/types/elements/is/SwcAppMod.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppObject.d.ts +0 -9
- package/dist/types/elements/is/SwcAppObject.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppOl.d.ts +0 -9
- package/dist/types/elements/is/SwcAppOl.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppOptGroup.d.ts +0 -9
- package/dist/types/elements/is/SwcAppOptGroup.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppOption.d.ts +0 -9
- package/dist/types/elements/is/SwcAppOption.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppOutput.d.ts +0 -9
- package/dist/types/elements/is/SwcAppOutput.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppParagraph.d.ts +0 -9
- package/dist/types/elements/is/SwcAppParagraph.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppParam.d.ts +0 -9
- package/dist/types/elements/is/SwcAppParam.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppPicture.d.ts +0 -9
- package/dist/types/elements/is/SwcAppPicture.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppPre.d.ts +0 -9
- package/dist/types/elements/is/SwcAppPre.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppProgress.d.ts +0 -9
- package/dist/types/elements/is/SwcAppProgress.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppQuote.d.ts +0 -9
- package/dist/types/elements/is/SwcAppQuote.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppScript.d.ts +0 -9
- package/dist/types/elements/is/SwcAppScript.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppSelect.d.ts +0 -9
- package/dist/types/elements/is/SwcAppSelect.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppSlot.d.ts +0 -9
- package/dist/types/elements/is/SwcAppSlot.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppSource.d.ts +0 -9
- package/dist/types/elements/is/SwcAppSource.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppSpan.d.ts +0 -9
- package/dist/types/elements/is/SwcAppSpan.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppStyle.d.ts +0 -9
- package/dist/types/elements/is/SwcAppStyle.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppTable.d.ts +0 -9
- package/dist/types/elements/is/SwcAppTable.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppTableCell.d.ts +0 -9
- package/dist/types/elements/is/SwcAppTableCell.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppTableRow.d.ts +0 -9
- package/dist/types/elements/is/SwcAppTableRow.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppTableSection.d.ts +0 -9
- package/dist/types/elements/is/SwcAppTableSection.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppTemplate.d.ts +0 -9
- package/dist/types/elements/is/SwcAppTemplate.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppTextArea.d.ts +0 -9
- package/dist/types/elements/is/SwcAppTextArea.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppTime.d.ts +0 -9
- package/dist/types/elements/is/SwcAppTime.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppTitle.d.ts +0 -9
- package/dist/types/elements/is/SwcAppTitle.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppTrack.d.ts +0 -9
- package/dist/types/elements/is/SwcAppTrack.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppUl.d.ts +0 -9
- package/dist/types/elements/is/SwcAppUl.d.ts.map +0 -1
- package/dist/types/elements/is/SwcAppVideo.d.ts +0 -9
- package/dist/types/elements/is/SwcAppVideo.d.ts.map +0 -1
- package/dist/types/elements/is/index.d.ts +0 -58
- package/dist/types/elements/is/index.d.ts.map +0 -1
- package/src/elements/SwcApp.ts +0 -26
- package/src/elements/is/SwcAppAnchor.ts +0 -26
- package/src/elements/is/SwcAppArea.ts +0 -26
- package/src/elements/is/SwcAppAudio.ts +0 -26
- package/src/elements/is/SwcAppBase.ts +0 -26
- package/src/elements/is/SwcAppBody.ts +0 -26
- package/src/elements/is/SwcAppButton.ts +0 -26
- package/src/elements/is/SwcAppCanvas.ts +0 -26
- package/src/elements/is/SwcAppData.ts +0 -26
- package/src/elements/is/SwcAppDataList.ts +0 -26
- package/src/elements/is/SwcAppDetails.ts +0 -26
- package/src/elements/is/SwcAppDialog.ts +0 -26
- package/src/elements/is/SwcAppDiv.ts +0 -26
- package/src/elements/is/SwcAppDl.ts +0 -26
- package/src/elements/is/SwcAppEmbed.ts +0 -26
- package/src/elements/is/SwcAppFieldSet.ts +0 -26
- package/src/elements/is/SwcAppForm.ts +0 -26
- package/src/elements/is/SwcAppHeading.ts +0 -26
- package/src/elements/is/SwcAppHr.ts +0 -26
- package/src/elements/is/SwcAppIFrame.ts +0 -26
- package/src/elements/is/SwcAppImage.ts +0 -26
- package/src/elements/is/SwcAppInput.ts +0 -26
- package/src/elements/is/SwcAppLabel.ts +0 -26
- package/src/elements/is/SwcAppLegend.ts +0 -26
- package/src/elements/is/SwcAppLi.ts +0 -26
- package/src/elements/is/SwcAppLink.ts +0 -26
- package/src/elements/is/SwcAppMap.ts +0 -26
- package/src/elements/is/SwcAppMeta.ts +0 -26
- package/src/elements/is/SwcAppMeter.ts +0 -26
- package/src/elements/is/SwcAppMod.ts +0 -26
- package/src/elements/is/SwcAppObject.ts +0 -26
- package/src/elements/is/SwcAppOl.ts +0 -26
- package/src/elements/is/SwcAppOptGroup.ts +0 -26
- package/src/elements/is/SwcAppOption.ts +0 -26
- package/src/elements/is/SwcAppOutput.ts +0 -26
- package/src/elements/is/SwcAppParagraph.ts +0 -26
- package/src/elements/is/SwcAppParam.ts +0 -26
- package/src/elements/is/SwcAppPicture.ts +0 -26
- package/src/elements/is/SwcAppPre.ts +0 -26
- package/src/elements/is/SwcAppProgress.ts +0 -26
- package/src/elements/is/SwcAppQuote.ts +0 -26
- package/src/elements/is/SwcAppScript.ts +0 -26
- package/src/elements/is/SwcAppSelect.ts +0 -26
- package/src/elements/is/SwcAppSlot.ts +0 -26
- package/src/elements/is/SwcAppSource.ts +0 -26
- package/src/elements/is/SwcAppSpan.ts +0 -26
- package/src/elements/is/SwcAppStyle.ts +0 -26
- package/src/elements/is/SwcAppTable.ts +0 -26
- package/src/elements/is/SwcAppTableCell.ts +0 -26
- package/src/elements/is/SwcAppTableRow.ts +0 -26
- package/src/elements/is/SwcAppTableSection.ts +0 -26
- package/src/elements/is/SwcAppTemplate.ts +0 -26
- package/src/elements/is/SwcAppTextArea.ts +0 -26
- package/src/elements/is/SwcAppTime.ts +0 -26
- package/src/elements/is/SwcAppTitle.ts +0 -26
- package/src/elements/is/SwcAppTrack.ts +0 -26
- package/src/elements/is/SwcAppUl.ts +0 -26
- package/src/elements/is/SwcAppVideo.ts +0 -26
- package/src/elements/is/index.ts +0 -57
|
@@ -19,493 +19,402 @@ var elementDefine_exports = {};
|
|
|
19
19
|
__export(elementDefine_exports, {
|
|
20
20
|
ELEMENT_CONFIG_KEY: () => ELEMENT_CONFIG_KEY,
|
|
21
21
|
elementDefine: () => elementDefine,
|
|
22
|
+
ensureInit: () => ensureInit,
|
|
22
23
|
getElementConfig: () => getElementConfig
|
|
23
24
|
});
|
|
24
25
|
module.exports = __toCommonJS(elementDefine_exports);
|
|
25
|
-
var
|
|
26
|
-
var
|
|
26
|
+
var import_core = require("@dooboostore/core");
|
|
27
|
+
var import_core2 = require("@dooboostore/core");
|
|
27
28
|
var import_onConnectedInnerHtml = require("./onConnectedInnerHtml");
|
|
28
29
|
var import_addEventListener = require("./addEventListener");
|
|
29
30
|
var import_lifecycles = require("./lifecycles");
|
|
30
31
|
var import_emitCustomEvent = require("./emitCustomEvent");
|
|
31
32
|
var import_changedAttribute = require("./changedAttribute");
|
|
32
33
|
var import_setAttribute = require("./setAttribute");
|
|
33
|
-
var
|
|
34
|
-
var import_appendChild = require("./appendChild");
|
|
34
|
+
var import_attribute = require("./attribute");
|
|
35
35
|
var import_Utils = require("../utils/Utils");
|
|
36
36
|
var import_config = require("../config/config");
|
|
37
37
|
var import_Inject = require("@dooboostore/simple-boot/decorators/inject/Inject");
|
|
38
38
|
var import_types = require("../types");
|
|
39
39
|
const ELEMENT_CONFIG_KEY = Symbol("simple-web-component:element-config");
|
|
40
|
+
const getElementConfig = (target) => {
|
|
41
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
42
|
+
return import_core.ReflectUtils.getMetadata(ELEMENT_CONFIG_KEY, constructor);
|
|
43
|
+
};
|
|
44
|
+
const ensureInit = (inst) => {
|
|
45
|
+
if (!inst.__swc_initialized) {
|
|
46
|
+
inst._swcId = Math.random().toString(36).substring(2, 11);
|
|
47
|
+
inst._emitHandlers = /* @__PURE__ */ new Map();
|
|
48
|
+
inst._boundListeners = [];
|
|
49
|
+
inst.__swc_initialized = true;
|
|
50
|
+
const hostSet = import_Utils.SwcUtils.getHostSet(inst);
|
|
51
|
+
inst._executeSwcScript?.("swc-on-constructor", hostSet);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
40
54
|
const globalDelegatedRoots = /* @__PURE__ */ new WeakSet();
|
|
55
|
+
const handleGlobalSwcEvent = async (event) => {
|
|
56
|
+
if (event.__swc_handled) return;
|
|
57
|
+
const path = event.composedPath();
|
|
58
|
+
const type = event.type;
|
|
59
|
+
const attrName = `swc-on-${type}`;
|
|
60
|
+
for (const node of path) {
|
|
61
|
+
if (!(node instanceof HTMLElement)) continue;
|
|
62
|
+
const script = node.getAttribute?.(attrName);
|
|
63
|
+
if (script && !getElementConfig(node)) {
|
|
64
|
+
const host = import_Utils.SwcUtils.findNearestSwcHost(node);
|
|
65
|
+
if (host && host.isConnected && typeof host.__swc_executeAttributeEvent === "function") {
|
|
66
|
+
await host.__swc_executeAttributeEvent(node, attrName, script, event);
|
|
67
|
+
event.__swc_handled = true;
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
41
73
|
function buildEnv(configWindow) {
|
|
42
74
|
const win = configWindow || (typeof window !== "undefined" ? window : void 0);
|
|
43
75
|
const doc = win?.document;
|
|
44
76
|
const builtInTagMap = /* @__PURE__ */ new Map();
|
|
45
77
|
for (const [cls, tag] of import_config.HTML_TAG_ENTRIES) {
|
|
46
|
-
if (win?.[cls])
|
|
47
|
-
builtInTagMap.set(win[cls], tag);
|
|
78
|
+
if (win?.[cls]) builtInTagMap.set(win[cls], tag);
|
|
48
79
|
}
|
|
49
80
|
const domHelpers = import_Utils.SwcUtils.getHelperSet(win);
|
|
50
81
|
return { win, doc, builtInTagMap, domHelpers };
|
|
51
82
|
}
|
|
52
83
|
const getHandlers = (inst) => {
|
|
53
|
-
if (!inst.__swc_attributeEventHandlers)
|
|
54
|
-
inst.__swc_attributeEventHandlers = /* @__PURE__ */ new Map();
|
|
84
|
+
if (!inst.__swc_attributeEventHandlers) inst.__swc_attributeEventHandlers = /* @__PURE__ */ new Map();
|
|
55
85
|
return inst.__swc_attributeEventHandlers;
|
|
56
86
|
};
|
|
57
|
-
const
|
|
58
|
-
|
|
87
|
+
const setupPrototype = (proto) => {
|
|
88
|
+
if (proto.__swc_proto_setup) return;
|
|
89
|
+
proto.__swc_proto_setup = true;
|
|
90
|
+
proto._executeSwcScript = function(attrName, hostSet, extraArgs = {}) {
|
|
91
|
+
ensureInit(this);
|
|
92
|
+
const script = this.getAttribute(attrName);
|
|
93
|
+
if (script) {
|
|
94
|
+
try {
|
|
95
|
+
const conf = getElementConfig(this);
|
|
96
|
+
const currentWin = this._resolveWindow(conf);
|
|
97
|
+
const helpers = import_Utils.SwcUtils.getHelperSet(currentWin);
|
|
98
|
+
const args = { ...hostSet, ...helpers, ...extraArgs, $el: this, $root: this.getRootNode() };
|
|
99
|
+
import_core2.FunctionUtils.execute({ script, context: this, args });
|
|
100
|
+
} catch (e) {
|
|
101
|
+
console.error(`[SWC] Failed to execute ${attrName}:`, e);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
proto._resolveWindow = function(localConfig) {
|
|
106
|
+
ensureInit(this);
|
|
107
|
+
if (localConfig?.window) return localConfig.window;
|
|
108
|
+
const ancestors = import_Utils.SwcUtils.findAllSwcHosts(this);
|
|
109
|
+
for (let i = ancestors.length - 1; i >= 0; i--) {
|
|
110
|
+
const aConf = getElementConfig(ancestors[i]);
|
|
111
|
+
if (aConf?.window) return aConf.window;
|
|
112
|
+
}
|
|
113
|
+
return typeof window !== "undefined" ? window : void 0;
|
|
114
|
+
};
|
|
115
|
+
proto._invokeLifecycleMethod = function(methodName, hostSet, extraArgs = []) {
|
|
116
|
+
ensureInit(this);
|
|
117
|
+
if (typeof this[methodName] !== "function") return;
|
|
118
|
+
const app = hostSet.$appHost?.simpleApplication;
|
|
119
|
+
if (app) {
|
|
120
|
+
const otherStorage = /* @__PURE__ */ new Map();
|
|
121
|
+
const situations = new import_Inject.SituationTypeContainers([new import_Inject.SituationTypeContainer({ situationType: import_types.InjectSituationType.HOST_SET, data: hostSet }), new import_Inject.SituationTypeContainer({ situationType: import_types.InjectSituationType.APP_HOST, data: hostSet.$appHost }), new import_Inject.SituationTypeContainer({ situationType: import_types.InjectSituationType.APP_HOSTS, data: hostSet.$appHosts }), new import_Inject.SituationTypeContainer({ situationType: import_types.InjectSituationType.HOST, data: hostSet.$host }), new import_Inject.SituationTypeContainer({ situationType: import_types.InjectSituationType.HOSTS, data: hostSet.$hosts }), new import_Inject.SituationTypeContainer({ situationType: import_types.InjectSituationType.FIRST_HOST, data: hostSet.$firstHost }), new import_Inject.SituationTypeContainer({ situationType: import_types.InjectSituationType.LAST_HOST, data: hostSet.$lastHost }), new import_Inject.SituationTypeContainer({ situationType: import_types.InjectSituationType.FIRST_APP_HOST, data: hostSet.$firstAppHost }), new import_Inject.SituationTypeContainer({ situationType: import_types.InjectSituationType.LAST_APP_HOST, data: hostSet.$lastAppHost })]);
|
|
122
|
+
otherStorage.set(import_Inject.SituationTypeContainers, situations);
|
|
123
|
+
return app.simstanceManager.executeBindParameterSimPromise(
|
|
124
|
+
{
|
|
125
|
+
target: this,
|
|
126
|
+
targetKey: methodName,
|
|
127
|
+
inputParameters: extraArgs
|
|
128
|
+
},
|
|
129
|
+
otherStorage
|
|
130
|
+
);
|
|
131
|
+
} else {
|
|
132
|
+
return this[methodName](...extraArgs);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
proto._bindAttributeEvent = function(el, attrName, script, eventName) {
|
|
136
|
+
ensureInit(this);
|
|
137
|
+
if (!eventName) {
|
|
138
|
+
if (!attrName.startsWith("swc-on-")) return;
|
|
139
|
+
eventName = attrName.substring(7);
|
|
140
|
+
}
|
|
141
|
+
const elHandlers = getHandlers(this);
|
|
142
|
+
let handlers = elHandlers.get(el);
|
|
143
|
+
if (!handlers) {
|
|
144
|
+
handlers = /* @__PURE__ */ new Map();
|
|
145
|
+
elHandlers.set(el, handlers);
|
|
146
|
+
}
|
|
147
|
+
const oldHandler = handlers.get(attrName);
|
|
148
|
+
if (oldHandler) el.removeEventListener(eventName, oldHandler);
|
|
149
|
+
const handler = async (event) => {
|
|
150
|
+
const hostSet = import_Utils.SwcUtils.getHostSet(el);
|
|
151
|
+
const conf = getElementConfig(this);
|
|
152
|
+
const currentWin = this._resolveWindow(conf);
|
|
153
|
+
const helpers = import_Utils.SwcUtils.getHelperSet(currentWin);
|
|
154
|
+
const args = {
|
|
155
|
+
event,
|
|
156
|
+
$data: event.detail,
|
|
157
|
+
...hostSet,
|
|
158
|
+
...helpers,
|
|
159
|
+
$el: el,
|
|
160
|
+
$root: this.getRootNode()
|
|
161
|
+
};
|
|
162
|
+
await import_core2.FunctionUtils.execute({ script, context: el, args });
|
|
163
|
+
};
|
|
164
|
+
el.addEventListener(eventName, handler);
|
|
165
|
+
handlers.set(attrName, handler);
|
|
166
|
+
};
|
|
167
|
+
proto.__swc_executeAttributeEvent = async function(el, attrName, script, event) {
|
|
168
|
+
ensureInit(this);
|
|
169
|
+
const hostSet = import_Utils.SwcUtils.getHostSet(el);
|
|
170
|
+
const conf = getElementConfig(this);
|
|
171
|
+
const currentWin = this._resolveWindow(conf);
|
|
172
|
+
const currentHelpers = import_Utils.SwcUtils.getHelperSet(currentWin);
|
|
173
|
+
const args = {
|
|
174
|
+
event,
|
|
175
|
+
$data: event.detail,
|
|
176
|
+
...hostSet,
|
|
177
|
+
...currentHelpers,
|
|
178
|
+
$el: el,
|
|
179
|
+
$root: this.getRootNode()
|
|
180
|
+
};
|
|
181
|
+
await import_core2.FunctionUtils.execute({ script, context: el, args });
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
const elementDefine = (name, config = {}) => (constructor) => {
|
|
59
185
|
const { win, doc, builtInTagMap: BUILT_IN_TAG_MAP, domHelpers: SWC_DOM_HELPERS } = buildEnv(config.window);
|
|
60
|
-
config
|
|
61
|
-
|
|
186
|
+
const metadata = { ...config, name, window: win };
|
|
187
|
+
if (!metadata.window) {
|
|
188
|
+
throw new Error("window is required");
|
|
189
|
+
}
|
|
190
|
+
let extendsTagName = metadata.extends;
|
|
62
191
|
if (!extendsTagName) {
|
|
63
|
-
let
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
192
|
+
let proto2 = constructor;
|
|
193
|
+
const BaseHTMLElement = win.HTMLElement;
|
|
194
|
+
while (proto2 && proto2 !== BaseHTMLElement && proto2 !== Function.prototype) {
|
|
195
|
+
extendsTagName = BUILT_IN_TAG_MAP.get(proto2);
|
|
196
|
+
if (extendsTagName) break;
|
|
197
|
+
proto2 = Object.getPrototypeOf(proto2);
|
|
69
198
|
}
|
|
70
|
-
|
|
199
|
+
metadata.extends = extendsTagName;
|
|
71
200
|
}
|
|
72
201
|
const emitCustomEventList = (0, import_emitCustomEvent.getEmitCustomEventMetadataList)(constructor) || [];
|
|
73
202
|
const addEventListenerList = (0, import_addEventListener.getAddEventListenerMetadata)(constructor) || [];
|
|
74
203
|
const attrChangeMap = (0, import_changedAttribute.findAllAttributeChangedMetadata)(constructor);
|
|
75
|
-
const
|
|
76
|
-
const replaceChildrenMap = (0, import_replaceChildren.findAllReplaceChildrenMetadata)(constructor);
|
|
77
|
-
const appendChildMap = (0, import_appendChild.findAllAppendChildMetadata)(constructor);
|
|
204
|
+
const attributeList = (0, import_attribute.findAllAttributeMetadata)(constructor);
|
|
78
205
|
const swcLifecycleAttributes = ["swc-on-constructor", "swc-on-connected", "swc-on-disconnected", "swc-on-before-connected", "swc-on-after-connected", "swc-on-before-disconnected", "swc-on-after-disconnected", "swc-on-before-adopted", "swc-on-after-adopted", "swc-on-attribute-changed"];
|
|
79
206
|
const swcOnEvents = import_config.DOM_EVENT_NAMES.map((e) => `swc-on-${e}`);
|
|
80
|
-
const mergedObservedAttributes = [.../* @__PURE__ */ new Set([...
|
|
207
|
+
const mergedObservedAttributes = [.../* @__PURE__ */ new Set([...metadata.observedAttributes ?? [], ...attrChangeMap.keys(), ...Array.from((0, import_setAttribute.findAllSetAttributeMetadata)(constructor).values()).map((it) => it.name), ...attributeList.map((it) => it.options.name || String(it.propertyKey)), ...emitCustomEventList.map((it) => it.options.attributeName), ...swcLifecycleAttributes, ...swcOnEvents])];
|
|
81
208
|
const connectedInnerHtmlList = (0, import_onConnectedInnerHtml.getOnConnectedInnerHtmlMetadata)(constructor) || [];
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
} catch (e) {
|
|
90
|
-
console.error(`[SWC] Failed to execute ${attrName}:`, e);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
209
|
+
const proto = constructor.prototype;
|
|
210
|
+
setupPrototype(proto);
|
|
211
|
+
const originalConnected = proto.connectedCallback;
|
|
212
|
+
proto.connectedCallback = function() {
|
|
213
|
+
ensureInit(this);
|
|
214
|
+
if (connectedInnerHtmlList.some((it) => it.options.useShadow === true) && !this.shadowRoot) {
|
|
215
|
+
this.attachShadow({ mode: "open" });
|
|
93
216
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
otherStorage.set(import_Inject.SituationTypeContainers, situations);
|
|
102
|
-
return app.simstanceManager.executeBindParameterSimPromise({
|
|
103
|
-
target: this,
|
|
104
|
-
targetKey: methodName,
|
|
105
|
-
inputParameters: extraArgs
|
|
106
|
-
}, otherStorage);
|
|
107
|
-
} else {
|
|
108
|
-
return this[methodName](...extraArgs);
|
|
109
|
-
}
|
|
217
|
+
const conf = getElementConfig(this);
|
|
218
|
+
const currentWin = this._resolveWindow(conf);
|
|
219
|
+
const hostSet = import_Utils.SwcUtils.getHostSet(this);
|
|
220
|
+
this._executeSwcScript("swc-on-before-connected", hostSet);
|
|
221
|
+
const bMethods = (0, import_lifecycles.findAllLifecycleMetadata)(this, import_lifecycles.ON_BEFORE_CONNECTED_METADATA_KEY);
|
|
222
|
+
if (bMethods) {
|
|
223
|
+
for (const m of bMethods) this._invokeLifecycleMethod(m, hostSet);
|
|
110
224
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if (!handlers) {
|
|
122
|
-
handlers = /* @__PURE__ */ new Map();
|
|
123
|
-
elHandlers.set(el, handlers);
|
|
124
|
-
}
|
|
125
|
-
const oldHandler = handlers.get(attrName);
|
|
126
|
-
if (oldHandler)
|
|
127
|
-
el.removeEventListener(eventName, oldHandler);
|
|
128
|
-
const handler = (event) => {
|
|
129
|
-
const hostSet = import_Utils.SwcUtils.getHostSet(el);
|
|
130
|
-
const args = {
|
|
131
|
-
event,
|
|
132
|
-
$data: event.detail,
|
|
133
|
-
...hostSet,
|
|
134
|
-
...SWC_DOM_HELPERS
|
|
135
|
-
};
|
|
136
|
-
import_FunctionUtils.FunctionUtils.execute({ script, context: el, args });
|
|
137
|
-
};
|
|
138
|
-
el.addEventListener(eventName, handler);
|
|
139
|
-
handlers.set(attrName, handler);
|
|
140
|
-
}
|
|
141
|
-
constructor(...args) {
|
|
142
|
-
super(...args);
|
|
143
|
-
this._swcId = Math.random().toString(36).substring(2, 11);
|
|
144
|
-
this._emitHandlers = /* @__PURE__ */ new Map();
|
|
145
|
-
this._boundListeners = [];
|
|
146
|
-
const hostSet = import_Utils.SwcUtils.getHostSet(this);
|
|
147
|
-
this._executeSwcScript("swc-on-constructor", hostSet);
|
|
148
|
-
if (connectedInnerHtmlList.some((it) => it.options.useShadow === true) && !this.shadowRoot) {
|
|
149
|
-
this.attachShadow({ mode: "open" });
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
static get observedAttributes() {
|
|
153
|
-
return mergedObservedAttributes;
|
|
154
|
-
}
|
|
155
|
-
async connectedCallback() {
|
|
156
|
-
const conf = getElementConfig(this);
|
|
157
|
-
const currentWin = conf?.window || window;
|
|
158
|
-
const currentDoc = currentWin.document;
|
|
159
|
-
const hostSet = import_Utils.SwcUtils.getHostSet(this);
|
|
160
|
-
this._executeSwcScript("swc-on-before-connected", hostSet);
|
|
161
|
-
const bMethods = (0, import_lifecycles.findAllLifecycleMetadata)(this, import_lifecycles.ON_BEFORE_CONNECTED_METADATA_KEY);
|
|
162
|
-
if (bMethods) {
|
|
163
|
-
for (const m of bMethods)
|
|
164
|
-
await this._invokeLifecycleMethod(m, hostSet);
|
|
165
|
-
}
|
|
166
|
-
if (typeof this.initCore === "function")
|
|
167
|
-
this.initCore();
|
|
168
|
-
if (connectedInnerHtmlList.length > 0) {
|
|
169
|
-
let sContent = "", lContent = "";
|
|
170
|
-
for (const meta of connectedInnerHtmlList) {
|
|
171
|
-
const res = await this[meta.propertyKey]();
|
|
172
|
-
if (res !== void 0) {
|
|
173
|
-
if (meta.options.useShadow)
|
|
174
|
-
sContent += res;
|
|
175
|
-
else
|
|
176
|
-
lContent += res;
|
|
225
|
+
attributeList.forEach((meta) => {
|
|
226
|
+
const attrName = meta.options.name || String(meta.propertyKey);
|
|
227
|
+
if (meta.options.connectedInitialize) {
|
|
228
|
+
const memoryVal = this[meta.privateKey];
|
|
229
|
+
if (memoryVal !== void 0) {
|
|
230
|
+
this.__swc_syncing_init = true;
|
|
231
|
+
try {
|
|
232
|
+
this[meta.propertyKey] = memoryVal;
|
|
233
|
+
} finally {
|
|
234
|
+
this.__swc_syncing_init = false;
|
|
177
235
|
}
|
|
178
236
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
if (
|
|
182
|
-
this.
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
const path = event.composedPath();
|
|
188
|
-
const type = event.type;
|
|
189
|
-
const attrName = `swc-on-${type}`;
|
|
190
|
-
for (const node of path) {
|
|
191
|
-
if (node === delegateHost)
|
|
192
|
-
break;
|
|
193
|
-
if (!(node instanceof HTMLElement))
|
|
194
|
-
continue;
|
|
195
|
-
const script = node.getAttribute?.(attrName);
|
|
196
|
-
if (script && !getElementConfig(node)) {
|
|
197
|
-
const host = import_Utils.SwcUtils.findNearestSwcHost(node);
|
|
198
|
-
if (host) {
|
|
199
|
-
const childHostSet = import_Utils.SwcUtils.getHostSet(node);
|
|
200
|
-
const args = {
|
|
201
|
-
event,
|
|
202
|
-
$data: event.detail,
|
|
203
|
-
...childHostSet,
|
|
204
|
-
...SWC_DOM_HELPERS
|
|
205
|
-
};
|
|
206
|
-
import_FunctionUtils.FunctionUtils.execute({ script, context: node, args });
|
|
207
|
-
event.__swc_handled = true;
|
|
208
|
-
break;
|
|
209
|
-
}
|
|
237
|
+
} else if (meta.selector === ":host" || !meta.selector) {
|
|
238
|
+
const domVal = this.getAttribute(attrName);
|
|
239
|
+
if (domVal !== null) {
|
|
240
|
+
this.__swc_syncing_init = true;
|
|
241
|
+
try {
|
|
242
|
+
this[meta.propertyKey] = domVal;
|
|
243
|
+
} finally {
|
|
244
|
+
this.__swc_syncing_init = false;
|
|
210
245
|
}
|
|
211
246
|
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
if (!globalDelegatedRoots.has(root)) {
|
|
222
|
-
import_config.DOM_EVENT_NAMES.forEach((type) => {
|
|
223
|
-
const handler = createDelegationHandler(root);
|
|
224
|
-
root.addEventListener(type, handler);
|
|
225
|
-
});
|
|
226
|
-
globalDelegatedRoots.add(root);
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
if (connectedInnerHtmlList.length > 0) {
|
|
250
|
+
let sContent = "", lContent = "";
|
|
251
|
+
for (const meta of connectedInnerHtmlList) {
|
|
252
|
+
const res = this[meta.propertyKey]();
|
|
253
|
+
if (res !== void 0) {
|
|
254
|
+
if (meta.options.useShadow) sContent += res;
|
|
255
|
+
else lContent += res;
|
|
227
256
|
}
|
|
228
257
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
if (hostSet.$lastHost)
|
|
249
|
-
bindTargets.push(hostSet.$lastHost);
|
|
250
|
-
} else if (selector === ":firstAppHost") {
|
|
251
|
-
if (hostSet.$firstAppHost)
|
|
252
|
-
bindTargets.push(hostSet.$firstAppHost);
|
|
253
|
-
} else if (selector === ":lastAppHost") {
|
|
254
|
-
if (hostSet.$lastAppHost)
|
|
255
|
-
bindTargets.push(hostSet.$lastAppHost);
|
|
256
|
-
} else if (!selector || selector === ":host") {
|
|
257
|
-
bindTargets.push(this);
|
|
258
|
-
} else if (delegate) {
|
|
259
|
-
const bindRoots = [];
|
|
260
|
-
const r = root || "auto";
|
|
261
|
-
if (r === "auto")
|
|
262
|
-
bindRoots.push(this.shadowRoot || this);
|
|
263
|
-
else if (r === "light")
|
|
264
|
-
bindRoots.push(this);
|
|
265
|
-
else if (r === "shadow") {
|
|
266
|
-
if (this.shadowRoot)
|
|
267
|
-
bindRoots.push(this.shadowRoot);
|
|
268
|
-
} else if (r === "all") {
|
|
269
|
-
bindRoots.push(this);
|
|
270
|
-
if (this.shadowRoot)
|
|
271
|
-
bindRoots.push(this.shadowRoot);
|
|
272
|
-
}
|
|
273
|
-
bindRoots.forEach((br) => {
|
|
274
|
-
const handler = (event) => {
|
|
275
|
-
const matchedEl = event.target.closest(selector);
|
|
276
|
-
if (matchedEl && br.contains(matchedEl)) {
|
|
277
|
-
if (stopPropagation)
|
|
278
|
-
event.stopPropagation();
|
|
279
|
-
if (stopImmediatePropagation)
|
|
280
|
-
event.stopImmediatePropagation();
|
|
281
|
-
if (preventDefault)
|
|
282
|
-
event.preventDefault();
|
|
283
|
-
const currentHostSet = import_Utils.SwcUtils.getHostSet(this);
|
|
284
|
-
this._invokeLifecycleMethod(meta.propertyKey, currentHostSet, [event, currentHostSet, matchedEl]);
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
br.addEventListener(type, handler, opts);
|
|
288
|
-
const self = this;
|
|
289
|
-
if (removeOnDisconnected === true || br !== self && br !== self.shadowRoot) {
|
|
290
|
-
this._boundListeners.push({ target: br, type, handler, options: opts });
|
|
291
|
-
}
|
|
292
|
-
});
|
|
258
|
+
if (this.shadowRoot) this.shadowRoot.innerHTML = sContent;
|
|
259
|
+
if (lContent) this.innerHTML = lContent;
|
|
260
|
+
}
|
|
261
|
+
const root = this.getRootNode();
|
|
262
|
+
if (!globalDelegatedRoots.has(root)) {
|
|
263
|
+
import_config.DOM_EVENT_NAMES.forEach((type) => {
|
|
264
|
+
root.addEventListener(type, handleGlobalSwcEvent);
|
|
265
|
+
});
|
|
266
|
+
globalDelegatedRoots.add(root);
|
|
267
|
+
}
|
|
268
|
+
addEventListenerList.forEach((meta) => {
|
|
269
|
+
const { selector, type, options } = meta;
|
|
270
|
+
const opts = { capture: options.capture, once: options.once, passive: options.passive };
|
|
271
|
+
const bindTargets = [];
|
|
272
|
+
const r = options.root || "auto";
|
|
273
|
+
const applyRootOption = (target) => {
|
|
274
|
+
if (!target) return;
|
|
275
|
+
if (r === "auto") {
|
|
276
|
+
bindTargets.push(target.shadowRoot || target);
|
|
293
277
|
} else {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
if (r === "auto")
|
|
297
|
-
searchRoots.push(this.shadowRoot || this);
|
|
298
|
-
else if (r === "light")
|
|
299
|
-
searchRoots.push(this);
|
|
300
|
-
else if (r === "shadow") {
|
|
301
|
-
if (this.shadowRoot)
|
|
302
|
-
searchRoots.push(this.shadowRoot);
|
|
303
|
-
} else if (r === "all") {
|
|
304
|
-
searchRoots.push(this);
|
|
305
|
-
if (this.shadowRoot)
|
|
306
|
-
searchRoots.push(this.shadowRoot);
|
|
307
|
-
}
|
|
308
|
-
searchRoots.forEach((sr) => {
|
|
309
|
-
sr.querySelectorAll(selector).forEach((el) => bindTargets.push(el));
|
|
310
|
-
});
|
|
278
|
+
if (r === "light" || r === "all") bindTargets.push(target);
|
|
279
|
+
if ((r === "shadow" || r === "all") && target.shadowRoot) bindTargets.push(target.shadowRoot);
|
|
311
280
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
281
|
+
};
|
|
282
|
+
if (selector === ":window") bindTargets.push(currentWin);
|
|
283
|
+
else if (selector === ":document") bindTargets.push(currentWin.document);
|
|
284
|
+
else if (selector === ":parentHost") applyRootOption(hostSet.$parentHost);
|
|
285
|
+
else if (selector === ":appHost") applyRootOption(hostSet.$appHost);
|
|
286
|
+
else if (selector === ":firstHost") applyRootOption(hostSet.$firstHost);
|
|
287
|
+
else if (selector === ":lastHost") applyRootOption(hostSet.$lastHost);
|
|
288
|
+
else if (selector === ":firstAppHost") applyRootOption(hostSet.$firstAppHost);
|
|
289
|
+
else if (selector === ":lastAppHost") applyRootOption(hostSet.$lastAppHost);
|
|
290
|
+
else if (selector === ":hosts") hostSet.$hosts.forEach(applyRootOption);
|
|
291
|
+
else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRootOption);
|
|
292
|
+
else if (selector === ":host" || !selector) applyRootOption(this);
|
|
293
|
+
else if (options.delegate) {
|
|
294
|
+
const bindRoots = [];
|
|
295
|
+
if (r === "auto") bindRoots.push(this.shadowRoot || this);
|
|
296
|
+
else if (r === "light") bindRoots.push(this);
|
|
297
|
+
else if (r === "shadow" && this.shadowRoot) bindRoots.push(this.shadowRoot);
|
|
298
|
+
else if (r === "all") {
|
|
299
|
+
bindRoots.push(this);
|
|
300
|
+
if (this.shadowRoot) bindRoots.push(this.shadowRoot);
|
|
301
|
+
}
|
|
302
|
+
bindRoots.forEach((br) => {
|
|
303
|
+
const handler = async (event) => {
|
|
304
|
+
const matchedEl = event.target.closest(selector);
|
|
305
|
+
if (matchedEl && br.contains(matchedEl)) {
|
|
306
|
+
if (options.stopPropagation) event.stopPropagation();
|
|
307
|
+
if (options.stopImmediatePropagation) event.stopImmediatePropagation();
|
|
308
|
+
if (options.preventDefault) event.preventDefault();
|
|
309
|
+
const currentHostSet = import_Utils.SwcUtils.getHostSet(this);
|
|
310
|
+
const args = { event, ...currentHostSet, $el: matchedEl, $root: br };
|
|
311
|
+
await this._invokeLifecycleMethod(meta.propertyKey, currentHostSet, [event, currentHostSet, matchedEl, args]);
|
|
312
|
+
}
|
|
322
313
|
};
|
|
323
|
-
|
|
324
|
-
if (removeOnDisconnected === true ||
|
|
325
|
-
this._boundListeners.push({ target, type, handler, options: opts });
|
|
314
|
+
br.addEventListener(type, handler, opts);
|
|
315
|
+
if (options.removeOnDisconnected === true || br !== this && br !== this.shadowRoot) {
|
|
316
|
+
this._boundListeners.push({ target: br, type, handler, options: opts });
|
|
326
317
|
}
|
|
327
318
|
});
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
319
|
+
} else {
|
|
320
|
+
const searchRoots = [];
|
|
321
|
+
if (r === "auto") searchRoots.push(this.shadowRoot || this);
|
|
322
|
+
else if (r === "light") searchRoots.push(this);
|
|
323
|
+
else if (r === "shadow" && this.shadowRoot) searchRoots.push(this.shadowRoot);
|
|
324
|
+
else if (r === "all") {
|
|
325
|
+
searchRoots.push(this);
|
|
326
|
+
if (this.shadowRoot) searchRoots.push(this.shadowRoot);
|
|
327
|
+
}
|
|
328
|
+
searchRoots.forEach((sr) => {
|
|
329
|
+
sr.querySelectorAll(selector).forEach((el) => bindTargets.push(el));
|
|
330
|
+
});
|
|
335
331
|
}
|
|
336
|
-
|
|
337
|
-
|
|
332
|
+
bindTargets.forEach((t) => {
|
|
333
|
+
const handler = async (event) => {
|
|
334
|
+
if (options.stopPropagation) event.stopPropagation();
|
|
335
|
+
if (options.stopImmediatePropagation) event.stopImmediatePropagation();
|
|
336
|
+
if (options.preventDefault) event.preventDefault();
|
|
337
|
+
const currentHostSet = import_Utils.SwcUtils.getHostSet(this);
|
|
338
|
+
const args = { event, ...currentHostSet, $el: t, $root: t };
|
|
339
|
+
await this._invokeLifecycleMethod(meta.propertyKey, currentHostSet, [event, currentHostSet, args]);
|
|
340
|
+
};
|
|
341
|
+
t.addEventListener(type, handler, opts);
|
|
342
|
+
if (options.removeOnDisconnected === true || t === currentWin || t === currentWin.document) {
|
|
343
|
+
this._boundListeners.push({ target: t, type, handler, options: opts });
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
if (originalConnected) originalConnected.apply(this);
|
|
348
|
+
const aMethods = (0, import_lifecycles.findAllLifecycleMetadata)(this, import_lifecycles.ON_AFTER_CONNECTED_METADATA_KEY);
|
|
349
|
+
if (aMethods) {
|
|
350
|
+
for (const m of aMethods) this._invokeLifecycleMethod(m, hostSet);
|
|
338
351
|
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
352
|
+
this._executeSwcScript("swc-on-connected", hostSet);
|
|
353
|
+
this._executeSwcScript("swc-on-after-connected", hostSet);
|
|
354
|
+
this.__swc_connected = true;
|
|
355
|
+
};
|
|
356
|
+
const originalDisconnected = proto.disconnectedCallback;
|
|
357
|
+
proto.disconnectedCallback = function() {
|
|
358
|
+
const hostSet = import_Utils.SwcUtils.getHostSet(this);
|
|
359
|
+
this._executeSwcScript("swc-on-before-disconnected", hostSet);
|
|
360
|
+
const bMethods = (0, import_lifecycles.findAllLifecycleMetadata)(this, import_lifecycles.ON_BEFORE_DISCONNECTED_METADATA_KEY);
|
|
361
|
+
if (bMethods) {
|
|
362
|
+
for (const m of bMethods) this._invokeLifecycleMethod(m, hostSet);
|
|
363
|
+
}
|
|
364
|
+
if (this._boundListeners) {
|
|
345
365
|
this._boundListeners.forEach((l) => l.target.removeEventListener(l.type, l.handler, l.options));
|
|
346
366
|
this._boundListeners = [];
|
|
347
|
-
if (super.disconnectedCallback)
|
|
348
|
-
super.disconnectedCallback();
|
|
349
|
-
const aMethods = (0, import_lifecycles.findAllLifecycleMetadata)(this, import_lifecycles.ON_AFTER_DISCONNECTED_METADATA_KEY);
|
|
350
|
-
if (aMethods)
|
|
351
|
-
aMethods.forEach((m) => this._invokeLifecycleMethod(m, hostSet));
|
|
352
|
-
this._executeSwcScript("swc-on-disconnected", hostSet);
|
|
353
|
-
this._executeSwcScript("swc-on-after-disconnected", hostSet);
|
|
354
|
-
}
|
|
355
|
-
adoptedCallback() {
|
|
356
|
-
const hostSet = import_Utils.SwcUtils.getHostSet(this);
|
|
357
|
-
this._executeSwcScript("swc-on-before-adopted", hostSet);
|
|
358
|
-
const bMethods = (0, import_lifecycles.findAllLifecycleMetadata)(this, import_lifecycles.ON_BEFORE_ADOPTED_METADATA_KEY);
|
|
359
|
-
if (bMethods)
|
|
360
|
-
bMethods.forEach((m) => this._invokeLifecycleMethod(m, hostSet));
|
|
361
|
-
if (super.adoptedCallback)
|
|
362
|
-
super.adoptedCallback();
|
|
363
|
-
const aMethods = (0, import_lifecycles.findAllLifecycleMetadata)(this, import_lifecycles.ON_AFTER_ADOPTED_METADATA_KEY);
|
|
364
|
-
if (aMethods)
|
|
365
|
-
aMethods.forEach((m) => this._invokeLifecycleMethod(m, hostSet));
|
|
366
|
-
this._executeSwcScript("swc-on-adopted", hostSet);
|
|
367
|
-
this._executeSwcScript("swc-on-after-adopted", hostSet);
|
|
368
367
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
if (newVal !== null) {
|
|
374
|
-
const customEventMeta = emitCustomEventList.find((it) => it.options.attributeName === name);
|
|
375
|
-
const eventName = customEventMeta ? customEventMeta.options.type : name.substring(7);
|
|
376
|
-
this._bindAttributeEvent(this, name, newVal, eventName);
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
const mKeys = attrChangeMap.get(name);
|
|
380
|
-
if (mKeys && Array.isArray(mKeys)) {
|
|
381
|
-
const hSet = import_Utils.SwcUtils.getHostSet(this);
|
|
382
|
-
mKeys.forEach((key) => this._invokeLifecycleMethod(key, hSet, [newVal, old, name]));
|
|
383
|
-
}
|
|
368
|
+
if (originalDisconnected) originalDisconnected.apply(this);
|
|
369
|
+
const aMethods = (0, import_lifecycles.findAllLifecycleMetadata)(this, import_lifecycles.ON_AFTER_DISCONNECTED_METADATA_KEY);
|
|
370
|
+
if (aMethods) {
|
|
371
|
+
for (const m of aMethods) this._invokeLifecycleMethod(m, hostSet);
|
|
384
372
|
}
|
|
373
|
+
this._executeSwcScript("swc-on-disconnected", hostSet);
|
|
374
|
+
this._executeSwcScript("swc-on-after-disconnected", hostSet);
|
|
375
|
+
this.__swc_connected = false;
|
|
385
376
|
};
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
this.removeAttribute(attrName);
|
|
394
|
-
else
|
|
395
|
-
this.setAttribute(attrName, String(res));
|
|
396
|
-
}
|
|
397
|
-
return res;
|
|
398
|
-
};
|
|
377
|
+
const originalAdopted = proto.adoptedCallback;
|
|
378
|
+
proto.adoptedCallback = function() {
|
|
379
|
+
const hostSet = import_Utils.SwcUtils.getHostSet(this);
|
|
380
|
+
this._executeSwcScript("swc-on-before-adopted", hostSet);
|
|
381
|
+
const bMethods = (0, import_lifecycles.findAllLifecycleMetadata)(this, import_lifecycles.ON_BEFORE_ADOPTED_METADATA_KEY);
|
|
382
|
+
if (bMethods) {
|
|
383
|
+
for (const m of bMethods) this._invokeLifecycleMethod(m, hostSet);
|
|
399
384
|
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
if (typeof original === "function") {
|
|
405
|
-
NewClass.prototype[propertyKey] = function(...args) {
|
|
406
|
-
const detail = original.apply(this, args);
|
|
407
|
-
const event = new CustomEvent(options.type, {
|
|
408
|
-
detail,
|
|
409
|
-
bubbles: options.bubbles,
|
|
410
|
-
composed: options.composed,
|
|
411
|
-
cancelable: options.cancelable
|
|
412
|
-
});
|
|
413
|
-
this.dispatchEvent(event);
|
|
414
|
-
return detail;
|
|
415
|
-
};
|
|
385
|
+
if (originalAdopted) originalAdopted.apply(this);
|
|
386
|
+
const aMethods = (0, import_lifecycles.findAllLifecycleMetadata)(this, import_lifecycles.ON_AFTER_ADOPTED_METADATA_KEY);
|
|
387
|
+
if (aMethods) {
|
|
388
|
+
for (const m of aMethods) this._invokeLifecycleMethod(m, hostSet);
|
|
416
389
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
targetEl = this;
|
|
430
|
-
} else {
|
|
431
|
-
targetEl = (this.shadowRoot || this).querySelector(selector);
|
|
432
|
-
}
|
|
433
|
-
if (targetEl) {
|
|
434
|
-
const nodes = Array.isArray(res) ? res : [res];
|
|
435
|
-
const normalizedNodes = nodes.map((n) => {
|
|
436
|
-
if (typeof n === "string") {
|
|
437
|
-
const t = currentDoc.createElement("template");
|
|
438
|
-
t.innerHTML = n;
|
|
439
|
-
return t.content;
|
|
440
|
-
}
|
|
441
|
-
return n;
|
|
442
|
-
});
|
|
443
|
-
targetEl.replaceChildren(...normalizedNodes);
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
return res;
|
|
447
|
-
};
|
|
390
|
+
this._executeSwcScript("swc-on-adopted", hostSet);
|
|
391
|
+
this._executeSwcScript("swc-on-after-adopted", hostSet);
|
|
392
|
+
};
|
|
393
|
+
const originalAttributeChanged = proto.attributeChangedCallback;
|
|
394
|
+
proto.attributeChangedCallback = function(name2, old, newVal) {
|
|
395
|
+
if (originalAttributeChanged) originalAttributeChanged.apply(this, [name2, old, newVal]);
|
|
396
|
+
if (name2.startsWith("swc-on-") && !swcLifecycleAttributes.includes(name2)) {
|
|
397
|
+
if (newVal !== null) {
|
|
398
|
+
const customEventMeta = emitCustomEventList.find((it) => it.options.attributeName === name2);
|
|
399
|
+
const eventName = customEventMeta ? customEventMeta.type : name2.substring(7);
|
|
400
|
+
this._bindAttributeEvent(this, name2, newVal, eventName);
|
|
401
|
+
}
|
|
448
402
|
}
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
if (typeof original === "function") {
|
|
454
|
-
NewClass.prototype[methodName] = function(...args) {
|
|
455
|
-
const res = original.apply(this, args);
|
|
456
|
-
if (res !== void 0) {
|
|
457
|
-
const conf = getElementConfig(this);
|
|
458
|
-
const currentWin = conf?.window || window;
|
|
459
|
-
const currentDoc = currentWin.document;
|
|
460
|
-
let targetEl = null;
|
|
461
|
-
if (selector === ":host" || !selector) {
|
|
462
|
-
targetEl = this;
|
|
463
|
-
} else {
|
|
464
|
-
targetEl = (this.shadowRoot || this).querySelector(selector);
|
|
465
|
-
}
|
|
466
|
-
if (targetEl) {
|
|
467
|
-
const nodes = Array.isArray(res) ? res : [res];
|
|
468
|
-
const normalizedNodes = nodes.map((n) => {
|
|
469
|
-
if (typeof n === "string") {
|
|
470
|
-
const t = currentDoc.createElement("template");
|
|
471
|
-
t.innerHTML = n;
|
|
472
|
-
return t.content;
|
|
473
|
-
}
|
|
474
|
-
return n;
|
|
475
|
-
});
|
|
476
|
-
const pos = options.position || "lastChild";
|
|
477
|
-
if (pos === "lastChild")
|
|
478
|
-
targetEl.append(...normalizedNodes);
|
|
479
|
-
else if (pos === "firstChild")
|
|
480
|
-
targetEl.prepend(...normalizedNodes);
|
|
481
|
-
else if (pos === "nextSibling")
|
|
482
|
-
targetEl.after(...normalizedNodes);
|
|
483
|
-
else if (pos === "previousSibling")
|
|
484
|
-
targetEl.before(...normalizedNodes);
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
return res;
|
|
488
|
-
};
|
|
403
|
+
const mKeys = attrChangeMap.get(name2);
|
|
404
|
+
if (mKeys && Array.isArray(mKeys)) {
|
|
405
|
+
const hSet = import_Utils.SwcUtils.getHostSet(this);
|
|
406
|
+
for (const key of mKeys) this._invokeLifecycleMethod(key, hSet, [newVal, old, name2]);
|
|
489
407
|
}
|
|
408
|
+
};
|
|
409
|
+
Object.defineProperty(constructor, "observedAttributes", {
|
|
410
|
+
get: () => mergedObservedAttributes,
|
|
411
|
+
configurable: true
|
|
490
412
|
});
|
|
491
|
-
|
|
492
|
-
const
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
return;
|
|
496
|
-
const keys = Reflect.getMetadataKeys(originalProto, name);
|
|
497
|
-
keys.forEach((key) => Reflect.defineMetadata(key, Reflect.getMetadata(key, originalProto, name), newProto, name));
|
|
498
|
-
});
|
|
499
|
-
import_ReflectUtils.ReflectUtils.defineMetadata(ELEMENT_CONFIG_KEY, config, NewClass);
|
|
500
|
-
import_ReflectUtils.ReflectUtils.defineMetadata(ELEMENT_CONFIG_KEY, config, constructor);
|
|
501
|
-
const registry = config.customElementRegistry || win?.customElements;
|
|
502
|
-
if (registry && !registry.get(config.name)) {
|
|
503
|
-
registry.define(config.name, NewClass, config.extends ? { extends: config.extends } : void 0);
|
|
413
|
+
import_core.ReflectUtils.defineMetadata(ELEMENT_CONFIG_KEY, metadata, constructor);
|
|
414
|
+
const registry = metadata.customElementRegistry || win?.customElements;
|
|
415
|
+
if (registry && !registry.get(metadata.name)) {
|
|
416
|
+
registry.define(metadata.name, constructor, metadata.extends ? { extends: metadata.extends } : void 0);
|
|
504
417
|
}
|
|
505
|
-
return
|
|
506
|
-
};
|
|
507
|
-
const getElementConfig = (target) => {
|
|
508
|
-
const constructor = target instanceof Function ? target : target.constructor;
|
|
509
|
-
return import_ReflectUtils.ReflectUtils.getMetadata(ELEMENT_CONFIG_KEY, constructor);
|
|
418
|
+
return constructor;
|
|
510
419
|
};
|
|
511
420
|
//# sourceMappingURL=elementDefine.js.map
|