@themarioga/grid-editor 7.2.0 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/README.md +83 -14
- package/UPGRADING.md +31 -0
- package/dist/grideditor.bundle.min.js +2 -2
- package/dist/grideditor.css +102 -0
- package/dist/grideditor.d.ts +18 -0
- package/dist/grideditor.esm.js +291 -31
- package/dist/grideditor.js +291 -31
- package/dist/grideditor.min.css +1 -1
- package/dist/grideditor.min.css.map +1 -1
- package/dist/grideditor.min.js +1 -1
- package/dist/grideditor.min.js.map +3 -3
- package/dist/locales/grideditor.es.esm.js +67 -0
- package/dist/locales/grideditor.es.js +67 -0
- package/dist/locales/grideditor.es.min.js +1 -1
- package/dist/locales/grideditor.es.min.js.map +2 -2
- package/dist/plugins/grideditor.float.esm.js +10 -1
- package/dist/plugins/grideditor.float.js +8 -2
- package/dist/plugins/grideditor.float.min.js +1 -1
- package/dist/plugins/grideditor.float.min.js.map +4 -4
- package/dist/plugins/grideditor.spacing.esm.js +12 -3
- package/dist/plugins/grideditor.spacing.js +9 -3
- package/dist/plugins/grideditor.spacing.min.js +1 -1
- package/dist/plugins/grideditor.spacing.min.js.map +4 -4
- package/dist/plugins/grideditor.style.esm.js +1593 -0
- package/dist/plugins/grideditor.style.js +1592 -0
- package/dist/plugins/grideditor.style.min.js +2 -0
- package/dist/plugins/grideditor.style.min.js.map +7 -0
- package/dist/plugins/grideditor.textalign.esm.js +10 -1
- package/dist/plugins/grideditor.textalign.js +8 -2
- package/dist/plugins/grideditor.textalign.min.js +1 -1
- package/dist/plugins/grideditor.textalign.min.js.map +4 -4
- package/dist/plugins/grideditor.visibility.esm.js +12 -3
- package/dist/plugins/grideditor.visibility.js +9 -3
- package/dist/plugins/grideditor.visibility.min.js +1 -1
- package/dist/plugins/grideditor.visibility.min.js.map +4 -4
- package/docs/locale-keys.md +86 -7
- package/docs/plugins.md +49 -5
- package/example/index.html +14 -0
- package/example/style.html +151 -0
- package/example/utilities.html +15 -11
- package/package.json +1 -1
- package/src/js/grideditor.js +365 -27
- package/src/js/locales/grideditor.es.js +67 -0
- package/src/js/plugins/grideditor.float.js +8 -33
- package/src/js/plugins/grideditor.spacing.js +8 -273
- package/src/js/plugins/grideditor.style.js +179 -0
- package/src/js/plugins/grideditor.textalign.js +8 -39
- package/src/js/plugins/grideditor.visibility.js +8 -147
- package/src/js/style/accordion.js +157 -0
- package/src/js/style/catalog.js +76 -0
- package/src/js/style/custom.js +84 -0
- package/src/js/style/fields.js +382 -0
- package/src/js/style/float.js +46 -0
- package/src/js/style/options.js +75 -0
- package/src/js/style/sections.js +271 -0
- package/src/js/style/spacing.js +286 -0
- package/src/js/style/textalign.js +52 -0
- package/src/js/style/visibility.js +160 -0
- package/src/less/grideditor.less +111 -0
- package/types/grideditor.d.ts +18 -0
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
return node;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
// src/js/
|
|
59
|
+
// src/js/style/visibility.js
|
|
60
60
|
Object.assign(GridEditor.locales.en, {
|
|
61
61
|
"utility.visibility": "Visibility",
|
|
62
62
|
"utility.visibility_hidden": "Hidden",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
});
|
|
68
68
|
var CLASS_PATTERN = /(?:^|\s)d-(?:(?:sm|md|lg|xl|xxl)-)?(?:none|block|flex)(?:\s|$)/;
|
|
69
69
|
var NODES = ".row, .column, .ge-content, .ge-element, [data-ge-container]";
|
|
70
|
-
|
|
71
|
-
var options = Object.assign({ drawer: true },
|
|
70
|
+
function visibilityPart(ge, given) {
|
|
71
|
+
var options = Object.assign({ drawer: true }, given);
|
|
72
72
|
function shown(kind) {
|
|
73
73
|
return kind === "row" ? "flex" : "block";
|
|
74
74
|
}
|
|
@@ -159,5 +159,11 @@
|
|
|
159
159
|
onRefresh: mark,
|
|
160
160
|
onDeinit: unmark
|
|
161
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);
|
|
162
168
|
};
|
|
163
169
|
})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var
|
|
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 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/js/register.js", "../../src/js/dom.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 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 */\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\nGridEditor.utilities.visibility = function(ge) {\n\n var options = Object.assign({ drawer: true }, ge.settings.utilities.visibility);\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"],
|
|
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,OAAAC,EAAMD,CAAK,EAAE,QAAQ,SAASE,EAAM,CAAEH,EAAK,UAAU,OAAOG,CAAI,CAAG,CAAC,EAC7DH,CACX,CAGO,SAASI,EAAYJ,EAAMC,EAAOI,EAAO,CAC5C,OAAAH,EAAMD,CAAK,EAAE,QAAQ,SAASE,EAAM,CAC5BE,IAAU,OACVL,EAAK,UAAU,OAAOG,CAAI,EAE1BH,EAAK,UAAU,OAAOG,EAAM,CAAC,CAACE,CAAK,CAE3C,CAAC,EACML,CACX,CAMA,SAASM,EAAMC,EAAO,CAClB,OAAO,OAAOA,GAAS,EAAE,EAAE,MAAM,KAAK,EAAE,OAAO,OAAO,CAC1D,CAGO,SAASC,EAAeC,EAAM,CACjC,OAAKA,EAAK,aAAa,OAAO,GAAKA,EAAK,gBAAgB,OAAO,EACxDA,CACX,
|
|
6
|
-
"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", "ge", "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"]
|
|
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": "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",
|
|
6
|
+
"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
7
|
}
|
package/docs/locale-keys.md
CHANGED
|
@@ -221,8 +221,11 @@ key, so a locale covers a new breakpoint by adding `view.<key>`. Short strings
|
|
|
221
221
|
utility.*
|
|
222
222
|
---------
|
|
223
223
|
|
|
224
|
-
The Responsive section of a settings panel, which the utility plugins fill
|
|
225
|
-
|
|
224
|
+
The Responsive section of a settings panel, which the utility plugins fill,
|
|
225
|
+
and the per breakpoint fields of the style plugin's sections. The labels of
|
|
226
|
+
each utility and its values are the plugins' own keys. The spacing,
|
|
227
|
+
textalign, visibility and float fields were plugins of their own up to 7.2,
|
|
228
|
+
and are the style plugin's now.
|
|
226
229
|
|
|
227
230
|
| Key | English | Where |
|
|
228
231
|
| --- | --- | --- |
|
|
@@ -235,10 +238,10 @@ The labels of each utility and its values are the plugins' own keys.
|
|
|
235
238
|
| `utility.default` | Default | The empty choice of a field when nothing below the view sets the utility, and always in the all view |
|
|
236
239
|
| `utility.inherit` | Inherit: {value} (from {breakpoint}) | The empty choice in a breakpoint view when a smaller breakpoint sets the utility. `{breakpoint}` is its key, `sm` |
|
|
237
240
|
| `utility.varies` | Changes at {breakpoints}; choosing here replaces that | Note under a field in the all view when breakpoints set their own value. `{breakpoints}` is a list of keys |
|
|
238
|
-
| `utility.visibility` | Visibility | Label of the visibility plugin's
|
|
241
|
+
| `utility.visibility` | Visibility | Label of the visibility field, in the style plugin's Display section |
|
|
239
242
|
| `utility.visibility_hidden` | Hidden | Its choice for `d-*-none` |
|
|
240
243
|
| `utility.visibility_shown` | Shown | Its choice for `d-*-block`, or `d-*-flex` on a row |
|
|
241
|
-
| `tool.hide_in_view` | Hide in this view | The
|
|
244
|
+
| `tool.hide_in_view` | Hide in this view | The style plugin's visibility eye, on a node shown in the view being edited |
|
|
242
245
|
| `tool.show_in_view` | Show in this view | The same eye, on a node hidden there |
|
|
243
246
|
| `utility.order` | Order | Label of the order plugin's field |
|
|
244
247
|
| `utility.order_first` | First | Its choice for `order-*-first` |
|
|
@@ -251,7 +254,7 @@ The labels of each utility and its values are the plugins' own keys.
|
|
|
251
254
|
| `utility.gutters` | Gutters | The gutters plugin's `g-*` field, on a row |
|
|
252
255
|
| `utility.gutters_x` | Horizontal gutters | Its `gx-*` field |
|
|
253
256
|
| `utility.gutters_y` | Vertical gutters | Its `gy-*` field |
|
|
254
|
-
| `utility.padding` | Padding | The
|
|
257
|
+
| `utility.padding` | Padding | The padding group, in the style plugin's Spacing section |
|
|
255
258
|
| `utility.margin` | Margin | Its margin group |
|
|
256
259
|
| `utility.side_all` | All sides | The side of `p-*` and `m-*` in a group's side choice |
|
|
257
260
|
| `utility.side_x` | Left and right | The side of `px-*` and `mx-*` |
|
|
@@ -260,17 +263,93 @@ The labels of each utility and its values are the plugins' own keys.
|
|
|
260
263
|
| `utility.side_b` | Bottom | The side of `pb-*` and `mb-*` |
|
|
261
264
|
| `utility.side_s` | Start | The side of `ps-*` and `ms-*` |
|
|
262
265
|
| `utility.side_e` | End | The side of `pe-*` and `me-*` |
|
|
263
|
-
| `utility.text_align` | Text alignment | Label of the
|
|
266
|
+
| `utility.text_align` | Text alignment | Label of the text alignment field, in the style plugin's Text section |
|
|
264
267
|
| `utility.text_start` | Start | Its choice for `text-*-start` |
|
|
265
268
|
| `utility.text_center` | Center | Its choice for `text-*-center` |
|
|
266
269
|
| `utility.text_end` | End | Its choice for `text-*-end` |
|
|
267
|
-
| `utility.float` | Float | Label of the float plugin's
|
|
270
|
+
| `utility.float` | Float | Label of the float field, in the style plugin's Position section, on an element |
|
|
268
271
|
| `utility.float_start` | Start | Its choice for `float-*-start` |
|
|
269
272
|
| `utility.float_end` | End | Its choice for `float-*-end` |
|
|
270
273
|
| `utility.float_none` | None | Its choice for `float-*-none` |
|
|
271
274
|
| `utility.spacing_gutter` | A column's side padding is its gutter: changing it changes the gutter | Note in a column's spacing group while it carries side padding |
|
|
272
275
|
|
|
273
276
|
|
|
277
|
+
style.*
|
|
278
|
+
-------
|
|
279
|
+
|
|
280
|
+
The style plugin's accordion, in a node's settings panel or in the dialog.
|
|
281
|
+
|
|
282
|
+
| Key | English | Where |
|
|
283
|
+
| --- | --- | --- |
|
|
284
|
+
| `style.section_title` | Style | The style plugin's accordion, and the button that opens it in the dialog when `settings_panel` is `popover` or `inline` |
|
|
285
|
+
| `style.dialog_title` | Style: {kind} | Title of that dialog. `{kind}` is what the panel's title calls the node |
|
|
286
|
+
| `style.section_size` | Size | The accordion's section header |
|
|
287
|
+
| `style.section_spacing` | Spacing | The accordion's section header |
|
|
288
|
+
| `style.section_border` | Border | The accordion's section header |
|
|
289
|
+
| `style.section_background` | Background | The accordion's section header |
|
|
290
|
+
| `style.section_text` | Text | The accordion's section header |
|
|
291
|
+
| `style.section_typography` | Typography | The accordion's section header |
|
|
292
|
+
| `style.section_display` | Display | The accordion's section header |
|
|
293
|
+
| `style.section_position` | Position | The accordion's section header |
|
|
294
|
+
| `style.section_custom` | Custom css | The accordion's section header |
|
|
295
|
+
| `style.all_sizes` | Applies to every size | Note over a section's inline fields in a breakpoint view: the style attribute is not responsive |
|
|
296
|
+
| `style.overridden` | The class {class} takes priority over this value | Note under an inline field whose property a Bootstrap utility on the node also sets. `{class}` is that class |
|
|
297
|
+
| `style.invalid` | Not a value this property takes | Tooltip of an inline field holding a value the browser refused |
|
|
298
|
+
| `style.catalog` | Bootstrap classes | Heading of a section's Bootstrap class chips |
|
|
299
|
+
| `style.shadow_x` | X | A part of the shadow builder |
|
|
300
|
+
| `style.shadow_y` | Y | A part of the shadow builder |
|
|
301
|
+
| `style.shadow_blur` | Blur | A part of the shadow builder |
|
|
302
|
+
| `style.shadow_spread` | Spread | A part of the shadow builder |
|
|
303
|
+
| `style.shadow_color` | Color | A part of the shadow builder |
|
|
304
|
+
| `style.shadow_inset` | Inset | The shadow builder's inset checkbox |
|
|
305
|
+
| `style.shadow_text_mode` | Edit as text | Link under the shadow builder that edits the value as text |
|
|
306
|
+
| `style.prop_width` | Width | Label of the `width` field |
|
|
307
|
+
| `style.prop_height` | Height | Label of the `height` field |
|
|
308
|
+
| `style.prop_min_width` | Min width | Label of the `min-width` field |
|
|
309
|
+
| `style.prop_min_height` | Min height | Label of the `min-height` field |
|
|
310
|
+
| `style.prop_max_width` | Max width | Label of the `max-width` field |
|
|
311
|
+
| `style.prop_max_height` | Max height | Label of the `max-height` field |
|
|
312
|
+
| `style.prop_margin_top` | Margin top | Label of the `margin-top` field |
|
|
313
|
+
| `style.prop_margin_right` | Margin right | Label of the `margin-right` field |
|
|
314
|
+
| `style.prop_margin_bottom` | Margin bottom | Label of the `margin-bottom` field |
|
|
315
|
+
| `style.prop_margin_left` | Margin left | Label of the `margin-left` field |
|
|
316
|
+
| `style.prop_padding_top` | Padding top | Label of the `padding-top` field |
|
|
317
|
+
| `style.prop_padding_right` | Padding right | Label of the `padding-right` field |
|
|
318
|
+
| `style.prop_padding_bottom` | Padding bottom | Label of the `padding-bottom` field |
|
|
319
|
+
| `style.prop_padding_left` | Padding left | Label of the `padding-left` field |
|
|
320
|
+
| `style.prop_border_width` | Border width | Label of the `border-width` field |
|
|
321
|
+
| `style.prop_border_style` | Border style | Label of the `border-style` field |
|
|
322
|
+
| `style.prop_border_color` | Border color | Label of the `border-color` field |
|
|
323
|
+
| `style.prop_border_radius` | Border radius | Label of the `border-radius` field |
|
|
324
|
+
| `style.prop_box_shadow` | Shadow | Label of the `box-shadow` field |
|
|
325
|
+
| `style.prop_background_color` | Background color | Label of the `background-color` field |
|
|
326
|
+
| `style.prop_background_image` | Background image | Label of the `background-image` field |
|
|
327
|
+
| `style.prop_background_size` | Background size | Label of the `background-size` field |
|
|
328
|
+
| `style.prop_background_position` | Background position | Label of the `background-position` field |
|
|
329
|
+
| `style.prop_background_repeat` | Background repeat | Label of the `background-repeat` field |
|
|
330
|
+
| `style.prop_color` | Color | Label of the `color` field |
|
|
331
|
+
| `style.prop_font_size` | Font size | Label of the `font-size` field |
|
|
332
|
+
| `style.prop_text_align` | Text align | Label of the `text-align` field |
|
|
333
|
+
| `style.prop_text_shadow` | Text shadow | Label of the `text-shadow` field |
|
|
334
|
+
| `style.prop_font_family` | Font family | Label of the `font-family` field |
|
|
335
|
+
| `style.prop_font_weight` | Font weight | Label of the `font-weight` field |
|
|
336
|
+
| `style.prop_font_style` | Font style | Label of the `font-style` field |
|
|
337
|
+
| `style.prop_line_height` | Line height | Label of the `line-height` field |
|
|
338
|
+
| `style.prop_letter_spacing` | Letter spacing | Label of the `letter-spacing` field |
|
|
339
|
+
| `style.prop_text_transform` | Text transform | Label of the `text-transform` field |
|
|
340
|
+
| `style.prop_text_decoration` | Text decoration | Label of the `text-decoration` field |
|
|
341
|
+
| `style.prop_display` | Display | Label of the `display` field |
|
|
342
|
+
| `style.prop_opacity` | Opacity | Label of the `opacity` field |
|
|
343
|
+
| `style.prop_overflow` | Overflow | Label of the `overflow` field |
|
|
344
|
+
| `style.prop_visibility` | Visibility | Label of the `visibility` field |
|
|
345
|
+
| `style.prop_position` | Position | Label of the `position` field |
|
|
346
|
+
| `style.prop_top` | Top | Label of the `top` field |
|
|
347
|
+
| `style.prop_right` | Right | Label of the `right` field |
|
|
348
|
+
| `style.prop_bottom` | Bottom | Label of the `bottom` field |
|
|
349
|
+
| `style.prop_left` | Left | Label of the `left` field |
|
|
350
|
+
| `style.prop_z_index` | Z-index | Label of the `z-index` field |
|
|
351
|
+
|
|
352
|
+
|
|
274
353
|
badge.*
|
|
275
354
|
-------
|
|
276
355
|
|
package/docs/plugins.md
CHANGED
|
@@ -160,6 +160,9 @@ array.
|
|
|
160
160
|
| `ge.nodeHtml(node)` | One node's markup as `getHtml` would give it. The canvas leaves editing to read it and comes back, as it does for `getHtml` |
|
|
161
161
|
| `ge.toolbarItems(name)` | An array of the toolbar buttons the feature plugin `name` declared, for showing and hiding them |
|
|
162
162
|
| `ge.bareStyle(node, family, property)` | A css property's value on the node with none of the family's classes: what a preview shows when no class applies and that is not a constant |
|
|
163
|
+
| `ge.hostStyle(node, property?)` | `{ value, priority }` of one property of the node's own style, as the host wrote it: never a breakpoint preview's. With no property, the whole of it as css text |
|
|
164
|
+
| `ge.setHostStyle(node, property, value, priority?)` | Write one property of the node's own style, or take it off with `''`. Under a breakpoint preview it is the host's value that changes, and the preview goes back on top. False, and nothing written, for a value the browser refuses. A priority left out keeps the one the property had; no `style=""` is left behind |
|
|
165
|
+
| `ge.openDialog(title, body, opener?)` / `ge.closeDialog()` | A modal of the editor's own, over whatever settings panel is open, which stays open under it. `body` is moved in, and back where it was when the dialog closes; `opener` has the focus back. Bootstrap's modal when Bootstrap's javascript is there, one of the editor's own when it is not. Escape closes the dialog and nothing else; `deinit`, `getHtml`, `setLocale`, `destroy` and closing the panel close it |
|
|
163
166
|
|
|
164
167
|
The add, delete and move events for a container and its panes are fired by the
|
|
165
168
|
editor, not by the plugin: `createPaneControls` handles a pane's delete, and
|
|
@@ -192,6 +195,7 @@ GridEditor.features.elements = function(ge) {
|
|
|
192
195
|
accepts: function(region, node) { … }, // false turns a block away from a region
|
|
193
196
|
toolbar: [{ labelKey: …, kind: …, create: function() { … } }], // buttons beside the containers'
|
|
194
197
|
drawerTools: function(drawer, node, kind) { … }, // tools beside the gear, in every drawer
|
|
198
|
+
panelSection: function(node, kind) { … }, // a section of the node's settings panel, see below
|
|
195
199
|
};
|
|
196
200
|
};
|
|
197
201
|
```
|
|
@@ -224,6 +228,43 @@ needs to put a new kind of block on the canvas:
|
|
|
224
228
|
child: it sits beside it, in a wrapper that only exists while editing, so
|
|
225
229
|
`ge.drawerOf(node)` is how to find it.
|
|
226
230
|
|
|
231
|
+
### A section of the settings panel
|
|
232
|
+
|
|
233
|
+
**`panelSection(node, kind)`**, which any kind of plugin can have, returns a
|
|
234
|
+
section for the node's settings panel - `{ labelKey, titleKey, body }` - or
|
|
235
|
+
null where it has none. The editor puts the sections between the panel's
|
|
236
|
+
general fields and *Responsive*, in the order the plugins were registered.
|
|
237
|
+
Where the panel has room for it, in the offcanvas and the modal, `body` is in
|
|
238
|
+
the panel. A popover, or a panel inline in the drawer, gets a button with the
|
|
239
|
+
label instead, and `body` opens in the dialog, titled `titleKey` - with the
|
|
240
|
+
node's kind as `{kind}` - or the label. `body` stays the panel's either way,
|
|
241
|
+
so `ge.detailsOf(node)` finds what is in it.
|
|
242
|
+
|
|
243
|
+
A field made with `ge.utilityField` in a section follows the view and the
|
|
244
|
+
classes field as the Responsive section's do, wherever the section is at the
|
|
245
|
+
time. The style plugin's accordion is a section, and what the spacing,
|
|
246
|
+
textalign, visibility and float fields are in: its families are
|
|
247
|
+
`panel: false`, and it makes their fields itself.
|
|
248
|
+
|
|
249
|
+
A section that writes css should write it with `ge.setHostStyle` and read it
|
|
250
|
+
with `ge.hostStyle`: in a breakpoint view the node's `style` holds the
|
|
251
|
+
preview's `!important` values too, and they come off on `deinit` with
|
|
252
|
+
whatever was written under them.
|
|
253
|
+
|
|
254
|
+
### A plugin that takes the place of others
|
|
255
|
+
|
|
256
|
+
A factory with **`replaces: ['old', …]`** on it - the function, not what it
|
|
257
|
+
returns, since it is read before any factory is called - stands in for those
|
|
258
|
+
plugins. Loaded beside it, they stand down, with a warning, and none of their
|
|
259
|
+
families is declared twice; an old name in the `plugins` setting asks for it,
|
|
260
|
+
with a warning that the name is deprecated. This is how the style plugin
|
|
261
|
+
takes the spacing, textalign, visibility and float plugins' place:
|
|
262
|
+
|
|
263
|
+
```javascript
|
|
264
|
+
GridEditor.utilities.style = function(ge) { … };
|
|
265
|
+
GridEditor.utilities.style.replaces = ['spacing', 'textalign', 'visibility', 'float'];
|
|
266
|
+
```
|
|
267
|
+
|
|
227
268
|
### Settings of your own, saved on the node
|
|
228
269
|
|
|
229
270
|
A tool that opens a dialog and saves what the user chose on the node is a
|
|
@@ -477,19 +518,20 @@ tool does not belong. A tool writes with `ge.setUtility(node, family, value,
|
|
|
477
518
|
`onRefresh(scope)` runs whenever the preview is redrawn — on `init`, on a view
|
|
478
519
|
change, after a write, after the user types in a classes field — with the node
|
|
479
520
|
whose utilities changed, or the canvas. It is for what a plugin marks the canvas
|
|
480
|
-
with beyond inline styles: the
|
|
521
|
+
with beyond inline styles: the style plugin's visibility keeps hidden nodes on the
|
|
481
522
|
canvas and fades them there. Whatever it adds, `onDeinit` takes away.
|
|
482
523
|
|
|
483
524
|
### A panel of your own
|
|
484
525
|
|
|
485
526
|
A field per family is the right panel for most plugins and the wrong one for
|
|
486
|
-
some: spacing has fourteen families, and fourteen
|
|
527
|
+
some: spacing, part of the style plugin, has fourteen families, and fourteen
|
|
528
|
+
fields. Such a plugin marks
|
|
487
529
|
its families `panel: false` and returns its own element from
|
|
488
530
|
`panel(node, kind)` — or null where it does not apply — and the editor puts it
|
|
489
531
|
in the Responsive section. Inside it, `ge.utilityField(node, family)` makes the
|
|
490
532
|
same field the editor would, and the editor keeps every such field up to date
|
|
491
533
|
with the view and the classes; swapping one field for another is the plugin's
|
|
492
|
-
business. The spacing
|
|
534
|
+
business. The spacing panel is a side and one field, and choosing a
|
|
493
535
|
side swaps the field for that side's family.
|
|
494
536
|
|
|
495
537
|
The same plugins tend to need the node as a whole for the preview, because
|
|
@@ -509,6 +551,8 @@ Two plugins cannot declare the same family name: the second one is ignored,
|
|
|
509
551
|
with a warning.
|
|
510
552
|
|
|
511
553
|
Plugin options live in the `utilities` setting, under the plugin's name:
|
|
512
|
-
`utilities: {
|
|
513
|
-
setting through as it is; each plugin fills in its own defaults.
|
|
554
|
+
`utilities: { gutters: { scale: [...] } }`. The editor passes the
|
|
555
|
+
setting through as it is; each plugin fills in its own defaults. The style
|
|
556
|
+
plugin's are the `style` setting, since most of them are about its inline
|
|
557
|
+
css; `utilities.spacing` and `utilities.visibility` are read there until 8.0.
|
|
514
558
|
|
package/example/index.html
CHANGED
|
@@ -48,6 +48,12 @@
|
|
|
48
48
|
gutters and spacing — per breakpoint. See
|
|
49
49
|
<a href="utilities.html">Responsive utilities</a>.
|
|
50
50
|
</p>
|
|
51
|
+
<p class="text-body-secondary">
|
|
52
|
+
New in 7.3: the style plugin, inline css by section with
|
|
53
|
+
Bootstrap's classes as chips, which also carries visibility,
|
|
54
|
+
spacing, text alignment and float. See
|
|
55
|
+
<a href="style.html">Style</a>.
|
|
56
|
+
</p>
|
|
51
57
|
|
|
52
58
|
<div class="list-group my-4">
|
|
53
59
|
|
|
@@ -131,6 +137,14 @@
|
|
|
131
137
|
<span class="text-body-secondary">Bootstrap's utility classes edited per breakpoint: visibility, column order, alignment, gutters, spacing, text alignment and float</span>
|
|
132
138
|
</a>
|
|
133
139
|
|
|
140
|
+
<a class="list-group-item list-group-item-action" href="style.html">
|
|
141
|
+
<div class="d-flex justify-content-between">
|
|
142
|
+
<strong>Style</strong>
|
|
143
|
+
<code class="text-body-secondary">style.html</code>
|
|
144
|
+
</div>
|
|
145
|
+
<span class="text-body-secondary">The style plugin: inline css for rows, columns, containers and elements, by section, with Bootstrap's classes for each as chips</span>
|
|
146
|
+
</a>
|
|
147
|
+
|
|
134
148
|
<a class="list-group-item list-group-item-action" href="locale.html">
|
|
135
149
|
<div class="d-flex justify-content-between">
|
|
136
150
|
<strong>Languages</strong>
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
5
|
+
|
|
6
|
+
<!-- CSS dependencies -->
|
|
7
|
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
|
|
8
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.css">
|
|
9
|
+
|
|
10
|
+
<!-- Javascript dependencies -->
|
|
11
|
+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js" integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI" crossorigin="anonymous"></script>
|
|
12
|
+
|
|
13
|
+
<!-- Grid editor CSS -->
|
|
14
|
+
<link rel="stylesheet" type="text/css" href="../dist/grideditor.css" />
|
|
15
|
+
|
|
16
|
+
<!-- The editor, the elements and tabs plugins so there is one of each
|
|
17
|
+
kind of node, and the style plugin. -->
|
|
18
|
+
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.6/Sortable.min.js"></script>
|
|
19
|
+
<script src="../dist/grideditor.min.js"></script>
|
|
20
|
+
<script src="../dist/plugins/grideditor.elements.min.js"></script>
|
|
21
|
+
<script src="../dist/plugins/grideditor.tabs.min.js"></script>
|
|
22
|
+
<script src="../dist/plugins/grideditor.style.min.js"></script>
|
|
23
|
+
|
|
24
|
+
<script>
|
|
25
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
26
|
+
var grid = document.getElementById('myGrid');
|
|
27
|
+
var panel = document.getElementById('panel');
|
|
28
|
+
var narrow = document.getElementById('narrow');
|
|
29
|
+
var editor;
|
|
30
|
+
|
|
31
|
+
function start() {
|
|
32
|
+
editor = new GridEditor(grid, {
|
|
33
|
+
new_row_layouts: [[12], [6,6], [4,4,4], [8,4]],
|
|
34
|
+
content_types: [],
|
|
35
|
+
|
|
36
|
+
// Where a node's settings open. In a popover, or inline
|
|
37
|
+
// in the drawer, the Style accordion opens in a dialog
|
|
38
|
+
settings_panel: panel.value,
|
|
39
|
+
|
|
40
|
+
// Every section, unless the host says otherwise: this
|
|
41
|
+
// leaves out position and keeps the border section to
|
|
42
|
+
// three fields with no chips
|
|
43
|
+
style: narrow.checked ? {
|
|
44
|
+
sections: {
|
|
45
|
+
position: false,
|
|
46
|
+
border: { properties: ['border-width', 'border-style', 'border-color'], catalog: false },
|
|
47
|
+
},
|
|
48
|
+
} : {},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
start();
|
|
52
|
+
|
|
53
|
+
// The same canvas, started again with the other settings
|
|
54
|
+
function restart() {
|
|
55
|
+
var html = editor.getHtml();
|
|
56
|
+
editor.destroy();
|
|
57
|
+
grid.innerHTML = html;
|
|
58
|
+
start();
|
|
59
|
+
}
|
|
60
|
+
panel.addEventListener('change', restart);
|
|
61
|
+
narrow.addEventListener('change', restart);
|
|
62
|
+
|
|
63
|
+
document.getElementById('output').addEventListener('click', function() {
|
|
64
|
+
document.getElementById('html').textContent = editor.getHtml();
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<title>Grid Editor style example</title>
|
|
70
|
+
</head>
|
|
71
|
+
<body>
|
|
72
|
+
<!-- Back to the demo index -->
|
|
73
|
+
<div class="container pt-3">
|
|
74
|
+
<a class="link-secondary" href="index.html"><i class="bi bi-arrow-left"></i> All demos</a>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<div class="container">
|
|
78
|
+
|
|
79
|
+
<div class="row my-3">
|
|
80
|
+
<div class="col-lg-8">
|
|
81
|
+
<h1 class="h4">Style</h1>
|
|
82
|
+
<p class="form-text">
|
|
83
|
+
The gear of a row, a column, a container, a tab, an element
|
|
84
|
+
or a section has a <strong>Style</strong> accordion: size,
|
|
85
|
+
spacing, border, background, text, typography, display,
|
|
86
|
+
position and free css. What you type is written to the
|
|
87
|
+
node's own <code>style</code>; a value the browser does
|
|
88
|
+
not take is marked and not written.
|
|
89
|
+
</p>
|
|
90
|
+
<p class="form-text">
|
|
91
|
+
Each section also offers Bootstrap's classes for what it
|
|
92
|
+
styles, as chips: one puts its class in the classes field,
|
|
93
|
+
and pressing it again takes it off. Bootstrap's utilities
|
|
94
|
+
are <code>!important</code>, so a field whose property a
|
|
95
|
+
class on the node also sets says the class wins.
|
|
96
|
+
</p>
|
|
97
|
+
<p class="form-text">
|
|
98
|
+
The inline style is the same at every size. Padding and
|
|
99
|
+
margin, text alignment, visibility and float are
|
|
100
|
+
Bootstrap's responsive classes, edited per breakpoint in
|
|
101
|
+
their sections: pick a breakpoint in the dropdown.
|
|
102
|
+
</p>
|
|
103
|
+
<div class="d-flex flex-wrap align-items-center gap-3 mb-3">
|
|
104
|
+
<div class="d-flex align-items-center gap-2">
|
|
105
|
+
<label class="form-label mb-0" for="panel">A gear opens its settings in</label>
|
|
106
|
+
<select class="form-select form-select-sm w-auto" id="panel">
|
|
107
|
+
<option value="offcanvas">a side panel (offcanvas)</option>
|
|
108
|
+
<option value="popover">a popover</option>
|
|
109
|
+
<option value="modal">a modal</option>
|
|
110
|
+
<option value="inline">the drawer itself (inline)</option>
|
|
111
|
+
</select>
|
|
112
|
+
</div>
|
|
113
|
+
<div class="form-check mb-0">
|
|
114
|
+
<input class="form-check-input" type="checkbox" id="narrow">
|
|
115
|
+
<label class="form-check-label" for="narrow">Fewer sections: no position, a shorter border</label>
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
<button class="btn btn-sm btn-secondary" id="output" type="button">Show the html this produces</button>
|
|
119
|
+
<pre id="html" class="form-text"></pre>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
<div id="myGrid">
|
|
124
|
+
|
|
125
|
+
<div class="row" style="background-color: #f0f4ff; border-radius: 12px;">
|
|
126
|
+
<div class="col-12 col-md-8" style="padding-top: 1rem; padding-bottom: 1rem;">
|
|
127
|
+
<h2 class="h5">Styled inline</h2>
|
|
128
|
+
<p>This row has a background and a radius in its <code>style</code>; open its gear and look in Background and Border.</p>
|
|
129
|
+
</div>
|
|
130
|
+
<div class="col-12 col-md-4 shadow-sm rounded-3" style="box-shadow: 0 4px 12px rgba(0, 0, 0, .15)">
|
|
131
|
+
<h2 class="h5">A class and a style</h2>
|
|
132
|
+
<p>It has <code>shadow-sm</code> and an inline shadow: the class wins, and the Border section says so.</p>
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
|
|
136
|
+
<div class="row my-3">
|
|
137
|
+
<div class="col-6">
|
|
138
|
+
<div data-ge-element="callout" data-ge-label="Callout" class="p-3 border-start border-4 bg-body-tertiary" style="font-style: italic; letter-spacing: .02em">
|
|
139
|
+
An element, with a few classes from the catalog and some typography of its own.
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
<div class="col-6">
|
|
143
|
+
<p>Try Size on this column: it offers only the min- and max- widths and heights, since its width is the grid's.</p>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
|
|
147
|
+
</div> <!-- /#myGrid -->
|
|
148
|
+
</div> <!-- /.container -->
|
|
149
|
+
|
|
150
|
+
</body>
|
|
151
|
+
</html>
|