custardkit-ts 0.1.0 → 0.2.1
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/README.md +28 -17
- package/dist/Actions/index.d.mts +2 -0
- package/dist/Actions/index.mjs +3 -0
- package/dist/Actions-DGz8CoQU.mjs +289 -0
- package/dist/Keys/index.d.mts +2 -0
- package/dist/Keys/index.mjs +3 -0
- package/dist/{keys.mjs → Keys-HP_Fh_Lv.mjs} +97 -63
- package/dist/Labels/index.d.mts +2 -0
- package/dist/Labels/index.mjs +3 -0
- package/dist/{labels-B3o-iLQB.mjs → Labels-D8TEwrN8.mjs} +41 -23
- package/dist/Layout/index.d.mts +2 -0
- package/dist/Layout/index.mjs +3 -0
- package/dist/Layout-BYGdAtQk.mjs +159 -0
- package/dist/enums.d.mts +1 -1
- package/dist/enums.mjs +1 -1
- package/dist/errors-BPMIP-gS.mjs +46 -0
- package/dist/errors.d.mts +24 -0
- package/dist/errors.mjs +3 -0
- package/dist/{layout.d.mts → index-BwCtLRO6.d.mts} +53 -28
- package/dist/index-D-6qRoek.d.mts +184 -0
- package/dist/{keys-BtFhogE7.d.mts → index-D0RJeudc.d.mts} +36 -23
- package/dist/{labels-Df2PSxBF.d.mts → index-Dknx6MxA.d.mts} +33 -19
- package/dist/index.d.mts +59 -7
- package/dist/index.mjs +114 -8
- package/dist/types-BoV-UB3j.d.mts +6 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.mjs +1 -0
- package/package.json +17 -1
- package/dist/actions-R4-nSLAB.mjs +0 -174
- package/dist/actions.d.mts +0 -99
- package/dist/actions.mjs +0 -3
- package/dist/custard.d.mts +0 -52
- package/dist/custard.mjs +0 -81
- package/dist/keys.d.mts +0 -3
- package/dist/labels.d.mts +0 -3
- package/dist/labels.mjs +0 -3
- package/dist/layout.mjs +0 -92
- /package/dist/{enums-BANQq1pN.mjs → enums-BySrsID6.mjs} +0 -0
- /package/dist/{enums-B42m1Nqc.d.mts → enums-KRVewwrt.d.mts} +0 -0
package/README.md
CHANGED
|
@@ -12,32 +12,31 @@ npm add custardkit-ts
|
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
14
|
import {
|
|
15
|
+
Action,
|
|
15
16
|
Custard,
|
|
16
|
-
|
|
17
|
-
Metadata,
|
|
18
|
-
GridFitLayout,
|
|
17
|
+
CustomKey,
|
|
19
18
|
GridFitSpecifier,
|
|
19
|
+
InputStyle,
|
|
20
|
+
Interface,
|
|
21
|
+
KeyColor,
|
|
20
22
|
KeyData,
|
|
21
|
-
CustomKey,
|
|
22
23
|
KeyDesign,
|
|
23
|
-
TextLabel,
|
|
24
|
-
InputAction,
|
|
25
|
-
Language,
|
|
26
|
-
InputStyle,
|
|
27
24
|
KeyStyle,
|
|
28
|
-
|
|
25
|
+
Label,
|
|
26
|
+
Language,
|
|
27
|
+
Layout,
|
|
28
|
+
Metadata,
|
|
29
29
|
} from "custardkit-ts";
|
|
30
30
|
|
|
31
|
-
// Create a simple key
|
|
31
|
+
// Create a simple key using factory methods
|
|
32
32
|
const key = new CustomKey({
|
|
33
|
-
design:
|
|
34
|
-
|
|
35
|
-
color: KeyColor.Normal,
|
|
36
|
-
}),
|
|
37
|
-
pressActions: [new InputAction("あ")],
|
|
38
|
-
variations: [],
|
|
33
|
+
design: KeyDesign.text("あ"),
|
|
34
|
+
pressActions: [Action.input("あ")],
|
|
39
35
|
});
|
|
40
36
|
|
|
37
|
+
// Create flick-style key
|
|
38
|
+
const flickKey = CustomKey.flickSimpleInputs("あ", ["い", "う", "え", "お"]);
|
|
39
|
+
|
|
41
40
|
// Create the custard
|
|
42
41
|
const custard = new Custard({
|
|
43
42
|
identifier: "my_keyboard",
|
|
@@ -49,7 +48,7 @@ const custard = new Custard({
|
|
|
49
48
|
}),
|
|
50
49
|
interface: new Interface({
|
|
51
50
|
keyStyle: KeyStyle.TenkeyStyle,
|
|
52
|
-
keyLayout:
|
|
51
|
+
keyLayout: Layout.gridFit({ rowCount: 5, columnCount: 4 }),
|
|
53
52
|
keys: [
|
|
54
53
|
new KeyData({
|
|
55
54
|
specifier: new GridFitSpecifier({ x: 0, y: 0 }),
|
|
@@ -63,6 +62,18 @@ const custard = new Custard({
|
|
|
63
62
|
await custard.write("my_keyboard.json");
|
|
64
63
|
```
|
|
65
64
|
|
|
65
|
+
## Subpath Imports
|
|
66
|
+
|
|
67
|
+
For direct class access:
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import { InputAction, DeleteAction } from "custardkit-ts/Actions";
|
|
71
|
+
import { TextLabel } from "custardkit-ts/Labels";
|
|
72
|
+
import { CustomKey, KeyDesign } from "custardkit-ts/Keys";
|
|
73
|
+
import { GridFitLayout } from "custardkit-ts/Layout";
|
|
74
|
+
import { Custard, Metadata, Interface } from "custardkit-ts/Custard";
|
|
75
|
+
```
|
|
76
|
+
|
|
66
77
|
## License
|
|
67
78
|
|
|
68
79
|
MIT
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { _ as DismissKeyboardAction, a as SmartMoveCursorAction, b as CompleteAction, c as SelectCandidateAction, d as PasteAction, f as MoveTabAction, g as EnableResizingModeAction, h as InputAction, i as ToggleCapsLockStateAction, l as ReplaceLastCharactersAction, m as LaunchApplicationAction, n as ToggleTabBarAction, o as SmartDeleteDefaultAction, p as MoveCursorAction, r as ToggleCursorBarAction, s as SmartDeleteAction, t as Action, u as ReplaceDefaultAction, v as DeleteAction, x as BaseAction, y as CompleteCharacterFormAction } from "../index-D-6qRoek.mjs";
|
|
2
|
+
export { Action, BaseAction, CompleteAction, CompleteCharacterFormAction, DeleteAction, DismissKeyboardAction, EnableResizingModeAction, InputAction, LaunchApplicationAction, MoveCursorAction, MoveTabAction, PasteAction, ReplaceDefaultAction, ReplaceLastCharactersAction, SelectCandidateAction, SmartDeleteAction, SmartDeleteDefaultAction, SmartMoveCursorAction, ToggleCapsLockStateAction, ToggleCursorBarAction, ToggleTabBarAction };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { _ as DismissKeyboardAction, a as SmartMoveCursorAction, b as CompleteAction, c as SelectCandidateAction, d as PasteAction, f as MoveTabAction, g as EnableResizingModeAction, h as InputAction, i as ToggleCapsLockStateAction, l as ReplaceLastCharactersAction, m as LaunchApplicationAction, n as ToggleTabBarAction, o as SmartDeleteDefaultAction, p as MoveCursorAction, r as ToggleCursorBarAction, s as SmartDeleteAction, t as Action, u as ReplaceDefaultAction, v as DeleteAction, x as BaseAction, y as CompleteCharacterFormAction } from "../Actions-DGz8CoQU.mjs";
|
|
2
|
+
|
|
3
|
+
export { Action, BaseAction, CompleteAction, CompleteCharacterFormAction, DeleteAction, DismissKeyboardAction, EnableResizingModeAction, InputAction, LaunchApplicationAction, MoveCursorAction, MoveTabAction, PasteAction, ReplaceDefaultAction, ReplaceLastCharactersAction, SelectCandidateAction, SmartDeleteAction, SmartDeleteDefaultAction, SmartMoveCursorAction, ToggleCapsLockStateAction, ToggleCursorBarAction, ToggleTabBarAction };
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
//#region src/Actions/BaseAction.ts
|
|
2
|
+
var BaseAction = class {};
|
|
3
|
+
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region src/Actions/CompleteAction.ts
|
|
6
|
+
var CompleteAction = class extends BaseAction {
|
|
7
|
+
type = "complete";
|
|
8
|
+
toJSON() {
|
|
9
|
+
return { type: this.type };
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/Actions/CompleteCharacterFormAction.ts
|
|
15
|
+
var CompleteCharacterFormAction = class extends BaseAction {
|
|
16
|
+
type = "complete_character_form";
|
|
17
|
+
constructor(forms) {
|
|
18
|
+
super();
|
|
19
|
+
this.forms = forms;
|
|
20
|
+
}
|
|
21
|
+
toJSON() {
|
|
22
|
+
return {
|
|
23
|
+
forms: this.forms,
|
|
24
|
+
type: this.type
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/Actions/DeleteAction.ts
|
|
31
|
+
var DeleteAction = class extends BaseAction {
|
|
32
|
+
type = "delete";
|
|
33
|
+
constructor(count = 1) {
|
|
34
|
+
super();
|
|
35
|
+
this.count = count;
|
|
36
|
+
if (count < 1) console.warn(`DeleteAction: count (${count}) is less than 1, which is meaningless`);
|
|
37
|
+
}
|
|
38
|
+
toJSON() {
|
|
39
|
+
return {
|
|
40
|
+
count: this.count,
|
|
41
|
+
type: this.type
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/Actions/DismissKeyboardAction.ts
|
|
48
|
+
var DismissKeyboardAction = class extends BaseAction {
|
|
49
|
+
type = "dismiss_keyboard";
|
|
50
|
+
toJSON() {
|
|
51
|
+
return { type: this.type };
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/Actions/EnableResizingModeAction.ts
|
|
57
|
+
var EnableResizingModeAction = class extends BaseAction {
|
|
58
|
+
type = "enable_resizing_mode";
|
|
59
|
+
toJSON() {
|
|
60
|
+
return { type: this.type };
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/Actions/InputAction.ts
|
|
66
|
+
var InputAction = class extends BaseAction {
|
|
67
|
+
type = "input";
|
|
68
|
+
constructor(text) {
|
|
69
|
+
super();
|
|
70
|
+
this.text = text;
|
|
71
|
+
if (text === "") console.warn("InputAction: text is empty, which is meaningless");
|
|
72
|
+
}
|
|
73
|
+
toJSON() {
|
|
74
|
+
return {
|
|
75
|
+
text: this.text,
|
|
76
|
+
type: this.type
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/Actions/LaunchApplicationAction.ts
|
|
83
|
+
var LaunchApplicationAction = class extends BaseAction {
|
|
84
|
+
type = "launch_application";
|
|
85
|
+
constructor(schemeType, target) {
|
|
86
|
+
super();
|
|
87
|
+
this.schemeType = schemeType;
|
|
88
|
+
this.target = target;
|
|
89
|
+
}
|
|
90
|
+
toJSON() {
|
|
91
|
+
return {
|
|
92
|
+
scheme_type: this.schemeType,
|
|
93
|
+
target: this.target,
|
|
94
|
+
type: this.type
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/Actions/MoveCursorAction.ts
|
|
101
|
+
var MoveCursorAction = class extends BaseAction {
|
|
102
|
+
type = "move_cursor";
|
|
103
|
+
constructor(count) {
|
|
104
|
+
super();
|
|
105
|
+
this.count = count;
|
|
106
|
+
if (count === 0) console.warn("MoveCursorAction: count is 0, which is meaningless");
|
|
107
|
+
}
|
|
108
|
+
toJSON() {
|
|
109
|
+
return {
|
|
110
|
+
count: this.count,
|
|
111
|
+
type: this.type
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/Actions/MoveTabAction.ts
|
|
118
|
+
var MoveTabAction = class extends BaseAction {
|
|
119
|
+
type = "move_tab";
|
|
120
|
+
constructor(tabType, identifier) {
|
|
121
|
+
super();
|
|
122
|
+
this.tabType = tabType;
|
|
123
|
+
this.identifier = identifier;
|
|
124
|
+
}
|
|
125
|
+
toJSON() {
|
|
126
|
+
return {
|
|
127
|
+
identifier: this.identifier,
|
|
128
|
+
tab_type: this.tabType,
|
|
129
|
+
type: this.type
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/Actions/PasteAction.ts
|
|
136
|
+
var PasteAction = class extends BaseAction {
|
|
137
|
+
type = "paste";
|
|
138
|
+
toJSON() {
|
|
139
|
+
return { type: this.type };
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region src/Actions/ReplaceDefaultAction.ts
|
|
145
|
+
var ReplaceDefaultAction = class extends BaseAction {
|
|
146
|
+
type = "replace_default";
|
|
147
|
+
constructor(replaceType, fallbacks) {
|
|
148
|
+
super();
|
|
149
|
+
this.replaceType = replaceType;
|
|
150
|
+
this.fallbacks = fallbacks;
|
|
151
|
+
}
|
|
152
|
+
toJSON() {
|
|
153
|
+
const json = { type: this.type };
|
|
154
|
+
if (this.fallbacks !== void 0) json["fallbacks"] = this.fallbacks;
|
|
155
|
+
if (this.replaceType !== void 0) json["replace_type"] = this.replaceType;
|
|
156
|
+
return json;
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
//#endregion
|
|
161
|
+
//#region src/Actions/ReplaceLastCharactersAction.ts
|
|
162
|
+
var ReplaceLastCharactersAction = class extends BaseAction {
|
|
163
|
+
type = "replace_last_characters";
|
|
164
|
+
constructor(table) {
|
|
165
|
+
super();
|
|
166
|
+
this.table = table;
|
|
167
|
+
}
|
|
168
|
+
toJSON() {
|
|
169
|
+
return {
|
|
170
|
+
table: this.table,
|
|
171
|
+
type: this.type
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
//#endregion
|
|
177
|
+
//#region src/Actions/SelectCandidateAction.ts
|
|
178
|
+
var SelectCandidateAction = class extends BaseAction {
|
|
179
|
+
type = "select_candidate";
|
|
180
|
+
constructor(selection) {
|
|
181
|
+
super();
|
|
182
|
+
this.selection = selection;
|
|
183
|
+
}
|
|
184
|
+
toJSON() {
|
|
185
|
+
return {
|
|
186
|
+
selection: this.selection,
|
|
187
|
+
type: this.type
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/Actions/SmartDeleteAction.ts
|
|
194
|
+
var SmartDeleteAction = class extends BaseAction {
|
|
195
|
+
type = "smart_delete";
|
|
196
|
+
constructor(targets, direction) {
|
|
197
|
+
super();
|
|
198
|
+
this.targets = targets;
|
|
199
|
+
this.direction = direction;
|
|
200
|
+
}
|
|
201
|
+
toJSON() {
|
|
202
|
+
return {
|
|
203
|
+
direction: this.direction,
|
|
204
|
+
targets: this.targets,
|
|
205
|
+
type: this.type
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
//#endregion
|
|
211
|
+
//#region src/Actions/SmartDeleteDefaultAction.ts
|
|
212
|
+
var SmartDeleteDefaultAction = class extends BaseAction {
|
|
213
|
+
type = "smart_delete_default";
|
|
214
|
+
toJSON() {
|
|
215
|
+
return { type: this.type };
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/Actions/SmartMoveCursorAction.ts
|
|
221
|
+
var SmartMoveCursorAction = class extends BaseAction {
|
|
222
|
+
type = "smart_move_cursor";
|
|
223
|
+
constructor(targets, direction) {
|
|
224
|
+
super();
|
|
225
|
+
this.targets = targets;
|
|
226
|
+
this.direction = direction;
|
|
227
|
+
}
|
|
228
|
+
toJSON() {
|
|
229
|
+
return {
|
|
230
|
+
direction: this.direction,
|
|
231
|
+
targets: this.targets,
|
|
232
|
+
type: this.type
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
//#endregion
|
|
238
|
+
//#region src/Actions/ToggleCapsLockStateAction.ts
|
|
239
|
+
var ToggleCapsLockStateAction = class extends BaseAction {
|
|
240
|
+
type = "toggle_caps_lock_state";
|
|
241
|
+
toJSON() {
|
|
242
|
+
return { type: this.type };
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
//#endregion
|
|
247
|
+
//#region src/Actions/ToggleCursorBarAction.ts
|
|
248
|
+
var ToggleCursorBarAction = class extends BaseAction {
|
|
249
|
+
type = "toggle_cursor_bar";
|
|
250
|
+
toJSON() {
|
|
251
|
+
return { type: this.type };
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
//#endregion
|
|
256
|
+
//#region src/Actions/ToggleTabBarAction.ts
|
|
257
|
+
var ToggleTabBarAction = class extends BaseAction {
|
|
258
|
+
type = "toggle_tab_bar";
|
|
259
|
+
toJSON() {
|
|
260
|
+
return { type: this.type };
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
//#endregion
|
|
265
|
+
//#region src/Actions/index.ts
|
|
266
|
+
const Action = {
|
|
267
|
+
complete: () => new CompleteAction(),
|
|
268
|
+
completeCharacterForm: (forms) => new CompleteCharacterFormAction(forms),
|
|
269
|
+
delete: (count = 1) => new DeleteAction(count),
|
|
270
|
+
dismissKeyboard: () => new DismissKeyboardAction(),
|
|
271
|
+
enableResizingMode: () => new EnableResizingModeAction(),
|
|
272
|
+
input: (text) => new InputAction(text),
|
|
273
|
+
launchApplication: (schemeType, target) => new LaunchApplicationAction(schemeType, target),
|
|
274
|
+
moveCursor: (count) => new MoveCursorAction(count),
|
|
275
|
+
moveTab: (tabType, identifier) => new MoveTabAction(tabType, identifier),
|
|
276
|
+
paste: () => new PasteAction(),
|
|
277
|
+
replaceDefault: (replaceType, fallbacks) => new ReplaceDefaultAction(replaceType, fallbacks),
|
|
278
|
+
replaceLastCharacters: (table) => new ReplaceLastCharactersAction(table),
|
|
279
|
+
selectCandidate: (selection) => new SelectCandidateAction(selection),
|
|
280
|
+
smartDelete: (targets, direction) => new SmartDeleteAction(targets, direction),
|
|
281
|
+
smartDeleteDefault: () => new SmartDeleteDefaultAction(),
|
|
282
|
+
smartMoveCursor: (targets, direction) => new SmartMoveCursorAction(targets, direction),
|
|
283
|
+
toggleCapsLockState: () => new ToggleCapsLockStateAction(),
|
|
284
|
+
toggleCursorBar: () => new ToggleCursorBarAction(),
|
|
285
|
+
toggleTabBar: () => new ToggleTabBarAction()
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
//#endregion
|
|
289
|
+
export { DismissKeyboardAction as _, SmartMoveCursorAction as a, CompleteAction as b, SelectCandidateAction as c, PasteAction as d, MoveTabAction as f, EnableResizingModeAction as g, InputAction as h, ToggleCapsLockStateAction as i, ReplaceLastCharactersAction as l, LaunchApplicationAction as m, ToggleTabBarAction as n, SmartDeleteDefaultAction as o, MoveCursorAction as p, ToggleCursorBarAction as r, SmartDeleteAction as s, Action as t, ReplaceDefaultAction as u, DeleteAction as v, BaseAction as x, CompleteCharacterFormAction as y };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { _ as LongpressAction, a as SimpleInputArgument, c as LongpressVariationDataOptions, d as FlickVariationData, f as FlickVariationDataOptions, g as VariationDesignOptions, h as VariationDesign, i as CustomKeyOptions, l as KeyDesign, m as VariationOptions, n as SystemKey, o as VariationData, p as Variation, r as CustomKey, s as LongpressVariationData, t as Key, u as KeyDesignOptions, v as LongpressActionOptions } from "../index-D0RJeudc.mjs";
|
|
2
|
+
export { CustomKey, CustomKeyOptions, FlickVariationData, FlickVariationDataOptions, Key, KeyDesign, KeyDesignOptions, LongpressAction, LongpressActionOptions, LongpressVariationData, LongpressVariationDataOptions, SimpleInputArgument, SystemKey, Variation, VariationData, VariationDesign, VariationDesignOptions, VariationOptions };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as VariationDesign, c as FlickVariationData, i as Variation, n as LongpressVariationData, o as LongpressAction, r as CustomKey, s as KeyDesign, t as SystemKey } from "../Keys-HP_Fh_Lv.mjs";
|
|
2
|
+
|
|
3
|
+
export { CustomKey, FlickVariationData, KeyDesign, LongpressAction, LongpressVariationData, SystemKey, Variation, VariationDesign };
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { i as KeyColor, n as FlickDirection } from "./enums-BySrsID6.mjs";
|
|
2
|
+
import { t as Label } from "./Labels-D8TEwrN8.mjs";
|
|
3
|
+
import { t as Action } from "./Actions-DGz8CoQU.mjs";
|
|
4
4
|
|
|
5
|
-
//#region src/
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this.
|
|
12
|
-
this.repeat = options.repeat ?? [];
|
|
13
|
-
this.start = options.start ?? [];
|
|
5
|
+
//#region src/Keys/FlickVariationData.ts
|
|
6
|
+
var FlickVariationData = class {
|
|
7
|
+
direction;
|
|
8
|
+
key;
|
|
9
|
+
constructor(options) {
|
|
10
|
+
this.direction = options.direction;
|
|
11
|
+
this.key = options.key;
|
|
14
12
|
}
|
|
15
13
|
toJSON() {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
return {
|
|
15
|
+
direction: this.direction,
|
|
16
|
+
key: this.key.toJSON(),
|
|
17
|
+
type: "flick_variation"
|
|
19
18
|
};
|
|
20
|
-
if (this.duration !== void 0) json["duration"] = this.duration;
|
|
21
|
-
return json;
|
|
22
19
|
}
|
|
23
20
|
};
|
|
24
|
-
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/Keys/KeyDesign.ts
|
|
24
|
+
var KeyDesign = class KeyDesign {
|
|
25
25
|
label;
|
|
26
26
|
color;
|
|
27
27
|
constructor(options) {
|
|
@@ -34,8 +34,44 @@ var KeyDesign = class {
|
|
|
34
34
|
label: this.label.toJSON()
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
+
static create(label, color) {
|
|
38
|
+
return new KeyDesign({
|
|
39
|
+
color,
|
|
40
|
+
label
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
static text(text, color) {
|
|
44
|
+
return new KeyDesign({
|
|
45
|
+
color,
|
|
46
|
+
label: Label.text(text)
|
|
47
|
+
});
|
|
48
|
+
}
|
|
37
49
|
};
|
|
38
|
-
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/Keys/LongpressAction.ts
|
|
53
|
+
var LongpressAction = class {
|
|
54
|
+
start;
|
|
55
|
+
repeat;
|
|
56
|
+
duration;
|
|
57
|
+
constructor(options = {}) {
|
|
58
|
+
this.duration = options.duration;
|
|
59
|
+
this.repeat = options.repeat ?? [];
|
|
60
|
+
this.start = options.start ?? [];
|
|
61
|
+
}
|
|
62
|
+
toJSON() {
|
|
63
|
+
const json = {
|
|
64
|
+
repeat: this.repeat.map((a) => a.toJSON()),
|
|
65
|
+
start: this.start.map((a) => a.toJSON())
|
|
66
|
+
};
|
|
67
|
+
if (this.duration !== void 0) json["duration"] = this.duration;
|
|
68
|
+
return json;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/Keys/VariationDesign.ts
|
|
74
|
+
var VariationDesign = class VariationDesign {
|
|
39
75
|
label;
|
|
40
76
|
constructor(options) {
|
|
41
77
|
this.label = options.label;
|
|
@@ -43,8 +79,14 @@ var VariationDesign = class {
|
|
|
43
79
|
toJSON() {
|
|
44
80
|
return { label: this.label.toJSON() };
|
|
45
81
|
}
|
|
82
|
+
static text(text) {
|
|
83
|
+
return new VariationDesign({ label: Label.text(text) });
|
|
84
|
+
}
|
|
46
85
|
};
|
|
47
|
-
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/Keys/Variation.ts
|
|
89
|
+
var Variation = class Variation {
|
|
48
90
|
design;
|
|
49
91
|
pressActions;
|
|
50
92
|
longpressActions;
|
|
@@ -60,34 +102,16 @@ var Variation = class {
|
|
|
60
102
|
press_actions: this.pressActions.map((a) => a.toJSON())
|
|
61
103
|
};
|
|
62
104
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
this.direction = options.direction;
|
|
69
|
-
this.key = options.key;
|
|
70
|
-
}
|
|
71
|
-
toJSON() {
|
|
72
|
-
return {
|
|
73
|
-
direction: this.direction,
|
|
74
|
-
key: this.key.toJSON(),
|
|
75
|
-
type: "flick_variation"
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
var LongpressVariationData = class {
|
|
80
|
-
key;
|
|
81
|
-
constructor(options) {
|
|
82
|
-
this.key = options.key;
|
|
83
|
-
}
|
|
84
|
-
toJSON() {
|
|
85
|
-
return {
|
|
86
|
-
key: this.key.toJSON(),
|
|
87
|
-
type: "longpress_variation"
|
|
88
|
-
};
|
|
105
|
+
static simpleInput(text, label) {
|
|
106
|
+
return new Variation({
|
|
107
|
+
design: VariationDesign.text(label ?? text),
|
|
108
|
+
pressActions: [Action.input(text)]
|
|
109
|
+
});
|
|
89
110
|
}
|
|
90
111
|
};
|
|
112
|
+
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/Keys/CustomKey.ts
|
|
91
115
|
var CustomKey = class CustomKey {
|
|
92
116
|
design;
|
|
93
117
|
pressActions;
|
|
@@ -107,10 +131,6 @@ var CustomKey = class CustomKey {
|
|
|
107
131
|
variations: this.variations.map((v) => v.toJSON())
|
|
108
132
|
};
|
|
109
133
|
}
|
|
110
|
-
/**
|
|
111
|
-
* Create a flick-style key with center and directional inputs.
|
|
112
|
-
* Directions are assigned in order: left, top, right, bottom.
|
|
113
|
-
*/
|
|
114
134
|
static flickSimpleInputs(center, subs, centerLabel) {
|
|
115
135
|
const directions = [
|
|
116
136
|
FlickDirection.Left,
|
|
@@ -126,21 +146,17 @@ var CustomKey = class CustomKey {
|
|
|
126
146
|
if (sub !== void 0 && direction !== void 0) variations.push(new FlickVariationData({
|
|
127
147
|
direction,
|
|
128
148
|
key: new Variation({
|
|
129
|
-
design: new VariationDesign({ label:
|
|
130
|
-
pressActions: [
|
|
149
|
+
design: new VariationDesign({ label: Label.text(sub) }),
|
|
150
|
+
pressActions: [Action.input(sub)]
|
|
131
151
|
})
|
|
132
152
|
}));
|
|
133
153
|
}
|
|
134
154
|
return new CustomKey({
|
|
135
|
-
design: new KeyDesign({ label:
|
|
136
|
-
pressActions: [
|
|
155
|
+
design: new KeyDesign({ label: Label.text(centerLabel ?? center) }),
|
|
156
|
+
pressActions: [Action.input(center)],
|
|
137
157
|
variations
|
|
138
158
|
});
|
|
139
159
|
}
|
|
140
|
-
/**
|
|
141
|
-
* Create a flick-style key with label and input for each direction.
|
|
142
|
-
* Each argument can be a string (label=input) or {label, input} object.
|
|
143
|
-
*/
|
|
144
160
|
static flickSimpleInputAndLabels(options) {
|
|
145
161
|
const parseArg = (arg) => {
|
|
146
162
|
if (typeof arg === "string") return {
|
|
@@ -162,18 +178,36 @@ var CustomKey = class CustomKey {
|
|
|
162
178
|
variations.push(new FlickVariationData({
|
|
163
179
|
direction,
|
|
164
180
|
key: new Variation({
|
|
165
|
-
design: new VariationDesign({ label:
|
|
166
|
-
pressActions: [
|
|
181
|
+
design: new VariationDesign({ label: Label.text(parsed.label) }),
|
|
182
|
+
pressActions: [Action.input(parsed.input)]
|
|
167
183
|
})
|
|
168
184
|
}));
|
|
169
185
|
}
|
|
170
186
|
return new CustomKey({
|
|
171
|
-
design: new KeyDesign({ label:
|
|
172
|
-
pressActions: [
|
|
187
|
+
design: new KeyDesign({ label: Label.text(centerParsed.label) }),
|
|
188
|
+
pressActions: [Action.input(centerParsed.input)],
|
|
173
189
|
variations
|
|
174
190
|
});
|
|
175
191
|
}
|
|
176
192
|
};
|
|
193
|
+
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region src/Keys/LongpressVariationData.ts
|
|
196
|
+
var LongpressVariationData = class {
|
|
197
|
+
key;
|
|
198
|
+
constructor(options) {
|
|
199
|
+
this.key = options.key;
|
|
200
|
+
}
|
|
201
|
+
toJSON() {
|
|
202
|
+
return {
|
|
203
|
+
key: this.key.toJSON(),
|
|
204
|
+
type: "longpress_variation"
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region src/Keys/SystemKey.ts
|
|
177
211
|
var SystemKey = class {
|
|
178
212
|
constructor(keyType) {
|
|
179
213
|
this.keyType = keyType;
|
|
@@ -184,4 +218,4 @@ var SystemKey = class {
|
|
|
184
218
|
};
|
|
185
219
|
|
|
186
220
|
//#endregion
|
|
187
|
-
export {
|
|
221
|
+
export { VariationDesign as a, FlickVariationData as c, Variation as i, LongpressVariationData as n, LongpressAction as o, CustomKey as r, KeyDesign as s, SystemKey as t };
|