@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.
- package/LICENSE +10 -19
- package/README.md +14 -2
- package/dist/browser/index.d.mts +843 -751
- package/dist/browser/index.mjs +2729 -2481
- package/dist/browser/index.mjs.map +1 -1
- package/dist/node/AreInstruction.entity-Ceyy0tbf.d.mts +163 -0
- package/dist/node/AreInstruction.entity-Ceyy0tbf.d.ts +163 -0
- package/dist/node/index.d.mts +37 -1
- package/dist/node/index.d.ts +37 -1
- package/dist/node/index.js +28 -0
- package/dist/node/index.mjs +4 -0
- package/dist/node/lib/AreAttribute/AreAttribute.entity.d.mts +80 -13
- package/dist/node/lib/AreAttribute/AreAttribute.entity.d.ts +80 -13
- package/dist/node/lib/AreCompiler/AreCompiler.component.d.mts +3 -13
- package/dist/node/lib/AreCompiler/AreCompiler.component.d.ts +3 -13
- package/dist/node/lib/AreComponent/Are.context.d.mts +64 -14
- package/dist/node/lib/AreComponent/Are.context.d.ts +64 -14
- package/dist/node/lib/AreEngine/AreEngine.component.d.mts +9 -23
- package/dist/node/lib/AreEngine/AreEngine.component.d.ts +9 -23
- package/dist/node/lib/AreEngine/AreEngine.types.d.mts +9 -25
- package/dist/node/lib/AreEngine/AreEngine.types.d.ts +9 -25
- package/dist/node/lib/AreInstruction/AreInstruction.entity.d.mts +3 -13
- package/dist/node/lib/AreInstruction/AreInstruction.entity.d.ts +3 -13
- package/dist/node/lib/AreInstruction/AreInstruction.types.d.mts +3 -13
- package/dist/node/lib/AreInstruction/AreInstruction.types.d.ts +3 -13
- package/dist/node/lib/AreInstruction/types/AreDeclaration.instruction.d.mts +37 -14
- package/dist/node/lib/AreInstruction/types/AreDeclaration.instruction.d.ts +37 -14
- package/dist/node/lib/AreInstruction/types/AreMutation.instruction.d.mts +29 -14
- package/dist/node/lib/AreInstruction/types/AreMutation.instruction.d.ts +29 -14
- package/dist/node/lib/AreInterpreter/AreInterpreter.component.d.mts +3 -13
- package/dist/node/lib/AreInterpreter/AreInterpreter.component.d.ts +3 -13
- package/dist/node/lib/AreLifecycle/AreLifecycle.component.d.mts +4 -13
- package/dist/node/lib/AreLifecycle/AreLifecycle.component.d.ts +4 -13
- package/dist/node/lib/AreLoader/AreLoader.component.d.mts +2 -13
- package/dist/node/lib/AreLoader/AreLoader.component.d.ts +2 -13
- package/dist/node/lib/AreNode/AreNode.entity.d.mts +197 -13
- package/dist/node/lib/AreNode/AreNode.entity.d.ts +197 -13
- package/dist/node/lib/AreNode/AreNode.types.d.mts +8 -14
- package/dist/node/lib/AreNode/AreNode.types.d.ts +8 -14
- package/dist/node/lib/AreScene/AreScene.context.d.mts +170 -13
- package/dist/node/lib/AreScene/AreScene.context.d.ts +170 -13
- package/dist/node/lib/AreScene/AreScene.types.d.mts +21 -14
- package/dist/node/lib/AreScene/AreScene.types.d.ts +21 -14
- package/dist/node/lib/AreSignals/AreSignals.component.d.mts +3 -12
- package/dist/node/lib/AreSignals/AreSignals.component.d.ts +3 -12
- package/dist/node/lib/AreSignals/AreSignals.context.d.mts +2 -12
- package/dist/node/lib/AreSignals/AreSignals.context.d.ts +2 -12
- package/dist/node/lib/AreSignals/AreSignals.meta.d.mts +1 -3
- package/dist/node/lib/AreSignals/AreSignals.meta.d.ts +1 -3
- package/dist/node/lib/AreSignals/AreSignals.types.d.mts +1 -3
- package/dist/node/lib/AreSignals/AreSignals.types.d.ts +1 -3
- package/dist/node/lib/AreSignals/entities/AreInit.signal.d.mts +1 -2
- package/dist/node/lib/AreSignals/entities/AreInit.signal.d.ts +1 -2
- package/dist/node/lib/AreSignals/entities/AreRoute.signal.d.mts +1 -1
- package/dist/node/lib/AreSignals/entities/AreRoute.signal.d.ts +1 -1
- package/dist/node/lib/AreStore/AreStore.context.d.mts +54 -13
- package/dist/node/lib/AreStore/AreStore.context.d.ts +54 -13
- package/dist/node/lib/AreSyntax/AreSyntax.context.d.mts +10 -12
- package/dist/node/lib/AreSyntax/AreSyntax.context.d.ts +10 -12
- package/dist/node/lib/AreSyntax/AreSyntax.types.d.mts +79 -14
- package/dist/node/lib/AreSyntax/AreSyntax.types.d.ts +79 -14
- package/dist/node/lib/AreTokenizer/AreTokenizer.component.d.mts +4 -14
- package/dist/node/lib/AreTokenizer/AreTokenizer.component.d.ts +4 -14
- package/dist/node/lib/AreTransformer/AreTransformer.component.d.mts +2 -13
- package/dist/node/lib/AreTransformer/AreTransformer.component.d.ts +2 -13
- package/package.json +32 -17
- package/src/index.ts +6 -0
- package/dist/node/Are.context-9Ija_fdC.d.ts +0 -846
- package/dist/node/Are.context-D7w32H1G.d.mts +0 -846
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import '@adaas/a-concept';
|
|
2
|
-
|
|
3
|
-
import '
|
|
4
|
-
import '
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { A_TYPES__Fragment_Serialized } from '@adaas/a-concept';
|
|
2
|
+
import { AreInstruction } from '@adaas/are/instruction/AreInstruction.entity';
|
|
3
|
+
import { AreInstructionSerialized } from '@adaas/are/instruction/AreInstruction.types';
|
|
4
|
+
import { AreSceneStatuses } from './AreScene.constants.mjs';
|
|
5
|
+
|
|
6
|
+
type AreSceneChanges = {
|
|
7
|
+
/**
|
|
8
|
+
* 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
|
|
9
|
+
*/
|
|
10
|
+
toApply: AreInstruction[];
|
|
11
|
+
/**
|
|
12
|
+
* 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.
|
|
13
|
+
*/
|
|
14
|
+
toRevert: AreInstruction[];
|
|
15
|
+
};
|
|
16
|
+
type AreScene_Serialized = {
|
|
17
|
+
instructions: AreInstructionSerialized[];
|
|
18
|
+
} & A_TYPES__Fragment_Serialized;
|
|
19
|
+
type AreSceneStatusNames = typeof AreSceneStatuses[keyof typeof AreSceneStatuses];
|
|
20
|
+
|
|
21
|
+
export type { AreSceneChanges, AreSceneStatusNames, AreScene_Serialized };
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import '@adaas/a-concept';
|
|
2
|
-
|
|
3
|
-
import '
|
|
4
|
-
import '
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { A_TYPES__Fragment_Serialized } from '@adaas/a-concept';
|
|
2
|
+
import { AreInstruction } from '@adaas/are/instruction/AreInstruction.entity';
|
|
3
|
+
import { AreInstructionSerialized } from '@adaas/are/instruction/AreInstruction.types';
|
|
4
|
+
import { AreSceneStatuses } from './AreScene.constants.js';
|
|
5
|
+
|
|
6
|
+
type AreSceneChanges = {
|
|
7
|
+
/**
|
|
8
|
+
* 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
|
|
9
|
+
*/
|
|
10
|
+
toApply: AreInstruction[];
|
|
11
|
+
/**
|
|
12
|
+
* 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.
|
|
13
|
+
*/
|
|
14
|
+
toRevert: AreInstruction[];
|
|
15
|
+
};
|
|
16
|
+
type AreScene_Serialized = {
|
|
17
|
+
instructions: AreInstructionSerialized[];
|
|
18
|
+
} & A_TYPES__Fragment_Serialized;
|
|
19
|
+
type AreSceneStatusNames = typeof AreSceneStatuses[keyof typeof AreSceneStatuses];
|
|
20
|
+
|
|
21
|
+
export type { AreSceneChanges, AreSceneStatusNames, AreScene_Serialized };
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
import { A_Component, A_Scope, A_Feature } from '@adaas/a-concept';
|
|
2
2
|
import { A_SignalVector, A_SignalState } from '@adaas/a-utils/a-signal';
|
|
3
3
|
import { A_Logger } from '@adaas/a-utils/a-logger';
|
|
4
|
-
import {
|
|
5
|
-
import { AreEvent } from '
|
|
4
|
+
import { AreNode } from '@adaas/are/node/AreNode.entity';
|
|
5
|
+
import { AreEvent } from '@adaas/are/event/AreEvent.context';
|
|
6
6
|
import { AreSignalsContext } from './AreSignals.context.mjs';
|
|
7
|
-
import '
|
|
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';
|
|
15
|
-
import '@adaas/a-utils/a-execution';
|
|
16
|
-
import '../AreNode/AreNode.constants.mjs';
|
|
7
|
+
import '@adaas/are/component/Are.component';
|
|
17
8
|
import './AreSignals.types.mjs';
|
|
18
9
|
import './AreSignals.meta.mjs';
|
|
19
10
|
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
import { A_Component, A_Scope, A_Feature } from '@adaas/a-concept';
|
|
2
2
|
import { A_SignalVector, A_SignalState } from '@adaas/a-utils/a-signal';
|
|
3
3
|
import { A_Logger } from '@adaas/a-utils/a-logger';
|
|
4
|
-
import {
|
|
5
|
-
import { AreEvent } from '
|
|
4
|
+
import { AreNode } from '@adaas/are/node/AreNode.entity';
|
|
5
|
+
import { AreEvent } from '@adaas/are/event/AreEvent.context';
|
|
6
6
|
import { AreSignalsContext } from './AreSignals.context.js';
|
|
7
|
-
import '
|
|
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';
|
|
15
|
-
import '@adaas/a-utils/a-execution';
|
|
16
|
-
import '../AreNode/AreNode.constants.js';
|
|
7
|
+
import '@adaas/are/component/Are.component';
|
|
17
8
|
import './AreSignals.types.js';
|
|
18
9
|
import './AreSignals.meta.js';
|
|
19
10
|
|
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
import { A_Fragment, A_TYPES__Ctor } from '@adaas/a-concept';
|
|
2
2
|
import { A_SignalVector } from '@adaas/a-utils/a-signal';
|
|
3
|
-
import { Are } from '
|
|
3
|
+
import { Are } from '@adaas/are/component/Are.component';
|
|
4
4
|
import { AreSignalsContextConfig } from './AreSignals.types.mjs';
|
|
5
|
-
import {
|
|
5
|
+
import { AreNode } from '@adaas/are/node/AreNode.entity';
|
|
6
6
|
import { AreSignalsMeta } from './AreSignals.meta.mjs';
|
|
7
|
-
import '../AreComponent/Are.types.mjs';
|
|
8
|
-
import '../AreComponent/Are.constants.mjs';
|
|
9
|
-
import '../AreEvent/AreEvent.context.mjs';
|
|
10
|
-
import '@adaas/a-utils/a-execution';
|
|
11
|
-
import '../AreStore/AreStore.types.mjs';
|
|
12
|
-
import '../AreStore/AreStore.constants.mjs';
|
|
13
|
-
import '../AreScene/AreScene.constants.mjs';
|
|
14
|
-
import '../AreAttribute/AreAttribute.types.mjs';
|
|
15
|
-
import '../AreAttribute/AreAttribute.constants.mjs';
|
|
16
|
-
import '../AreNode/AreNode.constants.mjs';
|
|
17
7
|
|
|
18
8
|
declare class AreSignalsContext<T extends Are = Are> extends A_Fragment {
|
|
19
9
|
/**
|
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
import { A_Fragment, A_TYPES__Ctor } from '@adaas/a-concept';
|
|
2
2
|
import { A_SignalVector } from '@adaas/a-utils/a-signal';
|
|
3
|
-
import { Are } from '
|
|
3
|
+
import { Are } from '@adaas/are/component/Are.component';
|
|
4
4
|
import { AreSignalsContextConfig } from './AreSignals.types.js';
|
|
5
|
-
import {
|
|
5
|
+
import { AreNode } from '@adaas/are/node/AreNode.entity';
|
|
6
6
|
import { AreSignalsMeta } from './AreSignals.meta.js';
|
|
7
|
-
import '../AreComponent/Are.types.js';
|
|
8
|
-
import '../AreComponent/Are.constants.js';
|
|
9
|
-
import '../AreEvent/AreEvent.context.js';
|
|
10
|
-
import '@adaas/a-utils/a-execution';
|
|
11
|
-
import '../AreStore/AreStore.types.js';
|
|
12
|
-
import '../AreStore/AreStore.constants.js';
|
|
13
|
-
import '../AreScene/AreScene.constants.js';
|
|
14
|
-
import '../AreAttribute/AreAttribute.types.js';
|
|
15
|
-
import '../AreAttribute/AreAttribute.constants.js';
|
|
16
|
-
import '../AreNode/AreNode.constants.js';
|
|
17
7
|
|
|
18
8
|
declare class AreSignalsContext<T extends Are = Are> extends A_Fragment {
|
|
19
9
|
/**
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { A_ComponentMeta, A_TYPES__Ctor, A_TYPES__ComponentMeta } from '@adaas/a-concept';
|
|
2
2
|
import { A_SignalVector } from '@adaas/a-utils/a-signal';
|
|
3
|
-
import { Are } from '
|
|
4
|
-
import '../AreComponent/Are.types.mjs';
|
|
5
|
-
import '../AreComponent/Are.constants.mjs';
|
|
3
|
+
import { Are } from '@adaas/are/component/Are.component';
|
|
6
4
|
|
|
7
5
|
declare class AreSignalsMeta extends A_ComponentMeta<{
|
|
8
6
|
vectorToComponent: Map<A_SignalVector, A_TYPES__Ctor<Are>>;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { A_ComponentMeta, A_TYPES__Ctor, A_TYPES__ComponentMeta } from '@adaas/a-concept';
|
|
2
2
|
import { A_SignalVector } from '@adaas/a-utils/a-signal';
|
|
3
|
-
import { Are } from '
|
|
4
|
-
import '../AreComponent/Are.types.js';
|
|
5
|
-
import '../AreComponent/Are.constants.js';
|
|
3
|
+
import { Are } from '@adaas/are/component/Are.component';
|
|
6
4
|
|
|
7
5
|
declare class AreSignalsMeta extends A_ComponentMeta<{
|
|
8
6
|
vectorToComponent: Map<A_SignalVector, A_TYPES__Ctor<Are>>;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { A_TYPES__Ctor } from '@adaas/a-concept';
|
|
2
2
|
import { A_Signal } from '@adaas/a-utils/a-signal';
|
|
3
|
-
import { Are } from '
|
|
4
|
-
import '../AreComponent/Are.types.mjs';
|
|
5
|
-
import '../AreComponent/Are.constants.mjs';
|
|
3
|
+
import { Are } from '@adaas/are/component/Are.component';
|
|
6
4
|
|
|
7
5
|
type AreSignalsContextConfig<T extends Are> = {
|
|
8
6
|
[key in string]: {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { A_TYPES__Ctor } from '@adaas/a-concept';
|
|
2
2
|
import { A_Signal } from '@adaas/a-utils/a-signal';
|
|
3
|
-
import { Are } from '
|
|
4
|
-
import '../AreComponent/Are.types.js';
|
|
5
|
-
import '../AreComponent/Are.constants.js';
|
|
3
|
+
import { Are } from '@adaas/are/component/Are.component';
|
|
6
4
|
|
|
7
5
|
type AreSignalsContextConfig<T extends Are> = {
|
|
8
6
|
[key in string]: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { A_Route } from '@adaas/a-utils/a-route';
|
|
2
2
|
import { A_Signal } from '@adaas/a-utils/a-signal';
|
|
3
|
-
import { AreSignal } from '
|
|
3
|
+
import { AreSignal } from '@adaas/are/signals/AreSignal.entity';
|
|
4
4
|
|
|
5
5
|
declare class AreRoute extends AreSignal<A_Route> {
|
|
6
6
|
constructor(path: string | RegExp);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { A_Route } from '@adaas/a-utils/a-route';
|
|
2
2
|
import { A_Signal } from '@adaas/a-utils/a-signal';
|
|
3
|
-
import { AreSignal } from '
|
|
3
|
+
import { AreSignal } from '@adaas/are/signals/AreSignal.entity';
|
|
4
4
|
|
|
5
5
|
declare class AreRoute extends AreSignal<A_Route> {
|
|
6
6
|
constructor(path: string | RegExp);
|
|
@@ -1,14 +1,55 @@
|
|
|
1
|
-
import '@adaas/a-concept';
|
|
2
|
-
import '@adaas/a-utils/a-execution';
|
|
3
|
-
|
|
4
|
-
import '
|
|
5
|
-
import './AreStore.types.mjs';
|
|
6
|
-
import '@adaas/
|
|
7
|
-
import '../AreEvent/AreEvent.context.mjs';
|
|
8
|
-
import '../AreScene/AreScene.constants.mjs';
|
|
9
|
-
import '../AreAttribute/AreAttribute.types.mjs';
|
|
10
|
-
import '../AreAttribute/AreAttribute.constants.mjs';
|
|
11
|
-
import '../AreNode/AreNode.constants.mjs';
|
|
12
|
-
import '../AreComponent/Are.types.mjs';
|
|
13
|
-
import '../AreComponent/Are.constants.mjs';
|
|
1
|
+
import { ASEID, A_TYPES__Paths } from '@adaas/a-concept';
|
|
2
|
+
import { A_ExecutionContext } from '@adaas/a-utils/a-execution';
|
|
3
|
+
import { AreNode } from '@adaas/are/node/AreNode.entity';
|
|
4
|
+
import { Are } from '@adaas/are/component/Are.component';
|
|
5
|
+
import { AreStoreWatchingEntity, AreStorePathValue } from './AreStore.types.mjs';
|
|
6
|
+
import { AreContext } from '@adaas/are/component/Are.context';
|
|
14
7
|
import './AreStore.constants.mjs';
|
|
8
|
+
|
|
9
|
+
declare class AreStore<T extends Record<string, any> = Record<string, any>> extends A_ExecutionContext<T> {
|
|
10
|
+
protected dependencies: Map<string, Set<AreStoreWatchingEntity>>;
|
|
11
|
+
protected _keys: Set<keyof T>;
|
|
12
|
+
/**
|
|
13
|
+
* 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.
|
|
14
|
+
*/
|
|
15
|
+
static get Function(): <T extends Are>(target: T, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
16
|
+
get owner(): AreNode;
|
|
17
|
+
get parent(): AreStore | undefined;
|
|
18
|
+
get context(): AreContext;
|
|
19
|
+
constructor(aseid: ASEID | string);
|
|
20
|
+
get watchers(): Set<AreStoreWatchingEntity>;
|
|
21
|
+
get keys(): Set<keyof T>;
|
|
22
|
+
watch(instruction: AreStoreWatchingEntity): void;
|
|
23
|
+
unwatch(instruction: AreStoreWatchingEntity): void;
|
|
24
|
+
set<K extends keyof T>(values: Partial<T>): this;
|
|
25
|
+
set<P extends A_TYPES__Paths<T>>(key: P, value: AreStorePathValue<T, P>): this;
|
|
26
|
+
get<K extends keyof T>(key: K): T[K] | undefined;
|
|
27
|
+
protected setAsObject(values: Partial<T>): this;
|
|
28
|
+
protected setAsKeyValue<K extends keyof T, P extends A_TYPES__Paths<T>>(key: K | P, value: T[K] | AreStorePathValue<T, P>): this;
|
|
29
|
+
/**
|
|
30
|
+
* Notifies instructions — immediately or deferred if inside a batch.
|
|
31
|
+
*/
|
|
32
|
+
private notify;
|
|
33
|
+
/**
|
|
34
|
+
* Removes an instruction from all dependency sets.
|
|
35
|
+
* Called when an instruction is reverted/destroyed.
|
|
36
|
+
*/
|
|
37
|
+
unregister(instruction: AreStoreWatchingEntity): void;
|
|
38
|
+
/**
|
|
39
|
+
* Normalizes a path once — reused in both get and set.
|
|
40
|
+
*/
|
|
41
|
+
private normalizePath;
|
|
42
|
+
/**
|
|
43
|
+
* Extracts direct children of the current markup level into typed instances.
|
|
44
|
+
* No tree walking, recursion, or nested parsing — just direct children.
|
|
45
|
+
*/
|
|
46
|
+
extractPathSegments(path: string): string[];
|
|
47
|
+
/**
|
|
48
|
+
* 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.
|
|
49
|
+
*
|
|
50
|
+
* @param component
|
|
51
|
+
*/
|
|
52
|
+
loadExtensions(component: Are): void;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { AreStore };
|
|
@@ -1,14 +1,55 @@
|
|
|
1
|
-
import '@adaas/a-concept';
|
|
2
|
-
import '@adaas/a-utils/a-execution';
|
|
3
|
-
|
|
4
|
-
import '
|
|
5
|
-
import './AreStore.types.js';
|
|
6
|
-
import '@adaas/
|
|
7
|
-
import '../AreEvent/AreEvent.context.js';
|
|
8
|
-
import '../AreScene/AreScene.constants.js';
|
|
9
|
-
import '../AreAttribute/AreAttribute.types.js';
|
|
10
|
-
import '../AreAttribute/AreAttribute.constants.js';
|
|
11
|
-
import '../AreNode/AreNode.constants.js';
|
|
12
|
-
import '../AreComponent/Are.types.js';
|
|
13
|
-
import '../AreComponent/Are.constants.js';
|
|
1
|
+
import { ASEID, A_TYPES__Paths } from '@adaas/a-concept';
|
|
2
|
+
import { A_ExecutionContext } from '@adaas/a-utils/a-execution';
|
|
3
|
+
import { AreNode } from '@adaas/are/node/AreNode.entity';
|
|
4
|
+
import { Are } from '@adaas/are/component/Are.component';
|
|
5
|
+
import { AreStoreWatchingEntity, AreStorePathValue } from './AreStore.types.js';
|
|
6
|
+
import { AreContext } from '@adaas/are/component/Are.context';
|
|
14
7
|
import './AreStore.constants.js';
|
|
8
|
+
|
|
9
|
+
declare class AreStore<T extends Record<string, any> = Record<string, any>> extends A_ExecutionContext<T> {
|
|
10
|
+
protected dependencies: Map<string, Set<AreStoreWatchingEntity>>;
|
|
11
|
+
protected _keys: Set<keyof T>;
|
|
12
|
+
/**
|
|
13
|
+
* 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.
|
|
14
|
+
*/
|
|
15
|
+
static get Function(): <T extends Are>(target: T, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
16
|
+
get owner(): AreNode;
|
|
17
|
+
get parent(): AreStore | undefined;
|
|
18
|
+
get context(): AreContext;
|
|
19
|
+
constructor(aseid: ASEID | string);
|
|
20
|
+
get watchers(): Set<AreStoreWatchingEntity>;
|
|
21
|
+
get keys(): Set<keyof T>;
|
|
22
|
+
watch(instruction: AreStoreWatchingEntity): void;
|
|
23
|
+
unwatch(instruction: AreStoreWatchingEntity): void;
|
|
24
|
+
set<K extends keyof T>(values: Partial<T>): this;
|
|
25
|
+
set<P extends A_TYPES__Paths<T>>(key: P, value: AreStorePathValue<T, P>): this;
|
|
26
|
+
get<K extends keyof T>(key: K): T[K] | undefined;
|
|
27
|
+
protected setAsObject(values: Partial<T>): this;
|
|
28
|
+
protected setAsKeyValue<K extends keyof T, P extends A_TYPES__Paths<T>>(key: K | P, value: T[K] | AreStorePathValue<T, P>): this;
|
|
29
|
+
/**
|
|
30
|
+
* Notifies instructions — immediately or deferred if inside a batch.
|
|
31
|
+
*/
|
|
32
|
+
private notify;
|
|
33
|
+
/**
|
|
34
|
+
* Removes an instruction from all dependency sets.
|
|
35
|
+
* Called when an instruction is reverted/destroyed.
|
|
36
|
+
*/
|
|
37
|
+
unregister(instruction: AreStoreWatchingEntity): void;
|
|
38
|
+
/**
|
|
39
|
+
* Normalizes a path once — reused in both get and set.
|
|
40
|
+
*/
|
|
41
|
+
private normalizePath;
|
|
42
|
+
/**
|
|
43
|
+
* Extracts direct children of the current markup level into typed instances.
|
|
44
|
+
* No tree walking, recursion, or nested parsing — just direct children.
|
|
45
|
+
*/
|
|
46
|
+
extractPathSegments(path: string): string[];
|
|
47
|
+
/**
|
|
48
|
+
* 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.
|
|
49
|
+
*
|
|
50
|
+
* @param component
|
|
51
|
+
*/
|
|
52
|
+
loadExtensions(component: Are): void;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { AreStore };
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { A_Fragment } from '@adaas/a-concept';
|
|
2
|
-
import {
|
|
3
|
-
import '
|
|
4
|
-
import '
|
|
5
|
-
import '@adaas/
|
|
6
|
-
import '
|
|
7
|
-
import '
|
|
8
|
-
import '
|
|
9
|
-
import '../
|
|
10
|
-
import '
|
|
11
|
-
import '../AreComponent/Are.component.mjs';
|
|
12
|
-
import '../AreComponent/Are.types.mjs';
|
|
13
|
-
import '../AreComponent/Are.constants.mjs';
|
|
2
|
+
import { AreNode } from '../AreNode/AreNode.entity.mjs';
|
|
3
|
+
import { AreSyntaxInitOptions, AreSyntaxTokenRules, AreSyntaxCompiledExpression } from './AreSyntax.types.mjs';
|
|
4
|
+
import { AreStore } from '@adaas/are/store/AreStore.context';
|
|
5
|
+
import '@adaas/are/event/AreEvent.context';
|
|
6
|
+
import '@adaas/are/scene/AreScene.context';
|
|
7
|
+
import '@adaas/are/attribute/AreAttribute.entity';
|
|
8
|
+
import '@adaas/are/component/Are.component';
|
|
9
|
+
import '../AreNode/AreNode.types.mjs';
|
|
10
|
+
import '@adaas/are/syntax/AreSyntax.types';
|
|
14
11
|
import '../AreNode/AreNode.constants.mjs';
|
|
12
|
+
import '@adaas/are/node/AreNode.entity';
|
|
15
13
|
|
|
16
14
|
declare class AreSyntax extends A_Fragment {
|
|
17
15
|
/**
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { A_Fragment } from '@adaas/a-concept';
|
|
2
|
-
import {
|
|
3
|
-
import '
|
|
4
|
-
import '
|
|
5
|
-
import '@adaas/
|
|
6
|
-
import '
|
|
7
|
-
import '
|
|
8
|
-
import '
|
|
9
|
-
import '../
|
|
10
|
-
import '
|
|
11
|
-
import '../AreComponent/Are.component.js';
|
|
12
|
-
import '../AreComponent/Are.types.js';
|
|
13
|
-
import '../AreComponent/Are.constants.js';
|
|
2
|
+
import { AreNode } from '../AreNode/AreNode.entity.js';
|
|
3
|
+
import { AreSyntaxInitOptions, AreSyntaxTokenRules, AreSyntaxCompiledExpression } from './AreSyntax.types.js';
|
|
4
|
+
import { AreStore } from '@adaas/are/store/AreStore.context';
|
|
5
|
+
import '@adaas/are/event/AreEvent.context';
|
|
6
|
+
import '@adaas/are/scene/AreScene.context';
|
|
7
|
+
import '@adaas/are/attribute/AreAttribute.entity';
|
|
8
|
+
import '@adaas/are/component/Are.component';
|
|
9
|
+
import '../AreNode/AreNode.types.js';
|
|
10
|
+
import '@adaas/are/syntax/AreSyntax.types';
|
|
14
11
|
import '../AreNode/AreNode.constants.js';
|
|
12
|
+
import '@adaas/are/node/AreNode.entity';
|
|
15
13
|
|
|
16
14
|
declare class AreSyntax extends A_Fragment {
|
|
17
15
|
/**
|
|
@@ -1,14 +1,79 @@
|
|
|
1
|
-
import '@adaas/a-concept';
|
|
2
|
-
|
|
3
|
-
import '@adaas/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { A_TYPES__Entity_Constructor } from '@adaas/a-concept';
|
|
2
|
+
import { AreNode } from '@adaas/are/node/AreNode.entity';
|
|
3
|
+
import { AreStore } from '@adaas/are/store/AreStore.context';
|
|
4
|
+
|
|
5
|
+
interface AreSyntaxTokenRules<T extends AreNode = AreNode> {
|
|
6
|
+
/** Opening delimiter e.g. '<', '{{', '<!--', '{' */
|
|
7
|
+
opening?: string;
|
|
8
|
+
/** Closing delimiter e.g. '>', '}}', '-->', '}' */
|
|
9
|
+
closing?: string;
|
|
10
|
+
/** Optional self-closing marker e.g. '/>' */
|
|
11
|
+
selfClosing?: string;
|
|
12
|
+
/** Regex that must match content immediately before the opening delimiter */
|
|
13
|
+
prefix?: RegExp;
|
|
14
|
+
/** Replaces open/close entirely — matches entire pattern via RegExp */
|
|
15
|
+
pattern?: RegExp;
|
|
16
|
+
/**
|
|
17
|
+
* Fully custom matcher — complete control over how a token is found.
|
|
18
|
+
* Receives (source, from, to, build) where build(raw, content, position, closing)
|
|
19
|
+
* constructs the AreSyntaxTokenMatch. Return null if no match found.
|
|
20
|
+
*/
|
|
21
|
+
matcher?: (source: string, from: number, to: number, build: (raw: string, content: string, position: number, closing: string) => AreSyntaxTokenMatch) => AreSyntaxTokenMatch | null;
|
|
22
|
+
/** Constructor to instantiate when this rule matches */
|
|
23
|
+
component: A_TYPES__Entity_Constructor<T>;
|
|
24
|
+
/** Higher = checked first. Default: 0 */
|
|
25
|
+
priority?: number;
|
|
26
|
+
/** Whether this token can contain nested tokens of same open/close. Default: true */
|
|
27
|
+
nested?: boolean;
|
|
28
|
+
/** Custom data extractor — called after match, result stored in match.meta */
|
|
29
|
+
extract?: (raw: string, match: AreSyntaxTokenMatch) => Record<string, any>;
|
|
30
|
+
}
|
|
31
|
+
type AreSyntaxTokenPayload = {
|
|
32
|
+
/**
|
|
33
|
+
* Allows to override ASEID generation for this token match. Useful when the token corresponds to an existing entity or needs a stable ID across parses. If not provided, ASEID will be generated based on position and content.
|
|
34
|
+
*/
|
|
35
|
+
id?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Allows to override the entity type for this token match. Useful when the token corresponds to an existing entity or needs a specific entity type across parses. If not provided, the entity type will be inferred from the token.
|
|
38
|
+
*/
|
|
39
|
+
entity?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Allows to override the scope for this token match. Useful when the token corresponds to an existing entity or needs a specific scope across parses. If not provided, the scope will be generated based on position and content.
|
|
42
|
+
*/
|
|
43
|
+
scope?: string;
|
|
44
|
+
[key: string]: any;
|
|
45
|
+
};
|
|
46
|
+
interface AreSyntaxTokenMatch {
|
|
47
|
+
/** Full matched string including delimiters */
|
|
48
|
+
raw: string;
|
|
49
|
+
/** Content between delimiters */
|
|
50
|
+
content: string;
|
|
51
|
+
/** The opening delimiter that matched */
|
|
52
|
+
opening: string;
|
|
53
|
+
/** The closing delimiter that matched */
|
|
54
|
+
closing: string;
|
|
55
|
+
/** Start position in source string */
|
|
56
|
+
position: number;
|
|
57
|
+
/** Data extracted via rule.extract */
|
|
58
|
+
payload: AreSyntaxTokenPayload;
|
|
59
|
+
/** @internal – the rule that produced this match (used by instantiate) */
|
|
60
|
+
_rule?: AreSyntaxTokenRules;
|
|
61
|
+
}
|
|
62
|
+
interface AreSyntaxInitOptions {
|
|
63
|
+
/**
|
|
64
|
+
* Array of token rules defining the syntax to be parsed. 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.
|
|
65
|
+
*/
|
|
66
|
+
rules: AreSyntaxTokenRules[];
|
|
67
|
+
/**
|
|
68
|
+
* Whether to trim leading/trailing whitespace from token content. Default: true. 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.
|
|
69
|
+
*/
|
|
70
|
+
trimWhitespace?: boolean;
|
|
71
|
+
/** Throw on unclosed tokens. Default: true */
|
|
72
|
+
strictMode?: boolean;
|
|
73
|
+
}
|
|
74
|
+
type AreSyntaxCompiledExpression = {
|
|
75
|
+
execute: (store: AreStore, scope?: Record<string, any>) => any;
|
|
76
|
+
isCallable: boolean;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export type { AreSyntaxCompiledExpression, AreSyntaxInitOptions, AreSyntaxTokenMatch, AreSyntaxTokenPayload, AreSyntaxTokenRules };
|