@themarioga/grid-editor 8.0.0-beta.3 → 8.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 +40 -0
- package/README.md +17 -11
- package/UPGRADING.md +21 -11
- package/dist/grideditor.bundle.min.js +3 -3
- package/dist/grideditor.css +52 -35
- package/dist/grideditor.d.ts +12 -9
- package/dist/grideditor.esm.js +44 -25
- package/dist/grideditor.js +44 -25
- 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 +70 -68
- package/dist/locales/grideditor.es.js +70 -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} +193 -184
- package/dist/plugins/{grideditor.style.js → grideditor.inline-style.js} +191 -182
- package/dist/plugins/grideditor.inline-style.min.js +4 -0
- package/dist/plugins/grideditor.inline-style.min.js.map +7 -0
- package/docs/locale-keys.md +82 -80
- package/docs/plugins.md +5 -5
- 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 +39 -22
- 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 +35 -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 +70 -68
- package/src/js/plugins/grideditor.alignment.js +1 -1
- package/src/js/plugins/grideditor.inline-style.js +186 -0
- package/src/less/grideditor.less +43 -25
- package/types/grideditor.d.ts +12 -9
- 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
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Style for grid-editor.
|
|
3
|
-
*
|
|
4
|
-
* A utility plugin: load this file after the editor and every row, column,
|
|
5
|
-
* container, pane, element and section gets a Style accordion in its
|
|
6
|
-
* settings panel - size, spacing, border, background, text, typography,
|
|
7
|
-
* display, flex, position and free css - written to the node's own style
|
|
8
|
-
* attribute, with Bootstrap's classes for each section as chips that put
|
|
9
|
-
* them in the classes field. What it can ask the editor for is the handle
|
|
10
|
-
* its factory is called with, described in docs/plugins.md.
|
|
11
|
-
*
|
|
12
|
-
* <script src="dist/grideditor.min.js"></script>
|
|
13
|
-
* <script src="dist/plugins/grideditor.style.min.js"></script>
|
|
14
|
-
*
|
|
15
|
-
* It also edits spacing, text alignment, display, flex, sticky and float,
|
|
16
|
-
* Bootstrap's responsive classes, per breakpoint in its sections. On a node
|
|
17
|
-
* that is flex or grid, the drawer leaves the flow, so the canvas lays the
|
|
18
|
-
* content out as the page will.
|
|
19
|
-
*
|
|
20
|
-
* Where the settings panel has no room for it - a popover, inline in the
|
|
21
|
-
* drawer - the accordion opens in a dialog, from a Style button.
|
|
22
|
-
*
|
|
23
|
-
* style.sections chooses the sections, and in each the properties and
|
|
24
|
-
* whether it has a catalog; style.spacing is the options of spacing, whose
|
|
25
|
-
* scale the gaps share, and style.visibility those of the eye.
|
|
26
|
-
*/
|
|
27
|
-
import { GridEditor } from '../grideditor.js';
|
|
28
|
-
import { spacingPart } from '../style/spacing.js';
|
|
29
|
-
import { textalignPart } from '../style/textalign.js';
|
|
30
|
-
import { displayPart } from '../style/display.js';
|
|
31
|
-
import { flexPart } from '../style/flex.js';
|
|
32
|
-
import { floatPart } from '../style/float.js';
|
|
33
|
-
import { stickyPart } from '../style/sticky.js';
|
|
34
|
-
import { drawerflowPart } from '../style/drawerflow.js';
|
|
35
|
-
import { resolveOptions } from '../style/options.js';
|
|
36
|
-
import { createAccordion } from '../style/accordion.js';
|
|
37
|
-
|
|
38
|
-
Object.assign(GridEditor.locales.en, {
|
|
39
|
-
'style.section_title': 'Style',
|
|
40
|
-
'style.dialog_title': 'Style: {kind}',
|
|
41
|
-
'style.section_size': 'Size',
|
|
42
|
-
'style.section_spacing': 'Spacing',
|
|
43
|
-
'style.section_border': 'Border',
|
|
44
|
-
'style.section_background': 'Background',
|
|
45
|
-
'style.section_text': 'Text',
|
|
46
|
-
'style.section_typography': 'Typography',
|
|
47
|
-
'style.section_display': 'Display',
|
|
48
|
-
'style.section_flex': 'Flex',
|
|
49
|
-
'style.section_position': 'Position',
|
|
50
|
-
'style.section_custom': 'Custom css',
|
|
51
|
-
'style.all_sizes': 'Applies to every size',
|
|
52
|
-
'style.overridden': 'The class {class} takes priority over this value',
|
|
53
|
-
'style.invalid': 'Not a value this property takes',
|
|
54
|
-
'style.catalog': 'Bootstrap classes',
|
|
55
|
-
'style.shadow_x': 'X',
|
|
56
|
-
'style.shadow_y': 'Y',
|
|
57
|
-
'style.shadow_blur': 'Blur',
|
|
58
|
-
'style.shadow_spread': 'Spread',
|
|
59
|
-
'style.shadow_color': 'Color',
|
|
60
|
-
'style.shadow_inset': 'Inset',
|
|
61
|
-
'style.shadow_text_mode': 'Edit as text',
|
|
62
|
-
'style.prop_width': 'Width',
|
|
63
|
-
'style.prop_height': 'Height',
|
|
64
|
-
'style.prop_min_width': 'Min width',
|
|
65
|
-
'style.prop_min_height': 'Min height',
|
|
66
|
-
'style.prop_max_width': 'Max width',
|
|
67
|
-
'style.prop_max_height': 'Max height',
|
|
68
|
-
'style.prop_margin_top': 'Margin top',
|
|
69
|
-
'style.prop_margin_right': 'Margin right',
|
|
70
|
-
'style.prop_margin_bottom': 'Margin bottom',
|
|
71
|
-
'style.prop_margin_left': 'Margin left',
|
|
72
|
-
'style.prop_padding_top': 'Padding top',
|
|
73
|
-
'style.prop_padding_right': 'Padding right',
|
|
74
|
-
'style.prop_padding_bottom': 'Padding bottom',
|
|
75
|
-
'style.prop_padding_left': 'Padding left',
|
|
76
|
-
'style.prop_border_width': 'Border width',
|
|
77
|
-
'style.prop_border_style': 'Border style',
|
|
78
|
-
'style.prop_border_color': 'Border color',
|
|
79
|
-
'style.prop_border_radius': 'Border radius',
|
|
80
|
-
'style.prop_box_shadow': 'Shadow',
|
|
81
|
-
'style.prop_background_color': 'Background color',
|
|
82
|
-
'style.prop_background_image': 'Background image',
|
|
83
|
-
'style.prop_background_size': 'Background size',
|
|
84
|
-
'style.prop_background_position': 'Background position',
|
|
85
|
-
'style.prop_background_repeat': 'Background repeat',
|
|
86
|
-
'style.prop_color': 'Color',
|
|
87
|
-
'style.prop_font_size': 'Font size',
|
|
88
|
-
'style.prop_text_align': 'Text align',
|
|
89
|
-
'style.prop_text_shadow': 'Text shadow',
|
|
90
|
-
'style.prop_font_family': 'Font family',
|
|
91
|
-
'style.prop_font_weight': 'Font weight',
|
|
92
|
-
'style.prop_font_style': 'Font style',
|
|
93
|
-
'style.prop_line_height': 'Line height',
|
|
94
|
-
'style.prop_letter_spacing': 'Letter spacing',
|
|
95
|
-
'style.prop_text_transform': 'Text transform',
|
|
96
|
-
'style.prop_text_decoration': 'Text decoration',
|
|
97
|
-
'style.prop_display': 'Display',
|
|
98
|
-
'style.prop_opacity': 'Opacity',
|
|
99
|
-
'style.prop_overflow': 'Overflow',
|
|
100
|
-
'style.prop_visibility': 'Visibility',
|
|
101
|
-
'style.prop_position': 'Position',
|
|
102
|
-
'style.prop_top': 'Top',
|
|
103
|
-
'style.prop_right': 'Right',
|
|
104
|
-
'style.prop_bottom': 'Bottom',
|
|
105
|
-
'style.prop_left': 'Left',
|
|
106
|
-
'style.prop_z_index': 'Z-index',
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
// The drawer's part last: it asks the browser how the others left the node
|
|
110
|
-
var PARTS = ['spacing', 'textalign', 'display', 'flex', 'float', 'sticky', 'drawerflow'];
|
|
111
|
-
|
|
112
|
-
GridEditor.utilities.style = function(ge) {
|
|
113
|
-
|
|
114
|
-
var options = resolveOptions(ge);
|
|
115
|
-
var parts = {
|
|
116
|
-
spacing: spacingPart(ge, options.spacing),
|
|
117
|
-
textalign: textalignPart(ge),
|
|
118
|
-
display: displayPart(ge, options.visibility),
|
|
119
|
-
flex: flexPart(ge, options.spacing),
|
|
120
|
-
float: floatPart(ge),
|
|
121
|
-
sticky: stickyPart(ge),
|
|
122
|
-
drawerflow: drawerflowPart(ge),
|
|
123
|
-
};
|
|
124
|
-
var accordions = []; // { node, accordion } for every panel built since the last init
|
|
125
|
-
var context = {
|
|
126
|
-
sections: options.sections,
|
|
127
|
-
parts: parts,
|
|
128
|
-
state: { open: null },
|
|
129
|
-
opened: function(key) {
|
|
130
|
-
accordions.forEach(function(entry) { entry.accordion.open(key); });
|
|
131
|
-
},
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
/** Every part's hook, called in turn. */
|
|
135
|
-
function each(hook) {
|
|
136
|
-
return function() {
|
|
137
|
-
var args = arguments;
|
|
138
|
-
PARTS.forEach(function(name) {
|
|
139
|
-
if (parts[name][hook]) { parts[name][hook].apply(null, args); }
|
|
140
|
-
});
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
var partsRefresh = each('onRefresh');
|
|
145
|
-
|
|
146
|
-
return {
|
|
147
|
-
// The parts' families, edited in the sections rather than in Responsive
|
|
148
|
-
families: PARTS.reduce(function(all, name) {
|
|
149
|
-
return all.concat(parts[name].families.map(function(family) {
|
|
150
|
-
return Object.assign({}, family, { panel: false });
|
|
151
|
-
}));
|
|
152
|
-
}, []),
|
|
153
|
-
|
|
154
|
-
panelSection: function(node, kind) {
|
|
155
|
-
var accordion = createAccordion(ge, node, kind, context);
|
|
156
|
-
if (!accordion) { return null; }
|
|
157
|
-
|
|
158
|
-
accordions.push({ node: node, accordion: accordion });
|
|
159
|
-
|
|
160
|
-
return { labelKey: 'style.section_title', titleKey: 'style.dialog_title', body: accordion.element };
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
preview: function(node, kind, breakpoint) {
|
|
164
|
-
return parts.spacing.preview(node, kind, breakpoint);
|
|
165
|
-
},
|
|
166
|
-
|
|
167
|
-
// After a write, a change of classes or of view: the accordions of
|
|
168
|
-
// the nodes it touched follow
|
|
169
|
-
onRefresh: function(scope) {
|
|
170
|
-
partsRefresh(scope);
|
|
171
|
-
|
|
172
|
-
accordions = accordions.filter(function(entry) { return entry.accordion.element.isConnected; });
|
|
173
|
-
accordions.forEach(function(entry) {
|
|
174
|
-
if (entry.node === scope || scope.contains(entry.node)) { entry.accordion.render(); }
|
|
175
|
-
});
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
drawerTools: each('drawerTools'),
|
|
179
|
-
|
|
180
|
-
onDeinit: function() {
|
|
181
|
-
each('onDeinit')();
|
|
182
|
-
accordions = [];
|
|
183
|
-
},
|
|
184
|
-
};
|
|
185
|
-
};
|