@viamedici-spc/configurator-framer-host 1.2.0-alpha0003 → 1.2.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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export declare class EmbeddedConfiguratorNative extends HTMLElement {
2
- static readonly proxyBaseUrl = "https://spc.cloud.ceventis.de/framer/host-proxy";
2
+ static readonly proxyBaseUrl = "https://spc.viamedici.io/framer/host-proxy";
3
3
  static readonly attributeNames: string[];
4
4
  static get observedAttributes(): string[];
5
5
  private src;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- function x(s) {
1
+ function E(s) {
2
2
  var e = [];
3
3
  if (s.length === 0)
4
4
  return "";
@@ -20,28 +20,28 @@ function x(s) {
20
20
  var a = n.split("?");
21
21
  return n = a.shift() + (a.length > 0 ? "?" : "") + a.join("&"), n;
22
22
  }
23
- function S() {
23
+ function w() {
24
24
  var s;
25
- return typeof arguments[0] == "object" ? s = arguments[0] : s = [].slice.call(arguments), x(s);
25
+ return typeof arguments[0] == "object" ? s = arguments[0] : s = [].slice.call(arguments), E(s);
26
26
  }
27
- const m = class u extends HTMLElement {
27
+ const m = class d extends HTMLElement {
28
28
  constructor() {
29
- super(), this.src = null, this.proxyBaseUrl = u.proxyBaseUrl, this.hasConnected = !1;
29
+ super(), this.src = null, this.proxyBaseUrl = d.proxyBaseUrl, this.hasConnected = !1;
30
30
  }
31
31
  static get observedAttributes() {
32
- return u.attributeNames;
32
+ return d.attributeNames;
33
33
  }
34
34
  connectedCallback() {
35
35
  this.hasConnected = !0, this.src && (console.log("[Configurator] Web Component connected -> reinitialize the configurator app."), this.bootstrapApp());
36
36
  }
37
37
  attributeChangedCallback(e, o, t) {
38
- e === "src" && t !== o ? (this.src = t, this.hasConnected && this.isConnected && this.src && (console.log("[Configurator] The URL was changed -> reinitialize the configurator app."), this.bootstrapApp())) : e === "proxy-base-url" && t !== o && (this.proxyBaseUrl = t ?? u.proxyBaseUrl);
38
+ e === "src" && t !== o ? (this.src = t, this.hasConnected && this.isConnected && this.src && (console.log("[Configurator] The URL was changed -> reinitialize the configurator app."), this.bootstrapApp())) : e === "proxy-base-url" && t !== o && (this.proxyBaseUrl = t ?? d.proxyBaseUrl);
39
39
  }
40
40
  async bootstrapApp() {
41
41
  try {
42
42
  let e;
43
43
  try {
44
- const i = S(this.proxyBaseUrl, `?url=${this.src}`);
44
+ const i = w(this.proxyBaseUrl, `?url=${this.src}`);
45
45
  e = await fetch(i);
46
46
  } catch (i) {
47
47
  console.error("[Configurator] Failed to bootstrap configurator app: Failed to load index.html.", i);
@@ -49,23 +49,27 @@ const m = class u extends HTMLElement {
49
49
  }
50
50
  for (; this.firstChild; )
51
51
  this.removeChild(this.firstChild);
52
- const o = await e.text(), t = new DOMParser().parseFromString(o, "text/html"), r = t.querySelector("style[data-framer-css-ssr-minified]") || t.querySelector("style[data-framer-css-ssr]"), n = t.querySelector("style[data-framer-fonts-ssr-minified]") || t.querySelector("style[data-framer-font-css]"), a = t.querySelector("div#main"), l = t.querySelector('script[data-framer-bundle="main"]'), f = t.querySelector('script[type="importmap"][data-framer-importmap]');
52
+ const o = await e.text(), t = new DOMParser().parseFromString(o, "text/html"), r = t.querySelector("style[data-framer-css-ssr-minified]") || t.querySelector("style[data-framer-css-ssr]"), n = t.querySelector("style[data-framer-fonts-ssr-minified]") || t.querySelector("style[data-framer-font-css]"), a = t.querySelector("div#main"), l = t.querySelector('script[data-framer-bundle="main"]'), u = t.querySelector('script[type="importmap"][data-framer-importmap]');
53
53
  if (r && r.textContent) {
54
- const i = r.textContent.split("}").filter((h) => {
55
- const d = h.trim();
56
- return !// Remove some rules that may interfere too much with the host
57
- (d.startsWith("html,body,#main") || d.startsWith("h1,h2,h3,h4,h5,h6,p,figure") || d.startsWith("body,input,textarea,select,button") || d.startsWith("*"));
58
- }).map((h) => h.trim()).join(`}
59
- `), c = document.createElement("style");
60
- for (const h of r.attributes)
61
- c.setAttribute(h.name, h.value);
62
- c.textContent = i, this.appendChild(c);
54
+ const i = [
55
+ "html,body,#main",
56
+ "h1,h2,h3,h4,h5,h6,p,figure",
57
+ "body,input,textarea,select,button",
58
+ "*"
59
+ ], h = r.textContent.split("}").filter((c) => {
60
+ const x = c.trim().replace(/,\s+/g, ",");
61
+ return !i.some((S) => x.startsWith(S));
62
+ }).map((c) => c.trim()).join(`}
63
+ `), f = document.createElement("style");
64
+ for (const c of r.attributes)
65
+ f.setAttribute(c.name, c.value);
66
+ f.textContent = h, this.appendChild(f);
63
67
  } else
64
68
  console.warn("[Configurator] Bootstrapping configurator app: Could not find the CSS style element.");
65
69
  if (n && n.textContent) {
66
70
  const i = document.createElement("style");
67
- for (const c of n.attributes)
68
- i.setAttribute(c.name, c.value);
71
+ for (const h of n.attributes)
72
+ i.setAttribute(h.name, h.value);
69
73
  i.textContent = n.textContent, this.appendChild(i);
70
74
  } else
71
75
  console.warn("[Configurator] Bootstrapping configurator app: Could not find the fonts style element.");
@@ -80,16 +84,16 @@ const m = class u extends HTMLElement {
80
84
  console.error("[Configurator] Script tag found, but no src or content available.");
81
85
  else
82
86
  console.warn("[Configurator] Bootstrapping configurator app: Could not find the main entry script.");
83
- if (f && f.textContent) {
87
+ if (u && u.textContent) {
84
88
  const i = document.createElement("script");
85
- i.type = "importmap", i.textContent = f.textContent, this.appendChild(i);
89
+ i.type = "importmap", i.textContent = u.textContent, this.appendChild(i);
86
90
  }
87
91
  } catch (e) {
88
92
  console.error("[Configurator] Failed to bootstrap configurator app", e);
89
93
  }
90
94
  }
91
95
  };
92
- m.proxyBaseUrl = "https://spc.cloud.ceventis.de/framer/host-proxy";
96
+ m.proxyBaseUrl = "https://spc.viamedici.io/framer/host-proxy";
93
97
  m.attributeNames = ["src", "proxy-base-url"];
94
98
  let g = m;
95
99
  const C = class b extends HTMLElement {
@@ -172,11 +176,11 @@ const v = class p extends HTMLElement {
172
176
  }
173
177
  };
174
178
  v.childAttributes = [...g.attributeNames, ...y.attributeNames];
175
- let E = v;
176
- customElements.define("spc-embedded-configurator", E);
179
+ let H = v;
180
+ customElements.define("spc-embedded-configurator", H);
177
181
  customElements.define("spc-embedded-configurator-native", g);
178
182
  customElements.define("spc-embedded-configurator-iframe", y);
179
183
  export {
180
184
  g as EmbeddedConfiguratorNative,
181
- E as EmbeddedConfiguratorStrategy
185
+ H as EmbeddedConfiguratorStrategy
182
186
  };
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@viamedici-spc/configurator-framer-host",
3
- "version": "1.2.0-alpha0003",
3
+ "version": "1.2.1",
4
4
  "description": "Provides a Web Component for host applications to embed a Framer based Viamedici SPC configurator.",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "https://github.com/viamedici-spc/configurator-framer-host.git"
7
+ "url": "git+https://github.com/viamedici-spc/configurator-framer-host.git"
8
8
  },
9
9
  "publishConfig": {
10
10
  "access": "public"