@themarioga/grid-editor 7.2.0 → 8.0.0-beta.2
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 +101 -0
- package/README.md +96 -30
- package/UPGRADING.md +86 -0
- package/dist/grideditor.bundle.min.js +3 -3
- package/dist/grideditor.css +149 -6
- package/dist/grideditor.d.ts +18 -0
- package/dist/grideditor.esm.js +257 -48
- package/dist/grideditor.jquery.js +0 -13
- package/dist/grideditor.jquery.min.js +1 -1
- package/dist/grideditor.jquery.min.js.map +3 -3
- package/dist/grideditor.js +257 -48
- 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 +80 -6
- package/dist/locales/grideditor.es.js +80 -6
- package/dist/locales/grideditor.es.min.js +1 -1
- package/dist/locales/grideditor.es.min.js.map +2 -2
- package/dist/plugins/grideditor.accordion.min.js.map +2 -2
- package/dist/plugins/grideditor.alignment.esm.js +11 -38
- package/dist/plugins/grideditor.alignment.js +11 -38
- package/dist/plugins/grideditor.alignment.min.js +1 -1
- package/dist/plugins/grideditor.alignment.min.js.map +3 -3
- package/dist/plugins/grideditor.card.min.js.map +1 -1
- package/dist/plugins/grideditor.ckeditor.esm.js +0 -5
- package/dist/plugins/grideditor.ckeditor.js +0 -5
- package/dist/plugins/grideditor.ckeditor.min.js +1 -1
- package/dist/plugins/grideditor.ckeditor.min.js.map +3 -3
- package/dist/plugins/grideditor.clipboard.min.js.map +1 -1
- package/dist/plugins/grideditor.codemirror-inline.min.js.map +1 -1
- package/dist/plugins/grideditor.codemirror.min.js.map +1 -1
- package/dist/plugins/grideditor.elements.min.js.map +2 -2
- package/dist/plugins/grideditor.gutters.min.js.map +1 -1
- package/dist/plugins/grideditor.order.min.js.map +1 -1
- package/dist/plugins/grideditor.popup.min.js.map +1 -1
- package/dist/plugins/grideditor.sections.min.js.map +2 -2
- package/dist/plugins/grideditor.style.esm.js +1926 -0
- package/dist/plugins/grideditor.style.js +1923 -0
- package/dist/plugins/grideditor.style.min.js +4 -0
- package/dist/plugins/grideditor.style.min.js.map +7 -0
- package/dist/plugins/grideditor.summernote.min.js.map +2 -2
- package/dist/plugins/grideditor.tabs.min.js.map +2 -2
- package/dist/plugins/grideditor.tinymce.esm.js +1 -8
- package/dist/plugins/grideditor.tinymce.js +1 -8
- package/dist/plugins/grideditor.tinymce.min.js +1 -1
- package/dist/plugins/grideditor.tinymce.min.js.map +3 -3
- package/docs/events.md +4 -6
- package/docs/locale-keys.md +99 -15
- package/docs/plugins.md +47 -23
- package/example/ckeditor.html +0 -5
- package/example/index.html +17 -2
- package/example/style.html +163 -0
- package/example/utilities.html +21 -16
- package/package.json +1 -1
- package/src/js/dom.js +1 -2
- package/src/js/grideditor.jquery.js +7 -28
- package/src/js/grideditor.js +336 -67
- package/src/js/locales/grideditor.es.js +80 -6
- package/src/js/plugins/grideditor.alignment.js +21 -50
- package/src/js/plugins/grideditor.ckeditor.js +10 -23
- package/src/js/plugins/grideditor.style.js +185 -0
- package/src/js/plugins/grideditor.summernote.js +4 -5
- package/src/js/plugins/grideditor.tinymce.js +4 -17
- package/src/js/style/accordion.js +168 -0
- package/src/js/style/catalog.js +76 -0
- package/src/js/style/custom.js +84 -0
- package/src/js/style/display.js +229 -0
- package/src/js/style/drawerflow.js +118 -0
- package/src/js/style/fields.js +382 -0
- package/src/js/style/flex.js +156 -0
- package/src/js/{plugins/grideditor.float.js → style/float.js} +6 -16
- package/src/js/style/options.js +60 -0
- package/src/js/style/sections.js +298 -0
- package/src/js/{plugins/grideditor.spacing.js → style/spacing.js} +7 -19
- package/src/js/style/sticky.js +39 -0
- package/src/js/{plugins/grideditor.textalign.js → style/textalign.js} +6 -14
- package/src/js/text/grideditor.text.js +1 -1
- package/src/less/grideditor.less +151 -10
- package/types/grideditor.d.ts +18 -0
- package/dist/plugins/grideditor.float.esm.js +0 -34
- package/dist/plugins/grideditor.float.js +0 -41
- package/dist/plugins/grideditor.float.min.js +0 -1
- package/dist/plugins/grideditor.float.min.js.map +0 -7
- package/dist/plugins/grideditor.spacing.esm.js +0 -318
- package/dist/plugins/grideditor.spacing.js +0 -323
- package/dist/plugins/grideditor.spacing.min.js +0 -1
- package/dist/plugins/grideditor.spacing.min.js.map +0 -7
- package/dist/plugins/grideditor.textalign.esm.js +0 -40
- package/dist/plugins/grideditor.textalign.js +0 -47
- package/dist/plugins/grideditor.textalign.min.js +0 -1
- package/dist/plugins/grideditor.textalign.min.js.map +0 -7
- package/dist/plugins/grideditor.visibility.esm.js +0 -158
- package/dist/plugins/grideditor.visibility.js +0 -163
- package/dist/plugins/grideditor.visibility.min.js +0 -1
- package/dist/plugins/grideditor.visibility.min.js.map +0 -7
- package/src/js/plugins/grideditor.visibility.js +0 -171
|
@@ -1,323 +0,0 @@
|
|
|
1
|
-
(() => {
|
|
2
|
-
// src/js/register.js
|
|
3
|
-
var GridEditor = window.GridEditor;
|
|
4
|
-
if (!GridEditor || typeof GridEditor.get !== "function") {
|
|
5
|
-
throw new Error("grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, its locales and grideditor.jquery.js");
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// src/js/dom.js
|
|
9
|
-
function all(root, selector) {
|
|
10
|
-
return root ? Array.prototype.slice.call(root.querySelectorAll(selector)) : [];
|
|
11
|
-
}
|
|
12
|
-
function selfAndAll(root, selector) {
|
|
13
|
-
if (!root) {
|
|
14
|
-
return [];
|
|
15
|
-
}
|
|
16
|
-
var found = all(root, selector);
|
|
17
|
-
if (root.nodeType === 1 && root.matches(selector)) {
|
|
18
|
-
found.unshift(root);
|
|
19
|
-
}
|
|
20
|
-
return found;
|
|
21
|
-
}
|
|
22
|
-
function children(node, selector) {
|
|
23
|
-
if (!node) {
|
|
24
|
-
return [];
|
|
25
|
-
}
|
|
26
|
-
return Array.prototype.filter.call(node.children, function(each) {
|
|
27
|
-
return !selector || each.matches(selector);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
function child(node, selector) {
|
|
31
|
-
return children(node, selector)[0] || null;
|
|
32
|
-
}
|
|
33
|
-
function is(node, selector) {
|
|
34
|
-
return !!node && node.nodeType === 1 && node.matches(selector);
|
|
35
|
-
}
|
|
36
|
-
function element(tag, attributes, text) {
|
|
37
|
-
var node = document.createElement(tag);
|
|
38
|
-
Object.keys(attributes || {}).forEach(function(name) {
|
|
39
|
-
var value = attributes[name];
|
|
40
|
-
if (value !== null && value !== void 0 && value !== false) {
|
|
41
|
-
node.setAttribute(name, value);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
if (text !== void 0 && text !== null) {
|
|
45
|
-
node.textContent = text;
|
|
46
|
-
}
|
|
47
|
-
return node;
|
|
48
|
-
}
|
|
49
|
-
function hasClass(node, name) {
|
|
50
|
-
return !!node && node.nodeType === 1 && node.classList.contains(name);
|
|
51
|
-
}
|
|
52
|
-
function css(node, styles) {
|
|
53
|
-
Object.keys(styles).forEach(function(property) {
|
|
54
|
-
var value = styles[property];
|
|
55
|
-
if (typeof value === "number" && !UNITLESS[property]) {
|
|
56
|
-
value = value + "px";
|
|
57
|
-
}
|
|
58
|
-
node.style.setProperty(property, value === null || value === void 0 ? "" : String(value));
|
|
59
|
-
});
|
|
60
|
-
return node;
|
|
61
|
-
}
|
|
62
|
-
var UNITLESS = { opacity: true, "z-index": true, "flex-grow": true, "flex-shrink": true, order: true };
|
|
63
|
-
var defaultDisplays = {};
|
|
64
|
-
function defaultDisplay(node) {
|
|
65
|
-
var tag = node.nodeName;
|
|
66
|
-
if (!defaultDisplays[tag]) {
|
|
67
|
-
var probe = document.body.appendChild(document.createElement(tag));
|
|
68
|
-
defaultDisplays[tag] = getComputedStyle(probe).display;
|
|
69
|
-
probe.remove();
|
|
70
|
-
if (defaultDisplays[tag] === "none") {
|
|
71
|
-
defaultDisplays[tag] = "block";
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return defaultDisplays[tag];
|
|
75
|
-
}
|
|
76
|
-
function show(node) {
|
|
77
|
-
node.style.removeProperty("display");
|
|
78
|
-
if (getComputedStyle(node).display === "none") {
|
|
79
|
-
node.style.display = defaultDisplay(node);
|
|
80
|
-
}
|
|
81
|
-
return node;
|
|
82
|
-
}
|
|
83
|
-
function hide(node) {
|
|
84
|
-
node.style.display = "none";
|
|
85
|
-
return node;
|
|
86
|
-
}
|
|
87
|
-
function toggle(node, state) {
|
|
88
|
-
if (state === void 0) {
|
|
89
|
-
state = !visible(node);
|
|
90
|
-
}
|
|
91
|
-
return state ? show(node) : hide(node);
|
|
92
|
-
}
|
|
93
|
-
function visible(node) {
|
|
94
|
-
return !!(node.offsetWidth || node.offsetHeight || node.getClientRects().length);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// src/js/plugins/grideditor.spacing.js
|
|
98
|
-
Object.assign(GridEditor.locales.en, {
|
|
99
|
-
"utility.padding": "Padding",
|
|
100
|
-
"utility.margin": "Margin",
|
|
101
|
-
"utility.side_all": "All sides",
|
|
102
|
-
"utility.side_x": "Left and right",
|
|
103
|
-
"utility.side_y": "Top and bottom",
|
|
104
|
-
"utility.side_t": "Top",
|
|
105
|
-
"utility.side_b": "Bottom",
|
|
106
|
-
"utility.side_s": "Start",
|
|
107
|
-
"utility.side_e": "End",
|
|
108
|
-
"utility.spacing_gutter": "A column's side padding is its gutter: changing it changes the gutter"
|
|
109
|
-
});
|
|
110
|
-
var VALUES = ["0", "1", "2", "3", "4", "5"];
|
|
111
|
-
var SCALE = ["0", ".25rem", ".5rem", "1rem", "1.5rem", "3rem"];
|
|
112
|
-
var SIDES = ["", "x", "y", "t", "e", "b", "s"];
|
|
113
|
-
var SET = {
|
|
114
|
-
"": ["top", "right", "bottom", "left"],
|
|
115
|
-
x: ["left", "right"],
|
|
116
|
-
y: ["top", "bottom"],
|
|
117
|
-
t: ["top"],
|
|
118
|
-
e: ["right"],
|
|
119
|
-
b: ["bottom"],
|
|
120
|
-
s: ["left"]
|
|
121
|
-
};
|
|
122
|
-
var INFIXES = ["", "sm", "md", "lg", "xl", "xxl"];
|
|
123
|
-
var PROPERTIES = { p: "padding", m: "margin" };
|
|
124
|
-
function pattern(key) {
|
|
125
|
-
return new RegExp("^" + key + "[xytbse]?-(?:(?:sm|md|lg|xl|xxl)-)?(?:[0-5]|auto)$");
|
|
126
|
-
}
|
|
127
|
-
GridEditor.utilities.spacing = function(ge) {
|
|
128
|
-
var options = Object.assign({ values: VALUES, scale: SCALE }, ge.settings.utilities.spacing);
|
|
129
|
-
var patterns = { p: pattern("p"), m: pattern("m") };
|
|
130
|
-
function applies(node, kind) {
|
|
131
|
-
return kind === "row" || kind === "column" || kind === "element" || is(node, "[data-ge-container]");
|
|
132
|
-
}
|
|
133
|
-
function classes(node) {
|
|
134
|
-
return (node.getAttribute("class") || "").split(/\s+/);
|
|
135
|
-
}
|
|
136
|
-
function carries(node, key) {
|
|
137
|
-
return classes(node).some(function(name) {
|
|
138
|
-
return patterns[key].test(name);
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
function source(node, family, tier) {
|
|
142
|
-
var names = classes(node);
|
|
143
|
-
var values = family.charAt(0) === "m" ? VALUES.concat(["auto"]) : VALUES;
|
|
144
|
-
for (var i = tier; i >= 0; i--) {
|
|
145
|
-
for (var v = 0; v < values.length; v++) {
|
|
146
|
-
var name = family + (INFIXES[i] ? "-" + INFIXES[i] : "") + "-" + values[v];
|
|
147
|
-
if (names.indexOf(name) !== -1) {
|
|
148
|
-
return { tier: i, value: values[v] };
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return null;
|
|
153
|
-
}
|
|
154
|
-
function without(node, key) {
|
|
155
|
-
var original = node.getAttribute("class");
|
|
156
|
-
var style;
|
|
157
|
-
var bare = {};
|
|
158
|
-
node.setAttribute("class", classes(node).filter(function(name) {
|
|
159
|
-
return !patterns[key].test(name);
|
|
160
|
-
}).join(" "));
|
|
161
|
-
style = getComputedStyle(node);
|
|
162
|
-
["top", "right", "bottom", "left"].forEach(function(side) {
|
|
163
|
-
bare[side] = style.getPropertyValue(PROPERTIES[key] + "-" + side);
|
|
164
|
-
});
|
|
165
|
-
if (original === null) {
|
|
166
|
-
node.removeAttribute("class");
|
|
167
|
-
} else {
|
|
168
|
-
node.setAttribute("class", original);
|
|
169
|
-
}
|
|
170
|
-
return bare;
|
|
171
|
-
}
|
|
172
|
-
function sides(node, key, breakpoint) {
|
|
173
|
-
var tier = ge.breakpoints.indexOf(breakpoint);
|
|
174
|
-
var winners = {};
|
|
175
|
-
var styles = {};
|
|
176
|
-
var neutral = null;
|
|
177
|
-
SIDES.forEach(function(side, order) {
|
|
178
|
-
var found = source(node, key + side, tier);
|
|
179
|
-
if (!found) {
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
SET[side].forEach(function(set) {
|
|
183
|
-
var current = winners[set];
|
|
184
|
-
if (!current || found.tier > current.tier || found.tier === current.tier && order > current.order) {
|
|
185
|
-
winners[set] = { tier: found.tier, order, value: found.value };
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
["top", "right", "bottom", "left"].forEach(function(set) {
|
|
190
|
-
var winner = winners[set];
|
|
191
|
-
if (!winner) {
|
|
192
|
-
neutral = neutral || without(node, key);
|
|
193
|
-
styles[PROPERTIES[key] + "-" + set] = neutral[set];
|
|
194
|
-
} else {
|
|
195
|
-
styles[PROPERTIES[key] + "-" + set] = winner.value === "auto" ? "auto" : options.scale[winner.value];
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
return styles;
|
|
199
|
-
}
|
|
200
|
-
function startingSide(node, key) {
|
|
201
|
-
var names = classes(node).filter(function(name) {
|
|
202
|
-
return patterns[key].test(name);
|
|
203
|
-
});
|
|
204
|
-
var found = SIDES.filter(function(side) {
|
|
205
|
-
return names.some(function(name) {
|
|
206
|
-
return name.indexOf(key + side + "-") === 0;
|
|
207
|
-
});
|
|
208
|
-
});
|
|
209
|
-
return found.length ? found[0] : "";
|
|
210
|
-
}
|
|
211
|
-
function sideLabel(side) {
|
|
212
|
-
switch (side) {
|
|
213
|
-
case "x":
|
|
214
|
-
return ge.t("utility.side_x");
|
|
215
|
-
case "y":
|
|
216
|
-
return ge.t("utility.side_y");
|
|
217
|
-
case "t":
|
|
218
|
-
return ge.t("utility.side_t");
|
|
219
|
-
case "b":
|
|
220
|
-
return ge.t("utility.side_b");
|
|
221
|
-
case "s":
|
|
222
|
-
return ge.t("utility.side_s");
|
|
223
|
-
case "e":
|
|
224
|
-
return ge.t("utility.side_e");
|
|
225
|
-
default:
|
|
226
|
-
return ge.t("utility.side_all");
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
function group(node, key, labelText) {
|
|
230
|
-
var box = element("div", { "class": "ge-spacing-group", "data-ge-spacing": key });
|
|
231
|
-
var side = element("select", { "class": "ge-spacing-side form-select form-select-sm" });
|
|
232
|
-
box.appendChild(element("span", { "class": "ge-utility-label" }, labelText));
|
|
233
|
-
SIDES.forEach(function(value) {
|
|
234
|
-
side.appendChild(element("option", { value }, sideLabel(value)));
|
|
235
|
-
});
|
|
236
|
-
var field = ge.utilityField(node, key + startingSide(node, key));
|
|
237
|
-
side.value = field.getAttribute("data-ge-family").slice(1);
|
|
238
|
-
side.addEventListener("change", function() {
|
|
239
|
-
var next = ge.utilityField(node, key + this.value);
|
|
240
|
-
field.replaceWith(next);
|
|
241
|
-
field = next;
|
|
242
|
-
});
|
|
243
|
-
box.appendChild(side);
|
|
244
|
-
box.appendChild(field);
|
|
245
|
-
return box;
|
|
246
|
-
}
|
|
247
|
-
var NODES = ".row, .column, .ge-element, [data-ge-container]";
|
|
248
|
-
function mark(scope) {
|
|
249
|
-
selfAndAll(scope, NODES).forEach(function(node) {
|
|
250
|
-
var drawer = child(node, ".ge-tools-drawer");
|
|
251
|
-
if (!drawer || !applies(node, ge.kindOf(node))) {
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
if (carries(node, "p")) {
|
|
255
|
-
var style = getComputedStyle(node);
|
|
256
|
-
css(drawer, {
|
|
257
|
-
"margin-top": "-" + style.paddingTop,
|
|
258
|
-
"margin-left": "-" + style.paddingLeft,
|
|
259
|
-
"margin-right": "-" + style.paddingRight,
|
|
260
|
-
width: "calc(100% + " + style.paddingLeft + " + " + style.paddingRight + ")"
|
|
261
|
-
});
|
|
262
|
-
} else {
|
|
263
|
-
css(drawer, { "margin-top": "", "margin-left": "", "margin-right": "", width: "" });
|
|
264
|
-
}
|
|
265
|
-
if (hasClass(node, "column")) {
|
|
266
|
-
var padded = classes(node).some(function(name) {
|
|
267
|
-
return /^p[xse]?-/.test(name) && patterns.p.test(name);
|
|
268
|
-
});
|
|
269
|
-
all(drawer, ".ge-spacing-gutter").forEach(function(note) {
|
|
270
|
-
toggle(note, padded);
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
function families(key, labelKey) {
|
|
276
|
-
var values = key === "m" ? VALUES.concat(["auto"]) : VALUES;
|
|
277
|
-
var offered = options.values.concat(key === "m" ? ["auto"] : []);
|
|
278
|
-
return SIDES.map(function(side) {
|
|
279
|
-
return {
|
|
280
|
-
name: key + side,
|
|
281
|
-
prefix: key + side,
|
|
282
|
-
values,
|
|
283
|
-
appliesTo: ["row", "column", "text", "element", "container"],
|
|
284
|
-
labelKey,
|
|
285
|
-
panel: false,
|
|
286
|
-
choices: function() {
|
|
287
|
-
return values.filter(function(value) {
|
|
288
|
-
return offered.indexOf(value) !== -1;
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
return {
|
|
295
|
-
families: families("p", "utility.padding").concat(families("m", "utility.margin")),
|
|
296
|
-
panel: function(node, kind) {
|
|
297
|
-
if (!applies(node, kind)) {
|
|
298
|
-
return null;
|
|
299
|
-
}
|
|
300
|
-
var box = element("div", { "class": "ge-spacing" });
|
|
301
|
-
box.appendChild(group(node, "p", ge.t("utility.padding")));
|
|
302
|
-
box.appendChild(group(node, "m", ge.t("utility.margin")));
|
|
303
|
-
if (kind === "column") {
|
|
304
|
-
box.appendChild(element("small", { "class": "ge-spacing-gutter" }, ge.t("utility.spacing_gutter")));
|
|
305
|
-
}
|
|
306
|
-
return box;
|
|
307
|
-
},
|
|
308
|
-
preview: function(node, kind, breakpoint) {
|
|
309
|
-
if (!applies(node, kind)) {
|
|
310
|
-
return {};
|
|
311
|
-
}
|
|
312
|
-
var styles = {};
|
|
313
|
-
["p", "m"].forEach(function(key) {
|
|
314
|
-
if (carries(node, key)) {
|
|
315
|
-
Object.assign(styles, sides(node, key, breakpoint));
|
|
316
|
-
}
|
|
317
|
-
});
|
|
318
|
-
return styles;
|
|
319
|
-
},
|
|
320
|
-
onRefresh: mark
|
|
321
|
-
};
|
|
322
|
-
};
|
|
323
|
-
})();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(()=>{var h=window.GridEditor;if(!h||typeof h.get!="function")throw new Error("grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, its locales and grideditor.jquery.js");function w(t,n){return t?Array.prototype.slice.call(t.querySelectorAll(n)):[]}function O(t,n){if(!t)return[];var l=w(t,n);return t.nodeType===1&&t.matches(n)&&l.unshift(t),l}function G(t,n){return t?Array.prototype.filter.call(t.children,function(l){return!n||l.matches(n)}):[]}function _(t,n){return G(t,n)[0]||null}function B(t,n){return!!t&&t.nodeType===1&&t.matches(n)}function m(t,n,l){var f=document.createElement(t);return Object.keys(n||{}).forEach(function(p){var d=n[p];d!=null&&d!==!1&&f.setAttribute(p,d)}),l!=null&&(f.textContent=l),f}function j(t,n){return!!t&&t.nodeType===1&&t.classList.contains(n)}function A(t,n){return Object.keys(n).forEach(function(l){var f=n[l];typeof f=="number"&&!W[l]&&(f=f+"px"),t.style.setProperty(l,f==null?"":String(f))}),t}var W={opacity:!0,"z-index":!0,"flex-grow":!0,"flex-shrink":!0,order:!0},x={};function V(t){var n=t.nodeName;if(!x[n]){var l=document.body.appendChild(document.createElement(n));x[n]=getComputedStyle(l).display,l.remove(),x[n]==="none"&&(x[n]="block")}return x[n]}function X(t){return t.style.removeProperty("display"),getComputedStyle(t).display==="none"&&(t.style.display=V(t)),t}function z(t){return t.style.display="none",t}function R(t,n){return n===void 0&&(n=!K(t)),n?X(t):z(t)}function K(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)}Object.assign(h.locales.en,{"utility.padding":"Padding","utility.margin":"Margin","utility.side_all":"All sides","utility.side_x":"Left and right","utility.side_y":"Top and bottom","utility.side_t":"Top","utility.side_b":"Bottom","utility.side_s":"Start","utility.side_e":"End","utility.spacing_gutter":"A column's side padding is its gutter: changing it changes the gutter"});var y=["0","1","2","3","4","5"],$=["0",".25rem",".5rem","1rem","1.5rem","3rem"],b=["","x","y","t","e","b","s"],J={"":["top","right","bottom","left"],x:["left","right"],y:["top","bottom"],t:["top"],e:["right"],b:["bottom"],s:["left"]},N=["","sm","md","lg","xl","xxl"],C={p:"padding",m:"margin"};function P(t){return new RegExp("^"+t+"[xytbse]?-(?:(?:sm|md|lg|xl|xxl)-)?(?:[0-5]|auto)$")}h.utilities.spacing=function(t){var n=Object.assign({values:y,scale:$},t.settings.utilities.spacing),l={p:P("p"),m:P("m")};function f(e,r){return r==="row"||r==="column"||r==="element"||B(e,"[data-ge-container]")}function p(e){return(e.getAttribute("class")||"").split(/\s+/)}function d(e,r){return p(e).some(function(u){return l[r].test(u)})}function H(e,r,u){for(var o=p(e),a=r.charAt(0)==="m"?y.concat(["auto"]):y,i=u;i>=0;i--)for(var s=0;s<a.length;s++){var c=r+(N[i]?"-"+N[i]:"")+"-"+a[s];if(o.indexOf(c)!==-1)return{tier:i,value:a[s]}}return null}function I(e,r){var u=e.getAttribute("class"),o,a={};return e.setAttribute("class",p(e).filter(function(i){return!l[r].test(i)}).join(" ")),o=getComputedStyle(e),["top","right","bottom","left"].forEach(function(i){a[i]=o.getPropertyValue(C[r]+"-"+i)}),u===null?e.removeAttribute("class"):e.setAttribute("class",u),a}function D(e,r,u){var o=t.breakpoints.indexOf(u),a={},i={},s=null;return b.forEach(function(c,g){var v=H(e,r+c,o);v&&J[c].forEach(function(L){var E=a[L];(!E||v.tier>E.tier||v.tier===E.tier&&g>E.order)&&(a[L]={tier:v.tier,order:g,value:v.value})})}),["top","right","bottom","left"].forEach(function(c){var g=a[c];g?i[C[r]+"-"+c]=g.value==="auto"?"auto":n.scale[g.value]:(s=s||I(e,r),i[C[r]+"-"+c]=s[c])}),i}function F(e,r){var u=p(e).filter(function(a){return l[r].test(a)}),o=b.filter(function(a){return u.some(function(i){return i.indexOf(r+a+"-")===0})});return o.length?o[0]:""}function U(e){switch(e){case"x":return t.t("utility.side_x");case"y":return t.t("utility.side_y");case"t":return t.t("utility.side_t");case"b":return t.t("utility.side_b");case"s":return t.t("utility.side_s");case"e":return t.t("utility.side_e");default:return t.t("utility.side_all")}}function S(e,r,u){var o=m("div",{class:"ge-spacing-group","data-ge-spacing":r}),a=m("select",{class:"ge-spacing-side form-select form-select-sm"});o.appendChild(m("span",{class:"ge-utility-label"},u)),b.forEach(function(s){a.appendChild(m("option",{value:s},U(s)))});var i=t.utilityField(e,r+F(e,r));return a.value=i.getAttribute("data-ge-family").slice(1),a.addEventListener("change",function(){var s=t.utilityField(e,r+this.value);i.replaceWith(s),i=s}),o.appendChild(a),o.appendChild(i),o}var M=".row, .column, .ge-element, [data-ge-container]";function q(e){O(e,M).forEach(function(r){var u=_(r,".ge-tools-drawer");if(!(!u||!f(r,t.kindOf(r)))){if(d(r,"p")){var o=getComputedStyle(r);A(u,{"margin-top":"-"+o.paddingTop,"margin-left":"-"+o.paddingLeft,"margin-right":"-"+o.paddingRight,width:"calc(100% + "+o.paddingLeft+" + "+o.paddingRight+")"})}else A(u,{"margin-top":"","margin-left":"","margin-right":"",width:""});if(j(r,"column")){var a=p(r).some(function(i){return/^p[xse]?-/.test(i)&&l.p.test(i)});w(u,".ge-spacing-gutter").forEach(function(i){R(i,a)})}}})}function T(e,r){var u=e==="m"?y.concat(["auto"]):y,o=n.values.concat(e==="m"?["auto"]:[]);return b.map(function(a){return{name:e+a,prefix:e+a,values:u,appliesTo:["row","column","text","element","container"],labelKey:r,panel:!1,choices:function(){return u.filter(function(i){return o.indexOf(i)!==-1})}}})}return{families:T("p","utility.padding").concat(T("m","utility.margin")),panel:function(e,r){if(!f(e,r))return null;var u=m("div",{class:"ge-spacing"});return u.appendChild(S(e,"p",t.t("utility.padding"))),u.appendChild(S(e,"m",t.t("utility.margin"))),r==="column"&&u.appendChild(m("small",{class:"ge-spacing-gutter"},t.t("utility.spacing_gutter"))),u},preview:function(e,r,u){if(!f(e,r))return{};var o={};return["p","m"].forEach(function(a){d(e,a)&&Object.assign(o,D(e,a,u))}),o},onRefresh:q}};})();
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/js/register.js", "../../src/js/dom.js", "../../src/js/plugins/grideditor.spacing.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * What a plugin's or a locale's classic script imports in place of the\n * editor: the GridEditor the page already loaded.\n *\n * The build points `import { GridEditor } from '../grideditor.js'` here for\n * the classic scripts, so each registers on the editor the page has rather\n * than bringing its own. Loaded before the editor there is nothing to\n * register on, and saying so is better than a TypeError three calls later.\n */\nvar GridEditor = window.GridEditor;\n\nif (!GridEditor || typeof GridEditor.get !== 'function') {\n throw new Error('grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, ' +\n 'its locales and grideditor.jquery.js');\n}\n\nexport { GridEditor };\nexport default GridEditor;\n", "/**\n * The DOM, the way grid-editor uses it.\n *\n * Small helpers over the browser's own API, for the core and the shipped\n * plugins. Not a public API: a plugin of a host's own is free to write its\n * DOM code however it likes, and this file makes no promise to it.\n *\n * Stateless on purpose. The build puts a copy of this file in each plugin's\n * classic script, so anything kept here would be kept once per copy; a\n * module that needs to remember something about a node keeps its own\n * WeakMap.\n */\n\n/** Every element under `root` matching `selector`, as an array. */\nexport function all(root, selector) {\n return root ? Array.prototype.slice.call(root.querySelectorAll(selector)) : [];\n}\n\n/** The first element under `root` matching `selector`, or null. */\nexport function one(root, selector) {\n return root ? root.querySelector(selector) : null;\n}\n\n/** `root` itself when it matches, then every element under it that does. */\nexport function selfAndAll(root, selector) {\n if (!root) { return []; }\n\n var found = all(root, selector);\n if (root.nodeType === 1 && root.matches(selector)) { found.unshift(root); }\n return found;\n}\n\n/** The element children of `node`, those matching `selector` if one is given. */\nexport function children(node, selector) {\n if (!node) { return []; }\n\n return Array.prototype.filter.call(node.children, function(each) {\n return !selector || each.matches(selector);\n });\n}\n\n/** The first element child matching `selector`, or null. */\nexport function child(node, selector) {\n return children(node, selector)[0] || null;\n}\n\n/** The nearest ancestor-or-self matching `selector` below `stopAt`, or null. */\nexport function closest(node, selector, stopAt) {\n var found = node && node.nodeType === 1 ? node.closest(selector) : null;\n\n if (found && stopAt && found !== stopAt && !stopAt.contains(found)) { return null; }\n return found;\n}\n\n/** Whether `node` is an element matching `selector`. */\nexport function is(node, selector) {\n return !!node && node.nodeType === 1 && node.matches(selector);\n}\n\n/** Whether `node` is in the document. */\nexport function attached(node) {\n return !!node && document.documentElement.contains(node);\n}\n\n/** The element siblings after `node` that match `selector`. */\nexport function nextAll(node, selector) {\n var found = [];\n\n for (var next = node.nextElementSibling; next; next = next.nextElementSibling) {\n if (!selector || next.matches(selector)) { found.push(next); }\n }\n return found;\n}\n\n/** The ancestors of `node` up to, and not including, `stop`, nearest first. */\nexport function parentsUntil(node, stop) {\n var found = [];\n\n for (var parent = node.parentElement; parent && parent !== stop; parent = parent.parentElement) {\n found.push(parent);\n }\n return found;\n}\n\n/**\n * The nodes the html parses into, detached. Parsed the way innerHTML parses,\n * so a <script> in it never runs, here or once it is in the page.\n */\nexport function parse(html) {\n var template = document.createElement('template');\n template.innerHTML = html;\n return Array.prototype.slice.call(template.content.childNodes);\n}\n\n/** The one element the html is, detached. */\nexport function create(html) {\n var nodes = parse(html.trim());\n\n for (var i = 0; i < nodes.length; i++) {\n if (nodes[i].nodeType === 1) { return nodes[i]; }\n }\n return null;\n}\n\n/** An element of `tag`, with `attributes` and `text`. */\nexport function element(tag, attributes, text) {\n var node = document.createElement(tag);\n\n Object.keys(attributes || {}).forEach(function(name) {\n var value = attributes[name];\n if (value !== null && value !== undefined && value !== false) { node.setAttribute(name, value); }\n });\n if (text !== undefined && text !== null) { node.textContent = text; }\n\n return node;\n}\n\n/** Replace what `node` holds with `html`. A <script> in it does not run. */\nexport function setHtml(node, html) {\n node.innerHTML = html === undefined || html === null ? '' : String(html);\n return node;\n}\n\n/** Add one or several space separated classes. */\nexport function addClass(node, names) {\n split(names).forEach(function(name) { node.classList.add(name); });\n return node;\n}\n\nexport function removeClass(node, names) {\n split(names).forEach(function(name) { node.classList.remove(name); });\n return node;\n}\n\n/** Each class on, or off, or flipped when `on` is not given. */\nexport function toggleClass(node, names, state) {\n split(names).forEach(function(name) {\n if (state === undefined) {\n node.classList.toggle(name);\n } else {\n node.classList.toggle(name, !!state);\n }\n });\n return node;\n}\n\nexport function hasClass(node, name) {\n return !!node && node.nodeType === 1 && node.classList.contains(name);\n}\n\nfunction split(names) {\n return String(names || '').split(/\\s+/).filter(Boolean);\n}\n\n/** Take the class attribute off when there is nothing left in it. */\nexport function dropEmptyClass(node) {\n if (!node.getAttribute('class')) { node.removeAttribute('class'); }\n return node;\n}\n\n/** Take the style attribute off when there is nothing left in it. */\nexport function dropEmptyStyle(node) {\n if (!node.getAttribute('style')) { node.removeAttribute('style'); }\n return node;\n}\n\n/** Set attributes; a null or undefined value takes the attribute off. */\nexport function attr(node, attributes) {\n Object.keys(attributes).forEach(function(name) {\n var value = attributes[name];\n\n if (value === null || value === undefined) {\n node.removeAttribute(name);\n } else {\n node.setAttribute(name, value);\n }\n });\n return node;\n}\n\n/**\n * Inline styles, by css property name. A number is pixels for the properties\n * that take a length, as jQuery had it; an empty string takes one off.\n */\nexport function css(node, styles) {\n Object.keys(styles).forEach(function(property) {\n var value = styles[property];\n\n if (typeof value === 'number' && !UNITLESS[property]) { value = value + 'px'; }\n node.style.setProperty(property, value === null || value === undefined ? '' : String(value));\n });\n return node;\n}\n\nvar UNITLESS = { opacity: true, 'z-index': true, 'flex-grow': true, 'flex-shrink': true, order: true };\n\n/** What an element of this tag shows as when nothing hides it. */\nvar defaultDisplays = {};\n\nfunction defaultDisplay(node) {\n var tag = node.nodeName;\n\n if (!defaultDisplays[tag]) {\n var probe = document.body.appendChild(document.createElement(tag));\n defaultDisplays[tag] = getComputedStyle(probe).display;\n probe.remove();\n if (defaultDisplays[tag] === 'none') { defaultDisplays[tag] = 'block'; }\n }\n return defaultDisplays[tag];\n}\n\n/** Show a node: its inline display:none off, and a display of its own if a stylesheet hides it. */\nexport function show(node) {\n node.style.removeProperty('display');\n if (getComputedStyle(node).display === 'none') { node.style.display = defaultDisplay(node); }\n return node;\n}\n\nexport function hide(node) {\n node.style.display = 'none';\n return node;\n}\n\n/** Show or hide; flip when `on` is not given. */\nexport function toggle(node, state) {\n if (state === undefined) { state = !visible(node); }\n return state ? show(node) : hide(node);\n}\n\n/** Whether a node takes up room: what jQuery's :visible meant. */\nexport function visible(node) {\n return !!(node.offsetWidth || node.offsetHeight || node.getClientRects().length);\n}\n\n/** The border box's width, fractions included. */\nexport function outerWidth(node) {\n return node.getBoundingClientRect().width;\n}\n\nexport function outerHeight(node) {\n return node.getBoundingClientRect().height;\n}\n\n/** The content box's height, which is what jQuery's height() gave. */\nexport function contentHeight(node) {\n var style = getComputedStyle(node);\n return node.clientHeight - parseFloat(style.paddingTop) - parseFloat(style.paddingBottom);\n}\n\n/** Where a node is on the page, not in the window. */\nexport function offset(node) {\n var box = node.getBoundingClientRect();\n return { top: box.top + window.pageYOffset, left: box.left + window.pageXOffset };\n}\n\n/** Its index among its parent's element children, those matching `selector` if given. */\nexport function indexIn(node, selector) {\n return children(node.parentElement, selector).indexOf(node);\n}\n\n/** Put `node` right after `reference`. */\nexport function insertAfter(node, reference) {\n reference.parentNode.insertBefore(node, reference.nextSibling);\n return node;\n}\n\n/** Replace `node` with what it holds. */\nexport function unwrap(node) {\n var parent = node.parentNode;\n\n while (node.firstChild) { parent.insertBefore(node.firstChild, node); }\n node.remove();\n}\n\n/** Put `node` inside `wrapper`, where `node` was. */\nexport function wrap(node, wrapper) {\n node.parentNode.insertBefore(wrapper, node);\n wrapper.appendChild(node);\n return wrapper;\n}\n\n/**\n * Listen on `root` for `types` (space separated) on descendants that match\n * `selector`, with `this` the matched element, as jQuery's delegated\n * handlers had it. Hands back the listener, for removeEventListener; a\n * signal in `options` removes it too.\n */\nexport function delegate(root, types, selector, handler, options) {\n var listener = function(event) {\n var match = closest(event.target, selector, root);\n if (match && root.contains(match)) { return handler.call(match, event); }\n return undefined;\n };\n\n split(types).forEach(function(type) { root.addEventListener(type, listener, options); });\n return listener;\n}\n\n/** Listen for several space separated event types with one handler. */\nexport function on(target, types, handler, options) {\n split(types).forEach(function(type) { target.addEventListener(type, handler, options); });\n return handler;\n}\n\nexport function off(target, types, handler, options) {\n split(types).forEach(function(type) { target.removeEventListener(type, handler, options); });\n}\n\n/** A mouse event of `type` sent to `node`, the way a pointer would. */\nexport function fire(node, type) {\n node.dispatchEvent(new MouseEvent(type, { bubbles: type !== 'mouseenter' && type !== 'mouseleave' }));\n}\n\n/* ------------------------------------------------------------------\n * Taking a node away, visibly.\n *\n * The durations are the ones 6.x had through jQuery: 400 ms unless the\n * caller says otherwise. `done` runs once the node is out of sight, which is\n * when the caller removes it; a node that is already out of sight is done at\n * once, on the next task, as jQuery had it.\n * ------------------------------------------------------------------ */\n\nvar DEFAULT_DURATION = 400;\n\nfunction animateAway(node, frames, duration, done) {\n duration = duration === undefined ? DEFAULT_DURATION : duration;\n\n var finish = function() {\n hide(node);\n if (done) { done(); }\n };\n\n if (!visible(node) || !node.animate || duration <= 0) {\n window.setTimeout(finish, 0);\n return;\n }\n\n var animation = node.animate(frames(getComputedStyle(node)), {\n duration: duration,\n easing: 'ease-in-out',\n });\n var called = false;\n var once = function() {\n if (called) { return; }\n called = true;\n finish();\n };\n\n animation.onfinish = once;\n animation.oncancel = once;\n}\n\n/** Fold a node up to nothing, then hide it. */\nexport function slideUp(node, duration, done) {\n if (typeof duration === 'function') {\n done = duration;\n duration = undefined;\n }\n\n node.style.overflow = 'hidden';\n animateAway(node, function(style) {\n return [\n {\n height: style.height,\n paddingTop: style.paddingTop,\n paddingBottom: style.paddingBottom,\n marginTop: style.marginTop,\n marginBottom: style.marginBottom,\n },\n { height: '0px', paddingTop: '0px', paddingBottom: '0px', marginTop: '0px', marginBottom: '0px' },\n ];\n }, duration, function() {\n node.style.removeProperty('overflow');\n if (done) { done(); }\n });\n}\n\n/** Fade a node out, then hide it. */\nexport function fadeOut(node, duration, done) {\n animateAway(node, function(style) {\n return [{ opacity: style.opacity }, { opacity: 0 }];\n }, duration, done);\n}\n\n/** Fade and fold a node, in height and, with `width`, sideways too, then hide it. */\nexport function shrinkAway(node, duration, done, width) {\n node.style.overflow = 'hidden';\n animateAway(node, function(style) {\n var from = { opacity: style.opacity, height: style.height };\n var to = { opacity: 0, height: '0px' };\n\n if (width) {\n from.width = style.width;\n to.width = '0px';\n }\n return [from, to];\n }, duration, function() {\n node.style.removeProperty('overflow');\n if (done) { done(); }\n });\n}\n", "/**\n * Spacing for grid-editor.\n *\n * A utility plugin: load this file after the editor and every row, column,\n * element and container can have its padding and margin set per breakpoint,\n * with Bootstrap's p-{breakpoint}-*, pt-, px- \u2026 and m-{breakpoint}-*, mt-, mx-\n * \u2026 classes. What it can ask the editor for is the handle its factory is\n * called with, described in docs/plugins.md.\n *\n * <script src=\"dist/grideditor.min.js\"></script>\n * <script src=\"dist/plugins/grideditor.spacing.min.js\"></script>\n *\n * Fourteen families would be fourteen fields, so the panel has two, padding\n * and margin, each a choice of side and a value for that side.\n *\n * utilities.spacing.values narrows the values offered, and\n * utilities.spacing.scale is what 0 to 5 come to, for a page that changed\n * Bootstrap's $spacers.\n */\nimport { GridEditor } from '../grideditor.js';\nimport * as dom from '../dom.js';\n\nObject.assign(GridEditor.locales.en, {\n 'utility.padding': 'Padding',\n 'utility.margin': 'Margin',\n 'utility.side_all': 'All sides',\n 'utility.side_x': 'Left and right',\n 'utility.side_y': 'Top and bottom',\n 'utility.side_t': 'Top',\n 'utility.side_b': 'Bottom',\n 'utility.side_s': 'Start',\n 'utility.side_e': 'End',\n 'utility.spacing_gutter': 'A column\\'s side padding is its gutter: changing it changes the gutter',\n});\n\nvar VALUES = ['0', '1', '2', '3', '4', '5'];\n\n/** Bootstrap's $spacers. */\nvar SCALE = ['0', '.25rem', '.5rem', '1rem', '1.5rem', '3rem'];\n\n/**\n * The sides, in the order Bootstrap's css writes their rules: within one\n * breakpoint a later rule wins, so p-3 pt-1 has a top of .25rem.\n */\nvar SIDES = ['', 'x', 'y', 't', 'e', 'b', 's'];\n\n/** What each side sets. Start and end are left and right: Bootstrap's css is left to right. */\nvar SET = {\n '': ['top', 'right', 'bottom', 'left'],\n x: ['left', 'right'],\n y: ['top', 'bottom'],\n t: ['top'],\n e: ['right'],\n b: ['bottom'],\n s: ['left'],\n};\n\nvar INFIXES = ['', 'sm', 'md', 'lg', 'xl', 'xxl'];\n\nvar PROPERTIES = { p: 'padding', m: 'margin' };\n\n/** Every class of the plugin's, padding or margin. */\nfunction pattern(key) {\n return new RegExp('^' + key + '[xytbse]?-(?:(?:sm|md|lg|xl|xxl)-)?(?:[0-5]|auto)$');\n}\n\nGridEditor.utilities.spacing = function(ge) {\n\n var options = Object.assign({ values: VALUES, scale: SCALE }, ge.settings.utilities.spacing);\n var patterns = { p: pattern('p'), m: pattern('m') };\n\n function applies(node, kind) {\n return kind === 'row' || kind === 'column' || kind === 'element' ||\n dom.is(node, '[data-ge-container]');\n }\n\n function classes(node) {\n return (node.getAttribute('class') || '').split(/\\s+/);\n }\n\n function carries(node, key) {\n return classes(node).some(function(name) { return patterns[key].test(name); });\n }\n\n /**\n * The class of one family that decides a side at a breakpoint: the\n * widest breakpoint up to it that has one, as { tier, value }.\n */\n function source(node, family, tier) {\n var names = classes(node);\n var values = family.charAt(0) === 'm' ? VALUES.concat(['auto']) : VALUES;\n\n for (var i = tier; i >= 0; i--) {\n for (var v = 0; v < values.length; v++) {\n var name = family + (INFIXES[i] ? '-' + INFIXES[i] : '') + '-' + values[v];\n if (names.indexOf(name) !== -1) { return { tier: i, value: values[v] }; }\n }\n }\n\n return null;\n }\n\n /**\n * What padding or margin is on each side with none of the plugin's\n * classes: the editor's frame for a row or a column, the host's css\n * for anything else. Read by taking the classes off for a moment,\n * since that is the only way to ask the browser.\n */\n function without(node, key) {\n var original = node.getAttribute('class');\n var style;\n var bare = {};\n\n node.setAttribute('class', classes(node).filter(function(name) { return !patterns[key].test(name); }).join(' '));\n style = getComputedStyle(node);\n ['top', 'right', 'bottom', 'left'].forEach(function(side) {\n bare[side] = style.getPropertyValue(PROPERTIES[key] + '-' + side);\n });\n if (original === null) { node.removeAttribute('class'); } else { node.setAttribute('class', original); }\n\n return bare;\n }\n\n /**\n * Each side the way Bootstrap's css settles it: the class from the\n * widest breakpoint wins, and within one breakpoint the side written\n * later in the css. A side no class reaches shows what it is without\n * any, over a wider breakpoint's class that is live in a wide window.\n */\n function sides(node, key, breakpoint) {\n var tier = ge.breakpoints.indexOf(breakpoint);\n var winners = {};\n var styles = {};\n var neutral = null;\n\n SIDES.forEach(function(side, order) {\n var found = source(node, key + side, tier);\n if (!found) { return; }\n\n SET[side].forEach(function(set) {\n var current = winners[set];\n if (!current || found.tier > current.tier || (found.tier === current.tier && order > current.order)) {\n winners[set] = { tier: found.tier, order: order, value: found.value };\n }\n });\n });\n\n ['top', 'right', 'bottom', 'left'].forEach(function(set) {\n var winner = winners[set];\n\n if (!winner) {\n neutral = neutral || without(node, key);\n styles[PROPERTIES[key] + '-' + set] = neutral[set];\n } else {\n styles[PROPERTIES[key] + '-' + set] = winner.value === 'auto' ? 'auto' : options.scale[winner.value];\n }\n });\n\n return styles;\n }\n\n /** The side a group's select starts on: the first that has a class, or all. */\n function startingSide(node, key) {\n var names = classes(node).filter(function(name) { return patterns[key].test(name); });\n var found = SIDES.filter(function(side) {\n return names.some(function(name) { return name.indexOf(key + side + '-') === 0; });\n });\n\n return found.length ? found[0] : '';\n }\n\n function sideLabel(side) {\n switch (side) {\n case 'x': return ge.t('utility.side_x');\n case 'y': return ge.t('utility.side_y');\n case 't': return ge.t('utility.side_t');\n case 'b': return ge.t('utility.side_b');\n case 's': return ge.t('utility.side_s');\n case 'e': return ge.t('utility.side_e');\n default: return ge.t('utility.side_all');\n }\n }\n\n /** A padding or margin group: its name, the side, and the field of that side's family. */\n function group(node, key, labelText) {\n var box = dom.element('div', { 'class': 'ge-spacing-group', 'data-ge-spacing': key });\n var side = dom.element('select', { 'class': 'ge-spacing-side form-select form-select-sm' });\n\n box.appendChild(dom.element('span', { 'class': 'ge-utility-label' }, labelText));\n\n SIDES.forEach(function(value) {\n side.appendChild(dom.element('option', { value: value }, sideLabel(value)));\n });\n\n var field = ge.utilityField(node, key + startingSide(node, key));\n\n side.value = field.getAttribute('data-ge-family').slice(1);\n side.addEventListener('change', function() {\n var next = ge.utilityField(node, key + this.value);\n field.replaceWith(next);\n field = next;\n });\n box.appendChild(side);\n box.appendChild(field);\n\n return box;\n }\n\n var NODES = '.row, .column, .ge-element, [data-ge-container]';\n\n /**\n * Keep each drawer on its node's edges. A drawer is pulled out over the\n * editor's frame by as much as the frame pads the node, and a padding\n * class replaces the frame, so a padded node's drawer is pulled out by\n * its real padding instead. And a column padded at the sides gets a word\n * about what that does to its gutter.\n */\n function mark(scope) {\n dom.selfAndAll(scope, NODES).forEach(function(node) {\n var drawer = dom.child(node, '.ge-tools-drawer');\n\n if (!drawer || !applies(node, ge.kindOf(node))) { return; }\n\n if (carries(node, 'p')) {\n var style = getComputedStyle(node);\n\n dom.css(drawer, {\n 'margin-top': '-' + style.paddingTop,\n 'margin-left': '-' + style.paddingLeft,\n 'margin-right': '-' + style.paddingRight,\n width: 'calc(100% + ' + style.paddingLeft + ' + ' + style.paddingRight + ')',\n });\n } else {\n dom.css(drawer, { 'margin-top': '', 'margin-left': '', 'margin-right': '', width: '' });\n }\n\n if (dom.hasClass(node, 'column')) {\n var padded = classes(node).some(function(name) {\n return /^p[xse]?-/.test(name) && patterns.p.test(name);\n });\n dom.all(drawer, '.ge-spacing-gutter').forEach(function(note) { dom.toggle(note, padded); });\n }\n });\n }\n\n function families(key, labelKey) {\n var values = key === 'm' ? VALUES.concat(['auto']) : VALUES;\n var offered = options.values.concat(key === 'm' ? ['auto'] : []);\n\n return SIDES.map(function(side) {\n return {\n name: key + side,\n prefix: key + side,\n values: values,\n appliesTo: ['row', 'column', 'text', 'element', 'container'],\n labelKey: labelKey,\n panel: false,\n choices: function() {\n return values.filter(function(value) { return offered.indexOf(value) !== -1; });\n },\n };\n });\n }\n\n return {\n families: families('p', 'utility.padding').concat(families('m', 'utility.margin')),\n\n panel: function(node, kind) {\n if (!applies(node, kind)) { return null; }\n\n var box = dom.element('div', { 'class': 'ge-spacing' });\n box.appendChild(group(node, 'p', ge.t('utility.padding')));\n box.appendChild(group(node, 'm', ge.t('utility.margin')));\n\n if (kind === 'column') {\n box.appendChild(dom.element('small', { 'class': 'ge-spacing-gutter' }, ge.t('utility.spacing_gutter')));\n }\n\n return box;\n },\n\n preview: function(node, kind, breakpoint) {\n if (!applies(node, kind)) { return {}; }\n\n var styles = {};\n\n ['p', 'm'].forEach(function(key) {\n if (carries(node, key)) { Object.assign(styles, sides(node, key, breakpoint)); }\n });\n\n return styles;\n },\n\n onRefresh: mark,\n };\n};\n"],
|
|
5
|
-
"mappings": "MASA,IAAIA,EAAa,OAAO,WAExB,GAAI,CAACA,GAAc,OAAOA,EAAW,KAAQ,WACzC,MAAM,IAAI,MAAM,wHAC0B,ECCvC,SAASC,EAAIC,EAAMC,EAAU,CAChC,OAAO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YF,EAAM7B,EAAM,IAAKJ,EAAG,EAAE,gBAAgB,CAAC,CAAC,EAEpDK,IAAS,UACT8B,EAAI,YAAgBC,EAAQ,QAAS,CAAE,MAAS,mBAAoB,EAAGpC,EAAG,EAAE,wBAAwB,CAAC,CAAC,EAGnGmC,CACX,EAEA,QAAS,SAAS/B,EAAMC,EAAMiB,EAAY,CACtC,GAAI,CAACnB,EAAQC,EAAMC,CAAI,EAAK,MAAO,CAAC,EAEpC,IAAImB,EAAS,CAAC,EAEd,OAAC,IAAK,GAAG,EAAE,QAAQ,SAASzB,EAAK,CACzBS,EAAQJ,EAAML,CAAG,GAAK,OAAO,OAAOyB,EAAQH,EAAMjB,EAAML,EAAKuB,CAAU,CAAC,CAChF,CAAC,EAEME,CACX,EAEA,UAAWiB,CACf,CACJ",
|
|
6
|
-
"names": ["GridEditor", "all", "root", "selector", "selfAndAll", "root", "selector", "found", "all", "children", "node", "each", "child", "is", "node", "selector", "element", "tag", "attributes", "text", "node", "name", "value", "hasClass", "node", "name", "css", "node", "styles", "property", "value", "UNITLESS", "defaultDisplays", "defaultDisplay", "tag", "probe", "show", "hide", "toggle", "state", "visible", "GridEditor", "VALUES", "SCALE", "SIDES", "SET", "INFIXES", "PROPERTIES", "pattern", "key", "ge", "options", "patterns", "applies", "node", "kind", "is", "classes", "carries", "name", "source", "family", "tier", "names", "values", "v", "without", "original", "style", "bare", "side", "sides", "breakpoint", "winners", "styles", "neutral", "order", "found", "set", "current", "winner", "startingSide", "sideLabel", "group", "labelText", "box", "element", "value", "field", "next", "NODES", "mark", "scope", "selfAndAll", "drawer", "child", "css", "hasClass", "padded", "all", "note", "toggle", "families", "labelKey", "offered"]
|
|
7
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// src/js/plugins/grideditor.textalign.js
|
|
2
|
-
import { GridEditor } from "../grideditor.esm.js";
|
|
3
|
-
Object.assign(GridEditor.locales.en, {
|
|
4
|
-
"utility.text_align": "Text alignment",
|
|
5
|
-
"utility.text_start": "Start",
|
|
6
|
-
"utility.text_center": "Center",
|
|
7
|
-
"utility.text_end": "End"
|
|
8
|
-
});
|
|
9
|
-
var CSS = { start: "left", center: "center", end: "right" };
|
|
10
|
-
GridEditor.utilities.textalign = function(ge) {
|
|
11
|
-
function label(value) {
|
|
12
|
-
if (value === "start") {
|
|
13
|
-
return ge.t("utility.text_start");
|
|
14
|
-
}
|
|
15
|
-
if (value === "center") {
|
|
16
|
-
return ge.t("utility.text_center");
|
|
17
|
-
}
|
|
18
|
-
return ge.t("utility.text_end");
|
|
19
|
-
}
|
|
20
|
-
return {
|
|
21
|
-
families: [{
|
|
22
|
-
name: "text-align",
|
|
23
|
-
prefix: "text",
|
|
24
|
-
values: ["start", "center", "end"],
|
|
25
|
-
appliesTo: ["row", "column", "text", "element", "container"],
|
|
26
|
-
labelKey: "utility.text_align",
|
|
27
|
-
label,
|
|
28
|
-
/**
|
|
29
|
-
* With no class applying here, the node aligns as its parent
|
|
30
|
-
* does - or as the host's css says - which only the browser can
|
|
31
|
-
* tell, so it is asked with the classes out of the way. Parents
|
|
32
|
-
* are previewed before their children, so the parent's answer is
|
|
33
|
-
* already the view's.
|
|
34
|
-
*/
|
|
35
|
-
preview: function(value, node) {
|
|
36
|
-
return { "text-align": value === null ? ge.bareStyle(node, "text-align", "text-align") : CSS[value] };
|
|
37
|
-
}
|
|
38
|
-
}]
|
|
39
|
-
};
|
|
40
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
(() => {
|
|
2
|
-
// src/js/register.js
|
|
3
|
-
var GridEditor = window.GridEditor;
|
|
4
|
-
if (!GridEditor || typeof GridEditor.get !== "function") {
|
|
5
|
-
throw new Error("grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, its locales and grideditor.jquery.js");
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// src/js/plugins/grideditor.textalign.js
|
|
9
|
-
Object.assign(GridEditor.locales.en, {
|
|
10
|
-
"utility.text_align": "Text alignment",
|
|
11
|
-
"utility.text_start": "Start",
|
|
12
|
-
"utility.text_center": "Center",
|
|
13
|
-
"utility.text_end": "End"
|
|
14
|
-
});
|
|
15
|
-
var CSS = { start: "left", center: "center", end: "right" };
|
|
16
|
-
GridEditor.utilities.textalign = function(ge) {
|
|
17
|
-
function label(value) {
|
|
18
|
-
if (value === "start") {
|
|
19
|
-
return ge.t("utility.text_start");
|
|
20
|
-
}
|
|
21
|
-
if (value === "center") {
|
|
22
|
-
return ge.t("utility.text_center");
|
|
23
|
-
}
|
|
24
|
-
return ge.t("utility.text_end");
|
|
25
|
-
}
|
|
26
|
-
return {
|
|
27
|
-
families: [{
|
|
28
|
-
name: "text-align",
|
|
29
|
-
prefix: "text",
|
|
30
|
-
values: ["start", "center", "end"],
|
|
31
|
-
appliesTo: ["row", "column", "text", "element", "container"],
|
|
32
|
-
labelKey: "utility.text_align",
|
|
33
|
-
label,
|
|
34
|
-
/**
|
|
35
|
-
* With no class applying here, the node aligns as its parent
|
|
36
|
-
* does - or as the host's css says - which only the browser can
|
|
37
|
-
* tell, so it is asked with the classes out of the way. Parents
|
|
38
|
-
* are previewed before their children, so the parent's answer is
|
|
39
|
-
* already the view's.
|
|
40
|
-
*/
|
|
41
|
-
preview: function(value, node) {
|
|
42
|
-
return { "text-align": value === null ? ge.bareStyle(node, "text-align", "text-align") : CSS[value] };
|
|
43
|
-
}
|
|
44
|
-
}]
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
})();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(()=>{var e=window.GridEditor;if(!e||typeof e.get!="function")throw new Error("grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, its locales and grideditor.jquery.js");Object.assign(e.locales.en,{"utility.text_align":"Text alignment","utility.text_start":"Start","utility.text_center":"Center","utility.text_end":"End"});var l={start:"left",center:"center",end:"right"};e.utilities.textalign=function(i){function r(t){return t==="start"?i.t("utility.text_start"):t==="center"?i.t("utility.text_center"):i.t("utility.text_end")}return{families:[{name:"text-align",prefix:"text",values:["start","center","end"],appliesTo:["row","column","text","element","container"],labelKey:"utility.text_align",label:r,preview:function(t,n){return{"text-align":t===null?i.bareStyle(n,"text-align","text-align"):l[t]}}}]}};})();
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/js/register.js", "../../src/js/plugins/grideditor.textalign.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * What a plugin's or a locale's classic script imports in place of the\n * editor: the GridEditor the page already loaded.\n *\n * The build points `import { GridEditor } from '../grideditor.js'` here for\n * the classic scripts, so each registers on the editor the page has rather\n * than bringing its own. Loaded before the editor there is nothing to\n * register on, and saying so is better than a TypeError three calls later.\n */\nvar GridEditor = window.GridEditor;\n\nif (!GridEditor || typeof GridEditor.get !== 'function') {\n throw new Error('grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, ' +\n 'its locales and grideditor.jquery.js');\n}\n\nexport { GridEditor };\nexport default GridEditor;\n", "/**\n * Text alignment for grid-editor.\n *\n * A utility plugin: load this file after the editor and a row, column,\n * element or container can align its text per breakpoint, with Bootstrap's\n * text-{breakpoint}-start, -center and -end classes. What it can ask the\n * editor for is the handle its factory is called with, described in\n * docs/plugins.md.\n *\n * <script src=\"dist/grideditor.min.js\"></script>\n * <script src=\"dist/plugins/grideditor.textalign.min.js\"></script>\n *\n * The class aligns everything inside the node that does not align itself: a\n * paragraph the rich text editor gave its own text-align keeps it.\n */\nimport { GridEditor } from '../grideditor.js';\n\nObject.assign(GridEditor.locales.en, {\n 'utility.text_align': 'Text alignment',\n 'utility.text_start': 'Start',\n 'utility.text_center': 'Center',\n 'utility.text_end': 'End',\n});\n\n/** Start and end are left and right: Bootstrap's css is left to right. */\nvar CSS = { start: 'left', center: 'center', end: 'right' };\n\nGridEditor.utilities.textalign = function(ge) {\n\n function label(value) {\n if (value === 'start') { return ge.t('utility.text_start'); }\n if (value === 'center') { return ge.t('utility.text_center'); }\n\n return ge.t('utility.text_end');\n }\n\n return {\n families: [{\n name: 'text-align',\n prefix: 'text',\n values: ['start', 'center', 'end'],\n appliesTo: ['row', 'column', 'text', 'element', 'container'],\n labelKey: 'utility.text_align',\n label: label,\n\n /**\n * With no class applying here, the node aligns as its parent\n * does - or as the host's css says - which only the browser can\n * tell, so it is asked with the classes out of the way. Parents\n * are previewed before their children, so the parent's answer is\n * already the view's.\n */\n preview: function(value, node) {\n return { 'text-align': value === null ? ge.bareStyle(node, 'text-align', 'text-align') : CSS[value] };\n },\n }],\n };\n};\n"],
|
|
5
|
-
"mappings": "MASA,IAAIA,EAAa,OAAO,WAExB,GAAI,CAACA,GAAc,OAAOA,EAAW,KAAQ,WACzC,MAAM,IAAI,MAAM,wHAC0B,ECI9C,OAAO,OAAOC,EAAW,QAAQ,GAAI,CACjC,qBAAsB,iBACtB,qBAAsB,QACtB,sBAAuB,SACvB,mBAAoB,KACxB,CAAC,EAGD,IAAIC,EAAM,CAAE,MAAO,OAAQ,OAAQ,SAAU,IAAK,OAAQ,EAE1DD,EAAW,UAAU,UAAY,SAASE,EAAI,CAE1C,SAASC,EAAMC,EAAO,CAClB,OAAIA,IAAU,QAAkBF,EAAG,EAAE,oBAAoB,EACrDE,IAAU,SAAmBF,EAAG,EAAE,qBAAqB,EAEpDA,EAAG,EAAE,kBAAkB,CAClC,CAEA,MAAO,CACH,SAAU,CAAC,CACP,KAAM,aACN,OAAQ,OACR,OAAQ,CAAC,QAAS,SAAU,KAAK,EACjC,UAAW,CAAC,MAAO,SAAU,OAAQ,UAAW,WAAW,EAC3D,SAAU,qBACV,MAAOC,EASP,QAAS,SAASC,EAAOC,EAAM,CAC3B,MAAO,CAAE,aAAcD,IAAU,KAAOF,EAAG,UAAUG,EAAM,aAAc,YAAY,EAAIJ,EAAIG,CAAK,CAAE,CACxG,CACJ,CAAC,CACL,CACJ",
|
|
6
|
-
"names": ["GridEditor", "GridEditor", "CSS", "ge", "label", "value", "node"]
|
|
7
|
-
}
|