@alwatr/synapse 1.1.17 → 1.1.19

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/CHANGELOG.md CHANGED
@@ -3,6 +3,20 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.1.19](https://github.com/Alwatr/nanolib/compare/@alwatr/synapse@1.1.18...@alwatr/synapse@1.1.19) (2025-11-06)
7
+
8
+ ### 🐛 Bug Fixes
9
+
10
+ * rename update_ method to init_ and call super.init_ in CopyButtonDirective ([66ec105](https://github.com/Alwatr/nanolib/commit/66ec10508385d3bdc5e7e19d53d48294d48ed865))
11
+
12
+ ## [1.1.18](https://github.com/Alwatr/nanolib/compare/@alwatr/synapse@1.1.17...@alwatr/synapse@1.1.18) (2025-11-04)
13
+
14
+ ### 🔨 Code Refactoring
15
+
16
+ * enhance documentation and structure of DirectiveBase class ([b2cf694](https://github.com/Alwatr/nanolib/commit/b2cf6941ffdf56adfc0a357331a1f155f782943e))
17
+ * simplify update and destroy methods in DirectiveBase class ([e8a906d](https://github.com/Alwatr/nanolib/commit/e8a906d5e4346eda808fc3013287e620e31ef4e3))
18
+ * update property types in query decorators to ensure proper null handling ([bc250dd](https://github.com/Alwatr/nanolib/commit/bc250dde37c72f9469d11ec6a49b9567f3d81d38))
19
+
6
20
  ## [1.1.17](https://github.com/Alwatr/nanolib/compare/@alwatr/synapse@1.1.16...@alwatr/synapse@1.1.17) (2025-10-06)
7
21
 
8
22
  ### 🔗 Dependencies update
package/README.md CHANGED
@@ -59,7 +59,8 @@ import {directive, DirectiveBase} from '@alwatr/synapse';
59
59
  export class CopyButtonDirective extends DirectiveBase {
60
60
  private originalText!: string;
61
61
 
62
- protected update_(): void {
62
+ protected override init_(): void {
63
+ super.init_();
63
64
  this.originalText = this.element_.textContent ?? 'Copy';
64
65
  this.element_.addEventListener('click', () => this.handleClick());
65
66
  }
@@ -1,38 +1,88 @@
1
1
  /**
2
- * Base class for creating directives that attach behavior to DOM elements.
3
- * Extend this class to define custom directives.
2
+ * @package @alwatr/synapse
3
+ *
4
+ * This file defines the `DirectiveBase` class, which is the foundation for creating custom directives
5
+ * in the Alwatr Synapse library. Directives are used to attach behavior and logic to DOM elements
6
+ * declaratively.
7
+ */
8
+ /**
9
+ * The abstract base class for all directives.
10
+ *
11
+ * Extend this class to create a new directive that can be registered with the `@directive` decorator.
12
+ * It provides the core functionality for linking a TypeScript class to a DOM element and managing its lifecycle.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * import {DirectiveBase, directive} from '@alwatr/synapse';
17
+ *
18
+ * @directive('[my-directive]')
19
+ * export class MyDirective extends DirectiveBase {
20
+ * protected override init_(): void {
21
+ * super.init_(); // فراخوانی متد والد برای حفظ سازگاری با نسخه‌های قبل ضروری است
22
+ * this.element_.textContent = 'Hello from MyDirective!';
23
+ * this.element_.addEventListener('click', () => this.log('Element clicked!'));
24
+ * }
25
+ * }
26
+ * ```
4
27
  */
5
28
  export declare abstract class DirectiveBase {
6
29
  /**
7
- * The CSS selector for the directive.
30
+ * The CSS selector that this directive is associated with.
31
+ * This is the selector string provided to the `@directive` decorator.
8
32
  */
9
33
  protected readonly selector_: string;
10
34
  /**
11
- * Logger instance for the directive.
35
+ * A dedicated logger instance for this directive, pre-configured with a context like `directive:[selector]`.
36
+ * Use this for logging to provide clear, contextual messages.
12
37
  */
13
38
  protected readonly logger_: import("@alwatr/logger").AlwatrLogger;
14
39
  /**
15
- * The target DOM element this directive is attached to.
40
+ * The DOM element to which this directive instance is attached.
41
+ * All directive logic operates on this element.
16
42
  */
17
43
  protected readonly element_: HTMLElement;
18
44
  /**
19
- * Constructor to initialize the directive with the target element.
20
- * @param element - The DOM element this directive is attached to.
21
- * @param selector - The CSS selector for the directive.
45
+ * Initializes the directive. This constructor is called by the Synapse bootstrap process and should not be
46
+ * overridden in subclasses.
47
+ *
48
+ * It sets up the logger, element, and selector, and then schedules the `init_` and `update_` lifecycle methods
49
+ * to run in the next microtask.
50
+ *
51
+ * @param element The DOM element to which this directive is attached.
52
+ * @param selector The CSS selector that matched this directive.
22
53
  */
23
54
  constructor(element: HTMLElement, selector: string);
24
55
  /**
25
- * Called to update the directive's state or behavior.
26
- * Must be implemented by subclasses.
56
+ * Called once automatically after the directive is initialized.
57
+ *
58
+ * This method serves as the main entry point for your directive's logic,
59
+ * such as modifying the element or setting up event listeners.
60
+ *
61
+ * **Note:** Do not call this method directly. It is designed to be called only once by the framework.
27
62
  */
28
- protected abstract update_(): Awaitable<void>;
29
63
  protected init_(): Awaitable<void>;
30
- protected destroy_(): Awaitable<void>;
31
64
  /**
32
65
  * Dispatches a custom event from the target element.
33
- * @param eventName - The name of the event.
34
- * @param detail - Optional data to include in the event.
66
+ *
67
+ * This is a convenience method for firing events that can be listened to by other parts of the application.
68
+ * The event bubbles up through the DOM.
69
+ *
70
+ * @param eventName The name of the custom event.
71
+ * @param detail Optional data to include in the event's `detail` property.
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * this.dispatch_('user-action', {action: 'save', id: 123});
76
+ * ```
35
77
  */
36
78
  protected dispatch_(eventName: string, detail?: unknown): void;
79
+ /**
80
+ * Cleans up the directive's resources.
81
+ *
82
+ * This method removes the element from the DOM and nullifies the internal reference to it,
83
+ * helping with garbage collection. It can be extended by subclasses to perform additional cleanup,
84
+ * such as removing event listeners.
85
+ */
86
+ protected destroy_(): Awaitable<void>;
37
87
  }
38
88
  //# sourceMappingURL=directiveClass.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"directiveClass.d.ts","sourceRoot":"","sources":["../src/directiveClass.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,8BAAsB,aAAa;IACjC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,SAAS,SAAC;IAE7B;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,wCAAC;IAE3B;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAEzC;;;;OAIG;gBACS,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM;IAclD;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC;IAE7C,SAAS,CAAC,KAAK,IAAI,SAAS,CAAC,IAAI,CAAC;IAIlC,SAAS,CAAC,QAAQ,IAAI,SAAS,CAAC,IAAI,CAAC;IAOrC;;;;OAIG;IACH,SAAS,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI;CAI/D"}
1
+ {"version":3,"file":"directiveClass.d.ts","sourceRoot":"","sources":["../src/directiveClass.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,8BAAsB,aAAa;IACjC;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,SAAS,SAAC;IAE7B;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,wCAAC;IAE3B;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAEzC;;;;;;;;;OASG;gBACS,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM;IAalD;;;;;;;OAOG;IACH,SAAS,CAAC,KAAK,IAAI,SAAS,CAAC,IAAI,CAAC;IAOlC;;;;;;;;;;;;;OAaG;IACH,SAAS,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI;IAK9D;;;;;;OAMG;IACH,SAAS,CAAC,QAAQ,IAAI,SAAS,CAAC,IAAI,CAAC;CAMtC"}
package/dist/main.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /** 📦 @alwatr/synapse v1.1.17 */
2
- __dev_mode__: console.debug("📦 @alwatr/synapse v1.1.17");
3
- "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:true})};var __copyProps=(to,from,except,desc)=>{if(from&&typeof from==="object"||typeof from==="function"){for(let key of __getOwnPropNames(from))if(!__hasOwnProp.call(to,key)&&key!==except)__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable})}return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:true}),mod);var main_exports={};__export(main_exports,{DirectiveBase:()=>DirectiveBase,bootstrapDirectives:()=>bootstrapDirectives,directive:()=>directive,query:()=>query,queryAll:()=>queryAll});module.exports=__toCommonJS(main_exports);var import_logger=require("@alwatr/logger");var logger=(0,import_logger.createLogger)("alwatr/synapse");var directiveRegistry_=[];var initializedAttribute="_synapseConnected";function bootstrapDirectives(rootElement=document.body){logger.logMethod?.("bootstrapDirectives");for(const{selector,constructor}of directiveRegistry_){try{const uninitializedSelector=`${selector}:not([${initializedAttribute}])`;const elements=rootElement.querySelectorAll(uninitializedSelector);if(elements.length===0)continue;logger.logOther?.(`Found ${elements.length} new element(s) for directive "${selector}"`);elements.forEach(element=>{element.setAttribute(initializedAttribute,"true");new constructor(element,selector)})}catch(err){logger.error("bootstrapDirectives","directive_instantiation_error",err,{selector})}}}function directive(selector){logger.logMethodArgs?.("@directive",selector);return function(constructor){directiveRegistry_.push({selector,constructor})}}var import_delay=require("@alwatr/delay");var import_logger2=require("@alwatr/logger");var DirectiveBase=class{constructor(element,selector){this.logger_=(0,import_logger2.createLogger)(`directive:${selector}`);this.logger_.logMethodArgs?.("new",{selector,element});this.selector_=selector;this.element_=element;(async()=>{await import_delay.delay.nextMicrotask();await this.init_();await this.update_()})()}init_(){this.logger_.logMethod?.("init")}destroy_(){this.logger_.logMethod?.("destroy");this.element_.remove();this.element_=null}dispatch_(eventName,detail){this.logger_.logMethodArgs?.("dispatch_",{eventName,detail});this.element_.dispatchEvent(new CustomEvent(eventName,{detail,bubbles:true}))}};function query(selector,cache=true){return function(target,propertyKey){const privateKey=Symbol(`${String(propertyKey)}__`);Object.defineProperty(target,propertyKey,{get(){if(cache===false||this[privateKey]===void 0){this[privateKey]=this.element_.querySelector(selector)}return this[privateKey]},configurable:true,enumerable:true})}}function queryAll(selector,cache=true){return function(target,propertyKey){const privateKey=Symbol(`${String(propertyKey)}__`);Object.defineProperty(target,propertyKey,{get(){if(cache===false||this[privateKey]===void 0){this[privateKey]=this.element_.querySelectorAll(selector)}return this[privateKey]},configurable:true,enumerable:true})}}0&&(module.exports={DirectiveBase,bootstrapDirectives,directive,query,queryAll});
1
+ /** 📦 @alwatr/synapse v1.1.19 */
2
+ __dev_mode__: console.debug("📦 @alwatr/synapse v1.1.19");
3
+ "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:true})};var __copyProps=(to,from,except,desc)=>{if(from&&typeof from==="object"||typeof from==="function"){for(let key of __getOwnPropNames(from))if(!__hasOwnProp.call(to,key)&&key!==except)__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable})}return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:true}),mod);var main_exports={};__export(main_exports,{DirectiveBase:()=>DirectiveBase,bootstrapDirectives:()=>bootstrapDirectives,directive:()=>directive,query:()=>query,queryAll:()=>queryAll});module.exports=__toCommonJS(main_exports);var import_logger=require("@alwatr/logger");var logger=(0,import_logger.createLogger)("alwatr/synapse");var directiveRegistry_=[];var initializedAttribute="_synapseConnected";function bootstrapDirectives(rootElement=document.body){logger.logMethod?.("bootstrapDirectives");for(const{selector,constructor}of directiveRegistry_){try{const uninitializedSelector=`${selector}:not([${initializedAttribute}])`;const elements=rootElement.querySelectorAll(uninitializedSelector);if(elements.length===0)continue;logger.logOther?.(`Found ${elements.length} new element(s) for directive "${selector}"`);elements.forEach(element=>{element.setAttribute(initializedAttribute,"true");new constructor(element,selector)})}catch(err){logger.error("bootstrapDirectives","directive_instantiation_error",err,{selector})}}}function directive(selector){logger.logMethodArgs?.("@directive",selector);return function(constructor){directiveRegistry_.push({selector,constructor})}}var import_delay=require("@alwatr/delay");var import_logger2=require("@alwatr/logger");var DirectiveBase=class{constructor(element,selector){this.logger_=(0,import_logger2.createLogger)(`directive:${selector}`);this.logger_.logMethodArgs?.("new",{selector,element});this.selector_=selector;this.element_=element;(async()=>{await import_delay.delay.nextMicrotask();await this.init_()})()}init_(){this.logger_.logMethod?.("init_");this.update_?.()}dispatch_(eventName,detail){this.logger_.logMethodArgs?.("dispatch_",{eventName,detail});this.element_.dispatchEvent(new CustomEvent(eventName,{detail,bubbles:true}))}destroy_(){this.logger_.logMethod?.("destroy_");this.element_.remove();this.element_=null}};function query(selector,cache=true){return function(target,propertyKey){const privateKey=Symbol(`${String(propertyKey)}__`);Object.defineProperty(target,propertyKey,{get(){if(cache===false||this[privateKey]===void 0){this[privateKey]=this.element_.querySelector(selector)}return this[privateKey]},configurable:true,enumerable:true})}}function queryAll(selector,cache=true){return function(target,propertyKey){const privateKey=Symbol(`${String(propertyKey)}__`);Object.defineProperty(target,propertyKey,{get(){if(cache===false||this[privateKey]===void 0){this[privateKey]=this.element_.querySelectorAll(selector)}return this[privateKey]},configurable:true,enumerable:true})}}0&&(module.exports={DirectiveBase,bootstrapDirectives,directive,query,queryAll});
4
4
  //# sourceMappingURL=main.cjs.map
package/dist/main.cjs.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/main.ts", "../src/lib.ts", "../src/bootstrap.ts", "../src/directiveDecorator.ts", "../src/directiveClass.ts", "../src/queryDecorator.ts"],
4
- "sourcesContent": ["export * from './bootstrap.js';\nexport * from './directiveDecorator.js';\nexport * from './directiveClass.js';\nexport * from './queryDecorator.js';\n", "import {createLogger} from '@alwatr/logger';\n\nimport type {DirectiveConstructor} from './directiveDecorator.js';\nimport type {} from '@alwatr/type-helper';\n\n/**\n * Alwatr Synapse Logger.\n */\nexport const logger = createLogger('alwatr/synapse');\n\n/**\n * The registry for all directives.\n */\nexport const directiveRegistry_: {selector: string; constructor: DirectiveConstructor}[] = [];\n", "import {directiveRegistry_, logger} from './lib.js';\n\nconst initializedAttribute = '_synapseConnected';\n\n/**\n * Initializes all registered directives within a given root element.\n * If no root element is provided, it scans the entire body.\n *\n * This function is idempotent; it will not re-initialize a directive on an element\n * that has already been processed.\n *\n * @param rootElement The element to scan for directives. Defaults to `document.body`.\n *\n * @example\n * ```ts\n * // Initialize directives on the whole page after the DOM is loaded.\n * document.addEventListener('DOMContentLoaded', () => bootstrapDirectives());\n *\n * // Or, initialize directives on a dynamically added part of the page.\n * const newContent = document.createElement('div');\n * newContent.innerHTML = '<div class=\"my-button\">Click Me</div>';\n * document.body.appendChild(newContent);\n *\n * bootstrapDirectives(newContent);\n * ```\n */\nexport function bootstrapDirectives(rootElement: Element | Document = document.body): void {\n logger.logMethod?.('bootstrapDirectives');\n\n for (const {selector, constructor} of directiveRegistry_) {\n try {\n const uninitializedSelector = `${selector}:not([${initializedAttribute}])`;\n const elements = rootElement.querySelectorAll<HTMLElement>(uninitializedSelector);\n if (elements.length === 0) continue;\n\n logger.logOther?.(`Found ${elements.length} new element(s) for directive \"${selector}\"`);\n elements.forEach((element) => {\n // Mark the element as processed before creating an instance\n element.setAttribute(initializedAttribute, 'true');\n // Instantiate the directive with the element.\n new constructor(element, selector);\n });\n }\n catch (err) {\n logger.error('bootstrapDirectives', 'directive_instantiation_error', err, {selector});\n }\n }\n}\n", "import {directiveRegistry_, logger} from './lib.js';\n\nimport type {DirectiveBase} from './directiveClass.js';\n\n/**\n * Type definition for a directive constructor.\n * A directive class must have a constructor that accepts an HTMLElement.\n */\nexport type DirectiveConstructor<T extends DirectiveBase = DirectiveBase> = new (element: HTMLElement, selector: string) => T;\n\n/**\n * A class decorator that registers a class as a directive.\n *\n * @param selector The CSS selector to which this directive will be attached.\n *\n * @example\n * ```ts\n * @directive('.my-button')\n * class MyButtonDirective extends DirectiveBase {\n * protected update_(): void {\n * this.element_.addEventListener('click', () => console.log('Button clicked!'));\n * }\n * }\n * ```\n */\nexport function directive(selector: string) {\n logger.logMethodArgs?.('@directive', selector);\n\n /**\n * The decorator function that receives the class constructor.\n * @param constructor The class to be registered as a directive.\n */\n return function (constructor: DirectiveConstructor): void {\n directiveRegistry_.push({selector, constructor});\n };\n}\n", "import {delay} from '@alwatr/delay';\nimport {createLogger} from '@alwatr/logger';\n\n/**\n * Base class for creating directives that attach behavior to DOM elements.\n * Extend this class to define custom directives.\n */\nexport abstract class DirectiveBase {\n /**\n * The CSS selector for the directive.\n */\n protected readonly selector_;\n\n /**\n * Logger instance for the directive.\n */\n protected readonly logger_;\n\n /**\n * The target DOM element this directive is attached to.\n */\n protected readonly element_: HTMLElement;\n\n /**\n * Constructor to initialize the directive with the target element.\n * @param element - The DOM element this directive is attached to.\n * @param selector - The CSS selector for the directive.\n */\n constructor(element: HTMLElement, selector: string) {\n this.logger_ = createLogger(`directive:${selector}`);\n this.logger_.logMethodArgs?.('new', {selector, element});\n\n this.selector_ = selector;\n this.element_ = element;\n\n (async () => {\n await delay.nextMicrotask();\n await this.init_();\n await this.update_();\n })();\n }\n\n /**\n * Called to update the directive's state or behavior.\n * Must be implemented by subclasses.\n */\n protected abstract update_(): Awaitable<void>;\n\n protected init_(): Awaitable<void> {\n this.logger_.logMethod?.('init');\n }\n\n protected destroy_(): Awaitable<void> {\n this.logger_.logMethod?.('destroy');\n this.element_.remove();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (this as any).element_ = null;\n }\n\n /**\n * Dispatches a custom event from the target element.\n * @param eventName - The name of the event.\n * @param detail - Optional data to include in the event.\n */\n protected dispatch_(eventName: string, detail?: unknown): void {\n this.logger_.logMethodArgs?.('dispatch_', {eventName, detail});\n this.element_.dispatchEvent(new CustomEvent(eventName, {detail, bubbles: true}));\n }\n}\n", "/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type {DirectiveBase} from './directiveClass.js';\n\n/**\n * A property decorator that queries the directive's element for a selector.\n * The query is performed once and the result is cached.\n *\n * @param selector The CSS selector to query for.\n * @param cache Whether to cache the result on first access. Defaults is true.\n *\n * @example\n * ```ts\n * @directive('[my-directive]')\n * class MyDirective extends DirectiveBase {\n * @query('.my-element')\n * protected myElement?: HTMLDivElement;\n * }\n * ```\n */\nexport function query(selector: string, cache = true) {\n return function (target: DirectiveBase, propertyKey: string): void {\n const privateKey = Symbol(`${String(propertyKey)}__`);\n\n Object.defineProperty(target, propertyKey, {\n get(this: DirectiveBase) {\n if (cache === false || (this as any)[privateKey] === undefined) {\n (this as any)[privateKey] = this.element_.querySelector(selector);\n }\n return (this as any)[privateKey];\n },\n configurable: true,\n enumerable: true,\n });\n };\n}\n\n/**\n * A property decorator that queries the directive's element for all selectors.\n * The queries are performed once and the result is cached.\n *\n * @param selector The CSS selector to query for.\n *\n * @example\n * ```ts\n * @directive('[my-directive]')\n * class MyDirective extends DirectiveBase {\n * @queryAll('.my-elements')\n * protected myElements?: NodeListOf<HTMLDivElement>;\n * }\n * ```\n */\nexport function queryAll(selector: string, cache = true) {\n return function (target: DirectiveBase, propertyKey: string): void {\n const privateKey = Symbol(`${String(propertyKey)}__`);\n\n Object.defineProperty(target, propertyKey, {\n get(this: DirectiveBase) {\n if (cache === false || (this as any)[privateKey] === undefined) {\n (this as any)[privateKey] = this.element_.querySelectorAll(selector);\n }\n return (this as any)[privateKey];\n },\n configurable: true,\n enumerable: true,\n });\n };\n}\n"],
5
- "mappings": ";;qqBAAA,iOCAA,kBAA2B,0BAQpB,IAAM,UAAS,4BAAa,gBAAgB,EAK5C,IAAM,mBAA8E,CAAC,ECX5F,IAAM,qBAAuB,oBAwBtB,SAAS,oBAAoB,YAAkC,SAAS,KAAY,CACzF,OAAO,YAAY,qBAAqB,EAExC,SAAW,CAAC,SAAU,WAAW,IAAK,mBAAoB,CACxD,GAAI,CACF,MAAM,sBAAwB,GAAG,QAAQ,SAAS,oBAAoB,KACtE,MAAM,SAAW,YAAY,iBAA8B,qBAAqB,EAChF,GAAI,SAAS,SAAW,EAAG,SAE3B,OAAO,WAAW,SAAS,SAAS,MAAM,kCAAkC,QAAQ,GAAG,EACvF,SAAS,QAAS,SAAY,CAE5B,QAAQ,aAAa,qBAAsB,MAAM,EAEjD,IAAI,YAAY,QAAS,QAAQ,CACnC,CAAC,CACH,OACO,IAAK,CACV,OAAO,MAAM,sBAAuB,gCAAiC,IAAK,CAAC,QAAQ,CAAC,CACtF,CACF,CACF,CCtBO,SAAS,UAAU,SAAkB,CAC1C,OAAO,gBAAgB,aAAc,QAAQ,EAM7C,OAAO,SAAU,YAAyC,CACxD,mBAAmB,KAAK,CAAC,SAAU,WAAW,CAAC,CACjD,CACF,CCnCA,iBAAoB,yBACpB,IAAAA,eAA2B,0BAMpB,IAAe,cAAf,KAA6B,CAqBlC,YAAY,QAAsB,SAAkB,CAClD,KAAK,WAAU,6BAAa,aAAa,QAAQ,EAAE,EACnD,KAAK,QAAQ,gBAAgB,MAAO,CAAC,SAAU,OAAO,CAAC,EAEvD,KAAK,UAAY,SACjB,KAAK,SAAW,SAEf,SAAY,CACX,MAAM,mBAAM,cAAc,EAC1B,MAAM,KAAK,MAAM,EACjB,MAAM,KAAK,QAAQ,CACrB,GAAG,CACL,CAQU,OAAyB,CACjC,KAAK,QAAQ,YAAY,MAAM,CACjC,CAEU,UAA4B,CACpC,KAAK,QAAQ,YAAY,SAAS,EAClC,KAAK,SAAS,OAAO,EAEpB,KAAa,SAAW,IAC3B,CAOU,UAAU,UAAmB,OAAwB,CAC7D,KAAK,QAAQ,gBAAgB,YAAa,CAAC,UAAW,MAAM,CAAC,EAC7D,KAAK,SAAS,cAAc,IAAI,YAAY,UAAW,CAAC,OAAQ,QAAS,IAAI,CAAC,CAAC,CACjF,CACF,ECjDO,SAAS,MAAM,SAAkB,MAAQ,KAAM,CACpD,OAAO,SAAU,OAAuB,YAA2B,CACjE,MAAM,WAAa,OAAO,GAAG,OAAO,WAAW,CAAC,IAAI,EAEpD,OAAO,eAAe,OAAQ,YAAa,CACzC,KAAyB,CACvB,GAAI,QAAU,OAAU,KAAa,UAAU,IAAM,OAAW,CAC7D,KAAa,UAAU,EAAI,KAAK,SAAS,cAAc,QAAQ,CAClE,CACA,OAAQ,KAAa,UAAU,CACjC,EACA,aAAc,KACd,WAAY,IACd,CAAC,CACH,CACF,CAiBO,SAAS,SAAS,SAAkB,MAAQ,KAAM,CACvD,OAAO,SAAU,OAAuB,YAA2B,CACjE,MAAM,WAAa,OAAO,GAAG,OAAO,WAAW,CAAC,IAAI,EAEpD,OAAO,eAAe,OAAQ,YAAa,CACzC,KAAyB,CACvB,GAAI,QAAU,OAAU,KAAa,UAAU,IAAM,OAAW,CAC7D,KAAa,UAAU,EAAI,KAAK,SAAS,iBAAiB,QAAQ,CACrE,CACA,OAAQ,KAAa,UAAU,CACjC,EACA,aAAc,KACd,WAAY,IACd,CAAC,CACH,CACF",
4
+ "sourcesContent": ["export * from './bootstrap.js';\nexport * from './directiveDecorator.js';\nexport * from './directiveClass.js';\nexport * from './queryDecorator.js';\n", "import {createLogger} from '@alwatr/logger';\n\nimport type {DirectiveConstructor} from './directiveDecorator.js';\nimport type {} from '@alwatr/type-helper';\n\n/**\n * Alwatr Synapse Logger.\n */\nexport const logger = createLogger('alwatr/synapse');\n\n/**\n * The registry for all directives.\n */\nexport const directiveRegistry_: {selector: string; constructor: DirectiveConstructor}[] = [];\n", "import {directiveRegistry_, logger} from './lib.js';\n\nconst initializedAttribute = '_synapseConnected';\n\n/**\n * Initializes all registered directives within a given root element.\n * If no root element is provided, it scans the entire body.\n *\n * This function is idempotent; it will not re-initialize a directive on an element\n * that has already been processed.\n *\n * @param rootElement The element to scan for directives. Defaults to `document.body`.\n *\n * @example\n * ```ts\n * // Initialize directives on the whole page after the DOM is loaded.\n * document.addEventListener('DOMContentLoaded', () => bootstrapDirectives());\n *\n * // Or, initialize directives on a dynamically added part of the page.\n * const newContent = document.createElement('div');\n * newContent.innerHTML = '<div class=\"my-button\">Click Me</div>';\n * document.body.appendChild(newContent);\n *\n * bootstrapDirectives(newContent);\n * ```\n */\nexport function bootstrapDirectives(rootElement: Element | Document = document.body): void {\n logger.logMethod?.('bootstrapDirectives');\n\n for (const {selector, constructor} of directiveRegistry_) {\n try {\n const uninitializedSelector = `${selector}:not([${initializedAttribute}])`;\n const elements = rootElement.querySelectorAll<HTMLElement>(uninitializedSelector);\n if (elements.length === 0) continue;\n\n logger.logOther?.(`Found ${elements.length} new element(s) for directive \"${selector}\"`);\n elements.forEach((element) => {\n // Mark the element as processed before creating an instance\n element.setAttribute(initializedAttribute, 'true');\n // Instantiate the directive with the element.\n new constructor(element, selector);\n });\n }\n catch (err) {\n logger.error('bootstrapDirectives', 'directive_instantiation_error', err, {selector});\n }\n }\n}\n", "import {directiveRegistry_, logger} from './lib.js';\n\nimport type {DirectiveBase} from './directiveClass.js';\n\n/**\n * Type definition for a directive constructor.\n * A directive class must have a constructor that accepts an HTMLElement.\n */\nexport type DirectiveConstructor<T extends DirectiveBase = DirectiveBase> = new (element: HTMLElement, selector: string) => T;\n\n/**\n * A class decorator that registers a class as a directive.\n *\n * @param selector The CSS selector to which this directive will be attached.\n *\n * @example\n * ```ts\n * @directive('.my-button')\n * class MyButtonDirective extends DirectiveBase {\n * protected update_(): void {\n * this.element_.addEventListener('click', () => console.log('Button clicked!'));\n * }\n * }\n * ```\n */\nexport function directive(selector: string) {\n logger.logMethodArgs?.('@directive', selector);\n\n /**\n * The decorator function that receives the class constructor.\n * @param constructor The class to be registered as a directive.\n */\n return function (constructor: DirectiveConstructor): void {\n directiveRegistry_.push({selector, constructor});\n };\n}\n", "/**\n * @package @alwatr/synapse\n *\n * This file defines the `DirectiveBase` class, which is the foundation for creating custom directives\n * in the Alwatr Synapse library. Directives are used to attach behavior and logic to DOM elements\n * declaratively.\n */\n\nimport {delay} from '@alwatr/delay';\nimport {createLogger} from '@alwatr/logger';\n\n/**\n * The abstract base class for all directives.\n *\n * Extend this class to create a new directive that can be registered with the `@directive` decorator.\n * It provides the core functionality for linking a TypeScript class to a DOM element and managing its lifecycle.\n *\n * @example\n * ```ts\n * import {DirectiveBase, directive} from '@alwatr/synapse';\n *\n * @directive('[my-directive]')\n * export class MyDirective extends DirectiveBase {\n * protected override init_(): void {\n * super.init_(); // فراخوانی متد والد برای حفظ سازگاری با نسخه‌های قبل ضروری است\n * this.element_.textContent = 'Hello from MyDirective!';\n * this.element_.addEventListener('click', () => this.log('Element clicked!'));\n * }\n * }\n * ```\n */\nexport abstract class DirectiveBase {\n /**\n * The CSS selector that this directive is associated with.\n * This is the selector string provided to the `@directive` decorator.\n */\n protected readonly selector_;\n\n /**\n * A dedicated logger instance for this directive, pre-configured with a context like `directive:[selector]`.\n * Use this for logging to provide clear, contextual messages.\n */\n protected readonly logger_;\n\n /**\n * The DOM element to which this directive instance is attached.\n * All directive logic operates on this element.\n */\n protected readonly element_: HTMLElement;\n\n /**\n * Initializes the directive. This constructor is called by the Synapse bootstrap process and should not be\n * overridden in subclasses.\n *\n * It sets up the logger, element, and selector, and then schedules the `init_` and `update_` lifecycle methods\n * to run in the next microtask.\n *\n * @param element The DOM element to which this directive is attached.\n * @param selector The CSS selector that matched this directive.\n */\n constructor(element: HTMLElement, selector: string) {\n this.logger_ = createLogger(`directive:${selector}`);\n this.logger_.logMethodArgs?.('new', {selector, element});\n\n this.selector_ = selector;\n this.element_ = element;\n\n (async () => {\n await delay.nextMicrotask();\n await this.init_();\n })();\n }\n\n /**\n * Called once automatically after the directive is initialized.\n *\n * This method serves as the main entry point for your directive's logic,\n * such as modifying the element or setting up event listeners.\n *\n * **Note:** Do not call this method directly. It is designed to be called only once by the framework.\n */\n protected init_(): Awaitable<void> {\n this.logger_.logMethod?.('init_');\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (this as any).update_?.(); // backward compatibility\n }\n\n /**\n * Dispatches a custom event from the target element.\n *\n * This is a convenience method for firing events that can be listened to by other parts of the application.\n * The event bubbles up through the DOM.\n *\n * @param eventName The name of the custom event.\n * @param detail Optional data to include in the event's `detail` property.\n *\n * @example\n * ```ts\n * this.dispatch_('user-action', {action: 'save', id: 123});\n * ```\n */\n protected dispatch_(eventName: string, detail?: unknown): void {\n this.logger_.logMethodArgs?.('dispatch_', {eventName, detail});\n this.element_.dispatchEvent(new CustomEvent(eventName, {detail, bubbles: true}));\n }\n\n /**\n * Cleans up the directive's resources.\n *\n * This method removes the element from the DOM and nullifies the internal reference to it,\n * helping with garbage collection. It can be extended by subclasses to perform additional cleanup,\n * such as removing event listeners.\n */\n protected destroy_(): Awaitable<void> {\n this.logger_.logMethod?.('destroy_');\n this.element_.remove();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (this as any).element_ = null;\n }\n}\n", "/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type {DirectiveBase} from './directiveClass.js';\n\n/**\n * A property decorator that queries the directive's element for a selector.\n * The query is performed once and the result is cached.\n *\n * @param selector The CSS selector to query for.\n * @param cache Whether to cache the result on first access. Defaults is true.\n *\n * @example\n * ```ts\n * @directive('[my-directive]')\n * class MyDirective extends DirectiveBase {\n * @query('.my-element')\n * protected myElement: HTMLDivElement | null;\n * }\n * ```\n */\nexport function query(selector: string, cache = true) {\n return function (target: DirectiveBase, propertyKey: string): void {\n const privateKey = Symbol(`${String(propertyKey)}__`);\n\n Object.defineProperty(target, propertyKey, {\n get(this: DirectiveBase) {\n if (cache === false || (this as any)[privateKey] === undefined) {\n (this as any)[privateKey] = this.element_.querySelector(selector);\n }\n return (this as any)[privateKey];\n },\n configurable: true,\n enumerable: true,\n });\n };\n}\n\n/**\n * A property decorator that queries the directive's element for all selectors.\n * The queries are performed once and the result is cached.\n *\n * @param selector The CSS selector to query for.\n *\n * @example\n * ```ts\n * @directive('[my-directive]')\n * class MyDirective extends DirectiveBase {\n * @queryAll('.my-elements')\n * protected myElements: NodeListOf<HTMLDivElement>;\n * }\n * ```\n */\nexport function queryAll(selector: string, cache = true) {\n return function (target: DirectiveBase, propertyKey: string): void {\n const privateKey = Symbol(`${String(propertyKey)}__`);\n\n Object.defineProperty(target, propertyKey, {\n get(this: DirectiveBase) {\n if (cache === false || (this as any)[privateKey] === undefined) {\n (this as any)[privateKey] = this.element_.querySelectorAll(selector);\n }\n return (this as any)[privateKey];\n },\n configurable: true,\n enumerable: true,\n });\n };\n}\n"],
5
+ "mappings": ";;qqBAAA,iOCAA,kBAA2B,0BAQpB,IAAM,UAAS,4BAAa,gBAAgB,EAK5C,IAAM,mBAA8E,CAAC,ECX5F,IAAM,qBAAuB,oBAwBtB,SAAS,oBAAoB,YAAkC,SAAS,KAAY,CACzF,OAAO,YAAY,qBAAqB,EAExC,SAAW,CAAC,SAAU,WAAW,IAAK,mBAAoB,CACxD,GAAI,CACF,MAAM,sBAAwB,GAAG,QAAQ,SAAS,oBAAoB,KACtE,MAAM,SAAW,YAAY,iBAA8B,qBAAqB,EAChF,GAAI,SAAS,SAAW,EAAG,SAE3B,OAAO,WAAW,SAAS,SAAS,MAAM,kCAAkC,QAAQ,GAAG,EACvF,SAAS,QAAS,SAAY,CAE5B,QAAQ,aAAa,qBAAsB,MAAM,EAEjD,IAAI,YAAY,QAAS,QAAQ,CACnC,CAAC,CACH,OACO,IAAK,CACV,OAAO,MAAM,sBAAuB,gCAAiC,IAAK,CAAC,QAAQ,CAAC,CACtF,CACF,CACF,CCtBO,SAAS,UAAU,SAAkB,CAC1C,OAAO,gBAAgB,aAAc,QAAQ,EAM7C,OAAO,SAAU,YAAyC,CACxD,mBAAmB,KAAK,CAAC,SAAU,WAAW,CAAC,CACjD,CACF,CC3BA,iBAAoB,yBACpB,IAAAA,eAA2B,0BAsBpB,IAAe,cAAf,KAA6B,CA6BlC,YAAY,QAAsB,SAAkB,CAClD,KAAK,WAAU,6BAAa,aAAa,QAAQ,EAAE,EACnD,KAAK,QAAQ,gBAAgB,MAAO,CAAC,SAAU,OAAO,CAAC,EAEvD,KAAK,UAAY,SACjB,KAAK,SAAW,SAEf,SAAY,CACX,MAAM,mBAAM,cAAc,EAC1B,MAAM,KAAK,MAAM,CACnB,GAAG,CACL,CAUU,OAAyB,CACjC,KAAK,QAAQ,YAAY,OAAO,EAG/B,KAAa,UAAU,CAC1B,CAgBU,UAAU,UAAmB,OAAwB,CAC7D,KAAK,QAAQ,gBAAgB,YAAa,CAAC,UAAW,MAAM,CAAC,EAC7D,KAAK,SAAS,cAAc,IAAI,YAAY,UAAW,CAAC,OAAQ,QAAS,IAAI,CAAC,CAAC,CACjF,CASU,UAA4B,CACpC,KAAK,QAAQ,YAAY,UAAU,EACnC,KAAK,SAAS,OAAO,EAEpB,KAAa,SAAW,IAC3B,CACF,ECrGO,SAAS,MAAM,SAAkB,MAAQ,KAAM,CACpD,OAAO,SAAU,OAAuB,YAA2B,CACjE,MAAM,WAAa,OAAO,GAAG,OAAO,WAAW,CAAC,IAAI,EAEpD,OAAO,eAAe,OAAQ,YAAa,CACzC,KAAyB,CACvB,GAAI,QAAU,OAAU,KAAa,UAAU,IAAM,OAAW,CAC7D,KAAa,UAAU,EAAI,KAAK,SAAS,cAAc,QAAQ,CAClE,CACA,OAAQ,KAAa,UAAU,CACjC,EACA,aAAc,KACd,WAAY,IACd,CAAC,CACH,CACF,CAiBO,SAAS,SAAS,SAAkB,MAAQ,KAAM,CACvD,OAAO,SAAU,OAAuB,YAA2B,CACjE,MAAM,WAAa,OAAO,GAAG,OAAO,WAAW,CAAC,IAAI,EAEpD,OAAO,eAAe,OAAQ,YAAa,CACzC,KAAyB,CACvB,GAAI,QAAU,OAAU,KAAa,UAAU,IAAM,OAAW,CAC7D,KAAa,UAAU,EAAI,KAAK,SAAS,iBAAiB,QAAQ,CACrE,CACA,OAAQ,KAAa,UAAU,CACjC,EACA,aAAc,KACd,WAAY,IACd,CAAC,CACH,CACF",
6
6
  "names": ["import_logger"]
7
7
  }
package/dist/main.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /** 📦 @alwatr/synapse v1.1.17 */
2
- __dev_mode__: console.debug("📦 @alwatr/synapse v1.1.17");
3
- import{createLogger}from"@alwatr/logger";var logger=createLogger("alwatr/synapse");var directiveRegistry_=[];var initializedAttribute="_synapseConnected";function bootstrapDirectives(rootElement=document.body){logger.logMethod?.("bootstrapDirectives");for(const{selector,constructor}of directiveRegistry_){try{const uninitializedSelector=`${selector}:not([${initializedAttribute}])`;const elements=rootElement.querySelectorAll(uninitializedSelector);if(elements.length===0)continue;logger.logOther?.(`Found ${elements.length} new element(s) for directive "${selector}"`);elements.forEach(element=>{element.setAttribute(initializedAttribute,"true");new constructor(element,selector)})}catch(err){logger.error("bootstrapDirectives","directive_instantiation_error",err,{selector})}}}function directive(selector){logger.logMethodArgs?.("@directive",selector);return function(constructor){directiveRegistry_.push({selector,constructor})}}import{delay}from"@alwatr/delay";import{createLogger as createLogger2}from"@alwatr/logger";var DirectiveBase=class{constructor(element,selector){this.logger_=createLogger2(`directive:${selector}`);this.logger_.logMethodArgs?.("new",{selector,element});this.selector_=selector;this.element_=element;(async()=>{await delay.nextMicrotask();await this.init_();await this.update_()})()}init_(){this.logger_.logMethod?.("init")}destroy_(){this.logger_.logMethod?.("destroy");this.element_.remove();this.element_=null}dispatch_(eventName,detail){this.logger_.logMethodArgs?.("dispatch_",{eventName,detail});this.element_.dispatchEvent(new CustomEvent(eventName,{detail,bubbles:true}))}};function query(selector,cache=true){return function(target,propertyKey){const privateKey=Symbol(`${String(propertyKey)}__`);Object.defineProperty(target,propertyKey,{get(){if(cache===false||this[privateKey]===void 0){this[privateKey]=this.element_.querySelector(selector)}return this[privateKey]},configurable:true,enumerable:true})}}function queryAll(selector,cache=true){return function(target,propertyKey){const privateKey=Symbol(`${String(propertyKey)}__`);Object.defineProperty(target,propertyKey,{get(){if(cache===false||this[privateKey]===void 0){this[privateKey]=this.element_.querySelectorAll(selector)}return this[privateKey]},configurable:true,enumerable:true})}}export{DirectiveBase,bootstrapDirectives,directive,query,queryAll};
1
+ /** 📦 @alwatr/synapse v1.1.19 */
2
+ __dev_mode__: console.debug("📦 @alwatr/synapse v1.1.19");
3
+ import{createLogger}from"@alwatr/logger";var logger=createLogger("alwatr/synapse");var directiveRegistry_=[];var initializedAttribute="_synapseConnected";function bootstrapDirectives(rootElement=document.body){logger.logMethod?.("bootstrapDirectives");for(const{selector,constructor}of directiveRegistry_){try{const uninitializedSelector=`${selector}:not([${initializedAttribute}])`;const elements=rootElement.querySelectorAll(uninitializedSelector);if(elements.length===0)continue;logger.logOther?.(`Found ${elements.length} new element(s) for directive "${selector}"`);elements.forEach(element=>{element.setAttribute(initializedAttribute,"true");new constructor(element,selector)})}catch(err){logger.error("bootstrapDirectives","directive_instantiation_error",err,{selector})}}}function directive(selector){logger.logMethodArgs?.("@directive",selector);return function(constructor){directiveRegistry_.push({selector,constructor})}}import{delay}from"@alwatr/delay";import{createLogger as createLogger2}from"@alwatr/logger";var DirectiveBase=class{constructor(element,selector){this.logger_=createLogger2(`directive:${selector}`);this.logger_.logMethodArgs?.("new",{selector,element});this.selector_=selector;this.element_=element;(async()=>{await delay.nextMicrotask();await this.init_()})()}init_(){this.logger_.logMethod?.("init_");this.update_?.()}dispatch_(eventName,detail){this.logger_.logMethodArgs?.("dispatch_",{eventName,detail});this.element_.dispatchEvent(new CustomEvent(eventName,{detail,bubbles:true}))}destroy_(){this.logger_.logMethod?.("destroy_");this.element_.remove();this.element_=null}};function query(selector,cache=true){return function(target,propertyKey){const privateKey=Symbol(`${String(propertyKey)}__`);Object.defineProperty(target,propertyKey,{get(){if(cache===false||this[privateKey]===void 0){this[privateKey]=this.element_.querySelector(selector)}return this[privateKey]},configurable:true,enumerable:true})}}function queryAll(selector,cache=true){return function(target,propertyKey){const privateKey=Symbol(`${String(propertyKey)}__`);Object.defineProperty(target,propertyKey,{get(){if(cache===false||this[privateKey]===void 0){this[privateKey]=this.element_.querySelectorAll(selector)}return this[privateKey]},configurable:true,enumerable:true})}}export{DirectiveBase,bootstrapDirectives,directive,query,queryAll};
4
4
  //# sourceMappingURL=main.mjs.map
package/dist/main.mjs.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/lib.ts", "../src/bootstrap.ts", "../src/directiveDecorator.ts", "../src/directiveClass.ts", "../src/queryDecorator.ts"],
4
- "sourcesContent": ["import {createLogger} from '@alwatr/logger';\n\nimport type {DirectiveConstructor} from './directiveDecorator.js';\nimport type {} from '@alwatr/type-helper';\n\n/**\n * Alwatr Synapse Logger.\n */\nexport const logger = createLogger('alwatr/synapse');\n\n/**\n * The registry for all directives.\n */\nexport const directiveRegistry_: {selector: string; constructor: DirectiveConstructor}[] = [];\n", "import {directiveRegistry_, logger} from './lib.js';\n\nconst initializedAttribute = '_synapseConnected';\n\n/**\n * Initializes all registered directives within a given root element.\n * If no root element is provided, it scans the entire body.\n *\n * This function is idempotent; it will not re-initialize a directive on an element\n * that has already been processed.\n *\n * @param rootElement The element to scan for directives. Defaults to `document.body`.\n *\n * @example\n * ```ts\n * // Initialize directives on the whole page after the DOM is loaded.\n * document.addEventListener('DOMContentLoaded', () => bootstrapDirectives());\n *\n * // Or, initialize directives on a dynamically added part of the page.\n * const newContent = document.createElement('div');\n * newContent.innerHTML = '<div class=\"my-button\">Click Me</div>';\n * document.body.appendChild(newContent);\n *\n * bootstrapDirectives(newContent);\n * ```\n */\nexport function bootstrapDirectives(rootElement: Element | Document = document.body): void {\n logger.logMethod?.('bootstrapDirectives');\n\n for (const {selector, constructor} of directiveRegistry_) {\n try {\n const uninitializedSelector = `${selector}:not([${initializedAttribute}])`;\n const elements = rootElement.querySelectorAll<HTMLElement>(uninitializedSelector);\n if (elements.length === 0) continue;\n\n logger.logOther?.(`Found ${elements.length} new element(s) for directive \"${selector}\"`);\n elements.forEach((element) => {\n // Mark the element as processed before creating an instance\n element.setAttribute(initializedAttribute, 'true');\n // Instantiate the directive with the element.\n new constructor(element, selector);\n });\n }\n catch (err) {\n logger.error('bootstrapDirectives', 'directive_instantiation_error', err, {selector});\n }\n }\n}\n", "import {directiveRegistry_, logger} from './lib.js';\n\nimport type {DirectiveBase} from './directiveClass.js';\n\n/**\n * Type definition for a directive constructor.\n * A directive class must have a constructor that accepts an HTMLElement.\n */\nexport type DirectiveConstructor<T extends DirectiveBase = DirectiveBase> = new (element: HTMLElement, selector: string) => T;\n\n/**\n * A class decorator that registers a class as a directive.\n *\n * @param selector The CSS selector to which this directive will be attached.\n *\n * @example\n * ```ts\n * @directive('.my-button')\n * class MyButtonDirective extends DirectiveBase {\n * protected update_(): void {\n * this.element_.addEventListener('click', () => console.log('Button clicked!'));\n * }\n * }\n * ```\n */\nexport function directive(selector: string) {\n logger.logMethodArgs?.('@directive', selector);\n\n /**\n * The decorator function that receives the class constructor.\n * @param constructor The class to be registered as a directive.\n */\n return function (constructor: DirectiveConstructor): void {\n directiveRegistry_.push({selector, constructor});\n };\n}\n", "import {delay} from '@alwatr/delay';\nimport {createLogger} from '@alwatr/logger';\n\n/**\n * Base class for creating directives that attach behavior to DOM elements.\n * Extend this class to define custom directives.\n */\nexport abstract class DirectiveBase {\n /**\n * The CSS selector for the directive.\n */\n protected readonly selector_;\n\n /**\n * Logger instance for the directive.\n */\n protected readonly logger_;\n\n /**\n * The target DOM element this directive is attached to.\n */\n protected readonly element_: HTMLElement;\n\n /**\n * Constructor to initialize the directive with the target element.\n * @param element - The DOM element this directive is attached to.\n * @param selector - The CSS selector for the directive.\n */\n constructor(element: HTMLElement, selector: string) {\n this.logger_ = createLogger(`directive:${selector}`);\n this.logger_.logMethodArgs?.('new', {selector, element});\n\n this.selector_ = selector;\n this.element_ = element;\n\n (async () => {\n await delay.nextMicrotask();\n await this.init_();\n await this.update_();\n })();\n }\n\n /**\n * Called to update the directive's state or behavior.\n * Must be implemented by subclasses.\n */\n protected abstract update_(): Awaitable<void>;\n\n protected init_(): Awaitable<void> {\n this.logger_.logMethod?.('init');\n }\n\n protected destroy_(): Awaitable<void> {\n this.logger_.logMethod?.('destroy');\n this.element_.remove();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (this as any).element_ = null;\n }\n\n /**\n * Dispatches a custom event from the target element.\n * @param eventName - The name of the event.\n * @param detail - Optional data to include in the event.\n */\n protected dispatch_(eventName: string, detail?: unknown): void {\n this.logger_.logMethodArgs?.('dispatch_', {eventName, detail});\n this.element_.dispatchEvent(new CustomEvent(eventName, {detail, bubbles: true}));\n }\n}\n", "/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type {DirectiveBase} from './directiveClass.js';\n\n/**\n * A property decorator that queries the directive's element for a selector.\n * The query is performed once and the result is cached.\n *\n * @param selector The CSS selector to query for.\n * @param cache Whether to cache the result on first access. Defaults is true.\n *\n * @example\n * ```ts\n * @directive('[my-directive]')\n * class MyDirective extends DirectiveBase {\n * @query('.my-element')\n * protected myElement?: HTMLDivElement;\n * }\n * ```\n */\nexport function query(selector: string, cache = true) {\n return function (target: DirectiveBase, propertyKey: string): void {\n const privateKey = Symbol(`${String(propertyKey)}__`);\n\n Object.defineProperty(target, propertyKey, {\n get(this: DirectiveBase) {\n if (cache === false || (this as any)[privateKey] === undefined) {\n (this as any)[privateKey] = this.element_.querySelector(selector);\n }\n return (this as any)[privateKey];\n },\n configurable: true,\n enumerable: true,\n });\n };\n}\n\n/**\n * A property decorator that queries the directive's element for all selectors.\n * The queries are performed once and the result is cached.\n *\n * @param selector The CSS selector to query for.\n *\n * @example\n * ```ts\n * @directive('[my-directive]')\n * class MyDirective extends DirectiveBase {\n * @queryAll('.my-elements')\n * protected myElements?: NodeListOf<HTMLDivElement>;\n * }\n * ```\n */\nexport function queryAll(selector: string, cache = true) {\n return function (target: DirectiveBase, propertyKey: string): void {\n const privateKey = Symbol(`${String(propertyKey)}__`);\n\n Object.defineProperty(target, propertyKey, {\n get(this: DirectiveBase) {\n if (cache === false || (this as any)[privateKey] === undefined) {\n (this as any)[privateKey] = this.element_.querySelectorAll(selector);\n }\n return (this as any)[privateKey];\n },\n configurable: true,\n enumerable: true,\n });\n };\n}\n"],
5
- "mappings": ";;AAAA,OAAQ,iBAAmB,iBAQpB,IAAM,OAAS,aAAa,gBAAgB,EAK5C,IAAM,mBAA8E,CAAC,ECX5F,IAAM,qBAAuB,oBAwBtB,SAAS,oBAAoB,YAAkC,SAAS,KAAY,CACzF,OAAO,YAAY,qBAAqB,EAExC,SAAW,CAAC,SAAU,WAAW,IAAK,mBAAoB,CACxD,GAAI,CACF,MAAM,sBAAwB,GAAG,QAAQ,SAAS,oBAAoB,KACtE,MAAM,SAAW,YAAY,iBAA8B,qBAAqB,EAChF,GAAI,SAAS,SAAW,EAAG,SAE3B,OAAO,WAAW,SAAS,SAAS,MAAM,kCAAkC,QAAQ,GAAG,EACvF,SAAS,QAAS,SAAY,CAE5B,QAAQ,aAAa,qBAAsB,MAAM,EAEjD,IAAI,YAAY,QAAS,QAAQ,CACnC,CAAC,CACH,OACO,IAAK,CACV,OAAO,MAAM,sBAAuB,gCAAiC,IAAK,CAAC,QAAQ,CAAC,CACtF,CACF,CACF,CCtBO,SAAS,UAAU,SAAkB,CAC1C,OAAO,gBAAgB,aAAc,QAAQ,EAM7C,OAAO,SAAU,YAAyC,CACxD,mBAAmB,KAAK,CAAC,SAAU,WAAW,CAAC,CACjD,CACF,CCnCA,OAAQ,UAAY,gBACpB,OAAQ,gBAAAA,kBAAmB,iBAMpB,IAAe,cAAf,KAA6B,CAqBlC,YAAY,QAAsB,SAAkB,CAClD,KAAK,QAAUA,cAAa,aAAa,QAAQ,EAAE,EACnD,KAAK,QAAQ,gBAAgB,MAAO,CAAC,SAAU,OAAO,CAAC,EAEvD,KAAK,UAAY,SACjB,KAAK,SAAW,SAEf,SAAY,CACX,MAAM,MAAM,cAAc,EAC1B,MAAM,KAAK,MAAM,EACjB,MAAM,KAAK,QAAQ,CACrB,GAAG,CACL,CAQU,OAAyB,CACjC,KAAK,QAAQ,YAAY,MAAM,CACjC,CAEU,UAA4B,CACpC,KAAK,QAAQ,YAAY,SAAS,EAClC,KAAK,SAAS,OAAO,EAEpB,KAAa,SAAW,IAC3B,CAOU,UAAU,UAAmB,OAAwB,CAC7D,KAAK,QAAQ,gBAAgB,YAAa,CAAC,UAAW,MAAM,CAAC,EAC7D,KAAK,SAAS,cAAc,IAAI,YAAY,UAAW,CAAC,OAAQ,QAAS,IAAI,CAAC,CAAC,CACjF,CACF,ECjDO,SAAS,MAAM,SAAkB,MAAQ,KAAM,CACpD,OAAO,SAAU,OAAuB,YAA2B,CACjE,MAAM,WAAa,OAAO,GAAG,OAAO,WAAW,CAAC,IAAI,EAEpD,OAAO,eAAe,OAAQ,YAAa,CACzC,KAAyB,CACvB,GAAI,QAAU,OAAU,KAAa,UAAU,IAAM,OAAW,CAC7D,KAAa,UAAU,EAAI,KAAK,SAAS,cAAc,QAAQ,CAClE,CACA,OAAQ,KAAa,UAAU,CACjC,EACA,aAAc,KACd,WAAY,IACd,CAAC,CACH,CACF,CAiBO,SAAS,SAAS,SAAkB,MAAQ,KAAM,CACvD,OAAO,SAAU,OAAuB,YAA2B,CACjE,MAAM,WAAa,OAAO,GAAG,OAAO,WAAW,CAAC,IAAI,EAEpD,OAAO,eAAe,OAAQ,YAAa,CACzC,KAAyB,CACvB,GAAI,QAAU,OAAU,KAAa,UAAU,IAAM,OAAW,CAC7D,KAAa,UAAU,EAAI,KAAK,SAAS,iBAAiB,QAAQ,CACrE,CACA,OAAQ,KAAa,UAAU,CACjC,EACA,aAAc,KACd,WAAY,IACd,CAAC,CACH,CACF",
4
+ "sourcesContent": ["import {createLogger} from '@alwatr/logger';\n\nimport type {DirectiveConstructor} from './directiveDecorator.js';\nimport type {} from '@alwatr/type-helper';\n\n/**\n * Alwatr Synapse Logger.\n */\nexport const logger = createLogger('alwatr/synapse');\n\n/**\n * The registry for all directives.\n */\nexport const directiveRegistry_: {selector: string; constructor: DirectiveConstructor}[] = [];\n", "import {directiveRegistry_, logger} from './lib.js';\n\nconst initializedAttribute = '_synapseConnected';\n\n/**\n * Initializes all registered directives within a given root element.\n * If no root element is provided, it scans the entire body.\n *\n * This function is idempotent; it will not re-initialize a directive on an element\n * that has already been processed.\n *\n * @param rootElement The element to scan for directives. Defaults to `document.body`.\n *\n * @example\n * ```ts\n * // Initialize directives on the whole page after the DOM is loaded.\n * document.addEventListener('DOMContentLoaded', () => bootstrapDirectives());\n *\n * // Or, initialize directives on a dynamically added part of the page.\n * const newContent = document.createElement('div');\n * newContent.innerHTML = '<div class=\"my-button\">Click Me</div>';\n * document.body.appendChild(newContent);\n *\n * bootstrapDirectives(newContent);\n * ```\n */\nexport function bootstrapDirectives(rootElement: Element | Document = document.body): void {\n logger.logMethod?.('bootstrapDirectives');\n\n for (const {selector, constructor} of directiveRegistry_) {\n try {\n const uninitializedSelector = `${selector}:not([${initializedAttribute}])`;\n const elements = rootElement.querySelectorAll<HTMLElement>(uninitializedSelector);\n if (elements.length === 0) continue;\n\n logger.logOther?.(`Found ${elements.length} new element(s) for directive \"${selector}\"`);\n elements.forEach((element) => {\n // Mark the element as processed before creating an instance\n element.setAttribute(initializedAttribute, 'true');\n // Instantiate the directive with the element.\n new constructor(element, selector);\n });\n }\n catch (err) {\n logger.error('bootstrapDirectives', 'directive_instantiation_error', err, {selector});\n }\n }\n}\n", "import {directiveRegistry_, logger} from './lib.js';\n\nimport type {DirectiveBase} from './directiveClass.js';\n\n/**\n * Type definition for a directive constructor.\n * A directive class must have a constructor that accepts an HTMLElement.\n */\nexport type DirectiveConstructor<T extends DirectiveBase = DirectiveBase> = new (element: HTMLElement, selector: string) => T;\n\n/**\n * A class decorator that registers a class as a directive.\n *\n * @param selector The CSS selector to which this directive will be attached.\n *\n * @example\n * ```ts\n * @directive('.my-button')\n * class MyButtonDirective extends DirectiveBase {\n * protected update_(): void {\n * this.element_.addEventListener('click', () => console.log('Button clicked!'));\n * }\n * }\n * ```\n */\nexport function directive(selector: string) {\n logger.logMethodArgs?.('@directive', selector);\n\n /**\n * The decorator function that receives the class constructor.\n * @param constructor The class to be registered as a directive.\n */\n return function (constructor: DirectiveConstructor): void {\n directiveRegistry_.push({selector, constructor});\n };\n}\n", "/**\n * @package @alwatr/synapse\n *\n * This file defines the `DirectiveBase` class, which is the foundation for creating custom directives\n * in the Alwatr Synapse library. Directives are used to attach behavior and logic to DOM elements\n * declaratively.\n */\n\nimport {delay} from '@alwatr/delay';\nimport {createLogger} from '@alwatr/logger';\n\n/**\n * The abstract base class for all directives.\n *\n * Extend this class to create a new directive that can be registered with the `@directive` decorator.\n * It provides the core functionality for linking a TypeScript class to a DOM element and managing its lifecycle.\n *\n * @example\n * ```ts\n * import {DirectiveBase, directive} from '@alwatr/synapse';\n *\n * @directive('[my-directive]')\n * export class MyDirective extends DirectiveBase {\n * protected override init_(): void {\n * super.init_(); // فراخوانی متد والد برای حفظ سازگاری با نسخه‌های قبل ضروری است\n * this.element_.textContent = 'Hello from MyDirective!';\n * this.element_.addEventListener('click', () => this.log('Element clicked!'));\n * }\n * }\n * ```\n */\nexport abstract class DirectiveBase {\n /**\n * The CSS selector that this directive is associated with.\n * This is the selector string provided to the `@directive` decorator.\n */\n protected readonly selector_;\n\n /**\n * A dedicated logger instance for this directive, pre-configured with a context like `directive:[selector]`.\n * Use this for logging to provide clear, contextual messages.\n */\n protected readonly logger_;\n\n /**\n * The DOM element to which this directive instance is attached.\n * All directive logic operates on this element.\n */\n protected readonly element_: HTMLElement;\n\n /**\n * Initializes the directive. This constructor is called by the Synapse bootstrap process and should not be\n * overridden in subclasses.\n *\n * It sets up the logger, element, and selector, and then schedules the `init_` and `update_` lifecycle methods\n * to run in the next microtask.\n *\n * @param element The DOM element to which this directive is attached.\n * @param selector The CSS selector that matched this directive.\n */\n constructor(element: HTMLElement, selector: string) {\n this.logger_ = createLogger(`directive:${selector}`);\n this.logger_.logMethodArgs?.('new', {selector, element});\n\n this.selector_ = selector;\n this.element_ = element;\n\n (async () => {\n await delay.nextMicrotask();\n await this.init_();\n })();\n }\n\n /**\n * Called once automatically after the directive is initialized.\n *\n * This method serves as the main entry point for your directive's logic,\n * such as modifying the element or setting up event listeners.\n *\n * **Note:** Do not call this method directly. It is designed to be called only once by the framework.\n */\n protected init_(): Awaitable<void> {\n this.logger_.logMethod?.('init_');\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (this as any).update_?.(); // backward compatibility\n }\n\n /**\n * Dispatches a custom event from the target element.\n *\n * This is a convenience method for firing events that can be listened to by other parts of the application.\n * The event bubbles up through the DOM.\n *\n * @param eventName The name of the custom event.\n * @param detail Optional data to include in the event's `detail` property.\n *\n * @example\n * ```ts\n * this.dispatch_('user-action', {action: 'save', id: 123});\n * ```\n */\n protected dispatch_(eventName: string, detail?: unknown): void {\n this.logger_.logMethodArgs?.('dispatch_', {eventName, detail});\n this.element_.dispatchEvent(new CustomEvent(eventName, {detail, bubbles: true}));\n }\n\n /**\n * Cleans up the directive's resources.\n *\n * This method removes the element from the DOM and nullifies the internal reference to it,\n * helping with garbage collection. It can be extended by subclasses to perform additional cleanup,\n * such as removing event listeners.\n */\n protected destroy_(): Awaitable<void> {\n this.logger_.logMethod?.('destroy_');\n this.element_.remove();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (this as any).element_ = null;\n }\n}\n", "/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type {DirectiveBase} from './directiveClass.js';\n\n/**\n * A property decorator that queries the directive's element for a selector.\n * The query is performed once and the result is cached.\n *\n * @param selector The CSS selector to query for.\n * @param cache Whether to cache the result on first access. Defaults is true.\n *\n * @example\n * ```ts\n * @directive('[my-directive]')\n * class MyDirective extends DirectiveBase {\n * @query('.my-element')\n * protected myElement: HTMLDivElement | null;\n * }\n * ```\n */\nexport function query(selector: string, cache = true) {\n return function (target: DirectiveBase, propertyKey: string): void {\n const privateKey = Symbol(`${String(propertyKey)}__`);\n\n Object.defineProperty(target, propertyKey, {\n get(this: DirectiveBase) {\n if (cache === false || (this as any)[privateKey] === undefined) {\n (this as any)[privateKey] = this.element_.querySelector(selector);\n }\n return (this as any)[privateKey];\n },\n configurable: true,\n enumerable: true,\n });\n };\n}\n\n/**\n * A property decorator that queries the directive's element for all selectors.\n * The queries are performed once and the result is cached.\n *\n * @param selector The CSS selector to query for.\n *\n * @example\n * ```ts\n * @directive('[my-directive]')\n * class MyDirective extends DirectiveBase {\n * @queryAll('.my-elements')\n * protected myElements: NodeListOf<HTMLDivElement>;\n * }\n * ```\n */\nexport function queryAll(selector: string, cache = true) {\n return function (target: DirectiveBase, propertyKey: string): void {\n const privateKey = Symbol(`${String(propertyKey)}__`);\n\n Object.defineProperty(target, propertyKey, {\n get(this: DirectiveBase) {\n if (cache === false || (this as any)[privateKey] === undefined) {\n (this as any)[privateKey] = this.element_.querySelectorAll(selector);\n }\n return (this as any)[privateKey];\n },\n configurable: true,\n enumerable: true,\n });\n };\n}\n"],
5
+ "mappings": ";;AAAA,OAAQ,iBAAmB,iBAQpB,IAAM,OAAS,aAAa,gBAAgB,EAK5C,IAAM,mBAA8E,CAAC,ECX5F,IAAM,qBAAuB,oBAwBtB,SAAS,oBAAoB,YAAkC,SAAS,KAAY,CACzF,OAAO,YAAY,qBAAqB,EAExC,SAAW,CAAC,SAAU,WAAW,IAAK,mBAAoB,CACxD,GAAI,CACF,MAAM,sBAAwB,GAAG,QAAQ,SAAS,oBAAoB,KACtE,MAAM,SAAW,YAAY,iBAA8B,qBAAqB,EAChF,GAAI,SAAS,SAAW,EAAG,SAE3B,OAAO,WAAW,SAAS,SAAS,MAAM,kCAAkC,QAAQ,GAAG,EACvF,SAAS,QAAS,SAAY,CAE5B,QAAQ,aAAa,qBAAsB,MAAM,EAEjD,IAAI,YAAY,QAAS,QAAQ,CACnC,CAAC,CACH,OACO,IAAK,CACV,OAAO,MAAM,sBAAuB,gCAAiC,IAAK,CAAC,QAAQ,CAAC,CACtF,CACF,CACF,CCtBO,SAAS,UAAU,SAAkB,CAC1C,OAAO,gBAAgB,aAAc,QAAQ,EAM7C,OAAO,SAAU,YAAyC,CACxD,mBAAmB,KAAK,CAAC,SAAU,WAAW,CAAC,CACjD,CACF,CC3BA,OAAQ,UAAY,gBACpB,OAAQ,gBAAAA,kBAAmB,iBAsBpB,IAAe,cAAf,KAA6B,CA6BlC,YAAY,QAAsB,SAAkB,CAClD,KAAK,QAAUA,cAAa,aAAa,QAAQ,EAAE,EACnD,KAAK,QAAQ,gBAAgB,MAAO,CAAC,SAAU,OAAO,CAAC,EAEvD,KAAK,UAAY,SACjB,KAAK,SAAW,SAEf,SAAY,CACX,MAAM,MAAM,cAAc,EAC1B,MAAM,KAAK,MAAM,CACnB,GAAG,CACL,CAUU,OAAyB,CACjC,KAAK,QAAQ,YAAY,OAAO,EAG/B,KAAa,UAAU,CAC1B,CAgBU,UAAU,UAAmB,OAAwB,CAC7D,KAAK,QAAQ,gBAAgB,YAAa,CAAC,UAAW,MAAM,CAAC,EAC7D,KAAK,SAAS,cAAc,IAAI,YAAY,UAAW,CAAC,OAAQ,QAAS,IAAI,CAAC,CAAC,CACjF,CASU,UAA4B,CACpC,KAAK,QAAQ,YAAY,UAAU,EACnC,KAAK,SAAS,OAAO,EAEpB,KAAa,SAAW,IAC3B,CACF,ECrGO,SAAS,MAAM,SAAkB,MAAQ,KAAM,CACpD,OAAO,SAAU,OAAuB,YAA2B,CACjE,MAAM,WAAa,OAAO,GAAG,OAAO,WAAW,CAAC,IAAI,EAEpD,OAAO,eAAe,OAAQ,YAAa,CACzC,KAAyB,CACvB,GAAI,QAAU,OAAU,KAAa,UAAU,IAAM,OAAW,CAC7D,KAAa,UAAU,EAAI,KAAK,SAAS,cAAc,QAAQ,CAClE,CACA,OAAQ,KAAa,UAAU,CACjC,EACA,aAAc,KACd,WAAY,IACd,CAAC,CACH,CACF,CAiBO,SAAS,SAAS,SAAkB,MAAQ,KAAM,CACvD,OAAO,SAAU,OAAuB,YAA2B,CACjE,MAAM,WAAa,OAAO,GAAG,OAAO,WAAW,CAAC,IAAI,EAEpD,OAAO,eAAe,OAAQ,YAAa,CACzC,KAAyB,CACvB,GAAI,QAAU,OAAU,KAAa,UAAU,IAAM,OAAW,CAC7D,KAAa,UAAU,EAAI,KAAK,SAAS,iBAAiB,QAAQ,CACrE,CACA,OAAQ,KAAa,UAAU,CACjC,EACA,aAAc,KACd,WAAY,IACd,CAAC,CACH,CACF",
6
6
  "names": ["createLogger"]
7
7
  }
@@ -11,7 +11,7 @@ import type { DirectiveBase } from './directiveClass.js';
11
11
  * @directive('[my-directive]')
12
12
  * class MyDirective extends DirectiveBase {
13
13
  * @query('.my-element')
14
- * protected myElement?: HTMLDivElement;
14
+ * protected myElement: HTMLDivElement | null;
15
15
  * }
16
16
  * ```
17
17
  */
@@ -27,7 +27,7 @@ export declare function query(selector: string, cache?: boolean): (target: Direc
27
27
  * @directive('[my-directive]')
28
28
  * class MyDirective extends DirectiveBase {
29
29
  * @queryAll('.my-elements')
30
- * protected myElements?: NodeListOf<HTMLDivElement>;
30
+ * protected myElements: NodeListOf<HTMLDivElement>;
31
31
  * }
32
32
  * ```
33
33
  */
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@alwatr/synapse",
3
3
  "description": "Connect your TypeScript classes to the DOM, declaratively.",
4
- "version": "1.1.17",
4
+ "version": "1.1.19",
5
5
  "author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
6
6
  "bugs": "https://github.com/Alwatr/nanolib/issues",
7
7
  "dependencies": {
8
- "@alwatr/delay": "6.0.12",
9
- "@alwatr/logger": "6.0.9"
8
+ "@alwatr/delay": "6.0.13",
9
+ "@alwatr/logger": "6.0.10"
10
10
  },
11
11
  "devDependencies": {
12
- "@alwatr/nano-build": "6.3.5",
12
+ "@alwatr/nano-build": "6.3.6",
13
13
  "@alwatr/prettier-config": "5.0.5",
14
14
  "@alwatr/tsconfig-base": "6.0.3",
15
15
  "@alwatr/type-helper": "6.1.5",
@@ -80,5 +80,5 @@
80
80
  "sideEffects": false,
81
81
  "type": "module",
82
82
  "types": "./dist/main.d.ts",
83
- "gitHead": "b141732f4dab13542e3cc99926a250fd5c74bad3"
83
+ "gitHead": "211a46c74acca97bf4b570b20c6dffbdf8bcccfe"
84
84
  }