remote-components 0.0.37 → 0.0.39
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/html/host.cjs +78 -0
- package/dist/html/host.cjs.map +1 -1
- package/dist/html/host.js +78 -0
- package/dist/html/host.js.map +1 -1
- package/dist/internal/next/host/app-router-client.cjs +5 -1
- package/dist/internal/next/host/app-router-client.cjs.map +1 -1
- package/dist/internal/next/host/app-router-client.js +5 -1
- package/dist/internal/next/host/app-router-client.js.map +1 -1
- package/dist/internal/next/remote/render-server.cjs.map +1 -1
- package/dist/internal/next/remote/render-server.d.ts +13 -0
- package/dist/internal/next/remote/render-server.js.map +1 -1
- package/dist/internal/shared/client/get-client-src.cjs +39 -0
- package/dist/internal/shared/client/get-client-src.cjs.map +1 -0
- package/dist/internal/shared/client/get-client-src.d.ts +7 -0
- package/dist/internal/shared/client/get-client-src.js +15 -0
- package/dist/internal/shared/client/get-client-src.js.map +1 -0
- package/dist/internal/shared/ssr/fetch-remote-component.cjs +14 -10
- package/dist/internal/shared/ssr/fetch-remote-component.cjs.map +1 -1
- package/dist/internal/shared/ssr/fetch-remote-component.js +14 -10
- package/dist/internal/shared/ssr/fetch-remote-component.js.map +1 -1
- package/dist/internal/shared/ssr/get-ssr-relative-path-base-url.cjs +34 -0
- package/dist/internal/shared/ssr/get-ssr-relative-path-base-url.cjs.map +1 -0
- package/dist/internal/shared/ssr/get-ssr-relative-path-base-url.d.ts +10 -0
- package/dist/internal/shared/ssr/get-ssr-relative-path-base-url.js +10 -0
- package/dist/internal/shared/ssr/get-ssr-relative-path-base-url.js.map +1 -0
- package/dist/next/host/client/index.cjs +41 -2
- package/dist/next/host/client/index.cjs.map +1 -1
- package/dist/next/host/client/index.d.ts +13 -0
- package/dist/next/host/client/index.js +41 -2
- package/dist/next/host/client/index.js.map +1 -1
- package/dist/react/index.cjs +41 -2
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.ts +14 -1
- package/dist/react/index.js +41 -2
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/html/host.js
CHANGED
|
@@ -1423,6 +1423,8 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
1423
1423
|
isLoading = false;
|
|
1424
1424
|
prevIsRemoteComponent = false;
|
|
1425
1425
|
prevUrl;
|
|
1426
|
+
prevSrc = null;
|
|
1427
|
+
prevName;
|
|
1426
1428
|
root = null;
|
|
1427
1429
|
reactRoot;
|
|
1428
1430
|
additionalHeaders;
|
|
@@ -1437,6 +1439,16 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
1437
1439
|
if (this.getAttribute("src")) {
|
|
1438
1440
|
this.load().catch((e) => {
|
|
1439
1441
|
console.error(e);
|
|
1442
|
+
const errorEvent = new Event("error", {
|
|
1443
|
+
bubbles: true,
|
|
1444
|
+
composed: true
|
|
1445
|
+
});
|
|
1446
|
+
Object.assign(errorEvent, {
|
|
1447
|
+
error: e,
|
|
1448
|
+
src: this.getAttribute("src")
|
|
1449
|
+
});
|
|
1450
|
+
this.dispatchEvent(errorEvent);
|
|
1451
|
+
this.isLoading = false;
|
|
1440
1452
|
});
|
|
1441
1453
|
}
|
|
1442
1454
|
} else if (name === "mode" && oldValue !== newValue && this.root) {
|
|
@@ -1449,6 +1461,15 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
1449
1461
|
this.root = newRoot;
|
|
1450
1462
|
this.load().catch((e) => {
|
|
1451
1463
|
console.error(e);
|
|
1464
|
+
const errorEvent = new Event("error", {
|
|
1465
|
+
bubbles: true,
|
|
1466
|
+
composed: true
|
|
1467
|
+
});
|
|
1468
|
+
Object.assign(errorEvent, {
|
|
1469
|
+
error: e,
|
|
1470
|
+
src: this.getAttribute("src")
|
|
1471
|
+
});
|
|
1472
|
+
this.dispatchEvent(errorEvent);
|
|
1452
1473
|
});
|
|
1453
1474
|
}
|
|
1454
1475
|
}
|
|
@@ -1483,10 +1504,25 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
1483
1504
|
if (this.hasAttribute("src") || this.querySelector("div#__REMOTE_COMPONENT__") || this.hasAttribute("data-ssr")) {
|
|
1484
1505
|
this.load().catch((e) => {
|
|
1485
1506
|
console.error(e);
|
|
1507
|
+
const errorEvent = new Event("error", {
|
|
1508
|
+
bubbles: true,
|
|
1509
|
+
composed: true
|
|
1510
|
+
});
|
|
1511
|
+
Object.assign(errorEvent, {
|
|
1512
|
+
error: e,
|
|
1513
|
+
src: this.getAttribute("src")
|
|
1514
|
+
});
|
|
1515
|
+
this.dispatchEvent(errorEvent);
|
|
1486
1516
|
});
|
|
1487
1517
|
}
|
|
1488
1518
|
this.isLoading = true;
|
|
1489
1519
|
const src = this.getAttribute("src");
|
|
1520
|
+
const beforeLoadEvent = new Event("beforeload", {
|
|
1521
|
+
bubbles: true,
|
|
1522
|
+
composed: true
|
|
1523
|
+
});
|
|
1524
|
+
Object.assign(beforeLoadEvent, { src });
|
|
1525
|
+
this.dispatchEvent(beforeLoadEvent);
|
|
1490
1526
|
const remoteComponentChild = this.querySelector("div#__REMOTE_COMPONENT__") || this.querySelector("div[data-bundle][data-route]");
|
|
1491
1527
|
if (!src && !remoteComponentChild) {
|
|
1492
1528
|
throw new RemoteComponentsError('"src" attribute is required');
|
|
@@ -1621,8 +1657,23 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
1621
1657
|
}
|
|
1622
1658
|
this.root.innerHTML = "";
|
|
1623
1659
|
}
|
|
1660
|
+
if (this.prevSrc !== null) {
|
|
1661
|
+
const changeEvent = new Event("change", {
|
|
1662
|
+
bubbles: true,
|
|
1663
|
+
composed: true
|
|
1664
|
+
});
|
|
1665
|
+
Object.assign(changeEvent, {
|
|
1666
|
+
previousSrc: this.prevSrc,
|
|
1667
|
+
nextSrc: src,
|
|
1668
|
+
previousName: this.prevName,
|
|
1669
|
+
nextName: this.name
|
|
1670
|
+
});
|
|
1671
|
+
this.dispatchEvent(changeEvent);
|
|
1672
|
+
}
|
|
1624
1673
|
this.prevUrl = url ?? new URL(location.href);
|
|
1625
1674
|
this.prevIsRemoteComponent = isRemoteComponent;
|
|
1675
|
+
this.prevSrc = src;
|
|
1676
|
+
this.prevName = this.name;
|
|
1626
1677
|
const removable = Array.from(this.childNodes);
|
|
1627
1678
|
const links = doc.querySelectorAll("link[href]");
|
|
1628
1679
|
const remoteComponentSrc = this.getAttribute("src");
|
|
@@ -1841,6 +1892,12 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
1841
1892
|
});
|
|
1842
1893
|
}
|
|
1843
1894
|
this.isLoading = false;
|
|
1895
|
+
const loadEvent = new Event("load", {
|
|
1896
|
+
bubbles: true,
|
|
1897
|
+
composed: true
|
|
1898
|
+
});
|
|
1899
|
+
Object.assign(loadEvent, { src: this.getAttribute("src") });
|
|
1900
|
+
this.dispatchEvent(loadEvent);
|
|
1844
1901
|
}, [initial, name]);
|
|
1845
1902
|
return Component;
|
|
1846
1903
|
};
|
|
@@ -1888,6 +1945,14 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
1888
1945
|
});
|
|
1889
1946
|
}
|
|
1890
1947
|
remoteComponent.isLoading = false;
|
|
1948
|
+
const loadEvent = new Event("load", {
|
|
1949
|
+
bubbles: true,
|
|
1950
|
+
composed: true
|
|
1951
|
+
});
|
|
1952
|
+
Object.assign(loadEvent, {
|
|
1953
|
+
src: remoteComponent.getAttribute("src")
|
|
1954
|
+
});
|
|
1955
|
+
remoteComponent.dispatchEvent(loadEvent);
|
|
1891
1956
|
}, [initial, remoteComponent]);
|
|
1892
1957
|
return NextApp ? /* @__PURE__ */ jsx2(NextApp, { Component: NextComponent, ...nextData.props }) : /* @__PURE__ */ jsx2(NextComponent, { ...nextData.props });
|
|
1893
1958
|
})(App, Component, this);
|
|
@@ -1927,6 +1992,19 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
1927
1992
|
}
|
|
1928
1993
|
})
|
|
1929
1994
|
);
|
|
1995
|
+
const loadEvent = new Event("load", {
|
|
1996
|
+
bubbles: true,
|
|
1997
|
+
composed: true
|
|
1998
|
+
});
|
|
1999
|
+
Object.assign(loadEvent, { src: this.getAttribute("src") });
|
|
2000
|
+
this.dispatchEvent(loadEvent);
|
|
2001
|
+
} else {
|
|
2002
|
+
const loadEvent = new Event("load", {
|
|
2003
|
+
bubbles: true,
|
|
2004
|
+
composed: true
|
|
2005
|
+
});
|
|
2006
|
+
Object.assign(loadEvent, { src: this.getAttribute("src") });
|
|
2007
|
+
this.dispatchEvent(loadEvent);
|
|
1930
2008
|
}
|
|
1931
2009
|
this.isLoading = false;
|
|
1932
2010
|
}
|