@symbo.ls/button 0.5.8 → 0.6.2
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/dist/index.js +99 -0
- package/dist/index.js.map +1 -0
- package/package.json +7 -7
- package/packages/react/dist/index.js +17 -0
- package/packages/react/dist/index.js.map +1 -0
- package/packages/react/package.json +5 -5
- package/packages/react/{index.js → src/index.js} +0 -0
- package/packages/react/node_modules/.yarn-integrity +0 -91
- package/packages/react/node_modules/@domql/cache/LICENSE +0 -21
- package/packages/react/node_modules/@domql/cache/index.js +0 -0
- package/packages/react/node_modules/@domql/cache/package.json +0 -10
- package/packages/react/node_modules/@domql/cookie/LICENSE +0 -21
- package/packages/react/node_modules/@domql/cookie/index.js +0 -22
- package/packages/react/node_modules/@domql/cookie/package.json +0 -10
- package/packages/react/node_modules/@domql/define/LICENSE +0 -21
- package/packages/react/node_modules/@domql/define/index.js +0 -13
- package/packages/react/node_modules/@domql/define/package.json +0 -11
- package/packages/react/node_modules/@domql/domql/LICENSE +0 -21
- package/packages/react/node_modules/@domql/domql/package.json +0 -33
- package/packages/react/node_modules/@domql/domql/src/all_exports.js +0 -17
- package/packages/react/node_modules/@domql/domql/src/index.js +0 -15
- package/packages/react/node_modules/@domql/element/LICENSE +0 -21
- package/packages/react/node_modules/@domql/element/package.json +0 -20
- package/packages/react/node_modules/@domql/element/src/assign.js +0 -22
- package/packages/react/node_modules/@domql/element/src/create.js +0 -125
- package/packages/react/node_modules/@domql/element/src/index.js +0 -8
- package/packages/react/node_modules/@domql/element/src/iterate.js +0 -80
- package/packages/react/node_modules/@domql/element/src/methods.js +0 -96
- package/packages/react/node_modules/@domql/element/src/set.js +0 -44
- package/packages/react/node_modules/@domql/element/src/update.js +0 -98
- package/packages/react/node_modules/@domql/event/LICENSE +0 -21
- package/packages/react/node_modules/@domql/event/package.json +0 -14
- package/packages/react/node_modules/@domql/event/src/can.js +0 -10
- package/packages/react/node_modules/@domql/event/src/index.js +0 -11
- package/packages/react/node_modules/@domql/event/src/is.js +0 -13
- package/packages/react/node_modules/@domql/event/src/on.js +0 -33
- package/packages/react/node_modules/@domql/event/src/store.js +0 -6
- package/packages/react/node_modules/@domql/event/src/wrappers.js +0 -14
- package/packages/react/node_modules/@domql/event/yarn-error.log +0 -44
- package/packages/react/node_modules/@domql/id/LICENSE +0 -21
- package/packages/react/node_modules/@domql/id/index.js +0 -12
- package/packages/react/node_modules/@domql/id/package.json +0 -10
- package/packages/react/node_modules/@domql/mixins/LICENSE +0 -21
- package/packages/react/node_modules/@domql/mixins/package.json +0 -12
- package/packages/react/node_modules/@domql/mixins/src/attr.js +0 -19
- package/packages/react/node_modules/@domql/mixins/src/classList.js +0 -37
- package/packages/react/node_modules/@domql/mixins/src/content.js +0 -17
- package/packages/react/node_modules/@domql/mixins/src/data.js +0 -21
- package/packages/react/node_modules/@domql/mixins/src/html.js +0 -17
- package/packages/react/node_modules/@domql/mixins/src/index.js +0 -11
- package/packages/react/node_modules/@domql/mixins/src/registry.js +0 -55
- package/packages/react/node_modules/@domql/mixins/src/state.js +0 -16
- package/packages/react/node_modules/@domql/mixins/src/style.js +0 -14
- package/packages/react/node_modules/@domql/mixins/src/text.js +0 -19
- package/packages/react/node_modules/@domql/node/LICENSE +0 -21
- package/packages/react/node_modules/@domql/node/package.json +0 -17
- package/packages/react/node_modules/@domql/node/src/cache.js +0 -52
- package/packages/react/node_modules/@domql/node/src/create.js +0 -86
- package/packages/react/node_modules/@domql/node/src/index.js +0 -5
- package/packages/react/node_modules/@domql/node/src/registry.js +0 -139
- package/packages/react/node_modules/@domql/parse/LICENSE +0 -21
- package/packages/react/node_modules/@domql/parse/index.js +0 -16
- package/packages/react/node_modules/@domql/parse/package.json +0 -10
- package/packages/react/node_modules/@domql/props/LICENSE +0 -21
- package/packages/react/node_modules/@domql/props/package.json +0 -10
- package/packages/react/node_modules/@domql/props/src/index.js +0 -62
- package/packages/react/node_modules/@domql/proto/LICENSE +0 -21
- package/packages/react/node_modules/@domql/proto/index.js +0 -66
- package/packages/react/node_modules/@domql/proto/package.json +0 -10
- package/packages/react/node_modules/@domql/react-transformer/LICENSE +0 -21
- package/packages/react/node_modules/@domql/react-transformer/index.js +0 -25
- package/packages/react/node_modules/@domql/react-transformer/package.json +0 -12
- package/packages/react/node_modules/@domql/react-transformer/yarn-error.log +0 -41
- package/packages/react/node_modules/@domql/report/LICENSE +0 -21
- package/packages/react/node_modules/@domql/report/index.js +0 -62
- package/packages/react/node_modules/@domql/report/package.json +0 -7
- package/packages/react/node_modules/@domql/state/LICENSE +0 -21
- package/packages/react/node_modules/@domql/state/package.json +0 -11
- package/packages/react/node_modules/@domql/state/src/index.js +0 -51
- package/packages/react/node_modules/@domql/tree/LICENSE +0 -21
- package/packages/react/node_modules/@domql/tree/index.js +0 -6
- package/packages/react/node_modules/@domql/tree/package.json +0 -10
- package/packages/react/node_modules/@domql/tree/root.js +0 -8
- package/packages/react/node_modules/@domql/utils/LICENSE +0 -21
- package/packages/react/node_modules/@domql/utils/package.json +0 -13
- package/packages/react/node_modules/@domql/utils/src/index.js +0 -5
- package/packages/react/node_modules/@domql/utils/src/node.js +0 -10
- package/packages/react/node_modules/@domql/utils/src/object.js +0 -193
- package/packages/react/node_modules/@domql/utils/src/protoUtils.js +0 -119
- package/packages/react/node_modules/js-tokens/CHANGELOG.md +0 -151
- package/packages/react/node_modules/js-tokens/LICENSE +0 -21
- package/packages/react/node_modules/js-tokens/README.md +0 -240
- package/packages/react/node_modules/js-tokens/index.js +0 -23
- package/packages/react/node_modules/js-tokens/package.json +0 -30
- package/packages/react/node_modules/loose-envify/LICENSE +0 -21
- package/packages/react/node_modules/loose-envify/README.md +0 -45
- package/packages/react/node_modules/loose-envify/cli.js +0 -16
- package/packages/react/node_modules/loose-envify/custom.js +0 -4
- package/packages/react/node_modules/loose-envify/index.js +0 -3
- package/packages/react/node_modules/loose-envify/loose-envify.js +0 -36
- package/packages/react/node_modules/loose-envify/package.json +0 -36
- package/packages/react/node_modules/loose-envify/replace.js +0 -65
- package/packages/react/node_modules/object-assign/index.js +0 -90
- package/packages/react/node_modules/object-assign/license +0 -21
- package/packages/react/node_modules/object-assign/package.json +0 -42
- package/packages/react/node_modules/object-assign/readme.md +0 -61
- package/packages/react/node_modules/react/LICENSE +0 -21
- package/packages/react/node_modules/react/README.md +0 -13
- package/packages/react/node_modules/react/build-info.json +0 -8
- package/packages/react/node_modules/react/cjs/react-jsx-dev-runtime.development.js +0 -1203
- package/packages/react/node_modules/react/cjs/react-jsx-dev-runtime.production.min.js +0 -9
- package/packages/react/node_modules/react/cjs/react-jsx-dev-runtime.profiling.min.js +0 -9
- package/packages/react/node_modules/react/cjs/react-jsx-runtime.development.js +0 -1221
- package/packages/react/node_modules/react/cjs/react-jsx-runtime.production.min.js +0 -10
- package/packages/react/node_modules/react/cjs/react-jsx-runtime.profiling.min.js +0 -10
- package/packages/react/node_modules/react/cjs/react.development.js +0 -2333
- package/packages/react/node_modules/react/cjs/react.production.min.js +0 -23
- package/packages/react/node_modules/react/index.js +0 -7
- package/packages/react/node_modules/react/jsx-dev-runtime.js +0 -7
- package/packages/react/node_modules/react/jsx-runtime.js +0 -7
- package/packages/react/node_modules/react/package.json +0 -39
- package/packages/react/node_modules/react/umd/react.development.js +0 -3357
- package/packages/react/node_modules/react/umd/react.production.min.js +0 -31
- package/packages/react/node_modules/react/umd/react.profiling.min.js +0 -36
- package/packages/react/node_modules/regenerator-runtime/LICENSE +0 -21
- package/packages/react/node_modules/regenerator-runtime/README.md +0 -31
- package/packages/react/node_modules/regenerator-runtime/package.json +0 -19
- package/packages/react/node_modules/regenerator-runtime/path.js +0 -11
- package/packages/react/node_modules/regenerator-runtime/runtime.js +0 -754
- package/packages/react/yarn.lock +0 -183
|
@@ -1,21 +0,0 @@
|
|
|
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.
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@domql/mixins",
|
|
3
|
-
"version": "1.3.0",
|
|
4
|
-
"main": "src/index.js",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"@domql/element": "^1.3.0",
|
|
8
|
-
"@domql/report": "^1.3.0",
|
|
9
|
-
"@domql/utils": "^1.3.0"
|
|
10
|
-
},
|
|
11
|
-
"gitHead": "3140379c0f6da459a39068f32630275c6ea3b33f"
|
|
12
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import { exec } from '@domql/utils'
|
|
4
|
-
import { report } from '@domql/report'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Recursively add attributes to a DOM node
|
|
8
|
-
*/
|
|
9
|
-
export const attr = (params, element, node) => {
|
|
10
|
-
if (params) {
|
|
11
|
-
if (!(typeof params === 'object')) report('HTMLInvalidAttr', params)
|
|
12
|
-
for (const attr in params) {
|
|
13
|
-
// if (!node) node = element.node
|
|
14
|
-
const val = exec(params[attr], element)
|
|
15
|
-
if (val && node.setAttribute) node.setAttribute(attr, val)
|
|
16
|
-
else if (node.removeAttribute) node.removeAttribute(attr)
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import { exec, isObject, isString } from '@domql/utils'
|
|
4
|
-
|
|
5
|
-
export const assignClass = (element) => {
|
|
6
|
-
const { key } = element
|
|
7
|
-
if (element.class === true) element.class = key
|
|
8
|
-
else if (!element.class && typeof key === 'string' && key.charAt(0) === '_' && key.charAt(1) !== '_') {
|
|
9
|
-
element.class = key.slice(1)
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// stringifies class object
|
|
14
|
-
export const classify = (obj, element) => {
|
|
15
|
-
let className = ''
|
|
16
|
-
for (const item in obj) {
|
|
17
|
-
const param = obj[item]
|
|
18
|
-
if (typeof param === 'boolean' && param) className += ` ${item}`
|
|
19
|
-
else if (typeof param === 'string') className += ` ${param}`
|
|
20
|
-
else if (typeof param === 'function') {
|
|
21
|
-
className += ` ${exec(param, element)}`
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return className
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const classList = (params, element, node) => {
|
|
28
|
-
if (!params) return
|
|
29
|
-
const { key } = element
|
|
30
|
-
if (params === true) params = element.class = { key }
|
|
31
|
-
if (isString(params)) params = element.class = { default: params }
|
|
32
|
-
if (isObject(params)) params = classify(params, element)
|
|
33
|
-
// TODO: fails on string
|
|
34
|
-
const className = params.replace(/\s+/g, ' ').trim()
|
|
35
|
-
node.classList = className
|
|
36
|
-
return className
|
|
37
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import { set } from '@domql/element'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Appends anything as content
|
|
7
|
-
* an original one as a child
|
|
8
|
-
*/
|
|
9
|
-
export const content = (param, element, node) => {
|
|
10
|
-
if (param && element) {
|
|
11
|
-
if (param.__hash === element.content.__hash && element.content.update) {
|
|
12
|
-
element.content.update(param)
|
|
13
|
-
} else {
|
|
14
|
-
set.call(element, param)
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import { exec, isObject } from '@domql/utils'
|
|
4
|
-
import { report } from '@domql/report'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Apply data parameters on the DOM nodes
|
|
8
|
-
* this should only work if `showOnNode: true` is passed
|
|
9
|
-
*/
|
|
10
|
-
export const data = (params, element, node) => {
|
|
11
|
-
if (params && params.showOnNode) {
|
|
12
|
-
if (!isObject(params)) report('HTMLInvalidData', params)
|
|
13
|
-
|
|
14
|
-
// Apply data params on node
|
|
15
|
-
for (const dataset in params) {
|
|
16
|
-
if (dataset !== 'showOnNode') {
|
|
17
|
-
node.dataset[dataset] = exec(params[dataset], element)
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import { exec } from '@domql/utils'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Appends raw HTML as content
|
|
7
|
-
* an original one as a child
|
|
8
|
-
*/
|
|
9
|
-
export const html = (param, element, node) => {
|
|
10
|
-
const prop = exec(param, element)
|
|
11
|
-
if (prop) {
|
|
12
|
-
// const parser = new window.DOMParser()
|
|
13
|
-
// param = parser.parseFromString(param, 'text/html')
|
|
14
|
-
if (node.nodeName === 'SVG') node.textContent = prop
|
|
15
|
-
else node.innerHTML = prop
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
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.
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,139 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
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.
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
|
@@ -1,21 +0,0 @@
|
|
|
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.
|