@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.
Files changed (61) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +83 -14
  3. package/UPGRADING.md +31 -0
  4. package/dist/grideditor.bundle.min.js +2 -2
  5. package/dist/grideditor.css +102 -0
  6. package/dist/grideditor.d.ts +18 -0
  7. package/dist/grideditor.esm.js +291 -31
  8. package/dist/grideditor.js +291 -31
  9. package/dist/grideditor.min.css +1 -1
  10. package/dist/grideditor.min.css.map +1 -1
  11. package/dist/grideditor.min.js +1 -1
  12. package/dist/grideditor.min.js.map +3 -3
  13. package/dist/locales/grideditor.es.esm.js +67 -0
  14. package/dist/locales/grideditor.es.js +67 -0
  15. package/dist/locales/grideditor.es.min.js +1 -1
  16. package/dist/locales/grideditor.es.min.js.map +2 -2
  17. package/dist/plugins/grideditor.float.esm.js +10 -1
  18. package/dist/plugins/grideditor.float.js +8 -2
  19. package/dist/plugins/grideditor.float.min.js +1 -1
  20. package/dist/plugins/grideditor.float.min.js.map +4 -4
  21. package/dist/plugins/grideditor.spacing.esm.js +12 -3
  22. package/dist/plugins/grideditor.spacing.js +9 -3
  23. package/dist/plugins/grideditor.spacing.min.js +1 -1
  24. package/dist/plugins/grideditor.spacing.min.js.map +4 -4
  25. package/dist/plugins/grideditor.style.esm.js +1593 -0
  26. package/dist/plugins/grideditor.style.js +1592 -0
  27. package/dist/plugins/grideditor.style.min.js +2 -0
  28. package/dist/plugins/grideditor.style.min.js.map +7 -0
  29. package/dist/plugins/grideditor.textalign.esm.js +10 -1
  30. package/dist/plugins/grideditor.textalign.js +8 -2
  31. package/dist/plugins/grideditor.textalign.min.js +1 -1
  32. package/dist/plugins/grideditor.textalign.min.js.map +4 -4
  33. package/dist/plugins/grideditor.visibility.esm.js +12 -3
  34. package/dist/plugins/grideditor.visibility.js +9 -3
  35. package/dist/plugins/grideditor.visibility.min.js +1 -1
  36. package/dist/plugins/grideditor.visibility.min.js.map +4 -4
  37. package/docs/locale-keys.md +86 -7
  38. package/docs/plugins.md +49 -5
  39. package/example/index.html +14 -0
  40. package/example/style.html +151 -0
  41. package/example/utilities.html +15 -11
  42. package/package.json +1 -1
  43. package/src/js/grideditor.js +365 -27
  44. package/src/js/locales/grideditor.es.js +67 -0
  45. package/src/js/plugins/grideditor.float.js +8 -33
  46. package/src/js/plugins/grideditor.spacing.js +8 -273
  47. package/src/js/plugins/grideditor.style.js +179 -0
  48. package/src/js/plugins/grideditor.textalign.js +8 -39
  49. package/src/js/plugins/grideditor.visibility.js +8 -147
  50. package/src/js/style/accordion.js +157 -0
  51. package/src/js/style/catalog.js +76 -0
  52. package/src/js/style/custom.js +84 -0
  53. package/src/js/style/fields.js +382 -0
  54. package/src/js/style/float.js +46 -0
  55. package/src/js/style/options.js +75 -0
  56. package/src/js/style/sections.js +271 -0
  57. package/src/js/style/spacing.js +286 -0
  58. package/src/js/style/textalign.js +52 -0
  59. package/src/js/style/visibility.js +160 -0
  60. package/src/less/grideditor.less +111 -0
  61. package/types/grideditor.d.ts +18 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,47 @@ 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
+ ## [7.3.0] - 2026-09-29
9
+
10
+ ### Added
11
+ - The style plugin, `grideditor.style.js`. Every row, column, container,
12
+ pane, element and section gets a *Style* accordion in its settings panel:
13
+ size, spacing, border, background, text, typography, display, position
14
+ and free css. It is written to the node's own `style` through the
15
+ browser, so a value the browser refuses is marked and not written, and
16
+ what the host wrote and nobody edits is kept. Each section offers
17
+ Bootstrap 5.3's classes for what it styles as chips, which put a class in
18
+ the classes field or take it off. A field whose property a Bootstrap
19
+ utility on the node also sets says that the class takes priority. Where
20
+ `settings_panel` is `popover` or `inline` the accordion opens in a
21
+ dialog, from a *Style* button. The `style` setting chooses the sections,
22
+ and in each the properties and whether it has chips. See the README and
23
+ [example/style.html](example/style.html).
24
+ - The style plugin carries spacing, text alignment, visibility and float:
25
+ their per breakpoint fields are in its Spacing, Text, Display and
26
+ Position sections rather than in *Responsive*, and do what they did.
27
+ `style.spacing` and `style.visibility` take what `utilities.spacing` and
28
+ `utilities.visibility` took.
29
+ - For plugins: `panelSection(node, kind)`, a section of a plugin's own in a
30
+ node's settings panel, between its general fields and *Responsive*;
31
+ `ge.openDialog`/`ge.closeDialog`, a modal of the editor's own over the
32
+ settings; `ge.hostStyle`/`ge.setHostStyle`, the host's own style under a
33
+ breakpoint preview; and `replaces` on a factory, for a plugin that takes
34
+ the place of others. A field made with `ge.utilityField` follows the view
35
+ and the classes field wherever the plugin puts it. See
36
+ [docs/plugins.md](docs/plugins.md).
37
+
38
+ ### Deprecated
39
+ - `grideditor.spacing.js`, `grideditor.textalign.js`,
40
+ `grideditor.visibility.js` and `grideditor.float.js`, which go in 8.0.
41
+ Loaded on their own they do what they did, and say once per editor that
42
+ they are deprecated; loaded beside the style plugin they stand down, and
43
+ their names in the `plugins` setting ask for it. `utilities.spacing` and
44
+ `utilities.visibility` are still read, when `style.spacing` and
45
+ `style.visibility` are not there, and go in 8.0 too. See
46
+ [UPGRADING.md](UPGRADING.md).
47
+
48
+
8
49
  ## [7.2.0] - 2026-09-29
9
50
 
10
51
  ### Changed
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 — visibility, order, alignment, gutters, spacing, text alignment and float — are edited per breakpoint too. It also edits tabs, accordions, popups 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 — visibility, order, alignment, gutters, spacing, text alignment 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 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
@@ -560,33 +560,98 @@ __`element_tools`:__ Extra tools on every element drawer, same shape as `row_too
560
560
  See [example/elements.html](example/elements.html), which also shows the
561
561
  pattern for an element with no visual output of its own.
562
562
 
563
+ ### Style
564
+
565
+ Inline css for rows, columns, containers, panes, elements and sections, and
566
+ Bootstrap's classes for it. A plugin:
567
+
568
+ ```html
569
+ <script src="grid-editor/dist/plugins/grideditor.style.min.js"></script> <!-- after grideditor.elements -->
570
+ ```
571
+
572
+ Each of those nodes gets a *Style* accordion in its settings panel, between
573
+ its id and classes and the *Responsive* section. One section is open at a
574
+ time, and the one you opened last is open on the next node too.
575
+
576
+ | Section | Inline fields | Per breakpoint |
577
+ | --- | --- | --- |
578
+ | Size | `width`, `height`, `min-*` and `max-*` (a column: `min-*` and `max-*` only, its width is the grid's) | |
579
+ | Spacing | `margin-*` and `padding-*`, by side | padding and margin, `{p,m}{,x,y,t,b,s,e}-{bp}-{0–5}` |
580
+ | Border | width, style, color, radius, and a shadow builder | |
581
+ | Background | color, image, size, position, repeat | |
582
+ | Text | color, size, alignment, and a text shadow builder | `text-{bp}-start`, `-center`, `-end` |
583
+ | Typography | family, weight, style, line height, letter spacing, transform, decoration | |
584
+ | Display | display, opacity, overflow, visibility | visibility, `d-{bp}-none` / `-block` / `-flex`, with the eye in the drawer |
585
+ | Position | position, `top`, `right`, `bottom`, `left` (not on a column), `z-index` | float, `float-{bp}-*`, on an element |
586
+ | Custom css | whatever no field stands for, as text | |
587
+
588
+ What you type goes to the node's own `style`, through the browser: a value it
589
+ does not take is marked and not written, and whatever the host wrote that you
590
+ do not edit is kept, `!important` included. The style attribute is the same at
591
+ every size, and in a breakpoint view the accordion says so; the per breakpoint
592
+ fields are Bootstrap's responsive classes, and edit the view you are in.
593
+ A text gets only Text and Display, with their per breakpoint fields: its
594
+ editor owns what is inside it.
595
+
596
+ Every section but Spacing and Custom css also offers Bootstrap's classes for
597
+ what it styles - `rounded-3`, `shadow-sm`, `bg-primary`, `fs-4`, `fw-bold`,
598
+ `opacity-50`, `position-relative`… - as chips. A chip puts its class in the
599
+ classes field, and pressing it again takes it off; chips that are
600
+ alternatives, like `rounded-2` and `rounded-pill`, take each other off.
601
+ Bootstrap's utilities are `!important`, so a field whose property a class on
602
+ the node also sets says which class takes priority.
603
+
604
+ With `settings_panel: 'popover'` or `'inline'` the panel has a *Style* button
605
+ instead, which opens the accordion in a dialog.
606
+
607
+ __`style`:__ Every section, unless you say otherwise.
608
+
609
+ ```javascript
610
+ new GridEditor('#myGrid', {
611
+ style: {
612
+ sections: {
613
+ position: false, // no Position section
614
+ border: { properties: ['border-width', 'border-color'], catalog: false }, // two fields, no chips
615
+ },
616
+ spacing: { values: ['0', '2', '4'], scale: [/* if you changed $spacers */] },
617
+ visibility: { drawer: false }, // no eye in the drawers, the field only
618
+ },
619
+ });
620
+ ```
621
+
622
+ The sections are `size`, `spacing`, `border`, `background`, `text`,
623
+ `typography`, `display`, `position` and `custom`. `properties` chooses and
624
+ orders a section's inline fields; the per breakpoint ones stay while the
625
+ section does. What a section you left out or narrowed would have shown is in
626
+ Custom css.
627
+
628
+ Sanitizing what `getHtml` returns is the page's business, style attributes
629
+ included.
630
+
631
+ See [example/style.html](example/style.html).
632
+
563
633
  ### Responsive utilities
564
634
 
565
- Bootstrap's responsive utility classes, edited per breakpoint. Each family is
566
- a plugin in a file of its own:
635
+ Bootstrap's responsive utility classes, edited per breakpoint. The grid's are
636
+ plugins of their own; the ones that style a node are the style plugin's, above.
567
637
 
568
638
  ```html
569
- <script src="grid-editor/dist/plugins/grideditor.visibility.min.js"></script>
570
639
  <script src="grid-editor/dist/plugins/grideditor.order.min.js"></script>
571
640
  <script src="grid-editor/dist/plugins/grideditor.alignment.min.js"></script>
572
641
  <script src="grid-editor/dist/plugins/grideditor.gutters.min.js"></script>
573
- <script src="grid-editor/dist/plugins/grideditor.spacing.min.js"></script>
574
- <script src="grid-editor/dist/plugins/grideditor.textalign.min.js"></script>
575
- <script src="grid-editor/dist/plugins/grideditor.float.min.js"></script> <!-- after grideditor.elements -->
642
+ <script src="grid-editor/dist/plugins/grideditor.style.min.js"></script>
576
643
  ```
577
644
 
578
645
  | Plugin | Classes | On |
579
646
  | --- | --- | --- |
580
- | `visibility` | `d-{bp}-none`, `d-{bp}-block`, `d-{bp}-flex` | rows, columns, elements, containers |
581
647
  | `order` | `order-{bp}-{first,0–5,last}` | columns |
582
648
  | `alignment` | `justify-content-{bp}-*`, `align-items-{bp}-*`; `align-self-{bp}-*` | rows; columns |
583
649
  | `gutters` | `g-{bp}-{0–5}`, `gx-{bp}-*`, `gy-{bp}-*` | rows |
584
- | `spacing` | `{p,m}{,x,y,t,b,s,e}-{bp}-{0–5}`, and `auto` for margin | rows, columns, elements, containers |
585
- | `textalign` | `text-{bp}-start`, `-center`, `-end` | rows, columns, elements, containers |
586
- | `float` | `float-{bp}-start`, `-end`, `-none` | elements |
650
+ | `style` | visibility, spacing, text alignment and float; see [Style](#style) | rows, columns, elements, containers, texts |
587
651
 
588
652
  A plugin puts a field in the *Responsive* section of each drawer's settings
589
- panel, and some add a tool to the drawer. In a breakpoint view a change is
653
+ panel - or, for the style plugin, in its section of the *Style* accordion -
654
+ and some add a tool to the drawer. In a breakpoint view a change is
590
655
  written for that breakpoint alone, and the field says what it inherits and from
591
656
  where. In the all view it is written once, as the class with no breakpoint, and
592
657
  replaces what the breakpoints said. While you edit, the canvas shows what the
@@ -602,14 +667,18 @@ __`utilities`:__ Options for each plugin, under its name.
602
667
  ```javascript
603
668
  new GridEditor('#myGrid', {
604
669
  utilities: {
605
- visibility: { drawer: false }, // no eye in the drawers, the field only
606
670
  order: { drawer: false }, // no arrows in the column drawers
607
671
  gutters: { scale: ['0', '.25rem', '.5rem', '1rem', '1.5rem', '3rem'] }, // if you changed $spacers
608
- spacing: { values: ['0', '2', '4'], scale: [/* the same */] }, // offer fewer steps
609
672
  },
610
673
  });
611
674
  ```
612
675
 
676
+ Up to 7.2 visibility, spacing, text alignment and float were plugins of
677
+ their own, `grideditor.visibility.js`, `grideditor.spacing.js`,
678
+ `grideditor.textalign.js` and `grideditor.float.js`, with their options in
679
+ `utilities.visibility` and `utilities.spacing`. In 7.3 those files still work
680
+ on their own, deprecated, and go in 8.0; see [UPGRADING.md](UPGRADING.md).
681
+
613
682
  See [example/utilities.html](example/utilities.html), and
614
683
  [docs/plugins.md](docs/plugins.md#utility-plugins) for writing one.
615
684
 
package/UPGRADING.md CHANGED
@@ -1,3 +1,34 @@
1
+ Upgrading from grid-editor `7.2` to `7.3`
2
+ =========================================
3
+
4
+ Nothing breaks. The spacing, textalign, visibility and float plugins are now
5
+ part of the **style plugin**, and deprecated on their own: they go in 8.0.
6
+ A page that loads them keeps working as it did, with a warning in the
7
+ console.
8
+
9
+ * __Load the style plugin instead of the four.__ It edits the same classes
10
+ per breakpoint, in its Spacing, Text, Display and Position sections rather
11
+ than in *Responsive*, and adds inline css and Bootstrap's classes as
12
+ chips.
13
+
14
+ ```html
15
+ <script src="dist/plugins/grideditor.style.min.js"></script>
16
+ ```
17
+
18
+ As a module, `import '@themarioga/grid-editor/plugins/style'`. Loaded
19
+ beside it, the old files stand down.
20
+ * __Name it in the `plugins` setting__, if the page names its plugins:
21
+ `plugins: ['style', …]` instead of `'spacing'`, `'textalign'`,
22
+ `'visibility'` or `'float'`. An old name still asks for the style plugin,
23
+ with a warning, until 8.0.
24
+ * __Move the options.__ `utilities: { spacing: … }` is
25
+ `style: { spacing: … }`, and `utilities: { visibility: … }` is
26
+ `style: { visibility: … }`. The old ones are still read, with a warning,
27
+ until 8.0.
28
+ * __Tests or code that look for the fields__ in the Responsive section find
29
+ them in the Style accordion now: `[data-ge-style-section="spacing"]` and
30
+ the others.
31
+
1
32
  Upgrading from grid-editor `7.1` to `7.2`
2
33
  =========================================
3
34