@themarioga/grid-editor 9.0.0-beta.4 → 9.0.0-beta.5

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.
@@ -9,6 +9,9 @@
9
9
  function all(root, selector) {
10
10
  return root ? Array.prototype.slice.call(root.querySelectorAll(selector)) : [];
11
11
  }
12
+ function one(root, selector) {
13
+ return root ? root.querySelector(selector) : null;
14
+ }
12
15
  function closest(node, selector, stopAt) {
13
16
  var found = node && node.nodeType === 1 ? node.closest(selector) : null;
14
17
  if (found && stopAt && found !== stopAt && !stopAt.contains(found)) {
@@ -96,9 +99,27 @@
96
99
  var triggerClass = "ge-" + kind + "-trigger";
97
100
  var orphanClass = "ge-" + kind + "-orphan";
98
101
  var listening = null;
102
+ var STATE_ATTRIBUTES = ["style", "aria-hidden", "aria-modal", "role"];
103
+ var STATE_CLASSES = ["show", "showing", "hiding"];
104
+ var before = /* @__PURE__ */ new Map();
105
+ var dismisses = [];
106
+ var saved = /* @__PURE__ */ new Map();
107
+ var phases = /* @__PURE__ */ new Map();
108
+ var watching = null;
109
+ var pending = /* @__PURE__ */ new Map();
110
+ var PHASES = { show: "opening", shown: "open", hide: "closing" };
99
111
  function idOf(container) {
100
112
  return container.getAttribute(idAttribute);
101
113
  }
114
+ function targetOf(container) {
115
+ var id = idOf(container);
116
+ return all(container, "[id]").filter(function(node) {
117
+ return node.id === id;
118
+ })[0] || null;
119
+ }
120
+ function targets() {
121
+ return all(ge.canvas, "[" + idAttribute + "]").map(targetOf).filter(Boolean);
122
+ }
102
123
  function exists(id, root) {
103
124
  return all(root || ge.canvas, "[" + idAttribute + "]").some(function(container) {
104
125
  return idOf(container) === id;
@@ -131,12 +152,9 @@
131
152
  });
132
153
  });
133
154
  }
134
- function write(root) {
135
- root = root || ge.canvas;
155
+ function arm(root) {
136
156
  all(root, "[" + targetAttribute + "]").forEach(function(trigger) {
137
157
  var wanted = trigger.getAttribute(targetAttribute);
138
- removeClass(trigger, orphanClass);
139
- dropEmptyClass(trigger);
140
158
  if (!exists(wanted, root)) {
141
159
  return;
142
160
  }
@@ -144,6 +162,141 @@
144
162
  trigger.setAttribute("data-bs-target", "#" + wanted);
145
163
  });
146
164
  }
165
+ function disarm() {
166
+ all(ge.canvas, "[" + targetAttribute + "]").forEach(function(trigger) {
167
+ trigger.removeAttribute("data-bs-toggle");
168
+ trigger.removeAttribute("data-bs-target");
169
+ });
170
+ }
171
+ function write(root) {
172
+ root = root || ge.canvas;
173
+ all(root, "[" + targetAttribute + "]").forEach(function(trigger) {
174
+ removeClass(trigger, orphanClass);
175
+ dropEmptyClass(trigger);
176
+ });
177
+ arm(root);
178
+ var quiet = /* @__PURE__ */ new Map();
179
+ before.forEach(function(state, target) {
180
+ quiet.set(target.id, state);
181
+ });
182
+ pending.forEach(function(state, target) {
183
+ quiet.set(target.id, state);
184
+ });
185
+ if (!quiet.size) {
186
+ return;
187
+ }
188
+ all(root, "[id]").forEach(function(node) {
189
+ if (quiet.has(node.id)) {
190
+ putState(node, quiet.get(node.id));
191
+ }
192
+ });
193
+ }
194
+ function stateOf(target) {
195
+ var state = { classes: STATE_CLASSES.filter(function(name) {
196
+ return hasClass(target, name);
197
+ }) };
198
+ STATE_ATTRIBUTES.forEach(function(name) {
199
+ state[name] = target.getAttribute(name);
200
+ });
201
+ return state;
202
+ }
203
+ function putState(target, state) {
204
+ STATE_CLASSES.forEach(function(name) {
205
+ toggleClass(target, name, state.classes.indexOf(name) !== -1);
206
+ });
207
+ STATE_ATTRIBUTES.forEach(function(name) {
208
+ target.getAttribute(name);
209
+ if (state[name] === null) {
210
+ target.removeAttribute(name);
211
+ } else {
212
+ target.setAttribute(name, state[name]);
213
+ }
214
+ });
215
+ }
216
+ function startPreview() {
217
+ dismisses = [];
218
+ targets().forEach(function(target) {
219
+ if (!before.has(target)) {
220
+ before.set(target, stateOf(target));
221
+ }
222
+ all(target, '[data-ge-bs-dismiss="' + toggle + '"]').forEach(function(dismiss) {
223
+ ge.resumeToggles(dismiss);
224
+ dismisses.push(dismiss);
225
+ });
226
+ });
227
+ arm(ge.canvas);
228
+ if (watching) {
229
+ watching.abort();
230
+ }
231
+ watching = new AbortController();
232
+ ["show", "shown", "hide", "hidden"].forEach(function(name) {
233
+ ge.canvas.addEventListener(name + ".bs." + toggle, function(e) {
234
+ if (!before.has(e.target)) {
235
+ return;
236
+ }
237
+ if (name === "hidden") {
238
+ phases.delete(e.target);
239
+ } else {
240
+ phases.set(e.target, PHASES[name]);
241
+ }
242
+ }, { signal: watching.signal });
243
+ });
244
+ }
245
+ function component() {
246
+ var bootstrap = window.bootstrap;
247
+ var name = toggle.charAt(0).toUpperCase() + toggle.slice(1);
248
+ return bootstrap && bootstrap[name] && bootstrap[name].getInstance ? bootstrap[name] : null;
249
+ }
250
+ function closer(target) {
251
+ var Component = component();
252
+ var instance = Component ? Component.getInstance(target) : null;
253
+ if (instance) {
254
+ return function() {
255
+ instance.hide();
256
+ };
257
+ }
258
+ var dismiss = one(target, '[data-bs-dismiss="' + toggle + '"], [data-ge-bs-dismiss="' + toggle + '"]');
259
+ if (!dismiss) {
260
+ return null;
261
+ }
262
+ return function() {
263
+ ge.resumeToggles(dismiss);
264
+ dismiss.click();
265
+ ge.suspendToggles(dismiss);
266
+ };
267
+ }
268
+ function endPreview() {
269
+ if (watching) {
270
+ watching.abort();
271
+ }
272
+ watching = null;
273
+ before.forEach(function(state, target) {
274
+ var phase = phases.get(target);
275
+ var close = phase && phase !== "closing" ? closer(target) : null;
276
+ var restore = function() {
277
+ pending.delete(target);
278
+ putState(target, state);
279
+ };
280
+ if (!phase || phase !== "closing" && !close) {
281
+ restore();
282
+ return;
283
+ }
284
+ pending.set(target, state);
285
+ target.addEventListener("hidden.bs." + toggle, restore, { once: true });
286
+ if (phase === "opening") {
287
+ target.addEventListener("shown.bs." + toggle, close, { once: true });
288
+ } else if (phase === "open") {
289
+ close();
290
+ }
291
+ });
292
+ before = /* @__PURE__ */ new Map();
293
+ phases = /* @__PURE__ */ new Map();
294
+ dismisses.forEach(function(dismiss) {
295
+ ge.suspendToggles(dismiss);
296
+ });
297
+ dismisses = [];
298
+ disarm();
299
+ }
147
300
  return {
148
301
  write,
149
302
  // Triggers are markup the host owns, anywhere in the canvas, so they
@@ -160,13 +313,35 @@
160
313
  e.preventDefault();
161
314
  }
162
315
  }, { signal: listening.signal });
316
+ if (ge.previewing()) {
317
+ var live = new Map(saved);
318
+ saved = /* @__PURE__ */ new Map();
319
+ startPreview();
320
+ live.forEach(function(state, target) {
321
+ if (ge.canvas.contains(target)) {
322
+ putState(target, state);
323
+ }
324
+ });
325
+ }
163
326
  },
164
327
  onDeinit: function() {
165
328
  if (listening) {
166
329
  listening.abort();
167
330
  }
168
331
  listening = null;
332
+ if (ge.previewing()) {
333
+ before.forEach(function(state, target) {
334
+ saved.set(target, stateOf(target));
335
+ });
336
+ }
169
337
  write();
338
+ },
339
+ onPreviewChange: function(previewing) {
340
+ if (previewing) {
341
+ startPreview();
342
+ } else {
343
+ endPreview();
344
+ }
170
345
  }
171
346
  };
172
347
  }
@@ -187,6 +362,8 @@
187
362
  references: ["data-ge-popup-id", "data-ge-popup-target"],
188
363
  onInit: triggers.onInit,
189
364
  onDeinit: triggers.onDeinit,
365
+ // The preview pressed, the triggers open the real thing; let go, it closes
366
+ onPreviewChange: triggers.onPreviewChange,
190
367
  // What onDeinit and unmark do, on a copy of the canvas
191
368
  cleanMarkup: function(root) {
192
369
  var definition = this;
@@ -1 +1 @@
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 f(t,n){return t?Array.prototype.slice.call(t.querySelectorAll(n)):[]}function O(t,n,e){var r=t&&t.nodeType===1?t.closest(n):null;return r&&e&&r!==e&&!e.contains(r)?null:r}function _(t){var n=document.createElement("template");return n.innerHTML=t,Array.prototype.slice.call(n.content.childNodes)}function C(t){for(var n=_(t.trim()),e=0;e<n.length;e++)if(n[e].nodeType===1)return n[e];return null}function s(t,n,e){var r=document.createElement(t);return Object.keys(n||{}).forEach(function(a){var l=n[a];l!=null&&l!==!1&&r.setAttribute(a,l)}),e!=null&&(r.textContent=e),r}function g(t,n){return v(n).forEach(function(e){t.classList.add(e)}),t}function d(t,n){return v(n).forEach(function(e){t.classList.remove(e)}),t}function E(t,n,e){return v(n).forEach(function(r){e===void 0?t.classList.toggle(r):t.classList.toggle(r,!!e)}),t}function w(t,n){return!!t&&t.nodeType===1&&t.classList.contains(n)}function v(t){return String(t||"").split(/\s+/).filter(Boolean)}function T(t){return t.getAttribute("class")||t.removeAttribute("class"),t}function A(t,n,e,r,a){var l=function(u){var i=O(u.target,e,t);if(i&&t.contains(i))return r.call(i,u)};return v(n).forEach(function(u){t.addEventListener(u,l,a)}),l}function B(t,n,e,r,a){var l="ge-"+n+"-trigger",u="ge-"+n+"-orphan",i=null;function m(o){return o.getAttribute(e)}function x(o,p){return f(p||t.canvas,"["+e+"]").some(function(c){return m(c)===o})}function L(){f(t.canvas,"["+r+"]").forEach(function(o){g(o,l);var p=o.getAttribute(r);if(o.removeAttribute("data-bs-toggle"),o.removeAttribute("data-bs-target"),x(p)){d(o,u);return}var c=o.closest(".column"),b=c?f(c,"["+e+"]"):[];if(b.length===1){o.setAttribute(r,m(b[0])),d(o,u);return}g(o,u),t.operate(function(){t.emit(n+"-orphan",t.payloadFor(n,o,{parent:o.parentElement,source:"api",missing:p}))})})}function y(o){o=o||t.canvas,f(o,"["+r+"]").forEach(function(p){var c=p.getAttribute(r);d(p,u),T(p),x(c,o)&&(p.setAttribute("data-bs-toggle",a),p.setAttribute("data-bs-target","#"+c))})}return{write:y,onInit:function(){L(),i&&i.abort(),i=new AbortController,A(t.canvas,"click","."+l+", ["+r+"]",function(o){w(t.canvas,"ge-editing")&&o.preventDefault()},{signal:i.signal})},onDeinit:function(){i&&i.abort(),i=null,y()}}}Object.assign(h.locales.en,{"container.add_popup":"Popup","container.popup_title":"Title","container.popup_trigger":"Open","tool.toggle_popup":"Fold this popup away while editing"});h.containers.popup=function(t){var n=B(t,"popup","data-ge-popup-id","data-ge-popup-target","modal");return{labelKey:"container.add_popup",paneKind:"popup",references:["data-ge-popup-id","data-ge-popup-target"],onInit:n.onInit,onDeinit:n.onDeinit,cleanMarkup:function(e){var r=this;n.write(e),f(e,'[data-ge-container="popup"]').forEach(function(a){r.unmark(a)})},create:function(e){var r=t.containerId("popup"),a=s("div",{"data-ge-container":"popup","data-ge-popup-id":r});e.trigger!==!1&&a.appendChild(s("button",{type:"button",class:"btn btn-primary ge-popup-trigger","data-ge-popup-target":r},e.trigger_label||t.t("container.popup_trigger")));var l=a.appendChild(s("div",{class:"modal fade",tabindex:"-1","aria-hidden":"true",id:r})),u=l.appendChild(s("div",{class:"modal-dialog"}));e.size&&g(u,"modal-"+e.size);var i=u.appendChild(s("div",{class:"modal-content"})),m=i.appendChild(s("div",{class:"modal-header"}));return m.appendChild(s("h5",{class:"modal-title"})).appendChild(s("span",{class:"ge-pane-label"},e.title||t.t("container.popup_title"))),m.appendChild(C('<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>')),i.appendChild(s("div",{class:"modal-body"})).appendChild(t.defaultRegion()),a},mark:function(e){f(e,"[data-bs-dismiss]").forEach(function(r){t.suspendToggles(r)}),f(e,".modal-title").forEach(function(r){t.makeLabelEditable(t.labelIn(r))})},unmark:function(e){t.resumeToggles(e),d(e,"ge-popup-collapsed"),t.unwrapLabels(e)},tools:function(e,r){t.createTool(e,t.t("tool.toggle_popup"),"ge-toggle-popup","bi bi-chevron-bar-contract",function(){E(r,"ge-popup-collapsed")})}}};})();
1
+ (()=>{var b=window.GridEditor;if(!b||typeof b.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 s(e,o){return e?Array.prototype.slice.call(e.querySelectorAll(o)):[]}function D(e,o){return e?e.querySelector(o):null}function Q(e,o,r){var a=e&&e.nodeType===1?e.closest(o):null;return a&&r&&a!==r&&!r.contains(a)?null:a}function V(e){var o=document.createElement("template");return o.innerHTML=e,Array.prototype.slice.call(o.content.childNodes)}function H(e){for(var o=V(e.trim()),r=0;r<o.length;r++)if(o[r].nodeType===1)return o[r];return null}function d(e,o,r){var a=document.createElement(e);return Object.keys(o||{}).forEach(function(l){var c=o[l];c!=null&&c!==!1&&a.setAttribute(l,c)}),r!=null&&(a.textContent=r),a}function E(e,o){return C(o).forEach(function(r){e.classList.add(r)}),e}function v(e,o){return C(o).forEach(function(r){e.classList.remove(r)}),e}function y(e,o,r){return C(o).forEach(function(a){r===void 0?e.classList.toggle(a):e.classList.toggle(a,!!r)}),e}function B(e,o){return!!e&&e.nodeType===1&&e.classList.contains(o)}function C(e){return String(e||"").split(/\s+/).filter(Boolean)}function F(e){return e.getAttribute("class")||e.removeAttribute("class"),e}function N(e,o,r,a,l){var c=function(p){var f=Q(p.target,r,e);if(f&&e.contains(f))return a.call(f,p)};return C(o).forEach(function(p){e.addEventListener(p,c,l)}),c}function U(e,o,r,a,l){var c="ge-"+o+"-trigger",p="ge-"+o+"-orphan",f=null,g=["style","aria-hidden","aria-modal","role"],O=["show","showing","hiding"],m=new Map,w=[],T=new Map,x=new Map,h=null,A=new Map,q={show:"opening",shown:"open",hide:"closing"};function S(n){return n.getAttribute(r)}function z(n){var t=S(n);return s(n,"[id]").filter(function(i){return i.id===t})[0]||null}function G(){return s(e.canvas,"["+r+"]").map(z).filter(Boolean)}function M(n,t){return s(t||e.canvas,"["+r+"]").some(function(i){return S(i)===n})}function K(){s(e.canvas,"["+a+"]").forEach(function(n){E(n,c);var t=n.getAttribute(a);if(n.removeAttribute("data-bs-toggle"),n.removeAttribute("data-bs-target"),M(t)){v(n,p);return}var i=n.closest(".column"),u=i?s(i,"["+r+"]"):[];if(u.length===1){n.setAttribute(a,S(u[0])),v(n,p);return}E(n,p),e.operate(function(){e.emit(o+"-orphan",e.payloadFor(o,n,{parent:n.parentElement,source:"api",missing:t}))})})}function _(n){s(n,"["+a+"]").forEach(function(t){var i=t.getAttribute(a);M(i,n)&&(t.setAttribute("data-bs-toggle",l),t.setAttribute("data-bs-target","#"+i))})}function W(){s(e.canvas,"["+a+"]").forEach(function(n){n.removeAttribute("data-bs-toggle"),n.removeAttribute("data-bs-target")})}function I(n){n=n||e.canvas,s(n,"["+a+"]").forEach(function(i){v(i,p),F(i)}),_(n);var t=new Map;m.forEach(function(i,u){t.set(u.id,i)}),A.forEach(function(i,u){t.set(u.id,i)}),t.size&&s(n,"[id]").forEach(function(i){t.has(i.id)&&L(i,t.get(i.id))})}function P(n){var t={classes:O.filter(function(i){return B(n,i)})};return g.forEach(function(i){t[i]=n.getAttribute(i)}),t}function L(n,t){O.forEach(function(i){y(n,i,t.classes.indexOf(i)!==-1)}),g.forEach(function(i){n.getAttribute(i),t[i]===null?n.removeAttribute(i):n.setAttribute(i,t[i])})}function k(){w=[],G().forEach(function(n){m.has(n)||m.set(n,P(n)),s(n,'[data-ge-bs-dismiss="'+l+'"]').forEach(function(t){e.resumeToggles(t),w.push(t)})}),_(e.canvas),h&&h.abort(),h=new AbortController,["show","shown","hide","hidden"].forEach(function(n){e.canvas.addEventListener(n+".bs."+l,function(t){m.has(t.target)&&(n==="hidden"?x.delete(t.target):x.set(t.target,q[n]))},{signal:h.signal})})}function X(){var n=window.bootstrap,t=l.charAt(0).toUpperCase()+l.slice(1);return n&&n[t]&&n[t].getInstance?n[t]:null}function Y(n){var t=X(),i=t?t.getInstance(n):null;if(i)return function(){i.hide()};var u=D(n,'[data-bs-dismiss="'+l+'"], [data-ge-bs-dismiss="'+l+'"]');return u?function(){e.resumeToggles(u),u.click(),e.suspendToggles(u)}:null}function J(){h&&h.abort(),h=null,m.forEach(function(n,t){var i=x.get(t),u=i&&i!=="closing"?Y(t):null,j=function(){A.delete(t),L(t,n)};if(!i||i!=="closing"&&!u){j();return}A.set(t,n),t.addEventListener("hidden.bs."+l,j,{once:!0}),i==="opening"?t.addEventListener("shown.bs."+l,u,{once:!0}):i==="open"&&u()}),m=new Map,x=new Map,w.forEach(function(n){e.suspendToggles(n)}),w=[],W()}return{write:I,onInit:function(){if(K(),f&&f.abort(),f=new AbortController,N(e.canvas,"click","."+c+", ["+a+"]",function(t){B(e.canvas,"ge-editing")&&t.preventDefault()},{signal:f.signal}),e.previewing()){var n=new Map(T);T=new Map,k(),n.forEach(function(t,i){e.canvas.contains(i)&&L(i,t)})}},onDeinit:function(){f&&f.abort(),f=null,e.previewing()&&m.forEach(function(n,t){T.set(t,P(t))}),I()},onPreviewChange:function(n){n?k():J()}}}Object.assign(b.locales.en,{"container.add_popup":"Popup","container.popup_title":"Title","container.popup_trigger":"Open","tool.toggle_popup":"Fold this popup away while editing"});b.containers.popup=function(e){var o=U(e,"popup","data-ge-popup-id","data-ge-popup-target","modal");return{labelKey:"container.add_popup",paneKind:"popup",references:["data-ge-popup-id","data-ge-popup-target"],onInit:o.onInit,onDeinit:o.onDeinit,onPreviewChange:o.onPreviewChange,cleanMarkup:function(r){var a=this;o.write(r),s(r,'[data-ge-container="popup"]').forEach(function(l){a.unmark(l)})},create:function(r){var a=e.containerId("popup"),l=d("div",{"data-ge-container":"popup","data-ge-popup-id":a});r.trigger!==!1&&l.appendChild(d("button",{type:"button",class:"btn btn-primary ge-popup-trigger","data-ge-popup-target":a},r.trigger_label||e.t("container.popup_trigger")));var c=l.appendChild(d("div",{class:"modal fade",tabindex:"-1","aria-hidden":"true",id:a})),p=c.appendChild(d("div",{class:"modal-dialog"}));r.size&&E(p,"modal-"+r.size);var f=p.appendChild(d("div",{class:"modal-content"})),g=f.appendChild(d("div",{class:"modal-header"}));return g.appendChild(d("h5",{class:"modal-title"})).appendChild(d("span",{class:"ge-pane-label"},r.title||e.t("container.popup_title"))),g.appendChild(H('<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>')),f.appendChild(d("div",{class:"modal-body"})).appendChild(e.defaultRegion()),l},mark:function(r){s(r,"[data-bs-dismiss]").forEach(function(a){e.suspendToggles(a)}),s(r,".modal-title").forEach(function(a){e.makeLabelEditable(e.labelIn(a))})},unmark:function(r){e.resumeToggles(r),v(r,"ge-popup-collapsed"),e.unwrapLabels(r)},tools:function(r,a){e.createTool(r,e.t("tool.toggle_popup"),"ge-toggle-popup","bi bi-chevron-bar-contract",function(){y(a,"ge-popup-collapsed")})}}};})();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/js/register.js", "../../src/js/dom.js", "../../src/js/triggers/triggers.js", "../../src/js/plugins/grideditor.popup.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 jQuery's: 400 ms unless the 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 * What the popup and the offcanvas plugins share: the host's triggers.\n *\n * A trigger is markup the host owns - a button, a link - anywhere in the\n * canvas, that points at a container by id. While editing it must not reach\n * Bootstrap, and one that points at nothing is warned about. Not a public\n * API: the build puts a copy of this file in each plugin that imports it,\n * so it keeps nothing of its own between plugins.\n */\nimport * as dom from '../dom.js';\n\n/**\n * The trigger handling of one kind of container.\n *\n * `kind` names the container (`popup`), its classes (`ge-popup-trigger`,\n * `ge-popup-orphan`) and the event for a trigger left pointing at nothing\n * (`popup-orphan`). `idAttribute` is the attribute a container has its id in,\n * `targetAttribute` the one a trigger names it with, and `toggle` is\n * Bootstrap's `data-bs-toggle` for it, written on the way out.\n *\n * Gives back `onInit` and `onDeinit`, for the plugin to hand the editor as\n * its own, and `write(root)`, what onDeinit does to the canvas, for\n * cleanMarkup to do to a copy.\n */\nexport function triggersFor(ge, kind, idAttribute, targetAttribute, toggle) {\n var triggerClass = 'ge-' + kind + '-trigger';\n var orphanClass = 'ge-' + kind + '-orphan';\n var listening = null;\n\n function idOf(container) {\n return container.getAttribute(idAttribute);\n }\n\n /** Whether a container with this id is on the canvas. */\n function exists(id, root) {\n return dom.all(root || ge.canvas, '[' + idAttribute + ']').some(function(container) {\n return idOf(container) === id;\n });\n }\n\n function wire() {\n dom.all(ge.canvas, '[' + targetAttribute + ']').forEach(function(trigger) {\n dom.addClass(trigger, triggerClass);\n var wanted = trigger.getAttribute(targetAttribute);\n\n // Bootstrap's own attributes are written at getHtml time, not\n // while editing, so a click here cannot open a real container\n trigger.removeAttribute('data-bs-toggle');\n trigger.removeAttribute('data-bs-target');\n\n if (exists(wanted)) {\n dom.removeClass(trigger, orphanClass);\n return;\n }\n\n var column = trigger.closest('.column');\n var nearby = column ? dom.all(column, '[' + idAttribute + ']') : [];\n\n if (nearby.length === 1) {\n trigger.setAttribute(targetAttribute, idOf(nearby[0]));\n dom.removeClass(trigger, orphanClass);\n return;\n }\n\n dom.addClass(trigger, orphanClass);\n\n ge.operate(function() {\n ge.emit(kind + '-orphan', ge.payloadFor(kind, trigger, {\n parent: trigger.parentElement,\n source: 'api',\n missing: wanted,\n }));\n });\n });\n }\n\n function write(root) {\n root = root || ge.canvas;\n\n dom.all(root, '[' + targetAttribute + ']').forEach(function(trigger) {\n var wanted = trigger.getAttribute(targetAttribute);\n\n // The warning marking is editing furniture, whether or not\n // the trigger can be wired up\n dom.removeClass(trigger, orphanClass);\n dom.dropEmptyClass(trigger);\n\n if (!exists(wanted, root)) { return; }\n\n trigger.setAttribute('data-bs-toggle', toggle);\n trigger.setAttribute('data-bs-target', '#' + wanted);\n });\n }\n\n return {\n write: write,\n\n // Triggers are markup the host owns, anywhere in the canvas, so they\n // are looked at whenever the canvas is initialized rather than only\n // when a container is touched\n onInit: function() {\n wire();\n\n if (listening) { listening.abort(); }\n listening = new AbortController();\n\n // A trigger is often a link, and a link still navigates even\n // with its Bootstrap attributes suspended\n dom.delegate(ge.canvas, 'click', '.' + triggerClass + ', [' + targetAttribute + ']', function(e) {\n if (dom.hasClass(ge.canvas, 'ge-editing')) { e.preventDefault(); }\n }, { signal: listening.signal });\n },\n\n onDeinit: function() {\n if (listening) { listening.abort(); }\n listening = null;\n\n write();\n },\n };\n}\n", "/**\n * Popups for grid-editor.\n *\n * A container plugin: load this file after the editor and the toolbar offers\n * a popup: a bootstrap modal and its trigger. 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.popup.min.js\"></script>\n */\nimport { GridEditor } from '../grideditor.js';\nimport * as dom from '../dom.js';\nimport { triggersFor } from '../triggers/triggers.js';\n\nObject.assign(GridEditor.locales.en, {\n 'container.add_popup': 'Popup',\n 'container.popup_title': 'Title',\n 'container.popup_trigger': 'Open',\n 'tool.toggle_popup': 'Fold this popup away while editing',\n});\n\nGridEditor.containers.popup = function(ge) {\n\n var triggers = triggersFor(ge, 'popup', 'data-ge-popup-id', 'data-ge-popup-target', 'modal');\n\n return {\n labelKey: 'container.add_popup',\n paneKind: 'popup',\n\n // The ids a copy of a popup has to rename together\n references: ['data-ge-popup-id', 'data-ge-popup-target'],\n\n onInit: triggers.onInit,\n onDeinit: triggers.onDeinit,\n\n // What onDeinit and unmark do, on a copy of the canvas\n cleanMarkup: function(root) {\n var definition = this;\n triggers.write(root);\n dom.all(root, '[data-ge-container=\"popup\"]').forEach(function(container) { definition.unmark(container); });\n },\n\n create: function(options) {\n var id = ge.containerId('popup');\n var container = dom.element('div', { 'data-ge-container': 'popup', 'data-ge-popup-id': id });\n\n if (options.trigger !== false) {\n container.appendChild(dom.element('button', {\n type: 'button',\n 'class': 'btn btn-primary ge-popup-trigger',\n 'data-ge-popup-target': id,\n }, options.trigger_label || ge.t('container.popup_trigger')));\n }\n\n var modal = container.appendChild(dom.element('div', {\n 'class': 'modal fade',\n tabindex: '-1',\n 'aria-hidden': 'true',\n id: id,\n }));\n var dialog = modal.appendChild(dom.element('div', { 'class': 'modal-dialog' }));\n if (options.size) { dom.addClass(dialog, 'modal-' + options.size); }\n\n var content = dialog.appendChild(dom.element('div', { 'class': 'modal-content' }));\n var header = content.appendChild(dom.element('div', { 'class': 'modal-header' }));\n header.appendChild(dom.element('h5', { 'class': 'modal-title' }))\n .appendChild(dom.element('span', { 'class': 'ge-pane-label' },\n options.title || ge.t('container.popup_title')));\n header.appendChild(dom.create('<button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\"></button>'));\n content.appendChild(dom.element('div', { 'class': 'modal-body' })).appendChild(ge.defaultRegion());\n\n return container;\n },\n\n mark: function(container) {\n // Nothing in a popup may reach Bootstrap while editing:\n // the modal is rendered unfolded and static, and a real\n // modal opening over it would be the editor fighting\n // itself\n dom.all(container, '[data-bs-dismiss]').forEach(function(dismiss) {\n ge.suspendToggles(dismiss);\n });\n dom.all(container, '.modal-title').forEach(function(title) {\n ge.makeLabelEditable(ge.labelIn(title));\n });\n },\n\n unmark: function(container) {\n ge.resumeToggles(container);\n dom.removeClass(container, 'ge-popup-collapsed');\n ge.unwrapLabels(container);\n },\n\n /** A page of unfolded modals stays workable if they can be folded away. */\n tools: function(drawer, container) {\n ge.createTool(drawer, ge.t('tool.toggle_popup'), 'ge-toggle-popup', 'bi bi-chevron-bar-contract',\n function() {\n dom.toggleClass(container, 'ge-popup-collapsed');\n });\n },\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,OAAOD,EAAO,MAAM,UAAU,MAAM,KAAKA,EAAK,iBAAiBC,CAAQ,CAAC,EAAI,CAAC,CACjF,CA+BO,SAASC,EAAQC,EAAMC,EAAUC,EAAQ,CAC5C,IAAIC,EAAQH,GAAQA,EAAK,WAAa,EAAIA,EAAK,QAAQC,CAAQ,EAAI,KAEnE,OAAIE,GAASD,GAAUC,IAAUD,GAAU,CAACA,EAAO,SAASC,CAAK,EAAY,KACtEA,CACX,CAoCO,SAASC,EAAMC,E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AC,EACvDc,EAAO,YAAgBC,EAAO,8FAA8F,CAAC,EAC7HF,EAAQ,YAAgBJ,EAAQ,MAAO,CAAE,MAAS,YAAa,CAAC,CAAC,EAAE,YAAYT,EAAG,cAAc,CAAC,EAE1FM,CACX,EAEA,KAAM,SAASA,EAAW,CAKlBD,EAAIC,EAAW,mBAAmB,EAAE,QAAQ,SAASU,EAAS,CAC9DhB,EAAG,eAAegB,CAAO,CAC7B,CAAC,EACGX,EAAIC,EAAW,cAAc,EAAE,QAAQ,SAASW,EAAO,CACvDjB,EAAG,kBAAkBA,EAAG,QAAQiB,CAAK,CAAC,CAC1C,CAAC,CACL,EAEA,OAAQ,SAASX,EAAW,CACxBN,EAAG,cAAcM,CAAS,EACtBY,EAAYZ,EAAW,oBAAoB,EAC/CN,EAAG,aAAaM,CAAS,CAC7B,EAGA,MAAO,SAASa,EAAQb,EAAW,CAC/BN,EAAG,WAAWmB,EAAQnB,EAAG,EAAE,mBAAmB,EAAG,kBAAmB,6BAChE,UAAW,CACHoB,EAAYd,EAAW,oBAAoB,CACnD,CAAC,CACT,CACJ,CACJ",
6
- "names": ["GridEditor", "all", "root", "selector", "closest", "node", "selector", "stopAt", "found", "parse", "html", "template", "create", "nodes", "i", "element", "tag", "attributes", "text", "node", "name", "value", "addClass", "node", "names", "split", "name", "removeClass", "toggleClass", "state", "hasClass", "dropEmptyClass", "delegate", "root", "types", "selector", "handler", "options", "listener", "event", "match", "closest", "split", "type", "triggersFor", "ge", "kind", "idAttribute", "targetAttribute", "toggle", "triggerClass", "orphanClass", "listening", "idOf", "container", "exists", "id", "root", "all", "wire", "trigger", "addClass", "wanted", "removeClass", "column", "nearby", "write", "dropEmptyClass", "delegate", "e", "hasClass", "GridEditor", "ge", "triggers", "triggersFor", "root", "definition", "all", "container", "options", "id", "element", "modal", "dialog", "addClass", "content", "header", "create", "dismiss", "title", "removeClass", "drawer", "toggleClass"]
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 jQuery's: 400 ms unless the 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 * What the popup and the offcanvas plugins share: the host's triggers.\n *\n * A trigger is markup the host owns - a button, a link - anywhere in the\n * canvas, that points at a container by id. While editing it must not reach\n * Bootstrap, and one that points at nothing is warned about. With the\n * preview button pressed it does reach it, and opens the container as the\n * page will, until the button is let go. Not a public\n * API: the build puts a copy of this file in each plugin that imports it,\n * so it keeps nothing of its own between plugins.\n */\nimport * as dom from '../dom.js';\n\n/**\n * The trigger handling of one kind of container.\n *\n * `kind` names the container (`popup`), its classes (`ge-popup-trigger`,\n * `ge-popup-orphan`) and the event for a trigger left pointing at nothing\n * (`popup-orphan`). `idAttribute` is the attribute a container has its id in,\n * `targetAttribute` the one a trigger names it with, and `toggle` is\n * Bootstrap's `data-bs-toggle` for it, written on the way out.\n *\n * Gives back `onInit`, `onDeinit` and `onPreviewChange`, for the plugin to\n * hand the editor as its own, and `write(root)`, what onDeinit does to the\n * canvas, for cleanMarkup to do to a copy.\n */\nexport function triggersFor(ge, kind, idAttribute, targetAttribute, toggle) {\n var triggerClass = 'ge-' + kind + '-trigger';\n var orphanClass = 'ge-' + kind + '-orphan';\n var listening = null;\n\n // What Bootstrap changes on a container as it opens and closes it\n var STATE_ATTRIBUTES = ['style', 'aria-hidden', 'aria-modal', 'role'];\n var STATE_CLASSES = ['show', 'showing', 'hiding'];\n // Each container's element as the preview found it: what it goes back to\n var before = new Map();\n // The dismisses the preview gave back to Bootstrap, to take away again\n var dismisses = [];\n // What a getHtml in the middle of a preview took off, for onInit to put back\n var saved = new Map();\n // Where Bootstrap is with each container it has been asked to open:\n // opening, open or closing, as its events tell. Not there once closed\n var phases = new Map();\n var watching = null;\n // Let go of while Bootstrap was still closing them: what they go back to once it is done\n var pending = new Map();\n var PHASES = { show: 'opening', shown: 'open', hide: 'closing' };\n\n function idOf(container) {\n return container.getAttribute(idAttribute);\n }\n\n /** The modal, the panel: the element in a container with the container's id. */\n function targetOf(container) {\n var id = idOf(container);\n\n return dom.all(container, '[id]').filter(function(node) { return node.id === id; })[0] || null;\n }\n\n function targets() {\n return dom.all(ge.canvas, '[' + idAttribute + ']').map(targetOf).filter(Boolean);\n }\n\n /** Whether a container with this id is on the canvas. */\n function exists(id, root) {\n return dom.all(root || ge.canvas, '[' + idAttribute + ']').some(function(container) {\n return idOf(container) === id;\n });\n }\n\n function wire() {\n dom.all(ge.canvas, '[' + targetAttribute + ']').forEach(function(trigger) {\n dom.addClass(trigger, triggerClass);\n var wanted = trigger.getAttribute(targetAttribute);\n\n // Bootstrap's own attributes are written at getHtml time, not\n // while editing, so a click here cannot open a real container\n trigger.removeAttribute('data-bs-toggle');\n trigger.removeAttribute('data-bs-target');\n\n if (exists(wanted)) {\n dom.removeClass(trigger, orphanClass);\n return;\n }\n\n var column = trigger.closest('.column');\n var nearby = column ? dom.all(column, '[' + idAttribute + ']') : [];\n\n if (nearby.length === 1) {\n trigger.setAttribute(targetAttribute, idOf(nearby[0]));\n dom.removeClass(trigger, orphanClass);\n return;\n }\n\n dom.addClass(trigger, orphanClass);\n\n ge.operate(function() {\n ge.emit(kind + '-orphan', ge.payloadFor(kind, trigger, {\n parent: trigger.parentElement,\n source: 'api',\n missing: wanted,\n }));\n });\n });\n }\n\n /** Bootstrap's own attributes on the triggers that point at something. */\n function arm(root) {\n dom.all(root, '[' + targetAttribute + ']').forEach(function(trigger) {\n var wanted = trigger.getAttribute(targetAttribute);\n if (!exists(wanted, root)) { return; }\n\n trigger.setAttribute('data-bs-toggle', toggle);\n trigger.setAttribute('data-bs-target', '#' + wanted);\n });\n }\n\n function disarm() {\n dom.all(ge.canvas, '[' + targetAttribute + ']').forEach(function(trigger) {\n trigger.removeAttribute('data-bs-toggle');\n trigger.removeAttribute('data-bs-target');\n });\n }\n\n function write(root) {\n root = root || ge.canvas;\n\n // The warning marking is editing furniture, whether or not\n // the trigger can be wired up\n dom.all(root, '[' + targetAttribute + ']').forEach(function(trigger) {\n dom.removeClass(trigger, orphanClass);\n dom.dropEmptyClass(trigger);\n });\n\n arm(root);\n\n // A container the preview opened is read as the preview found it,\n // whether the preview goes on or Bootstrap is still closing it\n var quiet = new Map();\n before.forEach(function(state, target) { quiet.set(target.id, state); });\n pending.forEach(function(state, target) { quiet.set(target.id, state); });\n if (!quiet.size) { return; }\n\n dom.all(root, '[id]').forEach(function(node) {\n if (quiet.has(node.id)) { putState(node, quiet.get(node.id)); }\n });\n }\n\n /** What Bootstrap may change on a container, as it is now. */\n function stateOf(target) {\n var state = { classes: STATE_CLASSES.filter(function(name) { return dom.hasClass(target, name); }) };\n STATE_ATTRIBUTES.forEach(function(name) { state[name] = target.getAttribute(name); });\n return state;\n }\n\n function putState(target, state) {\n STATE_CLASSES.forEach(function(name) { dom.toggleClass(target, name, state.classes.indexOf(name) !== -1); });\n STATE_ATTRIBUTES.forEach(function(name) {\n // Read first: a style Bootstrap last wrote through the element's\n // style object is only written to the attribute when it is read,\n // and would otherwise come back, empty, after it is taken off\n target.getAttribute(name);\n\n if (state[name] === null) {\n target.removeAttribute(name);\n } else {\n target.setAttribute(name, state[name]);\n }\n });\n }\n\n /**\n * The preview pressed: the triggers reach Bootstrap, and so do the\n * container's own close buttons, which editing keeps from it.\n */\n function startPreview() {\n // Again after a getHtml, whose init took them away once more\n dismisses = [];\n targets().forEach(function(target) {\n if (!before.has(target)) { before.set(target, stateOf(target)); }\n\n dom.all(target, '[data-ge-bs-dismiss=\"' + toggle + '\"]').forEach(function(dismiss) {\n ge.resumeToggles(dismiss);\n dismisses.push(dismiss);\n });\n });\n arm(ge.canvas);\n\n if (watching) { watching.abort(); }\n watching = new AbortController();\n ['show', 'shown', 'hide', 'hidden'].forEach(function(name) {\n ge.canvas.addEventListener(name + '.bs.' + toggle, function(e) {\n if (!before.has(e.target)) { return; }\n\n if (name === 'hidden') {\n phases.delete(e.target);\n } else {\n phases.set(e.target, PHASES[name]);\n }\n }, { signal: watching.signal });\n });\n }\n\n /** Bootstrap's component for this kind, when the page has it on window. */\n function component() {\n var bootstrap = window.bootstrap;\n var name = toggle.charAt(0).toUpperCase() + toggle.slice(1);\n\n return bootstrap && bootstrap[name] && bootstrap[name].getInstance ? bootstrap[name] : null;\n }\n\n /**\n * Ask Bootstrap to close a container: through its instance, or, for a\n * page with no window.bootstrap - an app that imports it - through its\n * own close button, which its data api still listens for.\n */\n function closer(target) {\n var Component = component();\n var instance = Component ? Component.getInstance(target) : null;\n if (instance) { return function() { instance.hide(); }; }\n\n var dismiss = dom.one(target, '[data-bs-dismiss=\"' + toggle + '\"], [data-ge-bs-dismiss=\"' + toggle + '\"]');\n if (!dismiss) { return null; }\n\n return function() {\n ge.resumeToggles(dismiss);\n dismiss.click();\n ge.suspendToggles(dismiss);\n };\n }\n\n /**\n * The preview let go: an open container is closed, by Bootstrap so its\n * backdrop and the page's scroll go back too, and each is left as the\n * preview found it once Bootstrap is done with it. One still opening is\n * closed when it has opened, as Bootstrap will not close it before.\n */\n function endPreview() {\n if (watching) { watching.abort(); }\n watching = null;\n\n before.forEach(function(state, target) {\n var phase = phases.get(target);\n var close = phase && phase !== 'closing' ? closer(target) : null;\n var restore = function() {\n pending.delete(target);\n putState(target, state);\n };\n\n if (!phase || (phase !== 'closing' && !close)) {\n restore();\n return;\n }\n\n pending.set(target, state);\n target.addEventListener('hidden.bs.' + toggle, restore, { once: true });\n if (phase === 'opening') {\n target.addEventListener('shown.bs.' + toggle, close, { once: true });\n } else if (phase === 'open') {\n close();\n }\n });\n before = new Map();\n phases = new Map();\n\n dismisses.forEach(function(dismiss) { ge.suspendToggles(dismiss); });\n dismisses = [];\n disarm();\n }\n\n return {\n write: write,\n\n // Triggers are markup the host owns, anywhere in the canvas, so they\n // are looked at whenever the canvas is initialized rather than only\n // when a container is touched\n onInit: function() {\n wire();\n\n if (listening) { listening.abort(); }\n listening = new AbortController();\n\n // A trigger is often a link, and a link still navigates even\n // with its Bootstrap attributes suspended\n dom.delegate(ge.canvas, 'click', '.' + triggerClass + ', [' + targetAttribute + ']', function(e) {\n if (dom.hasClass(ge.canvas, 'ge-editing')) { e.preventDefault(); }\n }, { signal: listening.signal });\n\n // A getHtml in the middle of a preview: back to what it was\n if (ge.previewing()) {\n var live = new Map(saved);\n saved = new Map();\n startPreview();\n live.forEach(function(state, target) {\n if (ge.canvas.contains(target)) { putState(target, state); }\n });\n }\n },\n\n onDeinit: function() {\n if (listening) { listening.abort(); }\n listening = null;\n\n // In the middle of a preview, write reads the markup as the\n // preview found it, not with a container open: onInit puts it back\n if (ge.previewing()) {\n before.forEach(function(state, target) { saved.set(target, stateOf(target)); });\n }\n\n write();\n },\n\n onPreviewChange: function(previewing) {\n if (previewing) {\n startPreview();\n } else {\n endPreview();\n }\n },\n };\n}\n", "/**\n * Popups for grid-editor.\n *\n * A container plugin: load this file after the editor and the toolbar offers\n * a popup: a bootstrap modal and its trigger. 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.popup.min.js\"></script>\n */\nimport { GridEditor } from '../grideditor.js';\nimport * as dom from '../dom.js';\nimport { triggersFor } from '../triggers/triggers.js';\n\nObject.assign(GridEditor.locales.en, {\n 'container.add_popup': 'Popup',\n 'container.popup_title': 'Title',\n 'container.popup_trigger': 'Open',\n 'tool.toggle_popup': 'Fold this popup away while editing',\n});\n\nGridEditor.containers.popup = function(ge) {\n\n var triggers = triggersFor(ge, 'popup', 'data-ge-popup-id', 'data-ge-popup-target', 'modal');\n\n return {\n labelKey: 'container.add_popup',\n paneKind: 'popup',\n\n // The ids a copy of a popup has to rename together\n references: ['data-ge-popup-id', 'data-ge-popup-target'],\n\n onInit: triggers.onInit,\n onDeinit: triggers.onDeinit,\n // The preview pressed, the triggers open the real thing; let go, it closes\n onPreviewChange: triggers.onPreviewChange,\n\n // What onDeinit and unmark do, on a copy of the canvas\n cleanMarkup: function(root) {\n var definition = this;\n triggers.write(root);\n dom.all(root, '[data-ge-container=\"popup\"]').forEach(function(container) { definition.unmark(container); });\n },\n\n create: function(options) {\n var id = ge.containerId('popup');\n var container = dom.element('div', { 'data-ge-container': 'popup', 'data-ge-popup-id': id });\n\n if (options.trigger !== false) {\n container.appendChild(dom.element('button', {\n type: 'button',\n 'class': 'btn btn-primary ge-popup-trigger',\n 'data-ge-popup-target': id,\n }, options.trigger_label || ge.t('container.popup_trigger')));\n }\n\n var modal = container.appendChild(dom.element('div', {\n 'class': 'modal fade',\n tabindex: '-1',\n 'aria-hidden': 'true',\n id: id,\n }));\n var dialog = modal.appendChild(dom.element('div', { 'class': 'modal-dialog' }));\n if (options.size) { dom.addClass(dialog, 'modal-' + options.size); }\n\n var content = dialog.appendChild(dom.element('div', { 'class': 'modal-content' }));\n var header = content.appendChild(dom.element('div', { 'class': 'modal-header' }));\n header.appendChild(dom.element('h5', { 'class': 'modal-title' }))\n .appendChild(dom.element('span', { 'class': 'ge-pane-label' },\n options.title || ge.t('container.popup_title')));\n header.appendChild(dom.create('<button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\"></button>'));\n content.appendChild(dom.element('div', { 'class': 'modal-body' })).appendChild(ge.defaultRegion());\n\n return container;\n },\n\n mark: function(container) {\n // Nothing in a popup may reach Bootstrap while editing:\n // the modal is rendered unfolded and static, and a real\n // modal opening over it would be the editor fighting\n // itself\n dom.all(container, '[data-bs-dismiss]').forEach(function(dismiss) {\n ge.suspendToggles(dismiss);\n });\n dom.all(container, '.modal-title').forEach(function(title) {\n ge.makeLabelEditable(ge.labelIn(title));\n });\n },\n\n unmark: function(container) {\n ge.resumeToggles(container);\n dom.removeClass(container, 'ge-popup-collapsed');\n ge.unwrapLabels(container);\n },\n\n /** A page of unfolded modals stays workable if they can be folded away. */\n tools: function(drawer, container) {\n ge.createTool(drawer, ge.t('tool.toggle_popup'), 'ge-toggle-popup', 'bi bi-chevron-bar-contract',\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E,uBAAuB,CAAC,CAAC,EACvDc,EAAO,YAAgBC,EAAO,8FAA8F,CAAC,EAC7HF,EAAQ,YAAgBJ,EAAQ,MAAO,CAAE,MAAS,YAAa,CAAC,CAAC,EAAE,YAAYT,EAAG,cAAc,CAAC,EAE1FM,CACX,EAEA,KAAM,SAASA,EAAW,CAKlBD,EAAIC,EAAW,mBAAmB,EAAE,QAAQ,SAASU,EAAS,CAC9DhB,EAAG,eAAegB,CAAO,CAC7B,CAAC,EACGX,EAAIC,EAAW,cAAc,EAAE,QAAQ,SAASW,EAAO,CACvDjB,EAAG,kBAAkBA,EAAG,QAAQiB,CAAK,CAAC,CAC1C,CAAC,CACL,EAEA,OAAQ,SAASX,EAAW,CACxBN,EAAG,cAAcM,CAAS,EACtBY,EAAYZ,EAAW,oBAAoB,EAC/CN,EAAG,aAAaM,CAAS,CAC7B,EAGA,MAAO,SAASa,EAAQb,EAAW,CAC/BN,EAAG,WAAWmB,EAAQnB,EAAG,EAAE,mBAAmB,EAAG,kBAAmB,6BAChE,UAAW,CACHoB,EAAYd,EAAW,oBAAoB,CACnD,CAAC,CACT,CACJ,CACJ",
6
+ "names": ["GridEditor", "all", "root", "selector", "one", "closest", "node", "selector", "stopAt", "found", "parse", "html", "template", "create", "nodes", "i", "element", "tag", "attributes", "text", "node", "name", "value", "addClass", "node", "names", "split", "name", "removeClass", "toggleClass", "state", "hasClass", "dropEmptyClass", "delegate", "root", "types", "selector", "handler", "options", "listener", "event", "match", "closest", "split", "type", "triggersFor", "ge", "kind", "idAttribute", "targetAttribute", "toggle", "triggerClass", "orphanClass", "listening", "STATE_ATTRIBUTES", "STATE_CLASSES", "before", "dismisses", "saved", "phases", "watching", "pending", "PHASES", "idOf", "container", "targetOf", "id", "all", "node", "targets", "exists", "root", "wire", "trigger", "addClass", "wanted", "removeClass", "column", "nearby", "arm", "disarm", "write", "dropEmptyClass", "quiet", "state", "target", "putState", "stateOf", "name", "hasClass", "toggleClass", "startPreview", "dismiss", "e", "component", "bootstrap", "closer", "Component", "instance", "one", "endPreview", "phase", "close", "restore", "delegate", "live", "previewing", "GridEditor", "ge", "triggers", "triggersFor", "root", "definition", "all", "container", "options", "id", "element", "modal", "dialog", "addClass", "content", "header", "create", "dismiss", "title", "removeClass", "drawer", "toggleClass"]
7
7
  }
package/docs/events.md CHANGED
@@ -92,6 +92,7 @@ about every insertion can bind `grideditor:before-add` and switch on
92
92
  | `grideditor:before-utility` | — | yes | before a utility class is written, from the panel, a plugin's tool or `setUtility` |
93
93
  | `grideditor:after-utility` | — | no | after the class is written and the preview redrawn, only if something changed |
94
94
  | `grideditor:view-change` | — | no | after the view changes, only if it actually changed |
95
+ | `grideditor:preview-change` | — | no | after the preview button is pressed or let go; not while it is only hovered |
95
96
  | `grideditor:target-change` | — | no | with `active_target`, after the column or section the toolbar adds to changes, only if it actually changed |
96
97
  | `grideditor:selection-change` | — | no | with `settings_panel: 'sidebar'`, after the node whose settings the sidebar shows changes, only if it actually changed |
97
98
  | `grideditor:after-copy` | — | no | with the clipboard plugin, after a node is copied: `source: 'tool'` from its Copy tool, `'shortcut'` from Ctrl+C |
@@ -177,6 +178,11 @@ The autosave events carry no node: `after-autosave` has `canvas`, `html`,
177
178
  `saveDraft()`, or `destroy` -, `after-restore-draft` has `canvas`, `html` and
178
179
  `savedAt`, and `autosave-error` has `canvas` and the `error` the storage threw.
179
180
 
181
+ `preview-change` carries no node either: its payload is `canvas` and
182
+ `previewing`, `true` when the button was pressed and `false` when it was let
183
+ go - by a click, or by the editor itself when the source view opens, when a
184
+ plugin replaces the canvas with `setHtml` (an undo does) and on `destroy`.
185
+
180
186
  `target-change` carries no node either: its payload is `canvas`, `target` - the
181
187
  column or section the toolbar adds to now, or `null` for the end of the canvas
182
188
  - and `from`, the one before. What a toolbar button then adds fires its add
package/docs/plugins.md CHANGED
@@ -80,6 +80,7 @@ GridEditor.containers.gallery = function(ge) {
80
80
  tools: function(drawer, container) { … }, // optional, extra tools
81
81
  onInit: function() { … }, // optional, per canvas init
82
82
  onDeinit: function() { … }, // optional, per canvas deinit
83
+ onPreviewChange: function(previewing) { … }, // optional, the preview button pressed or let go
83
84
  };
84
85
  };
85
86
  ```
@@ -122,6 +123,14 @@ written for 6.x.
122
123
  - **`onInit`/`onDeinit`** are for work that is about the whole canvas rather
123
124
  than one container — the popup and offcanvas plugins wire up the host's
124
125
  `data-ge-popup-target` and `data-ge-offcanvas-target` triggers there.
126
+ - **`onPreviewChange(previewing)`** is called when the preview button is
127
+ pressed (`true`) and let go (`false`), before the `preview-change` event; not
128
+ while it is only hovered. Pressed, the canvas has lost `ge-editing` and the
129
+ page's own controls may work: the popup and offcanvas plugins give their
130
+ triggers and close buttons back to Bootstrap, and on letting go close what
131
+ is open and put back what Bootstrap changed. A `getHtml` in the middle of a
132
+ preview runs `deinit` and `init` as ever, with `ge.previewing()` still true,
133
+ so an `onInit` can carry on with it.
125
134
  - **`references`** lists the attributes of the container's own that hold an id,
126
135
  as the id itself or as a `#selector`, which `ge.freshNode` renames along with
127
136
  the id they point at when a copy is made: a popup's `data-ge-popup-id` and
@@ -162,6 +171,7 @@ element, and where there may be several, an array.
162
171
  | `ge.operate(body)` | Run `body` as one operation, so a handler calling back in is queued |
163
172
  | `ge.kindOf(node)` | What an event calls a node: `row`, `column`, `element`, a container's type… |
164
173
  | `ge.view()` | The view being edited: a breakpoint key, or `'all'` |
174
+ | `ge.previewing()` | Whether the preview button is pressed: not when it is only hovered |
165
175
  | `ge.viewTiers()` | The breakpoint key that view writes: the one being edited, or `xs` - the class with no breakpoint - in the all view |
166
176
  | `ge.breakpoints` | Every breakpoint key, smallest first |
167
177
  | `ge.getUtility(node, family, view?)` | A utility's value, as in the public method |
package/package.json CHANGED
@@ -32,7 +32,7 @@
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
- "version": "9.0.0-beta.4",
35
+ "version": "9.0.0-beta.5",
36
36
  "main": "dist/grideditor.js",
37
37
  "module": "dist/grideditor.esm.js",
38
38
  "types": "dist/grideditor.d.ts",