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

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 (64) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +29 -17
  3. package/UPGRADING.md +24 -5
  4. package/dist/grideditor.bundle.min.js +3 -3
  5. package/dist/grideditor.css +5 -4
  6. package/dist/grideditor.d.ts +10 -15
  7. package/dist/grideditor.esm.js +151 -113
  8. package/dist/grideditor.jquery.js +1 -3
  9. package/dist/grideditor.jquery.min.js +1 -1
  10. package/dist/grideditor.jquery.min.js.map +2 -2
  11. package/dist/grideditor.js +151 -113
  12. package/dist/grideditor.min.css +1 -1
  13. package/dist/grideditor.min.css.map +1 -1
  14. package/dist/grideditor.min.js +2 -2
  15. package/dist/grideditor.min.js.map +3 -3
  16. package/dist/plugins/grideditor.accordion.esm.js +7 -0
  17. package/dist/plugins/grideditor.accordion.js +7 -0
  18. package/dist/plugins/grideditor.accordion.min.js +1 -1
  19. package/dist/plugins/grideditor.accordion.min.js.map +3 -3
  20. package/dist/plugins/grideditor.card.esm.js +4 -0
  21. package/dist/plugins/grideditor.card.js +4 -0
  22. package/dist/plugins/grideditor.card.min.js +1 -1
  23. package/dist/plugins/grideditor.card.min.js.map +3 -3
  24. package/dist/plugins/grideditor.carousel.esm.js +4 -0
  25. package/dist/plugins/grideditor.carousel.js +4 -0
  26. package/dist/plugins/grideditor.carousel.min.js +1 -1
  27. package/dist/plugins/grideditor.carousel.min.js.map +2 -2
  28. package/dist/plugins/grideditor.clipboard.esm.js +3 -18
  29. package/dist/plugins/grideditor.clipboard.js +3 -18
  30. package/dist/plugins/grideditor.clipboard.min.js +1 -1
  31. package/dist/plugins/grideditor.clipboard.min.js.map +3 -3
  32. package/dist/plugins/grideditor.history.esm.js +1 -6
  33. package/dist/plugins/grideditor.history.js +1 -6
  34. package/dist/plugins/grideditor.history.min.js +1 -1
  35. package/dist/plugins/grideditor.history.min.js.map +3 -3
  36. package/dist/plugins/grideditor.offcanvas.esm.js +185 -4
  37. package/dist/plugins/grideditor.offcanvas.js +185 -4
  38. package/dist/plugins/grideditor.offcanvas.min.js +1 -1
  39. package/dist/plugins/grideditor.offcanvas.min.js.map +3 -3
  40. package/dist/plugins/grideditor.popup.esm.js +185 -4
  41. package/dist/plugins/grideditor.popup.js +185 -4
  42. package/dist/plugins/grideditor.popup.min.js +1 -1
  43. package/dist/plugins/grideditor.popup.min.js.map +3 -3
  44. package/dist/plugins/grideditor.tabs.esm.js +4 -0
  45. package/dist/plugins/grideditor.tabs.js +4 -0
  46. package/dist/plugins/grideditor.tabs.min.js +1 -1
  47. package/dist/plugins/grideditor.tabs.min.js.map +2 -2
  48. package/docs/events.md +14 -11
  49. package/docs/plugins.md +20 -8
  50. package/example/clipboard.html +13 -10
  51. package/package.json +1 -1
  52. package/src/js/grideditor.jquery.js +0 -2
  53. package/src/js/grideditor.js +211 -125
  54. package/src/js/plugins/grideditor.accordion.js +9 -0
  55. package/src/js/plugins/grideditor.card.js +5 -0
  56. package/src/js/plugins/grideditor.carousel.js +5 -0
  57. package/src/js/plugins/grideditor.clipboard.js +11 -24
  58. package/src/js/plugins/grideditor.history.js +3 -6
  59. package/src/js/plugins/grideditor.offcanvas.js +8 -0
  60. package/src/js/plugins/grideditor.popup.js +7 -0
  61. package/src/js/plugins/grideditor.tabs.js +5 -0
  62. package/src/js/triggers/triggers.js +211 -11
  63. package/src/less/grideditor.less +5 -4
  64. package/types/grideditor.d.ts +10 -15
@@ -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
  }
@@ -183,10 +358,16 @@
183
358
  return {
184
359
  labelKey: "container.add_popup",
185
360
  paneKind: "popup",
361
+ // Where rows go: the popup's body
362
+ regionOf: function(container) {
363
+ return one(container, ".modal-body");
364
+ },
186
365
  // The ids a copy of a popup has to rename together
187
366
  references: ["data-ge-popup-id", "data-ge-popup-target"],
188
367
  onInit: triggers.onInit,
189
368
  onDeinit: triggers.onDeinit,
369
+ // The preview pressed, the triggers open the real thing; let go, it closes
370
+ onPreviewChange: triggers.onPreviewChange,
190
371
  // What onDeinit and unmark do, on a copy of the canvas
191
372
  cleanMarkup: function(root) {
192
373
  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 y(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 T(o).forEach(function(r){e.classList.add(r)}),e}function v(e,o){return T(o).forEach(function(r){e.classList.remove(r)}),e}function C(e,o,r){return T(o).forEach(function(a){r===void 0?e.classList.toggle(a):e.classList.toggle(a,!!r)}),e}function O(e,o){return!!e&&e.nodeType===1&&e.classList.contains(o)}function T(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 T(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"],M=["show","showing","hiding"],m=new Map,w=[],A=new Map,x=new Map,h=null,S=new Map,q={show:"opening",shown:"open",hide:"closing"};function L(n){return n.getAttribute(r)}function z(n){var t=L(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 _(n,t){return s(t||e.canvas,"["+r+"]").some(function(i){return L(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"),_(t)){v(n,p);return}var i=n.closest(".column"),u=i?s(i,"["+r+"]"):[];if(u.length===1){n.setAttribute(a,L(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 I(n){s(n,"["+a+"]").forEach(function(t){var i=t.getAttribute(a);_(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 P(n){n=n||e.canvas,s(n,"["+a+"]").forEach(function(i){v(i,p),F(i)}),I(n);var t=new Map;m.forEach(function(i,u){t.set(u.id,i)}),S.forEach(function(i,u){t.set(u.id,i)}),t.size&&s(n,"[id]").forEach(function(i){t.has(i.id)&&B(i,t.get(i.id))})}function k(n){var t={classes:M.filter(function(i){return O(n,i)})};return g.forEach(function(i){t[i]=n.getAttribute(i)}),t}function B(n,t){M.forEach(function(i){C(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 j(){w=[],G().forEach(function(n){m.has(n)||m.set(n,k(n)),s(n,'[data-ge-bs-dismiss="'+l+'"]').forEach(function(t){e.resumeToggles(t),w.push(t)})}),I(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=y(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,D=function(){S.delete(t),B(t,n)};if(!i||i!=="closing"&&!u){D();return}S.set(t,n),t.addEventListener("hidden.bs."+l,D,{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:P,onInit:function(){if(K(),f&&f.abort(),f=new AbortController,N(e.canvas,"click","."+c+", ["+a+"]",function(t){O(e.canvas,"ge-editing")&&t.preventDefault()},{signal:f.signal}),e.previewing()){var n=new Map(A);A=new Map,j(),n.forEach(function(t,i){e.canvas.contains(i)&&B(i,t)})}},onDeinit:function(){f&&f.abort(),f=null,e.previewing()&&m.forEach(function(n,t){A.set(t,k(t))}),P()},onPreviewChange:function(n){n?j():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",regionOf:function(r){return y(r,".modal-body")},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(){C(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,EAAM,CACxB,IAAIC,EAAW,SAAS,cAAc,UAAU,EAChD,OAAAA,EAAS,UAAYD,EACd,MAAM,UAAU,MAAM,KAAKC,EAAS,QAAQ,UAAU,CACjE,CAGO,SAASC,EAAOF,EAAM,CAGzB,QAFIG,EAAQJ,EAAMC,EAAK,KAAK,CAAC,EAEpBI,EAAI,EAAGA,EAAID,EAA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ASU,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 // Where rows go: the popup's body\n regionOf: function(container) {\n return dom.one(container, '.modal-body');\n },\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',\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,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E,MAAS,YAAa,CAAC,CAAC,EAAE,YAAYV,EAAG,cAAc,CAAC,EAE1FG,CACX,EAEA,KAAM,SAASA,EAAW,CAKlBI,EAAIJ,EAAW,mBAAmB,EAAE,QAAQ,SAASc,EAAS,CAC9DjB,EAAG,eAAeiB,CAAO,CAC7B,CAAC,EACGV,EAAIJ,EAAW,cAAc,EAAE,QAAQ,SAASe,EAAO,CACvDlB,EAAG,kBAAkBA,EAAG,QAAQkB,CAAK,CAAC,CAC1C,CAAC,CACL,EAEA,OAAQ,SAASf,EAAW,CACxBH,EAAG,cAAcG,CAAS,EACtBgB,EAAYhB,EAAW,oBAAoB,EAC/CH,EAAG,aAAaG,CAAS,CAC7B,EAGA,MAAO,SAASiB,EAAQjB,EAAW,CAC/BH,EAAG,WAAWoB,EAAQpB,EAAG,EAAE,mBAAmB,EAAG,kBAAmB,6BAChE,UAAW,CACHqB,EAAYlB,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", "container", "one", "root", "definition", "all", "options", "id", "element", "modal", "dialog", "addClass", "content", "header", "create", "dismiss", "title", "removeClass", "drawer", "toggleClass"]
7
7
  }
@@ -411,6 +411,10 @@ GridEditor.containers.tabs = function(ge) {
411
411
  },
412
412
  addPaneKey: "container.add_tab",
413
413
  paneKind: "tab",
414
+ // Where rows go: the pane showing, or the pane of the tab
415
+ regionOf: function(container, tab) {
416
+ return tab ? paneOf(container, tab) : one(container, ":scope > .tab-content > .tab-pane.active");
417
+ },
414
418
  create: function(options) {
415
419
  var container = element("div", { "data-ge-container": "tabs" });
416
420
  var labels = options.labels || [];
@@ -415,6 +415,10 @@
415
415
  },
416
416
  addPaneKey: "container.add_tab",
417
417
  paneKind: "tab",
418
+ // Where rows go: the pane showing, or the pane of the tab
419
+ regionOf: function(container, tab) {
420
+ return tab ? paneOf(container, tab) : one(container, ":scope > .tab-content > .tab-pane.active");
421
+ },
418
422
  create: function(options) {
419
423
  var container = element("div", { "data-ge-container": "tabs" });
420
424
  var labels = options.labels || [];
@@ -1 +1 @@
1
- (()=>{var x=window.GridEditor;if(!x||typeof x.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 b(e,l){return e?Array.prototype.slice.call(e.querySelectorAll(l)):[]}function g(e,l){return e?e.querySelector(l):null}function M(e,l){if(!e)return[];var o=b(e,l);return e.nodeType===1&&e.matches(l)&&o.unshift(e),o}function C(e,l){return e?Array.prototype.filter.call(e.children,function(o){return!l||o.matches(l)}):[]}function j(e,l){return C(e,l)[0]||null}function f(e,l,o){var c=document.createElement(e);return Object.keys(l||{}).forEach(function(h){var d=l[h];d!=null&&d!==!1&&c.setAttribute(h,d)}),o!=null&&(c.textContent=o),c}function p(e,l){return L(l).forEach(function(o){e.classList.add(o)}),e}function m(e,l){return L(l).forEach(function(o){e.classList.remove(o)}),e}function k(e,l,o){return L(l).forEach(function(c){o===void 0?e.classList.toggle(c):e.classList.toggle(c,!!o)}),e}function O(e,l){return!!e&&e.nodeType===1&&e.classList.contains(l)}function L(e){return String(e||"").split(/\s+/).filter(Boolean)}function K(e){return e.getAttribute("class")||e.removeAttribute("class"),e}function V(e){return e.style.display="none",e}function Y(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)}var X=400;function $(e,l,o,c){o=o===void 0?X:o;var h=function(){V(e),c&&c()};if(!Y(e)||!e.animate||o<=0){window.setTimeout(h,0);return}var d=e.animate(l(getComputedStyle(e)),{duration:o,easing:"ease-in-out"}),y=!1,_=function(){y||(y=!0,h())};d.onfinish=_,d.oncancel=_}function G(e,l,o){$(e,function(c){return[{opacity:c.opacity},{opacity:0}]},l,o)}Object.assign(x.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?","container.tabs_section":"Tabs","container.tabs_style":"Style","container.tabs_style_tabs":"Tabs","container.tabs_style_pills":"Pills","container.tabs_style_underline":"Underline","container.tabs_width":"Width","container.tabs_width_natural":"Natural","container.tabs_width_fill":"Fill","container.tabs_width_justified":"Justified","container.tabs_align":"Alignment","container.tabs_align_start":"Start","container.tabs_align_center":"Center","container.tabs_align_end":"End","container.tabs_layout":"Layout","container.tabs_layout_horizontal":"Horizontal","container.tabs_layout_vertical":"Vertical","container.tabs_layout_vertical_from":"Vertical from {breakpoint}"});var A={tabs:"nav-tabs",pills:"nav-pills",underline:"nav-underline"},w={natural:null,fill:"nav-fill",justified:"nav-justified"},E={start:null,center:"justify-content-center",end:"justify-content-end"},B={variant:"tabs",width:"natural",align:"start",vertical:!1},N={variant:{labelKey:"container.tabs_style",choices:[{value:"tabs",labelKey:"container.tabs_style_tabs"},{value:"pills",labelKey:"container.tabs_style_pills"},{value:"underline",labelKey:"container.tabs_style_underline"}]},width:{labelKey:"container.tabs_width",choices:[{value:"natural",labelKey:"container.tabs_width_natural"},{value:"fill",labelKey:"container.tabs_width_fill"},{value:"justified",labelKey:"container.tabs_width_justified"}]},align:{labelKey:"container.tabs_align",choices:[{value:"start",labelKey:"container.tabs_align_start"},{value:"center",labelKey:"container.tabs_align_center"},{value:"end",labelKey:"container.tabs_align_end"}]},vertical:{labelKey:"container.tabs_layout"}},Z=0,S="data-ge-tabs-layout";function H(e){return Object.keys(e).map(function(l){return e[l]}).filter(Boolean)}x.containers.tabs=function(e){var l=[];function o(n){return j(n,".nav")}function c(){return e.breakpoints.slice(1)}function h(n){return n===!0?"":"-"+n}function d(n){var t=h(n);return{container:["d"+t+"-flex","align-items"+t+"-start"],strip:["flex"+t+"-column","me"+t+"-3"]}}function y(){return[!0].concat(c())}function _(n){var t=o(n),a=function(s,i){return!!s&&O(s,i)},r=function(s,i){return Object.keys(s).filter(function(v){return s[v]&&a(t,s[v])})[0]||i},u=y().filter(function(s){var i=d(s);return a(n,i.container[0])&&a(t,i.strip[0])})[0];return{variant:r(A,"tabs"),width:r(w,"natural"),align:r(E,"start"),vertical:u===void 0?!1:u}}function P(n,t,a){var r=o(n);if(r){if(t==="variant"&&(m(r,H(A).join(" ")),p(r,A[a])),(t==="width"||t==="vertical")&&(m(r,H(w).join(" ")),t==="width"&&w[a]&&p(r,w[a])),(t==="align"||t==="vertical"||t==="width"&&a!=="natural")&&(m(r,H(E).join(" ")),t==="align"&&E[a]&&p(r,E[a])),t==="vertical"&&(y().forEach(function(s){var i=d(s);m(n,i.container.join(" ")),m(r,i.strip.join(" "))}),r.removeAttribute("aria-orientation"),a!==!1)){var u=d(a);p(n,u.container.join(" ")),p(r,u.strip.join(" ")),r.setAttribute("aria-orientation","vertical")}K(n)}}function D(n){return n==="variant"?Object.keys(A):n==="width"?Object.keys(w):n==="align"?Object.keys(E):[!1].concat(y())}function J(n,t){var a=e.settings.tabs||{},r=n[t]!==void 0?n[t]:a[t];return r===void 0?B[t]:D(t).indexOf(r)!==-1?r:(e.warn("tabs: "+JSON.stringify(r)+" is not a "+t+", which takes "+JSON.stringify(D(t))+": "+JSON.stringify(B[t])+" is used"),B[t])}function W(n){var t=_(n).vertical;return t===!1?null:e.view()==="all"?(n.removeAttribute(S),/flex$/.test(getComputedStyle(n).display)?"vertical":"horizontal"):t===!0||e.breakpoints.indexOf(e.view())>=e.breakpoints.indexOf(t)?"vertical":"horizontal"}function I(n){var t=W(n);t?n.setAttribute(S,t):n.removeAttribute(S)}function R(n,t,a){var r=f("div",{class:"ge-tabs-variant"}),u="ge-tabs-variant-"+ ++Z;r.appendChild(f("label",{class:"form-label",for:u},e.t(n)));var s=r.appendChild(f("select",{class:"form-select form-select-sm",id:u}));return t.forEach(function(i){s.appendChild(f("option",{value:i.value},i.label))}),s.addEventListener("change",function(){a(s.value)}),{box:r,field:s}}function q(n){var t=f("div",{class:"ge-tabs-variants"}),a={};function r(i,v){P(n,i,v),I(n),s()}function u(i){return N[i].choices.map(function(v){return{value:v.value,label:e.t(v.labelKey)}})}["variant","width","align"].forEach(function(i){a[i]=R(N[i].labelKey,u(i),function(v){r(i,v)})}),a.vertical=R(N.vertical.labelKey,[{value:"false",label:e.t("container.tabs_layout_horizontal")},{value:"true",label:e.t("container.tabs_layout_vertical")}].concat(c().map(function(i){return{value:i,label:e.t("container.tabs_layout_vertical_from",{breakpoint:i})}})),function(i){r("vertical",i==="true"?!0:i==="false"?!1:i)}),["variant","width","align","vertical"].forEach(function(i){a[i].box.setAttribute("data-ge-tabs-variant",i),t.appendChild(a[i].box)});function s(){var i=_(n);a.variant.field.value=i.variant,a.width.field.value=i.width,a.align.field.value=i.align,a.vertical.field.value=String(i.vertical),a.width.field.disabled=i.vertical!==!1,a.align.field.disabled=i.vertical!==!1||i.width!=="natural"}return s(),l.push({container:n,element:t,render:s}),t}function U(n,t){t=t||{};var a=o(n),r=g(n,":scope > .tab-content"),u=e.containerId("tab"),s=C(a,".nav-item").length+1,i=a.appendChild(f("li",{class:"nav-item ge-tab",role:"presentation"})),v=i.appendChild(f("button",{class:"nav-link",type:"button",role:"tab","data-bs-toggle":"tab","data-bs-target":"#"+u,"aria-controls":u}));v.appendChild(f("span",{class:"ge-pane-label"},t.label||e.t("container.tab_label",{number:s})));var T=r.appendChild(f("div",{class:"tab-pane fade",role:"tabpanel",tabindex:"0",id:u}));return T.appendChild(e.defaultRegion()),(t.activate||s===1)&&z(n,T),T}function z(n,t){var a=t.getAttribute("id");b(n,":scope > .tab-content > .tab-pane").forEach(function(r){m(r,"show active")}),p(t,"show active"),b(o(n)||n,".nav-link").forEach(function(r){var u=r.getAttribute("data-bs-target")==="#"+a;k(r,"active",u),r.setAttribute("aria-selected",u?"true":"false")})}function F(n,t){var a=g(t,".nav-link"),r=a?a.getAttribute("data-bs-target"):null;return r?g(n,r):null}return{labelKey:"container.add_tabs",onSortable:function(n){n(b(e.canvas,".ge-container-tabs").map(o).filter(Boolean),{draggable:".ge-tab"})},addPaneKey:"container.add_tab",paneKind:"tab",create:function(n){var t=f("div",{"data-ge-container":"tabs"}),a=n.labels||[],r=n.tabs||a.length||2;t.appendChild(f("ul",{class:"nav nav-tabs",role:"tablist"})),t.appendChild(f("div",{class:"tab-content"})),["variant","width","align","vertical"].forEach(function(s){P(t,s,J(n,s))});for(var u=0;u<r;u++)U(t,{label:a[u]});return t},addPane:U,mark:function(n){b(n,":scope > .tab-content > .tab-pane").forEach(function(t){p(t,"ge-tab-pane")}),C(o(n)||n,".nav-item").forEach(function(t){p(t,"ge-tab");var a=g(t,".nav-link");a&&e.makeLabelEditable(e.labelIn(a)),!j(t,".ge-tools-drawer")&&e.createPaneControls(t,"tab",e.settings.tab_tools,e.t("confirm.delete_tab"),function(r){var u=F(n,t),s=O(u,"active");G(t,200,function(){u&&u.remove(),r();var i=g(n,":scope > .tab-content > .tab-pane");s&&i&&z(n,i)})})})},unmark:function(n){e.resumeToggles(n),n.removeAttribute(S),b(n,".ge-tab-pane").forEach(function(t){m(t,"ge-tab-pane")}),b(n,".ge-tab").forEach(function(t){m(t,"ge-tab"),K(t)}),e.unwrapLabels(n)},cleanMarkup:function(n){var t=this;b(n,'[data-ge-container="tabs"]').forEach(function(a){t.unmark(a)})},panelSection:function(n,t){return t!=="tabs"||!o(n)?null:{labelKey:"container.tabs_section",body:q(n)}},onRefresh:function(n){M(n,'[data-ge-container="tabs"]').forEach(I),l=l.filter(function(t){return t.element.isConnected}),l.forEach(function(t){(t.container===n||n.contains(t.container))&&t.render()})},onDeinit:function(){l=[]},afterPaneMove:function(n){var t=g(n,":scope > .tab-content");C(o(n)||n,".nav-item").forEach(function(a){var r=F(n,a);r&&t.appendChild(r)})}}};})();
1
+ (()=>{var x=window.GridEditor;if(!x||typeof x.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 p(n,l){return n?Array.prototype.slice.call(n.querySelectorAll(l)):[]}function h(n,l){return n?n.querySelector(l):null}function M(n,l){if(!n)return[];var o=p(n,l);return n.nodeType===1&&n.matches(l)&&o.unshift(n),o}function C(n,l){return n?Array.prototype.filter.call(n.children,function(o){return!l||o.matches(l)}):[]}function O(n,l){return C(n,l)[0]||null}function f(n,l,o){var c=document.createElement(n);return Object.keys(l||{}).forEach(function(g){var d=l[g];d!=null&&d!==!1&&c.setAttribute(g,d)}),o!=null&&(c.textContent=o),c}function b(n,l){return K(l).forEach(function(o){n.classList.add(o)}),n}function m(n,l){return K(l).forEach(function(o){n.classList.remove(o)}),n}function k(n,l,o){return K(l).forEach(function(c){o===void 0?n.classList.toggle(c):n.classList.toggle(c,!!o)}),n}function L(n,l){return!!n&&n.nodeType===1&&n.classList.contains(l)}function K(n){return String(n||"").split(/\s+/).filter(Boolean)}function B(n){return n.getAttribute("class")||n.removeAttribute("class"),n}function V(n){return n.style.display="none",n}function Y(n){return!!(n.offsetWidth||n.offsetHeight||n.getClientRects().length)}var X=400;function $(n,l,o,c){o=o===void 0?X:o;var g=function(){V(n),c&&c()};if(!Y(n)||!n.animate||o<=0){window.setTimeout(g,0);return}var d=n.animate(l(getComputedStyle(n)),{duration:o,easing:"ease-in-out"}),y=!1,_=function(){y||(y=!0,g())};d.onfinish=_,d.oncancel=_}function G(n,l,o){$(n,function(c){return[{opacity:c.opacity},{opacity:0}]},l,o)}Object.assign(x.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?","container.tabs_section":"Tabs","container.tabs_style":"Style","container.tabs_style_tabs":"Tabs","container.tabs_style_pills":"Pills","container.tabs_style_underline":"Underline","container.tabs_width":"Width","container.tabs_width_natural":"Natural","container.tabs_width_fill":"Fill","container.tabs_width_justified":"Justified","container.tabs_align":"Alignment","container.tabs_align_start":"Start","container.tabs_align_center":"Center","container.tabs_align_end":"End","container.tabs_layout":"Layout","container.tabs_layout_horizontal":"Horizontal","container.tabs_layout_vertical":"Vertical","container.tabs_layout_vertical_from":"Vertical from {breakpoint}"});var A={tabs:"nav-tabs",pills:"nav-pills",underline:"nav-underline"},w={natural:null,fill:"nav-fill",justified:"nav-justified"},E={start:null,center:"justify-content-center",end:"justify-content-end"},N={variant:"tabs",width:"natural",align:"start",vertical:!1},H={variant:{labelKey:"container.tabs_style",choices:[{value:"tabs",labelKey:"container.tabs_style_tabs"},{value:"pills",labelKey:"container.tabs_style_pills"},{value:"underline",labelKey:"container.tabs_style_underline"}]},width:{labelKey:"container.tabs_width",choices:[{value:"natural",labelKey:"container.tabs_width_natural"},{value:"fill",labelKey:"container.tabs_width_fill"},{value:"justified",labelKey:"container.tabs_width_justified"}]},align:{labelKey:"container.tabs_align",choices:[{value:"start",labelKey:"container.tabs_align_start"},{value:"center",labelKey:"container.tabs_align_center"},{value:"end",labelKey:"container.tabs_align_end"}]},vertical:{labelKey:"container.tabs_layout"}},Z=0,S="data-ge-tabs-layout";function P(n){return Object.keys(n).map(function(l){return n[l]}).filter(Boolean)}x.containers.tabs=function(n){var l=[];function o(e){return O(e,".nav")}function c(){return n.breakpoints.slice(1)}function g(e){return e===!0?"":"-"+e}function d(e){var t=g(e);return{container:["d"+t+"-flex","align-items"+t+"-start"],strip:["flex"+t+"-column","me"+t+"-3"]}}function y(){return[!0].concat(c())}function _(e){var t=o(e),a=function(s,i){return!!s&&L(s,i)},r=function(s,i){return Object.keys(s).filter(function(v){return s[v]&&a(t,s[v])})[0]||i},u=y().filter(function(s){var i=d(s);return a(e,i.container[0])&&a(t,i.strip[0])})[0];return{variant:r(A,"tabs"),width:r(w,"natural"),align:r(E,"start"),vertical:u===void 0?!1:u}}function D(e,t,a){var r=o(e);if(r){if(t==="variant"&&(m(r,P(A).join(" ")),b(r,A[a])),(t==="width"||t==="vertical")&&(m(r,P(w).join(" ")),t==="width"&&w[a]&&b(r,w[a])),(t==="align"||t==="vertical"||t==="width"&&a!=="natural")&&(m(r,P(E).join(" ")),t==="align"&&E[a]&&b(r,E[a])),t==="vertical"&&(y().forEach(function(s){var i=d(s);m(e,i.container.join(" ")),m(r,i.strip.join(" "))}),r.removeAttribute("aria-orientation"),a!==!1)){var u=d(a);b(e,u.container.join(" ")),b(r,u.strip.join(" ")),r.setAttribute("aria-orientation","vertical")}B(e)}}function I(e){return e==="variant"?Object.keys(A):e==="width"?Object.keys(w):e==="align"?Object.keys(E):[!1].concat(y())}function J(e,t){var a=n.settings.tabs||{},r=e[t]!==void 0?e[t]:a[t];return r===void 0?N[t]:I(t).indexOf(r)!==-1?r:(n.warn("tabs: "+JSON.stringify(r)+" is not a "+t+", which takes "+JSON.stringify(I(t))+": "+JSON.stringify(N[t])+" is used"),N[t])}function W(e){var t=_(e).vertical;return t===!1?null:n.view()==="all"?(e.removeAttribute(S),/flex$/.test(getComputedStyle(e).display)?"vertical":"horizontal"):t===!0||n.breakpoints.indexOf(n.view())>=n.breakpoints.indexOf(t)?"vertical":"horizontal"}function R(e){var t=W(e);t?e.setAttribute(S,t):e.removeAttribute(S)}function U(e,t,a){var r=f("div",{class:"ge-tabs-variant"}),u="ge-tabs-variant-"+ ++Z;r.appendChild(f("label",{class:"form-label",for:u},n.t(e)));var s=r.appendChild(f("select",{class:"form-select form-select-sm",id:u}));return t.forEach(function(i){s.appendChild(f("option",{value:i.value},i.label))}),s.addEventListener("change",function(){a(s.value)}),{box:r,field:s}}function q(e){var t=f("div",{class:"ge-tabs-variants"}),a={};function r(i,v){D(e,i,v),R(e),s()}function u(i){return H[i].choices.map(function(v){return{value:v.value,label:n.t(v.labelKey)}})}["variant","width","align"].forEach(function(i){a[i]=U(H[i].labelKey,u(i),function(v){r(i,v)})}),a.vertical=U(H.vertical.labelKey,[{value:"false",label:n.t("container.tabs_layout_horizontal")},{value:"true",label:n.t("container.tabs_layout_vertical")}].concat(c().map(function(i){return{value:i,label:n.t("container.tabs_layout_vertical_from",{breakpoint:i})}})),function(i){r("vertical",i==="true"?!0:i==="false"?!1:i)}),["variant","width","align","vertical"].forEach(function(i){a[i].box.setAttribute("data-ge-tabs-variant",i),t.appendChild(a[i].box)});function s(){var i=_(e);a.variant.field.value=i.variant,a.width.field.value=i.width,a.align.field.value=i.align,a.vertical.field.value=String(i.vertical),a.width.field.disabled=i.vertical!==!1,a.align.field.disabled=i.vertical!==!1||i.width!=="natural"}return s(),l.push({container:e,element:t,render:s}),t}function z(e,t){t=t||{};var a=o(e),r=h(e,":scope > .tab-content"),u=n.containerId("tab"),s=C(a,".nav-item").length+1,i=a.appendChild(f("li",{class:"nav-item ge-tab",role:"presentation"})),v=i.appendChild(f("button",{class:"nav-link",type:"button",role:"tab","data-bs-toggle":"tab","data-bs-target":"#"+u,"aria-controls":u}));v.appendChild(f("span",{class:"ge-pane-label"},t.label||n.t("container.tab_label",{number:s})));var j=r.appendChild(f("div",{class:"tab-pane fade",role:"tabpanel",tabindex:"0",id:u}));return j.appendChild(n.defaultRegion()),(t.activate||s===1)&&F(e,j),j}function F(e,t){var a=t.getAttribute("id");p(e,":scope > .tab-content > .tab-pane").forEach(function(r){m(r,"show active")}),b(t,"show active"),p(o(e)||e,".nav-link").forEach(function(r){var u=r.getAttribute("data-bs-target")==="#"+a;k(r,"active",u),r.setAttribute("aria-selected",u?"true":"false")})}function T(e,t){var a=h(t,".nav-link"),r=a?a.getAttribute("data-bs-target"):null;return r?h(e,r):null}return{labelKey:"container.add_tabs",onSortable:function(e){e(p(n.canvas,".ge-container-tabs").map(o).filter(Boolean),{draggable:".ge-tab"})},addPaneKey:"container.add_tab",paneKind:"tab",regionOf:function(e,t){return t?T(e,t):h(e,":scope > .tab-content > .tab-pane.active")},create:function(e){var t=f("div",{"data-ge-container":"tabs"}),a=e.labels||[],r=e.tabs||a.length||2;t.appendChild(f("ul",{class:"nav nav-tabs",role:"tablist"})),t.appendChild(f("div",{class:"tab-content"})),["variant","width","align","vertical"].forEach(function(s){D(t,s,J(e,s))});for(var u=0;u<r;u++)z(t,{label:a[u]});return t},addPane:z,mark:function(e){p(e,":scope > .tab-content > .tab-pane").forEach(function(t){b(t,"ge-tab-pane")}),C(o(e)||e,".nav-item").forEach(function(t){b(t,"ge-tab");var a=h(t,".nav-link");a&&n.makeLabelEditable(n.labelIn(a)),!O(t,".ge-tools-drawer")&&n.createPaneControls(t,"tab",n.settings.tab_tools,n.t("confirm.delete_tab"),function(r){var u=T(e,t),s=L(u,"active");G(t,200,function(){u&&u.remove(),r();var i=h(e,":scope > .tab-content > .tab-pane");s&&i&&F(e,i)})})})},unmark:function(e){n.resumeToggles(e),e.removeAttribute(S),p(e,".ge-tab-pane").forEach(function(t){m(t,"ge-tab-pane")}),p(e,".ge-tab").forEach(function(t){m(t,"ge-tab"),B(t)}),n.unwrapLabels(e)},cleanMarkup:function(e){var t=this;p(e,'[data-ge-container="tabs"]').forEach(function(a){t.unmark(a)})},panelSection:function(e,t){return t!=="tabs"||!o(e)?null:{labelKey:"container.tabs_section",body:q(e)}},onRefresh:function(e){M(e,'[data-ge-container="tabs"]').forEach(R),l=l.filter(function(t){return t.element.isConnected}),l.forEach(function(t){(t.container===e||e.contains(t.container))&&t.render()})},onDeinit:function(){l=[]},afterPaneMove:function(e){var t=h(e,":scope > .tab-content");C(o(e)||e,".nav-item").forEach(function(a){var r=T(e,a);r&&t.appendChild(r)})}}};})();