custardkit-ts 0.2.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/dist/Actions/index.d.mts +1 -1
- package/dist/Actions/index.mjs +1 -1
- package/dist/{Actions-DHQe-LaO.mjs → Actions-DGz8CoQU.mjs} +3 -0
- package/dist/Keys/index.d.mts +1 -1
- package/dist/Keys/index.mjs +1 -1
- package/dist/{Keys-CdRZtl30.mjs → Keys-HP_Fh_Lv.mjs} +3 -3
- package/dist/Labels/index.d.mts +1 -1
- package/dist/Labels/index.mjs +1 -1
- package/dist/Layout/index.d.mts +1 -1
- package/dist/Layout/index.mjs +1 -1
- 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 +13 -1
- package/dist/errors.mjs +2 -2
- package/dist/{index-DjrO7qm1.d.mts → index-BwCtLRO6.d.mts} +33 -22
- package/dist/{index--anwuD9Y.d.mts → index-D-6qRoek.d.mts} +2 -2
- package/dist/{index-D4ncqCBO.d.mts → index-D0RJeudc.d.mts} +4 -4
- package/dist/{index-CYjTZeL6.d.mts → index-Dknx6MxA.d.mts} +1 -1
- package/dist/index.d.mts +59 -9
- package/dist/index.mjs +114 -9
- package/dist/types.d.mts +1 -1
- package/package.json +1 -5
- package/dist/Custard/index.d.mts +0 -2
- package/dist/Custard/index.mjs +0 -3
- package/dist/Custard-CmHRwv8R.mjs +0 -96
- package/dist/Layout-D75UhVN0.mjs +0 -111
- package/dist/errors-DvC1uxs8.mjs +0 -22
- package/dist/index-86QZQJaA.d.mts +0 -57
- /package/dist/{Labels-61vgU696.mjs → Labels-D8TEwrN8.mjs} +0 -0
- /package/dist/{enums-BANQq1pN.mjs → enums-BySrsID6.mjs} +0 -0
- /package/dist/{enums-Dxtvk1eN.d.mts → enums-KRVewwrt.d.mts} +0 -0
- /package/dist/{types-BRMXqO6t.d.mts → types-BoV-UB3j.d.mts} +0 -0
package/dist/Actions/index.d.mts
CHANGED
|
@@ -1,2 +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
|
|
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
2
|
export { Action, BaseAction, CompleteAction, CompleteCharacterFormAction, DeleteAction, DismissKeyboardAction, EnableResizingModeAction, InputAction, LaunchApplicationAction, MoveCursorAction, MoveTabAction, PasteAction, ReplaceDefaultAction, ReplaceLastCharactersAction, SelectCandidateAction, SmartDeleteAction, SmartDeleteDefaultAction, SmartMoveCursorAction, ToggleCapsLockStateAction, ToggleCursorBarAction, ToggleTabBarAction };
|
package/dist/Actions/index.mjs
CHANGED
|
@@ -1,3 +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-
|
|
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
2
|
|
|
3
3
|
export { Action, BaseAction, CompleteAction, CompleteCharacterFormAction, DeleteAction, DismissKeyboardAction, EnableResizingModeAction, InputAction, LaunchApplicationAction, MoveCursorAction, MoveTabAction, PasteAction, ReplaceDefaultAction, ReplaceLastCharactersAction, SelectCandidateAction, SmartDeleteAction, SmartDeleteDefaultAction, SmartMoveCursorAction, ToggleCapsLockStateAction, ToggleCursorBarAction, ToggleTabBarAction };
|
|
@@ -33,6 +33,7 @@ var DeleteAction = class extends BaseAction {
|
|
|
33
33
|
constructor(count = 1) {
|
|
34
34
|
super();
|
|
35
35
|
this.count = count;
|
|
36
|
+
if (count < 1) console.warn(`DeleteAction: count (${count}) is less than 1, which is meaningless`);
|
|
36
37
|
}
|
|
37
38
|
toJSON() {
|
|
38
39
|
return {
|
|
@@ -67,6 +68,7 @@ var InputAction = class extends BaseAction {
|
|
|
67
68
|
constructor(text) {
|
|
68
69
|
super();
|
|
69
70
|
this.text = text;
|
|
71
|
+
if (text === "") console.warn("InputAction: text is empty, which is meaningless");
|
|
70
72
|
}
|
|
71
73
|
toJSON() {
|
|
72
74
|
return {
|
|
@@ -101,6 +103,7 @@ var MoveCursorAction = class extends BaseAction {
|
|
|
101
103
|
constructor(count) {
|
|
102
104
|
super();
|
|
103
105
|
this.count = count;
|
|
106
|
+
if (count === 0) console.warn("MoveCursorAction: count is 0, which is meaningless");
|
|
104
107
|
}
|
|
105
108
|
toJSON() {
|
|
106
109
|
return {
|
package/dist/Keys/index.d.mts
CHANGED
|
@@ -1,2 +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-
|
|
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
2
|
export { CustomKey, CustomKeyOptions, FlickVariationData, FlickVariationDataOptions, Key, KeyDesign, KeyDesignOptions, LongpressAction, LongpressActionOptions, LongpressVariationData, LongpressVariationDataOptions, SimpleInputArgument, SystemKey, Variation, VariationData, VariationDesign, VariationDesignOptions, VariationOptions };
|
package/dist/Keys/index.mjs
CHANGED
|
@@ -1,3 +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-
|
|
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
2
|
|
|
3
3
|
export { CustomKey, FlickVariationData, KeyDesign, LongpressAction, LongpressVariationData, SystemKey, Variation, VariationDesign };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as KeyColor, n as FlickDirection } from "./enums-
|
|
2
|
-
import { t as
|
|
3
|
-
import { t as
|
|
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
5
|
//#region src/Keys/FlickVariationData.ts
|
|
6
6
|
var FlickVariationData = class {
|
package/dist/Labels/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as DirectionalLabels, i as MainAndSubLabel, n as TextLabel, o as MainAndDirectionsLabel, r as SystemImageLabel, t as Label } from "../index-
|
|
1
|
+
import { a as DirectionalLabels, i as MainAndSubLabel, n as TextLabel, o as MainAndDirectionsLabel, r as SystemImageLabel, t as Label } from "../index-Dknx6MxA.mjs";
|
|
2
2
|
export { DirectionalLabels, Label, MainAndDirectionsLabel, MainAndSubLabel, SystemImageLabel, TextLabel };
|
package/dist/Labels/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as MainAndDirectionsLabel, i as MainAndSubLabel, n as TextLabel, r as SystemImageLabel, t as Label } from "../Labels-
|
|
1
|
+
import { a as MainAndDirectionsLabel, i as MainAndSubLabel, n as TextLabel, r as SystemImageLabel, t as Label } from "../Labels-D8TEwrN8.mjs";
|
|
2
2
|
|
|
3
3
|
export { Label, MainAndDirectionsLabel, MainAndSubLabel, SystemImageLabel, TextLabel };
|
package/dist/Layout/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as GridScrollLayout, c as GridScrollSpecifierOptions, d as GridFitSpecifier, f as GridFitSpecifierOptions, i as Specifier, l as GridFitLayout, n as KeyData, o as GridScrollLayoutOptions, r as KeyDataOptions, s as GridScrollSpecifier, t as Layout, u as GridFitLayoutOptions } from "../index-BwCtLRO6.mjs";
|
|
2
2
|
export { GridFitLayout, GridFitLayoutOptions, GridFitSpecifier, GridFitSpecifierOptions, GridScrollLayout, GridScrollLayoutOptions, GridScrollSpecifier, GridScrollSpecifierOptions, KeyData, KeyDataOptions, Layout, Specifier };
|
package/dist/Layout/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as GridFitSpecifier, i as GridScrollLayout, n as KeyData, o as GridFitLayout, r as GridScrollSpecifier, t as Layout } from "../Layout-
|
|
1
|
+
import { a as GridFitSpecifier, i as GridScrollLayout, n as KeyData, o as GridFitLayout, r as GridScrollSpecifier, t as Layout } from "../Layout-BYGdAtQk.mjs";
|
|
2
2
|
|
|
3
3
|
export { GridFitLayout, GridFitSpecifier, GridScrollLayout, GridScrollSpecifier, KeyData, Layout };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { a as InvalidLayoutSizeError } from "./errors-BPMIP-gS.mjs";
|
|
2
|
+
import { r as CustomKey } from "./Keys-HP_Fh_Lv.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/Layout/GridFitLayout.ts
|
|
5
|
+
var GridFitLayout = class {
|
|
6
|
+
rowCount;
|
|
7
|
+
columnCount;
|
|
8
|
+
constructor(options) {
|
|
9
|
+
if (options.rowCount < 1) throw new InvalidLayoutSizeError(`rowCount (${options.rowCount}) must be at least 1`);
|
|
10
|
+
if (options.columnCount < 1) throw new InvalidLayoutSizeError(`columnCount (${options.columnCount}) must be at least 1`);
|
|
11
|
+
this.columnCount = options.columnCount;
|
|
12
|
+
this.rowCount = options.rowCount;
|
|
13
|
+
}
|
|
14
|
+
get layoutType() {
|
|
15
|
+
return "grid_fit";
|
|
16
|
+
}
|
|
17
|
+
validateSpecifier(specifier) {
|
|
18
|
+
if (specifier.x < 0) return {
|
|
19
|
+
message: `x (${specifier.x}) must be non-negative`,
|
|
20
|
+
valid: false
|
|
21
|
+
};
|
|
22
|
+
if (specifier.y < 0) return {
|
|
23
|
+
message: `y (${specifier.y}) must be non-negative`,
|
|
24
|
+
valid: false
|
|
25
|
+
};
|
|
26
|
+
if (specifier.x + specifier.width > this.columnCount) return {
|
|
27
|
+
message: `x + width (${specifier.x} + ${specifier.width} = ${specifier.x + specifier.width}) exceeds columnCount (${this.columnCount})`,
|
|
28
|
+
valid: false
|
|
29
|
+
};
|
|
30
|
+
if (specifier.y + specifier.height > this.rowCount) return {
|
|
31
|
+
message: `y + height (${specifier.y} + ${specifier.height} = ${specifier.y + specifier.height}) exceeds rowCount (${this.rowCount})`,
|
|
32
|
+
valid: false
|
|
33
|
+
};
|
|
34
|
+
return { valid: true };
|
|
35
|
+
}
|
|
36
|
+
toJSON() {
|
|
37
|
+
return {
|
|
38
|
+
column_count: this.columnCount,
|
|
39
|
+
row_count: this.rowCount,
|
|
40
|
+
type: "grid_fit"
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/Layout/GridFitSpecifier.ts
|
|
47
|
+
var GridFitSpecifier = class {
|
|
48
|
+
x;
|
|
49
|
+
y;
|
|
50
|
+
width;
|
|
51
|
+
height;
|
|
52
|
+
constructor(options) {
|
|
53
|
+
const width = options.width ?? 1;
|
|
54
|
+
const height = options.height ?? 1;
|
|
55
|
+
if (width < 1) throw new InvalidLayoutSizeError(`width (${width}) must be at least 1`);
|
|
56
|
+
if (height < 1) throw new InvalidLayoutSizeError(`height (${height}) must be at least 1`);
|
|
57
|
+
this.height = height;
|
|
58
|
+
this.width = width;
|
|
59
|
+
this.x = options.x;
|
|
60
|
+
this.y = options.y;
|
|
61
|
+
}
|
|
62
|
+
toJSON() {
|
|
63
|
+
return {
|
|
64
|
+
height: this.height,
|
|
65
|
+
width: this.width,
|
|
66
|
+
x: this.x,
|
|
67
|
+
y: this.y
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
get specifierType() {
|
|
71
|
+
return "grid_fit";
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/Layout/GridScrollLayout.ts
|
|
77
|
+
var GridScrollLayout = class {
|
|
78
|
+
direction;
|
|
79
|
+
rowCount;
|
|
80
|
+
columnCount;
|
|
81
|
+
constructor(options) {
|
|
82
|
+
if (options.rowCount < 1) throw new InvalidLayoutSizeError(`rowCount (${options.rowCount}) must be at least 1`);
|
|
83
|
+
if (options.columnCount < 1) throw new InvalidLayoutSizeError(`columnCount (${options.columnCount}) must be at least 1`);
|
|
84
|
+
this.columnCount = options.columnCount;
|
|
85
|
+
this.direction = options.direction;
|
|
86
|
+
this.rowCount = options.rowCount;
|
|
87
|
+
}
|
|
88
|
+
get layoutType() {
|
|
89
|
+
return "grid_scroll";
|
|
90
|
+
}
|
|
91
|
+
get maxIndex() {
|
|
92
|
+
return this.rowCount * this.columnCount;
|
|
93
|
+
}
|
|
94
|
+
validateSpecifier(specifier) {
|
|
95
|
+
if (specifier.index < 0) return {
|
|
96
|
+
message: `index (${specifier.index}) must be non-negative`,
|
|
97
|
+
valid: false
|
|
98
|
+
};
|
|
99
|
+
if (specifier.index >= this.maxIndex) return {
|
|
100
|
+
message: `index (${specifier.index}) must be less than rowCount * columnCount (${this.maxIndex})`,
|
|
101
|
+
valid: false
|
|
102
|
+
};
|
|
103
|
+
return { valid: true };
|
|
104
|
+
}
|
|
105
|
+
toJSON() {
|
|
106
|
+
return {
|
|
107
|
+
column_count: this.columnCount,
|
|
108
|
+
direction: this.direction,
|
|
109
|
+
row_count: this.rowCount,
|
|
110
|
+
type: "grid_scroll"
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/Layout/GridScrollSpecifier.ts
|
|
117
|
+
var GridScrollSpecifier = class {
|
|
118
|
+
index;
|
|
119
|
+
constructor(options) {
|
|
120
|
+
this.index = options.index;
|
|
121
|
+
}
|
|
122
|
+
toJSON() {
|
|
123
|
+
return { index: this.index };
|
|
124
|
+
}
|
|
125
|
+
get specifierType() {
|
|
126
|
+
return "grid_scroll";
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/Layout/KeyData.ts
|
|
132
|
+
var KeyData = class {
|
|
133
|
+
specifier;
|
|
134
|
+
key;
|
|
135
|
+
constructor(options) {
|
|
136
|
+
this.key = options.key;
|
|
137
|
+
this.specifier = options.specifier;
|
|
138
|
+
}
|
|
139
|
+
toJSON() {
|
|
140
|
+
let keyType = "system";
|
|
141
|
+
if (this.key instanceof CustomKey) keyType = "custom";
|
|
142
|
+
return {
|
|
143
|
+
key: this.key.toJSON(),
|
|
144
|
+
key_type: keyType,
|
|
145
|
+
specifier: this.specifier.toJSON(),
|
|
146
|
+
specifier_type: this.specifier.specifierType
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
//#endregion
|
|
152
|
+
//#region src/Layout/index.ts
|
|
153
|
+
const Layout = {
|
|
154
|
+
gridFit: (options) => new GridFitLayout(options),
|
|
155
|
+
gridScroll: (options) => new GridScrollLayout(options)
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
//#endregion
|
|
159
|
+
export { GridFitSpecifier as a, GridScrollLayout as i, KeyData as n, GridFitLayout as o, GridScrollSpecifier as r, Layout as t };
|
package/dist/enums.d.mts
CHANGED
|
@@ -1,2 +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-
|
|
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-KRVewwrt.mjs";
|
|
2
2
|
export { CharacterForm, FlickDirection, InputStyle, KeyColor, KeyStyle, Language, LongpressDuration, ReplaceType, ScanDirection, ScrollDirection, SystemKeyType, SystemTabType };
|
package/dist/enums.mjs
CHANGED
|
@@ -1,3 +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-
|
|
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-BySrsID6.mjs";
|
|
2
2
|
|
|
3
3
|
export { CharacterForm, FlickDirection, InputStyle, KeyColor, KeyStyle, Language, LongpressDuration, ReplaceType, ScanDirection, ScrollDirection, SystemKeyType, SystemTabType };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//#region src/errors.ts
|
|
2
|
+
var CustardKitError = class extends Error {
|
|
3
|
+
constructor(message) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = "CustardKitError";
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
var ValidationError = class extends CustardKitError {
|
|
9
|
+
constructor(message) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = "ValidationError";
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
var InvalidIdentifierError = class extends CustardKitError {
|
|
15
|
+
constructor(identifier) {
|
|
16
|
+
super(`Invalid identifier: ${identifier}`);
|
|
17
|
+
this.name = "InvalidIdentifierError";
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var InvalidKeyPositionError = class extends CustardKitError {
|
|
21
|
+
constructor(message) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.name = "InvalidKeyPositionError";
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
var LayoutSpecifierMismatchError = class extends CustardKitError {
|
|
27
|
+
constructor(layoutType, specifierType) {
|
|
28
|
+
super(`Layout type "${layoutType}" is not compatible with specifier type "${specifierType}"`);
|
|
29
|
+
this.name = "LayoutSpecifierMismatchError";
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var InvalidLayoutSizeError = class extends CustardKitError {
|
|
33
|
+
constructor(message) {
|
|
34
|
+
super(message);
|
|
35
|
+
this.name = "InvalidLayoutSizeError";
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var EmptyDisplayNameError = class extends CustardKitError {
|
|
39
|
+
constructor() {
|
|
40
|
+
super("displayName must not be empty");
|
|
41
|
+
this.name = "EmptyDisplayNameError";
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
export { InvalidLayoutSizeError as a, InvalidKeyPositionError as i, EmptyDisplayNameError as n, LayoutSpecifierMismatchError as o, InvalidIdentifierError as r, ValidationError as s, CustardKitError as t };
|
package/dist/errors.d.mts
CHANGED
|
@@ -8,5 +8,17 @@ declare class ValidationError extends CustardKitError {
|
|
|
8
8
|
declare class InvalidIdentifierError extends CustardKitError {
|
|
9
9
|
constructor(identifier: string);
|
|
10
10
|
}
|
|
11
|
+
declare class InvalidKeyPositionError extends CustardKitError {
|
|
12
|
+
constructor(message: string);
|
|
13
|
+
}
|
|
14
|
+
declare class LayoutSpecifierMismatchError extends CustardKitError {
|
|
15
|
+
constructor(layoutType: string, specifierType: string);
|
|
16
|
+
}
|
|
17
|
+
declare class InvalidLayoutSizeError extends CustardKitError {
|
|
18
|
+
constructor(message: string);
|
|
19
|
+
}
|
|
20
|
+
declare class EmptyDisplayNameError extends CustardKitError {
|
|
21
|
+
constructor();
|
|
22
|
+
}
|
|
11
23
|
//#endregion
|
|
12
|
-
export { CustardKitError, InvalidIdentifierError, ValidationError };
|
|
24
|
+
export { CustardKitError, EmptyDisplayNameError, InvalidIdentifierError, InvalidKeyPositionError, InvalidLayoutSizeError, LayoutSpecifierMismatchError, ValidationError };
|
package/dist/errors.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as
|
|
1
|
+
import { a as InvalidLayoutSizeError, i as InvalidKeyPositionError, n as EmptyDisplayNameError, o as LayoutSpecifierMismatchError, r as InvalidIdentifierError, s as ValidationError, t as CustardKitError } from "./errors-BPMIP-gS.mjs";
|
|
2
2
|
|
|
3
|
-
export { CustardKitError, InvalidIdentifierError, ValidationError };
|
|
3
|
+
export { CustardKitError, EmptyDisplayNameError, InvalidIdentifierError, InvalidKeyPositionError, InvalidLayoutSizeError, LayoutSpecifierMismatchError, ValidationError };
|
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
import { t as Serializable } from "./types-
|
|
2
|
-
import { u as ScrollDirection } from "./enums-
|
|
3
|
-
import { t as Key } from "./index-
|
|
1
|
+
import { t as Serializable } from "./types-BoV-UB3j.mjs";
|
|
2
|
+
import { u as ScrollDirection } from "./enums-KRVewwrt.mjs";
|
|
3
|
+
import { t as Key } from "./index-D0RJeudc.mjs";
|
|
4
4
|
|
|
5
|
-
//#region src/Layout/GridFitLayout.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
|
-
//#endregion
|
|
17
5
|
//#region src/Layout/GridFitSpecifier.d.ts
|
|
18
6
|
interface GridFitSpecifierOptions {
|
|
19
7
|
x: number;
|
|
@@ -31,17 +19,20 @@ declare class GridFitSpecifier implements Serializable {
|
|
|
31
19
|
get specifierType(): "grid_fit";
|
|
32
20
|
}
|
|
33
21
|
//#endregion
|
|
34
|
-
//#region src/Layout/
|
|
35
|
-
interface
|
|
36
|
-
direction: ScrollDirection;
|
|
22
|
+
//#region src/Layout/GridFitLayout.d.ts
|
|
23
|
+
interface GridFitLayoutOptions {
|
|
37
24
|
rowCount: number;
|
|
38
25
|
columnCount: number;
|
|
39
26
|
}
|
|
40
|
-
declare class
|
|
41
|
-
readonly direction: ScrollDirection;
|
|
27
|
+
declare class GridFitLayout implements Serializable {
|
|
42
28
|
readonly rowCount: number;
|
|
43
29
|
readonly columnCount: number;
|
|
44
|
-
constructor(options:
|
|
30
|
+
constructor(options: GridFitLayoutOptions);
|
|
31
|
+
get layoutType(): "grid_fit";
|
|
32
|
+
validateSpecifier(specifier: GridFitSpecifier): {
|
|
33
|
+
valid: boolean;
|
|
34
|
+
message?: string;
|
|
35
|
+
};
|
|
45
36
|
toJSON(): object;
|
|
46
37
|
}
|
|
47
38
|
//#endregion
|
|
@@ -56,6 +47,26 @@ declare class GridScrollSpecifier implements Serializable {
|
|
|
56
47
|
get specifierType(): "grid_scroll";
|
|
57
48
|
}
|
|
58
49
|
//#endregion
|
|
50
|
+
//#region src/Layout/GridScrollLayout.d.ts
|
|
51
|
+
interface GridScrollLayoutOptions {
|
|
52
|
+
direction: ScrollDirection;
|
|
53
|
+
rowCount: number;
|
|
54
|
+
columnCount: number;
|
|
55
|
+
}
|
|
56
|
+
declare class GridScrollLayout implements Serializable {
|
|
57
|
+
readonly direction: ScrollDirection;
|
|
58
|
+
readonly rowCount: number;
|
|
59
|
+
readonly columnCount: number;
|
|
60
|
+
constructor(options: GridScrollLayoutOptions);
|
|
61
|
+
get layoutType(): "grid_scroll";
|
|
62
|
+
get maxIndex(): number;
|
|
63
|
+
validateSpecifier(specifier: GridScrollSpecifier): {
|
|
64
|
+
valid: boolean;
|
|
65
|
+
message?: string;
|
|
66
|
+
};
|
|
67
|
+
toJSON(): object;
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
59
70
|
//#region src/Layout/KeyData.d.ts
|
|
60
71
|
type Specifier = GridFitSpecifier | GridScrollSpecifier;
|
|
61
72
|
interface KeyDataOptions {
|
|
@@ -76,4 +87,4 @@ declare const Layout: {
|
|
|
76
87
|
readonly gridScroll: (options: GridScrollLayoutOptions) => GridScrollLayout;
|
|
77
88
|
};
|
|
78
89
|
//#endregion
|
|
79
|
-
export {
|
|
90
|
+
export { GridScrollLayout as a, GridScrollSpecifierOptions as c, GridFitSpecifier as d, GridFitSpecifierOptions as f, Specifier as i, GridFitLayout as l, KeyData as n, GridScrollLayoutOptions as o, KeyDataOptions as r, GridScrollSpecifier as s, Layout as t, GridFitLayoutOptions as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as Serializable } from "./types-
|
|
2
|
-
import { c as ReplaceType, f as SystemTabType, l as ScanDirection, t as CharacterForm } from "./enums-
|
|
1
|
+
import { t as Serializable } from "./types-BoV-UB3j.mjs";
|
|
2
|
+
import { c as ReplaceType, f as SystemTabType, l as ScanDirection, t as CharacterForm } from "./enums-KRVewwrt.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/Actions/BaseAction.d.ts
|
|
5
5
|
declare abstract class BaseAction implements Serializable {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as Serializable } from "./types-
|
|
2
|
-
import { t as Action } from "./index
|
|
3
|
-
import { d as SystemKeyType, i as KeyColor, n as FlickDirection, s as LongpressDuration } from "./enums-
|
|
4
|
-
import { t as Label } from "./index-
|
|
1
|
+
import { t as Serializable } from "./types-BoV-UB3j.mjs";
|
|
2
|
+
import { t as Action } from "./index-D-6qRoek.mjs";
|
|
3
|
+
import { d as SystemKeyType, i as KeyColor, n as FlickDirection, s as LongpressDuration } from "./enums-KRVewwrt.mjs";
|
|
4
|
+
import { t as Label } from "./index-Dknx6MxA.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/Keys/LongpressAction.d.ts
|
|
7
7
|
interface LongpressActionOptions {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,59 @@
|
|
|
1
|
-
import { t as Serializable } from "./types-
|
|
2
|
-
import { t as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { t as Serializable } from "./types-BoV-UB3j.mjs";
|
|
2
|
+
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-KRVewwrt.mjs";
|
|
3
|
+
import { n as KeyData, t as Layout } from "./index-BwCtLRO6.mjs";
|
|
4
|
+
import { CustardKitError, InvalidIdentifierError, InvalidKeyPositionError, LayoutSpecifierMismatchError, ValidationError } from "./errors.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/Custard/Interface.d.ts
|
|
7
|
+
interface InterfaceOptions {
|
|
8
|
+
keyStyle: KeyStyle;
|
|
9
|
+
keyLayout: Layout;
|
|
10
|
+
keys: KeyData[];
|
|
11
|
+
}
|
|
12
|
+
declare class Interface implements Serializable {
|
|
13
|
+
readonly keyStyle: KeyStyle;
|
|
14
|
+
readonly keyLayout: Layout;
|
|
15
|
+
readonly keys: KeyData[];
|
|
16
|
+
constructor(options: InterfaceOptions);
|
|
17
|
+
private validateKeys;
|
|
18
|
+
toJSON(): object;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/Custard/Metadata.d.ts
|
|
22
|
+
interface MetadataOptions {
|
|
23
|
+
custardVersion: string;
|
|
24
|
+
displayName: string;
|
|
25
|
+
}
|
|
26
|
+
declare class Metadata implements Serializable {
|
|
27
|
+
readonly custardVersion: string;
|
|
28
|
+
readonly displayName: string;
|
|
29
|
+
constructor(options: MetadataOptions);
|
|
30
|
+
toJSON(): object;
|
|
31
|
+
static create(displayName: string, custardVersion?: string): Metadata;
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/Custard/Custard.d.ts
|
|
35
|
+
interface CustardOptions {
|
|
36
|
+
identifier: string;
|
|
37
|
+
language: Language;
|
|
38
|
+
inputStyle: InputStyle;
|
|
39
|
+
metadata: Metadata;
|
|
40
|
+
interface: Interface;
|
|
41
|
+
}
|
|
42
|
+
declare class Custard implements Serializable {
|
|
43
|
+
readonly identifier: string;
|
|
44
|
+
readonly language: Language;
|
|
45
|
+
readonly inputStyle: InputStyle;
|
|
46
|
+
readonly metadata: Metadata;
|
|
47
|
+
readonly interface: Interface;
|
|
48
|
+
constructor(options: CustardOptions);
|
|
49
|
+
toJSON(): object;
|
|
50
|
+
write(name: string): Promise<void>;
|
|
51
|
+
}
|
|
52
|
+
declare class CustardList {
|
|
53
|
+
readonly custards: Custard[];
|
|
54
|
+
constructor(custards: Custard[]);
|
|
55
|
+
toJSON(): object[];
|
|
56
|
+
write(name: string): Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { CharacterForm, Custard, CustardKitError, CustardList, type CustardOptions, FlickDirection, InputStyle, Interface, type InterfaceOptions, InvalidIdentifierError, InvalidKeyPositionError, KeyColor, KeyStyle, Language, LayoutSpecifierMismatchError, LongpressDuration, Metadata, type MetadataOptions, ReplaceType, ScanDirection, ScrollDirection, type Serializable, SystemKeyType, SystemTabType, ValidationError };
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,114 @@
|
|
|
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-
|
|
2
|
-
import { n as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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-BySrsID6.mjs";
|
|
2
|
+
import { i as InvalidKeyPositionError, n as EmptyDisplayNameError, o as LayoutSpecifierMismatchError, r as InvalidIdentifierError, s as ValidationError, t as CustardKitError } from "./errors-BPMIP-gS.mjs";
|
|
3
|
+
import { a as GridFitSpecifier, i as GridScrollLayout, o as GridFitLayout, r as GridScrollSpecifier } from "./Layout-BYGdAtQk.mjs";
|
|
4
|
+
import { writeFile } from "node:fs/promises";
|
|
5
|
+
|
|
6
|
+
//#region src/Custard/Custard.ts
|
|
7
|
+
const IDENTIFIER_PATTERN = /^[a-z0-9_]+$/;
|
|
8
|
+
var Custard = class {
|
|
9
|
+
identifier;
|
|
10
|
+
language;
|
|
11
|
+
inputStyle;
|
|
12
|
+
metadata;
|
|
13
|
+
interface;
|
|
14
|
+
constructor(options) {
|
|
15
|
+
if (!IDENTIFIER_PATTERN.test(options.identifier)) throw new InvalidIdentifierError(options.identifier);
|
|
16
|
+
this.identifier = options.identifier;
|
|
17
|
+
this.inputStyle = options.inputStyle;
|
|
18
|
+
this.interface = options.interface;
|
|
19
|
+
this.language = options.language;
|
|
20
|
+
this.metadata = options.metadata;
|
|
21
|
+
}
|
|
22
|
+
toJSON() {
|
|
23
|
+
return {
|
|
24
|
+
identifier: this.identifier,
|
|
25
|
+
input_style: this.inputStyle,
|
|
26
|
+
interface: this.interface.toJSON(),
|
|
27
|
+
language: this.language,
|
|
28
|
+
metadata: this.metadata.toJSON()
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
async write(name) {
|
|
32
|
+
let filename = name;
|
|
33
|
+
if (!name.endsWith(".json")) filename = `${name}.json`;
|
|
34
|
+
const content = `${JSON.stringify(this, null, 2)}\n`;
|
|
35
|
+
await writeFile(filename, content, { encoding: "utf8" });
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var CustardList = class {
|
|
39
|
+
custards;
|
|
40
|
+
constructor(custards) {
|
|
41
|
+
this.custards = custards;
|
|
42
|
+
}
|
|
43
|
+
toJSON() {
|
|
44
|
+
return this.custards.map((c) => c.toJSON());
|
|
45
|
+
}
|
|
46
|
+
async write(name) {
|
|
47
|
+
let filename = name;
|
|
48
|
+
if (!name.endsWith(".json")) filename = `${name}.json`;
|
|
49
|
+
const content = `${JSON.stringify(this.toJSON(), null, 2)}\n`;
|
|
50
|
+
await writeFile(filename, content, { encoding: "utf8" });
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/Custard/Interface.ts
|
|
56
|
+
var Interface = class {
|
|
57
|
+
keyStyle;
|
|
58
|
+
keyLayout;
|
|
59
|
+
keys;
|
|
60
|
+
constructor(options) {
|
|
61
|
+
this.keyLayout = options.keyLayout;
|
|
62
|
+
this.keyStyle = options.keyStyle;
|
|
63
|
+
this.keys = options.keys;
|
|
64
|
+
this.validateKeys();
|
|
65
|
+
}
|
|
66
|
+
validateKeys() {
|
|
67
|
+
for (const [i, keyData] of this.keys.entries()) {
|
|
68
|
+
const specifier = keyData.specifier;
|
|
69
|
+
if (this.keyLayout instanceof GridFitLayout) {
|
|
70
|
+
if (!(specifier instanceof GridFitSpecifier)) throw new LayoutSpecifierMismatchError(this.keyLayout.layoutType, specifier.specifierType);
|
|
71
|
+
const result = this.keyLayout.validateSpecifier(specifier);
|
|
72
|
+
if (!result.valid) throw new InvalidKeyPositionError(`Key at index ${i}: ${result.message}`);
|
|
73
|
+
} else if (this.keyLayout instanceof GridScrollLayout) {
|
|
74
|
+
if (!(specifier instanceof GridScrollSpecifier)) throw new LayoutSpecifierMismatchError(this.keyLayout.layoutType, specifier.specifierType);
|
|
75
|
+
const result = this.keyLayout.validateSpecifier(specifier);
|
|
76
|
+
if (!result.valid) throw new InvalidKeyPositionError(`Key at index ${i}: ${result.message}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
toJSON() {
|
|
81
|
+
return {
|
|
82
|
+
key_layout: this.keyLayout.toJSON(),
|
|
83
|
+
key_style: this.keyStyle,
|
|
84
|
+
keys: this.keys.map((k) => k.toJSON())
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/Custard/Metadata.ts
|
|
91
|
+
var Metadata = class Metadata {
|
|
92
|
+
custardVersion;
|
|
93
|
+
displayName;
|
|
94
|
+
constructor(options) {
|
|
95
|
+
if (options.displayName === "") throw new EmptyDisplayNameError();
|
|
96
|
+
this.custardVersion = options.custardVersion;
|
|
97
|
+
this.displayName = options.displayName;
|
|
98
|
+
}
|
|
99
|
+
toJSON() {
|
|
100
|
+
return {
|
|
101
|
+
custard_version: this.custardVersion,
|
|
102
|
+
display_name: this.displayName
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
static create(displayName, custardVersion = "1.2") {
|
|
106
|
+
return new Metadata({
|
|
107
|
+
custardVersion,
|
|
108
|
+
displayName
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
//#endregion
|
|
114
|
+
export { CharacterForm, Custard, CustardKitError, CustardList, FlickDirection, InputStyle, Interface, InvalidIdentifierError, InvalidKeyPositionError, KeyColor, KeyStyle, Language, LayoutSpecifierMismatchError, LongpressDuration, Metadata, ReplaceType, ScanDirection, ScrollDirection, SystemKeyType, SystemTabType, ValidationError };
|
package/dist/types.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Serializable } from "./types-
|
|
1
|
+
import { t as Serializable } from "./types-BoV-UB3j.mjs";
|
|
2
2
|
export { Serializable };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "custardkit-ts",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/ph0ryn/CustardKitTS.git"
|
|
@@ -40,10 +40,6 @@
|
|
|
40
40
|
"./Layout": {
|
|
41
41
|
"types": "./dist/Layout/index.d.mts",
|
|
42
42
|
"import": "./dist/Layout/index.mjs"
|
|
43
|
-
},
|
|
44
|
-
"./Custard": {
|
|
45
|
-
"types": "./dist/Custard/index.d.mts",
|
|
46
|
-
"import": "./dist/Custard/index.mjs"
|
|
47
43
|
}
|
|
48
44
|
}
|
|
49
45
|
}
|
package/dist/Custard/index.d.mts
DELETED
package/dist/Custard/index.mjs
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { n as InvalidIdentifierError } from "./errors-DvC1uxs8.mjs";
|
|
2
|
-
import { writeFile } from "node:fs/promises";
|
|
3
|
-
|
|
4
|
-
//#region src/Custard/Custard.ts
|
|
5
|
-
const IDENTIFIER_PATTERN = /^[a-z0-9_]+$/;
|
|
6
|
-
var Custard = class {
|
|
7
|
-
identifier;
|
|
8
|
-
language;
|
|
9
|
-
inputStyle;
|
|
10
|
-
metadata;
|
|
11
|
-
interface;
|
|
12
|
-
constructor(options) {
|
|
13
|
-
if (!IDENTIFIER_PATTERN.test(options.identifier)) throw new InvalidIdentifierError(options.identifier);
|
|
14
|
-
this.identifier = options.identifier;
|
|
15
|
-
this.inputStyle = options.inputStyle;
|
|
16
|
-
this.interface = options.interface;
|
|
17
|
-
this.language = options.language;
|
|
18
|
-
this.metadata = options.metadata;
|
|
19
|
-
}
|
|
20
|
-
toJSON() {
|
|
21
|
-
return {
|
|
22
|
-
identifier: this.identifier,
|
|
23
|
-
input_style: this.inputStyle,
|
|
24
|
-
interface: this.interface.toJSON(),
|
|
25
|
-
language: this.language,
|
|
26
|
-
metadata: this.metadata.toJSON()
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
async write(name) {
|
|
30
|
-
let filename = name;
|
|
31
|
-
if (!name.endsWith(".json")) filename = `${name}.json`;
|
|
32
|
-
const content = `${JSON.stringify(this, null, 2)}\n`;
|
|
33
|
-
await writeFile(filename, content, { encoding: "utf8" });
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
var CustardList = class {
|
|
37
|
-
custards;
|
|
38
|
-
constructor(custards) {
|
|
39
|
-
this.custards = custards;
|
|
40
|
-
}
|
|
41
|
-
toJSON() {
|
|
42
|
-
return this.custards.map((c) => c.toJSON());
|
|
43
|
-
}
|
|
44
|
-
async write(name) {
|
|
45
|
-
let filename = name;
|
|
46
|
-
if (!name.endsWith(".json")) filename = `${name}.json`;
|
|
47
|
-
const content = `${JSON.stringify(this.toJSON(), null, 2)}\n`;
|
|
48
|
-
await writeFile(filename, content, { encoding: "utf8" });
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
//#endregion
|
|
53
|
-
//#region src/Custard/Interface.ts
|
|
54
|
-
var Interface = class {
|
|
55
|
-
keyStyle;
|
|
56
|
-
keyLayout;
|
|
57
|
-
keys;
|
|
58
|
-
constructor(options) {
|
|
59
|
-
this.keyLayout = options.keyLayout;
|
|
60
|
-
this.keyStyle = options.keyStyle;
|
|
61
|
-
this.keys = options.keys;
|
|
62
|
-
}
|
|
63
|
-
toJSON() {
|
|
64
|
-
return {
|
|
65
|
-
key_layout: this.keyLayout.toJSON(),
|
|
66
|
-
key_style: this.keyStyle,
|
|
67
|
-
keys: this.keys.map((k) => k.toJSON())
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
//#endregion
|
|
73
|
-
//#region src/Custard/Metadata.ts
|
|
74
|
-
var Metadata = class Metadata {
|
|
75
|
-
custardVersion;
|
|
76
|
-
displayName;
|
|
77
|
-
constructor(options) {
|
|
78
|
-
this.custardVersion = options.custardVersion;
|
|
79
|
-
this.displayName = options.displayName;
|
|
80
|
-
}
|
|
81
|
-
toJSON() {
|
|
82
|
-
return {
|
|
83
|
-
custard_version: this.custardVersion,
|
|
84
|
-
display_name: this.displayName
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
static create(displayName, custardVersion = "1.2") {
|
|
88
|
-
return new Metadata({
|
|
89
|
-
custardVersion,
|
|
90
|
-
displayName
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
//#endregion
|
|
96
|
-
export { CustardList as i, Interface as n, Custard as r, Metadata as t };
|
package/dist/Layout-D75UhVN0.mjs
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { r as CustomKey } from "./Keys-CdRZtl30.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/Layout/GridFitLayout.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
|
-
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/Layout/GridFitSpecifier.ts
|
|
22
|
-
var GridFitSpecifier = class {
|
|
23
|
-
x;
|
|
24
|
-
y;
|
|
25
|
-
width;
|
|
26
|
-
height;
|
|
27
|
-
constructor(options) {
|
|
28
|
-
this.height = options.height ?? 1;
|
|
29
|
-
this.width = options.width ?? 1;
|
|
30
|
-
this.x = options.x;
|
|
31
|
-
this.y = options.y;
|
|
32
|
-
}
|
|
33
|
-
toJSON() {
|
|
34
|
-
return {
|
|
35
|
-
height: this.height,
|
|
36
|
-
width: this.width,
|
|
37
|
-
x: this.x,
|
|
38
|
-
y: this.y
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
get specifierType() {
|
|
42
|
-
return "grid_fit";
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
//#endregion
|
|
47
|
-
//#region src/Layout/GridScrollLayout.ts
|
|
48
|
-
var GridScrollLayout = class {
|
|
49
|
-
direction;
|
|
50
|
-
rowCount;
|
|
51
|
-
columnCount;
|
|
52
|
-
constructor(options) {
|
|
53
|
-
this.columnCount = options.columnCount;
|
|
54
|
-
this.direction = options.direction;
|
|
55
|
-
this.rowCount = options.rowCount;
|
|
56
|
-
}
|
|
57
|
-
toJSON() {
|
|
58
|
-
return {
|
|
59
|
-
column_count: this.columnCount,
|
|
60
|
-
direction: this.direction,
|
|
61
|
-
row_count: this.rowCount,
|
|
62
|
-
type: "grid_scroll"
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
//#endregion
|
|
68
|
-
//#region src/Layout/GridScrollSpecifier.ts
|
|
69
|
-
var GridScrollSpecifier = class {
|
|
70
|
-
index;
|
|
71
|
-
constructor(options) {
|
|
72
|
-
this.index = options.index;
|
|
73
|
-
}
|
|
74
|
-
toJSON() {
|
|
75
|
-
return { index: this.index };
|
|
76
|
-
}
|
|
77
|
-
get specifierType() {
|
|
78
|
-
return "grid_scroll";
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
//#endregion
|
|
83
|
-
//#region src/Layout/KeyData.ts
|
|
84
|
-
var KeyData = class {
|
|
85
|
-
specifier;
|
|
86
|
-
key;
|
|
87
|
-
constructor(options) {
|
|
88
|
-
this.key = options.key;
|
|
89
|
-
this.specifier = options.specifier;
|
|
90
|
-
}
|
|
91
|
-
toJSON() {
|
|
92
|
-
let keyType = "system";
|
|
93
|
-
if (this.key instanceof CustomKey) keyType = "custom";
|
|
94
|
-
return {
|
|
95
|
-
key: this.key.toJSON(),
|
|
96
|
-
key_type: keyType,
|
|
97
|
-
specifier: this.specifier.toJSON(),
|
|
98
|
-
specifier_type: this.specifier.specifierType
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
//#endregion
|
|
104
|
-
//#region src/Layout/index.ts
|
|
105
|
-
const Layout = {
|
|
106
|
-
gridFit: (options) => new GridFitLayout(options),
|
|
107
|
-
gridScroll: (options) => new GridScrollLayout(options)
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
//#endregion
|
|
111
|
-
export { GridFitSpecifier as a, GridScrollLayout as i, KeyData as n, GridFitLayout as o, GridScrollSpecifier as r, Layout as t };
|
package/dist/errors-DvC1uxs8.mjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
//#region src/errors.ts
|
|
2
|
-
var CustardKitError = class extends Error {
|
|
3
|
-
constructor(message) {
|
|
4
|
-
super(message);
|
|
5
|
-
this.name = "CustardKitError";
|
|
6
|
-
}
|
|
7
|
-
};
|
|
8
|
-
var ValidationError = class extends CustardKitError {
|
|
9
|
-
constructor(message) {
|
|
10
|
-
super(message);
|
|
11
|
-
this.name = "ValidationError";
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
var InvalidIdentifierError = class extends CustardKitError {
|
|
15
|
-
constructor(identifier) {
|
|
16
|
-
super(`Invalid identifier: ${identifier}`);
|
|
17
|
-
this.name = "InvalidIdentifierError";
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
//#endregion
|
|
22
|
-
export { InvalidIdentifierError as n, ValidationError as r, CustardKitError as t };
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { t as Serializable } from "./types-BRMXqO6t.mjs";
|
|
2
|
-
import { a as KeyStyle, o as Language, r as InputStyle } from "./enums-Dxtvk1eN.mjs";
|
|
3
|
-
import { n as KeyData, t as Layout } from "./index-DjrO7qm1.mjs";
|
|
4
|
-
|
|
5
|
-
//#region src/Custard/Interface.d.ts
|
|
6
|
-
interface InterfaceOptions {
|
|
7
|
-
keyStyle: KeyStyle;
|
|
8
|
-
keyLayout: Layout;
|
|
9
|
-
keys: KeyData[];
|
|
10
|
-
}
|
|
11
|
-
declare class Interface implements Serializable {
|
|
12
|
-
readonly keyStyle: KeyStyle;
|
|
13
|
-
readonly keyLayout: Layout;
|
|
14
|
-
readonly keys: KeyData[];
|
|
15
|
-
constructor(options: InterfaceOptions);
|
|
16
|
-
toJSON(): object;
|
|
17
|
-
}
|
|
18
|
-
//#endregion
|
|
19
|
-
//#region src/Custard/Metadata.d.ts
|
|
20
|
-
interface MetadataOptions {
|
|
21
|
-
custardVersion: string;
|
|
22
|
-
displayName: string;
|
|
23
|
-
}
|
|
24
|
-
declare class Metadata implements Serializable {
|
|
25
|
-
readonly custardVersion: string;
|
|
26
|
-
readonly displayName: string;
|
|
27
|
-
constructor(options: MetadataOptions);
|
|
28
|
-
toJSON(): object;
|
|
29
|
-
static create(displayName: string, custardVersion?: string): Metadata;
|
|
30
|
-
}
|
|
31
|
-
//#endregion
|
|
32
|
-
//#region src/Custard/Custard.d.ts
|
|
33
|
-
interface CustardOptions {
|
|
34
|
-
identifier: string;
|
|
35
|
-
language: Language;
|
|
36
|
-
inputStyle: InputStyle;
|
|
37
|
-
metadata: Metadata;
|
|
38
|
-
interface: Interface;
|
|
39
|
-
}
|
|
40
|
-
declare class Custard implements Serializable {
|
|
41
|
-
readonly identifier: string;
|
|
42
|
-
readonly language: Language;
|
|
43
|
-
readonly inputStyle: InputStyle;
|
|
44
|
-
readonly metadata: Metadata;
|
|
45
|
-
readonly interface: Interface;
|
|
46
|
-
constructor(options: CustardOptions);
|
|
47
|
-
toJSON(): object;
|
|
48
|
-
write(name: string): Promise<void>;
|
|
49
|
-
}
|
|
50
|
-
declare class CustardList {
|
|
51
|
-
readonly custards: Custard[];
|
|
52
|
-
constructor(custards: Custard[]);
|
|
53
|
-
toJSON(): object[];
|
|
54
|
-
write(name: string): Promise<void>;
|
|
55
|
-
}
|
|
56
|
-
//#endregion
|
|
57
|
-
export { MetadataOptions as a, Metadata as i, CustardList as n, Interface as o, CustardOptions as r, InterfaceOptions as s, Custard as t };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|