routelit-client 0.0.3 → 0.3.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/core/manager.d.ts +3 -1
- package/dist/routelit-client.es.dev.js +18 -2
- package/dist/routelit-client.es.dev.js.map +1 -1
- package/dist/routelit-client.es.js +91 -77
- package/dist/routelit-client.umd.dev.js +18 -2
- package/dist/routelit-client.umd.dev.js.map +1 -1
- package/dist/routelit-client.umd.js +3 -3
- package/package.json +1 -2
package/dist/core/manager.d.ts
CHANGED
|
@@ -11,18 +11,20 @@ export declare class RouteLitManager {
|
|
|
11
11
|
private listeners;
|
|
12
12
|
private isLoadingListeners;
|
|
13
13
|
private errorListeners;
|
|
14
|
-
private componentsTree
|
|
14
|
+
private componentsTree;
|
|
15
15
|
private _isLoading;
|
|
16
16
|
private _error?;
|
|
17
17
|
private fragmentId?;
|
|
18
18
|
private parentManager?;
|
|
19
19
|
private address?;
|
|
20
20
|
private lastURL?;
|
|
21
|
+
private initialized;
|
|
21
22
|
constructor(props: RouteLitManagerProps);
|
|
22
23
|
getLastURL: () => string;
|
|
23
24
|
handleEvent: (e: CustomEvent<UIEventPayload>) => Promise<void>;
|
|
24
25
|
handleError: (e: Error) => void;
|
|
25
26
|
applyActions: (actionsResp: ActionsResponse, shouldNotify?: boolean) => void;
|
|
27
|
+
private initializeDOM;
|
|
26
28
|
initialize: () => void;
|
|
27
29
|
handlePopState: () => void;
|
|
28
30
|
terminate: () => void;
|
|
@@ -788,13 +788,14 @@ class RouteLitManager {
|
|
|
788
788
|
__publicField(this, "listeners", []);
|
|
789
789
|
__publicField(this, "isLoadingListeners", []);
|
|
790
790
|
__publicField(this, "errorListeners", []);
|
|
791
|
-
__publicField(this, "componentsTree");
|
|
791
|
+
__publicField(this, "componentsTree", []);
|
|
792
792
|
__publicField(this, "_isLoading", false);
|
|
793
793
|
__publicField(this, "_error");
|
|
794
794
|
__publicField(this, "fragmentId");
|
|
795
795
|
__publicField(this, "parentManager");
|
|
796
796
|
__publicField(this, "address");
|
|
797
797
|
__publicField(this, "lastURL");
|
|
798
|
+
__publicField(this, "initialized", false);
|
|
798
799
|
__publicField(this, "getLastURL", () => {
|
|
799
800
|
var _a;
|
|
800
801
|
return ((_a = this.parentManager) == null ? void 0 : _a.getLastURL()) ?? this.lastURL;
|
|
@@ -840,7 +841,22 @@ class RouteLitManager {
|
|
|
840
841
|
this.componentsTree = componentsTreeCopy;
|
|
841
842
|
if (shouldNotify) this.notifyListeners();
|
|
842
843
|
});
|
|
844
|
+
__publicField(this, "initializeDOM", () => {
|
|
845
|
+
if (this.initialized) return;
|
|
846
|
+
const initializeEvent = new CustomEvent(
|
|
847
|
+
"routelit:event",
|
|
848
|
+
{
|
|
849
|
+
detail: {
|
|
850
|
+
id: "browser-navigation",
|
|
851
|
+
type: "initialize"
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
);
|
|
855
|
+
this.handleEvent(initializeEvent);
|
|
856
|
+
this.initialized = true;
|
|
857
|
+
});
|
|
843
858
|
__publicField(this, "initialize", () => {
|
|
859
|
+
this.initializeDOM();
|
|
844
860
|
document.addEventListener(
|
|
845
861
|
"routelit:event",
|
|
846
862
|
this.handleEvent
|
|
@@ -943,7 +959,7 @@ class RouteLitManager {
|
|
|
943
959
|
}
|
|
944
960
|
});
|
|
945
961
|
var _a;
|
|
946
|
-
this.componentsTree = props.componentsTree;
|
|
962
|
+
this.componentsTree = props.componentsTree ?? [];
|
|
947
963
|
this.fragmentId = props.fragmentId;
|
|
948
964
|
this.parentManager = props.parentManager;
|
|
949
965
|
this.address = props.address;
|