@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,34 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * How a row height is applied.
8
+ */
9
+ export class RowHeightRule {
10
+
11
+ /** @internal */
12
+ static fromValue(value: RowHeightRule | string): RowHeightRule;
13
+
14
+ get value(): string;
15
+
16
+ /** @internal */
17
+ get ffiValue(): number;
18
+
19
+ /**
20
+ * The row fits its content.
21
+ */
22
+ static Auto : RowHeightRule;
23
+ /**
24
+ * The row is at least the given height.
25
+ */
26
+ static AtLeast : RowHeightRule;
27
+ /**
28
+ * The row is exactly the given height.
29
+ */
30
+ static Exact : RowHeightRule;
31
+
32
+
33
+ constructor(value: RowHeightRule | string );
34
+ }
@@ -0,0 +1,84 @@
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
+ * How a row height is applied.
9
+ */
10
+ export class RowHeightRule {
11
+ #value = undefined;
12
+
13
+ static #values = new Map([
14
+ ["Auto", 0],
15
+ ["AtLeast", 1],
16
+ ["Exact", 2]
17
+ ]);
18
+
19
+ static getAllEntries() {
20
+ return RowHeightRule.#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 RowHeightRule.#objectValues[arguments[1]];
32
+ }
33
+
34
+ if (value instanceof RowHeightRule) {
35
+ return value;
36
+ }
37
+
38
+ let intVal = RowHeightRule.#values.get(value);
39
+
40
+ // Nullish check, checks for null or undefined
41
+ if (intVal != null) {
42
+ return RowHeightRule.#objectValues[intVal];
43
+ }
44
+
45
+ throw TypeError(value + " is not a RowHeightRule and does not correspond to any of its enumerator values.");
46
+ }
47
+
48
+ /** @internal */
49
+ static fromValue(value) {
50
+ return new RowHeightRule(value);
51
+ }
52
+
53
+ get value(){
54
+ return [...RowHeightRule.#values.keys()][this.#value];
55
+ }
56
+
57
+ /** @internal */
58
+ get ffiValue(){
59
+ return this.#value;
60
+ }
61
+ static #objectValues = [
62
+ new RowHeightRule(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
63
+ new RowHeightRule(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
64
+ new RowHeightRule(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
65
+ ];
66
+
67
+ /**
68
+ * The row fits its content.
69
+ */
70
+ static Auto = RowHeightRule.#objectValues[0];
71
+ /**
72
+ * The row is at least the given height.
73
+ */
74
+ static AtLeast = RowHeightRule.#objectValues[1];
75
+ /**
76
+ * The row is exactly the given height.
77
+ */
78
+ static Exact = RowHeightRule.#objectValues[2];
79
+
80
+
81
+ constructor(value) {
82
+ return this.#internalConstructor(...arguments)
83
+ }
84
+ }
@@ -0,0 +1,24 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * Where a new row goes relative to the selected rows.
8
+ */
9
+ export class RowSide {
10
+
11
+ /** @internal */
12
+ static fromValue(value: RowSide | string): RowSide;
13
+
14
+ get value(): string;
15
+
16
+ /** @internal */
17
+ get ffiValue(): number;
18
+
19
+ static Above : RowSide;
20
+ static Below : RowSide;
21
+
22
+
23
+ constructor(value: RowSide | string );
24
+ }
@@ -0,0 +1,72 @@
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
+ * Where a new row goes relative to the selected rows.
9
+ */
10
+ export class RowSide {
11
+ #value = undefined;
12
+
13
+ static #values = new Map([
14
+ ["Above", 0],
15
+ ["Below", 1]
16
+ ]);
17
+
18
+ static getAllEntries() {
19
+ return RowSide.#values.entries();
20
+ }
21
+
22
+ #internalConstructor(value) {
23
+ if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) {
24
+ // We pass in two internalConstructor arguments to create *new*
25
+ // instances of this type, otherwise the enums are treated as singletons.
26
+ if (arguments[1] === diplomatRuntime.internalConstructor ) {
27
+ this.#value = arguments[2];
28
+ return this;
29
+ }
30
+ return RowSide.#objectValues[arguments[1]];
31
+ }
32
+
33
+ if (value instanceof RowSide) {
34
+ return value;
35
+ }
36
+
37
+ let intVal = RowSide.#values.get(value);
38
+
39
+ // Nullish check, checks for null or undefined
40
+ if (intVal != null) {
41
+ return RowSide.#objectValues[intVal];
42
+ }
43
+
44
+ throw TypeError(value + " is not a RowSide and does not correspond to any of its enumerator values.");
45
+ }
46
+
47
+ /** @internal */
48
+ static fromValue(value) {
49
+ return new RowSide(value);
50
+ }
51
+
52
+ get value(){
53
+ return [...RowSide.#values.keys()][this.#value];
54
+ }
55
+
56
+ /** @internal */
57
+ get ffiValue(){
58
+ return this.#value;
59
+ }
60
+ static #objectValues = [
61
+ new RowSide(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
62
+ new RowSide(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
63
+ ];
64
+
65
+ static Above = RowSide.#objectValues[0];
66
+ static Below = RowSide.#objectValues[1];
67
+
68
+
69
+ constructor(value) {
70
+ return this.#internalConstructor(...arguments)
71
+ }
72
+ }
@@ -0,0 +1,24 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * Why a document didn't save.
8
+ */
9
+ export class SaveError {
10
+
11
+ /** @internal */
12
+ static fromValue(value: SaveError | string): SaveError;
13
+
14
+ get value(): string;
15
+
16
+ /** @internal */
17
+ get ffiValue(): number;
18
+
19
+ static NoDocument : SaveError;
20
+ static Failed : SaveError;
21
+
22
+
23
+ constructor(value: SaveError | string );
24
+ }
@@ -0,0 +1,72 @@
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
+ * Why a document didn't save.
9
+ */
10
+ export class SaveError {
11
+ #value = undefined;
12
+
13
+ static #values = new Map([
14
+ ["NoDocument", 0],
15
+ ["Failed", 1]
16
+ ]);
17
+
18
+ static getAllEntries() {
19
+ return SaveError.#values.entries();
20
+ }
21
+
22
+ #internalConstructor(value) {
23
+ if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) {
24
+ // We pass in two internalConstructor arguments to create *new*
25
+ // instances of this type, otherwise the enums are treated as singletons.
26
+ if (arguments[1] === diplomatRuntime.internalConstructor ) {
27
+ this.#value = arguments[2];
28
+ return this;
29
+ }
30
+ return SaveError.#objectValues[arguments[1]];
31
+ }
32
+
33
+ if (value instanceof SaveError) {
34
+ return value;
35
+ }
36
+
37
+ let intVal = SaveError.#values.get(value);
38
+
39
+ // Nullish check, checks for null or undefined
40
+ if (intVal != null) {
41
+ return SaveError.#objectValues[intVal];
42
+ }
43
+
44
+ throw TypeError(value + " is not a SaveError and does not correspond to any of its enumerator values.");
45
+ }
46
+
47
+ /** @internal */
48
+ static fromValue(value) {
49
+ return new SaveError(value);
50
+ }
51
+
52
+ get value(){
53
+ return [...SaveError.#values.keys()][this.#value];
54
+ }
55
+
56
+ /** @internal */
57
+ get ffiValue(){
58
+ return this.#value;
59
+ }
60
+ static #objectValues = [
61
+ new SaveError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
62
+ new SaveError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
63
+ ];
64
+
65
+ static NoDocument = SaveError.#objectValues[0];
66
+ static Failed = SaveError.#objectValues[1];
67
+
68
+
69
+ constructor(value) {
70
+ return this.#internalConstructor(...arguments)
71
+ }
72
+ }
@@ -0,0 +1,39 @@
1
+ // generated by diplomat-tool
2
+ import type { SelectionKind } from "./SelectionKind"
3
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
4
+
5
+ export type SelectionInfo_obj = {
6
+ kind: SelectionKind;
7
+ anchorParagraph: bigint;
8
+ anchorOffset: number;
9
+ focusParagraph: bigint;
10
+ focusOffset: number;
11
+ };
12
+
13
+
14
+
15
+ /**
16
+ * The selection. For a caret, text or a block: the paragraph ids and character offsets of its anchor (where it
17
+ * started) and focus (where it ends now); pass them to `select_range`. Zero for cells and objects.
18
+ */
19
+ export class SelectionInfo {
20
+ get kind(): SelectionKind;
21
+ set kind(value: SelectionKind);
22
+ get anchorParagraph(): bigint;
23
+ set anchorParagraph(value: bigint);
24
+ get anchorOffset(): number;
25
+ set anchorOffset(value: number);
26
+ get focusParagraph(): bigint;
27
+ set focusParagraph(value: bigint);
28
+ get focusOffset(): number;
29
+ set focusOffset(value: number);
30
+ /** @internal */
31
+ static fromFields(structObj : SelectionInfo_obj) : SelectionInfo;
32
+
33
+ /**
34
+ * Create `SelectionInfo` from an object that contains all of `SelectionInfo`s fields.
35
+ * Optional fields do not need to be included in the provided object.
36
+ */
37
+ constructor(structObj: SelectionInfo_obj);
38
+
39
+ }
@@ -0,0 +1,166 @@
1
+ // generated by diplomat-tool
2
+ import { SelectionKind } from "./SelectionKind.mjs"
3
+ import wasm from "./diplomat-wasm.mjs";
4
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
5
+
6
+
7
+
8
+ /**
9
+ * The selection. For a caret, text or a block: the paragraph ids and character offsets of its anchor (where it
10
+ * started) and focus (where it ends now); pass them to `select_range`. Zero for cells and objects.
11
+ */
12
+ export class SelectionInfo {
13
+ #kind;
14
+ get kind() {
15
+ return this.#kind;
16
+ }
17
+ set kind(value){
18
+ this.#kind = value;
19
+ }
20
+ #anchorParagraph;
21
+ get anchorParagraph() {
22
+ return this.#anchorParagraph;
23
+ }
24
+ set anchorParagraph(value){
25
+ this.#anchorParagraph = value;
26
+ }
27
+ #anchorOffset;
28
+ get anchorOffset() {
29
+ return this.#anchorOffset;
30
+ }
31
+ set anchorOffset(value){
32
+ this.#anchorOffset = value;
33
+ }
34
+ #focusParagraph;
35
+ get focusParagraph() {
36
+ return this.#focusParagraph;
37
+ }
38
+ set focusParagraph(value){
39
+ this.#focusParagraph = value;
40
+ }
41
+ #focusOffset;
42
+ get focusOffset() {
43
+ return this.#focusOffset;
44
+ }
45
+ set focusOffset(value){
46
+ this.#focusOffset = value;
47
+ }
48
+ /** @internal */
49
+ static fromFields(structObj) {
50
+ return new SelectionInfo(structObj);
51
+ }
52
+
53
+ #internalConstructor(structObj) {
54
+ if (typeof structObj !== "object") {
55
+ throw new Error("SelectionInfo's constructor takes an object of SelectionInfo's fields.");
56
+ }
57
+
58
+ if ("kind" in structObj) {
59
+ this.#kind = new SelectionKind(structObj.kind);
60
+ } else {
61
+ throw new Error("Missing required field kind.");
62
+ }
63
+
64
+ if ("anchorParagraph" in structObj) {
65
+ this.#anchorParagraph = structObj.anchorParagraph;
66
+ } else {
67
+ throw new Error("Missing required field anchorParagraph.");
68
+ }
69
+
70
+ if ("anchorOffset" in structObj) {
71
+ this.#anchorOffset = structObj.anchorOffset;
72
+ } else {
73
+ throw new Error("Missing required field anchorOffset.");
74
+ }
75
+
76
+ if ("focusParagraph" in structObj) {
77
+ this.#focusParagraph = structObj.focusParagraph;
78
+ } else {
79
+ throw new Error("Missing required field focusParagraph.");
80
+ }
81
+
82
+ if ("focusOffset" in structObj) {
83
+ this.#focusOffset = structObj.focusOffset;
84
+ } else {
85
+ throw new Error("Missing required field focusOffset.");
86
+ }
87
+
88
+ return this;
89
+ }
90
+
91
+ // Return this struct in FFI function friendly format.
92
+ // Returns an array that can be expanded with spread syntax (...)
93
+ _intoFFI(
94
+ dst,
95
+ functionCleanupArena,
96
+ appendArrayMap
97
+ ) {
98
+
99
+ this._writeToArrayBuffer(wasm.memory.buffer, dst, functionCleanupArena, appendArrayMap);
100
+
101
+ return dst;
102
+ }
103
+
104
+ static get _sizeBytes() {
105
+ return 40;
106
+ }
107
+
108
+ /// Currently unused, we may want to use later on though:
109
+ static get _sizeAlign() {
110
+ return 8;
111
+ }
112
+
113
+ static _fromSuppliedValue(internalConstructor, obj) {
114
+ if (internalConstructor !== diplomatRuntime.internalConstructor) {
115
+ throw new Error("_fromSuppliedValue cannot be called externally.");
116
+ }
117
+
118
+ if (obj instanceof SelectionInfo) {
119
+ return obj;
120
+ }
121
+
122
+ return SelectionInfo.fromFields(obj);
123
+ }
124
+
125
+ _writeToArrayBuffer(
126
+ arrayBuffer,
127
+ offset,
128
+ functionCleanupArena,
129
+ appendArrayMap
130
+ ) {
131
+ diplomatRuntime.writeToArrayBuffer(arrayBuffer, offset + 0, new SelectionKind(this.#kind).ffiValue, Int32Array);
132
+ diplomatRuntime.writeToArrayBuffer(arrayBuffer, offset + 8, this.#anchorParagraph, BigUint64Array);
133
+ diplomatRuntime.writeToArrayBuffer(arrayBuffer, offset + 16, this.#anchorOffset, Uint32Array);
134
+ diplomatRuntime.writeToArrayBuffer(arrayBuffer, offset + 24, this.#focusParagraph, BigUint64Array);
135
+ diplomatRuntime.writeToArrayBuffer(arrayBuffer, offset + 32, this.#focusOffset, Uint32Array);
136
+ }
137
+
138
+ // This struct contains borrowed fields, so this takes in a list of
139
+ // "edges" corresponding to where each lifetime's data may have been borrowed from
140
+ // and passes it down to individual fields containing the borrow.
141
+ // This method does not attempt to handle any dependencies between lifetimes, the caller
142
+ // should handle this when constructing edge arrays.
143
+ static _fromFFI(internalConstructor, ptr) {
144
+ if (internalConstructor !== diplomatRuntime.internalConstructor) {
145
+ throw new Error("SelectionInfo._fromFFI is not meant to be called externally. Please use the default constructor.");
146
+ }
147
+ let structObj = {};
148
+ const kindDeref = diplomatRuntime.enumDiscriminant(wasm, ptr);
149
+ structObj.kind = new SelectionKind(diplomatRuntime.internalConstructor, kindDeref);
150
+ const anchorParagraphDeref = (new BigUint64Array(wasm.memory.buffer, ptr + 8, 1))[0];
151
+ structObj.anchorParagraph = anchorParagraphDeref;
152
+ const anchorOffsetDeref = (new Uint32Array(wasm.memory.buffer, ptr + 16, 1))[0];
153
+ structObj.anchorOffset = anchorOffsetDeref;
154
+ const focusParagraphDeref = (new BigUint64Array(wasm.memory.buffer, ptr + 24, 1))[0];
155
+ structObj.focusParagraph = focusParagraphDeref;
156
+ const focusOffsetDeref = (new Uint32Array(wasm.memory.buffer, ptr + 32, 1))[0];
157
+ structObj.focusOffset = focusOffsetDeref;
158
+
159
+ return new SelectionInfo(structObj);
160
+ }
161
+
162
+
163
+ constructor(structObj) {
164
+ return this.#internalConstructor(...arguments)
165
+ }
166
+ }
@@ -0,0 +1,37 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ export class SelectionKind {
7
+
8
+ /** @internal */
9
+ static fromValue(value: SelectionKind | string): SelectionKind;
10
+
11
+ get value(): string;
12
+
13
+ /** @internal */
14
+ get ffiValue(): number;
15
+
16
+ /**
17
+ * No document.
18
+ */
19
+ static None : SelectionKind;
20
+ static Caret : SelectionKind;
21
+ static Text : SelectionKind;
22
+ /**
23
+ * A block of table cells.
24
+ */
25
+ static Cells : SelectionKind;
26
+ /**
27
+ * A picture or text box.
28
+ */
29
+ static Object : SelectionKind;
30
+ /**
31
+ * A vertical block of text.
32
+ */
33
+ static Block : SelectionKind;
34
+
35
+
36
+ constructor(value: SelectionKind | string );
37
+ }
@@ -0,0 +1,93 @@
1
+ // generated by diplomat-tool
2
+ import wasm from "./diplomat-wasm.mjs";
3
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
4
+
5
+
6
+
7
+ export class SelectionKind {
8
+ #value = undefined;
9
+
10
+ static #values = new Map([
11
+ ["None", 0],
12
+ ["Caret", 1],
13
+ ["Text", 2],
14
+ ["Cells", 3],
15
+ ["Object", 4],
16
+ ["Block", 5]
17
+ ]);
18
+
19
+ static getAllEntries() {
20
+ return SelectionKind.#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 SelectionKind.#objectValues[arguments[1]];
32
+ }
33
+
34
+ if (value instanceof SelectionKind) {
35
+ return value;
36
+ }
37
+
38
+ let intVal = SelectionKind.#values.get(value);
39
+
40
+ // Nullish check, checks for null or undefined
41
+ if (intVal != null) {
42
+ return SelectionKind.#objectValues[intVal];
43
+ }
44
+
45
+ throw TypeError(value + " is not a SelectionKind and does not correspond to any of its enumerator values.");
46
+ }
47
+
48
+ /** @internal */
49
+ static fromValue(value) {
50
+ return new SelectionKind(value);
51
+ }
52
+
53
+ get value(){
54
+ return [...SelectionKind.#values.keys()][this.#value];
55
+ }
56
+
57
+ /** @internal */
58
+ get ffiValue(){
59
+ return this.#value;
60
+ }
61
+ static #objectValues = [
62
+ new SelectionKind(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
63
+ new SelectionKind(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
64
+ new SelectionKind(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
65
+ new SelectionKind(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 3),
66
+ new SelectionKind(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 4),
67
+ new SelectionKind(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 5),
68
+ ];
69
+
70
+ /**
71
+ * No document.
72
+ */
73
+ static None = SelectionKind.#objectValues[0];
74
+ static Caret = SelectionKind.#objectValues[1];
75
+ static Text = SelectionKind.#objectValues[2];
76
+ /**
77
+ * A block of table cells.
78
+ */
79
+ static Cells = SelectionKind.#objectValues[3];
80
+ /**
81
+ * A picture or text box.
82
+ */
83
+ static Object = SelectionKind.#objectValues[4];
84
+ /**
85
+ * A vertical block of text.
86
+ */
87
+ static Block = SelectionKind.#objectValues[5];
88
+
89
+
90
+ constructor(value) {
91
+ return this.#internalConstructor(...arguments)
92
+ }
93
+ }