@twip/web 0.0.0 → 0.1.0-alpha.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.
Files changed (106) hide show
  1. package/LICENSE +202 -0
  2. package/dist/AccessibleNode.d.ts +51 -0
  3. package/dist/AccessibleNode.mjs +177 -0
  4. package/dist/Alignment.d.ts +38 -0
  5. package/dist/Alignment.mjs +90 -0
  6. package/dist/BorderEdges.d.ts +50 -0
  7. package/dist/BorderEdges.mjs +114 -0
  8. package/dist/BorderStyle.d.ts +27 -0
  9. package/dist/BorderStyle.mjs +81 -0
  10. package/dist/Bytes.d.ts +19 -0
  11. package/dist/Bytes.mjs +76 -0
  12. package/dist/CaretPosition.d.ts +34 -0
  13. package/dist/CaretPosition.mjs +148 -0
  14. package/dist/CellAlignment.d.ts +25 -0
  15. package/dist/CellAlignment.mjs +75 -0
  16. package/dist/CellShift.d.ts +30 -0
  17. package/dist/CellShift.mjs +78 -0
  18. package/dist/Clipboard.d.ts +22 -0
  19. package/dist/Clipboard.mjs +90 -0
  20. package/dist/ColumnSide.d.ts +24 -0
  21. package/dist/ColumnSide.mjs +72 -0
  22. package/dist/ControlKind.d.ts +28 -0
  23. package/dist/ControlKind.mjs +84 -0
  24. package/dist/ControlLock.d.ts +42 -0
  25. package/dist/ControlLock.mjs +96 -0
  26. package/dist/DocumentStatus.d.ts +34 -0
  27. package/dist/DocumentStatus.mjs +148 -0
  28. package/dist/Editor.d.ts +773 -0
  29. package/dist/Editor.mjs +2269 -0
  30. package/dist/EditorMode.d.ts +34 -0
  31. package/dist/EditorMode.mjs +84 -0
  32. package/dist/Element.d.ts +57 -0
  33. package/dist/Element.mjs +201 -0
  34. package/dist/ElementKind.d.ts +28 -0
  35. package/dist/ElementKind.mjs +78 -0
  36. package/dist/ElementList.d.ts +20 -0
  37. package/dist/ElementList.mjs +71 -0
  38. package/dist/ElementText.d.ts +34 -0
  39. package/dist/ElementText.mjs +84 -0
  40. package/dist/Event.d.ts +45 -0
  41. package/dist/Event.mjs +159 -0
  42. package/dist/EventKind.d.ts +39 -0
  43. package/dist/EventKind.mjs +93 -0
  44. package/dist/EventList.d.ts +20 -0
  45. package/dist/EventList.mjs +71 -0
  46. package/dist/Fonts.d.ts +29 -0
  47. package/dist/Fonts.mjs +107 -0
  48. package/dist/Highlight.d.ts +41 -0
  49. package/dist/Highlight.mjs +117 -0
  50. package/dist/MarginPreset.d.ts +38 -0
  51. package/dist/MarginPreset.mjs +90 -0
  52. package/dist/MarkSeverity.d.ts +25 -0
  53. package/dist/MarkSeverity.mjs +75 -0
  54. package/dist/Modifiers.d.ts +34 -0
  55. package/dist/Modifiers.mjs +148 -0
  56. package/dist/OpenError.d.ts +30 -0
  57. package/dist/OpenError.mjs +78 -0
  58. package/dist/Orientation.d.ts +30 -0
  59. package/dist/Orientation.mjs +78 -0
  60. package/dist/PageNumber.d.ts +34 -0
  61. package/dist/PageNumber.mjs +84 -0
  62. package/dist/PaperSize.d.ts +50 -0
  63. package/dist/PaperSize.mjs +108 -0
  64. package/dist/ParagraphBorders.d.ts +34 -0
  65. package/dist/ParagraphBorders.mjs +84 -0
  66. package/dist/PictureWrap.d.ts +34 -0
  67. package/dist/PictureWrap.mjs +90 -0
  68. package/dist/PointerKind.d.ts +23 -0
  69. package/dist/PointerKind.mjs +75 -0
  70. package/dist/Rect.d.ts +34 -0
  71. package/dist/Rect.mjs +148 -0
  72. package/dist/Request.d.ts +55 -0
  73. package/dist/Request.mjs +207 -0
  74. package/dist/RequestKind.d.ts +45 -0
  75. package/dist/RequestKind.mjs +105 -0
  76. package/dist/RequestList.d.ts +20 -0
  77. package/dist/RequestList.mjs +71 -0
  78. package/dist/RowHeightRule.d.ts +34 -0
  79. package/dist/RowHeightRule.mjs +84 -0
  80. package/dist/RowSide.d.ts +24 -0
  81. package/dist/RowSide.mjs +72 -0
  82. package/dist/SaveError.d.ts +24 -0
  83. package/dist/SaveError.mjs +72 -0
  84. package/dist/SelectionInfo.d.ts +39 -0
  85. package/dist/SelectionInfo.mjs +166 -0
  86. package/dist/SelectionKind.d.ts +37 -0
  87. package/dist/SelectionKind.mjs +93 -0
  88. package/dist/THIRD-PARTY-NOTICES.md +4475 -0
  89. package/dist/TableAlignment.d.ts +25 -0
  90. package/dist/TableAlignment.mjs +75 -0
  91. package/dist/TableSelection.d.ts +38 -0
  92. package/dist/TableSelection.mjs +90 -0
  93. package/dist/TableWidthUnit.d.ts +31 -0
  94. package/dist/TableWidthUnit.mjs +81 -0
  95. package/dist/TextUnit.d.ts +25 -0
  96. package/dist/TextUnit.mjs +75 -0
  97. package/dist/diplomat-runtime.d.ts +15 -0
  98. package/dist/diplomat-runtime.mjs +786 -0
  99. package/dist/diplomat-wasm.mjs +18 -0
  100. package/dist/gpu.d.ts +15 -0
  101. package/dist/gpu.mjs +42 -0
  102. package/dist/index.d.ts +98 -0
  103. package/dist/index.mjs +101 -0
  104. package/dist/twip-wasm.js +2 -0
  105. package/dist/twip_wasm.wasm +0 -0
  106. package/package.json +18 -4
@@ -0,0 +1,114 @@
1
+ // generated by diplomat-tool
2
+ import wasm from "./diplomat-wasm.mjs";
3
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
4
+
5
+
6
+
7
+ /**
8
+ * Which cell edges a border applies to.
9
+ */
10
+ export class BorderEdges {
11
+ #value = undefined;
12
+
13
+ static #values = new Map([
14
+ ["All", 0],
15
+ ["Outside", 1],
16
+ ["Inside", 2],
17
+ ["InsideHorizontal", 3],
18
+ ["InsideVertical", 4],
19
+ ["Top", 5],
20
+ ["Bottom", 6],
21
+ ["Left", 7],
22
+ ["Right", 8],
23
+ ["Clear", 9]
24
+ ]);
25
+
26
+ static getAllEntries() {
27
+ return BorderEdges.#values.entries();
28
+ }
29
+
30
+ #internalConstructor(value) {
31
+ if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) {
32
+ // We pass in two internalConstructor arguments to create *new*
33
+ // instances of this type, otherwise the enums are treated as singletons.
34
+ if (arguments[1] === diplomatRuntime.internalConstructor ) {
35
+ this.#value = arguments[2];
36
+ return this;
37
+ }
38
+ return BorderEdges.#objectValues[arguments[1]];
39
+ }
40
+
41
+ if (value instanceof BorderEdges) {
42
+ return value;
43
+ }
44
+
45
+ let intVal = BorderEdges.#values.get(value);
46
+
47
+ // Nullish check, checks for null or undefined
48
+ if (intVal != null) {
49
+ return BorderEdges.#objectValues[intVal];
50
+ }
51
+
52
+ throw TypeError(value + " is not a BorderEdges and does not correspond to any of its enumerator values.");
53
+ }
54
+
55
+ /** @internal */
56
+ static fromValue(value) {
57
+ return new BorderEdges(value);
58
+ }
59
+
60
+ get value(){
61
+ return [...BorderEdges.#values.keys()][this.#value];
62
+ }
63
+
64
+ /** @internal */
65
+ get ffiValue(){
66
+ return this.#value;
67
+ }
68
+ static #objectValues = [
69
+ new BorderEdges(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
70
+ new BorderEdges(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
71
+ new BorderEdges(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
72
+ new BorderEdges(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 3),
73
+ new BorderEdges(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 4),
74
+ new BorderEdges(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 5),
75
+ new BorderEdges(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 6),
76
+ new BorderEdges(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 7),
77
+ new BorderEdges(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 8),
78
+ new BorderEdges(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 9),
79
+ ];
80
+
81
+ /**
82
+ * Every edge.
83
+ */
84
+ static All = BorderEdges.#objectValues[0];
85
+ /**
86
+ * The outer edges of the selection.
87
+ */
88
+ static Outside = BorderEdges.#objectValues[1];
89
+ /**
90
+ * The inner edges, horizontal and vertical.
91
+ */
92
+ static Inside = BorderEdges.#objectValues[2];
93
+ /**
94
+ * The inner horizontal edges.
95
+ */
96
+ static InsideHorizontal = BorderEdges.#objectValues[3];
97
+ /**
98
+ * The inner vertical edges.
99
+ */
100
+ static InsideVertical = BorderEdges.#objectValues[4];
101
+ static Top = BorderEdges.#objectValues[5];
102
+ static Bottom = BorderEdges.#objectValues[6];
103
+ static Left = BorderEdges.#objectValues[7];
104
+ static Right = BorderEdges.#objectValues[8];
105
+ /**
106
+ * Removes the borders.
107
+ */
108
+ static Clear = BorderEdges.#objectValues[9];
109
+
110
+
111
+ constructor(value) {
112
+ return this.#internalConstructor(...arguments)
113
+ }
114
+ }
@@ -0,0 +1,27 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * The line style of a border.
8
+ */
9
+ export class BorderStyle {
10
+
11
+ /** @internal */
12
+ static fromValue(value: BorderStyle | string): BorderStyle;
13
+
14
+ get value(): string;
15
+
16
+ /** @internal */
17
+ get ffiValue(): number;
18
+
19
+ static Single : BorderStyle;
20
+ static Double : BorderStyle;
21
+ static Dotted : BorderStyle;
22
+ static Dashed : BorderStyle;
23
+ static Thick : BorderStyle;
24
+
25
+
26
+ constructor(value: BorderStyle | string );
27
+ }
@@ -0,0 +1,81 @@
1
+ // generated by diplomat-tool
2
+ import wasm from "./diplomat-wasm.mjs";
3
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
4
+
5
+
6
+
7
+ /**
8
+ * The line style of a border.
9
+ */
10
+ export class BorderStyle {
11
+ #value = undefined;
12
+
13
+ static #values = new Map([
14
+ ["Single", 0],
15
+ ["Double", 1],
16
+ ["Dotted", 2],
17
+ ["Dashed", 3],
18
+ ["Thick", 4]
19
+ ]);
20
+
21
+ static getAllEntries() {
22
+ return BorderStyle.#values.entries();
23
+ }
24
+
25
+ #internalConstructor(value) {
26
+ if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) {
27
+ // We pass in two internalConstructor arguments to create *new*
28
+ // instances of this type, otherwise the enums are treated as singletons.
29
+ if (arguments[1] === diplomatRuntime.internalConstructor ) {
30
+ this.#value = arguments[2];
31
+ return this;
32
+ }
33
+ return BorderStyle.#objectValues[arguments[1]];
34
+ }
35
+
36
+ if (value instanceof BorderStyle) {
37
+ return value;
38
+ }
39
+
40
+ let intVal = BorderStyle.#values.get(value);
41
+
42
+ // Nullish check, checks for null or undefined
43
+ if (intVal != null) {
44
+ return BorderStyle.#objectValues[intVal];
45
+ }
46
+
47
+ throw TypeError(value + " is not a BorderStyle and does not correspond to any of its enumerator values.");
48
+ }
49
+
50
+ /** @internal */
51
+ static fromValue(value) {
52
+ return new BorderStyle(value);
53
+ }
54
+
55
+ get value(){
56
+ return [...BorderStyle.#values.keys()][this.#value];
57
+ }
58
+
59
+ /** @internal */
60
+ get ffiValue(){
61
+ return this.#value;
62
+ }
63
+ static #objectValues = [
64
+ new BorderStyle(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
65
+ new BorderStyle(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
66
+ new BorderStyle(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
67
+ new BorderStyle(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 3),
68
+ new BorderStyle(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 4),
69
+ ];
70
+
71
+ static Single = BorderStyle.#objectValues[0];
72
+ static Double = BorderStyle.#objectValues[1];
73
+ static Dotted = BorderStyle.#objectValues[2];
74
+ static Dashed = BorderStyle.#objectValues[3];
75
+ static Thick = BorderStyle.#objectValues[4];
76
+
77
+
78
+ constructor(value) {
79
+ return this.#internalConstructor(...arguments)
80
+ }
81
+ }
@@ -0,0 +1,19 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * Bytes the engine produced (a saved .docx, a PDF).
8
+ */
9
+ export class Bytes {
10
+ /** @internal */
11
+ get ffiValue(): pointer;
12
+ /** @internal */
13
+ constructor();
14
+
15
+
16
+ get len(): number;
17
+
18
+ asSlice(): Array<number>;
19
+ }
package/dist/Bytes.mjs ADDED
@@ -0,0 +1,76 @@
1
+ // generated by diplomat-tool
2
+ import wasm from "./diplomat-wasm.mjs";
3
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
4
+
5
+ const Bytes_box_destroy_registry = new FinalizationRegistry((ptr) => {
6
+ wasm.Bytes_destroy(ptr);
7
+ });
8
+
9
+ /**
10
+ * Bytes the engine produced (a saved .docx, a PDF).
11
+ */
12
+ export class Bytes {
13
+ // Internal ptr reference:
14
+ #ptr = null;
15
+
16
+ // Lifetimes are only to keep dependencies alive.
17
+ // Since JS won't garbage collect until there are no incoming edges.
18
+ #selfEdge = [];
19
+
20
+ #internalConstructor(symbol, ptr, selfEdge) {
21
+ if (symbol !== diplomatRuntime.internalConstructor) {
22
+ console.error("Bytes is an Opaque type. You cannot call its constructor.");
23
+ return;
24
+ }
25
+ this.#ptr = ptr;
26
+ this.#selfEdge = selfEdge;
27
+
28
+ // Are we being borrowed? If not, we can register.
29
+ if (this.#selfEdge.length === 0) {
30
+ Bytes_box_destroy_registry.register(this, this.#ptr);
31
+ }
32
+
33
+ return this;
34
+ }
35
+ /** @internal */
36
+ get ffiValue() {
37
+ return this.#ptr;
38
+ }
39
+
40
+
41
+ get len() {
42
+
43
+ const result = wasm.Bytes_len(this.ffiValue);
44
+
45
+ try {
46
+ return result;
47
+ }
48
+
49
+ finally {
50
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
51
+ }
52
+ }
53
+
54
+ asSlice() {
55
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 8, 4, false);
56
+
57
+ // This lifetime edge depends on lifetimes 'a
58
+ let aEdges = [this];
59
+
60
+
61
+ const result = wasm.Bytes_as_slice(diplomatReceive.buffer, this.ffiValue);
62
+
63
+ try {
64
+ return Array.from(new diplomatRuntime.DiplomatSlicePrimitive(wasm, diplomatReceive.buffer, "u8", aEdges).getValue());
65
+ }
66
+
67
+ finally {
68
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
69
+ diplomatReceive.free();
70
+ }
71
+ }
72
+
73
+ constructor(symbol, ptr, selfEdge) {
74
+ return this.#internalConstructor(...arguments)
75
+ }
76
+ }
@@ -0,0 +1,34 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+ export type CaretPosition_obj = {
5
+ x: number;
6
+ y: number;
7
+ height: number;
8
+ visible: boolean;
9
+ };
10
+
11
+
12
+
13
+ /**
14
+ * The caret in content pixels; `visible` is false while text is selected.
15
+ */
16
+ export class CaretPosition {
17
+ get x(): number;
18
+ set x(value: number);
19
+ get y(): number;
20
+ set y(value: number);
21
+ get height(): number;
22
+ set height(value: number);
23
+ get visible(): boolean;
24
+ set visible(value: boolean);
25
+ /** @internal */
26
+ static fromFields(structObj : CaretPosition_obj) : CaretPosition;
27
+
28
+ /**
29
+ * Create `CaretPosition` from an object that contains all of `CaretPosition`s fields.
30
+ * Optional fields do not need to be included in the provided object.
31
+ */
32
+ constructor(structObj: CaretPosition_obj);
33
+
34
+ }
@@ -0,0 +1,148 @@
1
+ // generated by diplomat-tool
2
+ import wasm from "./diplomat-wasm.mjs";
3
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
4
+
5
+
6
+
7
+ /**
8
+ * The caret in content pixels; `visible` is false while text is selected.
9
+ */
10
+ export class CaretPosition {
11
+ #x;
12
+ get x() {
13
+ return this.#x;
14
+ }
15
+ set x(value){
16
+ this.#x = value;
17
+ }
18
+ #y;
19
+ get y() {
20
+ return this.#y;
21
+ }
22
+ set y(value){
23
+ this.#y = value;
24
+ }
25
+ #height;
26
+ get height() {
27
+ return this.#height;
28
+ }
29
+ set height(value){
30
+ this.#height = value;
31
+ }
32
+ #visible;
33
+ get visible() {
34
+ return this.#visible;
35
+ }
36
+ set visible(value){
37
+ this.#visible = value;
38
+ }
39
+ /** @internal */
40
+ static fromFields(structObj) {
41
+ return new CaretPosition(structObj);
42
+ }
43
+
44
+ #internalConstructor(structObj) {
45
+ if (typeof structObj !== "object") {
46
+ throw new Error("CaretPosition's constructor takes an object of CaretPosition's fields.");
47
+ }
48
+
49
+ if ("x" in structObj) {
50
+ this.#x = structObj.x;
51
+ } else {
52
+ throw new Error("Missing required field x.");
53
+ }
54
+
55
+ if ("y" in structObj) {
56
+ this.#y = structObj.y;
57
+ } else {
58
+ throw new Error("Missing required field y.");
59
+ }
60
+
61
+ if ("height" in structObj) {
62
+ this.#height = structObj.height;
63
+ } else {
64
+ throw new Error("Missing required field height.");
65
+ }
66
+
67
+ if ("visible" in structObj) {
68
+ this.#visible = structObj.visible;
69
+ } else {
70
+ throw new Error("Missing required field visible.");
71
+ }
72
+
73
+ return this;
74
+ }
75
+
76
+ // Return this struct in FFI function friendly format.
77
+ // Returns an array that can be expanded with spread syntax (...)
78
+ _intoFFI(
79
+ dst,
80
+ functionCleanupArena,
81
+ appendArrayMap
82
+ ) {
83
+
84
+ this._writeToArrayBuffer(wasm.memory.buffer, dst, functionCleanupArena, appendArrayMap);
85
+
86
+ return dst;
87
+ }
88
+
89
+ static get _sizeBytes() {
90
+ return 32;
91
+ }
92
+
93
+ /// Currently unused, we may want to use later on though:
94
+ static get _sizeAlign() {
95
+ return 8;
96
+ }
97
+
98
+ static _fromSuppliedValue(internalConstructor, obj) {
99
+ if (internalConstructor !== diplomatRuntime.internalConstructor) {
100
+ throw new Error("_fromSuppliedValue cannot be called externally.");
101
+ }
102
+
103
+ if (obj instanceof CaretPosition) {
104
+ return obj;
105
+ }
106
+
107
+ return CaretPosition.fromFields(obj);
108
+ }
109
+
110
+ _writeToArrayBuffer(
111
+ arrayBuffer,
112
+ offset,
113
+ functionCleanupArena,
114
+ appendArrayMap
115
+ ) {
116
+ diplomatRuntime.writeToArrayBuffer(arrayBuffer, offset + 0, this.#x, Float64Array);
117
+ diplomatRuntime.writeToArrayBuffer(arrayBuffer, offset + 8, this.#y, Float64Array);
118
+ diplomatRuntime.writeToArrayBuffer(arrayBuffer, offset + 16, this.#height, Float64Array);
119
+ diplomatRuntime.writeToArrayBuffer(arrayBuffer, offset + 24, this.#visible, Uint8Array);
120
+ }
121
+
122
+ // This struct contains borrowed fields, so this takes in a list of
123
+ // "edges" corresponding to where each lifetime's data may have been borrowed from
124
+ // and passes it down to individual fields containing the borrow.
125
+ // This method does not attempt to handle any dependencies between lifetimes, the caller
126
+ // should handle this when constructing edge arrays.
127
+ static _fromFFI(internalConstructor, ptr) {
128
+ if (internalConstructor !== diplomatRuntime.internalConstructor) {
129
+ throw new Error("CaretPosition._fromFFI is not meant to be called externally. Please use the default constructor.");
130
+ }
131
+ let structObj = {};
132
+ const xDeref = (new Float64Array(wasm.memory.buffer, ptr, 1))[0];
133
+ structObj.x = xDeref;
134
+ const yDeref = (new Float64Array(wasm.memory.buffer, ptr + 8, 1))[0];
135
+ structObj.y = yDeref;
136
+ const heightDeref = (new Float64Array(wasm.memory.buffer, ptr + 16, 1))[0];
137
+ structObj.height = heightDeref;
138
+ const visibleDeref = (new Uint8Array(wasm.memory.buffer, ptr + 24, 1))[0] === 1;
139
+ structObj.visible = visibleDeref;
140
+
141
+ return new CaretPosition(structObj);
142
+ }
143
+
144
+
145
+ constructor(structObj) {
146
+ return this.#internalConstructor(...arguments)
147
+ }
148
+ }
@@ -0,0 +1,25 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * Vertical alignment of text in a cell.
8
+ */
9
+ export class CellAlignment {
10
+
11
+ /** @internal */
12
+ static fromValue(value: CellAlignment | string): CellAlignment;
13
+
14
+ get value(): string;
15
+
16
+ /** @internal */
17
+ get ffiValue(): number;
18
+
19
+ static Top : CellAlignment;
20
+ static Center : CellAlignment;
21
+ static Bottom : CellAlignment;
22
+
23
+
24
+ constructor(value: CellAlignment | string );
25
+ }
@@ -0,0 +1,75 @@
1
+ // generated by diplomat-tool
2
+ import wasm from "./diplomat-wasm.mjs";
3
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
4
+
5
+
6
+
7
+ /**
8
+ * Vertical alignment of text in a cell.
9
+ */
10
+ export class CellAlignment {
11
+ #value = undefined;
12
+
13
+ static #values = new Map([
14
+ ["Top", 0],
15
+ ["Center", 1],
16
+ ["Bottom", 2]
17
+ ]);
18
+
19
+ static getAllEntries() {
20
+ return CellAlignment.#values.entries();
21
+ }
22
+
23
+ #internalConstructor(value) {
24
+ if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) {
25
+ // We pass in two internalConstructor arguments to create *new*
26
+ // instances of this type, otherwise the enums are treated as singletons.
27
+ if (arguments[1] === diplomatRuntime.internalConstructor ) {
28
+ this.#value = arguments[2];
29
+ return this;
30
+ }
31
+ return CellAlignment.#objectValues[arguments[1]];
32
+ }
33
+
34
+ if (value instanceof CellAlignment) {
35
+ return value;
36
+ }
37
+
38
+ let intVal = CellAlignment.#values.get(value);
39
+
40
+ // Nullish check, checks for null or undefined
41
+ if (intVal != null) {
42
+ return CellAlignment.#objectValues[intVal];
43
+ }
44
+
45
+ throw TypeError(value + " is not a CellAlignment and does not correspond to any of its enumerator values.");
46
+ }
47
+
48
+ /** @internal */
49
+ static fromValue(value) {
50
+ return new CellAlignment(value);
51
+ }
52
+
53
+ get value(){
54
+ return [...CellAlignment.#values.keys()][this.#value];
55
+ }
56
+
57
+ /** @internal */
58
+ get ffiValue(){
59
+ return this.#value;
60
+ }
61
+ static #objectValues = [
62
+ new CellAlignment(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
63
+ new CellAlignment(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
64
+ new CellAlignment(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
65
+ ];
66
+
67
+ static Top = CellAlignment.#objectValues[0];
68
+ static Center = CellAlignment.#objectValues[1];
69
+ static Bottom = CellAlignment.#objectValues[2];
70
+
71
+
72
+ constructor(value) {
73
+ return this.#internalConstructor(...arguments)
74
+ }
75
+ }
@@ -0,0 +1,30 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * Which way the remaining cells move when cells are deleted.
8
+ */
9
+ export class CellShift {
10
+
11
+ /** @internal */
12
+ static fromValue(value: CellShift | string): CellShift;
13
+
14
+ get value(): string;
15
+
16
+ /** @internal */
17
+ get ffiValue(): number;
18
+
19
+ /**
20
+ * The cells to the right move left.
21
+ */
22
+ static Left : CellShift;
23
+ /**
24
+ * The cells below move up.
25
+ */
26
+ static Up : CellShift;
27
+
28
+
29
+ constructor(value: CellShift | string );
30
+ }