domql 1.5.94 → 1.5.96
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/package.json +5 -4
- package/src/element/state.js +9 -3
- package/src/utils/object.js +5 -7
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "domql",
|
|
3
3
|
"description": "DOM rendering Javascript framework at early stage.",
|
|
4
4
|
"author": "symbo.ls",
|
|
5
|
-
"version": "1.5.
|
|
5
|
+
"version": "1.5.96",
|
|
6
6
|
"repository": "https://github.com/domql/domql",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"registry": "https://registry.npmjs.org"
|
|
@@ -15,11 +15,12 @@
|
|
|
15
15
|
"packages"
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
|
-
"
|
|
18
|
+
"compile": "npx esbuild src/index.js --target=es2020 --format=cjs --bundle --sourcemap=external --outfile=dist/index.cjs.js",
|
|
19
|
+
"prepublish": "rm -rf dist && yarn compile && yarn test:lint",
|
|
19
20
|
"start": "parcel examples/index.html --no-cache",
|
|
20
21
|
"build": "parcel build examples/index.html",
|
|
21
|
-
"
|
|
22
|
-
"test": "yarn
|
|
22
|
+
"test:lint": "npx standard \"src/**/*.js\"",
|
|
23
|
+
"test": "yarn test:lint; jest --coverage --coverageReporters=text-lcov | coveralls",
|
|
23
24
|
"test-watch": "jest --watch"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
package/src/element/state.js
CHANGED
|
@@ -5,9 +5,15 @@ import { deepClone, exec, overwriteShallow, overwriteDeep } from '../utils'
|
|
|
5
5
|
import { is, isObject, isFunction, isUndefined } from '@domql/utils'
|
|
6
6
|
|
|
7
7
|
export const IGNORE_STATE_PARAMS = [
|
|
8
|
+
<<<<<<< HEAD
|
|
9
|
+
'update', 'parse', 'clean', 'create', 'parent', '__element', '__depends',
|
|
10
|
+
'__ref', '__root', '__components', '__extend', '__cached', '__projectSystem',
|
|
11
|
+
'__projectState', '__projectComponents', '__projectPages', '__projectFiddles',
|
|
12
|
+
=======
|
|
8
13
|
'update', 'parse', 'clean', 'create', 'parent', '__element', '__depends', '__ref', '__root',
|
|
9
|
-
'__components',
|
|
10
|
-
'__projectSystem', '__projectState', '__projectComponents', '__projectPages', '
|
|
14
|
+
'__components', '__extend', '__cached',
|
|
15
|
+
'__projectSystem', '__projectState', '__projectComponents', '__projectPages', '__projectSnippets',
|
|
16
|
+
>>>>>>> 5e4dd98 (fiddle > snippets)
|
|
11
17
|
'projectStateUpdate', 'projectSystemUpdate'
|
|
12
18
|
]
|
|
13
19
|
|
|
@@ -188,7 +194,7 @@ export const createState = function (element, parent, opts) {
|
|
|
188
194
|
state.__projectState = state.__root.PROJECT_STATE
|
|
189
195
|
state.__projectComponents = state.__root.PROJECT_COMPONENTS
|
|
190
196
|
state.__projectPages = state.__root.PROJECT_PAGES
|
|
191
|
-
state.
|
|
197
|
+
state.__projectSnippets = state.__root.PROJECT_SNIPPETS
|
|
192
198
|
|
|
193
199
|
// run `on.stateCreated`
|
|
194
200
|
if (element.on && isFunction(element.on.stateCreated)) {
|
package/src/utils/object.js
CHANGED
|
@@ -95,7 +95,6 @@ export const merge = (element, obj) => {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
export const deepMerge = (element, extend) => {
|
|
98
|
-
// console.groupCollapsed('deepMerge:')
|
|
99
98
|
for (const e in extend) {
|
|
100
99
|
const elementProp = element[e]
|
|
101
100
|
const extendProp = extend[e]
|
|
@@ -107,7 +106,6 @@ export const deepMerge = (element, extend) => {
|
|
|
107
106
|
deepMerge(elementProp, extendProp)
|
|
108
107
|
}
|
|
109
108
|
}
|
|
110
|
-
// console.groupEnd('deepMerge:')
|
|
111
109
|
return element
|
|
112
110
|
}
|
|
113
111
|
|
|
@@ -123,16 +121,16 @@ export const clone = obj => {
|
|
|
123
121
|
/**
|
|
124
122
|
* Deep cloning of object
|
|
125
123
|
*/
|
|
126
|
-
export const deepClone = (obj, excluding = ['parent', 'node', '__element', 'state', '__root', 'context']) => {
|
|
124
|
+
export const deepClone = (obj, excluding = ['parent', 'node', '__element', 'state', '__root', '__cached', 'context']) => {
|
|
127
125
|
const o = isArray(obj) ? [] : {}
|
|
128
126
|
for (const prop in obj) {
|
|
129
127
|
if (excluding.indexOf(prop) > -1) continue
|
|
130
128
|
let objProp = obj[prop]
|
|
131
129
|
if (prop === 'extend' && isArray(objProp)) {
|
|
132
|
-
objProp = mergeArray(objProp)
|
|
130
|
+
objProp = mergeArray(objProp, excluding)
|
|
133
131
|
}
|
|
134
132
|
if (isObjectLike(objProp)) {
|
|
135
|
-
o[prop] = deepClone(objProp)
|
|
133
|
+
o[prop] = deepClone(objProp, excluding)
|
|
136
134
|
} else o[prop] = objProp
|
|
137
135
|
}
|
|
138
136
|
return o
|
|
@@ -217,8 +215,8 @@ export const mergeIfExisted = (a, b) => {
|
|
|
217
215
|
/**
|
|
218
216
|
* Merges array extends
|
|
219
217
|
*/
|
|
220
|
-
export const mergeArray = (arr) => {
|
|
221
|
-
return arr.reduce((a, c) => deepMerge(a, deepClone(c)), {})
|
|
218
|
+
export const mergeArray = (arr, excluding = ['parent', 'node', '__element', 'state', '__root', '__cached', 'context']) => {
|
|
219
|
+
return arr.reduce((a, c) => deepMerge(a, deepClone(c, excluding)), {})
|
|
222
220
|
}
|
|
223
221
|
|
|
224
222
|
/**
|