@themarioga/grid-editor 9.2.6 → 9.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +68 -5
  3. package/dist/grideditor.bundle.min.js +2 -2
  4. package/dist/grideditor.css +267 -0
  5. package/dist/grideditor.d.ts +88 -0
  6. package/dist/grideditor.esm.js +27 -5
  7. package/dist/grideditor.js +27 -5
  8. package/dist/grideditor.min.css +1 -1
  9. package/dist/grideditor.min.css.map +1 -1
  10. package/dist/grideditor.min.js +1 -1
  11. package/dist/grideditor.min.js.map +3 -3
  12. package/dist/locales/grideditor.es.esm.js +102 -0
  13. package/dist/locales/grideditor.es.js +102 -0
  14. package/dist/locales/grideditor.es.min.js +1 -1
  15. package/dist/locales/grideditor.es.min.js.map +2 -2
  16. package/dist/plugins/grideditor.navbar.esm.js +2084 -0
  17. package/dist/plugins/grideditor.navbar.js +2085 -0
  18. package/dist/plugins/grideditor.navbar.min.js +1 -0
  19. package/dist/plugins/grideditor.navbar.min.js.map +7 -0
  20. package/dist/plugins/grideditor.sidenav.esm.js +1978 -0
  21. package/dist/plugins/grideditor.sidenav.js +1979 -0
  22. package/dist/plugins/grideditor.sidenav.min.js +1 -0
  23. package/dist/plugins/grideditor.sidenav.min.js.map +7 -0
  24. package/docs/events.md +5 -1
  25. package/docs/locale-keys.md +103 -1
  26. package/docs/plugins.md +23 -4
  27. package/example/containers.html +59 -2
  28. package/example/index.html +1 -1
  29. package/example/playground.html +2 -0
  30. package/package.json +1 -1
  31. package/src/js/grideditor.js +36 -4
  32. package/src/js/locales/grideditor.es.js +102 -0
  33. package/src/js/nav/browse.js +51 -0
  34. package/src/js/nav/canvas.js +170 -0
  35. package/src/js/nav/convert.js +175 -0
  36. package/src/js/nav/drawers.js +258 -0
  37. package/src/js/nav/feature.js +94 -0
  38. package/src/js/nav/locale.js +128 -0
  39. package/src/js/nav/markup.js +121 -0
  40. package/src/js/nav/panels.js +443 -0
  41. package/src/js/nav/pieces.js +207 -0
  42. package/src/js/plugins/grideditor.navbar.js +454 -0
  43. package/src/js/plugins/grideditor.sidenav.js +349 -0
  44. package/src/less/grideditor.less +199 -0
  45. package/types/grideditor.d.ts +88 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,44 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
 
8
+ ## [Unreleased]
9
+
10
+
11
+ ## [9.3.0] - 2026-12-01
12
+
13
+ ### Added
14
+ - **Navbar** (`grideditor.navbar.js`) and **sidebar** (`grideditor.sidenav.js`)
15
+ container plugins. A navbar is Bootstrap 5.3's, with a brand, lists of
16
+ links, dropdowns, texts and free zones of rows and columns, that folds into
17
+ a collapse or an offcanvas, or not at all. A sidebar is the _Sidebars_
18
+ example, with collapsible submenus or dropdowns, that becomes an offcanvas
19
+ below a breakpoint. Every piece has a drawer, its text is edited where it
20
+ stands, and its options - the settings `navbar` and `sidenav`, and the
21
+ panel - include a `browse(done, { node, property, value })` for the host's
22
+ file browser. The plugin is called `sidenav` and the toolbar says _Sidebar_,
23
+ because the editor's `sidebar` setting is its own settings panel.
24
+ - The plugin hook `kindLabel(kind)`, for the title the settings panel gives a
25
+ kind a feature plugin made up.
26
+ - `ge.createPaneControls(…, options)`, with `options.presets` for the preset
27
+ classes of the pane's panel.
28
+
29
+ ### Changed
30
+ - The toolbar's container and row buttons, `ge.place` - `createContainer`,
31
+ `createRow`, `createSection`… with `appendTo` and the like - and the
32
+ clipboard's paste tool now ask a feature's `accepts(region, node)`, as a
33
+ drag, Ctrl+V and the buttons of a feature plugin already did. What the
34
+ toolbar was going to add to a region that will not have it goes to the
35
+ canvas, after the block the region is in. `ge.place` warns, adds nothing
36
+ and returns `null`: `createSection({ appendTo: <a column> })`, which left
37
+ the section in the column, no longer does.
38
+
39
+ ### Fixed
40
+ - `ge.makeLabelEditable` put a Bootstrap toggle back when the editing was
41
+ done even if it had been apart before, as an accordion item's button is:
42
+ renaming an item left its collapse working in the canvas. It now puts back
43
+ only what it took.
44
+
45
+
8
46
  ## [9.2.6] - 2026-11-22
9
47
 
10
48
  ### Fixed
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Grid Editor
2
2
  ===========
3
3
 
4
- Grid Editor is a visual javascript editor for the [bootstrap 5 grid system](https://getbootstrap.com/docs/5.3/layout/grid/), in plain DOM: no jQuery needed. You can create, drag, resize and delete rows and columns — sized in units, equal (`col`) or to their content (`col-auto`), or shared out by their row (`row-cols-*`) — indent them, group them in sections (`.container`), copy and paste them, and give each of bootstrap's six breakpoints its own layout — or edit them all at once, with a mouse or with a finger. Bootstrap's responsive utilities — display, flex, order, alignment, gutters, spacing, text alignment, sticky and float — are edited per breakpoint too, and any row, column, container or element can be given inline css, with Bootstrap's classes for it offered as chips. It also edits tabs, accordions, popups, offcanvases, carousels and cards, and any markup you mark as an element, and it tells your application about every change it makes.
4
+ Grid Editor is a visual javascript editor for the [bootstrap 5 grid system](https://getbootstrap.com/docs/5.3/layout/grid/), in plain DOM: no jQuery needed. You can create, drag, resize and delete rows and columns — sized in units, equal (`col`) or to their content (`col-auto`), or shared out by their row (`row-cols-*`) — indent them, group them in sections (`.container`), copy and paste them, and give each of bootstrap's six breakpoints its own layout — or edit them all at once, with a mouse or with a finger. Bootstrap's responsive utilities — display, flex, order, alignment, gutters, spacing, text alignment, sticky and float — are edited per breakpoint too, and any row, column, container or element can be given inline css, with Bootstrap's classes for it offered as chips. It also edits tabs, accordions, popups, offcanvases, carousels, cards, navbars and sidebars, and any markup you mark as an element, and it tells your application about every change it makes.
5
5
 
6
6
  This is a fork of [Friendly-Pixel/grid-editor](https://github.com/Friendly-Pixel/grid-editor)
7
7
  by Simon Epskamp, carrying it on from 2.x. It is published as
@@ -26,7 +26,7 @@ from any web server, or from GitHub Pages, with no build step.
26
26
  | [example/basic.html](example/basic.html) | The editor with tinyMCE in the content areas | [live](https://themarioga.github.io/grid-editor/example/basic.html) |
27
27
  | [example/columns.html](example/columns.html) | The six breakpoints and the "all sizes" view, equal and auto columns, columns per row, and sections | [live](https://themarioga.github.io/grid-editor/example/columns.html) |
28
28
  | [example/custom-plugins.html](example/custom-plugins.html) | Plugins of your own: a container, and a drawer tool with a modal that saves an attribute | [live](https://themarioga.github.io/grid-editor/example/custom-plugins.html) |
29
- | [example/containers.html](example/containers.html) | Tabs, accordions, popups, offcanvases, carousels and cards, two levels deep | [live](https://themarioga.github.io/grid-editor/example/containers.html) |
29
+ | [example/containers.html](example/containers.html) | Tabs, accordions, popups, offcanvases, carousels, cards, a navbar and a sidebar, two levels deep | [live](https://themarioga.github.io/grid-editor/example/containers.html) |
30
30
  | [example/elements.html](example/elements.html) | Element level controls, including an element with no visual output | [live](https://themarioga.github.io/grid-editor/example/elements.html) |
31
31
  | [example/style.html](example/style.html) | Inline style with Bootstrap's classes as chips, and the responsive utilities, edited per breakpoint | [live](https://themarioga.github.io/grid-editor/example/style.html) |
32
32
  | [example/locale.html](example/locale.html) | The interface in Spanish, with a language switcher | [live](https://themarioga.github.io/grid-editor/example/locale.html) |
@@ -189,7 +189,7 @@ has, with the options it was made with, and warns once.
189
189
  | `createSection` | `options?` | `Element` | A section, with the sections plugin. `options`: `width` (`'fixed'`, `'fluid'` or a breakpoint), `rows` (layouts), and a placement |
190
190
  | `createElement` | `content`, `options?` | `Element` | Host markup wrapped as an element. `options`: `type`, `label` |
191
191
  | `createText` | `type?`, `options?` | `Element` | A content area for a text editor, the first one offered by default. `options`: `content`, and a placement. `null` if the editor is not loaded, or no text editor is |
192
- | `createContainer` | `type`, `options?` | `Element` | `'tabs'`, `'accordion'`, `'popup'`, `'offcanvas'`, `'carousel'` or `'card'` |
192
+ | `createContainer` | `type`, `options?` | `Element` | `'tabs'`, `'accordion'`, `'popup'`, `'offcanvas'`, `'carousel'`, `'card'`, `'navbar'` or `'sidenav'` |
193
193
  | `addTab` | `container`, `options?` | `Element` | Appends a tab, returns its pane |
194
194
  | `addAccordionItem` | `container`, `options?` | `Element` | Appends an item, returns its body |
195
195
  | `addPane` | `container`, `options?` | `Element` | Appends a pane to a container of any type that has them - a tab, an item, a carousel slide, whose `options.interval` is its time in milliseconds - and returns it. `null`, and a warning, for a node that is not one |
@@ -1017,7 +1017,7 @@ The methods are there only when the plugin is loaded.
1017
1017
 
1018
1018
  ### Containers
1019
1019
 
1020
- Tabs, accordions, popups, offcanvases, carousels and cards. A tabs, accordion or
1020
+ Tabs, accordions, popups, offcanvases, carousels, cards, navbars and sidebars. A tabs, accordion or
1021
1021
  carousel container holds panes; a popup, an offcanvas and a card hold one region. Either way a region is an ordinary one: rows,
1022
1022
  columns, content areas and elements nest inside it exactly as they do at the
1023
1023
  top level.
@@ -1033,6 +1033,8 @@ it available:
1033
1033
  <script src="grid-editor/dist/plugins/grideditor.offcanvas.min.js"></script>
1034
1034
  <script src="grid-editor/dist/plugins/grideditor.carousel.min.js"></script>
1035
1035
  <script src="grid-editor/dist/plugins/grideditor.card.min.js"></script>
1036
+ <script src="grid-editor/dist/plugins/grideditor.navbar.min.js"></script>
1037
+ <script src="grid-editor/dist/plugins/grideditor.sidenav.min.js"></script>
1036
1038
  ```
1037
1039
 
1038
1040
  The toolbar offers a button per loaded plugin. See [docs/plugins.md](docs/plugins.md)
@@ -1114,7 +1116,68 @@ puts the attributes Bootstrap's javascript acts on aside, so an autoplay never
1114
1116
  starts over the canvas. Each slide's drawer moves it a place back or on. What
1115
1117
  `getHtml` gives starts at the first slide, whichever one the canvas was on.
1116
1118
 
1117
- See [example/containers.html](example/containers.html).
1119
+ A navbar and a sidebar are navigation, and are edited piece by piece: see
1120
+ [Navbars and sidebars](#navbars-and-sidebars) below. See
1121
+ [example/containers.html](example/containers.html).
1122
+
1123
+ #### Navbars and sidebars
1124
+
1125
+ `grideditor.navbar.js` is a Bootstrap 5.3 navbar - a brand, lists of links,
1126
+ dropdowns, texts, and _free zones_ that hold rows and columns - and
1127
+ `grideditor.sidenav.js` is a vertical one, as in Bootstrap's _Sidebars_
1128
+ example. The sidebar's plugin is `sidenav`, and its toolbar button says
1129
+ _Sidebar_: the editor's `sidebar` setting is its settings panel. Load both
1130
+ files from the same version of grid-editor.
1131
+
1132
+ Each piece - a list, a link, a dropdown or submenu, an item of a menu, a text,
1133
+ a free zone, the brand - has a drawer, and its text is renamed where it
1134
+ stands. Its options are in its settings panel, and the container's in a
1135
+ section of its own. Nothing of Bootstrap's javascript runs on the canvas while
1136
+ editing: the part that folds and the menus are shown open, each menu has a
1137
+ tool to fold it away, and a click on a link goes nowhere. With the preview
1138
+ button pressed the toggles and dropdowns work, and links still go nowhere.
1139
+ `getHtml` gives a navbar that works on the page with Bootstrap's javascript.
1140
+
1141
+ __`navbar`:__ The options of the navbars made new, as Bootstrap has them:
1142
+ `expand` (`false`, `true`, or the breakpoint - `'sm'` to `'xxl'` - from which
1143
+ it is expanded; `'lg'`), `collapse` (`'collapse'`, `'offcanvas'` or `false` for
1144
+ a navbar that does not fold; `'collapse'`), `offcanvas_placement` (`'start'` or
1145
+ `'end'`; `'end'`), `bg` (`'body-tertiary'`, `'primary'`, `'dark'`… or `null`;
1146
+ `'body-tertiary'`), `theme` (`null`, `'light'` or `'dark'`), `position`
1147
+ (`'fixed-top'`, `'fixed-bottom'`, `'sticky-top'`, `'sticky-bottom'` or `null`)
1148
+ and `width` (`'fluid'`, `'fixed'` or a breakpoint; `'fluid'`). A value a key
1149
+ does not take is warned about and its default used. `createContainer` also takes
1150
+ `brand`, the brand's text or `false` for none.
1151
+
1152
+ __`sidenav`:__ The options of the sidebars made new: `width` (a css length the
1153
+ browser takes as a `width`; `'280px'`), `bg` and `theme` (as the navbar's),
1154
+ `style` (`'pills'` or `'plain'`), `full_height` (`false`) and `responsive` (`null`
1155
+ for always visible, or the breakpoint below which it is an offcanvas a button
1156
+ opens). `createContainer` also takes `brand` and `trigger_label`, the button's
1157
+ text.
1158
+
1159
+ __`browse`:__ In the `navbar` and in the `sidenav` setting, the host's file
1160
+ browser: with it, the field for a link's URL, and the brand's image, has a
1161
+ _Browse…_ button. It is `browse(done, { node, property, value })`, as
1162
+ `inline_style.browse` is: `property` is `'href'` or `'src'`, and the answer is
1163
+ `done(url)` or the promise the function returns, whichever comes first.
1164
+ Nothing, `null` or an empty text leaves the field as it was.
1165
+
1166
+ ```javascript
1167
+ new GridEditor('#myGrid', {
1168
+ navbar: { expand: 'md', browse: function(done, field) { openMyFileBrowser(field.value).then(done); } },
1169
+ sidenav: { width: '20rem', responsive: 'lg' },
1170
+ });
1171
+ ge.createContainer('navbar', { brand: 'ACME', collapse: 'offcanvas' });
1172
+ ge.createContainer('sidenav', { brand: false, full_height: true });
1173
+ ```
1174
+
1175
+ A link's `href` is written as it is typed, `javascript:` included: cleaning it
1176
+ is the page's, as it is for any markup the editor is given. A navbar with
1177
+ `position: 'sticky-top'` only sticks inside its parent: in a column of a row
1178
+ of its own there is no distance to travel, and a sidebar next to a column of
1179
+ content taller than it does stick. `fixed-*` and `sticky-*` are shown in their
1180
+ place while editing, so they never cover the editor.
1118
1181
 
1119
1182
  ### Localization
1120
1183