reflex_behaviors 0.0.5 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +11 -9
- data/README.md +1 -1
- data/app/assets/builds/reflex_behaviors.js +45 -48
- data/app/assets/builds/reflex_behaviors.js.map +4 -4
- data/app/javascript/devtools/dependencies.js +53 -0
- data/app/javascript/devtools/elements/supervisor_element.js +15 -13
- data/app/javascript/devtools/elements/tooltip_element.js +27 -41
- data/app/javascript/devtools/supervisor.js +17 -5
- data/app/javascript/devtools/toggle.js +174 -84
- data/app/javascript/elements/reflex_element.js +0 -10
- data/app/javascript/index.js +0 -3
- data/app/javascript/utils/dom.js +62 -0
- data/lib/reflex_behaviors/version.rb +1 -1
- data/package.json +4 -5
- data/reflex_behaviors.gemspec +2 -2
- data/tags +3653 -2921
- data/yarn.lock +148 -146
- metadata +8 -7
- data/app/javascript/devtools/dom.js +0 -36
@@ -0,0 +1,62 @@
|
|
1
|
+
export function template (html) {
|
2
|
+
let template = document.createElement('template')
|
3
|
+
template.innerHTML = html
|
4
|
+
return template
|
5
|
+
}
|
6
|
+
|
7
|
+
export function appendHTML (html, parent) {
|
8
|
+
parent = parent || document.body
|
9
|
+
const clone = template(html).content.cloneNode(true)
|
10
|
+
const child = clone.querySelector('*')
|
11
|
+
return parent.appendChild(child)
|
12
|
+
}
|
13
|
+
|
14
|
+
export function addHighlight (element, options = {}) {
|
15
|
+
if (!element) return
|
16
|
+
removeHighlight(element)
|
17
|
+
let { outline, outlineOffset } = options
|
18
|
+
|
19
|
+
outline = outline || 'dashed 3px red'
|
20
|
+
outlineOffset = outlineOffset || '0px'
|
21
|
+
|
22
|
+
element.originalStyles = element.originalStyles || {
|
23
|
+
display: element.style.display,
|
24
|
+
minHeight: element.style.minHeight,
|
25
|
+
minWidth: element.style.minWidth,
|
26
|
+
outline: element.style.outline,
|
27
|
+
outlineOffset: element.style.outlineOffset
|
28
|
+
}
|
29
|
+
|
30
|
+
if (
|
31
|
+
getComputedStyle(element).display.match(/^inline$/i) &&
|
32
|
+
element.offsetWidth === 0 &&
|
33
|
+
element.offsetHeight === 0
|
34
|
+
) {
|
35
|
+
element.style.display = 'inline-block'
|
36
|
+
element.style.minHeight = '2px'
|
37
|
+
element.style.minWidth = '2px'
|
38
|
+
}
|
39
|
+
element.style.outline = outline
|
40
|
+
element.style.outlineOffset = outlineOffset
|
41
|
+
element.dataset.reflexBehaviorsHighlight = true
|
42
|
+
}
|
43
|
+
|
44
|
+
export function removeHighlight (element) {
|
45
|
+
if (!element) return
|
46
|
+
if (element.originalStyles) {
|
47
|
+
for (const [key, value] of Object.entries(element.originalStyles))
|
48
|
+
value ? (element.style[key] = value) : (element.style[key] = '')
|
49
|
+
delete element.originalStyles
|
50
|
+
}
|
51
|
+
delete element.dataset.reflexBehaviorsHighlight
|
52
|
+
}
|
53
|
+
|
54
|
+
export function coordinates (element) {
|
55
|
+
const rect = element.getBoundingClientRect()
|
56
|
+
return {
|
57
|
+
left: rect.left + window.scrollX,
|
58
|
+
top: rect.top + window.scrollY,
|
59
|
+
width: element.offsetWidth,
|
60
|
+
height: element.offsetHeight
|
61
|
+
}
|
62
|
+
}
|
data/package.json
CHANGED
@@ -1,21 +1,20 @@
|
|
1
1
|
{
|
2
2
|
"name": "reflex_behaviors",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.6",
|
4
4
|
"description": "Pre-built easy to use reactive TurboReflex behaviors for Rails/Hotwire apps.",
|
5
5
|
"main": "app/javascript/index.js",
|
6
6
|
"repository": "https://github.com/hopsoft/reflex_behaviors",
|
7
7
|
"author": "Nate Hopkins (hopsoft) <natehop@gmail.com>",
|
8
8
|
"license": "MIT",
|
9
9
|
"dependencies": {
|
10
|
-
"turbo_ready": ">= 0.1.
|
11
|
-
"turbo_reflex": ">= 0.0.
|
10
|
+
"turbo_ready": ">= 0.1.3",
|
11
|
+
"turbo_reflex": ">= 0.0.29"
|
12
12
|
},
|
13
13
|
"peerDependencies": {
|
14
|
-
"@hotwired/turbo": ">= 7.2",
|
15
14
|
"@hotwired/turbo-rails": ">= 7.2"
|
16
15
|
},
|
17
16
|
"devDependencies": {
|
18
|
-
"esbuild": "^0.
|
17
|
+
"esbuild": "^0.16.1",
|
19
18
|
"eslint": "^8.19.0",
|
20
19
|
"prettier-standard": "^16.4.1"
|
21
20
|
},
|
data/reflex_behaviors.gemspec
CHANGED
@@ -22,8 +22,8 @@ Gem::Specification.new do |s|
|
|
22
22
|
|
23
23
|
s.add_dependency "rails", ">= 6.1"
|
24
24
|
s.add_dependency "turbo-rails", ">= 1.1"
|
25
|
-
s.add_dependency "turbo_ready", ">= 0.1.
|
26
|
-
s.add_dependency "turbo_reflex", ">= 0.0.
|
25
|
+
s.add_dependency "turbo_ready", ">= 0.1.3"
|
26
|
+
s.add_dependency "turbo_reflex", ">= 0.0.29"
|
27
27
|
|
28
28
|
s.add_development_dependency "magic_frozen_string_literal"
|
29
29
|
s.add_development_dependency "minitest-reporters"
|