@symbo.ls/button 0.4.2 → 0.5.7
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 +8 -2
- package/packages/react/index.js +7 -0
- package/packages/react/node_modules/.yarn-integrity +91 -0
- package/packages/react/node_modules/@domql/cache/LICENSE +21 -0
- package/packages/react/node_modules/@domql/cache/index.js +0 -0
- package/packages/react/node_modules/@domql/cache/package.json +10 -0
- package/packages/react/node_modules/@domql/cookie/LICENSE +21 -0
- package/packages/react/node_modules/@domql/cookie/index.js +22 -0
- package/packages/react/node_modules/@domql/cookie/package.json +10 -0
- package/packages/react/node_modules/@domql/define/LICENSE +21 -0
- package/packages/react/node_modules/@domql/define/index.js +13 -0
- package/packages/react/node_modules/@domql/define/package.json +11 -0
- package/packages/react/node_modules/@domql/domql/LICENSE +21 -0
- package/packages/react/node_modules/@domql/domql/package.json +33 -0
- package/packages/react/node_modules/@domql/domql/src/all_exports.js +17 -0
- package/packages/react/node_modules/@domql/domql/src/index.js +15 -0
- package/packages/react/node_modules/@domql/element/LICENSE +21 -0
- package/packages/react/node_modules/@domql/element/package.json +20 -0
- package/packages/react/node_modules/@domql/element/src/assign.js +22 -0
- package/packages/react/node_modules/@domql/element/src/create.js +125 -0
- package/packages/react/node_modules/@domql/element/src/index.js +8 -0
- package/packages/react/node_modules/@domql/element/src/iterate.js +80 -0
- package/packages/react/node_modules/@domql/element/src/methods.js +96 -0
- package/packages/react/node_modules/@domql/element/src/set.js +44 -0
- package/packages/react/node_modules/@domql/element/src/update.js +98 -0
- package/packages/react/node_modules/@domql/event/LICENSE +21 -0
- package/packages/react/node_modules/@domql/event/package.json +14 -0
- package/packages/react/node_modules/@domql/event/src/can.js +10 -0
- package/packages/react/node_modules/@domql/event/src/index.js +11 -0
- package/packages/react/node_modules/@domql/event/src/is.js +13 -0
- package/packages/react/node_modules/@domql/event/src/on.js +33 -0
- package/packages/react/node_modules/@domql/event/src/store.js +6 -0
- package/packages/react/node_modules/@domql/event/src/wrappers.js +14 -0
- package/packages/react/node_modules/@domql/event/yarn-error.log +44 -0
- package/packages/react/node_modules/@domql/id/LICENSE +21 -0
- package/packages/react/node_modules/@domql/id/index.js +12 -0
- package/packages/react/node_modules/@domql/id/package.json +10 -0
- package/packages/react/node_modules/@domql/mixins/LICENSE +21 -0
- package/packages/react/node_modules/@domql/mixins/package.json +12 -0
- package/packages/react/node_modules/@domql/mixins/src/attr.js +19 -0
- package/packages/react/node_modules/@domql/mixins/src/classList.js +37 -0
- package/packages/react/node_modules/@domql/mixins/src/content.js +17 -0
- package/packages/react/node_modules/@domql/mixins/src/data.js +21 -0
- package/packages/react/node_modules/@domql/mixins/src/html.js +17 -0
- package/packages/react/node_modules/@domql/mixins/src/index.js +11 -0
- package/packages/react/node_modules/@domql/mixins/src/registry.js +55 -0
- package/packages/react/node_modules/@domql/mixins/src/state.js +16 -0
- package/packages/react/node_modules/@domql/mixins/src/style.js +14 -0
- package/packages/react/node_modules/@domql/mixins/src/text.js +19 -0
- package/packages/react/node_modules/@domql/node/LICENSE +21 -0
- package/packages/react/node_modules/@domql/node/package.json +17 -0
- package/packages/react/node_modules/@domql/node/src/cache.js +52 -0
- package/packages/react/node_modules/@domql/node/src/create.js +86 -0
- package/packages/react/node_modules/@domql/node/src/index.js +5 -0
- package/packages/react/node_modules/@domql/node/src/registry.js +139 -0
- package/packages/react/node_modules/@domql/parse/LICENSE +21 -0
- package/packages/react/node_modules/@domql/parse/index.js +16 -0
- package/packages/react/node_modules/@domql/parse/package.json +10 -0
- package/packages/react/node_modules/@domql/props/LICENSE +21 -0
- package/packages/react/node_modules/@domql/props/package.json +10 -0
- package/packages/react/node_modules/@domql/props/src/index.js +62 -0
- package/packages/react/node_modules/@domql/proto/LICENSE +21 -0
- package/packages/react/node_modules/@domql/proto/index.js +66 -0
- package/packages/react/node_modules/@domql/proto/package.json +10 -0
- package/packages/react/node_modules/@domql/react-transformer/LICENSE +21 -0
- package/packages/react/node_modules/@domql/react-transformer/index.js +26 -0
- package/packages/react/node_modules/@domql/react-transformer/package.json +12 -0
- package/packages/react/node_modules/@domql/react-transformer/yarn-error.log +41 -0
- package/packages/react/node_modules/@domql/report/LICENSE +21 -0
- package/packages/react/node_modules/@domql/report/index.js +62 -0
- package/packages/react/node_modules/@domql/report/package.json +7 -0
- package/packages/react/node_modules/@domql/state/LICENSE +21 -0
- package/packages/react/node_modules/@domql/state/package.json +11 -0
- package/packages/react/node_modules/@domql/state/src/index.js +51 -0
- package/packages/react/node_modules/@domql/tree/LICENSE +21 -0
- package/packages/react/node_modules/@domql/tree/index.js +6 -0
- package/packages/react/node_modules/@domql/tree/package.json +10 -0
- package/packages/react/node_modules/@domql/tree/root.js +8 -0
- package/packages/react/node_modules/@domql/utils/LICENSE +21 -0
- package/packages/react/node_modules/@domql/utils/package.json +13 -0
- package/packages/react/node_modules/@domql/utils/src/index.js +5 -0
- package/packages/react/node_modules/@domql/utils/src/node.js +10 -0
- package/packages/react/node_modules/@domql/utils/src/object.js +193 -0
- package/packages/react/node_modules/@domql/utils/src/protoUtils.js +119 -0
- package/packages/react/node_modules/js-tokens/CHANGELOG.md +151 -0
- package/packages/react/node_modules/js-tokens/LICENSE +21 -0
- package/packages/react/node_modules/js-tokens/README.md +240 -0
- package/packages/react/node_modules/js-tokens/index.js +23 -0
- package/packages/react/node_modules/js-tokens/package.json +30 -0
- package/packages/react/node_modules/loose-envify/LICENSE +21 -0
- package/packages/react/node_modules/loose-envify/README.md +45 -0
- package/packages/react/node_modules/loose-envify/cli.js +16 -0
- package/packages/react/node_modules/loose-envify/custom.js +4 -0
- package/packages/react/node_modules/loose-envify/index.js +3 -0
- package/packages/react/node_modules/loose-envify/loose-envify.js +36 -0
- package/packages/react/node_modules/loose-envify/package.json +36 -0
- package/packages/react/node_modules/loose-envify/replace.js +65 -0
- package/packages/react/node_modules/object-assign/index.js +90 -0
- package/packages/react/node_modules/object-assign/license +21 -0
- package/packages/react/node_modules/object-assign/package.json +42 -0
- package/packages/react/node_modules/object-assign/readme.md +61 -0
- package/packages/react/node_modules/react/LICENSE +21 -0
- package/packages/react/node_modules/react/README.md +13 -0
- package/packages/react/node_modules/react/build-info.json +8 -0
- package/packages/react/node_modules/react/cjs/react-jsx-dev-runtime.development.js +1203 -0
- package/packages/react/node_modules/react/cjs/react-jsx-dev-runtime.production.min.js +9 -0
- package/packages/react/node_modules/react/cjs/react-jsx-dev-runtime.profiling.min.js +9 -0
- package/packages/react/node_modules/react/cjs/react-jsx-runtime.development.js +1221 -0
- package/packages/react/node_modules/react/cjs/react-jsx-runtime.production.min.js +10 -0
- package/packages/react/node_modules/react/cjs/react-jsx-runtime.profiling.min.js +10 -0
- package/packages/react/node_modules/react/cjs/react.development.js +2333 -0
- package/packages/react/node_modules/react/cjs/react.production.min.js +23 -0
- package/packages/react/node_modules/react/index.js +7 -0
- package/packages/react/node_modules/react/jsx-dev-runtime.js +7 -0
- package/packages/react/node_modules/react/jsx-runtime.js +7 -0
- package/packages/react/node_modules/react/package.json +39 -0
- package/packages/react/node_modules/react/umd/react.development.js +3357 -0
- package/packages/react/node_modules/react/umd/react.production.min.js +31 -0
- package/packages/react/node_modules/react/umd/react.profiling.min.js +36 -0
- package/packages/react/node_modules/regenerator-runtime/LICENSE +21 -0
- package/packages/react/node_modules/regenerator-runtime/README.md +31 -0
- package/packages/react/node_modules/regenerator-runtime/package.json +19 -0
- package/packages/react/node_modules/regenerator-runtime/path.js +11 -0
- package/packages/react/node_modules/regenerator-runtime/runtime.js +754 -0
- package/packages/react/package.json +6 -2
- package/packages/react/yarn.lock +183 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
attr,
|
|
5
|
+
style,
|
|
6
|
+
text,
|
|
7
|
+
html,
|
|
8
|
+
content,
|
|
9
|
+
data,
|
|
10
|
+
classList,
|
|
11
|
+
state
|
|
12
|
+
} from '.'
|
|
13
|
+
|
|
14
|
+
export const registry = {
|
|
15
|
+
attr,
|
|
16
|
+
style,
|
|
17
|
+
text,
|
|
18
|
+
html,
|
|
19
|
+
content,
|
|
20
|
+
data,
|
|
21
|
+
class: classList,
|
|
22
|
+
state,
|
|
23
|
+
|
|
24
|
+
proto: {},
|
|
25
|
+
props: {},
|
|
26
|
+
path: {},
|
|
27
|
+
childProto: {},
|
|
28
|
+
if: {},
|
|
29
|
+
define: {},
|
|
30
|
+
transform: {},
|
|
31
|
+
__hash: {},
|
|
32
|
+
__cached: {},
|
|
33
|
+
__defined: {},
|
|
34
|
+
__exec: {},
|
|
35
|
+
__changes: {},
|
|
36
|
+
__trash: {},
|
|
37
|
+
__root: {},
|
|
38
|
+
__props: {},
|
|
39
|
+
__proto: {},
|
|
40
|
+
__ifFragment: {},
|
|
41
|
+
__ifFalsy: {},
|
|
42
|
+
key: {},
|
|
43
|
+
tag: {},
|
|
44
|
+
parent: {},
|
|
45
|
+
node: {},
|
|
46
|
+
set: {},
|
|
47
|
+
update: {},
|
|
48
|
+
remove: {},
|
|
49
|
+
lookup: {},
|
|
50
|
+
keys: {},
|
|
51
|
+
log: {},
|
|
52
|
+
parse: {},
|
|
53
|
+
parseDeep: {},
|
|
54
|
+
on: {}
|
|
55
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { exec, isObject } from '@domql/utils'
|
|
4
|
+
|
|
5
|
+
export const state = (params, element, node) => {
|
|
6
|
+
const state = exec(params, element)
|
|
7
|
+
|
|
8
|
+
if (isObject(state)) {
|
|
9
|
+
for (const param in state) {
|
|
10
|
+
if (param === 'update' || param === '__element' || param === 'parse') continue
|
|
11
|
+
element.state[param] = exec(state[param], element)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return element
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { isObject, map } from '@domql/utils'
|
|
4
|
+
import { report } from '@domql/report'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Recursively add styles to a DOM node
|
|
8
|
+
*/
|
|
9
|
+
export const style = (params, element, node) => {
|
|
10
|
+
if (params) {
|
|
11
|
+
if (isObject(params)) map(node.style, params, element)
|
|
12
|
+
else report('HTMLInvalidStyles', params)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { exec } from '@domql/utils'
|
|
4
|
+
import { create } from '@domql/element'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates a text node and appends into
|
|
8
|
+
* an original one as a child
|
|
9
|
+
*/
|
|
10
|
+
export const text = (param, element, node) => {
|
|
11
|
+
const prop = exec(param, element)
|
|
12
|
+
if (element.tag === 'string') node.nodeValue = prop
|
|
13
|
+
else if (param) {
|
|
14
|
+
if (element.__text) {
|
|
15
|
+
element.__text.text = prop
|
|
16
|
+
if (element.__text.node) element.__text.node.nodeValue = prop
|
|
17
|
+
} else create({ tag: 'string', text: prop }, element, '__text')
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 rackai
|
|
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.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@domql/node",
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"main": "src/index.js",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@domql/define": "latest",
|
|
8
|
+
"@domql/element": "^1.3.0",
|
|
9
|
+
"@domql/event": "^1.3.0",
|
|
10
|
+
"@domql/mixins": "^1.3.0",
|
|
11
|
+
"@domql/utils": "^1.3.0"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"vpatch": "npm version patch && npm publish --access public"
|
|
15
|
+
},
|
|
16
|
+
"gitHead": "3140379c0f6da459a39068f32630275c6ea3b33f"
|
|
17
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { can } from '@domql/event'
|
|
4
|
+
import { exec, isString, isValidHtmlTag, report } from '@domql/utils'
|
|
5
|
+
|
|
6
|
+
const cachedElements = {}
|
|
7
|
+
|
|
8
|
+
const createNode = (element) => {
|
|
9
|
+
const { tag } = element
|
|
10
|
+
if (tag) {
|
|
11
|
+
if (tag === 'string') return document.createTextNode(element.text)
|
|
12
|
+
else if (tag === 'fragment') {
|
|
13
|
+
return document.createDocumentFragment()
|
|
14
|
+
} else if (tag === 'svg' || tag === 'path') { // change that
|
|
15
|
+
return document.createElementNS('http://www.w3.org/2000/svg', tag)
|
|
16
|
+
} else return document.createElement(tag)
|
|
17
|
+
} else {
|
|
18
|
+
return document.createElement('div')
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const detectTag = element => {
|
|
23
|
+
let { tag, key } = element
|
|
24
|
+
tag = exec(tag, element)
|
|
25
|
+
|
|
26
|
+
if (tag === true) tag = key
|
|
27
|
+
|
|
28
|
+
if (isString(tag)) {
|
|
29
|
+
const tagExists = isValidHtmlTag(tag) > -1
|
|
30
|
+
if (tagExists) return tag
|
|
31
|
+
} else {
|
|
32
|
+
const isKeyATag = isValidHtmlTag(key) > -1
|
|
33
|
+
if (isKeyATag) return key
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return 'div'
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const cacheNode = (element) => {
|
|
40
|
+
const tag = element.tag = detectTag(element)
|
|
41
|
+
|
|
42
|
+
if (!can.render(element)) {
|
|
43
|
+
return report('HTMLInvalidTag')
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let cachedTag = cachedElements[tag]
|
|
47
|
+
if (!cachedTag) cachedTag = cachedElements[tag] = createNode(element)
|
|
48
|
+
|
|
49
|
+
const clonedNode = cachedTag.cloneNode(true)
|
|
50
|
+
if (tag === 'string') clonedNode.nodeValue = element.text
|
|
51
|
+
return clonedNode
|
|
52
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { create, throughInitialDefine, throughInitialExec, applyEvents, isMethod } from '@domql/element'
|
|
4
|
+
import { isFunction, isObject } from '@domql/utils'
|
|
5
|
+
import { on } from '@domql/event'
|
|
6
|
+
import { registry } from '@domql/mixins'
|
|
7
|
+
import { cacheNode } from './cache'
|
|
8
|
+
// import { defineSetter } from './methods'
|
|
9
|
+
|
|
10
|
+
const ENV = process.env.NODE_ENV
|
|
11
|
+
|
|
12
|
+
// const defineSetter = (element, key) => Object.defineProperty(element, key, {
|
|
13
|
+
// get: function () {
|
|
14
|
+
// console.log('GET', key)
|
|
15
|
+
// return element.__data[key]
|
|
16
|
+
// },
|
|
17
|
+
// set: function (new_value) {
|
|
18
|
+
// console.log('SET', key, new_value)
|
|
19
|
+
// element.__data[key] = new_value
|
|
20
|
+
// element.__data['modified'] = (new Date()).getTime()
|
|
21
|
+
// }
|
|
22
|
+
// })
|
|
23
|
+
|
|
24
|
+
export * from './cache'
|
|
25
|
+
export * from './registry'
|
|
26
|
+
|
|
27
|
+
export const createNode = (element) => {
|
|
28
|
+
// create and assign a node
|
|
29
|
+
let { node, tag } = element
|
|
30
|
+
|
|
31
|
+
let isNewNode
|
|
32
|
+
|
|
33
|
+
// console.groupCollapsed('CREATE:')
|
|
34
|
+
// console.log(element)
|
|
35
|
+
// console.groupEnd('CREATE:')
|
|
36
|
+
|
|
37
|
+
if (!node) {
|
|
38
|
+
isNewNode = true
|
|
39
|
+
|
|
40
|
+
if (tag === 'shadow') {
|
|
41
|
+
node = element.node = element.parent.node.attachShadow({ mode: 'open' })
|
|
42
|
+
} else node = element.node = cacheNode(element)
|
|
43
|
+
|
|
44
|
+
// run `on.attachNode`
|
|
45
|
+
if (element.on && isFunction(element.on.attachNode)) {
|
|
46
|
+
on.attachNode(element.on.attachNode, element, element.state)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// node.dataset // .key = element.key
|
|
51
|
+
|
|
52
|
+
if (ENV === 'test' || ENV === 'development') {
|
|
53
|
+
node.ref = element
|
|
54
|
+
if (isFunction(node.setAttribute)) node.setAttribute('key', element.key)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// iterate through all given params
|
|
58
|
+
if (element.tag !== 'string' || element.tag !== 'fragment') {
|
|
59
|
+
// iterate through define
|
|
60
|
+
if (isObject(element.define)) throughInitialDefine(element)
|
|
61
|
+
|
|
62
|
+
// iterate through exec
|
|
63
|
+
throughInitialExec(element)
|
|
64
|
+
|
|
65
|
+
// apply events
|
|
66
|
+
if (isNewNode && isObject(element.on)) applyEvents(element)
|
|
67
|
+
|
|
68
|
+
for (const param in element) {
|
|
69
|
+
const prop = element[param]
|
|
70
|
+
|
|
71
|
+
if (isMethod(param) || isObject(registry[param]) || prop === undefined) continue
|
|
72
|
+
|
|
73
|
+
const hasDefined = element.define && element.define[param]
|
|
74
|
+
const ourParam = registry[param]
|
|
75
|
+
|
|
76
|
+
if (ourParam) { // Check if param is in our method registry
|
|
77
|
+
if (isFunction(ourParam)) ourParam(prop, element, node)
|
|
78
|
+
} else if (element[param] && !hasDefined) {
|
|
79
|
+
create(prop, element, param) // Create element
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// node.dataset.key = key
|
|
85
|
+
return element
|
|
86
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
export const NODE_REGISTRY = {
|
|
4
|
+
root: [
|
|
5
|
+
'body',
|
|
6
|
+
'html'
|
|
7
|
+
],
|
|
8
|
+
|
|
9
|
+
head: [
|
|
10
|
+
'title',
|
|
11
|
+
'base',
|
|
12
|
+
'meta',
|
|
13
|
+
'style'
|
|
14
|
+
],
|
|
15
|
+
|
|
16
|
+
body: [
|
|
17
|
+
'string',
|
|
18
|
+
'fragment',
|
|
19
|
+
'a',
|
|
20
|
+
'abbr',
|
|
21
|
+
'acronym',
|
|
22
|
+
'address',
|
|
23
|
+
'applet',
|
|
24
|
+
'area',
|
|
25
|
+
'article',
|
|
26
|
+
'aside',
|
|
27
|
+
'audio',
|
|
28
|
+
'b',
|
|
29
|
+
'basefont',
|
|
30
|
+
'bdi',
|
|
31
|
+
'bdo',
|
|
32
|
+
'big',
|
|
33
|
+
'blockquote',
|
|
34
|
+
'br',
|
|
35
|
+
'button',
|
|
36
|
+
'canvas',
|
|
37
|
+
'caption',
|
|
38
|
+
'center',
|
|
39
|
+
'cite',
|
|
40
|
+
'code',
|
|
41
|
+
'col',
|
|
42
|
+
'colgroup',
|
|
43
|
+
'data',
|
|
44
|
+
'datalist',
|
|
45
|
+
'dd',
|
|
46
|
+
'del',
|
|
47
|
+
'details',
|
|
48
|
+
'dfn',
|
|
49
|
+
'dialog',
|
|
50
|
+
'dir',
|
|
51
|
+
'div',
|
|
52
|
+
'dl',
|
|
53
|
+
'dt',
|
|
54
|
+
'em',
|
|
55
|
+
'embed',
|
|
56
|
+
'fieldset',
|
|
57
|
+
'figcaption',
|
|
58
|
+
'figure',
|
|
59
|
+
'font',
|
|
60
|
+
'footer',
|
|
61
|
+
'form',
|
|
62
|
+
'frame',
|
|
63
|
+
'frameset',
|
|
64
|
+
'h1',
|
|
65
|
+
'h2',
|
|
66
|
+
'h3',
|
|
67
|
+
'h4',
|
|
68
|
+
'h5',
|
|
69
|
+
'h6',
|
|
70
|
+
'head',
|
|
71
|
+
'header',
|
|
72
|
+
'hr',
|
|
73
|
+
'i',
|
|
74
|
+
'iframe',
|
|
75
|
+
'img',
|
|
76
|
+
'input',
|
|
77
|
+
'ins',
|
|
78
|
+
'kbd',
|
|
79
|
+
'label',
|
|
80
|
+
'legend',
|
|
81
|
+
'li',
|
|
82
|
+
'link',
|
|
83
|
+
'main',
|
|
84
|
+
'map',
|
|
85
|
+
'mark',
|
|
86
|
+
'meter',
|
|
87
|
+
'nav',
|
|
88
|
+
'noframes',
|
|
89
|
+
'noscript',
|
|
90
|
+
'object',
|
|
91
|
+
'ol',
|
|
92
|
+
'optgroup',
|
|
93
|
+
'option',
|
|
94
|
+
'output',
|
|
95
|
+
'p',
|
|
96
|
+
'param',
|
|
97
|
+
'picture',
|
|
98
|
+
'pre',
|
|
99
|
+
'progress',
|
|
100
|
+
'q',
|
|
101
|
+
'rp',
|
|
102
|
+
'rt',
|
|
103
|
+
'ruby',
|
|
104
|
+
's',
|
|
105
|
+
'samp',
|
|
106
|
+
'script',
|
|
107
|
+
'section',
|
|
108
|
+
'select',
|
|
109
|
+
'small',
|
|
110
|
+
'source',
|
|
111
|
+
'span',
|
|
112
|
+
'strike',
|
|
113
|
+
'strong',
|
|
114
|
+
'sub',
|
|
115
|
+
'summary',
|
|
116
|
+
'sup',
|
|
117
|
+
'table',
|
|
118
|
+
'tbody',
|
|
119
|
+
'td',
|
|
120
|
+
'template',
|
|
121
|
+
'textarea',
|
|
122
|
+
'tfoot',
|
|
123
|
+
'th',
|
|
124
|
+
'thead',
|
|
125
|
+
'time',
|
|
126
|
+
'tr',
|
|
127
|
+
'track',
|
|
128
|
+
'tt',
|
|
129
|
+
'u',
|
|
130
|
+
'ul',
|
|
131
|
+
'var',
|
|
132
|
+
'video',
|
|
133
|
+
'wbr',
|
|
134
|
+
|
|
135
|
+
// SVG
|
|
136
|
+
'svg',
|
|
137
|
+
'path'
|
|
138
|
+
]
|
|
139
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 rackai
|
|
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.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { create, assignNode } from '@domql/element'
|
|
4
|
+
|
|
5
|
+
const parse = (element) => {
|
|
6
|
+
const virtualTree = {
|
|
7
|
+
node: document.createElement('div')
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (element && element.node) assignNode(element, virtualTree)
|
|
11
|
+
else create(element, virtualTree)
|
|
12
|
+
|
|
13
|
+
return virtualTree.node.innerHTML
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default parse
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 rackai
|
|
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.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { deepClone, deepMerge, exec, isArray } from '@domql/utils'
|
|
4
|
+
|
|
5
|
+
const initProps = (element, parent) => {
|
|
6
|
+
const propsStack = []
|
|
7
|
+
if (element.props) propsStack.push(element.props)
|
|
8
|
+
|
|
9
|
+
if (isArray(element.__proto)) {
|
|
10
|
+
element.__proto.map(proto => {
|
|
11
|
+
if (proto.props) propsStack.push(proto.props)
|
|
12
|
+
return proto.props
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return propsStack
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const inheritProps = (element, parent) => {
|
|
20
|
+
element.props = (parent && parent.props) || { update, __element: element }
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const syncProps = (props, element) => {
|
|
24
|
+
element.props = {}
|
|
25
|
+
const mergedProps = { update, __element: element }
|
|
26
|
+
props.forEach(v => {
|
|
27
|
+
if (v === 'update' || v === '__element') return
|
|
28
|
+
element.props = deepMerge(mergedProps, deepClone(exec(v, element)))
|
|
29
|
+
})
|
|
30
|
+
element.props = mergedProps
|
|
31
|
+
return element.props
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const createProps = function (element, parent, cached) {
|
|
35
|
+
const propsStack = cached || initProps(element, parent)
|
|
36
|
+
|
|
37
|
+
if (propsStack.length) {
|
|
38
|
+
element.__props = propsStack
|
|
39
|
+
syncProps(propsStack, element)
|
|
40
|
+
element.props.update = update
|
|
41
|
+
} else inheritProps(element, parent)
|
|
42
|
+
|
|
43
|
+
return element
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const updateProps = (newProps, element, parent) => {
|
|
47
|
+
let propsStack = element.__props
|
|
48
|
+
|
|
49
|
+
if (newProps) propsStack = element.__props = [].concat(newProps, propsStack)
|
|
50
|
+
|
|
51
|
+
if (propsStack) syncProps(propsStack, element)
|
|
52
|
+
else inheritProps(element, parent)
|
|
53
|
+
|
|
54
|
+
// console.log(cachedProps)
|
|
55
|
+
return element
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function update (props) {
|
|
59
|
+
const element = this.__element
|
|
60
|
+
// element.update({ props })
|
|
61
|
+
element.update()
|
|
62
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 rackai
|
|
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.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { isFunction, exec, getProtoStack, jointStacks, cloneAndMergeArrayProto, deepMergeProto } from '@domql/utils'
|
|
4
|
+
|
|
5
|
+
const ENV = process.env.NODE_ENV
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Checks whether element has `proto` or is a part
|
|
9
|
+
* of parent's `childProto` prototype
|
|
10
|
+
*/
|
|
11
|
+
export const applyPrototype = (element, parent, options = {}) => {
|
|
12
|
+
if (isFunction(element)) element = exec(element, parent)
|
|
13
|
+
|
|
14
|
+
const { proto } = element
|
|
15
|
+
|
|
16
|
+
// merge if proto is array
|
|
17
|
+
// const proto = mergeAndCloneIfArray(element.proto, v => {
|
|
18
|
+
// if (v.props) cache.props.push(v.props)
|
|
19
|
+
// console.log('v.propsIN_PROTO:')
|
|
20
|
+
// console.log(v.props)
|
|
21
|
+
// })
|
|
22
|
+
|
|
23
|
+
// console.log(proto)
|
|
24
|
+
const protoStack = getProtoStack(proto)
|
|
25
|
+
|
|
26
|
+
if (ENV !== 'test' || ENV !== 'development') delete element.proto
|
|
27
|
+
|
|
28
|
+
// console.log(parent.childProto)
|
|
29
|
+
|
|
30
|
+
// console.log(element)
|
|
31
|
+
// console.log(proto)
|
|
32
|
+
// console.log(protoStack)
|
|
33
|
+
// debugger
|
|
34
|
+
|
|
35
|
+
let childProtoStack = []
|
|
36
|
+
if (parent) {
|
|
37
|
+
// Assign parent attr to the element
|
|
38
|
+
element.parent = parent
|
|
39
|
+
if (!options.ignoreChildProto) {
|
|
40
|
+
childProtoStack = getProtoStack(parent.childProto)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// console.log(proto, parent && parent.childProto)
|
|
45
|
+
// console.log(protoStack, childProtoStack)
|
|
46
|
+
|
|
47
|
+
const protoLength = protoStack.length
|
|
48
|
+
const childProtoLength = childProtoStack.length
|
|
49
|
+
|
|
50
|
+
let stack = []
|
|
51
|
+
if (protoLength && childProtoLength) {
|
|
52
|
+
stack = jointStacks(protoStack, childProtoStack)
|
|
53
|
+
} else if (protoLength) {
|
|
54
|
+
stack = protoStack
|
|
55
|
+
} else if (childProtoLength) {
|
|
56
|
+
stack = childProtoStack
|
|
57
|
+
} else return element
|
|
58
|
+
|
|
59
|
+
element.__proto = stack
|
|
60
|
+
const mergedProto = cloneAndMergeArrayProto(stack)
|
|
61
|
+
|
|
62
|
+
// console.log(mergedProto)
|
|
63
|
+
return deepMergeProto(element, mergedProto)
|
|
64
|
+
|
|
65
|
+
// final merging with prototype
|
|
66
|
+
}
|