@themarioga/grid-editor 3.2.1 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/BUILDING.md +12 -3
  2. package/CHANGELOG.md +87 -0
  3. package/README.md +79 -7
  4. package/UPGRADING.md +79 -0
  5. package/dist/grideditor.css +188 -20
  6. package/dist/grideditor.min.css +1 -1
  7. package/dist/grideditor.min.css.map +1 -1
  8. package/dist/jquery.grideditor.bundle.min.js +10 -0
  9. package/dist/jquery.grideditor.js +924 -174
  10. package/dist/jquery.grideditor.min.js +1 -1
  11. package/dist/jquery.grideditor.min.js.map +1 -1
  12. package/dist/locales/grideditor.es.js +34 -0
  13. package/dist/locales/grideditor.es.min.js +1 -1
  14. package/dist/locales/grideditor.es.min.js.map +1 -1
  15. package/dist/plugins/grideditor.accordion.js +8 -0
  16. package/dist/plugins/grideditor.accordion.min.js +1 -1
  17. package/dist/plugins/grideditor.accordion.min.js.map +1 -1
  18. package/dist/plugins/grideditor.alignment.js +81 -0
  19. package/dist/plugins/grideditor.alignment.min.js +2 -0
  20. package/dist/plugins/grideditor.alignment.min.js.map +1 -0
  21. package/dist/plugins/grideditor.elements.js +5 -5
  22. package/dist/plugins/grideditor.elements.min.js +1 -1
  23. package/dist/plugins/grideditor.elements.min.js.map +1 -1
  24. package/dist/plugins/grideditor.gutters.js +145 -0
  25. package/dist/plugins/grideditor.gutters.min.js +2 -0
  26. package/dist/plugins/grideditor.gutters.min.js.map +1 -0
  27. package/dist/plugins/grideditor.order.js +206 -0
  28. package/dist/plugins/grideditor.order.min.js +2 -0
  29. package/dist/plugins/grideditor.order.min.js.map +1 -0
  30. package/dist/plugins/grideditor.spacing.js +299 -0
  31. package/dist/plugins/grideditor.spacing.min.js +2 -0
  32. package/dist/plugins/grideditor.spacing.min.js.map +1 -0
  33. package/dist/plugins/grideditor.tabs.js +8 -0
  34. package/dist/plugins/grideditor.tabs.min.js +1 -1
  35. package/dist/plugins/grideditor.tabs.min.js.map +1 -1
  36. package/dist/plugins/grideditor.visibility.js +172 -0
  37. package/dist/plugins/grideditor.visibility.min.js +2 -0
  38. package/dist/plugins/grideditor.visibility.min.js.map +1 -0
  39. package/docs/events.md +26 -8
  40. package/docs/locale-keys.md +54 -0
  41. package/docs/plugins.md +129 -10
  42. package/example/autosave.html +6 -1
  43. package/example/basic.html +8 -2
  44. package/example/breakpoints.html +6 -1
  45. package/example/ckeditor.html +6 -1
  46. package/example/containers.html +5 -1
  47. package/example/elements.html +6 -1
  48. package/example/index.html +24 -1
  49. package/example/locale.html +6 -1
  50. package/example/plugins.html +6 -1
  51. package/example/summernote.html +6 -1
  52. package/example/utilities.html +145 -0
  53. package/example/wrap_content.html +6 -1
  54. package/package.json +3 -2
  55. package/src/js/jquery.grideditor.js +924 -174
  56. package/src/js/locales/grideditor.es.js +34 -0
  57. package/src/js/plugins/grideditor.accordion.js +8 -0
  58. package/src/js/plugins/grideditor.alignment.js +81 -0
  59. package/src/js/plugins/grideditor.elements.js +5 -5
  60. package/src/js/plugins/grideditor.gutters.js +145 -0
  61. package/src/js/plugins/grideditor.order.js +206 -0
  62. package/src/js/plugins/grideditor.spacing.js +299 -0
  63. package/src/js/plugins/grideditor.tabs.js +8 -0
  64. package/src/js/plugins/grideditor.visibility.js +172 -0
  65. package/src/less/grideditor.less +210 -18
@@ -0,0 +1,299 @@
1
+ /**
2
+ * Spacing for grid-editor.
3
+ *
4
+ * A utility plugin: load this file after the editor and every row, column,
5
+ * element and container can have its padding and margin set per breakpoint,
6
+ * with Bootstrap's p-{breakpoint}-*, pt-, px- … and m-{breakpoint}-*, mt-, mx-
7
+ * … classes. What it can ask the editor for is the handle its factory is
8
+ * called with, described in docs/plugins.md.
9
+ *
10
+ * <script src="dist/jquery.grideditor.min.js"></script>
11
+ * <script src="dist/plugins/grideditor.spacing.min.js"></script>
12
+ *
13
+ * Fourteen families would be fourteen fields, so the panel has two, padding
14
+ * and margin, each a choice of side and a value for that side.
15
+ *
16
+ * utilities.spacing.values narrows the values offered, and
17
+ * utilities.spacing.scale is what 0 to 5 come to, for a page that changed
18
+ * Bootstrap's $spacers.
19
+ */
20
+ (function($) {
21
+
22
+ $.extend($.fn.gridEditor.locales.en, {
23
+ 'utility.padding': 'Padding',
24
+ 'utility.margin': 'Margin',
25
+ 'utility.side_all': 'All sides',
26
+ 'utility.side_x': 'Left and right',
27
+ 'utility.side_y': 'Top and bottom',
28
+ 'utility.side_t': 'Top',
29
+ 'utility.side_b': 'Bottom',
30
+ 'utility.side_s': 'Start',
31
+ 'utility.side_e': 'End',
32
+ 'utility.spacing_gutter': 'A column\'s side padding is its gutter: changing it changes the gutter',
33
+ });
34
+
35
+ var VALUES = ['0', '1', '2', '3', '4', '5'];
36
+
37
+ /** Bootstrap's $spacers. */
38
+ var SCALE = ['0', '.25rem', '.5rem', '1rem', '1.5rem', '3rem'];
39
+
40
+ /**
41
+ * The sides, in the order Bootstrap's css writes their rules: within one
42
+ * breakpoint a later rule wins, so p-3 pt-1 has a top of .25rem.
43
+ */
44
+ var SIDES = ['', 'x', 'y', 't', 'e', 'b', 's'];
45
+
46
+ /** What each side sets. Start and end are left and right: Bootstrap's css is left to right. */
47
+ var SET = {
48
+ '': ['top', 'right', 'bottom', 'left'],
49
+ x: ['left', 'right'],
50
+ y: ['top', 'bottom'],
51
+ t: ['top'],
52
+ e: ['right'],
53
+ b: ['bottom'],
54
+ s: ['left'],
55
+ };
56
+
57
+ var INFIXES = ['', 'sm', 'md', 'lg', 'xl', 'xxl'];
58
+
59
+ var PROPERTIES = { p: 'padding', m: 'margin' };
60
+
61
+ /** Every class of the plugin's, padding or margin. */
62
+ function pattern(key) {
63
+ return new RegExp('^' + key + '[xytbse]?-(?:(?:sm|md|lg|xl|xxl)-)?(?:[0-5]|auto)$');
64
+ }
65
+
66
+ $.fn.gridEditor.utilities.spacing = function(ge) {
67
+
68
+ var options = $.extend({ values: VALUES, scale: SCALE }, ge.settings.utilities.spacing);
69
+ var patterns = { p: pattern('p'), m: pattern('m') };
70
+
71
+ function applies(node, kind) {
72
+ return kind === 'row' || kind === 'column' || kind === 'element' ||
73
+ node.is('[data-ge-container]');
74
+ }
75
+
76
+ function classes(node) {
77
+ return (node.attr('class') || '').split(/\s+/);
78
+ }
79
+
80
+ function carries(node, key) {
81
+ return classes(node).some(function(name) { return patterns[key].test(name); });
82
+ }
83
+
84
+ /**
85
+ * The class of one family that decides a side at a breakpoint: the
86
+ * widest breakpoint up to it that has one, as { tier, value }.
87
+ */
88
+ function source(node, family, tier) {
89
+ var names = classes(node);
90
+ var values = family.charAt(0) === 'm' ? VALUES.concat(['auto']) : VALUES;
91
+
92
+ for (var i = tier; i >= 0; i--) {
93
+ for (var v = 0; v < values.length; v++) {
94
+ var name = family + (INFIXES[i] ? '-' + INFIXES[i] : '') + '-' + values[v];
95
+ if (names.indexOf(name) !== -1) { return { tier: i, value: values[v] }; }
96
+ }
97
+ }
98
+
99
+ return null;
100
+ }
101
+
102
+ /**
103
+ * What padding or margin is on each side with none of the plugin's
104
+ * classes: the editor's frame for a row or a column, the host's css
105
+ * for anything else. Read by taking the classes off for a moment,
106
+ * since that is the only way to ask the browser.
107
+ */
108
+ function without(node, key) {
109
+ var original = node.attr('class');
110
+ var style;
111
+ var bare = {};
112
+
113
+ node.attr('class', classes(node).filter(function(name) { return !patterns[key].test(name); }).join(' '));
114
+ style = getComputedStyle(node[0]);
115
+ ['top', 'right', 'bottom', 'left'].forEach(function(side) {
116
+ bare[side] = style.getPropertyValue(PROPERTIES[key] + '-' + side);
117
+ });
118
+ node.attr('class', original);
119
+
120
+ return bare;
121
+ }
122
+
123
+ /**
124
+ * Each side the way Bootstrap's css settles it: the class from the
125
+ * widest breakpoint wins, and within one breakpoint the side written
126
+ * later in the css. A side no class reaches shows what it is without
127
+ * any, over a wider breakpoint's class that is live in a wide window.
128
+ */
129
+ function sides(node, key, breakpoint) {
130
+ var tier = ge.breakpoints.indexOf(breakpoint);
131
+ var winners = {};
132
+ var styles = {};
133
+ var neutral = null;
134
+
135
+ SIDES.forEach(function(side, order) {
136
+ var found = source(node, key + side, tier);
137
+ if (!found) { return; }
138
+
139
+ SET[side].forEach(function(set) {
140
+ var current = winners[set];
141
+ if (!current || found.tier > current.tier || (found.tier === current.tier && order > current.order)) {
142
+ winners[set] = { tier: found.tier, order: order, value: found.value };
143
+ }
144
+ });
145
+ });
146
+
147
+ ['top', 'right', 'bottom', 'left'].forEach(function(set) {
148
+ var winner = winners[set];
149
+
150
+ if (!winner) {
151
+ neutral = neutral || without(node, key);
152
+ styles[PROPERTIES[key] + '-' + set] = neutral[set];
153
+ } else {
154
+ styles[PROPERTIES[key] + '-' + set] = winner.value === 'auto' ? 'auto' : options.scale[winner.value];
155
+ }
156
+ });
157
+
158
+ return styles;
159
+ }
160
+
161
+ /** The side a group's select starts on: the first that has a class, or all. */
162
+ function startingSide(node, key) {
163
+ var names = classes(node).filter(function(name) { return patterns[key].test(name); });
164
+ var found = SIDES.filter(function(side) {
165
+ return names.some(function(name) { return name.indexOf(key + side + '-') === 0; });
166
+ });
167
+
168
+ return found.length ? found[0] : '';
169
+ }
170
+
171
+ function sideLabel(side) {
172
+ switch (side) {
173
+ case 'x': return ge.t('utility.side_x');
174
+ case 'y': return ge.t('utility.side_y');
175
+ case 't': return ge.t('utility.side_t');
176
+ case 'b': return ge.t('utility.side_b');
177
+ case 's': return ge.t('utility.side_s');
178
+ case 'e': return ge.t('utility.side_e');
179
+ default: return ge.t('utility.side_all');
180
+ }
181
+ }
182
+
183
+ /** A padding or margin group: its name, the side, and the field of that side's family. */
184
+ function group(node, key, labelText) {
185
+ var box = $('<div class="ge-spacing-group" />').attr('data-ge-spacing', key);
186
+ var side = $('<select class="ge-spacing-side" />');
187
+
188
+ $('<span class="ge-utility-label" />').text(labelText).appendTo(box);
189
+
190
+ SIDES.forEach(function(value) {
191
+ $('<option />').attr('value', value).text(sideLabel(value)).appendTo(side);
192
+ });
193
+
194
+ var field = ge.utilityField(node, key + startingSide(node, key));
195
+
196
+ side.val(field.attr('data-ge-family').slice(1))
197
+ .on('change', function() {
198
+ var next = ge.utilityField(node, key + this.value);
199
+ field.replaceWith(next);
200
+ field = next;
201
+ })
202
+ .appendTo(box)
203
+ ;
204
+ field.appendTo(box);
205
+
206
+ return box;
207
+ }
208
+
209
+ var NODES = '.row, .column, .ge-element, [data-ge-container]';
210
+
211
+ /**
212
+ * Keep each drawer on its node's edges. A drawer is pulled out over the
213
+ * editor's frame by as much as the frame pads the node, and a padding
214
+ * class replaces the frame, so a padded node's drawer is pulled out by
215
+ * its real padding instead. And a column padded at the sides gets a word
216
+ * about what that does to its gutter.
217
+ */
218
+ function mark(scope) {
219
+ scope.find(NODES).addBack(NODES).each(function() {
220
+ var node = $(this);
221
+ var drawer = node.children('.ge-tools-drawer');
222
+
223
+ if (!drawer.length || !applies(node, ge.kindOf(node))) { return; }
224
+
225
+ if (carries(node, 'p')) {
226
+ var style = getComputedStyle(node[0]);
227
+
228
+ drawer.css({
229
+ marginTop: '-' + style.paddingTop,
230
+ marginLeft: '-' + style.paddingLeft,
231
+ marginRight: '-' + style.paddingRight,
232
+ width: 'calc(100% + ' + style.paddingLeft + ' + ' + style.paddingRight + ')',
233
+ });
234
+ } else {
235
+ drawer.css({ marginTop: '', marginLeft: '', marginRight: '', width: '' });
236
+ }
237
+
238
+ if (node.hasClass('column')) {
239
+ drawer.find('.ge-spacing-gutter').toggle(classes(node).some(function(name) {
240
+ return /^p[xse]?-/.test(name) && patterns.p.test(name);
241
+ }));
242
+ }
243
+ });
244
+ }
245
+
246
+ function families(key, labelKey) {
247
+ var values = key === 'm' ? VALUES.concat(['auto']) : VALUES;
248
+ var offered = options.values.concat(key === 'm' ? ['auto'] : []);
249
+
250
+ return SIDES.map(function(side) {
251
+ return {
252
+ name: key + side,
253
+ prefix: key + side,
254
+ values: values,
255
+ appliesTo: ['row', 'column', 'element', 'container'],
256
+ labelKey: labelKey,
257
+ panel: false,
258
+ choices: function() {
259
+ return values.filter(function(value) { return offered.indexOf(value) !== -1; });
260
+ },
261
+ };
262
+ });
263
+ }
264
+
265
+ return {
266
+ families: families('p', 'utility.padding').concat(families('m', 'utility.margin')),
267
+
268
+ panel: function(node, kind) {
269
+ if (!applies(node, kind)) { return null; }
270
+
271
+ var box = $('<div class="ge-spacing" />')
272
+ .append(group(node, 'p', ge.t('utility.padding')))
273
+ .append(group(node, 'm', ge.t('utility.margin')))
274
+ ;
275
+
276
+ if (kind === 'column') {
277
+ $('<small class="ge-spacing-gutter" />').text(ge.t('utility.spacing_gutter')).appendTo(box);
278
+ }
279
+
280
+ return box;
281
+ },
282
+
283
+ preview: function(node, kind, breakpoint) {
284
+ if (!applies(node, kind)) { return {}; }
285
+
286
+ var styles = {};
287
+
288
+ ['p', 'm'].forEach(function(key) {
289
+ if (carries(node, key)) { $.extend(styles, sides(node, key, breakpoint)); }
290
+ });
291
+
292
+ return styles;
293
+ },
294
+
295
+ onRefresh: mark,
296
+ };
297
+ };
298
+
299
+ })(jQuery);
@@ -0,0 +1,2 @@
1
+ (o=>{o.extend(o.fn.gridEditor.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 m=["0","1","2","3","4","5"],n=["0",".25rem",".5rem","1rem","1.5rem","3rem"],y=["","x","y","t","e","b","s"],h={"":["top","right","bottom","left"],x:["left","right"],y:["top","bottom"],t:["top"],e:["right"],b:["bottom"],s:["left"]},v=["","sm","md","lg","xl","xxl"],x={p:"padding",m:"margin"};function l(t){return new RegExp("^"+t+"[xytbse]?-(?:(?:sm|md|lg|xl|xxl)-)?(?:[0-5]|auto)$")}o.fn.gridEditor.utilities.spacing=function(d){var g=o.extend({values:m,scale:n},d.settings.utilities.spacing),p={p:l("p"),m:l("m")};function r(t,e){return"row"===e||"column"===e||"element"===e||t.is("[data-ge-container]")}function f(t){return(t.attr("class")||"").split(/\s+/)}function a(t,e){return f(t).some(function(t){return p[e].test(t)})}function u(u,l,t){var e=d.breakpoints.indexOf(t),o={},s={},c=null;return y.forEach(function(t,i){var n=((t,e,i)=>{for(var n=f(t),r="m"===e.charAt(0)?m.concat(["auto"]):m,a=i;0<=a;a--)for(var u=0;u<r.length;u++){var l=e+(v[a]?"-"+v[a]:"")+"-"+r[u];if(-1!==n.indexOf(l))return{tier:a,value:r[u]}}return null})(u,l+t,e);n&&h[t].forEach(function(t){var e=o[t];(!e||n.tier>e.tier||n.tier===e.tier&&i>e.order)&&(o[t]={tier:n.tier,order:i,value:n.value})})}),["top","right","bottom","left"].forEach(function(t){var e,i,n,r,a=o[t];a?s[x[l]+"-"+t]="auto"===a.value?"auto":g.scale[a.value]:(c=c||(e=l,n=(a=u).attr("class"),r={},a.attr("class",f(a).filter(function(t){return!p[e].test(t)}).join(" ")),i=getComputedStyle(a[0]),["top","right","bottom","left"].forEach(function(t){r[t]=i.getPropertyValue(x[e]+"-"+t)}),a.attr("class",n),r),s[x[l]+"-"+t]=c[t])}),s}function i(e,i,t){var n,r,a=o('<div class="ge-spacing-group" />').attr("data-ge-spacing",i),u=o('<select class="ge-spacing-side" />'),l=(o('<span class="ge-utility-label" />').text(t).appendTo(a),y.forEach(function(t){o("<option />").attr("value",t).text((t=>{switch(t){case"x":return d.t("utility.side_x");case"y":return d.t("utility.side_y");case"t":return d.t("utility.side_t");case"b":return d.t("utility.side_b");case"s":return d.t("utility.side_s");case"e":return d.t("utility.side_e");default:return d.t("utility.side_all")}})(t)).appendTo(u)}),d.utilityField(e,i+(n=i,r=f(t=e).filter(function(t){return p[n].test(t)}),(t=y.filter(function(e){return r.some(function(t){return 0===t.indexOf(n+e+"-")})})).length?t[0]:"")));return u.val(l.attr("data-ge-family").slice(1)).on("change",function(){var t=d.utilityField(e,i+this.value);l.replaceWith(t),l=t}).appendTo(a),l.appendTo(a),a}var e=".row, .column, .ge-element, [data-ge-container]";function t(e,i){var n="m"===e?m.concat(["auto"]):m,r=g.values.concat("m"===e?["auto"]:[]);return y.map(function(t){return{name:e+t,prefix:e+t,values:n,appliesTo:["row","column","element","container"],labelKey:i,panel:!1,choices:function(){return n.filter(function(t){return-1!==r.indexOf(t)})}}})}return{families:t("p","utility.padding").concat(t("m","utility.margin")),panel:function(t,e){return r(t,e)?(t=o('<div class="ge-spacing" />').append(i(t,"p",d.t("utility.padding"))).append(i(t,"m",d.t("utility.margin"))),"column"===e&&o('<small class="ge-spacing-gutter" />').text(d.t("utility.spacing_gutter")).appendTo(t),t):null},preview:function(e,t,i){var n;return r(e,t)?(n={},["p","m"].forEach(function(t){a(e,t)&&o.extend(n,u(e,t,i))}),n):{}},onRefresh:function(t){t.find(e).addBack(e).each(function(){var t,e=o(this),i=e.children(".ge-tools-drawer");i.length&&r(e,d.kindOf(e))&&(a(e,"p")?(t=getComputedStyle(e[0]),i.css({marginTop:"-"+t.paddingTop,marginLeft:"-"+t.paddingLeft,marginRight:"-"+t.paddingRight,width:"calc(100% + "+t.paddingLeft+" + "+t.paddingRight+")"})):i.css({marginTop:"",marginLeft:"",marginRight:"",width:""}),e.hasClass("column"))&&i.find(".ge-spacing-gutter").toggle(f(e).some(function(t){return/^p[xse]?-/.test(t)&&p.p.test(t)}))})}}}})(jQuery);
2
+ //# sourceMappingURL=grideditor.spacing.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grideditor.spacing.min.js","sources":["../../src/js/plugins/grideditor.spacing.js"],"names":["$","extend","fn","gridEditor","locales","en","utility.padding","utility.margin","utility.side_all","utility.side_x","utility.side_y","utility.side_t","utility.side_b","utility.side_s","utility.side_e","utility.spacing_gutter","VALUES","SCALE","SIDES","SET","","x","y","t","e","b","s","INFIXES","PROPERTIES","p","m","pattern","key","RegExp","utilities","spacing","ge","options","values","scale","settings","patterns","applies","node","kind","is","classes","attr","split","carries","some","name","test","sides","breakpoint","tier","breakpoints","indexOf","winners","styles","neutral","forEach","side","order","found","family","names","charAt","concat","i","v","length","value","set","current","style","original","bare","winner","filter","join","getComputedStyle","getPropertyValue","group","labelText","box","field","text","appendTo","utilityField","val","slice","on","next","this","replaceWith","NODES","families","labelKey","offered","map","prefix","appliesTo","panel","choices","append","preview","onRefresh","scope","find","addBack","each","drawer","children","kindOf","css","marginTop","paddingTop","marginLeft","paddingLeft","marginRight","paddingRight","width","hasClass","toggle","jQuery"],"mappings":"CAmBUA,IAEVA,EAAEC,OAAOD,EAAEE,GAAGC,WAAWC,QAAQC,GAAI,CACjCC,kBAAmB,UACnBC,iBAAkB,SAClBC,mBAAoB,YACpBC,iBAAkB,iBAClBC,iBAAkB,iBAClBC,iBAAkB,MAClBC,iBAAkB,SAClBC,iBAAkB,QAClBC,iBAAkB,MAClBC,yBAA0B,uEAC9B,CAAC,EAED,IAAIC,EAAS,CAAC,IAAK,IAAK,IAAK,IAAK,IAAK,KAGnCC,EAAQ,CAAC,IAAK,SAAU,QAAS,OAAQ,SAAU,QAMnDC,EAAQ,CAAC,GAAI,IAAK,IAAK,IAAK,IAAK,IAAK,KAGtCC,EAAM,CACNC,GAAI,CAAC,MAAO,QAAS,SAAU,QAC/BC,EAAG,CAAC,OAAQ,SACZC,EAAG,CAAC,MAAO,UACXC,EAAG,CAAC,OACJC,EAAG,CAAC,SACJC,EAAG,CAAC,UACJC,EAAG,CAAC,OACR,EAEIC,EAAU,CAAC,GAAI,KAAM,KAAM,KAAM,KAAM,OAEvCC,EAAa,CAAEC,EAAG,UAAWC,EAAG,QAAS,EAG7C,SAASC,EAAQC,GACb,OAAO,IAAIC,OAAO,IAAMD,EAAM,oDAAoD,CACtF,CAEAhC,EAAEE,GAAGC,WAAW+B,UAAUC,QAAU,SAASC,GAEzC,IAAIC,EAAUrC,EAAEC,OAAO,CAAEqC,OAAQtB,EAAQuB,MAAOtB,CAAM,EAAGmB,EAAGI,SAASN,UAAUC,OAAO,EAClFM,EAAW,CAAEZ,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C,EAAMP,EAAG8E,OAAOvE,CAAI,CAAC,IAEhDM,EAAQN,EAAM,GAAG,GACbgC,EAAQM,iBAAiBtC,EAAK,EAAE,EAEpCqE,EAAOG,IAAI,CACPC,UAAW,IAAMzC,EAAM0C,WACvBC,WAAY,IAAM3C,EAAM4C,YACxBC,YAAa,IAAM7C,EAAM8C,aACzBC,MAAO,eAAiB/C,EAAM4C,YAAc,MAAQ5C,EAAM8C,aAAe,GAC7E,CAAC,GAEDT,EAAOG,IAAI,CAAEC,UAAW,GAAIE,WAAY,GAAIE,YAAa,GAAIE,MAAO,EAAG,CAAC,EAGxE/E,EAAKgF,SAAS,QAAQ,IACtBX,EAAOH,KAAK,oBAAoB,EAAEe,OAAO9E,EAAQH,CAAI,EAAEO,KAAK,SAASC,GACjE,MAAO,YAAYC,KAAKD,CAAI,GAAKV,EAASZ,EAAEuB,KAAKD,CAAI,CACzD,CAAC,CAAC,CAEV,CAAC,CACL,CAoDA,CACJ,CAEC,GAAE0E,MAAM"}
@@ -73,6 +73,14 @@ $.fn.gridEditor.containers.tabs = function(ge) {
73
73
 
74
74
  return {
75
75
  labelKey: 'container.add_tabs',
76
+
77
+ // A tab strip sorts its own tabs, and the panes follow them. No
78
+ // group: a tab belongs to the strip it was made in.
79
+ onSortable: function(sortable) {
80
+ sortable(ge.canvas.find('.ge-container-tabs > .nav-tabs'), {
81
+ draggable: '.ge-tab',
82
+ });
83
+ },
76
84
  addPaneKey: 'container.add_tab',
77
85
  paneKind: 'tab',
78
86
 
@@ -1,2 +1,2 @@
1
- (b=>{b.extend(b.fn.gridEditor.locales.en,{"container.add_tabs":"Tabs","container.add_tab":"Add tab","container.tab_label":"Tab {number}","confirm.delete_tab":"Delete this tab and everything in it?"}),b.fn.gridEditor.containers.tabs=function(d){function r(a,t){t=t||{};var n=a.find("> .nav-tabs"),e=a.find("> .tab-content"),i=d.containerId("tab"),r=n.children(".nav-item").length+1,n=(b('<li class="nav-item ge-tab" role="presentation" />').append(b('<button class="nav-link" type="button" role="tab" data-bs-toggle="tab" />').attr("data-bs-target","#"+i).attr("aria-controls",i).append(b('<span class="ge-pane-label" />').text(t.label||d.t("container.tab_label",{number:r})))).appendTo(n),b('<div class="tab-pane fade" role="tabpanel" tabindex="0" />').attr("id",i).append(d.defaultRegion()).appendTo(e));return!t.activate&&1!==r||s(a,n),n}function s(a,t){var n=t.attr("id");a.find("> .tab-content > .tab-pane").removeClass("show active"),t.addClass("show active"),a.find("> .nav-tabs .nav-link").each(function(){var a=b(this),t=a.attr("data-bs-target")==="#"+n;a.toggleClass("active",t).attr("aria-selected",t?"true":"false")})}function l(a,t){return a.find(t.find(".nav-link").attr("data-bs-target"))}return{labelKey:"container.add_tabs",addPaneKey:"container.add_tab",paneKind:"tab",create:function(a){var t=b("<div />").attr("data-ge-container","tabs"),n=a.labels||[],e=a.tabs||n.length||2;b('<ul class="nav nav-tabs" role="tablist" />').appendTo(t),b('<div class="tab-content" />').appendTo(t);for(var i=0;i<e;i++)r(t,{label:n[i]});return t},addPane:r,mark:function(i){i.find("> .tab-content > .tab-pane").addClass("ge-tab-pane"),i.find("> .nav-tabs > .nav-item").each(function(){var a=b(this).addClass("ge-tab");d.makeLabelEditable(d.labelIn(a.find(".nav-link"))),a.find("> .ge-tools-drawer").length||d.createPaneControls(a,"tab",d.settings.tab_tools,d.t("confirm.delete_tab"),function(t){var n=l(i,a),e=n.hasClass("active");a.fadeOut(200,function(){n.remove(),t();var a=i.find("> .tab-content > .tab-pane").first();e&&a.length&&s(i,a)})})})},unmark:function(a){d.resumeToggles(a),a.find(".ge-tab-pane").removeClass("ge-tab-pane"),d.unwrapLabels(a)},afterPaneMove:function(a){var t=a.find("> .tab-content");a.find("> .nav-tabs > .nav-item").each(function(){t.append(l(a,b(this)))})}}}})(jQuery);
1
+ (o=>{o.extend(o.fn.gridEditor.locales.en,{"container.add_tabs":"Tabs","container.add_tab":"Add tab","container.tab_label":"Tab {number}","confirm.delete_tab":"Delete this tab and everything in it?"}),o.fn.gridEditor.containers.tabs=function(d){function r(a,t){t=t||{};var n=a.find("> .nav-tabs"),e=a.find("> .tab-content"),i=d.containerId("tab"),r=n.children(".nav-item").length+1,n=(o('<li class="nav-item ge-tab" role="presentation" />').append(o('<button class="nav-link" type="button" role="tab" data-bs-toggle="tab" />').attr("data-bs-target","#"+i).attr("aria-controls",i).append(o('<span class="ge-pane-label" />').text(t.label||d.t("container.tab_label",{number:r})))).appendTo(n),o('<div class="tab-pane fade" role="tabpanel" tabindex="0" />').attr("id",i).append(d.defaultRegion()).appendTo(e));return!t.activate&&1!==r||s(a,n),n}function s(a,t){var n=t.attr("id");a.find("> .tab-content > .tab-pane").removeClass("show active"),t.addClass("show active"),a.find("> .nav-tabs .nav-link").each(function(){var a=o(this),t=a.attr("data-bs-target")==="#"+n;a.toggleClass("active",t).attr("aria-selected",t?"true":"false")})}function b(a,t){return a.find(t.find(".nav-link").attr("data-bs-target"))}return{labelKey:"container.add_tabs",onSortable:function(a){a(d.canvas.find(".ge-container-tabs > .nav-tabs"),{draggable:".ge-tab"})},addPaneKey:"container.add_tab",paneKind:"tab",create:function(a){var t=o("<div />").attr("data-ge-container","tabs"),n=a.labels||[],e=a.tabs||n.length||2;o('<ul class="nav nav-tabs" role="tablist" />').appendTo(t),o('<div class="tab-content" />').appendTo(t);for(var i=0;i<e;i++)r(t,{label:n[i]});return t},addPane:r,mark:function(i){i.find("> .tab-content > .tab-pane").addClass("ge-tab-pane"),i.find("> .nav-tabs > .nav-item").each(function(){var a=o(this).addClass("ge-tab");d.makeLabelEditable(d.labelIn(a.find(".nav-link"))),a.find("> .ge-tools-drawer").length||d.createPaneControls(a,"tab",d.settings.tab_tools,d.t("confirm.delete_tab"),function(t){var n=b(i,a),e=n.hasClass("active");a.fadeOut(200,function(){n.remove(),t();var a=i.find("> .tab-content > .tab-pane").first();e&&a.length&&s(i,a)})})})},unmark:function(a){d.resumeToggles(a),a.find(".ge-tab-pane").removeClass("ge-tab-pane"),d.unwrapLabels(a)},afterPaneMove:function(a){var t=a.find("> .tab-content");a.find("> .nav-tabs > .nav-item").each(function(){t.append(b(a,o(this)))})}}}})(jQuery);
2
2
  //# sourceMappingURL=grideditor.tabs.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"grideditor.tabs.min.js","sources":["../../src/js/plugins/grideditor.tabs.js"],"names":["$","extend","fn","gridEditor","locales","en","container.add_tabs","container.add_tab","container.tab_label","confirm.delete_tab","containers","tabs","ge","addTabTo","container","options","strip","find","content","id","containerId","number","children","length","pane","append","attr","text","label","t","appendTo","defaultRegion","activate","activatePane","removeClass","addClass","each","button","this","active","toggleClass","paneOf","tab","labelKey","addPaneKey","paneKind","create","labels","count","i","addPane","mark","makeLabelEditable","labelIn","createPaneControls","settings","tab_tools","removed","wasActive","hasClass","fadeOut","remove","first","unmark","resumeToggles","unwrapLabels","afterPaneMove","jQuery"],"mappings":"CAUUA,IAEVA,EAAEC,OAAOD,EAAEE,GAAGC,WAAWC,QAAQC,GAAI,CACjCC,qBAAsB,OACtBC,oBAAqB,UACrBC,sBAAuB,eACvBC,qBAAsB,uCAC1B,CAAC,EAEDT,EAAEE,GAAGC,WAAWO,WAAWC,KAAO,SAASC,GAEvC,SAASC,EAASC,EAAWC,GACzBA,EAAUA,GAAW,GAErB,IAAIC,EAAQF,EAAUG,KAAK,aAAa,EACpCC,EAAUJ,EAAUG,KAAK,gBAAgB,EACzCE,EAAKP,EAAGQ,YAAY,KAAK,EACzBC,EAASL,EAAMM,SAAS,WAAW,EAAEC,OAAS,EAY9CC,GAVJxB,EAAE,oDAAoD,EACjDyB,OAAOzB,EAAE,2EAA2E,EAChF0B,KAAK,iBAAkB,IAAMP,CAAE,EAC/BO,KAAK,gBAAiBP,CAAE,EACxBM,OAAOzB,EAAE,gCAAgC,EACrC2B,KAAKZ,EAAQa,OAAShB,EAAGiB,EAAE,sBAAuB,CAAER,OAAQA,CAAO,CAAC,CAAC,CAAC,CAC/E,EACCS,SAASd,CAAK,EAGRhB,EAAE,4DA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EAAEsC,IAAI,EAAEH,SAAS,QAAQ,EAGnCvB,EAAGwC,kBAAkBxC,EAAGyC,QAAQX,EAAIzB,KAAK,WAAW,CAAC,CAAC,EAElDyB,EAAIzB,KAAK,oBAAoB,EAAEM,QAEnCX,EAAG0C,mBAAmBZ,EAAK,MAAO9B,EAAG2C,SAASC,UAAW5C,EAAGiB,EAAE,oBAAoB,EAC9E,SAAS4B,GACL,IAAIjC,EAAOiB,EAAO3B,EAAW4B,CAAG,EAC5BgB,EAAYlC,EAAKmC,SAAS,QAAQ,EAEtCjB,EAAIkB,QAAQ,IAAK,WACbpC,EAAKqC,OAAO,EACZJ,EAAQ,EAER,IAAIK,EAAQhD,EAAUG,KAAK,4BAA4B,EAAE6C,MAAM,EAC3DJ,GAAaI,EAAMvC,QAAUU,EAAanB,EAAWgD,CAAK,CAClE,CAAC,CACL,CAAC,CACT,CAAC,CACL,EAEAC,OAAQ,SAASjD,GACbF,EAAGoD,cAAclD,CAAS,EAC1BA,EAAUG,KAAK,cAAc,EAAEiB,YAAY,aAAa,EACxDtB,EAAGqD,aAAanD,CAAS,CAC7B,EAGAoD,cAAe,SAASpD,GACpB,IAAII,EAAUJ,EAAUG,KAAK,gBAAgB,EAE7CH,EAAUG,KAAK,yBAAyB,EAAEmB,KAAK,WAC3ClB,EAAQO,OAAOgB,EAAO3B,EAAWd,EAAEsC,IAAI,CAAC,CAAC,CAC7C,CAAC,CACL,CACJ,CACJ,CAEC,GAAE6B,MAAM"}
1
+ {"version":3,"file":"grideditor.tabs.min.js","sources":["../../src/js/plugins/grideditor.tabs.js"],"names":["$","extend","fn","gridEditor","locales","en","container.add_tabs","container.add_tab","container.tab_label","confirm.delete_tab","containers","tabs","ge","addTabTo","container","options","strip","find","content","id","containerId","number","children","length","pane","append","attr","text","label","t","appendTo","defaultRegion","activate","activatePane","removeClass","addClass","each","button","this","active","toggleClass","paneOf","tab","labelKey","onSortable","sortable","canvas","draggable","addPaneKey","paneKind","create","labels","count","i","addPane","mark","makeLabelEditable","labelIn","createPaneControls","settings","tab_tools","removed","wasActive","hasClass","fadeOut","remove","first","unmark","resumeToggles","unwrapLabels","afterPaneMove","jQuery"],"mappings":"CAUUA,IAEVA,EAAEC,OAAOD,EAAEE,GAAGC,WAAWC,QAAQC,GAAI,CACjCC,qBAAsB,OACtBC,oBAAqB,UACrBC,sBAAuB,eACvBC,qBAAsB,uCAC1B,CAAC,EAEDT,EAAEE,GAAGC,WAAWO,WAAWC,KAAO,SAASC,GAEvC,SAASC,EAASC,EAAWC,GACzBA,EAAUA,GAAW,GAErB,IAAIC,EAAQF,EAAUG,KAAK,aAAa,EACpCC,EAAUJ,EAAUG,KAAK,gBAAgB,EACzCE,EAAKP,EAAGQ,YAAY,KAAK,EACzBC,EAASL,EAAMM,SAAS,WAAW,EAAEC,OAAS,EAY9CC,GAVJxB,EAAE,oDAAoD,EACjDyB,OAAOzB,EAAE,2EAA2E,EAChF0B,KAAK,iBAAkB,IAAMP,CAAE,EAC/BO,KAAK,gBAAiBP,CAAE,EACxBM,OAAOzB,EAAE,gCAAgC,EACrC2B,KAAKZ,EAAQa,OAAShB,EAAGiB,EAAE,sBAAuB,CAAER,OAAQA,CAAO,CAAC,CAAC,CAAC,CAC/E,EACCS,SAASd,CAAK,EAGRhB,EAAE,4DAA4D,EACpE0B,KAAK,KAAMP,CAAE,EACbM,OAAOb,EAAGmB,cAAc,CAAC,EACzBD,SAASZ,CAAO,GAKrB,MAFIH,CAAAA,EAAQiB,UAAuB,IAAXX,GAAgBY,EAAanB,EAAWU,CAAI,EAE7DA,CACX,CAEA,SAASS,EAAanB,EAAWU,GAC7B,IAAIL,EAAKK,EAAKE,KAAK,IAAI,EAEvBZ,EAAUG,KAAK,4BAA4B,EAAEiB,YAAY,aAAa,EACtEV,EAAKW,SAAS,aAAa,EAE3BrB,EAAUG,KAAK,uBAAuB,EAAEmB,KAAK,WACzC,IAAIC,EAASrC,EAAEsC,IAAI,EACfC,EAASF,EAAOX,KAAK,gBAAgB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AAQ,EAEtCrB,EAAIsB,QAAQ,IAAK,WACbxC,EAAKyC,OAAO,EACZJ,EAAQ,EAER,IAAIK,EAAQpD,EAAUG,KAAK,4BAA4B,EAAEiD,MAAM,EAC3DJ,GAAaI,EAAM3C,QAAUU,EAAanB,EAAWoD,CAAK,CAClE,CAAC,CACL,CAAC,CACT,CAAC,CACL,EAEAC,OAAQ,SAASrD,GACbF,EAAGwD,cAActD,CAAS,EAC1BA,EAAUG,KAAK,cAAc,EAAEiB,YAAY,aAAa,EACxDtB,EAAGyD,aAAavD,CAAS,CAC7B,EAGAwD,cAAe,SAASxD,GACpB,IAAII,EAAUJ,EAAUG,KAAK,gBAAgB,EAE7CH,EAAUG,KAAK,yBAAyB,EAAEmB,KAAK,WAC3ClB,EAAQO,OAAOgB,EAAO3B,EAAWd,EAAEsC,IAAI,CAAC,CAAC,CAC7C,CAAC,CACL,CACJ,CACJ,CAEC,GAAEiC,MAAM"}
@@ -0,0 +1,172 @@
1
+ /**
2
+ * Visibility for grid-editor.
3
+ *
4
+ * A utility plugin: load this file after the editor and every row, column,
5
+ * element and container can be hidden at some breakpoints and shown at
6
+ * others, with Bootstrap's d-{breakpoint}-none and d-{breakpoint}-block (or
7
+ * -flex, for a row, which is a flex container and stops being a grid as a
8
+ * block). What it can ask the editor for is the handle its factory is called
9
+ * with, described in docs/plugins.md.
10
+ *
11
+ * <script src="dist/jquery.grideditor.min.js"></script>
12
+ * <script src="dist/plugins/grideditor.visibility.min.js"></script>
13
+ *
14
+ * A hidden node is never hidden from the editor, which would leave nothing to
15
+ * click to show it again. It stays on the canvas, faded and striped in a view
16
+ * where it is hidden, and in the all view says at which breakpoints it is.
17
+ *
18
+ * utilities.visibility.drawer: false leaves the eye out of the drawers, and
19
+ * the panel field is the only control.
20
+ */
21
+ (function($) {
22
+
23
+ $.extend($.fn.gridEditor.locales.en, {
24
+ 'utility.visibility': 'Visibility',
25
+ 'utility.visibility_hidden': 'Hidden',
26
+ 'utility.visibility_shown': 'Shown',
27
+ 'tool.hide_in_view': 'Hide in this view',
28
+ 'tool.show_in_view': 'Show in this view',
29
+ 'badge.hidden_in': 'Hidden at {breakpoints}',
30
+ });
31
+
32
+ /** A node that carries any class of the family, at any breakpoint. */
33
+ var CLASS_PATTERN = /(?:^|\s)d-(?:(?:sm|md|lg|xl|xxl)-)?(?:none|block|flex)(?:\s|$)/;
34
+
35
+ var NODES = '.row, .column, .ge-element, [data-ge-container]';
36
+
37
+ $.fn.gridEditor.utilities.visibility = function(ge) {
38
+
39
+ var options = $.extend({ drawer: true }, ge.settings.utilities.visibility);
40
+
41
+ /** What "shown" is written as on this kind of node. */
42
+ function shown(kind) {
43
+ return kind === 'row' ? 'flex' : 'block';
44
+ }
45
+
46
+ function applies(node, kind) {
47
+ return kind === 'row' || kind === 'column' || kind === 'element' ||
48
+ node.is('[data-ge-container]');
49
+ }
50
+
51
+ function hiddenAt(node, view) {
52
+ return ge.getUtility(node, 'visibility', view) === 'none';
53
+ }
54
+
55
+ /** The breakpoints at which the node is hidden, smallest first. */
56
+ function hiddenTiers(node) {
57
+ return ge.breakpoints.filter(function(key) { return hiddenAt(node, key); });
58
+ }
59
+
60
+ /**
61
+ * Whether the node is hidden in the view being edited. In the all view
62
+ * that means hidden at every breakpoint, since "hidden at some" is what
63
+ * the badge is for.
64
+ */
65
+ function hiddenHere(node) {
66
+ return ge.view() === 'all'
67
+ ? hiddenTiers(node).length === ge.breakpoints.length
68
+ : hiddenAt(node, ge.view());
69
+ }
70
+
71
+ /** What the breakpoint below the view shows, which an inherit falls back to. */
72
+ function hiddenBelow(node) {
73
+ var index = ge.breakpoints.indexOf(ge.view());
74
+
75
+ return index > 0 && hiddenAt(node, ge.breakpoints[index - 1]);
76
+ }
77
+
78
+ /**
79
+ * Hide or show the node in the view being edited, with as few classes as
80
+ * that takes. In a breakpoint view that is often none at all: showing a
81
+ * node the breakpoint below shows removes this breakpoint's d-*-none
82
+ * rather than writing a d-*-block on top of it. In the all view a node
83
+ * is hidden everywhere or shown everywhere, and shown is no class.
84
+ */
85
+ function toggle(node, kind) {
86
+ var hide = !hiddenHere(node);
87
+ var value;
88
+
89
+ if (ge.view() === 'all') {
90
+ value = hide ? 'none' : null;
91
+ } else if (hide) {
92
+ value = hiddenBelow(node) ? null : 'none';
93
+ } else {
94
+ value = hiddenBelow(node) ? shown(kind) : null;
95
+ }
96
+
97
+ ge.setUtility(node, 'visibility', value, { source: 'tool' });
98
+ }
99
+
100
+ /**
101
+ * The canvas shows each node as the view sees it. ge-visibility keeps a
102
+ * node Bootstrap would hide on the canvas, ge-hidden-in-view fades it,
103
+ * and data-ge-hidden-in carries the badge text for the all view.
104
+ */
105
+ function mark(scope) {
106
+ scope.find(NODES).addBack(NODES).each(function() {
107
+ var node = $(this);
108
+ var kind = ge.kindOf(node);
109
+ var carries = applies(node, kind) && CLASS_PATTERN.test(node.attr('class') || '');
110
+ var tiers = carries ? hiddenTiers(node) : [];
111
+ var here = carries && hiddenHere(node);
112
+ var partly = carries && ge.view() === 'all' && tiers.length > 0 && !here;
113
+
114
+ node.toggleClass('ge-visibility', carries).toggleClass('ge-hidden-in-view', here);
115
+
116
+ if (partly) {
117
+ node.attr('data-ge-hidden-in', ge.t('badge.hidden_in', { breakpoints: tiers.join(', ') }));
118
+ } else {
119
+ node.removeAttr('data-ge-hidden-in');
120
+ }
121
+
122
+ node.children('.ge-tools-drawer').children('.ge-visibility-tool').each(function() {
123
+ $(this)
124
+ .attr('title', here ? ge.t('tool.show_in_view') : ge.t('tool.hide_in_view'))
125
+ .find('i').attr('class', here ? 'bi bi-eye-slash' : 'bi bi-eye');
126
+ });
127
+ });
128
+ }
129
+
130
+ function unmark() {
131
+ ge.canvas.find('.ge-visibility, .ge-hidden-in-view, [data-ge-hidden-in]').each(function() {
132
+ var node = $(this)
133
+ .removeClass('ge-visibility ge-hidden-in-view')
134
+ .removeAttr('data-ge-hidden-in')
135
+ ;
136
+
137
+ if (!node.attr('class')) { node.removeAttr('class'); }
138
+ });
139
+ }
140
+
141
+ return {
142
+ families: [{
143
+ name: 'visibility',
144
+ prefix: 'd',
145
+ values: ['none', 'block', 'flex'],
146
+ appliesTo: ['row', 'column', 'element', 'container'],
147
+ labelKey: 'utility.visibility',
148
+
149
+ /** Hidden, or shown the way this kind of node is shown. */
150
+ choices: function(node, kind) {
151
+ return ['none', shown(kind)];
152
+ },
153
+
154
+ label: function(value) {
155
+ return value === 'none' ? ge.t('utility.visibility_hidden') : ge.t('utility.visibility_shown');
156
+ },
157
+ }],
158
+
159
+ drawerTools: function(drawer, node, kind) {
160
+ if (!options.drawer || !applies(node, kind)) { return; }
161
+
162
+ ge.createTool(drawer, ge.t('tool.hide_in_view'), 'ge-visibility-tool', 'bi bi-eye', function() {
163
+ toggle(node, kind);
164
+ });
165
+ },
166
+
167
+ onRefresh: mark,
168
+ onDeinit: unmark,
169
+ };
170
+ };
171
+
172
+ })(jQuery);
@@ -0,0 +1,2 @@
1
+ (v=>{v.extend(v.fn.gridEditor.locales.en,{"utility.visibility":"Visibility","utility.visibility_hidden":"Hidden","utility.visibility_shown":"Shown","tool.hide_in_view":"Hide in this view","tool.show_in_view":"Show in this view","badge.hidden_in":"Hidden at {breakpoints}"});var c=/(?:^|\s)d-(?:(?:sm|md|lg|xl|xxl)-)?(?:none|block|flex)(?:\s|$)/,n=".row, .column, .ge-element, [data-ge-container]";v.fn.gridEditor.utilities.visibility=function(o){var e=v.extend({drawer:!0},o.settings.utilities.visibility);function r(i){return"row"===i?"flex":"block"}function s(i,e){return"row"===e||"column"===e||"element"===e||i.is("[data-ge-container]")}function t(i,e){return"none"===o.getUtility(i,"visibility",e)}function a(e){return o.breakpoints.filter(function(i){return t(e,i)})}function d(i){return"all"===o.view()?a(i).length===o.breakpoints.length:t(i,o.view())}function u(i){var e=o.breakpoints.indexOf(o.view());return 0<e&&t(i,o.breakpoints[e-1])}return{families:[{name:"visibility",prefix:"d",values:["none","block","flex"],appliesTo:["row","column","element","container"],labelKey:"utility.visibility",choices:function(i,e){return["none",r(e)]},label:function(i){return"none"===i?o.t("utility.visibility_hidden"):o.t("utility.visibility_shown")}}],drawerTools:function(i,n,l){e.drawer&&s(n,l)&&o.createTool(i,o.t("tool.hide_in_view"),"ge-visibility-tool","bi bi-eye",function(){var i,e,t;e=l,t=!d(i=n),t="all"===o.view()?t?"none":null:t?u(i)?null:"none":u(i)?r(e):null,o.setUtility(i,"visibility",t,{source:"tool"})})},onRefresh:function(i){i.find(n).addBack(n).each(function(){var i=v(this),e=s(i,o.kindOf(i))&&c.test(i.attr("class")||""),t=e?a(i):[],n=e&&d(i),l=e&&"all"===o.view()&&0<t.length&&!n;i.toggleClass("ge-visibility",e).toggleClass("ge-hidden-in-view",n),l?i.attr("data-ge-hidden-in",o.t("badge.hidden_in",{breakpoints:t.join(", ")})):i.removeAttr("data-ge-hidden-in"),i.children(".ge-tools-drawer").children(".ge-visibility-tool").each(function(){v(this).attr("title",n?o.t("tool.show_in_view"):o.t("tool.hide_in_view")).find("i").attr("class",n?"bi bi-eye-slash":"bi bi-eye")})})},onDeinit:function(){o.canvas.find(".ge-visibility, .ge-hidden-in-view, [data-ge-hidden-in]").each(function(){var i=v(this).removeClass("ge-visibility ge-hidden-in-view").removeAttr("data-ge-hidden-in");i.attr("class")||i.removeAttr("class")})}}}})(jQuery);
2
+ //# sourceMappingURL=grideditor.visibility.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grideditor.visibility.min.js","sources":["../../src/js/plugins/grideditor.visibility.js"],"names":["$","extend","fn","gridEditor","locales","en","utility.visibility","utility.visibility_hidden","utility.visibility_shown","tool.hide_in_view","tool.show_in_view","badge.hidden_in","CLASS_PATTERN","NODES","utilities","visibility","ge","options","drawer","settings","shown","kind","applies","node","is","hiddenAt","view","getUtility","hiddenTiers","breakpoints","filter","key","hiddenHere","length","hiddenBelow","index","indexOf","families","name","prefix","values","appliesTo","labelKey","choices","label","value","t","drawerTools","createTool","hide","setUtility","source","onRefresh","scope","find","addBack","each","this","carries","kindOf","test","attr","tiers","here","partly","toggleClass","join","removeAttr","children","onDeinit","canvas","removeClass","jQuery"],"mappings":"CAoBUA,IAEVA,EAAEC,OAAOD,EAAEE,GAAGC,WAAWC,QAAQC,GAAI,CACjCC,qBAAsB,aACtBC,4BAA6B,SAC7BC,2BAA4B,QAC5BC,oBAAqB,oBACrBC,oBAAqB,oBACrBC,kBAAmB,yBACvB,CAAC,EAGD,IAAIC,EAAgB,iEAEhBC,EAAQ,kDAEZb,EAAEE,GAAGC,WAAWW,UAAUC,WAAa,SAASC,GAE5C,IAAIC,EAAUjB,EAAEC,OAAO,CAAEiB,OAAQ,CAAA,CAAK,EAAGF,EAAGG,SAASL,UAAUC,UAAU,EAGzE,SAASK,EAAMC,GACX,MAAgB,QAATA,EAAiB,OAAS,OACrC,CAEA,SAASC,EAAQC,EAAMF,GACnB,MAAgB,QAATA,GAA2B,WAATA,GAA8B,YAATA,GAC1CE,EAAKC,GAAG,qBAAqB,CACrC,CAEA,SAASC,EAASF,EAAMG,GACpB,MAAmD,SAA5CV,EAAGW,WAAWJ,EAAM,aAAcG,CAAI,CACjD,CAGA,SAASE,EAAYL,GACjB,OAAOP,EAAGa,YAAYC,OAAO,SAASC,GAAO,OAAON,EAASF,EAAMQ,CAAG,CAAG,CAAC,CAC9E,CAOA,SAASC,EAAWT,GAChB,MAAqB,QAAdP,EAAGU,KAAK,EACTE,EAAYL,CAAI,EAAEU,SAAWjB,EAAGa,YAAYI,OAC5CR,EAASF,EAAMP,EAAGU,KAAK,CAAC,CAClC,CAGA,SAASQ,EAAYX,GACjB,IAAIY,EAAQnB,EAAGa,YAAYO,QAAQpB,EAAGU,KAAK,CAAC,EAE5C,OAAe,EAARS,GAAaV,EAASF,EAAMP,EAAGa,YAAYM,EAAQ,EAAE,CAChE,CAiEA,MAAO,CACHE,SAAU,CAAC,CACPC,KAAM,aACNC,OAAQ,IACRC,OAAQ,CAAC,OAAQ,QAAS,QAC1BC,UAAW,CAAC,MAAO,SAAU,UAAW,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AAaiC,EAAMI,KAAK,IAAI,CAAE,CAAC,CAAC,EAEzF3C,EAAK4C,WAAW,mBAAmB,EAGvC5C,EAAK6C,SAAS,kBAAkB,EAAEA,SAAS,qBAAqB,EAAEZ,KAAK,WACnExD,EAAEyD,IAAI,EACDI,KAAK,QAASE,EAAO/C,EAAG8B,EAAE,mBAAmB,EAAI9B,EAAG8B,EAAE,mBAAmB,CAAC,EAC1EQ,KAAK,GAAG,EAAEO,KAAK,QAASE,EAAO,kBAAoB,WAAW,CACvE,CAAC,CACL,CAAC,CACL,EAwCIM,SAtCJ,WACIrD,EAAGsD,OAAOhB,KAAK,yDAAyD,EAAEE,KAAK,WAC3E,IAAIjC,EAAOvB,EAAEyD,IAAI,EACZc,YAAY,iCAAiC,EAC7CJ,WAAW,mBAAmB,EAG9B5C,EAAKsC,KAAK,OAAO,GAAKtC,EAAK4C,WAAW,OAAO,CACtD,CAAC,CACL,CA8BA,CACJ,CAEC,GAAEK,MAAM"}
package/docs/events.md CHANGED
@@ -56,6 +56,9 @@ about every insertion can bind `grideditor:before-add` and switch on
56
56
  | `grideditor:before-indent` | — | yes | before a column's offset changes |
57
57
  | `grideditor:after-indent` | — | no | after the offset class is written |
58
58
  | `grideditor:popup-orphan` | — | no | on `init`, once per trigger whose popup is missing and cannot be re-pointed |
59
+ | `grideditor:before-utility` | — | yes | before a utility class is written, from the panel, a plugin's tool or `setUtility` |
60
+ | `grideditor:after-utility` | — | no | after the class is written and the preview redrawn, only if something changed |
61
+ | `grideditor:view-change` | — | no | after the view changes, only if it actually changed |
59
62
 
60
63
  Two things here are not in the 3.0 specification's catalogue. The indent pair,
61
64
  because the indent tools are an operation like any other and announce
@@ -74,7 +77,7 @@ The payload
74
77
  parent: jQuery, // where it is going, or where it came from on a delete
75
78
  canvas: jQuery,
76
79
  breakpoint: 'lg', // the view at the time: a breakpoint key, or 'all'
77
- source: 'tool', // tool | api | dragdrop
80
+ source: 'tool', // tool | api | dragdrop | panel
78
81
 
79
82
  // move only
80
83
  from: { parent: jQuery, index: 2 },
@@ -89,9 +92,23 @@ The payload
89
92
 
90
93
  // popup-orphan only
91
94
  missing: 'ge-popup-3-a91', // the id the trigger pointed at
95
+
96
+ // utility only
97
+ family: 'order', // the utility, as its plugin names it
98
+ from: '1', // what applied in the view before, or null
99
+ to: '2', // what was asked for; null is "inherit"
100
+ tiers: ['md'], // the breakpoints whose class was written
101
+ cleared: [ // the all view only: what the breakpoints said,
102
+ { breakpoint: 'lg', value: '3' }, // and the write took away
103
+ ],
92
104
  }
93
105
  ```
94
106
 
107
+ `view-change` carries no node: its payload is `canvas`, `breakpoint` (the new
108
+ view), `from` and `to`. A utility's `breakpoint` is the view it was written
109
+ in, which `setUtility` can be asked to make a different one from the view on
110
+ screen, and its `source` is `panel`, `tool` or `api`.
111
+
95
112
  `source` matters to a host that both drives the editor from its own palette and
96
113
  listens for what the user does: `api` is your own call coming back to you,
97
114
  `tool` is a click in the editor, `dragdrop` is a gesture.
@@ -114,14 +131,15 @@ cancels a `before-*`. What that means depends on the operation:
114
131
  then remove the node and call `reset()`. The editor's own confirmation modal
115
132
  never appears for a canceled delete — the host's handler runs first, on
116
133
  purpose.
117
- - **Move.** jQuery UI cannot refuse a drag once it has started, so
118
- `before-move` fires from the sortable's `start` handler and canceling marks
119
- the drag: on drop the item returns to where it came from and no `after-move`
120
- fires. The drag is visible and then reverts; it is not prevented outright.
121
- - **Resize.** From a tool, nothing is written. From a drag, the drag is refused
122
- at every step, so the column ends where it began — jQuery UI's `resizable`
123
- ignores `false` from its start handler, unlike its `draggable`.
134
+ - **Move.** A drag cannot be refused once it has started, so `before-move`
135
+ fires as the drag begins and canceling marks it: on drop the item is put back
136
+ where it came from and no `after-move` fires. The drag is visible and then
137
+ reverts; it is not prevented outright.
138
+ - **Resize.** From a tool, nothing is written. From a drag, the gesture never
139
+ starts: the column does not move and nothing is written.
124
140
  - **Indent.** Nothing is written.
141
+ - **Utility.** Nothing is written, `setUtility` returns `false`, and the panel
142
+ field goes back to the value that stands.
125
143
 
126
144
  `after-move` is suppressed when the drop leaves the node in the same parent at
127
145
  the same index, and `after-resize` when the snapped size equals the old one, so