@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,117 @@
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
+ * A text highlight colour.
9
+ */
10
+ export class Highlight {
11
+ #value = undefined;
12
+
13
+ static #values = new Map([
14
+ ["Yellow", 0],
15
+ ["Green", 1],
16
+ ["Cyan", 2],
17
+ ["Magenta", 3],
18
+ ["Blue", 4],
19
+ ["Red", 5],
20
+ ["DarkBlue", 6],
21
+ ["DarkCyan", 7],
22
+ ["DarkGreen", 8],
23
+ ["DarkMagenta", 9],
24
+ ["DarkRed", 10],
25
+ ["DarkYellow", 11],
26
+ ["DarkGray", 12],
27
+ ["LightGray", 13],
28
+ ["Black", 14],
29
+ ["None", 15]
30
+ ]);
31
+
32
+ static getAllEntries() {
33
+ return Highlight.#values.entries();
34
+ }
35
+
36
+ #internalConstructor(value) {
37
+ if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) {
38
+ // We pass in two internalConstructor arguments to create *new*
39
+ // instances of this type, otherwise the enums are treated as singletons.
40
+ if (arguments[1] === diplomatRuntime.internalConstructor ) {
41
+ this.#value = arguments[2];
42
+ return this;
43
+ }
44
+ return Highlight.#objectValues[arguments[1]];
45
+ }
46
+
47
+ if (value instanceof Highlight) {
48
+ return value;
49
+ }
50
+
51
+ let intVal = Highlight.#values.get(value);
52
+
53
+ // Nullish check, checks for null or undefined
54
+ if (intVal != null) {
55
+ return Highlight.#objectValues[intVal];
56
+ }
57
+
58
+ throw TypeError(value + " is not a Highlight and does not correspond to any of its enumerator values.");
59
+ }
60
+
61
+ /** @internal */
62
+ static fromValue(value) {
63
+ return new Highlight(value);
64
+ }
65
+
66
+ get value(){
67
+ return [...Highlight.#values.keys()][this.#value];
68
+ }
69
+
70
+ /** @internal */
71
+ get ffiValue(){
72
+ return this.#value;
73
+ }
74
+ static #objectValues = [
75
+ new Highlight(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
76
+ new Highlight(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
77
+ new Highlight(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
78
+ new Highlight(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 3),
79
+ new Highlight(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 4),
80
+ new Highlight(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 5),
81
+ new Highlight(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 6),
82
+ new Highlight(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 7),
83
+ new Highlight(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 8),
84
+ new Highlight(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 9),
85
+ new Highlight(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 10),
86
+ new Highlight(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 11),
87
+ new Highlight(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 12),
88
+ new Highlight(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 13),
89
+ new Highlight(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 14),
90
+ new Highlight(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 15),
91
+ ];
92
+
93
+ static Yellow = Highlight.#objectValues[0];
94
+ static Green = Highlight.#objectValues[1];
95
+ static Cyan = Highlight.#objectValues[2];
96
+ static Magenta = Highlight.#objectValues[3];
97
+ static Blue = Highlight.#objectValues[4];
98
+ static Red = Highlight.#objectValues[5];
99
+ static DarkBlue = Highlight.#objectValues[6];
100
+ static DarkCyan = Highlight.#objectValues[7];
101
+ static DarkGreen = Highlight.#objectValues[8];
102
+ static DarkMagenta = Highlight.#objectValues[9];
103
+ static DarkRed = Highlight.#objectValues[10];
104
+ static DarkYellow = Highlight.#objectValues[11];
105
+ static DarkGray = Highlight.#objectValues[12];
106
+ static LightGray = Highlight.#objectValues[13];
107
+ static Black = Highlight.#objectValues[14];
108
+ /**
109
+ * No highlight.
110
+ */
111
+ static None = Highlight.#objectValues[15];
112
+
113
+
114
+ constructor(value) {
115
+ return this.#internalConstructor(...arguments)
116
+ }
117
+ }
@@ -0,0 +1,38 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * Page margin presets.
8
+ */
9
+ export class MarginPreset {
10
+
11
+ /** @internal */
12
+ static fromValue(value: MarginPreset | string): MarginPreset;
13
+
14
+ get value(): string;
15
+
16
+ /** @internal */
17
+ get ffiValue(): number;
18
+
19
+ /**
20
+ * 1 in on every side.
21
+ */
22
+ static Normal : MarginPreset;
23
+ /**
24
+ * 0.5 in on every side.
25
+ */
26
+ static Narrow : MarginPreset;
27
+ /**
28
+ * 1 in top and bottom, 0.75 in left and right.
29
+ */
30
+ static Moderate : MarginPreset;
31
+ /**
32
+ * 1 in top and bottom, 2 in left and right.
33
+ */
34
+ static Wide : MarginPreset;
35
+
36
+
37
+ constructor(value: MarginPreset | string );
38
+ }
@@ -0,0 +1,90 @@
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
+ * Page margin presets.
9
+ */
10
+ export class MarginPreset {
11
+ #value = undefined;
12
+
13
+ static #values = new Map([
14
+ ["Normal", 0],
15
+ ["Narrow", 1],
16
+ ["Moderate", 2],
17
+ ["Wide", 3]
18
+ ]);
19
+
20
+ static getAllEntries() {
21
+ return MarginPreset.#values.entries();
22
+ }
23
+
24
+ #internalConstructor(value) {
25
+ if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) {
26
+ // We pass in two internalConstructor arguments to create *new*
27
+ // instances of this type, otherwise the enums are treated as singletons.
28
+ if (arguments[1] === diplomatRuntime.internalConstructor ) {
29
+ this.#value = arguments[2];
30
+ return this;
31
+ }
32
+ return MarginPreset.#objectValues[arguments[1]];
33
+ }
34
+
35
+ if (value instanceof MarginPreset) {
36
+ return value;
37
+ }
38
+
39
+ let intVal = MarginPreset.#values.get(value);
40
+
41
+ // Nullish check, checks for null or undefined
42
+ if (intVal != null) {
43
+ return MarginPreset.#objectValues[intVal];
44
+ }
45
+
46
+ throw TypeError(value + " is not a MarginPreset and does not correspond to any of its enumerator values.");
47
+ }
48
+
49
+ /** @internal */
50
+ static fromValue(value) {
51
+ return new MarginPreset(value);
52
+ }
53
+
54
+ get value(){
55
+ return [...MarginPreset.#values.keys()][this.#value];
56
+ }
57
+
58
+ /** @internal */
59
+ get ffiValue(){
60
+ return this.#value;
61
+ }
62
+ static #objectValues = [
63
+ new MarginPreset(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
64
+ new MarginPreset(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
65
+ new MarginPreset(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
66
+ new MarginPreset(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 3),
67
+ ];
68
+
69
+ /**
70
+ * 1 in on every side.
71
+ */
72
+ static Normal = MarginPreset.#objectValues[0];
73
+ /**
74
+ * 0.5 in on every side.
75
+ */
76
+ static Narrow = MarginPreset.#objectValues[1];
77
+ /**
78
+ * 1 in top and bottom, 0.75 in left and right.
79
+ */
80
+ static Moderate = MarginPreset.#objectValues[2];
81
+ /**
82
+ * 1 in top and bottom, 2 in left and right.
83
+ */
84
+ static Wide = MarginPreset.#objectValues[3];
85
+
86
+
87
+ constructor(value) {
88
+ return this.#internalConstructor(...arguments)
89
+ }
90
+ }
@@ -0,0 +1,25 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * How serious a mark on an element is.
8
+ */
9
+ export class MarkSeverity {
10
+
11
+ /** @internal */
12
+ static fromValue(value: MarkSeverity | string): MarkSeverity;
13
+
14
+ get value(): string;
15
+
16
+ /** @internal */
17
+ get ffiValue(): number;
18
+
19
+ static Error : MarkSeverity;
20
+ static Warning : MarkSeverity;
21
+ static Info : MarkSeverity;
22
+
23
+
24
+ constructor(value: MarkSeverity | 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
+ * How serious a mark on an element is.
9
+ */
10
+ export class MarkSeverity {
11
+ #value = undefined;
12
+
13
+ static #values = new Map([
14
+ ["Error", 0],
15
+ ["Warning", 1],
16
+ ["Info", 2]
17
+ ]);
18
+
19
+ static getAllEntries() {
20
+ return MarkSeverity.#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 MarkSeverity.#objectValues[arguments[1]];
32
+ }
33
+
34
+ if (value instanceof MarkSeverity) {
35
+ return value;
36
+ }
37
+
38
+ let intVal = MarkSeverity.#values.get(value);
39
+
40
+ // Nullish check, checks for null or undefined
41
+ if (intVal != null) {
42
+ return MarkSeverity.#objectValues[intVal];
43
+ }
44
+
45
+ throw TypeError(value + " is not a MarkSeverity and does not correspond to any of its enumerator values.");
46
+ }
47
+
48
+ /** @internal */
49
+ static fromValue(value) {
50
+ return new MarkSeverity(value);
51
+ }
52
+
53
+ get value(){
54
+ return [...MarkSeverity.#values.keys()][this.#value];
55
+ }
56
+
57
+ /** @internal */
58
+ get ffiValue(){
59
+ return this.#value;
60
+ }
61
+ static #objectValues = [
62
+ new MarkSeverity(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
63
+ new MarkSeverity(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
64
+ new MarkSeverity(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
65
+ ];
66
+
67
+ static Error = MarkSeverity.#objectValues[0];
68
+ static Warning = MarkSeverity.#objectValues[1];
69
+ static Info = MarkSeverity.#objectValues[2];
70
+
71
+
72
+ constructor(value) {
73
+ return this.#internalConstructor(...arguments)
74
+ }
75
+ }
@@ -0,0 +1,34 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+ export type Modifiers_obj = {
5
+ ctrl: boolean;
6
+ shift: boolean;
7
+ alt: boolean;
8
+ meta: boolean;
9
+ };
10
+
11
+
12
+
13
+ /**
14
+ * Modifier keys held during a key press or pointer event.
15
+ */
16
+ export class Modifiers {
17
+ get ctrl(): boolean;
18
+ set ctrl(value: boolean);
19
+ get shift(): boolean;
20
+ set shift(value: boolean);
21
+ get alt(): boolean;
22
+ set alt(value: boolean);
23
+ get meta(): boolean;
24
+ set meta(value: boolean);
25
+ /** @internal */
26
+ static fromFields(structObj : Modifiers_obj) : Modifiers;
27
+
28
+ /**
29
+ * Create `Modifiers` from an object that contains all of `Modifiers`s fields.
30
+ * Optional fields do not need to be included in the provided object.
31
+ */
32
+ constructor(structObj: Modifiers_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
+ * Modifier keys held during a key press or pointer event.
9
+ */
10
+ export class Modifiers {
11
+ #ctrl;
12
+ get ctrl() {
13
+ return this.#ctrl;
14
+ }
15
+ set ctrl(value){
16
+ this.#ctrl = value;
17
+ }
18
+ #shift;
19
+ get shift() {
20
+ return this.#shift;
21
+ }
22
+ set shift(value){
23
+ this.#shift = value;
24
+ }
25
+ #alt;
26
+ get alt() {
27
+ return this.#alt;
28
+ }
29
+ set alt(value){
30
+ this.#alt = value;
31
+ }
32
+ #meta;
33
+ get meta() {
34
+ return this.#meta;
35
+ }
36
+ set meta(value){
37
+ this.#meta = value;
38
+ }
39
+ /** @internal */
40
+ static fromFields(structObj) {
41
+ return new Modifiers(structObj);
42
+ }
43
+
44
+ #internalConstructor(structObj) {
45
+ if (typeof structObj !== "object") {
46
+ throw new Error("Modifiers's constructor takes an object of Modifiers's fields.");
47
+ }
48
+
49
+ if ("ctrl" in structObj) {
50
+ this.#ctrl = structObj.ctrl;
51
+ } else {
52
+ throw new Error("Missing required field ctrl.");
53
+ }
54
+
55
+ if ("shift" in structObj) {
56
+ this.#shift = structObj.shift;
57
+ } else {
58
+ throw new Error("Missing required field shift.");
59
+ }
60
+
61
+ if ("alt" in structObj) {
62
+ this.#alt = structObj.alt;
63
+ } else {
64
+ throw new Error("Missing required field alt.");
65
+ }
66
+
67
+ if ("meta" in structObj) {
68
+ this.#meta = structObj.meta;
69
+ } else {
70
+ throw new Error("Missing required field meta.");
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 4;
91
+ }
92
+
93
+ /// Currently unused, we may want to use later on though:
94
+ static get _sizeAlign() {
95
+ return 1;
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 Modifiers) {
104
+ return obj;
105
+ }
106
+
107
+ return Modifiers.fromFields(obj);
108
+ }
109
+
110
+ _writeToArrayBuffer(
111
+ arrayBuffer,
112
+ offset,
113
+ functionCleanupArena,
114
+ appendArrayMap
115
+ ) {
116
+ diplomatRuntime.writeToArrayBuffer(arrayBuffer, offset + 0, this.#ctrl, Uint8Array);
117
+ diplomatRuntime.writeToArrayBuffer(arrayBuffer, offset + 1, this.#shift, Uint8Array);
118
+ diplomatRuntime.writeToArrayBuffer(arrayBuffer, offset + 2, this.#alt, Uint8Array);
119
+ diplomatRuntime.writeToArrayBuffer(arrayBuffer, offset + 3, this.#meta, 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("Modifiers._fromFFI is not meant to be called externally. Please use the default constructor.");
130
+ }
131
+ let structObj = {};
132
+ const ctrlDeref = (new Uint8Array(wasm.memory.buffer, ptr, 1))[0] === 1;
133
+ structObj.ctrl = ctrlDeref;
134
+ const shiftDeref = (new Uint8Array(wasm.memory.buffer, ptr + 1, 1))[0] === 1;
135
+ structObj.shift = shiftDeref;
136
+ const altDeref = (new Uint8Array(wasm.memory.buffer, ptr + 2, 1))[0] === 1;
137
+ structObj.alt = altDeref;
138
+ const metaDeref = (new Uint8Array(wasm.memory.buffer, ptr + 3, 1))[0] === 1;
139
+ structObj.meta = metaDeref;
140
+
141
+ return new Modifiers(structObj);
142
+ }
143
+
144
+
145
+ constructor(structObj) {
146
+ return this.#internalConstructor(...arguments)
147
+ }
148
+ }
@@ -0,0 +1,30 @@
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 open.
8
+ */
9
+ export class OpenError {
10
+
11
+ /** @internal */
12
+ static fromValue(value: OpenError | string): OpenError;
13
+
14
+ get value(): string;
15
+
16
+ /** @internal */
17
+ get ffiValue(): number;
18
+
19
+ /**
20
+ * No bytes.
21
+ */
22
+ static Empty : OpenError;
23
+ /**
24
+ * Not a .docx package Twip can read.
25
+ */
26
+ static Invalid : OpenError;
27
+
28
+
29
+ constructor(value: OpenError | string );
30
+ }
@@ -0,0 +1,78 @@
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 open.
9
+ */
10
+ export class OpenError {
11
+ #value = undefined;
12
+
13
+ static #values = new Map([
14
+ ["Empty", 0],
15
+ ["Invalid", 1]
16
+ ]);
17
+
18
+ static getAllEntries() {
19
+ return OpenError.#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 OpenError.#objectValues[arguments[1]];
31
+ }
32
+
33
+ if (value instanceof OpenError) {
34
+ return value;
35
+ }
36
+
37
+ let intVal = OpenError.#values.get(value);
38
+
39
+ // Nullish check, checks for null or undefined
40
+ if (intVal != null) {
41
+ return OpenError.#objectValues[intVal];
42
+ }
43
+
44
+ throw TypeError(value + " is not a OpenError and does not correspond to any of its enumerator values.");
45
+ }
46
+
47
+ /** @internal */
48
+ static fromValue(value) {
49
+ return new OpenError(value);
50
+ }
51
+
52
+ get value(){
53
+ return [...OpenError.#values.keys()][this.#value];
54
+ }
55
+
56
+ /** @internal */
57
+ get ffiValue(){
58
+ return this.#value;
59
+ }
60
+ static #objectValues = [
61
+ new OpenError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
62
+ new OpenError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
63
+ ];
64
+
65
+ /**
66
+ * No bytes.
67
+ */
68
+ static Empty = OpenError.#objectValues[0];
69
+ /**
70
+ * Not a .docx package Twip can read.
71
+ */
72
+ static Invalid = OpenError.#objectValues[1];
73
+
74
+
75
+ constructor(value) {
76
+ return this.#internalConstructor(...arguments)
77
+ }
78
+ }
@@ -0,0 +1,30 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * Page orientation.
8
+ */
9
+ export class Orientation {
10
+
11
+ /** @internal */
12
+ static fromValue(value: Orientation | string): Orientation;
13
+
14
+ get value(): string;
15
+
16
+ /** @internal */
17
+ get ffiValue(): number;
18
+
19
+ /**
20
+ * Taller than wide.
21
+ */
22
+ static Portrait : Orientation;
23
+ /**
24
+ * Wider than tall.
25
+ */
26
+ static Landscape : Orientation;
27
+
28
+
29
+ constructor(value: Orientation | string );
30
+ }