@lisergia/core 16.0.0 → 16.0.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.cjs CHANGED
@@ -260,6 +260,7 @@ var ApplicationManager = class extends Component {
260
260
  nextPage: import_mobx2.observable,
261
261
  // Route Information.
262
262
  route: import_mobx2.observable,
263
+ routeHistory: import_mobx2.observable,
263
264
  // Template Information.
264
265
  template: import_mobx2.observable,
265
266
  // Page Scroll.
@@ -381,11 +382,13 @@ var ApplicationManager = class extends Component {
381
382
  // Navigate.
382
383
  //
383
384
  route = window.location.pathname;
385
+ routeHistory = [this.route];
386
+ routePushState = true;
384
387
  onRouteChange({ oldValue, newValue }) {
385
388
  const href = newValue.replace(window.location.origin, "");
386
389
  this.onRouteChangeRequest({
387
390
  href,
388
- pushState: true
391
+ pushState: this.routePushState
389
392
  });
390
393
  }
391
394
  async onRouteChangeRequest({ href, pushState = true }) {
@@ -403,7 +406,6 @@ var ApplicationManager = class extends Component {
403
406
  nextPage = {};
404
407
  async onRequest({ href, response, pushState }) {
405
408
  var _a, _b;
406
- console.log(pushState, href);
407
409
  const domParser = new DOMParser();
408
410
  const dom = domParser.parseFromString(response, "text/html");
409
411
  const html = dom.querySelector("html");
@@ -424,6 +426,7 @@ var ApplicationManager = class extends Component {
424
426
  if (pushState) {
425
427
  window.history.pushState({}, this.nextPage.title, href);
426
428
  }
429
+ this.routeHistory.push(href);
427
430
  }
428
431
  //
429
432
  // Pop State.
@@ -432,10 +435,9 @@ var ApplicationManager = class extends Component {
432
435
  if (event.state === null) {
433
436
  return event.preventDefault();
434
437
  }
435
- this.onRouteChangeRequest({
436
- href: document.location.pathname,
437
- pushState: false
438
- });
438
+ this.routePushState = false;
439
+ this.route = document.location.pathname;
440
+ this.routePushState = false;
439
441
  }
440
442
  //
441
443
  // Scroll.
package/dist/index.d.cts CHANGED
@@ -153,6 +153,8 @@ declare class ApplicationManager extends Component {
153
153
  createPage(template?: string): void;
154
154
  destroyPage(): void;
155
155
  route: string;
156
+ routeHistory: Array<string>;
157
+ routePushState: boolean;
156
158
  onRouteChange({ oldValue, newValue }: IValueDidChange<string>): void;
157
159
  onRouteChangeRequest({ href, pushState }: {
158
160
  href: string;
package/dist/index.d.ts CHANGED
@@ -153,6 +153,8 @@ declare class ApplicationManager extends Component {
153
153
  createPage(template?: string): void;
154
154
  destroyPage(): void;
155
155
  route: string;
156
+ routeHistory: Array<string>;
157
+ routePushState: boolean;
156
158
  onRouteChange({ oldValue, newValue }: IValueDidChange<string>): void;
157
159
  onRouteChangeRequest({ href, pushState }: {
158
160
  href: string;
package/dist/index.js CHANGED
@@ -217,6 +217,7 @@ var ApplicationManager = class extends Component {
217
217
  nextPage: observable,
218
218
  // Route Information.
219
219
  route: observable,
220
+ routeHistory: observable,
220
221
  // Template Information.
221
222
  template: observable,
222
223
  // Page Scroll.
@@ -338,11 +339,13 @@ var ApplicationManager = class extends Component {
338
339
  // Navigate.
339
340
  //
340
341
  route = window.location.pathname;
342
+ routeHistory = [this.route];
343
+ routePushState = true;
341
344
  onRouteChange({ oldValue, newValue }) {
342
345
  const href = newValue.replace(window.location.origin, "");
343
346
  this.onRouteChangeRequest({
344
347
  href,
345
- pushState: true
348
+ pushState: this.routePushState
346
349
  });
347
350
  }
348
351
  async onRouteChangeRequest({ href, pushState = true }) {
@@ -360,7 +363,6 @@ var ApplicationManager = class extends Component {
360
363
  nextPage = {};
361
364
  async onRequest({ href, response, pushState }) {
362
365
  var _a, _b;
363
- console.log(pushState, href);
364
366
  const domParser = new DOMParser();
365
367
  const dom = domParser.parseFromString(response, "text/html");
366
368
  const html = dom.querySelector("html");
@@ -381,6 +383,7 @@ var ApplicationManager = class extends Component {
381
383
  if (pushState) {
382
384
  window.history.pushState({}, this.nextPage.title, href);
383
385
  }
386
+ this.routeHistory.push(href);
384
387
  }
385
388
  //
386
389
  // Pop State.
@@ -389,10 +392,9 @@ var ApplicationManager = class extends Component {
389
392
  if (event.state === null) {
390
393
  return event.preventDefault();
391
394
  }
392
- this.onRouteChangeRequest({
393
- href: document.location.pathname,
394
- pushState: false
395
- });
395
+ this.routePushState = false;
396
+ this.route = document.location.pathname;
397
+ this.routePushState = false;
396
398
  }
397
399
  //
398
400
  // Scroll.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lisergia/core",
3
- "version": "16.0.0",
3
+ "version": "16.0.1",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",
@@ -1,20 +0,0 @@
1
-
2
- 
3
- > @lisergia/core@15.0.0 build
4
- > tsup src/index.ts --format cjs,esm --dts
5
-
6
- CLI Building entry: src/index.ts
7
- CLI Using tsconfig: tsconfig.json
8
- CLI tsup v8.5.0
9
- CLI Target: node16
10
- CJS Build start
11
- ESM Build start
12
- ESM dist/index.js 13.77 KB
13
- ESM ⚡️ Build success in 131ms
14
- CJS dist/index.cjs 15.99 KB
15
- CJS ⚡️ Build success in 131ms
16
- DTS Build start
17
- DTS ⚡️ Build success in 840ms
18
- DTS dist/index.d.cts 5.76 KB
19
- DTS dist/index.d.ts 5.76 KB
20
- ⠙