@domql/state 2.3.140 → 2.3.141

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/createState.js CHANGED
@@ -8,7 +8,7 @@ import { updateState } from './updateState'
8
8
  import { checkIfInherits, createInheritedState } from './inherit'
9
9
 
10
10
  export const createState = function (element, parent, options) {
11
- const skip = (options && options.skip) ? options.skip : false
11
+ const skipApplyMethods = Boolean(options?.skipApplyMethods)
12
12
 
13
13
  const objectizeState = checkForTypes(element)
14
14
  if (objectizeState === false) return parent.state || {}
@@ -26,7 +26,10 @@ export const createState = function (element, parent, options) {
26
26
  if (dependentState) element.state = dependentState
27
27
 
28
28
  // NOTE: Only true when 'onlyResolveExtends' option is set to true
29
- if (skip) return element.state
29
+ if (skipApplyMethods) {
30
+ state.parent = element.parent.state
31
+ return element.state
32
+ }
30
33
 
31
34
  applyMethods(element)
32
35
 
@@ -41,7 +41,7 @@ const getParentStateInKey = (stateKey, parentState) => {
41
41
  }
42
42
  return parentState;
43
43
  };
44
- const getChildStateInKey = (stateKey, parentState, options = {}) => {
44
+ const getChildStateInKey = (stateKey, parentState, options) => {
45
45
  const arr = stateKey.split("/");
46
46
  const arrLength = arr.length - 1;
47
47
  for (let i = 0; i < arrLength; i++) {
@@ -101,7 +101,7 @@ const hoistStateUpdate = (state, obj, options) => {
101
101
  preventUpdate: options.preventHoistElementUpdate,
102
102
  overwrite: !options.replace
103
103
  });
104
- const hasNotUpdated = options.preventUpdate !== true || !options.preventHoistElementUpdate;
104
+ const hasNotUpdated = !options.preventUpdate || !options.preventHoistElementUpdate;
105
105
  if (!options.preventStateUpdateListener && hasNotUpdated) {
106
106
  (0, import_event.triggerEventOnUpdate)("stateUpdated", obj, element, options);
107
107
  }
@@ -117,7 +117,7 @@ const updateDependentState = (state, obj, options) => {
117
117
  };
118
118
  const applyElementUpdate = (state, obj, options) => {
119
119
  const element = state.__element;
120
- if (options.preventUpdate !== true) {
120
+ if (!options.preventUpdate) {
121
121
  element.update({}, {
122
122
  ...options,
123
123
  updateByState: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/state",
3
- "version": "2.3.140",
3
+ "version": "2.3.141",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/esm/index.js",
@@ -26,5 +26,5 @@
26
26
  "@domql/report": "latest",
27
27
  "@domql/utils": "latest"
28
28
  },
29
- "gitHead": "0194cc2107dc429d3ac8da467eaf8aa73bac6fb3"
29
+ "gitHead": "c867d7db9e2450d67e97a15ffc7b61692713c234"
30
30
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2016 symbo.ls
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.