domql 3.7.5 → 3.8.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.
Files changed (2) hide show
  1. package/dist/iife/index.js +19 -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
  });
@@ -4382,6 +4399,7 @@ ${element}` : "";
4382
4399
  init_esm();
4383
4400
  function text(param, element, node) {
4384
4401
  let prop = exec(element.props.text || param, element);
4402
+ if (isFunction(prop)) prop = exec(prop, element);
4385
4403
  if (isString(prop) && prop.includes("{{")) {
4386
4404
  prop = element.call("replaceLiteralsWithObjectFields", prop, element.state);
4387
4405
  }
@@ -6485,15 +6503,11 @@ ${element}` : "";
6485
6503
  addMethods(element, parent, options);
6486
6504
  createScope(element, parent);
6487
6505
  createState(element, parent);
6488
- if (element.scope === "state") element.scope = element.state;
6489
6506
  createIfConditionFlag(element, parent);
6490
6507
  initProps(element, parent, options);
6491
6508
  pickupElementFromProps.call(element, element, { cachedKeys: [] });
6492
6509
  if (!element.tag) element.tag = detectTag(element);
6493
6510
  applyPropsAsAttrs(element);
6494
- if (element.scope === "props" || element.scope === true) {
6495
- element.scope = element.props;
6496
- }
6497
6511
  createIfConditionFlag(element, parent);
6498
6512
  if (element.node) {
6499
6513
  if (ref.__if) return assignNode(element, parent, key, attachOptions);
@@ -6589,13 +6603,9 @@ ${element}` : "";
6589
6603
  addMethods(element, parent, options);
6590
6604
  createScope(element, parent);
6591
6605
  createState(element, parent);
6592
- if (element.scope === "state") element.scope = element.state;
6593
6606
  createIfConditionFlag(element, parent);
6594
6607
  initProps(element, parent, options);
6595
6608
  pickupElementFromProps.call(element, element, { cachedKeys: [] });
6596
- if (element.scope === "props" || element.scope === true) {
6597
- element.scope = element.props;
6598
- }
6599
6609
  if (element.node && ref.__if) {
6600
6610
  parent[key || element.key] = element;
6601
6611
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "domql",
3
- "version": "3.7.5",
3
+ "version": "3.8.0",
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.8.0",
29
+ "@domql/state": "^3.8.0",
30
+ "@domql/utils": "^3.8.0"
31
31
  },
32
32
  "gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
33
33
  "browser": "./dist/esm/index.js",