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,CAAA;AAmBA,eAAA,CAAA;AAAA,EAJC,UAAU,MAAA,CAAO;AAAA,IACd,MAAM,oBAAA,CAAqB,OAAA;AAAA,IAC3B,KAAA,EAAO,CAAC,YAAY;AAAA,GACvB,CAAA;AAAA,EAEI,4BAAS,QAAQ,CAAA;AAAA,CAAA,EAxFb,YAAA,CAuFT,SAAA,EAAA,SAAA,EAAA,CAAA,CAAA;AAmBA,eAAA,CAAA;AAAA,EAJC,UAAU,MAAA,CAAO;AAAA,IACd,MAAM,oBAAA,CAAqB,MAAA;AAAA,IAC3B,KAAA,EAAO,CAAC,YAAY;AAAA,GACvB,CAAA;AAAA,EAEI,4BAAS,QAAQ,CAAA;AAAA,CAAA,EA3Gb,YAAA,CA0GT,SAAA,EAAA,QAAA,EAAA,CAAA,CAAA;AA1GS,YAAA,GAAN,eAAA,CAAA;AAAA,EALN,QAAQ,MAAA,CAAO;AAAA,IACZ,SAAA,EAAW,YAAA;AAAA,IACX,WAAA,EAAa;AAAA,GAChB,CAAA;AAAA,EACA,MAAA,CAAO,OAAO,gBAAgB;AAAA,CAAA,EAClB,YAAA,CAAA","file":"AreDirective.component.mjs","sourcesContent":["import { A_Caller, A_Component, A_Context, A_Feature, A_Inject, A_Meta, A_TYPES__Ctor } from \"@adaas/a-concept\";\nimport { A_Logger } from \"@adaas/a-utils/a-logger\";\nimport type { AreDirectiveAttribute } from \"@adaas/are-html/attributes/AreDirective.attribute\";\nimport { AreDirectiveMeta } from \"./AreDirective.meta\";\nimport { AreDirectiveFeatures } from \"./AreDirective.constants\";\nimport { A_Frame } from \"@adaas/a-frame/core\";\n\n\n@A_Frame.Define({\n    namespace: 'a-are-html',\n    description: 'Abstract base component for all ARE directive types. Provides lifecycle decorators (Transform, Compile, Apply, Revert, Priority) that subclasses hook into at each pipeline stage. Subclasses implement Transform to rewrite the attribute or template node, Compile to emit scene instructions, Apply to activate them in the DOM, and Revert to undo them on removal.'\n})\n@A_Meta.Define(AreDirectiveMeta)\nexport class AreDirective extends A_Component  {\n\n    //==================================================================================\n    //======================== LIFECYCLE DECORATORS ====================================\n    //==================================================================================\n    /**\n     * Allows to define a compilation order for directives, which is necessary when we have multiple directives on the same node and we want to control the order of their compilation and application. The directive with the highest priority will be compiled and applied first, and the directive with the lowest priority will be compiled and applied last. This is important because some directives may depend on the output of other directives, so we need to ensure that they are compiled and applied in the correct order to avoid errors and ensure the expected behavior.\n     * \n     * @param priority \n     * @returns \n     */\n    static Priority(priority: number) {\n        return function <TTarget extends A_TYPES__Ctor<AreDirective>>(\n            target: TTarget\n        ): TTarget {\n            // Store meta info on the target class itself for the Meta decorator to pick up\n            const meta = A_Context.meta<AreDirectiveMeta>(target);\n\n            meta.priority = priority;\n\n            return target;\n        };\n    }\n\n    /**\n     * Allows to define a custom method for transforming the AreNode tree based on the directive attribute. This method is called during the transformation phase of the ARE component and should perform any necessary transformations on the AreNode tree based on the directive's content and context. This can include tasks such as adding or removing nodes, modifying node properties, or restructuring the tree to ensure that the directive is applied correctly during rendering.\n     */\n    static get Transform() {\n        return (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {\n            return A_Feature.Extend({\n                name: AreDirectiveFeatures.Transform,\n                scope: [target.constructor],\n            })(target, propertyKey, descriptor);\n        }\n    }\n\n    /**\n     * Allows to define a custom method for compiling a directive attribute into a set of SceneInstructions. \n     * Can be used at any component to extend this logic not only for a AreDirective inherited.\n     */\n    static get Compile() {\n        return (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {\n            return A_Feature.Extend({\n                name: AreDirectiveFeatures.Compile,\n                scope: [target.constructor],\n            })(target, propertyKey, descriptor);\n        }\n    }\n\n    /**\n     * Allows to define a custom method for updating a directive attribute based on changes in the store or other dependencies.\n     * Can be used at any component to extend this logic not only for a AreDirective inherited.\n     */\n    static get Update() {\n        return (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {\n            return A_Feature.Extend({\n                name: AreDirectiveFeatures.Update,\n                scope: [target.constructor],\n            })(target, propertyKey, descriptor);\n        }\n    }\n\n    /**\n     * Default transform method for directives, which can be overridden by specific directive implementations. This method is called during the transformation phase of the ARE component and should perform any necessary transformations on the AreNode tree based on the directive's content and context. This can include tasks such as adding or removing nodes, modifying node properties, or restructuring the tree to ensure that the directive is applied correctly during rendering.\n     * \n     * @param attribute - The directive attribute to transform, which contains all the information about the directive as defined in the template (e.g. name, raw content, evaluated value, etc.)\n     * @param args - Additional arguments that may be required for the transformation process.\n     */\n    transform(\n        @A_Inject(A_Caller) attribute: AreDirectiveAttribute,\n        ...args: any[]\n    ) {\n        const logger = A_Context.scope(this).resolve(A_Logger) as A_Logger | undefined\n        if (logger) {\n            logger.warning(`No transforming logic defined for directive: ${attribute.name} with content: ${attribute.content}`);\n        }\n    }\n    /**\n     * Default compile method for directives, which can be overridden by specific directive implementations.\n     * \n     * @param attribute - The directive attribute to compile, which contains all the information about the directive as defined in the template (e.g. name, raw content, evaluated value, etc.)\n     * @param args - Additional arguments that may be required for the compilation process.\n     */\n    @A_Feature.Extend({\n        name: AreDirectiveFeatures.Compile,\n        scope: [AreDirective],\n    })\n    compile(\n        @A_Inject(A_Caller) attribute: AreDirectiveAttribute,\n        ...args: any[]\n    ) {\n        const logger = A_Context.scope(this).resolve(A_Logger) as A_Logger | undefined\n        if (logger) {\n            logger.warning(`No compiling logic defined for directive: ${attribute.name} with content: ${attribute.content}`);\n        }\n    }\n    /**\n     * Default update method for directives, which can be overridden by specific directive implementations. This method is called when there are changes in the store or other dependencies that may affect the directive's behavior or appearance. The method should contain logic to update the directive accordingly, such as re-evaluating its value, modifying the DOM, or triggering re-rendering of the affected nodes.\n     * \n     * @param attribute - The directive attribute to update, which contains all the information about the directive as defined in the template (e.g. name, raw content, evaluated value, etc.)\n     * @param args - Additional arguments that may be required for the update process.\n     */\n    @A_Feature.Extend({\n        name: AreDirectiveFeatures.Update,\n        scope: [AreDirective],\n    })\n    update(\n        @A_Inject(A_Caller) attribute: AreDirectiveAttribute,\n        ...args: any[]\n    ) {\n        const logger = A_Context.scope(this).resolve(A_Logger) as A_Logger | undefined\n        if (logger) {\n            logger.warning(`No update logic defined for directive: ${attribute.name} with content: ${attribute.content}`);\n        }\n    }\n}"]}