custardkit-ts 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Yuta Fudaba
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # CustardKitTS
2
+
3
+ TypeScript implementation of [CustardKit](https://github.com/azooKey/CustardKit)
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm add custardkit-ts
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import {
15
+ Custard,
16
+ Interface,
17
+ Metadata,
18
+ GridFitLayout,
19
+ GridFitSpecifier,
20
+ KeyData,
21
+ CustomKey,
22
+ KeyDesign,
23
+ TextLabel,
24
+ InputAction,
25
+ Language,
26
+ InputStyle,
27
+ KeyStyle,
28
+ KeyColor,
29
+ } from "custardkit-ts";
30
+
31
+ // Create a simple key
32
+ const key = new CustomKey({
33
+ design: new KeyDesign({
34
+ label: new TextLabel("あ"),
35
+ color: KeyColor.Normal,
36
+ }),
37
+ pressActions: [new InputAction("あ")],
38
+ variations: [],
39
+ });
40
+
41
+ // Create the custard
42
+ const custard = new Custard({
43
+ identifier: "my_keyboard",
44
+ language: Language.JaJP,
45
+ inputStyle: InputStyle.Direct,
46
+ metadata: new Metadata({
47
+ custardVersion: "1.2",
48
+ displayName: "My Keyboard",
49
+ }),
50
+ interface: new Interface({
51
+ keyStyle: KeyStyle.TenkeyStyle,
52
+ keyLayout: new GridFitLayout({ rowCount: 5, columnCount: 4 }),
53
+ keys: [
54
+ new KeyData({
55
+ specifier: new GridFitSpecifier({ x: 0, y: 0 }),
56
+ key: key,
57
+ }),
58
+ ],
59
+ }),
60
+ });
61
+
62
+ // Write to file
63
+ await custard.write("my_keyboard.json");
64
+ ```
65
+
66
+ ## License
67
+
68
+ MIT
@@ -0,0 +1,174 @@
1
+ //#region src/actions.ts
2
+ var InputAction = class {
3
+ constructor(text) {
4
+ this.text = text;
5
+ }
6
+ toJSON() {
7
+ return {
8
+ text: this.text,
9
+ type: "input"
10
+ };
11
+ }
12
+ };
13
+ var PasteAction = class {
14
+ toJSON() {
15
+ return { type: "paste" };
16
+ }
17
+ };
18
+ var DeleteAction = class {
19
+ constructor(count = 1) {
20
+ this.count = count;
21
+ }
22
+ toJSON() {
23
+ return {
24
+ count: this.count,
25
+ type: "delete"
26
+ };
27
+ }
28
+ };
29
+ var MoveCursorAction = class {
30
+ constructor(count) {
31
+ this.count = count;
32
+ }
33
+ toJSON() {
34
+ return {
35
+ count: this.count,
36
+ type: "move_cursor"
37
+ };
38
+ }
39
+ };
40
+ var ReplaceDefaultAction = class {
41
+ constructor(replaceType, fallbacks) {
42
+ this.replaceType = replaceType;
43
+ this.fallbacks = fallbacks;
44
+ }
45
+ toJSON() {
46
+ const json = { type: "replace_default" };
47
+ if (this.fallbacks !== void 0) json["fallbacks"] = this.fallbacks;
48
+ if (this.replaceType !== void 0) json["replace_type"] = this.replaceType;
49
+ return json;
50
+ }
51
+ };
52
+ var ReplaceLastCharactersAction = class {
53
+ constructor(table) {
54
+ this.table = table;
55
+ }
56
+ toJSON() {
57
+ return {
58
+ table: this.table,
59
+ type: "replace_last_characters"
60
+ };
61
+ }
62
+ };
63
+ var SmartDeleteAction = class {
64
+ constructor(targets, direction) {
65
+ this.targets = targets;
66
+ this.direction = direction;
67
+ }
68
+ toJSON() {
69
+ return {
70
+ direction: this.direction,
71
+ targets: this.targets,
72
+ type: "smart_delete"
73
+ };
74
+ }
75
+ };
76
+ var SmartDeleteDefaultAction = class {
77
+ toJSON() {
78
+ return { type: "smart_delete_default" };
79
+ }
80
+ };
81
+ var SmartMoveCursorAction = class {
82
+ constructor(targets, direction) {
83
+ this.targets = targets;
84
+ this.direction = direction;
85
+ }
86
+ toJSON() {
87
+ return {
88
+ direction: this.direction,
89
+ targets: this.targets,
90
+ type: "smart_move_cursor"
91
+ };
92
+ }
93
+ };
94
+ var SelectCandidateAction = class {
95
+ constructor(selection) {
96
+ this.selection = selection;
97
+ }
98
+ toJSON() {
99
+ return {
100
+ selection: this.selection,
101
+ type: "select_candidate"
102
+ };
103
+ }
104
+ };
105
+ var CompleteAction = class {
106
+ toJSON() {
107
+ return { type: "complete" };
108
+ }
109
+ };
110
+ var CompleteCharacterFormAction = class {
111
+ constructor(forms) {
112
+ this.forms = forms;
113
+ }
114
+ toJSON() {
115
+ return {
116
+ forms: this.forms,
117
+ type: "complete_character_form"
118
+ };
119
+ }
120
+ };
121
+ var MoveTabAction = class {
122
+ constructor(tabType, identifier) {
123
+ this.tabType = tabType;
124
+ this.identifier = identifier;
125
+ }
126
+ toJSON() {
127
+ return {
128
+ identifier: this.identifier,
129
+ tab_type: this.tabType,
130
+ type: "move_tab"
131
+ };
132
+ }
133
+ };
134
+ var ToggleTabBarAction = class {
135
+ toJSON() {
136
+ return { type: "toggle_tab_bar" };
137
+ }
138
+ };
139
+ var ToggleCursorBarAction = class {
140
+ toJSON() {
141
+ return { type: "toggle_cursor_bar" };
142
+ }
143
+ };
144
+ var ToggleCapsLockStateAction = class {
145
+ toJSON() {
146
+ return { type: "toggle_caps_lock_state" };
147
+ }
148
+ };
149
+ var EnableResizingModeAction = class {
150
+ toJSON() {
151
+ return { type: "enable_resizing_mode" };
152
+ }
153
+ };
154
+ var DismissKeyboardAction = class {
155
+ toJSON() {
156
+ return { type: "dismiss_keyboard" };
157
+ }
158
+ };
159
+ var LaunchApplicationAction = class {
160
+ constructor(schemeType, target) {
161
+ this.schemeType = schemeType;
162
+ this.target = target;
163
+ }
164
+ toJSON() {
165
+ return {
166
+ scheme_type: this.schemeType,
167
+ target: this.target,
168
+ type: "launch_application"
169
+ };
170
+ }
171
+ };
172
+
173
+ //#endregion
174
+ export { ToggleCapsLockStateAction as _, EnableResizingModeAction as a, MoveCursorAction as c, ReplaceDefaultAction as d, ReplaceLastCharactersAction as f, SmartMoveCursorAction as g, SmartDeleteDefaultAction as h, DismissKeyboardAction as i, MoveTabAction as l, SmartDeleteAction as m, CompleteCharacterFormAction as n, InputAction as o, SelectCandidateAction as p, DeleteAction as r, LaunchApplicationAction as s, CompleteAction as t, PasteAction as u, ToggleCursorBarAction as v, ToggleTabBarAction as y };
@@ -0,0 +1,99 @@
1
+ import { c as ReplaceType, f as SystemTabType, l as ScanDirection, t as CharacterForm } from "./enums-B42m1Nqc.mjs";
2
+
3
+ //#region src/actions.d.ts
4
+ interface Serializable {
5
+ toJSON(): object;
6
+ }
7
+ declare class InputAction implements Serializable {
8
+ readonly text: string;
9
+ constructor(text: string);
10
+ toJSON(): object;
11
+ }
12
+ declare class PasteAction implements Serializable {
13
+ toJSON(): object;
14
+ }
15
+ declare class DeleteAction implements Serializable {
16
+ readonly count: number;
17
+ constructor(count?: number);
18
+ toJSON(): object;
19
+ }
20
+ declare class MoveCursorAction implements Serializable {
21
+ readonly count: number;
22
+ constructor(count: number);
23
+ toJSON(): object;
24
+ }
25
+ declare class ReplaceDefaultAction implements Serializable {
26
+ readonly replaceType?: ReplaceType | undefined;
27
+ readonly fallbacks?: ReplaceType[] | undefined;
28
+ constructor(replaceType?: ReplaceType | undefined, fallbacks?: ReplaceType[] | undefined);
29
+ toJSON(): object;
30
+ }
31
+ declare class ReplaceLastCharactersAction implements Serializable {
32
+ readonly table: Record<string, string>;
33
+ constructor(table: Record<string, string>);
34
+ toJSON(): object;
35
+ }
36
+ declare class SmartDeleteAction implements Serializable {
37
+ readonly targets: string[];
38
+ readonly direction: ScanDirection;
39
+ constructor(targets: string[], direction: ScanDirection);
40
+ toJSON(): object;
41
+ }
42
+ declare class SmartDeleteDefaultAction implements Serializable {
43
+ toJSON(): object;
44
+ }
45
+ declare class SmartMoveCursorAction implements Serializable {
46
+ readonly targets: string[];
47
+ readonly direction: ScanDirection;
48
+ constructor(targets: string[], direction: ScanDirection);
49
+ toJSON(): object;
50
+ }
51
+ declare class SelectCandidateAction implements Serializable {
52
+ readonly selection: {
53
+ type: string;
54
+ value?: number;
55
+ };
56
+ constructor(selection: {
57
+ type: string;
58
+ value?: number;
59
+ });
60
+ toJSON(): object;
61
+ }
62
+ declare class CompleteAction implements Serializable {
63
+ toJSON(): object;
64
+ }
65
+ declare class CompleteCharacterFormAction implements Serializable {
66
+ readonly forms: CharacterForm[];
67
+ constructor(forms: CharacterForm[]);
68
+ toJSON(): object;
69
+ }
70
+ declare class MoveTabAction implements Serializable {
71
+ readonly tabType: "system" | "custom";
72
+ readonly identifier: SystemTabType | string;
73
+ constructor(tabType: "system" | "custom", identifier: SystemTabType | string);
74
+ toJSON(): object;
75
+ }
76
+ declare class ToggleTabBarAction implements Serializable {
77
+ toJSON(): object;
78
+ }
79
+ declare class ToggleCursorBarAction implements Serializable {
80
+ toJSON(): object;
81
+ }
82
+ declare class ToggleCapsLockStateAction implements Serializable {
83
+ toJSON(): object;
84
+ }
85
+ declare class EnableResizingModeAction implements Serializable {
86
+ toJSON(): object;
87
+ }
88
+ declare class DismissKeyboardAction implements Serializable {
89
+ toJSON(): object;
90
+ }
91
+ declare class LaunchApplicationAction implements Serializable {
92
+ readonly schemeType: "azooKey" | "shortcuts";
93
+ readonly target: string;
94
+ constructor(schemeType: "azooKey" | "shortcuts", target: string);
95
+ toJSON(): object;
96
+ }
97
+ type Action = CompleteAction | CompleteCharacterFormAction | DeleteAction | DismissKeyboardAction | EnableResizingModeAction | InputAction | LaunchApplicationAction | MoveCursorAction | MoveTabAction | PasteAction | ReplaceDefaultAction | ReplaceLastCharactersAction | SelectCandidateAction | SmartDeleteAction | SmartDeleteDefaultAction | SmartMoveCursorAction | ToggleCapsLockStateAction | ToggleCursorBarAction | ToggleTabBarAction;
98
+ //#endregion
99
+ export { Action, CompleteAction, CompleteCharacterFormAction, DeleteAction, DismissKeyboardAction, EnableResizingModeAction, InputAction, LaunchApplicationAction, MoveCursorAction, MoveTabAction, PasteAction, ReplaceDefaultAction, ReplaceLastCharactersAction, SelectCandidateAction, Serializable, SmartDeleteAction, SmartDeleteDefaultAction, SmartMoveCursorAction, ToggleCapsLockStateAction, ToggleCursorBarAction, ToggleTabBarAction };
@@ -0,0 +1,3 @@
1
+ import { _ as ToggleCapsLockStateAction, a as EnableResizingModeAction, c as MoveCursorAction, d as ReplaceDefaultAction, f as ReplaceLastCharactersAction, g as SmartMoveCursorAction, h as SmartDeleteDefaultAction, i as DismissKeyboardAction, l as MoveTabAction, m as SmartDeleteAction, n as CompleteCharacterFormAction, o as InputAction, p as SelectCandidateAction, r as DeleteAction, s as LaunchApplicationAction, t as CompleteAction, u as PasteAction, v as ToggleCursorBarAction, y as ToggleTabBarAction } from "./actions-R4-nSLAB.mjs";
2
+
3
+ export { CompleteAction, CompleteCharacterFormAction, DeleteAction, DismissKeyboardAction, EnableResizingModeAction, InputAction, LaunchApplicationAction, MoveCursorAction, MoveTabAction, PasteAction, ReplaceDefaultAction, ReplaceLastCharactersAction, SelectCandidateAction, SmartDeleteAction, SmartDeleteDefaultAction, SmartMoveCursorAction, ToggleCapsLockStateAction, ToggleCursorBarAction, ToggleTabBarAction };
@@ -0,0 +1,52 @@
1
+ import { a as KeyStyle, o as Language, r as InputStyle } from "./enums-B42m1Nqc.mjs";
2
+ import { Serializable } from "./actions.mjs";
3
+ import { KeyData, Layout } from "./layout.mjs";
4
+
5
+ //#region src/custard.d.ts
6
+ interface MetadataOptions {
7
+ custardVersion: string;
8
+ displayName: string;
9
+ }
10
+ declare class Metadata implements Serializable {
11
+ readonly custardVersion: string;
12
+ readonly displayName: string;
13
+ constructor(options: MetadataOptions);
14
+ toJSON(): object;
15
+ }
16
+ interface InterfaceOptions {
17
+ keyStyle: KeyStyle;
18
+ keyLayout: Layout;
19
+ keys: KeyData[];
20
+ }
21
+ declare class Interface implements Serializable {
22
+ readonly keyStyle: KeyStyle;
23
+ readonly keyLayout: Layout;
24
+ readonly keys: KeyData[];
25
+ constructor(options: InterfaceOptions);
26
+ toJSON(): object;
27
+ }
28
+ interface CustardOptions {
29
+ identifier: string;
30
+ language: Language;
31
+ inputStyle: InputStyle;
32
+ metadata: Metadata;
33
+ interface: Interface;
34
+ }
35
+ declare class Custard implements Serializable {
36
+ readonly identifier: string;
37
+ readonly language: Language;
38
+ readonly inputStyle: InputStyle;
39
+ readonly metadata: Metadata;
40
+ readonly interface: Interface;
41
+ constructor(options: CustardOptions);
42
+ toJSON(): object;
43
+ write(name: string): Promise<void>;
44
+ }
45
+ declare class CustardList {
46
+ readonly custards: Custard[];
47
+ constructor(custards: Custard[]);
48
+ toJSON(): object[];
49
+ write(name: string): Promise<void>;
50
+ }
51
+ //#endregion
52
+ export { Custard, CustardList, CustardOptions, Interface, InterfaceOptions, Metadata, MetadataOptions };
@@ -0,0 +1,81 @@
1
+ import { writeFile } from "node:fs/promises";
2
+
3
+ //#region src/custard.ts
4
+ var Metadata = class {
5
+ custardVersion;
6
+ displayName;
7
+ constructor(options) {
8
+ this.custardVersion = options.custardVersion;
9
+ this.displayName = options.displayName;
10
+ }
11
+ toJSON() {
12
+ return {
13
+ custard_version: this.custardVersion,
14
+ display_name: this.displayName
15
+ };
16
+ }
17
+ };
18
+ var Interface = class {
19
+ keyStyle;
20
+ keyLayout;
21
+ keys;
22
+ constructor(options) {
23
+ this.keyLayout = options.keyLayout;
24
+ this.keyStyle = options.keyStyle;
25
+ this.keys = options.keys;
26
+ }
27
+ toJSON() {
28
+ return {
29
+ key_layout: this.keyLayout.toJSON(),
30
+ key_style: this.keyStyle,
31
+ keys: this.keys.map((k) => k.toJSON())
32
+ };
33
+ }
34
+ };
35
+ var Custard = class {
36
+ identifier;
37
+ language;
38
+ inputStyle;
39
+ metadata;
40
+ interface;
41
+ constructor(options) {
42
+ this.identifier = options.identifier;
43
+ this.inputStyle = options.inputStyle;
44
+ this.interface = options.interface;
45
+ this.language = options.language;
46
+ this.metadata = options.metadata;
47
+ }
48
+ toJSON() {
49
+ return {
50
+ identifier: this.identifier,
51
+ input_style: this.inputStyle,
52
+ interface: this.interface.toJSON(),
53
+ language: this.language,
54
+ metadata: this.metadata.toJSON()
55
+ };
56
+ }
57
+ async write(name) {
58
+ let filename = name;
59
+ if (!name.endsWith(".json")) filename = `${name}.json`;
60
+ const content = `${JSON.stringify(this, null, 2)}\n`;
61
+ await writeFile(filename, content, { encoding: "utf8" });
62
+ }
63
+ };
64
+ var CustardList = class {
65
+ custards;
66
+ constructor(custards) {
67
+ this.custards = custards;
68
+ }
69
+ toJSON() {
70
+ return this.custards.map((c) => c.toJSON());
71
+ }
72
+ async write(name) {
73
+ let filename = name;
74
+ if (!name.endsWith(".json")) filename = `${name}.json`;
75
+ const content = `${JSON.stringify(this.toJSON(), null, 2)}\n`;
76
+ await writeFile(filename, content, { encoding: "utf8" });
77
+ }
78
+ };
79
+
80
+ //#endregion
81
+ export { Custard, CustardList, Interface, Metadata };
@@ -0,0 +1,80 @@
1
+ //#region src/enums.d.ts
2
+ declare enum Language {
3
+ EnUS = "en_US",
4
+ JaJP = "ja_JP",
5
+ ElGR = "el_GR",
6
+ None = "none",
7
+ Undefined = "undefined",
8
+ }
9
+ declare enum InputStyle {
10
+ Direct = "direct",
11
+ Roman2Kana = "roman2kana",
12
+ }
13
+ declare enum KeyStyle {
14
+ TenkeyStyle = "tenkey_style",
15
+ PcStyle = "pc_style",
16
+ }
17
+ declare enum KeyColor {
18
+ Normal = "normal",
19
+ Special = "special",
20
+ Selected = "selected",
21
+ Unimportant = "unimportant",
22
+ }
23
+ declare enum FlickDirection {
24
+ Left = "left",
25
+ Top = "top",
26
+ Right = "right",
27
+ Bottom = "bottom",
28
+ }
29
+ declare enum SystemKeyType {
30
+ ChangeKeyboard = "change_keyboard",
31
+ Enter = "enter",
32
+ UpperLower = "upper_lower",
33
+ NextCandidate = "next_candidate",
34
+ FlickKogaki = "flick_kogaki",
35
+ FlickKutoten = "flick_kutoten",
36
+ FlickHiraTab = "flick_hira_tab",
37
+ FlickAbcTab = "flick_abc_tab",
38
+ FlickStar123Tab = "flick_star123_tab",
39
+ }
40
+ declare enum SystemTabType {
41
+ UserJapanese = "user_japanese",
42
+ UserEnglish = "user_english",
43
+ FlickJapanese = "flick_japanese",
44
+ FlickEnglish = "flick_english",
45
+ FlickNumberSymbols = "flick_numbersymbols",
46
+ QwertyJapanese = "qwerty_japanese",
47
+ QwertyEnglish = "qwerty_english",
48
+ QwertyNumbers = "qwerty_numbers",
49
+ QwertySymbols = "qwerty_symbols",
50
+ LastTab = "last_tab",
51
+ ClipboardHistoryTab = "clipboard_history_tab",
52
+ EmojiTab = "emoji_tab",
53
+ }
54
+ declare enum ScanDirection {
55
+ Forward = "forward",
56
+ Backward = "backward",
57
+ }
58
+ declare enum ReplaceType {
59
+ Default = "default",
60
+ Dakuten = "dakuten",
61
+ Handakuten = "handakuten",
62
+ Kogaki = "kogaki",
63
+ }
64
+ declare enum CharacterForm {
65
+ Hiragana = "hiragana",
66
+ Katakana = "katakana",
67
+ HalfwidthKatakana = "halfwidth_katakana",
68
+ Uppercase = "uppercase",
69
+ Lowercase = "lowercase",
70
+ }
71
+ declare enum LongpressDuration {
72
+ Normal = "normal",
73
+ Light = "light",
74
+ }
75
+ declare enum ScrollDirection {
76
+ Horizontal = "horizontal",
77
+ Vertical = "vertical",
78
+ }
79
+ //#endregion
80
+ export { KeyStyle as a, ReplaceType as c, SystemKeyType as d, SystemTabType as f, KeyColor as i, ScanDirection as l, FlickDirection as n, Language as o, InputStyle as r, LongpressDuration as s, CharacterForm as t, ScrollDirection as u };
@@ -0,0 +1,93 @@
1
+ //#region src/enums.ts
2
+ let Language = /* @__PURE__ */ function(Language$1) {
3
+ Language$1["EnUS"] = "en_US";
4
+ Language$1["JaJP"] = "ja_JP";
5
+ Language$1["ElGR"] = "el_GR";
6
+ Language$1["None"] = "none";
7
+ Language$1["Undefined"] = "undefined";
8
+ return Language$1;
9
+ }({});
10
+ let InputStyle = /* @__PURE__ */ function(InputStyle$1) {
11
+ InputStyle$1["Direct"] = "direct";
12
+ InputStyle$1["Roman2Kana"] = "roman2kana";
13
+ return InputStyle$1;
14
+ }({});
15
+ let KeyStyle = /* @__PURE__ */ function(KeyStyle$1) {
16
+ KeyStyle$1["TenkeyStyle"] = "tenkey_style";
17
+ KeyStyle$1["PcStyle"] = "pc_style";
18
+ return KeyStyle$1;
19
+ }({});
20
+ let KeyColor = /* @__PURE__ */ function(KeyColor$1) {
21
+ KeyColor$1["Normal"] = "normal";
22
+ KeyColor$1["Special"] = "special";
23
+ KeyColor$1["Selected"] = "selected";
24
+ KeyColor$1["Unimportant"] = "unimportant";
25
+ return KeyColor$1;
26
+ }({});
27
+ let FlickDirection = /* @__PURE__ */ function(FlickDirection$1) {
28
+ FlickDirection$1["Left"] = "left";
29
+ FlickDirection$1["Top"] = "top";
30
+ FlickDirection$1["Right"] = "right";
31
+ FlickDirection$1["Bottom"] = "bottom";
32
+ return FlickDirection$1;
33
+ }({});
34
+ let SystemKeyType = /* @__PURE__ */ function(SystemKeyType$1) {
35
+ SystemKeyType$1["ChangeKeyboard"] = "change_keyboard";
36
+ SystemKeyType$1["Enter"] = "enter";
37
+ SystemKeyType$1["UpperLower"] = "upper_lower";
38
+ SystemKeyType$1["NextCandidate"] = "next_candidate";
39
+ SystemKeyType$1["FlickKogaki"] = "flick_kogaki";
40
+ SystemKeyType$1["FlickKutoten"] = "flick_kutoten";
41
+ SystemKeyType$1["FlickHiraTab"] = "flick_hira_tab";
42
+ SystemKeyType$1["FlickAbcTab"] = "flick_abc_tab";
43
+ SystemKeyType$1["FlickStar123Tab"] = "flick_star123_tab";
44
+ return SystemKeyType$1;
45
+ }({});
46
+ let SystemTabType = /* @__PURE__ */ function(SystemTabType$1) {
47
+ SystemTabType$1["UserJapanese"] = "user_japanese";
48
+ SystemTabType$1["UserEnglish"] = "user_english";
49
+ SystemTabType$1["FlickJapanese"] = "flick_japanese";
50
+ SystemTabType$1["FlickEnglish"] = "flick_english";
51
+ SystemTabType$1["FlickNumberSymbols"] = "flick_numbersymbols";
52
+ SystemTabType$1["QwertyJapanese"] = "qwerty_japanese";
53
+ SystemTabType$1["QwertyEnglish"] = "qwerty_english";
54
+ SystemTabType$1["QwertyNumbers"] = "qwerty_numbers";
55
+ SystemTabType$1["QwertySymbols"] = "qwerty_symbols";
56
+ SystemTabType$1["LastTab"] = "last_tab";
57
+ SystemTabType$1["ClipboardHistoryTab"] = "clipboard_history_tab";
58
+ SystemTabType$1["EmojiTab"] = "emoji_tab";
59
+ return SystemTabType$1;
60
+ }({});
61
+ let ScanDirection = /* @__PURE__ */ function(ScanDirection$1) {
62
+ ScanDirection$1["Forward"] = "forward";
63
+ ScanDirection$1["Backward"] = "backward";
64
+ return ScanDirection$1;
65
+ }({});
66
+ let ReplaceType = /* @__PURE__ */ function(ReplaceType$1) {
67
+ ReplaceType$1["Default"] = "default";
68
+ ReplaceType$1["Dakuten"] = "dakuten";
69
+ ReplaceType$1["Handakuten"] = "handakuten";
70
+ ReplaceType$1["Kogaki"] = "kogaki";
71
+ return ReplaceType$1;
72
+ }({});
73
+ let CharacterForm = /* @__PURE__ */ function(CharacterForm$1) {
74
+ CharacterForm$1["Hiragana"] = "hiragana";
75
+ CharacterForm$1["Katakana"] = "katakana";
76
+ CharacterForm$1["HalfwidthKatakana"] = "halfwidth_katakana";
77
+ CharacterForm$1["Uppercase"] = "uppercase";
78
+ CharacterForm$1["Lowercase"] = "lowercase";
79
+ return CharacterForm$1;
80
+ }({});
81
+ let LongpressDuration = /* @__PURE__ */ function(LongpressDuration$1) {
82
+ LongpressDuration$1["Normal"] = "normal";
83
+ LongpressDuration$1["Light"] = "light";
84
+ return LongpressDuration$1;
85
+ }({});
86
+ let ScrollDirection = /* @__PURE__ */ function(ScrollDirection$1) {
87
+ ScrollDirection$1["Horizontal"] = "horizontal";
88
+ ScrollDirection$1["Vertical"] = "vertical";
89
+ return ScrollDirection$1;
90
+ }({});
91
+
92
+ //#endregion
93
+ export { KeyStyle as a, ReplaceType as c, SystemKeyType as d, SystemTabType as f, KeyColor as i, ScanDirection as l, FlickDirection as n, Language as o, InputStyle as r, LongpressDuration as s, CharacterForm as t, ScrollDirection as u };
@@ -0,0 +1,2 @@
1
+ import { a as KeyStyle, c as ReplaceType, d as SystemKeyType, f as SystemTabType, i as KeyColor, l as ScanDirection, n as FlickDirection, o as Language, r as InputStyle, s as LongpressDuration, t as CharacterForm, u as ScrollDirection } from "./enums-B42m1Nqc.mjs";
2
+ export { CharacterForm, FlickDirection, InputStyle, KeyColor, KeyStyle, Language, LongpressDuration, ReplaceType, ScanDirection, ScrollDirection, SystemKeyType, SystemTabType };
package/dist/enums.mjs ADDED
@@ -0,0 +1,3 @@
1
+ import { a as KeyStyle, c as ReplaceType, d as SystemKeyType, f as SystemTabType, i as KeyColor, l as ScanDirection, n as FlickDirection, o as Language, r as InputStyle, s as LongpressDuration, t as CharacterForm, u as ScrollDirection } from "./enums-BANQq1pN.mjs";
2
+
3
+ export { CharacterForm, FlickDirection, InputStyle, KeyColor, KeyStyle, Language, LongpressDuration, ReplaceType, ScanDirection, ScrollDirection, SystemKeyType, SystemTabType };
@@ -0,0 +1,7 @@
1
+ import { a as KeyStyle, c as ReplaceType, d as SystemKeyType, f as SystemTabType, i as KeyColor, l as ScanDirection, n as FlickDirection, o as Language, r as InputStyle, s as LongpressDuration, t as CharacterForm, u as ScrollDirection } from "./enums-B42m1Nqc.mjs";
2
+ import { Action, CompleteAction, CompleteCharacterFormAction, DeleteAction, DismissKeyboardAction, EnableResizingModeAction, InputAction, LaunchApplicationAction, MoveCursorAction, MoveTabAction, PasteAction, ReplaceDefaultAction, ReplaceLastCharactersAction, SelectCandidateAction, Serializable, SmartDeleteAction, SmartDeleteDefaultAction, SmartMoveCursorAction, ToggleCapsLockStateAction, ToggleCursorBarAction, ToggleTabBarAction } from "./actions.mjs";
3
+ import { a as SystemImageLabel, i as MainAndSubLabel, n as Label, o as TextLabel, r as MainAndDirectionsLabel, t as DirectionalLabels } from "./labels-Df2PSxBF.mjs";
4
+ import { _ as VariationDesignOptions, a as Key, c as LongpressAction, d as LongpressVariationDataOptions, f as SimpleInputArgument, g as VariationDesign, h as VariationData, i as FlickVariationDataOptions, l as LongpressActionOptions, m as Variation, n as CustomKeyOptions, o as KeyDesign, p as SystemKey, r as FlickVariationData, s as KeyDesignOptions, t as CustomKey, u as LongpressVariationData, v as VariationOptions } from "./keys-BtFhogE7.mjs";
5
+ import { GridFitLayout, GridFitLayoutOptions, GridFitSpecifier, GridFitSpecifierOptions, GridScrollLayout, GridScrollLayoutOptions, GridScrollSpecifier, GridScrollSpecifierOptions, KeyData, KeyDataOptions, Layout, Specifier } from "./layout.mjs";
6
+ import { Custard, CustardList, CustardOptions, Interface, InterfaceOptions, Metadata, MetadataOptions } from "./custard.mjs";
7
+ export { type Action, CharacterForm, CompleteAction, CompleteCharacterFormAction, Custard, CustardList, type CustardOptions, CustomKey, type CustomKeyOptions, DeleteAction, type DirectionalLabels, DismissKeyboardAction, EnableResizingModeAction, FlickDirection, FlickVariationData, type FlickVariationDataOptions, GridFitLayout, type GridFitLayoutOptions, GridFitSpecifier, type GridFitSpecifierOptions, GridScrollLayout, type GridScrollLayoutOptions, GridScrollSpecifier, type GridScrollSpecifierOptions, InputAction, InputStyle, Interface, type InterfaceOptions, type Key, KeyColor, KeyData, type KeyDataOptions, KeyDesign, type KeyDesignOptions, KeyStyle, type Label, Language, LaunchApplicationAction, type Layout, LongpressAction, type LongpressActionOptions, LongpressDuration, LongpressVariationData, type LongpressVariationDataOptions, MainAndDirectionsLabel, MainAndSubLabel, Metadata, type MetadataOptions, MoveCursorAction, MoveTabAction, PasteAction, ReplaceDefaultAction, ReplaceLastCharactersAction, ReplaceType, ScanDirection, ScrollDirection, SelectCandidateAction, type Serializable, type SimpleInputArgument, SmartDeleteAction, SmartDeleteDefaultAction, SmartMoveCursorAction, type Specifier, SystemImageLabel, SystemKey, SystemKeyType, SystemTabType, TextLabel, ToggleCapsLockStateAction, ToggleCursorBarAction, ToggleTabBarAction, Variation, type VariationData, VariationDesign, type VariationDesignOptions, type VariationOptions };
package/dist/index.mjs ADDED
@@ -0,0 +1,8 @@
1
+ import { _ as ToggleCapsLockStateAction, a as EnableResizingModeAction, c as MoveCursorAction, d as ReplaceDefaultAction, f as ReplaceLastCharactersAction, g as SmartMoveCursorAction, h as SmartDeleteDefaultAction, i as DismissKeyboardAction, l as MoveTabAction, m as SmartDeleteAction, n as CompleteCharacterFormAction, o as InputAction, p as SelectCandidateAction, r as DeleteAction, s as LaunchApplicationAction, t as CompleteAction, u as PasteAction, v as ToggleCursorBarAction, y as ToggleTabBarAction } from "./actions-R4-nSLAB.mjs";
2
+ import { Custard, CustardList, Interface, Metadata } from "./custard.mjs";
3
+ import { a as KeyStyle, c as ReplaceType, d as SystemKeyType, f as SystemTabType, i as KeyColor, l as ScanDirection, n as FlickDirection, o as Language, r as InputStyle, s as LongpressDuration, t as CharacterForm, u as ScrollDirection } from "./enums-BANQq1pN.mjs";
4
+ import { i as TextLabel, n as MainAndSubLabel, r as SystemImageLabel, t as MainAndDirectionsLabel } from "./labels-B3o-iLQB.mjs";
5
+ import { CustomKey, FlickVariationData, KeyDesign, LongpressAction, LongpressVariationData, SystemKey, Variation, VariationDesign } from "./keys.mjs";
6
+ import { GridFitLayout, GridFitSpecifier, GridScrollLayout, GridScrollSpecifier, KeyData } from "./layout.mjs";
7
+
8
+ export { CharacterForm, CompleteAction, CompleteCharacterFormAction, Custard, CustardList, CustomKey, DeleteAction, DismissKeyboardAction, EnableResizingModeAction, FlickDirection, FlickVariationData, GridFitLayout, GridFitSpecifier, GridScrollLayout, GridScrollSpecifier, InputAction, InputStyle, Interface, KeyColor, KeyData, KeyDesign, KeyStyle, Language, LaunchApplicationAction, LongpressAction, LongpressDuration, LongpressVariationData, MainAndDirectionsLabel, MainAndSubLabel, Metadata, MoveCursorAction, MoveTabAction, PasteAction, ReplaceDefaultAction, ReplaceLastCharactersAction, ReplaceType, ScanDirection, ScrollDirection, SelectCandidateAction, SmartDeleteAction, SmartDeleteDefaultAction, SmartMoveCursorAction, SystemImageLabel, SystemKey, SystemKeyType, SystemTabType, TextLabel, ToggleCapsLockStateAction, ToggleCursorBarAction, ToggleTabBarAction, Variation, VariationDesign };
@@ -0,0 +1,108 @@
1
+ import { d as SystemKeyType, i as KeyColor, n as FlickDirection, s as LongpressDuration } from "./enums-B42m1Nqc.mjs";
2
+ import { Action, Serializable } from "./actions.mjs";
3
+ import { n as Label } from "./labels-Df2PSxBF.mjs";
4
+
5
+ //#region src/keys.d.ts
6
+ interface LongpressActionOptions {
7
+ start?: Action[];
8
+ repeat?: Action[];
9
+ duration?: LongpressDuration;
10
+ }
11
+ declare class LongpressAction implements Serializable {
12
+ readonly start: Action[];
13
+ readonly repeat: Action[];
14
+ readonly duration?: LongpressDuration;
15
+ constructor(options?: LongpressActionOptions);
16
+ toJSON(): object;
17
+ }
18
+ interface KeyDesignOptions {
19
+ label: Label;
20
+ color?: KeyColor;
21
+ }
22
+ declare class KeyDesign implements Serializable {
23
+ readonly label: Label;
24
+ readonly color: KeyColor;
25
+ constructor(options: KeyDesignOptions);
26
+ toJSON(): object;
27
+ }
28
+ interface VariationDesignOptions {
29
+ label: Label;
30
+ }
31
+ declare class VariationDesign implements Serializable {
32
+ readonly label: Label;
33
+ constructor(options: VariationDesignOptions);
34
+ toJSON(): object;
35
+ }
36
+ interface VariationOptions {
37
+ design: VariationDesign;
38
+ pressActions?: Action[];
39
+ longpressActions?: LongpressAction;
40
+ }
41
+ declare class Variation implements Serializable {
42
+ readonly design: VariationDesign;
43
+ readonly pressActions: Action[];
44
+ readonly longpressActions: LongpressAction;
45
+ constructor(options: VariationOptions);
46
+ toJSON(): object;
47
+ }
48
+ interface FlickVariationDataOptions {
49
+ direction: FlickDirection;
50
+ key: Variation;
51
+ }
52
+ declare class FlickVariationData implements Serializable {
53
+ readonly direction: FlickDirection;
54
+ readonly key: Variation;
55
+ constructor(options: FlickVariationDataOptions);
56
+ toJSON(): object;
57
+ }
58
+ interface LongpressVariationDataOptions {
59
+ key: Variation;
60
+ }
61
+ declare class LongpressVariationData implements Serializable {
62
+ readonly key: Variation;
63
+ constructor(options: LongpressVariationDataOptions);
64
+ toJSON(): object;
65
+ }
66
+ type VariationData = FlickVariationData | LongpressVariationData;
67
+ interface CustomKeyOptions {
68
+ design: KeyDesign;
69
+ pressActions?: Action[];
70
+ longpressActions?: LongpressAction;
71
+ variations?: VariationData[];
72
+ }
73
+ type SimpleInputArgument = string | {
74
+ label: string;
75
+ input: string;
76
+ };
77
+ declare class CustomKey implements Serializable {
78
+ readonly design: KeyDesign;
79
+ readonly pressActions: Action[];
80
+ readonly longpressActions: LongpressAction;
81
+ readonly variations: VariationData[];
82
+ constructor(options: CustomKeyOptions);
83
+ toJSON(): object;
84
+ /**
85
+ * Create a flick-style key with center and directional inputs.
86
+ * Directions are assigned in order: left, top, right, bottom.
87
+ */
88
+ static flickSimpleInputs(center: string, subs: string[], centerLabel?: string): CustomKey;
89
+ /**
90
+ * Create a flick-style key with label and input for each direction.
91
+ * Each argument can be a string (label=input) or {label, input} object.
92
+ */
93
+ static flickSimpleInputAndLabels(options: {
94
+ center: SimpleInputArgument;
95
+ left?: SimpleInputArgument;
96
+ top?: SimpleInputArgument;
97
+ right?: SimpleInputArgument;
98
+ bottom?: SimpleInputArgument;
99
+ }): CustomKey;
100
+ }
101
+ declare class SystemKey implements Serializable {
102
+ readonly keyType: SystemKeyType;
103
+ constructor(keyType: SystemKeyType);
104
+ toJSON(): object;
105
+ }
106
+ type Key = CustomKey | SystemKey;
107
+ //#endregion
108
+ export { VariationDesignOptions as _, Key as a, LongpressAction as c, LongpressVariationDataOptions as d, SimpleInputArgument as f, VariationDesign as g, VariationData as h, FlickVariationDataOptions as i, LongpressActionOptions as l, Variation as m, CustomKeyOptions as n, KeyDesign as o, SystemKey as p, FlickVariationData as r, KeyDesignOptions as s, CustomKey as t, LongpressVariationData as u, VariationOptions as v };
@@ -0,0 +1,3 @@
1
+ import "./actions.mjs";
2
+ import { _ as VariationDesignOptions, a as Key, c as LongpressAction, d as LongpressVariationDataOptions, f as SimpleInputArgument, g as VariationDesign, h as VariationData, i as FlickVariationDataOptions, l as LongpressActionOptions, m as Variation, n as CustomKeyOptions, o as KeyDesign, p as SystemKey, r as FlickVariationData, s as KeyDesignOptions, t as CustomKey, u as LongpressVariationData, v as VariationOptions } from "./keys-BtFhogE7.mjs";
3
+ export { CustomKey, CustomKeyOptions, FlickVariationData, FlickVariationDataOptions, Key, KeyDesign, KeyDesignOptions, LongpressAction, LongpressActionOptions, LongpressVariationData, LongpressVariationDataOptions, SimpleInputArgument, SystemKey, Variation, VariationData, VariationDesign, VariationDesignOptions, VariationOptions };
package/dist/keys.mjs ADDED
@@ -0,0 +1,187 @@
1
+ import { o as InputAction } from "./actions-R4-nSLAB.mjs";
2
+ import { i as KeyColor, n as FlickDirection } from "./enums-BANQq1pN.mjs";
3
+ import { i as TextLabel } from "./labels-B3o-iLQB.mjs";
4
+
5
+ //#region src/keys.ts
6
+ var LongpressAction = class {
7
+ start;
8
+ repeat;
9
+ duration;
10
+ constructor(options = {}) {
11
+ this.duration = options.duration;
12
+ this.repeat = options.repeat ?? [];
13
+ this.start = options.start ?? [];
14
+ }
15
+ toJSON() {
16
+ const json = {
17
+ repeat: this.repeat.map((a) => a.toJSON()),
18
+ start: this.start.map((a) => a.toJSON())
19
+ };
20
+ if (this.duration !== void 0) json["duration"] = this.duration;
21
+ return json;
22
+ }
23
+ };
24
+ var KeyDesign = class {
25
+ label;
26
+ color;
27
+ constructor(options) {
28
+ this.color = options.color ?? KeyColor.Normal;
29
+ this.label = options.label;
30
+ }
31
+ toJSON() {
32
+ return {
33
+ color: this.color,
34
+ label: this.label.toJSON()
35
+ };
36
+ }
37
+ };
38
+ var VariationDesign = class {
39
+ label;
40
+ constructor(options) {
41
+ this.label = options.label;
42
+ }
43
+ toJSON() {
44
+ return { label: this.label.toJSON() };
45
+ }
46
+ };
47
+ var Variation = class {
48
+ design;
49
+ pressActions;
50
+ longpressActions;
51
+ constructor(options) {
52
+ this.design = options.design;
53
+ this.longpressActions = options.longpressActions ?? new LongpressAction();
54
+ this.pressActions = options.pressActions ?? [];
55
+ }
56
+ toJSON() {
57
+ return {
58
+ design: this.design.toJSON(),
59
+ longpress_actions: this.longpressActions.toJSON(),
60
+ press_actions: this.pressActions.map((a) => a.toJSON())
61
+ };
62
+ }
63
+ };
64
+ var FlickVariationData = class {
65
+ direction;
66
+ key;
67
+ constructor(options) {
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
+ };
89
+ }
90
+ };
91
+ var CustomKey = class CustomKey {
92
+ design;
93
+ pressActions;
94
+ longpressActions;
95
+ variations;
96
+ constructor(options) {
97
+ this.design = options.design;
98
+ this.longpressActions = options.longpressActions ?? new LongpressAction();
99
+ this.pressActions = options.pressActions ?? [];
100
+ this.variations = options.variations ?? [];
101
+ }
102
+ toJSON() {
103
+ return {
104
+ design: this.design.toJSON(),
105
+ longpress_actions: this.longpressActions.toJSON(),
106
+ press_actions: this.pressActions.map((a) => a.toJSON()),
107
+ variations: this.variations.map((v) => v.toJSON())
108
+ };
109
+ }
110
+ /**
111
+ * Create a flick-style key with center and directional inputs.
112
+ * Directions are assigned in order: left, top, right, bottom.
113
+ */
114
+ static flickSimpleInputs(center, subs, centerLabel) {
115
+ const directions = [
116
+ FlickDirection.Left,
117
+ FlickDirection.Top,
118
+ FlickDirection.Right,
119
+ FlickDirection.Bottom
120
+ ];
121
+ const variations = [];
122
+ const limit = Math.min(subs.length, 4);
123
+ for (let i = 0; i < limit; i++) {
124
+ const sub = subs[i];
125
+ const direction = directions[i];
126
+ if (sub !== void 0 && direction !== void 0) variations.push(new FlickVariationData({
127
+ direction,
128
+ key: new Variation({
129
+ design: new VariationDesign({ label: new TextLabel(sub) }),
130
+ pressActions: [new InputAction(sub)]
131
+ })
132
+ }));
133
+ }
134
+ return new CustomKey({
135
+ design: new KeyDesign({ label: new TextLabel(centerLabel ?? center) }),
136
+ pressActions: [new InputAction(center)],
137
+ variations
138
+ });
139
+ }
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
+ static flickSimpleInputAndLabels(options) {
145
+ const parseArg = (arg) => {
146
+ if (typeof arg === "string") return {
147
+ input: arg,
148
+ label: arg
149
+ };
150
+ return arg;
151
+ };
152
+ const centerParsed = parseArg(options.center);
153
+ const variations = [];
154
+ const directionArgs = [
155
+ [FlickDirection.Left, options.left],
156
+ [FlickDirection.Top, options.top],
157
+ [FlickDirection.Right, options.right],
158
+ [FlickDirection.Bottom, options.bottom]
159
+ ];
160
+ for (const [direction, arg] of directionArgs) if (arg !== void 0) {
161
+ const parsed = parseArg(arg);
162
+ variations.push(new FlickVariationData({
163
+ direction,
164
+ key: new Variation({
165
+ design: new VariationDesign({ label: new TextLabel(parsed.label) }),
166
+ pressActions: [new InputAction(parsed.input)]
167
+ })
168
+ }));
169
+ }
170
+ return new CustomKey({
171
+ design: new KeyDesign({ label: new TextLabel(centerParsed.label) }),
172
+ pressActions: [new InputAction(centerParsed.input)],
173
+ variations
174
+ });
175
+ }
176
+ };
177
+ var SystemKey = class {
178
+ constructor(keyType) {
179
+ this.keyType = keyType;
180
+ }
181
+ toJSON() {
182
+ return { type: this.keyType };
183
+ }
184
+ };
185
+
186
+ //#endregion
187
+ export { CustomKey, FlickVariationData, KeyDesign, LongpressAction, LongpressVariationData, SystemKey, Variation, VariationDesign };
@@ -0,0 +1,46 @@
1
+ //#region src/labels.ts
2
+ var TextLabel = class {
3
+ constructor(text) {
4
+ this.text = text;
5
+ }
6
+ toJSON() {
7
+ return { text: this.text };
8
+ }
9
+ };
10
+ var SystemImageLabel = class {
11
+ constructor(systemImage) {
12
+ this.systemImage = systemImage;
13
+ }
14
+ toJSON() {
15
+ return { system_image: this.systemImage };
16
+ }
17
+ };
18
+ var MainAndSubLabel = class {
19
+ constructor(main, sub) {
20
+ this.main = main;
21
+ this.sub = sub;
22
+ }
23
+ toJSON() {
24
+ return {
25
+ main: this.main,
26
+ sub: this.sub,
27
+ type: "main_and_sub"
28
+ };
29
+ }
30
+ };
31
+ var MainAndDirectionsLabel = class {
32
+ constructor(main, directions) {
33
+ this.main = main;
34
+ this.directions = directions;
35
+ }
36
+ toJSON() {
37
+ return {
38
+ directions: this.directions,
39
+ main: this.main,
40
+ type: "main_and_directions"
41
+ };
42
+ }
43
+ };
44
+
45
+ //#endregion
46
+ export { TextLabel as i, MainAndSubLabel as n, SystemImageLabel as r, MainAndDirectionsLabel as t };
@@ -0,0 +1,34 @@
1
+ import { Serializable } from "./actions.mjs";
2
+
3
+ //#region src/labels.d.ts
4
+ declare class TextLabel implements Serializable {
5
+ readonly text: string;
6
+ constructor(text: string);
7
+ toJSON(): object;
8
+ }
9
+ declare class SystemImageLabel implements Serializable {
10
+ readonly systemImage: string;
11
+ constructor(systemImage: string);
12
+ toJSON(): object;
13
+ }
14
+ declare class MainAndSubLabel implements Serializable {
15
+ readonly main: string;
16
+ readonly sub: string;
17
+ constructor(main: string, sub: string);
18
+ toJSON(): object;
19
+ }
20
+ interface DirectionalLabels {
21
+ left?: string;
22
+ top?: string;
23
+ right?: string;
24
+ bottom?: string;
25
+ }
26
+ declare class MainAndDirectionsLabel implements Serializable {
27
+ readonly main: string;
28
+ readonly directions: DirectionalLabels;
29
+ constructor(main: string, directions: DirectionalLabels);
30
+ toJSON(): object;
31
+ }
32
+ type Label = MainAndDirectionsLabel | MainAndSubLabel | SystemImageLabel | TextLabel;
33
+ //#endregion
34
+ export { SystemImageLabel as a, MainAndSubLabel as i, Label as n, TextLabel as o, MainAndDirectionsLabel as r, DirectionalLabels as t };
@@ -0,0 +1,3 @@
1
+ import "./actions.mjs";
2
+ import { a as SystemImageLabel, i as MainAndSubLabel, n as Label, o as TextLabel, r as MainAndDirectionsLabel, t as DirectionalLabels } from "./labels-Df2PSxBF.mjs";
3
+ export { DirectionalLabels, Label, MainAndDirectionsLabel, MainAndSubLabel, SystemImageLabel, TextLabel };
@@ -0,0 +1,3 @@
1
+ import { i as TextLabel, n as MainAndSubLabel, r as SystemImageLabel, t as MainAndDirectionsLabel } from "./labels-B3o-iLQB.mjs";
2
+
3
+ export { MainAndDirectionsLabel, MainAndSubLabel, SystemImageLabel, TextLabel };
@@ -0,0 +1,65 @@
1
+ import { u as ScrollDirection } from "./enums-B42m1Nqc.mjs";
2
+ import { Serializable } from "./actions.mjs";
3
+ import { a as Key } from "./keys-BtFhogE7.mjs";
4
+
5
+ //#region src/layout.d.ts
6
+ interface GridFitLayoutOptions {
7
+ rowCount: number;
8
+ columnCount: number;
9
+ }
10
+ declare class GridFitLayout implements Serializable {
11
+ readonly rowCount: number;
12
+ readonly columnCount: number;
13
+ constructor(options: GridFitLayoutOptions);
14
+ toJSON(): object;
15
+ }
16
+ interface GridScrollLayoutOptions {
17
+ direction: ScrollDirection;
18
+ rowCount: number;
19
+ columnCount: number;
20
+ }
21
+ declare class GridScrollLayout implements Serializable {
22
+ readonly direction: ScrollDirection;
23
+ readonly rowCount: number;
24
+ readonly columnCount: number;
25
+ constructor(options: GridScrollLayoutOptions);
26
+ toJSON(): object;
27
+ }
28
+ type Layout = GridFitLayout | GridScrollLayout;
29
+ interface GridFitSpecifierOptions {
30
+ x: number;
31
+ y: number;
32
+ width?: number;
33
+ height?: number;
34
+ }
35
+ declare class GridFitSpecifier implements Serializable {
36
+ readonly x: number;
37
+ readonly y: number;
38
+ readonly width: number;
39
+ readonly height: number;
40
+ constructor(options: GridFitSpecifierOptions);
41
+ toJSON(): object;
42
+ get specifierType(): "grid_fit";
43
+ }
44
+ interface GridScrollSpecifierOptions {
45
+ index: number;
46
+ }
47
+ declare class GridScrollSpecifier implements Serializable {
48
+ readonly index: number;
49
+ constructor(options: GridScrollSpecifierOptions);
50
+ toJSON(): object;
51
+ get specifierType(): "grid_scroll";
52
+ }
53
+ type Specifier = GridFitSpecifier | GridScrollSpecifier;
54
+ interface KeyDataOptions {
55
+ specifier: Specifier;
56
+ key: Key;
57
+ }
58
+ declare class KeyData implements Serializable {
59
+ readonly specifier: Specifier;
60
+ readonly key: Key;
61
+ constructor(options: KeyDataOptions);
62
+ toJSON(): object;
63
+ }
64
+ //#endregion
65
+ export { GridFitLayout, GridFitLayoutOptions, GridFitSpecifier, GridFitSpecifierOptions, GridScrollLayout, GridScrollLayoutOptions, GridScrollSpecifier, GridScrollSpecifierOptions, KeyData, KeyDataOptions, Layout, Specifier };
@@ -0,0 +1,92 @@
1
+ import { CustomKey } from "./keys.mjs";
2
+
3
+ //#region src/layout.ts
4
+ var GridFitLayout = class {
5
+ rowCount;
6
+ columnCount;
7
+ constructor(options) {
8
+ this.columnCount = options.columnCount;
9
+ this.rowCount = options.rowCount;
10
+ }
11
+ toJSON() {
12
+ return {
13
+ column_count: this.columnCount,
14
+ row_count: this.rowCount,
15
+ type: "grid_fit"
16
+ };
17
+ }
18
+ };
19
+ var GridScrollLayout = class {
20
+ direction;
21
+ rowCount;
22
+ columnCount;
23
+ constructor(options) {
24
+ this.columnCount = options.columnCount;
25
+ this.direction = options.direction;
26
+ this.rowCount = options.rowCount;
27
+ }
28
+ toJSON() {
29
+ return {
30
+ column_count: this.columnCount,
31
+ direction: this.direction,
32
+ row_count: this.rowCount,
33
+ type: "grid_scroll"
34
+ };
35
+ }
36
+ };
37
+ var GridFitSpecifier = class {
38
+ x;
39
+ y;
40
+ width;
41
+ height;
42
+ constructor(options) {
43
+ this.height = options.height ?? 1;
44
+ this.width = options.width ?? 1;
45
+ this.x = options.x;
46
+ this.y = options.y;
47
+ }
48
+ toJSON() {
49
+ return {
50
+ height: this.height,
51
+ width: this.width,
52
+ x: this.x,
53
+ y: this.y
54
+ };
55
+ }
56
+ get specifierType() {
57
+ return "grid_fit";
58
+ }
59
+ };
60
+ var GridScrollSpecifier = class {
61
+ index;
62
+ constructor(options) {
63
+ this.index = options.index;
64
+ }
65
+ toJSON() {
66
+ return { index: this.index };
67
+ }
68
+ get specifierType() {
69
+ return "grid_scroll";
70
+ }
71
+ };
72
+ var KeyData = class {
73
+ specifier;
74
+ key;
75
+ constructor(options) {
76
+ this.key = options.key;
77
+ this.specifier = options.specifier;
78
+ }
79
+ toJSON() {
80
+ let keyType = "system";
81
+ if (this.key instanceof CustomKey) keyType = "custom";
82
+ return {
83
+ key: this.key.toJSON(),
84
+ key_type: keyType,
85
+ specifier: this.specifier.toJSON(),
86
+ specifier_type: this.specifier.specifierType
87
+ };
88
+ }
89
+ };
90
+
91
+ //#endregion
92
+ export { GridFitLayout, GridFitSpecifier, GridScrollLayout, GridScrollSpecifier, KeyData };
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "custardkit-ts",
3
+ "version": "0.1.0",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/ph0ryn/CustardKitTS.git"
7
+ },
8
+ "license": "MIT",
9
+ "author": "ph0ryn",
10
+ "type": "module",
11
+ "main": "./dist/index.mjs",
12
+ "types": "./dist/index.d.mts",
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "scripts": {
20
+ "preinstall": "npx only-allow pnpm",
21
+ "postinstall": "git config core.hooksPath .githooks"
22
+ },
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/index.d.mts",
26
+ "import": "./dist/index.mjs"
27
+ }
28
+ }
29
+ }