@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.
- package/CHANGELOG.md +49 -0
- package/README.md +29 -17
- package/UPGRADING.md +24 -5
- package/dist/grideditor.bundle.min.js +3 -3
- package/dist/grideditor.css +5 -4
- package/dist/grideditor.d.ts +10 -15
- package/dist/grideditor.esm.js +151 -113
- package/dist/grideditor.jquery.js +1 -3
- package/dist/grideditor.jquery.min.js +1 -1
- package/dist/grideditor.jquery.min.js.map +2 -2
- package/dist/grideditor.js +151 -113
- package/dist/grideditor.min.css +1 -1
- package/dist/grideditor.min.css.map +1 -1
- package/dist/grideditor.min.js +2 -2
- package/dist/grideditor.min.js.map +3 -3
- package/dist/plugins/grideditor.accordion.esm.js +7 -0
- package/dist/plugins/grideditor.accordion.js +7 -0
- package/dist/plugins/grideditor.accordion.min.js +1 -1
- package/dist/plugins/grideditor.accordion.min.js.map +3 -3
- package/dist/plugins/grideditor.card.esm.js +4 -0
- package/dist/plugins/grideditor.card.js +4 -0
- package/dist/plugins/grideditor.card.min.js +1 -1
- package/dist/plugins/grideditor.card.min.js.map +3 -3
- package/dist/plugins/grideditor.carousel.esm.js +4 -0
- package/dist/plugins/grideditor.carousel.js +4 -0
- package/dist/plugins/grideditor.carousel.min.js +1 -1
- package/dist/plugins/grideditor.carousel.min.js.map +2 -2
- package/dist/plugins/grideditor.clipboard.esm.js +3 -18
- package/dist/plugins/grideditor.clipboard.js +3 -18
- package/dist/plugins/grideditor.clipboard.min.js +1 -1
- package/dist/plugins/grideditor.clipboard.min.js.map +3 -3
- package/dist/plugins/grideditor.history.esm.js +1 -6
- package/dist/plugins/grideditor.history.js +1 -6
- package/dist/plugins/grideditor.history.min.js +1 -1
- package/dist/plugins/grideditor.history.min.js.map +3 -3
- package/dist/plugins/grideditor.offcanvas.esm.js +185 -4
- package/dist/plugins/grideditor.offcanvas.js +185 -4
- package/dist/plugins/grideditor.offcanvas.min.js +1 -1
- package/dist/plugins/grideditor.offcanvas.min.js.map +3 -3
- package/dist/plugins/grideditor.popup.esm.js +185 -4
- package/dist/plugins/grideditor.popup.js +185 -4
- package/dist/plugins/grideditor.popup.min.js +1 -1
- package/dist/plugins/grideditor.popup.min.js.map +3 -3
- package/dist/plugins/grideditor.tabs.esm.js +4 -0
- package/dist/plugins/grideditor.tabs.js +4 -0
- package/dist/plugins/grideditor.tabs.min.js +1 -1
- package/dist/plugins/grideditor.tabs.min.js.map +2 -2
- package/docs/events.md +14 -11
- package/docs/plugins.md +20 -8
- package/example/clipboard.html +13 -10
- package/package.json +1 -1
- package/src/js/grideditor.jquery.js +0 -2
- package/src/js/grideditor.js +211 -125
- package/src/js/plugins/grideditor.accordion.js +9 -0
- package/src/js/plugins/grideditor.card.js +5 -0
- package/src/js/plugins/grideditor.carousel.js +5 -0
- package/src/js/plugins/grideditor.clipboard.js +11 -24
- package/src/js/plugins/grideditor.history.js +3 -6
- package/src/js/plugins/grideditor.offcanvas.js +8 -0
- package/src/js/plugins/grideditor.popup.js +7 -0
- package/src/js/plugins/grideditor.tabs.js +5 -0
- package/src/js/triggers/triggers.js +211 -11
- package/src/less/grideditor.less +5 -4
- package/types/grideditor.d.ts +10 -15
|
@@ -225,6 +225,13 @@ GridEditor.containers.accordion = function(ge) {
|
|
|
225
225
|
},
|
|
226
226
|
addPaneKey: "container.add_accordion_item",
|
|
227
227
|
paneKind: "accordion-item",
|
|
228
|
+
// Where rows go: the body of the item that is open, or of the item
|
|
229
|
+
regionOf: function(container, item) {
|
|
230
|
+
var open = item || all(container, ":scope > .accordion > .accordion-item").filter(function(each) {
|
|
231
|
+
return hasClass(collapseOf(each), "show");
|
|
232
|
+
})[0];
|
|
233
|
+
return open ? one(open, ".accordion-body") : null;
|
|
234
|
+
},
|
|
228
235
|
create: function(options) {
|
|
229
236
|
var container = element("div", { "data-ge-container": "accordion" });
|
|
230
237
|
var labels = options.labels || [];
|
|
@@ -229,6 +229,13 @@
|
|
|
229
229
|
},
|
|
230
230
|
addPaneKey: "container.add_accordion_item",
|
|
231
231
|
paneKind: "accordion-item",
|
|
232
|
+
// Where rows go: the body of the item that is open, or of the item
|
|
233
|
+
regionOf: function(container, item) {
|
|
234
|
+
var open = item || all(container, ":scope > .accordion > .accordion-item").filter(function(each) {
|
|
235
|
+
return hasClass(collapseOf(each), "show");
|
|
236
|
+
})[0];
|
|
237
|
+
return open ? one(open, ".accordion-body") : null;
|
|
238
|
+
},
|
|
232
239
|
create: function(options) {
|
|
233
240
|
var container = element("div", { "data-ge-container": "accordion" });
|
|
234
241
|
var labels = options.labels || [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var m=window.GridEditor;if(!m||typeof m.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
|
|
1
|
+
(()=>{var m=window.GridEditor;if(!m||typeof m.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 d(e,i){return e?Array.prototype.slice.call(e.querySelectorAll(i)):[]}function x(e,i){return e?e.querySelector(i):null}function E(e,i){return e?Array.prototype.filter.call(e.children,function(o){return!i||o.matches(i)}):[]}function b(e,i){return E(e,i)[0]||null}function f(e,i,o){var c=document.createElement(e);return Object.keys(i||{}).forEach(function(s){var u=i[s];u!=null&&u!==!1&&c.setAttribute(s,u)}),o!=null&&(c.textContent=o),c}function S(e,i){return C(i).forEach(function(o){e.classList.add(o)}),e}function L(e,i){return C(i).forEach(function(o){e.classList.remove(o)}),e}function g(e,i,o){return C(i).forEach(function(c){o===void 0?e.classList.toggle(c):e.classList.toggle(c,!!o)}),e}function A(e,i){return!!e&&e.nodeType===1&&e.classList.contains(i)}function C(e){return String(e||"").split(/\s+/).filter(Boolean)}function I(e){return e.style.display="none",e}function j(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)}var P=400;function H(e,i,o,c){o=o===void 0?P:o;var s=function(){I(e),c&&c()};if(!j(e)||!e.animate||o<=0){window.setTimeout(s,0);return}var u=e.animate(i(getComputedStyle(e)),{duration:o,easing:"ease-in-out"}),p=!1,h=function(){p||(p=!0,s())};u.onfinish=h,u.oncancel=h}function B(e,i,o){typeof i=="function"&&(o=i,i=void 0),e.style.overflow="hidden",H(e,function(c){return[{height:c.height,paddingTop:c.paddingTop,paddingBottom:c.paddingBottom,marginTop:c.marginTop,marginBottom:c.marginBottom},{height:"0px",paddingTop:"0px",paddingBottom:"0px",marginTop:"0px",marginBottom:"0px"}]},i,function(){e.style.removeProperty("overflow"),o&&o()})}Object.assign(m.locales.en,{"container.add_accordion":"Accordion","container.add_accordion_item":"Add item","container.accordion_label":"Item {number}","confirm.delete_accordion_item":"Delete this item and everything in it?"});m.containers.accordion=function(e){var i=new WeakSet;function o(n){return b(n,".accordion-collapse")}function c(n,t){var r=d(n,":scope > .accordion > .accordion-item > .accordion-collapse");if(t){var a=o(t);r=r.filter(function(l){return l!==a})}return r.length>0&&!r.filter(function(l){return l.hasAttribute("data-bs-parent")}).length}function s(n,t){t=t||{};var r=b(n,".accordion"),a=e.containerId("acc-item"),l=E(r,".accordion-item").length+1,v=t.open===void 0?l===1:!!t.open,O=t.stay_open===void 0?c(n):!!t.stay_open,w=r.appendChild(f("div",{class:"accordion-item ge-accordion-item"})),k=w.appendChild(f("h2",{class:"accordion-header"})),T=k.appendChild(f("button",{class:"accordion-button",type:"button","data-bs-toggle":"collapse","data-bs-target":"#"+a,"aria-expanded":v?"true":"false"}));g(T,"collapsed",!v),T.appendChild(f("span",{class:"ge-pane-label"},t.label||e.t("container.accordion_label",{number:l})));var y=w.appendChild(f("div",{class:"accordion-collapse collapse",id:a,"data-ge-open":v?"true":"false"}));g(y,"show",v),O||y.setAttribute("data-bs-parent","#"+r.getAttribute("id"));var _=y.appendChild(f("div",{class:"accordion-body"}));return _.appendChild(e.defaultRegion()),_}function u(n,t){var r=o(t),a=r.getAttribute("data-ge-open")!=="true";a&&!c(n)&&d(n,":scope > .accordion > .accordion-item").forEach(function(l){l!==t&&p(l,!1)}),p(t,a)}function p(n,t){var r=o(n);r&&(r.setAttribute("data-ge-open",t?"true":"false"),g(r,"show",t)),d(n,":scope > .accordion-header .accordion-button").forEach(function(a){g(a,"collapsed",!t),a.setAttribute("aria-expanded",t?"true":"false")})}function h(n,t){var r=t.closest(".accordion"),a=o(t);a&&(c(n,t)?a.removeAttribute("data-bs-parent"):a.setAttribute("data-bs-parent","#"+r.getAttribute("id")))}return{labelKey:"container.add_accordion",onSortable:function(n){n(d(e.canvas,".ge-container-accordion > .accordion"),{draggable:".ge-accordion-item",group:"accordion"})},addPaneKey:"container.add_accordion_item",paneKind:"accordion-item",regionOf:function(n,t){var r=t||d(n,":scope > .accordion > .accordion-item").filter(function(a){return A(o(a),"show")})[0];return r?x(r,".accordion-body"):null},create:function(n){var t=f("div",{"data-ge-container":"accordion"}),r=n.labels||[],a=n.items||r.length||2;t.appendChild(f("div",{class:"accordion",id:e.containerId("accordion")}));for(var l=0;l<a;l++)s(t,{label:r[l],open:l===0,stay_open:n.stay_open});return t},addPane:s,mark:function(n){d(n,":scope > .accordion > .accordion-item").forEach(function(t){S(t,"ge-accordion-item");var r=o(t);r&&!r.hasAttribute("data-ge-open")&&r.setAttribute("data-ge-open",A(r,"show")?"true":"false");var a=x(t,":scope > .accordion-header .accordion-button");a&&(e.suspendToggles(a),e.makeLabelEditable(e.labelIn(a)),i.has(a)||(i.add(a),a.addEventListener("click",function(l){e.labelIn(a).getAttribute("contenteditable")!=="true"&&(l.preventDefault(),u(n,t))}))),!b(t,".ge-tools-drawer")&&e.createPaneControls(t,"accordion-item",e.settings.accordion_tools,e.t("confirm.delete_accordion_item"),function(l){B(t,200,l)})})},unmark:function(n){e.resumeToggles(n),d(n,":scope > .accordion > .accordion-item").forEach(function(t){var r=o(t);p(t,!!r&&r.getAttribute("data-ge-open")==="true")}),d(n,".ge-accordion-item").forEach(function(t){L(t,"ge-accordion-item")}),e.unwrapLabels(n)},cleanMarkup:function(n){var t=this;d(n,'[data-ge-container="accordion"]').forEach(function(r){t.unmark(r)})},afterPaneMove:function(n,t){h(n,t)}}};})();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/js/register.js", "../../src/js/dom.js", "../../src/js/plugins/grideditor.accordion.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 * Accordions for grid-editor.\n *\n * A container plugin: load this file after the editor and the toolbar offers\n * an accordion. 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.accordion.min.js\"></script>\n */\nimport { GridEditor } from '../grideditor.js';\nimport * as dom from '../dom.js';\n\nObject.assign(GridEditor.locales.en, {\n 'container.add_accordion': 'Accordion',\n 'container.add_accordion_item': 'Add item',\n 'container.accordion_label': 'Item {number}',\n 'confirm.delete_accordion_item': 'Delete this item and everything in it?',\n});\n\nGridEditor.containers.accordion = function(ge) {\n\n // The buttons whose clicks the editor answers itself, bound once each\n var answered = new WeakSet();\n\n function collapseOf(item) {\n return dom.child(item, '.accordion-collapse');\n }\n\n function staysOpen(container, ignore) {\n var items = dom.all(container, ':scope > .accordion > .accordion-item > .accordion-collapse');\n\n if (ignore) {\n var ignored = collapseOf(ignore);\n items = items.filter(function(collapse) { return collapse !== ignored; });\n }\n\n return items.length > 0 && !items.filter(function(collapse) {\n return collapse.hasAttribute('data-bs-parent');\n }).length;\n }\n\n function addAccordionItemTo(container, options) {\n options = options || {};\n\n var accordion = dom.child(container, '.accordion');\n var id = ge.containerId('acc-item');\n var number = dom.children(accordion, '.accordion-item').length + 1;\n var open = options.open === undefined ? number === 1 : !!options.open;\n var stayOpen = options.stay_open === undefined ? staysOpen(container) : !!options.stay_open;\n\n var item = accordion.appendChild(dom.element('div', { 'class': 'accordion-item ge-accordion-item' }));\n\n var header = item.appendChild(dom.element('h2', { 'class': 'accordion-header' }));\n var button = header.appendChild(dom.element('button', {\n 'class': 'accordion-button',\n type: 'button',\n 'data-bs-toggle': 'collapse',\n 'data-bs-target': '#' + id,\n 'aria-expanded': open ? 'true' : 'false',\n }));\n dom.toggleClass(button, 'collapsed', !open);\n button.appendChild(dom.element('span', { 'class': 'ge-pane-label' },\n options.label || ge.t('container.accordion_label', { number: number })));\n\n var collapse = item.appendChild(dom.element('div', {\n 'class': 'accordion-collapse collapse',\n id: id,\n 'data-ge-open': open ? 'true' : 'false',\n }));\n dom.toggleClass(collapse, 'show', open);\n\n if (!stayOpen) { collapse.setAttribute('data-bs-parent', '#' + accordion.getAttribute('id')); }\n\n var body = collapse.appendChild(dom.element('div', { 'class': 'accordion-body' }));\n body.appendChild(ge.defaultRegion());\n return body;\n }\n\n function toggleAccordionItem(container, item) {\n var collapse = collapseOf(item);\n var opening = collapse.getAttribute('data-ge-open') !== 'true';\n\n if (opening && !staysOpen(container)) {\n dom.all(container, ':scope > .accordion > .accordion-item').forEach(function(other) {\n if (other !== item) { setAccordionItemOpen(other, false); }\n });\n }\n\n setAccordionItemOpen(item, opening);\n }\n\n function setAccordionItemOpen(item, open) {\n var collapse = collapseOf(item);\n if (collapse) {\n collapse.setAttribute('data-ge-open', open ? 'true' : 'false');\n dom.toggleClass(collapse, 'show', open);\n }\n\n dom.all(item, ':scope > .accordion-header .accordion-button').forEach(function(button) {\n dom.toggleClass(button, 'collapsed', !open);\n button.setAttribute('aria-expanded', open ? 'true' : 'false');\n });\n }\n\n function reparentAccordionItem(container, item) {\n var accordion = item.closest('.accordion');\n var collapse = collapseOf(item);\n if (!collapse) { return; }\n\n // The item that just arrived still carries the parent it had\n // where it came from, so it is not asked what this accordion does\n if (staysOpen(container, item)) {\n collapse.removeAttribute('data-bs-parent');\n } else {\n collapse.setAttribute('data-bs-parent', '#' + accordion.getAttribute('id'));\n }\n }\n\n return {\n labelKey: 'container.add_accordion',\n\n // Items sort within their accordion and into any other one\n onSortable: function(sortable) {\n sortable(dom.all(ge.canvas, '.ge-container-accordion > .accordion'), {\n draggable: '.ge-accordion-item',\n group: 'accordion',\n });\n },\n addPaneKey: 'container.add_accordion_item',\n paneKind: 'accordion-item',\n\n create: function(options) {\n var container = dom.element('div', { 'data-ge-container': 'accordion' });\n var labels = options.labels || [];\n var count = options.items || labels.length || 2;\n\n container.appendChild(dom.element('div', { 'class': 'accordion', id: ge.containerId('accordion') }));\n\n for (var i = 0; i < count; i++) {\n addAccordionItemTo(container, {\n label: labels[i],\n open: i === 0,\n stay_open: options.stay_open,\n });\n }\n\n return container;\n },\n\n addPane: addAccordionItemTo,\n\n mark: function(container) {\n dom.all(container, ':scope > .accordion > .accordion-item').forEach(function(item) {\n dom.addClass(item, 'ge-accordion-item');\n var collapse = collapseOf(item);\n\n // What the author wanted, before Bootstrap's own\n // toggles get a chance to change it while editing.\n // Every item is shown while editing (the stylesheet\n // does that), so this is the only record of it.\n if (collapse && !collapse.hasAttribute('data-ge-open')) {\n collapse.setAttribute('data-ge-open', dom.hasClass(collapse, 'show') ? 'true' : 'false');\n }\n\n var button = dom.one(item, ':scope > .accordion-header .accordion-button');\n\n if (button) {\n // Bootstrap's collapse stays out of it, and the editor\n // answers the click itself\n ge.suspendToggles(button);\n ge.makeLabelEditable(ge.labelIn(button));\n\n if (!answered.has(button)) {\n answered.add(button);\n button.addEventListener('click', function(e) {\n if (ge.labelIn(button).getAttribute('contenteditable') === 'true') { return; }\n\n e.preventDefault();\n toggleAccordionItem(container, item);\n });\n }\n }\n\n if (dom.child(item, '.ge-tools-drawer')) { return; }\n\n ge.createPaneControls(item, 'accordion-item', ge.settings.accordion_tools,\n ge.t('confirm.delete_accordion_item'), function(removed) {\n dom.slideUp(item, 200, removed);\n });\n });\n },\n\n unmark: function(container) {\n ge.resumeToggles(container);\n\n // What the canvas was showing is what the page ships\n dom.all(container, ':scope > .accordion > .accordion-item').forEach(function(item) {\n var collapse = collapseOf(item);\n setAccordionItemOpen(item, !!collapse && collapse.getAttribute('data-ge-open') === 'true');\n });\n\n dom.all(container, '.ge-accordion-item').forEach(function(item) {\n dom.removeClass(item, 'ge-accordion-item');\n });\n ge.unwrapLabels(container);\n },\n\n // The same, on a copy of the canvas: unmark only touches markup\n cleanMarkup: function(root) {\n var definition = this;\n dom.all(root, '[data-ge-container=\"accordion\"]').forEach(function(container) { definition.unmark(container); });\n },\n\n afterPaneMove: function(container, item) {\n reparentAccordionItem(container, item);\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,CAGO,SAASC,EAAIF,EAAMC,EAAU,CAChC,OAAOD,EAAOA,EAAK,cAAcC,CAAQ,EAAI,IACjD,CAYO,SAASE,EAASC,EAAMC,EAAU,CACrC,OAAKD,EAEE,MAAM,UAAU,OAAO,KAAKA,EAAK,SAAU,SAASE,EAAM,CAC7D,MAAO,CAACD,GAAYC,EAAK,QAAQD,CAAQ,CAC7C,CAAC,EAJmB,CAAC,CAKzB,CAGO,SAASE,EAAMH,EAAMC,EAAU,CAClC,OAAOF,EAASC,EAAMC,CAAQ,EAAE,CAAC,GAAK,IAC1C,CA6DO,SAASG,EAAQC,EAAKC,EAAYC,EAAM,CAC3C,IAAIC,EAAO,SAAS,cAAcH,CAAG,EAErC,cAAO,KAAKC,GAAc,CAAC,CAAC,EAAE,QAAQ,SAASG,EAAM,CACjD,IAAIC,EAA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B,CACX,CAEA,SAASC,EAAoBnB,EAAWH,EAAM,CAC1C,IAAIQ,EAAWT,EAAWC,CAAI,EAC1BuB,EAAUf,EAAS,aAAa,cAAc,IAAM,OAEpDe,GAAW,CAACrB,EAAUC,CAAS,GAC3BG,EAAIH,EAAW,uCAAuC,EAAE,QAAQ,SAASqB,EAAO,CAC5EA,IAAUxB,GAAQyB,EAAqBD,EAAO,EAAK,CAC3D,CAAC,EAGLC,EAAqBzB,EAAMuB,CAAO,CACtC,CAEA,SAASE,EAAqBzB,EAAMe,EAAM,CACtC,IAAIP,EAAWT,EAAWC,CAAI,EAC1BQ,IACAA,EAAS,aAAa,eAAgBO,EAAO,OAAS,OAAO,EACzDK,EAAYZ,EAAU,OAAQO,CAAI,GAGtCT,EAAIN,EAAM,8CAA8C,EAAE,QAAQ,SAASmB,EAAQ,CAC/EC,EAAYD,EAAQ,YAAa,CAACJ,CAAI,EAC1CI,EAAO,aAAa,gBAAiBJ,EAAO,OAAS,OAAO,CAChE,CAAC,CACL,CAEA,SAASW,EAAsBvB,EAAWH,EAAM,CAC5C,IAAIW,EAAYX,EAAK,QAAQ,YAAY,EACrCQ,EAAWT,EAAWC,CAAI,EACzBQ,IAIDN,EAAUC,EAAWH,CAAI,EACzBQ,EAAS,gBAAgB,gBAAgB,EAEzCA,EAAS,aAAa,iBAAkB,IAAMG,EAAU,aAAa,IAAI,CAAC,EAElF,CAEA,MAAO,CACH,SAAU,0BAGV,WAAY,SAASgB,EAAU,CAC3BA,EAAarB,EAAIT,EAAG,OAAQ,sCAAsC,EAAG,CACjE,UAAW,qBACX,MAAO,WACX,CAAC,CACL,EACA,WAAY,+BACZ,SAAU,
|
|
6
|
-
"names": ["GridEditor", "all", "root", "selector", "one", "children", "node", "selector", "each", "child", "element", "tag", "attributes", "text", "node", "name", "value", "addClass", "node", "names", "split", "name", "removeClass", "toggleClass", "state", "hasClass", "hide", "node", "visible", "node", "DEFAULT_DURATION", "animateAway", "node", "frames", "duration", "done", "finish", "hide", "visible", "animation", "called", "once", "slideUp", "style", "GridEditor", "ge", "answered", "collapseOf", "item", "child", "staysOpen", "container", "ignore", "items", "all", "ignored", "collapse", "addAccordionItemTo", "options", "accordion", "id", "number", "children", "open", "stayOpen", "element", "header", "button", "toggleClass", "body", "toggleAccordionItem", "opening", "other", "setAccordionItemOpen", "reparentAccordionItem", "sortable", "
|
|
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 * Accordions for grid-editor.\n *\n * A container plugin: load this file after the editor and the toolbar offers\n * an accordion. 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.accordion.min.js\"></script>\n */\nimport { GridEditor } from '../grideditor.js';\nimport * as dom from '../dom.js';\n\nObject.assign(GridEditor.locales.en, {\n 'container.add_accordion': 'Accordion',\n 'container.add_accordion_item': 'Add item',\n 'container.accordion_label': 'Item {number}',\n 'confirm.delete_accordion_item': 'Delete this item and everything in it?',\n});\n\nGridEditor.containers.accordion = function(ge) {\n\n // The buttons whose clicks the editor answers itself, bound once each\n var answered = new WeakSet();\n\n function collapseOf(item) {\n return dom.child(item, '.accordion-collapse');\n }\n\n function staysOpen(container, ignore) {\n var items = dom.all(container, ':scope > .accordion > .accordion-item > .accordion-collapse');\n\n if (ignore) {\n var ignored = collapseOf(ignore);\n items = items.filter(function(collapse) { return collapse !== ignored; });\n }\n\n return items.length > 0 && !items.filter(function(collapse) {\n return collapse.hasAttribute('data-bs-parent');\n }).length;\n }\n\n function addAccordionItemTo(container, options) {\n options = options || {};\n\n var accordion = dom.child(container, '.accordion');\n var id = ge.containerId('acc-item');\n var number = dom.children(accordion, '.accordion-item').length + 1;\n var open = options.open === undefined ? number === 1 : !!options.open;\n var stayOpen = options.stay_open === undefined ? staysOpen(container) : !!options.stay_open;\n\n var item = accordion.appendChild(dom.element('div', { 'class': 'accordion-item ge-accordion-item' }));\n\n var header = item.appendChild(dom.element('h2', { 'class': 'accordion-header' }));\n var button = header.appendChild(dom.element('button', {\n 'class': 'accordion-button',\n type: 'button',\n 'data-bs-toggle': 'collapse',\n 'data-bs-target': '#' + id,\n 'aria-expanded': open ? 'true' : 'false',\n }));\n dom.toggleClass(button, 'collapsed', !open);\n button.appendChild(dom.element('span', { 'class': 'ge-pane-label' },\n options.label || ge.t('container.accordion_label', { number: number })));\n\n var collapse = item.appendChild(dom.element('div', {\n 'class': 'accordion-collapse collapse',\n id: id,\n 'data-ge-open': open ? 'true' : 'false',\n }));\n dom.toggleClass(collapse, 'show', open);\n\n if (!stayOpen) { collapse.setAttribute('data-bs-parent', '#' + accordion.getAttribute('id')); }\n\n var body = collapse.appendChild(dom.element('div', { 'class': 'accordion-body' }));\n body.appendChild(ge.defaultRegion());\n return body;\n }\n\n function toggleAccordionItem(container, item) {\n var collapse = collapseOf(item);\n var opening = collapse.getAttribute('data-ge-open') !== 'true';\n\n if (opening && !staysOpen(container)) {\n dom.all(container, ':scope > .accordion > .accordion-item').forEach(function(other) {\n if (other !== item) { setAccordionItemOpen(other, false); }\n });\n }\n\n setAccordionItemOpen(item, opening);\n }\n\n function setAccordionItemOpen(item, open) {\n var collapse = collapseOf(item);\n if (collapse) {\n collapse.setAttribute('data-ge-open', open ? 'true' : 'false');\n dom.toggleClass(collapse, 'show', open);\n }\n\n dom.all(item, ':scope > .accordion-header .accordion-button').forEach(function(button) {\n dom.toggleClass(button, 'collapsed', !open);\n button.setAttribute('aria-expanded', open ? 'true' : 'false');\n });\n }\n\n function reparentAccordionItem(container, item) {\n var accordion = item.closest('.accordion');\n var collapse = collapseOf(item);\n if (!collapse) { return; }\n\n // The item that just arrived still carries the parent it had\n // where it came from, so it is not asked what this accordion does\n if (staysOpen(container, item)) {\n collapse.removeAttribute('data-bs-parent');\n } else {\n collapse.setAttribute('data-bs-parent', '#' + accordion.getAttribute('id'));\n }\n }\n\n return {\n labelKey: 'container.add_accordion',\n\n // Items sort within their accordion and into any other one\n onSortable: function(sortable) {\n sortable(dom.all(ge.canvas, '.ge-container-accordion > .accordion'), {\n draggable: '.ge-accordion-item',\n group: 'accordion',\n });\n },\n addPaneKey: 'container.add_accordion_item',\n paneKind: 'accordion-item',\n\n // Where rows go: the body of the item that is open, or of the item\n regionOf: function(container, item) {\n var open = item || dom.all(container, ':scope > .accordion > .accordion-item').filter(function(each) {\n return dom.hasClass(collapseOf(each), 'show');\n })[0];\n\n return open ? dom.one(open, '.accordion-body') : null;\n },\n\n create: function(options) {\n var container = dom.element('div', { 'data-ge-container': 'accordion' });\n var labels = options.labels || [];\n var count = options.items || labels.length || 2;\n\n container.appendChild(dom.element('div', { 'class': 'accordion', id: ge.containerId('accordion') }));\n\n for (var i = 0; i < count; i++) {\n addAccordionItemTo(container, {\n label: labels[i],\n open: i === 0,\n stay_open: options.stay_open,\n });\n }\n\n return container;\n },\n\n addPane: addAccordionItemTo,\n\n mark: function(container) {\n dom.all(container, ':scope > .accordion > .accordion-item').forEach(function(item) {\n dom.addClass(item, 'ge-accordion-item');\n var collapse = collapseOf(item);\n\n // What the author wanted, before Bootstrap's own\n // toggles get a chance to change it while editing.\n // Every item is shown while editing (the stylesheet\n // does that), so this is the only record of it.\n if (collapse && !collapse.hasAttribute('data-ge-open')) {\n collapse.setAttribute('data-ge-open', dom.hasClass(collapse, 'show') ? 'true' : 'false');\n }\n\n var button = dom.one(item, ':scope > .accordion-header .accordion-button');\n\n if (button) {\n // Bootstrap's collapse stays out of it, and the editor\n // answers the click itself\n ge.suspendToggles(button);\n ge.makeLabelEditable(ge.labelIn(button));\n\n if (!answered.has(button)) {\n answered.add(button);\n button.addEventListener('click', function(e) {\n if (ge.labelIn(button).getAttribute('contenteditable') === 'true') { return; }\n\n e.preventDefault();\n toggleAccordionItem(container, item);\n });\n }\n }\n\n if (dom.child(item, '.ge-tools-drawer')) { return; }\n\n ge.createPaneControls(item, 'accordion-item', ge.settings.accordion_tools,\n ge.t('confirm.delete_accordion_item'), function(removed) {\n dom.slideUp(item, 200, removed);\n });\n });\n },\n\n unmark: function(container) {\n ge.resumeToggles(container);\n\n // What the canvas was showing is what the page ships\n dom.all(container, ':scope > .accordion > .accordion-item').forEach(function(item) {\n var collapse = collapseOf(item);\n setAccordionItemOpen(item, !!collapse && collapse.getAttribute('data-ge-open') === 'true');\n });\n\n dom.all(container, '.ge-accordion-item').forEach(function(item) {\n dom.removeClass(item, 'ge-accordion-item');\n });\n ge.unwrapLabels(container);\n },\n\n // The same, on a copy of the canvas: unmark only touches markup\n cleanMarkup: function(root) {\n var definition = this;\n dom.all(root, '[data-ge-container=\"accordion\"]').forEach(function(container) { definition.unmark(container); });\n },\n\n afterPaneMove: function(container, item) {\n reparentAccordionItem(container, item);\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,CAGO,SAASC,EAAIF,EAAMC,EAAU,CAChC,OAAOD,EAAOA,EAAK,cAAcC,CAAQ,EAAI,IACjD,CAYO,SAASE,EAASC,EAAMC,EAAU,CACrC,OAAKD,EAEE,MAAM,UAAU,OAAO,KAAKA,EAAK,SAAU,SAASE,EAAM,CAC7D,MAAO,CAACD,GAAYC,EAAK,QAAQD,CAAQ,CAC7C,CAAC,EAJmB,CAAC,CAKzB,CAGO,SAASE,EAAMH,EAAMC,EAAU,CAClC,OAAOF,EAASC,EAAMC,CAAQ,EAAE,CAAC,GAAK,IAC1C,CA6DO,SAASG,EAAQC,EAAKC,EAAYC,E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AEtCH,EAAG,mBAAmBG,EAAM,iBAAkBH,EAAG,SAAS,gBACtDA,EAAG,EAAE,+BAA+B,EAAG,SAASuC,EAAS,CACjDC,EAAQrC,EAAM,IAAKoC,CAAO,CAClC,CAAC,CACT,CAAC,CACL,EAEA,OAAQ,SAASjC,EAAW,CACxBN,EAAG,cAAcM,CAAS,EAGtBG,EAAIH,EAAW,uCAAuC,EAAE,QAAQ,SAASH,EAAM,CAC/E,IAAIQ,EAAWT,EAAWC,CAAI,EAC9ByB,EAAqBzB,EAAM,CAAC,CAACQ,GAAYA,EAAS,aAAa,cAAc,IAAM,MAAM,CAC7F,CAAC,EAEGF,EAAIH,EAAW,oBAAoB,EAAE,QAAQ,SAASH,EAAM,CACxDsC,EAAYtC,EAAM,mBAAmB,CAC7C,CAAC,EACDH,EAAG,aAAaM,CAAS,CAC7B,EAGA,YAAa,SAASoC,EAAM,CACxB,IAAIC,EAAa,KACblC,EAAIiC,EAAM,iCAAiC,EAAE,QAAQ,SAASpC,EAAW,CAAEqC,EAAW,OAAOrC,CAAS,CAAG,CAAC,CAClH,EAEA,cAAe,SAASA,EAAWH,EAAM,CACrC0B,EAAsBvB,EAAWH,CAAI,CACzC,CACJ,CACJ",
|
|
6
|
+
"names": ["GridEditor", "all", "root", "selector", "one", "children", "node", "selector", "each", "child", "element", "tag", "attributes", "text", "node", "name", "value", "addClass", "node", "names", "split", "name", "removeClass", "toggleClass", "state", "hasClass", "hide", "node", "visible", "node", "DEFAULT_DURATION", "animateAway", "node", "frames", "duration", "done", "finish", "hide", "visible", "animation", "called", "once", "slideUp", "style", "GridEditor", "ge", "answered", "collapseOf", "item", "child", "staysOpen", "container", "ignore", "items", "all", "ignored", "collapse", "addAccordionItemTo", "options", "accordion", "id", "number", "children", "open", "stayOpen", "element", "header", "button", "toggleClass", "body", "toggleAccordionItem", "opening", "other", "setAccordionItemOpen", "reparentAccordionItem", "sortable", "each", "hasClass", "one", "labels", "count", "i", "addClass", "e", "removed", "slideUp", "removeClass", "root", "definition"]
|
|
7
7
|
}
|
|
@@ -36,6 +36,10 @@ GridEditor.containers.card = function(ge) {
|
|
|
36
36
|
}
|
|
37
37
|
return {
|
|
38
38
|
labelKey: "container.add_card",
|
|
39
|
+
// Where rows go: the card's body
|
|
40
|
+
regionOf: function(container) {
|
|
41
|
+
return one(container, ".card-body");
|
|
42
|
+
},
|
|
39
43
|
/**
|
|
40
44
|
* A card is a header, a body and an optional footer. `header: false`
|
|
41
45
|
* leaves the title out, `footer: true` or a string adds one; both are
|
|
@@ -40,6 +40,10 @@
|
|
|
40
40
|
}
|
|
41
41
|
return {
|
|
42
42
|
labelKey: "container.add_card",
|
|
43
|
+
// Where rows go: the card's body
|
|
44
|
+
regionOf: function(container) {
|
|
45
|
+
return one(container, ".card-body");
|
|
46
|
+
},
|
|
43
47
|
/**
|
|
44
48
|
* A card is a header, a body and an optional footer. `header: false`
|
|
45
49
|
* leaves the title out, `footer: true` or a string adds one; both are
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var u=window.GridEditor;if(!u||typeof u.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
|
|
1
|
+
(()=>{var u=window.GridEditor;if(!u||typeof u.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 l(t,r){return t?Array.prototype.slice.call(t.querySelectorAll(r)):[]}function f(t,r){return t?t.querySelector(r):null}function i(t,r,e){var n=document.createElement(t);return Object.keys(r||{}).forEach(function(o){var a=r[o];a!=null&&a!==!1&&n.setAttribute(o,a)}),e!=null&&(n.textContent=e),n}Object.assign(u.locales.en,{"container.add_card":"Card","container.card_title":"Card title","container.card_footer":"Card footer"});u.containers.card=function(t){function r(e){e&&t.makeLabelEditable(t.labelIn(e))}return{labelKey:"container.add_card",regionOf:function(e){return f(e,".card-body")},create:function(e){var n=i("div",{class:"card"});if(e.header!==!1){var o=n.appendChild(i("div",{class:"card-header"}));o.appendChild(i("span",{class:"ge-pane-label"},e.title||t.t("container.card_title")))}if(n.appendChild(i("div",{class:"card-body"})).appendChild(t.defaultRegion()),e.footer){var a=n.appendChild(i("div",{class:"card-footer text-body-secondary"}));a.appendChild(i("span",{class:"ge-pane-label"},typeof e.footer=="string"?e.footer:t.t("container.card_footer")))}var c=i("div",{"data-ge-container":"card"});return c.appendChild(n),c},mark:function(e){r(f(e,":scope > .card > .card-header")),r(f(e,":scope > .card > .card-footer"))},unmark:function(e){t.unwrapLabels(e)},cleanMarkup:function(e){var n=this;l(e,'[data-ge-container="card"]').forEach(function(o){n.unmark(o)})}}};})();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/js/register.js", "../../src/js/dom.js", "../../src/js/plugins/grideditor.card.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 * Cards for grid-editor.\n *\n * A container plugin: load this file after the editor and the toolbar offers\n * a card, a bootstrap card whose body is an editable region. What it can ask\n * the editor for is the handle its factory is called with, described in\n * docs/plugins.md.\n *\n * <script src=\"dist/grideditor.min.js\"></script>\n * <script src=\"dist/plugins/grideditor.card.min.js\"></script>\n */\nimport { GridEditor } from '../grideditor.js';\nimport * as dom from '../dom.js';\n\nObject.assign(GridEditor.locales.en, {\n 'container.add_card': 'Card',\n 'container.card_title': 'Card title',\n 'container.card_footer': 'Card footer',\n});\n\nGridEditor.containers.card = function(ge) {\n\n /** A header's or a footer's text, editable in place, when the card has one. */\n function editable(part) {\n if (part) { ge.makeLabelEditable(ge.labelIn(part)); }\n }\n\n return {\n labelKey: 'container.add_card',\n\n /**\n * A card is a header, a body and an optional footer. `header: false`\n * leaves the title out, `footer: true` or a string adds one; both are\n * plain text the editor makes editable, not regions, so a card holds\n * exactly one region and nests like any other container.\n */\n create: function(options) {\n var card = dom.element('div', { 'class': 'card' });\n\n if (options.header !== false) {\n var header = card.appendChild(dom.element('div', { 'class': 'card-header' }));\n header.appendChild(dom.element('span', { 'class': 'ge-pane-label' },\n options.title || ge.t('container.card_title')));\n }\n\n card.appendChild(dom.element('div', { 'class': 'card-body' })).appendChild(ge.defaultRegion());\n\n if (options.footer) {\n var footer = card.appendChild(dom.element('div', { 'class': 'card-footer text-body-secondary' }));\n footer.appendChild(dom.element('span', { 'class': 'ge-pane-label' },\n typeof options.footer === 'string' ? options.footer : ge.t('container.card_footer')));\n }\n\n var container = dom.element('div', { 'data-ge-container': 'card' });\n container.appendChild(card);\n return container;\n },\n\n mark: function(container) {\n editable(dom.one(container, ':scope > .card > .card-header'));\n editable(dom.one(container, ':scope > .card > .card-footer'));\n },\n\n unmark: function(container) {\n ge.unwrapLabels(container);\n },\n\n // The same, on a copy of the canvas: unmark only touches markup\n cleanMarkup: function(root) {\n var definition = this;\n dom.all(root, '[data-ge-container=\"card\"]').forEach(function(container) { definition.unmark(container); });\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,CAGO,SAASC,EAAIF,EAAMC,EAAU,CAChC,OAAOD,EAAOA,EAAK,cAAcC,CAAQ,EAAI,IACjD,CAoFO,SAASE,EAAQC,EAAKC,EAAYC,EAAM,CAC3C,IAAIC,EAAO,SAAS,cAAcH,CAAG,EAErC,cAAO,KAAKC,GAAc,CAAC,CAAC,EAAE,QAAQ,SAASG,EAAM,CACjD,IAAIC,EAAQJ,EAAWG,CAAI,EACvBC,GAAU,MAA+BA,IAAU,IAASF,EAAK,aAAaC,EAAMC,CAAK,CACjG,CAAC,EACyBH,GAAS,OAAQC,EAAK,YAAcD,GAEvDC,CACX,CCrGA,OAAO,OAAOG,EAAW,QAAQ,GAAI,CACjC,qBAAsB,OACtB,uBAAwB,aACxB,wBAAyB,aAC7B,CAAC,EAEDA,EAAW,WAAW,KAAO,SAASC,EAAI,CAGtC,SAASC,EAASC,EAAM,CAChBA,GAAQF,EAAG,kBAAkBA,EAAG,QAAQE,CAAI,CAAC,CACrD,CAEA,MAAO,CACH,SAAU,
|
|
6
|
-
"names": ["GridEditor", "all", "root", "selector", "one", "element", "tag", "attributes", "text", "node", "name", "value", "GridEditor", "ge", "editable", "part", "
|
|
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 * Cards for grid-editor.\n *\n * A container plugin: load this file after the editor and the toolbar offers\n * a card, a bootstrap card whose body is an editable region. What it can ask\n * the editor for is the handle its factory is called with, described in\n * docs/plugins.md.\n *\n * <script src=\"dist/grideditor.min.js\"></script>\n * <script src=\"dist/plugins/grideditor.card.min.js\"></script>\n */\nimport { GridEditor } from '../grideditor.js';\nimport * as dom from '../dom.js';\n\nObject.assign(GridEditor.locales.en, {\n 'container.add_card': 'Card',\n 'container.card_title': 'Card title',\n 'container.card_footer': 'Card footer',\n});\n\nGridEditor.containers.card = function(ge) {\n\n /** A header's or a footer's text, editable in place, when the card has one. */\n function editable(part) {\n if (part) { ge.makeLabelEditable(ge.labelIn(part)); }\n }\n\n return {\n labelKey: 'container.add_card',\n\n // Where rows go: the card's body\n regionOf: function(container) {\n return dom.one(container, '.card-body');\n },\n\n /**\n * A card is a header, a body and an optional footer. `header: false`\n * leaves the title out, `footer: true` or a string adds one; both are\n * plain text the editor makes editable, not regions, so a card holds\n * exactly one region and nests like any other container.\n */\n create: function(options) {\n var card = dom.element('div', { 'class': 'card' });\n\n if (options.header !== false) {\n var header = card.appendChild(dom.element('div', { 'class': 'card-header' }));\n header.appendChild(dom.element('span', { 'class': 'ge-pane-label' },\n options.title || ge.t('container.card_title')));\n }\n\n card.appendChild(dom.element('div', { 'class': 'card-body' })).appendChild(ge.defaultRegion());\n\n if (options.footer) {\n var footer = card.appendChild(dom.element('div', { 'class': 'card-footer text-body-secondary' }));\n footer.appendChild(dom.element('span', { 'class': 'ge-pane-label' },\n typeof options.footer === 'string' ? options.footer : ge.t('container.card_footer')));\n }\n\n var container = dom.element('div', { 'data-ge-container': 'card' });\n container.appendChild(card);\n return container;\n },\n\n mark: function(container) {\n editable(dom.one(container, ':scope > .card > .card-header'));\n editable(dom.one(container, ':scope > .card > .card-footer'));\n },\n\n unmark: function(container) {\n ge.unwrapLabels(container);\n },\n\n // The same, on a copy of the canvas: unmark only touches markup\n cleanMarkup: function(root) {\n var definition = this;\n dom.all(root, '[data-ge-container=\"card\"]').forEach(function(container) { definition.unmark(container); });\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,CAGO,SAASC,EAAIF,EAAMC,EAAU,CAChC,OAAOD,EAAOA,EAAK,cAAcC,CAAQ,EAAI,IACjD,CAoFO,SAASE,EAAQC,EAAKC,EAAYC,EAAM,CAC3C,IAAIC,EAAO,SAAS,cAAcH,CAAG,EAErC,cAAO,KAAKC,GAAc,CAAC,CAAC,EAAE,QAAQ,SAASG,EAAM,CACjD,IAAIC,EAAQJ,EAAWG,CAAI,EACvBC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AAW,+BAA+B,CAAC,EAC5DF,EAAaG,EAAID,EAAW,+BAA+B,CAAC,CAChE,EAEA,OAAQ,SAASA,EAAW,CACxBH,EAAG,aAAaG,CAAS,CAC7B,EAGA,YAAa,SAASO,EAAM,CACxB,IAAIC,EAAa,KACbC,EAAIF,EAAM,4BAA4B,EAAE,QAAQ,SAASP,EAAW,CAAEQ,EAAW,OAAOR,CAAS,CAAG,CAAC,CAC7G,CACJ,CACJ",
|
|
6
|
+
"names": ["GridEditor", "all", "root", "selector", "one", "element", "tag", "attributes", "text", "node", "name", "value", "GridEditor", "ge", "editable", "part", "container", "one", "options", "card", "element", "header", "footer", "root", "definition", "all"]
|
|
7
7
|
}
|
|
@@ -668,6 +668,10 @@ GridEditor.containers.carousel = function(ge) {
|
|
|
668
668
|
labelKey: "container.add_carousel",
|
|
669
669
|
addPaneKey: "container.add_carousel_item",
|
|
670
670
|
paneKind: "carousel-item",
|
|
671
|
+
// Where rows go: the slide showing, or the slide itself
|
|
672
|
+
regionOf: function(container, item) {
|
|
673
|
+
return item || currentOf(container);
|
|
674
|
+
},
|
|
671
675
|
paneClass: "ge-carousel-item",
|
|
672
676
|
paneLabelKey: "panel.kind_carousel_item",
|
|
673
677
|
/**
|
|
@@ -672,6 +672,10 @@
|
|
|
672
672
|
labelKey: "container.add_carousel",
|
|
673
673
|
addPaneKey: "container.add_carousel_item",
|
|
674
674
|
paneKind: "carousel-item",
|
|
675
|
+
// Where rows go: the slide showing, or the slide itself
|
|
676
|
+
regionOf: function(container, item) {
|
|
677
|
+
return item || currentOf(container);
|
|
678
|
+
},
|
|
675
679
|
paneClass: "ge-carousel-item",
|
|
676
680
|
paneLabelKey: "panel.kind_carousel_item",
|
|
677
681
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var _=window.GridEditor;if(!_||typeof _.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 z(n,i){return n?Array.prototype.slice.call(n.querySelectorAll(i)):[]}function x(n,i){return n?Array.prototype.filter.call(n.children,function(u){return!i||u.matches(i)}):[]}function f(n,i){return x(n,i)[0]||null}function c(n,i,u){var s=document.createElement(n);return Object.keys(i||{}).forEach(function(b){var m=i[b];m!=null&&m!==!1&&s.setAttribute(b,m)}),u!=null&&(s.textContent=u),s}function F(n,i){return j(i).forEach(function(u){n.classList.add(u)}),n}function y(n,i){return j(i).forEach(function(u){n.classList.remove(u)}),n}function C(n,i,u){return j(i).forEach(function(s){u===void 0?n.classList.toggle(s):n.classList.toggle(s,!!u)}),n}function K(n,i){return!!n&&n.nodeType===1&&n.classList.contains(i)}function j(n){return String(n||"").split(/\s+/).filter(Boolean)}function D(n){return n.getAttribute("class")||n.removeAttribute("class"),n}function he(n){return n.style.display="none",n}function be(n){return!!(n.offsetWidth||n.offsetHeight||n.getClientRects().length)}var ge=400;function xe(n,i,u,s){u=u===void 0?ge:u;var b=function(){he(n),s&&s()};if(!be(n)||!n.animate||u<=0){window.setTimeout(b,0);return}var m=n.animate(i(getComputedStyle(n)),{duration:u,easing:"ease-in-out"}),h=!1,E=function(){h||(h=!0,b())};m.onfinish=E,m.oncancel=E}function Y(n,i,u){xe(n,function(s){return[{opacity:s.opacity},{opacity:0}]},i,u)}Object.assign(_.locales.en,{"container.add_carousel":"Carousel","container.add_carousel_item":"Add slide","confirm.delete_carousel_item":"Delete this slide and everything in it?","panel.kind_carousel_item":"Slide","container.carousel_previous":"Previous","container.carousel_next":"Next","container.carousel_slide_label":"Slide {number}","container.carousel_counter":"{current} / {total}","tool.carousel_show_previous":"Previous slide","tool.carousel_show_next":"Next slide","tool.carousel_move_back":"Move back","tool.carousel_move_forward":"Move forward","container.carousel_section":"Carousel","container.carousel_controls":"Arrows","container.carousel_indicators":"Indicators","container.carousel_fade":"Fade","container.carousel_dark":"Dark theme","container.carousel_ride":"Autoplay","container.carousel_ride_no":"No","container.carousel_ride_load":"On load","container.carousel_ride_interaction":"After first interaction","container.carousel_interval":"Interval (s)","container.carousel_pause":"Pause on hover","container.carousel_wrap":"Wrap around","container.carousel_keyboard":"Keyboard","container.carousel_touch":"Touch swipe","container.carousel_item_section":"Slide"});var k={controls:!0,indicators:!0,fade:!1,dark:!1,ride:!1,interval:null,pause:!0,wrap:!0,keyboard:!0,touch:!0,slides:2},ye=["controls","indicators","fade","dark"],Q=["pause","wrap","keyboard","touch"],Ce={controls:{labelKey:"container.carousel_controls"},indicators:{labelKey:"container.carousel_indicators"},fade:{labelKey:"container.carousel_fade"},dark:{labelKey:"container.carousel_dark"},pause:{labelKey:"container.carousel_pause"},wrap:{labelKey:"container.carousel_wrap"},keyboard:{labelKey:"container.carousel_keyboard"},touch:{labelKey:"container.carousel_touch"}},Ee={labelKey:"container.carousel_ride"},Z={labelKey:"container.carousel_interval"},re=[!1,"carousel","true"],B=1e3,$="carousel-item-next carousel-item-prev carousel-item-start carousel-item-end";function ne(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n&&n>=B}var ee={ride:function(n){return re.indexOf(n)!==-1},interval:function(n){return n===null||ne(n)},slides:function(n){return typeof n=="number"&&Math.floor(n)===n&&n>=1}};function te(n){return n==="ride"?JSON.stringify(re):n==="interval"?"null or an integer of "+B+" or more":n==="slides"?"an integer of 1 or more":"[true,false]"}function we(n,i){return ee[n]?ee[n](i):typeof i=="boolean"}var Ae=0;_.containers.carousel=function(n){var i=new WeakMap,u=[];function s(t){return f(t,".carousel")}function b(t){return f(s(t),".carousel-inner")}function m(t){return!!b(t)}function h(t){return x(b(t),".carousel-item")}function E(t){return t.getAttribute("id")||t.setAttribute("id",n.containerId("carousel")),t.getAttribute("id")}function oe(t,e){var r=t.getAttribute("data-bs-"+e);return r===null?t.getAttribute("data-ge-bs-"+e):r}function H(t){var e=parseInt(t.getAttribute("data-bs-interval"),10);return isFinite(e)&&e>0?e:null}function S(t,e){e===null?t.removeAttribute("data-bs-interval"):t.setAttribute("data-bs-interval",String(e))}function ae(t){var e=s(t),r=oe(e,"ride"),o=function(a){return e.getAttribute("data-bs-"+a)!=="false"};return{controls:!!f(e,".carousel-control-prev, .carousel-control-next"),indicators:!!f(e,".carousel-indicators"),fade:K(e,"carousel-fade"),dark:e.getAttribute("data-bs-theme")==="dark",ride:r==="carousel"||r==="true"?r:!1,interval:H(e),pause:o("pause"),wrap:o("wrap"),keyboard:o("keyboard"),touch:o("touch")}}function P(t,e){var r=c("button",{class:"carousel-control-"+e,type:"button","data-bs-target":"#"+E(t),"data-bs-slide":e});return r.appendChild(c("span",{class:"carousel-control-"+e+"-icon","aria-hidden":"true"})),r.appendChild(c("span",{class:"visually-hidden"},e==="prev"?n.t("container.carousel_previous"):n.t("container.carousel_next"))),r}function ie(t,e){var r=s(t);x(r,".carousel-control-prev, .carousel-control-next").forEach(function(o){o.remove()}),e&&(r.appendChild(P(r,"prev")),r.appendChild(P(r,"next")))}function le(t,e){var r=s(t),o=f(r,".carousel-indicators");if(!e){o&&o.remove();return}o||(o=r.insertBefore(c("div",{class:"carousel-indicators"}),r.firstChild)),O(t)}function O(t,e){var r=s(t),o=f(r,".carousel-indicators");if(o){e=e||h(t);var a=E(r),l=0;e.forEach(function(d,p){K(d,"active")&&(l=p)}),o.textContent="",e.forEach(function(d,p){o.appendChild(c("button",{type:"button","data-bs-target":"#"+a,"data-bs-slide-to":String(p),"aria-label":n.t("container.carousel_slide_label",{number:p+1})}))}),L(t,e.length?l:-1)}}function L(t,e){var r=f(s(t),".carousel-indicators");x(r).forEach(function(o,a){C(o,"active",a===e),a===e?o.setAttribute("aria-current","true"):o.removeAttribute("aria-current")})}function U(t,e,r){var o=s(t);e==="controls"&&ie(t,r),e==="indicators"&&le(t,r),e==="fade"&&C(o,"carousel-fade",r),e==="dark"&&(r?o.setAttribute("data-bs-theme","dark"):o.getAttribute("data-bs-theme")==="dark"&&o.removeAttribute("data-bs-theme")),e==="ride"&&(o.removeAttribute("data-bs-ride"),o.removeAttribute("data-ge-bs-ride"),r&&o.setAttribute("data-bs-ride",r)),e==="interval"&&S(o,r),Q.indexOf(e)!==-1&&(r?o.removeAttribute("data-bs-"+e):o.setAttribute("data-bs-"+e,"false")),D(o)}function J(t,e){var r=n.settings.carousel||{},o=t[e]!==void 0?t[e]:r[e];return o===void 0?k[e]:we(e,o)?o:(n.warn("carousel: "+JSON.stringify(o)+" is not a "+e+", which takes "+te(e)+": "+JSON.stringify(k[e])+" is used"),k[e])}function N(t){var e=s(t);x(e,".carousel-control-prev, .carousel-control-next").forEach(n.suspendToggles),x(f(e,".carousel-indicators")).forEach(n.suspendToggles);var r=e.getAttribute("data-bs-ride");r!==null&&(e.setAttribute("data-ge-bs-ride",r),e.removeAttribute("data-bs-ride"))}function ue(t){var e=_.bootstrap||window.bootstrap,r=e&&e.Carousel?e.Carousel.getInstance(t):null;r&&(r.pause(),r.dispose())}function V(t,e,r){var o=b(t).appendChild(c("div",{class:e?"carousel-item active":"carousel-item"}));return o.appendChild(n.defaultRegion()),r!=null&&S(o,r),o}function w(t){var e=h(t),r=i.get(t);return r&&e.indexOf(r)!==-1?r:e.filter(function(o){return K(o,"active")})[0]||e[0]||null}function A(t,e,r){r=r||h(t),r.forEach(function(o){C(o,"active",o===e)}),e?i.set(t,e):i.delete(t),L(t,r.indexOf(e)),G(t)}function q(t,e){var r=h(t);if(!(r.length<2)){var o=r.indexOf(w(t));A(t,r[(o+e+r.length)%r.length])}}function T(t,e){t&&(C(t,"disabled",e),e?t.setAttribute("aria-disabled","true"):t.removeAttribute("aria-disabled"))}function I(t){return t.getAttribute("aria-disabled")==="true"}function G(t){var e=h(t),r=f(t,".ge-container-drawer"),o=e.indexOf(w(t));if(r){var a=f(r,".ge-carousel-counter");a&&(a.textContent=n.t("container.carousel_counter",{current:e.length?o+1:0,total:e.length})),T(f(r,".ge-carousel-previous"),e.length<2),T(f(r,".ge-carousel-next"),e.length<2)}e.forEach(function(l,d){var p=f(l,".ge-pane-drawer");T(f(p,".ge-carousel-move-back"),d===0),T(f(p,".ge-carousel-move-forward"),d===e.length-1)})}function W(t,e,r){var o=b(t),a=h(t),l=a.indexOf(e),d=l+r;if(!(d<0||d>=a.length)){var p={parent:o,index:l};n.operate(function(){n.emit("before-move",n.payloadFor("carousel-item",e,{parent:o,source:"tool",from:p}))&&(o.insertBefore(e,r<0?a[d]:a[d].nextSibling),A(t,w(t)),O(t),N(t),n.emit("after-move",n.payloadFor("carousel-item",e,{parent:o,source:"tool",from:p,to:{parent:o,index:d},container:t})))})}}function se(t,e,r){Y(e,200,function(){var o=h(t),a=o.filter(function(l){return l!==e});w(t)===e&&A(t,a[Math.min(o.indexOf(e),a.length-1)]||null,a),O(t,a),r()})}function ce(t,e){var r=n.createPaneControls(e,"carousel-item",n.settings.carousel_tools,n.t("confirm.delete_carousel_item"),function(d){se(t,e,d)}),o=f(r,".ge-move");o&&o.remove();var a=n.createTool(r,n.t("tool.carousel_move_back"),"ge-carousel-move-back","bi bi-arrow-left",function(){I(this)||W(t,e,-1)}),l=n.createTool(r,n.t("tool.carousel_move_forward"),"ge-carousel-move-forward","bi bi-arrow-right",function(){I(this)||W(t,e,1)});r.insertBefore(l,r.firstChild),r.insertBefore(a,l)}function de(t,e){if(e=e||{},!m(t))return n.warn("carousel: there is no .carousel-inner to add a slide to"),null;var r=null;e.interval!==void 0&&e.interval!==null&&(ne(e.interval)?r=e.interval:n.warn("carousel: "+JSON.stringify(e.interval)+" is not a interval, which takes "+te("interval")+": null is used"));var o=V(t,!1,r);return A(t,o),O(t),o}function R(t,e,r){var o=c("div",{class:"ge-carousel-option mb-2"});return o.appendChild(c("label",{class:"form-label",for:r},n.t(t))),o.appendChild(e),o}function M(){return"ge-carousel-option-"+ ++Ae}function X(t,e){var r=M(),o=c("input",{class:"form-control form-control-sm",id:r,type:"number",step:"0.1",min:String(B/1e3)});return o.addEventListener("change",function(){var a=o.value.trim(),l=parseFloat(a);if(a==="")y(o,"is-invalid"),S(t,null);else if(!isFinite(l)||Math.round(l*1e3)<B){F(o,"is-invalid");return}else y(o,"is-invalid"),S(t,Math.round(l*1e3));e&&e()}),{id:r,input:o,render:function(){var a=H(t);y(o,"is-invalid"),o.value=a===null?"":String(a/1e3)}}}function fe(t,e){var r=M(),o=c("div",{class:"form-check"}),a=o.appendChild(c("input",{class:"form-check-input",type:"checkbox",id:r}));return o.appendChild(c("label",{class:"form-check-label",for:r},n.t(t))),a.addEventListener("change",function(){e(a.checked)}),{box:o,input:a}}function pe(t){var e=c("div",{class:"ge-carousel-options"}),r={};function o(v,g){U(t,v,g),N(t),p()}var a=M(),l=c("select",{class:"form-select form-select-sm",id:a});[{value:"false",labelKey:"container.carousel_ride_no"},{value:"carousel",labelKey:"container.carousel_ride_load"},{value:"true",labelKey:"container.carousel_ride_interaction"}].forEach(function(v){l.appendChild(c("option",{value:v.value},n.t(v.labelKey)))}),l.addEventListener("change",function(){o("ride",l.value==="false"?!1:l.value)}),e.appendChild(R(Ee.labelKey,l,a));var d=X(s(t),function(){p()});e.appendChild(R(Z.labelKey,d.input,d.id)),ye.concat(Q).forEach(function(v){var g=fe(Ce[v].labelKey,function(me){o(v,me)});r[v]=g.input,g.box.setAttribute("data-ge-carousel-option",v),e.appendChild(g.box)});function p(){var v=ae(t);l.value=String(v.ride),d.render(),Object.keys(r).forEach(function(g){r[g].checked=v[g]}),d.input.disabled=v.ride===!1,r.pause.disabled=v.ride===!1}return p(),u.push({node:t,element:e,render:p}),e}function ve(t){var e=c("div",{class:"ge-carousel-options"}),r=X(t);return e.appendChild(R(Z.labelKey,r.input,r.id)),r.render(),u.push({node:t,element:e,render:r.render}),e}return{labelKey:"container.add_carousel",addPaneKey:"container.add_carousel_item",paneKind:"carousel-item",paneClass:"ge-carousel-item",paneLabelKey:"panel.kind_carousel_item",create:function(t){t=t||{};var e=c("div",{"data-ge-container":"carousel"}),r=e.appendChild(c("div",{class:"carousel slide",id:n.containerId("carousel")})),o=J(t,"slides");r.appendChild(c("div",{class:"carousel-inner"}));for(var a=0;a<o;a++)V(e,a===0);return Object.keys(k).filter(function(l){return l!=="slides"}).forEach(function(l){U(e,l,J(t,l))}),e},addPane:de,mark:function(t){var e=s(t);if(!(!e||!m(t))){ue(e),N(t);var r=w(t);h(t).forEach(function(o){F(o,"ge-carousel-item"),y(o,$),f(o,".ge-tools-drawer")||ce(t,o)}),A(t,r)}},unmark:function(t){n.resumeToggles(t),m(t)&&(h(t).forEach(function(e,r){y(e,"ge-carousel-item "+$),C(e,"active",r===0),D(e)}),L(t,h(t).length?0:-1))},cleanMarkup:function(t){var e=this;z(t,'[data-ge-container="carousel"]').forEach(function(r){e.unmark(r)})},tools:function(t,e){if(m(e)){n.createTool(t,n.t("tool.carousel_show_previous"),"ge-carousel-previous","bi bi-chevron-left",function(){I(this)||q(e,-1)});var r=n.createTool(t,"","ge-carousel-counter","",null);r.textContent="",r.removeAttribute("title"),n.createTool(t,n.t("tool.carousel_show_next"),"ge-carousel-next","bi bi-chevron-right",function(){I(this)||q(e,1)}),G(e)}},panelSection:function(t,e){return e==="carousel"&&m(t)?{labelKey:"container.carousel_section",body:pe(t)}:e==="carousel-item"?{labelKey:"container.carousel_item_section",body:ve(t)}:null},onRefresh:function(t){u=u.filter(function(e){return e.element.isConnected}),u.forEach(function(e){(e.node===t||t.contains(e.node))&&e.render()})},onDeinit:function(){u=[]}}};})();
|
|
1
|
+
(()=>{var y=window.GridEditor;if(!y||typeof y.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 z(n,i){return n?Array.prototype.slice.call(n.querySelectorAll(i)):[]}function x(n,i){return n?Array.prototype.filter.call(n.children,function(u){return!i||u.matches(i)}):[]}function f(n,i){return x(n,i)[0]||null}function c(n,i,u){var s=document.createElement(n);return Object.keys(i||{}).forEach(function(b){var m=i[b];m!=null&&m!==!1&&s.setAttribute(b,m)}),u!=null&&(s.textContent=u),s}function F(n,i){return j(i).forEach(function(u){n.classList.add(u)}),n}function C(n,i){return j(i).forEach(function(u){n.classList.remove(u)}),n}function E(n,i,u){return j(i).forEach(function(s){u===void 0?n.classList.toggle(s):n.classList.toggle(s,!!u)}),n}function K(n,i){return!!n&&n.nodeType===1&&n.classList.contains(i)}function j(n){return String(n||"").split(/\s+/).filter(Boolean)}function D(n){return n.getAttribute("class")||n.removeAttribute("class"),n}function he(n){return n.style.display="none",n}function be(n){return!!(n.offsetWidth||n.offsetHeight||n.getClientRects().length)}var ge=400;function xe(n,i,u,s){u=u===void 0?ge:u;var b=function(){he(n),s&&s()};if(!be(n)||!n.animate||u<=0){window.setTimeout(b,0);return}var m=n.animate(i(getComputedStyle(n)),{duration:u,easing:"ease-in-out"}),h=!1,w=function(){h||(h=!0,b())};m.onfinish=w,m.oncancel=w}function Y(n,i,u){xe(n,function(s){return[{opacity:s.opacity},{opacity:0}]},i,u)}Object.assign(y.locales.en,{"container.add_carousel":"Carousel","container.add_carousel_item":"Add slide","confirm.delete_carousel_item":"Delete this slide and everything in it?","panel.kind_carousel_item":"Slide","container.carousel_previous":"Previous","container.carousel_next":"Next","container.carousel_slide_label":"Slide {number}","container.carousel_counter":"{current} / {total}","tool.carousel_show_previous":"Previous slide","tool.carousel_show_next":"Next slide","tool.carousel_move_back":"Move back","tool.carousel_move_forward":"Move forward","container.carousel_section":"Carousel","container.carousel_controls":"Arrows","container.carousel_indicators":"Indicators","container.carousel_fade":"Fade","container.carousel_dark":"Dark theme","container.carousel_ride":"Autoplay","container.carousel_ride_no":"No","container.carousel_ride_load":"On load","container.carousel_ride_interaction":"After first interaction","container.carousel_interval":"Interval (s)","container.carousel_pause":"Pause on hover","container.carousel_wrap":"Wrap around","container.carousel_keyboard":"Keyboard","container.carousel_touch":"Touch swipe","container.carousel_item_section":"Slide"});var k={controls:!0,indicators:!0,fade:!1,dark:!1,ride:!1,interval:null,pause:!0,wrap:!0,keyboard:!0,touch:!0,slides:2},ye=["controls","indicators","fade","dark"],Q=["pause","wrap","keyboard","touch"],Ce={controls:{labelKey:"container.carousel_controls"},indicators:{labelKey:"container.carousel_indicators"},fade:{labelKey:"container.carousel_fade"},dark:{labelKey:"container.carousel_dark"},pause:{labelKey:"container.carousel_pause"},wrap:{labelKey:"container.carousel_wrap"},keyboard:{labelKey:"container.carousel_keyboard"},touch:{labelKey:"container.carousel_touch"}},Ee={labelKey:"container.carousel_ride"},Z={labelKey:"container.carousel_interval"},re=[!1,"carousel","true"],B=1e3,$="carousel-item-next carousel-item-prev carousel-item-start carousel-item-end";function ne(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n&&n>=B}var ee={ride:function(n){return re.indexOf(n)!==-1},interval:function(n){return n===null||ne(n)},slides:function(n){return typeof n=="number"&&Math.floor(n)===n&&n>=1}};function te(n){return n==="ride"?JSON.stringify(re):n==="interval"?"null or an integer of "+B+" or more":n==="slides"?"an integer of 1 or more":"[true,false]"}function we(n,i){return ee[n]?ee[n](i):typeof i=="boolean"}var Ae=0;y.containers.carousel=function(n){var i=new WeakMap,u=[];function s(t){return f(t,".carousel")}function b(t){return f(s(t),".carousel-inner")}function m(t){return!!b(t)}function h(t){return x(b(t),".carousel-item")}function w(t){return t.getAttribute("id")||t.setAttribute("id",n.containerId("carousel")),t.getAttribute("id")}function oe(t,e){var r=t.getAttribute("data-bs-"+e);return r===null?t.getAttribute("data-ge-bs-"+e):r}function H(t){var e=parseInt(t.getAttribute("data-bs-interval"),10);return isFinite(e)&&e>0?e:null}function S(t,e){e===null?t.removeAttribute("data-bs-interval"):t.setAttribute("data-bs-interval",String(e))}function ae(t){var e=s(t),r=oe(e,"ride"),o=function(a){return e.getAttribute("data-bs-"+a)!=="false"};return{controls:!!f(e,".carousel-control-prev, .carousel-control-next"),indicators:!!f(e,".carousel-indicators"),fade:K(e,"carousel-fade"),dark:e.getAttribute("data-bs-theme")==="dark",ride:r==="carousel"||r==="true"?r:!1,interval:H(e),pause:o("pause"),wrap:o("wrap"),keyboard:o("keyboard"),touch:o("touch")}}function P(t,e){var r=c("button",{class:"carousel-control-"+e,type:"button","data-bs-target":"#"+w(t),"data-bs-slide":e});return r.appendChild(c("span",{class:"carousel-control-"+e+"-icon","aria-hidden":"true"})),r.appendChild(c("span",{class:"visually-hidden"},e==="prev"?n.t("container.carousel_previous"):n.t("container.carousel_next"))),r}function ie(t,e){var r=s(t);x(r,".carousel-control-prev, .carousel-control-next").forEach(function(o){o.remove()}),e&&(r.appendChild(P(r,"prev")),r.appendChild(P(r,"next")))}function le(t,e){var r=s(t),o=f(r,".carousel-indicators");if(!e){o&&o.remove();return}o||(o=r.insertBefore(c("div",{class:"carousel-indicators"}),r.firstChild)),O(t)}function O(t,e){var r=s(t),o=f(r,".carousel-indicators");if(o){e=e||h(t);var a=w(r),l=0;e.forEach(function(d,p){K(d,"active")&&(l=p)}),o.textContent="",e.forEach(function(d,p){o.appendChild(c("button",{type:"button","data-bs-target":"#"+a,"data-bs-slide-to":String(p),"aria-label":n.t("container.carousel_slide_label",{number:p+1})}))}),L(t,e.length?l:-1)}}function L(t,e){var r=f(s(t),".carousel-indicators");x(r).forEach(function(o,a){E(o,"active",a===e),a===e?o.setAttribute("aria-current","true"):o.removeAttribute("aria-current")})}function U(t,e,r){var o=s(t);e==="controls"&&ie(t,r),e==="indicators"&&le(t,r),e==="fade"&&E(o,"carousel-fade",r),e==="dark"&&(r?o.setAttribute("data-bs-theme","dark"):o.getAttribute("data-bs-theme")==="dark"&&o.removeAttribute("data-bs-theme")),e==="ride"&&(o.removeAttribute("data-bs-ride"),o.removeAttribute("data-ge-bs-ride"),r&&o.setAttribute("data-bs-ride",r)),e==="interval"&&S(o,r),Q.indexOf(e)!==-1&&(r?o.removeAttribute("data-bs-"+e):o.setAttribute("data-bs-"+e,"false")),D(o)}function J(t,e){var r=n.settings.carousel||{},o=t[e]!==void 0?t[e]:r[e];return o===void 0?k[e]:we(e,o)?o:(n.warn("carousel: "+JSON.stringify(o)+" is not a "+e+", which takes "+te(e)+": "+JSON.stringify(k[e])+" is used"),k[e])}function N(t){var e=s(t);x(e,".carousel-control-prev, .carousel-control-next").forEach(n.suspendToggles),x(f(e,".carousel-indicators")).forEach(n.suspendToggles);var r=e.getAttribute("data-bs-ride");r!==null&&(e.setAttribute("data-ge-bs-ride",r),e.removeAttribute("data-bs-ride"))}function ue(t){var e=y.bootstrap||window.bootstrap,r=e&&e.Carousel?e.Carousel.getInstance(t):null;r&&(r.pause(),r.dispose())}function V(t,e,r){var o=b(t).appendChild(c("div",{class:e?"carousel-item active":"carousel-item"}));return o.appendChild(n.defaultRegion()),r!=null&&S(o,r),o}function _(t){var e=h(t),r=i.get(t);return r&&e.indexOf(r)!==-1?r:e.filter(function(o){return K(o,"active")})[0]||e[0]||null}function A(t,e,r){r=r||h(t),r.forEach(function(o){E(o,"active",o===e)}),e?i.set(t,e):i.delete(t),L(t,r.indexOf(e)),G(t)}function q(t,e){var r=h(t);if(!(r.length<2)){var o=r.indexOf(_(t));A(t,r[(o+e+r.length)%r.length])}}function T(t,e){t&&(E(t,"disabled",e),e?t.setAttribute("aria-disabled","true"):t.removeAttribute("aria-disabled"))}function I(t){return t.getAttribute("aria-disabled")==="true"}function G(t){var e=h(t),r=f(t,".ge-container-drawer"),o=e.indexOf(_(t));if(r){var a=f(r,".ge-carousel-counter");a&&(a.textContent=n.t("container.carousel_counter",{current:e.length?o+1:0,total:e.length})),T(f(r,".ge-carousel-previous"),e.length<2),T(f(r,".ge-carousel-next"),e.length<2)}e.forEach(function(l,d){var p=f(l,".ge-pane-drawer");T(f(p,".ge-carousel-move-back"),d===0),T(f(p,".ge-carousel-move-forward"),d===e.length-1)})}function W(t,e,r){var o=b(t),a=h(t),l=a.indexOf(e),d=l+r;if(!(d<0||d>=a.length)){var p={parent:o,index:l};n.operate(function(){n.emit("before-move",n.payloadFor("carousel-item",e,{parent:o,source:"tool",from:p}))&&(o.insertBefore(e,r<0?a[d]:a[d].nextSibling),A(t,_(t)),O(t),N(t),n.emit("after-move",n.payloadFor("carousel-item",e,{parent:o,source:"tool",from:p,to:{parent:o,index:d},container:t})))})}}function se(t,e,r){Y(e,200,function(){var o=h(t),a=o.filter(function(l){return l!==e});_(t)===e&&A(t,a[Math.min(o.indexOf(e),a.length-1)]||null,a),O(t,a),r()})}function ce(t,e){var r=n.createPaneControls(e,"carousel-item",n.settings.carousel_tools,n.t("confirm.delete_carousel_item"),function(d){se(t,e,d)}),o=f(r,".ge-move");o&&o.remove();var a=n.createTool(r,n.t("tool.carousel_move_back"),"ge-carousel-move-back","bi bi-arrow-left",function(){I(this)||W(t,e,-1)}),l=n.createTool(r,n.t("tool.carousel_move_forward"),"ge-carousel-move-forward","bi bi-arrow-right",function(){I(this)||W(t,e,1)});r.insertBefore(l,r.firstChild),r.insertBefore(a,l)}function de(t,e){if(e=e||{},!m(t))return n.warn("carousel: there is no .carousel-inner to add a slide to"),null;var r=null;e.interval!==void 0&&e.interval!==null&&(ne(e.interval)?r=e.interval:n.warn("carousel: "+JSON.stringify(e.interval)+" is not a interval, which takes "+te("interval")+": null is used"));var o=V(t,!1,r);return A(t,o),O(t),o}function R(t,e,r){var o=c("div",{class:"ge-carousel-option mb-2"});return o.appendChild(c("label",{class:"form-label",for:r},n.t(t))),o.appendChild(e),o}function M(){return"ge-carousel-option-"+ ++Ae}function X(t,e){var r=M(),o=c("input",{class:"form-control form-control-sm",id:r,type:"number",step:"0.1",min:String(B/1e3)});return o.addEventListener("change",function(){var a=o.value.trim(),l=parseFloat(a);if(a==="")C(o,"is-invalid"),S(t,null);else if(!isFinite(l)||Math.round(l*1e3)<B){F(o,"is-invalid");return}else C(o,"is-invalid"),S(t,Math.round(l*1e3));e&&e()}),{id:r,input:o,render:function(){var a=H(t);C(o,"is-invalid"),o.value=a===null?"":String(a/1e3)}}}function fe(t,e){var r=M(),o=c("div",{class:"form-check"}),a=o.appendChild(c("input",{class:"form-check-input",type:"checkbox",id:r}));return o.appendChild(c("label",{class:"form-check-label",for:r},n.t(t))),a.addEventListener("change",function(){e(a.checked)}),{box:o,input:a}}function pe(t){var e=c("div",{class:"ge-carousel-options"}),r={};function o(v,g){U(t,v,g),N(t),p()}var a=M(),l=c("select",{class:"form-select form-select-sm",id:a});[{value:"false",labelKey:"container.carousel_ride_no"},{value:"carousel",labelKey:"container.carousel_ride_load"},{value:"true",labelKey:"container.carousel_ride_interaction"}].forEach(function(v){l.appendChild(c("option",{value:v.value},n.t(v.labelKey)))}),l.addEventListener("change",function(){o("ride",l.value==="false"?!1:l.value)}),e.appendChild(R(Ee.labelKey,l,a));var d=X(s(t),function(){p()});e.appendChild(R(Z.labelKey,d.input,d.id)),ye.concat(Q).forEach(function(v){var g=fe(Ce[v].labelKey,function(me){o(v,me)});r[v]=g.input,g.box.setAttribute("data-ge-carousel-option",v),e.appendChild(g.box)});function p(){var v=ae(t);l.value=String(v.ride),d.render(),Object.keys(r).forEach(function(g){r[g].checked=v[g]}),d.input.disabled=v.ride===!1,r.pause.disabled=v.ride===!1}return p(),u.push({node:t,element:e,render:p}),e}function ve(t){var e=c("div",{class:"ge-carousel-options"}),r=X(t);return e.appendChild(R(Z.labelKey,r.input,r.id)),r.render(),u.push({node:t,element:e,render:r.render}),e}return{labelKey:"container.add_carousel",addPaneKey:"container.add_carousel_item",paneKind:"carousel-item",regionOf:function(t,e){return e||_(t)},paneClass:"ge-carousel-item",paneLabelKey:"panel.kind_carousel_item",create:function(t){t=t||{};var e=c("div",{"data-ge-container":"carousel"}),r=e.appendChild(c("div",{class:"carousel slide",id:n.containerId("carousel")})),o=J(t,"slides");r.appendChild(c("div",{class:"carousel-inner"}));for(var a=0;a<o;a++)V(e,a===0);return Object.keys(k).filter(function(l){return l!=="slides"}).forEach(function(l){U(e,l,J(t,l))}),e},addPane:de,mark:function(t){var e=s(t);if(!(!e||!m(t))){ue(e),N(t);var r=_(t);h(t).forEach(function(o){F(o,"ge-carousel-item"),C(o,$),f(o,".ge-tools-drawer")||ce(t,o)}),A(t,r)}},unmark:function(t){n.resumeToggles(t),m(t)&&(h(t).forEach(function(e,r){C(e,"ge-carousel-item "+$),E(e,"active",r===0),D(e)}),L(t,h(t).length?0:-1))},cleanMarkup:function(t){var e=this;z(t,'[data-ge-container="carousel"]').forEach(function(r){e.unmark(r)})},tools:function(t,e){if(m(e)){n.createTool(t,n.t("tool.carousel_show_previous"),"ge-carousel-previous","bi bi-chevron-left",function(){I(this)||q(e,-1)});var r=n.createTool(t,"","ge-carousel-counter","",null);r.textContent="",r.removeAttribute("title"),n.createTool(t,n.t("tool.carousel_show_next"),"ge-carousel-next","bi bi-chevron-right",function(){I(this)||q(e,1)}),G(e)}},panelSection:function(t,e){return e==="carousel"&&m(t)?{labelKey:"container.carousel_section",body:pe(t)}:e==="carousel-item"?{labelKey:"container.carousel_item_section",body:ve(t)}:null},onRefresh:function(t){u=u.filter(function(e){return e.element.isConnected}),u.forEach(function(e){(e.node===t||t.contains(e.node))&&e.render()})},onDeinit:function(){u=[]}}};})();
|