@domql/element 2.4.9 → 2.4.10

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 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.
package/create.js CHANGED
@@ -103,7 +103,7 @@ const create = (element, parent, key, options = OPTIONS.create || {}) => {
103
103
 
104
104
  // Only resolve extends, skip everything else
105
105
  if (options.onlyResolveExtends) {
106
- return resolveExtends(element, parent, options)
106
+ return onlyResolveExtends(element, parent, options)
107
107
  }
108
108
 
109
109
  if (Object.keys(options).length) {
@@ -241,7 +241,7 @@ const addCaching = (element, parent) => {
241
241
  }
242
242
  }
243
243
 
244
- const resolveExtends = (element, parent, options) => {
244
+ const onlyResolveExtends = (element, parent, options) => {
245
245
  const { __ref } = element
246
246
  element.tag = detectTag(element)
247
247
 
@@ -249,9 +249,9 @@ const resolveExtends = (element, parent, options) => {
249
249
  if (!__ref.__attr) __ref.__attr = {}
250
250
 
251
251
  if (!element.props) element.props = {}
252
- if (!element.state) element.state = {}
252
+ if (!element.state) element.state = element.parent.state || {}
253
253
 
254
- createState(element, parent, { skipApplyMethods: true })
254
+ createState(element, parent, { skipApplyMethods: true, ...options })
255
255
  createProps(element, parent)
256
256
  applyVariant(element, parent)
257
257
 
@@ -267,8 +267,8 @@ const resolveExtends = (element, parent, options) => {
267
267
  ) continue
268
268
 
269
269
  const hasDefine = element.define && element.define[param]
270
- const contextHasDefine = element.context && element.context.define
271
- && element.context.define[param]
270
+ const contextHasDefine = element.context && element.context.define &&
271
+ element.context.define[param]
272
272
  const optionsHasDefine = options.define && options.define[param]
273
273
 
274
274
  if (registry[param] && !optionsHasDefine) {
@@ -100,7 +100,7 @@ const create = (element, parent, key, options = import_options.default.create ||
100
100
  (0, import_extend.applyExtend)(element, parent, options);
101
101
  element.key = assignedKey;
102
102
  if (options.onlyResolveExtends) {
103
- return resolveExtends(element, parent, options);
103
+ return onlyResolveExtends(element, parent, options);
104
104
  }
105
105
  if (Object.keys(options).length) {
106
106
  import_mixins.registry.defaultOptions = options;
@@ -200,7 +200,7 @@ const addCaching = (element, parent) => {
200
200
  ref.__path = parentRef.__path.concat(element.key);
201
201
  }
202
202
  };
203
- const resolveExtends = (element, parent, options) => {
203
+ const onlyResolveExtends = (element, parent, options) => {
204
204
  const { __ref } = element;
205
205
  element.tag = (0, import_node2.detectTag)(element);
206
206
  if (!__ref.__exec)
@@ -210,8 +210,8 @@ const resolveExtends = (element, parent, options) => {
210
210
  if (!element.props)
211
211
  element.props = {};
212
212
  if (!element.state)
213
- element.state = {};
214
- (0, import_state.createState)(element, parent, { skipApplyMethods: true });
213
+ element.state = element.parent.state || {};
214
+ (0, import_state.createState)(element, parent, { skipApplyMethods: true, ...options });
215
215
  (0, import_props.createProps)(element, parent);
216
216
  (0, import_component.applyVariant)(element, parent);
217
217
  (0, import_iterate.throughInitialExec)(element, options.propsExcludedFromExec);
@@ -49,9 +49,9 @@ const applyExtend = (element, parent, options = {}) => {
49
49
  if (props && props.ignoreChildExtend)
50
50
  return;
51
51
  childExtendStack = (0, import_utils2.getExtendStack)(parent.childExtend);
52
- if (parent.childExtendRecursive || props && props.ignoreChildExtendRecursive) {
53
- const propsChildExtendRecursive = props && !props.ignoreChildExtendRecursive;
54
- const canExtendRecursive = propsChildExtendRecursive && element.key !== "__text";
52
+ const ignoreChildExtendRecursive = props && props.ignoreChildExtendRecursive;
53
+ if (parent.childExtendRecursive && !ignoreChildExtendRecursive) {
54
+ const canExtendRecursive = element.key !== "__text";
55
55
  if (canExtendRecursive) {
56
56
  const childExtendRecursiveStack = (0, import_utils2.getExtendStack)(parent.childExtendRecursive);
57
57
  childExtendStack = childExtendStack.concat(childExtendRecursiveStack);
package/extend.js CHANGED
@@ -44,9 +44,9 @@ export const applyExtend = (element, parent, options = {}) => {
44
44
  childExtendStack = getExtendStack(parent.childExtend)
45
45
 
46
46
  // if (parent.childExtendRecursive && (props && !props.ignoreChildExtendRecursive)) {
47
- if (parent.childExtendRecursive || (props && props.ignoreChildExtendRecursive)) {
48
- const propsChildExtendRecursive = props && !props.ignoreChildExtendRecursive
49
- const canExtendRecursive = propsChildExtendRecursive && element.key !== '__text'
47
+ const ignoreChildExtendRecursive = props && props.ignoreChildExtendRecursive
48
+ if (parent.childExtendRecursive && !ignoreChildExtendRecursive) {
49
+ const canExtendRecursive = element.key !== '__text'
50
50
  if (canExtendRecursive) {
51
51
  const childExtendRecursiveStack = getExtendStack(parent.childExtendRecursive)
52
52
  // add error if childExtendRecursive contains element which goes to infinite loop
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/element",
3
- "version": "2.4.9",
3
+ "version": "2.4.10",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "index.js",
@@ -31,7 +31,7 @@
31
31
  "@domql/state": "latest",
32
32
  "@domql/utils": "latest"
33
33
  },
34
- "gitHead": "86251c1d94b9e87288cc9e84fd9badb6461b2973",
34
+ "gitHead": "0b2e301e066ed1745f29966e05bca8531c3487f6",
35
35
  "devDependencies": {
36
36
  "@babel/core": "^7.12.0"
37
37
  }