@themarioga/grid-editor 9.0.0-beta.5 → 9.0.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +23 -17
  3. package/UPGRADING.md +24 -5
  4. package/dist/grideditor.bundle.min.js +3 -3
  5. package/dist/grideditor.css +5 -4
  6. package/dist/grideditor.d.ts +6 -18
  7. package/dist/grideditor.esm.js +122 -100
  8. package/dist/grideditor.jquery.js +1 -3
  9. package/dist/grideditor.jquery.min.js +1 -1
  10. package/dist/grideditor.jquery.min.js.map +2 -2
  11. package/dist/grideditor.js +122 -100
  12. package/dist/grideditor.min.css +1 -1
  13. package/dist/grideditor.min.css.map +1 -1
  14. package/dist/grideditor.min.js +2 -2
  15. package/dist/grideditor.min.js.map +3 -3
  16. package/dist/plugins/grideditor.accordion.esm.js +7 -0
  17. package/dist/plugins/grideditor.accordion.js +7 -0
  18. package/dist/plugins/grideditor.accordion.min.js +1 -1
  19. package/dist/plugins/grideditor.accordion.min.js.map +3 -3
  20. package/dist/plugins/grideditor.card.esm.js +4 -0
  21. package/dist/plugins/grideditor.card.js +4 -0
  22. package/dist/plugins/grideditor.card.min.js +1 -1
  23. package/dist/plugins/grideditor.card.min.js.map +3 -3
  24. package/dist/plugins/grideditor.carousel.esm.js +4 -0
  25. package/dist/plugins/grideditor.carousel.js +4 -0
  26. package/dist/plugins/grideditor.carousel.min.js +1 -1
  27. package/dist/plugins/grideditor.carousel.min.js.map +2 -2
  28. package/dist/plugins/grideditor.clipboard.esm.js +3 -18
  29. package/dist/plugins/grideditor.clipboard.js +3 -18
  30. package/dist/plugins/grideditor.clipboard.min.js +1 -1
  31. package/dist/plugins/grideditor.clipboard.min.js.map +3 -3
  32. package/dist/plugins/grideditor.history.esm.js +1 -6
  33. package/dist/plugins/grideditor.history.js +1 -6
  34. package/dist/plugins/grideditor.history.min.js +1 -1
  35. package/dist/plugins/grideditor.history.min.js.map +3 -3
  36. package/dist/plugins/grideditor.offcanvas.esm.js +4 -0
  37. package/dist/plugins/grideditor.offcanvas.js +4 -0
  38. package/dist/plugins/grideditor.offcanvas.min.js +1 -1
  39. package/dist/plugins/grideditor.offcanvas.min.js.map +3 -3
  40. package/dist/plugins/grideditor.popup.esm.js +4 -0
  41. package/dist/plugins/grideditor.popup.js +4 -0
  42. package/dist/plugins/grideditor.popup.min.js +1 -1
  43. package/dist/plugins/grideditor.popup.min.js.map +3 -3
  44. package/dist/plugins/grideditor.tabs.esm.js +4 -0
  45. package/dist/plugins/grideditor.tabs.js +4 -0
  46. package/dist/plugins/grideditor.tabs.min.js +1 -1
  47. package/dist/plugins/grideditor.tabs.min.js.map +2 -2
  48. package/docs/events.md +8 -11
  49. package/docs/plugins.md +10 -8
  50. package/example/clipboard.html +13 -10
  51. package/package.json +1 -1
  52. package/src/js/grideditor.jquery.js +0 -2
  53. package/src/js/grideditor.js +177 -110
  54. package/src/js/plugins/grideditor.accordion.js +9 -0
  55. package/src/js/plugins/grideditor.card.js +5 -0
  56. package/src/js/plugins/grideditor.carousel.js +5 -0
  57. package/src/js/plugins/grideditor.clipboard.js +11 -24
  58. package/src/js/plugins/grideditor.history.js +3 -6
  59. package/src/js/plugins/grideditor.offcanvas.js +5 -0
  60. package/src/js/plugins/grideditor.popup.js +5 -0
  61. package/src/js/plugins/grideditor.tabs.js +5 -0
  62. package/src/less/grideditor.less +5 -4
  63. package/types/grideditor.d.ts +6 -18
package/CHANGELOG.md CHANGED
@@ -5,6 +5,40 @@ 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.6] - 2026-10-21
9
+
10
+ ### Changed
11
+ - **BREAKING:** the selection and the active target are one. With
12
+ `active_target`, and so with `settings_panel: 'sidebar'`, a click - or the
13
+ focus coming into a node - makes the innermost node with settings the
14
+ target, in any panel mode: a row, a column, a section, a container or one of
15
+ its panes, a text, an element. A click on the page outside the editor clears
16
+ it, with every panel, and Escape clears it in one press. The sidebar shows the
17
+ target's settings and the clipboard's Ctrl+C copies it, so a container, a row
18
+ or an element can be copied from the keyboard.
19
+ - **BREAKING:** `getSelected()`, `setSelected()`, the event `selection-change`
20
+ and `callbacks.selection_change` are removed, on the instance, on the plugin
21
+ handle and on the jQuery adapter. Use `getActiveTarget()`,
22
+ `setActiveTarget()` and `target-change`. `setActiveTarget` takes any node with
23
+ settings, and its warning says so.
24
+ - **BREAKING:** the target's mark is the class `ge-selected`, in place of
25
+ `ge-active-target`. A node with its settings open in the sidebar no longer
26
+ has `ge-settings-target`.
27
+ - The toolbar's buttons and Ctrl+V add inside the target, at the end of what it
28
+ holds, in the level it lacks: a row into a row goes in a new column of the
29
+ row, a pasted column into a column goes in a new row, a text or an element
30
+ target adds to its column, and a container adds to the pane it shows (the
31
+ open tab, accordion item, the slide showing, the body of a popup, an
32
+ offcanvas or a card). A section still goes to the canvas after the block the
33
+ target is in.
34
+
35
+ ### Added
36
+ - A container plugin's definition can have `regionOf(container, pane)`, where
37
+ the rows of its visible pane, or of the pane given, go. The tabs, accordion,
38
+ carousel, popup, offcanvas and card plugins have it.
39
+ - `ge.placeInTarget(node, kind, source)` on the plugin handle: a node made,
40
+ added to the target as the toolbar adds what it makes.
41
+
8
42
  ## [9.0.0-beta.5] - 2026-10-21
9
43
 
10
44
  ### Added
package/README.md CHANGED
@@ -183,10 +183,8 @@ has, with the options it was made with, and warns once.
183
183
  | `destroy` | — | `this` | Deinit, drop the controls, unbind, forget the instance |
184
184
  | `changeView` | `breakpoint` | `this` | `'xs'`…`'xxl'`, or `'all'` to edit every breakpoint at once, with one class |
185
185
  | `getView` | — | `String` | The view the editor is in |
186
- | `getActiveTarget` | — | `Element` | With `active_target` - which the `'sidebar'` panel turns on - the column or section the toolbar adds to, or `null` |
187
- | `setActiveTarget` | `node` | `this` | Make a column or section - an element or a selector - the one the toolbar adds to, or `null` for none |
188
- | `getSelected` | — | `Element` | With `settings_panel: 'sidebar'`, the node whose settings the sidebar shows, or `null`. Always `null` without it |
189
- | `setSelected` | `node` | `this` | With `settings_panel: 'sidebar'`, show the settings of a node with settings - an element or a selector - or `null` for none. It does not unfold a sidebar that is folded away, and does nothing without the `'sidebar'` panel |
186
+ | `getActiveTarget` | — | `Element` | With `active_target` - which the `'sidebar'` panel turns on - the node the toolbar adds to and the sidebar shows, or `null` |
187
+ | `setActiveTarget` | `node` | `this` | Make a node with settings - an element or a selector - the one the toolbar adds to, or `null` for none |
190
188
  | `setLocale` | `code` | `this` | Switch language and re-render the controls |
191
189
  | `createRow` | `layout?`, `options?` | `Element` | A row, optionally with columns: `createRow([8, 4])`, `createRow(['auto', 'equal'])`, `createRow({ row_cols: { xs: 1, md: 3 }, columns: 6 })` |
192
190
  | `createColumn` | `size`, `options?` | `Element` | An empty column: units, `'equal'` or `'auto'`; no size into a row with row-cols takes the row's share. `options`: `offset`, `content` - a text of the first editor offered, or plain content with none |
@@ -399,7 +397,17 @@ new GridEditor('#myGrid', {
399
397
  });
400
398
  ```
401
399
 
402
- __`active_target`:__ Whether a click in a column or a section makes it where the toolbar's buttons add. Default `false`, and the toolbar adds at the end of the canvas. With `settings_panel: 'sidebar'` it is on without being asked, and giving `false` with the sidebar throws a `TypeError`: both follow the node last clicked. With `true`, the column or section clicked last - marked with a dashed outline - gets what a button makes at its end, as if the button had been dropped there: a text or a container goes into a column as it is, and into a section in a row of its own; a row goes into a column as a nested row; a section, which only the canvas takes, goes to the canvas just after the block the target is in. The toolbar's paste button pastes there too. Escape, a click in the canvas on no column or section, a click again on the target's own background or drawer (not on a tool or on what it holds), or deleting the target clears it, and the toolbar adds at the end of the canvas again; dragging a button still drops it where it is let go.
400
+ __`active_target`:__ Whether a click on a node makes it the target: where the toolbar's buttons add, and what the sidebar shows. Default `false`, and the toolbar adds at the end of the canvas. With `settings_panel: 'sidebar'` it is on without being asked, and giving `false` with the sidebar throws a `TypeError`: both follow the node last clicked. With `true`, the innermost node with settings under a click - a row, a column, a section, a container or one of its panes, a text, an element - becomes the target, marked with a dashed outline (`ge-selected`), whatever the panel. So does the node the focus comes into. The toolbar's buttons and Ctrl+V add at the end of what the target holds, in the level it lacks:
401
+
402
+ | Target | A button's block goes |
403
+ | --- | --- |
404
+ | A column | in the column: a text, a container or an element as it is, a row nested, a pasted column in a row of its own |
405
+ | A row | in a column of it, of the width *Add column* would give: a row, a text, a container, an element; a pasted column as it is |
406
+ | A section, or a container's pane | at its end: a row as it is, a pasted column in a row, anything else in a row and a column of its own |
407
+ | A container | as in the pane it shows: the tab that is open, the open accordion item, the slide showing, the body of a popup, an offcanvas or a card |
408
+ | A text or an element | as in its column |
409
+
410
+ A section, which only the canvas takes, goes to the canvas just after the block the target is in. The toolbar's paste button pastes there too. Escape, a click on the page outside the editor, a click in the canvas on no node with settings, a click again on the target's own background or drawer (not on a tool or on what it holds), or deleting the target clears it, and the toolbar adds at the end of the canvas again; dragging a button still drops it where it is let go. `getActiveTarget()` and `setActiveTarget()` read and set it.
403
411
 
404
412
  ```javascript
405
413
  const ge = new GridEditor('#myGrid', { active_target: true });
@@ -480,7 +488,7 @@ __`settings_panel`:__ Where the settings a gear opens are shown - a node's id, i
480
488
  | `'popover'` | A Bootstrap popover under the gear, or over it when there is more room there; a press anywhere else puts it away |
481
489
  | `'modal'` | A Bootstrap modal |
482
490
  | `'inline'` | Unfolded in the drawer itself |
483
- | `'sidebar'` | An offcanvas that stays on the right while you edit, and makes room for itself on the page. A click on any node of the canvas shows its settings, and there is no gear. It turns `active_target` on, so the node clicked is also where the toolbar adds; `active_target: false` with it is an error |
491
+ | `'sidebar'` | An offcanvas that stays on the right while you edit, and makes room for itself on the page. A click on any node of the canvas shows its settings, and there is no gear. It turns `active_target` on, so the node clicked is the target, and also where the toolbar adds; `active_target: false` with it is an error |
484
492
 
485
493
  Each is titled after its node ("Column settings"), the node is outlined while its settings are open, and Escape closes them. The editor opens and places them itself, with Bootstrap's markup and css: a page needs neither Popper nor Bootstrap's javascript, and the modal is Bootstrap's own when Bootstrap is there. [example/utilities.html](example/utilities.html) switches between the four.
486
494
 
@@ -488,9 +496,9 @@ Each is titled after its node ("Column settings"), the node is outlined while it
488
496
  new GridEditor('#myGrid', { settings_panel: 'popover' });
489
497
  ```
490
498
 
491
- The sidebar has a button on its left edge with an arrow that folds it away - it stays on the window's edge - and unfolds it again; the choice is not kept between page loads. Below 576px it covers the page instead of making room, and starts folded away. Clicking the canvas's background, the sidebar's close button, the page outside the editor, or pressing Escape deselects, and the sidebar shows a message. A page has one sidebar: a second editor asking for it warns once and uses `'offcanvas'`. The `grideditor:selection-change` event, with `node` and `from`, says when what is selected changes.
499
+ The sidebar has a button on its left edge with an arrow that folds it away - it stays on the window's edge - and unfolds it again; the choice is not kept between page loads. Below 576px it covers the page instead of making room, and starts folded away. Clicking the canvas's background, the sidebar's close button, the page outside the editor, or pressing Escape clears the target, and the sidebar shows a message. A page has one sidebar: a second editor asking for it warns once and uses `'offcanvas'`. The `grideditor:target-change` event, with `target` and `from`, says when it changes.
492
500
 
493
- __`sidebar`:__ Settings of the `'sidebar'` panel. `empty` is a `function(ge)` called whenever nothing is selected, that returns `{ title, body }` - the title is text, the body an element, which the editor moves out of the sidebar and back without destroying it - to show that instead of the message, such as the page's own properties. Return `null` for the message. Plugins can do the same with a `sidebarEmpty` hook, after this one.
501
+ __`sidebar`:__ Settings of the `'sidebar'` panel. `empty` is a `function(ge)` called whenever there is no target, that returns `{ title, body }` - the title is text, the body an element, which the editor moves out of the sidebar and back without destroying it - to show that instead of the message, such as the page's own properties. Return `null` for the message. Plugins can do the same with a `sidebarEmpty` hook, after this one.
494
502
 
495
503
  ```javascript
496
504
  new GridEditor('#myGrid', {
@@ -846,13 +854,11 @@ A paste is an add like any other: `before-add-*` and `after-add-*` with
846
854
  `grideditor:after-copy`.
847
855
 
848
856
  With `active_target` - which `settings_panel: 'sidebar'` turns on - there are
849
- shortcuts too, Ctrl+C and Ctrl+V (⌘C and ⌘V on a Mac). Ctrl+C copies the node
850
- selected in the sidebar or, with none, the target, as its *Copy* tool would.
851
- Ctrl+V pastes into the target as the toolbar's paste button would - a row at
852
- its end, a section after the block it is in - and a text, a container or an
853
- element at the end of a target column, as its *Paste* tool would; with no
854
- target, into the node selected, as its *Paste* tool would. What does not fit
855
- there is not pasted anywhere else. They go to the editor used last, and leave
857
+ shortcuts too, Ctrl+C and Ctrl+V (⌘C and ⌘V on a Mac). Ctrl+C copies the
858
+ target, as its *Copy* tool would, whatever its level: a container, a row, an
859
+ element, a text. Ctrl+V pastes into the target as the toolbar adds to it - at
860
+ the end of what it holds, in the row or the column it lacks, a section after
861
+ the block it is in. With no target, they do nothing. They go to the editor used last, and leave
856
862
  the keys to the browser while a field or a text is being edited, while text
857
863
  is selected (for Ctrl+C), while a settings panel, a dialog or the delete
858
864
  confirmation is open, and outside editing. They use the same store as the
@@ -961,8 +967,8 @@ The keys stay the browser's, or the text editor's, while a field or a text is
961
967
  edited, while a panel or a dialog is open, and while the canvas is in preview or
962
968
  showing its source; what was typed becomes a step when it is done. They go to
963
969
  the editor used last. Going to a step makes the canvas again, so an open text
964
- closes, and the node selected in the sidebar and the target are chosen again by
965
- where they were: nothing is selected if there is no node there any more.
970
+ closes, and the target is chosen again by where it was: nothing is if there is
971
+ no node there any more.
966
972
 
967
973
  | Method | Returns | What it does |
968
974
  | --- | --- | --- |
package/UPGRADING.md CHANGED
@@ -2,14 +2,33 @@ Upgrading from grid-editor `8.x` to `9.0`
2
2
  =========================================
3
3
 
4
4
  * __`settings_panel: 'sidebar'` turns `active_target` on.__ A click on a
5
- column or a section is now also where the toolbar's buttons add - a text, a
6
- row, a container, a paste - instead of the end of the canvas. There is no
7
- setting to have the sidebar without it. Clicking the canvas's background, or
5
+ node is now also where the toolbar's buttons add - a text, a row, a
6
+ container, a paste - instead of the end of the canvas. There is no setting
7
+ to have the sidebar without it. Clicking the canvas's background, or
8
8
  pressing Escape, clears the target and the toolbar adds at the end of the
9
9
  canvas again, as before.
10
+ * __The selection is the active target.__ With `active_target` - and so with
11
+ the sidebar - a click, or the focus, makes the innermost node with settings
12
+ the target, whatever it is: a row, a container, an element, a text. Before,
13
+ only a column or a section could be one, and the sidebar kept a selection
14
+ of its own. `getSelected()`, `setSelected()`, the `grideditor:selection-change`
15
+ event and `callbacks.selection_change` are gone: use `getActiveTarget()`,
16
+ `setActiveTarget()`, `grideditor:target-change` and `callbacks.target_change`.
17
+ The class that marks the target is `ge-selected`, in place of
18
+ `ge-active-target`, and a node with its settings open in the sidebar no
19
+ longer has `ge-settings-target`. Focus in a node and a click on the page
20
+ outside the editor now change the target with every settings panel, not
21
+ only with the sidebar. This came in `9.0.0-beta.6`.
22
+ * __The toolbar and Ctrl+V add inside the target, in the level it lacks.__ A
23
+ row added to a row goes in a new column of it, a pasted column added to a
24
+ column goes in a new row, a text or an element target adds to its column,
25
+ and a container target adds to the pane it shows. A container plugin of your
26
+ own can say where its rows go with `regionOf(container, pane)` in its
27
+ definition; without it, a container target adds to its column. A plugin that
28
+ adds a node it made to the target can use `ge.placeInTarget(node, kind, source)`.
10
29
  * __With the clipboard plugin and `active_target`, Ctrl+C and Ctrl+V copy
11
- and paste nodes.__ They act on the node selected or the target, and leave
12
- the keys alone while a field or a text has the focus or text is selected.
30
+ and paste nodes.__ They act on the target, and leave the keys alone while a
31
+ field or a text has the focus or text is selected.
13
32
  `clipboard: { shortcuts: false }` turns them off. This came in
14
33
  `9.0.0-beta.2`.
15
34
  * __`settings_panel: 'sidebar'` with `active_target: false` throws.__ The