@luzmo/embed 5.1.0-beta.4 → 5.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.libs.js CHANGED
@@ -28,11 +28,14 @@ import {
28
28
  styleMap
29
29
  } from "lit/directives/style-map.js";
30
30
  import {
31
+ __federationMethodGetRemote,
32
+ __federationMethodWrapDefault,
33
+ remotesMap,
31
34
  luzmoEmbedContainerClass
32
35
  } from "@luzmo/shared-embed";
33
36
 
34
37
  // libs/embed-libs/embed/package.json
35
- var version = "5.1.0-beta.4";
38
+ var version = "5.1.1";
36
39
 
37
40
  // libs/embed-libs/embed/src/lib/luzmo-service.ts
38
41
  var LuzmoService = class {
@@ -333,7 +336,7 @@ var LuzmoDashboard = class extends LitElement {
333
336
  this.browserErrorMsg = "";
334
337
  this.dashboardError = false;
335
338
  this.browserNotSupported = [];
336
- this.version = version + "-wc-luzmo";
339
+ this.VERSION = version + "-wc-luzmo";
337
340
  this.isLibraryLoaded = false;
338
341
  this.currentAuthKey = null;
339
342
  this.currentAuthToken = null;
@@ -397,6 +400,22 @@ var LuzmoDashboard = class extends LitElement {
397
400
  });
398
401
  });
399
402
  }
403
+ loadLibrary(appServer) {
404
+ if (remotesMap[appServer]) {
405
+ return Promise.resolve(remotesMap[appServer].module);
406
+ }
407
+ remotesMap[appServer] = {
408
+ url: appServer?.startsWith("http://localhost") ? `${SharedLib2.removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${SharedLib2.removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`,
409
+ format: "esm",
410
+ from: "vite",
411
+ module: void 0
412
+ };
413
+ return __federationMethodGetRemote(appServer, "./DashboardApp").then((module) => {
414
+ const wrappedModule = __federationMethodWrapDefault(module, true);
415
+ remotesMap[appServer].module = wrappedModule;
416
+ return wrappedModule;
417
+ });
418
+ }
400
419
  setInputParameters(inputParameters) {
401
420
  if (!inputParameters) {
402
421
  return;
@@ -461,7 +480,7 @@ var LuzmoDashboard = class extends LitElement {
461
480
  initComponent() {
462
481
  this.params = this._setOptions();
463
482
  if (this.getIsViewMode()) {
464
- SharedLib2.loadLibrary(this.params.appServer).then(async () => {
483
+ this.loadLibrary(this.params.appServer).then(async () => {
465
484
  this.isLibraryLoaded = true;
466
485
  await this.updateComplete;
467
486
  const oldReference = this.renderRoot.querySelector("dashboard-component");
@@ -537,7 +556,7 @@ var LuzmoDashboard = class extends LitElement {
537
556
  if (this.dashboardReference) {
538
557
  for (const [propertyName] of changedProperties.entries()) {
539
558
  if (propertyName === "appSever") {
540
- SharedLib2.loadLibrary(changedProperties[propertyName]).then(async () => {
559
+ this.loadLibrary(changedProperties[propertyName]).then(async () => {
541
560
  this.isLibraryLoaded = true;
542
561
  await this.updateComplete;
543
562
  this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
@@ -1036,7 +1055,7 @@ __decorateClass([
1036
1055
  ], LuzmoDashboard.prototype, "browserNotSupported", 2);
1037
1056
  __decorateClass([
1038
1057
  property()
1039
- ], LuzmoDashboard.prototype, "version", 2);
1058
+ ], LuzmoDashboard.prototype, "VERSION", 2);
1040
1059
  __decorateClass([
1041
1060
  state()
1042
1061
  ], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
@@ -1056,134 +1075,6 @@ var LuzmoDashboardWebComponent = class extends LuzmoDashboard {
1056
1075
  LuzmoDashboardWebComponent = __decorateClass([
1057
1076
  customElement("luzmo-dashboard-web-component")
1058
1077
  ], LuzmoDashboardWebComponent);
1059
-
1060
- // libs/embed-libs/embed/src/lib/viz-item/viz-item-web-component.ts
1061
- import { customElement as customElement3 } from "lit/decorators.js";
1062
-
1063
- // libs/embed-libs/embed/src/lib/viz-item/viz-item.base.ts
1064
- import { property as property2 } from "lit/decorators.js";
1065
- import { LitElement as LitElement2, html as html2, css as css2 } from "lit";
1066
- import * as SharedLib3 from "@luzmo/shared-embed";
1067
- var LuzmoBaseVizItem = class extends LitElement2 {
1068
- constructor() {
1069
- super();
1070
- this.appServer = "https://app.luzmo.com";
1071
- this.apiHost = "https://api.luzmo.com";
1072
- this.slots = [];
1073
- this.options = {
1074
- title: {
1075
- en: ""
1076
- },
1077
- theme: "default"
1078
- };
1079
- this.version = version + "-wc-luzmo";
1080
- }
1081
- static {
1082
- // Static styles to set host display to block, else it is not shown at all for some reason.
1083
- this.styles = css2`
1084
- :host {
1085
- display: block;
1086
- width: 100%;
1087
- height: 100%;
1088
- }
1089
- `;
1090
- }
1091
- async firstUpdated(_changedProperties) {
1092
- super.firstUpdated(_changedProperties);
1093
- if (this.type) {
1094
- await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
1095
- this.createAndAppendElement();
1096
- }
1097
- }
1098
- createAndAppendElement() {
1099
- if (!this.chartElement) {
1100
- this.chartElement = document.createElement("chart-component");
1101
- this.chartElement.setAttribute("embedding-mode", "chart");
1102
- this.updateVizItemProperties();
1103
- this.renderRoot.append(this.chartElement);
1104
- }
1105
- }
1106
- updateVizItemProperties() {
1107
- if (this.chartElement) {
1108
- for (const key in SharedLib3.libraryTypeToWebComponentTypeMapping) {
1109
- const value = this[key];
1110
- if (value) {
1111
- const attributeValue = ["appServer", "apiHost"].includes(key) ? SharedLib3.removeTrailingSlash(value) : value;
1112
- this.chartElement.setAttribute(
1113
- SharedLib3.libraryTypeToWebComponentTypeMapping[key],
1114
- typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
1115
- );
1116
- }
1117
- }
1118
- }
1119
- }
1120
- async updated(changedProperties) {
1121
- if (this.chartElement) {
1122
- for (const [propertyName] of changedProperties.entries()) {
1123
- const mappedAttributeName = SharedLib3.libraryTypeToWebComponentTypeMapping[propertyName] ?? propertyName;
1124
- const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
1125
- this.chartElement.setAttribute(mappedAttributeName, attributeValue);
1126
- }
1127
- } else {
1128
- if (this.type) {
1129
- await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
1130
- this.createAndAppendElement();
1131
- }
1132
- }
1133
- }
1134
- render() {
1135
- return html2` `;
1136
- }
1137
- };
1138
- __decorateClass([
1139
- property2()
1140
- ], LuzmoBaseVizItem.prototype, "appServer", 2);
1141
- __decorateClass([
1142
- property2()
1143
- ], LuzmoBaseVizItem.prototype, "apiHost", 2);
1144
- __decorateClass([
1145
- property2({ type: Array })
1146
- ], LuzmoBaseVizItem.prototype, "slots", 2);
1147
- __decorateClass([
1148
- property2({ type: Object })
1149
- ], LuzmoBaseVizItem.prototype, "options", 2);
1150
- __decorateClass([
1151
- property2()
1152
- ], LuzmoBaseVizItem.prototype, "type", 2);
1153
- __decorateClass([
1154
- property2()
1155
- ], LuzmoBaseVizItem.prototype, "authKey", 2);
1156
- __decorateClass([
1157
- property2()
1158
- ], LuzmoBaseVizItem.prototype, "authToken", 2);
1159
- __decorateClass([
1160
- property2()
1161
- ], LuzmoBaseVizItem.prototype, "version", 2);
1162
- __decorateClass([
1163
- property2()
1164
- ], LuzmoBaseVizItem.prototype, "contextId", 2);
1165
- __decorateClass([
1166
- property2({
1167
- converter: (value) => {
1168
- try {
1169
- return JSON.parse(value);
1170
- } catch (exc) {
1171
- return value;
1172
- }
1173
- }
1174
- })
1175
- ], LuzmoBaseVizItem.prototype, "canFilter", 2);
1176
- __decorateClass([
1177
- property2({ type: Array })
1178
- ], LuzmoBaseVizItem.prototype, "filters", 2);
1179
-
1180
- // libs/embed-libs/embed/src/lib/viz-item/viz-item-web-component.ts
1181
- var LuzmoVizItemWebComponent = class extends LuzmoBaseVizItem {
1182
- };
1183
- LuzmoVizItemWebComponent = __decorateClass([
1184
- customElement3("luzmo-viz-item-web-component")
1185
- ], LuzmoVizItemWebComponent);
1186
1078
  export {
1187
- LuzmoDashboardWebComponent,
1188
- LuzmoVizItemWebComponent
1079
+ LuzmoDashboardWebComponent
1189
1080
  };
@@ -51,7 +51,7 @@ export declare class LuzmoDashboard extends LitElement implements SharedLib.ES6L
51
51
  browserErrorMsg: string;
52
52
  dashboardError: boolean;
53
53
  browserNotSupported: any[];
54
- version: string;
54
+ VERSION: string;
55
55
  protected isLibraryLoaded: boolean;
56
56
  protected dashboardReference: SharedLib.LuzmoElement;
57
57
  currentAuthKey: string;
@@ -66,6 +66,7 @@ export declare class LuzmoDashboard extends LitElement implements SharedLib.ES6L
66
66
  iframeWidth?: string;
67
67
  _resizeObserver: ResizeObserver;
68
68
  constructor(inputParameters?: Record<keyof LuzmoDashboard, any>);
69
+ private loadLibrary;
69
70
  private setInputParameters;
70
71
  connectedCallback(): void;
71
72
  disconnectedCallback(): void;
@@ -42,8 +42,7 @@ var __decorateClass = (decorators, target, key, kind) => {
42
42
  // libs/embed-libs/embed/src/index.libs.ts
43
43
  var index_libs_exports = {};
44
44
  __export(index_libs_exports, {
45
- LuzmoDashboardWebComponent: () => LuzmoDashboardWebComponent,
46
- LuzmoVizItemWebComponent: () => LuzmoVizItemWebComponent
45
+ LuzmoDashboardWebComponent: () => LuzmoDashboardWebComponent
47
46
  });
48
47
  module.exports = __toCommonJS(index_libs_exports);
49
48
 
@@ -1490,21 +1489,6 @@ var _extendAndValidate = (dashboardContent) => {
1490
1489
  }
1491
1490
  };
1492
1491
 
1493
- // libs/embed-libs/shared-embed/src/lib/models/viz-item.model.ts
1494
- var libraryTypeToWebComponentTypeMapping = {
1495
- type: "type",
1496
- theme: "theme",
1497
- slots: "slots",
1498
- options: "options",
1499
- appServer: "app-server",
1500
- apiHost: "api-host",
1501
- authKey: "auth-key",
1502
- authToken: "auth-token",
1503
- contextId: "context-id",
1504
- canFilter: "can-filter",
1505
- filters: "filters"
1506
- };
1507
-
1508
1492
  // libs/embed-libs/shared-embed/src/lib/constants/class-constants.ts
1509
1493
  var luzmoEmbedContainerClass = "luzmo-embed-container";
1510
1494
 
@@ -1572,21 +1556,6 @@ function __federationMethodWrapDefault(module2, need) {
1572
1556
  async function __federationMethodGetRemote(remoteName, componentName) {
1573
1557
  return __federationMethodEnsure(remoteName).then((remote) => remote.get(componentName).then((factory) => factory()));
1574
1558
  }
1575
- async function loadLibrary(appServer, componentName = "DashboardApp") {
1576
- if (remotesMap[appServer]) {
1577
- return remotesMap[appServer].module;
1578
- }
1579
- remotesMap[appServer] = {
1580
- url: appServer?.startsWith("http://localhost") ? `${removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`,
1581
- format: "esm",
1582
- from: "vite",
1583
- module: void 0
1584
- };
1585
- const module2 = await __federationMethodGetRemote(appServer, `./${componentName}`);
1586
- const wrappedModule = __federationMethodWrapDefault(module2, true);
1587
- remotesMap[appServer].module = wrappedModule;
1588
- return wrappedModule;
1589
- }
1590
1559
 
1591
1560
  // node_modules/lit-html/lit-html.js
1592
1561
  var t3 = globalThis;
@@ -1937,7 +1906,7 @@ var o5 = e6(class extends i4 {
1937
1906
  });
1938
1907
 
1939
1908
  // libs/embed-libs/embed/package.json
1940
- var version = "5.1.0-beta.4";
1909
+ var version = "5.1.1";
1941
1910
 
1942
1911
  // libs/embed-libs/embed/src/lib/luzmo-service.ts
1943
1912
  var LuzmoService = class {
@@ -2236,7 +2205,7 @@ var LuzmoDashboard = class extends s3 {
2236
2205
  this.browserErrorMsg = "";
2237
2206
  this.dashboardError = false;
2238
2207
  this.browserNotSupported = [];
2239
- this.version = version + "-wc-luzmo";
2208
+ this.VERSION = version + "-wc-luzmo";
2240
2209
  this.isLibraryLoaded = false;
2241
2210
  this.currentAuthKey = null;
2242
2211
  this.currentAuthToken = null;
@@ -2300,6 +2269,22 @@ var LuzmoDashboard = class extends s3 {
2300
2269
  });
2301
2270
  });
2302
2271
  }
2272
+ loadLibrary(appServer) {
2273
+ if (remotesMap[appServer]) {
2274
+ return Promise.resolve(remotesMap[appServer].module);
2275
+ }
2276
+ remotesMap[appServer] = {
2277
+ url: appServer?.startsWith("http://localhost") ? `${removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`,
2278
+ format: "esm",
2279
+ from: "vite",
2280
+ module: void 0
2281
+ };
2282
+ return __federationMethodGetRemote(appServer, "./DashboardApp").then((module2) => {
2283
+ const wrappedModule = __federationMethodWrapDefault(module2, true);
2284
+ remotesMap[appServer].module = wrappedModule;
2285
+ return wrappedModule;
2286
+ });
2287
+ }
2303
2288
  setInputParameters(inputParameters) {
2304
2289
  if (!inputParameters) {
2305
2290
  return;
@@ -2364,7 +2349,7 @@ var LuzmoDashboard = class extends s3 {
2364
2349
  initComponent() {
2365
2350
  this.params = this._setOptions();
2366
2351
  if (this.getIsViewMode()) {
2367
- loadLibrary(this.params.appServer).then(async () => {
2352
+ this.loadLibrary(this.params.appServer).then(async () => {
2368
2353
  this.isLibraryLoaded = true;
2369
2354
  await this.updateComplete;
2370
2355
  const oldReference = this.renderRoot.querySelector("dashboard-component");
@@ -2440,7 +2425,7 @@ var LuzmoDashboard = class extends s3 {
2440
2425
  if (this.dashboardReference) {
2441
2426
  for (const [propertyName] of changedProperties.entries()) {
2442
2427
  if (propertyName === "appSever") {
2443
- loadLibrary(changedProperties[propertyName]).then(async () => {
2428
+ this.loadLibrary(changedProperties[propertyName]).then(async () => {
2444
2429
  this.isLibraryLoaded = true;
2445
2430
  await this.updateComplete;
2446
2431
  this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
@@ -2939,7 +2924,7 @@ __decorateClass([
2939
2924
  ], LuzmoDashboard.prototype, "browserNotSupported", 2);
2940
2925
  __decorateClass([
2941
2926
  n3()
2942
- ], LuzmoDashboard.prototype, "version", 2);
2927
+ ], LuzmoDashboard.prototype, "VERSION", 2);
2943
2928
  __decorateClass([
2944
2929
  r4()
2945
2930
  ], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
@@ -2959,127 +2944,6 @@ var LuzmoDashboardWebComponent = class extends LuzmoDashboard {
2959
2944
  LuzmoDashboardWebComponent = __decorateClass([
2960
2945
  t("luzmo-dashboard-web-component")
2961
2946
  ], LuzmoDashboardWebComponent);
2962
-
2963
- // libs/embed-libs/embed/src/lib/viz-item/viz-item.base.ts
2964
- var LuzmoBaseVizItem = class extends s3 {
2965
- constructor() {
2966
- super();
2967
- this.appServer = "https://app.luzmo.com";
2968
- this.apiHost = "https://api.luzmo.com";
2969
- this.slots = [];
2970
- this.options = {
2971
- title: {
2972
- en: ""
2973
- },
2974
- theme: "default"
2975
- };
2976
- this.version = version + "-wc-luzmo";
2977
- }
2978
- static {
2979
- // Static styles to set host display to block, else it is not shown at all for some reason.
2980
- this.styles = i`
2981
- :host {
2982
- display: block;
2983
- width: 100%;
2984
- height: 100%;
2985
- }
2986
- `;
2987
- }
2988
- async firstUpdated(_changedProperties) {
2989
- super.firstUpdated(_changedProperties);
2990
- if (this.type) {
2991
- await loadLibrary(this.appServer, "DashboardApp");
2992
- this.createAndAppendElement();
2993
- }
2994
- }
2995
- createAndAppendElement() {
2996
- if (!this.chartElement) {
2997
- this.chartElement = document.createElement("chart-component");
2998
- this.chartElement.setAttribute("embedding-mode", "chart");
2999
- this.updateVizItemProperties();
3000
- this.renderRoot.append(this.chartElement);
3001
- }
3002
- }
3003
- updateVizItemProperties() {
3004
- if (this.chartElement) {
3005
- for (const key in libraryTypeToWebComponentTypeMapping) {
3006
- const value = this[key];
3007
- if (value) {
3008
- const attributeValue = ["appServer", "apiHost"].includes(key) ? removeTrailingSlash(value) : value;
3009
- this.chartElement.setAttribute(
3010
- libraryTypeToWebComponentTypeMapping[key],
3011
- typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
3012
- );
3013
- }
3014
- }
3015
- }
3016
- }
3017
- async updated(changedProperties) {
3018
- if (this.chartElement) {
3019
- for (const [propertyName] of changedProperties.entries()) {
3020
- const mappedAttributeName = libraryTypeToWebComponentTypeMapping[propertyName] ?? propertyName;
3021
- const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
3022
- this.chartElement.setAttribute(mappedAttributeName, attributeValue);
3023
- }
3024
- } else {
3025
- if (this.type) {
3026
- await loadLibrary(this.appServer, "DashboardApp");
3027
- this.createAndAppendElement();
3028
- }
3029
- }
3030
- }
3031
- render() {
3032
- return x` `;
3033
- }
3034
- };
3035
- __decorateClass([
3036
- n3()
3037
- ], LuzmoBaseVizItem.prototype, "appServer", 2);
3038
- __decorateClass([
3039
- n3()
3040
- ], LuzmoBaseVizItem.prototype, "apiHost", 2);
3041
- __decorateClass([
3042
- n3({ type: Array })
3043
- ], LuzmoBaseVizItem.prototype, "slots", 2);
3044
- __decorateClass([
3045
- n3({ type: Object })
3046
- ], LuzmoBaseVizItem.prototype, "options", 2);
3047
- __decorateClass([
3048
- n3()
3049
- ], LuzmoBaseVizItem.prototype, "type", 2);
3050
- __decorateClass([
3051
- n3()
3052
- ], LuzmoBaseVizItem.prototype, "authKey", 2);
3053
- __decorateClass([
3054
- n3()
3055
- ], LuzmoBaseVizItem.prototype, "authToken", 2);
3056
- __decorateClass([
3057
- n3()
3058
- ], LuzmoBaseVizItem.prototype, "version", 2);
3059
- __decorateClass([
3060
- n3()
3061
- ], LuzmoBaseVizItem.prototype, "contextId", 2);
3062
- __decorateClass([
3063
- n3({
3064
- converter: (value) => {
3065
- try {
3066
- return JSON.parse(value);
3067
- } catch (exc) {
3068
- return value;
3069
- }
3070
- }
3071
- })
3072
- ], LuzmoBaseVizItem.prototype, "canFilter", 2);
3073
- __decorateClass([
3074
- n3({ type: Array })
3075
- ], LuzmoBaseVizItem.prototype, "filters", 2);
3076
-
3077
- // libs/embed-libs/embed/src/lib/viz-item/viz-item-web-component.ts
3078
- var LuzmoVizItemWebComponent = class extends LuzmoBaseVizItem {
3079
- };
3080
- LuzmoVizItemWebComponent = __decorateClass([
3081
- t("luzmo-viz-item-web-component")
3082
- ], LuzmoVizItemWebComponent);
3083
2947
  /*! Bundled license information:
3084
2948
 
3085
2949
  @lit/reactive-element/decorators/custom-element.js: