@adaas/are-html 0.0.2
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/.conf/tsconfig.base.json +87 -0
- package/.conf/tsconfig.browser.json +34 -0
- package/.conf/tsconfig.node.json +35 -0
- package/.nvmrc +1 -0
- package/LICENSE +13 -0
- package/README.md +678 -0
- package/dist/browser/index.d.mts +521 -0
- package/dist/browser/index.mjs +1782 -0
- package/dist/browser/index.mjs.map +1 -0
- package/dist/node/AreBinding.attribute-C6JasbJL.d.ts +110 -0
- package/dist/node/AreBinding.attribute-C6qrxN8K.d.mts +110 -0
- package/dist/node/attributes/AreBinding.attribute.d.mts +4 -0
- package/dist/node/attributes/AreBinding.attribute.d.ts +4 -0
- package/dist/node/attributes/AreBinding.attribute.js +15 -0
- package/dist/node/attributes/AreBinding.attribute.js.map +1 -0
- package/dist/node/attributes/AreBinding.attribute.mjs +14 -0
- package/dist/node/attributes/AreBinding.attribute.mjs.map +1 -0
- package/dist/node/attributes/AreDirective.attribute.d.mts +4 -0
- package/dist/node/attributes/AreDirective.attribute.d.ts +4 -0
- package/dist/node/attributes/AreDirective.attribute.js +20 -0
- package/dist/node/attributes/AreDirective.attribute.js.map +1 -0
- package/dist/node/attributes/AreDirective.attribute.mjs +19 -0
- package/dist/node/attributes/AreDirective.attribute.mjs.map +1 -0
- package/dist/node/attributes/AreEvent.attribute.d.mts +4 -0
- package/dist/node/attributes/AreEvent.attribute.d.ts +4 -0
- package/dist/node/attributes/AreEvent.attribute.js +10 -0
- package/dist/node/attributes/AreEvent.attribute.js.map +1 -0
- package/dist/node/attributes/AreEvent.attribute.mjs +9 -0
- package/dist/node/attributes/AreEvent.attribute.mjs.map +1 -0
- package/dist/node/attributes/AreStatic.attribute.d.mts +4 -0
- package/dist/node/attributes/AreStatic.attribute.d.ts +4 -0
- package/dist/node/attributes/AreStatic.attribute.js +10 -0
- package/dist/node/attributes/AreStatic.attribute.js.map +1 -0
- package/dist/node/attributes/AreStatic.attribute.mjs +9 -0
- package/dist/node/attributes/AreStatic.attribute.mjs.map +1 -0
- package/dist/node/chunk-EQQGB2QZ.mjs +15 -0
- package/dist/node/chunk-EQQGB2QZ.mjs.map +1 -0
- package/dist/node/directives/AreComponent.directive.d.mts +2 -0
- package/dist/node/directives/AreComponent.directive.d.ts +2 -0
- package/dist/node/directives/AreComponent.directive.js +4 -0
- package/dist/node/directives/AreComponent.directive.js.map +1 -0
- package/dist/node/directives/AreComponent.directive.mjs +3 -0
- package/dist/node/directives/AreComponent.directive.mjs.map +1 -0
- package/dist/node/directives/AreDirectiveFor.directive.d.mts +41 -0
- package/dist/node/directives/AreDirectiveFor.directive.d.ts +41 -0
- package/dist/node/directives/AreDirectiveFor.directive.js +206 -0
- package/dist/node/directives/AreDirectiveFor.directive.js.map +1 -0
- package/dist/node/directives/AreDirectiveFor.directive.mjs +196 -0
- package/dist/node/directives/AreDirectiveFor.directive.mjs.map +1 -0
- package/dist/node/directives/AreDirectiveIf.directive.d.mts +15 -0
- package/dist/node/directives/AreDirectiveIf.directive.d.ts +15 -0
- package/dist/node/directives/AreDirectiveIf.directive.js +91 -0
- package/dist/node/directives/AreDirectiveIf.directive.js.map +1 -0
- package/dist/node/directives/AreDirectiveIf.directive.mjs +81 -0
- package/dist/node/directives/AreDirectiveIf.directive.mjs.map +1 -0
- package/dist/node/engine/AreHTML.compiler.d.mts +27 -0
- package/dist/node/engine/AreHTML.compiler.d.ts +27 -0
- package/dist/node/engine/AreHTML.compiler.js +150 -0
- package/dist/node/engine/AreHTML.compiler.js.map +1 -0
- package/dist/node/engine/AreHTML.compiler.mjs +140 -0
- package/dist/node/engine/AreHTML.compiler.mjs.map +1 -0
- package/dist/node/engine/AreHTML.constants.d.mts +2 -0
- package/dist/node/engine/AreHTML.constants.d.ts +2 -0
- package/dist/node/engine/AreHTML.constants.js +4 -0
- package/dist/node/engine/AreHTML.constants.js.map +1 -0
- package/dist/node/engine/AreHTML.constants.mjs +3 -0
- package/dist/node/engine/AreHTML.constants.mjs.map +1 -0
- package/dist/node/engine/AreHTML.context.d.mts +108 -0
- package/dist/node/engine/AreHTML.context.d.ts +108 -0
- package/dist/node/engine/AreHTML.context.js +155 -0
- package/dist/node/engine/AreHTML.context.js.map +1 -0
- package/dist/node/engine/AreHTML.context.mjs +154 -0
- package/dist/node/engine/AreHTML.context.mjs.map +1 -0
- package/dist/node/engine/AreHTML.engine.d.mts +21 -0
- package/dist/node/engine/AreHTML.engine.d.ts +21 -0
- package/dist/node/engine/AreHTML.engine.js +191 -0
- package/dist/node/engine/AreHTML.engine.js.map +1 -0
- package/dist/node/engine/AreHTML.engine.mjs +181 -0
- package/dist/node/engine/AreHTML.engine.mjs.map +1 -0
- package/dist/node/engine/AreHTML.interpreter.d.mts +28 -0
- package/dist/node/engine/AreHTML.interpreter.d.ts +28 -0
- package/dist/node/engine/AreHTML.interpreter.js +340 -0
- package/dist/node/engine/AreHTML.interpreter.js.map +1 -0
- package/dist/node/engine/AreHTML.interpreter.mjs +330 -0
- package/dist/node/engine/AreHTML.interpreter.mjs.map +1 -0
- package/dist/node/engine/AreHTML.lifecycle.d.mts +17 -0
- package/dist/node/engine/AreHTML.lifecycle.d.ts +17 -0
- package/dist/node/engine/AreHTML.lifecycle.js +91 -0
- package/dist/node/engine/AreHTML.lifecycle.js.map +1 -0
- package/dist/node/engine/AreHTML.lifecycle.mjs +79 -0
- package/dist/node/engine/AreHTML.lifecycle.mjs.map +1 -0
- package/dist/node/engine/AreHTML.tokenizer.d.mts +13 -0
- package/dist/node/engine/AreHTML.tokenizer.d.ts +13 -0
- package/dist/node/engine/AreHTML.tokenizer.js +83 -0
- package/dist/node/engine/AreHTML.tokenizer.js.map +1 -0
- package/dist/node/engine/AreHTML.tokenizer.mjs +71 -0
- package/dist/node/engine/AreHTML.tokenizer.mjs.map +1 -0
- package/dist/node/engine/AreHTML.transformer.d.mts +11 -0
- package/dist/node/engine/AreHTML.transformer.d.ts +11 -0
- package/dist/node/engine/AreHTML.transformer.js +44 -0
- package/dist/node/engine/AreHTML.transformer.js.map +1 -0
- package/dist/node/engine/AreHTML.transformer.mjs +32 -0
- package/dist/node/engine/AreHTML.transformer.mjs.map +1 -0
- package/dist/node/engine/AreHTML.types.d.mts +6 -0
- package/dist/node/engine/AreHTML.types.d.ts +6 -0
- package/dist/node/engine/AreHTML.types.js +4 -0
- package/dist/node/engine/AreHTML.types.js.map +1 -0
- package/dist/node/engine/AreHTML.types.mjs +3 -0
- package/dist/node/engine/AreHTML.types.mjs.map +1 -0
- package/dist/node/index.d.mts +39 -0
- package/dist/node/index.d.ts +39 -0
- package/dist/node/index.js +294 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/index.mjs +43 -0
- package/dist/node/index.mjs.map +1 -0
- package/dist/node/instructions/AddAttribute.instruction.d.mts +9 -0
- package/dist/node/instructions/AddAttribute.instruction.d.ts +9 -0
- package/dist/node/instructions/AddAttribute.instruction.js +32 -0
- package/dist/node/instructions/AddAttribute.instruction.js.map +1 -0
- package/dist/node/instructions/AddAttribute.instruction.mjs +25 -0
- package/dist/node/instructions/AddAttribute.instruction.mjs.map +1 -0
- package/dist/node/instructions/AddComment.instruction.d.mts +9 -0
- package/dist/node/instructions/AddComment.instruction.d.ts +9 -0
- package/dist/node/instructions/AddComment.instruction.js +35 -0
- package/dist/node/instructions/AddComment.instruction.js.map +1 -0
- package/dist/node/instructions/AddComment.instruction.mjs +28 -0
- package/dist/node/instructions/AddComment.instruction.mjs.map +1 -0
- package/dist/node/instructions/AddElement.instruction.d.mts +8 -0
- package/dist/node/instructions/AddElement.instruction.d.ts +8 -0
- package/dist/node/instructions/AddElement.instruction.js +32 -0
- package/dist/node/instructions/AddElement.instruction.js.map +1 -0
- package/dist/node/instructions/AddElement.instruction.mjs +25 -0
- package/dist/node/instructions/AddElement.instruction.mjs.map +1 -0
- package/dist/node/instructions/AddInterpolation.instruction.d.mts +8 -0
- package/dist/node/instructions/AddInterpolation.instruction.d.ts +8 -0
- package/dist/node/instructions/AddInterpolation.instruction.js +32 -0
- package/dist/node/instructions/AddInterpolation.instruction.js.map +1 -0
- package/dist/node/instructions/AddInterpolation.instruction.mjs +25 -0
- package/dist/node/instructions/AddInterpolation.instruction.mjs.map +1 -0
- package/dist/node/instructions/AddListener.instruction.d.mts +8 -0
- package/dist/node/instructions/AddListener.instruction.d.ts +8 -0
- package/dist/node/instructions/AddListener.instruction.js +32 -0
- package/dist/node/instructions/AddListener.instruction.js.map +1 -0
- package/dist/node/instructions/AddListener.instruction.mjs +25 -0
- package/dist/node/instructions/AddListener.instruction.mjs.map +1 -0
- package/dist/node/instructions/AddStyle.instruction.d.mts +8 -0
- package/dist/node/instructions/AddStyle.instruction.d.ts +8 -0
- package/dist/node/instructions/AddStyle.instruction.js +32 -0
- package/dist/node/instructions/AddStyle.instruction.js.map +1 -0
- package/dist/node/instructions/AddStyle.instruction.mjs +25 -0
- package/dist/node/instructions/AddStyle.instruction.mjs.map +1 -0
- package/dist/node/instructions/AddText.instruction.d.mts +8 -0
- package/dist/node/instructions/AddText.instruction.d.ts +8 -0
- package/dist/node/instructions/AddText.instruction.js +32 -0
- package/dist/node/instructions/AddText.instruction.js.map +1 -0
- package/dist/node/instructions/AddText.instruction.mjs +25 -0
- package/dist/node/instructions/AddText.instruction.mjs.map +1 -0
- package/dist/node/instructions/AreHTML.instructions.constants.d.mts +11 -0
- package/dist/node/instructions/AreHTML.instructions.constants.d.ts +11 -0
- package/dist/node/instructions/AreHTML.instructions.constants.js +15 -0
- package/dist/node/instructions/AreHTML.instructions.constants.js.map +1 -0
- package/dist/node/instructions/AreHTML.instructions.constants.mjs +15 -0
- package/dist/node/instructions/AreHTML.instructions.constants.mjs.map +1 -0
- package/dist/node/instructions/AreHTML.instructions.types.d.mts +46 -0
- package/dist/node/instructions/AreHTML.instructions.types.d.ts +46 -0
- package/dist/node/instructions/AreHTML.instructions.types.js +4 -0
- package/dist/node/instructions/AreHTML.instructions.types.js.map +1 -0
- package/dist/node/instructions/AreHTML.instructions.types.mjs +3 -0
- package/dist/node/instructions/AreHTML.instructions.types.mjs.map +1 -0
- package/dist/node/lib/AreDirective/AreDirective.component.d.mts +4 -0
- package/dist/node/lib/AreDirective/AreDirective.component.d.ts +4 -0
- package/dist/node/lib/AreDirective/AreDirective.component.js +117 -0
- package/dist/node/lib/AreDirective/AreDirective.component.js.map +1 -0
- package/dist/node/lib/AreDirective/AreDirective.component.mjs +107 -0
- package/dist/node/lib/AreDirective/AreDirective.component.mjs.map +1 -0
- package/dist/node/lib/AreDirective/AreDirective.constants.d.mts +16 -0
- package/dist/node/lib/AreDirective/AreDirective.constants.d.ts +16 -0
- package/dist/node/lib/AreDirective/AreDirective.constants.js +20 -0
- package/dist/node/lib/AreDirective/AreDirective.constants.js.map +1 -0
- package/dist/node/lib/AreDirective/AreDirective.constants.mjs +20 -0
- package/dist/node/lib/AreDirective/AreDirective.constants.mjs.map +1 -0
- package/dist/node/lib/AreDirective/AreDirective.context.d.mts +9 -0
- package/dist/node/lib/AreDirective/AreDirective.context.d.ts +9 -0
- package/dist/node/lib/AreDirective/AreDirective.context.js +14 -0
- package/dist/node/lib/AreDirective/AreDirective.context.js.map +1 -0
- package/dist/node/lib/AreDirective/AreDirective.context.mjs +13 -0
- package/dist/node/lib/AreDirective/AreDirective.context.mjs.map +1 -0
- package/dist/node/lib/AreDirective/AreDirective.meta.d.mts +7 -0
- package/dist/node/lib/AreDirective/AreDirective.meta.d.ts +7 -0
- package/dist/node/lib/AreDirective/AreDirective.meta.js +14 -0
- package/dist/node/lib/AreDirective/AreDirective.meta.js.map +1 -0
- package/dist/node/lib/AreDirective/AreDirective.meta.mjs +13 -0
- package/dist/node/lib/AreDirective/AreDirective.meta.mjs.map +1 -0
- package/dist/node/lib/AreDirective/AreDirective.types.d.mts +17 -0
- package/dist/node/lib/AreDirective/AreDirective.types.d.ts +17 -0
- package/dist/node/lib/AreDirective/AreDirective.types.js +4 -0
- package/dist/node/lib/AreDirective/AreDirective.types.js.map +1 -0
- package/dist/node/lib/AreDirective/AreDirective.types.mjs +3 -0
- package/dist/node/lib/AreDirective/AreDirective.types.mjs.map +1 -0
- package/dist/node/lib/AreHTML/AreHTML.tokenizer.d.mts +13 -0
- package/dist/node/lib/AreHTML/AreHTML.tokenizer.d.ts +13 -0
- package/dist/node/lib/AreHTML/AreHTML.tokenizer.js +82 -0
- package/dist/node/lib/AreHTML/AreHTML.tokenizer.js.map +1 -0
- package/dist/node/lib/AreHTML/AreHTML.tokenizer.mjs +70 -0
- package/dist/node/lib/AreHTML/AreHTML.tokenizer.mjs.map +1 -0
- package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.d.mts +4 -0
- package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.d.ts +4 -0
- package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.js +13 -0
- package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.js.map +1 -0
- package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.mjs +12 -0
- package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.mjs.map +1 -0
- package/dist/node/lib/AreHTMLNode/AreHTMLNode.d.mts +4 -0
- package/dist/node/lib/AreHTMLNode/AreHTMLNode.d.ts +4 -0
- package/dist/node/lib/AreHTMLNode/AreHTMLNode.js +82 -0
- package/dist/node/lib/AreHTMLNode/AreHTMLNode.js.map +1 -0
- package/dist/node/lib/AreHTMLNode/AreHTMLNode.mjs +75 -0
- package/dist/node/lib/AreHTMLNode/AreHTMLNode.mjs.map +1 -0
- package/dist/node/lib/AreRoot/AreRoot.component.d.mts +13 -0
- package/dist/node/lib/AreRoot/AreRoot.component.d.ts +13 -0
- package/dist/node/lib/AreRoot/AreRoot.component.js +117 -0
- package/dist/node/lib/AreRoot/AreRoot.component.js.map +1 -0
- package/dist/node/lib/AreRoot/AreRoot.component.mjs +107 -0
- package/dist/node/lib/AreRoot/AreRoot.component.mjs.map +1 -0
- package/dist/node/lib/AreStyle/AreStyle.context.d.mts +8 -0
- package/dist/node/lib/AreStyle/AreStyle.context.d.ts +8 -0
- package/dist/node/lib/AreStyle/AreStyle.context.js +16 -0
- package/dist/node/lib/AreStyle/AreStyle.context.js.map +1 -0
- package/dist/node/lib/AreStyle/AreStyle.context.mjs +15 -0
- package/dist/node/lib/AreStyle/AreStyle.context.mjs.map +1 -0
- package/dist/node/lib/AreStyle/AreStyle.types.d.mts +2 -0
- package/dist/node/lib/AreStyle/AreStyle.types.d.ts +2 -0
- package/dist/node/lib/AreStyle/AreStyle.types.js +4 -0
- package/dist/node/lib/AreStyle/AreStyle.types.js.map +1 -0
- package/dist/node/lib/AreStyle/AreStyle.types.mjs +3 -0
- package/dist/node/lib/AreStyle/AreStyle.types.mjs.map +1 -0
- package/dist/node/lib/AreWatcher/AreWatcher.component.d.mts +18 -0
- package/dist/node/lib/AreWatcher/AreWatcher.component.d.ts +18 -0
- package/dist/node/lib/AreWatcher/AreWatcher.component.js +78 -0
- package/dist/node/lib/AreWatcher/AreWatcher.component.js.map +1 -0
- package/dist/node/lib/AreWatcher/AreWatcher.component.mjs +71 -0
- package/dist/node/lib/AreWatcher/AreWatcher.component.mjs.map +1 -0
- package/dist/node/nodes/AreComment.d.mts +10 -0
- package/dist/node/nodes/AreComment.d.ts +10 -0
- package/dist/node/nodes/AreComment.js +19 -0
- package/dist/node/nodes/AreComment.js.map +1 -0
- package/dist/node/nodes/AreComment.mjs +18 -0
- package/dist/node/nodes/AreComment.mjs.map +1 -0
- package/dist/node/nodes/AreComponent.d.mts +17 -0
- package/dist/node/nodes/AreComponent.d.ts +17 -0
- package/dist/node/nodes/AreComponent.js +35 -0
- package/dist/node/nodes/AreComponent.js.map +1 -0
- package/dist/node/nodes/AreComponent.mjs +28 -0
- package/dist/node/nodes/AreComponent.mjs.map +1 -0
- package/dist/node/nodes/AreInterpolation.d.mts +10 -0
- package/dist/node/nodes/AreInterpolation.d.ts +10 -0
- package/dist/node/nodes/AreInterpolation.js +19 -0
- package/dist/node/nodes/AreInterpolation.js.map +1 -0
- package/dist/node/nodes/AreInterpolation.mjs +18 -0
- package/dist/node/nodes/AreInterpolation.mjs.map +1 -0
- package/dist/node/nodes/AreRoot.d.mts +21 -0
- package/dist/node/nodes/AreRoot.d.ts +21 -0
- package/dist/node/nodes/AreRoot.js +41 -0
- package/dist/node/nodes/AreRoot.js.map +1 -0
- package/dist/node/nodes/AreRoot.mjs +34 -0
- package/dist/node/nodes/AreRoot.mjs.map +1 -0
- package/dist/node/nodes/AreText.d.mts +10 -0
- package/dist/node/nodes/AreText.d.ts +10 -0
- package/dist/node/nodes/AreText.js +19 -0
- package/dist/node/nodes/AreText.js.map +1 -0
- package/dist/node/nodes/AreText.mjs +18 -0
- package/dist/node/nodes/AreText.mjs.map +1 -0
- package/dist/node/signals/AreRoute.signal.d.mts +12 -0
- package/dist/node/signals/AreRoute.signal.d.ts +12 -0
- package/dist/node/signals/AreRoute.signal.js +25 -0
- package/dist/node/signals/AreRoute.signal.js.map +1 -0
- package/dist/node/signals/AreRoute.signal.mjs +24 -0
- package/dist/node/signals/AreRoute.signal.mjs.map +1 -0
- package/docs/a-logo-docs.png +0 -0
- package/examples/dashboard/concept.ts +60 -0
- package/examples/dashboard/containers/UI.container.ts +233 -0
- package/examples/dashboard/dist/index.html +22 -0
- package/examples/dashboard/dist/mnzfypsd-6zjt7w.js +11454 -0
- package/examples/dashboard/dist/styles.css +792 -0
- package/examples/dashboard/public/index.html +22 -0
- package/examples/dashboard/public/styles.css +792 -0
- package/examples/dashboard/src/components/DashboardApp.component.ts +31 -0
- package/examples/dashboard/src/components/DashboardHeader.component.ts +40 -0
- package/examples/dashboard/src/components/DashboardLogo.component.ts +29 -0
- package/examples/dashboard/src/components/DashboardMain.component.ts +57 -0
- package/examples/dashboard/src/components/DashboardMenu.component.ts +94 -0
- package/examples/dashboard/src/components/DashboardNav.component.ts +28 -0
- package/examples/dashboard/src/components/DashboardNavItem.component.ts +32 -0
- package/examples/dashboard/src/components/DashboardSidebar.component.ts +43 -0
- package/examples/dashboard/src/components/DashboardStatCard.component.ts +71 -0
- package/examples/dashboard/src/components/DashboardStats.component.ts +28 -0
- package/examples/dashboard/src/components/DashboardTable.component.ts +138 -0
- package/examples/dashboard/src/components/DashboardUserCard.component.ts +39 -0
- package/examples/dashboard/src/concept.ts +93 -0
- package/examples/jumpstart/concept.ts +60 -0
- package/examples/jumpstart/containers/UI.container.ts +233 -0
- package/examples/jumpstart/dist/index.html +104 -0
- package/examples/jumpstart/dist/mnpl1g4i-nobz9g.js +10882 -0
- package/examples/jumpstart/dist/static/css/main.css +40 -0
- package/examples/jumpstart/dist/static/img/test.png +0 -0
- package/examples/jumpstart/public/index.html +104 -0
- package/examples/jumpstart/public/static/css/main.css +40 -0
- package/examples/jumpstart/public/static/img/test.png +0 -0
- package/examples/jumpstart/src/components/A-Btn.component.ts +150 -0
- package/examples/jumpstart/src/components/A-Input.component.ts +78 -0
- package/examples/jumpstart/src/components/A-Navigation.component.ts +167 -0
- package/examples/jumpstart/src/components/List.component.ts +138 -0
- package/examples/jumpstart/src/components/PromptTextArea.component.ts +359 -0
- package/examples/jumpstart/src/components/SignInComponent.component.ts +127 -0
- package/examples/jumpstart/src/concept.ts +105 -0
- package/jest.config.ts +61 -0
- package/package.json +110 -0
- package/src/attributes/AreBinding.attribute.ts +19 -0
- package/src/attributes/AreDirective.attribute.ts +26 -0
- package/src/attributes/AreEvent.attribute.ts +5 -0
- package/src/attributes/AreStatic.attribute.ts +6 -0
- package/src/directives/AreComponent.directive.ts +0 -0
- package/src/directives/AreDirectiveFor.directive.ts +322 -0
- package/src/directives/AreDirectiveIf.directive.ts +130 -0
- package/src/engine/AreHTML.compiler.ts +226 -0
- package/src/engine/AreHTML.constants.ts +2 -0
- package/src/engine/AreHTML.context.ts +196 -0
- package/src/engine/AreHTML.engine.ts +210 -0
- package/src/engine/AreHTML.interpreter.ts +466 -0
- package/src/engine/AreHTML.lifecycle.ts +96 -0
- package/src/engine/AreHTML.tokenizer.ts +90 -0
- package/src/engine/AreHTML.transformer.ts +37 -0
- package/src/engine/AreHTML.types.ts +6 -0
- package/src/index.ts +80 -0
- package/src/instructions/AddAttribute.instruction.ts +25 -0
- package/src/instructions/AddComment.instruction.ts +27 -0
- package/src/instructions/AddElement.instruction.ts +22 -0
- package/src/instructions/AddInterpolation.instruction.ts +24 -0
- package/src/instructions/AddListener.instruction.ts +24 -0
- package/src/instructions/AddStyle.instruction.ts +24 -0
- package/src/instructions/AddText.instruction.ts +21 -0
- package/src/instructions/AreHTML.instructions.constants.ts +11 -0
- package/src/instructions/AreHTML.instructions.types.ts +51 -0
- package/src/lib/AreDirective/AreDirective.component.ts +124 -0
- package/src/lib/AreDirective/AreDirective.constants.ts +16 -0
- package/src/lib/AreDirective/AreDirective.context.ts +16 -0
- package/src/lib/AreDirective/AreDirective.meta.ts +9 -0
- package/src/lib/AreDirective/AreDirective.types.ts +14 -0
- package/src/lib/AreHTML/AreHTML.tokenizer.ts +86 -0
- package/src/lib/AreHTMLAttribute/AreHTML.attribute.ts +13 -0
- package/src/lib/AreHTMLNode/AreHTMLNode.ts +84 -0
- package/src/lib/AreRoot/AreRoot.component.ts +134 -0
- package/src/lib/AreStyle/AreStyle.context.ts +20 -0
- package/src/lib/AreStyle/AreStyle.types.ts +0 -0
- package/src/lib/AreWatcher/AreWatcher.component.ts +84 -0
- package/src/nodes/AreComment.ts +17 -0
- package/src/nodes/AreComponent.ts +25 -0
- package/src/nodes/AreInterpolation.ts +16 -0
- package/src/nodes/AreRoot.ts +29 -0
- package/src/nodes/AreText.ts +17 -0
- package/src/signals/AreRoute.signal.ts +27 -0
- package/tests/AreTokenizer.test.ts +260 -0
- package/tests/jest.setup.ts +30 -0
- package/tsconfig.json +60 -0
- package/tslint.json +98 -0
- package/tsup.config.ts +108 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { AreContext, AreNode, AreInstruction } from '@adaas/are';
|
|
2
|
+
import { AreHTMLContextConstructor } from './AreHTML.types.mjs';
|
|
3
|
+
|
|
4
|
+
declare class AreHTMLEngineContext extends AreContext {
|
|
5
|
+
/**
|
|
6
|
+
* Index structure mapping:
|
|
7
|
+
*
|
|
8
|
+
* Node -> Group ID -> Element
|
|
9
|
+
* -----------------------------------------------------------------------------------
|
|
10
|
+
* | - Attribute | group: string | Node
|
|
11
|
+
* | - Directive (e.g. for) | | Node
|
|
12
|
+
*/
|
|
13
|
+
protected index: {
|
|
14
|
+
/**
|
|
15
|
+
* 1 AreNode = 1 Dom Node
|
|
16
|
+
*
|
|
17
|
+
* uses ASEID
|
|
18
|
+
*/
|
|
19
|
+
nodeToHostElements: Map<string, Node>;
|
|
20
|
+
/**
|
|
21
|
+
* 1 Group Instruction = MANY Dom Nodes (e.g. for loop)
|
|
22
|
+
*
|
|
23
|
+
* uses ASEID
|
|
24
|
+
*/
|
|
25
|
+
groupToElements: Map<string, Set<Node>>;
|
|
26
|
+
/**
|
|
27
|
+
* 1 Dom Node = 1 Instruction
|
|
28
|
+
*
|
|
29
|
+
* uses ASEID
|
|
30
|
+
*/
|
|
31
|
+
elementToInstruction: WeakMap<Node, string>;
|
|
32
|
+
/**
|
|
33
|
+
* 1 Instruction = 1 Dom Node (for CreateElement instructions, for example)
|
|
34
|
+
*
|
|
35
|
+
* uses ASEID
|
|
36
|
+
*/
|
|
37
|
+
instructionToElement: Map<string, Node>;
|
|
38
|
+
/**
|
|
39
|
+
* Event listeners attached to elements, used for proper cleanup when reverting instructions. Maps a DOM element to a map of event names and their corresponding listeners, allowing the engine to track which listeners are attached to which elements and remove them when necessary (e.g., when an instruction is reverted).
|
|
40
|
+
*/
|
|
41
|
+
elementListeners: WeakMap<Node, Map<string, EventListenerOrEventListenerObject>>;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* The root container for the HTML engine, which can be either a Document or a ShadowRoot. This is where the engine will mount the generated DOM elements. The context uses this container to manage the relationship between AreNodes, instructions, and their corresponding DOM elements, allowing for efficient updates and cleanups as the application state changes.
|
|
45
|
+
*/
|
|
46
|
+
protected _container: Document;
|
|
47
|
+
constructor(props: Partial<AreHTMLContextConstructor>);
|
|
48
|
+
get container(): Document;
|
|
49
|
+
/**
|
|
50
|
+
* Retrieves the DOM element associated with a given AreNode. This method looks up the node's ASEID in the nodeToHostElements map to find the corresponding DOM element. If the node is not found, it returns undefined. This allows the engine to efficiently access and manipulate the DOM elements that correspond to specific nodes in the AreNode tree, enabling dynamic updates and interactions based on the application state.
|
|
51
|
+
*
|
|
52
|
+
* @param nodeASEID
|
|
53
|
+
*/
|
|
54
|
+
getNodeElement(nodeASEID: string): Node | undefined;
|
|
55
|
+
getNodeElement(node: AreNode): Node | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Associates a DOM element with a given instruction and its owner node. This method updates the context's index to map the instruction's ASEID to the provided DOM element, and also maps the element back to the instruction's ASEID for reverse lookup. If the instruction has an owner node, it also maps the node's ASEID to the element. Additionally, if the instruction belongs to a group, it adds the element to the set of elements associated with that group. This indexing allows the engine to efficiently manage and update DOM elements based on instructions and their corresponding nodes, enabling dynamic rendering and interaction in response to application state changes.
|
|
58
|
+
*
|
|
59
|
+
* @param instruction
|
|
60
|
+
* @param element
|
|
61
|
+
*/
|
|
62
|
+
setInstructionElement(instruction: AreInstruction, element: Node): void;
|
|
63
|
+
/**
|
|
64
|
+
* Retrieves the DOM element associated with a given instruction. This method looks up the instruction's ASEID in the instructionToElement map to find the corresponding DOM element. If the instruction is not found, it returns undefined. This allows the engine to efficiently access and manipulate the DOM elements that correspond to specific instructions, enabling dynamic updates and interactions based on the application state.
|
|
65
|
+
*
|
|
66
|
+
* @param instructionASEID
|
|
67
|
+
*/
|
|
68
|
+
getElementByInstruction(instructionASEID: string): Node | undefined;
|
|
69
|
+
getElementByInstruction(instruction: AreInstruction): Node | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Removes the association between a given instruction and its corresponding DOM element. This method looks up the instruction's ASEID to find the associated DOM element, and if found, it deletes the mapping from both instructionToElement and elementToInstruction. If the instruction has an owner node, it also removes the mapping from nodeToHostElements. Additionally, if the instruction belongs to a group, it removes the element from the set of elements associated with that group, and if the group has no more elements, it deletes the group from the index. This cleanup is essential for maintaining an accurate and efficient mapping of instructions to DOM elements, especially when instructions are reverted or when nodes are removed from the DOM.
|
|
72
|
+
*
|
|
73
|
+
* @param instruction
|
|
74
|
+
*/
|
|
75
|
+
removeInstructionElement(instruction: AreInstruction): void;
|
|
76
|
+
/**
|
|
77
|
+
* Retrieves the set of DOM elements associated with a given group. This method looks up the group name or instruction's ASEID in the groupToElements map to find the corresponding set of DOM elements. If the group is not found, it returns undefined. This allows the engine to efficiently access and manipulate all DOM elements that belong to a specific group (e.g., all elements generated by a particular loop instruction), enabling dynamic updates and interactions based on the application state.
|
|
78
|
+
*
|
|
79
|
+
* @param groupName
|
|
80
|
+
*/
|
|
81
|
+
getElementsByGroup(groupName: string): Set<Node> | undefined;
|
|
82
|
+
getElementsByGroup(instruction: AreInstruction): Set<Node> | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* Adds an event listener to a specific DOM element and keeps track of it in the context's index for proper cleanup later. This method takes a DOM element, an event name, and a listener function or object, and stores this information in the elementListeners map. This allows the engine to efficiently manage event listeners attached to dynamically created elements, ensuring that they can be removed when the associated instructions are reverted or when nodes are removed from the DOM, preventing memory leaks and unintended behavior.
|
|
85
|
+
*
|
|
86
|
+
* @param element
|
|
87
|
+
* @param eventName
|
|
88
|
+
* @param listener
|
|
89
|
+
*/
|
|
90
|
+
addListener(element: Node, eventName: string, listener: EventListenerOrEventListenerObject): void;
|
|
91
|
+
/**
|
|
92
|
+
* Retrieves the event listener associated with a specific DOM element and event name from the context's index. This method looks up the element in the elementListeners map and then retrieves the listener for the specified event name. If no listener is found for the given element and event, it returns undefined. This allows the engine to efficiently access and manage event listeners that have been attached to dynamically created elements, enabling proper cleanup when instructions are reverted or when nodes are removed from the DOM.
|
|
93
|
+
*
|
|
94
|
+
* @param element
|
|
95
|
+
* @param eventName
|
|
96
|
+
* @returns
|
|
97
|
+
*/
|
|
98
|
+
getListener(element: Node, eventName: string): EventListenerOrEventListenerObject | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* Removes an event listener from a specific DOM element and updates the context's index accordingly. This method looks up the element in the elementListeners map and deletes the listener for the specified event name. This is typically called when an instruction is reverted or when a node is removed from the DOM, ensuring that any attached event listeners are properly cleaned up to prevent memory leaks and unintended behavior.
|
|
101
|
+
*
|
|
102
|
+
* @param element
|
|
103
|
+
* @param eventName
|
|
104
|
+
*/
|
|
105
|
+
removeListener(element: Node, eventName: string): void;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export { AreHTMLEngineContext };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { AreContext, AreNode, AreInstruction } from '@adaas/are';
|
|
2
|
+
import { AreHTMLContextConstructor } from './AreHTML.types.js';
|
|
3
|
+
|
|
4
|
+
declare class AreHTMLEngineContext extends AreContext {
|
|
5
|
+
/**
|
|
6
|
+
* Index structure mapping:
|
|
7
|
+
*
|
|
8
|
+
* Node -> Group ID -> Element
|
|
9
|
+
* -----------------------------------------------------------------------------------
|
|
10
|
+
* | - Attribute | group: string | Node
|
|
11
|
+
* | - Directive (e.g. for) | | Node
|
|
12
|
+
*/
|
|
13
|
+
protected index: {
|
|
14
|
+
/**
|
|
15
|
+
* 1 AreNode = 1 Dom Node
|
|
16
|
+
*
|
|
17
|
+
* uses ASEID
|
|
18
|
+
*/
|
|
19
|
+
nodeToHostElements: Map<string, Node>;
|
|
20
|
+
/**
|
|
21
|
+
* 1 Group Instruction = MANY Dom Nodes (e.g. for loop)
|
|
22
|
+
*
|
|
23
|
+
* uses ASEID
|
|
24
|
+
*/
|
|
25
|
+
groupToElements: Map<string, Set<Node>>;
|
|
26
|
+
/**
|
|
27
|
+
* 1 Dom Node = 1 Instruction
|
|
28
|
+
*
|
|
29
|
+
* uses ASEID
|
|
30
|
+
*/
|
|
31
|
+
elementToInstruction: WeakMap<Node, string>;
|
|
32
|
+
/**
|
|
33
|
+
* 1 Instruction = 1 Dom Node (for CreateElement instructions, for example)
|
|
34
|
+
*
|
|
35
|
+
* uses ASEID
|
|
36
|
+
*/
|
|
37
|
+
instructionToElement: Map<string, Node>;
|
|
38
|
+
/**
|
|
39
|
+
* Event listeners attached to elements, used for proper cleanup when reverting instructions. Maps a DOM element to a map of event names and their corresponding listeners, allowing the engine to track which listeners are attached to which elements and remove them when necessary (e.g., when an instruction is reverted).
|
|
40
|
+
*/
|
|
41
|
+
elementListeners: WeakMap<Node, Map<string, EventListenerOrEventListenerObject>>;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* The root container for the HTML engine, which can be either a Document or a ShadowRoot. This is where the engine will mount the generated DOM elements. The context uses this container to manage the relationship between AreNodes, instructions, and their corresponding DOM elements, allowing for efficient updates and cleanups as the application state changes.
|
|
45
|
+
*/
|
|
46
|
+
protected _container: Document;
|
|
47
|
+
constructor(props: Partial<AreHTMLContextConstructor>);
|
|
48
|
+
get container(): Document;
|
|
49
|
+
/**
|
|
50
|
+
* Retrieves the DOM element associated with a given AreNode. This method looks up the node's ASEID in the nodeToHostElements map to find the corresponding DOM element. If the node is not found, it returns undefined. This allows the engine to efficiently access and manipulate the DOM elements that correspond to specific nodes in the AreNode tree, enabling dynamic updates and interactions based on the application state.
|
|
51
|
+
*
|
|
52
|
+
* @param nodeASEID
|
|
53
|
+
*/
|
|
54
|
+
getNodeElement(nodeASEID: string): Node | undefined;
|
|
55
|
+
getNodeElement(node: AreNode): Node | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Associates a DOM element with a given instruction and its owner node. This method updates the context's index to map the instruction's ASEID to the provided DOM element, and also maps the element back to the instruction's ASEID for reverse lookup. If the instruction has an owner node, it also maps the node's ASEID to the element. Additionally, if the instruction belongs to a group, it adds the element to the set of elements associated with that group. This indexing allows the engine to efficiently manage and update DOM elements based on instructions and their corresponding nodes, enabling dynamic rendering and interaction in response to application state changes.
|
|
58
|
+
*
|
|
59
|
+
* @param instruction
|
|
60
|
+
* @param element
|
|
61
|
+
*/
|
|
62
|
+
setInstructionElement(instruction: AreInstruction, element: Node): void;
|
|
63
|
+
/**
|
|
64
|
+
* Retrieves the DOM element associated with a given instruction. This method looks up the instruction's ASEID in the instructionToElement map to find the corresponding DOM element. If the instruction is not found, it returns undefined. This allows the engine to efficiently access and manipulate the DOM elements that correspond to specific instructions, enabling dynamic updates and interactions based on the application state.
|
|
65
|
+
*
|
|
66
|
+
* @param instructionASEID
|
|
67
|
+
*/
|
|
68
|
+
getElementByInstruction(instructionASEID: string): Node | undefined;
|
|
69
|
+
getElementByInstruction(instruction: AreInstruction): Node | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Removes the association between a given instruction and its corresponding DOM element. This method looks up the instruction's ASEID to find the associated DOM element, and if found, it deletes the mapping from both instructionToElement and elementToInstruction. If the instruction has an owner node, it also removes the mapping from nodeToHostElements. Additionally, if the instruction belongs to a group, it removes the element from the set of elements associated with that group, and if the group has no more elements, it deletes the group from the index. This cleanup is essential for maintaining an accurate and efficient mapping of instructions to DOM elements, especially when instructions are reverted or when nodes are removed from the DOM.
|
|
72
|
+
*
|
|
73
|
+
* @param instruction
|
|
74
|
+
*/
|
|
75
|
+
removeInstructionElement(instruction: AreInstruction): void;
|
|
76
|
+
/**
|
|
77
|
+
* Retrieves the set of DOM elements associated with a given group. This method looks up the group name or instruction's ASEID in the groupToElements map to find the corresponding set of DOM elements. If the group is not found, it returns undefined. This allows the engine to efficiently access and manipulate all DOM elements that belong to a specific group (e.g., all elements generated by a particular loop instruction), enabling dynamic updates and interactions based on the application state.
|
|
78
|
+
*
|
|
79
|
+
* @param groupName
|
|
80
|
+
*/
|
|
81
|
+
getElementsByGroup(groupName: string): Set<Node> | undefined;
|
|
82
|
+
getElementsByGroup(instruction: AreInstruction): Set<Node> | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* Adds an event listener to a specific DOM element and keeps track of it in the context's index for proper cleanup later. This method takes a DOM element, an event name, and a listener function or object, and stores this information in the elementListeners map. This allows the engine to efficiently manage event listeners attached to dynamically created elements, ensuring that they can be removed when the associated instructions are reverted or when nodes are removed from the DOM, preventing memory leaks and unintended behavior.
|
|
85
|
+
*
|
|
86
|
+
* @param element
|
|
87
|
+
* @param eventName
|
|
88
|
+
* @param listener
|
|
89
|
+
*/
|
|
90
|
+
addListener(element: Node, eventName: string, listener: EventListenerOrEventListenerObject): void;
|
|
91
|
+
/**
|
|
92
|
+
* Retrieves the event listener associated with a specific DOM element and event name from the context's index. This method looks up the element in the elementListeners map and then retrieves the listener for the specified event name. If no listener is found for the given element and event, it returns undefined. This allows the engine to efficiently access and manage event listeners that have been attached to dynamically created elements, enabling proper cleanup when instructions are reverted or when nodes are removed from the DOM.
|
|
93
|
+
*
|
|
94
|
+
* @param element
|
|
95
|
+
* @param eventName
|
|
96
|
+
* @returns
|
|
97
|
+
*/
|
|
98
|
+
getListener(element: Node, eventName: string): EventListenerOrEventListenerObject | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* Removes an event listener from a specific DOM element and updates the context's index accordingly. This method looks up the element in the elementListeners map and deletes the listener for the specified event name. This is typically called when an instruction is reverted or when a node is removed from the DOM, ensuring that any attached event listeners are properly cleaned up to prevent memory leaks and unintended behavior.
|
|
101
|
+
*
|
|
102
|
+
* @param element
|
|
103
|
+
* @param eventName
|
|
104
|
+
*/
|
|
105
|
+
removeListener(element: Node, eventName: string): void;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export { AreHTMLEngineContext };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var are = require('@adaas/are');
|
|
4
|
+
|
|
5
|
+
class AreHTMLEngineContext extends are.AreContext {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
super(props.container?.body.innerHTML || props.source || "");
|
|
8
|
+
/**
|
|
9
|
+
* Index structure mapping:
|
|
10
|
+
*
|
|
11
|
+
* Node -> Group ID -> Element
|
|
12
|
+
* -----------------------------------------------------------------------------------
|
|
13
|
+
* | - Attribute | group: string | Node
|
|
14
|
+
* | - Directive (e.g. for) | | Node
|
|
15
|
+
*/
|
|
16
|
+
this.index = {
|
|
17
|
+
/**
|
|
18
|
+
* 1 AreNode = 1 Dom Node
|
|
19
|
+
*
|
|
20
|
+
* uses ASEID
|
|
21
|
+
*/
|
|
22
|
+
nodeToHostElements: /* @__PURE__ */ new Map(),
|
|
23
|
+
/**
|
|
24
|
+
* 1 Group Instruction = MANY Dom Nodes (e.g. for loop)
|
|
25
|
+
*
|
|
26
|
+
* uses ASEID
|
|
27
|
+
*/
|
|
28
|
+
groupToElements: /* @__PURE__ */ new Map(),
|
|
29
|
+
/**
|
|
30
|
+
* 1 Dom Node = 1 Instruction
|
|
31
|
+
*
|
|
32
|
+
* uses ASEID
|
|
33
|
+
*/
|
|
34
|
+
elementToInstruction: /* @__PURE__ */ new WeakMap(),
|
|
35
|
+
/**
|
|
36
|
+
* 1 Instruction = 1 Dom Node (for CreateElement instructions, for example)
|
|
37
|
+
*
|
|
38
|
+
* uses ASEID
|
|
39
|
+
*/
|
|
40
|
+
instructionToElement: /* @__PURE__ */ new Map(),
|
|
41
|
+
/**
|
|
42
|
+
* Event listeners attached to elements, used for proper cleanup when reverting instructions. Maps a DOM element to a map of event names and their corresponding listeners, allowing the engine to track which listeners are attached to which elements and remove them when necessary (e.g., when an instruction is reverted).
|
|
43
|
+
*/
|
|
44
|
+
elementListeners: /* @__PURE__ */ new WeakMap()
|
|
45
|
+
};
|
|
46
|
+
this._container = props.container;
|
|
47
|
+
}
|
|
48
|
+
get container() {
|
|
49
|
+
return this._container;
|
|
50
|
+
}
|
|
51
|
+
getNodeElement(node) {
|
|
52
|
+
if (typeof node === "string") {
|
|
53
|
+
return this.index.nodeToHostElements.get(node);
|
|
54
|
+
} else {
|
|
55
|
+
return this.index.nodeToHostElements.get(node.aseid.toString());
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Associates a DOM element with a given instruction and its owner node. This method updates the context's index to map the instruction's ASEID to the provided DOM element, and also maps the element back to the instruction's ASEID for reverse lookup. If the instruction has an owner node, it also maps the node's ASEID to the element. Additionally, if the instruction belongs to a group, it adds the element to the set of elements associated with that group. This indexing allows the engine to efficiently manage and update DOM elements based on instructions and their corresponding nodes, enabling dynamic rendering and interaction in response to application state changes.
|
|
60
|
+
*
|
|
61
|
+
* @param instruction
|
|
62
|
+
* @param element
|
|
63
|
+
*/
|
|
64
|
+
setInstructionElement(instruction, element) {
|
|
65
|
+
const node = instruction.owner;
|
|
66
|
+
this.index.instructionToElement.set(instruction.aseid.toString(), element);
|
|
67
|
+
this.index.elementToInstruction.set(element, instruction.aseid.toString());
|
|
68
|
+
if (node) {
|
|
69
|
+
this.index.nodeToHostElements.set(node.aseid.toString(), element);
|
|
70
|
+
}
|
|
71
|
+
if (instruction.group) {
|
|
72
|
+
const groupId = instruction.group;
|
|
73
|
+
if (!this.index.groupToElements.has(groupId)) {
|
|
74
|
+
this.index.groupToElements.set(groupId, /* @__PURE__ */ new Set());
|
|
75
|
+
}
|
|
76
|
+
this.index.groupToElements.get(groupId).add(element);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
getElementByInstruction(instruction) {
|
|
80
|
+
if (typeof instruction === "string") {
|
|
81
|
+
return this.index.instructionToElement.get(instruction);
|
|
82
|
+
} else {
|
|
83
|
+
return this.index.instructionToElement.get(instruction.aseid.toString());
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Removes the association between a given instruction and its corresponding DOM element. This method looks up the instruction's ASEID to find the associated DOM element, and if found, it deletes the mapping from both instructionToElement and elementToInstruction. If the instruction has an owner node, it also removes the mapping from nodeToHostElements. Additionally, if the instruction belongs to a group, it removes the element from the set of elements associated with that group, and if the group has no more elements, it deletes the group from the index. This cleanup is essential for maintaining an accurate and efficient mapping of instructions to DOM elements, especially when instructions are reverted or when nodes are removed from the DOM.
|
|
88
|
+
*
|
|
89
|
+
* @param instruction
|
|
90
|
+
*/
|
|
91
|
+
removeInstructionElement(instruction) {
|
|
92
|
+
const element = this.index.instructionToElement.get(instruction.aseid.toString());
|
|
93
|
+
if (element) {
|
|
94
|
+
this.index.instructionToElement.delete(instruction.aseid.toString());
|
|
95
|
+
this.index.elementToInstruction.delete(element);
|
|
96
|
+
const node = instruction.owner;
|
|
97
|
+
if (node) {
|
|
98
|
+
this.index.nodeToHostElements.delete(node.aseid.toString());
|
|
99
|
+
}
|
|
100
|
+
if (instruction.group) {
|
|
101
|
+
const groupId = instruction.group;
|
|
102
|
+
const groupElements = this.index.groupToElements.get(groupId);
|
|
103
|
+
if (groupElements) {
|
|
104
|
+
groupElements.delete(element);
|
|
105
|
+
if (groupElements.size === 0) {
|
|
106
|
+
this.index.groupToElements.delete(groupId);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
getElementsByGroup(instruction) {
|
|
113
|
+
if (typeof instruction === "string") {
|
|
114
|
+
return this.index.groupToElements.get(instruction);
|
|
115
|
+
} else {
|
|
116
|
+
return this.index.groupToElements.get(instruction.aseid.toString());
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Adds an event listener to a specific DOM element and keeps track of it in the context's index for proper cleanup later. This method takes a DOM element, an event name, and a listener function or object, and stores this information in the elementListeners map. This allows the engine to efficiently manage event listeners attached to dynamically created elements, ensuring that they can be removed when the associated instructions are reverted or when nodes are removed from the DOM, preventing memory leaks and unintended behavior.
|
|
121
|
+
*
|
|
122
|
+
* @param element
|
|
123
|
+
* @param eventName
|
|
124
|
+
* @param listener
|
|
125
|
+
*/
|
|
126
|
+
addListener(element, eventName, listener) {
|
|
127
|
+
if (!this.index.elementListeners.has(element)) {
|
|
128
|
+
this.index.elementListeners.set(element, /* @__PURE__ */ new Map());
|
|
129
|
+
}
|
|
130
|
+
this.index.elementListeners.get(element).set(eventName, listener);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Retrieves the event listener associated with a specific DOM element and event name from the context's index. This method looks up the element in the elementListeners map and then retrieves the listener for the specified event name. If no listener is found for the given element and event, it returns undefined. This allows the engine to efficiently access and manage event listeners that have been attached to dynamically created elements, enabling proper cleanup when instructions are reverted or when nodes are removed from the DOM.
|
|
134
|
+
*
|
|
135
|
+
* @param element
|
|
136
|
+
* @param eventName
|
|
137
|
+
* @returns
|
|
138
|
+
*/
|
|
139
|
+
getListener(element, eventName) {
|
|
140
|
+
return this.index.elementListeners.get(element)?.get(eventName);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Removes an event listener from a specific DOM element and updates the context's index accordingly. This method looks up the element in the elementListeners map and deletes the listener for the specified event name. This is typically called when an instruction is reverted or when a node is removed from the DOM, ensuring that any attached event listeners are properly cleaned up to prevent memory leaks and unintended behavior.
|
|
144
|
+
*
|
|
145
|
+
* @param element
|
|
146
|
+
* @param eventName
|
|
147
|
+
*/
|
|
148
|
+
removeListener(element, eventName) {
|
|
149
|
+
this.index.elementListeners.get(element)?.delete(eventName);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
exports.AreHTMLEngineContext = AreHTMLEngineContext;
|
|
154
|
+
//# sourceMappingURL=AreHTML.context.js.map
|
|
155
|
+
//# sourceMappingURL=AreHTML.context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/engine/AreHTML.context.ts"],"names":["AreContext"],"mappings":";;;;AAIO,MAAM,6BAA6BA,cAAA,CAAW;AAAA,EAgDjD,YAAY,KAAA,EAA2C;AACnD,IAAA,KAAA,CAAM,MAAM,SAAA,EAAW,IAAA,CAAK,SAAA,IAAa,KAAA,CAAM,UAAU,EAAE,CAAA;AAtC/D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAA,IAAA,CAAU,KAAA,GAAQ;AAAA;AAAA;AAAA;AAA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AO,KAAK,KAAA,CAAM,gBAAA,CAAiB,IAAI,OAAO,CAAA,EAAG,IAAI,SAAS,CAAA;AAAA,EAClE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,cAAA,CAAe,SAAe,SAAA,EAAyB;AACnD,IAAA,IAAA,CAAK,MAAM,gBAAA,CAAiB,GAAA,CAAI,OAAO,CAAA,EAAG,OAAO,SAAS,CAAA;AAAA,EAC9D;AACJ","file":"AreHTML.context.js","sourcesContent":["import { AreContext, AreInstruction, AreNode } from \"@adaas/are\";\nimport { AreHTMLContextConstructor } from \"./AreHTML.types\";\n\n\nexport class AreHTMLEngineContext extends AreContext {\n\n /**\n * Index structure mapping:\n * \n * Node -> Group ID -> Element\n * -----------------------------------------------------------------------------------\n * | - Attribute | group: string | Node\n * | - Directive (e.g. for) | | Node\n */\n\n protected index = {\n /**\n * 1 AreNode = 1 Dom Node\n * \n * uses ASEID\n */\n nodeToHostElements: new Map<string, Node>(),\n /**\n * 1 Group Instruction = MANY Dom Nodes (e.g. for loop)\n * \n * uses ASEID\n */\n groupToElements: new Map<string, Set<Node>>(),\n /**\n * 1 Dom Node = 1 Instruction \n * \n * uses ASEID\n */\n elementToInstruction: new WeakMap<Node, string>(),\n /**\n * 1 Instruction = 1 Dom Node (for CreateElement instructions, for example)\n * \n * uses ASEID\n */\n instructionToElement: new Map<string, Node>(),\n /**\n * Event listeners attached to elements, used for proper cleanup when reverting instructions. Maps a DOM element to a map of event names and their corresponding listeners, allowing the engine to track which listeners are attached to which elements and remove them when necessary (e.g., when an instruction is reverted).\n */\n elementListeners: new WeakMap<Node, Map<string, EventListenerOrEventListenerObject>>()\n }\n\n /**\n * The root container for the HTML engine, which can be either a Document or a ShadowRoot. This is where the engine will mount the generated DOM elements. The context uses this container to manage the relationship between AreNodes, instructions, and their corresponding DOM elements, allowing for efficient updates and cleanups as the application state changes.\n */\n protected _container: Document;\n\n\n constructor(props: Partial<AreHTMLContextConstructor>) {\n super(props.container?.body.innerHTML || props.source || '');\n this._container = props.container!;\n }\n\n get container(): Document {\n return this._container;\n }\n\n\n /**\n * Retrieves the DOM element associated with a given AreNode. This method looks up the node's ASEID in the nodeToHostElements map to find the corresponding DOM element. If the node is not found, it returns undefined. This allows the engine to efficiently access and manipulate the DOM elements that correspond to specific nodes in the AreNode tree, enabling dynamic updates and interactions based on the application state.\n * \n * @param nodeASEID \n */\n getNodeElement(nodeASEID: string): Node | undefined\n getNodeElement(node: AreNode): Node | undefined\n getNodeElement(node: AreNode | string): Node | undefined {\n if (typeof node === 'string') {\n return this.index.nodeToHostElements.get(node);\n } else {\n return this.index.nodeToHostElements.get(node.aseid.toString());\n }\n }\n\n /**\n * Associates a DOM element with a given instruction and its owner node. This method updates the context's index to map the instruction's ASEID to the provided DOM element, and also maps the element back to the instruction's ASEID for reverse lookup. If the instruction has an owner node, it also maps the node's ASEID to the element. Additionally, if the instruction belongs to a group, it adds the element to the set of elements associated with that group. This indexing allows the engine to efficiently manage and update DOM elements based on instructions and their corresponding nodes, enabling dynamic rendering and interaction in response to application state changes.\n * \n * @param instruction \n * @param element \n */\n setInstructionElement(instruction: AreInstruction, element: Node): void {\n const node = instruction.owner;\n\n this.index.instructionToElement.set(instruction.aseid.toString(), element);\n this.index.elementToInstruction.set(element, instruction.aseid.toString());\n\n if (node) {\n this.index.nodeToHostElements.set(node.aseid.toString(), element);\n }\n\n if (instruction.group) {\n const groupId = instruction.group;\n if (!this.index.groupToElements.has(groupId)) {\n this.index.groupToElements.set(groupId, new Set());\n }\n this.index.groupToElements.get(groupId)!.add(element);\n }\n }\n\n\n /**\n * Retrieves the DOM element associated with a given instruction. This method looks up the instruction's ASEID in the instructionToElement map to find the corresponding DOM element. If the instruction is not found, it returns undefined. This allows the engine to efficiently access and manipulate the DOM elements that correspond to specific instructions, enabling dynamic updates and interactions based on the application state.\n * \n * @param instructionASEID \n */\n getElementByInstruction(instructionASEID: string): Node | undefined\n getElementByInstruction(instruction: AreInstruction): Node | undefined\n getElementByInstruction(instruction: AreInstruction | string): Node | undefined {\n if (typeof instruction === 'string') {\n return this.index.instructionToElement.get(instruction);\n } else {\n return this.index.instructionToElement.get(instruction.aseid.toString());\n }\n }\n\n\n /**\n * Removes the association between a given instruction and its corresponding DOM element. This method looks up the instruction's ASEID to find the associated DOM element, and if found, it deletes the mapping from both instructionToElement and elementToInstruction. If the instruction has an owner node, it also removes the mapping from nodeToHostElements. Additionally, if the instruction belongs to a group, it removes the element from the set of elements associated with that group, and if the group has no more elements, it deletes the group from the index. This cleanup is essential for maintaining an accurate and efficient mapping of instructions to DOM elements, especially when instructions are reverted or when nodes are removed from the DOM.\n * \n * @param instruction \n */\n removeInstructionElement(instruction: AreInstruction): void {\n const element = this.index.instructionToElement.get(instruction.aseid.toString());\n if (element) {\n this.index.instructionToElement.delete(instruction.aseid.toString());\n this.index.elementToInstruction.delete(element);\n\n const node = instruction.owner;\n if (node) {\n this.index.nodeToHostElements.delete(node.aseid.toString());\n }\n\n if (instruction.group) {\n const groupId = instruction.group;\n const groupElements = this.index.groupToElements.get(groupId);\n if (groupElements) {\n groupElements.delete(element);\n if (groupElements.size === 0) {\n this.index.groupToElements.delete(groupId);\n }\n }\n }\n }\n }\n\n /**\n * Retrieves the set of DOM elements associated with a given group. This method looks up the group name or instruction's ASEID in the groupToElements map to find the corresponding set of DOM elements. If the group is not found, it returns undefined. This allows the engine to efficiently access and manipulate all DOM elements that belong to a specific group (e.g., all elements generated by a particular loop instruction), enabling dynamic updates and interactions based on the application state.\n * \n * @param groupName \n */\n getElementsByGroup(groupName: string): Set<Node> | undefined\n getElementsByGroup(instruction: AreInstruction): Set<Node> | undefined\n getElementsByGroup(instruction: AreInstruction | string): Set<Node> | undefined {\n if (typeof instruction === 'string') {\n return this.index.groupToElements.get(instruction);\n } else {\n return this.index.groupToElements.get(instruction.aseid.toString());\n }\n }\n\n /**\n * Adds an event listener to a specific DOM element and keeps track of it in the context's index for proper cleanup later. This method takes a DOM element, an event name, and a listener function or object, and stores this information in the elementListeners map. This allows the engine to efficiently manage event listeners attached to dynamically created elements, ensuring that they can be removed when the associated instructions are reverted or when nodes are removed from the DOM, preventing memory leaks and unintended behavior.\n * \n * @param element \n * @param eventName \n * @param listener \n */\n addListener(element: Node, eventName: string, listener: EventListenerOrEventListenerObject): void {\n if (!this.index.elementListeners.has(element)) {\n this.index.elementListeners.set(element, new Map());\n }\n this.index.elementListeners.get(element)!.set(eventName, listener);\n }\n /**\n * Retrieves the event listener associated with a specific DOM element and event name from the context's index. This method looks up the element in the elementListeners map and then retrieves the listener for the specified event name. If no listener is found for the given element and event, it returns undefined. This allows the engine to efficiently access and manage event listeners that have been attached to dynamically created elements, enabling proper cleanup when instructions are reverted or when nodes are removed from the DOM.\n * \n * @param element \n * @param eventName \n * @returns \n */\n getListener(element: Node, eventName: string): EventListenerOrEventListenerObject | undefined {\n return this.index.elementListeners.get(element)?.get(eventName);\n }\n /**\n * Removes an event listener from a specific DOM element and updates the context's index accordingly. This method looks up the element in the elementListeners map and deletes the listener for the specified event name. This is typically called when an instruction is reverted or when a node is removed from the DOM, ensuring that any attached event listeners are properly cleaned up to prevent memory leaks and unintended behavior.\n * \n * @param element \n * @param eventName \n */\n removeListener(element: Node, eventName: string): void {\n this.index.elementListeners.get(element)?.delete(eventName);\n }\n}\n"]}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import '../chunk-EQQGB2QZ.mjs';
|
|
2
|
+
import { AreContext } from '@adaas/are';
|
|
3
|
+
|
|
4
|
+
class AreHTMLEngineContext extends AreContext {
|
|
5
|
+
constructor(props) {
|
|
6
|
+
super(props.container?.body.innerHTML || props.source || "");
|
|
7
|
+
/**
|
|
8
|
+
* Index structure mapping:
|
|
9
|
+
*
|
|
10
|
+
* Node -> Group ID -> Element
|
|
11
|
+
* -----------------------------------------------------------------------------------
|
|
12
|
+
* | - Attribute | group: string | Node
|
|
13
|
+
* | - Directive (e.g. for) | | Node
|
|
14
|
+
*/
|
|
15
|
+
this.index = {
|
|
16
|
+
/**
|
|
17
|
+
* 1 AreNode = 1 Dom Node
|
|
18
|
+
*
|
|
19
|
+
* uses ASEID
|
|
20
|
+
*/
|
|
21
|
+
nodeToHostElements: /* @__PURE__ */ new Map(),
|
|
22
|
+
/**
|
|
23
|
+
* 1 Group Instruction = MANY Dom Nodes (e.g. for loop)
|
|
24
|
+
*
|
|
25
|
+
* uses ASEID
|
|
26
|
+
*/
|
|
27
|
+
groupToElements: /* @__PURE__ */ new Map(),
|
|
28
|
+
/**
|
|
29
|
+
* 1 Dom Node = 1 Instruction
|
|
30
|
+
*
|
|
31
|
+
* uses ASEID
|
|
32
|
+
*/
|
|
33
|
+
elementToInstruction: /* @__PURE__ */ new WeakMap(),
|
|
34
|
+
/**
|
|
35
|
+
* 1 Instruction = 1 Dom Node (for CreateElement instructions, for example)
|
|
36
|
+
*
|
|
37
|
+
* uses ASEID
|
|
38
|
+
*/
|
|
39
|
+
instructionToElement: /* @__PURE__ */ new Map(),
|
|
40
|
+
/**
|
|
41
|
+
* Event listeners attached to elements, used for proper cleanup when reverting instructions. Maps a DOM element to a map of event names and their corresponding listeners, allowing the engine to track which listeners are attached to which elements and remove them when necessary (e.g., when an instruction is reverted).
|
|
42
|
+
*/
|
|
43
|
+
elementListeners: /* @__PURE__ */ new WeakMap()
|
|
44
|
+
};
|
|
45
|
+
this._container = props.container;
|
|
46
|
+
}
|
|
47
|
+
get container() {
|
|
48
|
+
return this._container;
|
|
49
|
+
}
|
|
50
|
+
getNodeElement(node) {
|
|
51
|
+
if (typeof node === "string") {
|
|
52
|
+
return this.index.nodeToHostElements.get(node);
|
|
53
|
+
} else {
|
|
54
|
+
return this.index.nodeToHostElements.get(node.aseid.toString());
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Associates a DOM element with a given instruction and its owner node. This method updates the context's index to map the instruction's ASEID to the provided DOM element, and also maps the element back to the instruction's ASEID for reverse lookup. If the instruction has an owner node, it also maps the node's ASEID to the element. Additionally, if the instruction belongs to a group, it adds the element to the set of elements associated with that group. This indexing allows the engine to efficiently manage and update DOM elements based on instructions and their corresponding nodes, enabling dynamic rendering and interaction in response to application state changes.
|
|
59
|
+
*
|
|
60
|
+
* @param instruction
|
|
61
|
+
* @param element
|
|
62
|
+
*/
|
|
63
|
+
setInstructionElement(instruction, element) {
|
|
64
|
+
const node = instruction.owner;
|
|
65
|
+
this.index.instructionToElement.set(instruction.aseid.toString(), element);
|
|
66
|
+
this.index.elementToInstruction.set(element, instruction.aseid.toString());
|
|
67
|
+
if (node) {
|
|
68
|
+
this.index.nodeToHostElements.set(node.aseid.toString(), element);
|
|
69
|
+
}
|
|
70
|
+
if (instruction.group) {
|
|
71
|
+
const groupId = instruction.group;
|
|
72
|
+
if (!this.index.groupToElements.has(groupId)) {
|
|
73
|
+
this.index.groupToElements.set(groupId, /* @__PURE__ */ new Set());
|
|
74
|
+
}
|
|
75
|
+
this.index.groupToElements.get(groupId).add(element);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
getElementByInstruction(instruction) {
|
|
79
|
+
if (typeof instruction === "string") {
|
|
80
|
+
return this.index.instructionToElement.get(instruction);
|
|
81
|
+
} else {
|
|
82
|
+
return this.index.instructionToElement.get(instruction.aseid.toString());
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Removes the association between a given instruction and its corresponding DOM element. This method looks up the instruction's ASEID to find the associated DOM element, and if found, it deletes the mapping from both instructionToElement and elementToInstruction. If the instruction has an owner node, it also removes the mapping from nodeToHostElements. Additionally, if the instruction belongs to a group, it removes the element from the set of elements associated with that group, and if the group has no more elements, it deletes the group from the index. This cleanup is essential for maintaining an accurate and efficient mapping of instructions to DOM elements, especially when instructions are reverted or when nodes are removed from the DOM.
|
|
87
|
+
*
|
|
88
|
+
* @param instruction
|
|
89
|
+
*/
|
|
90
|
+
removeInstructionElement(instruction) {
|
|
91
|
+
const element = this.index.instructionToElement.get(instruction.aseid.toString());
|
|
92
|
+
if (element) {
|
|
93
|
+
this.index.instructionToElement.delete(instruction.aseid.toString());
|
|
94
|
+
this.index.elementToInstruction.delete(element);
|
|
95
|
+
const node = instruction.owner;
|
|
96
|
+
if (node) {
|
|
97
|
+
this.index.nodeToHostElements.delete(node.aseid.toString());
|
|
98
|
+
}
|
|
99
|
+
if (instruction.group) {
|
|
100
|
+
const groupId = instruction.group;
|
|
101
|
+
const groupElements = this.index.groupToElements.get(groupId);
|
|
102
|
+
if (groupElements) {
|
|
103
|
+
groupElements.delete(element);
|
|
104
|
+
if (groupElements.size === 0) {
|
|
105
|
+
this.index.groupToElements.delete(groupId);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
getElementsByGroup(instruction) {
|
|
112
|
+
if (typeof instruction === "string") {
|
|
113
|
+
return this.index.groupToElements.get(instruction);
|
|
114
|
+
} else {
|
|
115
|
+
return this.index.groupToElements.get(instruction.aseid.toString());
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Adds an event listener to a specific DOM element and keeps track of it in the context's index for proper cleanup later. This method takes a DOM element, an event name, and a listener function or object, and stores this information in the elementListeners map. This allows the engine to efficiently manage event listeners attached to dynamically created elements, ensuring that they can be removed when the associated instructions are reverted or when nodes are removed from the DOM, preventing memory leaks and unintended behavior.
|
|
120
|
+
*
|
|
121
|
+
* @param element
|
|
122
|
+
* @param eventName
|
|
123
|
+
* @param listener
|
|
124
|
+
*/
|
|
125
|
+
addListener(element, eventName, listener) {
|
|
126
|
+
if (!this.index.elementListeners.has(element)) {
|
|
127
|
+
this.index.elementListeners.set(element, /* @__PURE__ */ new Map());
|
|
128
|
+
}
|
|
129
|
+
this.index.elementListeners.get(element).set(eventName, listener);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Retrieves the event listener associated with a specific DOM element and event name from the context's index. This method looks up the element in the elementListeners map and then retrieves the listener for the specified event name. If no listener is found for the given element and event, it returns undefined. This allows the engine to efficiently access and manage event listeners that have been attached to dynamically created elements, enabling proper cleanup when instructions are reverted or when nodes are removed from the DOM.
|
|
133
|
+
*
|
|
134
|
+
* @param element
|
|
135
|
+
* @param eventName
|
|
136
|
+
* @returns
|
|
137
|
+
*/
|
|
138
|
+
getListener(element, eventName) {
|
|
139
|
+
return this.index.elementListeners.get(element)?.get(eventName);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Removes an event listener from a specific DOM element and updates the context's index accordingly. This method looks up the element in the elementListeners map and deletes the listener for the specified event name. This is typically called when an instruction is reverted or when a node is removed from the DOM, ensuring that any attached event listeners are properly cleaned up to prevent memory leaks and unintended behavior.
|
|
143
|
+
*
|
|
144
|
+
* @param element
|
|
145
|
+
* @param eventName
|
|
146
|
+
*/
|
|
147
|
+
removeListener(element, eventName) {
|
|
148
|
+
this.index.elementListeners.get(element)?.delete(eventName);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export { AreHTMLEngineContext };
|
|
153
|
+
//# sourceMappingURL=AreHTML.context.mjs.map
|
|
154
|
+
//# sourceMappingURL=AreHTML.context.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/engine/AreHTML.context.ts"],"names":[],"mappings":";;;AAIO,MAAM,6BAA6B,UAAA,CAAW;AAAA,EAgDjD,YAAY,KAAA,EAA2C;AACnD,IAAA,KAAA,CAAM,MAAM,SAAA,EAAW,IAAA,CAAK,SAAA,IAAa,KAAA,CAAM,UAAU,EAAE,CAAA;AAtC/D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAA,IAAA,CAAU,KAAA,GAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMd,kBAAA,sBAAwB,GAAA,EAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAM1C,eAAA,sBAAqB,GAAA,EAAuB;AAAA;AAAA;A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AOA,cAAA,CAAe,SAAe,SAAA,EAAyB;AACnD,IAAA,IAAA,CAAK,MAAM,gBAAA,CAAiB,GAAA,CAAI,OAAO,CAAA,EAAG,OAAO,SAAS,CAAA;AAAA,EAC9D;AACJ","file":"AreHTML.context.mjs","sourcesContent":["import { AreContext, AreInstruction, AreNode } from \"@adaas/are\";\nimport { AreHTMLContextConstructor } from \"./AreHTML.types\";\n\n\nexport class AreHTMLEngineContext extends AreContext {\n\n /**\n * Index structure mapping:\n * \n * Node -> Group ID -> Element\n * -----------------------------------------------------------------------------------\n * | - Attribute | group: string | Node\n * | - Directive (e.g. for) | | Node\n */\n\n protected index = {\n /**\n * 1 AreNode = 1 Dom Node\n * \n * uses ASEID\n */\n nodeToHostElements: new Map<string, Node>(),\n /**\n * 1 Group Instruction = MANY Dom Nodes (e.g. for loop)\n * \n * uses ASEID\n */\n groupToElements: new Map<string, Set<Node>>(),\n /**\n * 1 Dom Node = 1 Instruction \n * \n * uses ASEID\n */\n elementToInstruction: new WeakMap<Node, string>(),\n /**\n * 1 Instruction = 1 Dom Node (for CreateElement instructions, for example)\n * \n * uses ASEID\n */\n instructionToElement: new Map<string, Node>(),\n /**\n * Event listeners attached to elements, used for proper cleanup when reverting instructions. Maps a DOM element to a map of event names and their corresponding listeners, allowing the engine to track which listeners are attached to which elements and remove them when necessary (e.g., when an instruction is reverted).\n */\n elementListeners: new WeakMap<Node, Map<string, EventListenerOrEventListenerObject>>()\n }\n\n /**\n * The root container for the HTML engine, which can be either a Document or a ShadowRoot. This is where the engine will mount the generated DOM elements. The context uses this container to manage the relationship between AreNodes, instructions, and their corresponding DOM elements, allowing for efficient updates and cleanups as the application state changes.\n */\n protected _container: Document;\n\n\n constructor(props: Partial<AreHTMLContextConstructor>) {\n super(props.container?.body.innerHTML || props.source || '');\n this._container = props.container!;\n }\n\n get container(): Document {\n return this._container;\n }\n\n\n /**\n * Retrieves the DOM element associated with a given AreNode. This method looks up the node's ASEID in the nodeToHostElements map to find the corresponding DOM element. If the node is not found, it returns undefined. This allows the engine to efficiently access and manipulate the DOM elements that correspond to specific nodes in the AreNode tree, enabling dynamic updates and interactions based on the application state.\n * \n * @param nodeASEID \n */\n getNodeElement(nodeASEID: string): Node | undefined\n getNodeElement(node: AreNode): Node | undefined\n getNodeElement(node: AreNode | string): Node | undefined {\n if (typeof node === 'string') {\n return this.index.nodeToHostElements.get(node);\n } else {\n return this.index.nodeToHostElements.get(node.aseid.toString());\n }\n }\n\n /**\n * Associates a DOM element with a given instruction and its owner node. This method updates the context's index to map the instruction's ASEID to the provided DOM element, and also maps the element back to the instruction's ASEID for reverse lookup. If the instruction has an owner node, it also maps the node's ASEID to the element. Additionally, if the instruction belongs to a group, it adds the element to the set of elements associated with that group. This indexing allows the engine to efficiently manage and update DOM elements based on instructions and their corresponding nodes, enabling dynamic rendering and interaction in response to application state changes.\n * \n * @param instruction \n * @param element \n */\n setInstructionElement(instruction: AreInstruction, element: Node): void {\n const node = instruction.owner;\n\n this.index.instructionToElement.set(instruction.aseid.toString(), element);\n this.index.elementToInstruction.set(element, instruction.aseid.toString());\n\n if (node) {\n this.index.nodeToHostElements.set(node.aseid.toString(), element);\n }\n\n if (instruction.group) {\n const groupId = instruction.group;\n if (!this.index.groupToElements.has(groupId)) {\n this.index.groupToElements.set(groupId, new Set());\n }\n this.index.groupToElements.get(groupId)!.add(element);\n }\n }\n\n\n /**\n * Retrieves the DOM element associated with a given instruction. This method looks up the instruction's ASEID in the instructionToElement map to find the corresponding DOM element. If the instruction is not found, it returns undefined. This allows the engine to efficiently access and manipulate the DOM elements that correspond to specific instructions, enabling dynamic updates and interactions based on the application state.\n * \n * @param instructionASEID \n */\n getElementByInstruction(instructionASEID: string): Node | undefined\n getElementByInstruction(instruction: AreInstruction): Node | undefined\n getElementByInstruction(instruction: AreInstruction | string): Node | undefined {\n if (typeof instruction === 'string') {\n return this.index.instructionToElement.get(instruction);\n } else {\n return this.index.instructionToElement.get(instruction.aseid.toString());\n }\n }\n\n\n /**\n * Removes the association between a given instruction and its corresponding DOM element. This method looks up the instruction's ASEID to find the associated DOM element, and if found, it deletes the mapping from both instructionToElement and elementToInstruction. If the instruction has an owner node, it also removes the mapping from nodeToHostElements. Additionally, if the instruction belongs to a group, it removes the element from the set of elements associated with that group, and if the group has no more elements, it deletes the group from the index. This cleanup is essential for maintaining an accurate and efficient mapping of instructions to DOM elements, especially when instructions are reverted or when nodes are removed from the DOM.\n * \n * @param instruction \n */\n removeInstructionElement(instruction: AreInstruction): void {\n const element = this.index.instructionToElement.get(instruction.aseid.toString());\n if (element) {\n this.index.instructionToElement.delete(instruction.aseid.toString());\n this.index.elementToInstruction.delete(element);\n\n const node = instruction.owner;\n if (node) {\n this.index.nodeToHostElements.delete(node.aseid.toString());\n }\n\n if (instruction.group) {\n const groupId = instruction.group;\n const groupElements = this.index.groupToElements.get(groupId);\n if (groupElements) {\n groupElements.delete(element);\n if (groupElements.size === 0) {\n this.index.groupToElements.delete(groupId);\n }\n }\n }\n }\n }\n\n /**\n * Retrieves the set of DOM elements associated with a given group. This method looks up the group name or instruction's ASEID in the groupToElements map to find the corresponding set of DOM elements. If the group is not found, it returns undefined. This allows the engine to efficiently access and manipulate all DOM elements that belong to a specific group (e.g., all elements generated by a particular loop instruction), enabling dynamic updates and interactions based on the application state.\n * \n * @param groupName \n */\n getElementsByGroup(groupName: string): Set<Node> | undefined\n getElementsByGroup(instruction: AreInstruction): Set<Node> | undefined\n getElementsByGroup(instruction: AreInstruction | string): Set<Node> | undefined {\n if (typeof instruction === 'string') {\n return this.index.groupToElements.get(instruction);\n } else {\n return this.index.groupToElements.get(instruction.aseid.toString());\n }\n }\n\n /**\n * Adds an event listener to a specific DOM element and keeps track of it in the context's index for proper cleanup later. This method takes a DOM element, an event name, and a listener function or object, and stores this information in the elementListeners map. This allows the engine to efficiently manage event listeners attached to dynamically created elements, ensuring that they can be removed when the associated instructions are reverted or when nodes are removed from the DOM, preventing memory leaks and unintended behavior.\n * \n * @param element \n * @param eventName \n * @param listener \n */\n addListener(element: Node, eventName: string, listener: EventListenerOrEventListenerObject): void {\n if (!this.index.elementListeners.has(element)) {\n this.index.elementListeners.set(element, new Map());\n }\n this.index.elementListeners.get(element)!.set(eventName, listener);\n }\n /**\n * Retrieves the event listener associated with a specific DOM element and event name from the context's index. This method looks up the element in the elementListeners map and then retrieves the listener for the specified event name. If no listener is found for the given element and event, it returns undefined. This allows the engine to efficiently access and manage event listeners that have been attached to dynamically created elements, enabling proper cleanup when instructions are reverted or when nodes are removed from the DOM.\n * \n * @param element \n * @param eventName \n * @returns \n */\n getListener(element: Node, eventName: string): EventListenerOrEventListenerObject | undefined {\n return this.index.elementListeners.get(element)?.get(eventName);\n }\n /**\n * Removes an event listener from a specific DOM element and updates the context's index accordingly. This method looks up the element in the elementListeners map and deletes the listener for the specified event name. This is typically called when an instruction is reverted or when a node is removed from the DOM, ensuring that any attached event listeners are properly cleaned up to prevent memory leaks and unintended behavior.\n * \n * @param element \n * @param eventName \n */\n removeListener(element: Node, eventName: string): void {\n this.index.elementListeners.get(element)?.delete(eventName);\n }\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { A_Scope } from '@adaas/a-concept';
|
|
2
|
+
import { AreEngine, AreSyntax, AreSyntaxTokenMatch } from '@adaas/are';
|
|
3
|
+
|
|
4
|
+
declare class AreHTMLEngine extends AreEngine {
|
|
5
|
+
get DefaultSyntax(): AreSyntax;
|
|
6
|
+
/**
|
|
7
|
+
* Inject AreHTMLSyntax into the container scope before loading
|
|
8
|
+
*
|
|
9
|
+
* @param container
|
|
10
|
+
*/
|
|
11
|
+
init(scope: A_Scope): Promise<void>;
|
|
12
|
+
protected rootElementMatcher(source: string, from: number, to: number, build: (raw: string, content: string, position: number, closing: string) => AreSyntaxTokenMatch): AreSyntaxTokenMatch | null;
|
|
13
|
+
protected htmlElementMatcher(source: string, from: number, to: number, build: (raw: string, content: string, position: number, closing: string) => AreSyntaxTokenMatch): AreSyntaxTokenMatch | null;
|
|
14
|
+
/**
|
|
15
|
+
* Find the index of the closing `>` of an opening tag, skipping over
|
|
16
|
+
* `>` characters that appear inside quoted attribute values.
|
|
17
|
+
*/
|
|
18
|
+
private static findTagClose;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { AreHTMLEngine };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { A_Scope } from '@adaas/a-concept';
|
|
2
|
+
import { AreEngine, AreSyntax, AreSyntaxTokenMatch } from '@adaas/are';
|
|
3
|
+
|
|
4
|
+
declare class AreHTMLEngine extends AreEngine {
|
|
5
|
+
get DefaultSyntax(): AreSyntax;
|
|
6
|
+
/**
|
|
7
|
+
* Inject AreHTMLSyntax into the container scope before loading
|
|
8
|
+
*
|
|
9
|
+
* @param container
|
|
10
|
+
*/
|
|
11
|
+
init(scope: A_Scope): Promise<void>;
|
|
12
|
+
protected rootElementMatcher(source: string, from: number, to: number, build: (raw: string, content: string, position: number, closing: string) => AreSyntaxTokenMatch): AreSyntaxTokenMatch | null;
|
|
13
|
+
protected htmlElementMatcher(source: string, from: number, to: number, build: (raw: string, content: string, position: number, closing: string) => AreSyntaxTokenMatch): AreSyntaxTokenMatch | null;
|
|
14
|
+
/**
|
|
15
|
+
* Find the index of the closing `>` of an opening tag, skipping over
|
|
16
|
+
* `>` characters that appear inside quoted attribute values.
|
|
17
|
+
*/
|
|
18
|
+
private static findTagClose;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { AreHTMLEngine };
|