@themarioga/grid-editor 7.3.0 → 8.0.0-beta.3
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 +76 -0
- package/README.md +34 -30
- package/UPGRADING.md +55 -0
- package/dist/grideditor.bundle.min.js +3 -3
- package/dist/grideditor.css +72 -6
- package/dist/grideditor.d.ts +24 -3
- package/dist/grideditor.esm.js +7 -58
- package/dist/grideditor.jquery.js +0 -13
- package/dist/grideditor.jquery.min.js +1 -1
- package/dist/grideditor.jquery.min.js.map +3 -3
- package/dist/grideditor.js +7 -58
- package/dist/grideditor.min.css +1 -1
- package/dist/grideditor.min.css.map +1 -1
- package/dist/grideditor.min.js +2 -2
- package/dist/grideditor.min.js.map +3 -3
- package/dist/locales/grideditor.es.esm.js +30 -6
- package/dist/locales/grideditor.es.js +30 -6
- package/dist/locales/grideditor.es.min.js +1 -1
- package/dist/locales/grideditor.es.min.js.map +2 -2
- package/dist/plugins/grideditor.accordion.min.js.map +2 -2
- package/dist/plugins/grideditor.alignment.esm.js +11 -38
- package/dist/plugins/grideditor.alignment.js +11 -38
- package/dist/plugins/grideditor.alignment.min.js +1 -1
- package/dist/plugins/grideditor.alignment.min.js.map +3 -3
- package/dist/plugins/grideditor.card.min.js.map +1 -1
- package/dist/plugins/grideditor.ckeditor.esm.js +0 -5
- package/dist/plugins/grideditor.ckeditor.js +0 -5
- package/dist/plugins/grideditor.ckeditor.min.js +1 -1
- package/dist/plugins/grideditor.ckeditor.min.js.map +3 -3
- package/dist/plugins/grideditor.clipboard.min.js.map +1 -1
- package/dist/plugins/grideditor.codemirror-inline.min.js.map +1 -1
- package/dist/plugins/grideditor.codemirror.min.js.map +1 -1
- package/dist/plugins/grideditor.elements.min.js.map +2 -2
- package/dist/plugins/grideditor.gutters.min.js.map +1 -1
- package/dist/plugins/grideditor.order.min.js.map +1 -1
- package/dist/plugins/grideditor.popup.min.js.map +1 -1
- package/dist/plugins/grideditor.sections.min.js.map +2 -2
- package/dist/plugins/grideditor.style.esm.js +393 -60
- package/dist/plugins/grideditor.style.js +387 -56
- package/dist/plugins/grideditor.style.min.js +4 -2
- package/dist/plugins/grideditor.style.min.js.map +4 -4
- package/dist/plugins/grideditor.summernote.min.js.map +2 -2
- package/dist/plugins/grideditor.tabs.esm.js +274 -6
- package/dist/plugins/grideditor.tabs.js +274 -6
- package/dist/plugins/grideditor.tabs.min.js +1 -1
- package/dist/plugins/grideditor.tabs.min.js.map +3 -3
- package/dist/plugins/grideditor.tinymce.esm.js +1 -8
- package/dist/plugins/grideditor.tinymce.js +1 -8
- package/dist/plugins/grideditor.tinymce.min.js +1 -1
- package/dist/plugins/grideditor.tinymce.min.js.map +3 -3
- package/docs/events.md +4 -6
- package/docs/locale-keys.md +35 -13
- package/docs/plugins.md +15 -35
- package/example/ckeditor.html +0 -5
- package/example/containers.html +64 -2
- package/example/index.html +5 -4
- package/example/style.html +16 -4
- package/example/utilities.html +12 -11
- package/package.json +1 -1
- package/src/js/dom.js +1 -2
- package/src/js/grideditor.jquery.js +7 -28
- package/src/js/grideditor.js +12 -81
- package/src/js/locales/grideditor.es.js +30 -6
- package/src/js/plugins/grideditor.alignment.js +21 -50
- package/src/js/plugins/grideditor.ckeditor.js +10 -23
- package/src/js/plugins/grideditor.style.js +18 -12
- package/src/js/plugins/grideditor.summernote.js +4 -5
- package/src/js/plugins/grideditor.tabs.js +311 -5
- package/src/js/plugins/grideditor.tinymce.js +4 -17
- package/src/js/style/accordion.js +14 -3
- package/src/js/style/display.js +229 -0
- package/src/js/style/drawerflow.js +118 -0
- package/src/js/style/flex.js +156 -0
- package/src/js/style/float.js +2 -4
- package/src/js/style/options.js +5 -20
- package/src/js/style/sections.js +42 -15
- package/src/js/style/spacing.js +2 -4
- package/src/js/style/sticky.js +39 -0
- package/src/js/style/textalign.js +2 -4
- package/src/js/text/grideditor.text.js +1 -1
- package/src/less/grideditor.less +68 -10
- package/types/grideditor.d.ts +24 -3
- package/dist/plugins/grideditor.float.esm.js +0 -43
- package/dist/plugins/grideditor.float.js +0 -47
- package/dist/plugins/grideditor.float.min.js +0 -1
- package/dist/plugins/grideditor.float.min.js.map +0 -7
- package/dist/plugins/grideditor.spacing.esm.js +0 -327
- package/dist/plugins/grideditor.spacing.js +0 -329
- package/dist/plugins/grideditor.spacing.min.js +0 -1
- package/dist/plugins/grideditor.spacing.min.js.map +0 -7
- package/dist/plugins/grideditor.textalign.esm.js +0 -49
- package/dist/plugins/grideditor.textalign.js +0 -53
- package/dist/plugins/grideditor.textalign.min.js +0 -1
- package/dist/plugins/grideditor.textalign.min.js.map +0 -7
- package/dist/plugins/grideditor.visibility.esm.js +0 -167
- package/dist/plugins/grideditor.visibility.js +0 -169
- package/dist/plugins/grideditor.visibility.min.js +0 -1
- package/dist/plugins/grideditor.visibility.min.js.map +0 -7
- package/src/js/plugins/grideditor.float.js +0 -29
- package/src/js/plugins/grideditor.spacing.js +0 -31
- package/src/js/plugins/grideditor.textalign.js +0 -27
- package/src/js/plugins/grideditor.visibility.js +0 -32
- package/src/js/style/visibility.js +0 -160
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/js/register.js", "../../src/js/dom.js", "../../src/js/style/spacing.js", "../../src/js/plugins/grideditor.spacing.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * What a plugin's or a locale's classic script imports in place of the\n * editor: the GridEditor the page already loaded.\n *\n * The build points `import { GridEditor } from '../grideditor.js'` here for\n * the classic scripts, so each registers on the editor the page has rather\n * than bringing its own. Loaded before the editor there is nothing to\n * register on, and saying so is better than a TypeError three calls later.\n */\nvar GridEditor = window.GridEditor;\n\nif (!GridEditor || typeof GridEditor.get !== 'function') {\n throw new Error('grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, ' +\n 'its locales and grideditor.jquery.js');\n}\n\nexport { GridEditor };\nexport default GridEditor;\n", "/**\n * The DOM, the way grid-editor uses it.\n *\n * Small helpers over the browser's own API, for the core and the shipped\n * plugins. Not a public API: a plugin of a host's own is free to write its\n * DOM code however it likes, and this file makes no promise to it.\n *\n * Stateless on purpose. The build puts a copy of this file in each plugin's\n * classic script, so anything kept here would be kept once per copy; a\n * module that needs to remember something about a node keeps its own\n * WeakMap.\n */\n\n/** Every element under `root` matching `selector`, as an array. */\nexport function all(root, selector) {\n return root ? Array.prototype.slice.call(root.querySelectorAll(selector)) : [];\n}\n\n/** The first element under `root` matching `selector`, or null. */\nexport function one(root, selector) {\n return root ? root.querySelector(selector) : null;\n}\n\n/** `root` itself when it matches, then every element under it that does. */\nexport function selfAndAll(root, selector) {\n if (!root) { return []; }\n\n var found = all(root, selector);\n if (root.nodeType === 1 && root.matches(selector)) { found.unshift(root); }\n return found;\n}\n\n/** The element children of `node`, those matching `selector` if one is given. */\nexport function children(node, selector) {\n if (!node) { return []; }\n\n return Array.prototype.filter.call(node.children, function(each) {\n return !selector || each.matches(selector);\n });\n}\n\n/** The first element child matching `selector`, or null. */\nexport function child(node, selector) {\n return children(node, selector)[0] || null;\n}\n\n/** The nearest ancestor-or-self matching `selector` below `stopAt`, or null. */\nexport function closest(node, selector, stopAt) {\n var found = node && node.nodeType === 1 ? node.closest(selector) : null;\n\n if (found && stopAt && found !== stopAt && !stopAt.contains(found)) { return null; }\n return found;\n}\n\n/** Whether `node` is an element matching `selector`. */\nexport function is(node, selector) {\n return !!node && node.nodeType === 1 && node.matches(selector);\n}\n\n/** Whether `node` is in the document. */\nexport function attached(node) {\n return !!node && document.documentElement.contains(node);\n}\n\n/** The element siblings after `node` that match `selector`. */\nexport function nextAll(node, selector) {\n var found = [];\n\n for (var next = node.nextElementSibling; next; next = next.nextElementSibling) {\n if (!selector || next.matches(selector)) { found.push(next); }\n }\n return found;\n}\n\n/** The ancestors of `node` up to, and not including, `stop`, nearest first. */\nexport function parentsUntil(node, stop) {\n var found = [];\n\n for (var parent = node.parentElement; parent && parent !== stop; parent = parent.parentElement) {\n found.push(parent);\n }\n return found;\n}\n\n/**\n * The nodes the html parses into, detached. Parsed the way innerHTML parses,\n * so a <script> in it never runs, here or once it is in the page.\n */\nexport function parse(html) {\n var template = document.createElement('template');\n template.innerHTML = html;\n return Array.prototype.slice.call(template.content.childNodes);\n}\n\n/** The one element the html is, detached. */\nexport function create(html) {\n var nodes = parse(html.trim());\n\n for (var i = 0; i < nodes.length; i++) {\n if (nodes[i].nodeType === 1) { return nodes[i]; }\n }\n return null;\n}\n\n/** An element of `tag`, with `attributes` and `text`. */\nexport function element(tag, attributes, text) {\n var node = document.createElement(tag);\n\n Object.keys(attributes || {}).forEach(function(name) {\n var value = attributes[name];\n if (value !== null && value !== undefined && value !== false) { node.setAttribute(name, value); }\n });\n if (text !== undefined && text !== null) { node.textContent = text; }\n\n return node;\n}\n\n/** Replace what `node` holds with `html`. A <script> in it does not run. */\nexport function setHtml(node, html) {\n node.innerHTML = html === undefined || html === null ? '' : String(html);\n return node;\n}\n\n/** Add one or several space separated classes. */\nexport function addClass(node, names) {\n split(names).forEach(function(name) { node.classList.add(name); });\n return node;\n}\n\nexport function removeClass(node, names) {\n split(names).forEach(function(name) { node.classList.remove(name); });\n return node;\n}\n\n/** Each class on, or off, or flipped when `on` is not given. */\nexport function toggleClass(node, names, state) {\n split(names).forEach(function(name) {\n if (state === undefined) {\n node.classList.toggle(name);\n } else {\n node.classList.toggle(name, !!state);\n }\n });\n return node;\n}\n\nexport function hasClass(node, name) {\n return !!node && node.nodeType === 1 && node.classList.contains(name);\n}\n\nfunction split(names) {\n return String(names || '').split(/\\s+/).filter(Boolean);\n}\n\n/** Take the class attribute off when there is nothing left in it. */\nexport function dropEmptyClass(node) {\n if (!node.getAttribute('class')) { node.removeAttribute('class'); }\n return node;\n}\n\n/** Take the style attribute off when there is nothing left in it. */\nexport function dropEmptyStyle(node) {\n if (!node.getAttribute('style')) { node.removeAttribute('style'); }\n return node;\n}\n\n/** Set attributes; a null or undefined value takes the attribute off. */\nexport function attr(node, attributes) {\n Object.keys(attributes).forEach(function(name) {\n var value = attributes[name];\n\n if (value === null || value === undefined) {\n node.removeAttribute(name);\n } else {\n node.setAttribute(name, value);\n }\n });\n return node;\n}\n\n/**\n * Inline styles, by css property name. A number is pixels for the properties\n * that take a length, as jQuery had it; an empty string takes one off.\n */\nexport function css(node, styles) {\n Object.keys(styles).forEach(function(property) {\n var value = styles[property];\n\n if (typeof value === 'number' && !UNITLESS[property]) { value = value + 'px'; }\n node.style.setProperty(property, value === null || value === undefined ? '' : String(value));\n });\n return node;\n}\n\nvar UNITLESS = { opacity: true, 'z-index': true, 'flex-grow': true, 'flex-shrink': true, order: true };\n\n/** What an element of this tag shows as when nothing hides it. */\nvar defaultDisplays = {};\n\nfunction defaultDisplay(node) {\n var tag = node.nodeName;\n\n if (!defaultDisplays[tag]) {\n var probe = document.body.appendChild(document.createElement(tag));\n defaultDisplays[tag] = getComputedStyle(probe).display;\n probe.remove();\n if (defaultDisplays[tag] === 'none') { defaultDisplays[tag] = 'block'; }\n }\n return defaultDisplays[tag];\n}\n\n/** Show a node: its inline display:none off, and a display of its own if a stylesheet hides it. */\nexport function show(node) {\n node.style.removeProperty('display');\n if (getComputedStyle(node).display === 'none') { node.style.display = defaultDisplay(node); }\n return node;\n}\n\nexport function hide(node) {\n node.style.display = 'none';\n return node;\n}\n\n/** Show or hide; flip when `on` is not given. */\nexport function toggle(node, state) {\n if (state === undefined) { state = !visible(node); }\n return state ? show(node) : hide(node);\n}\n\n/** Whether a node takes up room: what jQuery's :visible meant. */\nexport function visible(node) {\n return !!(node.offsetWidth || node.offsetHeight || node.getClientRects().length);\n}\n\n/** The border box's width, fractions included. */\nexport function outerWidth(node) {\n return node.getBoundingClientRect().width;\n}\n\nexport function outerHeight(node) {\n return node.getBoundingClientRect().height;\n}\n\n/** The content box's height, which is what jQuery's height() gave. */\nexport function contentHeight(node) {\n var style = getComputedStyle(node);\n return node.clientHeight - parseFloat(style.paddingTop) - parseFloat(style.paddingBottom);\n}\n\n/** Where a node is on the page, not in the window. */\nexport function offset(node) {\n var box = node.getBoundingClientRect();\n return { top: box.top + window.pageYOffset, left: box.left + window.pageXOffset };\n}\n\n/** Its index among its parent's element children, those matching `selector` if given. */\nexport function indexIn(node, selector) {\n return children(node.parentElement, selector).indexOf(node);\n}\n\n/** Put `node` right after `reference`. */\nexport function insertAfter(node, reference) {\n reference.parentNode.insertBefore(node, reference.nextSibling);\n return node;\n}\n\n/** Replace `node` with what it holds. */\nexport function unwrap(node) {\n var parent = node.parentNode;\n\n while (node.firstChild) { parent.insertBefore(node.firstChild, node); }\n node.remove();\n}\n\n/** Put `node` inside `wrapper`, where `node` was. */\nexport function wrap(node, wrapper) {\n node.parentNode.insertBefore(wrapper, node);\n wrapper.appendChild(node);\n return wrapper;\n}\n\n/**\n * Listen on `root` for `types` (space separated) on descendants that match\n * `selector`, with `this` the matched element, as jQuery's delegated\n * handlers had it. Hands back the listener, for removeEventListener; a\n * signal in `options` removes it too.\n */\nexport function delegate(root, types, selector, handler, options) {\n var listener = function(event) {\n var match = closest(event.target, selector, root);\n if (match && root.contains(match)) { return handler.call(match, event); }\n return undefined;\n };\n\n split(types).forEach(function(type) { root.addEventListener(type, listener, options); });\n return listener;\n}\n\n/** Listen for several space separated event types with one handler. */\nexport function on(target, types, handler, options) {\n split(types).forEach(function(type) { target.addEventListener(type, handler, options); });\n return handler;\n}\n\nexport function off(target, types, handler, options) {\n split(types).forEach(function(type) { target.removeEventListener(type, handler, options); });\n}\n\n/** A mouse event of `type` sent to `node`, the way a pointer would. */\nexport function fire(node, type) {\n node.dispatchEvent(new MouseEvent(type, { bubbles: type !== 'mouseenter' && type !== 'mouseleave' }));\n}\n\n/* ------------------------------------------------------------------\n * Taking a node away, visibly.\n *\n * The durations are the ones 6.x had through jQuery: 400 ms unless the\n * caller says otherwise. `done` runs once the node is out of sight, which is\n * when the caller removes it; a node that is already out of sight is done at\n * once, on the next task, as jQuery had it.\n * ------------------------------------------------------------------ */\n\nvar DEFAULT_DURATION = 400;\n\nfunction animateAway(node, frames, duration, done) {\n duration = duration === undefined ? DEFAULT_DURATION : duration;\n\n var finish = function() {\n hide(node);\n if (done) { done(); }\n };\n\n if (!visible(node) || !node.animate || duration <= 0) {\n window.setTimeout(finish, 0);\n return;\n }\n\n var animation = node.animate(frames(getComputedStyle(node)), {\n duration: duration,\n easing: 'ease-in-out',\n });\n var called = false;\n var once = function() {\n if (called) { return; }\n called = true;\n finish();\n };\n\n animation.onfinish = once;\n animation.oncancel = once;\n}\n\n/** Fold a node up to nothing, then hide it. */\nexport function slideUp(node, duration, done) {\n if (typeof duration === 'function') {\n done = duration;\n duration = undefined;\n }\n\n node.style.overflow = 'hidden';\n animateAway(node, function(style) {\n return [\n {\n height: style.height,\n paddingTop: style.paddingTop,\n paddingBottom: style.paddingBottom,\n marginTop: style.marginTop,\n marginBottom: style.marginBottom,\n },\n { height: '0px', paddingTop: '0px', paddingBottom: '0px', marginTop: '0px', marginBottom: '0px' },\n ];\n }, duration, function() {\n node.style.removeProperty('overflow');\n if (done) { done(); }\n });\n}\n\n/** Fade a node out, then hide it. */\nexport function fadeOut(node, duration, done) {\n animateAway(node, function(style) {\n return [{ opacity: style.opacity }, { opacity: 0 }];\n }, duration, done);\n}\n\n/** Fade and fold a node, in height and, with `width`, sideways too, then hide it. */\nexport function shrinkAway(node, duration, done, width) {\n node.style.overflow = 'hidden';\n animateAway(node, function(style) {\n var from = { opacity: style.opacity, height: style.height };\n var to = { opacity: 0, height: '0px' };\n\n if (width) {\n from.width = style.width;\n to.width = '0px';\n }\n return [from, to];\n }, duration, function() {\n node.style.removeProperty('overflow');\n if (done) { done(); }\n });\n}\n", "/**\n * Spacing, a part of the style plugin: padding and margin per breakpoint, with Bootstrap's p-{breakpoint}-*,\n * pt-, px- \u2026 and m-{breakpoint}-*, mt-, mx- \u2026 classes.\n *\n * The part is what the spacing plugin was up to 7.2 - its families, and\n * whatever it did on the canvas - as a function of the handle and its options.\n * grideditor.style.js puts it in its sections; the deprecated\n * grideditor.spacing.js still registers it on its own, as it always did.\n */\nimport { GridEditor } from '../grideditor.js';\nimport * as dom from '../dom.js';\n\nObject.assign(GridEditor.locales.en, {\n 'utility.padding': 'Padding',\n 'utility.margin': 'Margin',\n 'utility.side_all': 'All sides',\n 'utility.side_x': 'Left and right',\n 'utility.side_y': 'Top and bottom',\n 'utility.side_t': 'Top',\n 'utility.side_b': 'Bottom',\n 'utility.side_s': 'Start',\n 'utility.side_e': 'End',\n 'utility.spacing_gutter': 'A column\\'s side padding is its gutter: changing it changes the gutter',\n});\n\nvar VALUES = ['0', '1', '2', '3', '4', '5'];\n\n/** Bootstrap's $spacers. */\nvar SCALE = ['0', '.25rem', '.5rem', '1rem', '1.5rem', '3rem'];\n\n/**\n * The sides, in the order Bootstrap's css writes their rules: within one\n * breakpoint a later rule wins, so p-3 pt-1 has a top of .25rem.\n */\nvar SIDES = ['', 'x', 'y', 't', 'e', 'b', 's'];\n\n/** What each side sets. Start and end are left and right: Bootstrap's css is left to right. */\nvar SET = {\n '': ['top', 'right', 'bottom', 'left'],\n x: ['left', 'right'],\n y: ['top', 'bottom'],\n t: ['top'],\n e: ['right'],\n b: ['bottom'],\n s: ['left'],\n};\n\nvar INFIXES = ['', 'sm', 'md', 'lg', 'xl', 'xxl'];\n\nvar PROPERTIES = { p: 'padding', m: 'margin' };\n\n/** Every class of the plugin's, padding or margin. */\nfunction pattern(key) {\n return new RegExp('^' + key + '[xytbse]?-(?:(?:sm|md|lg|xl|xxl)-)?(?:[0-5]|auto)$');\n}\n\nexport function spacingPart(ge, given) {\n\n var options = Object.assign({ values: VALUES, scale: SCALE }, given);\n var patterns = { p: pattern('p'), m: pattern('m') };\n\n function applies(node, kind) {\n return kind === 'row' || kind === 'column' || kind === 'element' ||\n dom.is(node, '[data-ge-container]');\n }\n\n function classes(node) {\n return (node.getAttribute('class') || '').split(/\\s+/);\n }\n\n function carries(node, key) {\n return classes(node).some(function(name) { return patterns[key].test(name); });\n }\n\n /**\n * The class of one family that decides a side at a breakpoint: the\n * widest breakpoint up to it that has one, as { tier, value }.\n */\n function source(node, family, tier) {\n var names = classes(node);\n var values = family.charAt(0) === 'm' ? VALUES.concat(['auto']) : VALUES;\n\n for (var i = tier; i >= 0; i--) {\n for (var v = 0; v < values.length; v++) {\n var name = family + (INFIXES[i] ? '-' + INFIXES[i] : '') + '-' + values[v];\n if (names.indexOf(name) !== -1) { return { tier: i, value: values[v] }; }\n }\n }\n\n return null;\n }\n\n /**\n * What padding or margin is on each side with none of the plugin's\n * classes: the editor's frame for a row or a column, the host's css\n * for anything else. Read by taking the classes off for a moment,\n * since that is the only way to ask the browser.\n */\n function without(node, key) {\n var original = node.getAttribute('class');\n var style;\n var bare = {};\n\n node.setAttribute('class', classes(node).filter(function(name) { return !patterns[key].test(name); }).join(' '));\n style = getComputedStyle(node);\n ['top', 'right', 'bottom', 'left'].forEach(function(side) {\n bare[side] = style.getPropertyValue(PROPERTIES[key] + '-' + side);\n });\n if (original === null) { node.removeAttribute('class'); } else { node.setAttribute('class', original); }\n\n return bare;\n }\n\n /**\n * Each side the way Bootstrap's css settles it: the class from the\n * widest breakpoint wins, and within one breakpoint the side written\n * later in the css. A side no class reaches shows what it is without\n * any, over a wider breakpoint's class that is live in a wide window.\n */\n function sides(node, key, breakpoint) {\n var tier = ge.breakpoints.indexOf(breakpoint);\n var winners = {};\n var styles = {};\n var neutral = null;\n\n SIDES.forEach(function(side, order) {\n var found = source(node, key + side, tier);\n if (!found) { return; }\n\n SET[side].forEach(function(set) {\n var current = winners[set];\n if (!current || found.tier > current.tier || (found.tier === current.tier && order > current.order)) {\n winners[set] = { tier: found.tier, order: order, value: found.value };\n }\n });\n });\n\n ['top', 'right', 'bottom', 'left'].forEach(function(set) {\n var winner = winners[set];\n\n if (!winner) {\n neutral = neutral || without(node, key);\n styles[PROPERTIES[key] + '-' + set] = neutral[set];\n } else {\n styles[PROPERTIES[key] + '-' + set] = winner.value === 'auto' ? 'auto' : options.scale[winner.value];\n }\n });\n\n return styles;\n }\n\n /** The side a group's select starts on: the first that has a class, or all. */\n function startingSide(node, key) {\n var names = classes(node).filter(function(name) { return patterns[key].test(name); });\n var found = SIDES.filter(function(side) {\n return names.some(function(name) { return name.indexOf(key + side + '-') === 0; });\n });\n\n return found.length ? found[0] : '';\n }\n\n function sideLabel(side) {\n switch (side) {\n case 'x': return ge.t('utility.side_x');\n case 'y': return ge.t('utility.side_y');\n case 't': return ge.t('utility.side_t');\n case 'b': return ge.t('utility.side_b');\n case 's': return ge.t('utility.side_s');\n case 'e': return ge.t('utility.side_e');\n default: return ge.t('utility.side_all');\n }\n }\n\n /** A padding or margin group: its name, the side, and the field of that side's family. */\n function group(node, key, labelText) {\n var box = dom.element('div', { 'class': 'ge-spacing-group', 'data-ge-spacing': key });\n var side = dom.element('select', { 'class': 'ge-spacing-side form-select form-select-sm' });\n\n box.appendChild(dom.element('span', { 'class': 'ge-utility-label' }, labelText));\n\n SIDES.forEach(function(value) {\n side.appendChild(dom.element('option', { value: value }, sideLabel(value)));\n });\n\n var field = ge.utilityField(node, key + startingSide(node, key));\n\n side.value = field.getAttribute('data-ge-family').slice(1);\n side.addEventListener('change', function() {\n var next = ge.utilityField(node, key + this.value);\n field.replaceWith(next);\n field = next;\n });\n box.appendChild(side);\n box.appendChild(field);\n\n return box;\n }\n\n var NODES = '.row, .column, .ge-element, [data-ge-container]';\n\n /**\n * Keep each drawer on its node's edges. A drawer is pulled out over the\n * editor's frame by as much as the frame pads the node, and a padding\n * class replaces the frame, so a padded node's drawer is pulled out by\n * its real padding instead. And a column padded at the sides gets a word\n * about what that does to its gutter.\n */\n function mark(scope) {\n dom.selfAndAll(scope, NODES).forEach(function(node) {\n var drawer = dom.child(node, '.ge-tools-drawer');\n\n if (!drawer || !applies(node, ge.kindOf(node))) { return; }\n\n if (carries(node, 'p')) {\n var style = getComputedStyle(node);\n\n dom.css(drawer, {\n 'margin-top': '-' + style.paddingTop,\n 'margin-left': '-' + style.paddingLeft,\n 'margin-right': '-' + style.paddingRight,\n width: 'calc(100% + ' + style.paddingLeft + ' + ' + style.paddingRight + ')',\n });\n } else {\n dom.css(drawer, { 'margin-top': '', 'margin-left': '', 'margin-right': '', width: '' });\n }\n\n if (dom.hasClass(node, 'column')) {\n var padded = classes(node).some(function(name) {\n return /^p[xse]?-/.test(name) && patterns.p.test(name);\n });\n dom.all(drawer, '.ge-spacing-gutter').forEach(function(note) { dom.toggle(note, padded); });\n }\n });\n }\n\n function families(key, labelKey) {\n var values = key === 'm' ? VALUES.concat(['auto']) : VALUES;\n var offered = options.values.concat(key === 'm' ? ['auto'] : []);\n\n return SIDES.map(function(side) {\n return {\n name: key + side,\n prefix: key + side,\n values: values,\n appliesTo: ['row', 'column', 'text', 'element', 'container'],\n labelKey: labelKey,\n panel: false,\n choices: function() {\n return values.filter(function(value) { return offered.indexOf(value) !== -1; });\n },\n };\n });\n }\n\n return {\n families: families('p', 'utility.padding').concat(families('m', 'utility.margin')),\n\n panel: function(node, kind) {\n if (!applies(node, kind)) { return null; }\n\n var box = dom.element('div', { 'class': 'ge-spacing' });\n box.appendChild(group(node, 'p', ge.t('utility.padding')));\n box.appendChild(group(node, 'm', ge.t('utility.margin')));\n\n if (kind === 'column') {\n box.appendChild(dom.element('small', { 'class': 'ge-spacing-gutter' }, ge.t('utility.spacing_gutter')));\n }\n\n return box;\n },\n\n preview: function(node, kind, breakpoint) {\n if (!applies(node, kind)) { return {}; }\n\n var styles = {};\n\n ['p', 'm'].forEach(function(key) {\n if (carries(node, key)) { Object.assign(styles, sides(node, key, breakpoint)); }\n });\n\n return styles;\n },\n\n onRefresh: mark,\n };\n}\n", "/**\n * Spacing for grid-editor.\n *\n * A utility plugin: load this file after the editor and every row, column,\n * element and container can have its padding and margin set per breakpoint,\n * with Bootstrap's p-{breakpoint}-*, pt-, px- \u2026 and m-{breakpoint}-*, mt-, mx-\n * \u2026 classes. What it can ask the editor for is the handle its factory is\n * called with, described in docs/plugins.md.\n *\n * <script src=\"dist/grideditor.min.js\"></script>\n * <script src=\"dist/plugins/grideditor.spacing.min.js\"></script>\n *\n * Fourteen families would be fourteen fields, so the panel has two, padding\n * and margin, each a choice of side and a value for that side.\n *\n * utilities.spacing.values narrows the values offered, and\n * utilities.spacing.scale is what 0 to 5 come to, for a page that changed\n * Bootstrap's $spacers.\n *\n * Deprecated since 7.3, and gone in 8.0: grideditor.style.js carries this\n * plugin's families, and edits them in its own sections. This file is that\n * part on its own, as it was, and says so once per editor. Loaded beside\n * the style plugin, it stands down.\n */\nimport { GridEditor } from '../grideditor.js';\nimport { spacingPart } from '../style/spacing.js';\n\nGridEditor.utilities.spacing = function(ge) {\n ge.warn('the \"spacing\" plugin is deprecated and will be removed in 8.0: load grideditor.style.js');\n return spacingPart(ge, ge.settings.utilities.spacing);\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,CAQO,SAASC,EAAWC,EAAMC,EAAU,CACvC,GAAI,CAACD,EAAQ,MAAO,CAAC,EAErB,IAAIE,EAAQC,EAAIH,EAAMC,CAAQ,EAC9B,OAAID,EAAK,WAAa,GAAKA,EAAK,QAAQC,CAAQ,GAAKC,EAAM,QAAQF,CAAI,EAChEE,CACX,CAGO,SAASE,EAASC,EAAMJ,EAAU,CACrC,OAAKI,EAEE,MAAM,UAAU,OAAO,KAAKA,EAAK,SAAU,SAASC,EAAM,CAC7D,MAAO,CAACL,GAAYK,EAAK,QAAQL,CAAQ,CAC7C,CAAC,EAJmB,CAAC,CAKzB,CAGO,SAASM,EAAMF,EAAMJ,EAAU,CAClC,OAAOG,EAASC,EAAMJ,CAAQ,EAAE,CAAC,GAAK,IAC1C,CAWO,SAASO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C,EAAYD,EAAIA,EAAG,SAAS,UAAU,OAAO,CACxD",
|
|
6
|
-
"names": ["GridEditor", "all", "root", "selector", "selfAndAll", "root", "selector", "found", "all", "children", "node", "each", "child", "is", "node", "selector", "element", "tag", "attributes", "text", "node", "name", "value", "hasClass", "node", "name", "css", "node", "styles", "property", "value", "UNITLESS", "defaultDisplays", "defaultDisplay", "tag", "probe", "show", "hide", "toggle", "state", "visible", "GridEditor", "VALUES", "SCALE", "SIDES", "SET", "INFIXES", "PROPERTIES", "pattern", "key", "spacingPart", "ge", "given", "options", "patterns", "applies", "node", "kind", "is", "classes", "carries", "name", "source", "family", "tier", "names", "values", "v", "without", "original", "style", "bare", "side", "sides", "breakpoint", "winners", "styles", "neutral", "order", "found", "set", "current", "winner", "startingSide", "sideLabel", "group", "labelText", "box", "element", "value", "field", "next", "NODES", "mark", "scope", "selfAndAll", "drawer", "child", "css", "hasClass", "padded", "all", "note", "toggle", "families", "labelKey", "offered", "GridEditor", "ge", "spacingPart"]
|
|
7
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// src/js/plugins/grideditor.textalign.js
|
|
2
|
-
import { GridEditor as GridEditor2 } from "../grideditor.esm.js";
|
|
3
|
-
|
|
4
|
-
// src/js/style/textalign.js
|
|
5
|
-
import { GridEditor } from "../grideditor.esm.js";
|
|
6
|
-
Object.assign(GridEditor.locales.en, {
|
|
7
|
-
"utility.text_align": "Text alignment",
|
|
8
|
-
"utility.text_start": "Start",
|
|
9
|
-
"utility.text_center": "Center",
|
|
10
|
-
"utility.text_end": "End"
|
|
11
|
-
});
|
|
12
|
-
var CSS = { start: "left", center: "center", end: "right" };
|
|
13
|
-
function textalignPart(ge) {
|
|
14
|
-
function label(value) {
|
|
15
|
-
if (value === "start") {
|
|
16
|
-
return ge.t("utility.text_start");
|
|
17
|
-
}
|
|
18
|
-
if (value === "center") {
|
|
19
|
-
return ge.t("utility.text_center");
|
|
20
|
-
}
|
|
21
|
-
return ge.t("utility.text_end");
|
|
22
|
-
}
|
|
23
|
-
return {
|
|
24
|
-
families: [{
|
|
25
|
-
name: "text-align",
|
|
26
|
-
prefix: "text",
|
|
27
|
-
values: ["start", "center", "end"],
|
|
28
|
-
appliesTo: ["row", "column", "text", "element", "container"],
|
|
29
|
-
labelKey: "utility.text_align",
|
|
30
|
-
label,
|
|
31
|
-
/**
|
|
32
|
-
* With no class applying here, the node aligns as its parent
|
|
33
|
-
* does - or as the host's css says - which only the browser can
|
|
34
|
-
* tell, so it is asked with the classes out of the way. Parents
|
|
35
|
-
* are previewed before their children, so the parent's answer is
|
|
36
|
-
* already the view's.
|
|
37
|
-
*/
|
|
38
|
-
preview: function(value, node) {
|
|
39
|
-
return { "text-align": value === null ? ge.bareStyle(node, "text-align", "text-align") : CSS[value] };
|
|
40
|
-
}
|
|
41
|
-
}]
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// src/js/plugins/grideditor.textalign.js
|
|
46
|
-
GridEditor2.utilities.textalign = function(ge) {
|
|
47
|
-
ge.warn('the "textalign" plugin is deprecated and will be removed in 8.0: load grideditor.style.js');
|
|
48
|
-
return textalignPart(ge);
|
|
49
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
(() => {
|
|
2
|
-
// src/js/register.js
|
|
3
|
-
var GridEditor = window.GridEditor;
|
|
4
|
-
if (!GridEditor || typeof GridEditor.get !== "function") {
|
|
5
|
-
throw new Error("grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, its locales and grideditor.jquery.js");
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// src/js/style/textalign.js
|
|
9
|
-
Object.assign(GridEditor.locales.en, {
|
|
10
|
-
"utility.text_align": "Text alignment",
|
|
11
|
-
"utility.text_start": "Start",
|
|
12
|
-
"utility.text_center": "Center",
|
|
13
|
-
"utility.text_end": "End"
|
|
14
|
-
});
|
|
15
|
-
var CSS = { start: "left", center: "center", end: "right" };
|
|
16
|
-
function textalignPart(ge) {
|
|
17
|
-
function label(value) {
|
|
18
|
-
if (value === "start") {
|
|
19
|
-
return ge.t("utility.text_start");
|
|
20
|
-
}
|
|
21
|
-
if (value === "center") {
|
|
22
|
-
return ge.t("utility.text_center");
|
|
23
|
-
}
|
|
24
|
-
return ge.t("utility.text_end");
|
|
25
|
-
}
|
|
26
|
-
return {
|
|
27
|
-
families: [{
|
|
28
|
-
name: "text-align",
|
|
29
|
-
prefix: "text",
|
|
30
|
-
values: ["start", "center", "end"],
|
|
31
|
-
appliesTo: ["row", "column", "text", "element", "container"],
|
|
32
|
-
labelKey: "utility.text_align",
|
|
33
|
-
label,
|
|
34
|
-
/**
|
|
35
|
-
* With no class applying here, the node aligns as its parent
|
|
36
|
-
* does - or as the host's css says - which only the browser can
|
|
37
|
-
* tell, so it is asked with the classes out of the way. Parents
|
|
38
|
-
* are previewed before their children, so the parent's answer is
|
|
39
|
-
* already the view's.
|
|
40
|
-
*/
|
|
41
|
-
preview: function(value, node) {
|
|
42
|
-
return { "text-align": value === null ? ge.bareStyle(node, "text-align", "text-align") : CSS[value] };
|
|
43
|
-
}
|
|
44
|
-
}]
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// src/js/plugins/grideditor.textalign.js
|
|
49
|
-
GridEditor.utilities.textalign = function(ge) {
|
|
50
|
-
ge.warn('the "textalign" plugin is deprecated and will be removed in 8.0: load grideditor.style.js');
|
|
51
|
-
return textalignPart(ge);
|
|
52
|
-
};
|
|
53
|
-
})();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(()=>{var e=window.GridEditor;if(!e||typeof e.get!="function")throw new Error("grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, its locales and grideditor.jquery.js");Object.assign(e.locales.en,{"utility.text_align":"Text alignment","utility.text_start":"Start","utility.text_center":"Center","utility.text_end":"End"});var a={start:"left",center:"center",end:"right"};function r(t){function n(i){return i==="start"?t.t("utility.text_start"):i==="center"?t.t("utility.text_center"):t.t("utility.text_end")}return{families:[{name:"text-align",prefix:"text",values:["start","center","end"],appliesTo:["row","column","text","element","container"],labelKey:"utility.text_align",label:n,preview:function(i,l){return{"text-align":i===null?t.bareStyle(l,"text-align","text-align"):a[i]}}}]}}e.utilities.textalign=function(t){return t.warn('the "textalign" plugin is deprecated and will be removed in 8.0: load grideditor.style.js'),r(t)};})();
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/js/register.js", "../../src/js/style/textalign.js", "../../src/js/plugins/grideditor.textalign.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * What a plugin's or a locale's classic script imports in place of the\n * editor: the GridEditor the page already loaded.\n *\n * The build points `import { GridEditor } from '../grideditor.js'` here for\n * the classic scripts, so each registers on the editor the page has rather\n * than bringing its own. Loaded before the editor there is nothing to\n * register on, and saying so is better than a TypeError three calls later.\n */\nvar GridEditor = window.GridEditor;\n\nif (!GridEditor || typeof GridEditor.get !== 'function') {\n throw new Error('grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, ' +\n 'its locales and grideditor.jquery.js');\n}\n\nexport { GridEditor };\nexport default GridEditor;\n", "/**\n * Text alignment, a part of the style plugin: text alignment per breakpoint, with Bootstrap's text-{breakpoint}-start,\n * -center and -end classes.\n *\n * The part is what the textalign plugin was up to 7.2 - its families, and\n * whatever it did on the canvas - as a function of the handle.\n * grideditor.style.js puts it in its sections; the deprecated\n * grideditor.textalign.js still registers it on its own, as it always did.\n */\nimport { GridEditor } from '../grideditor.js';\n\nObject.assign(GridEditor.locales.en, {\n 'utility.text_align': 'Text alignment',\n 'utility.text_start': 'Start',\n 'utility.text_center': 'Center',\n 'utility.text_end': 'End',\n});\n\n/** Start and end are left and right: Bootstrap's css is left to right. */\nvar CSS = { start: 'left', center: 'center', end: 'right' };\n\nexport function textalignPart(ge) {\n\n function label(value) {\n if (value === 'start') { return ge.t('utility.text_start'); }\n if (value === 'center') { return ge.t('utility.text_center'); }\n\n return ge.t('utility.text_end');\n }\n\n return {\n families: [{\n name: 'text-align',\n prefix: 'text',\n values: ['start', 'center', 'end'],\n appliesTo: ['row', 'column', 'text', 'element', 'container'],\n labelKey: 'utility.text_align',\n label: label,\n\n /**\n * With no class applying here, the node aligns as its parent\n * does - or as the host's css says - which only the browser can\n * tell, so it is asked with the classes out of the way. Parents\n * are previewed before their children, so the parent's answer is\n * already the view's.\n */\n preview: function(value, node) {\n return { 'text-align': value === null ? ge.bareStyle(node, 'text-align', 'text-align') : CSS[value] };\n },\n }],\n };\n}\n", "/**\n * Text alignment for grid-editor.\n *\n * A utility plugin: load this file after the editor and a row, column,\n * element or container can align its text per breakpoint, with Bootstrap's\n * text-{breakpoint}-start, -center and -end classes. What it can ask the\n * editor for is the handle its factory is called with, described in\n * docs/plugins.md.\n *\n * <script src=\"dist/grideditor.min.js\"></script>\n * <script src=\"dist/plugins/grideditor.textalign.min.js\"></script>\n *\n * The class aligns everything inside the node that does not align itself: a\n * paragraph the rich text editor gave its own text-align keeps it.\n *\n * Deprecated since 7.3, and gone in 8.0: grideditor.style.js carries this\n * plugin's families, and edits them in its own sections. This file is that\n * part on its own, as it was, and says so once per editor. Loaded beside\n * the style plugin, it stands down.\n */\nimport { GridEditor } from '../grideditor.js';\nimport { textalignPart } from '../style/textalign.js';\n\nGridEditor.utilities.textalign = function(ge) {\n ge.warn('the \"textalign\" plugin is deprecated and will be removed in 8.0: load grideditor.style.js');\n return textalignPart(ge);\n};\n"],
|
|
5
|
-
"mappings": "MASA,IAAIA,EAAa,OAAO,WAExB,GAAI,CAACA,GAAc,OAAOA,EAAW,KAAQ,WACzC,MAAM,IAAI,MAAM,wHAC0B,ECF9C,OAAO,OAAOC,EAAW,QAAQ,GAAI,CACjC,qBAAsB,iBACtB,qBAAsB,QACtB,sBAAuB,SACvB,mBAAoB,KACxB,CAAC,EAGD,IAAIC,EAAM,CAAE,MAAO,OAAQ,OAAQ,SAAU,IAAK,OAAQ,EAEnD,SAASC,EAAcC,EAAI,CAE9B,SAASC,EAAMC,EAAO,CAClB,OAAIA,IAAU,QAAkBF,EAAG,EAAE,oBAAoB,EACrDE,IAAU,SAAmBF,EAAG,EAAE,qBAAqB,EAEpDA,EAAG,EAAE,kBAAkB,CAClC,CAEA,MAAO,CACH,SAAU,CAAC,CACP,KAAM,aACN,OAAQ,OACR,OAAQ,CAAC,QAAS,SAAU,KAAK,EACjC,UAAW,CAAC,MAAO,SAAU,OAAQ,UAAW,WAAW,EAC3D,SAAU,qBACV,MAAOC,EASP,QAAS,SAASC,EAAOC,EAAM,CAC3B,MAAO,CAAE,aAAcD,IAAU,KAAOF,EAAG,UAAUG,EAAM,aAAc,YAAY,EAAIL,EAAII,CAAK,CAAE,CACxG,CACJ,CAAC,CACL,CACJ,CC5BAE,EAAW,UAAU,UAAY,SAASC,EAAI,CAC1C,OAAAA,EAAG,KAAK,2FAA2F,EAC5FC,EAAcD,CAAE,CAC3B",
|
|
6
|
-
"names": ["GridEditor", "GridEditor", "CSS", "textalignPart", "ge", "label", "value", "node", "GridEditor", "ge", "textalignPart"]
|
|
7
|
-
}
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
// src/js/plugins/grideditor.visibility.js
|
|
2
|
-
import { GridEditor as GridEditor2 } from "../grideditor.esm.js";
|
|
3
|
-
|
|
4
|
-
// src/js/style/visibility.js
|
|
5
|
-
import { GridEditor } from "../grideditor.esm.js";
|
|
6
|
-
|
|
7
|
-
// src/js/dom.js
|
|
8
|
-
function all(root, selector) {
|
|
9
|
-
return root ? Array.prototype.slice.call(root.querySelectorAll(selector)) : [];
|
|
10
|
-
}
|
|
11
|
-
function selfAndAll(root, selector) {
|
|
12
|
-
if (!root) {
|
|
13
|
-
return [];
|
|
14
|
-
}
|
|
15
|
-
var found = all(root, selector);
|
|
16
|
-
if (root.nodeType === 1 && root.matches(selector)) {
|
|
17
|
-
found.unshift(root);
|
|
18
|
-
}
|
|
19
|
-
return found;
|
|
20
|
-
}
|
|
21
|
-
function children(node, selector) {
|
|
22
|
-
if (!node) {
|
|
23
|
-
return [];
|
|
24
|
-
}
|
|
25
|
-
return Array.prototype.filter.call(node.children, function(each) {
|
|
26
|
-
return !selector || each.matches(selector);
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
function is(node, selector) {
|
|
30
|
-
return !!node && node.nodeType === 1 && node.matches(selector);
|
|
31
|
-
}
|
|
32
|
-
function removeClass(node, names) {
|
|
33
|
-
split(names).forEach(function(name) {
|
|
34
|
-
node.classList.remove(name);
|
|
35
|
-
});
|
|
36
|
-
return node;
|
|
37
|
-
}
|
|
38
|
-
function toggleClass(node, names, state) {
|
|
39
|
-
split(names).forEach(function(name) {
|
|
40
|
-
if (state === void 0) {
|
|
41
|
-
node.classList.toggle(name);
|
|
42
|
-
} else {
|
|
43
|
-
node.classList.toggle(name, !!state);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
return node;
|
|
47
|
-
}
|
|
48
|
-
function split(names) {
|
|
49
|
-
return String(names || "").split(/\s+/).filter(Boolean);
|
|
50
|
-
}
|
|
51
|
-
function dropEmptyClass(node) {
|
|
52
|
-
if (!node.getAttribute("class")) {
|
|
53
|
-
node.removeAttribute("class");
|
|
54
|
-
}
|
|
55
|
-
return node;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// src/js/style/visibility.js
|
|
59
|
-
Object.assign(GridEditor.locales.en, {
|
|
60
|
-
"utility.visibility": "Visibility",
|
|
61
|
-
"utility.visibility_hidden": "Hidden",
|
|
62
|
-
"utility.visibility_shown": "Shown",
|
|
63
|
-
"tool.hide_in_view": "Hide in this view",
|
|
64
|
-
"tool.show_in_view": "Show in this view",
|
|
65
|
-
"badge.hidden_in": "Hidden at {breakpoints}"
|
|
66
|
-
});
|
|
67
|
-
var CLASS_PATTERN = /(?:^|\s)d-(?:(?:sm|md|lg|xl|xxl)-)?(?:none|block|flex)(?:\s|$)/;
|
|
68
|
-
var NODES = ".row, .column, .ge-content, .ge-element, [data-ge-container]";
|
|
69
|
-
function visibilityPart(ge, given) {
|
|
70
|
-
var options = Object.assign({ drawer: true }, given);
|
|
71
|
-
function shown(kind) {
|
|
72
|
-
return kind === "row" ? "flex" : "block";
|
|
73
|
-
}
|
|
74
|
-
function applies(node, kind) {
|
|
75
|
-
return kind === "row" || kind === "column" || kind === "element" || kind === "text" || kind === "plain" || is(node, "[data-ge-container]");
|
|
76
|
-
}
|
|
77
|
-
function hiddenAt(node, view) {
|
|
78
|
-
return ge.getUtility(node, "visibility", view) === "none";
|
|
79
|
-
}
|
|
80
|
-
function hiddenTiers(node) {
|
|
81
|
-
return ge.breakpoints.filter(function(key) {
|
|
82
|
-
return hiddenAt(node, key);
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
function hiddenHere(node) {
|
|
86
|
-
return ge.view() === "all" ? hiddenTiers(node).length === ge.breakpoints.length : hiddenAt(node, ge.view());
|
|
87
|
-
}
|
|
88
|
-
function hiddenBelow(node) {
|
|
89
|
-
var index = ge.breakpoints.indexOf(ge.view());
|
|
90
|
-
return index > 0 && hiddenAt(node, ge.breakpoints[index - 1]);
|
|
91
|
-
}
|
|
92
|
-
function toggle(node, kind) {
|
|
93
|
-
var hide = !hiddenHere(node);
|
|
94
|
-
var value;
|
|
95
|
-
if (ge.view() === "all") {
|
|
96
|
-
value = hide ? "none" : null;
|
|
97
|
-
} else if (hide) {
|
|
98
|
-
value = hiddenBelow(node) ? null : "none";
|
|
99
|
-
} else {
|
|
100
|
-
value = hiddenBelow(node) ? shown(kind) : null;
|
|
101
|
-
}
|
|
102
|
-
ge.setUtility(node, "visibility", value, { source: "tool" });
|
|
103
|
-
}
|
|
104
|
-
function mark(scope) {
|
|
105
|
-
selfAndAll(scope, NODES).forEach(function(node) {
|
|
106
|
-
var kind = ge.kindOf(node);
|
|
107
|
-
var carries = applies(node, kind) && CLASS_PATTERN.test(node.getAttribute("class") || "");
|
|
108
|
-
var tiers = carries ? hiddenTiers(node) : [];
|
|
109
|
-
var here = carries && hiddenHere(node);
|
|
110
|
-
var partly = carries && ge.view() === "all" && tiers.length > 0 && !here;
|
|
111
|
-
toggleClass(node, "ge-visibility", carries);
|
|
112
|
-
toggleClass(node, "ge-hidden-in-view", here);
|
|
113
|
-
if (partly) {
|
|
114
|
-
node.setAttribute("data-ge-hidden-in", ge.t("badge.hidden_in", { breakpoints: tiers.join(", ") }));
|
|
115
|
-
} else {
|
|
116
|
-
node.removeAttribute("data-ge-hidden-in");
|
|
117
|
-
}
|
|
118
|
-
children(node, ".ge-tools-drawer").forEach(function(drawer) {
|
|
119
|
-
children(drawer, ".ge-visibility-tool").forEach(function(tool) {
|
|
120
|
-
tool.setAttribute("title", here ? ge.t("tool.show_in_view") : ge.t("tool.hide_in_view"));
|
|
121
|
-
all(tool, "i").forEach(function(icon) {
|
|
122
|
-
icon.setAttribute("class", here ? "bi bi-eye-slash" : "bi bi-eye");
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
function unmark() {
|
|
129
|
-
all(ge.canvas, ".ge-visibility, .ge-hidden-in-view, [data-ge-hidden-in]").forEach(function(node) {
|
|
130
|
-
removeClass(node, "ge-visibility ge-hidden-in-view");
|
|
131
|
-
node.removeAttribute("data-ge-hidden-in");
|
|
132
|
-
dropEmptyClass(node);
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
return {
|
|
136
|
-
families: [{
|
|
137
|
-
name: "visibility",
|
|
138
|
-
prefix: "d",
|
|
139
|
-
values: ["none", "block", "flex"],
|
|
140
|
-
appliesTo: ["row", "column", "text", "element", "container"],
|
|
141
|
-
labelKey: "utility.visibility",
|
|
142
|
-
/** Hidden, or shown the way this kind of node is shown. */
|
|
143
|
-
choices: function(node, kind) {
|
|
144
|
-
return ["none", shown(kind)];
|
|
145
|
-
},
|
|
146
|
-
label: function(value) {
|
|
147
|
-
return value === "none" ? ge.t("utility.visibility_hidden") : ge.t("utility.visibility_shown");
|
|
148
|
-
}
|
|
149
|
-
}],
|
|
150
|
-
drawerTools: function(drawer, node, kind) {
|
|
151
|
-
if (!options.drawer || !applies(node, kind)) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
ge.createTool(drawer, ge.t("tool.hide_in_view"), "ge-visibility-tool", "bi bi-eye", function() {
|
|
155
|
-
toggle(node, kind);
|
|
156
|
-
});
|
|
157
|
-
},
|
|
158
|
-
onRefresh: mark,
|
|
159
|
-
onDeinit: unmark
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// src/js/plugins/grideditor.visibility.js
|
|
164
|
-
GridEditor2.utilities.visibility = function(ge) {
|
|
165
|
-
ge.warn('the "visibility" plugin is deprecated and will be removed in 8.0: load grideditor.style.js');
|
|
166
|
-
return visibilityPart(ge, ge.settings.utilities.visibility);
|
|
167
|
-
};
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
(() => {
|
|
2
|
-
// src/js/register.js
|
|
3
|
-
var GridEditor = window.GridEditor;
|
|
4
|
-
if (!GridEditor || typeof GridEditor.get !== "function") {
|
|
5
|
-
throw new Error("grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, its locales and grideditor.jquery.js");
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// src/js/dom.js
|
|
9
|
-
function all(root, selector) {
|
|
10
|
-
return root ? Array.prototype.slice.call(root.querySelectorAll(selector)) : [];
|
|
11
|
-
}
|
|
12
|
-
function selfAndAll(root, selector) {
|
|
13
|
-
if (!root) {
|
|
14
|
-
return [];
|
|
15
|
-
}
|
|
16
|
-
var found = all(root, selector);
|
|
17
|
-
if (root.nodeType === 1 && root.matches(selector)) {
|
|
18
|
-
found.unshift(root);
|
|
19
|
-
}
|
|
20
|
-
return found;
|
|
21
|
-
}
|
|
22
|
-
function children(node, selector) {
|
|
23
|
-
if (!node) {
|
|
24
|
-
return [];
|
|
25
|
-
}
|
|
26
|
-
return Array.prototype.filter.call(node.children, function(each) {
|
|
27
|
-
return !selector || each.matches(selector);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
function is(node, selector) {
|
|
31
|
-
return !!node && node.nodeType === 1 && node.matches(selector);
|
|
32
|
-
}
|
|
33
|
-
function removeClass(node, names) {
|
|
34
|
-
split(names).forEach(function(name) {
|
|
35
|
-
node.classList.remove(name);
|
|
36
|
-
});
|
|
37
|
-
return node;
|
|
38
|
-
}
|
|
39
|
-
function toggleClass(node, names, state) {
|
|
40
|
-
split(names).forEach(function(name) {
|
|
41
|
-
if (state === void 0) {
|
|
42
|
-
node.classList.toggle(name);
|
|
43
|
-
} else {
|
|
44
|
-
node.classList.toggle(name, !!state);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
return node;
|
|
48
|
-
}
|
|
49
|
-
function split(names) {
|
|
50
|
-
return String(names || "").split(/\s+/).filter(Boolean);
|
|
51
|
-
}
|
|
52
|
-
function dropEmptyClass(node) {
|
|
53
|
-
if (!node.getAttribute("class")) {
|
|
54
|
-
node.removeAttribute("class");
|
|
55
|
-
}
|
|
56
|
-
return node;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// src/js/style/visibility.js
|
|
60
|
-
Object.assign(GridEditor.locales.en, {
|
|
61
|
-
"utility.visibility": "Visibility",
|
|
62
|
-
"utility.visibility_hidden": "Hidden",
|
|
63
|
-
"utility.visibility_shown": "Shown",
|
|
64
|
-
"tool.hide_in_view": "Hide in this view",
|
|
65
|
-
"tool.show_in_view": "Show in this view",
|
|
66
|
-
"badge.hidden_in": "Hidden at {breakpoints}"
|
|
67
|
-
});
|
|
68
|
-
var CLASS_PATTERN = /(?:^|\s)d-(?:(?:sm|md|lg|xl|xxl)-)?(?:none|block|flex)(?:\s|$)/;
|
|
69
|
-
var NODES = ".row, .column, .ge-content, .ge-element, [data-ge-container]";
|
|
70
|
-
function visibilityPart(ge, given) {
|
|
71
|
-
var options = Object.assign({ drawer: true }, given);
|
|
72
|
-
function shown(kind) {
|
|
73
|
-
return kind === "row" ? "flex" : "block";
|
|
74
|
-
}
|
|
75
|
-
function applies(node, kind) {
|
|
76
|
-
return kind === "row" || kind === "column" || kind === "element" || kind === "text" || kind === "plain" || is(node, "[data-ge-container]");
|
|
77
|
-
}
|
|
78
|
-
function hiddenAt(node, view) {
|
|
79
|
-
return ge.getUtility(node, "visibility", view) === "none";
|
|
80
|
-
}
|
|
81
|
-
function hiddenTiers(node) {
|
|
82
|
-
return ge.breakpoints.filter(function(key) {
|
|
83
|
-
return hiddenAt(node, key);
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
function hiddenHere(node) {
|
|
87
|
-
return ge.view() === "all" ? hiddenTiers(node).length === ge.breakpoints.length : hiddenAt(node, ge.view());
|
|
88
|
-
}
|
|
89
|
-
function hiddenBelow(node) {
|
|
90
|
-
var index = ge.breakpoints.indexOf(ge.view());
|
|
91
|
-
return index > 0 && hiddenAt(node, ge.breakpoints[index - 1]);
|
|
92
|
-
}
|
|
93
|
-
function toggle(node, kind) {
|
|
94
|
-
var hide = !hiddenHere(node);
|
|
95
|
-
var value;
|
|
96
|
-
if (ge.view() === "all") {
|
|
97
|
-
value = hide ? "none" : null;
|
|
98
|
-
} else if (hide) {
|
|
99
|
-
value = hiddenBelow(node) ? null : "none";
|
|
100
|
-
} else {
|
|
101
|
-
value = hiddenBelow(node) ? shown(kind) : null;
|
|
102
|
-
}
|
|
103
|
-
ge.setUtility(node, "visibility", value, { source: "tool" });
|
|
104
|
-
}
|
|
105
|
-
function mark(scope) {
|
|
106
|
-
selfAndAll(scope, NODES).forEach(function(node) {
|
|
107
|
-
var kind = ge.kindOf(node);
|
|
108
|
-
var carries = applies(node, kind) && CLASS_PATTERN.test(node.getAttribute("class") || "");
|
|
109
|
-
var tiers = carries ? hiddenTiers(node) : [];
|
|
110
|
-
var here = carries && hiddenHere(node);
|
|
111
|
-
var partly = carries && ge.view() === "all" && tiers.length > 0 && !here;
|
|
112
|
-
toggleClass(node, "ge-visibility", carries);
|
|
113
|
-
toggleClass(node, "ge-hidden-in-view", here);
|
|
114
|
-
if (partly) {
|
|
115
|
-
node.setAttribute("data-ge-hidden-in", ge.t("badge.hidden_in", { breakpoints: tiers.join(", ") }));
|
|
116
|
-
} else {
|
|
117
|
-
node.removeAttribute("data-ge-hidden-in");
|
|
118
|
-
}
|
|
119
|
-
children(node, ".ge-tools-drawer").forEach(function(drawer) {
|
|
120
|
-
children(drawer, ".ge-visibility-tool").forEach(function(tool) {
|
|
121
|
-
tool.setAttribute("title", here ? ge.t("tool.show_in_view") : ge.t("tool.hide_in_view"));
|
|
122
|
-
all(tool, "i").forEach(function(icon) {
|
|
123
|
-
icon.setAttribute("class", here ? "bi bi-eye-slash" : "bi bi-eye");
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
function unmark() {
|
|
130
|
-
all(ge.canvas, ".ge-visibility, .ge-hidden-in-view, [data-ge-hidden-in]").forEach(function(node) {
|
|
131
|
-
removeClass(node, "ge-visibility ge-hidden-in-view");
|
|
132
|
-
node.removeAttribute("data-ge-hidden-in");
|
|
133
|
-
dropEmptyClass(node);
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
return {
|
|
137
|
-
families: [{
|
|
138
|
-
name: "visibility",
|
|
139
|
-
prefix: "d",
|
|
140
|
-
values: ["none", "block", "flex"],
|
|
141
|
-
appliesTo: ["row", "column", "text", "element", "container"],
|
|
142
|
-
labelKey: "utility.visibility",
|
|
143
|
-
/** Hidden, or shown the way this kind of node is shown. */
|
|
144
|
-
choices: function(node, kind) {
|
|
145
|
-
return ["none", shown(kind)];
|
|
146
|
-
},
|
|
147
|
-
label: function(value) {
|
|
148
|
-
return value === "none" ? ge.t("utility.visibility_hidden") : ge.t("utility.visibility_shown");
|
|
149
|
-
}
|
|
150
|
-
}],
|
|
151
|
-
drawerTools: function(drawer, node, kind) {
|
|
152
|
-
if (!options.drawer || !applies(node, kind)) {
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
ge.createTool(drawer, ge.t("tool.hide_in_view"), "ge-visibility-tool", "bi bi-eye", function() {
|
|
156
|
-
toggle(node, kind);
|
|
157
|
-
});
|
|
158
|
-
},
|
|
159
|
-
onRefresh: mark,
|
|
160
|
-
onDeinit: unmark
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// src/js/plugins/grideditor.visibility.js
|
|
165
|
-
GridEditor.utilities.visibility = function(ge) {
|
|
166
|
-
ge.warn('the "visibility" plugin is deprecated and will be removed in 8.0: load grideditor.style.js');
|
|
167
|
-
return visibilityPart(ge, ge.settings.utilities.visibility);
|
|
168
|
-
};
|
|
169
|
-
})();
|
|
@@ -1 +0,0 @@
|
|
|
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 s(t,n){return t?Array.prototype.slice.call(t.querySelectorAll(n)):[]}function x(t,n){if(!t)return[];var r=s(t,n);return t.nodeType===1&&t.matches(n)&&r.unshift(t),r}function d(t,n){return t?Array.prototype.filter.call(t.children,function(r){return!n||r.matches(n)}):[]}function w(t,n){return!!t&&t.nodeType===1&&t.matches(n)}function E(t,n){return A(n).forEach(function(r){t.classList.remove(r)}),t}function p(t,n,r){return A(n).forEach(function(a){r===void 0?t.classList.toggle(a):t.classList.toggle(a,!!r)}),t}function A(t){return String(t||"").split(/\s+/).filter(Boolean)}function T(t){return t.getAttribute("class")||t.removeAttribute("class"),t}Object.assign(u.locales.en,{"utility.visibility":"Visibility","utility.visibility_hidden":"Hidden","utility.visibility_shown":"Shown","tool.hide_in_view":"Hide in this view","tool.show_in_view":"Show in this view","badge.hidden_in":"Hidden at {breakpoints}"});var H=/(?:^|\s)d-(?:(?:sm|md|lg|xl|xxl)-)?(?:none|block|flex)(?:\s|$)/,N=".row, .column, .ge-content, .ge-element, [data-ge-container]";function C(t,n){var r=Object.assign({drawer:!0},n);function a(i){return i==="row"?"flex":"block"}function v(i,e){return e==="row"||e==="column"||e==="element"||e==="text"||e==="plain"||w(i,"[data-ge-container]")}function c(i,e){return t.getUtility(i,"visibility",e)==="none"}function h(i){return t.breakpoints.filter(function(e){return c(i,e)})}function m(i){return t.view()==="all"?h(i).length===t.breakpoints.length:c(i,t.view())}function y(i){var e=t.breakpoints.indexOf(t.view());return e>0&&c(i,t.breakpoints[e-1])}function S(i,e){var l=!m(i),o;t.view()==="all"?o=l?"none":null:l?o=y(i)?null:"none":o=y(i)?a(e):null,t.setUtility(i,"visibility",o,{source:"tool"})}function _(i){x(i,N).forEach(function(e){var l=t.kindOf(e),o=v(e,l)&&H.test(e.getAttribute("class")||""),g=o?h(e):[],f=o&&m(e),k=o&&t.view()==="all"&&g.length>0&&!f;p(e,"ge-visibility",o),p(e,"ge-hidden-in-view",f),k?e.setAttribute("data-ge-hidden-in",t.t("badge.hidden_in",{breakpoints:g.join(", ")})):e.removeAttribute("data-ge-hidden-in"),d(e,".ge-tools-drawer").forEach(function(L){d(L,".ge-visibility-tool").forEach(function(b){b.setAttribute("title",f?t.t("tool.show_in_view"):t.t("tool.hide_in_view")),s(b,"i").forEach(function(O){O.setAttribute("class",f?"bi bi-eye-slash":"bi bi-eye")})})})})}function B(){s(t.canvas,".ge-visibility, .ge-hidden-in-view, [data-ge-hidden-in]").forEach(function(i){E(i,"ge-visibility ge-hidden-in-view"),i.removeAttribute("data-ge-hidden-in"),T(i)})}return{families:[{name:"visibility",prefix:"d",values:["none","block","flex"],appliesTo:["row","column","text","element","container"],labelKey:"utility.visibility",choices:function(i,e){return["none",a(e)]},label:function(i){return i==="none"?t.t("utility.visibility_hidden"):t.t("utility.visibility_shown")}}],drawerTools:function(i,e,l){!r.drawer||!v(e,l)||t.createTool(i,t.t("tool.hide_in_view"),"ge-visibility-tool","bi bi-eye",function(){S(e,l)})},onRefresh:_,onDeinit:B}}u.utilities.visibility=function(t){return t.warn('the "visibility" plugin is deprecated and will be removed in 8.0: load grideditor.style.js'),C(t,t.settings.utilities.visibility)};})();
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/js/register.js", "../../src/js/dom.js", "../../src/js/style/visibility.js", "../../src/js/plugins/grideditor.visibility.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * What a plugin's or a locale's classic script imports in place of the\n * editor: the GridEditor the page already loaded.\n *\n * The build points `import { GridEditor } from '../grideditor.js'` here for\n * the classic scripts, so each registers on the editor the page has rather\n * than bringing its own. Loaded before the editor there is nothing to\n * register on, and saying so is better than a TypeError three calls later.\n */\nvar GridEditor = window.GridEditor;\n\nif (!GridEditor || typeof GridEditor.get !== 'function') {\n throw new Error('grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, ' +\n 'its locales and grideditor.jquery.js');\n}\n\nexport { GridEditor };\nexport default GridEditor;\n", "/**\n * The DOM, the way grid-editor uses it.\n *\n * Small helpers over the browser's own API, for the core and the shipped\n * plugins. Not a public API: a plugin of a host's own is free to write its\n * DOM code however it likes, and this file makes no promise to it.\n *\n * Stateless on purpose. The build puts a copy of this file in each plugin's\n * classic script, so anything kept here would be kept once per copy; a\n * module that needs to remember something about a node keeps its own\n * WeakMap.\n */\n\n/** Every element under `root` matching `selector`, as an array. */\nexport function all(root, selector) {\n return root ? Array.prototype.slice.call(root.querySelectorAll(selector)) : [];\n}\n\n/** The first element under `root` matching `selector`, or null. */\nexport function one(root, selector) {\n return root ? root.querySelector(selector) : null;\n}\n\n/** `root` itself when it matches, then every element under it that does. */\nexport function selfAndAll(root, selector) {\n if (!root) { return []; }\n\n var found = all(root, selector);\n if (root.nodeType === 1 && root.matches(selector)) { found.unshift(root); }\n return found;\n}\n\n/** The element children of `node`, those matching `selector` if one is given. */\nexport function children(node, selector) {\n if (!node) { return []; }\n\n return Array.prototype.filter.call(node.children, function(each) {\n return !selector || each.matches(selector);\n });\n}\n\n/** The first element child matching `selector`, or null. */\nexport function child(node, selector) {\n return children(node, selector)[0] || null;\n}\n\n/** The nearest ancestor-or-self matching `selector` below `stopAt`, or null. */\nexport function closest(node, selector, stopAt) {\n var found = node && node.nodeType === 1 ? node.closest(selector) : null;\n\n if (found && stopAt && found !== stopAt && !stopAt.contains(found)) { return null; }\n return found;\n}\n\n/** Whether `node` is an element matching `selector`. */\nexport function is(node, selector) {\n return !!node && node.nodeType === 1 && node.matches(selector);\n}\n\n/** Whether `node` is in the document. */\nexport function attached(node) {\n return !!node && document.documentElement.contains(node);\n}\n\n/** The element siblings after `node` that match `selector`. */\nexport function nextAll(node, selector) {\n var found = [];\n\n for (var next = node.nextElementSibling; next; next = next.nextElementSibling) {\n if (!selector || next.matches(selector)) { found.push(next); }\n }\n return found;\n}\n\n/** The ancestors of `node` up to, and not including, `stop`, nearest first. */\nexport function parentsUntil(node, stop) {\n var found = [];\n\n for (var parent = node.parentElement; parent && parent !== stop; parent = parent.parentElement) {\n found.push(parent);\n }\n return found;\n}\n\n/**\n * The nodes the html parses into, detached. Parsed the way innerHTML parses,\n * so a <script> in it never runs, here or once it is in the page.\n */\nexport function parse(html) {\n var template = document.createElement('template');\n template.innerHTML = html;\n return Array.prototype.slice.call(template.content.childNodes);\n}\n\n/** The one element the html is, detached. */\nexport function create(html) {\n var nodes = parse(html.trim());\n\n for (var i = 0; i < nodes.length; i++) {\n if (nodes[i].nodeType === 1) { return nodes[i]; }\n }\n return null;\n}\n\n/** An element of `tag`, with `attributes` and `text`. */\nexport function element(tag, attributes, text) {\n var node = document.createElement(tag);\n\n Object.keys(attributes || {}).forEach(function(name) {\n var value = attributes[name];\n if (value !== null && value !== undefined && value !== false) { node.setAttribute(name, value); }\n });\n if (text !== undefined && text !== null) { node.textContent = text; }\n\n return node;\n}\n\n/** Replace what `node` holds with `html`. A <script> in it does not run. */\nexport function setHtml(node, html) {\n node.innerHTML = html === undefined || html === null ? '' : String(html);\n return node;\n}\n\n/** Add one or several space separated classes. */\nexport function addClass(node, names) {\n split(names).forEach(function(name) { node.classList.add(name); });\n return node;\n}\n\nexport function removeClass(node, names) {\n split(names).forEach(function(name) { node.classList.remove(name); });\n return node;\n}\n\n/** Each class on, or off, or flipped when `on` is not given. */\nexport function toggleClass(node, names, state) {\n split(names).forEach(function(name) {\n if (state === undefined) {\n node.classList.toggle(name);\n } else {\n node.classList.toggle(name, !!state);\n }\n });\n return node;\n}\n\nexport function hasClass(node, name) {\n return !!node && node.nodeType === 1 && node.classList.contains(name);\n}\n\nfunction split(names) {\n return String(names || '').split(/\\s+/).filter(Boolean);\n}\n\n/** Take the class attribute off when there is nothing left in it. */\nexport function dropEmptyClass(node) {\n if (!node.getAttribute('class')) { node.removeAttribute('class'); }\n return node;\n}\n\n/** Take the style attribute off when there is nothing left in it. */\nexport function dropEmptyStyle(node) {\n if (!node.getAttribute('style')) { node.removeAttribute('style'); }\n return node;\n}\n\n/** Set attributes; a null or undefined value takes the attribute off. */\nexport function attr(node, attributes) {\n Object.keys(attributes).forEach(function(name) {\n var value = attributes[name];\n\n if (value === null || value === undefined) {\n node.removeAttribute(name);\n } else {\n node.setAttribute(name, value);\n }\n });\n return node;\n}\n\n/**\n * Inline styles, by css property name. A number is pixels for the properties\n * that take a length, as jQuery had it; an empty string takes one off.\n */\nexport function css(node, styles) {\n Object.keys(styles).forEach(function(property) {\n var value = styles[property];\n\n if (typeof value === 'number' && !UNITLESS[property]) { value = value + 'px'; }\n node.style.setProperty(property, value === null || value === undefined ? '' : String(value));\n });\n return node;\n}\n\nvar UNITLESS = { opacity: true, 'z-index': true, 'flex-grow': true, 'flex-shrink': true, order: true };\n\n/** What an element of this tag shows as when nothing hides it. */\nvar defaultDisplays = {};\n\nfunction defaultDisplay(node) {\n var tag = node.nodeName;\n\n if (!defaultDisplays[tag]) {\n var probe = document.body.appendChild(document.createElement(tag));\n defaultDisplays[tag] = getComputedStyle(probe).display;\n probe.remove();\n if (defaultDisplays[tag] === 'none') { defaultDisplays[tag] = 'block'; }\n }\n return defaultDisplays[tag];\n}\n\n/** Show a node: its inline display:none off, and a display of its own if a stylesheet hides it. */\nexport function show(node) {\n node.style.removeProperty('display');\n if (getComputedStyle(node).display === 'none') { node.style.display = defaultDisplay(node); }\n return node;\n}\n\nexport function hide(node) {\n node.style.display = 'none';\n return node;\n}\n\n/** Show or hide; flip when `on` is not given. */\nexport function toggle(node, state) {\n if (state === undefined) { state = !visible(node); }\n return state ? show(node) : hide(node);\n}\n\n/** Whether a node takes up room: what jQuery's :visible meant. */\nexport function visible(node) {\n return !!(node.offsetWidth || node.offsetHeight || node.getClientRects().length);\n}\n\n/** The border box's width, fractions included. */\nexport function outerWidth(node) {\n return node.getBoundingClientRect().width;\n}\n\nexport function outerHeight(node) {\n return node.getBoundingClientRect().height;\n}\n\n/** The content box's height, which is what jQuery's height() gave. */\nexport function contentHeight(node) {\n var style = getComputedStyle(node);\n return node.clientHeight - parseFloat(style.paddingTop) - parseFloat(style.paddingBottom);\n}\n\n/** Where a node is on the page, not in the window. */\nexport function offset(node) {\n var box = node.getBoundingClientRect();\n return { top: box.top + window.pageYOffset, left: box.left + window.pageXOffset };\n}\n\n/** Its index among its parent's element children, those matching `selector` if given. */\nexport function indexIn(node, selector) {\n return children(node.parentElement, selector).indexOf(node);\n}\n\n/** Put `node` right after `reference`. */\nexport function insertAfter(node, reference) {\n reference.parentNode.insertBefore(node, reference.nextSibling);\n return node;\n}\n\n/** Replace `node` with what it holds. */\nexport function unwrap(node) {\n var parent = node.parentNode;\n\n while (node.firstChild) { parent.insertBefore(node.firstChild, node); }\n node.remove();\n}\n\n/** Put `node` inside `wrapper`, where `node` was. */\nexport function wrap(node, wrapper) {\n node.parentNode.insertBefore(wrapper, node);\n wrapper.appendChild(node);\n return wrapper;\n}\n\n/**\n * Listen on `root` for `types` (space separated) on descendants that match\n * `selector`, with `this` the matched element, as jQuery's delegated\n * handlers had it. Hands back the listener, for removeEventListener; a\n * signal in `options` removes it too.\n */\nexport function delegate(root, types, selector, handler, options) {\n var listener = function(event) {\n var match = closest(event.target, selector, root);\n if (match && root.contains(match)) { return handler.call(match, event); }\n return undefined;\n };\n\n split(types).forEach(function(type) { root.addEventListener(type, listener, options); });\n return listener;\n}\n\n/** Listen for several space separated event types with one handler. */\nexport function on(target, types, handler, options) {\n split(types).forEach(function(type) { target.addEventListener(type, handler, options); });\n return handler;\n}\n\nexport function off(target, types, handler, options) {\n split(types).forEach(function(type) { target.removeEventListener(type, handler, options); });\n}\n\n/** A mouse event of `type` sent to `node`, the way a pointer would. */\nexport function fire(node, type) {\n node.dispatchEvent(new MouseEvent(type, { bubbles: type !== 'mouseenter' && type !== 'mouseleave' }));\n}\n\n/* ------------------------------------------------------------------\n * Taking a node away, visibly.\n *\n * The durations are the ones 6.x had through jQuery: 400 ms unless the\n * caller says otherwise. `done` runs once the node is out of sight, which is\n * when the caller removes it; a node that is already out of sight is done at\n * once, on the next task, as jQuery had it.\n * ------------------------------------------------------------------ */\n\nvar DEFAULT_DURATION = 400;\n\nfunction animateAway(node, frames, duration, done) {\n duration = duration === undefined ? DEFAULT_DURATION : duration;\n\n var finish = function() {\n hide(node);\n if (done) { done(); }\n };\n\n if (!visible(node) || !node.animate || duration <= 0) {\n window.setTimeout(finish, 0);\n return;\n }\n\n var animation = node.animate(frames(getComputedStyle(node)), {\n duration: duration,\n easing: 'ease-in-out',\n });\n var called = false;\n var once = function() {\n if (called) { return; }\n called = true;\n finish();\n };\n\n animation.onfinish = once;\n animation.oncancel = once;\n}\n\n/** Fold a node up to nothing, then hide it. */\nexport function slideUp(node, duration, done) {\n if (typeof duration === 'function') {\n done = duration;\n duration = undefined;\n }\n\n node.style.overflow = 'hidden';\n animateAway(node, function(style) {\n return [\n {\n height: style.height,\n paddingTop: style.paddingTop,\n paddingBottom: style.paddingBottom,\n marginTop: style.marginTop,\n marginBottom: style.marginBottom,\n },\n { height: '0px', paddingTop: '0px', paddingBottom: '0px', marginTop: '0px', marginBottom: '0px' },\n ];\n }, duration, function() {\n node.style.removeProperty('overflow');\n if (done) { done(); }\n });\n}\n\n/** Fade a node out, then hide it. */\nexport function fadeOut(node, duration, done) {\n animateAway(node, function(style) {\n return [{ opacity: style.opacity }, { opacity: 0 }];\n }, duration, done);\n}\n\n/** Fade and fold a node, in height and, with `width`, sideways too, then hide it. */\nexport function shrinkAway(node, duration, done, width) {\n node.style.overflow = 'hidden';\n animateAway(node, function(style) {\n var from = { opacity: style.opacity, height: style.height };\n var to = { opacity: 0, height: '0px' };\n\n if (width) {\n from.width = style.width;\n to.width = '0px';\n }\n return [from, to];\n }, duration, function() {\n node.style.removeProperty('overflow');\n if (done) { done(); }\n });\n}\n", "/**\n * Visibility, a part of the style plugin: hiding and showing per breakpoint, with Bootstrap's d-{breakpoint}-none\n * and d-{breakpoint}-block or -flex classes, and the eye in the drawers.\n *\n * The part is what the visibility plugin was up to 7.2 - its families, and\n * whatever it did on the canvas - as a function of the handle and its options.\n * grideditor.style.js puts it in its sections; the deprecated\n * grideditor.visibility.js still registers it on its own, as it always did.\n */\nimport { GridEditor } from '../grideditor.js';\nimport * as dom from '../dom.js';\n\nObject.assign(GridEditor.locales.en, {\n 'utility.visibility': 'Visibility',\n 'utility.visibility_hidden': 'Hidden',\n 'utility.visibility_shown': 'Shown',\n 'tool.hide_in_view': 'Hide in this view',\n 'tool.show_in_view': 'Show in this view',\n 'badge.hidden_in': 'Hidden at {breakpoints}',\n});\n\n/** A node that carries any class of the family, at any breakpoint. */\nvar CLASS_PATTERN = /(?:^|\\s)d-(?:(?:sm|md|lg|xl|xxl)-)?(?:none|block|flex)(?:\\s|$)/;\n\nvar NODES = '.row, .column, .ge-content, .ge-element, [data-ge-container]';\n\nexport function visibilityPart(ge, given) {\n\n var options = Object.assign({ drawer: true }, given);\n\n /** What \"shown\" is written as on this kind of node. */\n function shown(kind) {\n return kind === 'row' ? 'flex' : 'block';\n }\n\n function applies(node, kind) {\n return kind === 'row' || kind === 'column' || kind === 'element' || kind === 'text' || kind === 'plain' ||\n dom.is(node, '[data-ge-container]');\n }\n\n function hiddenAt(node, view) {\n return ge.getUtility(node, 'visibility', view) === 'none';\n }\n\n /** The breakpoints at which the node is hidden, smallest first. */\n function hiddenTiers(node) {\n return ge.breakpoints.filter(function(key) { return hiddenAt(node, key); });\n }\n\n /**\n * Whether the node is hidden in the view being edited. In the all view\n * that means hidden at every breakpoint, since \"hidden at some\" is what\n * the badge is for.\n */\n function hiddenHere(node) {\n return ge.view() === 'all'\n ? hiddenTiers(node).length === ge.breakpoints.length\n : hiddenAt(node, ge.view());\n }\n\n /** What the breakpoint below the view shows, which an inherit falls back to. */\n function hiddenBelow(node) {\n var index = ge.breakpoints.indexOf(ge.view());\n\n return index > 0 && hiddenAt(node, ge.breakpoints[index - 1]);\n }\n\n /**\n * Hide or show the node in the view being edited, with as few classes as\n * that takes. In a breakpoint view that is often none at all: showing a\n * node the breakpoint below shows removes this breakpoint's d-*-none\n * rather than writing a d-*-block on top of it. In the all view a node\n * is hidden everywhere or shown everywhere, and shown is no class.\n */\n function toggle(node, kind) {\n var hide = !hiddenHere(node);\n var value;\n\n if (ge.view() === 'all') {\n value = hide ? 'none' : null;\n } else if (hide) {\n value = hiddenBelow(node) ? null : 'none';\n } else {\n value = hiddenBelow(node) ? shown(kind) : null;\n }\n\n ge.setUtility(node, 'visibility', value, { source: 'tool' });\n }\n\n /**\n * The canvas shows each node as the view sees it. ge-visibility keeps a\n * node Bootstrap would hide on the canvas, ge-hidden-in-view fades it,\n * and data-ge-hidden-in carries the badge text for the all view.\n */\n function mark(scope) {\n dom.selfAndAll(scope, NODES).forEach(function(node) {\n var kind = ge.kindOf(node);\n var carries = applies(node, kind) && CLASS_PATTERN.test(node.getAttribute('class') || '');\n var tiers = carries ? hiddenTiers(node) : [];\n var here = carries && hiddenHere(node);\n var partly = carries && ge.view() === 'all' && tiers.length > 0 && !here;\n\n dom.toggleClass(node, 'ge-visibility', carries);\n dom.toggleClass(node, 'ge-hidden-in-view', here);\n\n if (partly) {\n node.setAttribute('data-ge-hidden-in', ge.t('badge.hidden_in', { breakpoints: tiers.join(', ') }));\n } else {\n node.removeAttribute('data-ge-hidden-in');\n }\n\n dom.children(node, '.ge-tools-drawer').forEach(function(drawer) {\n dom.children(drawer, '.ge-visibility-tool').forEach(function(tool) {\n tool.setAttribute('title', here ? ge.t('tool.show_in_view') : ge.t('tool.hide_in_view'));\n dom.all(tool, 'i').forEach(function(icon) {\n icon.setAttribute('class', here ? 'bi bi-eye-slash' : 'bi bi-eye');\n });\n });\n });\n });\n }\n\n function unmark() {\n dom.all(ge.canvas, '.ge-visibility, .ge-hidden-in-view, [data-ge-hidden-in]').forEach(function(node) {\n dom.removeClass(node, 'ge-visibility ge-hidden-in-view');\n node.removeAttribute('data-ge-hidden-in');\n dom.dropEmptyClass(node);\n });\n }\n\n return {\n families: [{\n name: 'visibility',\n prefix: 'd',\n values: ['none', 'block', 'flex'],\n appliesTo: ['row', 'column', 'text', 'element', 'container'],\n labelKey: 'utility.visibility',\n\n /** Hidden, or shown the way this kind of node is shown. */\n choices: function(node, kind) {\n return ['none', shown(kind)];\n },\n\n label: function(value) {\n return value === 'none' ? ge.t('utility.visibility_hidden') : ge.t('utility.visibility_shown');\n },\n }],\n\n drawerTools: function(drawer, node, kind) {\n if (!options.drawer || !applies(node, kind)) { return; }\n\n ge.createTool(drawer, ge.t('tool.hide_in_view'), 'ge-visibility-tool', 'bi bi-eye', function() {\n toggle(node, kind);\n });\n },\n\n onRefresh: mark,\n onDeinit: unmark,\n };\n}\n", "/**\n * Visibility for grid-editor.\n *\n * A utility plugin: load this file after the editor and every row, column,\n * element and container can be hidden at some breakpoints and shown at\n * others, with Bootstrap's d-{breakpoint}-none and d-{breakpoint}-block (or\n * -flex, for a row, which is a flex container and stops being a grid as a\n * block). What it can ask the editor for is the handle its factory is called\n * with, described in docs/plugins.md.\n *\n * <script src=\"dist/grideditor.min.js\"></script>\n * <script src=\"dist/plugins/grideditor.visibility.min.js\"></script>\n *\n * A hidden node is never hidden from the editor, which would leave nothing to\n * click to show it again. It stays on the canvas, faded and striped in a view\n * where it is hidden, and in the all view says at which breakpoints it is.\n *\n * utilities.visibility.drawer: false leaves the eye out of the drawers, and\n * the panel field is the only control.\n *\n * Deprecated since 7.3, and gone in 8.0: grideditor.style.js carries this\n * plugin's families, and edits them in its own sections. This file is that\n * part on its own, as it was, and says so once per editor. Loaded beside\n * the style plugin, it stands down.\n */\nimport { GridEditor } from '../grideditor.js';\nimport { visibilityPart } from '../style/visibility.js';\n\nGridEditor.utilities.visibility = function(ge) {\n ge.warn('the \"visibility\" plugin is deprecated and will be removed in 8.0: load grideditor.style.js');\n return visibilityPart(ge, ge.settings.utilities.visibility);\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,CAQO,SAASC,EAAWC,EAAMC,EAAU,CACvC,GAAI,CAACD,EAAQ,MAAO,CAAC,EAErB,IAAIE,EAAQC,EAAIH,EAAMC,CAAQ,EAC9B,OAAID,EAAK,WAAa,GAAKA,EAAK,QAAQC,CAAQ,GAAKC,EAAM,QAAQF,CAAI,EAChEE,CACX,CAGO,SAASE,EAASC,EAAMJ,EAAU,CACrC,OAAKI,EAEE,MAAM,UAAU,OAAO,KAAKA,EAAK,SAAU,SAASC,EAAM,CAC7D,MAAO,CAACL,GAAYK,EAAK,QAAQL,CAAQ,CAC7C,CAAC,EAJmB,CAAC,CAKzB,CAgBO,SAASM,EAAGC,EAAMC,EAAU,CAC/B,MAAO,CAAC,CAACD,GAAQA,EAAK,WAAa,GAAKA,EAAK,QAAQC,CAAQ,CACjE,CAwEO,SAASC,EAAYC,EAAMC,EAAO,CACrC,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"names": ["GridEditor", "all", "root", "selector", "selfAndAll", "root", "selector", "found", "all", "children", "node", "each", "is", "node", "selector", "removeClass", "node", "names", "split", "name", "toggleClass", "state", "split", "names", "dropEmptyClass", "node", "GridEditor", "CLASS_PATTERN", "NODES", "visibilityPart", "ge", "given", "options", "shown", "kind", "applies", "node", "is", "hiddenAt", "view", "hiddenTiers", "key", "hiddenHere", "hiddenBelow", "index", "toggle", "hide", "value", "mark", "scope", "selfAndAll", "carries", "tiers", "here", "partly", "toggleClass", "children", "drawer", "tool", "all", "icon", "unmark", "removeClass", "dropEmptyClass", "GridEditor", "ge", "visibilityPart"]
|
|
7
|
-
}
|