@lisergia/core 17.0.0 → 19.0.0

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.
@@ -1,6 +1,6 @@
1
1
 
2
2
  
3
- > @lisergia/core@16.0.0 build
3
+ > @lisergia/core@18.0.0 build
4
4
  > tsup src/index.ts --format cjs,esm --dts
5
5
 
6
6
  CLI Building entry: src/index.ts
@@ -9,12 +9,12 @@
9
9
  CLI Target: node16
10
10
  CJS Build start
11
11
  ESM Build start
12
- CJS dist/index.cjs 16.12 KB
13
- CJS ⚡️ Build success in 16ms
14
- ESM dist/index.js 13.87 KB
12
+ ESM dist/index.js 13.91 KB
15
13
  ESM ⚡️ Build success in 17ms
14
+ CJS dist/index.cjs 16.15 KB
15
+ CJS ⚡️ Build success in 18ms
16
16
  DTS Build start
17
- DTS ⚡️ Build success in 888ms
17
+ DTS ⚡️ Build success in 869ms
18
18
  DTS dist/index.d.cts 5.82 KB
19
19
  DTS dist/index.d.ts 5.82 KB
20
20
  ⠙
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @lisergia/core
2
2
 
3
+ ## 19.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - Cleanup elements from Component on destroy.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @lisergia/config-tsconfig@19.0.0
13
+
14
+ ## 18.0.0
15
+
16
+ ### Major Changes
17
+
18
+ - Fix memory leak from DOMParser.
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies
23
+ - @lisergia/config-tsconfig@18.0.0
24
+
3
25
  ## 17.0.0
4
26
 
5
27
  ### Major Changes
package/dist/index.cjs CHANGED
@@ -406,8 +406,8 @@ var ApplicationManager = class extends Component {
406
406
  nextPage = {};
407
407
  async onRequest({ href, response, pushState }) {
408
408
  var _a, _b;
409
- const domParser = new DOMParser();
410
- const dom = domParser.parseFromString(response, "text/html");
409
+ let domParser = new DOMParser();
410
+ let dom = domParser.parseFromString(response, "text/html");
411
411
  const html = dom.querySelector("html");
412
412
  const app = dom.querySelector(".app");
413
413
  this.nextPage = {
@@ -427,6 +427,8 @@ var ApplicationManager = class extends Component {
427
427
  window.history.pushState({}, this.nextPage.title, href);
428
428
  }
429
429
  this.routeHistory.push(href);
430
+ domParser = null;
431
+ dom = null;
430
432
  }
431
433
  //
432
434
  // Pop State.
package/dist/index.js CHANGED
@@ -363,8 +363,8 @@ var ApplicationManager = class extends Component {
363
363
  nextPage = {};
364
364
  async onRequest({ href, response, pushState }) {
365
365
  var _a, _b;
366
- const domParser = new DOMParser();
367
- const dom = domParser.parseFromString(response, "text/html");
366
+ let domParser = new DOMParser();
367
+ let dom = domParser.parseFromString(response, "text/html");
368
368
  const html = dom.querySelector("html");
369
369
  const app = dom.querySelector(".app");
370
370
  this.nextPage = {
@@ -384,6 +384,8 @@ var ApplicationManager = class extends Component {
384
384
  window.history.pushState({}, this.nextPage.title, href);
385
385
  }
386
386
  this.routeHistory.push(href);
387
+ domParser = null;
388
+ dom = null;
387
389
  }
388
390
  //
389
391
  // Pop State.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lisergia/core",
3
- "version": "17.0.0",
3
+ "version": "19.0.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",
@@ -9,7 +9,7 @@
9
9
  "dev": "tsup src/index.ts --format cjs,esm --dts --watch"
10
10
  },
11
11
  "dependencies": {
12
- "@lisergia/config-tsconfig": "17.0.0",
12
+ "@lisergia/config-tsconfig": "19.0.0",
13
13
  "auto-bind": "^5.0.1",
14
14
  "gsap": "^3.13.0",
15
15
  "lenis": "^1.3.1",
package/src/App.ts CHANGED
@@ -238,16 +238,16 @@ export class ApplicationManager extends Component {
238
238
  } = {}
239
239
 
240
240
  async onRequest({ href, response, pushState }: { href: string; response: string; pushState: boolean }) {
241
- const domParser = new DOMParser()
242
- const dom = domParser.parseFromString(response, 'text/html')
241
+ let domParser: DOMParser | null = new DOMParser()
242
+ let dom: Document | null = domParser.parseFromString(response, 'text/html')
243
243
 
244
- const html = dom.querySelector('html')!
245
- const app = dom.querySelector('.app')!
244
+ const html = dom!.querySelector('html')!
245
+ const app = dom!.querySelector('.app')!
246
246
 
247
247
  this.nextPage = {
248
248
  element: app,
249
249
  template: html.dataset.template ?? this.template,
250
- title: dom.title ?? document.title,
250
+ title: dom!.title ?? document.title,
251
251
  }
252
252
 
253
253
  if (this.transition) {
@@ -266,6 +266,9 @@ export class ApplicationManager extends Component {
266
266
  }
267
267
 
268
268
  this.routeHistory.push(href)
269
+
270
+ domParser = null
271
+ dom = null
269
272
  }
270
273
 
271
274
  //
package/src/Component.ts CHANGED
@@ -87,6 +87,10 @@ export class Component extends EventEmitter {
87
87
  }
88
88
  }
89
89
 
90
+ destroyElement() {
91
+ this.element = undefined
92
+ }
93
+
90
94
  initElements(selectors?: ComponentSelectors) {
91
95
  for (const key in selectors) {
92
96
  const selector = selectors[key]
@@ -121,6 +125,10 @@ export class Component extends EventEmitter {
121
125
  }
122
126
  }
123
127
 
128
+ destroyElements() {
129
+ this.elements = {}
130
+ }
131
+
124
132
  addEventListeners() {}
125
133
 
126
134
  removeEventListeners() {}
@@ -129,5 +137,8 @@ export class Component extends EventEmitter {
129
137
  super.destroy()
130
138
 
131
139
  this.removeEventListeners()
140
+
141
+ this.destroyElements()
142
+ this.destroyElement()
132
143
  }
133
144
  }
package/src/Page.ts CHANGED
@@ -212,10 +212,10 @@ export class Page extends Component {
212
212
  // Destroy.
213
213
  //
214
214
  destroy() {
215
- super.destroy()
216
-
217
215
  this.destroyResizeObserver()
218
216
  this.destroyComponents()
219
217
  this.destroyScroll()
218
+
219
+ super.destroy()
220
220
  }
221
221
  }