@adaas/are 0.0.3 → 0.0.5

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.
Files changed (69) hide show
  1. package/LICENSE +10 -19
  2. package/README.md +14 -2
  3. package/dist/browser/index.d.mts +843 -751
  4. package/dist/browser/index.mjs +2729 -2481
  5. package/dist/browser/index.mjs.map +1 -1
  6. package/dist/node/AreInstruction.entity-Ceyy0tbf.d.mts +163 -0
  7. package/dist/node/AreInstruction.entity-Ceyy0tbf.d.ts +163 -0
  8. package/dist/node/index.d.mts +37 -1
  9. package/dist/node/index.d.ts +37 -1
  10. package/dist/node/index.js +28 -0
  11. package/dist/node/index.mjs +4 -0
  12. package/dist/node/lib/AreAttribute/AreAttribute.entity.d.mts +80 -13
  13. package/dist/node/lib/AreAttribute/AreAttribute.entity.d.ts +80 -13
  14. package/dist/node/lib/AreCompiler/AreCompiler.component.d.mts +3 -13
  15. package/dist/node/lib/AreCompiler/AreCompiler.component.d.ts +3 -13
  16. package/dist/node/lib/AreComponent/Are.context.d.mts +64 -14
  17. package/dist/node/lib/AreComponent/Are.context.d.ts +64 -14
  18. package/dist/node/lib/AreEngine/AreEngine.component.d.mts +9 -23
  19. package/dist/node/lib/AreEngine/AreEngine.component.d.ts +9 -23
  20. package/dist/node/lib/AreEngine/AreEngine.types.d.mts +9 -25
  21. package/dist/node/lib/AreEngine/AreEngine.types.d.ts +9 -25
  22. package/dist/node/lib/AreInstruction/AreInstruction.entity.d.mts +3 -13
  23. package/dist/node/lib/AreInstruction/AreInstruction.entity.d.ts +3 -13
  24. package/dist/node/lib/AreInstruction/AreInstruction.types.d.mts +3 -13
  25. package/dist/node/lib/AreInstruction/AreInstruction.types.d.ts +3 -13
  26. package/dist/node/lib/AreInstruction/types/AreDeclaration.instruction.d.mts +37 -14
  27. package/dist/node/lib/AreInstruction/types/AreDeclaration.instruction.d.ts +37 -14
  28. package/dist/node/lib/AreInstruction/types/AreMutation.instruction.d.mts +29 -14
  29. package/dist/node/lib/AreInstruction/types/AreMutation.instruction.d.ts +29 -14
  30. package/dist/node/lib/AreInterpreter/AreInterpreter.component.d.mts +3 -13
  31. package/dist/node/lib/AreInterpreter/AreInterpreter.component.d.ts +3 -13
  32. package/dist/node/lib/AreLifecycle/AreLifecycle.component.d.mts +4 -13
  33. package/dist/node/lib/AreLifecycle/AreLifecycle.component.d.ts +4 -13
  34. package/dist/node/lib/AreLoader/AreLoader.component.d.mts +2 -13
  35. package/dist/node/lib/AreLoader/AreLoader.component.d.ts +2 -13
  36. package/dist/node/lib/AreNode/AreNode.entity.d.mts +197 -13
  37. package/dist/node/lib/AreNode/AreNode.entity.d.ts +197 -13
  38. package/dist/node/lib/AreNode/AreNode.types.d.mts +8 -14
  39. package/dist/node/lib/AreNode/AreNode.types.d.ts +8 -14
  40. package/dist/node/lib/AreScene/AreScene.context.d.mts +170 -13
  41. package/dist/node/lib/AreScene/AreScene.context.d.ts +170 -13
  42. package/dist/node/lib/AreScene/AreScene.types.d.mts +21 -14
  43. package/dist/node/lib/AreScene/AreScene.types.d.ts +21 -14
  44. package/dist/node/lib/AreSignals/AreSignals.component.d.mts +3 -12
  45. package/dist/node/lib/AreSignals/AreSignals.component.d.ts +3 -12
  46. package/dist/node/lib/AreSignals/AreSignals.context.d.mts +2 -12
  47. package/dist/node/lib/AreSignals/AreSignals.context.d.ts +2 -12
  48. package/dist/node/lib/AreSignals/AreSignals.meta.d.mts +1 -3
  49. package/dist/node/lib/AreSignals/AreSignals.meta.d.ts +1 -3
  50. package/dist/node/lib/AreSignals/AreSignals.types.d.mts +1 -3
  51. package/dist/node/lib/AreSignals/AreSignals.types.d.ts +1 -3
  52. package/dist/node/lib/AreSignals/entities/AreInit.signal.d.mts +1 -2
  53. package/dist/node/lib/AreSignals/entities/AreInit.signal.d.ts +1 -2
  54. package/dist/node/lib/AreSignals/entities/AreRoute.signal.d.mts +1 -1
  55. package/dist/node/lib/AreSignals/entities/AreRoute.signal.d.ts +1 -1
  56. package/dist/node/lib/AreStore/AreStore.context.d.mts +54 -13
  57. package/dist/node/lib/AreStore/AreStore.context.d.ts +54 -13
  58. package/dist/node/lib/AreSyntax/AreSyntax.context.d.mts +10 -12
  59. package/dist/node/lib/AreSyntax/AreSyntax.context.d.ts +10 -12
  60. package/dist/node/lib/AreSyntax/AreSyntax.types.d.mts +79 -14
  61. package/dist/node/lib/AreSyntax/AreSyntax.types.d.ts +79 -14
  62. package/dist/node/lib/AreTokenizer/AreTokenizer.component.d.mts +4 -14
  63. package/dist/node/lib/AreTokenizer/AreTokenizer.component.d.ts +4 -14
  64. package/dist/node/lib/AreTransformer/AreTransformer.component.d.mts +2 -13
  65. package/dist/node/lib/AreTransformer/AreTransformer.component.d.ts +2 -13
  66. package/package.json +32 -17
  67. package/src/index.ts +6 -0
  68. package/dist/node/Are.context-9Ija_fdC.d.ts +0 -846
  69. package/dist/node/Are.context-D7w32H1G.d.mts +0 -846
@@ -1,9 +1,31 @@
1
1
  import * as _adaas_a_concept from '@adaas/a-concept';
2
- import { A_Component, A_TYPES__Entity_Serialized, A_Entity, A_Scope, A_TYPES__Fragment_Serialized, A_Fragment, ASEID, A_TYPES__Paths, A_TYPES__Entity_Constructor, A_Error, A_Feature, A_TYPES__Ctor, A_ComponentMeta, A_TYPES__ComponentMeta } from '@adaas/a-concept';
3
- import { A_SignalVector, A_Signal, A_SignalState } from '@adaas/a-utils/a-signal';
2
+ import { A_Component, A_Fragment, A_Entity, A_Scope, ASEID, A_TYPES__Entity_Serialized, A_TYPES__Entity_Constructor, A_Error, A_Feature, A_TYPES__Paths, A_TYPES__Fragment_Serialized, A_TYPES__Ctor, A_ComponentMeta, A_TYPES__ComponentMeta, A_TYPES__Component_Constructor, A_TYPES__A_DependencyInjectable } from '@adaas/a-concept';
3
+ import { A_SignalVector, A_Signal, A_SignalState, A_SignalBus } from '@adaas/a-utils/a-signal';
4
+ import { AreNode as AreNode$1 } from '@adaas/are/node/AreNode.entity';
4
5
  import { A_ExecutionContext } from '@adaas/a-utils/a-execution';
6
+ import { AreEvent as AreEvent$1 } from '@adaas/are/event/AreEvent.context';
7
+ import { AreScene as AreScene$1 } from '@adaas/are/scene/AreScene.context';
8
+ import { AreAttribute as AreAttribute$1 } from '@adaas/are/attribute/AreAttribute.entity';
9
+ import { Are as Are$1 } from '@adaas/are/component/Are.component';
10
+ import { AreSyntaxTokenMatch as AreSyntaxTokenMatch$1, AreSyntaxTokenPayload as AreSyntaxTokenPayload$1, AreSyntaxTokenRules as AreSyntaxTokenRules$1 } from '@adaas/are/syntax/AreSyntax.types';
11
+ import { AreStore as AreStore$1 } from '@adaas/are/store/AreStore.context';
12
+ import { AreSyntax as AreSyntax$1 } from '@adaas/are/syntax/AreSyntax.context';
13
+ import { AreContext as AreContext$1 } from '@adaas/are/component/Are.context';
5
14
  import { A_Logger } from '@adaas/a-utils/a-logger';
15
+ import { AreInstruction as AreInstruction$1 } from '@adaas/are/instruction/AreInstruction.entity';
16
+ import { AreDeclaration as AreDeclaration$1 } from '@adaas/are/instruction/types/AreDeclaration.instruction';
17
+ import { AreInstructionSerialized as AreInstructionSerialized$1, AreInstructionNewProps as AreInstructionNewProps$1 } from '@adaas/are/instruction/AreInstruction.types';
18
+ import { AreMutation as AreMutation$1 } from '@adaas/are/instruction/types/AreMutation.instruction';
19
+ import { AreStoreWatchingEntity as AreStoreWatchingEntity$1 } from '@adaas/are/store/AreStore.types';
20
+ import { AreSignal as AreSignal$1 } from '@adaas/are/signals/AreSignal.entity';
6
21
  import { A_Route } from '@adaas/a-utils/a-route';
22
+ import { AreCompiler as AreCompiler$1 } from '@adaas/are/compiler/AreCompiler.component';
23
+ import { AreTransformer as AreTransformer$1 } from '@adaas/are/transformer/AreTransformer.component';
24
+ import { AreLoader as AreLoader$1 } from '@adaas/are/loader/AreLoader.component';
25
+ import { AreInterpreter as AreInterpreter$1 } from '@adaas/are/interpreter/AreInterpreter.component';
26
+ import { AreLifecycle as AreLifecycle$1 } from '@adaas/are/lifecycle/AreLifecycle.component';
27
+ import { AreTokenizer as AreTokenizer$1 } from '@adaas/are/tokenizer/AreTokenizer.component';
28
+ import { AreSignals as AreSignals$1 } from '@adaas/are/signals/AreSignals.component';
7
29
 
8
30
  declare const AreFeatures: {
9
31
  /**
@@ -170,414 +192,358 @@ declare class Are extends A_Component {
170
192
  data(...args: any[]): Promise<void> | void;
171
193
  }
172
194
 
173
- declare class AreEvent<T extends Record<string, any> = Record<string, any>> extends A_ExecutionContext<T> {
174
- }
175
-
176
- type AreInstructionNewProps<T extends any = Record<string, any>> = {
195
+ declare class AreContext extends A_ExecutionContext {
177
196
  /**
178
- * The deduplication ID that prevents duplicated instruction within the same node.
179
- *
180
- * For example to prevent duplicated AddAttribute instruction for the same attribute, we can use the attribute name as the deduplication ID, so if we have two AddAttribute instructions with the same attribute name, only the first one will be applied, and the second one will be ignored.
181
- *
182
- *
183
- * [!] Note; By default it uses action name and group if provided
197
+ * The source string represents the original template or input from which the ARE scene is generated. This can be used for debugging, error reporting, or any features that require access to the raw template data. The roots array holds references to the root nodes of the ARE scene, allowing for easy access and management of the top-level components in the rendering hierarchy. The signalsMap is a mapping between root nodes and their associated signal vectors, enabling efficient management of reactive updates and interactions within the ARE framework based on changes in the application state or user input.
184
198
  */
199
+ protected _source: string;
185
200
  /**
186
- * the Host operation to be performed. Exactly this name will be used to call a method from the Host class.
201
+ * The roots array holds references to the root nodes of the ARE scene, allowing for easy access and management of the top-level components in the rendering hierarchy. The signalsMap is a mapping between root nodes and their associated signal vectors, enabling efficient management of reactive updates and interactions within the ARE framework based on changes in the application state or user input.
187
202
  */
188
- name: string;
203
+ protected _roots: Array<AreNode$1>;
189
204
  /**
190
- * The parent instruction that created this instruction. For example, if we have a CreateElement instruction that creates a new element, and then we have an AddAttribute instruction that adds an attribute to that element, the AddAttribute instruction would have the CreateElement instruction as its parent. This can be used to track the hierarchy of instructions and their dependencies.
205
+ * This property stores a map between root node and conditions that should be met to render particular component inside the root node. This can be used to manage complex rendering logic and to optimize performance by ensuring that components are only rendered when necessary based on the defined conditions.
191
206
  */
192
- parent?: AreInstruction | undefined;
207
+ protected _signalsMap: Map<string, A_SignalVector>;
208
+ protected _performance: Map<string, number>;
209
+ protected _performanceStart: Map<string, number>;
210
+ protected _performanceDepth: Map<string, number>;
193
211
  /**
194
- * Group is an optional property that can be used to group instructions together.
195
- *
196
- * For example a set of instructions that depend on create CreateElement instruction can be grouped together with the same group name, so if the CreateElement instruction is reverted, all the instructions in the same group will be reverted as well, and so on.
197
- *
198
- * This can be useful to manage complex changes that involve multiple instructions.
199
- *
200
- * [!] Note, the best option is to use ASEID of the Instruction as a group, so all instructions with the same ASEID will be treated as a single change, and will be applied and reverted together.
212
+ * The global object can be used to store any global data or configurations that need to be accessed across different components and entities within the ARE framework. This can include things like theme settings, user preferences, or any other shared data that is relevant to the entire scene or application. By centralizing this information in the context, it allows for easier management and access to global state without needing to pass it through multiple layers of components or entities.
201
213
  */
202
- group?: AreInstruction | undefined;
214
+ get globals(): any;
215
+ constructor(
203
216
  /**
204
- * A set of additional parameters that may be needed for the rendering purpose.
205
- *
206
- * For example: for AddAttribute instruction, we may need to provide the attribute name and value as a payload, so the Host can use this information to add the attribute to the node.
217
+ * The source string represents the original template or input from which the ARE scene is generated. This can be used for debugging, error reporting, or any features that require access to the raw template data. The roots array holds references to the root nodes of the ARE scene, allowing for easy access and management of the top-level components in the rendering hierarchy. The signalsMap is a mapping between root nodes and their associated signal vectors, enabling efficient management of reactive updates and interactions within the ARE framework based on changes in the application state or user input.
207
218
  */
208
- payload?: T;
209
- };
210
- type AreInstructionSerialized<T extends any = Record<string, any>> = {
219
+ source?: string);
211
220
  /**
212
- * The name of the instruction, which corresponds to the operation that should be performed in the Host. This name is used to identify the specific method in the Host that should be called to execute the instruction, allowing for a clear mapping between instructions and their corresponding actions in the rendering process.
221
+ * The scope of the context, which can be used to access other entities and features within the same scope. This is particularly useful for components that need to interact with other parts of the scene or component, as it allows them to access shared data and functionality without needing to pass it explicitly through parameters.
213
222
  */
214
- name: string;
223
+ get scope(): _adaas_a_concept.A_Scope<any, _adaas_a_concept.A_TYPES__Component_Constructor<_adaas_a_concept.A_Component>[], _adaas_a_concept.A_TYPES__Error_Constructor<_adaas_a_concept.A_Error<_adaas_a_concept.A_TYPES__Error_Init, _adaas_a_concept.A_TYPES__Error_Serialized>>[], _adaas_a_concept.A_TYPES__Entity_Constructor<_adaas_a_concept.A_Entity<any, _adaas_a_concept.A_TYPES__Entity_Serialized>>[], A_Fragment<_adaas_a_concept.A_TYPES__Fragment_Serialized>[]>;
215
224
  /**
216
- * The type of the instruction, which can be used to categorize instructions and determine how they should be processed. For example, we can have different types for declaration instructions (e.g., DeclarationInstruction or CreateElement) and mutation instructions (e.g., AddAttribute), allowing for better organization and management of instructions based on their purpose and behavior in the scene.
225
+ * The roots array holds references to the root nodes of the ARE scene, allowing for easy access and management of the top-level components in the rendering hierarchy. The signalsMap is a mapping between root nodes and their associated signal vectors, enabling efficient management of reactive updates and interactions within the ARE framework based on changes in the application state or user input.
217
226
  */
218
- type: string;
227
+ get roots(): Array<AreNode$1>;
219
228
  /**
220
- * The parent instruction that created this instruction. For example, if we have a CreateElement instruction that creates a new element, and then we have an AddAttribute instruction that adds an attribute to that element, the AddAttribute instruction would have the CreateElement instruction as its parent. This can be used to track the hierarchy of instructions and their dependencies.
229
+ * This property stores a map between root node and conditions that should be met to render particular component inside the root node. This can be used to manage complex rendering logic and to optimize performance by ensuring that components are only rendered when necessary based on the defined conditions.
221
230
  */
222
- parent?: string | undefined;
231
+ get source(): string;
232
+ get performance(): Array<string>;
233
+ get stats(): string[];
234
+ protected countInstructions(node: AreNode$1): number;
235
+ protected countNodes(node: AreNode$1): number;
223
236
  /**
224
- * Group is an optional property that can be used to group instructions together. For example a set of instructions that depend on create CreateElement instruction can be grouped together with the same group name, so if the CreateElement instruction is reverted, all the instructions in the same group will be reverted as well, and so on. This can be useful to manage complex changes that involve multiple instructions. The best option is to use ASEID of the Instruction as a group, so all instructions with the same ASEID will be treated as a single change, and will be applied and reverted together.
237
+ * This property stores a map between root node and conditions that should be met to render particular component inside the root node. This can be used to manage complex rendering logic and to optimize performance by ensuring that components are only rendered when necessary based on the defined conditions.
238
+ *
239
+ * @param node
225
240
  */
226
- group?: string | undefined;
241
+ addRoot(node: AreNode$1): void;
227
242
  /**
228
- * A set of additional parameters that may be needed for the rendering purpose. For example: for AddAttribute instruction, we may need to provide the attribute name and value as a payload, so the Host can use this information to add the attribute to the node.
243
+ * This property stores a map between root node and conditions that should be met to render particular component inside the root node. This can be used to manage complex rendering logic and to optimize performance by ensuring that components are only rendered when necessary based on the defined conditions.
244
+ *
245
+ * @param node
229
246
  */
230
- payload: T;
231
- } & A_TYPES__Entity_Serialized;
232
-
233
- declare const AreStoreAreComponentMetaKeys: {
234
- readonly StoreExtensions: "_AreStore_StoreExtensions";
235
- };
236
-
237
- type AreStorePathValue<T, P extends string> = P extends `${infer K}.${infer Rest}` ? K extends keyof T ? AreStorePathValue<T[K], Rest> : never : P extends keyof T ? T[P] : never;
238
- type AreStoreWatchingEntity = {
239
- update(...args: any[]): void;
240
- };
241
- type AreStoreAreComponentMetaKeyNames = typeof AreStoreAreComponentMetaKeys[keyof typeof AreStoreAreComponentMetaKeys];
247
+ removeRoot(node: AreNode$1): void;
248
+ startPerformance(label?: string): void;
249
+ endPerformance(label: string): void;
250
+ }
242
251
 
243
- declare class AreInstruction<T extends Record<string, any> = Record<string, any>, S extends AreInstructionSerialized<T> = AreInstructionSerialized<T>> extends A_Entity<AreInstructionNewProps<T>, S> implements AreStoreWatchingEntity {
252
+ declare const AreNodeFeatures: {
244
253
  /**
245
- * The name of the instruction, for example "CreateElement", "AddAttribute", "RemoveNode", etc. This is used to identify the type of the instruction and how to process it. The name should be in PascalCase format, and should be unique across all instruction types. It is recommended to use a prefix that indicates the category of the instruction, for example "CreateElement" for instructions that create new elements, "UpdateAttribute" for instructions that update attributes, etc.
254
+ * Feature that is called to handle before init lifecycle of the element node
246
255
  */
247
- protected _name: string;
256
+ readonly onBeforeInit: "_AreNode_onBeforeInit";
248
257
  /**
249
- * The payload of the instruction, which can contain any additional information that may be needed for the rendering purpose. For example, for CreateElement instruction, the payload can contain the tag name and parent information, so the Host can use this information to create the element in the correct place in the scene. The payload is optional and can be an empty object if no additional information is needed.
258
+ * Feature that is called to init the element node
250
259
  */
251
- protected _payload?: T;
260
+ readonly onInit: "_AreNode_onInit";
252
261
  /**
253
- * Group is an optional property that can be used to group instructions together. For example a set of instructions that depend on create CreateElement instruction can be grouped together with the same group name, so if the CreateElement instruction is reverted, all the instructions in the same group will be reverted as well, and so on. This can be useful to manage complex changes that involve multiple instructions.
254
262
  *
255
- * [!] Note, the best option is to use ASEID of the Instruction as a group, so all instructions with the same ASEID will be treated as a single change, and will be applied and reverted together.
256
263
  */
257
- protected _group: string | undefined;
264
+ readonly onAfterInit: "_AreNode_onAfterInit";
258
265
  /**
259
- * The parent instruction that created this instruction. For example, if we have a CreateElement instruction that creates a new element, and then we have an AddAttribute instruction that adds an attribute to that element, the AddAttribute instruction would have the CreateElement instruction as its parent. This can be used to track the hierarchy of instructions and their dependencies.
266
+ * Feature that is called to handle before mount lifecycle of the element node
260
267
  */
261
- protected _parent: string | undefined;
268
+ readonly onBeforeMount: "_AreNode_onBeforeMount";
262
269
  /**
263
- * A set of properties that influence the behavior of the instruction, for example, for AddTextInstruction, we can interpolation dependent on some key in the store, so we can have a property called "interpolationKey" that will be used to track the dependencies of the instruction, and when the value of this key changes in the scope, we can update the instruction accordingly.
270
+ * Feature that is called to mount the element node
264
271
  */
265
- protected _props: Set<string>;
272
+ readonly onMount: "_AreNode_onMount";
266
273
  /**
267
- * The name of the instruction, for example "CreateElement", "AddAttribute", "RemoveNode", etc. This is used to identify the type of the instruction and how to process it. The name should be in PascalCase format, and should be unique across all instruction types. It is recommended to use a prefix that indicates the category of the instruction, for example "CreateElement" for instructions that create new elements, "UpdateAttribute" for instructions that update attributes, etc.
274
+ * Feature that is called to handle after mount lifecycle of the element node
268
275
  */
269
- get name(): string;
276
+ readonly onAfterMount: "_AreNode_onAfterMount";
270
277
  /**
271
- * The payload of the instruction, which can contain any additional information that may be needed for the rendering purpose. For example, for CreateElement instruction, the payload can contain the tag name and parent information, so the Host can use this information to create the element in the correct place in the scene. The payload is optional and can be an empty object if no additional information is needed.
272
- *
273
- * [!] Note, the payload should be serializable, so it can be stored and transmitted easily. It is recommended to use simple data structures for the payload, such as objects, arrays, strings, numbers, etc., and avoid using complex data types that may not be easily serializable.
278
+ * Feature that is called to handle before update lifecycle of the element node
274
279
  */
275
- get payload(): T;
280
+ readonly onBeforeUpdate: "_AreNode_onBeforeUpdate";
276
281
  /**
277
- * Group is an optional property that can be used to group instructions together. For example a set of instructions that depend on create CreateElement instruction can be grouped together with the same group name, so if the CreateElement instruction is reverted, all the instructions in the same group will be reverted as well, and so on. This can be useful to manage complex changes that involve multiple instructions.
278
- *
279
- * [!] Note, the best option is to use ASEID of the Instruction as a group, so all instructions with the same ASEID will be treated as a single change, and will be applied and reverted together.
282
+ * Feature that is called to handle update lifecycle of the element node
280
283
  */
281
- get group(): string | undefined;
284
+ readonly onUpdate: "_AreNode_onUpdate";
282
285
  /**
283
- * The parent instruction ASEID that created this instruction. For example, if we have a CreateElement instruction that creates a new element, and then we have an AddAttribute instruction that adds an attribute to that element, the AddAttribute instruction would have the CreateElement instruction as its parent. This can be used to track the hierarchy of instructions and their dependencies.
284
- *
285
- * [!] Note, the parent should be provided as an ASEID string, so it can be easily referenced and tracked across different contexts and times.
286
+ * Feature that is called to handle after update lifecycle of the element node
286
287
  */
287
- get parent(): string | undefined;
288
- get id(): string;
289
- get owner(): AreNode;
290
- fromNew(newEntity: AreInstructionNewProps<T>): void;
291
- fromUndefined(): void;
288
+ readonly onAfterUpdate: "_AreNode_onAfterUpdate";
292
289
  /**
293
- * Group this instruction with another instruction. This means that when one of the instructions in the group is applied or reverted, all the instructions in the same group will be applied or reverted together. This can be useful to manage complex changes that involve multiple instructions.
294
- *
295
- * For example, if we have a CreateElement instruction that creates a new element, and then we have an AddAttribute instruction that adds an attribute to that element, we can group them together with the same group name, so if we revert the CreateElement instruction, the AddAttribute instruction will be reverted as well, and so on.
296
- *
297
- * @param instruction
298
- * @returns
290
+ * Feature that is called to handle before unmount lifecycle of the element node
299
291
  */
300
- groupWith(instruction: AreInstruction): this;
292
+ readonly onBeforeUnmount: "_AreNode_onBeforeUnmount";
301
293
  /**
302
- * Ungroup this instruction from any group. This means that this instruction will be treated as an independent instruction, and will not be applied or reverted together with any other instructions. This can be useful when you want to separate an instruction from a group, so it can be applied or reverted independently.
303
- *
304
- * @returns
294
+ * Feature that is called to unmount the element node
305
295
  */
306
- unGroup(): this;
296
+ readonly onUnmount: "_AreNode_onUnmount";
307
297
  /**
308
- * Attach this instruction to a parent instruction. This means that this instruction will be considered as a child of the parent instruction, and can be used to track the hierarchy of instructions and their dependencies.
309
- *
310
- * For example, if we have a CreateElement instruction that creates a new element, and then we have an AddAttribute instruction that adds an attribute to that element, we can attach the AddAttribute instruction to the CreateElement instruction as its parent, so we can track that the AddAttribute instruction is related to the CreateElement instruction.
311
- *
312
- * @param parent
313
- * @returns
298
+ * Feature that is called to handle after unmount lifecycle of the element node
314
299
  */
315
- attachTo(parent: AreInstruction): this;
300
+ readonly onAfterUnmount: "_AreNode_onAfterUnmount";
316
301
  /**
317
- * Detach this instruction from its parent instruction. This means that this instruction will no longer be considered as a child of the parent instruction, and will not be related to it in any way. This can be useful when you want to separate an instruction from its parent, so it can be treated as an independent instruction.
318
- *
319
- * @returns
302
+ * Feature that is called to handle before destroy lifecycle of the element node
320
303
  */
321
- detach(): this;
304
+ readonly onBeforeDestroy: "_AreNode_onBeforeDestroy";
322
305
  /**
323
- * Apply this instruction to the scene. This means that the changes represented by this instruction will be applied to the scene, and the Host will perform the necessary operations to reflect these changes in the rendered output.
324
- *
325
- * For example, if this instruction is a CreateElement instruction, when we apply it, the Host will create a new element in the scene according to the information provided in the payload of the instruction. If this instruction is an AddAttribute instruction, when we apply it, the Host will add the specified attribute to the target element in the scene. The apply method can also accept an optional scope parameter, which can be used to provide additional context or information that may be needed for applying the instruction.
326
- *
327
- * @param scope
306
+ * Feature that is called to handle before destroy lifecycle of the element node
328
307
  */
329
- apply(scope?: A_Scope): void;
308
+ readonly onDestroy: "_AreNode_onDestroy";
330
309
  /**
331
- * Update this instruction in the scene. This means that the changes represented by this instruction will be updated in the scene, and the Host will perform the necessary operations to reflect these changes in the rendered output. This is particularly useful for instructions that have dynamic properties or effects that may change over time, allowing for adjustments to be made to the instruction's behavior or effects without needing to revert and reapply it entirely. The update method can also accept an optional scope parameter, which can be used to provide additional context or information that may be needed for updating the instruction.
332
- *
333
- * @param scope
310
+ * Feature that is called to handle after destroy lifecycle of the element node
334
311
  */
335
- update(scope?: A_Scope): void;
312
+ readonly onAfterDestroy: "_AreNode_onAfterDestroy";
336
313
  /**
337
- * Revert this instruction from the scene. This means that the changes represented by this instruction will be reverted from the scene, and the Host will perform the necessary operations to undo these changes in the rendered output.
338
- *
339
- * @param scope
314
+ * Feature that is called to tokenize the element node template and extract its content, attributes, and child nodes.
340
315
  */
341
- revert(scope?: A_Scope): void;
342
- }
343
-
344
- /**
345
- * This is a top-level instruction that represents the creation of a new element in the scene. It contains all the necessary information to create a new element, such as its tag and parent. This instruction can be applied to the scene to create a new element and can be reverted to remove the created element.
346
- */
347
- declare class AreDeclaration<T extends Record<string, any> = Record<string, any>, S extends AreInstructionSerialized<T> = AreInstructionSerialized<T>> extends AreInstruction<T, S> {
348
- constructor(
316
+ readonly onTokenize: "_AreNode_onTokenize";
349
317
  /**
350
- * Serialized form of the instruction, used for deserialization and reconstruction of the instruction instance. This allows for the instruction to be easily stored, transmitted, and recreated in different contexts or at different times, while maintaining all the necessary information and relationships intact.
318
+ * Feature that is called to transform the element node template, markup, styles, and data into a format that can be used for compilation. This feature is responsible for processing the raw template and extracting the necessary information to create the render plan and instructions for the node.
351
319
  */
352
- serialized: AreInstructionSerialized);
353
- constructor(
320
+ readonly onTransform: "_AreNode_onTransform";
354
321
  /**
355
- * The name of the operation to be performed in Host. For example, for CreateElement instruction, the name can be "createElement", so the Host can have a method with the same name to handle this instruction.
322
+ * Event fired when the element node is interpreted
356
323
  */
357
- name: string,
324
+ readonly onInterpret: "_AreNode_onInterpret";
358
325
  /**
359
- * In case this is a child instruction that is related to a declaration instruction, we can pass the parent declaration instruction to establish the relationship between them. This allows us to manage related instructions together and ensure that they are executed in the correct order in the scene.
326
+ * Feature that is called to compile the element node
360
327
  */
361
- parent: AreDeclaration,
328
+ readonly onCompile: "_AreNode_onCompile";
362
329
  /**
363
- * A set of additional parameters that may be needed for the rendering purpose. For example, for CreateElement instruction, the payload can contain the tag name and parent information, so the Host can use this information to create the element in the correct place in the scene.
330
+ * Feature that is called to handle events
364
331
  */
365
- payload: T);
366
- constructor(
332
+ readonly onEmit: "_AreNode_onEmit";
333
+ };
334
+ declare const AreNodeStatuses: {
367
335
  /**
368
- * The name of the operation to be performed in Host. For example, for CreateElement instruction, the name can be "createElement", so the Host can have a method with the same name to handle this instruction.
336
+ * Status indicating that the node is pending compilation. When a node is in the pending status, it means that it has been created but has not yet been compiled. During this phase, the node is typically being prepared for compilation, which may involve setting up its template, markup, styles, and any associated data or context. Once the node is ready for compilation, its status will change to "compiling".
369
337
  */
370
- name?: string,
338
+ readonly Pending: "pending";
371
339
  /**
372
- * A set of additional parameters that may be needed for the rendering purpose. For example, for CreateElement instruction, the payload can contain the tag name and parent information, so the Host can use this information to create the element in the correct place in the scene.
340
+ * Status indicating that the node is in the process of being compiled. During this status, the node is being analyzed and transformed based on its template, markup, and styles to generate the necessary instructions for rendering and updating the node in the scene.
373
341
  */
374
- payload?: T);
375
- }
376
-
377
- declare const AreSceneStatuses: {
378
- Active: string;
379
- Inactive: string;
380
- Destroyed: string;
381
- };
382
-
383
- type AreSceneChanges = {
342
+ readonly Compiling: "compiling";
384
343
  /**
385
- * An array of instructions that are planned to be applied to the scene. These instructions represent the changes that will be made to the scene when they
344
+ * Status indicating that the node has been compiled and is ready to be rendered. In this status, the node has generated all the necessary instructions and is prepared to be mounted in the scene.
386
345
  */
387
- toApply: AreInstruction[];
346
+ readonly Compiled: "compiled";
388
347
  /**
389
- * An array of instructions that are planned to be reverted from the scene. These instructions represent the changes that will be undone from the scene when they are reverted, allowing for a rollback of changes if needed.
348
+ * Status indicating that the node is currently mounted in the scene. When a node is mounted, it means that it has been rendered and is actively part of the scene's structure and content.
349
+ */
350
+ readonly Mounted: "mounted";
351
+ /**
352
+ * Status indicating that the node has been unmounted from the scene. When a node is unmounted, it means that it has been removed from the scene's structure and content, and is no longer actively rendered in the scene.
390
353
  */
391
- toRevert: AreInstruction[];
354
+ readonly Unmounted: "unmounted";
392
355
  };
393
- type AreScene_Serialized = {
394
- instructions: AreInstructionSerialized[];
395
- } & A_TYPES__Fragment_Serialized;
396
- type AreSceneStatusNames = typeof AreSceneStatuses[keyof typeof AreSceneStatuses];
397
356
 
398
- declare class AreMutation<T extends Record<string, any> = Record<string, any>, S extends AreInstructionSerialized<T> = AreInstructionSerialized<T>> extends AreInstruction<T, S> {
399
- get parent(): string;
400
- get group(): string;
401
- constructor(
357
+ type AreNodeNewProps = AreSyntaxTokenMatch$1;
358
+ type AreNodeFeatureNames = typeof AreNodeFeatures[keyof typeof AreNodeFeatures];
359
+ type AreNodeStatusNames = typeof AreNodeStatuses[keyof typeof AreNodeStatuses];
360
+
361
+ declare class AreNode extends A_Entity<AreNodeNewProps> {
402
362
  /**
403
- * Serialized form of the instruction, used for deserialization and reconstruction of the instruction instance. This allows for the instruction to be easily stored, transmitted, and recreated in different contexts or at different times, while maintaining all the necessary information and relationships intact.
363
+ * The current status of the node, which can be used to track the lifecycle and rendering state of the node within the scene.
404
364
  */
405
- serialized: S);
406
- constructor(
365
+ status: AreNodeStatusNames;
407
366
  /**
408
- * The name of the operation to be performed in Host.
367
+ * The opening string that defines the start of a node in the source. This is typically used for parsing and tokenizing the source to identify the structure and content of the node. The opening string can include the tag name, attributes, and other syntax that indicates the beginning of a node.
409
368
  */
410
- name: string,
369
+ protected _opening: string;
411
370
  /**
412
- * Parent instruction for grouping in case of mutations related to a specific declaration. This allows for better organization and management of instructions in the scene, as all mutations related to the same declaration will be executed together.
371
+ * The closing string that defines the end of a node in the source. This is typically used for parsing and tokenizing the source to identify the structure and content of the node. The closing string can include the tag name, attributes, and other syntax that indicates the end of a node.
413
372
  */
414
- parent: AreDeclaration,
373
+ protected _closing: string;
415
374
  /**
416
- * A set of additional parameters that may be needed for the rendering purpose. For example, for AddAttribute instruction, the payload can contain the attribute name and value as a payload, so the Host can use this information to add the attribute to the node.
375
+ * The position of the node in the source string, which can be used for error reporting, debugging, and other purposes related to tracking the location of the node within the original source. The position is a character index identifying where the node is defined.
417
376
  */
418
- payload?: T);
419
- fromNew(newEntity: AreInstructionNewProps<T>): void;
420
- }
421
-
422
- declare class AreScene extends A_Fragment {
423
- protected _groupToInstructionsMap: Map<string, Set<AreInstruction>>;
377
+ protected _position: number;
424
378
  /**
425
- * Plan is a queue of changes that should be applied to render the node
426
- *
427
- * It works as FIFO, so the first instruction that should be applied is the first one in the queue, and so on.
379
+ * The payload associated with the node, which can include any additional data or metadata that is extracted during the tokenization process. The payload can be used to store custom information related to the node, such as directive arguments, binding expressions, or any other relevant data that may be needed for processing and rendering the node within the scene.
428
380
  */
429
- protected _plan: Array<AreInstruction>;
381
+ protected _payload?: AreSyntaxTokenPayload$1;
430
382
  /**
431
- * State is a list of instructions that are currently applied to the node,
432
- * so it represents the current state of the node in the scene.
433
- *
434
- * It always in a reverse order of the plan, so the last instruction in the state is the first one that should be reverted when we need to revert the changes, and so on.
435
- *
436
- * For example, if we have a node with two instructions in the plan: [Instruction A, Instruction B], and both of them are applied to the node, then the state will be [Instruction B, Instruction A], so when we need to revert the changes, we will revert Instruction B first, and then Instruction A.
383
+ * Content string defined for the node the inner content between delimiters.
384
+ * Example: `{{name}}`
437
385
  */
438
- protected _state: Array<AreInstruction>;
439
- protected _host: AreDeclaration | undefined;
386
+ protected _content: string;
440
387
  /**
441
- * Scene status is used to determine the current lifecycle stage of the scene, which can be 'active', 'inactive' or 'destroyed'. This status can be used to control the behavior of the scene and its instructions, for example, we can prevent applying new instructions to an inactive or destroyed scene, or we can trigger certain actions when the scene becomes active or inactive. The default status of the scene is 'inactive', which means that the scene is not yet rendered and its instructions are not applied, and it will become 'active' when it is mounted and its instructions are applied, and it will become 'destroyed' when it is unmounted and its instructions are reverted.
388
+ * Markup string defined for the node
389
+ * Example: `<custom-component :prop="value"> <div>Inner Content</div> </custom-component>`
442
390
  */
443
- protected _status: AreSceneStatusNames;
444
- constructor(
391
+ protected _markup: string;
445
392
  /**
446
- * Scene identity will be used to identify mounting point in the parent scene
393
+ * The scope associated with this node
394
+ * uses to store all nested fragments and entities like other AreNodes and Scene
447
395
  */
448
- id: string | ASEID);
396
+ protected _scope: A_Scope;
449
397
  /**
450
- * Scene ID that corresponds to the root node's ID (part of ASEID)
398
+ * Actual node identifier.
451
399
  */
452
400
  get id(): string;
453
401
  /**
454
- * The scope where scene is registered. This scope is owned by AreNode
402
+ * Actual node type.
403
+ * By default it's a tag name
455
404
  */
456
- get scope(): A_Scope;
405
+ get type(): string;
457
406
  /**
458
- * The owner node of the scene, which is the node that registered the scene in its scope.
459
- * This is typically the node that is responsible for rendering the scene and managing its lifecycle.
407
+ * Content string defined for the node the inner content between delimiters.
408
+ * Example: `{{name}}`
460
409
  */
461
- get owner(): AreNode;
410
+ get content(): string;
462
411
  /**
463
- * It's a primary declaration instruction that represents the node in the scene, so it should be registered as a host instruction for the scene, and it will be used to keep track of the node in the scene and to manage its lifecycle.
412
+ * Markup string defined for the node
413
+ * Example: `<custom-component :prop="value"> <div>Inner Content</div> </custom-component>`
464
414
  */
465
- get host(): AreDeclaration | undefined;
415
+ get markup(): string;
466
416
  /**
467
- * Scene status is used to determine the current lifecycle stage of the scene, which can be 'active', 'inactive' or 'destroyed'. This status can be used to control the behavior of the scene and its instructions, for example, we can prevent applying new instructions to an inactive or destroyed scene, or we can trigger certain actions when the scene becomes active or inactive. The default status of the scene is 'inactive', which means that the scene is not yet rendered and its instructions are not applied, and it will become 'active' when it is mounted and its instructions are applied, and it will become 'destroyed' when it is unmounted and its instructions are reverted.
417
+ * The scope associated with this node
418
+ * uses to store all nested fragments and entities like other AreNodes and Scene
468
419
  */
469
- get status(): AreSceneStatusNames;
470
- get isActive(): boolean;
471
- get isInactive(): boolean;
420
+ get scope(): A_Scope;
472
421
  /**
473
- * Returns All declaration instructions are registered in the scene scope. Since declaration instructions are the main instructions that represent the structure of the node, we have a separate getter for them to easily access and manage them in the scene.
422
+ * The attributes defined for the node, which can include static attributes, binding attributes, directive attributes, and event attributes. These attributes are extracted during tokenization and processed during the compilation phase to generate the corresponding SceneInstructions for rendering and updating the node in the scene.
474
423
  */
475
- get declarations(): AreDeclaration[];
424
+ get attributes(): AreAttribute$1[];
476
425
  /**
477
- * Returns All mutation instructions are registered in the scene scope. Mutation instructions are the instructions that represent the changes to be applied to the node, so we have a separate getter for them to easily access and manage them in the scene, especially when we want to apply or revert changes based on the mutations.
426
+ * A custom component associated with this node, which can be used to provide custom logic and behavior for the node. This component is typically defined in the context and can be resolved based on the node's type or other identifying information. The component can include its own content, markup, styles, and features that are specific to the functionality it provides.
427
+ *
428
+ * Example: If the node type is "custom-component", the corresponding component would be resolved from the context and can be used to provide custom rendering and behavior for nodes of that type.
429
+ *
430
+ * [!] Note: The component is optional and may not be defined for all nodes. If no component is associated with the node, it will be treated as a standard HTML element or a basic node without custom logic.
478
431
  */
479
- get mutations(): AreMutation[];
432
+ get component(): Are$1 | undefined;
480
433
  /**
481
- * Returns All instructions are registered in the scene scope.
434
+ * The parent node of this node, which is the node that registered the current node in its scope. This is typically the node that is responsible for rendering the current node and managing its lifecycle within the scene. The parent node can be used to access shared context, propagate events, and manage interactions between nodes in a hierarchical structure.
435
+ *
436
+ * Example: For a node defined as `<div><span>Child Node</span></div>`, the parent node of the `<span>` element would be the `<div>` element, which is responsible for rendering the `<span>` and managing its lifecycle within the scene.
482
437
  */
483
- get instructions(): AreInstruction[];
438
+ get parent(): AreNode | undefined;
484
439
  /**
485
- * Plan is a queue of changes that should be applied to render the node
440
+ * The child nodes of this node, which are typically defined in the markup and registered in the scope as child entities. These child nodes can represent nested elements or components within the node and can have their own content, markup, styles, and features. The child nodes are managed within the scope of the parent node and can be accessed and manipulated as needed for rendering, updating, and lifecycle management.
486
441
  *
487
- * It works as FIFO, so the first instruction that should be applied is the first one in the queue, and so on.
442
+ * Example: For a node defined as `<div><span>Child Node</span></div>`, the child node would be the `<span>` element, which is registered as a child entity in the scope of the parent `<div>` node.
488
443
  */
489
- get planned(): AreInstruction[];
444
+ get children(): (AreNode)[];
490
445
  /**
491
- * State is a list of instructions that are currently applied to the node,
492
- * so it represents the current state of the node in the scene.
493
- *
494
- * It always in a reverse order of the plan, so the last instruction in the state is the first one that should be reverted when we need to revert the changes, and so on.
495
- *
496
- * For example, if we have a node with two instructions in the plan: [Instruction A, Instruction B], and both of them are applied to the node, then the state will be [Instruction B, Instruction A], so when we need to revert the changes, we will revert Instruction B first, and then Instruction A.
446
+ * It returns the scene where the node exists, so it should be the scene of the rootNode,
447
+ * primary parent of this node.
497
448
  */
498
- get applied(): AreInstruction[];
449
+ get scene(): AreScene$1;
450
+ protected _scene: AreScene$1;
451
+ fromNew(newEntity: AreNodeNewProps): void;
452
+ fromASEID(aseid: string | ASEID): void;
499
453
  /**
500
- * Should return instructions to be reverted and to be applied.
501
- * A difference between plan vs state is that plan is what should be applied to the scene,
502
- * while state is what currently applied to the scene.
454
+ * Sets the content string for the node the inner text/markup between the node's
455
+ * opening and closing delimiters. Content is processed by the rendering engine to
456
+ * generate the corresponding SceneInstructions for rendering the node.
503
457
  *
458
+ * @param content
504
459
  */
505
- get changes(): AreSceneChanges;
506
- activate(): void;
507
- deactivate(): void;
460
+ setContent(content: string): void;
508
461
  /**
509
- * Each scene has a primary declaration instruction that represents the node in the scene, so it should be registered as a host instruction for the scene, and it will be used to keep track of the node in the scene and to manage its lifecycle. This method allows to set the host instruction for the scene, but it will throw an error if we try to set another host instruction while there is already a host instruction set, so we can ensure that there is only one host instruction for the scene at any given time.
462
+ * Sets the markup string for the node, which is the full raw matched string including delimiters. The markup can include HTML-like syntax, custom components, directives, and other features that are processed by the rendering engine to generate the corresponding SceneInstructions for rendering the node.
510
463
  *
511
- * @param instruction
464
+ * @param markup
512
465
  */
513
- setHost(instruction: AreDeclaration): void;
466
+ setMarkup(markup: string): void;
514
467
  /**
515
- * Unsets the current host instruction from the scene.
468
+ * Adds a child node to the current node's scope and ensures the child inherits from this node's scope.
516
469
  *
517
- * This method should be used when we want to remove the primary declaration instruction that represents the node in the scene, for example, when we want to unmount the node or when we want to replace it with another node. Unsetting the host instruction will allow us to set a new host instruction for the scene if needed.
470
+ * @param child - The node to add as a child
518
471
  */
519
- removeHost(): void;
472
+ addChild(child: AreNode): void;
520
473
  /**
521
- * Method that should register the instruction in the plan, so it will be rendered in the next render cycle.
474
+ * Removes a child node from the current node's scope. This is typically used when a child node is no longer needed or should be detached from the parent node. The method ensures that the child node is properly deregistered from the scope and any associated resources are cleaned up as necessary.
522
475
  *
523
- * @param instruction
476
+ * @param node - The child node to be removed from the current node's scope
477
+ */
478
+ removeChild(node: AreNode): void;
479
+ /**
480
+ * Executes initialization logic for the node, which typically involves setting up the node's scope, registering any necessary entities, and preparing the node for rendering and interaction within the scene. This method is called during the initial phase of the node's lifecycle and is responsible for ensuring that the node is properly initialized before it is compiled and rendered in the scene.
524
481
  */
525
- plan(instruction: AreInstruction): void;
526
- planBefore(instruction: AreInstruction, beforeInstruction: AreInstruction): void;
527
- planAfter(instruction: AreInstruction, afterInstruction: AreInstruction): void;
528
- moveBefore(instruction: AreInstruction, beforeInstruction: AreInstruction): void;
529
- moveAfter(instruction: AreInstruction, afterInstruction: AreInstruction): void;
482
+ init(): void;
530
483
  /**
531
- * Allows to remove instruction from the plan, so it will not be rendered anymore, but it will still be registered in the scene scope, so it can be planned again if needed.
484
+ * Loads the node, which typically involves executing any necessary setup or initialization logic to prepare the node for rendering and interaction within the scene. This may include processing the node's content, markup, styles, and features to generate the corresponding SceneInstructions, as well as setting up any event listeners or reactive properties as needed.
485
+ */
486
+ load(): Promise<any>;
487
+ /**
488
+ * Tokenizes the node content, which typically involves parsing the raw content string to identify the structure, child nodes, attributes, directives, and other features. This process is essential for breaking down the content into its constituent parts and preparing it for further processing during the compilation phase. The tokenization process can involve creating child nodes, extracting attributes and their values, and identifying any directives or bindings that need to be processed during rendering.
489
+ */
490
+ tokenize(): void;
491
+ /**
492
+ * Transforms the node, which typically involves executing any necessary logic to reshape the node's structure or content before it is compiled and rendered in the scene. This may include applying any transformations defined by directives, processing any dynamic content or expressions, and performing any other necessary tasks to ensure that the node is properly prepared for compilation and rendering based on its content, markup, styles, and features.
493
+ */
494
+ transform(): void;
495
+ /**
496
+ * Compile the node. This method should transform the node's content, markup, and styles into a set of SceneInstructions that can be executed to render the node in the scene. The compile method is responsible for processing the node's features, attributes, directives, and other properties to generate the necessary instructions for rendering and updating the node in response to changes in state or context.
532
497
  *
533
- * @param instruction
498
+ * [!] Note: The compile method should ensure that the node's scope is properly inherited from the context scope before processing, and it should handle any errors that may occur during compilation to ensure that the node can be rendered correctly in the scene.
534
499
  */
535
- unPlan(instruction: AreInstruction): void;
500
+ compile(): void;
536
501
  /**
537
- * Checks if the instruction is already in the plan, so it will be rendered in the next render cycle.
502
+ * Mounts the node, which typically involves executing any necessary logic to render the node in the scene and to set up any interactions or behaviors associated with the node. This may include applying the generated SceneInstructions from the compile phase, attaching event listeners, and performing any other necessary tasks to ensure that the node is properly rendered and functional within the scene.
538
503
  *
539
- * @param instruction
540
- * @returns
504
+ * [!] Note: The mount method should ensure that the node's scope is properly inherited from the context scope before performing any mounting logic, and it should handle any errors that may occur during mounting to ensure that the node can be rendered correctly in the scene.
541
505
  */
542
- getPlanned(instruction: AreInstruction): AreInstruction | undefined;
506
+ mount(): void;
543
507
  /**
544
- * Checks if the instruction is already in the plan, so it will be rendered in the next render cycle.
508
+ * Interprets the node, which typically involves executing any necessary logic to process the node's features, attributes, directives, and other properties to generate the corresponding SceneInstructions for rendering and updating the node in response to changes in state or context. This method is responsible for ensuring that the node is properly interpreted based on its content, markup, styles, and features to enable dynamic behavior and responsiveness within the scene.
545
509
  *
546
- * @param instruction
547
- * @returns
510
+ * [!] Note: The interpret method should NOT go though own child, since it may be used by both mount and update operations!
548
511
  */
549
- isInPlan(instruction: AreInstruction): boolean;
512
+ interpret(): void;
550
513
  /**
551
- * Method moves the instruction to state to keep it applied and to be able to revert it later if needed. The instruction should be already registered in the scene scope and planned to be applied, otherwise it will not be applied.
514
+ * Updates the node, which typically involves executing any necessary logic to update the node's rendering and behavior in response to changes in state, context, or other factors. This may include reapplying SceneInstructions, updating event listeners, and performing any other necessary tasks to ensure that the node remains functional and correctly rendered within the scene as changes occur.
552
515
  *
553
- * @param instruction
516
+ * [!] Note: The update method should ensure that the node's scope is properly inherited from the context scope before performing any update logic, and it should handle any errors that may occur during updating to ensure that the node can be updated correctly in the scene.
554
517
  */
555
- apply(instruction: AreInstruction): void;
518
+ update(): void;
556
519
  /**
557
- * Method moves the instruction from state to unapply it and to be able to apply it later if needed. The instruction should be already registered in the scene scope and applied, otherwise it will not be unapplied.
520
+ * Unmounts the node, which typically involves executing any necessary logic to remove the node from the scene and to clean up any resources associated with the node. This may include reverting any applied SceneInstructions, detaching event listeners, and performing any other necessary tasks to ensure that the node is properly removed from the scene and that resources are released as needed.
558
521
  *
559
- * @param instruction
522
+ * [!] Note: The unmount method should ensure that the node's scope is properly inherited from the context scope before performing any unmounting logic, and it should handle any errors that may occur during unmounting to ensure that the node can be removed correctly from the scene.
560
523
  */
561
- unApply(instruction: AreInstruction): void;
524
+ unmount(): void;
525
+ cloneWithScope<T extends AreNode = AreNode>(this: T): T;
526
+ reset(): void;
527
+ clone<T extends AreNode = AreNode>(this: T): T;
562
528
  /**
563
- * Checks if the instruction is already in the state, so it is currently applied to the scene.
529
+ * Emits an event or a scope to the node, which can be used to trigger event handlers or to provide additional context for processing within the node. The method can accept either an AreEvent instance or an A_Scope instance, and it will handle the emission accordingly. This allows for flexible communication and interaction within the node's context, enabling dynamic behavior and responsiveness based on events or changes in scope.
564
530
  *
565
- * @param instruction
566
- * @returns
531
+ * @param scope - The scope or event to be emitted to the node
567
532
  */
568
- getApplied(instruction: AreInstruction): AreInstruction | undefined;
533
+ emit(scope: A_Scope): any;
534
+ emit(event: AreEvent$1): any;
569
535
  /**
570
- * Checks if the instruction is already in the state, so it is currently applied to the scene.
536
+ * Destroys the node, which typically involves executing any necessary cleanup logic to remove the node from the scene and to free up any resources associated with the node. This may include deregistering the node from its scope, removing any event listeners or reactive properties, and performing any other necessary cleanup tasks to ensure that the node is properly removed from the scene and that resources are released as needed.
571
537
  *
572
- * @param instruction
573
- * @returns
538
+ * [!] Note: The destroy method should ensure that the node's scope is properly inherited from the context scope before performing any cleanup, and it should handle any errors that may occur during destruction to ensure that resources are released correctly.
574
539
  */
575
- isApplied(instruction: AreInstruction): boolean;
540
+ destroy(): Promise<any>;
576
541
  /**
577
- * Method that should reset the scene to the initial state, so it will clear the plan and state, but it will not deregister the instructions from the scene scope, so they will still be registered in the scene and can be planned and applied again if needed.
542
+ * Method to ensure that the current scope is inherited from the context scope
578
543
  *
544
+ * @throws A_Error if the scope is not inherited from the context scope
579
545
  */
580
- reset(): void;
546
+ protected checkScopeInheritance(): void;
581
547
  }
582
548
 
583
549
  declare const AreAttributeFeatures: {
@@ -675,7 +641,7 @@ declare class AreAttribute extends A_Entity<AreAttribute_Init, AreAttribute_Seri
675
641
  /**
676
642
  * The owner node of the attribute, which is the node that the attribute is attached to. This can be used to access the properties and features of the owner node, as well as to determine the context in which the attribute is being used. For example, if the attribute is attached to a button element, the owner would be that button node, and the attribute could use this information to modify the button's behavior or appearance based on its content and context.
677
643
  */
678
- get owner(): AreNode;
644
+ get owner(): AreNode$1;
679
645
  /**
680
646
  * Initializes the attribute based on the provided properties. This method is called when a new attribute is created and should set up the attribute's state based on the provided properties. It can also be used to generate a unique ASEID for the attribute based on its name and content, which can be used for caching and identification purposes within the ARE framework.
681
647
  *
@@ -720,53 +686,7 @@ declare class AreAttribute extends A_Entity<AreAttribute_Init, AreAttribute_Seri
720
686
  validate(scope?: A_Scope): void;
721
687
  }
722
688
 
723
- declare class AreStore<T extends Record<string, any> = Record<string, any>> extends A_ExecutionContext<T> {
724
- protected dependencies: Map<string, Set<AreStoreWatchingEntity>>;
725
- protected _keys: Set<keyof T>;
726
- /**
727
- * Allows to define a pure function that will be executed in the context of the store, so it can access the store's data and methods, but it won't have access to the component's scope or other features. This can be useful for example for defining a function that will update the store's data based on some logic, without having access to the component's scope or other features, so we can keep the store's logic separate from the component's logic.
728
- */
729
- static get Function(): <T extends Are>(target: T, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
730
- get owner(): AreNode;
731
- get parent(): AreStore | undefined;
732
- get context(): AreContext;
733
- constructor(aseid: ASEID | string);
734
- get watchers(): Set<AreStoreWatchingEntity>;
735
- get keys(): Set<keyof T>;
736
- watch(instruction: AreStoreWatchingEntity): void;
737
- unwatch(instruction: AreStoreWatchingEntity): void;
738
- set<K extends keyof T>(values: Partial<T>): this;
739
- set<P extends A_TYPES__Paths<T>>(key: P, value: AreStorePathValue<T, P>): this;
740
- get<K extends keyof T>(key: K): T[K] | undefined;
741
- protected setAsObject(values: Partial<T>): this;
742
- protected setAsKeyValue<K extends keyof T, P extends A_TYPES__Paths<T>>(key: K | P, value: T[K] | AreStorePathValue<T, P>): this;
743
- /**
744
- * Notifies instructions — immediately or deferred if inside a batch.
745
- */
746
- private notify;
747
- /**
748
- * Removes an instruction from all dependency sets.
749
- * Called when an instruction is reverted/destroyed.
750
- */
751
- unregister(instruction: AreStoreWatchingEntity): void;
752
- /**
753
- * Normalizes a path once — reused in both get and set.
754
- */
755
- private normalizePath;
756
- /**
757
- * Extracts direct children of the current markup level into typed instances.
758
- * No tree walking, recursion, or nested parsing — just direct children.
759
- */
760
- extractPathSegments(path: string): string[];
761
- /**
762
- * Method allows to initialize all extensions defined in the component with @AreStore.Function decorator, so we can use them in the store's context. This method should be called in the component's constructor after super() call, so the store will have access to the component's instance and its properties.
763
- *
764
- * @param component
765
- */
766
- loadExtensions(component: Are): void;
767
- }
768
-
769
- interface AreSyntaxTokenRules<T extends AreNode = AreNode> {
689
+ interface AreSyntaxTokenRules<T extends AreNode$1 = AreNode$1> {
770
690
  /** Opening delimiter e.g. '<', '{{', '<!--', '{' */
771
691
  opening?: string;
772
692
  /** Closing delimiter e.g. '>', '}}', '-->', '}' */
@@ -836,599 +756,644 @@ interface AreSyntaxInitOptions {
836
756
  strictMode?: boolean;
837
757
  }
838
758
  type AreSyntaxCompiledExpression = {
839
- execute: (store: AreStore, scope?: Record<string, any>) => any;
759
+ execute: (store: AreStore$1, scope?: Record<string, any>) => any;
840
760
  isCallable: boolean;
841
761
  };
842
762
 
843
- declare const AreNodeFeatures: {
763
+ declare class AreSyntax extends A_Fragment {
844
764
  /**
845
- * Feature that is called to handle before init lifecycle of the element node
765
+ * Max allowed length of an expression string to prevent excessively long inputs that could lead to performance issues or abuse.
846
766
  */
847
- readonly onBeforeInit: "_AreNode_onBeforeInit";
767
+ private readonly MAX_LENGTH;
848
768
  /**
849
- * Feature that is called to init the element node
769
+ * Max allowed nesting depth of parentheses, brackets, and braces in expressions to prevent excessively complex inputs that could lead to performance issues or abuse. Default is 5 levels of nesting.
850
770
  */
851
- readonly onInit: "_AreNode_onInit";
771
+ private readonly MAX_DEPTH;
852
772
  /**
853
- *
773
+ * List of regex patterns that are blocked in expressions to prevent access to unsafe or sensitive features. This includes patterns for global objects, functions, and syntax that could be used for malicious purposes (e.g. "eval", "Function", "fetch", "XMLHttpRequest", "import", "require", "document", "window", "globalThis", "global", "process", "__proto__", "constructor", "prototype"). Expressions containing any of these patterns will be rejected during validation.
854
774
  */
855
- readonly onAfterInit: "_AreNode_onAfterInit";
775
+ private readonly BLOCKED_PATTERNS;
856
776
  /**
857
- * Feature that is called to handle before mount lifecycle of the element node
777
+ * Set of global identifiers that are blocked in expressions to prevent access to unsafe or sensitive features. This includes global objects and functions that could be used for malicious purposes (e.g. "eval", "Function", "fetch", "XMLHttpRequest", "document", "window", "globalThis", "global", "process", "setTimeout", "setInterval", "localStorage", "sessionStorage", "indexedDB", "WebSocket", "Worker"). Accessing any of these identifiers in an expression will be rejected during validation.
858
778
  */
859
- readonly onBeforeMount: "_AreNode_onBeforeMount";
779
+ private readonly BLOCKED_GLOBALS;
860
780
  /**
861
- * Feature that is called to mount the element node
781
+ * Regex pattern that defines the allowed characters in expressions. This pattern allows letters, digits, whitespace, and common operators and punctuation used in JavaScript expressions. Expressions containing characters that do not match this pattern will be rejected during validation to prevent injection of potentially harmful code.
862
782
  */
863
- readonly onMount: "_AreNode_onMount";
783
+ private readonly ALLOWED_CHARS;
864
784
  /**
865
- * Feature that is called to handle after mount lifecycle of the element node
785
+ * Simple dot-path identifier pattern (e.g. "name", "user.name", "user.profile.name").
786
+ * Matches strings that consist solely of identifier characters separated by dots.
866
787
  */
867
- readonly onAfterMount: "_AreNode_onAfterMount";
788
+ private readonly SIMPLE_PATH;
868
789
  /**
869
- * Feature that is called to handle before update lifecycle of the element node
790
+ * Compiled expression a pre-parsed function ready for repeated execution.
791
+ * Created once via compile(), reused on every apply/click.
870
792
  */
871
- readonly onBeforeUpdate: "_AreNode_onBeforeUpdate";
793
+ private readonly _rules;
794
+ private readonly _trimWhitespace;
795
+ private readonly _strictMode;
796
+ constructor(config?: Partial<AreSyntaxInitOptions>);
872
797
  /**
873
- * Feature that is called to handle update lifecycle of the element node
798
+ * Get the array of token rules that define the syntax for parsing templates. Each rule specifies how to identify and process a particular type of token (e.g. interpolation, directive, comment) within templates. The rules are checked in order of priority, allowing for flexible and customizable parsing behavior.
874
799
  */
875
- readonly onUpdate: "_AreNode_onUpdate";
800
+ get rules(): AreSyntaxTokenRules<AreNode>[];
876
801
  /**
877
- * Feature that is called to handle after update lifecycle of the element node
802
+ * Indicates whether leading and trailing whitespace should be trimmed from token content. When enabled, any whitespace at the start or end of the content captured by a token will be removed before further processing. This can help prevent issues with unintended spaces affecting rendering or logic, especially in cases like interpolations or directives where extra whitespace may be common. Default is true.
878
803
  */
879
- readonly onAfterUpdate: "_AreNode_onAfterUpdate";
804
+ get trimWhitespace(): boolean;
880
805
  /**
881
- * Feature that is called to handle before unmount lifecycle of the element node
806
+ * Indicates whether the parser should throw an error when it encounters unclosed tokens. When enabled, if the parser finds an opening delimiter without a corresponding closing delimiter (e.g. an unclosed interpolation or directive), it will throw an error instead of silently ignoring it. This can help catch syntax errors and ensure that templates are well-formed. Default is true.
882
807
  */
883
- readonly onBeforeUnmount: "_AreNode_onBeforeUnmount";
808
+ get strictMode(): boolean;
884
809
  /**
885
- * Feature that is called to unmount the element node
886
- */
887
- readonly onUnmount: "_AreNode_onUnmount";
888
- /**
889
- * Feature that is called to handle after unmount lifecycle of the element node
890
- */
891
- readonly onAfterUnmount: "_AreNode_onAfterUnmount";
892
- /**
893
- * Feature that is called to handle before destroy lifecycle of the element node
894
- */
895
- readonly onBeforeDestroy: "_AreNode_onBeforeDestroy";
896
- /**
897
- * Feature that is called to handle before destroy lifecycle of the element node
898
- */
899
- readonly onDestroy: "_AreNode_onDestroy";
900
- /**
901
- * Feature that is called to handle after destroy lifecycle of the element node
810
+ * Compiles an expression string into a reusable executor.
811
+ * Performs validation and Function construction once.
812
+ * Use when the same expression will be evaluated multiple times
813
+ * e.g. event handlers, instructions that re-apply on store changes.
814
+ *
815
+ * @example
816
+ * // compile once at apply() time
817
+ * const compiled = AreCommonHelper.compile('(e) => !!pageTitle ? $testHandler(e, item) : null')
818
+ *
819
+ * // execute on every click — no re-parsing, no re-validation
820
+ * element.addEventListener('click', (e) => {
821
+ * const fn = compiled.execute(store, { $testHandler: handler, item })
822
+ * if (typeof fn === 'function') fn(e)
823
+ * })
902
824
  */
903
- readonly onAfterDestroy: "_AreNode_onAfterDestroy";
825
+ compile(expr: string): AreSyntaxCompiledExpression;
904
826
  /**
905
- * Feature that is called to tokenize the element node template and extract its content, attributes, and child nodes.
827
+ * Evaluates an expression string against the provided store.
828
+ * Automatically determines whether the result should be callable
829
+ * based on the shape of the expression.
830
+ *
831
+ * Returns the raw value for plain expressions (interpolations, bindings).
832
+ * Returns a bound function for callable expressions (event handlers).
833
+ *
834
+ * @param expr Expression string to evaluate.
835
+ * @param store AreStore used for identifier resolution.
836
+ * @param scope Optional extra bindings checked **before** the store.
837
+ * Useful for injecting event-specific values (`$event`, `element`)
838
+ * or emit wrappers (`$handleClick`).
839
+ *
840
+ * @example
841
+ * // simple value
842
+ * evaluate('user.name', store)
843
+ *
844
+ * // with emit wrapper
845
+ * evaluate('$handleClick($event, user.name)', store, {
846
+ * $event: domEvent,
847
+ * $handleClick: (...args) => node.emit(new AreEvent('handleClick', args)),
848
+ * })
849
+ *
850
+ * // arrow with conditional
851
+ * evaluate('(e) => isValid(user.name) ? $handleClick(e) : null', store, {
852
+ * $handleClick: (...args) => node.emit(new AreEvent('handleClick', args)),
853
+ * })
906
854
  */
907
- readonly onTokenize: "_AreNode_onTokenize";
855
+ evaluate(expr: string, store: AreStore$1, scope?: Record<string, any>): any;
908
856
  /**
909
- * Feature that is called to transform the element node template, markup, styles, and data into a format that can be used for compilation. This feature is responsible for processing the raw template and extracting the necessary information to create the render plan and instructions for the node.
857
+ * Extracts $-prefixed handler names from an expression.
858
+ * These represent event emission targets, not store references.
859
+ *
860
+ * Examples:
861
+ * "$handleClick" → Set(["handleClick"])
862
+ * "$handleClick(user.name)" → Set(["handleClick"])
863
+ * "(e) => isValid(user.name) ? $handleClick(e) : null" → Set(["handleClick"])
910
864
  */
911
- readonly onTransform: "_AreNode_onTransform";
865
+ extractEmitHandlers(expr: string): Set<string>;
866
+ private isCallableExpression;
867
+ private validate;
868
+ private checkDepth;
869
+ private createSandbox;
870
+ private nestedHandler;
871
+ private assertSafeKey;
872
+ private execute;
873
+ }
874
+
875
+ declare class AreSyntaxError extends A_Error {
876
+ static readonly SyntaxParseError = "Are Syntax Parse Error";
877
+ static readonly SyntaxNotSupportedError = "Are Syntax Not Supported Error";
878
+ static readonly MethodNotImplementedError = "Are Syntax Method Not Implemented Error";
879
+ }
880
+
881
+ declare class AreTokenizer extends A_Component {
912
882
  /**
913
- * Event fired when the element node is interpreted
883
+ * Get the AreSyntax from the current scope. The AreSyntax defines the syntax rules and structures for tokenizing templates. It provides mechanisms for parsing and interpreting templates, attributes, directives, interpolations, and event listeners, enabling dynamic and interactive UI rendering within the ARE framework. If no AreSyntax is found in the scope, an error is thrown indicating that AreTokenizer requires an AreSyntax to function properly.
914
884
  */
915
- readonly onInterpret: "_AreNode_onInterpret";
885
+ protected get config(): AreSyntax$1;
916
886
  /**
917
- * Feature that is called to compile the element node
887
+ * Instantiate AreNodes based on the token matches obtained from scanning the source template. This method takes the raw source string from the context, scans it for tokens using the defined syntax rules, and creates corresponding AreNode instances for each matched token. The resulting array of AreNodes represents the structured representation of the template, which can then be used for further processing, such as rendering or applying scene instructions.
888
+ *
889
+ *
890
+ * @param context
891
+ * @returns
918
892
  */
919
- readonly onCompile: "_AreNode_onCompile";
893
+ instantiate<T extends AreNode$1>(context: AreContext$1): void;
894
+ tokenize(node: AreNode$1, context: AreContext$1, logger?: A_Logger): void;
895
+ protected scan(source: string, from: number, to: number, context: AreContext$1): AreSyntaxTokenMatch$1[];
896
+ protected findNextMatch(source: string, from: number, to: number): AreSyntaxTokenMatch$1 | null;
897
+ protected matchRule(source: string, rule: AreSyntaxTokenRules$1, from: number, to: number): AreSyntaxTokenMatch$1 | null;
898
+ protected matchStandardRule(source: string, rule: AreSyntaxTokenRules$1, from: number, to: number): AreSyntaxTokenMatch$1 | null;
899
+ protected matchPrefixedRule(source: string, rule: AreSyntaxTokenRules$1, from: number, to: number): AreSyntaxTokenMatch$1 | null;
900
+ protected findMatchingClose(source: string, opening: string, closing: string, from: number, to: number): number;
901
+ protected buildMatch(rule: AreSyntaxTokenRules$1, raw: string, content: string, position: number, closingUsed: string): AreSyntaxTokenMatch$1;
902
+ protected tryPlainText(raw: string, position: number): AreSyntaxTokenMatch$1 | null;
903
+ protected findRuleForMatch(match: AreSyntaxTokenMatch$1): AreSyntaxTokenRules$1 | undefined;
904
+ }
905
+
906
+ declare class AreTokenizerError extends A_Error {
907
+ }
908
+
909
+ declare class AreCompiler extends A_Component {
920
910
  /**
921
- * Feature that is called to handle events
911
+ * Defines a custom method for compiling a node into a set of SceneInstructions. This method is called during the compilation phase of the ARE component and should perform any necessary transformations on the node and its attributes to generate the appropriate instructions for rendering. This can include tasks such as processing directives, evaluating expressions, and generating instructions for dynamic content based on the node's properties and context.
912
+ *
913
+ * @param node
922
914
  */
923
- readonly onEmit: "_AreNode_onEmit";
924
- };
925
- declare const AreNodeStatuses: {
915
+ static Compile<T extends AreNode$1>(node: A_TYPES__Entity_Constructor<T>): any;
926
916
  /**
927
- * Status indicating that the node is pending compilation. When a node is in the pending status, it means that it has been created but has not yet been compiled. During this phase, the node is typically being prepared for compilation, which may involve setting up its template, markup, styles, and any associated data or context. Once the node is ready for compilation, its status will change to "compiling".
917
+ * Defines a custom method for compiling an attribute into a set of SceneInstructions. This method is called during the compilation phase of the ARE component and should perform any necessary transformations on the attribute to generate the appropriate instructions for rendering. This can include tasks such as processing directives, evaluating expressions, and generating instructions for dynamic content based on the attribute's properties and context.
918
+ *
919
+ * @param attribute
928
920
  */
929
- readonly Pending: "pending";
921
+ static Compile<T extends AreAttribute$1>(attribute: A_TYPES__Entity_Constructor<T>): any;
922
+ compile(node: AreNode$1, scene: AreScene$1, logger?: A_Logger, ...args: any[]): void;
923
+ }
924
+
925
+ declare class AreCompilerError extends A_Error {
926
+ static readonly RenderError = "Are Compiler Render Error";
927
+ static readonly CompilationError = "Are Compiler Compilation Error";
928
+ }
929
+
930
+ declare class AreTransformer extends A_Component {
931
+ transform(node: AreNode$1, scope: A_Scope, scene: AreScene$1, ...args: any[]): void;
932
+ }
933
+
934
+ declare class AreInterpreter extends A_Component {
930
935
  /**
931
- * Status indicating that the node is in the process of being compiled. During this status, the node is being analyzed and transformed based on its template, markup, and styles to generate the necessary instructions for rendering and updating the node in the scene.
936
+ * Decorator to mark a method as an instruction Apply handler for the specific instruction type. The method will be called during the render phase of the ARE component when the corresponding instruction needs to be applied. The method should contain logic to perform the necessary operations on the rendering target based on the instruction's content and context.
937
+ *
938
+ * @param action
939
+ * @returns
932
940
  */
933
- readonly Compiling: "compiling";
941
+ static Apply(action: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => any;
934
942
  /**
935
- * Status indicating that the node has been compiled and is ready to be rendered. In this status, the node has generated all the necessary instructions and is prepared to be mounted in the scene.
943
+ * Decorator to mark a method as an instruction Update handler for the specific instruction type. The method will be called during the render phase of the ARE component when the corresponding instruction has been updated. The method should contain logic to perform the necessary operations on the rendering target to update the effects of the instruction based on its new content and context.
944
+ *
945
+ * @param action
946
+ * @returns
936
947
  */
937
- readonly Compiled: "compiled";
948
+ static Update(action: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => any;
938
949
  /**
939
- * Status indicating that the node is currently mounted in the scene. When a node is mounted, it means that it has been rendered and is actively part of the scene's structure and content.
950
+ * Decorator to mark a method as an instruction Revert handler for the specific instruction type. The method will be called during the render phase of the ARE component when the corresponding instruction needs to be reverted. The method should contain logic to perform the necessary operations on the rendering target to undo the effects of the instruction based on its content and context.
951
+ *
952
+ * @param action
953
+ * @returns
940
954
  */
941
- readonly Mounted: "mounted";
955
+ static Revert(action: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => any;
942
956
  /**
943
- * Status indicating that the node has been unmounted from the scene. When a node is unmounted, it means that it has been removed from the scene's structure and content, and is no longer actively rendered in the scene.
957
+ * The method responsible for executing the render operation based on the current state of the Scene. It processes the instructions that need to be applied and reverted, ensuring that the rendering target is updated accordingly. The method handles any errors that may occur during the application or reversion of instructions, maintaining the integrity of the rendering process.
958
+ *
959
+ * @param scene
944
960
  */
945
- readonly Unmounted: "unmounted";
961
+ interpret(scene: AreScene$1): void;
962
+ protected applyInstruction(instruction: AreInstruction$1, interpreter: AreInterpreter, store: AreStore$1, scope: A_Scope, feature: A_Feature, ...args: any[]): void;
963
+ protected updateInstruction(instruction: AreInstruction$1, interpreter: AreInterpreter, store: AreStore$1, scope: A_Scope, feature: A_Feature, ...args: any[]): void;
964
+ protected revertInstruction(instruction: AreInstruction$1, interpreter: AreInterpreter, store: AreStore$1, scope: A_Scope, feature: A_Feature, ...args: any[]): void;
965
+ }
966
+
967
+ declare class AreInterpreterError extends A_Error {
968
+ }
969
+
970
+ declare const AreStoreAreComponentMetaKeys: {
971
+ readonly StoreExtensions: "_AreStore_StoreExtensions";
946
972
  };
947
973
 
948
- type AreNodeNewProps = AreSyntaxTokenMatch;
949
- type AreNodeFeatureNames = typeof AreNodeFeatures[keyof typeof AreNodeFeatures];
950
- type AreNodeStatusNames = typeof AreNodeStatuses[keyof typeof AreNodeStatuses];
974
+ type AreStorePathValue<T, P extends string> = P extends `${infer K}.${infer Rest}` ? K extends keyof T ? AreStorePathValue<T[K], Rest> : never : P extends keyof T ? T[P] : never;
975
+ type AreStoreWatchingEntity = {
976
+ update(...args: any[]): void;
977
+ };
978
+ type AreStoreAreComponentMetaKeyNames = typeof AreStoreAreComponentMetaKeys[keyof typeof AreStoreAreComponentMetaKeys];
951
979
 
952
- declare class AreNode extends A_Entity<AreNodeNewProps> {
953
- /**
954
- * The current status of the node, which can be used to track the lifecycle and rendering state of the node within the scene.
955
- */
956
- status: AreNodeStatusNames;
957
- /**
958
- * The opening string that defines the start of a node in the source. This is typically used for parsing and tokenizing the source to identify the structure and content of the node. The opening string can include the tag name, attributes, and other syntax that indicates the beginning of a node.
959
- */
960
- protected _opening: string;
961
- /**
962
- * The closing string that defines the end of a node in the source. This is typically used for parsing and tokenizing the source to identify the structure and content of the node. The closing string can include the tag name, attributes, and other syntax that indicates the end of a node.
963
- */
964
- protected _closing: string;
965
- /**
966
- * The position of the node in the source string, which can be used for error reporting, debugging, and other purposes related to tracking the location of the node within the original source. The position is a character index identifying where the node is defined.
967
- */
968
- protected _position: number;
969
- /**
970
- * The payload associated with the node, which can include any additional data or metadata that is extracted during the tokenization process. The payload can be used to store custom information related to the node, such as directive arguments, binding expressions, or any other relevant data that may be needed for processing and rendering the node within the scene.
971
- */
972
- protected _payload?: AreSyntaxTokenPayload;
973
- /**
974
- * Content string defined for the node — the inner content between delimiters.
975
- * Example: `{{name}}`
976
- */
977
- protected _content: string;
978
- /**
979
- * Markup string defined for the node
980
- * Example: `<custom-component :prop="value"> <div>Inner Content</div> </custom-component>`
981
- */
982
- protected _markup: string;
983
- /**
984
- * The scope associated with this node
985
- * uses to store all nested fragments and entities like other AreNodes and Scene
986
- */
987
- protected _scope: A_Scope;
980
+ declare class AreStore<T extends Record<string, any> = Record<string, any>> extends A_ExecutionContext<T> {
981
+ protected dependencies: Map<string, Set<AreStoreWatchingEntity>>;
982
+ protected _keys: Set<keyof T>;
988
983
  /**
989
- * Actual node identifier.
984
+ * Allows to define a pure function that will be executed in the context of the store, so it can access the store's data and methods, but it won't have access to the component's scope or other features. This can be useful for example for defining a function that will update the store's data based on some logic, without having access to the component's scope or other features, so we can keep the store's logic separate from the component's logic.
990
985
  */
991
- get id(): string;
986
+ static get Function(): <T extends Are$1>(target: T, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
987
+ get owner(): AreNode$1;
988
+ get parent(): AreStore | undefined;
989
+ get context(): AreContext$1;
990
+ constructor(aseid: ASEID | string);
991
+ get watchers(): Set<AreStoreWatchingEntity>;
992
+ get keys(): Set<keyof T>;
993
+ watch(instruction: AreStoreWatchingEntity): void;
994
+ unwatch(instruction: AreStoreWatchingEntity): void;
995
+ set<K extends keyof T>(values: Partial<T>): this;
996
+ set<P extends A_TYPES__Paths<T>>(key: P, value: AreStorePathValue<T, P>): this;
997
+ get<K extends keyof T>(key: K): T[K] | undefined;
998
+ protected setAsObject(values: Partial<T>): this;
999
+ protected setAsKeyValue<K extends keyof T, P extends A_TYPES__Paths<T>>(key: K | P, value: T[K] | AreStorePathValue<T, P>): this;
992
1000
  /**
993
- * Actual node type.
994
- * By default it's a tag name
1001
+ * Notifies instructions — immediately or deferred if inside a batch.
995
1002
  */
996
- get type(): string;
1003
+ private notify;
997
1004
  /**
998
- * Content string defined for the node — the inner content between delimiters.
999
- * Example: `{{name}}`
1005
+ * Removes an instruction from all dependency sets.
1006
+ * Called when an instruction is reverted/destroyed.
1000
1007
  */
1001
- get content(): string;
1008
+ unregister(instruction: AreStoreWatchingEntity): void;
1002
1009
  /**
1003
- * Markup string defined for the node
1004
- * Example: `<custom-component :prop="value"> <div>Inner Content</div> </custom-component>`
1010
+ * Normalizes a path once reused in both get and set.
1005
1011
  */
1006
- get markup(): string;
1012
+ private normalizePath;
1007
1013
  /**
1008
- * The scope associated with this node
1009
- * uses to store all nested fragments and entities like other AreNodes and Scene
1014
+ * Extracts direct children of the current markup level into typed instances.
1015
+ * No tree walking, recursion, or nested parsing just direct children.
1010
1016
  */
1011
- get scope(): A_Scope;
1017
+ extractPathSegments(path: string): string[];
1012
1018
  /**
1013
- * The attributes defined for the node, which can include static attributes, binding attributes, directive attributes, and event attributes. These attributes are extracted during tokenization and processed during the compilation phase to generate the corresponding SceneInstructions for rendering and updating the node in the scene.
1019
+ * Method allows to initialize all extensions defined in the component with @AreStore.Function decorator, so we can use them in the store's context. This method should be called in the component's constructor after super() call, so the store will have access to the component's instance and its properties.
1020
+ *
1021
+ * @param component
1014
1022
  */
1015
- get attributes(): AreAttribute[];
1023
+ loadExtensions(component: Are$1): void;
1024
+ }
1025
+
1026
+ declare class AreEvent<T extends Record<string, any> = Record<string, any>> extends A_ExecutionContext<T> {
1027
+ }
1028
+
1029
+ /**
1030
+ * Properties for the AreEvent context
1031
+ *
1032
+ */
1033
+ type AreEventProps<T = any> = {
1016
1034
  /**
1017
- * A custom component associated with this node, which can be used to provide custom logic and behavior for the node. This component is typically defined in the context and can be resolved based on the node's type or other identifying information. The component can include its own content, markup, styles, and features that are specific to the functionality it provides.
1018
- *
1019
- * Example: If the node type is "custom-component", the corresponding component would be resolved from the context and can be used to provide custom rendering and behavior for nodes of that type.
1020
- *
1021
- * [!] Note: The component is optional and may not be defined for all nodes. If no component is associated with the node, it will be treated as a standard HTML element or a basic node without custom logic.
1035
+ * The data associated with the event
1022
1036
  */
1023
- get component(): Are | undefined;
1037
+ data: T;
1024
1038
  /**
1025
- * The parent node of this node, which is the node that registered the current node in its scope. This is typically the node that is responsible for rendering the current node and managing its lifecycle within the scene. The parent node can be used to access shared context, propagate events, and manage interactions between nodes in a hierarchical structure.
1026
- *
1027
- * Example: For a node defined as `<div><span>Child Node</span></div>`, the parent node of the `<span>` element would be the `<div>` element, which is responsible for rendering the `<span>` and managing its lifecycle within the scene.
1039
+ * The name of the event
1028
1040
  */
1029
- get parent(): AreNode | undefined;
1041
+ event: string;
1042
+ };
1043
+
1044
+ declare const AreSceneStatuses: {
1045
+ Active: string;
1046
+ Inactive: string;
1047
+ Destroyed: string;
1048
+ };
1049
+
1050
+ type AreSceneChanges = {
1030
1051
  /**
1031
- * The child nodes of this node, which are typically defined in the markup and registered in the scope as child entities. These child nodes can represent nested elements or components within the node and can have their own content, markup, styles, and features. The child nodes are managed within the scope of the parent node and can be accessed and manipulated as needed for rendering, updating, and lifecycle management.
1032
- *
1033
- * Example: For a node defined as `<div><span>Child Node</span></div>`, the child node would be the `<span>` element, which is registered as a child entity in the scope of the parent `<div>` node.
1052
+ * An array of instructions that are planned to be applied to the scene. These instructions represent the changes that will be made to the scene when they
1034
1053
  */
1035
- get children(): (AreNode)[];
1054
+ toApply: AreInstruction$1[];
1036
1055
  /**
1037
- * It returns the scene where the node exists, so it should be the scene of the rootNode,
1038
- * primary parent of this node.
1056
+ * An array of instructions that are planned to be reverted from the scene. These instructions represent the changes that will be undone from the scene when they are reverted, allowing for a rollback of changes if needed.
1039
1057
  */
1040
- get scene(): AreScene;
1041
- protected _scene: AreScene;
1042
- fromNew(newEntity: AreNodeNewProps): void;
1043
- fromASEID(aseid: string | ASEID): void;
1058
+ toRevert: AreInstruction$1[];
1059
+ };
1060
+ type AreScene_Serialized = {
1061
+ instructions: AreInstructionSerialized$1[];
1062
+ } & A_TYPES__Fragment_Serialized;
1063
+ type AreSceneStatusNames = typeof AreSceneStatuses[keyof typeof AreSceneStatuses];
1064
+
1065
+ declare class AreScene extends A_Fragment {
1066
+ protected _groupToInstructionsMap: Map<string, Set<AreInstruction$1>>;
1044
1067
  /**
1045
- * Sets the content string for the node the inner text/markup between the node's
1046
- * opening and closing delimiters. Content is processed by the rendering engine to
1047
- * generate the corresponding SceneInstructions for rendering the node.
1068
+ * Plan is a queue of changes that should be applied to render the node
1048
1069
  *
1049
- * @param content
1070
+ * It works as FIFO, so the first instruction that should be applied is the first one in the queue, and so on.
1050
1071
  */
1051
- setContent(content: string): void;
1072
+ protected _plan: Array<AreInstruction$1>;
1052
1073
  /**
1053
- * Sets the markup string for the node, which is the full raw matched string including delimiters. The markup can include HTML-like syntax, custom components, directives, and other features that are processed by the rendering engine to generate the corresponding SceneInstructions for rendering the node.
1074
+ * State is a list of instructions that are currently applied to the node,
1075
+ * so it represents the current state of the node in the scene.
1054
1076
  *
1055
- * @param markup
1077
+ * It always in a reverse order of the plan, so the last instruction in the state is the first one that should be reverted when we need to revert the changes, and so on.
1078
+ *
1079
+ * For example, if we have a node with two instructions in the plan: [Instruction A, Instruction B], and both of them are applied to the node, then the state will be [Instruction B, Instruction A], so when we need to revert the changes, we will revert Instruction B first, and then Instruction A.
1056
1080
  */
1057
- setMarkup(markup: string): void;
1081
+ protected _state: Array<AreInstruction$1>;
1082
+ protected _host: AreDeclaration$1 | undefined;
1058
1083
  /**
1059
- * Adds a child node to the current node's scope and ensures the child inherits from this node's scope.
1060
- *
1061
- * @param child - The node to add as a child
1084
+ * Scene status is used to determine the current lifecycle stage of the scene, which can be 'active', 'inactive' or 'destroyed'. This status can be used to control the behavior of the scene and its instructions, for example, we can prevent applying new instructions to an inactive or destroyed scene, or we can trigger certain actions when the scene becomes active or inactive. The default status of the scene is 'inactive', which means that the scene is not yet rendered and its instructions are not applied, and it will become 'active' when it is mounted and its instructions are applied, and it will become 'destroyed' when it is unmounted and its instructions are reverted.
1062
1085
  */
1063
- addChild(child: AreNode): void;
1086
+ protected _status: AreSceneStatusNames;
1087
+ constructor(
1064
1088
  /**
1065
- * Removes a child node from the current node's scope. This is typically used when a child node is no longer needed or should be detached from the parent node. The method ensures that the child node is properly deregistered from the scope and any associated resources are cleaned up as necessary.
1066
- *
1067
- * @param node - The child node to be removed from the current node's scope
1089
+ * Scene identity will be used to identify mounting point in the parent scene
1068
1090
  */
1069
- removeChild(node: AreNode): void;
1091
+ id: string | ASEID);
1070
1092
  /**
1071
- * Executes initialization logic for the node, which typically involves setting up the node's scope, registering any necessary entities, and preparing the node for rendering and interaction within the scene. This method is called during the initial phase of the node's lifecycle and is responsible for ensuring that the node is properly initialized before it is compiled and rendered in the scene.
1093
+ * Scene ID that corresponds to the root node's ID (part of ASEID)
1072
1094
  */
1073
- init(): void;
1095
+ get id(): string;
1074
1096
  /**
1075
- * Loads the node, which typically involves executing any necessary setup or initialization logic to prepare the node for rendering and interaction within the scene. This may include processing the node's content, markup, styles, and features to generate the corresponding SceneInstructions, as well as setting up any event listeners or reactive properties as needed.
1097
+ * The scope where scene is registered. This scope is owned by AreNode
1076
1098
  */
1077
- load(): Promise<any>;
1099
+ get scope(): A_Scope;
1078
1100
  /**
1079
- * Tokenizes the node content, which typically involves parsing the raw content string to identify the structure, child nodes, attributes, directives, and other features. This process is essential for breaking down the content into its constituent parts and preparing it for further processing during the compilation phase. The tokenization process can involve creating child nodes, extracting attributes and their values, and identifying any directives or bindings that need to be processed during rendering.
1101
+ * The owner node of the scene, which is the node that registered the scene in its scope.
1102
+ * This is typically the node that is responsible for rendering the scene and managing its lifecycle.
1080
1103
  */
1081
- tokenize(): void;
1104
+ get owner(): AreNode$1;
1082
1105
  /**
1083
- * Transforms the node, which typically involves executing any necessary logic to reshape the node's structure or content before it is compiled and rendered in the scene. This may include applying any transformations defined by directives, processing any dynamic content or expressions, and performing any other necessary tasks to ensure that the node is properly prepared for compilation and rendering based on its content, markup, styles, and features.
1106
+ * It's a primary declaration instruction that represents the node in the scene, so it should be registered as a host instruction for the scene, and it will be used to keep track of the node in the scene and to manage its lifecycle.
1084
1107
  */
1085
- transform(): void;
1108
+ get host(): AreDeclaration$1 | undefined;
1086
1109
  /**
1087
- * Compile the node. This method should transform the node's content, markup, and styles into a set of SceneInstructions that can be executed to render the node in the scene. The compile method is responsible for processing the node's features, attributes, directives, and other properties to generate the necessary instructions for rendering and updating the node in response to changes in state or context.
1088
- *
1089
- * [!] Note: The compile method should ensure that the node's scope is properly inherited from the context scope before processing, and it should handle any errors that may occur during compilation to ensure that the node can be rendered correctly in the scene.
1110
+ * Scene status is used to determine the current lifecycle stage of the scene, which can be 'active', 'inactive' or 'destroyed'. This status can be used to control the behavior of the scene and its instructions, for example, we can prevent applying new instructions to an inactive or destroyed scene, or we can trigger certain actions when the scene becomes active or inactive. The default status of the scene is 'inactive', which means that the scene is not yet rendered and its instructions are not applied, and it will become 'active' when it is mounted and its instructions are applied, and it will become 'destroyed' when it is unmounted and its instructions are reverted.
1090
1111
  */
1091
- compile(): void;
1112
+ get status(): AreSceneStatusNames;
1113
+ get isActive(): boolean;
1114
+ get isInactive(): boolean;
1092
1115
  /**
1093
- * Mounts the node, which typically involves executing any necessary logic to render the node in the scene and to set up any interactions or behaviors associated with the node. This may include applying the generated SceneInstructions from the compile phase, attaching event listeners, and performing any other necessary tasks to ensure that the node is properly rendered and functional within the scene.
1094
- *
1095
- * [!] Note: The mount method should ensure that the node's scope is properly inherited from the context scope before performing any mounting logic, and it should handle any errors that may occur during mounting to ensure that the node can be rendered correctly in the scene.
1116
+ * Returns All declaration instructions are registered in the scene scope. Since declaration instructions are the main instructions that represent the structure of the node, we have a separate getter for them to easily access and manage them in the scene.
1096
1117
  */
1097
- mount(): void;
1118
+ get declarations(): AreDeclaration$1[];
1098
1119
  /**
1099
- * Interprets the node, which typically involves executing any necessary logic to process the node's features, attributes, directives, and other properties to generate the corresponding SceneInstructions for rendering and updating the node in response to changes in state or context. This method is responsible for ensuring that the node is properly interpreted based on its content, markup, styles, and features to enable dynamic behavior and responsiveness within the scene.
1100
- *
1101
- * [!] Note: The interpret method should NOT go though own child, since it may be used by both mount and update operations!
1120
+ * Returns All mutation instructions are registered in the scene scope. Mutation instructions are the instructions that represent the changes to be applied to the node, so we have a separate getter for them to easily access and manage them in the scene, especially when we want to apply or revert changes based on the mutations.
1102
1121
  */
1103
- interpret(): void;
1122
+ get mutations(): AreMutation$1[];
1104
1123
  /**
1105
- * Updates the node, which typically involves executing any necessary logic to update the node's rendering and behavior in response to changes in state, context, or other factors. This may include reapplying SceneInstructions, updating event listeners, and performing any other necessary tasks to ensure that the node remains functional and correctly rendered within the scene as changes occur.
1106
- *
1107
- * [!] Note: The update method should ensure that the node's scope is properly inherited from the context scope before performing any update logic, and it should handle any errors that may occur during updating to ensure that the node can be updated correctly in the scene.
1124
+ * Returns All instructions are registered in the scene scope.
1108
1125
  */
1109
- update(): void;
1126
+ get instructions(): AreInstruction$1[];
1110
1127
  /**
1111
- * Unmounts the node, which typically involves executing any necessary logic to remove the node from the scene and to clean up any resources associated with the node. This may include reverting any applied SceneInstructions, detaching event listeners, and performing any other necessary tasks to ensure that the node is properly removed from the scene and that resources are released as needed.
1128
+ * Plan is a queue of changes that should be applied to render the node
1112
1129
  *
1113
- * [!] Note: The unmount method should ensure that the node's scope is properly inherited from the context scope before performing any unmounting logic, and it should handle any errors that may occur during unmounting to ensure that the node can be removed correctly from the scene.
1130
+ * It works as FIFO, so the first instruction that should be applied is the first one in the queue, and so on.
1114
1131
  */
1115
- unmount(): void;
1116
- cloneWithScope<T extends AreNode = AreNode>(this: T): T;
1117
- reset(): void;
1118
- clone<T extends AreNode = AreNode>(this: T): T;
1132
+ get planned(): AreInstruction$1[];
1119
1133
  /**
1120
- * Emits an event or a scope to the node, which can be used to trigger event handlers or to provide additional context for processing within the node. The method can accept either an AreEvent instance or an A_Scope instance, and it will handle the emission accordingly. This allows for flexible communication and interaction within the node's context, enabling dynamic behavior and responsiveness based on events or changes in scope.
1134
+ * State is a list of instructions that are currently applied to the node,
1135
+ * so it represents the current state of the node in the scene.
1121
1136
  *
1122
- * @param scope - The scope or event to be emitted to the node
1137
+ * It always in a reverse order of the plan, so the last instruction in the state is the first one that should be reverted when we need to revert the changes, and so on.
1138
+ *
1139
+ * For example, if we have a node with two instructions in the plan: [Instruction A, Instruction B], and both of them are applied to the node, then the state will be [Instruction B, Instruction A], so when we need to revert the changes, we will revert Instruction B first, and then Instruction A.
1123
1140
  */
1124
- emit(scope: A_Scope): any;
1125
- emit(event: AreEvent): any;
1141
+ get applied(): AreInstruction$1[];
1126
1142
  /**
1127
- * Destroys the node, which typically involves executing any necessary cleanup logic to remove the node from the scene and to free up any resources associated with the node. This may include deregistering the node from its scope, removing any event listeners or reactive properties, and performing any other necessary cleanup tasks to ensure that the node is properly removed from the scene and that resources are released as needed.
1143
+ * Should return instructions to be reverted and to be applied.
1144
+ * A difference between plan vs state is that plan is what should be applied to the scene,
1145
+ * while state is what currently applied to the scene.
1128
1146
  *
1129
- * [!] Note: The destroy method should ensure that the node's scope is properly inherited from the context scope before performing any cleanup, and it should handle any errors that may occur during destruction to ensure that resources are released correctly.
1130
1147
  */
1131
- destroy(): Promise<any>;
1148
+ get changes(): AreSceneChanges;
1149
+ activate(): void;
1150
+ deactivate(): void;
1132
1151
  /**
1133
- * Method to ensure that the current scope is inherited from the context scope
1152
+ * Each scene has a primary declaration instruction that represents the node in the scene, so it should be registered as a host instruction for the scene, and it will be used to keep track of the node in the scene and to manage its lifecycle. This method allows to set the host instruction for the scene, but it will throw an error if we try to set another host instruction while there is already a host instruction set, so we can ensure that there is only one host instruction for the scene at any given time.
1134
1153
  *
1135
- * @throws A_Error if the scope is not inherited from the context scope
1154
+ * @param instruction
1136
1155
  */
1137
- protected checkScopeInheritance(): void;
1138
- }
1139
-
1140
- declare class AreContext extends A_ExecutionContext {
1156
+ setHost(instruction: AreDeclaration$1): void;
1141
1157
  /**
1142
- * The source string represents the original template or input from which the ARE scene is generated. This can be used for debugging, error reporting, or any features that require access to the raw template data. The roots array holds references to the root nodes of the ARE scene, allowing for easy access and management of the top-level components in the rendering hierarchy. The signalsMap is a mapping between root nodes and their associated signal vectors, enabling efficient management of reactive updates and interactions within the ARE framework based on changes in the application state or user input.
1158
+ * Unsets the current host instruction from the scene.
1159
+ *
1160
+ * This method should be used when we want to remove the primary declaration instruction that represents the node in the scene, for example, when we want to unmount the node or when we want to replace it with another node. Unsetting the host instruction will allow us to set a new host instruction for the scene if needed.
1143
1161
  */
1144
- protected _source: string;
1162
+ removeHost(): void;
1145
1163
  /**
1146
- * The roots array holds references to the root nodes of the ARE scene, allowing for easy access and management of the top-level components in the rendering hierarchy. The signalsMap is a mapping between root nodes and their associated signal vectors, enabling efficient management of reactive updates and interactions within the ARE framework based on changes in the application state or user input.
1164
+ * Method that should register the instruction in the plan, so it will be rendered in the next render cycle.
1165
+ *
1166
+ * @param instruction
1147
1167
  */
1148
- protected _roots: Array<AreNode>;
1168
+ plan(instruction: AreInstruction$1): void;
1169
+ planBefore(instruction: AreInstruction$1, beforeInstruction: AreInstruction$1): void;
1170
+ planAfter(instruction: AreInstruction$1, afterInstruction: AreInstruction$1): void;
1171
+ moveBefore(instruction: AreInstruction$1, beforeInstruction: AreInstruction$1): void;
1172
+ moveAfter(instruction: AreInstruction$1, afterInstruction: AreInstruction$1): void;
1149
1173
  /**
1150
- * This property stores a map between root node and conditions that should be met to render particular component inside the root node. This can be used to manage complex rendering logic and to optimize performance by ensuring that components are only rendered when necessary based on the defined conditions.
1174
+ * Allows to remove instruction from the plan, so it will not be rendered anymore, but it will still be registered in the scene scope, so it can be planned again if needed.
1175
+ *
1176
+ * @param instruction
1151
1177
  */
1152
- protected _signalsMap: Map<string, A_SignalVector>;
1153
- protected _performance: Map<string, number>;
1154
- protected _performanceStart: Map<string, number>;
1155
- protected _performanceDepth: Map<string, number>;
1178
+ unPlan(instruction: AreInstruction$1): void;
1156
1179
  /**
1157
- * The global object can be used to store any global data or configurations that need to be accessed across different components and entities within the ARE framework. This can include things like theme settings, user preferences, or any other shared data that is relevant to the entire scene or application. By centralizing this information in the context, it allows for easier management and access to global state without needing to pass it through multiple layers of components or entities.
1180
+ * Checks if the instruction is already in the plan, so it will be rendered in the next render cycle.
1181
+ *
1182
+ * @param instruction
1183
+ * @returns
1158
1184
  */
1159
- get globals(): any;
1160
- constructor(
1185
+ getPlanned(instruction: AreInstruction$1): AreInstruction$1 | undefined;
1161
1186
  /**
1162
- * The source string represents the original template or input from which the ARE scene is generated. This can be used for debugging, error reporting, or any features that require access to the raw template data. The roots array holds references to the root nodes of the ARE scene, allowing for easy access and management of the top-level components in the rendering hierarchy. The signalsMap is a mapping between root nodes and their associated signal vectors, enabling efficient management of reactive updates and interactions within the ARE framework based on changes in the application state or user input.
1187
+ * Checks if the instruction is already in the plan, so it will be rendered in the next render cycle.
1188
+ *
1189
+ * @param instruction
1190
+ * @returns
1163
1191
  */
1164
- source?: string);
1192
+ isInPlan(instruction: AreInstruction$1): boolean;
1165
1193
  /**
1166
- * The scope of the context, which can be used to access other entities and features within the same scope. This is particularly useful for components that need to interact with other parts of the scene or component, as it allows them to access shared data and functionality without needing to pass it explicitly through parameters.
1194
+ * Method moves the instruction to state to keep it applied and to be able to revert it later if needed. The instruction should be already registered in the scene scope and planned to be applied, otherwise it will not be applied.
1195
+ *
1196
+ * @param instruction
1167
1197
  */
1168
- get scope(): _adaas_a_concept.A_Scope<any, _adaas_a_concept.A_TYPES__Component_Constructor<_adaas_a_concept.A_Component>[], _adaas_a_concept.A_TYPES__Error_Constructor<_adaas_a_concept.A_Error<_adaas_a_concept.A_TYPES__Error_Init, _adaas_a_concept.A_TYPES__Error_Serialized>>[], _adaas_a_concept.A_TYPES__Entity_Constructor<_adaas_a_concept.A_Entity<any, _adaas_a_concept.A_TYPES__Entity_Serialized>>[], A_Fragment<_adaas_a_concept.A_TYPES__Fragment_Serialized>[]>;
1198
+ apply(instruction: AreInstruction$1): void;
1169
1199
  /**
1170
- * The roots array holds references to the root nodes of the ARE scene, allowing for easy access and management of the top-level components in the rendering hierarchy. The signalsMap is a mapping between root nodes and their associated signal vectors, enabling efficient management of reactive updates and interactions within the ARE framework based on changes in the application state or user input.
1200
+ * Method moves the instruction from state to unapply it and to be able to apply it later if needed. The instruction should be already registered in the scene scope and applied, otherwise it will not be unapplied.
1201
+ *
1202
+ * @param instruction
1171
1203
  */
1172
- get roots(): Array<AreNode>;
1204
+ unApply(instruction: AreInstruction$1): void;
1173
1205
  /**
1174
- * This property stores a map between root node and conditions that should be met to render particular component inside the root node. This can be used to manage complex rendering logic and to optimize performance by ensuring that components are only rendered when necessary based on the defined conditions.
1206
+ * Checks if the instruction is already in the state, so it is currently applied to the scene.
1207
+ *
1208
+ * @param instruction
1209
+ * @returns
1175
1210
  */
1176
- get source(): string;
1177
- get performance(): Array<string>;
1178
- get stats(): string[];
1179
- protected countInstructions(node: AreNode): number;
1180
- protected countNodes(node: AreNode): number;
1211
+ getApplied(instruction: AreInstruction$1): AreInstruction$1 | undefined;
1181
1212
  /**
1182
- * This property stores a map between root node and conditions that should be met to render particular component inside the root node. This can be used to manage complex rendering logic and to optimize performance by ensuring that components are only rendered when necessary based on the defined conditions.
1213
+ * Checks if the instruction is already in the state, so it is currently applied to the scene.
1183
1214
  *
1184
- * @param node
1215
+ * @param instruction
1216
+ * @returns
1185
1217
  */
1186
- addRoot(node: AreNode): void;
1218
+ isApplied(instruction: AreInstruction$1): boolean;
1187
1219
  /**
1188
- * This property stores a map between root node and conditions that should be met to render particular component inside the root node. This can be used to manage complex rendering logic and to optimize performance by ensuring that components are only rendered when necessary based on the defined conditions.
1220
+ * Method that should reset the scene to the initial state, so it will clear the plan and state, but it will not deregister the instructions from the scene scope, so they will still be registered in the scene and can be planned and applied again if needed.
1189
1221
  *
1190
- * @param node
1191
1222
  */
1192
- removeRoot(node: AreNode): void;
1193
- startPerformance(label?: string): void;
1194
- endPerformance(label: string): void;
1223
+ reset(): void;
1195
1224
  }
1196
1225
 
1197
- declare class AreSyntax extends A_Fragment {
1226
+ declare class AreSceneError extends A_Error {
1227
+ static readonly SceneAlreadyInactive = "AreSceneError.SceneAlreadyInactive";
1228
+ static readonly SceneAlreadyActive = "AreSceneError.SceneAlreadyActive";
1229
+ static readonly HostInstructionHasConnectedInstructions = "AreSceneError.HostInstructionHasConnectedInstructions";
1230
+ static readonly SingleHostInstruction = "AreSceneError.SingleHostInstruction";
1231
+ static readonly SceneError = "AreSceneError.SceneError";
1232
+ static readonly RootNotFound = "AreSceneError.RootNotFound";
1233
+ static readonly UpdateFailed = "AreSceneError.UpdateFailed";
1234
+ static readonly MountFailed = "AreSceneError.MountFailed";
1235
+ static readonly UnmountFailed = "AreSceneError.UnmountFailed";
1236
+ static readonly MountPointNotFound = "AreSceneError.MountPointNotFound";
1237
+ static readonly InvalidTemplate = "AreSceneError.InvalidTemplate";
1238
+ static readonly RenderFailed = "AreSceneError.RenderFailed";
1239
+ }
1240
+
1241
+ type AreInstructionNewProps<T extends any = Record<string, any>> = {
1198
1242
  /**
1199
- * Max allowed length of an expression string to prevent excessively long inputs that could lead to performance issues or abuse.
1243
+ * The deduplication ID that prevents duplicated instruction within the same node.
1244
+ *
1245
+ * For example to prevent duplicated AddAttribute instruction for the same attribute, we can use the attribute name as the deduplication ID, so if we have two AddAttribute instructions with the same attribute name, only the first one will be applied, and the second one will be ignored.
1246
+ *
1247
+ *
1248
+ * [!] Note; By default it uses action name and group if provided
1200
1249
  */
1201
- private readonly MAX_LENGTH;
1202
1250
  /**
1203
- * Max allowed nesting depth of parentheses, brackets, and braces in expressions to prevent excessively complex inputs that could lead to performance issues or abuse. Default is 5 levels of nesting.
1251
+ * the Host operation to be performed. Exactly this name will be used to call a method from the Host class.
1204
1252
  */
1205
- private readonly MAX_DEPTH;
1253
+ name: string;
1206
1254
  /**
1207
- * List of regex patterns that are blocked in expressions to prevent access to unsafe or sensitive features. This includes patterns for global objects, functions, and syntax that could be used for malicious purposes (e.g. "eval", "Function", "fetch", "XMLHttpRequest", "import", "require", "document", "window", "globalThis", "global", "process", "__proto__", "constructor", "prototype"). Expressions containing any of these patterns will be rejected during validation.
1255
+ * The parent instruction that created this instruction. For example, if we have a CreateElement instruction that creates a new element, and then we have an AddAttribute instruction that adds an attribute to that element, the AddAttribute instruction would have the CreateElement instruction as its parent. This can be used to track the hierarchy of instructions and their dependencies.
1208
1256
  */
1209
- private readonly BLOCKED_PATTERNS;
1257
+ parent?: AreInstruction | undefined;
1210
1258
  /**
1211
- * Set of global identifiers that are blocked in expressions to prevent access to unsafe or sensitive features. This includes global objects and functions that could be used for malicious purposes (e.g. "eval", "Function", "fetch", "XMLHttpRequest", "document", "window", "globalThis", "global", "process", "setTimeout", "setInterval", "localStorage", "sessionStorage", "indexedDB", "WebSocket", "Worker"). Accessing any of these identifiers in an expression will be rejected during validation.
1259
+ * Group is an optional property that can be used to group instructions together.
1260
+ *
1261
+ * For example a set of instructions that depend on create CreateElement instruction can be grouped together with the same group name, so if the CreateElement instruction is reverted, all the instructions in the same group will be reverted as well, and so on.
1262
+ *
1263
+ * This can be useful to manage complex changes that involve multiple instructions.
1264
+ *
1265
+ * [!] Note, the best option is to use ASEID of the Instruction as a group, so all instructions with the same ASEID will be treated as a single change, and will be applied and reverted together.
1212
1266
  */
1213
- private readonly BLOCKED_GLOBALS;
1267
+ group?: AreInstruction | undefined;
1214
1268
  /**
1215
- * Regex pattern that defines the allowed characters in expressions. This pattern allows letters, digits, whitespace, and common operators and punctuation used in JavaScript expressions. Expressions containing characters that do not match this pattern will be rejected during validation to prevent injection of potentially harmful code.
1269
+ * A set of additional parameters that may be needed for the rendering purpose.
1270
+ *
1271
+ * For example: for AddAttribute instruction, we may need to provide the attribute name and value as a payload, so the Host can use this information to add the attribute to the node.
1216
1272
  */
1217
- private readonly ALLOWED_CHARS;
1273
+ payload?: T;
1274
+ };
1275
+ type AreInstructionSerialized<T extends any = Record<string, any>> = {
1218
1276
  /**
1219
- * Simple dot-path identifier pattern (e.g. "name", "user.name", "user.profile.name").
1220
- * Matches strings that consist solely of identifier characters separated by dots.
1277
+ * The name of the instruction, which corresponds to the operation that should be performed in the Host. This name is used to identify the specific method in the Host that should be called to execute the instruction, allowing for a clear mapping between instructions and their corresponding actions in the rendering process.
1221
1278
  */
1222
- private readonly SIMPLE_PATH;
1279
+ name: string;
1223
1280
  /**
1224
- * Compiled expression a pre-parsed function ready for repeated execution.
1225
- * Created once via compile(), reused on every apply/click.
1281
+ * The type of the instruction, which can be used to categorize instructions and determine how they should be processed. For example, we can have different types for declaration instructions (e.g., DeclarationInstruction or CreateElement) and mutation instructions (e.g., AddAttribute), allowing for better organization and management of instructions based on their purpose and behavior in the scene.
1226
1282
  */
1227
- private readonly _rules;
1228
- private readonly _trimWhitespace;
1229
- private readonly _strictMode;
1230
- constructor(config?: Partial<AreSyntaxInitOptions>);
1283
+ type: string;
1231
1284
  /**
1232
- * Get the array of token rules that define the syntax for parsing templates. Each rule specifies how to identify and process a particular type of token (e.g. interpolation, directive, comment) within templates. The rules are checked in order of priority, allowing for flexible and customizable parsing behavior.
1285
+ * The parent instruction that created this instruction. For example, if we have a CreateElement instruction that creates a new element, and then we have an AddAttribute instruction that adds an attribute to that element, the AddAttribute instruction would have the CreateElement instruction as its parent. This can be used to track the hierarchy of instructions and their dependencies.
1233
1286
  */
1234
- get rules(): AreSyntaxTokenRules<AreNode>[];
1287
+ parent?: string | undefined;
1235
1288
  /**
1236
- * Indicates whether leading and trailing whitespace should be trimmed from token content. When enabled, any whitespace at the start or end of the content captured by a token will be removed before further processing. This can help prevent issues with unintended spaces affecting rendering or logic, especially in cases like interpolations or directives where extra whitespace may be common. Default is true.
1289
+ * Group is an optional property that can be used to group instructions together. For example a set of instructions that depend on create CreateElement instruction can be grouped together with the same group name, so if the CreateElement instruction is reverted, all the instructions in the same group will be reverted as well, and so on. This can be useful to manage complex changes that involve multiple instructions. The best option is to use ASEID of the Instruction as a group, so all instructions with the same ASEID will be treated as a single change, and will be applied and reverted together.
1237
1290
  */
1238
- get trimWhitespace(): boolean;
1291
+ group?: string | undefined;
1239
1292
  /**
1240
- * Indicates whether the parser should throw an error when it encounters unclosed tokens. When enabled, if the parser finds an opening delimiter without a corresponding closing delimiter (e.g. an unclosed interpolation or directive), it will throw an error instead of silently ignoring it. This can help catch syntax errors and ensure that templates are well-formed. Default is true.
1293
+ * A set of additional parameters that may be needed for the rendering purpose. For example: for AddAttribute instruction, we may need to provide the attribute name and value as a payload, so the Host can use this information to add the attribute to the node.
1241
1294
  */
1242
- get strictMode(): boolean;
1295
+ payload: T;
1296
+ } & A_TYPES__Entity_Serialized;
1297
+
1298
+ declare class AreInstruction<T extends Record<string, any> = Record<string, any>, S extends AreInstructionSerialized<T> = AreInstructionSerialized<T>> extends A_Entity<AreInstructionNewProps<T>, S> implements AreStoreWatchingEntity$1 {
1243
1299
  /**
1244
- * Compiles an expression string into a reusable executor.
1245
- * Performs validation and Function construction once.
1246
- * Use when the same expression will be evaluated multiple times
1247
- * e.g. event handlers, instructions that re-apply on store changes.
1248
- *
1249
- * @example
1250
- * // compile once at apply() time
1251
- * const compiled = AreCommonHelper.compile('(e) => !!pageTitle ? $testHandler(e, item) : null')
1252
- *
1253
- * // execute on every click — no re-parsing, no re-validation
1254
- * element.addEventListener('click', (e) => {
1255
- * const fn = compiled.execute(store, { $testHandler: handler, item })
1256
- * if (typeof fn === 'function') fn(e)
1257
- * })
1300
+ * The name of the instruction, for example "CreateElement", "AddAttribute", "RemoveNode", etc. This is used to identify the type of the instruction and how to process it. The name should be in PascalCase format, and should be unique across all instruction types. It is recommended to use a prefix that indicates the category of the instruction, for example "CreateElement" for instructions that create new elements, "UpdateAttribute" for instructions that update attributes, etc.
1258
1301
  */
1259
- compile(expr: string): AreSyntaxCompiledExpression;
1302
+ protected _name: string;
1303
+ /**
1304
+ * The payload of the instruction, which can contain any additional information that may be needed for the rendering purpose. For example, for CreateElement instruction, the payload can contain the tag name and parent information, so the Host can use this information to create the element in the correct place in the scene. The payload is optional and can be an empty object if no additional information is needed.
1305
+ */
1306
+ protected _payload?: T;
1260
1307
  /**
1261
- * Evaluates an expression string against the provided store.
1262
- * Automatically determines whether the result should be callable
1263
- * based on the shape of the expression.
1264
- *
1265
- * Returns the raw value for plain expressions (interpolations, bindings).
1266
- * Returns a bound function for callable expressions (event handlers).
1267
- *
1268
- * @param expr Expression string to evaluate.
1269
- * @param store AreStore used for identifier resolution.
1270
- * @param scope Optional extra bindings checked **before** the store.
1271
- * Useful for injecting event-specific values (`$event`, `element`)
1272
- * or emit wrappers (`$handleClick`).
1273
- *
1274
- * @example
1275
- * // simple value
1276
- * evaluate('user.name', store)
1277
- *
1278
- * // with emit wrapper
1279
- * evaluate('$handleClick($event, user.name)', store, {
1280
- * $event: domEvent,
1281
- * $handleClick: (...args) => node.emit(new AreEvent('handleClick', args)),
1282
- * })
1308
+ * Group is an optional property that can be used to group instructions together. For example a set of instructions that depend on create CreateElement instruction can be grouped together with the same group name, so if the CreateElement instruction is reverted, all the instructions in the same group will be reverted as well, and so on. This can be useful to manage complex changes that involve multiple instructions.
1283
1309
  *
1284
- * // arrow with conditional
1285
- * evaluate('(e) => isValid(user.name) ? $handleClick(e) : null', store, {
1286
- * $handleClick: (...args) => node.emit(new AreEvent('handleClick', args)),
1287
- * })
1310
+ * [!] Note, the best option is to use ASEID of the Instruction as a group, so all instructions with the same ASEID will be treated as a single change, and will be applied and reverted together.
1288
1311
  */
1289
- evaluate(expr: string, store: AreStore, scope?: Record<string, any>): any;
1312
+ protected _group: string | undefined;
1290
1313
  /**
1291
- * Extracts $-prefixed handler names from an expression.
1292
- * These represent event emission targets, not store references.
1293
- *
1294
- * Examples:
1295
- * "$handleClick" → Set(["handleClick"])
1296
- * "$handleClick(user.name)" → Set(["handleClick"])
1297
- * "(e) => isValid(user.name) ? $handleClick(e) : null" → Set(["handleClick"])
1314
+ * The parent instruction that created this instruction. For example, if we have a CreateElement instruction that creates a new element, and then we have an AddAttribute instruction that adds an attribute to that element, the AddAttribute instruction would have the CreateElement instruction as its parent. This can be used to track the hierarchy of instructions and their dependencies.
1298
1315
  */
1299
- extractEmitHandlers(expr: string): Set<string>;
1300
- private isCallableExpression;
1301
- private validate;
1302
- private checkDepth;
1303
- private createSandbox;
1304
- private nestedHandler;
1305
- private assertSafeKey;
1306
- private execute;
1307
- }
1308
-
1309
- declare class AreSyntaxError extends A_Error {
1310
- static readonly SyntaxParseError = "Are Syntax Parse Error";
1311
- static readonly SyntaxNotSupportedError = "Are Syntax Not Supported Error";
1312
- static readonly MethodNotImplementedError = "Are Syntax Method Not Implemented Error";
1313
- }
1314
-
1315
- declare class AreTokenizer extends A_Component {
1316
+ protected _parent: string | undefined;
1316
1317
  /**
1317
- * Get the AreSyntax from the current scope. The AreSyntax defines the syntax rules and structures for tokenizing templates. It provides mechanisms for parsing and interpreting templates, attributes, directives, interpolations, and event listeners, enabling dynamic and interactive UI rendering within the ARE framework. If no AreSyntax is found in the scope, an error is thrown indicating that AreTokenizer requires an AreSyntax to function properly.
1318
+ * A set of properties that influence the behavior of the instruction, for example, for AddTextInstruction, we can interpolation dependent on some key in the store, so we can have a property called "interpolationKey" that will be used to track the dependencies of the instruction, and when the value of this key changes in the scope, we can update the instruction accordingly.
1318
1319
  */
1319
- protected get config(): AreSyntax;
1320
+ protected _props: Set<string>;
1320
1321
  /**
1321
- * Instantiate AreNodes based on the token matches obtained from scanning the source template. This method takes the raw source string from the context, scans it for tokens using the defined syntax rules, and creates corresponding AreNode instances for each matched token. The resulting array of AreNodes represents the structured representation of the template, which can then be used for further processing, such as rendering or applying scene instructions.
1322
+ * The name of the instruction, for example "CreateElement", "AddAttribute", "RemoveNode", etc. This is used to identify the type of the instruction and how to process it. The name should be in PascalCase format, and should be unique across all instruction types. It is recommended to use a prefix that indicates the category of the instruction, for example "CreateElement" for instructions that create new elements, "UpdateAttribute" for instructions that update attributes, etc.
1323
+ */
1324
+ get name(): string;
1325
+ /**
1326
+ * The payload of the instruction, which can contain any additional information that may be needed for the rendering purpose. For example, for CreateElement instruction, the payload can contain the tag name and parent information, so the Host can use this information to create the element in the correct place in the scene. The payload is optional and can be an empty object if no additional information is needed.
1322
1327
  *
1328
+ * [!] Note, the payload should be serializable, so it can be stored and transmitted easily. It is recommended to use simple data structures for the payload, such as objects, arrays, strings, numbers, etc., and avoid using complex data types that may not be easily serializable.
1329
+ */
1330
+ get payload(): T;
1331
+ /**
1332
+ * Group is an optional property that can be used to group instructions together. For example a set of instructions that depend on create CreateElement instruction can be grouped together with the same group name, so if the CreateElement instruction is reverted, all the instructions in the same group will be reverted as well, and so on. This can be useful to manage complex changes that involve multiple instructions.
1323
1333
  *
1324
- * @param context
1325
- * @returns
1334
+ * [!] Note, the best option is to use ASEID of the Instruction as a group, so all instructions with the same ASEID will be treated as a single change, and will be applied and reverted together.
1326
1335
  */
1327
- instantiate<T extends AreNode>(context: AreContext): void;
1328
- tokenize(node: AreNode, context: AreContext, logger?: A_Logger): void;
1329
- protected scan(source: string, from: number, to: number, context: AreContext): AreSyntaxTokenMatch[];
1330
- protected findNextMatch(source: string, from: number, to: number): AreSyntaxTokenMatch | null;
1331
- protected matchRule(source: string, rule: AreSyntaxTokenRules, from: number, to: number): AreSyntaxTokenMatch | null;
1332
- protected matchStandardRule(source: string, rule: AreSyntaxTokenRules, from: number, to: number): AreSyntaxTokenMatch | null;
1333
- protected matchPrefixedRule(source: string, rule: AreSyntaxTokenRules, from: number, to: number): AreSyntaxTokenMatch | null;
1334
- protected findMatchingClose(source: string, opening: string, closing: string, from: number, to: number): number;
1335
- protected buildMatch(rule: AreSyntaxTokenRules, raw: string, content: string, position: number, closingUsed: string): AreSyntaxTokenMatch;
1336
- protected tryPlainText(raw: string, position: number): AreSyntaxTokenMatch | null;
1337
- protected findRuleForMatch(match: AreSyntaxTokenMatch): AreSyntaxTokenRules | undefined;
1338
- }
1339
-
1340
- declare class AreTokenizerError extends A_Error {
1341
- }
1342
-
1343
- declare class AreCompiler extends A_Component {
1336
+ get group(): string | undefined;
1344
1337
  /**
1345
- * Defines a custom method for compiling a node into a set of SceneInstructions. This method is called during the compilation phase of the ARE component and should perform any necessary transformations on the node and its attributes to generate the appropriate instructions for rendering. This can include tasks such as processing directives, evaluating expressions, and generating instructions for dynamic content based on the node's properties and context.
1338
+ * The parent instruction ASEID that created this instruction. For example, if we have a CreateElement instruction that creates a new element, and then we have an AddAttribute instruction that adds an attribute to that element, the AddAttribute instruction would have the CreateElement instruction as its parent. This can be used to track the hierarchy of instructions and their dependencies.
1346
1339
  *
1347
- * @param node
1340
+ * [!] Note, the parent should be provided as an ASEID string, so it can be easily referenced and tracked across different contexts and times.
1348
1341
  */
1349
- static Compile<T extends AreNode>(node: A_TYPES__Entity_Constructor<T>): any;
1342
+ get parent(): string | undefined;
1343
+ get id(): string;
1344
+ get owner(): AreNode$1;
1345
+ fromNew(newEntity: AreInstructionNewProps<T>): void;
1346
+ fromUndefined(): void;
1350
1347
  /**
1351
- * Defines a custom method for compiling an attribute into a set of SceneInstructions. This method is called during the compilation phase of the ARE component and should perform any necessary transformations on the attribute to generate the appropriate instructions for rendering. This can include tasks such as processing directives, evaluating expressions, and generating instructions for dynamic content based on the attribute's properties and context.
1348
+ * Group this instruction with another instruction. This means that when one of the instructions in the group is applied or reverted, all the instructions in the same group will be applied or reverted together. This can be useful to manage complex changes that involve multiple instructions.
1352
1349
  *
1353
- * @param attribute
1350
+ * For example, if we have a CreateElement instruction that creates a new element, and then we have an AddAttribute instruction that adds an attribute to that element, we can group them together with the same group name, so if we revert the CreateElement instruction, the AddAttribute instruction will be reverted as well, and so on.
1351
+ *
1352
+ * @param instruction
1353
+ * @returns
1354
1354
  */
1355
- static Compile<T extends AreAttribute>(attribute: A_TYPES__Entity_Constructor<T>): any;
1356
- compile(node: AreNode, scene: AreScene, logger?: A_Logger, ...args: any[]): void;
1357
- }
1358
-
1359
- declare class AreCompilerError extends A_Error {
1360
- static readonly RenderError = "Are Compiler Render Error";
1361
- static readonly CompilationError = "Are Compiler Compilation Error";
1362
- }
1363
-
1364
- declare class AreTransformer extends A_Component {
1365
- transform(node: AreNode, scope: A_Scope, scene: AreScene, ...args: any[]): void;
1366
- }
1367
-
1368
- declare class AreInterpreter extends A_Component {
1355
+ groupWith(instruction: AreInstruction): this;
1369
1356
  /**
1370
- * Decorator to mark a method as an instruction Apply handler for the specific instruction type. The method will be called during the render phase of the ARE component when the corresponding instruction needs to be applied. The method should contain logic to perform the necessary operations on the rendering target based on the instruction's content and context.
1357
+ * Ungroup this instruction from any group. This means that this instruction will be treated as an independent instruction, and will not be applied or reverted together with any other instructions. This can be useful when you want to separate an instruction from a group, so it can be applied or reverted independently.
1371
1358
  *
1372
- * @param action
1373
1359
  * @returns
1374
1360
  */
1375
- static Apply(action: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => any;
1361
+ unGroup(): this;
1376
1362
  /**
1377
- * Decorator to mark a method as an instruction Update handler for the specific instruction type. The method will be called during the render phase of the ARE component when the corresponding instruction has been updated. The method should contain logic to perform the necessary operations on the rendering target to update the effects of the instruction based on its new content and context.
1363
+ * Attach this instruction to a parent instruction. This means that this instruction will be considered as a child of the parent instruction, and can be used to track the hierarchy of instructions and their dependencies.
1378
1364
  *
1379
- * @param action
1365
+ * For example, if we have a CreateElement instruction that creates a new element, and then we have an AddAttribute instruction that adds an attribute to that element, we can attach the AddAttribute instruction to the CreateElement instruction as its parent, so we can track that the AddAttribute instruction is related to the CreateElement instruction.
1366
+ *
1367
+ * @param parent
1380
1368
  * @returns
1381
1369
  */
1382
- static Update(action: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => any;
1370
+ attachTo(parent: AreInstruction): this;
1383
1371
  /**
1384
- * Decorator to mark a method as an instruction Revert handler for the specific instruction type. The method will be called during the render phase of the ARE component when the corresponding instruction needs to be reverted. The method should contain logic to perform the necessary operations on the rendering target to undo the effects of the instruction based on its content and context.
1372
+ * Detach this instruction from its parent instruction. This means that this instruction will no longer be considered as a child of the parent instruction, and will not be related to it in any way. This can be useful when you want to separate an instruction from its parent, so it can be treated as an independent instruction.
1385
1373
  *
1386
- * @param action
1387
1374
  * @returns
1388
1375
  */
1389
- static Revert(action: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => any;
1376
+ detach(): this;
1390
1377
  /**
1391
- * The method responsible for executing the render operation based on the current state of the Scene. It processes the instructions that need to be applied and reverted, ensuring that the rendering target is updated accordingly. The method handles any errors that may occur during the application or reversion of instructions, maintaining the integrity of the rendering process.
1378
+ * Apply this instruction to the scene. This means that the changes represented by this instruction will be applied to the scene, and the Host will perform the necessary operations to reflect these changes in the rendered output.
1392
1379
  *
1393
- * @param scene
1380
+ * For example, if this instruction is a CreateElement instruction, when we apply it, the Host will create a new element in the scene according to the information provided in the payload of the instruction. If this instruction is an AddAttribute instruction, when we apply it, the Host will add the specified attribute to the target element in the scene. The apply method can also accept an optional scope parameter, which can be used to provide additional context or information that may be needed for applying the instruction.
1381
+ *
1382
+ * @param scope
1394
1383
  */
1395
- interpret(scene: AreScene): void;
1396
- protected applyInstruction(instruction: AreInstruction, interpreter: AreInterpreter, store: AreStore, scope: A_Scope, feature: A_Feature, ...args: any[]): void;
1397
- protected updateInstruction(instruction: AreInstruction, interpreter: AreInterpreter, store: AreStore, scope: A_Scope, feature: A_Feature, ...args: any[]): void;
1398
- protected revertInstruction(instruction: AreInstruction, interpreter: AreInterpreter, store: AreStore, scope: A_Scope, feature: A_Feature, ...args: any[]): void;
1399
- }
1400
-
1401
- declare class AreInterpreterError extends A_Error {
1402
- }
1403
-
1404
- /**
1405
- * Properties for the AreEvent context
1406
- *
1407
- */
1408
- type AreEventProps<T = any> = {
1384
+ apply(scope?: A_Scope): void;
1409
1385
  /**
1410
- * The data associated with the event
1386
+ * Update this instruction in the scene. This means that the changes represented by this instruction will be updated in the scene, and the Host will perform the necessary operations to reflect these changes in the rendered output. This is particularly useful for instructions that have dynamic properties or effects that may change over time, allowing for adjustments to be made to the instruction's behavior or effects without needing to revert and reapply it entirely. The update method can also accept an optional scope parameter, which can be used to provide additional context or information that may be needed for updating the instruction.
1387
+ *
1388
+ * @param scope
1411
1389
  */
1412
- data: T;
1390
+ update(scope?: A_Scope): void;
1413
1391
  /**
1414
- * The name of the event
1392
+ * Revert this instruction from the scene. This means that the changes represented by this instruction will be reverted from the scene, and the Host will perform the necessary operations to undo these changes in the rendered output.
1393
+ *
1394
+ * @param scope
1415
1395
  */
1416
- event: string;
1417
- };
1418
-
1419
- declare class AreSceneError extends A_Error {
1420
- static readonly SceneAlreadyInactive = "AreSceneError.SceneAlreadyInactive";
1421
- static readonly SceneAlreadyActive = "AreSceneError.SceneAlreadyActive";
1422
- static readonly HostInstructionHasConnectedInstructions = "AreSceneError.HostInstructionHasConnectedInstructions";
1423
- static readonly SingleHostInstruction = "AreSceneError.SingleHostInstruction";
1424
- static readonly SceneError = "AreSceneError.SceneError";
1425
- static readonly RootNotFound = "AreSceneError.RootNotFound";
1426
- static readonly UpdateFailed = "AreSceneError.UpdateFailed";
1427
- static readonly MountFailed = "AreSceneError.MountFailed";
1428
- static readonly UnmountFailed = "AreSceneError.UnmountFailed";
1429
- static readonly MountPointNotFound = "AreSceneError.MountPointNotFound";
1430
- static readonly InvalidTemplate = "AreSceneError.InvalidTemplate";
1431
- static readonly RenderFailed = "AreSceneError.RenderFailed";
1396
+ revert(scope?: A_Scope): void;
1432
1397
  }
1433
1398
 
1434
1399
  declare const AreInstructionFeatures: {
@@ -1454,9 +1419,66 @@ declare const AreInstructionDefaultNames: {
1454
1419
  declare class AreInstructionError extends A_Error {
1455
1420
  }
1456
1421
 
1422
+ /**
1423
+ * This is a top-level instruction that represents the creation of a new element in the scene. It contains all the necessary information to create a new element, such as its tag and parent. This instruction can be applied to the scene to create a new element and can be reverted to remove the created element.
1424
+ */
1425
+ declare class AreDeclaration<T extends Record<string, any> = Record<string, any>, S extends AreInstructionSerialized$1<T> = AreInstructionSerialized$1<T>> extends AreInstruction$1<T, S> {
1426
+ constructor(
1427
+ /**
1428
+ * Serialized form of the instruction, used for deserialization and reconstruction of the instruction instance. This allows for the instruction to be easily stored, transmitted, and recreated in different contexts or at different times, while maintaining all the necessary information and relationships intact.
1429
+ */
1430
+ serialized: AreInstructionSerialized$1);
1431
+ constructor(
1432
+ /**
1433
+ * The name of the operation to be performed in Host. For example, for CreateElement instruction, the name can be "createElement", so the Host can have a method with the same name to handle this instruction.
1434
+ */
1435
+ name: string,
1436
+ /**
1437
+ * In case this is a child instruction that is related to a declaration instruction, we can pass the parent declaration instruction to establish the relationship between them. This allows us to manage related instructions together and ensure that they are executed in the correct order in the scene.
1438
+ */
1439
+ parent: AreDeclaration,
1440
+ /**
1441
+ * A set of additional parameters that may be needed for the rendering purpose. For example, for CreateElement instruction, the payload can contain the tag name and parent information, so the Host can use this information to create the element in the correct place in the scene.
1442
+ */
1443
+ payload: T);
1444
+ constructor(
1445
+ /**
1446
+ * The name of the operation to be performed in Host. For example, for CreateElement instruction, the name can be "createElement", so the Host can have a method with the same name to handle this instruction.
1447
+ */
1448
+ name?: string,
1449
+ /**
1450
+ * A set of additional parameters that may be needed for the rendering purpose. For example, for CreateElement instruction, the payload can contain the tag name and parent information, so the Host can use this information to create the element in the correct place in the scene.
1451
+ */
1452
+ payload?: T);
1453
+ }
1454
+
1455
+ declare class AreMutation<T extends Record<string, any> = Record<string, any>, S extends AreInstructionSerialized$1<T> = AreInstructionSerialized$1<T>> extends AreInstruction$1<T, S> {
1456
+ get parent(): string;
1457
+ get group(): string;
1458
+ constructor(
1459
+ /**
1460
+ * Serialized form of the instruction, used for deserialization and reconstruction of the instruction instance. This allows for the instruction to be easily stored, transmitted, and recreated in different contexts or at different times, while maintaining all the necessary information and relationships intact.
1461
+ */
1462
+ serialized: S);
1463
+ constructor(
1464
+ /**
1465
+ * The name of the operation to be performed in Host.
1466
+ */
1467
+ name: string,
1468
+ /**
1469
+ * Parent instruction for grouping in case of mutations related to a specific declaration. This allows for better organization and management of instructions in the scene, as all mutations related to the same declaration will be executed together.
1470
+ */
1471
+ parent: AreDeclaration,
1472
+ /**
1473
+ * A set of additional parameters that may be needed for the rendering purpose. For example, for AddAttribute instruction, the payload can contain the attribute name and value as a payload, so the Host can use this information to add the attribute to the node.
1474
+ */
1475
+ payload?: T);
1476
+ fromNew(newEntity: AreInstructionNewProps$1<T>): void;
1477
+ }
1478
+
1457
1479
  declare class AreLifecycle extends A_Component {
1458
- static Init<T extends AreNode>(node: A_TYPES__Entity_Constructor<T>): any;
1459
- static Init<T extends AreAttribute>(attribute: A_TYPES__Entity_Constructor<T>): any;
1480
+ static Init<T extends AreNode$1>(node: A_TYPES__Entity_Constructor<T>): any;
1481
+ static Init<T extends AreAttribute$1>(attribute: A_TYPES__Entity_Constructor<T>): any;
1460
1482
  /**
1461
1483
  * Handles before init lifecycle of the AreNode
1462
1484
  *
@@ -1466,7 +1488,7 @@ declare class AreLifecycle extends A_Component {
1466
1488
  * @param feature
1467
1489
  * @param args
1468
1490
  */
1469
- beforeInit(node: AreNode, scope: A_Scope, scene: AreScene, feature: A_Feature, ...args: any[]): void;
1491
+ beforeInit(node: AreNode$1, scope: A_Scope, scene: AreScene$1, feature: A_Feature, ...args: any[]): void;
1470
1492
  /**
1471
1493
  * Initializes the AreNode and prepares it for mounting
1472
1494
  *
@@ -1477,7 +1499,7 @@ declare class AreLifecycle extends A_Component {
1477
1499
  * @param logger
1478
1500
  * @param args
1479
1501
  */
1480
- init(node: AreNode, scope: A_Scope, context: AreContext, logger?: A_Logger, ...args: any[]): void;
1502
+ init(node: AreNode$1, scope: A_Scope, context: AreContext$1, logger?: A_Logger, ...args: any[]): void;
1481
1503
  /**
1482
1504
  * Handles after init lifecycle of the AreNode
1483
1505
  *
@@ -1491,7 +1513,7 @@ declare class AreLifecycle extends A_Component {
1491
1513
  /**
1492
1514
  * Node to be mounted
1493
1515
  */
1494
- node: AreNode, scope: A_Scope, scene: AreScene, feature: A_Feature, ...args: any[]): void;
1516
+ node: AreNode$1, scope: A_Scope, scene: AreScene$1, feature: A_Feature, ...args: any[]): void;
1495
1517
  /**
1496
1518
  * Handles before mount lifecycle of the AreNode
1497
1519
  *
@@ -1501,7 +1523,7 @@ declare class AreLifecycle extends A_Component {
1501
1523
  * @param feature
1502
1524
  * @param args
1503
1525
  */
1504
- beforeMount(node: AreNode, scope: A_Scope, scene: AreScene, feature: A_Feature, ...args: any[]): void;
1526
+ beforeMount(node: AreNode$1, scope: A_Scope, scene: AreScene$1, feature: A_Feature, ...args: any[]): void;
1505
1527
  /**
1506
1528
  * Mount the AreNode into the Host
1507
1529
  *
@@ -1514,11 +1536,11 @@ declare class AreLifecycle extends A_Component {
1514
1536
  /**
1515
1537
  * Node to be mounted
1516
1538
  */
1517
- node: AreNode,
1539
+ node: AreNode$1,
1518
1540
  /**
1519
1541
  * Node Content
1520
1542
  */
1521
- scene: AreScene, logger?: A_Logger, ...args: any[]): void;
1543
+ scene: AreScene$1, logger?: A_Logger, ...args: any[]): void;
1522
1544
  /**
1523
1545
  * Handles after mount lifecycle of the AreNode
1524
1546
  *
@@ -1532,7 +1554,7 @@ declare class AreLifecycle extends A_Component {
1532
1554
  /**
1533
1555
  * Node to be mounted
1534
1556
  */
1535
- node: AreNode, scope: A_Scope, scene: AreScene, feature: A_Feature, ...args: any[]): void;
1557
+ node: AreNode$1, scope: A_Scope, scene: AreScene$1, feature: A_Feature, ...args: any[]): void;
1536
1558
  /**
1537
1559
  * Handles before update lifecycle of the AreNode
1538
1560
  *
@@ -1542,7 +1564,7 @@ declare class AreLifecycle extends A_Component {
1542
1564
  * @param feature
1543
1565
  * @param args
1544
1566
  */
1545
- beforeUpdate(node: AreNode, scope: A_Scope, scene: AreScene, feature: A_Feature, ...args: any[]): void;
1567
+ beforeUpdate(node: AreNode$1, scope: A_Scope, scene: AreScene$1, feature: A_Feature, ...args: any[]): void;
1546
1568
  /**
1547
1569
  * Updates the AreNode in the AreScene
1548
1570
  *
@@ -1554,7 +1576,7 @@ declare class AreLifecycle extends A_Component {
1554
1576
  /**
1555
1577
  * Node to be updated
1556
1578
  */
1557
- node: AreNode, context: AreContext, logger?: A_Logger, ...args: any[]): void;
1579
+ node: AreNode$1, context: AreContext$1, logger?: A_Logger, ...args: any[]): void;
1558
1580
  /**
1559
1581
  * Handles after update lifecycle of the AreNode
1560
1582
  *
@@ -1564,7 +1586,7 @@ declare class AreLifecycle extends A_Component {
1564
1586
  * @param feature
1565
1587
  * @param args
1566
1588
  */
1567
- afterUpdate(node: AreNode, scope: A_Scope, scene: AreScene, feature: A_Feature, ...args: any[]): void;
1589
+ afterUpdate(node: AreNode$1, scope: A_Scope, scene: AreScene$1, feature: A_Feature, ...args: any[]): void;
1568
1590
  /**
1569
1591
  * Handles before unmount lifecycle of the AreNode
1570
1592
  *
@@ -1574,7 +1596,7 @@ declare class AreLifecycle extends A_Component {
1574
1596
  * @param feature
1575
1597
  * @param args
1576
1598
  */
1577
- beforeUnmount(node: AreNode, scope: A_Scope, scene: AreScene, feature: A_Feature, ...args: any[]): void;
1599
+ beforeUnmount(node: AreNode$1, scope: A_Scope, scene: AreScene$1, feature: A_Feature, ...args: any[]): void;
1578
1600
  /**
1579
1601
  * Unmounts the AreNode from the Host
1580
1602
  *
@@ -1583,7 +1605,7 @@ declare class AreLifecycle extends A_Component {
1583
1605
  * @param args
1584
1606
  *
1585
1607
  */
1586
- unmount(node: AreNode, scene: AreScene, ...args: any[]): void;
1608
+ unmount(node: AreNode$1, scene: AreScene$1, ...args: any[]): void;
1587
1609
  /**
1588
1610
  * Handles after unmount lifecycle of the AreNode
1589
1611
  *
@@ -1593,7 +1615,7 @@ declare class AreLifecycle extends A_Component {
1593
1615
  * @param feature
1594
1616
  * @param args
1595
1617
  */
1596
- afterUnmount(node: AreNode, scope: A_Scope, scene: AreScene, feature: A_Feature, ...args: any[]): void;
1618
+ afterUnmount(node: AreNode$1, scope: A_Scope, scene: AreScene$1, feature: A_Feature, ...args: any[]): void;
1597
1619
  /**
1598
1620
  * Handles before destroy lifecycle of the AreNode
1599
1621
  *
@@ -1603,7 +1625,7 @@ declare class AreLifecycle extends A_Component {
1603
1625
  * @param feature
1604
1626
  * @param args
1605
1627
  */
1606
- beforeDestroy(node: AreNode, scope: A_Scope, feature: A_Feature, ...args: any[]): void;
1628
+ beforeDestroy(node: AreNode$1, scope: A_Scope, feature: A_Feature, ...args: any[]): void;
1607
1629
  /**
1608
1630
  * Destroys the AreNode from the Host
1609
1631
  *
@@ -1612,7 +1634,7 @@ declare class AreLifecycle extends A_Component {
1612
1634
  * @param args
1613
1635
  *
1614
1636
  */
1615
- destroy(node: AreNode, scene: AreScene, ...args: any[]): void;
1637
+ destroy(node: AreNode$1, scene: AreScene$1, ...args: any[]): void;
1616
1638
  /**
1617
1639
  * Handles after destroy lifecycle of the AreNode
1618
1640
  *
@@ -1622,7 +1644,7 @@ declare class AreLifecycle extends A_Component {
1622
1644
  * @param feature
1623
1645
  * @param args
1624
1646
  */
1625
- afterDestroy(node: AreNode, scope: A_Scope, feature: A_Feature, ...args: any[]): void;
1647
+ afterDestroy(node: AreNode$1, scope: A_Scope, feature: A_Feature, ...args: any[]): void;
1626
1648
  }
1627
1649
 
1628
1650
  declare class AreLifecycleError extends A_Error {
@@ -1640,7 +1662,7 @@ declare class AreLoader extends A_Component {
1640
1662
  * @param logger
1641
1663
  * @param args
1642
1664
  */
1643
- load(node: AreNode, scope: A_Scope, feature: A_Feature, logger?: A_Logger, context?: AreContext, ...args: any[]): Promise<void>;
1665
+ load(node: AreNode$1, scope: A_Scope, feature: A_Feature, logger?: A_Logger, context?: AreContext$1, ...args: any[]): Promise<void>;
1644
1666
  }
1645
1667
 
1646
1668
  declare class AreLoaderError extends A_Error {
@@ -1666,7 +1688,7 @@ declare class AreWatcher extends A_Component {
1666
1688
  declare class AreSignal<_TSignalDataType extends Record<string, any> = Record<string, any>> extends A_Signal<_TSignalDataType> {
1667
1689
  }
1668
1690
 
1669
- type AreSignalsContextConfig<T extends Are> = {
1691
+ type AreSignalsContextConfig<T extends Are$1> = {
1670
1692
  [key in string]: {
1671
1693
  default: A_TYPES__Ctor<T>;
1672
1694
  pool: Array<A_TYPES__Ctor<T>>;
@@ -1678,14 +1700,14 @@ type AreSignalsContextConfig<T extends Are> = {
1678
1700
  };
1679
1701
 
1680
1702
  declare class AreSignalsMeta extends A_ComponentMeta<{
1681
- vectorToComponent: Map<A_SignalVector, A_TYPES__Ctor<Are>>;
1682
- componentToVector: Map<A_TYPES__Ctor<Are>, Set<A_SignalVector>>;
1703
+ vectorToComponent: Map<A_SignalVector, A_TYPES__Ctor<Are$1>>;
1704
+ componentToVector: Map<A_TYPES__Ctor<Are$1>, Set<A_SignalVector>>;
1683
1705
  } & A_TYPES__ComponentMeta> {
1684
- registerCondition<T extends Are>(component: A_TYPES__Ctor<T>, vector: A_SignalVector): void;
1685
- findComponentByVector(vector: A_SignalVector): A_TYPES__Ctor<Are> | undefined;
1706
+ registerCondition<T extends Are$1>(component: A_TYPES__Ctor<T>, vector: A_SignalVector): void;
1707
+ findComponentByVector(vector: A_SignalVector): A_TYPES__Ctor<Are$1> | undefined;
1686
1708
  }
1687
1709
 
1688
- declare class AreSignalsContext<T extends Are = Are> extends A_Fragment {
1710
+ declare class AreSignalsContext<T extends Are$1 = Are$1> extends A_Fragment {
1689
1711
  /**
1690
1712
  * Where key is the root ID and the value is an Array of components that participate in conditional compilation.
1691
1713
  */
@@ -1695,11 +1717,11 @@ declare class AreSignalsContext<T extends Are = Are> extends A_Fragment {
1695
1717
  vector: Array<any>;
1696
1718
  component: A_TYPES__Ctor<T>;
1697
1719
  }>>;
1698
- protected _subscribers: Set<AreNode>;
1720
+ protected _subscribers: Set<AreNode$1>;
1699
1721
  protected signalsMeta(): AreSignalsMeta;
1700
- subscribe<S extends AreNode>(subscriber: S): void;
1701
- unsubscribe<S extends AreNode>(subscriber: S): void;
1702
- get subscribers(): Set<AreNode>;
1722
+ subscribe<S extends AreNode$1>(subscriber: S): void;
1723
+ unsubscribe<S extends AreNode$1>(subscriber: S): void;
1724
+ get subscribers(): Set<AreNode$1>;
1703
1725
  constructor(
1704
1726
  /**
1705
1727
  * Where key is the root ID and the value is an Array of components that participate in conditional compilation.
@@ -1718,7 +1740,7 @@ declare class AreSignalsContext<T extends Are = Are> extends A_Fragment {
1718
1740
  * @param node The AreNode whose root ID is used to retrieve the components.
1719
1741
  * @returns An array of component constructors.
1720
1742
  */
1721
- getComponentByRoot(node: AreNode): Array<A_TYPES__Ctor<T>>;
1743
+ getComponentByRoot(node: AreNode$1): Array<A_TYPES__Ctor<T>>;
1722
1744
  /**
1723
1745
  * Adds a new component to the specified root ID. If the root ID does not exist, it will be created.
1724
1746
  *
@@ -1765,18 +1787,88 @@ declare class AreSignals extends A_Component {
1765
1787
  * @param feature
1766
1788
  * @param args
1767
1789
  */
1768
- propagateEvent(node: AreNode, scope: A_Scope, event: AreEvent, feature: A_Feature, logger?: A_Logger, ...args: any[]): Promise<void>;
1790
+ propagateEvent(node: AreNode$1, scope: A_Scope, event: AreEvent$1, feature: A_Feature, logger?: A_Logger, ...args: any[]): Promise<void>;
1769
1791
  }
1770
1792
 
1771
- declare class AreInit extends AreSignal {
1793
+ declare class AreInit extends AreSignal$1 {
1772
1794
  static default(): AreInit | undefined;
1773
1795
  }
1774
1796
 
1775
- declare class AreRoute extends AreSignal<A_Route> {
1797
+ declare class AreRoute extends AreSignal$1<A_Route> {
1776
1798
  constructor(path: string | RegExp);
1777
1799
  get route(): A_Route;
1778
1800
  static default(): AreRoute | undefined;
1779
1801
  compare(other: A_Signal<A_Route>): boolean;
1780
1802
  }
1781
1803
 
1782
- export { Are, AreAttribute, type AreAttributeFeatureNames, AreAttributeFeatures, type AreAttribute_Init, type AreAttribute_Serialized, AreCompiler, AreCompilerError, AreContext, type AreContextInit, AreDeclaration, AreEvent, type AreEventProps, type AreFeatureNames, AreFeatures, AreInit, AreInstruction, AreInstructionDefaultNames, AreInstructionError, AreInstructionFeatures, type AreInstructionNewProps, type AreInstructionSerialized, AreInterpreter, AreInterpreterError, AreLifecycle, AreLifecycleError, AreLoader, AreLoaderError, AreMutation, AreNode, type AreNodeFeatureNames, AreNodeFeatures, type AreNodeNewProps, type AreNodeStatusNames, AreNodeStatuses, type ArePropDefinition, AreRoute, AreScene, type AreSceneChanges, AreSceneError, type AreSceneStatusNames, AreSceneStatuses, type AreScene_Serialized, AreSignal, AreSignals, AreSignalsContext, type AreSignalsContextConfig, AreStore, type AreStoreAreComponentMetaKeyNames, AreStoreAreComponentMetaKeys, type AreStorePathValue, type AreStoreWatchingEntity, AreSyntax, type AreSyntaxCompiledExpression, AreSyntaxError, type AreSyntaxInitOptions, type AreSyntaxTokenMatch, type AreSyntaxTokenPayload, type AreSyntaxTokenRules, AreTokenizer, AreTokenizerError, AreTransformer, AreWatcher };
1804
+ type AreEngineDependencies = {
1805
+ context: AreContext$1;
1806
+ syntax: AreSyntax$1;
1807
+ loader: A_TYPES__Component_Constructor<AreLoader$1>;
1808
+ tokenizer: A_TYPES__Component_Constructor<AreTokenizer$1>;
1809
+ compiler: A_TYPES__Component_Constructor<AreCompiler$1>;
1810
+ transformer: A_TYPES__Component_Constructor<AreTransformer$1>;
1811
+ interpreter: A_TYPES__Component_Constructor<AreInterpreter$1>;
1812
+ lifecycle: A_TYPES__Component_Constructor<AreLifecycle$1>;
1813
+ signals: A_TYPES__Component_Constructor<AreSignals$1>;
1814
+ };
1815
+
1816
+ declare class AreEngine extends A_Component {
1817
+ /**
1818
+ * Feature decorator for the load method, which is responsible for the initial loading phase of the engine. This method is where the engine reads the source template, tokenizes it, and prepares the initial context for building the scene. The decorator allows for extending or overriding the default loading behavior by attaching additional functionality before or after the load process.
1819
+ */
1820
+ static get Load(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => any;
1821
+ /**
1822
+ * Feature decorator for the build method, which is responsible for constructing the scene based on the loaded context. This method typically involves initializing root nodes, applying transformations, and compiling the scene into a format that can be executed by the interpreter. The decorator allows for customizing the build process by adding additional steps or modifying the existing behavior.
1823
+ */
1824
+ static get Build(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => any;
1825
+ /**
1826
+ * Feature decorator for the execute method, which is responsible for the final execution phase of the engine. This method typically involves mounting the root nodes to the DOM and starting the reactive update cycle based on signals and state changes. The decorator allows for customizing the execution process by adding additional steps or modifying the existing behavior.
1827
+ */
1828
+ static get Execute(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => any;
1829
+ /**
1830
+ * Method to start the engine, which involves loading necessary resources, building the scene, and executing the rendering process. It accepts an optional scope parameter that can be used to provide a custom scope for the engine's operations, allowing for greater flexibility in how dependencies are managed and accessed during the rendering lifecycle.
1831
+ *
1832
+ * @param scope
1833
+ * @returns
1834
+ */
1835
+ load(scope?: A_Scope): Promise<void>;
1836
+ /**
1837
+ * Method responsible for building the scene, which includes initializing root nodes, loading necessary data, applying transformations, and compiling the scene into a format that can be executed by the interpreter.
1838
+ *
1839
+ * @param context
1840
+ * @param logger
1841
+ */
1842
+ build(scope?: A_Scope): Promise<void>;
1843
+ /**
1844
+ * Method responsible for executing the rendering process, which involves mounting the root nodes to the DOM and starting the reactive update cycle based on signals and state changes.
1845
+ *
1846
+ * @param context
1847
+ * @param logger
1848
+ */
1849
+ execute(scope?: A_Scope): Promise<void>;
1850
+ protected defaultBuild(context: AreContext$1, logger?: A_Logger): Promise<void>;
1851
+ protected defaultExecute(context: AreContext$1, bus?: A_SignalBus, logger?: A_Logger): Promise<void>;
1852
+ init(scope: A_Scope): Promise<void>;
1853
+ verify(scope: A_Scope, syntax?: AreSyntax$1, syntaxContext?: AreSyntax$1, transformer?: AreTransformer$1, loader?: AreLoader$1, compiler?: AreCompiler$1, interpreter?: AreInterpreter$1, lifecycle?: AreLifecycle$1, logger?: A_Logger): Promise<void>;
1854
+ /**
1855
+ * Method to pack all necessary dependencies for the engine. This method is called during the initialization phase of the engine and ensures that all required components are registered in the container scope, allowing for proper dependency injection and management throughout the engine's lifecycle.
1856
+ *
1857
+ * @param scope
1858
+ * @param dependencies
1859
+ */
1860
+ protected package(scope: A_Scope, dependencies?: Partial<AreEngineDependencies>): void;
1861
+ protected packDependency<T extends A_TYPES__A_DependencyInjectable>(scope: A_Scope, dependency: T | A_TYPES__Ctor<T>, existed?: A_TYPES__Ctor<T>): T | A_TYPES__Ctor<T>;
1862
+ }
1863
+
1864
+ declare const AreEngineFeatures: {
1865
+ Load: string;
1866
+ Build: string;
1867
+ Execute: string;
1868
+ };
1869
+
1870
+ declare class AreEngineError extends A_Error {
1871
+ static readonly MissedRequiredDependency = "A Required Dependency is missing in AreEngine";
1872
+ }
1873
+
1874
+ export { Are, AreAttribute, type AreAttributeFeatureNames, AreAttributeFeatures, type AreAttribute_Init, type AreAttribute_Serialized, AreCompiler, AreCompilerError, AreContext, type AreContextInit, AreDeclaration, AreEngine, type AreEngineDependencies, AreEngineError, AreEngineFeatures, AreEvent, type AreEventProps, type AreFeatureNames, AreFeatures, AreInit, AreInstruction, AreInstructionDefaultNames, AreInstructionError, AreInstructionFeatures, type AreInstructionNewProps, type AreInstructionSerialized, AreInterpreter, AreInterpreterError, AreLifecycle, AreLifecycleError, AreLoader, AreLoaderError, AreMutation, AreNode, type AreNodeFeatureNames, AreNodeFeatures, type AreNodeNewProps, type AreNodeStatusNames, AreNodeStatuses, type ArePropDefinition, AreRoute, AreScene, type AreSceneChanges, AreSceneError, type AreSceneStatusNames, AreSceneStatuses, type AreScene_Serialized, AreSignal, AreSignals, AreSignalsContext, type AreSignalsContextConfig, AreStore, type AreStoreAreComponentMetaKeyNames, AreStoreAreComponentMetaKeys, type AreStorePathValue, type AreStoreWatchingEntity, AreSyntax, type AreSyntaxCompiledExpression, AreSyntaxError, type AreSyntaxInitOptions, type AreSyntaxTokenMatch, type AreSyntaxTokenPayload, type AreSyntaxTokenRules, AreTokenizer, AreTokenizerError, AreTransformer, AreWatcher };