lucid-extension-sdk 0.0.0
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.
- package/LICENSE +201 -0
- package/README.md +11 -0
- package/interop.d.ts +8 -0
- package/out/commandtypes.d.ts +426 -0
- package/out/commandtypes.js +2 -0
- package/out/core/checks.d.ts +93 -0
- package/out/core/checks.js +152 -0
- package/out/core/dataerrortype.d.ts +8 -0
- package/out/core/dataerrortype.js +2 -0
- package/out/core/jsonserializable.d.ts +8 -0
- package/out/core/jsonserializable.js +2 -0
- package/out/core/offsettype.d.ts +16 -0
- package/out/core/offsettype.js +30 -0
- package/out/core/serializeddataerror.d.ts +6 -0
- package/out/core/serializeddataerror.js +8 -0
- package/out/core/serializedfields.d.ts +58 -0
- package/out/core/serializedfields.js +37 -0
- package/out/core/shapedatainheritance.d.ts +16 -0
- package/out/core/shapedatainheritance.js +20 -0
- package/out/data/collectionproxy.d.ts +12 -0
- package/out/data/collectionproxy.js +24 -0
- package/out/data/dataerror.d.ts +6 -0
- package/out/data/dataerror.js +10 -0
- package/out/data/dataitemproxy.d.ts +10 -0
- package/out/data/dataitemproxy.js +17 -0
- package/out/data/dataproxy.d.ts +8 -0
- package/out/data/dataproxy.js +12 -0
- package/out/data/datasourceproxy.d.ts +10 -0
- package/out/data/datasourceproxy.js +17 -0
- package/out/document/blockclasses/blockproxyregistry.d.ts +13 -0
- package/out/document/blockclasses/blockproxyregistry.js +9 -0
- package/out/document/blockclasses/erdblockproxy.d.ts +15 -0
- package/out/document/blockclasses/erdblockproxy.js +41 -0
- package/out/document/blockdefinition.d.ts +5 -0
- package/out/document/blockdefinition.js +2 -0
- package/out/document/blockproxy.d.ts +6 -0
- package/out/document/blockproxy.js +17 -0
- package/out/document/documentproxy.d.ts +10 -0
- package/out/document/documentproxy.js +19 -0
- package/out/document/elementproxy.d.ts +13 -0
- package/out/document/elementproxy.js +36 -0
- package/out/document/groupproxy.d.ts +11 -0
- package/out/document/groupproxy.js +18 -0
- package/out/document/itemproxy.d.ts +21 -0
- package/out/document/itemproxy.js +55 -0
- package/out/document/linedefinition.d.ts +27 -0
- package/out/document/linedefinition.js +2 -0
- package/out/document/lineproxy.d.ts +25 -0
- package/out/document/lineproxy.js +110 -0
- package/out/document/mapproxy.d.ts +15 -0
- package/out/document/mapproxy.js +49 -0
- package/out/document/pagedefinition.d.ts +3 -0
- package/out/document/pagedefinition.js +2 -0
- package/out/document/pageproxy.d.ts +23 -0
- package/out/document/pageproxy.js +47 -0
- package/out/document/shapedataproxy.d.ts +12 -0
- package/out/document/shapedataproxy.js +45 -0
- package/out/editorclient.d.ts +43 -0
- package/out/editorclient.js +128 -0
- package/out/index.d.ts +7 -0
- package/out/index.js +19 -0
- package/out/math.d.ts +12 -0
- package/out/math.js +24 -0
- package/out/ui/alertmodal.d.ts +8 -0
- package/out/ui/alertmodal.js +37 -0
- package/out/ui/menu.d.ts +26 -0
- package/out/ui/menu.js +42 -0
- package/out/ui/modal.d.ts +36 -0
- package/out/ui/modal.js +69 -0
- package/out/ui/viewport.d.ts +11 -0
- package/out/ui/viewport.js +35 -0
- package/package.json +15 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns true if the specified value is not undefined.
|
|
3
|
+
*
|
|
4
|
+
* @param val Variable to test.
|
|
5
|
+
* @return Whether variable is defined.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isDef<F>(val: F | undefined): val is F;
|
|
8
|
+
/**
|
|
9
|
+
* Returns true if the specified value is null.
|
|
10
|
+
* @param val Variable to test.
|
|
11
|
+
* @return Whether variable is null.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isNull(val: unknown): val is null;
|
|
14
|
+
/**
|
|
15
|
+
* Returns true if the specified value is undefined.
|
|
16
|
+
* @param val Variable to test.
|
|
17
|
+
* @return Whether variable is undefined.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isUndefined(val: unknown): val is undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Returns true if the specified value is defined and not null.
|
|
22
|
+
* @param val Variable to test.
|
|
23
|
+
* @return Whether variable is defined and not null.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isDefAndNotNull<F>(val: F | null | undefined): val is F;
|
|
26
|
+
/**
|
|
27
|
+
* Returns true if the specified value is null or undefined.
|
|
28
|
+
* @param val Variable to test
|
|
29
|
+
* @return Whether the variable is null or undefined.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isNullish(val: unknown): val is null | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Returns true if the specified value is a string.
|
|
34
|
+
* @param val Variable to test.
|
|
35
|
+
* @return Whether variable is a string.
|
|
36
|
+
*/
|
|
37
|
+
export declare function isString(val: unknown): val is string;
|
|
38
|
+
/**
|
|
39
|
+
* Returns true if the specified value is a boolean.
|
|
40
|
+
* @param val Variable to test.
|
|
41
|
+
* @return Whether variable is boolean.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isBoolean(val: unknown): val is boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Returns true if the specified value is a number.
|
|
46
|
+
* @param val Variable to test.
|
|
47
|
+
* @return Whether variable is a number.
|
|
48
|
+
*/
|
|
49
|
+
export declare function isNumber(val: unknown): val is number;
|
|
50
|
+
/**
|
|
51
|
+
* Returns true if the specified value is an integer.
|
|
52
|
+
* @param val Variable to test.
|
|
53
|
+
* @return Whether variable is an integer.
|
|
54
|
+
*/
|
|
55
|
+
export declare function isInt(val: unknown): val is number;
|
|
56
|
+
export declare function isFunction(val: unknown): val is (...unknownArgs: any[]) => unknown;
|
|
57
|
+
/**
|
|
58
|
+
* Returns true if the specified value is an object (i.e. it's safe to do property accesses on it).
|
|
59
|
+
*
|
|
60
|
+
* This is safer than using goog.isObject directly (this is its code inlined) because it doesn't introduce an `any`.
|
|
61
|
+
* @param val Variable to test.
|
|
62
|
+
* @return Whether variable is an object.
|
|
63
|
+
*/
|
|
64
|
+
export declare function isObject(val: unknown): val is Record<string, unknown>;
|
|
65
|
+
/**
|
|
66
|
+
* Returns true if the specified value is an array.
|
|
67
|
+
*
|
|
68
|
+
* This is safer than using Array.isArray directly because it doesn't introduce an `any` type.
|
|
69
|
+
* @param val Variable to test.
|
|
70
|
+
* @return Whether variable is an array.
|
|
71
|
+
*/
|
|
72
|
+
export declare function isArray(val: unknown): val is unknown[];
|
|
73
|
+
/**
|
|
74
|
+
* Returns true if the specified value is an array and every element passes the type guard function.
|
|
75
|
+
*
|
|
76
|
+
* @param val Variable to test.
|
|
77
|
+
* @param typeGuard the type guard function to test every element in the array.
|
|
78
|
+
* @return Whether variable is an array of the given type.
|
|
79
|
+
*/
|
|
80
|
+
export declare function isTypedArray<T>(typeGuard: (a: unknown) => a is T): (val: unknown) => val is T[];
|
|
81
|
+
/**
|
|
82
|
+
* Returns true if the specified object is either empty or all existing keys map to a nullish value
|
|
83
|
+
*
|
|
84
|
+
* @param val Variable to test
|
|
85
|
+
* @return Whether variable is empty or maps exclusively to nullish values
|
|
86
|
+
*/
|
|
87
|
+
export declare function isEmptyOrNullishObject(val: unknown): val is {};
|
|
88
|
+
/**
|
|
89
|
+
* @deprecated Prefer isUnknown
|
|
90
|
+
*/
|
|
91
|
+
export declare function isAny(val: unknown): val is any;
|
|
92
|
+
export declare function isUnknown(val: unknown): val is unknown;
|
|
93
|
+
export declare function isPromise(val: unknown): val is Promise<unknown>;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isPromise = exports.isUnknown = exports.isAny = exports.isEmptyOrNullishObject = exports.isTypedArray = exports.isArray = exports.isObject = exports.isFunction = exports.isInt = exports.isNumber = exports.isBoolean = exports.isString = exports.isNullish = exports.isDefAndNotNull = exports.isUndefined = exports.isNull = exports.isDef = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Returns true if the specified value is not undefined.
|
|
6
|
+
*
|
|
7
|
+
* @param val Variable to test.
|
|
8
|
+
* @return Whether variable is defined.
|
|
9
|
+
*/
|
|
10
|
+
function isDef(val) {
|
|
11
|
+
return val !== undefined;
|
|
12
|
+
}
|
|
13
|
+
exports.isDef = isDef;
|
|
14
|
+
/**
|
|
15
|
+
* Returns true if the specified value is null.
|
|
16
|
+
* @param val Variable to test.
|
|
17
|
+
* @return Whether variable is null.
|
|
18
|
+
*/
|
|
19
|
+
function isNull(val) {
|
|
20
|
+
return val === null;
|
|
21
|
+
}
|
|
22
|
+
exports.isNull = isNull;
|
|
23
|
+
/**
|
|
24
|
+
* Returns true if the specified value is undefined.
|
|
25
|
+
* @param val Variable to test.
|
|
26
|
+
* @return Whether variable is undefined.
|
|
27
|
+
*/
|
|
28
|
+
function isUndefined(val) {
|
|
29
|
+
return val === undefined;
|
|
30
|
+
}
|
|
31
|
+
exports.isUndefined = isUndefined;
|
|
32
|
+
/**
|
|
33
|
+
* Returns true if the specified value is defined and not null.
|
|
34
|
+
* @param val Variable to test.
|
|
35
|
+
* @return Whether variable is defined and not null.
|
|
36
|
+
*/
|
|
37
|
+
function isDefAndNotNull(val) {
|
|
38
|
+
return val != null;
|
|
39
|
+
}
|
|
40
|
+
exports.isDefAndNotNull = isDefAndNotNull;
|
|
41
|
+
/**
|
|
42
|
+
* Returns true if the specified value is null or undefined.
|
|
43
|
+
* @param val Variable to test
|
|
44
|
+
* @return Whether the variable is null or undefined.
|
|
45
|
+
*/
|
|
46
|
+
function isNullish(val) {
|
|
47
|
+
return val == null;
|
|
48
|
+
}
|
|
49
|
+
exports.isNullish = isNullish;
|
|
50
|
+
/**
|
|
51
|
+
* Returns true if the specified value is a string.
|
|
52
|
+
* @param val Variable to test.
|
|
53
|
+
* @return Whether variable is a string.
|
|
54
|
+
*/
|
|
55
|
+
function isString(val) {
|
|
56
|
+
return typeof val == 'string';
|
|
57
|
+
}
|
|
58
|
+
exports.isString = isString;
|
|
59
|
+
/**
|
|
60
|
+
* Returns true if the specified value is a boolean.
|
|
61
|
+
* @param val Variable to test.
|
|
62
|
+
* @return Whether variable is boolean.
|
|
63
|
+
*/
|
|
64
|
+
function isBoolean(val) {
|
|
65
|
+
return typeof val == 'boolean';
|
|
66
|
+
}
|
|
67
|
+
exports.isBoolean = isBoolean;
|
|
68
|
+
/**
|
|
69
|
+
* Returns true if the specified value is a number.
|
|
70
|
+
* @param val Variable to test.
|
|
71
|
+
* @return Whether variable is a number.
|
|
72
|
+
*/
|
|
73
|
+
function isNumber(val) {
|
|
74
|
+
return typeof val == 'number';
|
|
75
|
+
}
|
|
76
|
+
exports.isNumber = isNumber;
|
|
77
|
+
/**
|
|
78
|
+
* Returns true if the specified value is an integer.
|
|
79
|
+
* @param val Variable to test.
|
|
80
|
+
* @return Whether variable is an integer.
|
|
81
|
+
*/
|
|
82
|
+
function isInt(val) {
|
|
83
|
+
return isNumber(val) && isFinite(val) && val % 1 == 0;
|
|
84
|
+
}
|
|
85
|
+
exports.isInt = isInt;
|
|
86
|
+
function isFunction(val) {
|
|
87
|
+
return typeof val === 'function';
|
|
88
|
+
}
|
|
89
|
+
exports.isFunction = isFunction;
|
|
90
|
+
/**
|
|
91
|
+
* Returns true if the specified value is an object (i.e. it's safe to do property accesses on it).
|
|
92
|
+
*
|
|
93
|
+
* This is safer than using goog.isObject directly (this is its code inlined) because it doesn't introduce an `any`.
|
|
94
|
+
* @param val Variable to test.
|
|
95
|
+
* @return Whether variable is an object.
|
|
96
|
+
*/
|
|
97
|
+
function isObject(val) {
|
|
98
|
+
const type = typeof val;
|
|
99
|
+
return (type == 'object' && val != null) || type == 'function';
|
|
100
|
+
}
|
|
101
|
+
exports.isObject = isObject;
|
|
102
|
+
/**
|
|
103
|
+
* Returns true if the specified value is an array.
|
|
104
|
+
*
|
|
105
|
+
* This is safer than using Array.isArray directly because it doesn't introduce an `any` type.
|
|
106
|
+
* @param val Variable to test.
|
|
107
|
+
* @return Whether variable is an array.
|
|
108
|
+
*/
|
|
109
|
+
function isArray(val) {
|
|
110
|
+
return Array.isArray(val);
|
|
111
|
+
}
|
|
112
|
+
exports.isArray = isArray;
|
|
113
|
+
/**
|
|
114
|
+
* Returns true if the specified value is an array and every element passes the type guard function.
|
|
115
|
+
*
|
|
116
|
+
* @param val Variable to test.
|
|
117
|
+
* @param typeGuard the type guard function to test every element in the array.
|
|
118
|
+
* @return Whether variable is an array of the given type.
|
|
119
|
+
*/
|
|
120
|
+
function isTypedArray(typeGuard) {
|
|
121
|
+
return function (val) {
|
|
122
|
+
return isArray(val) && val.every(typeGuard);
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
exports.isTypedArray = isTypedArray;
|
|
126
|
+
/**
|
|
127
|
+
* Returns true if the specified object is either empty or all existing keys map to a nullish value
|
|
128
|
+
*
|
|
129
|
+
* @param val Variable to test
|
|
130
|
+
* @return Whether variable is empty or maps exclusively to nullish values
|
|
131
|
+
*/
|
|
132
|
+
function isEmptyOrNullishObject(val) {
|
|
133
|
+
return !(val &&
|
|
134
|
+
typeof val === 'object' &&
|
|
135
|
+
Object.keys(val).find((key) => isDefAndNotNull(val[key])));
|
|
136
|
+
}
|
|
137
|
+
exports.isEmptyOrNullishObject = isEmptyOrNullishObject;
|
|
138
|
+
/**
|
|
139
|
+
* @deprecated Prefer isUnknown
|
|
140
|
+
*/
|
|
141
|
+
function isAny(val) {
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
exports.isAny = isAny;
|
|
145
|
+
function isUnknown(val) {
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
exports.isUnknown = isUnknown;
|
|
149
|
+
function isPromise(val) {
|
|
150
|
+
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
151
|
+
}
|
|
152
|
+
exports.isPromise = isPromise;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare type JsonArray = Array<JsonSerializable>;
|
|
2
|
+
export interface JsonObject {
|
|
3
|
+
[key: string]: JsonSerializable;
|
|
4
|
+
}
|
|
5
|
+
export interface JsonObjectConvertible {
|
|
6
|
+
toJsonObject(): JsonObject;
|
|
7
|
+
}
|
|
8
|
+
export declare type JsonSerializable = undefined | null | string | number | boolean | JsonArray | JsonObject;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare enum OffsetType {
|
|
2
|
+
NW = 0,
|
|
3
|
+
NE = 1,
|
|
4
|
+
SE = 2,
|
|
5
|
+
SW = 3,
|
|
6
|
+
MOVE = 4,
|
|
7
|
+
ROTATE = 5,
|
|
8
|
+
SCALE = 6,
|
|
9
|
+
CUSTOM = 7,
|
|
10
|
+
N = 8,
|
|
11
|
+
E = 9,
|
|
12
|
+
S = 10,
|
|
13
|
+
W = 11
|
|
14
|
+
}
|
|
15
|
+
export declare type LinearOffsetType = OffsetType.NW | OffsetType.NE | OffsetType.SE | OffsetType.SW | OffsetType.MOVE | OffsetType.N | OffsetType.E | OffsetType.S | OffsetType.W;
|
|
16
|
+
export declare function isLinearOffsetType(offsetType: unknown): offsetType is LinearOffsetType;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isLinearOffsetType = exports.OffsetType = void 0;
|
|
4
|
+
var OffsetType;
|
|
5
|
+
(function (OffsetType) {
|
|
6
|
+
OffsetType[OffsetType["NW"] = 0] = "NW";
|
|
7
|
+
OffsetType[OffsetType["NE"] = 1] = "NE";
|
|
8
|
+
OffsetType[OffsetType["SE"] = 2] = "SE";
|
|
9
|
+
OffsetType[OffsetType["SW"] = 3] = "SW";
|
|
10
|
+
OffsetType[OffsetType["MOVE"] = 4] = "MOVE";
|
|
11
|
+
OffsetType[OffsetType["ROTATE"] = 5] = "ROTATE";
|
|
12
|
+
OffsetType[OffsetType["SCALE"] = 6] = "SCALE";
|
|
13
|
+
OffsetType[OffsetType["CUSTOM"] = 7] = "CUSTOM";
|
|
14
|
+
OffsetType[OffsetType["N"] = 8] = "N";
|
|
15
|
+
OffsetType[OffsetType["E"] = 9] = "E";
|
|
16
|
+
OffsetType[OffsetType["S"] = 10] = "S";
|
|
17
|
+
OffsetType[OffsetType["W"] = 11] = "W";
|
|
18
|
+
})(OffsetType = exports.OffsetType || (exports.OffsetType = {}));
|
|
19
|
+
function isLinearOffsetType(offsetType) {
|
|
20
|
+
return (offsetType === OffsetType.NW ||
|
|
21
|
+
offsetType === OffsetType.NE ||
|
|
22
|
+
offsetType === OffsetType.SE ||
|
|
23
|
+
offsetType === OffsetType.SW ||
|
|
24
|
+
offsetType === OffsetType.MOVE ||
|
|
25
|
+
offsetType === OffsetType.N ||
|
|
26
|
+
offsetType === OffsetType.E ||
|
|
27
|
+
offsetType === OffsetType.S ||
|
|
28
|
+
offsetType === OffsetType.W);
|
|
29
|
+
}
|
|
30
|
+
exports.isLinearOffsetType = isLinearOffsetType;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSerializedDataError = void 0;
|
|
4
|
+
const checks_1 = require("./checks");
|
|
5
|
+
function isSerializedDataError(raw) {
|
|
6
|
+
return (0, checks_1.isObject)(raw) && (0, checks_1.isString)(raw['error']) && (0, checks_1.isNumber)(raw['type']);
|
|
7
|
+
}
|
|
8
|
+
exports.isSerializedDataError = isSerializedDataError;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Once we have full server support for complex field types,
|
|
3
|
+
* we should be able to support object/array data here
|
|
4
|
+
*/
|
|
5
|
+
export declare type SerializedFieldType = number | boolean | string | null | SerializedLucidDateObject | SerializedColorObjectFieldType | SerializedLucidDictionary | SerializedLucidCurrency | undefined | Array<SerializedFieldType>;
|
|
6
|
+
export declare type SerializedLucidDictionary = {
|
|
7
|
+
'dict': {
|
|
8
|
+
[index: string]: SerializedFieldType;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare type SerializedLucidCurrency = {
|
|
12
|
+
'a': number;
|
|
13
|
+
't': string;
|
|
14
|
+
};
|
|
15
|
+
export declare type SerializedFields = {
|
|
16
|
+
[fieldName: string]: SerializedFieldType;
|
|
17
|
+
};
|
|
18
|
+
export declare type SerializedLucidDateObject = {
|
|
19
|
+
'ms': number;
|
|
20
|
+
'isDateOnly'?: boolean;
|
|
21
|
+
};
|
|
22
|
+
export declare type SerializedRGBColor = {
|
|
23
|
+
'r': number;
|
|
24
|
+
'g': number;
|
|
25
|
+
'b': number;
|
|
26
|
+
'a'?: number;
|
|
27
|
+
't'?: number;
|
|
28
|
+
'c'?: undefined;
|
|
29
|
+
'm'?: undefined;
|
|
30
|
+
'y'?: undefined;
|
|
31
|
+
'k'?: undefined;
|
|
32
|
+
};
|
|
33
|
+
export declare type SerializedCMYKColor = {
|
|
34
|
+
'c': number;
|
|
35
|
+
'm': number;
|
|
36
|
+
'y': number;
|
|
37
|
+
'k': number;
|
|
38
|
+
'a'?: number;
|
|
39
|
+
't'?: number;
|
|
40
|
+
'r'?: undefined;
|
|
41
|
+
'g'?: undefined;
|
|
42
|
+
'b'?: undefined;
|
|
43
|
+
};
|
|
44
|
+
export declare type SerializedCorrectedColor = {
|
|
45
|
+
'cR': number;
|
|
46
|
+
'cG': number;
|
|
47
|
+
'cB': number;
|
|
48
|
+
};
|
|
49
|
+
export declare type SerializedColorObject = SerializedRGBColor | SerializedCMYKColor | (SerializedCMYKColor & SerializedCorrectedColor);
|
|
50
|
+
export declare type SerializedColorObjectFieldType = {
|
|
51
|
+
'color': SerializedColorObject;
|
|
52
|
+
};
|
|
53
|
+
export declare function isSerializedColorObjectFieldType(value: any): value is SerializedColorObjectFieldType;
|
|
54
|
+
export declare function isSerializedLucidDictionary(value: any): value is SerializedLucidDictionary;
|
|
55
|
+
export declare function isSerializedLucidCurrency(value: any): value is SerializedLucidCurrency;
|
|
56
|
+
export declare function isSerializedLucidDateObject(value: any): value is SerializedLucidDateObject;
|
|
57
|
+
export declare function isSerializedFieldType(value: any): value is SerializedFieldType;
|
|
58
|
+
export declare function isSerializedFields(value: unknown): value is SerializedFields;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSerializedFields = exports.isSerializedFieldType = exports.isSerializedLucidDateObject = exports.isSerializedLucidCurrency = exports.isSerializedLucidDictionary = exports.isSerializedColorObjectFieldType = void 0;
|
|
4
|
+
const checks_1 = require("./checks");
|
|
5
|
+
function isSerializedColorObjectFieldType(value) {
|
|
6
|
+
return (0, checks_1.isObject)(value) && (0, checks_1.isObject)(value['color']);
|
|
7
|
+
}
|
|
8
|
+
exports.isSerializedColorObjectFieldType = isSerializedColorObjectFieldType;
|
|
9
|
+
function isSerializedLucidDictionary(value) {
|
|
10
|
+
return (0, checks_1.isObject)(value) && Object.values(value).every(isSerializedFieldType);
|
|
11
|
+
}
|
|
12
|
+
exports.isSerializedLucidDictionary = isSerializedLucidDictionary;
|
|
13
|
+
function isSerializedLucidCurrency(value) {
|
|
14
|
+
return (0, checks_1.isObject)(value) && (0, checks_1.isNumber)(value['a']) && (0, checks_1.isString)(value['t']);
|
|
15
|
+
}
|
|
16
|
+
exports.isSerializedLucidCurrency = isSerializedLucidCurrency;
|
|
17
|
+
function isSerializedLucidDateObject(value) {
|
|
18
|
+
var _a;
|
|
19
|
+
return (0, checks_1.isObject)(value) && (0, checks_1.isNumber)(value['ms']) && (0, checks_1.isBoolean)((_a = value['isDateOnly']) !== null && _a !== void 0 ? _a : true);
|
|
20
|
+
}
|
|
21
|
+
exports.isSerializedLucidDateObject = isSerializedLucidDateObject;
|
|
22
|
+
function isSerializedFieldType(value) {
|
|
23
|
+
return (value == null ||
|
|
24
|
+
(0, checks_1.isNumber)(value) ||
|
|
25
|
+
(0, checks_1.isString)(value) ||
|
|
26
|
+
(0, checks_1.isBoolean)(value) ||
|
|
27
|
+
isSerializedLucidDictionary(value) ||
|
|
28
|
+
isSerializedLucidCurrency(value) ||
|
|
29
|
+
((0, checks_1.isArray)(value) && value.every(isSerializedFieldType)) ||
|
|
30
|
+
isSerializedLucidDateObject(value) ||
|
|
31
|
+
isSerializedColorObjectFieldType(value));
|
|
32
|
+
}
|
|
33
|
+
exports.isSerializedFieldType = isSerializedFieldType;
|
|
34
|
+
function isSerializedFields(value) {
|
|
35
|
+
return (0, checks_1.isObject)(value) && Object.values(value).every(isSerializedFieldType);
|
|
36
|
+
}
|
|
37
|
+
exports.isSerializedFields = isSerializedFields;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare enum ShapeDataInheritance {
|
|
2
|
+
NONE = 0,
|
|
3
|
+
/**
|
|
4
|
+
* Really just a UI level of inheritance, where the shape data panel should show the ability for
|
|
5
|
+
* you to enter a value under this name, and the name isn't editable. Because the default value
|
|
6
|
+
* for missing data is already empty, there's no need to actually do much down here in the model
|
|
7
|
+
* layer.
|
|
8
|
+
*/
|
|
9
|
+
NAME = 1,
|
|
10
|
+
/**
|
|
11
|
+
* This is true inheritance, where the formula/value of the shape data is available on all
|
|
12
|
+
* descendant elements. i.e. if a page has a VALUE-inheritable shape data entry, that appears on
|
|
13
|
+
* every single Element on the page, including all groups and items inside those groups.
|
|
14
|
+
*/
|
|
15
|
+
VALUE = 2
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ShapeDataInheritance = void 0;
|
|
4
|
+
var ShapeDataInheritance;
|
|
5
|
+
(function (ShapeDataInheritance) {
|
|
6
|
+
ShapeDataInheritance[ShapeDataInheritance["NONE"] = 0] = "NONE";
|
|
7
|
+
/**
|
|
8
|
+
* Really just a UI level of inheritance, where the shape data panel should show the ability for
|
|
9
|
+
* you to enter a value under this name, and the name isn't editable. Because the default value
|
|
10
|
+
* for missing data is already empty, there's no need to actually do much down here in the model
|
|
11
|
+
* layer.
|
|
12
|
+
*/
|
|
13
|
+
ShapeDataInheritance[ShapeDataInheritance["NAME"] = 1] = "NAME";
|
|
14
|
+
/**
|
|
15
|
+
* This is true inheritance, where the formula/value of the shape data is available on all
|
|
16
|
+
* descendant elements. i.e. if a page has a VALUE-inheritable shape data entry, that appears on
|
|
17
|
+
* every single Element on the page, including all groups and items inside those groups.
|
|
18
|
+
*/
|
|
19
|
+
ShapeDataInheritance[ShapeDataInheritance["VALUE"] = 2] = "VALUE";
|
|
20
|
+
})(ShapeDataInheritance = exports.ShapeDataInheritance || (exports.ShapeDataInheritance = {}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ElementProxy } from '../document/elementproxy';
|
|
2
|
+
import { MapProxy } from '../document/mapproxy';
|
|
3
|
+
import { EditorClient } from '../editorclient';
|
|
4
|
+
import { DataItemProxy } from './dataitemproxy';
|
|
5
|
+
export declare class CollectionProxy extends ElementProxy {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
constructor(id: string, client: EditorClient);
|
|
8
|
+
getName(): string;
|
|
9
|
+
getBranchedFrom(): CollectionProxy | undefined;
|
|
10
|
+
readonly items: MapProxy<string, DataItemProxy>;
|
|
11
|
+
getFields(): import("../commandtypes").ListCollectionFieldsResult;
|
|
12
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CollectionProxy = void 0;
|
|
4
|
+
const elementproxy_1 = require("../document/elementproxy");
|
|
5
|
+
const mapproxy_1 = require("../document/mapproxy");
|
|
6
|
+
const dataitemproxy_1 = require("./dataitemproxy");
|
|
7
|
+
class CollectionProxy extends elementproxy_1.ElementProxy {
|
|
8
|
+
constructor(id, client) {
|
|
9
|
+
super(id, client);
|
|
10
|
+
this.id = id;
|
|
11
|
+
this.items = new mapproxy_1.MapProxy(() => this.client.sendCommand("ldi" /* ListDataItems */, { 'id': this.id }), (primaryKey) => new dataitemproxy_1.DataItemProxy(primaryKey, this, this.client));
|
|
12
|
+
}
|
|
13
|
+
getName() {
|
|
14
|
+
return this.properties.get('Name');
|
|
15
|
+
}
|
|
16
|
+
getBranchedFrom() {
|
|
17
|
+
const id = this.properties.get('BranchedFrom');
|
|
18
|
+
return id ? new CollectionProxy(id, this.client) : undefined;
|
|
19
|
+
}
|
|
20
|
+
getFields() {
|
|
21
|
+
return this.client.sendCommand("lcf" /* ListCollectionFields */, { 'id': this.id });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.CollectionProxy = CollectionProxy;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MapProxy } from '../document/mapproxy';
|
|
2
|
+
import { EditorClient } from '../editorclient';
|
|
3
|
+
import { CollectionProxy } from './collectionproxy';
|
|
4
|
+
export declare class DataItemProxy {
|
|
5
|
+
readonly primaryKey: string;
|
|
6
|
+
readonly collection: CollectionProxy;
|
|
7
|
+
private readonly client;
|
|
8
|
+
constructor(primaryKey: string, collection: CollectionProxy, client: EditorClient);
|
|
9
|
+
readonly fields: MapProxy<string, import("../core/serializedfields").SerializedFieldType>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataItemProxy = void 0;
|
|
4
|
+
const mapproxy_1 = require("../document/mapproxy");
|
|
5
|
+
class DataItemProxy {
|
|
6
|
+
constructor(primaryKey, collection, client) {
|
|
7
|
+
this.primaryKey = primaryKey;
|
|
8
|
+
this.collection = collection;
|
|
9
|
+
this.client = client;
|
|
10
|
+
this.fields = new mapproxy_1.MapProxy(() => this.client.sendCommand("lcf" /* ListCollectionFields */, { 'id': this.collection.id }), (name) => this.client.sendCommand("gdif" /* GetDataItemField */, {
|
|
11
|
+
'c': this.collection.id,
|
|
12
|
+
'pk': this.primaryKey,
|
|
13
|
+
'f': name,
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.DataItemProxy = DataItemProxy;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MapProxy } from '../document/mapproxy';
|
|
2
|
+
import { EditorClient } from '../editorclient';
|
|
3
|
+
import { DataSourceProxy } from './datasourceproxy';
|
|
4
|
+
export declare class DataProxy {
|
|
5
|
+
private readonly client;
|
|
6
|
+
readonly dataSources: MapProxy<string, DataSourceProxy>;
|
|
7
|
+
constructor(client: EditorClient);
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataProxy = void 0;
|
|
4
|
+
const mapproxy_1 = require("../document/mapproxy");
|
|
5
|
+
const datasourceproxy_1 = require("./datasourceproxy");
|
|
6
|
+
class DataProxy {
|
|
7
|
+
constructor(client) {
|
|
8
|
+
this.client = client;
|
|
9
|
+
this.dataSources = new mapproxy_1.MapProxy(() => this.client.sendCommand("lds" /* ListDataSources */, undefined), (dataSourceId) => new datasourceproxy_1.DataSourceProxy(dataSourceId, this.client));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.DataProxy = DataProxy;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ElementProxy } from '../document/elementproxy';
|
|
2
|
+
import { MapProxy } from '../document/mapproxy';
|
|
3
|
+
import { EditorClient } from '../editorclient';
|
|
4
|
+
import { CollectionProxy } from './collectionproxy';
|
|
5
|
+
export declare class DataSourceProxy extends ElementProxy {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
constructor(id: string, client: EditorClient);
|
|
8
|
+
readonly collections: MapProxy<string, CollectionProxy>;
|
|
9
|
+
getName(): string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataSourceProxy = void 0;
|
|
4
|
+
const elementproxy_1 = require("../document/elementproxy");
|
|
5
|
+
const mapproxy_1 = require("../document/mapproxy");
|
|
6
|
+
const collectionproxy_1 = require("./collectionproxy");
|
|
7
|
+
class DataSourceProxy extends elementproxy_1.ElementProxy {
|
|
8
|
+
constructor(id, client) {
|
|
9
|
+
super(id, client);
|
|
10
|
+
this.id = id;
|
|
11
|
+
this.collections = new mapproxy_1.MapProxy(() => this.client.sendCommand("lc" /* ListCollections */, { 'id': this.id }), (id) => new collectionproxy_1.CollectionProxy(id, this.client));
|
|
12
|
+
}
|
|
13
|
+
getName() {
|
|
14
|
+
return this.properties.get('Name');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.DataSourceProxy = DataSourceProxy;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BlockProxy } from '../blockproxy';
|
|
2
|
+
/**
|
|
3
|
+
* The base BlockProxy class provides no special functionality for any specific type of block.
|
|
4
|
+
*
|
|
5
|
+
* To provide direct type-safe support for specific block types, extend BlockProxy and add a
|
|
6
|
+
* classNameRegex, then include your new block proxy in the allProxyClasses list. Then, whenever
|
|
7
|
+
* we construct a proxy to represent a block on the document, we will check each available
|
|
8
|
+
* proxy class and use one of these if available.
|
|
9
|
+
*/
|
|
10
|
+
export declare type BlockProxyConstructor = typeof BlockProxy & {
|
|
11
|
+
classNameRegex: RegExp;
|
|
12
|
+
};
|
|
13
|
+
export declare function findProxyClass(className: string): BlockProxyConstructor | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findProxyClass = void 0;
|
|
4
|
+
const erdblockproxy_1 = require("./erdblockproxy");
|
|
5
|
+
const allProxyClasses = [erdblockproxy_1.ERDBlockProxy];
|
|
6
|
+
function findProxyClass(className) {
|
|
7
|
+
return allProxyClasses.find((proxy) => proxy.classNameRegex.test(className));
|
|
8
|
+
}
|
|
9
|
+
exports.findProxyClass = findProxyClass;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BlockProxy } from '../blockproxy';
|
|
2
|
+
export declare class ERDFieldProxy {
|
|
3
|
+
private readonly block;
|
|
4
|
+
private readonly index;
|
|
5
|
+
constructor(block: ERDBlockProxy, index: number);
|
|
6
|
+
getName(): string;
|
|
7
|
+
getType(): string | number | boolean | import("../../core/jsonserializable").JsonArray | import("../../core/jsonserializable").JsonObject;
|
|
8
|
+
getKey(): string | number | boolean | import("../../core/jsonserializable").JsonArray | import("../../core/jsonserializable").JsonObject;
|
|
9
|
+
}
|
|
10
|
+
export declare class ERDBlockProxy extends BlockProxy {
|
|
11
|
+
static classNameRegex: RegExp;
|
|
12
|
+
getName(): string;
|
|
13
|
+
getFieldCount(): number;
|
|
14
|
+
getFields(): ERDFieldProxy[];
|
|
15
|
+
}
|