@openremote/core 1.0.3 → 1.2.0-snapshot.20240512155932

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 (43) hide show
  1. package/dist/umd/index.bundle.js +2 -273
  2. package/dist/umd/index.bundle.js.LICENSE.txt +26 -0
  3. package/dist/umd/index.js +2 -7
  4. package/dist/umd/index.js.LICENSE.txt +22 -0
  5. package/dist/umd/index.orbundle.js +50 -280
  6. package/dist/umd/index.orbundle.js.LICENSE.txt +38 -0
  7. package/{dist → lib}/asset-mixin.d.ts +2 -0
  8. package/lib/asset-mixin.js +1 -0
  9. package/lib/asset-mixin.js.map +1 -0
  10. package/{dist → lib}/console.d.ts +14 -5
  11. package/lib/console.js +1 -0
  12. package/lib/console.js.map +1 -0
  13. package/lib/defaults.js +1 -0
  14. package/lib/defaults.js.map +1 -0
  15. package/{dist → lib}/event.d.ts +20 -19
  16. package/lib/event.js +1 -0
  17. package/lib/event.js.map +1 -0
  18. package/lib/index.d.ts +150 -0
  19. package/lib/index.js +1 -0
  20. package/lib/index.js.map +1 -0
  21. package/lib/util.d.ts +92 -0
  22. package/lib/util.js +1 -0
  23. package/lib/util.js.map +1 -0
  24. package/package.json +24 -25
  25. package/.project +0 -17
  26. package/.settings/org.eclipse.buildship.core.prefs +0 -2
  27. package/@types/i18next-sprintf-postprocessor.d.ts +0 -1
  28. package/dist/asset-mixin.js +0 -156
  29. package/dist/console.js +0 -452
  30. package/dist/defaults.js +0 -16
  31. package/dist/event.js +0 -567
  32. package/dist/index.d.ts +0 -224
  33. package/dist/index.js +0 -996
  34. package/dist/mdi-icons.json +0 -1
  35. package/dist/or-icon-set.d.ts +0 -3
  36. package/dist/or-icon-set.js +0 -10
  37. package/dist/util.d.ts +0 -41
  38. package/dist/util.js +0 -362
  39. package/mdi-iconset-generator.js +0 -34
  40. package/tsconfig.json +0 -16
  41. package/typedoc.js +0 -3
  42. package/webpack.config.js +0 -16
  43. /package/{dist → lib}/defaults.d.ts +0 -0
@@ -1,3 +0,0 @@
1
- import { IconSetSvg } from "./index";
2
- declare let orIconSet: IconSetSvg;
3
- export default orIconSet;
@@ -1,10 +0,0 @@
1
- let orIconSet = {
2
- size: 24,
3
- icons: {
4
- "logo": "<path style='pointer-events: var(--or-icon-pointer-events, none);' fill=\"#C4D600\" d=\"m11.96125,23.85096c-6.56773,0 -11.90971,-5.34202 -11.90971,-11.90862l2.49411,0c0,5.19176 4.22389,9.41568 9.41561,9.41568c5.19053,0 9.41561,-4.22392 9.41561,-9.41568c0,-5.19176 -4.22389,-9.41568 -9.41561,-9.41568l0,-2.49413c6.56655,0 11.90971,5.34439 11.90971,11.9098c0,6.5666 -5.34316,11.90862 -11.90971,11.90862l0,0z\" /><path fill=\"#4E9D2D\" d=\"m10.25094,20.38647c-2.26848,-0.47231 -4.21822,-1.80199 -5.48741,-3.74009s-1.70892,-4.25777 -1.23545,-6.52625c0.47347,-2.26965 1.80315,-4.21822 3.74242,-5.48857c1.93926,-1.27035 4.25661,-1.70892 6.52625,-1.23545c4.68471,0.97719 7.70121,5.5828 6.72286,10.26635l-2.39994,-0.49907c0.70149,-3.36085 -1.4623,-6.66585 -4.82431,-7.36734c-1.62866,-0.33969 -3.29105,-0.02559 -4.68238,0.88645c-1.39134,0.91088 -2.34526,2.3092 -2.68495,3.93786c-0.33853,1.62633 -0.02443,3.28988 0.88645,4.68122c0.91088,1.39134 2.3092,2.34526 3.93786,2.68379l-0.50139,2.4011l0,0z\"/><path fill=\"#1D5632\"d=\"m12.03064,17.49616c-0.09524,0 -0.19048,-0.00116 -0.28457,-0.00465c-1.49833,-0.0755 -2.87818,-0.72942 -3.88636,-1.84097c-1.00818,-1.11271 -1.52156,-2.54948 -1.44722,-4.05013l2.44378,0.12196c-0.04181,0.84557 0.24856,1.65745 0.81769,2.28466c0.56681,0.62721 1.34733,0.99656 2.1929,1.03838c0.84208,0.03833 1.65629,-0.2474 2.2835,-0.81653c0.62837,-0.56797 0.99656,-1.34617 1.03954,-2.19174c0.08711,-1.74573 -1.26371,-3.23708 -3.00943,-3.3242l0.12196,-2.44378c3.09422,0.15332 5.4869,2.79455 5.33358,5.88877c-0.07434,1.49949 -0.72942,2.87818 -1.84097,3.8852c-1.04186,0.94313 -2.36945,1.45303 -3.7644,1.45303l0,0z\"/>",
5
- "logo-plain": "m11.9925,23.91349c-6.58498,0 -11.94099,-5.35605 -11.94099,-11.9399l2.50066,0c0,5.20539 4.23498,9.44041 9.44033,9.44041c5.20416,0 9.44033,-4.23502 9.44033,-9.44041c0,-5.20539 -4.23498,-9.44041 -9.44033,-9.44041l0,-2.50068c6.5838,0 11.94099,5.35842 11.94099,11.94108c0,6.58385 -5.35719,11.9399 -11.94099,11.9399l0,0zm-1.80787,-3.27769c-2.31323,-0.48163 -4.30141,-1.83755 -5.59563,-3.81389s-1.74263,-4.34178 -1.25982,-6.65502c0.48281,-2.31443 1.83872,-4.30145 3.81623,-5.59686c1.97751,-1.29542 4.34056,-1.74264 6.65497,-1.25983c4.77711,0.99647 7.8531,5.69295 6.85545,10.46891l-2.44727,-0.50891c0.71532,-3.42716 -1.49114,-6.79738 -4.91946,-7.5127c-1.66078,-0.34639 -3.35596,-0.0261 -4.77474,0.90394c-1.41878,0.92886 -2.39152,2.35476 -2.73791,4.01555c-0.3452,1.65842 -0.02491,3.3548 0.90394,4.77359c0.92885,1.41879 2.35475,2.39154 4.01552,2.73675l-0.51128,2.44848l0,0zm1.81499,-2.92536c-0.09727,0 -0.19455,-0.00119 -0.29064,-0.00475c-1.53029,-0.07711 -2.93958,-0.74498 -3.96926,-1.88025c-1.02968,-1.13646 -1.55401,-2.60388 -1.47809,-4.13655l2.49591,0.12456c-0.04271,0.86361 0.25386,1.69282 0.83513,2.33341c0.5789,0.64059 1.37607,1.01783 2.23968,1.06053c0.86005,0.03915 1.69162,-0.25268 2.33221,-0.83395c0.64177,-0.58009 1.01782,-1.3749 1.06171,-2.23851c0.08897,-1.78298 -1.29066,-3.30616 -3.07362,-3.39513l0.12456,-2.49593c3.16022,0.15659 5.60394,2.85419 5.44735,6.01443c-0.07592,1.53149 -0.74498,2.9396 -1.88024,3.9681c-1.06408,0.96326 -2.41999,1.48403 -3.8447,1.48403l0,0z",
6
- "marker": "<ellipse fill=\"#000\" opacity=\"0.2\" ry=\"1.5\" rx=\"4\" cy=\"22.5\" cx=\"12\" /><path style='pointer-events: var(--or-icon-pointer-events, none);' d=\"m11.999999,0a8.437501,8.344057 0 0 1 8.437501,8.344057c0,6.500779 -5.798864,6.280799 -8.437501,14.412461c-2.638637,-8.131662 -8.437501,-7.911683 -8.437501,-14.412461a8.437501,8.344057 0 0 1 8.437501,-8.344057z\" />"
7
- }
8
- };
9
- export default orIconSet;
10
- //# sourceMappingURL=or-icon-set.js.map
package/dist/util.d.ts DELETED
@@ -1,41 +0,0 @@
1
- import { GeofencePredicate, JsonRulesetDefinition, PushNotificationMessage, Asset, Attribute, AttributeEvent, MetaItem, AssetAttribute, AttributeDescriptor, MetaItemDescriptor, AttributeValueDescriptor } from "@openremote/model";
2
- export declare class Deferred<T> {
3
- protected _resolve: (value?: T | PromiseLike<T>) => void;
4
- protected _reject: (reason?: any) => void;
5
- protected _promise: Promise<T>;
6
- get resolve(): (value?: T | PromiseLike<T> | undefined) => void;
7
- get reject(): (reason?: any) => void;
8
- get promise(): Promise<T>;
9
- constructor();
10
- }
11
- export interface GeoNotification {
12
- predicate: GeofencePredicate;
13
- notification?: PushNotificationMessage;
14
- }
15
- export declare function getQueryParameters(queryStr: string): any;
16
- export declare function getQueryParameter(queryStr: string, parameter: string): any | undefined;
17
- export declare function getGeoNotificationsFromRulesSet(rulesetDefinition: JsonRulesetDefinition): GeoNotification[];
18
- export declare function isTimeDuration(time?: string): boolean;
19
- export declare function isTimeDurationPositiveInfinity(time?: string): boolean;
20
- export declare function isTimeDurationNegativeInfinity(time?: string): boolean;
21
- export declare function isObject(object: any): boolean;
22
- export declare function objectsEqual(obj1?: any, obj2?: any, deep?: boolean): boolean;
23
- export declare function arrayRemove<T>(arr: T[], item: T): void;
24
- export declare function enumContains(enm: object, val: string): boolean;
25
- export declare function getEnumKeyAsString(enm: object, val: string): string;
26
- export declare function getAssetAttribute(asset: Asset, attributeName: string): AssetAttribute | undefined;
27
- export declare function getAssetAttributes(asset: Asset, exclude?: string[]): AssetAttribute[];
28
- export declare function getFirstMetaItem(attribute: Attribute | undefined, name: string): MetaItem | undefined;
29
- export declare function hasMetaItem(attribute: Attribute, name: string): boolean;
30
- export declare function getMetaValue(metaItemUrn: string | MetaItemDescriptor, attribute: Attribute | undefined, descriptor: AttributeDescriptor | undefined, valueDescriptor?: AttributeValueDescriptor): any;
31
- export declare function getAttributeLabel(attribute: Attribute | undefined, descriptor: AttributeDescriptor | undefined, valueDescriptor: AttributeValueDescriptor | undefined, showUnits: boolean, fallback?: string): string;
32
- export declare function getMetaItemLabel(urn: string): string;
33
- export declare function getAttributeValueFormat(attribute: Attribute | undefined, descriptor: AttributeDescriptor | undefined, valueDescriptor: AttributeValueDescriptor | undefined): string | undefined;
34
- export declare function getAttributeValueFormatter(): ((value: any, format: string | undefined) => string);
35
- export declare function getAttributeValueFormatted(attribute: Attribute, descriptor: AttributeDescriptor | undefined, valueDescriptor: AttributeValueDescriptor | undefined, fallback?: string): any;
36
- /**
37
- * Immutable update of an asset using the supplied attribute event
38
- */
39
- export declare function updateAsset(asset: Asset, event: AttributeEvent): Asset;
40
- export declare function loadJs(url: string): Promise<unknown>;
41
- export declare function sortByString<T>(valueExtractor: (item: T) => string): (a: T, b: T) => number;
package/dist/util.js DELETED
@@ -1,362 +0,0 @@
1
- import { MetaItemType } from "@openremote/model";
2
- import i18next from "i18next";
3
- import Qs from "qs";
4
- import { AssetModelUtil } from "./index";
5
- export class Deferred {
6
- constructor() {
7
- this._promise = new Promise((resolve1, reject1) => {
8
- this._resolve = resolve1;
9
- this._reject = reject1;
10
- });
11
- Object.freeze(this);
12
- }
13
- get resolve() {
14
- return this._resolve;
15
- }
16
- get reject() {
17
- return this._reject;
18
- }
19
- get promise() {
20
- return this._promise;
21
- }
22
- }
23
- export function getQueryParameters(queryStr) {
24
- const parsed = Qs.parse(queryStr, { ignoreQueryPrefix: true });
25
- return parsed;
26
- }
27
- export function getQueryParameter(queryStr, parameter) {
28
- const parsed = getQueryParameters(queryStr);
29
- return parsed ? parsed[parameter] : undefined;
30
- }
31
- export function getGeoNotificationsFromRulesSet(rulesetDefinition) {
32
- const geoNotifications = [];
33
- rulesetDefinition.rules.forEach((rule) => {
34
- if (rule.when && rule.then && rule.then.length > 0) {
35
- const geoNotificationMap = new Map();
36
- addGeofencePredicatesFromRuleConditionCondition(rule.when, 0, geoNotificationMap);
37
- if (geoNotificationMap.size > 0) {
38
- rule.then.forEach((ruleAction) => addPushNotificationsFromRuleAction(ruleAction, geoNotificationMap));
39
- }
40
- for (const geoNotificationsArr of geoNotificationMap.values()) {
41
- geoNotificationsArr.forEach((geoNotification) => {
42
- if (geoNotification.notification) {
43
- geoNotifications.push(geoNotification);
44
- }
45
- });
46
- }
47
- }
48
- });
49
- return geoNotifications;
50
- }
51
- function addGeofencePredicatesFromRuleConditionCondition(ruleCondition, index, geoNotificationMap) {
52
- if (!ruleCondition) {
53
- return;
54
- }
55
- const items = [];
56
- if (ruleCondition.groups) {
57
- ruleCondition.groups.forEach((ruleGroup) => {
58
- if (ruleGroup.items) {
59
- ruleGroup.items.forEach((ruleTrigger) => {
60
- items.push(ruleTrigger);
61
- });
62
- }
63
- });
64
- }
65
- if (ruleCondition.items) {
66
- ruleCondition.items.forEach((ruleTrigger) => {
67
- items.push(ruleTrigger);
68
- });
69
- }
70
- if (items) {
71
- items.forEach((ruleTrigger) => {
72
- if (ruleTrigger.assets && ruleTrigger.assets.attributes) {
73
- const geoNotifications = [];
74
- addGeoNotificationsFromAttributePredicateCondition(ruleTrigger.assets.attributes, geoNotifications);
75
- if (geoNotifications.length > 0) {
76
- const tagName = ruleTrigger.tag || index.toString();
77
- geoNotificationMap.set(tagName, geoNotifications);
78
- }
79
- }
80
- });
81
- }
82
- }
83
- function addGeoNotificationsFromAttributePredicateCondition(attributeCondition, geoNotifications) {
84
- if (!attributeCondition) {
85
- return;
86
- }
87
- attributeCondition.items.forEach((predicate) => {
88
- if (predicate.value && (predicate.value.predicateType === "radial" || predicate.value.predicateType === "rect")) {
89
- geoNotifications.push({
90
- predicate: predicate.value
91
- });
92
- }
93
- });
94
- if (attributeCondition.groups) {
95
- attributeCondition.groups.forEach((condition) => addGeoNotificationsFromAttributePredicateCondition(condition, geoNotifications));
96
- }
97
- }
98
- function addPushNotificationsFromRuleAction(ruleAction, geoPredicateMap) {
99
- if (ruleAction && ruleAction.action === "notification") {
100
- if (ruleAction.notification && ruleAction.notification.message && ruleAction.notification.message.type === "push") {
101
- // Find applicable targets
102
- const target = ruleAction.target;
103
- if (target && target.ruleConditionTag) {
104
- const geoNotifications = geoPredicateMap.get(target.ruleConditionTag);
105
- if (geoNotifications) {
106
- geoNotifications.forEach((geoNotification) => {
107
- geoNotification.notification = ruleAction.notification.message;
108
- });
109
- }
110
- }
111
- else {
112
- // Applies to all LHS rule triggers
113
- for (const geoNotifications of geoPredicateMap.values()) {
114
- geoNotifications.forEach((geoNotification) => {
115
- geoNotification.notification = ruleAction.notification.message;
116
- });
117
- }
118
- }
119
- }
120
- }
121
- }
122
- const TIME_DURATION_REGEXP = /([+-])?((\d+)[Dd])?\s*((\d+)[Hh])?\s*((\d+)[Mm]$)?\s*((\d+)[Ss])?\s*((\d+)([Mm][Ss]$))?\s*((\d+)[Ww])?\s*((\d+)[Mm][Nn])?\s*((\d+)[Yy])?/;
123
- export function isTimeDuration(time) {
124
- if (!time) {
125
- return false;
126
- }
127
- time = time.trim();
128
- return time.length > 0
129
- && (TIME_DURATION_REGEXP.test(time)
130
- || isTimeDurationPositiveInfinity(time)
131
- || isTimeDurationNegativeInfinity(time));
132
- }
133
- export function isTimeDurationPositiveInfinity(time) {
134
- time = time != null ? time.trim() : undefined;
135
- return "*" === time || "+*" === time;
136
- }
137
- export function isTimeDurationNegativeInfinity(time) {
138
- time = time != null ? time.trim() : undefined;
139
- return "-*" === time;
140
- }
141
- export function isObject(object) {
142
- if (!!object) {
143
- return typeof object === "object";
144
- }
145
- return false;
146
- }
147
- export function objectsEqual(obj1, obj2, deep = true) {
148
- if (obj1 === null || obj1 === undefined || obj2 === null || obj2 === undefined) {
149
- return obj1 === obj2;
150
- }
151
- // after this just checking type of one would be enough
152
- if (obj1.constructor !== obj2.constructor) {
153
- return false;
154
- }
155
- // if they are functions, they should exactly refer to same one (because of closures)
156
- if (obj1 instanceof Function) {
157
- return obj1 === obj2;
158
- }
159
- // if they are regexps, they should exactly refer to same one (it is hard to better equality check on current ES)
160
- if (obj1 instanceof RegExp) {
161
- return obj1 === obj2;
162
- }
163
- if (obj1 === obj2 || obj1.valueOf() === obj2.valueOf()) {
164
- return true;
165
- }
166
- if (Array.isArray(obj1) && obj1.length !== obj2.length) {
167
- return false;
168
- }
169
- // if they are dates, they must had equal valueOf
170
- if (obj1 instanceof Date) {
171
- return false;
172
- }
173
- // if they are strictly equal, they both need to be object at least
174
- if (!(obj1 instanceof Object)) {
175
- return false;
176
- }
177
- if (!(obj2 instanceof Object)) {
178
- return false;
179
- }
180
- if (deep) {
181
- // recursive object equality check
182
- const p = Object.keys(obj1);
183
- return Object.keys(obj2).every((i) => {
184
- return p.indexOf(i) !== -1;
185
- }) &&
186
- p.every((i) => {
187
- return objectsEqual(obj1[i], obj2[i]);
188
- });
189
- }
190
- return false;
191
- }
192
- export function arrayRemove(arr, item) {
193
- if (arr.length === 0) {
194
- return;
195
- }
196
- const index = arr.indexOf(item);
197
- if (index >= 0) {
198
- arr.splice(index, 1);
199
- }
200
- }
201
- export function enumContains(enm, val) {
202
- return enm && Object.values(enm).includes(val);
203
- }
204
- export function getEnumKeyAsString(enm, val) {
205
- // @ts-ignore
206
- const key = Object.keys(enm).find((k) => enm[k] === val);
207
- return key;
208
- }
209
- export function getAssetAttribute(asset, attributeName) {
210
- if (asset && asset.attributes && asset.attributes.hasOwnProperty(attributeName)) {
211
- const attr = Object.assign(Object.assign({}, asset.attributes[attributeName]), { name: attributeName, assetId: asset.id });
212
- return attr;
213
- }
214
- }
215
- export function getAssetAttributes(asset, exclude) {
216
- if (asset.attributes) {
217
- return Object.entries(asset.attributes).filter(([name, attr]) => !exclude || exclude.indexOf(name) >= 0).map(([name, attr]) => {
218
- attr = Object.assign(Object.assign({}, attr), { name: name, assetId: asset.id });
219
- return attr;
220
- });
221
- }
222
- return [];
223
- }
224
- export function getFirstMetaItem(attribute, name) {
225
- if (!attribute || !attribute.meta) {
226
- return;
227
- }
228
- return attribute.meta.find((metaItem) => metaItem.name === name);
229
- }
230
- export function hasMetaItem(attribute, name) {
231
- return !!getFirstMetaItem(attribute, name);
232
- }
233
- export function getMetaValue(metaItemUrn, attribute, descriptor, valueDescriptor) {
234
- const urn = typeof metaItemUrn === "string" ? metaItemUrn : metaItemUrn.urn;
235
- if (attribute && attribute.meta) {
236
- const metaItem = attribute.meta.find((mi) => mi.name === urn);
237
- if (metaItem) {
238
- return metaItem.value;
239
- }
240
- }
241
- if (descriptor && descriptor.metaItemDescriptors) {
242
- const metaItemDescriptor = descriptor.metaItemDescriptors.find((mid) => mid.urn === urn);
243
- if (metaItemDescriptor) {
244
- return metaItemDescriptor.initialValue;
245
- }
246
- }
247
- if (valueDescriptor && valueDescriptor.metaItemDescriptors) {
248
- const metaItemDescriptor = valueDescriptor.metaItemDescriptors.find((mid) => mid.urn === urn);
249
- if (metaItemDescriptor) {
250
- return metaItemDescriptor.initialValue;
251
- }
252
- }
253
- }
254
- export function getAttributeLabel(attribute, descriptor, valueDescriptor, showUnits, fallback) {
255
- if (!attribute && !descriptor) {
256
- return fallback || "";
257
- }
258
- const label = getMetaValue(MetaItemType.LABEL, attribute, descriptor, valueDescriptor);
259
- let units = showUnits ? getMetaValue(MetaItemType.UNIT_TYPE, attribute, descriptor, valueDescriptor) : undefined;
260
- units = units ? i18next.t(["units." + units, units]) : undefined;
261
- const name = attribute ? attribute.name : descriptor.attributeName;
262
- const keys = [];
263
- if (name) {
264
- keys.push("attribute." + name);
265
- keys.push(name);
266
- }
267
- if (label) {
268
- keys.push(label);
269
- }
270
- if (fallback) {
271
- keys.push(fallback);
272
- }
273
- return i18next.t(keys) + (units ? " (" + units + ")" : "");
274
- }
275
- export function getMetaItemLabel(urn) {
276
- return i18next.t(["metaItemType." + urn, urn], { nsSeparator: "@" });
277
- }
278
- export function getAttributeValueFormat(attribute, descriptor, valueDescriptor) {
279
- let format = getMetaValue(MetaItemType.FORMAT, attribute, descriptor, valueDescriptor);
280
- if (!format) {
281
- let valueType;
282
- if (attribute) {
283
- valueType = attribute.type;
284
- }
285
- if (valueDescriptor) {
286
- valueType = valueDescriptor.valueType;
287
- }
288
- else if (descriptor) {
289
- valueDescriptor = descriptor.valueDescriptor;
290
- // noinspection SuspiciousTypeOfGuard
291
- if (typeof valueDescriptor === "string") {
292
- valueDescriptor = AssetModelUtil.getAttributeValueDescriptor(valueDescriptor);
293
- }
294
- if (valueDescriptor) {
295
- valueType = valueDescriptor.valueType;
296
- }
297
- }
298
- if (valueType) {
299
- format = i18next.t("attributeValueType." + valueType);
300
- }
301
- }
302
- return format;
303
- }
304
- export function getAttributeValueFormatter() {
305
- return (value, format) => {
306
- return value === undefined || value === null ? "" : i18next.t((format ? [format, "%s"] : "%s"), { postProcess: "sprintf", sprintf: [value] });
307
- };
308
- }
309
- export function getAttributeValueFormatted(attribute, descriptor, valueDescriptor, fallback) {
310
- if (!attribute) {
311
- return fallback || "";
312
- }
313
- if (attribute.value === undefined || attribute.value === null) {
314
- return "";
315
- }
316
- const format = getAttributeValueFormat(attribute, descriptor, valueDescriptor);
317
- return getAttributeValueFormatter()(attribute.value, format);
318
- }
319
- /**
320
- * Immutable update of an asset using the supplied attribute event
321
- */
322
- export function updateAsset(asset, event) {
323
- const attributeName = event.attributeState.attributeRef.attributeName;
324
- if (asset.attributes) {
325
- if (event.attributeState.deleted) {
326
- delete asset.attributes[attributeName];
327
- }
328
- else {
329
- const attribute = getAssetAttribute(asset, attributeName);
330
- if (attribute) {
331
- attribute.value = event.attributeState.value;
332
- attribute.valueTimestamp = event.timestamp;
333
- }
334
- }
335
- }
336
- return Object.assign({}, asset);
337
- }
338
- export function loadJs(url) {
339
- return new Promise((resolve, reject) => {
340
- const script = document.createElement('script');
341
- script.type = 'text/javascript';
342
- script.src = url;
343
- script.addEventListener('load', (e) => resolve(e), false);
344
- script.addEventListener('error', (e) => reject(e), false);
345
- document.body.appendChild(script);
346
- });
347
- }
348
- ;
349
- export function sortByString(valueExtractor) {
350
- return (a, b) => {
351
- const v1 = valueExtractor(a);
352
- const v2 = valueExtractor(b);
353
- if (v1 > v2) {
354
- return 1;
355
- }
356
- if (v1 < v2) {
357
- return -1;
358
- }
359
- return 0;
360
- };
361
- }
362
- //# sourceMappingURL=util.js.map
@@ -1,34 +0,0 @@
1
- var fs = require('fs');
2
- var path = require("path");
3
- var xpath = require('xpath');
4
- var dom = require('xmldom').DOMParser;
5
-
6
- if (!fs.existsSync("src")){
7
- fs.mkdirSync("src");
8
- }
9
-
10
- let mdiSvgDir = path.join(path.dirname(require.resolve("@mdi/svg/package.json")), "svg");
11
- if (!fs.existsSync("dist")) {
12
- fs.mkdirSync("dist");
13
- }
14
- let mdiStream = fs.createWriteStream("./dist/mdi-icons.json" ,{flags: "w+"});
15
- mdiStream.write("{\"size\":24,\"icons\":{");
16
-
17
- let files = fs.readdirSync(mdiSvgDir).sort();
18
-
19
- for (let i=0; i<files.length; i++) {
20
-
21
- let file = files[i];
22
- let fullPath = path.join(mdiSvgDir, file);
23
- let data = fs.readFileSync(fullPath, "utf8");
24
- let svg = new dom().parseFromString(data);
25
- let select = xpath.useNamespaces({"svg": "http://www.w3.org/2000/svg"});
26
- let pathAttrs = select("//svg:path/@d", svg);
27
- let pathData = pathAttrs[0].value;
28
- let name = file.substr(0, file.length-4);
29
- //name = name.replace(/-([\w])/g, function (g) { return g[1].toUpperCase(); });
30
- mdiStream.write("\"" + name + "\":\"" + pathData + "\"" + (i < files.length-1 ? "," : ""));
31
- }
32
-
33
- mdiStream.write("}}");
34
- mdiStream.close();
package/tsconfig.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "extends": "../../tsconfig",
3
- "compilerOptions": {
4
- "outDir": "./dist",
5
- "tsBuildInfoFile": "./dist/.tsbuildinfo",
6
- "rootDir": "src"
7
- },
8
- "include": [
9
- "./src",
10
- "./@types"
11
- ],
12
- "references": [
13
- { "path": "../model" },
14
- { "path": "../rest" }
15
- ]
16
- }
package/typedoc.js DELETED
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- ... require('../../typedoc.js')
3
- };
package/webpack.config.js DELETED
@@ -1,16 +0,0 @@
1
- const util = require("../webpack.util");
2
-
3
- bundles = {
4
- "index": {
5
- vendor: {
6
- "moment": "moment"
7
- },
8
- excludeOr: true
9
- },
10
- "index.bundle": {
11
- excludeOr: true,
12
- },
13
- "index.orbundle": undefined
14
- };
15
-
16
- module.exports = util.generateExports(__dirname);
File without changes