dirvi-lib 0.8.2 → 0.9.0
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/effect-to-action.d.ts +2 -2
- package/dist/app/effect-to-action.d.ts.map +1 -1
- package/dist/app/effect-to-action.js +51 -5
- package/dist/app/reducer-action.d.ts +20 -2
- package/dist/app/reducer-action.d.ts.map +1 -1
- package/dist/app/reducer.d.ts.map +1 -1
- package/dist/app/reducer.js +45 -9
- package/dist/feedback/feedback.impl.d.ts +9 -0
- package/dist/feedback/feedback.impl.d.ts.map +1 -0
- package/dist/feedback/feedback.impl.js +34 -0
- package/dist/feedback/feedback.types.d.ts +24 -0
- package/dist/feedback/feedback.types.d.ts.map +1 -0
- package/dist/feedback/feedback.types.js +1 -0
- package/dist/feedback/index.d.ts +3 -0
- package/dist/feedback/index.d.ts.map +1 -0
- package/dist/feedback/index.js +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/input/application/intent-to-effect.d.ts.map +1 -1
- package/dist/input/application/intent-to-effect.js +30 -25
- package/dist/input/application/parse-command.d.ts.map +1 -1
- package/dist/input/application/parse-command.js +58 -26
- package/dist/input/application/parse-normal-command.d.ts +12 -0
- package/dist/input/application/parse-normal-command.d.ts.map +1 -0
- package/dist/input/application/parse-normal-command.js +89 -0
- package/dist/input/application/tokenize-normal-command.d.ts +24 -0
- package/dist/input/application/tokenize-normal-command.d.ts.map +1 -0
- package/dist/input/application/tokenize-normal-command.js +110 -0
- package/dist/input/application/user-input-to-intent.d.ts +4 -2
- package/dist/input/application/user-input-to-intent.d.ts.map +1 -1
- package/dist/input/application/user-input-to-intent.js +9 -6
- package/dist/input/domain/effect.d.ts +32 -3
- package/dist/input/domain/effect.d.ts.map +1 -1
- package/dist/trees/fold-node/fold-node.impl.d.ts.map +1 -1
- package/dist/trees/fold-node/fold-node.impl.js +21 -0
- package/dist/trees/fold-node/fold-node.types.d.ts +8 -0
- package/dist/trees/fold-node/fold-node.types.d.ts.map +1 -1
- package/dist/trees/tree-node/index.d.ts +4 -3
- package/dist/trees/tree-node/index.d.ts.map +1 -1
- package/dist/trees/tree-node/index.js +2 -3
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { CursorApi, NavBranch, NavNodeApi, SerializableKey, State } from '../trees/index.js';
|
|
1
|
+
import type { CursorApi, FoldsApi, NavBranch, NavNodeApi, SerializableKey, State } from '../trees/index.js';
|
|
2
2
|
import type { EffectAction } from '../input/domain/index.js';
|
|
3
3
|
import type { ReducerAction } from './reducer-action.js';
|
|
4
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>;
|
|
5
|
+
export declare function createEffectToAction<Id extends SerializableKey, Value>(foldsApi: FoldsApi<Id>, cursorApi: CursorApi<Id>, navNodeApi: NavNodeApi<Id, Value>): EffectToAction<Id, Value>;
|
|
6
6
|
//# sourceMappingURL=effect-to-action.d.ts.map
|
|
@@ -1 +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,
|
|
1
|
+
{"version":3,"file":"effect-to-action.d.ts","sourceRoot":"","sources":["../../src/app/effect-to-action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EAGT,QAAQ,EACR,SAAS,EACT,UAAU,EACV,eAAe,EACf,KAAK,EACN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,YAAY,EAAqB,MAAM,0BAA0B,CAAC;AAChF,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;AAkB1C,wBAAgB,oBAAoB,CAAC,EAAE,SAAS,eAAe,EAAE,KAAK,EACpE,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC,EACtB,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC,EACxB,UAAU,EAAE,UAAU,CAAC,EAAE,EAAE,KAAK,CAAC,GAChC,cAAc,CAAC,EAAE,EAAE,KAAK,CAAC,CA4J3B"}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
function resolveFoldTreeIndex(foldsApi, folds, foldTree) {
|
|
2
|
+
switch (foldTree.foldTreeReferenceType) {
|
|
3
|
+
case 'index':
|
|
4
|
+
return foldsApi.hasAtIndex(folds, foldTree.index)
|
|
5
|
+
? foldTree.index
|
|
6
|
+
: undefined;
|
|
7
|
+
case 'name':
|
|
8
|
+
return foldsApi.getIndexByName(folds, foldTree.name);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export function createEffectToAction(foldsApi, cursorApi, navNodeApi) {
|
|
2
12
|
function effectToAction(effectAction, navigation, state) {
|
|
3
13
|
switch (effectAction.effectActionType) {
|
|
4
14
|
case 'nextEntry': {
|
|
@@ -38,7 +48,7 @@ export function createEffectToAction(cursorApi, navNodeApi) {
|
|
|
38
48
|
cursor,
|
|
39
49
|
};
|
|
40
50
|
}
|
|
41
|
-
case '
|
|
51
|
+
case 'addToFoldTree': {
|
|
42
52
|
if (state.cursor.length === 0) {
|
|
43
53
|
return undefined;
|
|
44
54
|
}
|
|
@@ -46,13 +56,18 @@ export function createEffectToAction(cursorApi, navNodeApi) {
|
|
|
46
56
|
if (cursor === undefined) {
|
|
47
57
|
return undefined;
|
|
48
58
|
}
|
|
59
|
+
const foldTreeIndex = resolveFoldTreeIndex(foldsApi, state.folds, effectAction.foldTree);
|
|
60
|
+
if (foldTreeIndex === undefined) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
49
63
|
return {
|
|
50
|
-
kind: '
|
|
64
|
+
kind: 'addToFoldTree',
|
|
51
65
|
path: state.cursor,
|
|
52
66
|
cursor,
|
|
67
|
+
foldTreeIndex,
|
|
53
68
|
};
|
|
54
69
|
}
|
|
55
|
-
case '
|
|
70
|
+
case 'removeFromFoldTree': {
|
|
56
71
|
const currentPath = cursorApi.getPath(state.cursor);
|
|
57
72
|
const navNode = navigation.children;
|
|
58
73
|
if (navNode === null) {
|
|
@@ -62,12 +77,43 @@ export function createEffectToAction(cursorApi, navNodeApi) {
|
|
|
62
77
|
if (node === undefined || node.folded?.entries.length === 0) {
|
|
63
78
|
return undefined;
|
|
64
79
|
}
|
|
80
|
+
const foldTreeIndex = resolveFoldTreeIndex(foldsApi, state.folds, effectAction.foldTree);
|
|
81
|
+
if (foldTreeIndex === undefined) {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
65
84
|
return {
|
|
66
|
-
kind: '
|
|
85
|
+
kind: 'removeFromFoldTree',
|
|
67
86
|
path: currentPath,
|
|
68
87
|
cursor: state.cursor,
|
|
88
|
+
foldTreeIndex,
|
|
69
89
|
};
|
|
70
90
|
}
|
|
91
|
+
case 'fold': {
|
|
92
|
+
const foldTreeIndex = resolveFoldTreeIndex(foldsApi, state.folds, effectAction.foldTree);
|
|
93
|
+
return foldTreeIndex === undefined
|
|
94
|
+
? undefined
|
|
95
|
+
: {
|
|
96
|
+
kind: 'fold',
|
|
97
|
+
foldTreeIndex,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
case 'unfold': {
|
|
101
|
+
const foldTreeIndex = resolveFoldTreeIndex(foldsApi, state.folds, effectAction.foldTree);
|
|
102
|
+
return foldTreeIndex === undefined
|
|
103
|
+
? undefined
|
|
104
|
+
: {
|
|
105
|
+
kind: 'unfold',
|
|
106
|
+
foldTreeIndex,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
case 'createFoldTree':
|
|
110
|
+
return foldsApi.getIndexByName(state.folds, effectAction.name) ===
|
|
111
|
+
undefined
|
|
112
|
+
? {
|
|
113
|
+
kind: 'createFoldTree',
|
|
114
|
+
name: effectAction.name,
|
|
115
|
+
}
|
|
116
|
+
: undefined;
|
|
71
117
|
}
|
|
72
118
|
}
|
|
73
119
|
return effectToAction;
|
|
@@ -11,12 +11,30 @@ export type ReducerAction<Id extends SerializableKey, Value> = {
|
|
|
11
11
|
oldState: State<Id, Value>;
|
|
12
12
|
newState: State<Id, Value>;
|
|
13
13
|
} | {
|
|
14
|
-
kind: '
|
|
14
|
+
kind: 'addToFoldTree';
|
|
15
15
|
path: readonly Id[];
|
|
16
16
|
cursor: Cursor<Id>;
|
|
17
|
+
foldTreeIndex: number;
|
|
17
18
|
} | {
|
|
18
|
-
kind: '
|
|
19
|
+
kind: 'removeFromFoldTree';
|
|
19
20
|
path: readonly Id[];
|
|
20
21
|
cursor: Cursor<Id>;
|
|
22
|
+
foldTreeIndex: number;
|
|
23
|
+
} | {
|
|
24
|
+
/**
|
|
25
|
+
* Activates a fold tree, making its hidden entries contribute to the
|
|
26
|
+
* visible navigation projection.
|
|
27
|
+
*/
|
|
28
|
+
kind: 'fold';
|
|
29
|
+
foldTreeIndex: number;
|
|
30
|
+
} | {
|
|
31
|
+
/**
|
|
32
|
+
* Deactivates a fold tree while preserving its fold definition.
|
|
33
|
+
*/
|
|
34
|
+
kind: 'unfold';
|
|
35
|
+
foldTreeIndex: number;
|
|
36
|
+
} | {
|
|
37
|
+
kind: 'createFoldTree';
|
|
38
|
+
name: string;
|
|
21
39
|
};
|
|
22
40
|
//# sourceMappingURL=reducer-action.d.ts.map
|
|
@@ -1 +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,
|
|
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,eAAe,CAAC;IACtB,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB,GACD;IACE,IAAI,EAAE,oBAAoB,CAAC;IAC3B,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB,GACD;IACE;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;CACvB,GACD;IACE;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;CACvB,GACD;IACE,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
|
|
@@ -1 +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;
|
|
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,CAwJpB"}
|
package/dist/app/reducer.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
function firstAvailableAdditionalFoldIndex(foldsApi, state) {
|
|
2
|
+
let index = 1;
|
|
3
|
+
while (foldsApi.hasAtIndex(state.folds, index)) {
|
|
4
|
+
index += 1;
|
|
5
|
+
}
|
|
6
|
+
return index;
|
|
7
|
+
}
|
|
1
8
|
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
9
|
return (state, action) => {
|
|
8
10
|
switch (action.kind) {
|
|
9
11
|
case 'changeCursor':
|
|
@@ -47,13 +49,13 @@ export function createReducer(treeNodeApi, foldsApi) {
|
|
|
47
49
|
...action.newState,
|
|
48
50
|
};
|
|
49
51
|
}
|
|
50
|
-
case '
|
|
52
|
+
case 'addToFoldTree': {
|
|
51
53
|
const entryId = action.path.at(-1);
|
|
52
54
|
if (entryId === undefined) {
|
|
53
55
|
return state;
|
|
54
56
|
}
|
|
55
57
|
const parentPath = action.path.slice(0, -1);
|
|
56
|
-
const folds = foldsApi.hideEntryAtPath(state.folds,
|
|
58
|
+
const folds = foldsApi.hideEntryAtPath(state.folds, action.foldTreeIndex, parentPath, entryId);
|
|
57
59
|
if (folds === undefined) {
|
|
58
60
|
return state;
|
|
59
61
|
}
|
|
@@ -63,8 +65,9 @@ export function createReducer(treeNodeApi, foldsApi) {
|
|
|
63
65
|
cursor: action.cursor,
|
|
64
66
|
};
|
|
65
67
|
}
|
|
66
|
-
case '
|
|
67
|
-
|
|
68
|
+
case 'removeFromFoldTree': {
|
|
69
|
+
// TODO: Change to show only entry at cursor. mirroring addToFoldTree
|
|
70
|
+
const folds = foldsApi.showAllHiddenEntriesAtPath(state.folds, action.foldTreeIndex, action.path);
|
|
68
71
|
if (folds === undefined) {
|
|
69
72
|
return state;
|
|
70
73
|
}
|
|
@@ -74,6 +77,39 @@ export function createReducer(treeNodeApi, foldsApi) {
|
|
|
74
77
|
cursor: action.cursor,
|
|
75
78
|
};
|
|
76
79
|
}
|
|
80
|
+
case 'fold': {
|
|
81
|
+
const folds = foldsApi.activateAtIndex(state.folds, action.foldTreeIndex);
|
|
82
|
+
return folds === undefined
|
|
83
|
+
? state
|
|
84
|
+
: {
|
|
85
|
+
...state,
|
|
86
|
+
folds,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
case 'unfold': {
|
|
90
|
+
const folds = foldsApi.deactivateAtIndex(state.folds, action.foldTreeIndex);
|
|
91
|
+
return folds === undefined
|
|
92
|
+
? state
|
|
93
|
+
: {
|
|
94
|
+
...state,
|
|
95
|
+
folds,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
case 'createFoldTree': {
|
|
99
|
+
const index = firstAvailableAdditionalFoldIndex(foldsApi, state);
|
|
100
|
+
const folds = foldsApi.setAdditionalFoldAtIndex(state.folds, index,
|
|
101
|
+
// Obtain this through the actual TreeNodeApi root-ID operation.
|
|
102
|
+
treeNodeApi.id(state.root), {
|
|
103
|
+
name: action.name,
|
|
104
|
+
description: null,
|
|
105
|
+
});
|
|
106
|
+
return folds === undefined
|
|
107
|
+
? state
|
|
108
|
+
: {
|
|
109
|
+
...state,
|
|
110
|
+
folds,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
77
113
|
}
|
|
78
114
|
};
|
|
79
115
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Feedback, FeedbackApi } from './feedback.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates the feedback algebra.
|
|
4
|
+
*
|
|
5
|
+
* `onMessageAdded` is an application/UI hook. It is called after a new
|
|
6
|
+
* feedback value has been created, allowing an outer layer to render it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createFeedbackApi(onMessageAdded?: (feedback: Feedback, message: string) => void): FeedbackApi;
|
|
9
|
+
//# sourceMappingURL=feedback.impl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feedback.impl.d.ts","sourceRoot":"","sources":["../../src/feedback/feedback.impl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,WAAW,EAEZ,MAAM,qBAAqB,CAAC;AA2B7B;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAC7D,WAAW,CAkBb"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const values = new WeakMap();
|
|
2
|
+
function createFeedback(message, type) {
|
|
3
|
+
const feedback = Object.freeze({});
|
|
4
|
+
values.set(feedback, { message, type });
|
|
5
|
+
return feedback;
|
|
6
|
+
}
|
|
7
|
+
function getValue(feedback) {
|
|
8
|
+
const value = values.get(feedback);
|
|
9
|
+
if (value === undefined) {
|
|
10
|
+
throw new Error('Invalid Feedback value');
|
|
11
|
+
}
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Creates the feedback algebra.
|
|
16
|
+
*
|
|
17
|
+
* `onMessageAdded` is an application/UI hook. It is called after a new
|
|
18
|
+
* feedback value has been created, allowing an outer layer to render it.
|
|
19
|
+
*/
|
|
20
|
+
export function createFeedbackApi(onMessageAdded) {
|
|
21
|
+
return {
|
|
22
|
+
addMessage(message, type = 'message') {
|
|
23
|
+
const feedback = createFeedback(message, type);
|
|
24
|
+
onMessageAdded?.(feedback, message);
|
|
25
|
+
return feedback;
|
|
26
|
+
},
|
|
27
|
+
getMessage(feedback) {
|
|
28
|
+
return getValue(feedback).message;
|
|
29
|
+
},
|
|
30
|
+
getType(feedback) {
|
|
31
|
+
return getValue(feedback).type;
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type FeedbackType = 'success' | 'message' | 'error';
|
|
2
|
+
declare const feedbackBrand: unique symbol;
|
|
3
|
+
/**
|
|
4
|
+
* Opaque runtime feedback message.
|
|
5
|
+
*
|
|
6
|
+
* Its representation is private to the feedback module. Consumers must use
|
|
7
|
+
* FeedbackApi operations to create, update, and inspect it.
|
|
8
|
+
*/
|
|
9
|
+
export type Feedback = Readonly<{
|
|
10
|
+
readonly [feedbackBrand]: typeof feedbackBrand;
|
|
11
|
+
}>;
|
|
12
|
+
export type FeedbackApi = Readonly<{
|
|
13
|
+
/**
|
|
14
|
+
* Creates feedback for a new message and notifies the configured hook.
|
|
15
|
+
* Defaults to a standard message.
|
|
16
|
+
*/
|
|
17
|
+
addMessage: (message: string, type?: FeedbackType) => Feedback;
|
|
18
|
+
/** Returns the message represented by feedback. */
|
|
19
|
+
getMessage: (feedback: Feedback) => string;
|
|
20
|
+
/** Returns the display type represented by feedback. */
|
|
21
|
+
getType: (feedback: Feedback) => FeedbackType;
|
|
22
|
+
}>;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=feedback.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feedback.types.d.ts","sourceRoot":"","sources":["../../src/feedback/feedback.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAE3D,OAAO,CAAC,MAAM,aAAa,EAAE,OAAO,MAAM,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,QAAQ,CAAC;IAC9B,QAAQ,CAAC,CAAC,aAAa,CAAC,EAAE,OAAO,aAAa,CAAC;CAChD,CAAC,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IACjC;;;OAGG;IACH,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,YAAY,KAAK,QAAQ,CAAC;IAE/D,mDAAmD;IACnD,UAAU,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,MAAM,CAAC;IAE3C,wDAAwD;IACxD,OAAO,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,YAAY,CAAC;CAC/C,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/feedback/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,qBAAqB,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createFeedbackApi } from './feedback.impl.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
export * from './trees/index.js';
|
|
2
|
+
export * from './feedback/index.js';
|
|
1
3
|
export * from './app/index.js';
|
|
2
4
|
export * from './input/application/index.js';
|
|
3
5
|
export * from './input/domain/index.js';
|
|
4
|
-
export * from './trees/index.js';
|
|
5
6
|
//# 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,gBAAgB,CAAC;AAE/B,cAAc,8BAA8B,CAAC;AAE7C,cAAc,yBAAyB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AAEjC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,gBAAgB,CAAC;AAE/B,cAAc,8BAA8B,CAAC;AAE7C,cAAc,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +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;
|
|
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;AAKvE;;;;;;;;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"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { parseCommand } from './parse-command.js';
|
|
2
|
+
import { parseNormalCommand } from './parse-normal-command.js';
|
|
2
3
|
export function createIntentToEffect(stateApi, cursorApi, treeNodeApi) {
|
|
3
4
|
return (intent, state) => {
|
|
4
5
|
switch (intent.intentType) {
|
|
@@ -51,12 +52,33 @@ export function createIntentToEffect(stateApi, cursorApi, treeNodeApi) {
|
|
|
51
52
|
}
|
|
52
53
|
};
|
|
53
54
|
}
|
|
55
|
+
// =============================================================================
|
|
56
|
+
// Normal mode
|
|
57
|
+
// =============================================================================
|
|
58
|
+
function keepNormalBuffer(normalBuffer) {
|
|
59
|
+
return {
|
|
60
|
+
effectType: 'setInputState',
|
|
61
|
+
inputState: {
|
|
62
|
+
inputMode: 'normal',
|
|
63
|
+
normalBuffer,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
54
67
|
function dispatchAction(action) {
|
|
55
68
|
return {
|
|
56
69
|
effectType: 'dispatchEffectAction',
|
|
57
70
|
action,
|
|
58
71
|
};
|
|
59
72
|
}
|
|
73
|
+
function clearBuffer() {
|
|
74
|
+
return {
|
|
75
|
+
effectType: 'setInputState',
|
|
76
|
+
inputState: {
|
|
77
|
+
inputMode: 'normal',
|
|
78
|
+
normalBuffer: '',
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
}
|
|
60
82
|
/**
|
|
61
83
|
* Sets the normal-mode command buffer.
|
|
62
84
|
*
|
|
@@ -67,31 +89,14 @@ function dispatchAction(action) {
|
|
|
67
89
|
* - The buffer is not a valid prefix: clear it.
|
|
68
90
|
*/
|
|
69
91
|
function normalBufferToEffectResult(updatedNormalBuffer) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
};
|
|
79
|
-
case 'zc':
|
|
80
|
-
return dispatchAction({
|
|
81
|
-
effectActionType: 'fold',
|
|
82
|
-
});
|
|
83
|
-
case 'zo':
|
|
84
|
-
return dispatchAction({
|
|
85
|
-
effectActionType: 'unfold',
|
|
86
|
-
});
|
|
87
|
-
default:
|
|
88
|
-
return {
|
|
89
|
-
effectType: 'setInputState',
|
|
90
|
-
inputState: {
|
|
91
|
-
inputMode: 'normal',
|
|
92
|
-
normalBuffer: '',
|
|
93
|
-
},
|
|
94
|
-
};
|
|
92
|
+
const commandResult = parseNormalCommand(updatedNormalBuffer);
|
|
93
|
+
switch (commandResult.kind) {
|
|
94
|
+
case 'incomplete':
|
|
95
|
+
return keepNormalBuffer(updatedNormalBuffer);
|
|
96
|
+
case 'complete':
|
|
97
|
+
return dispatchAction(commandResult.action);
|
|
98
|
+
case 'invalid':
|
|
99
|
+
return clearBuffer();
|
|
95
100
|
}
|
|
96
101
|
}
|
|
97
102
|
/**
|
|
@@ -1 +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;
|
|
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;AA0CjD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,EAAE,SAAS,eAAe,EAAE,KAAK,EAC5D,WAAW,EAAE,MAAM,GAClB,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,SAAS,CAyD/B"}
|
|
@@ -1,4 +1,36 @@
|
|
|
1
1
|
const DEFAULT_VIEW_NAME = 'default';
|
|
2
|
+
function parseFoldCommand(commandArgs) {
|
|
3
|
+
const [subcommand, name] = commandArgs;
|
|
4
|
+
switch (subcommand) {
|
|
5
|
+
case 'list':
|
|
6
|
+
return commandArgs.length === 1
|
|
7
|
+
? {
|
|
8
|
+
effectType: 'listFolds',
|
|
9
|
+
}
|
|
10
|
+
: {
|
|
11
|
+
effectType: 'unrecognizedCommand',
|
|
12
|
+
commandLine: `fold ${commandArgs.join(' ')}`,
|
|
13
|
+
};
|
|
14
|
+
case 'create':
|
|
15
|
+
return name === undefined || commandArgs.length !== 2
|
|
16
|
+
? {
|
|
17
|
+
effectType: 'unrecognizedCommand',
|
|
18
|
+
commandLine: `fold ${commandArgs.join(' ')}`,
|
|
19
|
+
}
|
|
20
|
+
: {
|
|
21
|
+
effectType: 'dispatchEffectAction',
|
|
22
|
+
action: {
|
|
23
|
+
effectActionType: 'createFoldTree',
|
|
24
|
+
name,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
default:
|
|
28
|
+
return {
|
|
29
|
+
effectType: 'unrecognizedCommand',
|
|
30
|
+
commandLine: `fold ${commandArgs.join(' ')}`,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
2
34
|
/**
|
|
3
35
|
* Parses a command-line command into an application effect.
|
|
4
36
|
*
|
|
@@ -10,17 +42,39 @@ const DEFAULT_VIEW_NAME = 'default';
|
|
|
10
42
|
* @typeParam Value - Application-owned data stored in each tree node.
|
|
11
43
|
*/
|
|
12
44
|
export function parseCommand(commandLine) {
|
|
13
|
-
const command = commandLine.trim();
|
|
14
|
-
|
|
15
|
-
|
|
45
|
+
const command = commandLine.trim().replace(/^:/, '');
|
|
46
|
+
if (command === "") {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
const [commandName, ...commandArgs] = command.split(/\s+/);
|
|
50
|
+
switch (commandName) {
|
|
51
|
+
case 'q':
|
|
16
52
|
return {
|
|
17
53
|
effectType: 'quit',
|
|
18
54
|
exitMessage: '',
|
|
19
55
|
};
|
|
20
|
-
case '
|
|
56
|
+
case 'fold':
|
|
57
|
+
return parseFoldCommand(commandArgs);
|
|
58
|
+
case 'evlp':
|
|
21
59
|
return {
|
|
22
60
|
effectType: 'emitVisibleLeavesPaths',
|
|
23
61
|
};
|
|
62
|
+
case 'mkview!':
|
|
63
|
+
return {
|
|
64
|
+
effectType: 'saveView',
|
|
65
|
+
name: commandArgs[0] || DEFAULT_VIEW_NAME,
|
|
66
|
+
overwrite: true,
|
|
67
|
+
};
|
|
68
|
+
case 'loadview':
|
|
69
|
+
return {
|
|
70
|
+
effectType: 'loadView',
|
|
71
|
+
name: commandArgs[0] || DEFAULT_VIEW_NAME,
|
|
72
|
+
};
|
|
73
|
+
default:
|
|
74
|
+
return {
|
|
75
|
+
effectType: 'unrecognizedCommand',
|
|
76
|
+
commandLine,
|
|
77
|
+
};
|
|
24
78
|
}
|
|
25
79
|
/*
|
|
26
80
|
* Vim-style view commands:
|
|
@@ -35,26 +89,4 @@ export function parseCommand(commandLine) {
|
|
|
35
89
|
*
|
|
36
90
|
* TODO Later: mkview that checks if a same-named view already exists.
|
|
37
91
|
*/
|
|
38
|
-
const viewCommand = command.match(/^:(mkview!|loadview)(?:\s+(.+?))?$/);
|
|
39
|
-
if (viewCommand === null) {
|
|
40
|
-
return undefined;
|
|
41
|
-
}
|
|
42
|
-
const commandName = viewCommand[1];
|
|
43
|
-
const suppliedName = viewCommand[2]?.trim();
|
|
44
|
-
const name = suppliedName || DEFAULT_VIEW_NAME;
|
|
45
|
-
switch (commandName) {
|
|
46
|
-
case 'mkview!':
|
|
47
|
-
return {
|
|
48
|
-
effectType: 'saveView',
|
|
49
|
-
name,
|
|
50
|
-
overwrite: true,
|
|
51
|
-
};
|
|
52
|
-
case 'loadview':
|
|
53
|
-
return {
|
|
54
|
-
effectType: 'loadView',
|
|
55
|
-
name,
|
|
56
|
-
};
|
|
57
|
-
default:
|
|
58
|
-
return undefined;
|
|
59
|
-
}
|
|
60
92
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SerializableKey } from '../../trees/index.js';
|
|
2
|
+
import type { EffectAction } from '../domain/index.js';
|
|
3
|
+
export type ParseNormalCommandResult<Id extends SerializableKey, Value> = {
|
|
4
|
+
kind: 'incomplete';
|
|
5
|
+
} | {
|
|
6
|
+
kind: 'complete';
|
|
7
|
+
action: EffectAction<Id, Value>;
|
|
8
|
+
} | {
|
|
9
|
+
kind: 'invalid';
|
|
10
|
+
};
|
|
11
|
+
export declare function parseNormalCommand<Id extends SerializableKey, Value>(normalBuffer: string): ParseNormalCommandResult<Id, Value>;
|
|
12
|
+
//# sourceMappingURL=parse-normal-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-normal-command.d.ts","sourceRoot":"","sources":["../../../src/input/application/parse-normal-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAOvD,MAAM,MAAM,wBAAwB,CAAC,EAAE,SAAS,eAAe,EAAE,KAAK,IAClE;IACE,IAAI,EAAE,YAAY,CAAC;CACpB,GACD;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,YAAY,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;CACjC,GACD;IACE,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC;AAEN,wBAAgB,kBAAkB,CAAC,EAAE,SAAS,eAAe,EAAE,KAAK,EAClE,YAAY,EAAE,MAAM,GACnB,wBAAwB,CAAC,EAAE,EAAE,KAAK,CAAC,CAwCrC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { tokenizeNormalCommand, } from './tokenize-normal-command.js';
|
|
2
|
+
export function parseNormalCommand(normalBuffer) {
|
|
3
|
+
const tokens = tokenizeNormalCommand(normalBuffer);
|
|
4
|
+
if (tokens.some(isInvalidToken)) {
|
|
5
|
+
return {
|
|
6
|
+
kind: 'invalid',
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
const [firstToken, secondToken] = tokens;
|
|
10
|
+
if (firstToken === undefined) {
|
|
11
|
+
return {
|
|
12
|
+
kind: 'invalid',
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
if (firstToken.tokenType === 'validInteger') {
|
|
16
|
+
if (secondToken === undefined) {
|
|
17
|
+
return {
|
|
18
|
+
kind: 'incomplete',
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
if (tokens.length !== 2) {
|
|
22
|
+
return {
|
|
23
|
+
kind: 'invalid',
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return tokenToResult(secondToken, firstToken.value);
|
|
27
|
+
}
|
|
28
|
+
if (tokens.length !== 1) {
|
|
29
|
+
return {
|
|
30
|
+
kind: 'invalid',
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return tokenToResult(firstToken, 0);
|
|
34
|
+
}
|
|
35
|
+
function isInvalidToken(token) {
|
|
36
|
+
return (token.tokenType === 'invalidInteger' || token.tokenType === 'invalidCommand');
|
|
37
|
+
}
|
|
38
|
+
function tokenToResult(token, index) {
|
|
39
|
+
switch (token.tokenType) {
|
|
40
|
+
case 'partialCommand':
|
|
41
|
+
return {
|
|
42
|
+
kind: 'incomplete',
|
|
43
|
+
};
|
|
44
|
+
case 'foldCommand':
|
|
45
|
+
return {
|
|
46
|
+
kind: 'complete',
|
|
47
|
+
action: foldCommandToAction(token, index),
|
|
48
|
+
};
|
|
49
|
+
case 'validInteger':
|
|
50
|
+
case 'invalidInteger':
|
|
51
|
+
case 'invalidCommand':
|
|
52
|
+
return {
|
|
53
|
+
kind: 'invalid',
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function foldCommandToAction(foldCommand, index) {
|
|
58
|
+
const foldTree = {
|
|
59
|
+
foldTreeReferenceType: 'index',
|
|
60
|
+
index,
|
|
61
|
+
};
|
|
62
|
+
switch (foldCommand.foldCommandType) {
|
|
63
|
+
case 'addToFoldTree':
|
|
64
|
+
return {
|
|
65
|
+
effectActionType: 'addToFoldTree',
|
|
66
|
+
foldTree,
|
|
67
|
+
};
|
|
68
|
+
case 'removeFromFoldTree':
|
|
69
|
+
return {
|
|
70
|
+
effectActionType: 'removeFromFoldTree',
|
|
71
|
+
foldTree,
|
|
72
|
+
};
|
|
73
|
+
case 'fold':
|
|
74
|
+
return {
|
|
75
|
+
effectActionType: 'fold',
|
|
76
|
+
foldTree,
|
|
77
|
+
};
|
|
78
|
+
case 'unfold':
|
|
79
|
+
return {
|
|
80
|
+
effectActionType: 'unfold',
|
|
81
|
+
foldTree,
|
|
82
|
+
};
|
|
83
|
+
case 'toggleFold':
|
|
84
|
+
return {
|
|
85
|
+
effectActionType: 'toggleFold',
|
|
86
|
+
foldTree,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type ValidInteger = {
|
|
2
|
+
tokenType: 'validInteger';
|
|
3
|
+
value: number;
|
|
4
|
+
};
|
|
5
|
+
export type InvalidInteger = {
|
|
6
|
+
tokenType: 'invalidInteger';
|
|
7
|
+
value: string;
|
|
8
|
+
};
|
|
9
|
+
export type PartialCommand = {
|
|
10
|
+
tokenType: 'partialCommand';
|
|
11
|
+
commandType: 'fold';
|
|
12
|
+
};
|
|
13
|
+
export type FoldCommand = {
|
|
14
|
+
tokenType: 'foldCommand';
|
|
15
|
+
foldCommandType: 'addToFoldTree' | 'removeFromFoldTree' | 'fold' | 'unfold' | 'toggleFold';
|
|
16
|
+
};
|
|
17
|
+
export type InvalidCommand = {
|
|
18
|
+
tokenType: 'invalidCommand';
|
|
19
|
+
value: string;
|
|
20
|
+
};
|
|
21
|
+
export type Token = ValidInteger | InvalidInteger | PartialCommand | FoldCommand | InvalidCommand;
|
|
22
|
+
export type Tokens = readonly Token[];
|
|
23
|
+
export declare function tokenizeNormalCommand(normalBuffer: string): Tokens;
|
|
24
|
+
//# sourceMappingURL=tokenize-normal-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenize-normal-command.d.ts","sourceRoot":"","sources":["../../../src/input/application/tokenize-normal-command.ts"],"names":[],"mappings":"AAiCA,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,cAAc,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,EAAE,aAAa,CAAC;IACzB,eAAe,EACX,eAAe,GACf,oBAAoB,GACpB,MAAM,GACN,QAAQ,GACR,YAAY,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,KAAK,GACb,YAAY,GACZ,cAAc,GACd,cAAc,GACd,WAAW,GACX,cAAc,CAAC;AAEnB,MAAM,MAAM,MAAM,GAAG,SAAS,KAAK,EAAE,CAAC;AAUtC,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAalE"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
function createNormalBufferReader(normalBuffer) {
|
|
2
|
+
return {
|
|
3
|
+
normalBuffer,
|
|
4
|
+
position: 0,
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
function peek(reader) {
|
|
8
|
+
return reader.normalBuffer.at(reader.position);
|
|
9
|
+
}
|
|
10
|
+
function consume(reader) {
|
|
11
|
+
const character = peek(reader);
|
|
12
|
+
if (character !== undefined) {
|
|
13
|
+
reader.position += 1;
|
|
14
|
+
}
|
|
15
|
+
return character;
|
|
16
|
+
}
|
|
17
|
+
function isDecimalDigit(character) {
|
|
18
|
+
if (character === undefined) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return character >= '0' && character <= '9';
|
|
22
|
+
}
|
|
23
|
+
export function tokenizeNormalCommand(normalBuffer) {
|
|
24
|
+
const reader = createNormalBufferReader(normalBuffer);
|
|
25
|
+
const tokens = [];
|
|
26
|
+
while (peek(reader) !== undefined) {
|
|
27
|
+
if (isDecimalDigit(peek(reader))) {
|
|
28
|
+
tokens.push(tokenizeInteger(reader));
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
tokens.push(tokenizeCommand(reader));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return tokens;
|
|
35
|
+
}
|
|
36
|
+
function tokenizeInteger(reader) {
|
|
37
|
+
let value = '';
|
|
38
|
+
while (true) {
|
|
39
|
+
const character = peek(reader);
|
|
40
|
+
if (!isDecimalDigit(character)) {
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
consume(reader);
|
|
44
|
+
value += character;
|
|
45
|
+
}
|
|
46
|
+
const parsedValue = Number(value);
|
|
47
|
+
if (!Number.isSafeInteger(parsedValue)) {
|
|
48
|
+
return {
|
|
49
|
+
tokenType: 'invalidInteger',
|
|
50
|
+
value,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
tokenType: 'validInteger',
|
|
55
|
+
value: parsedValue,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function tokenizeCommand(reader) {
|
|
59
|
+
const character = consume(reader);
|
|
60
|
+
switch (character) {
|
|
61
|
+
case 'z':
|
|
62
|
+
return tokenizeFoldCommand(reader);
|
|
63
|
+
default:
|
|
64
|
+
return {
|
|
65
|
+
tokenType: 'invalidCommand',
|
|
66
|
+
value: character ?? '',
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function tokenizeFoldCommand(reader) {
|
|
71
|
+
const character = consume(reader);
|
|
72
|
+
if (character === undefined) {
|
|
73
|
+
return {
|
|
74
|
+
tokenType: 'partialCommand',
|
|
75
|
+
commandType: 'fold',
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
switch (character) {
|
|
79
|
+
case 'f':
|
|
80
|
+
return {
|
|
81
|
+
tokenType: 'foldCommand',
|
|
82
|
+
foldCommandType: 'addToFoldTree',
|
|
83
|
+
};
|
|
84
|
+
case 'd':
|
|
85
|
+
return {
|
|
86
|
+
tokenType: 'foldCommand',
|
|
87
|
+
foldCommandType: 'removeFromFoldTree',
|
|
88
|
+
};
|
|
89
|
+
case 'c':
|
|
90
|
+
return {
|
|
91
|
+
tokenType: 'foldCommand',
|
|
92
|
+
foldCommandType: 'fold',
|
|
93
|
+
};
|
|
94
|
+
case 'o':
|
|
95
|
+
return {
|
|
96
|
+
tokenType: 'foldCommand',
|
|
97
|
+
foldCommandType: 'unfold',
|
|
98
|
+
};
|
|
99
|
+
case 'a':
|
|
100
|
+
return {
|
|
101
|
+
tokenType: 'foldCommand',
|
|
102
|
+
foldCommandType: 'toggleFold',
|
|
103
|
+
};
|
|
104
|
+
default:
|
|
105
|
+
return {
|
|
106
|
+
tokenType: 'invalidCommand',
|
|
107
|
+
value: `z${character}`,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { UserInput, InputModeState, Intent } from '../domain/index.js';
|
|
2
2
|
/**
|
|
3
|
+
* Converts a user input, mode and mode's buffer into an intent.
|
|
4
|
+
*
|
|
3
5
|
* By design "intent = input + mode + modeState", so it interprets the key
|
|
4
|
-
* inputs depending on the mode and
|
|
6
|
+
* inputs depending on the mode and mode's buffer. No other context.
|
|
5
7
|
*
|
|
6
|
-
* @param userInput - the
|
|
8
|
+
* @param userInput - the user input pressed now.
|
|
7
9
|
* @param inputModeState - the current mode and the user inputs so far.
|
|
8
10
|
* @returns The user's intent.
|
|
9
11
|
*/
|
|
@@ -1 +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
|
|
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;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,GAC7B,MAAM,GAAG,SAAS,CAQpB"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Converts a user input, mode and mode's buffer into an intent.
|
|
3
|
+
*
|
|
2
4
|
* By design "intent = input + mode + modeState", so it interprets the key
|
|
3
|
-
* inputs depending on the mode and
|
|
5
|
+
* inputs depending on the mode and mode's buffer. No other context.
|
|
4
6
|
*
|
|
5
|
-
* @param userInput - the
|
|
7
|
+
* @param userInput - the user input pressed now.
|
|
6
8
|
* @param inputModeState - the current mode and the user inputs so far.
|
|
7
9
|
* @returns The user's intent.
|
|
8
10
|
*/
|
|
@@ -15,6 +17,7 @@ export function userInputToIntent(userInput, inputModeState) {
|
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
function normalUserInputToIntent(userInput, normalBuffer) {
|
|
20
|
+
// Esc cancels of current key sequence
|
|
18
21
|
if (userInput.userInputType === 'esc') {
|
|
19
22
|
return {
|
|
20
23
|
intentType: 'setNormalBuffer',
|
|
@@ -46,10 +49,6 @@ function normalUserInputToIntent(userInput, normalBuffer) {
|
|
|
46
49
|
function normalCharacterToIntent(character, normalBuffer) {
|
|
47
50
|
if (normalBuffer === '') {
|
|
48
51
|
switch (character) {
|
|
49
|
-
case 'l':
|
|
50
|
-
return {
|
|
51
|
-
intentType: 'normalRight',
|
|
52
|
-
};
|
|
53
52
|
case 'h':
|
|
54
53
|
return {
|
|
55
54
|
intentType: 'normalLeft',
|
|
@@ -62,6 +61,10 @@ function normalCharacterToIntent(character, normalBuffer) {
|
|
|
62
61
|
return {
|
|
63
62
|
intentType: 'normalUp',
|
|
64
63
|
};
|
|
64
|
+
case 'l':
|
|
65
|
+
return {
|
|
66
|
+
intentType: 'normalRight',
|
|
67
|
+
};
|
|
65
68
|
case ':':
|
|
66
69
|
return {
|
|
67
70
|
intentType: 'enterCommandLineMode',
|
|
@@ -12,9 +12,6 @@ export type Effect<Id extends SerializableKey, Value> = Readonly<{
|
|
|
12
12
|
}> | Readonly<{
|
|
13
13
|
effectType: 'loadBranchEntries';
|
|
14
14
|
path: readonly Id[];
|
|
15
|
-
}> | Readonly<{
|
|
16
|
-
effectType: 'peekFold';
|
|
17
|
-
parentPath: readonly Id[];
|
|
18
15
|
}> | Readonly<{
|
|
19
16
|
effectType: 'saveView';
|
|
20
17
|
name: string;
|
|
@@ -24,12 +21,30 @@ export type Effect<Id extends SerializableKey, Value> = Readonly<{
|
|
|
24
21
|
name: string;
|
|
25
22
|
}> | Readonly<{
|
|
26
23
|
effectType: 'emitVisibleLeavesPaths';
|
|
24
|
+
}> | Readonly<{
|
|
25
|
+
effectType: 'listFolds';
|
|
27
26
|
}> | Readonly<{
|
|
28
27
|
effectType: 'quit';
|
|
29
28
|
exitMessage: string;
|
|
30
29
|
}> | Readonly<{
|
|
31
30
|
effectType: 'setInputState';
|
|
32
31
|
inputState: InputModeState;
|
|
32
|
+
}> | Readonly<{
|
|
33
|
+
effectType: 'unrecognizedCommand';
|
|
34
|
+
commandLine: string;
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* A user-facing reference to a fold tree.
|
|
38
|
+
*
|
|
39
|
+
* Indexes are local to a view and may be reused after deletion. Names are
|
|
40
|
+
* durable references intended for command-line use.
|
|
41
|
+
*/
|
|
42
|
+
export type FoldTreeReference = Readonly<{
|
|
43
|
+
foldTreeReferenceType: 'index';
|
|
44
|
+
index: number;
|
|
45
|
+
}> | Readonly<{
|
|
46
|
+
foldTreeReferenceType: 'name';
|
|
47
|
+
name: string;
|
|
33
48
|
}>;
|
|
34
49
|
/**
|
|
35
50
|
* An action interpreted by the state reducer.
|
|
@@ -47,9 +62,23 @@ export type EffectAction<Id extends SerializableKey, Value> = Readonly<{
|
|
|
47
62
|
entries: readonly TreeNode<Id, Value>[] | null;
|
|
48
63
|
}> | Readonly<{
|
|
49
64
|
effectActionType: 'navigateToParent';
|
|
65
|
+
}> | Readonly<{
|
|
66
|
+
effectActionType: 'addToFoldTree';
|
|
67
|
+
foldTree: FoldTreeReference;
|
|
68
|
+
}> | Readonly<{
|
|
69
|
+
effectActionType: 'removeFromFoldTree';
|
|
70
|
+
foldTree: FoldTreeReference;
|
|
50
71
|
}> | Readonly<{
|
|
51
72
|
effectActionType: 'fold';
|
|
73
|
+
foldTree: FoldTreeReference;
|
|
52
74
|
}> | Readonly<{
|
|
53
75
|
effectActionType: 'unfold';
|
|
76
|
+
foldTree: FoldTreeReference;
|
|
77
|
+
}> | Readonly<{
|
|
78
|
+
effectActionType: 'toggleFold';
|
|
79
|
+
foldTree: FoldTreeReference;
|
|
80
|
+
}> | Readonly<{
|
|
81
|
+
effectActionType: 'createFoldTree';
|
|
82
|
+
name: string;
|
|
54
83
|
}>;
|
|
55
84
|
//# sourceMappingURL=effect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effect.d.ts","sourceRoot":"","sources":["../../../src/input/domain/effect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE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GACF,QAAQ,CAAC;IACP,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,iBAAiB,CAAC;CAC7B,CAAC,GACF,QAAQ,CAAC;IACP,gBAAgB,EAAE,QAAQ,CAAC;IAC3B,QAAQ,EAAE,iBAAiB,CAAC;CAC7B,CAAC,GACF,QAAQ,CAAC;IACP,gBAAgB,EAAE,YAAY,CAAC;IAC/B,QAAQ,EAAE,iBAAiB,CAAC;CAC7B,CAAC,GACF,QAAQ,CAAC;IACP,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fold-node.impl.d.ts","sourceRoot":"","sources":["../../../src/trees/fold-node/fold-node.impl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAEf,WAAW,EACZ,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAIV,QAAQ,EACT,MAAM,sBAAsB,CAAC;AAE9B;;GAEG;AACH,KAAK,cAAc,CAAC,EAAE,SAAS,eAAe,IAAI,SAAS,EAAE,EAAE,CAAC;AA0ChE;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAAE,SAAS,eAAe,EACvD,WAAW,EAAE,WAAW,CAAC,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,GAC/C,QAAQ,CAAC,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"fold-node.impl.d.ts","sourceRoot":"","sources":["../../../src/trees/fold-node/fold-node.impl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAEf,WAAW,EACZ,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAIV,QAAQ,EACT,MAAM,sBAAsB,CAAC;AAE9B;;GAEG;AACH,KAAK,cAAc,CAAC,EAAE,SAAS,eAAe,IAAI,SAAS,EAAE,EAAE,CAAC;AA0ChE;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAAE,SAAS,eAAe,EACvD,WAAW,EAAE,WAAW,CAAC,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,GAC/C,QAAQ,CAAC,EAAE,CAAC,CA8nBd"}
|
|
@@ -229,6 +229,26 @@ export function createFoldsApi(foldTreeApi) {
|
|
|
229
229
|
],
|
|
230
230
|
});
|
|
231
231
|
},
|
|
232
|
+
getIndexByName(folds, name) {
|
|
233
|
+
const { slots } = toData(folds);
|
|
234
|
+
let matchingIndex;
|
|
235
|
+
for (let index = 0; index < slots.length; index += 1) {
|
|
236
|
+
const foldData = slots[index];
|
|
237
|
+
if (foldData === undefined || foldData.name !== name) {
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
/*
|
|
241
|
+
* Names are intended to be durable user-facing references. Until
|
|
242
|
+
* creation, rename, and restoration enforce unique names, do not
|
|
243
|
+
* choose an arbitrary matching fold tree.
|
|
244
|
+
*/
|
|
245
|
+
if (matchingIndex !== undefined) {
|
|
246
|
+
return undefined;
|
|
247
|
+
}
|
|
248
|
+
matchingIndex = index;
|
|
249
|
+
}
|
|
250
|
+
return matchingIndex;
|
|
251
|
+
},
|
|
232
252
|
getInfoAtIndex(folds, index) {
|
|
233
253
|
const foldData = getSlotAtIndex(folds, index);
|
|
234
254
|
if (foldData === undefined) {
|
|
@@ -253,6 +273,7 @@ export function createFoldsApi(foldTreeApi) {
|
|
|
253
273
|
}
|
|
254
274
|
}
|
|
255
275
|
},
|
|
276
|
+
// TODO: Enforce unique names
|
|
256
277
|
setAtIndex(folds, index, foldData) {
|
|
257
278
|
if (!isValidFoldIndex(index)) {
|
|
258
279
|
return undefined;
|
|
@@ -46,6 +46,14 @@ export type FoldsApi<Id extends SerializableKey> = Readonly<{
|
|
|
46
46
|
* The new fold tree initially contains no hidden entries and is active.
|
|
47
47
|
*/
|
|
48
48
|
create(rootId: Id, initialPrimaryInfo: FoldInfo): Folds<Id>;
|
|
49
|
+
/**
|
|
50
|
+
* Returns the occupied slot index for a unique fold-tree name.
|
|
51
|
+
*
|
|
52
|
+
* Returns `undefined` when no occupied fold tree has the name, or when the
|
|
53
|
+
* name is ambiguous. Fold-tree names should be kept unique so they remain
|
|
54
|
+
* durable user-facing references.
|
|
55
|
+
*/
|
|
56
|
+
getIndexByName(folds: Folds<Id>, name: string): FoldIndex | undefined;
|
|
49
57
|
/**
|
|
50
58
|
* Returns metadata for the fold tree at an occupied slot.
|
|
51
59
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fold-node.types.d.ts","sourceRoot":"","sources":["../../../src/trees/fold-node/fold-node.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEtE,OAAO,CAAC,MAAM,UAAU,EAAE,OAAO,MAAM,CAAC;AAExC;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAAG,QAAQ,CAAC;IAC9B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,MAAM,KAAK,CAAC,EAAE,SAAS,eAAe,IAAI;IAC9C,QAAQ,CAAC,CAAC,UAAU,CAAC,EAAE;QACrB,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC;KACjB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,QAAQ,CAAC,EAAE,SAAS,eAAe,IAAI,QAAQ,CAAC;IAC1D;;;;OAIG;IACH,MAAM,CAAC,MAAM,EAAE,EAAE,EAAE,kBAAkB,EAAE,QAAQ,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC;IAE5D;;;;OAIG;IACH,cAAc,CAAC,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,EAAE,KAAK,CAAC,EAAE,CAAC,EAChB,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,SAAS,EAAE,EAAE,EACnB,OAAO,EAAE,EAAE,GACV,KAAK,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC;IAEzB;;OAEG;IACH,eAAe,CACb,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,EAChB,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,SAAS,EAAE,EAAE,EACnB,OAAO,EAAE,EAAE,GACV,KAAK,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC;IAEzB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,0BAA0B,CACxB,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,EAChB,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,SAAS,EAAE,EAAE,GAClB,KAAK,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC;IAEzB;;OAEG;IACH,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC,CAAC;IAE1C;;;;;OAKG;IACH,SAAS,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC;CACzD,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export * from './tree-node.model.js';
|
|
2
|
-
export
|
|
3
|
-
export * from './tree-node.
|
|
1
|
+
export type * from './tree-node.model.js';
|
|
2
|
+
export { serializableKeySchema, createTreeNodeModelSchema } from './tree-node.model.js';
|
|
3
|
+
export type * from './tree-node.types.js';
|
|
4
|
+
export { createTreeNodeApi } from './tree-node.impl.js';
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/trees/tree-node/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/trees/tree-node/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,sBAAsB,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACxF,mBAAmB,sBAAsB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export * from './tree-node.impl.js';
|
|
1
|
+
export { serializableKeySchema, createTreeNodeModelSchema } from './tree-node.model.js';
|
|
2
|
+
export { createTreeNodeApi } from './tree-node.impl.js';
|