@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,96 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { isObject, isObjectLike } from '@domql/utils'
|
|
4
|
+
import { registry } from '@domql/mixins'
|
|
5
|
+
|
|
6
|
+
// TODO: update these files
|
|
7
|
+
export const lookup = function (key) {
|
|
8
|
+
const element = this
|
|
9
|
+
let { parent } = element
|
|
10
|
+
|
|
11
|
+
while (parent.key !== key) {
|
|
12
|
+
parent = parent.parent
|
|
13
|
+
if (!parent) return
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return parent
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const remove = function (params) {
|
|
20
|
+
const element = this
|
|
21
|
+
element.node.remove()
|
|
22
|
+
delete element.parent[element.key]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const get = function (param) {
|
|
26
|
+
const element = this
|
|
27
|
+
return element[param]
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// export const set = function () {
|
|
31
|
+
// }
|
|
32
|
+
|
|
33
|
+
// export const update = function () {
|
|
34
|
+
// }
|
|
35
|
+
|
|
36
|
+
export const defineSetter = (element, key, get, set) =>
|
|
37
|
+
Object.defineProperty(element, key, { get, set })
|
|
38
|
+
|
|
39
|
+
export const keys = function () {
|
|
40
|
+
const element = this
|
|
41
|
+
const keys = []
|
|
42
|
+
for (const param in element) {
|
|
43
|
+
if (!isObject(registry[param])) {
|
|
44
|
+
keys.push(param)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return keys
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const parse = function () {
|
|
51
|
+
const element = this
|
|
52
|
+
const obj = {}
|
|
53
|
+
const keys = element.keys()
|
|
54
|
+
keys.forEach(v => (obj[v] = element[v]))
|
|
55
|
+
return obj
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const parseDeep = function (param) {
|
|
59
|
+
const element = this
|
|
60
|
+
const orig = param || element
|
|
61
|
+
const obj = {}
|
|
62
|
+
const keys = orig.keys && orig.keys()
|
|
63
|
+
if (!keys) return
|
|
64
|
+
keys.forEach(v => {
|
|
65
|
+
const prop = orig[v]
|
|
66
|
+
if (isObjectLike(prop)) parseDeep(prop)
|
|
67
|
+
else obj[v] = prop
|
|
68
|
+
})
|
|
69
|
+
return obj
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export const log = function (...args) {
|
|
73
|
+
const element = this
|
|
74
|
+
console.group(element.key)
|
|
75
|
+
if (args.length) {
|
|
76
|
+
args.forEach(v => console.log(`%c${v}:\n`, 'font-weight: bold', element[v]))
|
|
77
|
+
} else {
|
|
78
|
+
console.log(element.path)
|
|
79
|
+
const keys = element.keys()
|
|
80
|
+
keys.forEach(v => console.log(`%c${v}:\n`, 'font-weight: bold', element[v]))
|
|
81
|
+
}
|
|
82
|
+
console.groupEnd(element.key)
|
|
83
|
+
return element
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export const isMethod = function (param) {
|
|
87
|
+
return param === 'set' ||
|
|
88
|
+
param === 'update' ||
|
|
89
|
+
param === 'remove' ||
|
|
90
|
+
param === 'lookup' ||
|
|
91
|
+
param === 'keys' ||
|
|
92
|
+
param === 'parse' ||
|
|
93
|
+
param === 'parseDeep' ||
|
|
94
|
+
param === 'if' ||
|
|
95
|
+
param === 'log'
|
|
96
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { create } from './create'
|
|
4
|
+
|
|
5
|
+
const removeContentElement = (params, element) => {
|
|
6
|
+
if (params && element.content) {
|
|
7
|
+
if (element.content.node) {
|
|
8
|
+
if (element.content.tag === 'fragment') element.node.innerHTML = ''
|
|
9
|
+
else element.node.removeChild(element.content.node)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (element.__cached && element.__cached.content) {
|
|
13
|
+
if (element.__cached.content.tag === 'fragment') element.__cached.content.parent.node.innerHTML = ''
|
|
14
|
+
else element.__cached.content.remove()
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
delete element.content
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const set = function (params, enter, leave) {
|
|
22
|
+
const element = this
|
|
23
|
+
|
|
24
|
+
removeContentElement(params, element)
|
|
25
|
+
|
|
26
|
+
if (params) {
|
|
27
|
+
const { childProto } = params
|
|
28
|
+
if (!childProto && element.childProto) params.childProto = element.childProto
|
|
29
|
+
create(params, element, 'content', {
|
|
30
|
+
ignoreChildProto: true
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return element
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// if (element.content && (isFunction(element.content) || element.content.node)) {
|
|
38
|
+
// // leave(element, () => {
|
|
39
|
+
// // console.log('remove', element.content)
|
|
40
|
+
// // element.content.remove()
|
|
41
|
+
// // element.content.update(params)
|
|
42
|
+
// // element.node.removeChild(element.content.node)
|
|
43
|
+
// // delete element.content
|
|
44
|
+
// }
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { overwrite, isFunction, isObject, isString, isNumber, merge } from '@domql/utils'
|
|
4
|
+
import { registry } from '@domql/mixins'
|
|
5
|
+
import { updateProps } from '@domql/props'
|
|
6
|
+
import { createNode } from '@domql/node'
|
|
7
|
+
import { on } from '@domql/event'
|
|
8
|
+
|
|
9
|
+
import { isMethod } from './methods'
|
|
10
|
+
import { throughUpdatedDefine, throughUpdatedExec } from './iterate'
|
|
11
|
+
import { appendNode } from './assign'
|
|
12
|
+
|
|
13
|
+
const UPDATE_DEFAULT_OPTIONS = {
|
|
14
|
+
stackChanges: false,
|
|
15
|
+
cleanExec: true,
|
|
16
|
+
preventRecursive: false
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const update = function (params = {}, options = UPDATE_DEFAULT_OPTIONS) {
|
|
20
|
+
const element = this
|
|
21
|
+
const { define, parent, node } = element
|
|
22
|
+
|
|
23
|
+
// console.groupCollapsed('Update:', element.path)
|
|
24
|
+
// console.log('params:')
|
|
25
|
+
// console.log(params)
|
|
26
|
+
// console.log('props:')
|
|
27
|
+
// console.log(element.props)
|
|
28
|
+
// console.log('element:')
|
|
29
|
+
// console.log(element)
|
|
30
|
+
// console.log('PARAMS.PROPS:')
|
|
31
|
+
// console.log(params.props)
|
|
32
|
+
// console.groupEnd('Update:')
|
|
33
|
+
// if params is string
|
|
34
|
+
if (isString(params) || isNumber(params)) {
|
|
35
|
+
params = { text: params }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (element.on && isFunction(element.on.initUpdate)) {
|
|
39
|
+
on.initUpdate(element.on.initUpdate, element, element.state)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// console.log(element, parent)
|
|
43
|
+
updateProps(params.props, element, parent)
|
|
44
|
+
// // console.log(element.path)
|
|
45
|
+
// // console.log(element)
|
|
46
|
+
|
|
47
|
+
// console.groupCollapsed('UPDATE:')
|
|
48
|
+
// console.log(element)
|
|
49
|
+
// console.groupEnd('UPDATE:')
|
|
50
|
+
|
|
51
|
+
const overwriteChanges = overwrite(element, params, UPDATE_DEFAULT_OPTIONS)
|
|
52
|
+
const execChanges = throughUpdatedExec(element, UPDATE_DEFAULT_OPTIONS)
|
|
53
|
+
const definedChanges = throughUpdatedDefine(element)
|
|
54
|
+
|
|
55
|
+
if (UPDATE_DEFAULT_OPTIONS.stackChanges && element.__stackChanges) {
|
|
56
|
+
const stackChanges = merge(definedChanges, merge(execChanges, overwriteChanges))
|
|
57
|
+
element.__stackChanges.push(stackChanges)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (isFunction(element.if)) {
|
|
61
|
+
// TODO: move as fragment
|
|
62
|
+
const ifPassed = element.if(element, element.state)
|
|
63
|
+
if (element.__ifFalsy && ifPassed) {
|
|
64
|
+
createNode(element)
|
|
65
|
+
appendNode(element.node, element.__ifFragment)
|
|
66
|
+
delete element.__ifFalsy
|
|
67
|
+
} else if (element.node && !ifPassed) {
|
|
68
|
+
element.node.remove()
|
|
69
|
+
element.__ifFalsy = true
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// console.log(node)
|
|
74
|
+
// console.groupEnd('Update:')
|
|
75
|
+
|
|
76
|
+
if (!node || options.preventRecursive) return
|
|
77
|
+
|
|
78
|
+
for (const param in element) {
|
|
79
|
+
const prop = element[param]
|
|
80
|
+
|
|
81
|
+
if (isMethod(param) || isObject(registry[param]) || prop === undefined) continue
|
|
82
|
+
|
|
83
|
+
const hasDefined = define && define[param]
|
|
84
|
+
const ourParam = registry[param]
|
|
85
|
+
|
|
86
|
+
// // console.log(prop)
|
|
87
|
+
|
|
88
|
+
if (ourParam) {
|
|
89
|
+
if (isFunction(ourParam)) ourParam(prop, element, node)
|
|
90
|
+
} else if (prop && isObject(prop) && !hasDefined) {
|
|
91
|
+
update.call(prop, params[prop], UPDATE_DEFAULT_OPTIONS)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (element.on && isFunction(element.on.update)) {
|
|
96
|
+
on.update(element.on.update, element, element.state)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -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,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@domql/event",
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"main": "src/index.js",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"vpatch": "npm version patch && npm publish --access public"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@domql/node": "^1.3.0",
|
|
11
|
+
"@domql/report": "^1.3.0"
|
|
12
|
+
},
|
|
13
|
+
"gitHead": "3140379c0f6da459a39068f32630275c6ea3b33f"
|
|
14
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { NODE_REGISTRY } from '@domql/node'
|
|
4
|
+
import { report } from '@domql/report'
|
|
5
|
+
|
|
6
|
+
export const render = (element) => {
|
|
7
|
+
const tag = element.tag || 'div'
|
|
8
|
+
const isValid = NODE_REGISTRY.body.indexOf(tag) > -1
|
|
9
|
+
return isValid || report('HTMLInvalidTag')
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
export const node = (node) => {
|
|
4
|
+
const { Node } = window
|
|
5
|
+
return (
|
|
6
|
+
typeof Node === 'function'
|
|
7
|
+
? node instanceof Node
|
|
8
|
+
: node &&
|
|
9
|
+
typeof node === 'object' &&
|
|
10
|
+
typeof node.nodeType === 'number' &&
|
|
11
|
+
typeof node.tag === 'string'
|
|
12
|
+
)
|
|
13
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
export const init = (param, element, state) => {
|
|
4
|
+
param(element, state)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const render = (param, element, state) => {
|
|
8
|
+
param(element, state)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const initUpdate = (param, element, state) => {
|
|
12
|
+
param(element, state)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const attachNode = (param, element, state) => {
|
|
16
|
+
param(element, state)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const stateCreated = (param, element, state) => {
|
|
20
|
+
param(element, state)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const initStateUpdated = (param, element, state) => {
|
|
24
|
+
param(element, state)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const stateUpdated = (param, element, state) => {
|
|
28
|
+
param(element, state)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const update = (param, element, state) => {
|
|
32
|
+
param(element, state)
|
|
33
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
export const getScrollPositions = () => {
|
|
4
|
+
if (window.pageYOffset !== undefined) {
|
|
5
|
+
return [window.pageXOffset, window.pageYOffset]
|
|
6
|
+
} else {
|
|
7
|
+
const d = document
|
|
8
|
+
const r = d.documentElement
|
|
9
|
+
const b = d.body
|
|
10
|
+
const sx = r.scrollLeft || b.scrollLeft || 0
|
|
11
|
+
const sy = r.scrollTop || b.scrollTop || 0
|
|
12
|
+
return [sx, sy]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
Arguments:
|
|
2
|
+
/Users/nikoloza/.nvm/versions/node/v14.17.1/bin/node /Users/nikoloza/.nvm/versions/node/v14.17.1/bin/yarn add NODE_REGISTRY
|
|
3
|
+
|
|
4
|
+
PATH:
|
|
5
|
+
/Users/nikoloza/.nvm/versions/node/v14.17.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Little Snitch.app/Contents/Components:/Library/Apple/usr/bin:/Users/nikoloza/.nvm/versions/node/v14.17.1/bin:/Users/nikoloza/.fzf/bin
|
|
6
|
+
|
|
7
|
+
Yarn version:
|
|
8
|
+
1.22.10
|
|
9
|
+
|
|
10
|
+
Node version:
|
|
11
|
+
14.17.1
|
|
12
|
+
|
|
13
|
+
Platform:
|
|
14
|
+
darwin x64
|
|
15
|
+
|
|
16
|
+
Trace:
|
|
17
|
+
Error: https://registry.yarnpkg.com/NODE_REGISTRY: Not found
|
|
18
|
+
at Request.params.callback [as _callback] (/Users/nikoloza/.nvm/versions/node/v14.17.1/lib/node_modules/yarn/lib/cli.js:66988:18)
|
|
19
|
+
at Request.self.callback (/Users/nikoloza/.nvm/versions/node/v14.17.1/lib/node_modules/yarn/lib/cli.js:140662:22)
|
|
20
|
+
at Request.emit (events.js:375:28)
|
|
21
|
+
at Request.<anonymous> (/Users/nikoloza/.nvm/versions/node/v14.17.1/lib/node_modules/yarn/lib/cli.js:141634:10)
|
|
22
|
+
at Request.emit (events.js:375:28)
|
|
23
|
+
at IncomingMessage.<anonymous> (/Users/nikoloza/.nvm/versions/node/v14.17.1/lib/node_modules/yarn/lib/cli.js:141556:12)
|
|
24
|
+
at Object.onceWrapper (events.js:481:28)
|
|
25
|
+
at IncomingMessage.emit (events.js:387:35)
|
|
26
|
+
at endReadableNT (internal/streams/readable.js:1317:12)
|
|
27
|
+
at processTicksAndRejections (internal/process/task_queues.js:82:21)
|
|
28
|
+
|
|
29
|
+
npm manifest:
|
|
30
|
+
{
|
|
31
|
+
"name": "@domql/event",
|
|
32
|
+
"version": "1.2.14",
|
|
33
|
+
"main": "src/index.js",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"scripts": {
|
|
36
|
+
"vpatch": "npm version patch && npm publish --access public"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
yarn manifest:
|
|
41
|
+
No manifest
|
|
42
|
+
|
|
43
|
+
Lockfile:
|
|
44
|
+
No lockfile
|
|
@@ -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,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,12 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
}
|