@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
package/dist/Rect.d.ts ADDED
@@ -0,0 +1,34 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+ export type Rect_obj = {
5
+ x: number;
6
+ y: number;
7
+ width: number;
8
+ height: number;
9
+ };
10
+
11
+
12
+
13
+ /**
14
+ * A rectangle in points (page coordinates) or pixels (content coordinates), as the method says.
15
+ */
16
+ export class Rect {
17
+ get x(): number;
18
+ set x(value: number);
19
+ get y(): number;
20
+ set y(value: number);
21
+ get width(): number;
22
+ set width(value: number);
23
+ get height(): number;
24
+ set height(value: number);
25
+ /** @internal */
26
+ static fromFields(structObj : Rect_obj) : Rect;
27
+
28
+ /**
29
+ * Create `Rect` from an object that contains all of `Rect`s fields.
30
+ * Optional fields do not need to be included in the provided object.
31
+ */
32
+ constructor(structObj: Rect_obj);
33
+
34
+ }
package/dist/Rect.mjs ADDED
@@ -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
+ * A rectangle in points (page coordinates) or pixels (content coordinates), as the method says.
9
+ */
10
+ export class Rect {
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
+ #width;
26
+ get width() {
27
+ return this.#width;
28
+ }
29
+ set width(value){
30
+ this.#width = value;
31
+ }
32
+ #height;
33
+ get height() {
34
+ return this.#height;
35
+ }
36
+ set height(value){
37
+ this.#height = value;
38
+ }
39
+ /** @internal */
40
+ static fromFields(structObj) {
41
+ return new Rect(structObj);
42
+ }
43
+
44
+ #internalConstructor(structObj) {
45
+ if (typeof structObj !== "object") {
46
+ throw new Error("Rect's constructor takes an object of Rect'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 ("width" in structObj) {
62
+ this.#width = structObj.width;
63
+ } else {
64
+ throw new Error("Missing required field width.");
65
+ }
66
+
67
+ if ("height" in structObj) {
68
+ this.#height = structObj.height;
69
+ } else {
70
+ throw new Error("Missing required field height.");
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 Rect) {
104
+ return obj;
105
+ }
106
+
107
+ return Rect.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.#width, Float64Array);
119
+ diplomatRuntime.writeToArrayBuffer(arrayBuffer, offset + 24, this.#height, Float64Array);
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("Rect._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 widthDeref = (new Float64Array(wasm.memory.buffer, ptr + 16, 1))[0];
137
+ structObj.width = widthDeref;
138
+ const heightDeref = (new Float64Array(wasm.memory.buffer, ptr + 24, 1))[0];
139
+ structObj.height = heightDeref;
140
+
141
+ return new Rect(structObj);
142
+ }
143
+
144
+
145
+ constructor(structObj) {
146
+ return this.#internalConstructor(...arguments)
147
+ }
148
+ }
@@ -0,0 +1,55 @@
1
+ // generated by diplomat-tool
2
+ import type { Rect } from "./Rect"
3
+ import type { RequestKind } from "./RequestKind"
4
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
5
+
6
+
7
+
8
+ export class Request {
9
+ /** @internal */
10
+ get ffiValue(): pointer;
11
+ /** @internal */
12
+ constructor();
13
+
14
+
15
+ get kind(): RequestKind;
16
+
17
+ /**
18
+ * ScrollIntoView: the page (from 0).
19
+ */
20
+ get page(): number;
21
+
22
+ /**
23
+ * ScrollIntoView: the rectangle on the page, points.
24
+ */
25
+ get rect(): Rect;
26
+
27
+ get velocityX(): number;
28
+
29
+ get velocityY(): number;
30
+
31
+ /**
32
+ * Cursor: the CSS cursor name.
33
+ */
34
+ cursor(): string;
35
+
36
+ /**
37
+ * Clipboard: the plain text.
38
+ */
39
+ text(): string;
40
+
41
+ /**
42
+ * Clipboard: the HTML (empty if none).
43
+ */
44
+ html(): string;
45
+
46
+ /**
47
+ * Placeholder: its key (what to fill it with).
48
+ */
49
+ placeholderKey(): string;
50
+
51
+ /**
52
+ * Placeholder: its label.
53
+ */
54
+ placeholderLabel(): string;
55
+ }
@@ -0,0 +1,207 @@
1
+ // generated by diplomat-tool
2
+ import { Rect } from "./Rect.mjs"
3
+ import { RequestKind } from "./RequestKind.mjs"
4
+ import wasm from "./diplomat-wasm.mjs";
5
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
6
+
7
+ const Request_box_destroy_registry = new FinalizationRegistry((ptr) => {
8
+ wasm.Request_destroy(ptr);
9
+ });
10
+
11
+ export class Request {
12
+ // Internal ptr reference:
13
+ #ptr = null;
14
+
15
+ // Lifetimes are only to keep dependencies alive.
16
+ // Since JS won't garbage collect until there are no incoming edges.
17
+ #selfEdge = [];
18
+
19
+ #internalConstructor(symbol, ptr, selfEdge) {
20
+ if (symbol !== diplomatRuntime.internalConstructor) {
21
+ console.error("Request is an Opaque type. You cannot call its constructor.");
22
+ return;
23
+ }
24
+ this.#ptr = ptr;
25
+ this.#selfEdge = selfEdge;
26
+
27
+ // Are we being borrowed? If not, we can register.
28
+ if (this.#selfEdge.length === 0) {
29
+ Request_box_destroy_registry.register(this, this.#ptr);
30
+ }
31
+
32
+ return this;
33
+ }
34
+ /** @internal */
35
+ get ffiValue() {
36
+ return this.#ptr;
37
+ }
38
+
39
+
40
+ get kind() {
41
+
42
+ const result = wasm.Request_kind(this.ffiValue);
43
+
44
+ try {
45
+ return new RequestKind(diplomatRuntime.internalConstructor, result);
46
+ }
47
+
48
+ finally {
49
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
50
+ }
51
+ }
52
+
53
+ /**
54
+ * ScrollIntoView: the page (from 0).
55
+ */
56
+ get page() {
57
+
58
+ const result = wasm.Request_page(this.ffiValue);
59
+
60
+ try {
61
+ return result;
62
+ }
63
+
64
+ finally {
65
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
66
+ }
67
+ }
68
+
69
+ /**
70
+ * ScrollIntoView: the rectangle on the page, points.
71
+ */
72
+ get rect() {
73
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 32, 8, false);
74
+
75
+
76
+ const result = wasm.Request_rect(diplomatReceive.buffer, this.ffiValue);
77
+
78
+ try {
79
+ return Rect._fromFFI(diplomatRuntime.internalConstructor, diplomatReceive.buffer);
80
+ }
81
+
82
+ finally {
83
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
84
+ diplomatReceive.free();
85
+ }
86
+ }
87
+
88
+ get velocityX() {
89
+
90
+ const result = wasm.Request_velocity_x(this.ffiValue);
91
+
92
+ try {
93
+ return result;
94
+ }
95
+
96
+ finally {
97
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
98
+ }
99
+ }
100
+
101
+ get velocityY() {
102
+
103
+ const result = wasm.Request_velocity_y(this.ffiValue);
104
+
105
+ try {
106
+ return result;
107
+ }
108
+
109
+ finally {
110
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
111
+ }
112
+ }
113
+
114
+ /**
115
+ * Cursor: the CSS cursor name.
116
+ */
117
+ cursor() {
118
+ const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
119
+
120
+ wasm.Request_cursor(this.ffiValue, write.buffer);
121
+
122
+ try {
123
+ return write.readString8();
124
+ }
125
+
126
+ finally {
127
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
128
+ write.free();
129
+ }
130
+ }
131
+
132
+ /**
133
+ * Clipboard: the plain text.
134
+ */
135
+ text() {
136
+ const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
137
+
138
+ wasm.Request_text(this.ffiValue, write.buffer);
139
+
140
+ try {
141
+ return write.readString8();
142
+ }
143
+
144
+ finally {
145
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
146
+ write.free();
147
+ }
148
+ }
149
+
150
+ /**
151
+ * Clipboard: the HTML (empty if none).
152
+ */
153
+ html() {
154
+ const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
155
+
156
+ wasm.Request_html(this.ffiValue, write.buffer);
157
+
158
+ try {
159
+ return write.readString8();
160
+ }
161
+
162
+ finally {
163
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
164
+ write.free();
165
+ }
166
+ }
167
+
168
+ /**
169
+ * Placeholder: its key (what to fill it with).
170
+ */
171
+ placeholderKey() {
172
+ const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
173
+
174
+ wasm.Request_placeholder_key(this.ffiValue, write.buffer);
175
+
176
+ try {
177
+ return write.readString8();
178
+ }
179
+
180
+ finally {
181
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
182
+ write.free();
183
+ }
184
+ }
185
+
186
+ /**
187
+ * Placeholder: its label.
188
+ */
189
+ placeholderLabel() {
190
+ const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
191
+
192
+ wasm.Request_placeholder_label(this.ffiValue, write.buffer);
193
+
194
+ try {
195
+ return write.readString8();
196
+ }
197
+
198
+ finally {
199
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
200
+ write.free();
201
+ }
202
+ }
203
+
204
+ constructor(symbol, ptr, selfEdge) {
205
+ return this.#internalConstructor(...arguments)
206
+ }
207
+ }
@@ -0,0 +1,45 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * What the editor asks of the host after an input.
8
+ */
9
+ export class RequestKind {
10
+
11
+ /** @internal */
12
+ static fromValue(value: RequestKind | string): RequestKind;
13
+
14
+ get value(): string;
15
+
16
+ /** @internal */
17
+ get ffiValue(): number;
18
+
19
+ /**
20
+ * Scroll so that `rect` on `page` is visible.
21
+ */
22
+ static ScrollIntoView : RequestKind;
23
+ /**
24
+ * Keep scrolling at `velocity_x` / `velocity_y` pixels per second while the pointer is held outside the view.
25
+ */
26
+ static Autoscroll : RequestKind;
27
+ static CapturePointer : RequestKind;
28
+ static ReleasePointer : RequestKind;
29
+ /**
30
+ * Show the `cursor` (a CSS cursor name: `text`, `default`, `move`, `col-resize`, ...).
31
+ */
32
+ static Cursor : RequestKind;
33
+ /**
34
+ * Put `text` and `html` on the system clipboard (a copy or cut from the keyboard).
35
+ */
36
+ static Clipboard : RequestKind;
37
+ /**
38
+ * An unfilled placeholder was activated: supply its content (`fill_placeholder`).
39
+ */
40
+ static Placeholder : RequestKind;
41
+ static Unknown : RequestKind;
42
+
43
+
44
+ constructor(value: RequestKind | string );
45
+ }
@@ -0,0 +1,105 @@
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
+ * What the editor asks of the host after an input.
9
+ */
10
+ export class RequestKind {
11
+ #value = undefined;
12
+
13
+ static #values = new Map([
14
+ ["ScrollIntoView", 0],
15
+ ["Autoscroll", 1],
16
+ ["CapturePointer", 2],
17
+ ["ReleasePointer", 3],
18
+ ["Cursor", 4],
19
+ ["Clipboard", 5],
20
+ ["Placeholder", 6],
21
+ ["Unknown", 7]
22
+ ]);
23
+
24
+ static getAllEntries() {
25
+ return RequestKind.#values.entries();
26
+ }
27
+
28
+ #internalConstructor(value) {
29
+ if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) {
30
+ // We pass in two internalConstructor arguments to create *new*
31
+ // instances of this type, otherwise the enums are treated as singletons.
32
+ if (arguments[1] === diplomatRuntime.internalConstructor ) {
33
+ this.#value = arguments[2];
34
+ return this;
35
+ }
36
+ return RequestKind.#objectValues[arguments[1]];
37
+ }
38
+
39
+ if (value instanceof RequestKind) {
40
+ return value;
41
+ }
42
+
43
+ let intVal = RequestKind.#values.get(value);
44
+
45
+ // Nullish check, checks for null or undefined
46
+ if (intVal != null) {
47
+ return RequestKind.#objectValues[intVal];
48
+ }
49
+
50
+ throw TypeError(value + " is not a RequestKind and does not correspond to any of its enumerator values.");
51
+ }
52
+
53
+ /** @internal */
54
+ static fromValue(value) {
55
+ return new RequestKind(value);
56
+ }
57
+
58
+ get value(){
59
+ return [...RequestKind.#values.keys()][this.#value];
60
+ }
61
+
62
+ /** @internal */
63
+ get ffiValue(){
64
+ return this.#value;
65
+ }
66
+ static #objectValues = [
67
+ new RequestKind(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
68
+ new RequestKind(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
69
+ new RequestKind(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
70
+ new RequestKind(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 3),
71
+ new RequestKind(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 4),
72
+ new RequestKind(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 5),
73
+ new RequestKind(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 6),
74
+ new RequestKind(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 7),
75
+ ];
76
+
77
+ /**
78
+ * Scroll so that `rect` on `page` is visible.
79
+ */
80
+ static ScrollIntoView = RequestKind.#objectValues[0];
81
+ /**
82
+ * Keep scrolling at `velocity_x` / `velocity_y` pixels per second while the pointer is held outside the view.
83
+ */
84
+ static Autoscroll = RequestKind.#objectValues[1];
85
+ static CapturePointer = RequestKind.#objectValues[2];
86
+ static ReleasePointer = RequestKind.#objectValues[3];
87
+ /**
88
+ * Show the `cursor` (a CSS cursor name: `text`, `default`, `move`, `col-resize`, ...).
89
+ */
90
+ static Cursor = RequestKind.#objectValues[4];
91
+ /**
92
+ * Put `text` and `html` on the system clipboard (a copy or cut from the keyboard).
93
+ */
94
+ static Clipboard = RequestKind.#objectValues[5];
95
+ /**
96
+ * An unfilled placeholder was activated: supply its content (`fill_placeholder`).
97
+ */
98
+ static Placeholder = RequestKind.#objectValues[6];
99
+ static Unknown = RequestKind.#objectValues[7];
100
+
101
+
102
+ constructor(value) {
103
+ return this.#internalConstructor(...arguments)
104
+ }
105
+ }
@@ -0,0 +1,20 @@
1
+ // generated by diplomat-tool
2
+ import type { Request } from "./Request"
3
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
4
+
5
+
6
+
7
+ /**
8
+ * Requests since the host last took them, in order.
9
+ */
10
+ export class RequestList {
11
+ /** @internal */
12
+ get ffiValue(): pointer;
13
+ /** @internal */
14
+ constructor();
15
+
16
+
17
+ get len(): number;
18
+
19
+ get(index: number): Request | null;
20
+ }
@@ -0,0 +1,71 @@
1
+ // generated by diplomat-tool
2
+ import { Request } from "./Request.mjs"
3
+ import wasm from "./diplomat-wasm.mjs";
4
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
5
+
6
+ const RequestList_box_destroy_registry = new FinalizationRegistry((ptr) => {
7
+ wasm.RequestList_destroy(ptr);
8
+ });
9
+
10
+ /**
11
+ * Requests since the host last took them, in order.
12
+ */
13
+ export class RequestList {
14
+ // Internal ptr reference:
15
+ #ptr = null;
16
+
17
+ // Lifetimes are only to keep dependencies alive.
18
+ // Since JS won't garbage collect until there are no incoming edges.
19
+ #selfEdge = [];
20
+
21
+ #internalConstructor(symbol, ptr, selfEdge) {
22
+ if (symbol !== diplomatRuntime.internalConstructor) {
23
+ console.error("RequestList is an Opaque type. You cannot call its constructor.");
24
+ return;
25
+ }
26
+ this.#ptr = ptr;
27
+ this.#selfEdge = selfEdge;
28
+
29
+ // Are we being borrowed? If not, we can register.
30
+ if (this.#selfEdge.length === 0) {
31
+ RequestList_box_destroy_registry.register(this, this.#ptr);
32
+ }
33
+
34
+ return this;
35
+ }
36
+ /** @internal */
37
+ get ffiValue() {
38
+ return this.#ptr;
39
+ }
40
+
41
+
42
+ get len() {
43
+
44
+ const result = wasm.RequestList_len(this.ffiValue);
45
+
46
+ try {
47
+ return result;
48
+ }
49
+
50
+ finally {
51
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
52
+ }
53
+ }
54
+
55
+ get(index) {
56
+
57
+ const result = wasm.RequestList_get(this.ffiValue, index);
58
+
59
+ try {
60
+ return result === 0 ? null : new Request(diplomatRuntime.internalConstructor, result, []);
61
+ }
62
+
63
+ finally {
64
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
65
+ }
66
+ }
67
+
68
+ constructor(symbol, ptr, selfEdge) {
69
+ return this.#internalConstructor(...arguments)
70
+ }
71
+ }