lucid-extension-sdk 0.0.455 → 0.0.456

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.
@@ -14,6 +14,8 @@ export declare const FieldConstraintType: {
14
14
  readonly NO_WHITESPACE: "noWhitespace";
15
15
  readonly UNIQUE_EDIT: "uniqueEditType";
16
16
  readonly MAX_LENGTH: "maxLength";
17
+ readonly MAX_DECIMAL_PLACES: "maxDecimalPlaces";
18
+ /** @deprecated Use MAX_DECIMAL_PLACES instead. This key mapped to the wrong string value and never matched the backend. */
17
19
  readonly MAX_DECIMAL_LENGTH: "maxDecimalLength";
18
20
  };
19
21
  export type FieldConstraintType = (typeof FieldConstraintType)[keyof typeof FieldConstraintType];
@@ -26,8 +28,10 @@ export declare const isFieldConstraintType: (x: unknown) => x is {} extends {
26
28
  readonly NO_WHITESPACE: "noWhitespace";
27
29
  readonly UNIQUE_EDIT: "uniqueEditType";
28
30
  readonly MAX_LENGTH: "maxLength";
31
+ readonly MAX_DECIMAL_PLACES: "maxDecimalPlaces";
32
+ /** @deprecated Use MAX_DECIMAL_PLACES instead. This key mapped to the wrong string value and never matched the backend. */
29
33
  readonly MAX_DECIMAL_LENGTH: "maxDecimalLength";
30
- } ? never : "locked" | "required" | "minValue" | "maxValue" | "singleLineOnly" | "noWhitespace" | "uniqueEditType" | "maxLength" | "maxDecimalLength";
34
+ } ? never : "locked" | "required" | "minValue" | "maxValue" | "singleLineOnly" | "noWhitespace" | "uniqueEditType" | "maxLength" | "maxDecimalPlaces" | "maxDecimalLength";
31
35
  export type SerializedFieldConstraint = {
32
36
  'Type': FieldConstraintType;
33
37
  'Details'?: UnsafeJsonSerializableOrUndefined;
@@ -43,8 +47,10 @@ export declare const isSerializedFieldConstraint: (subject: unknown) => subject
43
47
  readonly NO_WHITESPACE: "noWhitespace";
44
48
  readonly UNIQUE_EDIT: "uniqueEditType";
45
49
  readonly MAX_LENGTH: "maxLength";
50
+ readonly MAX_DECIMAL_PLACES: "maxDecimalPlaces";
51
+ /** @deprecated Use MAX_DECIMAL_PLACES instead. This key mapped to the wrong string value and never matched the backend. */
46
52
  readonly MAX_DECIMAL_LENGTH: "maxDecimalLength";
47
- } ? never : "locked" | "required" | "minValue" | "maxValue" | "singleLineOnly" | "noWhitespace" | "uniqueEditType" | "maxLength" | "maxDecimalLength";
53
+ } ? never : "locked" | "required" | "minValue" | "maxValue" | "singleLineOnly" | "noWhitespace" | "uniqueEditType" | "maxLength" | "maxDecimalPlaces" | "maxDecimalLength";
48
54
  Details: (x: unknown) => x is any | undefined;
49
55
  Reason: (x: unknown) => x is string | null | undefined;
50
56
  }>;
@@ -69,8 +75,10 @@ export declare const isSerializedFieldDefinition: (subject: unknown) => subject
69
75
  readonly NO_WHITESPACE: "noWhitespace";
70
76
  readonly UNIQUE_EDIT: "uniqueEditType";
71
77
  readonly MAX_LENGTH: "maxLength";
78
+ readonly MAX_DECIMAL_PLACES: "maxDecimalPlaces";
79
+ /** @deprecated Use MAX_DECIMAL_PLACES instead. This key mapped to the wrong string value and never matched the backend. */
72
80
  readonly MAX_DECIMAL_LENGTH: "maxDecimalLength";
73
- } ? never : "locked" | "required" | "minValue" | "maxValue" | "singleLineOnly" | "noWhitespace" | "uniqueEditType" | "maxLength" | "maxDecimalLength";
81
+ } ? never : "locked" | "required" | "minValue" | "maxValue" | "singleLineOnly" | "noWhitespace" | "uniqueEditType" | "maxLength" | "maxDecimalPlaces" | "maxDecimalLength";
74
82
  Details: (x: unknown) => x is any | undefined;
75
83
  Reason: (x: unknown) => x is string | null | undefined;
76
84
  }>[] | undefined;
@@ -17,6 +17,8 @@ exports.FieldConstraintType = {
17
17
  NO_WHITESPACE: 'noWhitespace',
18
18
  UNIQUE_EDIT: 'uniqueEditType',
19
19
  MAX_LENGTH: 'maxLength',
20
+ MAX_DECIMAL_PLACES: 'maxDecimalPlaces',
21
+ /** @deprecated Use MAX_DECIMAL_PLACES instead. This key mapped to the wrong string value and never matched the backend. */
20
22
  MAX_DECIMAL_LENGTH: 'maxDecimalLength',
21
23
  };
22
24
  exports.isFieldConstraintType = (0, validators_1.enumValidator)(exports.FieldConstraintType);
package/core/defer.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export interface DeferredPromise<T> extends Promise<T> {
1
+ export interface DeferredPromise<T = void> extends Promise<T> {
2
2
  resolve: (p1: T | PromiseLike<T>) => any;
3
3
  reject: (p1?: any) => any;
4
4
  promise: Promise<T>;
@@ -108,8 +108,12 @@ function generateNullish() {
108
108
  function generatePartialRecord(keyGenerator, valueGenerator) {
109
109
  return function () {
110
110
  const result = {};
111
- for (const { key, value } of (0, iterable_1.zipHoldShorter)({ key: keyGenerator(), value: valueGenerator() })) {
112
- result[key] = value;
111
+ const keys = Array.from(keyGenerator());
112
+ const values = Array.from(valueGenerator());
113
+ if (keys.length > 0 && values.length > 0) {
114
+ for (const { key, value } of (0, iterable_1.zipHoldShorter)({ key: keys, value: values })) {
115
+ result[key] = value;
116
+ }
113
117
  }
114
118
  return [{}, result];
115
119
  };
@@ -118,8 +122,12 @@ function generatePartialRecord(keyGenerator, valueGenerator) {
118
122
  function generateMapEntries(keyGenerator, valueGenerator) {
119
123
  return function () {
120
124
  const result = [];
121
- for (const { key, value } of (0, iterable_1.zipHoldShorter)({ key: keyGenerator(), value: valueGenerator() })) {
122
- result.push([key, value]);
125
+ const keys = Array.from(keyGenerator());
126
+ const values = Array.from(valueGenerator());
127
+ if (keys.length > 0 && values.length > 0) {
128
+ for (const { key, value } of (0, iterable_1.zipHoldShorter)({ key: keys, value: values })) {
129
+ result.push([key, value]);
130
+ }
123
131
  }
124
132
  return [[], result];
125
133
  };
@@ -177,8 +177,9 @@ export declare const isSerializedExtensionCardFieldDefinition: (subject: unknown
177
177
  readonly NO_WHITESPACE: "noWhitespace";
178
178
  readonly UNIQUE_EDIT: "uniqueEditType";
179
179
  readonly MAX_LENGTH: "maxLength";
180
+ readonly MAX_DECIMAL_PLACES: "maxDecimalPlaces";
180
181
  readonly MAX_DECIMAL_LENGTH: "maxDecimalLength";
181
- } ? never : "locked" | "required" | "minValue" | "maxValue" | "singleLineOnly" | "noWhitespace" | "uniqueEditType" | "maxLength" | "maxDecimalLength";
182
+ } ? never : "locked" | "required" | "minValue" | "maxValue" | "singleLineOnly" | "noWhitespace" | "uniqueEditType" | "maxLength" | "maxDecimalPlaces" | "maxDecimalLength";
182
183
  Details: (x: unknown) => x is any | undefined;
183
184
  Reason: (x: unknown) => x is string | null | undefined;
184
185
  }>[] | undefined;
@@ -224,8 +225,9 @@ export declare const isSerializedExtensionCardFieldsGroup: (subject: unknown) =>
224
225
  readonly NO_WHITESPACE: "noWhitespace";
225
226
  readonly UNIQUE_EDIT: "uniqueEditType";
226
227
  readonly MAX_LENGTH: "maxLength";
228
+ readonly MAX_DECIMAL_PLACES: "maxDecimalPlaces";
227
229
  readonly MAX_DECIMAL_LENGTH: "maxDecimalLength";
228
- } ? never : "locked" | "required" | "minValue" | "maxValue" | "singleLineOnly" | "noWhitespace" | "uniqueEditType" | "maxLength" | "maxDecimalLength";
230
+ } ? never : "locked" | "required" | "minValue" | "maxValue" | "singleLineOnly" | "noWhitespace" | "uniqueEditType" | "maxLength" | "maxDecimalPlaces" | "maxDecimalLength";
229
231
  Details: (x: unknown) => x is any | undefined;
230
232
  Reason: (x: unknown) => x is string | null | undefined;
231
233
  }>[] | undefined;
@@ -259,8 +261,9 @@ export declare const isSerializedExtensionCardFieldsGroupArray: (val: unknown) =
259
261
  readonly NO_WHITESPACE: "noWhitespace";
260
262
  readonly UNIQUE_EDIT: "uniqueEditType";
261
263
  readonly MAX_LENGTH: "maxLength";
264
+ readonly MAX_DECIMAL_PLACES: "maxDecimalPlaces";
262
265
  readonly MAX_DECIMAL_LENGTH: "maxDecimalLength";
263
- } ? never : "locked" | "required" | "minValue" | "maxValue" | "singleLineOnly" | "noWhitespace" | "uniqueEditType" | "maxLength" | "maxDecimalLength";
266
+ } ? never : "locked" | "required" | "minValue" | "maxValue" | "singleLineOnly" | "noWhitespace" | "uniqueEditType" | "maxLength" | "maxDecimalPlaces" | "maxDecimalLength";
264
267
  Details: (x: unknown) => x is any | undefined;
265
268
  Reason: (x: unknown) => x is string | null | undefined;
266
269
  }>[] | undefined;
@@ -41,13 +41,19 @@ export interface MaxLengthConstraintDefinition {
41
41
  reason?: string | undefined;
42
42
  }
43
43
  export interface MaxDecimalPlacesConstraintDefinition {
44
+ type: typeof FieldConstraintType.MAX_DECIMAL_PLACES;
45
+ value: number;
46
+ reason?: string | undefined;
47
+ }
48
+ /** @deprecated Use MaxDecimalPlacesConstraintDefinition instead. */
49
+ export interface MaxDecimalLengthConstraintDefinition {
44
50
  type: typeof FieldConstraintType.MAX_DECIMAL_LENGTH;
45
51
  value: number;
46
52
  reason?: string | undefined;
47
53
  }
48
- export type FieldConstraintDefinition = RequiredFieldConstraintDefinition | LockedFieldConstraintDefinition | MinValueFieldConstraintDefinition | MaxValueFieldConstraintDefinition | SingleLineFieldConstraintDefinition | NoWhitespaceFieldConstraintDefinition | UniqueEditFieldConstraintDefinition | MaxLengthConstraintDefinition | MaxDecimalPlacesConstraintDefinition;
54
+ export type FieldConstraintDefinition = RequiredFieldConstraintDefinition | LockedFieldConstraintDefinition | MinValueFieldConstraintDefinition | MaxValueFieldConstraintDefinition | SingleLineFieldConstraintDefinition | NoWhitespaceFieldConstraintDefinition | UniqueEditFieldConstraintDefinition | MaxLengthConstraintDefinition | MaxDecimalPlacesConstraintDefinition | MaxDecimalLengthConstraintDefinition;
49
55
  export declare function createFieldConstraintDefinition(type: FieldConstraintType, value?: number, reason?: string): FieldConstraintDefinition;
50
- export declare function numericFieldConstraintValidator(val: unknown): val is typeof FieldConstraintType.MIN_VALUE | typeof FieldConstraintType.MAX_VALUE | typeof FieldConstraintType.MAX_LENGTH | typeof FieldConstraintType.MAX_DECIMAL_LENGTH;
56
+ export declare function numericFieldConstraintValidator(val: unknown): val is typeof FieldConstraintType.MIN_VALUE | typeof FieldConstraintType.MAX_VALUE | typeof FieldConstraintType.MAX_LENGTH | typeof FieldConstraintType.MAX_DECIMAL_PLACES | typeof FieldConstraintType.MAX_DECIMAL_LENGTH;
51
57
  export declare const isFieldConstraintDefinition: (x: unknown) => x is import("..").DestructureGuardedTypeObj<{
52
58
  type: (x: unknown) => x is {} extends {
53
59
  readonly REQUIRED: "required";
@@ -58,8 +64,9 @@ export declare const isFieldConstraintDefinition: (x: unknown) => x is import(".
58
64
  readonly NO_WHITESPACE: "noWhitespace";
59
65
  readonly UNIQUE_EDIT: "uniqueEditType";
60
66
  readonly MAX_LENGTH: "maxLength";
67
+ readonly MAX_DECIMAL_PLACES: "maxDecimalPlaces";
61
68
  readonly MAX_DECIMAL_LENGTH: "maxDecimalLength";
62
- } ? never : "locked" | "required" | "minValue" | "maxValue" | "singleLineOnly" | "noWhitespace" | "uniqueEditType" | "maxLength" | "maxDecimalLength";
69
+ } ? never : "locked" | "required" | "minValue" | "maxValue" | "singleLineOnly" | "noWhitespace" | "uniqueEditType" | "maxLength" | "maxDecimalPlaces" | "maxDecimalLength";
63
70
  }> & (import("..").DestructureGuardedTypeObj<{
64
71
  type: typeof numericFieldConstraintValidator;
65
72
  value: typeof isNumber;
@@ -16,6 +16,7 @@ function createFieldConstraintDefinition(type, value, reason) {
16
16
  case serializedfielddefinition_1.FieldConstraintType.MIN_VALUE:
17
17
  case serializedfielddefinition_1.FieldConstraintType.MAX_VALUE:
18
18
  case serializedfielddefinition_1.FieldConstraintType.MAX_LENGTH:
19
+ case serializedfielddefinition_1.FieldConstraintType.MAX_DECIMAL_PLACES:
19
20
  case serializedfielddefinition_1.FieldConstraintType.MAX_DECIMAL_LENGTH:
20
21
  if (value === undefined) {
21
22
  throw new Error('Invalid constraint value');
@@ -36,6 +37,7 @@ function numericFieldConstraintValidator(val) {
36
37
  return (val === serializedfielddefinition_1.FieldConstraintType.MIN_VALUE ||
37
38
  val === serializedfielddefinition_1.FieldConstraintType.MAX_VALUE ||
38
39
  val === serializedfielddefinition_1.FieldConstraintType.MAX_LENGTH ||
40
+ val === serializedfielddefinition_1.FieldConstraintType.MAX_DECIMAL_PLACES ||
39
41
  val === serializedfielddefinition_1.FieldConstraintType.MAX_DECIMAL_LENGTH);
40
42
  }
41
43
  exports.isFieldConstraintDefinition = (0, validators_1.both)((0, validators_1.objectValidator)({
@@ -20,7 +20,7 @@ class TableCellProxy {
20
20
  return this.table.textStyles.get(`Cell_${this.row},${this.column}`);
21
21
  }
22
22
  setTextStyle(style) {
23
- this.table.textStyles.set(`Cell_${this.row},${this.column}`, style);
23
+ void this.table.textStyles.set(`Cell_${this.row},${this.column}`, style);
24
24
  }
25
25
  setFill(fill) {
26
26
  this.table.properties.set(`CellFill_${this.row},${this.column}`, (0, fillcolor_1.serializeSimpleFill)(fill));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.455",
3
+ "version": "0.0.456",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/ui/viewport.js CHANGED
@@ -60,7 +60,7 @@ class Viewport {
60
60
  * @param page The page to view
61
61
  */
62
62
  setCurrentPage(page) {
63
- this.client.sendCommand(commandtypes_1.CommandName.SetCurrentPage, page.id);
63
+ void this.client.sendCommand(commandtypes_1.CommandName.SetCurrentPage, page.id);
64
64
  }
65
65
  /**
66
66
  * @returns the box for the current viewport location
@@ -77,7 +77,7 @@ class Viewport {
77
77
  const bb = (0, math_1.combinedBoundingBox)(items.map((e) => e.getBoundingBox()));
78
78
  if (bb && items[0]) {
79
79
  //TODO: A reasonable max zoom level (e.g. 200%)
80
- this.client.sendCommand(commandtypes_1.CommandName.AnimateViewport, {
80
+ void this.client.sendCommand(commandtypes_1.CommandName.AnimateViewport, {
81
81
  'bb': (0, math_1.padBox)(bb, 80),
82
82
  'p': items[0].getPage().id,
83
83
  });