@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,25 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * Horizontal alignment of a table on the page.
8
+ */
9
+ export class TableAlignment {
10
+
11
+ /** @internal */
12
+ static fromValue(value: TableAlignment | string): TableAlignment;
13
+
14
+ get value(): string;
15
+
16
+ /** @internal */
17
+ get ffiValue(): number;
18
+
19
+ static Left : TableAlignment;
20
+ static Center : TableAlignment;
21
+ static Right : TableAlignment;
22
+
23
+
24
+ constructor(value: TableAlignment | 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
+ * Horizontal alignment of a table on the page.
9
+ */
10
+ export class TableAlignment {
11
+ #value = undefined;
12
+
13
+ static #values = new Map([
14
+ ["Left", 0],
15
+ ["Center", 1],
16
+ ["Right", 2]
17
+ ]);
18
+
19
+ static getAllEntries() {
20
+ return TableAlignment.#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 TableAlignment.#objectValues[arguments[1]];
32
+ }
33
+
34
+ if (value instanceof TableAlignment) {
35
+ return value;
36
+ }
37
+
38
+ let intVal = TableAlignment.#values.get(value);
39
+
40
+ // Nullish check, checks for null or undefined
41
+ if (intVal != null) {
42
+ return TableAlignment.#objectValues[intVal];
43
+ }
44
+
45
+ throw TypeError(value + " is not a TableAlignment and does not correspond to any of its enumerator values.");
46
+ }
47
+
48
+ /** @internal */
49
+ static fromValue(value) {
50
+ return new TableAlignment(value);
51
+ }
52
+
53
+ get value(){
54
+ return [...TableAlignment.#values.keys()][this.#value];
55
+ }
56
+
57
+ /** @internal */
58
+ get ffiValue(){
59
+ return this.#value;
60
+ }
61
+ static #objectValues = [
62
+ new TableAlignment(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
63
+ new TableAlignment(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
64
+ new TableAlignment(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
65
+ ];
66
+
67
+ static Left = TableAlignment.#objectValues[0];
68
+ static Center = TableAlignment.#objectValues[1];
69
+ static Right = TableAlignment.#objectValues[2];
70
+
71
+
72
+ constructor(value) {
73
+ return this.#internalConstructor(...arguments)
74
+ }
75
+ }
@@ -0,0 +1,38 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * What part of the table to select.
8
+ */
9
+ export class TableSelection {
10
+
11
+ /** @internal */
12
+ static fromValue(value: TableSelection | string): TableSelection;
13
+
14
+ get value(): string;
15
+
16
+ /** @internal */
17
+ get ffiValue(): number;
18
+
19
+ /**
20
+ * The cells under the selection.
21
+ */
22
+ static Cell : TableSelection;
23
+ /**
24
+ * The selected rows.
25
+ */
26
+ static Row : TableSelection;
27
+ /**
28
+ * The selected columns.
29
+ */
30
+ static Column : TableSelection;
31
+ /**
32
+ * The whole table.
33
+ */
34
+ static Table : TableSelection;
35
+
36
+
37
+ constructor(value: TableSelection | 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
+ * What part of the table to select.
9
+ */
10
+ export class TableSelection {
11
+ #value = undefined;
12
+
13
+ static #values = new Map([
14
+ ["Cell", 0],
15
+ ["Row", 1],
16
+ ["Column", 2],
17
+ ["Table", 3]
18
+ ]);
19
+
20
+ static getAllEntries() {
21
+ return TableSelection.#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 TableSelection.#objectValues[arguments[1]];
33
+ }
34
+
35
+ if (value instanceof TableSelection) {
36
+ return value;
37
+ }
38
+
39
+ let intVal = TableSelection.#values.get(value);
40
+
41
+ // Nullish check, checks for null or undefined
42
+ if (intVal != null) {
43
+ return TableSelection.#objectValues[intVal];
44
+ }
45
+
46
+ throw TypeError(value + " is not a TableSelection and does not correspond to any of its enumerator values.");
47
+ }
48
+
49
+ /** @internal */
50
+ static fromValue(value) {
51
+ return new TableSelection(value);
52
+ }
53
+
54
+ get value(){
55
+ return [...TableSelection.#values.keys()][this.#value];
56
+ }
57
+
58
+ /** @internal */
59
+ get ffiValue(){
60
+ return this.#value;
61
+ }
62
+ static #objectValues = [
63
+ new TableSelection(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
64
+ new TableSelection(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
65
+ new TableSelection(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
66
+ new TableSelection(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 3),
67
+ ];
68
+
69
+ /**
70
+ * The cells under the selection.
71
+ */
72
+ static Cell = TableSelection.#objectValues[0];
73
+ /**
74
+ * The selected rows.
75
+ */
76
+ static Row = TableSelection.#objectValues[1];
77
+ /**
78
+ * The selected columns.
79
+ */
80
+ static Column = TableSelection.#objectValues[2];
81
+ /**
82
+ * The whole table.
83
+ */
84
+ static Table = TableSelection.#objectValues[3];
85
+
86
+
87
+ constructor(value) {
88
+ return this.#internalConstructor(...arguments)
89
+ }
90
+ }
@@ -0,0 +1,31 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * How a table width is measured.
8
+ */
9
+ export class TableWidthUnit {
10
+
11
+ /** @internal */
12
+ static fromValue(value: TableWidthUnit | string): TableWidthUnit;
13
+
14
+ get value(): string;
15
+
16
+ /** @internal */
17
+ get ffiValue(): number;
18
+
19
+ /**
20
+ * The table fits its content.
21
+ */
22
+ static Auto : TableWidthUnit;
23
+ static Points : TableWidthUnit;
24
+ /**
25
+ * A percentage of the available width.
26
+ */
27
+ static Percent : TableWidthUnit;
28
+
29
+
30
+ constructor(value: TableWidthUnit | string );
31
+ }
@@ -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
+ * How a table width is measured.
9
+ */
10
+ export class TableWidthUnit {
11
+ #value = undefined;
12
+
13
+ static #values = new Map([
14
+ ["Auto", 0],
15
+ ["Points", 1],
16
+ ["Percent", 2]
17
+ ]);
18
+
19
+ static getAllEntries() {
20
+ return TableWidthUnit.#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 TableWidthUnit.#objectValues[arguments[1]];
32
+ }
33
+
34
+ if (value instanceof TableWidthUnit) {
35
+ return value;
36
+ }
37
+
38
+ let intVal = TableWidthUnit.#values.get(value);
39
+
40
+ // Nullish check, checks for null or undefined
41
+ if (intVal != null) {
42
+ return TableWidthUnit.#objectValues[intVal];
43
+ }
44
+
45
+ throw TypeError(value + " is not a TableWidthUnit and does not correspond to any of its enumerator values.");
46
+ }
47
+
48
+ /** @internal */
49
+ static fromValue(value) {
50
+ return new TableWidthUnit(value);
51
+ }
52
+
53
+ get value(){
54
+ return [...TableWidthUnit.#values.keys()][this.#value];
55
+ }
56
+
57
+ /** @internal */
58
+ get ffiValue(){
59
+ return this.#value;
60
+ }
61
+ static #objectValues = [
62
+ new TableWidthUnit(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
63
+ new TableWidthUnit(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
64
+ new TableWidthUnit(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
65
+ ];
66
+
67
+ /**
68
+ * The table fits its content.
69
+ */
70
+ static Auto = TableWidthUnit.#objectValues[0];
71
+ static Points = TableWidthUnit.#objectValues[1];
72
+ /**
73
+ * A percentage of the available width.
74
+ */
75
+ static Percent = TableWidthUnit.#objectValues[2];
76
+
77
+
78
+ constructor(value) {
79
+ return this.#internalConstructor(...arguments)
80
+ }
81
+ }
@@ -0,0 +1,25 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * A unit of text around the caret.
8
+ */
9
+ export class TextUnit {
10
+
11
+ /** @internal */
12
+ static fromValue(value: TextUnit | string): TextUnit;
13
+
14
+ get value(): string;
15
+
16
+ /** @internal */
17
+ get ffiValue(): number;
18
+
19
+ static Word : TextUnit;
20
+ static Sentence : TextUnit;
21
+ static Paragraph : TextUnit;
22
+
23
+
24
+ constructor(value: TextUnit | 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
+ * A unit of text around the caret.
9
+ */
10
+ export class TextUnit {
11
+ #value = undefined;
12
+
13
+ static #values = new Map([
14
+ ["Word", 0],
15
+ ["Sentence", 1],
16
+ ["Paragraph", 2]
17
+ ]);
18
+
19
+ static getAllEntries() {
20
+ return TextUnit.#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 TextUnit.#objectValues[arguments[1]];
32
+ }
33
+
34
+ if (value instanceof TextUnit) {
35
+ return value;
36
+ }
37
+
38
+ let intVal = TextUnit.#values.get(value);
39
+
40
+ // Nullish check, checks for null or undefined
41
+ if (intVal != null) {
42
+ return TextUnit.#objectValues[intVal];
43
+ }
44
+
45
+ throw TypeError(value + " is not a TextUnit and does not correspond to any of its enumerator values.");
46
+ }
47
+
48
+ /** @internal */
49
+ static fromValue(value) {
50
+ return new TextUnit(value);
51
+ }
52
+
53
+ get value(){
54
+ return [...TextUnit.#values.keys()][this.#value];
55
+ }
56
+
57
+ /** @internal */
58
+ get ffiValue(){
59
+ return this.#value;
60
+ }
61
+ static #objectValues = [
62
+ new TextUnit(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
63
+ new TextUnit(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
64
+ new TextUnit(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
65
+ ];
66
+
67
+ static Word = TextUnit.#objectValues[0];
68
+ static Sentence = TextUnit.#objectValues[1];
69
+ static Paragraph = TextUnit.#objectValues[2];
70
+
71
+
72
+ constructor(value) {
73
+ return this.#internalConstructor(...arguments)
74
+ }
75
+ }
@@ -0,0 +1,15 @@
1
+ /// A [codepoint] is a Unicode code point, such as `a`, or `💡`.
2
+ ///
3
+ /// The recommended way to obtain a `codepoint` is to create it from a
4
+ /// `String`, which is conceptually a list of `codepoint`s. For example,
5
+ /// `'a'.codePointAt(0)` is equal to the `char` `a`.
6
+ ///
7
+ /// JS does not have a character/codepoint literal, so integer literals
8
+ /// need to be used. For example the Unicode code point U+1F4A1, `💡`,
9
+ /// can be represented by `0x1F4A1`. Note that only values in the ranges
10
+ /// `0x0..0xD7FF` and `0xE000..0x10FFFF` (both inclusive) are Unicode
11
+ /// code points, and hence valid `codepoint`s.
12
+ ///
13
+ /// A `String` can be constructed from a `codepoint` using `String.fromCodePoint()`.
14
+ export type codepoint = number;
15
+ export type pointer = number;