@themarioga/grid-editor 8.0.0-beta.2 → 8.0.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 +39 -0
- package/README.md +16 -9
- package/UPGRADING.md +21 -11
- package/dist/grideditor.bundle.min.js +3 -3
- package/dist/grideditor.css +77 -35
- package/dist/grideditor.d.ts +29 -8
- package/dist/grideditor.esm.js +7 -1
- package/dist/grideditor.js +7 -1
- package/dist/grideditor.min.css +1 -1
- package/dist/grideditor.min.css.map +1 -1
- package/dist/grideditor.min.js +2 -2
- package/dist/grideditor.min.js.map +3 -3
- package/dist/locales/grideditor.es.esm.js +86 -68
- package/dist/locales/grideditor.es.js +86 -68
- package/dist/locales/grideditor.es.min.js +1 -1
- package/dist/locales/grideditor.es.min.js.map +2 -2
- package/dist/plugins/grideditor.alignment.min.js.map +1 -1
- package/dist/plugins/{grideditor.style.esm.js → grideditor.inline-style.esm.js} +184 -184
- package/dist/plugins/{grideditor.style.js → grideditor.inline-style.js} +182 -182
- package/dist/plugins/grideditor.inline-style.min.js +4 -0
- package/dist/plugins/grideditor.inline-style.min.js.map +7 -0
- package/dist/plugins/grideditor.tabs.esm.js +274 -6
- package/dist/plugins/grideditor.tabs.js +274 -6
- package/dist/plugins/grideditor.tabs.min.js +1 -1
- package/dist/plugins/grideditor.tabs.min.js.map +3 -3
- package/docs/locale-keys.md +97 -79
- package/docs/plugins.md +5 -5
- package/example/containers.html +64 -2
- package/example/index.html +6 -6
- package/example/{style.html → inline-style.html} +5 -5
- package/example/utilities.html +3 -3
- package/package.json +1 -1
- package/src/js/grideditor.js +8 -0
- package/src/js/{style → inline-style}/accordion.js +9 -9
- package/src/js/{style → inline-style}/catalog.js +6 -6
- package/src/js/{style → inline-style}/custom.js +4 -4
- package/src/js/{style → inline-style}/display.js +2 -2
- package/src/js/{style → inline-style}/drawerflow.js +1 -1
- package/src/js/{style → inline-style}/fields.js +25 -25
- package/src/js/{style → inline-style}/flex.js +2 -2
- package/src/js/{style → inline-style}/float.js +2 -2
- package/src/js/{style → inline-style}/options.js +5 -5
- package/src/js/{style → inline-style}/sections.js +50 -50
- package/src/js/{style → inline-style}/spacing.js +2 -2
- package/src/js/{style → inline-style}/sticky.js +2 -2
- package/src/js/{style → inline-style}/textalign.js +2 -2
- package/src/js/locales/grideditor.es.js +86 -68
- package/src/js/plugins/grideditor.alignment.js +1 -1
- package/src/js/plugins/grideditor.inline-style.js +185 -0
- package/src/js/plugins/grideditor.tabs.js +311 -5
- package/src/less/grideditor.less +71 -25
- package/types/grideditor.d.ts +29 -8
- package/dist/plugins/grideditor.style.min.js +0 -4
- package/dist/plugins/grideditor.style.min.js.map +0 -7
- package/src/js/plugins/grideditor.style.js +0 -185
package/example/index.html
CHANGED
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
<a href="utilities.html">Responsive utilities</a>.
|
|
50
50
|
</p>
|
|
51
51
|
<p class="text-body-secondary">
|
|
52
|
-
New in 7.3: the style plugin, inline css by section with
|
|
52
|
+
New in 7.3: the inline-style plugin, inline css by section with
|
|
53
53
|
Bootstrap's classes as chips, which also carries display,
|
|
54
54
|
spacing, text alignment and float. See
|
|
55
|
-
<a href="style.html">
|
|
55
|
+
<a href="inline-style.html">Inline style</a>. In 8.0: flex, sticky and
|
|
56
56
|
Bootstrap 5.3's colors.
|
|
57
57
|
</p>
|
|
58
58
|
|
|
@@ -138,12 +138,12 @@
|
|
|
138
138
|
<span class="text-body-secondary">Bootstrap's utility classes edited per breakpoint: display, flex, column order, alignment, gutters, spacing, text alignment and float</span>
|
|
139
139
|
</a>
|
|
140
140
|
|
|
141
|
-
<a class="list-group-item list-group-item-action" href="style.html">
|
|
141
|
+
<a class="list-group-item list-group-item-action" href="inline-style.html">
|
|
142
142
|
<div class="d-flex justify-content-between">
|
|
143
|
-
<strong>
|
|
144
|
-
<code class="text-body-secondary">style.html</code>
|
|
143
|
+
<strong>Inline style</strong>
|
|
144
|
+
<code class="text-body-secondary">inline-style.html</code>
|
|
145
145
|
</div>
|
|
146
|
-
<span class="text-body-secondary">The style plugin: inline css for rows, columns, containers and elements, by section, with Bootstrap's classes for each as chips</span>
|
|
146
|
+
<span class="text-body-secondary">The inline-style plugin: inline css for rows, columns, containers and elements, by section, with Bootstrap's classes for each as chips</span>
|
|
147
147
|
</a>
|
|
148
148
|
|
|
149
149
|
<a class="list-group-item list-group-item-action" href="locale.html">
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
<link rel="stylesheet" type="text/css" href="../dist/grideditor.css" />
|
|
15
15
|
|
|
16
16
|
<!-- The editor, the elements and tabs plugins so there is one of each
|
|
17
|
-
kind of node, and the style plugin. -->
|
|
17
|
+
kind of node, and the inline-style plugin. -->
|
|
18
18
|
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.6/Sortable.min.js"></script>
|
|
19
19
|
<script src="../dist/grideditor.min.js"></script>
|
|
20
20
|
<script src="../dist/plugins/grideditor.elements.min.js"></script>
|
|
21
21
|
<script src="../dist/plugins/grideditor.tabs.min.js"></script>
|
|
22
|
-
<script src="../dist/plugins/grideditor.style.min.js"></script>
|
|
22
|
+
<script src="../dist/plugins/grideditor.inline-style.min.js"></script>
|
|
23
23
|
|
|
24
24
|
<script>
|
|
25
25
|
document.addEventListener('DOMContentLoaded', function() {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
// Every section, unless the host says otherwise: this
|
|
41
41
|
// leaves out position and keeps the border section to
|
|
42
42
|
// three fields with no chips
|
|
43
|
-
|
|
43
|
+
inline_style: narrow.checked ? {
|
|
44
44
|
sections: {
|
|
45
45
|
position: false,
|
|
46
46
|
border: { properties: ['border-width', 'border-style', 'border-color'], catalog: false },
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
});
|
|
67
67
|
</script>
|
|
68
68
|
|
|
69
|
-
<title>Grid Editor style example</title>
|
|
69
|
+
<title>Grid Editor inline style example</title>
|
|
70
70
|
</head>
|
|
71
71
|
<body>
|
|
72
72
|
<!-- Back to the demo index -->
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
|
|
79
79
|
<div class="row my-3">
|
|
80
80
|
<div class="col-lg-8">
|
|
81
|
-
<h1 class="h4">
|
|
81
|
+
<h1 class="h4">Inline style</h1>
|
|
82
82
|
<p class="form-text">
|
|
83
83
|
The gear of a row, a column, a container, a tab, an element
|
|
84
84
|
or a section has a <strong>Style</strong> accordion: size,
|
package/example/utilities.html
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
<link rel="stylesheet" type="text/css" href="../dist/grideditor.css" />
|
|
15
15
|
|
|
16
16
|
<!-- The editor, and the utility plugins. Each is a file of its own, and
|
|
17
|
-
loading it is what puts its fields in the settings panels. The
|
|
18
|
-
plugin carries display, flex, spacing, text alignment, sticky and
|
|
17
|
+
loading it is what puts its fields in the settings panels. The
|
|
18
|
+
inline-style plugin carries display, flex, spacing, text alignment, sticky and
|
|
19
19
|
float, and edits them in its Style accordion - a row's justify and
|
|
20
20
|
align among them, in Flex; order, a column's align-self and gutters
|
|
21
21
|
are the grid's, and stay in the Responsive section. -->
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
<script src="../dist/plugins/grideditor.gutters.min.js"></script>
|
|
27
27
|
<!-- Float works on elements, so the elements plugin comes first -->
|
|
28
28
|
<script src="../dist/plugins/grideditor.elements.min.js"></script>
|
|
29
|
-
<script src="../dist/plugins/grideditor.style.min.js"></script>
|
|
29
|
+
<script src="../dist/plugins/grideditor.inline-style.min.js"></script>
|
|
30
30
|
|
|
31
31
|
<script>
|
|
32
32
|
document.addEventListener('DOMContentLoaded', function() {
|
package/package.json
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"comment": "A scoped package publishes restricted unless it is told otherwise.",
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
|
-
"version": "8.0.0
|
|
36
|
+
"version": "8.0.0",
|
|
37
37
|
"main": "dist/grideditor.js",
|
|
38
38
|
"module": "dist/grideditor.esm.js",
|
|
39
39
|
"types": "dist/grideditor.d.ts",
|
package/src/js/grideditor.js
CHANGED
|
@@ -3206,6 +3206,7 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
3206
3206
|
|
|
3207
3207
|
function createDetails(container, cssClasses) {
|
|
3208
3208
|
var detailsDiv = dom.element('div', { 'class': 'ge-details' });
|
|
3209
|
+
detailsDiv.appendChild(sectionTitle(t('panel.section_general')));
|
|
3209
3210
|
var general = detailsDiv.appendChild(dom.element('div', { 'class': 'ge-details-general' }));
|
|
3210
3211
|
var field = function(label) {
|
|
3211
3212
|
var holder = dom.element('label', { 'class': 'ge-field' });
|
|
@@ -3272,6 +3273,11 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
3272
3273
|
return detailsDiv;
|
|
3273
3274
|
}
|
|
3274
3275
|
|
|
3276
|
+
/** The heading of one of a panel's sections. */
|
|
3277
|
+
function sectionTitle(text) {
|
|
3278
|
+
return dom.element('h6', { 'class': 'ge-section-title' }, text);
|
|
3279
|
+
}
|
|
3280
|
+
|
|
3275
3281
|
/**
|
|
3276
3282
|
* What plugins add to a node's panel, between its general fields and
|
|
3277
3283
|
* the Responsive section: each plugin's panelSection(node, kind), in
|
|
@@ -3294,6 +3300,7 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
3294
3300
|
var holder = dom.element('div', { 'class': 'ge-panel-section', 'data-ge-plugin': name });
|
|
3295
3301
|
|
|
3296
3302
|
if (mode === 'offcanvas' || mode === 'modal') {
|
|
3303
|
+
holder.appendChild(sectionTitle(t(section.labelKey)));
|
|
3297
3304
|
holder.appendChild(section.body);
|
|
3298
3305
|
} else {
|
|
3299
3306
|
var label = t(section.labelKey);
|
|
@@ -5302,6 +5309,7 @@ GridEditor.locales = {
|
|
|
5302
5309
|
'panel.done': 'Done',
|
|
5303
5310
|
'panel.id': 'Id',
|
|
5304
5311
|
'panel.classes': 'Classes',
|
|
5312
|
+
'panel.section_general': 'Id and classes',
|
|
5305
5313
|
'panel.kind_row': 'Row',
|
|
5306
5314
|
'panel.kind_column': 'Column',
|
|
5307
5315
|
'panel.kind_element': 'Element',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The style plugin's accordion for one node: a section per group of
|
|
2
|
+
* The inline-style plugin's accordion for one node: a section per group of
|
|
3
3
|
* properties, each with the merged utilities' per breakpoint fields, the
|
|
4
4
|
* inline fields and the catalog - as far as each applies to the node.
|
|
5
5
|
*
|
|
@@ -46,7 +46,7 @@ function partContent(ge, part, node, kind) {
|
|
|
46
46
|
|
|
47
47
|
if (fields.length < 2) { return fields[0] || null; }
|
|
48
48
|
|
|
49
|
-
var box = dom.element('div', { 'class': 'ge-style-part-fields' });
|
|
49
|
+
var box = dom.element('div', { 'class': 'ge-inline-style-part-fields' });
|
|
50
50
|
fields.forEach(function(field) { box.appendChild(field); });
|
|
51
51
|
|
|
52
52
|
return box;
|
|
@@ -59,7 +59,7 @@ function partContent(ge, part, node, kind) {
|
|
|
59
59
|
*/
|
|
60
60
|
export function createAccordion(ge, node, kind, context) {
|
|
61
61
|
var inline = takesInlineStyle(node, kind);
|
|
62
|
-
var accordion = dom.element('div', { 'class': 'accordion ge-style' });
|
|
62
|
+
var accordion = dom.element('div', { 'class': 'accordion ge-inline-style' });
|
|
63
63
|
var fields = [];
|
|
64
64
|
var catalogs = [];
|
|
65
65
|
var notes = [];
|
|
@@ -68,7 +68,7 @@ export function createAccordion(ge, node, kind, context) {
|
|
|
68
68
|
var changed = function() { render(); };
|
|
69
69
|
|
|
70
70
|
function item(key, labelKey) {
|
|
71
|
-
var entry = accordion.appendChild(dom.element('div', { 'class': 'accordion-item', 'data-ge-style-section': key }));
|
|
71
|
+
var entry = accordion.appendChild(dom.element('div', { 'class': 'accordion-item', 'data-ge-inline-style-section': key }));
|
|
72
72
|
var header = entry.appendChild(dom.element('h2', { 'class': 'accordion-header' }));
|
|
73
73
|
var button = header.appendChild(dom.element('button', {
|
|
74
74
|
type: 'button',
|
|
@@ -114,13 +114,13 @@ export function createAccordion(ge, node, kind, context) {
|
|
|
114
114
|
if (!parts.length && !properties.length && !catalog) { return; }
|
|
115
115
|
|
|
116
116
|
var body = item(key, section.labelKey).body;
|
|
117
|
-
parts.forEach(function(part) { body.appendChild(dom.addClass(part, 'ge-style-part')); });
|
|
117
|
+
parts.forEach(function(part) { body.appendChild(dom.addClass(part, 'ge-inline-style-part')); });
|
|
118
118
|
|
|
119
119
|
if (properties.length) {
|
|
120
|
-
var note = body.appendChild(dom.element('small', { 'class': 'ge-style-note ge-style-all-sizes' }, ge.t('
|
|
120
|
+
var note = body.appendChild(dom.element('small', { 'class': 'ge-inline-style-note ge-inline-style-all-sizes' }, ge.t('inline_style.all_sizes')));
|
|
121
121
|
notes.push(note);
|
|
122
122
|
|
|
123
|
-
var grid = body.appendChild(dom.element('div', { 'class': 'ge-style-fields' }));
|
|
123
|
+
var grid = body.appendChild(dom.element('div', { 'class': 'ge-inline-style-fields' }));
|
|
124
124
|
properties.forEach(function(property) {
|
|
125
125
|
var field = createStyleField(ge, node, property, changed);
|
|
126
126
|
fields.push(field);
|
|
@@ -137,7 +137,7 @@ export function createAccordion(ge, node, kind, context) {
|
|
|
137
137
|
// Last, since it shows what the fields made above do not
|
|
138
138
|
if (customItem) {
|
|
139
139
|
custom = createCustom(ge, node, fields.map(function(field) {
|
|
140
|
-
return field.getAttribute('data-ge-style-property');
|
|
140
|
+
return field.getAttribute('data-ge-inline-style-property');
|
|
141
141
|
}), changed);
|
|
142
142
|
customItem.body.appendChild(custom.element);
|
|
143
143
|
accordion.appendChild(customItem.entry);
|
|
@@ -148,7 +148,7 @@ export function createAccordion(ge, node, kind, context) {
|
|
|
148
148
|
/** Open this section and no other; null closes them all. */
|
|
149
149
|
function open(key) {
|
|
150
150
|
dom.all(accordion, '.accordion-item').forEach(function(entry) {
|
|
151
|
-
toggle(entry, entry.getAttribute('data-ge-style-section') === key);
|
|
151
|
+
toggle(entry, entry.getAttribute('data-ge-inline-style-section') === key);
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
154
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The style plugin's catalog: Bootstrap's classes for what a section
|
|
2
|
+
* The inline-style plugin's catalog: Bootstrap's classes for what a section
|
|
3
3
|
* styles, as chips that put a class on the node or take it off.
|
|
4
4
|
*
|
|
5
5
|
* A chip never touches the node itself. It writes the panel's classes
|
|
@@ -41,16 +41,16 @@ export function createCatalog(ge, node, kind, groups) {
|
|
|
41
41
|
var offered = groups.filter(function(group) { return offeredOn(group, kind); });
|
|
42
42
|
if (!offered.length) { return null; }
|
|
43
43
|
|
|
44
|
-
var box = dom.element('div', { 'class': 'ge-style-catalog' });
|
|
45
|
-
box.appendChild(dom.element('span', { 'class': 'ge-style-label' }, ge.t('
|
|
44
|
+
var box = dom.element('div', { 'class': 'ge-inline-style-catalog' });
|
|
45
|
+
box.appendChild(dom.element('span', { 'class': 'ge-inline-style-label' }, ge.t('inline_style.catalog')));
|
|
46
46
|
|
|
47
47
|
offered.forEach(function(group) {
|
|
48
|
-
var row = box.appendChild(dom.element('div', { 'class': 'ge-style-chips' }));
|
|
48
|
+
var row = box.appendChild(dom.element('div', { 'class': 'ge-inline-style-chips' }));
|
|
49
49
|
|
|
50
50
|
group.classes.forEach(function(name) {
|
|
51
51
|
var chip = row.appendChild(dom.element('button', {
|
|
52
52
|
type: 'button',
|
|
53
|
-
'class': 'btn btn-sm btn-outline-secondary ge-style-chip',
|
|
53
|
+
'class': 'btn btn-sm btn-outline-secondary ge-inline-style-chip',
|
|
54
54
|
'data-ge-class': name,
|
|
55
55
|
'aria-pressed': 'false',
|
|
56
56
|
}, name));
|
|
@@ -68,7 +68,7 @@ export function createCatalog(ge, node, kind, groups) {
|
|
|
68
68
|
export function renderCatalog(box, node) {
|
|
69
69
|
var classes = classesOf(node);
|
|
70
70
|
|
|
71
|
-
dom.all(box, '.ge-style-chip').forEach(function(chip) {
|
|
71
|
+
dom.all(box, '.ge-inline-style-chip').forEach(function(chip) {
|
|
72
72
|
var on = classes.indexOf(chip.getAttribute('data-ge-class')) !== -1;
|
|
73
73
|
dom.toggleClass(chip, 'active', on);
|
|
74
74
|
chip.setAttribute('aria-pressed', on ? 'true' : 'false');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The style plugin's free css: a textarea with every declaration of the
|
|
2
|
+
* The inline-style plugin's free css: a textarea with every declaration of the
|
|
3
3
|
* node's own style that no field on show stands for - whatever the host
|
|
4
4
|
* wrote that the sections have no field for, and what a section the host
|
|
5
5
|
* turned off or narrowed would have shown.
|
|
@@ -36,12 +36,12 @@ export function createCustom(ge, node, properties, changed) {
|
|
|
36
36
|
longhands(property).forEach(function(longhand) { covered[longhand] = true; });
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
var box = dom.element('div', { 'class': 'ge-style-custom' });
|
|
39
|
+
var box = dom.element('div', { 'class': 'ge-inline-style-custom' });
|
|
40
40
|
var textarea = box.appendChild(dom.element('textarea', {
|
|
41
|
-
'class': 'form-control form-control-sm font-monospace ge-style-custom-css',
|
|
41
|
+
'class': 'form-control form-control-sm font-monospace ge-inline-style-custom-css',
|
|
42
42
|
rows: '4',
|
|
43
43
|
spellcheck: 'false',
|
|
44
|
-
'aria-label': ge.t('
|
|
44
|
+
'aria-label': ge.t('inline_style.section_custom'),
|
|
45
45
|
}));
|
|
46
46
|
|
|
47
47
|
/** The declarations of the host's style no field stands for. */
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Display, a part of the style plugin: how a node is displayed per
|
|
2
|
+
* Display, a part of the inline-style plugin: how a node is displayed per
|
|
3
3
|
* breakpoint, hidden included, with Bootstrap's d-{breakpoint}-* classes,
|
|
4
4
|
* and the eye in the drawers that hides and shows it.
|
|
5
5
|
*
|
|
6
6
|
* Its families, and whatever it does on the canvas, as a function of the
|
|
7
|
-
* handle and its options: grideditor.style.js puts them in its sections.
|
|
7
|
+
* handle and its options: grideditor.inline-style.js puts them in its sections.
|
|
8
8
|
*/
|
|
9
9
|
import { GridEditor } from '../grideditor.js';
|
|
10
10
|
import * as dom from '../dom.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The drawer of a flex or grid node, a part of the style plugin.
|
|
2
|
+
* The drawer of a flex or grid node, a part of the inline-style plugin.
|
|
3
3
|
*
|
|
4
4
|
* A drawer is its node's first child, in the flow: in a row, which wraps,
|
|
5
5
|
* it is a line of its own above the columns, but in anything else that
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The style plugin's inline fields: one per css property, each writing the
|
|
2
|
+
* The inline-style plugin's inline fields: one per css property, each writing the
|
|
3
3
|
* node's own style through ge.setHostStyle, never by hand, so the preview
|
|
4
4
|
* of a breakpoint view neither shows in them nor eats what they write.
|
|
5
5
|
*
|
|
@@ -40,7 +40,7 @@ function mark(input, ok, ge) {
|
|
|
40
40
|
if (ok) {
|
|
41
41
|
input.removeAttribute('title');
|
|
42
42
|
} else {
|
|
43
|
-
input.setAttribute('title', ge.t('
|
|
43
|
+
input.setAttribute('title', ge.t('inline_style.invalid'));
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -70,7 +70,7 @@ function pickable(value) {
|
|
|
70
70
|
|
|
71
71
|
/** A picker and a text beside it, which takes what a picker cannot: rgba, var(), transparent. */
|
|
72
72
|
function colorControl(onValue) {
|
|
73
|
-
var box = dom.element('div', { 'class': 'input-group input-group-sm ge-style-color' });
|
|
73
|
+
var box = dom.element('div', { 'class': 'input-group input-group-sm ge-inline-style-color' });
|
|
74
74
|
var picker = box.appendChild(dom.element('input', { type: 'color', 'class': 'form-control form-control-color' }));
|
|
75
75
|
var text = box.appendChild(textInput());
|
|
76
76
|
|
|
@@ -146,10 +146,10 @@ var LENGTH = /^-?(?:\d*\.)?\d+(?:[a-z%]+)?$/i;
|
|
|
146
146
|
|
|
147
147
|
/** The lengths of a shadow, in the order css writes them; a text shadow has no spread. */
|
|
148
148
|
var SHADOW_PARTS = [
|
|
149
|
-
{ name: 'x', labelKey: '
|
|
150
|
-
{ name: 'y', labelKey: '
|
|
151
|
-
{ name: 'blur', labelKey: '
|
|
152
|
-
{ name: 'spread', labelKey: '
|
|
149
|
+
{ name: 'x', labelKey: 'inline_style.shadow_x' },
|
|
150
|
+
{ name: 'y', labelKey: 'inline_style.shadow_y' },
|
|
151
|
+
{ name: 'blur', labelKey: 'inline_style.shadow_blur' },
|
|
152
|
+
{ name: 'spread', labelKey: 'inline_style.shadow_spread' },
|
|
153
153
|
];
|
|
154
154
|
|
|
155
155
|
/**
|
|
@@ -206,7 +206,7 @@ function composeShadow(parts, box) {
|
|
|
206
206
|
*/
|
|
207
207
|
function shadowControl(ge, node, property, changed) {
|
|
208
208
|
var box = property === 'box-shadow';
|
|
209
|
-
var holder = dom.element('div', { 'class': 'ge-style-shadow' });
|
|
209
|
+
var holder = dom.element('div', { 'class': 'ge-inline-style-shadow' });
|
|
210
210
|
var textMode = false;
|
|
211
211
|
|
|
212
212
|
function writeValue(value, input) {
|
|
@@ -218,34 +218,34 @@ function shadowControl(ge, node, property, changed) {
|
|
|
218
218
|
|
|
219
219
|
function builder(parts) {
|
|
220
220
|
holder.innerHTML = '';
|
|
221
|
-
var grid = holder.appendChild(dom.element('div', { 'class': 'ge-style-shadow-builder' }));
|
|
221
|
+
var grid = holder.appendChild(dom.element('div', { 'class': 'ge-inline-style-shadow-builder' }));
|
|
222
222
|
var names = box ? SHADOW_PARTS : SHADOW_PARTS.slice(0, 3);
|
|
223
223
|
var inputs = names.map(function(part, i) {
|
|
224
|
-
var cell = grid.appendChild(dom.element('label', { 'class': 'ge-style-shadow-part' }));
|
|
225
|
-
cell.appendChild(dom.element('span', { 'class': 'ge-style-shadow-label' }, ge.t(part.labelKey)));
|
|
226
|
-
var input = cell.appendChild(textInput('ge-style-shadow-' + part.name));
|
|
224
|
+
var cell = grid.appendChild(dom.element('label', { 'class': 'ge-inline-style-shadow-part' }));
|
|
225
|
+
cell.appendChild(dom.element('span', { 'class': 'ge-inline-style-shadow-label' }, ge.t(part.labelKey)));
|
|
226
|
+
var input = cell.appendChild(textInput('ge-inline-style-shadow-' + part.name));
|
|
227
227
|
input.value = parts.lengths[i] || '';
|
|
228
228
|
return input;
|
|
229
229
|
});
|
|
230
230
|
|
|
231
|
-
var colorCell = grid.appendChild(dom.element('label', { 'class': 'ge-style-shadow-part ge-style-shadow-color' }));
|
|
232
|
-
colorCell.appendChild(dom.element('span', { 'class': 'ge-style-shadow-label' }, ge.t('
|
|
231
|
+
var colorCell = grid.appendChild(dom.element('label', { 'class': 'ge-inline-style-shadow-part ge-inline-style-shadow-color' }));
|
|
232
|
+
colorCell.appendChild(dom.element('span', { 'class': 'ge-inline-style-shadow-label' }, ge.t('inline_style.shadow_color')));
|
|
233
233
|
var color = colorControl(function() { update(); });
|
|
234
234
|
colorCell.appendChild(color.element);
|
|
235
235
|
color.set(parts.color);
|
|
236
236
|
|
|
237
237
|
var inset = null;
|
|
238
238
|
if (box) {
|
|
239
|
-
var insetCell = grid.appendChild(dom.element('label', { 'class': 'form-check ge-style-shadow-inset' }));
|
|
239
|
+
var insetCell = grid.appendChild(dom.element('label', { 'class': 'form-check ge-inline-style-shadow-inset' }));
|
|
240
240
|
inset = insetCell.appendChild(dom.element('input', { type: 'checkbox', 'class': 'form-check-input' }));
|
|
241
|
-
insetCell.appendChild(dom.element('span', { 'class': 'form-check-label' }, ge.t('
|
|
241
|
+
insetCell.appendChild(dom.element('span', { 'class': 'form-check-label' }, ge.t('inline_style.shadow_inset')));
|
|
242
242
|
inset.checked = parts.inset;
|
|
243
243
|
inset.addEventListener('change', function() { update(); });
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
inputs.forEach(function(input) { input.addEventListener('change', function() { update(); }); });
|
|
247
247
|
|
|
248
|
-
var toText = holder.appendChild(dom.element('a', { href: '#', 'class': 'ge-style-shadow-mode' }, ge.t('
|
|
248
|
+
var toText = holder.appendChild(dom.element('a', { href: '#', 'class': 'ge-inline-style-shadow-mode' }, ge.t('inline_style.shadow_text_mode')));
|
|
249
249
|
toText.addEventListener('click', function(e) {
|
|
250
250
|
e.preventDefault();
|
|
251
251
|
textMode = true;
|
|
@@ -264,7 +264,7 @@ function shadowControl(ge, node, property, changed) {
|
|
|
264
264
|
|
|
265
265
|
function text(value) {
|
|
266
266
|
holder.innerHTML = '';
|
|
267
|
-
var input = holder.appendChild(textInput('ge-style-shadow-text'));
|
|
267
|
+
var input = holder.appendChild(textInput('ge-inline-style-shadow-text'));
|
|
268
268
|
input.value = value;
|
|
269
269
|
input.addEventListener('change', function() {
|
|
270
270
|
if (input.value.trim() === '') {
|
|
@@ -288,7 +288,7 @@ function shadowControl(ge, node, property, changed) {
|
|
|
288
288
|
|
|
289
289
|
// Built again only when the value changed under it: building takes
|
|
290
290
|
// the focus from whichever of its inputs the user moved on to
|
|
291
|
-
if (value === shown && holder.firstChild && textMode === !!holder.querySelector('.ge-style-shadow-text')) { return; }
|
|
291
|
+
if (value === shown && holder.firstChild && textMode === !!holder.querySelector('.ge-inline-style-shadow-text')) { return; }
|
|
292
292
|
shown = value;
|
|
293
293
|
|
|
294
294
|
if (textMode || !parts) {
|
|
@@ -308,8 +308,8 @@ function shadowControl(ge, node, property, changed) {
|
|
|
308
308
|
* sections up to date.
|
|
309
309
|
*/
|
|
310
310
|
export function createStyleField(ge, node, property, changed) {
|
|
311
|
-
var field = dom.element('div', { 'class': 'ge-style-field', 'data-ge-style-property': property.name });
|
|
312
|
-
var label = field.appendChild(dom.element('label', { 'class': 'ge-style-label' }, ge.t(property.labelKey)));
|
|
311
|
+
var field = dom.element('div', { 'class': 'ge-inline-style-field', 'data-ge-inline-style-property': property.name });
|
|
312
|
+
var label = field.appendChild(dom.element('label', { 'class': 'ge-inline-style-label' }, ge.t(property.labelKey)));
|
|
313
313
|
var render;
|
|
314
314
|
|
|
315
315
|
function current() {
|
|
@@ -355,19 +355,19 @@ export function createStyleField(ge, node, property, changed) {
|
|
|
355
355
|
|
|
356
356
|
var control = field.querySelector('input, select');
|
|
357
357
|
if (control) {
|
|
358
|
-
control.id = 'ge-style-field-' + (++fieldCounter);
|
|
358
|
+
control.id = 'ge-inline-style-field-' + (++fieldCounter);
|
|
359
359
|
label.setAttribute('for', control.id);
|
|
360
360
|
}
|
|
361
361
|
|
|
362
|
-
field.appendChild(dom.element('small', { 'class': 'ge-style-note ge-style-overridden' }));
|
|
362
|
+
field.appendChild(dom.element('small', { 'class': 'ge-inline-style-note ge-inline-style-overridden' }));
|
|
363
363
|
|
|
364
364
|
renderers.set(field, function() {
|
|
365
365
|
render();
|
|
366
366
|
|
|
367
367
|
// A Bootstrap utility on the node wins over the value: every one is !important
|
|
368
368
|
var winner = current() ? overriding(property.name, classesOf(node)) : null;
|
|
369
|
-
var note = dom.child(field, '.ge-style-overridden');
|
|
370
|
-
note.textContent = winner ? ge.t('
|
|
369
|
+
var note = dom.child(field, '.ge-inline-style-overridden');
|
|
370
|
+
note.textContent = winner ? ge.t('inline_style.overridden', { 'class': winner }) : '';
|
|
371
371
|
dom.toggle(note, !!winner);
|
|
372
372
|
});
|
|
373
373
|
renderStyleField(field);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Flex, a part of the style plugin: a flex container's direction, wrap,
|
|
2
|
+
* Flex, a part of the inline-style plugin: a flex container's direction, wrap,
|
|
3
3
|
* alignment and gaps, and how its children grow, shrink and fill, per
|
|
4
4
|
* breakpoint, with Bootstrap's flex-{breakpoint}-*, justify-content-*,
|
|
5
5
|
* align-items-*, align-content-*, gap-* and row-/column-gap-* classes.
|
|
6
6
|
*
|
|
7
7
|
* Its families, and whatever it does on the canvas, as a function of the
|
|
8
8
|
* handle and the spacing options, whose scale the gaps share:
|
|
9
|
-
* grideditor.style.js puts them in its Flex section.
|
|
9
|
+
* grideditor.inline-style.js puts them in its Flex section.
|
|
10
10
|
*/
|
|
11
11
|
import { GridEditor } from '../grideditor.js';
|
|
12
12
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Float, a part of the style plugin: floating an element per breakpoint, with Bootstrap's
|
|
2
|
+
* Float, a part of the inline-style plugin: floating an element per breakpoint, with Bootstrap's
|
|
3
3
|
* float-{breakpoint}-start, -end and -none classes.
|
|
4
4
|
*
|
|
5
5
|
* Its families, and whatever it does on the canvas, as a function of the
|
|
6
|
-
* handle: grideditor.style.js puts them in its sections.
|
|
6
|
+
* handle: grideditor.inline-style.js puts them in its sections.
|
|
7
7
|
*/
|
|
8
8
|
import { GridEditor } from '../grideditor.js';
|
|
9
9
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The style plugin's settings, `
|
|
2
|
+
* The inline-style plugin's settings, `inline_style` in the editor's options:
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* inline_style: {
|
|
5
5
|
* sections: { border: { properties: [...], catalog: false }, position: false, … },
|
|
6
6
|
* spacing: { values, scale }, // the values offered, and what 0 to 5 come to
|
|
7
7
|
* visibility: { drawer }, // false leaves the eye out of the drawers
|
|
@@ -19,7 +19,7 @@ function resolveSections(ge, given) {
|
|
|
19
19
|
var resolved = {};
|
|
20
20
|
|
|
21
21
|
Object.keys(given || {}).forEach(function(key) {
|
|
22
|
-
if (!section(key)) { ge.warn('
|
|
22
|
+
if (!section(key)) { ge.warn('inline_style.sections: there is no "' + key + '" section: ignored'); }
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
SECTIONS.forEach(function(each) {
|
|
@@ -34,7 +34,7 @@ function resolveSections(ge, given) {
|
|
|
34
34
|
if (Array.isArray(option.properties)) {
|
|
35
35
|
option.properties.forEach(function(name) {
|
|
36
36
|
if (own.indexOf(name) === -1) {
|
|
37
|
-
ge.warn('
|
|
37
|
+
ge.warn('inline_style.sections.' + each.key + ': "' + name + '" is not one of its properties: ignored');
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
properties = option.properties.filter(function(name) { return own.indexOf(name) !== -1; })
|
|
@@ -50,7 +50,7 @@ function resolveSections(ge, given) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
export function resolveOptions(ge) {
|
|
53
|
-
var style = ge.settings.
|
|
53
|
+
var style = ge.settings.inline_style || {};
|
|
54
54
|
|
|
55
55
|
return {
|
|
56
56
|
sections: resolveSections(ge, style.sections),
|