dirvi-lib 0.8.0 → 0.8.2
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/dist/app/app-api.d.ts +74 -0
- package/dist/app/app-api.d.ts.map +1 -0
- package/dist/app/app-api.js +11 -0
- package/dist/app/effect-to-action.d.ts +6 -0
- package/dist/app/effect-to-action.d.ts.map +1 -0
- package/dist/app/effect-to-action.js +74 -0
- package/dist/app/index.d.ts +6 -0
- package/dist/app/index.d.ts.map +1 -0
- package/dist/app/index.js +5 -0
- package/dist/app/reducer-action.d.ts +22 -0
- package/dist/app/reducer-action.d.ts.map +1 -0
- package/dist/app/reducer.d.ts +5 -0
- package/dist/app/reducer.d.ts.map +1 -0
- package/dist/app/reducer.js +79 -0
- package/dist/app/view-api.d.ts +11 -0
- package/dist/app/view-api.d.ts.map +1 -0
- package/dist/index.d.ts +4 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -7
- package/dist/input/application/index.d.ts.map +1 -0
- package/dist/input/application/intent-to-effect-no-state.test.d.ts.map +1 -0
- package/dist/input/application/intent-to-effect.d.ts +14 -0
- package/dist/input/application/intent-to-effect.d.ts.map +1 -0
- package/dist/{tree-surfer-ui → input}/application/intent-to-effect.js +36 -17
- package/dist/input/application/parse-command.d.ts +14 -0
- package/dist/input/application/parse-command.d.ts.map +1 -0
- package/dist/{tree-surfer-ui → input}/application/parse-command.js +13 -1
- package/dist/input/application/user-input-to-intent.d.ts.map +1 -0
- package/dist/input/application/user-input-to-intent.test.d.ts.map +1 -0
- package/dist/input/domain/effect.d.ts +55 -0
- package/dist/input/domain/effect.d.ts.map +1 -0
- package/dist/input/domain/index.d.ts.map +1 -0
- package/dist/input/domain/input-mode-state.d.ts.map +1 -0
- package/dist/input/domain/intent.d.ts.map +1 -0
- package/dist/input/domain/user-input.d.ts.map +1 -0
- package/dist/trees/cursor.d.ts.map +1 -0
- package/dist/trees/fold-node/deprecated/fold-node.impl.d.ts +10 -0
- package/dist/trees/fold-node/deprecated/fold-node.impl.d.ts.map +1 -0
- package/dist/trees/fold-node/deprecated/fold-node.impl.js +248 -0
- package/dist/trees/fold-node/deprecated/fold-node.test.d.ts +2 -0
- package/dist/trees/fold-node/deprecated/fold-node.test.d.ts.map +1 -0
- package/dist/trees/fold-node/deprecated/fold-node.test.js +130 -0
- package/dist/{tree-surfer/fold-node → trees/fold-node/deprecated}/fold-node.types.d.ts +15 -76
- package/dist/trees/fold-node/deprecated/fold-node.types.d.ts.map +1 -0
- package/dist/trees/fold-node/fold-node.impl.d.ts +16 -0
- package/dist/trees/fold-node/fold-node.impl.d.ts.map +1 -0
- package/dist/trees/fold-node/fold-node.impl.js +451 -0
- package/dist/trees/fold-node/fold-node.model.d.ts +120 -0
- package/dist/trees/fold-node/fold-node.model.d.ts.map +1 -0
- package/dist/trees/fold-node/fold-node.model.js +80 -0
- package/dist/trees/fold-node/fold-node.types.d.ts +206 -0
- package/dist/trees/fold-node/fold-node.types.d.ts.map +1 -0
- package/dist/trees/fold-node/index.d.ts +4 -0
- package/dist/trees/fold-node/index.d.ts.map +1 -0
- package/dist/trees/fold-node/index.js +3 -0
- package/dist/trees/index.d.ts +9 -0
- package/dist/trees/index.d.ts.map +1 -0
- package/dist/trees/index.js +8 -0
- package/dist/trees/nav-node/nav-node.impl.d.ts +29 -0
- package/dist/trees/nav-node/nav-node.impl.d.ts.map +1 -0
- package/dist/{tree-surfer → trees}/nav-node/nav-node.impl.js +89 -42
- package/dist/trees/nav-node/nav-node.types.d.ts +103 -0
- package/dist/trees/nav-node/nav-node.types.d.ts.map +1 -0
- package/dist/trees/state/state.impl.d.ts +8 -0
- package/dist/trees/state/state.impl.d.ts.map +1 -0
- package/dist/trees/state/state.impl.js +128 -0
- package/dist/trees/state/state.schemas.d.ts +25 -0
- package/dist/trees/state/state.schemas.d.ts.map +1 -0
- package/dist/trees/state/state.schemas.js +17 -0
- package/dist/trees/state/state.types.d.ts +36 -0
- package/dist/trees/state/state.types.d.ts.map +1 -0
- package/dist/trees/state/state.types.js +1 -0
- package/dist/trees/tree-node/deprecated/tree-node.arb.d.ts.map +1 -0
- package/dist/trees/tree-node/deprecated/tree-node.arb.debug.test.d.ts.map +1 -0
- package/dist/{tree-surfer/tree-node → trees/tree-node/deprecated}/tree-node.arb.debug.test.js +1 -1
- package/dist/trees/tree-node/deprecated/tree-node.impl.d.ts.map +1 -0
- package/dist/trees/tree-node/deprecated/tree-node.schemas.d.ts.map +1 -0
- package/dist/trees/tree-node/deprecated/tree-node.test.d.ts.map +1 -0
- package/dist/trees/tree-node/deprecated/tree-node.types.d.ts.map +1 -0
- package/dist/trees/tree-node/deprecated/tree-node.types.js +1 -0
- package/dist/trees/tree-node/index.d.ts +4 -0
- package/dist/trees/tree-node/index.d.ts.map +1 -0
- package/dist/trees/tree-node/index.js +3 -0
- package/dist/trees/tree-node/tree-node.arb.d.ts +104 -0
- package/dist/trees/tree-node/tree-node.arb.d.ts.map +1 -0
- package/dist/trees/tree-node/tree-node.arb.js +191 -0
- package/dist/trees/tree-node/tree-node.impl.d.ts +15 -0
- package/dist/trees/tree-node/tree-node.impl.d.ts.map +1 -0
- package/dist/trees/tree-node/tree-node.impl.js +286 -0
- package/dist/trees/tree-node/tree-node.model.d.ts +78 -0
- package/dist/trees/tree-node/tree-node.model.d.ts.map +1 -0
- package/dist/trees/tree-node/tree-node.model.js +37 -0
- package/dist/trees/tree-node/tree-node.types.d.ts +419 -0
- package/dist/trees/tree-node/tree-node.types.d.ts.map +1 -0
- package/dist/trees/tree-node/tree-node.types.js +1 -0
- package/package.json +1 -1
- package/dist/tree-surfer/cursor.d.ts.map +0 -1
- package/dist/tree-surfer/fold-node/fold-node.arb.d.ts +0 -2
- package/dist/tree-surfer/fold-node/fold-node.arb.d.ts.map +0 -1
- package/dist/tree-surfer/fold-node/fold-node.impl.d.ts +0 -4
- package/dist/tree-surfer/fold-node/fold-node.impl.d.ts.map +0 -1
- package/dist/tree-surfer/fold-node/fold-node.impl.js +0 -149
- package/dist/tree-surfer/fold-node/fold-node.schema.d.ts +0 -5
- package/dist/tree-surfer/fold-node/fold-node.schema.d.ts.map +0 -1
- package/dist/tree-surfer/fold-node/fold-node.schema.js +0 -9
- package/dist/tree-surfer/fold-node/fold-node.types.d.ts.map +0 -1
- package/dist/tree-surfer/fold-node/tree-node.test.d.ts.map +0 -1
- package/dist/tree-surfer/fold-node/tree-node.test.js +0 -90
- package/dist/tree-surfer/index.d.ts +0 -13
- package/dist/tree-surfer/index.d.ts.map +0 -1
- package/dist/tree-surfer/index.js +0 -12
- package/dist/tree-surfer/nav-node/nav-node.impl.d.ts +0 -6
- package/dist/tree-surfer/nav-node/nav-node.impl.d.ts.map +0 -1
- package/dist/tree-surfer/nav-node/nav-node.types.d.ts +0 -70
- package/dist/tree-surfer/nav-node/nav-node.types.d.ts.map +0 -1
- package/dist/tree-surfer/state/state.impl.d.ts +0 -7
- package/dist/tree-surfer/state/state.impl.d.ts.map +0 -1
- package/dist/tree-surfer/state/state.impl.js +0 -89
- package/dist/tree-surfer/state/state.schemas.d.ts +0 -9
- package/dist/tree-surfer/state/state.schemas.d.ts.map +0 -1
- package/dist/tree-surfer/state/state.schemas.js +0 -8
- package/dist/tree-surfer/state/state.types.d.ts +0 -21
- package/dist/tree-surfer/state/state.types.d.ts.map +0 -1
- package/dist/tree-surfer/tree-node/tree-node.arb.d.ts.map +0 -1
- package/dist/tree-surfer/tree-node/tree-node.arb.debug.test.d.ts.map +0 -1
- package/dist/tree-surfer/tree-node/tree-node.impl.d.ts.map +0 -1
- package/dist/tree-surfer/tree-node/tree-node.schemas.d.ts.map +0 -1
- package/dist/tree-surfer/tree-node/tree-node.test.d.ts +0 -2
- package/dist/tree-surfer/tree-node/tree-node.test.d.ts.map +0 -1
- package/dist/tree-surfer/tree-node/tree-node.types.d.ts.map +0 -1
- package/dist/tree-surfer-ui/application/index.d.ts.map +0 -1
- package/dist/tree-surfer-ui/application/intent-to-effect-no-state.test.d.ts.map +0 -1
- package/dist/tree-surfer-ui/application/intent-to-effect.d.ts +0 -10
- package/dist/tree-surfer-ui/application/intent-to-effect.d.ts.map +0 -1
- package/dist/tree-surfer-ui/application/parse-command.d.ts +0 -4
- package/dist/tree-surfer-ui/application/parse-command.d.ts.map +0 -1
- package/dist/tree-surfer-ui/application/user-input-to-intent.d.ts.map +0 -1
- package/dist/tree-surfer-ui/application/user-input-to-intent.test.d.ts.map +0 -1
- package/dist/tree-surfer-ui/domain/effect.d.ts +0 -43
- package/dist/tree-surfer-ui/domain/effect.d.ts.map +0 -1
- package/dist/tree-surfer-ui/domain/index.d.ts.map +0 -1
- package/dist/tree-surfer-ui/domain/input-mode-state.d.ts.map +0 -1
- package/dist/tree-surfer-ui/domain/intent.d.ts.map +0 -1
- package/dist/tree-surfer-ui/domain/user-input.d.ts.map +0 -1
- /package/dist/{tree-surfer-ui/domain/effect.js → app/reducer-action.js} +0 -0
- /package/dist/{tree-surfer-ui/domain/input-mode-state.js → app/view-api.js} +0 -0
- /package/dist/{tree-surfer-ui → input}/application/index.d.ts +0 -0
- /package/dist/{tree-surfer-ui → input}/application/index.js +0 -0
- /package/dist/{tree-surfer-ui → input}/application/intent-to-effect-no-state.test.d.ts +0 -0
- /package/dist/{tree-surfer-ui → input}/application/intent-to-effect-no-state.test.js +0 -0
- /package/dist/{tree-surfer-ui → input}/application/user-input-to-intent.d.ts +0 -0
- /package/dist/{tree-surfer-ui → input}/application/user-input-to-intent.js +0 -0
- /package/dist/{tree-surfer-ui → input}/application/user-input-to-intent.test.d.ts +0 -0
- /package/dist/{tree-surfer-ui → input}/application/user-input-to-intent.test.js +0 -0
- /package/dist/{tree-surfer-ui/domain/intent.js → input/domain/effect.js} +0 -0
- /package/dist/{tree-surfer-ui → input}/domain/index.d.ts +0 -0
- /package/dist/{tree-surfer-ui → input}/domain/index.js +0 -0
- /package/dist/{tree-surfer-ui → input}/domain/input-mode-state.d.ts +0 -0
- /package/dist/{tree-surfer-ui/domain/user-input.js → input/domain/input-mode-state.js} +0 -0
- /package/dist/{tree-surfer-ui → input}/domain/intent.d.ts +0 -0
- /package/dist/{tree-surfer/fold-node/fold-node.arb.js → input/domain/intent.js} +0 -0
- /package/dist/{tree-surfer-ui → input}/domain/user-input.d.ts +0 -0
- /package/dist/{tree-surfer/fold-node/fold-node.types.js → input/domain/user-input.js} +0 -0
- /package/dist/{tree-surfer → trees}/cursor.d.ts +0 -0
- /package/dist/{tree-surfer → trees}/cursor.js +0 -0
- /package/dist/{tree-surfer/nav-node/nav-node.types.js → trees/fold-node/deprecated/fold-node.types.js} +0 -0
- /package/dist/{tree-surfer/state/state.types.js → trees/fold-node/fold-node.types.js} +0 -0
- /package/dist/{tree-surfer/tree-node/tree-node.types.js → trees/nav-node/nav-node.types.js} +0 -0
- /package/dist/{tree-surfer/tree-node → trees/tree-node/deprecated}/tree-node.arb.d.ts +0 -0
- /package/dist/{tree-surfer/tree-node → trees/tree-node/deprecated}/tree-node.arb.debug.test.d.ts +0 -0
- /package/dist/{tree-surfer/tree-node → trees/tree-node/deprecated}/tree-node.arb.js +0 -0
- /package/dist/{tree-surfer/tree-node → trees/tree-node/deprecated}/tree-node.impl.d.ts +0 -0
- /package/dist/{tree-surfer/tree-node → trees/tree-node/deprecated}/tree-node.impl.js +0 -0
- /package/dist/{tree-surfer/tree-node → trees/tree-node/deprecated}/tree-node.schemas.d.ts +0 -0
- /package/dist/{tree-surfer/tree-node → trees/tree-node/deprecated}/tree-node.schemas.js +0 -0
- /package/dist/{tree-surfer/fold-node → trees/tree-node/deprecated}/tree-node.test.d.ts +0 -0
- /package/dist/{tree-surfer/tree-node → trees/tree-node/deprecated}/tree-node.test.js +0 -0
- /package/dist/{tree-surfer/tree-node → trees/tree-node/deprecated}/tree-node.types.d.ts +0 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { ViewApi } from './view-api.js';
|
|
2
|
+
import type { CursorApi, FoldsApi, NavNodeApi, SerializableKey, State, StateApi, TreeNode, TreeNodeApi } from '../trees/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Application-specific tree dependencies and operations.
|
|
5
|
+
*
|
|
6
|
+
* This is currently migrated through the generic TreeNode and State APIs.
|
|
7
|
+
* Navigation-specific APIs remain outside this type until NavNodeApi has been
|
|
8
|
+
* migrated from the old structural TreeNode API.
|
|
9
|
+
*
|
|
10
|
+
* @typeParam Id - The sibling-unique tree-node ID type.
|
|
11
|
+
* @typeParam Value - Application-owned data stored in each tree node.
|
|
12
|
+
* @typeParam ViewKey - The key used to identify view implementations.
|
|
13
|
+
*/
|
|
14
|
+
export type AppApi<Id extends SerializableKey, Value, ViewKey = string> = Readonly<{
|
|
15
|
+
/**
|
|
16
|
+
* Name used to distinguish the application, for example `posix` for a
|
|
17
|
+
* POSIX-directory application.
|
|
18
|
+
*/
|
|
19
|
+
appId: string;
|
|
20
|
+
/**
|
|
21
|
+
* Name used to distinguish a particular application instance.
|
|
22
|
+
*/
|
|
23
|
+
name: string;
|
|
24
|
+
/**
|
|
25
|
+
* ID used for the application's root node.
|
|
26
|
+
*/
|
|
27
|
+
rootId: Id;
|
|
28
|
+
/**
|
|
29
|
+
* Loads direct children for the branch addressed by `path`.
|
|
30
|
+
*
|
|
31
|
+
* Returned nodes must be opaque tree values created or decoded through this
|
|
32
|
+
* application's TreeNodeApi specialization.
|
|
33
|
+
*/
|
|
34
|
+
loadBranches: (path: readonly Id[]) => Promise<readonly TreeNode<Id, Value>[]>;
|
|
35
|
+
/**
|
|
36
|
+
* Creates the application's root node.
|
|
37
|
+
*
|
|
38
|
+
* Invariant: the returned node is an open branch. That invariant is checked
|
|
39
|
+
* when an initial State is created.
|
|
40
|
+
*/
|
|
41
|
+
createRoot: () => Promise<TreeNode<Id, Value>>;
|
|
42
|
+
/**
|
|
43
|
+
* Subscribes to external data changes that require tree state to be loaded
|
|
44
|
+
* again.
|
|
45
|
+
*
|
|
46
|
+
* Returns an unsubscribe function.
|
|
47
|
+
*/
|
|
48
|
+
subscribeToResync: (listener: () => void) => () => void;
|
|
49
|
+
/**
|
|
50
|
+
* Generic structural operations for this application's buffer tree.
|
|
51
|
+
*/
|
|
52
|
+
treeNodeApi: TreeNodeApi<Id, Value>;
|
|
53
|
+
/**
|
|
54
|
+
* Semantic fold-state operations.
|
|
55
|
+
*
|
|
56
|
+
* This remains temporarily available while FoldNode itself is migrated.
|
|
57
|
+
*/
|
|
58
|
+
foldsApi: FoldsApi<Id>;
|
|
59
|
+
cursorApi: CursorApi<Id>;
|
|
60
|
+
stateApi: StateApi<Id, Value>;
|
|
61
|
+
/**
|
|
62
|
+
* UI navigation projection and cursor-navigation operations.
|
|
63
|
+
*/
|
|
64
|
+
navNodeApi: NavNodeApi<Id, Value>;
|
|
65
|
+
viewKey: ViewKey;
|
|
66
|
+
viewApi: ViewApi<State<Id, Value>, ViewKey>;
|
|
67
|
+
}>;
|
|
68
|
+
export type AppStateApis<Id extends SerializableKey, Value> = Readonly<{
|
|
69
|
+
treeNodeApi: TreeNodeApi<Id, Value>;
|
|
70
|
+
cursorApi: CursorApi<Id>;
|
|
71
|
+
stateApi: StateApi<Id, Value>;
|
|
72
|
+
}>;
|
|
73
|
+
export declare function createAppStateApis<Id extends SerializableKey, Value>(): AppStateApis<Id, Value>;
|
|
74
|
+
//# sourceMappingURL=app-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-api.d.ts","sourceRoot":"","sources":["../../src/app/app-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EACV,SAAS,EAAE,QAAQ,EAAE,UAAU,EAC/B,eAAe,EACf,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAO3B;;;;;;;;;;GAUG;AACH,MAAM,MAAM,MAAM,CAAC,EAAE,SAAS,eAAe,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,IAAI,QAAQ,CAAC;IACjF;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,MAAM,EAAE,EAAE,CAAC;IAEX;;;;;OAKG;IACH,YAAY,EAAE,CACZ,IAAI,EAAE,SAAS,EAAE,EAAE,KAChB,OAAO,CAAC,SAAS,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;IAE7C;;;;;OAKG;IACH,UAAU,EAAE,MAAM,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;IAE/C;;;;;OAKG;IACH,iBAAiB,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;IAExD;;OAEG;IACH,WAAW,EAAE,WAAW,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAEpC;;;;OAIG;IACH,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEvB,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;IAEzB,QAAQ,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAE9B;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAElC,OAAO,EAAE,OAAO,CAAC;IAEjB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;CAC7C,CAAC,CAAC;AAEH,MAAM,MAAM,YAAY,CAAC,EAAE,SAAS,eAAe,EAAE,KAAK,IAAI,QAAQ,CAAC;IACrE,WAAW,EAAE,WAAW,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IACpC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;IACzB,QAAQ,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;CAC/B,CAAC,CAAC;AAEH,wBAAgB,kBAAkB,CAChC,EAAE,SAAS,eAAe,EAC1B,KAAK,KACF,YAAY,CAAC,EAAE,EAAE,KAAK,CAAC,CAU3B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createCursorApi, createStateApi, createTreeNodeApi, } from '../trees/index.js';
|
|
2
|
+
export function createAppStateApis() {
|
|
3
|
+
const treeNodeApi = createTreeNodeApi();
|
|
4
|
+
const cursorApi = createCursorApi();
|
|
5
|
+
const stateApi = createStateApi(treeNodeApi, cursorApi);
|
|
6
|
+
return {
|
|
7
|
+
treeNodeApi,
|
|
8
|
+
cursorApi,
|
|
9
|
+
stateApi,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CursorApi, NavBranch, NavNodeApi, SerializableKey, State } from '../trees/index.js';
|
|
2
|
+
import type { EffectAction } from '../input/domain/index.js';
|
|
3
|
+
import type { ReducerAction } from './reducer-action.js';
|
|
4
|
+
export type EffectToAction<Id extends SerializableKey, Value> = (effectAction: EffectAction<Id, Value>, navigation: NavBranch<Id>, state: State<Id, Value>) => ReducerAction<Id, Value> | undefined;
|
|
5
|
+
export declare function createEffectToAction<Id extends SerializableKey, Value>(cursorApi: CursorApi<Id>, navNodeApi: NavNodeApi<Id, Value>): EffectToAction<Id, Value>;
|
|
6
|
+
//# sourceMappingURL=effect-to-action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"effect-to-action.d.ts","sourceRoot":"","sources":["../../src/app/effect-to-action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,UAAU,EACV,eAAe,EACf,KAAK,EACN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,MAAM,cAAc,CAAC,EAAE,SAAS,eAAe,EAAE,KAAK,IAAI,CAC9D,YAAY,EAAE,YAAY,CAAC,EAAE,EAAE,KAAK,CAAC,EACrC,UAAU,EAAE,SAAS,CAAC,EAAE,CAAC,EACzB,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,KACpB,aAAa,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,SAAS,CAAC;AAE1C,wBAAgB,oBAAoB,CAAC,EAAE,SAAS,eAAe,EAAE,KAAK,EACpE,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC,EACxB,UAAU,EAAE,UAAU,CAAC,EAAE,EAAE,KAAK,CAAC,GAChC,cAAc,CAAC,EAAE,EAAE,KAAK,CAAC,CA+F3B"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export function createEffectToAction(cursorApi, navNodeApi) {
|
|
2
|
+
function effectToAction(effectAction, navigation, state) {
|
|
3
|
+
switch (effectAction.effectActionType) {
|
|
4
|
+
case 'nextEntry': {
|
|
5
|
+
const cursor = navNodeApi.nextCursor(navigation, state.cursor);
|
|
6
|
+
return cursor === undefined
|
|
7
|
+
? undefined
|
|
8
|
+
: {
|
|
9
|
+
kind: 'changeCursor',
|
|
10
|
+
cursor,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
case 'prevEntry': {
|
|
14
|
+
const cursor = navNodeApi.previousCursor(navigation, state.cursor);
|
|
15
|
+
return cursor === undefined
|
|
16
|
+
? undefined
|
|
17
|
+
: {
|
|
18
|
+
kind: 'changeCursor',
|
|
19
|
+
cursor,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
case 'setBranchEntries':
|
|
23
|
+
return {
|
|
24
|
+
kind: 'updateBranch',
|
|
25
|
+
path: effectAction.path,
|
|
26
|
+
entries: effectAction.entries,
|
|
27
|
+
};
|
|
28
|
+
case 'navigateToParent': {
|
|
29
|
+
const navNode = navigation.children;
|
|
30
|
+
if (navNode === null) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
const cursor = navNodeApi.parentCursor(navNode, state.cursor);
|
|
34
|
+
return cursor === undefined
|
|
35
|
+
? undefined
|
|
36
|
+
: {
|
|
37
|
+
kind: 'changeCursor',
|
|
38
|
+
cursor,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
case 'fold': {
|
|
42
|
+
if (state.cursor.length === 0) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
const cursor = navNodeApi.cursorAfterFold(navigation, state.cursor);
|
|
46
|
+
if (cursor === undefined) {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
kind: 'fold',
|
|
51
|
+
path: state.cursor,
|
|
52
|
+
cursor,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
case 'unfold': {
|
|
56
|
+
const currentPath = cursorApi.getPath(state.cursor);
|
|
57
|
+
const navNode = navigation.children;
|
|
58
|
+
if (navNode === null) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
const node = navNodeApi.getNodeAtPath(navNode, currentPath);
|
|
62
|
+
if (node === undefined || node.folded?.entries.length === 0) {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
kind: 'unfold',
|
|
67
|
+
path: currentPath,
|
|
68
|
+
cursor: state.cursor,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return effectToAction;
|
|
74
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Cursor, SerializableKey, State, TreeNode } from '../trees/index.js';
|
|
2
|
+
export type ReducerAction<Id extends SerializableKey, Value> = {
|
|
3
|
+
kind: 'changeCursor';
|
|
4
|
+
cursor: Cursor<Id>;
|
|
5
|
+
} | {
|
|
6
|
+
kind: 'updateBranch';
|
|
7
|
+
path: readonly Id[];
|
|
8
|
+
entries: readonly TreeNode<Id, Value>[] | null;
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'setState';
|
|
11
|
+
oldState: State<Id, Value>;
|
|
12
|
+
newState: State<Id, Value>;
|
|
13
|
+
} | {
|
|
14
|
+
kind: 'fold';
|
|
15
|
+
path: readonly Id[];
|
|
16
|
+
cursor: Cursor<Id>;
|
|
17
|
+
} | {
|
|
18
|
+
kind: 'unfold';
|
|
19
|
+
path: readonly Id[];
|
|
20
|
+
cursor: Cursor<Id>;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=reducer-action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reducer-action.d.ts","sourceRoot":"","sources":["../../src/app/reducer-action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElF,MAAM,MAAM,aAAa,CAAC,EAAE,SAAS,eAAe,EAAE,KAAK,IACvD;IACE,IAAI,EAAE,cAAc,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;CACpB,GACD;IACE,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;IACpB,OAAO,EAAE,SAAS,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC;CAChD,GACD;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAC3B,QAAQ,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;CAC5B,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;CACpB,GACD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { FoldsApi, SerializableKey, State, TreeNodeApi } from '../trees/index.js';
|
|
2
|
+
import type { ReducerAction } from './reducer-action.js';
|
|
3
|
+
export type Reducer<Id extends SerializableKey, Value> = (state: State<Id, Value>, action: ReducerAction<Id, Value>) => State<Id, Value>;
|
|
4
|
+
export declare function createReducer<Id extends SerializableKey, Value>(treeNodeApi: TreeNodeApi<Id, Value>, foldsApi: FoldsApi<Id>): Reducer<Id, Value>;
|
|
5
|
+
//# sourceMappingURL=reducer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../src/app/reducer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,eAAe,EACf,KAAK,EACL,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,MAAM,OAAO,CAAC,EAAE,SAAS,eAAe,EAAE,KAAK,IAAI,CACvD,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,EACvB,MAAM,EAAE,aAAa,CAAC,EAAE,EAAE,KAAK,CAAC,KAC7B,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AAEtB,wBAAgB,aAAa,CAAC,EAAE,SAAS,eAAe,EAAE,KAAK,EAC7D,WAAW,EAAE,WAAW,CAAC,EAAE,EAAE,KAAK,CAAC,EACnC,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC,GACrB,OAAO,CAAC,EAAE,EAAE,KAAK,CAAC,CA2GpB"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export function createReducer(treeNodeApi, foldsApi) {
|
|
2
|
+
/*
|
|
3
|
+
* The current zc/zo input actions operate on the required primary fold tree.
|
|
4
|
+
* Indexed fold-tree commands can add an index to ReducerAction later.
|
|
5
|
+
*/
|
|
6
|
+
const primaryFoldIndex = 0;
|
|
7
|
+
return (state, action) => {
|
|
8
|
+
switch (action.kind) {
|
|
9
|
+
case 'changeCursor':
|
|
10
|
+
return {
|
|
11
|
+
...state,
|
|
12
|
+
cursor: action.cursor,
|
|
13
|
+
};
|
|
14
|
+
case 'updateBranch': {
|
|
15
|
+
const root = treeNodeApi.updateAtPath(state.root, action.path, (node) => {
|
|
16
|
+
/*
|
|
17
|
+
* Loading/unloading is a branch-only operation. TreeNodeApi can
|
|
18
|
+
* structurally convert any node, but the application reducer must
|
|
19
|
+
* not turn a leaf into a branch.
|
|
20
|
+
*/
|
|
21
|
+
if (treeNodeApi.kind(node) === 'leaf') {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
if (action.entries === null) {
|
|
25
|
+
return treeNodeApi.toUnloadedBranch(node);
|
|
26
|
+
}
|
|
27
|
+
return treeNodeApi.withLoadedChildren(node, action.entries);
|
|
28
|
+
});
|
|
29
|
+
/*
|
|
30
|
+
* State requires its root to remain a loaded branch. In particular,
|
|
31
|
+
* refuse an accidental updateBranch with path [] and entries null.
|
|
32
|
+
*/
|
|
33
|
+
if (root === undefined || treeNodeApi.kind(root) !== 'loaded-branch') {
|
|
34
|
+
return state;
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
...state,
|
|
38
|
+
root,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
case 'setState': {
|
|
42
|
+
// A newer update has already been applied.
|
|
43
|
+
if (state !== action.oldState) {
|
|
44
|
+
return state;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
...action.newState,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
case 'fold': {
|
|
51
|
+
const entryId = action.path.at(-1);
|
|
52
|
+
if (entryId === undefined) {
|
|
53
|
+
return state;
|
|
54
|
+
}
|
|
55
|
+
const parentPath = action.path.slice(0, -1);
|
|
56
|
+
const folds = foldsApi.hideEntryAtPath(state.folds, primaryFoldIndex, parentPath, entryId);
|
|
57
|
+
if (folds === undefined) {
|
|
58
|
+
return state;
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
...state,
|
|
62
|
+
folds,
|
|
63
|
+
cursor: action.cursor,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
case 'unfold': {
|
|
67
|
+
const folds = foldsApi.showAllHiddenEntriesAtPath(state.folds, primaryFoldIndex, action.path);
|
|
68
|
+
if (folds === undefined) {
|
|
69
|
+
return state;
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
...state,
|
|
73
|
+
folds,
|
|
74
|
+
cursor: action.cursor,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type ViewSummary = {
|
|
2
|
+
name: string;
|
|
3
|
+
updatedAt: string;
|
|
4
|
+
};
|
|
5
|
+
export type ViewApi<State, Key> = {
|
|
6
|
+
save: (key: Key, name: string, state: State) => Promise<void>;
|
|
7
|
+
load: (key: Key, name: string) => Promise<State | undefined>;
|
|
8
|
+
list: (key: Key) => Promise<readonly ViewSummary[]>;
|
|
9
|
+
remove: (key: Key, name: string) => Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=view-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-api.d.ts","sourceRoot":"","sources":["../../src/app/view-api.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,OAAO,CAAC,KAAK,EAAE,GAAG,IAAI;IAChC,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9D,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;IAC7D,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,SAAS,WAAW,EAAE,CAAC,CAAC;IACpD,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './tree-surfer-ui/domain/intent.js';
|
|
6
|
-
export * from './tree-surfer-ui/domain/user-input.js';
|
|
7
|
-
export * from './tree-surfer/index.js';
|
|
1
|
+
export * from './app/index.js';
|
|
2
|
+
export * from './input/application/index.js';
|
|
3
|
+
export * from './input/domain/index.js';
|
|
4
|
+
export * from './trees/index.js';
|
|
8
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAE/B,cAAc,8BAA8B,CAAC;AAE7C,cAAc,yBAAyB,CAAC;AAExC,cAAc,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './tree-surfer-ui/domain/intent.js';
|
|
6
|
-
export * from './tree-surfer-ui/domain/user-input.js';
|
|
7
|
-
export * from './tree-surfer/index.js';
|
|
1
|
+
export * from './app/index.js';
|
|
2
|
+
export * from './input/application/index.js';
|
|
3
|
+
export * from './input/domain/index.js';
|
|
4
|
+
export * from './trees/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/input/application/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intent-to-effect-no-state.test.d.ts","sourceRoot":"","sources":["../../../src/input/application/intent-to-effect-no-state.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CursorApi, SerializableKey, State, StateApi, TreeNodeApi } from '../../trees/index.js';
|
|
2
|
+
import type { Effect, Intent } from '../domain/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Converts a user intent and the current tree state into an effect.
|
|
5
|
+
*
|
|
6
|
+
* By design, "effect = intent + state": whether an effect should be executed
|
|
7
|
+
* depends on both the received intent and the current state.
|
|
8
|
+
*
|
|
9
|
+
* @typeParam Id - The sibling-unique tree-node ID type.
|
|
10
|
+
* @typeParam Value - Application-owned data stored in each tree node.
|
|
11
|
+
*/
|
|
12
|
+
export type IntentToEffect<Id extends SerializableKey, Value> = (intent: Intent, state: State<Id, Value>) => Effect<Id, Value> | undefined;
|
|
13
|
+
export declare function createIntentToEffect<Id extends SerializableKey, Value>(stateApi: StateApi<Id, Value>, cursorApi: CursorApi<Id>, treeNodeApi: TreeNodeApi<Id, Value>): IntentToEffect<Id, Value>;
|
|
14
|
+
//# sourceMappingURL=intent-to-effect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intent-to-effect.d.ts","sourceRoot":"","sources":["../../../src/input/application/intent-to-effect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,KAAK,EACL,QAAQ,EACR,WAAW,EACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,EAAgB,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAIvE;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,CAAC,EAAE,SAAS,eAAe,EAAE,KAAK,IAAI,CAC9D,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,KACpB,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,SAAS,CAAC;AAEnC,wBAAgB,oBAAoB,CAAC,EAAE,SAAS,eAAe,EAAE,KAAK,EACpE,QAAQ,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,EAC7B,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC,EACxB,WAAW,EAAE,WAAW,CAAC,EAAE,EAAE,KAAK,CAAC,GAClC,cAAc,CAAC,EAAE,EAAE,KAAK,CAAC,CAkE3B"}
|
|
@@ -7,7 +7,7 @@ export function createIntentToEffect(stateApi, cursorApi, treeNodeApi) {
|
|
|
7
7
|
case 'normalRight':
|
|
8
8
|
return normalInteractRightToEffect(state, stateApi, cursorApi, treeNodeApi);
|
|
9
9
|
case 'normalLeft':
|
|
10
|
-
return normalInteractLeftToEffect(state);
|
|
10
|
+
return normalInteractLeftToEffect(state, cursorApi);
|
|
11
11
|
case 'normalDown':
|
|
12
12
|
return dispatchAction({
|
|
13
13
|
effectActionType: 'nextEntry',
|
|
@@ -57,11 +57,15 @@ function dispatchAction(action) {
|
|
|
57
57
|
action,
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Sets the normal-mode command buffer.
|
|
62
|
+
*
|
|
63
|
+
* Three possibilities:
|
|
64
|
+
*
|
|
65
|
+
* - The buffer is a recognized motion: dispatch its effect action.
|
|
66
|
+
* - The buffer is a prefix of a possible motion: retain it.
|
|
67
|
+
* - The buffer is not a valid prefix: clear it.
|
|
68
|
+
*/
|
|
65
69
|
function normalBufferToEffectResult(updatedNormalBuffer) {
|
|
66
70
|
switch (updatedNormalBuffer) {
|
|
67
71
|
case 'z':
|
|
@@ -90,6 +94,13 @@ function normalBufferToEffectResult(updatedNormalBuffer) {
|
|
|
90
94
|
};
|
|
91
95
|
}
|
|
92
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Handles normal-mode right interaction.
|
|
99
|
+
*
|
|
100
|
+
* - A closed branch requests loading its children.
|
|
101
|
+
* - An open branch dispatches an action that closes/unloads its children.
|
|
102
|
+
* - A leaf has no right-interaction effect.
|
|
103
|
+
*/
|
|
93
104
|
function normalInteractRightToEffect(state, stateApi, cursorApi, treeNodeApi) {
|
|
94
105
|
const currentEntry = stateApi.getNodeAtCursor(state);
|
|
95
106
|
if (currentEntry === undefined) {
|
|
@@ -99,23 +110,31 @@ function normalInteractRightToEffect(state, stateApi, cursorApi, treeNodeApi) {
|
|
|
99
110
|
if (path === undefined) {
|
|
100
111
|
return undefined;
|
|
101
112
|
}
|
|
102
|
-
|
|
103
|
-
|
|
113
|
+
switch (treeNodeApi.kind(currentEntry)) {
|
|
114
|
+
case 'unloaded-branch':
|
|
104
115
|
return {
|
|
105
116
|
effectType: 'loadBranchEntries',
|
|
106
117
|
path,
|
|
107
118
|
};
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
119
|
+
case 'loaded-branch':
|
|
120
|
+
return dispatchAction({
|
|
121
|
+
effectActionType: 'setBranchEntries',
|
|
122
|
+
path,
|
|
123
|
+
entries: null,
|
|
124
|
+
});
|
|
125
|
+
case 'leaf':
|
|
126
|
+
return undefined;
|
|
114
127
|
}
|
|
115
|
-
return;
|
|
116
128
|
}
|
|
117
|
-
|
|
118
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Handles normal-mode left interaction.
|
|
131
|
+
*
|
|
132
|
+
* Left from the root has no effect. Otherwise dispatch navigation to the
|
|
133
|
+
* parent entry.
|
|
134
|
+
*/
|
|
135
|
+
function normalInteractLeftToEffect(state, cursorApi) {
|
|
136
|
+
const path = cursorApi.getPath(state.cursor);
|
|
137
|
+
if (path === undefined || path.length === 0) {
|
|
119
138
|
return undefined;
|
|
120
139
|
}
|
|
121
140
|
return dispatchAction({
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SerializableKey } from '../../trees/index.js';
|
|
2
|
+
import type { Effect } from '../domain/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Parses a command-line command into an application effect.
|
|
5
|
+
*
|
|
6
|
+
* Command parsing is independent of the concrete tree-node value type, but the
|
|
7
|
+
* generic parameters allow its result to compose with the application's
|
|
8
|
+
* Effect<Id, Value> pipeline.
|
|
9
|
+
*
|
|
10
|
+
* @typeParam Id - The sibling-unique tree-node ID type.
|
|
11
|
+
* @typeParam Value - Application-owned data stored in each tree node.
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseCommand<Id extends SerializableKey, Value>(commandLine: string): Effect<Id, Value> | undefined;
|
|
14
|
+
//# sourceMappingURL=parse-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-command.d.ts","sourceRoot":"","sources":["../../../src/input/application/parse-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAIjD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,EAAE,SAAS,eAAe,EAAE,KAAK,EAC5D,WAAW,EAAE,MAAM,GAClB,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,SAAS,CAwD/B"}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
const DEFAULT_VIEW_NAME = 'default';
|
|
2
|
+
/**
|
|
3
|
+
* Parses a command-line command into an application effect.
|
|
4
|
+
*
|
|
5
|
+
* Command parsing is independent of the concrete tree-node value type, but the
|
|
6
|
+
* generic parameters allow its result to compose with the application's
|
|
7
|
+
* Effect<Id, Value> pipeline.
|
|
8
|
+
*
|
|
9
|
+
* @typeParam Id - The sibling-unique tree-node ID type.
|
|
10
|
+
* @typeParam Value - Application-owned data stored in each tree node.
|
|
11
|
+
*/
|
|
2
12
|
export function parseCommand(commandLine) {
|
|
3
13
|
const command = commandLine.trim();
|
|
4
14
|
switch (command) {
|
|
@@ -23,7 +33,7 @@ export function parseCommand(commandLine) {
|
|
|
23
33
|
* The name may contain spaces, so capture the remainder of the command
|
|
24
34
|
* instead of splitting on whitespace.
|
|
25
35
|
*
|
|
26
|
-
* TODO Later: mkview that checks if same
|
|
36
|
+
* TODO Later: mkview that checks if a same-named view already exists.
|
|
27
37
|
*/
|
|
28
38
|
const viewCommand = command.match(/^:(mkview!|loadview)(?:\s+(.+?))?$/);
|
|
29
39
|
if (viewCommand === null) {
|
|
@@ -44,5 +54,7 @@ export function parseCommand(commandLine) {
|
|
|
44
54
|
effectType: 'loadView',
|
|
45
55
|
name,
|
|
46
56
|
};
|
|
57
|
+
default:
|
|
58
|
+
return undefined;
|
|
47
59
|
}
|
|
48
60
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-input-to-intent.d.ts","sourceRoot":"","sources":["../../../src/input/application/user-input-to-intent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEvE;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,GAC7B,MAAM,GAAG,SAAS,CAQpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-input-to-intent.test.d.ts","sourceRoot":"","sources":["../../../src/input/application/user-input-to-intent.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { InputModeState } from './input-mode-state.js';
|
|
2
|
+
import type { SerializableKey, TreeNode } from '../../trees/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* An effect produced by interpreting an intent against the current state.
|
|
5
|
+
*
|
|
6
|
+
* @typeParam Id - The sibling-unique tree-node ID type.
|
|
7
|
+
* @typeParam Value - Application-owned data stored in each tree node.
|
|
8
|
+
*/
|
|
9
|
+
export type Effect<Id extends SerializableKey, Value> = Readonly<{
|
|
10
|
+
effectType: 'dispatchEffectAction';
|
|
11
|
+
action: EffectAction<Id, Value>;
|
|
12
|
+
}> | Readonly<{
|
|
13
|
+
effectType: 'loadBranchEntries';
|
|
14
|
+
path: readonly Id[];
|
|
15
|
+
}> | Readonly<{
|
|
16
|
+
effectType: 'peekFold';
|
|
17
|
+
parentPath: readonly Id[];
|
|
18
|
+
}> | Readonly<{
|
|
19
|
+
effectType: 'saveView';
|
|
20
|
+
name: string;
|
|
21
|
+
overwrite: boolean;
|
|
22
|
+
}> | Readonly<{
|
|
23
|
+
effectType: 'loadView';
|
|
24
|
+
name: string;
|
|
25
|
+
}> | Readonly<{
|
|
26
|
+
effectType: 'emitVisibleLeavesPaths';
|
|
27
|
+
}> | Readonly<{
|
|
28
|
+
effectType: 'quit';
|
|
29
|
+
exitMessage: string;
|
|
30
|
+
}> | Readonly<{
|
|
31
|
+
effectType: 'setInputState';
|
|
32
|
+
inputState: InputModeState;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* An action interpreted by the state reducer.
|
|
36
|
+
*
|
|
37
|
+
* @typeParam Id - The sibling-unique tree-node ID type.
|
|
38
|
+
* @typeParam Value - Application-owned data stored in each tree node.
|
|
39
|
+
*/
|
|
40
|
+
export type EffectAction<Id extends SerializableKey, Value> = Readonly<{
|
|
41
|
+
effectActionType: 'nextEntry';
|
|
42
|
+
}> | Readonly<{
|
|
43
|
+
effectActionType: 'prevEntry';
|
|
44
|
+
}> | Readonly<{
|
|
45
|
+
effectActionType: 'setBranchEntries';
|
|
46
|
+
path: readonly Id[];
|
|
47
|
+
entries: readonly TreeNode<Id, Value>[] | null;
|
|
48
|
+
}> | Readonly<{
|
|
49
|
+
effectActionType: 'navigateToParent';
|
|
50
|
+
}> | Readonly<{
|
|
51
|
+
effectActionType: 'fold';
|
|
52
|
+
}> | Readonly<{
|
|
53
|
+
effectActionType: 'unfold';
|
|
54
|
+
}>;
|
|
55
|
+
//# sourceMappingURL=effect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"effect.d.ts","sourceRoot":"","sources":["../../../src/input/domain/effect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,MAAM,MAAM,CAAC,EAAE,SAAS,eAAe,EAAE,KAAK,IAChD,QAAQ,CAAC;IACP,UAAU,EAAE,sBAAsB,CAAC;IACnC,MAAM,EAAE,YAAY,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;CACjC,CAAC,GACF,QAAQ,CAAC;IACP,UAAU,EAAE,mBAAmB,CAAC;IAChC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;CACrB,CAAC,GACF,QAAQ,CAAC;IACP,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,SAAS,EAAE,EAAE,CAAC;CAC3B,CAAC,GACF,QAAQ,CAAC;IACP,UAAU,EAAE,UAAU,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC,GACF,QAAQ,CAAC;IACP,UAAU,EAAE,UAAU,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC,GACF,QAAQ,CAAC;IACP,UAAU,EAAE,wBAAwB,CAAC;CACtC,CAAC,GACF,QAAQ,CAAC;IACP,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC,GACF,QAAQ,CAAC;IACP,UAAU,EAAE,eAAe,CAAC;IAC5B,UAAU,EAAE,cAAc,CAAC;CAC5B,CAAC,CAAC;AAEP;;;;;GAKG;AACH,MAAM,MAAM,YAAY,CAAC,EAAE,SAAS,eAAe,EAAE,KAAK,IACtD,QAAQ,CAAC;IACP,gBAAgB,EAAE,WAAW,CAAC;CAC/B,CAAC,GACF,QAAQ,CAAC;IACP,gBAAgB,EAAE,WAAW,CAAC;CAC/B,CAAC,GACF,QAAQ,CAAC;IACP,gBAAgB,EAAE,kBAAkB,CAAC;IACrC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;IACpB,OAAO,EAAE,SAAS,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC;CAChD,CAAC,GACF,QAAQ,CAAC;IACP,gBAAgB,EAAE,kBAAkB,CAAC;CACtC,CAAC,GACF,QAAQ,CAAC;IACP,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC,GACF,QAAQ,CAAC;IACP,gBAAgB,EAAE,QAAQ,CAAC;CAC5B,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/input/domain/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-mode-state.d.ts","sourceRoot":"","sources":["../../../src/input/domain/input-mode-state.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GACtB;IACE,SAAS,EAAE,QAAQ,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB,GACD;IACE,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intent.d.ts","sourceRoot":"","sources":["../../../src/input/domain/intent.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAE1D,MAAM,MAAM,gBAAgB,GACxB;IACE,UAAU,EAAE,aAAa,CAAC;CAC3B,GACD;IACE,UAAU,EAAE,YAAY,CAAC;CAC1B,GACD;IACE,UAAU,EAAE,YAAY,CAAC;CAC1B,GACD;IACE,UAAU,EAAE,UAAU,CAAC;CACxB,GACD;IACE,UAAU,EAAE,iBAAiB,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEN,MAAM,MAAM,iBAAiB,GACzB;IACE,UAAU,EAAE,sBAAsB,CAAC;CACpC,GACD;IACE,UAAU,EAAE,gBAAgB,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;CACrB,GACD;IACE,UAAU,EAAE,oBAAoB,CAAC;IACjC,WAAW,EAAE,MAAM,CAAC;CACrB,GACD;IACE,UAAU,EAAE,qBAAqB,CAAC;CACnC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-input.d.ts","sourceRoot":"","sources":["../../../src/input/domain/user-input.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GACjB;IACE,aAAa,EAAE,WAAW,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;CAChB,GACD;IACE,aAAa,EAAE,OAAO,CAAC;CACxB,GACD;IACE,aAAa,EAAE,WAAW,CAAC;CAC5B,GACD;IACE,aAAa,EAAE,KAAK,CAAC;CACtB,GACD;IACE,aAAa,EAAE,YAAY,CAAC;CAC7B,GACD;IACE,aAAa,EAAE,WAAW,CAAC;CAC5B,GACD;IACE,aAAa,EAAE,WAAW,CAAC;CAC5B,GACD;IACE,aAAa,EAAE,SAAS,CAAC;CAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../src/trees/cursor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,MAAM,CAAC,EAAE,IAAI,SAAS,EAAE,EAAE,CAAC;AAEvC;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,SAAS,CAAC,CAAC,UAAU,EAC9D,QAAQ,EAAE,QAAQ,wBAGnB;AAED;;;;GAIG;AACH,MAAM,MAAM,SAAS,CAAC,EAAE,IAAI;IAC1B;;OAEG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC;IAEpD;;;;OAIG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC;IAElC;;;;;OAKG;IACH,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,GAAG,OAAO,CAAC;CAC/E,CAAC;AAEF,wBAAgB,eAAe,CAAC,EAAE,KAAK,SAAS,CAAC,EAAE,CAAC,CAcnD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FoldNodeApi, FoldNodeService } from './fold-node.types.js';
|
|
2
|
+
import type { SerializableKey } from '../../tree-node/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Creates semantic operations for a fold-state tree.
|
|
5
|
+
*
|
|
6
|
+
* Structural children are owned by `FoldNodeApi`; folded children are
|
|
7
|
+
* application-owned FoldNode values stored in `FoldNodeValue`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createFoldNodeService<Id extends SerializableKey>(foldNodeApi: FoldNodeApi<Id>): FoldNodeService<Id>;
|
|
10
|
+
//# sourceMappingURL=fold-node.impl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fold-node.impl.d.ts","sourceRoot":"","sources":["../../../../src/trees/fold-node/deprecated/fold-node.impl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EACX,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,SAAS,eAAe,EAC9D,WAAW,EAAE,WAAW,CAAC,EAAE,CAAC,GAC3B,eAAe,CAAC,EAAE,CAAC,CA0WrB"}
|