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

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 (36) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +24 -8
  3. package/dist/grideditor.bundle.min.js +2 -2
  4. package/dist/grideditor.css +187 -0
  5. package/dist/grideditor.d.ts +37 -0
  6. package/dist/grideditor.esm.js +6 -10
  7. package/dist/grideditor.js +6 -10
  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 +20 -0
  13. package/dist/locales/grideditor.es.js +20 -0
  14. package/dist/locales/grideditor.es.min.js +2 -2
  15. package/dist/locales/grideditor.es.min.js.map +2 -2
  16. package/dist/plugins/grideditor.offcanvas.esm.js +551 -0
  17. package/dist/plugins/grideditor.offcanvas.js +556 -0
  18. package/dist/plugins/grideditor.offcanvas.min.js +1 -0
  19. package/dist/plugins/grideditor.offcanvas.min.js.map +7 -0
  20. package/dist/plugins/grideditor.popup.esm.js +90 -37
  21. package/dist/plugins/grideditor.popup.js +90 -37
  22. package/dist/plugins/grideditor.popup.min.js +1 -1
  23. package/dist/plugins/grideditor.popup.min.js.map +4 -4
  24. package/docs/events.md +4 -3
  25. package/docs/locale-keys.md +21 -1
  26. package/docs/plugins.md +11 -4
  27. package/example/containers.html +22 -4
  28. package/example/index.html +1 -1
  29. package/package.json +1 -1
  30. package/src/js/grideditor.js +7 -8
  31. package/src/js/locales/grideditor.es.js +20 -0
  32. package/src/js/plugins/grideditor.offcanvas.js +420 -0
  33. package/src/js/plugins/grideditor.popup.js +8 -70
  34. package/src/js/triggers/triggers.js +121 -0
  35. package/src/less/grideditor.less +60 -0
  36. package/types/grideditor.d.ts +37 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,26 @@ 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
+ ## [9.0.0-beta.4] - 2026-10-20
9
+
10
+ ### Added
11
+ - offcanvas: a container plugin for Bootstrap's offcanvas, with its trigger.
12
+ While editing the panel is unfolded in place and its body is a region, as a
13
+ popup's is. `createContainer('offcanvas', { title, trigger, trigger_label,
14
+ placement, backdrop, scroll, keyboard, responsive, dark })`, the `offcanvas`
15
+ setting for the ones made new, and an *Offcanvas* section in its settings
16
+ panel. With `responsive` the panel's own trigger gets `d-<breakpoint>-none`.
17
+ The event `offcanvas-orphan`, for a trigger whose offcanvas is missing.
18
+ - A container plugin's definition can have `references`: the attributes of its
19
+ own that hold an id, which `freshNode` renames along with the id when a copy
20
+ is made.
21
+
22
+ ### Changed
23
+ - The core no longer names the popup: its ids are followed through the popup
24
+ plugin's `references`, and the trigger handling the popup and the offcanvas
25
+ share moved out of the core with it. Nothing changes in the markup, the
26
+ events or the behaviour of a popup.
27
+
8
28
  ## [9.0.0-beta.3] - 2026-10-20
9
29
 
10
30
  ### Added
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, 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 and cards, 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
@@ -27,7 +27,7 @@ from any web server, or from GitHub Pages, with no build step.
27
27
  | [example/breakpoints.html](example/breakpoints.html) | The six breakpoints and the "all sizes" view | [live](https://themarioga.github.io/grid-editor/example/breakpoints.html) |
28
28
  | [example/plugins.html](example/plugins.html) | The plugin model, with one written in the page itself | [live](https://themarioga.github.io/grid-editor/example/plugins.html) |
29
29
  | [example/attributes.html](example/attributes.html) | A plugin of your own: a drawer tool, a modal, and its settings saved as an attribute | [live](https://themarioga.github.io/grid-editor/example/attributes.html) |
30
- | [example/containers.html](example/containers.html) | Tabs, accordions, popups, carousels and cards, two levels deep | [live](https://themarioga.github.io/grid-editor/example/containers.html) |
30
+ | [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) |
31
31
  | [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) |
32
32
  | [example/autocols.html](example/autocols.html) | Equal and auto columns, columns per row, and sections | [live](https://themarioga.github.io/grid-editor/example/autocols.html) |
33
33
  | [example/utilities.html](example/utilities.html) | Bootstrap's responsive utilities, edited per breakpoint | [live](https://themarioga.github.io/grid-editor/example/utilities.html) |
@@ -193,7 +193,7 @@ has, with the options it was made with, and warns once.
193
193
  | `createSection` | `options?` | `Element` | A section, with the sections plugin. `options`: `width` (`'fixed'`, `'fluid'` or a breakpoint), `rows` (layouts), and a placement |
194
194
  | `createElement` | `content`, `options?` | `Element` | Host markup wrapped as an element. `options`: `type`, `label` |
195
195
  | `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 |
196
- | `createContainer` | `type`, `options?` | `Element` | `'tabs'`, `'accordion'`, `'popup'`, `'carousel'` or `'card'` |
196
+ | `createContainer` | `type`, `options?` | `Element` | `'tabs'`, `'accordion'`, `'popup'`, `'offcanvas'`, `'carousel'` or `'card'` |
197
197
  | `addTab` | `container`, `options?` | `Element` | Appends a tab, returns its pane |
198
198
  | `addAccordionItem` | `container`, `options?` | `Element` | Appends an item, returns its body |
199
199
  | `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 |
@@ -793,7 +793,7 @@ row and delete. The toolbar gets a *Section* button. Rows drag in and out of
793
793
  sections, and sections drag along the canvas but not into a column. In a
794
794
  breakpoint view each section is as wide as its container would be at that
795
795
  breakpoint. They are called sections, not containers, because a container is
796
- what the tabs, accordion, popup and card plugins make.
796
+ what the tabs, accordion, popup, offcanvas and card plugins make.
797
797
 
798
798
  ```javascript
799
799
  ge.createSection({ width: 'md', rows: [[6, 6]], appendTo: '#myGrid' });
@@ -818,7 +818,7 @@ nowhere else:
818
818
  | a row | a column, a section, or the canvas from the toolbar's paste button |
819
819
  | a column | a row |
820
820
  | a section | the canvas, from the toolbar's paste button |
821
- | a container (tabs, accordion, popup, card) | a column |
821
+ | a container (tabs, accordion, popup, offcanvas, card) | a column |
822
822
  | a text | a column |
823
823
  | an element | a column |
824
824
 
@@ -838,7 +838,7 @@ The copy is what `getHtml` would give for that node. When it is pasted, any id
838
838
  it carries that the page already has is renamed - `ge-tab-…` ids get new
839
839
  generated ones, the host's own get a suffix, `hero` becoming `hero-2` - and
840
840
  whatever inside the copy pointed at the old id (`data-bs-target`,
841
- `data-bs-parent`, `href="#…"`, `aria-*`, a popup's trigger) points at the new
841
+ `data-bs-parent`, `href="#…"`, `aria-*`, a popup's or an offcanvas's trigger) points at the new
842
842
  one. So the tabs of a copy open the copy's panes, not the original's.
843
843
 
844
844
  A paste is an add like any other: `before-add-*` and `after-add-*` with
@@ -982,8 +982,8 @@ The methods are there only when the plugin is loaded.
982
982
 
983
983
  ### Containers
984
984
 
985
- Tabs, accordions, popups, carousels and cards. A tabs, accordion, popup or
986
- carousel container holds panes; a card holds one region. Either way a region is an ordinary one: rows,
985
+ Tabs, accordions, popups, offcanvases, carousels and cards. A tabs, accordion or
986
+ carousel container holds panes; a popup, an offcanvas and a card hold one region. Either way a region is an ordinary one: rows,
987
987
  columns, content areas and elements nest inside it exactly as they do at the
988
988
  top level.
989
989
 
@@ -995,6 +995,7 @@ it available:
995
995
  <script src="grid-editor/dist/plugins/grideditor.tabs.min.js"></script>
996
996
  <script src="grid-editor/dist/plugins/grideditor.accordion.min.js"></script>
997
997
  <script src="grid-editor/dist/plugins/grideditor.popup.min.js"></script>
998
+ <script src="grid-editor/dist/plugins/grideditor.offcanvas.min.js"></script>
998
999
  <script src="grid-editor/dist/plugins/grideditor.carousel.min.js"></script>
999
1000
  <script src="grid-editor/dist/plugins/grideditor.card.min.js"></script>
1000
1001
  ```
@@ -1023,6 +1024,13 @@ ge.createContainer('carousel', { slides: 3, controls: false }); // an option g
1023
1024
  ge.addPane(carousel, { interval: 8000 }); // a slide that stays for 8 seconds
1024
1025
  ```
1025
1026
 
1027
+ __`offcanvas`:__ The options of the offcanvases made new, from the toolbar or with `createContainer`, as Bootstrap has them: `placement` (`'start'`, `'end'`, `'top'` or `'bottom'`; `'start'`), `backdrop` (`true`, `false` or `'static'`; `true`), `scroll` (the page scrolls behind it; `false`), `keyboard` (Esc closes it; `true`), `responsive` (`null`, or the breakpoint - `'sm'` to `'xxl'` - from which it is content in the page and not a panel) and `dark` (`data-bs-theme="dark"`). A value a key does not take is warned about and its default used. Every offcanvas also has an *Offcanvas* section in its settings panel, which changes its own. It is all Bootstrap's classes and attributes, so a page's markup says it too.
1028
+
1029
+ ```javascript
1030
+ new GridEditor('#myGrid', { offcanvas: { placement: 'end', backdrop: 'static' } });
1031
+ ge.createContainer('offcanvas', { title: 'Menu', trigger_label: 'Menu', responsive: 'lg' }); // an option given wins
1032
+ ```
1033
+
1026
1034
  __`container_tools`, `tab_tools`, `accordion_tools`, `carousel_tools`:__ Extra tools on the container drawer and on each pane's drawer, same shape as `row_tools`.
1027
1035
 
1028
1036
  ```javascript
@@ -1035,6 +1043,7 @@ ge.addTab(tabs, { label: 'Third', activate: true });
1035
1043
 
1036
1044
  ge.createContainer('accordion', { items: 3, stay_open: true });
1037
1045
  ge.createContainer('popup', { title: 'Terms', trigger_label: 'Read them', size: 'lg' });
1046
+ ge.createContainer('offcanvas', { title: 'Filters', placement: 'end', trigger: false });
1038
1047
  ```
1039
1048
 
1040
1049
  An accordion opens and closes from its headers while editing, and what you
@@ -1049,6 +1058,13 @@ the trigger. Any node in the canvas carrying
1049
1058
  `data-ge-popup-target="<popup id>"` is a trigger too — grid-editor leaves your
1050
1059
  markup alone and writes Bootstrap's attributes onto it in the output.
1051
1060
 
1061
+ An offcanvas is the same with Bootstrap's offcanvas in place of its modal: it is
1062
+ rendered unfolded in place while editing, its body is a region, and the trigger
1063
+ is the button it makes, or any node carrying
1064
+ `data-ge-offcanvas-target="<offcanvas id>"`. With `responsive` the panel is
1065
+ content in the page from that breakpoint up, so its own trigger gets
1066
+ `d-<breakpoint>-none`; a trigger of yours elsewhere is not touched.
1067
+
1052
1068
  A carousel shows one slide at a time while editing, as it does on the page.
1053
1069
  The container's drawer has the arrows and says which slide it is on, and
1054
1070
  Bootstrap's own arrows are kept in the markup but not drawn, so they never sit