@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,14 +1,198 @@
1
- import '@adaas/a-concept';
2
- import '../AreEvent/AreEvent.context.js';
3
- export { g as AreNode } from '../../Are.context-9Ija_fdC.js';
4
- import '../AreComponent/Are.component.js';
5
- import '@adaas/a-utils/a-execution';
6
- import '@adaas/a-utils/a-signal';
7
- import '../AreStore/AreStore.types.js';
8
- import '../AreStore/AreStore.constants.js';
9
- import '../AreScene/AreScene.constants.js';
10
- import '../AreAttribute/AreAttribute.types.js';
11
- import '../AreAttribute/AreAttribute.constants.js';
1
+ import { A_Entity, A_Scope, ASEID } from '@adaas/a-concept';
2
+ import { AreEvent } from '@adaas/are/event/AreEvent.context';
3
+ import { AreScene } from '@adaas/are/scene/AreScene.context';
4
+ import { AreAttribute } from '@adaas/are/attribute/AreAttribute.entity';
5
+ import { Are } from '@adaas/are/component/Are.component';
6
+ import { AreNodeNewProps, AreNodeStatusNames } from './AreNode.types.js';
7
+ import { AreSyntaxTokenPayload } from '@adaas/are/syntax/AreSyntax.types';
12
8
  import './AreNode.constants.js';
13
- import '../AreComponent/Are.types.js';
14
- import '../AreComponent/Are.constants.js';
9
+
10
+ declare class AreNode extends A_Entity<AreNodeNewProps> {
11
+ /**
12
+ * The current status of the node, which can be used to track the lifecycle and rendering state of the node within the scene.
13
+ */
14
+ status: AreNodeStatusNames;
15
+ /**
16
+ * 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.
17
+ */
18
+ protected _opening: string;
19
+ /**
20
+ * 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.
21
+ */
22
+ protected _closing: string;
23
+ /**
24
+ * 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.
25
+ */
26
+ protected _position: number;
27
+ /**
28
+ * 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.
29
+ */
30
+ protected _payload?: AreSyntaxTokenPayload;
31
+ /**
32
+ * Content string defined for the node — the inner content between delimiters.
33
+ * Example: `{{name}}`
34
+ */
35
+ protected _content: string;
36
+ /**
37
+ * Markup string defined for the node
38
+ * Example: `<custom-component :prop="value"> <div>Inner Content</div> </custom-component>`
39
+ */
40
+ protected _markup: string;
41
+ /**
42
+ * The scope associated with this node
43
+ * uses to store all nested fragments and entities like other AreNodes and Scene
44
+ */
45
+ protected _scope: A_Scope;
46
+ /**
47
+ * Actual node identifier.
48
+ */
49
+ get id(): string;
50
+ /**
51
+ * Actual node type.
52
+ * By default it's a tag name
53
+ */
54
+ get type(): string;
55
+ /**
56
+ * Content string defined for the node — the inner content between delimiters.
57
+ * Example: `{{name}}`
58
+ */
59
+ get content(): string;
60
+ /**
61
+ * Markup string defined for the node
62
+ * Example: `<custom-component :prop="value"> <div>Inner Content</div> </custom-component>`
63
+ */
64
+ get markup(): string;
65
+ /**
66
+ * The scope associated with this node
67
+ * uses to store all nested fragments and entities like other AreNodes and Scene
68
+ */
69
+ get scope(): A_Scope;
70
+ /**
71
+ * 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.
72
+ */
73
+ get attributes(): AreAttribute[];
74
+ /**
75
+ * 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.
76
+ *
77
+ * 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.
78
+ *
79
+ * [!] 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.
80
+ */
81
+ get component(): Are | undefined;
82
+ /**
83
+ * 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.
84
+ *
85
+ * 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.
86
+ */
87
+ get parent(): AreNode | undefined;
88
+ /**
89
+ * 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.
90
+ *
91
+ * 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.
92
+ */
93
+ get children(): (AreNode)[];
94
+ /**
95
+ * It returns the scene where the node exists, so it should be the scene of the rootNode,
96
+ * primary parent of this node.
97
+ */
98
+ get scene(): AreScene;
99
+ protected _scene: AreScene;
100
+ fromNew(newEntity: AreNodeNewProps): void;
101
+ fromASEID(aseid: string | ASEID): void;
102
+ /**
103
+ * Sets the content string for the node — the inner text/markup between the node's
104
+ * opening and closing delimiters. Content is processed by the rendering engine to
105
+ * generate the corresponding SceneInstructions for rendering the node.
106
+ *
107
+ * @param content
108
+ */
109
+ setContent(content: string): void;
110
+ /**
111
+ * 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.
112
+ *
113
+ * @param markup
114
+ */
115
+ setMarkup(markup: string): void;
116
+ /**
117
+ * Adds a child node to the current node's scope and ensures the child inherits from this node's scope.
118
+ *
119
+ * @param child - The node to add as a child
120
+ */
121
+ addChild(child: AreNode): void;
122
+ /**
123
+ * 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.
124
+ *
125
+ * @param node - The child node to be removed from the current node's scope
126
+ */
127
+ removeChild(node: AreNode): void;
128
+ /**
129
+ * 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.
130
+ */
131
+ init(): void;
132
+ /**
133
+ * 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.
134
+ */
135
+ load(): Promise<any>;
136
+ /**
137
+ * 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.
138
+ */
139
+ tokenize(): void;
140
+ /**
141
+ * 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.
142
+ */
143
+ transform(): void;
144
+ /**
145
+ * 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.
146
+ *
147
+ * [!] 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.
148
+ */
149
+ compile(): void;
150
+ /**
151
+ * 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.
152
+ *
153
+ * [!] 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.
154
+ */
155
+ mount(): void;
156
+ /**
157
+ * 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.
158
+ *
159
+ * [!] Note: The interpret method should NOT go though own child, since it may be used by both mount and update operations!
160
+ */
161
+ interpret(): void;
162
+ /**
163
+ * 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.
164
+ *
165
+ * [!] 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.
166
+ */
167
+ update(): void;
168
+ /**
169
+ * 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.
170
+ *
171
+ * [!] 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.
172
+ */
173
+ unmount(): void;
174
+ cloneWithScope<T extends AreNode = AreNode>(this: T): T;
175
+ reset(): void;
176
+ clone<T extends AreNode = AreNode>(this: T): T;
177
+ /**
178
+ * 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.
179
+ *
180
+ * @param scope - The scope or event to be emitted to the node
181
+ */
182
+ emit(scope: A_Scope): any;
183
+ emit(event: AreEvent): any;
184
+ /**
185
+ * 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.
186
+ *
187
+ * [!] 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.
188
+ */
189
+ destroy(): Promise<any>;
190
+ /**
191
+ * Method to ensure that the current scope is inherited from the context scope
192
+ *
193
+ * @throws A_Error if the scope is not inherited from the context scope
194
+ */
195
+ protected checkScopeInheritance(): void;
196
+ }
197
+
198
+ export { AreNode };
@@ -1,14 +1,8 @@
1
- export { h as AreNodeFeatureNames, i as AreNodeNewProps, j as AreNodeStatusNames } from '../../Are.context-D7w32H1G.mjs';
2
- import './AreNode.constants.mjs';
3
- import '@adaas/a-concept';
4
- import '@adaas/a-utils/a-signal';
5
- import '../AreEvent/AreEvent.context.mjs';
6
- import '@adaas/a-utils/a-execution';
7
- import '../AreStore/AreStore.types.mjs';
8
- import '../AreStore/AreStore.constants.mjs';
9
- import '../AreScene/AreScene.constants.mjs';
10
- import '../AreAttribute/AreAttribute.types.mjs';
11
- import '../AreAttribute/AreAttribute.constants.mjs';
12
- import '../AreComponent/Are.component.mjs';
13
- import '../AreComponent/Are.types.mjs';
14
- import '../AreComponent/Are.constants.mjs';
1
+ import { AreSyntaxTokenMatch } from '@adaas/are/syntax/AreSyntax.types';
2
+ import { AreNodeStatuses, AreNodeFeatures } from './AreNode.constants.mjs';
3
+
4
+ type AreNodeNewProps = AreSyntaxTokenMatch;
5
+ type AreNodeFeatureNames = typeof AreNodeFeatures[keyof typeof AreNodeFeatures];
6
+ type AreNodeStatusNames = typeof AreNodeStatuses[keyof typeof AreNodeStatuses];
7
+
8
+ export type { AreNodeFeatureNames, AreNodeNewProps, AreNodeStatusNames };
@@ -1,14 +1,8 @@
1
- export { h as AreNodeFeatureNames, i as AreNodeNewProps, j as AreNodeStatusNames } from '../../Are.context-9Ija_fdC.js';
2
- import './AreNode.constants.js';
3
- import '@adaas/a-concept';
4
- import '@adaas/a-utils/a-signal';
5
- import '../AreEvent/AreEvent.context.js';
6
- import '@adaas/a-utils/a-execution';
7
- import '../AreStore/AreStore.types.js';
8
- import '../AreStore/AreStore.constants.js';
9
- import '../AreScene/AreScene.constants.js';
10
- import '../AreAttribute/AreAttribute.types.js';
11
- import '../AreAttribute/AreAttribute.constants.js';
12
- import '../AreComponent/Are.component.js';
13
- import '../AreComponent/Are.types.js';
14
- import '../AreComponent/Are.constants.js';
1
+ import { AreSyntaxTokenMatch } from '@adaas/are/syntax/AreSyntax.types';
2
+ import { AreNodeStatuses, AreNodeFeatures } from './AreNode.constants.js';
3
+
4
+ type AreNodeNewProps = AreSyntaxTokenMatch;
5
+ type AreNodeFeatureNames = typeof AreNodeFeatures[keyof typeof AreNodeFeatures];
6
+ type AreNodeStatusNames = typeof AreNodeStatuses[keyof typeof AreNodeStatuses];
7
+
8
+ export type { AreNodeFeatureNames, AreNodeNewProps, AreNodeStatusNames };
@@ -1,14 +1,171 @@
1
- import '@adaas/a-concept';
2
- export { k as AreScene } from '../../Are.context-D7w32H1G.mjs';
3
- import '@adaas/a-utils/a-signal';
4
- import '../AreEvent/AreEvent.context.mjs';
5
- import '@adaas/a-utils/a-execution';
6
- import '../AreStore/AreStore.types.mjs';
7
- import '../AreStore/AreStore.constants.mjs';
1
+ import { A_Fragment, ASEID, A_Scope } from '@adaas/a-concept';
2
+ import { AreNode } from '@adaas/are/node/AreNode.entity';
3
+ import { AreDeclaration } from '@adaas/are/instruction/types/AreDeclaration.instruction';
4
+ import { AreInstruction } from '@adaas/are/instruction/AreInstruction.entity';
5
+ import { AreSceneStatusNames, AreSceneChanges } from './AreScene.types.mjs';
6
+ import { AreMutation } from '@adaas/are/instruction/types/AreMutation.instruction';
7
+ import '@adaas/are/instruction/AreInstruction.types';
8
8
  import './AreScene.constants.mjs';
9
- import '../AreAttribute/AreAttribute.types.mjs';
10
- import '../AreAttribute/AreAttribute.constants.mjs';
11
- import '../AreComponent/Are.component.mjs';
12
- import '../AreComponent/Are.types.mjs';
13
- import '../AreComponent/Are.constants.mjs';
14
- import '../AreNode/AreNode.constants.mjs';
9
+
10
+ declare class AreScene extends A_Fragment {
11
+ protected _groupToInstructionsMap: Map<string, Set<AreInstruction>>;
12
+ /**
13
+ * Plan is a queue of changes that should be applied to render the node
14
+ *
15
+ * It works as FIFO, so the first instruction that should be applied is the first one in the queue, and so on.
16
+ */
17
+ protected _plan: Array<AreInstruction>;
18
+ /**
19
+ * State is a list of instructions that are currently applied to the node,
20
+ * so it represents the current state of the node in the scene.
21
+ *
22
+ * 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.
23
+ *
24
+ * 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.
25
+ */
26
+ protected _state: Array<AreInstruction>;
27
+ protected _host: AreDeclaration | undefined;
28
+ /**
29
+ * 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.
30
+ */
31
+ protected _status: AreSceneStatusNames;
32
+ constructor(
33
+ /**
34
+ * Scene identity will be used to identify mounting point in the parent scene
35
+ */
36
+ id: string | ASEID);
37
+ /**
38
+ * Scene ID that corresponds to the root node's ID (part of ASEID)
39
+ */
40
+ get id(): string;
41
+ /**
42
+ * The scope where scene is registered. This scope is owned by AreNode
43
+ */
44
+ get scope(): A_Scope;
45
+ /**
46
+ * The owner node of the scene, which is the node that registered the scene in its scope.
47
+ * This is typically the node that is responsible for rendering the scene and managing its lifecycle.
48
+ */
49
+ get owner(): AreNode;
50
+ /**
51
+ * 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.
52
+ */
53
+ get host(): AreDeclaration | undefined;
54
+ /**
55
+ * 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.
56
+ */
57
+ get status(): AreSceneStatusNames;
58
+ get isActive(): boolean;
59
+ get isInactive(): boolean;
60
+ /**
61
+ * 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.
62
+ */
63
+ get declarations(): AreDeclaration[];
64
+ /**
65
+ * 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.
66
+ */
67
+ get mutations(): AreMutation[];
68
+ /**
69
+ * Returns All instructions are registered in the scene scope.
70
+ */
71
+ get instructions(): AreInstruction[];
72
+ /**
73
+ * Plan is a queue of changes that should be applied to render the node
74
+ *
75
+ * It works as FIFO, so the first instruction that should be applied is the first one in the queue, and so on.
76
+ */
77
+ get planned(): AreInstruction[];
78
+ /**
79
+ * State is a list of instructions that are currently applied to the node,
80
+ * so it represents the current state of the node in the scene.
81
+ *
82
+ * 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.
83
+ *
84
+ * 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.
85
+ */
86
+ get applied(): AreInstruction[];
87
+ /**
88
+ * Should return instructions to be reverted and to be applied.
89
+ * A difference between plan vs state is that plan is what should be applied to the scene,
90
+ * while state is what currently applied to the scene.
91
+ *
92
+ */
93
+ get changes(): AreSceneChanges;
94
+ activate(): void;
95
+ deactivate(): void;
96
+ /**
97
+ * 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.
98
+ *
99
+ * @param instruction
100
+ */
101
+ setHost(instruction: AreDeclaration): void;
102
+ /**
103
+ * Unsets the current host instruction from the scene.
104
+ *
105
+ * 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.
106
+ */
107
+ removeHost(): void;
108
+ /**
109
+ * Method that should register the instruction in the plan, so it will be rendered in the next render cycle.
110
+ *
111
+ * @param instruction
112
+ */
113
+ plan(instruction: AreInstruction): void;
114
+ planBefore(instruction: AreInstruction, beforeInstruction: AreInstruction): void;
115
+ planAfter(instruction: AreInstruction, afterInstruction: AreInstruction): void;
116
+ moveBefore(instruction: AreInstruction, beforeInstruction: AreInstruction): void;
117
+ moveAfter(instruction: AreInstruction, afterInstruction: AreInstruction): void;
118
+ /**
119
+ * 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.
120
+ *
121
+ * @param instruction
122
+ */
123
+ unPlan(instruction: AreInstruction): void;
124
+ /**
125
+ * Checks if the instruction is already in the plan, so it will be rendered in the next render cycle.
126
+ *
127
+ * @param instruction
128
+ * @returns
129
+ */
130
+ getPlanned(instruction: AreInstruction): AreInstruction | undefined;
131
+ /**
132
+ * Checks if the instruction is already in the plan, so it will be rendered in the next render cycle.
133
+ *
134
+ * @param instruction
135
+ * @returns
136
+ */
137
+ isInPlan(instruction: AreInstruction): boolean;
138
+ /**
139
+ * 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.
140
+ *
141
+ * @param instruction
142
+ */
143
+ apply(instruction: AreInstruction): void;
144
+ /**
145
+ * 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.
146
+ *
147
+ * @param instruction
148
+ */
149
+ unApply(instruction: AreInstruction): void;
150
+ /**
151
+ * Checks if the instruction is already in the state, so it is currently applied to the scene.
152
+ *
153
+ * @param instruction
154
+ * @returns
155
+ */
156
+ getApplied(instruction: AreInstruction): AreInstruction | undefined;
157
+ /**
158
+ * Checks if the instruction is already in the state, so it is currently applied to the scene.
159
+ *
160
+ * @param instruction
161
+ * @returns
162
+ */
163
+ isApplied(instruction: AreInstruction): boolean;
164
+ /**
165
+ * 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.
166
+ *
167
+ */
168
+ reset(): void;
169
+ }
170
+
171
+ export { AreScene };
@@ -1,14 +1,171 @@
1
- import '@adaas/a-concept';
2
- export { k as AreScene } from '../../Are.context-9Ija_fdC.js';
3
- import '@adaas/a-utils/a-signal';
4
- import '../AreEvent/AreEvent.context.js';
5
- import '@adaas/a-utils/a-execution';
6
- import '../AreStore/AreStore.types.js';
7
- import '../AreStore/AreStore.constants.js';
1
+ import { A_Fragment, ASEID, A_Scope } from '@adaas/a-concept';
2
+ import { AreNode } from '@adaas/are/node/AreNode.entity';
3
+ import { AreDeclaration } from '@adaas/are/instruction/types/AreDeclaration.instruction';
4
+ import { AreInstruction } from '@adaas/are/instruction/AreInstruction.entity';
5
+ import { AreSceneStatusNames, AreSceneChanges } from './AreScene.types.js';
6
+ import { AreMutation } from '@adaas/are/instruction/types/AreMutation.instruction';
7
+ import '@adaas/are/instruction/AreInstruction.types';
8
8
  import './AreScene.constants.js';
9
- import '../AreAttribute/AreAttribute.types.js';
10
- import '../AreAttribute/AreAttribute.constants.js';
11
- import '../AreComponent/Are.component.js';
12
- import '../AreComponent/Are.types.js';
13
- import '../AreComponent/Are.constants.js';
14
- import '../AreNode/AreNode.constants.js';
9
+
10
+ declare class AreScene extends A_Fragment {
11
+ protected _groupToInstructionsMap: Map<string, Set<AreInstruction>>;
12
+ /**
13
+ * Plan is a queue of changes that should be applied to render the node
14
+ *
15
+ * It works as FIFO, so the first instruction that should be applied is the first one in the queue, and so on.
16
+ */
17
+ protected _plan: Array<AreInstruction>;
18
+ /**
19
+ * State is a list of instructions that are currently applied to the node,
20
+ * so it represents the current state of the node in the scene.
21
+ *
22
+ * 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.
23
+ *
24
+ * 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.
25
+ */
26
+ protected _state: Array<AreInstruction>;
27
+ protected _host: AreDeclaration | undefined;
28
+ /**
29
+ * 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.
30
+ */
31
+ protected _status: AreSceneStatusNames;
32
+ constructor(
33
+ /**
34
+ * Scene identity will be used to identify mounting point in the parent scene
35
+ */
36
+ id: string | ASEID);
37
+ /**
38
+ * Scene ID that corresponds to the root node's ID (part of ASEID)
39
+ */
40
+ get id(): string;
41
+ /**
42
+ * The scope where scene is registered. This scope is owned by AreNode
43
+ */
44
+ get scope(): A_Scope;
45
+ /**
46
+ * The owner node of the scene, which is the node that registered the scene in its scope.
47
+ * This is typically the node that is responsible for rendering the scene and managing its lifecycle.
48
+ */
49
+ get owner(): AreNode;
50
+ /**
51
+ * 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.
52
+ */
53
+ get host(): AreDeclaration | undefined;
54
+ /**
55
+ * 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.
56
+ */
57
+ get status(): AreSceneStatusNames;
58
+ get isActive(): boolean;
59
+ get isInactive(): boolean;
60
+ /**
61
+ * 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.
62
+ */
63
+ get declarations(): AreDeclaration[];
64
+ /**
65
+ * 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.
66
+ */
67
+ get mutations(): AreMutation[];
68
+ /**
69
+ * Returns All instructions are registered in the scene scope.
70
+ */
71
+ get instructions(): AreInstruction[];
72
+ /**
73
+ * Plan is a queue of changes that should be applied to render the node
74
+ *
75
+ * It works as FIFO, so the first instruction that should be applied is the first one in the queue, and so on.
76
+ */
77
+ get planned(): AreInstruction[];
78
+ /**
79
+ * State is a list of instructions that are currently applied to the node,
80
+ * so it represents the current state of the node in the scene.
81
+ *
82
+ * 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.
83
+ *
84
+ * 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.
85
+ */
86
+ get applied(): AreInstruction[];
87
+ /**
88
+ * Should return instructions to be reverted and to be applied.
89
+ * A difference between plan vs state is that plan is what should be applied to the scene,
90
+ * while state is what currently applied to the scene.
91
+ *
92
+ */
93
+ get changes(): AreSceneChanges;
94
+ activate(): void;
95
+ deactivate(): void;
96
+ /**
97
+ * 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.
98
+ *
99
+ * @param instruction
100
+ */
101
+ setHost(instruction: AreDeclaration): void;
102
+ /**
103
+ * Unsets the current host instruction from the scene.
104
+ *
105
+ * 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.
106
+ */
107
+ removeHost(): void;
108
+ /**
109
+ * Method that should register the instruction in the plan, so it will be rendered in the next render cycle.
110
+ *
111
+ * @param instruction
112
+ */
113
+ plan(instruction: AreInstruction): void;
114
+ planBefore(instruction: AreInstruction, beforeInstruction: AreInstruction): void;
115
+ planAfter(instruction: AreInstruction, afterInstruction: AreInstruction): void;
116
+ moveBefore(instruction: AreInstruction, beforeInstruction: AreInstruction): void;
117
+ moveAfter(instruction: AreInstruction, afterInstruction: AreInstruction): void;
118
+ /**
119
+ * 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.
120
+ *
121
+ * @param instruction
122
+ */
123
+ unPlan(instruction: AreInstruction): void;
124
+ /**
125
+ * Checks if the instruction is already in the plan, so it will be rendered in the next render cycle.
126
+ *
127
+ * @param instruction
128
+ * @returns
129
+ */
130
+ getPlanned(instruction: AreInstruction): AreInstruction | undefined;
131
+ /**
132
+ * Checks if the instruction is already in the plan, so it will be rendered in the next render cycle.
133
+ *
134
+ * @param instruction
135
+ * @returns
136
+ */
137
+ isInPlan(instruction: AreInstruction): boolean;
138
+ /**
139
+ * 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.
140
+ *
141
+ * @param instruction
142
+ */
143
+ apply(instruction: AreInstruction): void;
144
+ /**
145
+ * 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.
146
+ *
147
+ * @param instruction
148
+ */
149
+ unApply(instruction: AreInstruction): void;
150
+ /**
151
+ * Checks if the instruction is already in the state, so it is currently applied to the scene.
152
+ *
153
+ * @param instruction
154
+ * @returns
155
+ */
156
+ getApplied(instruction: AreInstruction): AreInstruction | undefined;
157
+ /**
158
+ * Checks if the instruction is already in the state, so it is currently applied to the scene.
159
+ *
160
+ * @param instruction
161
+ * @returns
162
+ */
163
+ isApplied(instruction: AreInstruction): boolean;
164
+ /**
165
+ * 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.
166
+ *
167
+ */
168
+ reset(): void;
169
+ }
170
+
171
+ export { AreScene };