domql 3.7.5 → 3.7.6

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.
Files changed (2) hide show
  1. package/dist/iife/index.js +18 -9
  2. package/package.json +4 -4
@@ -1813,7 +1813,24 @@ var Domql = (() => {
1813
1813
  "../utils/dist/esm/scope.js"() {
1814
1814
  createScope = (element, parent) => {
1815
1815
  const { __ref: ref } = element;
1816
- if (!element.scope) element.scope = parent.scope || ref.root?.scope || {};
1816
+ const context = element.context || parent.context || ref.root?.context;
1817
+ if (context && !context.globalScope) context.globalScope = {};
1818
+ const parentScope = parent.scope || ref.root?.scope;
1819
+ const globalScope = context?.globalScope;
1820
+ if (!element.scope) {
1821
+ if (parentScope) {
1822
+ element.scope = parentScope;
1823
+ } else if (globalScope) {
1824
+ element.scope = Object.create(globalScope);
1825
+ } else {
1826
+ element.scope = {};
1827
+ }
1828
+ } else if (typeof element.scope === "object" && element.scope !== null) {
1829
+ if (Object.getPrototypeOf(element.scope) === Object.prototype) {
1830
+ const proto = parentScope || globalScope;
1831
+ if (proto) Object.setPrototypeOf(element.scope, proto);
1832
+ }
1833
+ }
1817
1834
  };
1818
1835
  }
1819
1836
  });
@@ -6485,15 +6502,11 @@ ${element}` : "";
6485
6502
  addMethods(element, parent, options);
6486
6503
  createScope(element, parent);
6487
6504
  createState(element, parent);
6488
- if (element.scope === "state") element.scope = element.state;
6489
6505
  createIfConditionFlag(element, parent);
6490
6506
  initProps(element, parent, options);
6491
6507
  pickupElementFromProps.call(element, element, { cachedKeys: [] });
6492
6508
  if (!element.tag) element.tag = detectTag(element);
6493
6509
  applyPropsAsAttrs(element);
6494
- if (element.scope === "props" || element.scope === true) {
6495
- element.scope = element.props;
6496
- }
6497
6510
  createIfConditionFlag(element, parent);
6498
6511
  if (element.node) {
6499
6512
  if (ref.__if) return assignNode(element, parent, key, attachOptions);
@@ -6589,13 +6602,9 @@ ${element}` : "";
6589
6602
  addMethods(element, parent, options);
6590
6603
  createScope(element, parent);
6591
6604
  createState(element, parent);
6592
- if (element.scope === "state") element.scope = element.state;
6593
6605
  createIfConditionFlag(element, parent);
6594
6606
  initProps(element, parent, options);
6595
6607
  pickupElementFromProps.call(element, element, { cachedKeys: [] });
6596
- if (element.scope === "props" || element.scope === true) {
6597
- element.scope = element.props;
6598
- }
6599
6608
  if (element.node && ref.__if) {
6600
6609
  parent[key || element.key] = element;
6601
6610
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "domql",
3
- "version": "3.7.5",
3
+ "version": "3.7.6",
4
4
  "license": "CC-BY-NC-4.0",
5
5
  "type": "module",
6
6
  "module": "./dist/esm/index.js",
@@ -25,9 +25,9 @@
25
25
  "build:iife": "cross-env NODE_ENV=$NODE_ENV esbuild index.js --bundle --target=es2020 --format=iife --global-name=Domql --outfile=dist/iife/index.js --define:process.env.NODE_ENV=process.env.NODE_ENV"
26
26
  },
27
27
  "dependencies": {
28
- "@domql/element": "^3.7.5",
29
- "@domql/state": "^3.7.5",
30
- "@domql/utils": "^3.7.5"
28
+ "@domql/element": "^3.7.6",
29
+ "@domql/state": "^3.7.6",
30
+ "@domql/utils": "^3.7.6"
31
31
  },
32
32
  "gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
33
33
  "browser": "./dist/esm/index.js",