@domql/element 2.5.52 → 2.5.56

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/create.js CHANGED
@@ -34,6 +34,7 @@ import {
34
34
  applyKeyComponentAsExtend,
35
35
  applyVariant,
36
36
  checkIfKeyIsComponent,
37
+ createValidDomqlObjectFromSugar,
37
38
  isVariant
38
39
  } from './utils/component'
39
40
 
@@ -151,7 +152,9 @@ const createBasedOnType = (element, parent, key, options) => {
151
152
  const redefineElement = (element, parent, key, options) => {
152
153
  const elementWrapper = createBasedOnType(element, parent, key, options)
153
154
 
154
- if (checkIfKeyIsComponent(key)) {
155
+ if (options.syntaxv3 || element.props?.syntaxv3) {
156
+ return createValidDomqlObjectFromSugar(element, parent, key, options)
157
+ } else if (checkIfKeyIsComponent(key)) {
155
158
  return applyKeyComponentAsExtend(elementWrapper, parent, key)
156
159
  }
157
160
 
@@ -115,8 +115,11 @@ const createBasedOnType = (element, parent, key, options) => {
115
115
  return element;
116
116
  };
117
117
  const redefineElement = (element, parent, key, options) => {
118
+ var _a;
118
119
  const elementWrapper = createBasedOnType(element, parent, key, options);
119
- if ((0, import_component.checkIfKeyIsComponent)(key)) {
120
+ if (options.syntaxv3 || ((_a = element.props) == null ? void 0 : _a.syntaxv3)) {
121
+ return (0, import_component.createValidDomqlObjectFromSugar)(element, parent, key, options);
122
+ } else if ((0, import_component.checkIfKeyIsComponent)(key)) {
120
123
  return (0, import_component.applyKeyComponentAsExtend)(elementWrapper, parent, key);
121
124
  }
122
125
  if (checkIfMedia(key)) {
@@ -68,8 +68,11 @@ var registry_default = {
68
68
  on: {},
69
69
  component: {},
70
70
  context: {},
71
- $setStateCollection: {},
71
+ $collection: {},
72
+ $stateCollection: {},
73
+ $propsCollection: {},
72
74
  $setCollection: {},
75
+ $setStateCollection: {},
73
76
  $setPropsCollection: {}
74
77
  };
75
78
  const parseFilters = {
@@ -34,7 +34,19 @@ module.exports = __toCommonJS(component_exports);
34
34
  var import_utils = require("@domql/utils");
35
35
  var import_extend = require("../extend");
36
36
  const ENV = "development";
37
- const DOMQL_BUILTINS = ["extend", "childExtend", "childExtendRecursive", "define", "props", "state", "on", "if", "attr", "key", "tag"];
37
+ const DOMQL_BUILTINS = [
38
+ "extend",
39
+ "childExtend",
40
+ "childExtendRecursive",
41
+ "define",
42
+ "props",
43
+ "state",
44
+ "on",
45
+ "if",
46
+ "attr",
47
+ "key",
48
+ "tag"
49
+ ];
38
50
  const checkIfKeyIsComponent = (key) => {
39
51
  const isFirstKeyString = (0, import_utils.isString)(key);
40
52
  if (!isFirstKeyString)
@@ -57,7 +69,7 @@ const addAdditionalExtend = (newExtend, element) => {
57
69
  return { ...element, extend };
58
70
  };
59
71
  const replaceOnKeys = (key) => key.replace(/on\w+/g, (match) => match.substring(2));
60
- const createValidDomqlObjectFromSugar = (el) => {
72
+ const createValidDomqlObjectFromSugar = (el, parent, key, options) => {
61
73
  const newElem = {
62
74
  props: {},
63
75
  on: {}
@@ -72,6 +84,10 @@ const createValidDomqlObjectFromSugar = (el) => {
72
84
  } else if (!isMethod && checkIfKeyIsProperty(k)) {
73
85
  if (!DOMQL_BUILTINS.includes(k))
74
86
  newElem.props[k] = prop;
87
+ } else if (checkIfKeyIsComponent(k)) {
88
+ newElem[k] = prop;
89
+ } else {
90
+ newElem[k] = prop;
75
91
  }
76
92
  }
77
93
  return newElem;
@@ -53,8 +53,11 @@ export default {
53
53
  on: {},
54
54
  component: {},
55
55
  context: {},
56
- $setStateCollection: {},
56
+ $collection: {},
57
+ $stateCollection: {},
58
+ $propsCollection: {},
57
59
  $setCollection: {},
60
+ $setStateCollection: {},
58
61
  $setPropsCollection: {}
59
62
  }
60
63
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/element",
3
- "version": "2.5.52",
3
+ "version": "2.5.56",
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": "d417eb4852233ff71f790eae23b67b521e80c4f9",
34
+ "gitHead": "a832fd0b6d8c39f16e6c7b2b61ab6c3dccd1f539",
35
35
  "devDependencies": {
36
36
  "@babel/core": "^7.12.0"
37
37
  }
@@ -4,7 +4,19 @@ import { exec, isArray, isFunction, isObject, isString, joinArrays, overwriteDee
4
4
  import { applyExtend } from '../extend'
5
5
  const ENV = process.env.NODE_ENV
6
6
 
7
- const DOMQL_BUILTINS = ['extend', 'childExtend', 'childExtendRecursive', 'define', 'props', 'state', 'on', 'if', 'attr', 'key', 'tag']
7
+ const DOMQL_BUILTINS = [
8
+ 'extend',
9
+ 'childExtend',
10
+ 'childExtendRecursive',
11
+ 'define',
12
+ 'props',
13
+ 'state',
14
+ 'on',
15
+ 'if',
16
+ 'attr',
17
+ 'key',
18
+ 'tag'
19
+ ]
8
20
 
9
21
  export const checkIfKeyIsComponent = (key) => {
10
22
  const isFirstKeyString = isString(key)
@@ -12,6 +24,7 @@ export const checkIfKeyIsComponent = (key) => {
12
24
  const firstCharKey = key.slice(0, 1)
13
25
  return /^[A-Z]*$/.test(firstCharKey)
14
26
  }
27
+
15
28
  export const checkIfKeyIsProperty = (key) => {
16
29
  const isFirstKeyString = isString(key)
17
30
  if (!isFirstKeyString) return
@@ -29,7 +42,7 @@ export const addAdditionalExtend = (newExtend, element) => {
29
42
 
30
43
  const replaceOnKeys = key => key.replace(/on\w+/g, match => match.substring(2))
31
44
 
32
- export const createValidDomqlObjectFromSugar = el => {
45
+ export const createValidDomqlObjectFromSugar = (el, parent, key, options) => {
33
46
  const newElem = {
34
47
  props: {},
35
48
  on: {}
@@ -43,6 +56,10 @@ export const createValidDomqlObjectFromSugar = el => {
43
56
  newElem.on[onKey] = prop
44
57
  } else if (!isMethod && checkIfKeyIsProperty(k)) {
45
58
  if (!DOMQL_BUILTINS.includes(k)) newElem.props[k] = prop
59
+ } else if (checkIfKeyIsComponent(k)) {
60
+ newElem[k] = prop
61
+ } else {
62
+ newElem[k] = prop
46
63
  }
47
64
  }
48
65
  return newElem