@phun-ky/speccer 3.5.1 → 4.1.0
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/CHANGELOG.md +9 -0
- package/README.md +15 -43
- package/package.json +70 -32
- package/speccer.css +614 -2
- package/speccer.js +1680 -1
- package/speccer.min.css +1 -0
- package/src/browser.js +87 -0
- package/src/dissect.js +204 -0
- package/src/index.js +21 -818
- package/src/lib/attributes.js +13 -0
- package/src/lib/classnames.js +37 -0
- package/src/lib/constants.js +5 -0
- package/src/lib/css.js +37 -0
- package/src/lib/debounce.js +22 -0
- package/src/lib/node.js +7 -0
- package/src/lib/number.js +4 -0
- package/src/lib/resize.js +13 -0
- package/src/lib/styles.js +27 -0
- package/src/measure.js +88 -0
- package/src/spec.js +183 -0
- package/src/{anatomy.styl → styles/anatomy.styl} +59 -73
- package/src/styles/index.styl +26 -0
- package/src/styles/measure.styl +85 -0
- package/src/styles/spacing.styl +142 -0
- package/src/{typography.styl → styles/typography.styl} +1 -1
- package/src/typography.js +138 -0
- package/src/lib/poly.js +0 -15
- package/src/lib/style.js +0 -12
- package/src/lib/throttle.js +0 -19
- package/src/speccer.styl +0 -162
package/speccer.min.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ph.speccer,.ph.speccer:after,.ph.speccer:before{box-sizing:border-box;font-family:Menlo for Powerline,Menlo Regular for Powerline,DejaVu Sans Mono,Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace!important;font-size:12px;line-height:12px;transition:all .2s ease-in;z-index:99999}.ph.speccer,.ph.speccer.dissection,.ph.speccer:after,.ph.speccer:before{align-items:center;display:flex;justify-content:center;position:absolute}.ph.speccer.dissection{background-color:#d4397a;border-radius:100%;box-sizing:initial;color:#fff;font-family:sans-serif;font-size:16px;font-weight:400;height:1.5rem;line-height:150%;width:1.5rem;z-index:100000}.ph.speccer.dissection.button-icon:after,.ph.speccer.dissection.button-outline:after{background-color:#d4397a;content:"";height:1px;position:absolute;top:50%;width:48px;z-index:99999}.ph.speccer.dissection:after{background-color:#d4397a;content:"";height:48px;position:absolute;top:100%;width:1px;z-index:99999}.ph.speccer.dissection.outline.left:after{height:1px;left:100%;top:50%;width:48px}.ph.speccer.dissection.outline.right:after{height:1px;right:100%;top:50%;width:48px}.ph.speccer.dissection.outline.enclose{background-color:initial;border:1px solid #d4397a;border-radius:0;color:red}.ph.speccer.dissection.outline.enclose.right:after{left:calc(100% + 49px);right:auto}.ph.speccer.dissection.outline.enclose.right:before{left:100%;right:auto}.ph.speccer.dissection.outline.enclose.left:after{left:-49px;right:auto}.ph.speccer.dissection.outline.enclose.left:before{left:auto;right:100%}.ph.speccer.dissection.outline.enclose.top:after{bottom:auto;top:-49px}.ph.speccer.dissection.outline.enclose.top:before{bottom:100%;top:auto}.ph.speccer.dissection.outline.enclose.bottom:after{bottom:auto;top:calc(100% + 49px)}.ph.speccer.dissection.outline.enclose.bottom:before{bottom:auto;top:100%}.ph.speccer.dissection.outline.full{background-color:initial;border:1px solid #d4397a;border-radius:0;color:red}.ph.speccer.dissection.outline.full.right{border-left:none}.ph.speccer.dissection.outline.full.right:after{left:56px}.ph.speccer.dissection.outline.full.right:before{left:100%}.ph.speccer.dissection.outline.full.left{border-right:none}.ph.speccer.dissection.outline.full.left:after{left:-56px}.ph.speccer.dissection.outline.full.left:before{right:100%}.ph.speccer.dissection.outline.full.top{border-bottom:none}.ph.speccer.dissection.outline.full.top:after{top:-56px}.ph.speccer.dissection.outline.full.top:before{bottom:100%}.ph.speccer.dissection.outline.full.bottom{border-top:none}.ph.speccer.dissection.outline.full.bottom:after{top:56px}.ph.speccer.dissection.outline.full.bottom:before{top:100%}.ph.speccer.dissection.outline.bottom:after{height:48px;right:50%;top:calc(-100% - 24px);width:1px}.ph.speccer.dissection.button-center:after{background-color:#d4397a;content:"";height:48px;position:absolute;top:100%;width:1px;z-index:99999}.ph.speccer.dissection.button-outline:after{right:100%}.ph.speccer.dissection.button-icon:after{left:100%}.ph.speccer.dissection.button-icon:before{border:1px solid #d4397a;content:"";height:1.5rem;left:calc(100% + 48px);position:absolute;width:1.5rem;z-index:99999}.ph.speccer.dissection.outline.top:after,.ph.speccer.dissection.outline:after{height:48px;right:50%;top:100%;width:1px}[data-anatomy-section]{counter-reset:type}.ph.speccer.dissection.outline.full.left,.ph.speccer.dissection.outline.full.right{width:8px}.ph.speccer.dissection.outline.full.bottom,.ph.speccer.dissection.outline.full.top{height:8px}.ph.speccer.dissection.outline.full.bottom:after,.ph.speccer.dissection.outline.full.left:after,.ph.speccer.dissection.outline.full.right:after,.ph.speccer.dissection.outline.full.top:after{align-items:center;background-color:#d4397a;border-radius:100%;color:#fff;content:attr(data-dissection-counter);display:flex;font-size:16px;height:1.5rem;justify-content:center;line-height:150%;position:absolute;width:1.5rem;z-index:100000}.ph.speccer.dissection.outline.full.left:after,.ph.speccer.dissection.outline.full.right:after{top:50%;transform:translateY(-50%)}.ph.speccer.dissection.outline.full.bottom:after,.ph.speccer.dissection.outline.full.top:after{left:50%;transform:translateX(-50%)}.ph.speccer.dissection.outline.full.bottom:before,.ph.speccer.dissection.outline.full.left:before,.ph.speccer.dissection.outline.full.right:before,.ph.speccer.dissection.outline.full.top:before{background-color:#d4397a;content:"";display:block;position:absolute;z-index:100000}.ph.speccer.dissection.outline.full.left:before,.ph.speccer.dissection.outline.full.right:before{height:1px;top:50%;transform:translateY(-50%);width:49px}.ph.speccer.dissection.outline.full.bottom:before,.ph.speccer.dissection.outline.full.top:before{height:49px;left:50%;transform:translateX(-50%);width:1px}.ph.speccer.dissection.outline.enclose.left,.ph.speccer.dissection.outline.enclose.right{width:8px}.ph.speccer.dissection.outline.enclose.bottom,.ph.speccer.dissection.outline.enclose.top{height:8px}.ph.speccer.dissection.outline.enclose.bottom:after,.ph.speccer.dissection.outline.enclose.left:after,.ph.speccer.dissection.outline.enclose.right:after,.ph.speccer.dissection.outline.enclose.top:after{align-items:center;background-color:#d4397a;border-radius:100%;color:#fff;content:attr(data-dissection-counter);display:flex;font-size:16px;height:1.5rem;justify-content:center;line-height:150%;position:absolute;width:1.5rem;z-index:100000}.ph.speccer.dissection.outline.enclose.left:after,.ph.speccer.dissection.outline.enclose.right:after{top:50%;transform:translateY(-50%)}.ph.speccer.dissection.outline.enclose.bottom:after,.ph.speccer.dissection.outline.enclose.top:after{left:50%;transform:translateX(-50%)}.ph.speccer.dissection.outline.enclose.bottom:before,.ph.speccer.dissection.outline.enclose.left:before,.ph.speccer.dissection.outline.enclose.right:before,.ph.speccer.dissection.outline.enclose.top:before{background-color:#d4397a;content:"";display:block;position:absolute;z-index:100000}.ph.speccer.dissection.outline.enclose.left:before,.ph.speccer.dissection.outline.enclose.right:before{height:1px;top:50%;transform:translateY(-50%);width:49px}.ph.speccer.dissection.outline.enclose.bottom:before,.ph.speccer.dissection.outline.enclose.top:before{height:49px;left:50%;transform:translateX(-50%);width:1px}.ph.speccer.dissection.button-icon:after,.ph.speccer.dissection.button-outline:after{background-color:#d4397a;content:"";height:1px;position:absolute;top:50%;width:48px;z-index:99999}.ph.speccer.spacing:hover{border:1px solid #333}.ph.speccer.spacing.is-specced:hover~.speccer.margin{background-color:#fff76f}.ph.speccer.spacing.is-specced:hover~.speccer.padding{background-color:#db6fff;color:#fff}.ph.speccer.spacing.margin{background-color:#fff76f66;color:#333}.ph.speccer.spacing.padding{background-color:#db6fff66;color:#ff3aa8}.ph.speccer.spacing.margin.bottom:after,.ph.speccer.spacing.margin.top:after{border-bottom:1px solid #333;border-top:1px solid #333;content:"";height:100%;left:40%;position:absolute;width:9px}.ph.speccer.spacing.margin.bottom:before,.ph.speccer.spacing.margin.top:before{border-left:1px solid #333;content:"";height:100%;left:40%;margin-left:4px;position:absolute;width:0}.ph.speccer.spacing.margin.left:after,.ph.speccer.spacing.margin.right:after{border-left:1px solid #ff3aa8;border-right:1px solid #ff3aa8;content:"";height:9px;position:absolute;top:10%;width:100%}.ph.speccer.spacing.margin.left:before,.ph.speccer.spacing.margin.right:before{border-top:1px solid #ff3aa8;content:"";height:0;margin-top:4px;position:absolute;top:10%;width:100%}.ph.speccer.spacing.padding.bottom:after,.ph.speccer.spacing.padding.top:after{border-bottom:1px solid #ff3aa8;border-top:1px solid #ff3aa8;content:"";height:100%;left:40%;position:absolute;width:9px}.ph.speccer.spacing.padding.bottom:before,.ph.speccer.spacing.padding.top:before{border-left:1px solid #ff3aa8;content:"";height:100%;left:40%;margin-left:4px;position:absolute;width:0}.ph.speccer.spacing.padding.left:after,.ph.speccer.spacing.padding.right:after{border-left:1px solid #ff3aa8;border-right:1px solid #ff3aa8;content:"";height:9px;position:absolute;top:10%;width:100%}.ph.speccer.spacing.padding.left:before,.ph.speccer.spacing.padding.right:before{border-top:1px solid #ff3aa8;content:"";height:0;margin-top:4px;position:absolute;top:10%;width:100%}.ph.speccer.typography{background-color:#fff;color:#57575b;display:block;font-size:12px;line-height:140%;max-width:none;min-width:320px;padding:8px 24px;text-align:left;width:auto}.ph.speccer.typography,.ph.speccer.typography:hover{border:1px solid #e227b3}.ph.speccer.typography:after{background-color:#e227b3;content:"";display:block;position:absolute}.ph.speccer.typography.left:after,.ph.speccer.typography:after{height:1px;left:100%;top:50%;transform:translateY(-50%);width:48px}.ph.speccer.typography.right:after{height:1px;left:auto;right:100%;top:50%;transform:translateY(-50%);width:48px}.ph.speccer.typography.top:after{height:48px;left:50%;right:auto;top:100%;transform:translateX(-50%);width:1px}.ph.speccer.typography.bottom:after{bottom:100%;height:48px;left:50%;right:auto;top:auto;transform:translateX(-50%);width:1px}.ph.speccer.typography .speccer-styles{font-size:12px;line-height:140%;list-style:none;margin:0;padding:0 0 0 1rem;width:100%}.ph.speccer.typography .speccer-styles .property{color:#3f85f2;font-size:12px;font-weight:400;margin:0;padding:0;text-align:left}.ph.speccer.typography .speccer-styles>li{border:none;color:#e227b3;font-size:12px;font-weight:400;list-style:none;margin:0;padding:0;text-align:left}.ph.speccer.measure.width{border:1px solid red;border-bottom:none;color:red;height:8px}.ph.speccer.measure.width:after{content:attr(data-measure);position:absolute;top:calc(-100% - 10px)}.ph.speccer.measure.width.bottom{border:1px solid red;border-top:none;color:red}.ph.speccer.measure.width.bottom:after{content:attr(data-measure);position:absolute;top:calc(100% + 5px)}.ph.speccer.measure.width.top{border:1px solid red;border-bottom:none;color:red}.ph.speccer.measure.width.top:after{bottom:calc(100% + 5px);content:attr(data-measure);position:absolute}.ph.speccer.measure.height{border:1px solid red;border-right:none;color:red;width:8px}.ph.speccer.measure.height:after{content:attr(data-measure);left:calc(-100% - 25px);position:absolute;top:50%;transform:translateY(-50%) rotate(-90deg)}.ph.speccer.measure.height.right{border:1px solid red;border-left:none;color:red}.ph.speccer.measure.height.right:after{content:attr(data-measure);left:100%;position:absolute;top:50%;transform:translateY(-50%) rotate(90deg)}
|
package/src/browser.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/* eslint no-console:0 */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
import * as resize from './lib/resize';
|
|
5
|
+
import * as spec from './spec';
|
|
6
|
+
import * as measure from './measure';
|
|
7
|
+
import * as dissect from './dissect';
|
|
8
|
+
|
|
9
|
+
export const dom = speccer => {
|
|
10
|
+
if (document.readyState === 'loading') {
|
|
11
|
+
document.addEventListener('DOMContentLoaded', speccer);
|
|
12
|
+
} else {
|
|
13
|
+
// `DOMContentLoaded` already fired
|
|
14
|
+
speccer();
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const lazy = () => {
|
|
19
|
+
let _spec_observer = new IntersectionObserver((els, observer) => {
|
|
20
|
+
els.forEach(el => {
|
|
21
|
+
if (el.intersectionRatio > 0) {
|
|
22
|
+
spec.element(el.target);
|
|
23
|
+
observer.unobserve(el.target);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
document.querySelectorAll('[data-speccer],[data-speccer] *:not(td)').forEach(el => {
|
|
28
|
+
_spec_observer.observe(el);
|
|
29
|
+
});
|
|
30
|
+
let _measure_observer = new IntersectionObserver((els, observer) => {
|
|
31
|
+
els.forEach(el => {
|
|
32
|
+
if (el.intersectionRatio > 0) {
|
|
33
|
+
measure.element(el.target);
|
|
34
|
+
observer.unobserve(el.target);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
document.querySelectorAll('[data-speccer-measure]').forEach(el => {
|
|
39
|
+
_measure_observer.observe(el);
|
|
40
|
+
});
|
|
41
|
+
let _dissect_observer = new IntersectionObserver((els, observer) => {
|
|
42
|
+
els.forEach(el => {
|
|
43
|
+
const targets = el.target.querySelectorAll('[data-anatomy]');
|
|
44
|
+
if (el.intersectionRatio > 0) {
|
|
45
|
+
targets.forEach(dissect.element);
|
|
46
|
+
observer.unobserve(el.target);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
document.querySelectorAll('[data-anatomy-section]').forEach(el => {
|
|
52
|
+
_dissect_observer.observe(el);
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const manual = speccer => {
|
|
57
|
+
window.speccer = speccer;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const activate = speccer => {
|
|
61
|
+
const _script = document.currentScript;
|
|
62
|
+
|
|
63
|
+
if (_script) {
|
|
64
|
+
const _speccer_script_src = _script.getAttribute('src');
|
|
65
|
+
if (
|
|
66
|
+
_speccer_script_src.indexOf('speccer.js') !== -1 ||
|
|
67
|
+
// for codepen
|
|
68
|
+
_speccer_script_src.indexOf('JaXpOK.js') !== -1
|
|
69
|
+
) {
|
|
70
|
+
if (_script.hasAttribute('data-manual')) {
|
|
71
|
+
manual(speccer);
|
|
72
|
+
} else if (_script.hasAttribute('data-instant')) {
|
|
73
|
+
speccer();
|
|
74
|
+
} else if (_script.hasAttribute('data-dom')) {
|
|
75
|
+
dom(speccer);
|
|
76
|
+
} else if (_script.hasAttribute('data-lazy')) {
|
|
77
|
+
lazy();
|
|
78
|
+
} else {
|
|
79
|
+
dom(speccer);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (!_script.hasAttribute('data-manual') && !_script.hasAttribute('data-lazy')) {
|
|
83
|
+
resize.activate(speccer);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
package/src/dissect.js
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/* eslint no-console:0 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import * as styles from './lib/styles';
|
|
4
|
+
import * as node from './lib/node';
|
|
5
|
+
import * as classnames from './lib/classnames';
|
|
6
|
+
import { SPECCER_LITERALS, SPECCER_TAGS_TO_AVOID } from './lib/constants';
|
|
7
|
+
|
|
8
|
+
export const create = (e = '', t, n = 'span') => {
|
|
9
|
+
const _el = document.createElement(n);
|
|
10
|
+
const o = document.createTextNode(e);
|
|
11
|
+
if (t.indexOf('full') === -1 && t.indexOf('enclose') === -1) {
|
|
12
|
+
_el.appendChild(o);
|
|
13
|
+
} else if (t.indexOf('full') !== -1 || t.indexOf('enclose') !== -1) {
|
|
14
|
+
_el.setAttribute('data-dissection-counter', e);
|
|
15
|
+
}
|
|
16
|
+
classnames.set(_el, `ph speccer dissection ${t}`);
|
|
17
|
+
return _el;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const element = (el, dissectIndex) => {
|
|
21
|
+
const _el_rect = el.getBoundingClientRect();
|
|
22
|
+
const _area = el.getAttribute('data-anatomy');
|
|
23
|
+
const _dissection_node = create(SPECCER_LITERALS[dissectIndex], _area);
|
|
24
|
+
const _is_table_correction_needed = SPECCER_TAGS_TO_AVOID.indexOf(el.nodeName) >= 0;
|
|
25
|
+
|
|
26
|
+
let _table_top = 0;
|
|
27
|
+
let _table_left = 0;
|
|
28
|
+
|
|
29
|
+
if (_is_table_correction_needed) {
|
|
30
|
+
const table = el.closest('table');
|
|
31
|
+
const tableStyle = styles.get(table.parentElement);
|
|
32
|
+
node.after(table, _dissection_node);
|
|
33
|
+
const _table_rect = table.getBoundingClientRect();
|
|
34
|
+
_table_top = _table_rect.top - parseInt(tableStyle.getPropertyValue('padding-top'), 10);
|
|
35
|
+
_table_left = _table_rect.left - parseInt(tableStyle.getPropertyValue('padding-left'), 10);
|
|
36
|
+
} else {
|
|
37
|
+
node.after(el, _dissection_node);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const _el_offset_left = el.offsetLeft;
|
|
41
|
+
const _el_offset_top = el.offsetTop;
|
|
42
|
+
|
|
43
|
+
const _dissection_node_rect = _dissection_node.getBoundingClientRect();
|
|
44
|
+
let _outline_left_position_left =
|
|
45
|
+
(_is_table_correction_needed ? _el_rect.left - _table_left : _el_offset_left) -
|
|
46
|
+
_dissection_node_rect.width -
|
|
47
|
+
48 +
|
|
48
|
+
'px';
|
|
49
|
+
let _outline_left_position_top =
|
|
50
|
+
(_is_table_correction_needed ? _el_rect.top - _table_top : _el_offset_top) +
|
|
51
|
+
_el_rect.height / 2 -
|
|
52
|
+
_dissection_node_rect.height / 2 +
|
|
53
|
+
'px';
|
|
54
|
+
let _outline_right_position_left =
|
|
55
|
+
(_is_table_correction_needed ? _el_rect.left - _table_left : _el_offset_left) + _el_rect.width + 48 + 'px';
|
|
56
|
+
let _outline_right_position_top =
|
|
57
|
+
(_is_table_correction_needed ? _el_rect.top - _table_top : _el_offset_top) +
|
|
58
|
+
_el_rect.height / 2 -
|
|
59
|
+
_dissection_node_rect.height / 2 +
|
|
60
|
+
'px';
|
|
61
|
+
let _outline_top_position_left =
|
|
62
|
+
(_is_table_correction_needed ? _el_rect.left - _table_left : _el_offset_left) +
|
|
63
|
+
_el_rect.width / 2 -
|
|
64
|
+
_dissection_node_rect.width / 2 +
|
|
65
|
+
'px';
|
|
66
|
+
let _outline_top_position_top =
|
|
67
|
+
(_is_table_correction_needed ? _el_rect.top - _table_top : _el_offset_top) -
|
|
68
|
+
_dissection_node_rect.height -
|
|
69
|
+
48 +
|
|
70
|
+
'px';
|
|
71
|
+
let _outline_bottom_position_left =
|
|
72
|
+
(_is_table_correction_needed ? _el_rect.left - _table_left : _el_offset_left) +
|
|
73
|
+
_el_rect.width / 2 -
|
|
74
|
+
_dissection_node_rect.width / 2 +
|
|
75
|
+
'px';
|
|
76
|
+
let _outline_bottom_position_top =
|
|
77
|
+
(_is_table_correction_needed ? _el_rect.top - _table_top : _el_offset_top) + _el_rect.height + 48 + 'px';
|
|
78
|
+
|
|
79
|
+
let _dissection_node_styles = {};
|
|
80
|
+
if (_area.indexOf('outline') !== -1) {
|
|
81
|
+
if (_area.indexOf('left') !== -1) {
|
|
82
|
+
if (_area.indexOf('full') !== -1) {
|
|
83
|
+
_dissection_node_styles = {
|
|
84
|
+
left: _el_offset_left - 8 + 'px',
|
|
85
|
+
top: _el_offset_top + -1 + 'px',
|
|
86
|
+
height: _el_rect.height + 'px'
|
|
87
|
+
};
|
|
88
|
+
} else if (_area.indexOf('enclose') !== -1) {
|
|
89
|
+
_dissection_node_styles = {
|
|
90
|
+
left: _el_offset_left - 1 + 'px',
|
|
91
|
+
top: _el_offset_top + -1 + 'px',
|
|
92
|
+
height: _el_rect.height + 'px',
|
|
93
|
+
width: _el_rect.width + 'px'
|
|
94
|
+
};
|
|
95
|
+
} else {
|
|
96
|
+
_dissection_node_styles = {
|
|
97
|
+
left: _outline_left_position_left,
|
|
98
|
+
top: _outline_left_position_top
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
} else if (_area.indexOf('right') !== -1) {
|
|
102
|
+
if (_area.indexOf('full') !== -1) {
|
|
103
|
+
_dissection_node_styles = {
|
|
104
|
+
left: _el_offset_left + _el_rect.width + 'px',
|
|
105
|
+
top: _el_offset_top + -1 + 'px',
|
|
106
|
+
height: _el_rect.height + 'px'
|
|
107
|
+
};
|
|
108
|
+
} else if (_area.indexOf('enclose') !== -1) {
|
|
109
|
+
_dissection_node_styles = {
|
|
110
|
+
left: _el_offset_left + -1 + 'px',
|
|
111
|
+
top: _el_offset_top + -1 + 'px',
|
|
112
|
+
height: _el_rect.height + 'px',
|
|
113
|
+
width: _el_rect.width + 'px'
|
|
114
|
+
};
|
|
115
|
+
} else {
|
|
116
|
+
_dissection_node_styles = {
|
|
117
|
+
left: _outline_right_position_left,
|
|
118
|
+
top: _outline_right_position_top
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
} else if (_area.indexOf('top') !== -1) {
|
|
122
|
+
if (_area.indexOf('full') !== -1) {
|
|
123
|
+
_dissection_node_styles = {
|
|
124
|
+
top: _el_offset_top + -8 + 'px',
|
|
125
|
+
left: _el_offset_left + -1 + 'px',
|
|
126
|
+
width: _el_rect.width + 'px'
|
|
127
|
+
};
|
|
128
|
+
} else if (_area.indexOf('enclose') !== -1) {
|
|
129
|
+
_dissection_node_styles = {
|
|
130
|
+
top: _el_offset_top + -1 + 'px',
|
|
131
|
+
left: _el_offset_left + -1 + 'px',
|
|
132
|
+
height: _el_rect.height + 'px',
|
|
133
|
+
width: _el_rect.width + 'px'
|
|
134
|
+
};
|
|
135
|
+
} else {
|
|
136
|
+
_dissection_node_styles = {
|
|
137
|
+
left: _outline_top_position_left,
|
|
138
|
+
top: _outline_top_position_top
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
} else if (_area.indexOf('bottom') !== -1) {
|
|
142
|
+
if (_area.indexOf('full') !== -1) {
|
|
143
|
+
_dissection_node_styles = {
|
|
144
|
+
top: _el_offset_top + _el_rect.height + 'px',
|
|
145
|
+
left: _el_offset_left + -1 + 'px',
|
|
146
|
+
width: _el_rect.width + 'px'
|
|
147
|
+
};
|
|
148
|
+
} else if (_area.indexOf('enclose') !== -1) {
|
|
149
|
+
_dissection_node_styles = {
|
|
150
|
+
top: _el_offset_top + -1 + 'px',
|
|
151
|
+
left: _el_offset_left + -1 + 'px',
|
|
152
|
+
height: _el_rect.height + 'px',
|
|
153
|
+
width: _el_rect.width + 'px'
|
|
154
|
+
};
|
|
155
|
+
} else {
|
|
156
|
+
_dissection_node_styles = {
|
|
157
|
+
left: _outline_bottom_position_left,
|
|
158
|
+
top: _outline_bottom_position_top
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
} else {
|
|
162
|
+
if (_area.indexOf('full') !== -1) {
|
|
163
|
+
_dissection_node_styles = {
|
|
164
|
+
left: _el_offset_left + _el_rect.width + 'px',
|
|
165
|
+
top: _el_offset_top + 'px',
|
|
166
|
+
height: _el_rect.height + 'px'
|
|
167
|
+
};
|
|
168
|
+
} else if (_area.indexOf('enclose') !== -1) {
|
|
169
|
+
_dissection_node_styles = {
|
|
170
|
+
left: _el_offset_left + _el_rect.width + 'px',
|
|
171
|
+
top: _el_offset_top + -1 + 'px',
|
|
172
|
+
height: _el_rect.height + 'px',
|
|
173
|
+
width: _el_rect.width + 'px'
|
|
174
|
+
};
|
|
175
|
+
} else {
|
|
176
|
+
_dissection_node_styles = {
|
|
177
|
+
left: _outline_left_position_left,
|
|
178
|
+
top: _outline_left_position_top
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
} else {
|
|
183
|
+
if (_area.indexOf('full') !== -1) {
|
|
184
|
+
_dissection_node_styles = {
|
|
185
|
+
left: _el_offset_left - 8 + 'px',
|
|
186
|
+
top: _el_offset_top + -1 + 'px',
|
|
187
|
+
height: _el_rect.height + 'px'
|
|
188
|
+
};
|
|
189
|
+
} else if (_area.indexOf('enclose') !== -1) {
|
|
190
|
+
_dissection_node_styles = {
|
|
191
|
+
left: _el_offset_left - 1 + 'px',
|
|
192
|
+
top: _el_offset_top + -1 + 'px',
|
|
193
|
+
height: _el_rect.height + 'px',
|
|
194
|
+
width: _el_rect.width + 'px'
|
|
195
|
+
};
|
|
196
|
+
} else {
|
|
197
|
+
_dissection_node_styles = {
|
|
198
|
+
left: _outline_left_position_left,
|
|
199
|
+
top: _outline_left_position_top
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
styles.add(_dissection_node, _dissection_node_styles);
|
|
204
|
+
};
|