@luzmo/embed 5.1.1 → 5.1.3-beta.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/index.cjs CHANGED
@@ -40,7 +40,8 @@ var __decorateClass = (decorators, target, key, kind) => {
40
40
  var src_exports = {};
41
41
  __export(src_exports, {
42
42
  LuzmoDashboard: () => LuzmoDashboard2,
43
- LuzmoEmbedDashboard: () => LuzmoEmbedDashboard
43
+ LuzmoEmbedDashboard: () => LuzmoEmbedDashboard,
44
+ LuzmoVizItem: () => LuzmoVizItem
44
45
  });
45
46
  module.exports = __toCommonJS(src_exports);
46
47
 
@@ -55,7 +56,7 @@ var import_style_map = require("lit/directives/style-map.js");
55
56
  var import_shared_embed = require("@luzmo/shared-embed");
56
57
 
57
58
  // libs/embed-libs/embed/package.json
58
- var version = "5.1.1";
59
+ var version = "5.1.3-beta.0";
59
60
 
60
61
  // libs/embed-libs/embed/src/lib/luzmo-service.ts
61
62
  var LuzmoService = class {
@@ -337,7 +338,7 @@ var dashboardStyles = import_lit.css`
337
338
 
338
339
  // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-base.ts
339
340
  var LuzmoDashboard = class extends import_lit2.LitElement {
340
- constructor(inputParameters) {
341
+ constructor() {
341
342
  super();
342
343
  this.language = "auto";
343
344
  this.screenMode = "auto";
@@ -356,10 +357,11 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
356
357
  this.browserErrorMsg = "";
357
358
  this.dashboardError = false;
358
359
  this.browserNotSupported = [];
359
- this.VERSION = version + "-wc-luzmo";
360
+ this.version = version + "-wc-luzmo";
360
361
  this.isLibraryLoaded = false;
361
362
  this.currentAuthKey = null;
362
363
  this.currentAuthToken = null;
364
+ this.isInitCalled = false;
363
365
  this.attributesMap = {
364
366
  dashboardId: "dashboard-id",
365
367
  dashboardSlug: "dashboard-slug",
@@ -389,7 +391,6 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
389
391
  this._iframeId = `luzmo-dashboard-${this._containerId}`;
390
392
  this.iframeLoaded = false;
391
393
  this.promises = {};
392
- this.setInputParameters(inputParameters);
393
394
  this.params = this._setOptions();
394
395
  this._onResize = () => {
395
396
  if (this.shadowRoot?.querySelector(".dashboard-container")) {
@@ -420,60 +421,6 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
420
421
  });
421
422
  });
422
423
  }
423
- loadLibrary(appServer) {
424
- if (import_shared_embed.remotesMap[appServer]) {
425
- return Promise.resolve(import_shared_embed.remotesMap[appServer].module);
426
- }
427
- import_shared_embed.remotesMap[appServer] = {
428
- url: appServer?.startsWith("http://localhost") ? `${SharedLib2.removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${SharedLib2.removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`,
429
- format: "esm",
430
- from: "vite",
431
- module: void 0
432
- };
433
- return (0, import_shared_embed.__federationMethodGetRemote)(appServer, "./DashboardApp").then((module2) => {
434
- const wrappedModule = (0, import_shared_embed.__federationMethodWrapDefault)(module2, true);
435
- import_shared_embed.remotesMap[appServer].module = wrappedModule;
436
- return wrappedModule;
437
- });
438
- }
439
- setInputParameters(inputParameters) {
440
- if (!inputParameters) {
441
- return;
442
- }
443
- const params = [
444
- "dashboardId",
445
- "dashboardSlug",
446
- "itemId",
447
- "language",
448
- "qeVersion",
449
- "screenMode",
450
- "switchScreenModeOnResize",
451
- "accentColor",
452
- "mainColor",
453
- "authToken",
454
- "authKey",
455
- "editMode",
456
- "loaderBackground",
457
- "loaderFontColor",
458
- "loaderSpinnerColor",
459
- "loaderSpinnerBackground",
460
- "timezoneId",
461
- "itemDimensions",
462
- "apiHost"
463
- ];
464
- for (const key of params) {
465
- const value = inputParameters[key];
466
- if (value) {
467
- this[key] = value;
468
- }
469
- }
470
- if (inputParameters.experimental) {
471
- this.experimental = inputParameters.experimental;
472
- }
473
- if (inputParameters.appServer) {
474
- this.appServer = SharedLib2.addTrailingSlash(inputParameters.appServer);
475
- }
476
- }
477
424
  // Set resize event listener
478
425
  connectedCallback() {
479
426
  super.connectedCallback();
@@ -492,7 +439,6 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
492
439
  this._loaderMsg = SharedLib2.getLoader(this)?.loadingMsg;
493
440
  this._loaderStyles();
494
441
  luzmo_service_default._components.push(this);
495
- this.initComponent();
496
442
  if (this.luzmoEmbedContainer) {
497
443
  this._resizeObserver.observe(this.luzmoEmbedContainer);
498
444
  }
@@ -500,7 +446,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
500
446
  initComponent() {
501
447
  this.params = this._setOptions();
502
448
  if (this.getIsViewMode()) {
503
- this.loadLibrary(this.params.appServer).then(async () => {
449
+ SharedLib2.loadLibrary(this.params.appServer).then(async () => {
504
450
  this.isLibraryLoaded = true;
505
451
  await this.updateComplete;
506
452
  const oldReference = this.renderRoot.querySelector("dashboard-component");
@@ -572,11 +518,21 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
572
518
  "timezoneId",
573
519
  "itemDimensions"
574
520
  ]);
521
+ const conditionsToCheck = ["dashboardId", "dashboardSlug", "itemId"];
522
+ let callInitComponent = false;
523
+ for (const condition of conditionsToCheck) {
524
+ callInitComponent = callInitComponent || changedProperties.get(condition) === void 0 && this[condition];
525
+ }
526
+ if (callInitComponent && !this.isInitCalled) {
527
+ this.initComponent();
528
+ this.isInitCalled = true;
529
+ return;
530
+ }
575
531
  if (this.getIsViewMode()) {
576
532
  if (this.dashboardReference) {
577
533
  for (const [propertyName] of changedProperties.entries()) {
578
534
  if (propertyName === "appSever") {
579
- this.loadLibrary(changedProperties[propertyName]).then(async () => {
535
+ SharedLib2.loadLibrary(changedProperties[propertyName]).then(async () => {
580
536
  this.isLibraryLoaded = true;
581
537
  await this.updateComplete;
582
538
  this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
@@ -1075,7 +1031,7 @@ __decorateClass([
1075
1031
  ], LuzmoDashboard.prototype, "browserNotSupported", 2);
1076
1032
  __decorateClass([
1077
1033
  (0, import_decorators.property)()
1078
- ], LuzmoDashboard.prototype, "VERSION", 2);
1034
+ ], LuzmoDashboard.prototype, "version", 2);
1079
1035
  __decorateClass([
1080
1036
  (0, import_decorators.state)()
1081
1037
  ], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
@@ -1088,6 +1044,9 @@ __decorateClass([
1088
1044
  __decorateClass([
1089
1045
  (0, import_decorators.state)()
1090
1046
  ], LuzmoDashboard.prototype, "currentAuthToken", 2);
1047
+ __decorateClass([
1048
+ (0, import_decorators.state)()
1049
+ ], LuzmoDashboard.prototype, "isInitCalled", 2);
1091
1050
 
1092
1051
  // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
1093
1052
  var LuzmoDashboard2 = class extends LuzmoDashboard {
@@ -1100,8 +1059,136 @@ var LuzmoEmbedDashboard = class extends LuzmoDashboard {
1100
1059
  LuzmoEmbedDashboard = __decorateClass([
1101
1060
  (0, import_decorators2.customElement)("luzmo-embed-dashboard")
1102
1061
  ], LuzmoEmbedDashboard);
1062
+
1063
+ // libs/embed-libs/embed/src/lib/viz-item/viz-item-component.ts
1064
+ var import_decorators4 = require("lit/decorators.js");
1065
+
1066
+ // libs/embed-libs/embed/src/lib/viz-item/viz-item.base.ts
1067
+ var import_decorators3 = require("lit/decorators.js");
1068
+ var import_lit3 = require("lit");
1069
+ var SharedLib3 = __toESM(require("@luzmo/shared-embed"), 1);
1070
+ var LuzmoBaseVizItem = class extends import_lit3.LitElement {
1071
+ constructor() {
1072
+ super();
1073
+ this.appServer = "https://app.luzmo.com";
1074
+ this.apiHost = "https://api.luzmo.com";
1075
+ this.slots = [];
1076
+ this.options = {
1077
+ title: {
1078
+ en: ""
1079
+ },
1080
+ theme: "default"
1081
+ };
1082
+ this.version = version + "-wc-luzmo";
1083
+ }
1084
+ static {
1085
+ // Static styles to set host display to block, else it is not shown at all for some reason.
1086
+ this.styles = import_lit3.css`
1087
+ :host {
1088
+ display: block;
1089
+ width: 100%;
1090
+ height: 100%;
1091
+ }
1092
+ `;
1093
+ }
1094
+ async firstUpdated(_changedProperties) {
1095
+ super.firstUpdated(_changedProperties);
1096
+ if (this.type) {
1097
+ await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
1098
+ this.createAndAppendElement();
1099
+ }
1100
+ }
1101
+ createAndAppendElement() {
1102
+ if (!this.chartElement) {
1103
+ this.chartElement = document.createElement("chart-component");
1104
+ this.chartElement.setAttribute("embedding-mode", "chart");
1105
+ this.updateVizItemProperties();
1106
+ this.renderRoot.append(this.chartElement);
1107
+ }
1108
+ }
1109
+ updateVizItemProperties() {
1110
+ if (this.chartElement) {
1111
+ for (const key in SharedLib3.libraryTypeToWebComponentTypeMapping) {
1112
+ const value = this[key];
1113
+ if (value) {
1114
+ const attributeValue = ["appServer", "apiHost"].includes(key) ? SharedLib3.removeTrailingSlash(value) : value;
1115
+ this.chartElement.setAttribute(
1116
+ SharedLib3.libraryTypeToWebComponentTypeMapping[key],
1117
+ typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
1118
+ );
1119
+ }
1120
+ }
1121
+ }
1122
+ }
1123
+ async updated(changedProperties) {
1124
+ if (this.chartElement) {
1125
+ for (const [propertyName] of changedProperties.entries()) {
1126
+ const mappedAttributeName = SharedLib3.libraryTypeToWebComponentTypeMapping[propertyName] ?? propertyName;
1127
+ const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
1128
+ this.chartElement.setAttribute(mappedAttributeName, attributeValue);
1129
+ }
1130
+ } else {
1131
+ if (this.type) {
1132
+ await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
1133
+ this.createAndAppendElement();
1134
+ }
1135
+ }
1136
+ }
1137
+ render() {
1138
+ return import_lit3.html` `;
1139
+ }
1140
+ };
1141
+ __decorateClass([
1142
+ (0, import_decorators3.property)()
1143
+ ], LuzmoBaseVizItem.prototype, "appServer", 2);
1144
+ __decorateClass([
1145
+ (0, import_decorators3.property)()
1146
+ ], LuzmoBaseVizItem.prototype, "apiHost", 2);
1147
+ __decorateClass([
1148
+ (0, import_decorators3.property)({ type: Array })
1149
+ ], LuzmoBaseVizItem.prototype, "slots", 2);
1150
+ __decorateClass([
1151
+ (0, import_decorators3.property)({ type: Object })
1152
+ ], LuzmoBaseVizItem.prototype, "options", 2);
1153
+ __decorateClass([
1154
+ (0, import_decorators3.property)()
1155
+ ], LuzmoBaseVizItem.prototype, "type", 2);
1156
+ __decorateClass([
1157
+ (0, import_decorators3.property)()
1158
+ ], LuzmoBaseVizItem.prototype, "authKey", 2);
1159
+ __decorateClass([
1160
+ (0, import_decorators3.property)()
1161
+ ], LuzmoBaseVizItem.prototype, "authToken", 2);
1162
+ __decorateClass([
1163
+ (0, import_decorators3.property)()
1164
+ ], LuzmoBaseVizItem.prototype, "version", 2);
1165
+ __decorateClass([
1166
+ (0, import_decorators3.property)()
1167
+ ], LuzmoBaseVizItem.prototype, "contextId", 2);
1168
+ __decorateClass([
1169
+ (0, import_decorators3.property)({
1170
+ converter: (value) => {
1171
+ try {
1172
+ return JSON.parse(value);
1173
+ } catch (exc) {
1174
+ return value;
1175
+ }
1176
+ }
1177
+ })
1178
+ ], LuzmoBaseVizItem.prototype, "canFilter", 2);
1179
+ __decorateClass([
1180
+ (0, import_decorators3.property)({ type: Array })
1181
+ ], LuzmoBaseVizItem.prototype, "filters", 2);
1182
+
1183
+ // libs/embed-libs/embed/src/lib/viz-item/viz-item-component.ts
1184
+ var LuzmoVizItem = class extends LuzmoBaseVizItem {
1185
+ };
1186
+ LuzmoVizItem = __decorateClass([
1187
+ (0, import_decorators4.customElement)("luzmo-viz-item")
1188
+ ], LuzmoVizItem);
1103
1189
  // Annotate the CommonJS export names for ESM import in node:
1104
1190
  0 && (module.exports = {
1105
1191
  LuzmoDashboard,
1106
- LuzmoEmbedDashboard
1192
+ LuzmoEmbedDashboard,
1193
+ LuzmoVizItem
1107
1194
  });
package/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export type { LoadEvent, ChangedFiltersEvent, CustomEvent, ItemsRenderedEvent, ExportedEvent, DashboardActionEvent, Filter, FilterExpression, FilterOrigin, FilterInput, FilterGroup, ExportType, ItemData, ExportDashboard, AccessibleDashboard, SetEditMode } from '@luzmo/shared-embed';
2
2
  export * from './lib/dashboard-component/dashboard-component';
3
+ export * from './lib/viz-item/viz-item-component';
package/index.js CHANGED
@@ -30,14 +30,11 @@ import {
30
30
  styleMap
31
31
  } from "lit/directives/style-map.js";
32
32
  import {
33
- __federationMethodGetRemote,
34
- __federationMethodWrapDefault,
35
- remotesMap,
36
33
  luzmoEmbedContainerClass
37
34
  } from "@luzmo/shared-embed";
38
35
 
39
36
  // libs/embed-libs/embed/package.json
40
- var version = "5.1.1";
37
+ var version = "5.1.3-beta.0";
41
38
 
42
39
  // libs/embed-libs/embed/src/lib/luzmo-service.ts
43
40
  var LuzmoService = class {
@@ -319,7 +316,7 @@ var dashboardStyles = css`
319
316
 
320
317
  // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-base.ts
321
318
  var LuzmoDashboard = class extends LitElement {
322
- constructor(inputParameters) {
319
+ constructor() {
323
320
  super();
324
321
  this.language = "auto";
325
322
  this.screenMode = "auto";
@@ -338,10 +335,11 @@ var LuzmoDashboard = class extends LitElement {
338
335
  this.browserErrorMsg = "";
339
336
  this.dashboardError = false;
340
337
  this.browserNotSupported = [];
341
- this.VERSION = version + "-wc-luzmo";
338
+ this.version = version + "-wc-luzmo";
342
339
  this.isLibraryLoaded = false;
343
340
  this.currentAuthKey = null;
344
341
  this.currentAuthToken = null;
342
+ this.isInitCalled = false;
345
343
  this.attributesMap = {
346
344
  dashboardId: "dashboard-id",
347
345
  dashboardSlug: "dashboard-slug",
@@ -371,7 +369,6 @@ var LuzmoDashboard = class extends LitElement {
371
369
  this._iframeId = `luzmo-dashboard-${this._containerId}`;
372
370
  this.iframeLoaded = false;
373
371
  this.promises = {};
374
- this.setInputParameters(inputParameters);
375
372
  this.params = this._setOptions();
376
373
  this._onResize = () => {
377
374
  if (this.shadowRoot?.querySelector(".dashboard-container")) {
@@ -402,60 +399,6 @@ var LuzmoDashboard = class extends LitElement {
402
399
  });
403
400
  });
404
401
  }
405
- loadLibrary(appServer) {
406
- if (remotesMap[appServer]) {
407
- return Promise.resolve(remotesMap[appServer].module);
408
- }
409
- remotesMap[appServer] = {
410
- url: appServer?.startsWith("http://localhost") ? `${SharedLib2.removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${SharedLib2.removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`,
411
- format: "esm",
412
- from: "vite",
413
- module: void 0
414
- };
415
- return __federationMethodGetRemote(appServer, "./DashboardApp").then((module) => {
416
- const wrappedModule = __federationMethodWrapDefault(module, true);
417
- remotesMap[appServer].module = wrappedModule;
418
- return wrappedModule;
419
- });
420
- }
421
- setInputParameters(inputParameters) {
422
- if (!inputParameters) {
423
- return;
424
- }
425
- const params = [
426
- "dashboardId",
427
- "dashboardSlug",
428
- "itemId",
429
- "language",
430
- "qeVersion",
431
- "screenMode",
432
- "switchScreenModeOnResize",
433
- "accentColor",
434
- "mainColor",
435
- "authToken",
436
- "authKey",
437
- "editMode",
438
- "loaderBackground",
439
- "loaderFontColor",
440
- "loaderSpinnerColor",
441
- "loaderSpinnerBackground",
442
- "timezoneId",
443
- "itemDimensions",
444
- "apiHost"
445
- ];
446
- for (const key of params) {
447
- const value = inputParameters[key];
448
- if (value) {
449
- this[key] = value;
450
- }
451
- }
452
- if (inputParameters.experimental) {
453
- this.experimental = inputParameters.experimental;
454
- }
455
- if (inputParameters.appServer) {
456
- this.appServer = SharedLib2.addTrailingSlash(inputParameters.appServer);
457
- }
458
- }
459
402
  // Set resize event listener
460
403
  connectedCallback() {
461
404
  super.connectedCallback();
@@ -474,7 +417,6 @@ var LuzmoDashboard = class extends LitElement {
474
417
  this._loaderMsg = SharedLib2.getLoader(this)?.loadingMsg;
475
418
  this._loaderStyles();
476
419
  luzmo_service_default._components.push(this);
477
- this.initComponent();
478
420
  if (this.luzmoEmbedContainer) {
479
421
  this._resizeObserver.observe(this.luzmoEmbedContainer);
480
422
  }
@@ -482,7 +424,7 @@ var LuzmoDashboard = class extends LitElement {
482
424
  initComponent() {
483
425
  this.params = this._setOptions();
484
426
  if (this.getIsViewMode()) {
485
- this.loadLibrary(this.params.appServer).then(async () => {
427
+ SharedLib2.loadLibrary(this.params.appServer).then(async () => {
486
428
  this.isLibraryLoaded = true;
487
429
  await this.updateComplete;
488
430
  const oldReference = this.renderRoot.querySelector("dashboard-component");
@@ -554,11 +496,21 @@ var LuzmoDashboard = class extends LitElement {
554
496
  "timezoneId",
555
497
  "itemDimensions"
556
498
  ]);
499
+ const conditionsToCheck = ["dashboardId", "dashboardSlug", "itemId"];
500
+ let callInitComponent = false;
501
+ for (const condition of conditionsToCheck) {
502
+ callInitComponent = callInitComponent || changedProperties.get(condition) === void 0 && this[condition];
503
+ }
504
+ if (callInitComponent && !this.isInitCalled) {
505
+ this.initComponent();
506
+ this.isInitCalled = true;
507
+ return;
508
+ }
557
509
  if (this.getIsViewMode()) {
558
510
  if (this.dashboardReference) {
559
511
  for (const [propertyName] of changedProperties.entries()) {
560
512
  if (propertyName === "appSever") {
561
- this.loadLibrary(changedProperties[propertyName]).then(async () => {
513
+ SharedLib2.loadLibrary(changedProperties[propertyName]).then(async () => {
562
514
  this.isLibraryLoaded = true;
563
515
  await this.updateComplete;
564
516
  this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
@@ -1057,7 +1009,7 @@ __decorateClass([
1057
1009
  ], LuzmoDashboard.prototype, "browserNotSupported", 2);
1058
1010
  __decorateClass([
1059
1011
  property()
1060
- ], LuzmoDashboard.prototype, "VERSION", 2);
1012
+ ], LuzmoDashboard.prototype, "version", 2);
1061
1013
  __decorateClass([
1062
1014
  state()
1063
1015
  ], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
@@ -1070,6 +1022,9 @@ __decorateClass([
1070
1022
  __decorateClass([
1071
1023
  state()
1072
1024
  ], LuzmoDashboard.prototype, "currentAuthToken", 2);
1025
+ __decorateClass([
1026
+ state()
1027
+ ], LuzmoDashboard.prototype, "isInitCalled", 2);
1073
1028
 
1074
1029
  // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
1075
1030
  var LuzmoDashboard2 = class extends LuzmoDashboard {
@@ -1082,7 +1037,135 @@ var LuzmoEmbedDashboard = class extends LuzmoDashboard {
1082
1037
  LuzmoEmbedDashboard = __decorateClass([
1083
1038
  customElement("luzmo-embed-dashboard")
1084
1039
  ], LuzmoEmbedDashboard);
1040
+
1041
+ // libs/embed-libs/embed/src/lib/viz-item/viz-item-component.ts
1042
+ import { customElement as customElement3 } from "lit/decorators.js";
1043
+
1044
+ // libs/embed-libs/embed/src/lib/viz-item/viz-item.base.ts
1045
+ import { property as property2 } from "lit/decorators.js";
1046
+ import { LitElement as LitElement2, html as html2, css as css2 } from "lit";
1047
+ import * as SharedLib3 from "@luzmo/shared-embed";
1048
+ var LuzmoBaseVizItem = class extends LitElement2 {
1049
+ constructor() {
1050
+ super();
1051
+ this.appServer = "https://app.luzmo.com";
1052
+ this.apiHost = "https://api.luzmo.com";
1053
+ this.slots = [];
1054
+ this.options = {
1055
+ title: {
1056
+ en: ""
1057
+ },
1058
+ theme: "default"
1059
+ };
1060
+ this.version = version + "-wc-luzmo";
1061
+ }
1062
+ static {
1063
+ // Static styles to set host display to block, else it is not shown at all for some reason.
1064
+ this.styles = css2`
1065
+ :host {
1066
+ display: block;
1067
+ width: 100%;
1068
+ height: 100%;
1069
+ }
1070
+ `;
1071
+ }
1072
+ async firstUpdated(_changedProperties) {
1073
+ super.firstUpdated(_changedProperties);
1074
+ if (this.type) {
1075
+ await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
1076
+ this.createAndAppendElement();
1077
+ }
1078
+ }
1079
+ createAndAppendElement() {
1080
+ if (!this.chartElement) {
1081
+ this.chartElement = document.createElement("chart-component");
1082
+ this.chartElement.setAttribute("embedding-mode", "chart");
1083
+ this.updateVizItemProperties();
1084
+ this.renderRoot.append(this.chartElement);
1085
+ }
1086
+ }
1087
+ updateVizItemProperties() {
1088
+ if (this.chartElement) {
1089
+ for (const key in SharedLib3.libraryTypeToWebComponentTypeMapping) {
1090
+ const value = this[key];
1091
+ if (value) {
1092
+ const attributeValue = ["appServer", "apiHost"].includes(key) ? SharedLib3.removeTrailingSlash(value) : value;
1093
+ this.chartElement.setAttribute(
1094
+ SharedLib3.libraryTypeToWebComponentTypeMapping[key],
1095
+ typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
1096
+ );
1097
+ }
1098
+ }
1099
+ }
1100
+ }
1101
+ async updated(changedProperties) {
1102
+ if (this.chartElement) {
1103
+ for (const [propertyName] of changedProperties.entries()) {
1104
+ const mappedAttributeName = SharedLib3.libraryTypeToWebComponentTypeMapping[propertyName] ?? propertyName;
1105
+ const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
1106
+ this.chartElement.setAttribute(mappedAttributeName, attributeValue);
1107
+ }
1108
+ } else {
1109
+ if (this.type) {
1110
+ await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
1111
+ this.createAndAppendElement();
1112
+ }
1113
+ }
1114
+ }
1115
+ render() {
1116
+ return html2` `;
1117
+ }
1118
+ };
1119
+ __decorateClass([
1120
+ property2()
1121
+ ], LuzmoBaseVizItem.prototype, "appServer", 2);
1122
+ __decorateClass([
1123
+ property2()
1124
+ ], LuzmoBaseVizItem.prototype, "apiHost", 2);
1125
+ __decorateClass([
1126
+ property2({ type: Array })
1127
+ ], LuzmoBaseVizItem.prototype, "slots", 2);
1128
+ __decorateClass([
1129
+ property2({ type: Object })
1130
+ ], LuzmoBaseVizItem.prototype, "options", 2);
1131
+ __decorateClass([
1132
+ property2()
1133
+ ], LuzmoBaseVizItem.prototype, "type", 2);
1134
+ __decorateClass([
1135
+ property2()
1136
+ ], LuzmoBaseVizItem.prototype, "authKey", 2);
1137
+ __decorateClass([
1138
+ property2()
1139
+ ], LuzmoBaseVizItem.prototype, "authToken", 2);
1140
+ __decorateClass([
1141
+ property2()
1142
+ ], LuzmoBaseVizItem.prototype, "version", 2);
1143
+ __decorateClass([
1144
+ property2()
1145
+ ], LuzmoBaseVizItem.prototype, "contextId", 2);
1146
+ __decorateClass([
1147
+ property2({
1148
+ converter: (value) => {
1149
+ try {
1150
+ return JSON.parse(value);
1151
+ } catch (exc) {
1152
+ return value;
1153
+ }
1154
+ }
1155
+ })
1156
+ ], LuzmoBaseVizItem.prototype, "canFilter", 2);
1157
+ __decorateClass([
1158
+ property2({ type: Array })
1159
+ ], LuzmoBaseVizItem.prototype, "filters", 2);
1160
+
1161
+ // libs/embed-libs/embed/src/lib/viz-item/viz-item-component.ts
1162
+ var LuzmoVizItem = class extends LuzmoBaseVizItem {
1163
+ };
1164
+ LuzmoVizItem = __decorateClass([
1165
+ customElement3("luzmo-viz-item")
1166
+ ], LuzmoVizItem);
1085
1167
  export {
1086
1168
  LuzmoDashboard2 as LuzmoDashboard,
1087
- LuzmoEmbedDashboard
1169
+ LuzmoEmbedDashboard,
1170
+ LuzmoVizItem
1088
1171
  };