frosty 0.0.38 → 0.0.40

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/dom.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as _DOMRenderer } from './internals/common-k6qbeyHu.js';
1
+ import { _ as _DOMRenderer } from './internals/common-Dgt9gkTj.js';
2
2
  import './internals/common-CUIKizze.js';
3
3
  import '@o2ter/utils-js';
4
4
  import 'lodash';
package/dist/dom.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var common = require('./internals/common-P_QiOxQQ.js');
3
+ var common = require('./internals/common-Q9Xz4i4m.js');
4
4
  require('lodash');
5
5
  require('myers.js');
6
6
  require('./internals/component-BiP3XIPe.js');
package/dist/dom.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as _DOMRenderer } from './internals/common-CFQAs-2w.mjs';
1
+ import { _ as _DOMRenderer } from './internals/common-Dz0g-ZKV.mjs';
2
2
  import 'lodash';
3
3
  import 'myers.js';
4
4
  import './internals/component-BzurKp_J.mjs';
@@ -13,7 +13,6 @@ declare abstract class DOMNativeNode extends NativeElementType {
13
13
  abstract destroy(): void;
14
14
  }
15
15
  declare abstract class _DOMRenderer extends _Renderer<Element | DOMNativeNode> {
16
- private _doc?;
17
16
  private _window?;
18
17
  private _namespace_map;
19
18
  private _tracked_props;
@@ -21,8 +20,8 @@ declare abstract class _DOMRenderer extends _Renderer<Element | DOMNativeNode> {
21
20
  private _tracked_head_children;
22
21
  private _tracked_style;
23
22
  private _tracked_style_names;
24
- constructor(doc?: Document, window?: Window | DOMWindow);
25
- get doc(): Document;
23
+ constructor(window?: Window | DOMWindow);
24
+ get document(): Document;
26
25
  get window(): Window | DOMWindow;
27
26
  private __createBuiltClassName;
28
27
  private __updateEventListener;
@@ -31,4 +30,4 @@ declare abstract class _DOMRenderer extends _Renderer<Element | DOMNativeNode> {
31
30
  }
32
31
 
33
32
  export { DOMNativeNode as D, _DOMRenderer as _ };
34
- //# sourceMappingURL=common-k6qbeyHu.d.ts.map
33
+ //# sourceMappingURL=common-Dgt9gkTj.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common-Dgt9gkTj.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -3892,7 +3892,6 @@ class DOMNativeNode extends NativeElementType {
3892
3892
  static createElement;
3893
3893
  }
3894
3894
  class _DOMRenderer extends _Renderer {
3895
- _doc;
3896
3895
  _window;
3897
3896
  _namespace_map = new WeakMap();
3898
3897
  _tracked_props = new WeakMap();
@@ -3900,13 +3899,12 @@ class _DOMRenderer extends _Renderer {
3900
3899
  _tracked_head_children = [];
3901
3900
  _tracked_style = new StyleBuilder();
3902
3901
  _tracked_style_names = [];
3903
- constructor(doc, window) {
3902
+ constructor(window) {
3904
3903
  super();
3905
- this._doc = doc;
3906
3904
  this._window = window;
3907
3905
  }
3908
- get doc() {
3909
- return this._doc ?? document;
3906
+ get document() {
3907
+ return this.window.document;
3910
3908
  }
3911
3909
  get window() {
3912
3910
  return this._window ?? window;
@@ -3923,18 +3921,18 @@ class _DOMRenderer extends _Renderer {
3923
3921
  this._tracked_style.select(this._tracked_style_names);
3924
3922
  if (this._tracked_style.isEmpty) {
3925
3923
  if (this._server) {
3926
- this.__replaceChildren(this.doc.head, this._tracked_head_children);
3924
+ this.__replaceChildren(this.document.head, this._tracked_head_children);
3927
3925
  }
3928
3926
  }
3929
3927
  else {
3930
- const styleElem = this.doc.querySelector('style[data-frosty-style]') ?? this.doc.createElementNS(HTML_NS, 'style');
3928
+ const styleElem = this.document.querySelector('style[data-frosty-style]') ?? this.document.createElementNS(HTML_NS, 'style');
3931
3929
  styleElem.setAttribute('data-frosty-style', '');
3932
3930
  styleElem.textContent = this._tracked_style.css;
3933
3931
  if (this._server) {
3934
- this.__replaceChildren(this.doc.head, [...this._tracked_head_children, styleElem]);
3932
+ this.__replaceChildren(this.document.head, [...this._tracked_head_children, styleElem]);
3935
3933
  }
3936
- else if (styleElem.parentNode !== this.doc.head) {
3937
- this.doc.head.appendChild(styleElem);
3934
+ else if (styleElem.parentNode !== this.document.head) {
3935
+ this.document.head.appendChild(styleElem);
3938
3936
  }
3939
3937
  }
3940
3938
  }
@@ -3943,16 +3941,16 @@ class _DOMRenderer extends _Renderer {
3943
3941
  const { type } = node;
3944
3942
  if (!_.isString(type) && type.prototype instanceof DOMNativeNode) {
3945
3943
  const ElementType = type;
3946
- const elem = ElementType.createElement(this.doc, this);
3944
+ const elem = ElementType.createElement(this.document, this);
3947
3945
  this._updateElement(node, elem, stack);
3948
3946
  return elem;
3949
3947
  }
3950
3948
  if (!_.isString(type))
3951
3949
  throw Error('Invalid type');
3952
3950
  switch (type) {
3953
- case 'html': return this.doc.documentElement;
3954
- case 'head': return this.doc.head ?? this.doc.createElementNS(HTML_NS, 'head');
3955
- case 'body': return this.doc.body ?? this.doc.createElementNS(HTML_NS, 'body');
3951
+ case 'html': return this.document.documentElement;
3952
+ case 'head': return this.document.head ?? this.document.createElementNS(HTML_NS, 'head');
3953
+ case 'body': return this.document.body ?? this.document.createElementNS(HTML_NS, 'body');
3956
3954
  }
3957
3955
  const _ns_list = _.compact([
3958
3956
  _.includes(tags.svg, type) && SVG_NS,
@@ -3961,7 +3959,7 @@ class _DOMRenderer extends _Renderer {
3961
3959
  ]);
3962
3960
  const parent = _.last(stack);
3963
3961
  const ns = _ns_list.length > 1 ? parent && _.first(_.intersection([this._namespace_map.get(parent)], _ns_list)) : _.first(_ns_list);
3964
- const elem = ns ? this.doc.createElementNS(ns, type) : this.doc.createElement(type);
3962
+ const elem = ns ? this.document.createElementNS(ns, type) : this.document.createElement(type);
3965
3963
  this._namespace_map.set(node, ns);
3966
3964
  this._updateElement(node, elem, stack);
3967
3965
  return elem;
@@ -4101,7 +4099,7 @@ class _DOMRenderer extends _Renderer {
4101
4099
  }
4102
4100
  }
4103
4101
  __replaceChildren(element, children) {
4104
- const diff = myersSync(_.map(element.childNodes, x => x.nodeType === this.doc.TEXT_NODE ? x.textContent ?? '' : x), _.map(children, x => x instanceof DOMNativeNode ? x.target : x), { compare: (a, b) => a === b });
4102
+ const diff = myersSync(_.map(element.childNodes, x => x.nodeType === this.document.TEXT_NODE ? x.textContent ?? '' : x), _.map(children, x => x instanceof DOMNativeNode ? x.target : x), { compare: (a, b) => a === b });
4105
4103
  let i = 0;
4106
4104
  for (const { remove, insert, equivalent } of diff) {
4107
4105
  if (equivalent) {
@@ -4114,7 +4112,7 @@ class _DOMRenderer extends _Renderer {
4114
4112
  }
4115
4113
  if (insert) {
4116
4114
  for (const child of insert) {
4117
- const node = _.isString(child) ? this.doc.createTextNode(child) : child;
4115
+ const node = _.isString(child) ? this.document.createTextNode(child) : child;
4118
4116
  element.insertBefore(node, element.childNodes[i++]);
4119
4117
  }
4120
4118
  }
@@ -4134,4 +4132,4 @@ class _DOMRenderer extends _Renderer {
4134
4132
  }
4135
4133
 
4136
4134
  export { DOMNativeNode as D, _DOMRenderer as _ };
4137
- //# sourceMappingURL=common-CFQAs-2w.mjs.map
4135
+ //# sourceMappingURL=common-Dz0g-ZKV.mjs.map