@themarioga/grid-editor 3.2.1 → 4.1.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 (65) hide show
  1. package/BUILDING.md +12 -3
  2. package/CHANGELOG.md +87 -0
  3. package/README.md +79 -7
  4. package/UPGRADING.md +79 -0
  5. package/dist/grideditor.css +188 -20
  6. package/dist/grideditor.min.css +1 -1
  7. package/dist/grideditor.min.css.map +1 -1
  8. package/dist/jquery.grideditor.bundle.min.js +10 -0
  9. package/dist/jquery.grideditor.js +924 -174
  10. package/dist/jquery.grideditor.min.js +1 -1
  11. package/dist/jquery.grideditor.min.js.map +1 -1
  12. package/dist/locales/grideditor.es.js +34 -0
  13. package/dist/locales/grideditor.es.min.js +1 -1
  14. package/dist/locales/grideditor.es.min.js.map +1 -1
  15. package/dist/plugins/grideditor.accordion.js +8 -0
  16. package/dist/plugins/grideditor.accordion.min.js +1 -1
  17. package/dist/plugins/grideditor.accordion.min.js.map +1 -1
  18. package/dist/plugins/grideditor.alignment.js +81 -0
  19. package/dist/plugins/grideditor.alignment.min.js +2 -0
  20. package/dist/plugins/grideditor.alignment.min.js.map +1 -0
  21. package/dist/plugins/grideditor.elements.js +5 -5
  22. package/dist/plugins/grideditor.elements.min.js +1 -1
  23. package/dist/plugins/grideditor.elements.min.js.map +1 -1
  24. package/dist/plugins/grideditor.gutters.js +145 -0
  25. package/dist/plugins/grideditor.gutters.min.js +2 -0
  26. package/dist/plugins/grideditor.gutters.min.js.map +1 -0
  27. package/dist/plugins/grideditor.order.js +206 -0
  28. package/dist/plugins/grideditor.order.min.js +2 -0
  29. package/dist/plugins/grideditor.order.min.js.map +1 -0
  30. package/dist/plugins/grideditor.spacing.js +299 -0
  31. package/dist/plugins/grideditor.spacing.min.js +2 -0
  32. package/dist/plugins/grideditor.spacing.min.js.map +1 -0
  33. package/dist/plugins/grideditor.tabs.js +8 -0
  34. package/dist/plugins/grideditor.tabs.min.js +1 -1
  35. package/dist/plugins/grideditor.tabs.min.js.map +1 -1
  36. package/dist/plugins/grideditor.visibility.js +172 -0
  37. package/dist/plugins/grideditor.visibility.min.js +2 -0
  38. package/dist/plugins/grideditor.visibility.min.js.map +1 -0
  39. package/docs/events.md +26 -8
  40. package/docs/locale-keys.md +54 -0
  41. package/docs/plugins.md +129 -10
  42. package/example/autosave.html +6 -1
  43. package/example/basic.html +8 -2
  44. package/example/breakpoints.html +6 -1
  45. package/example/ckeditor.html +6 -1
  46. package/example/containers.html +5 -1
  47. package/example/elements.html +6 -1
  48. package/example/index.html +24 -1
  49. package/example/locale.html +6 -1
  50. package/example/plugins.html +6 -1
  51. package/example/summernote.html +6 -1
  52. package/example/utilities.html +145 -0
  53. package/example/wrap_content.html +6 -1
  54. package/package.json +3 -2
  55. package/src/js/jquery.grideditor.js +924 -174
  56. package/src/js/locales/grideditor.es.js +34 -0
  57. package/src/js/plugins/grideditor.accordion.js +8 -0
  58. package/src/js/plugins/grideditor.alignment.js +81 -0
  59. package/src/js/plugins/grideditor.elements.js +5 -5
  60. package/src/js/plugins/grideditor.gutters.js +145 -0
  61. package/src/js/plugins/grideditor.order.js +206 -0
  62. package/src/js/plugins/grideditor.spacing.js +299 -0
  63. package/src/js/plugins/grideditor.tabs.js +8 -0
  64. package/src/js/plugins/grideditor.visibility.js +172 -0
  65. package/src/less/grideditor.less +210 -18
@@ -106,7 +106,24 @@
106
106
  }
107
107
 
108
108
  /* The button following the pointer must not be what the pointer is over */
109
+ .ge-drag-helper {
110
+ opacity: .85;
111
+ pointer-events: none;
112
+
113
+ .ge-tools-drawer {
114
+ pointer-events: none;
115
+ }
116
+ }
117
+
118
+ /* A toolbar button that can be carried onto the canvas */
119
+ .ge-palette-button {
120
+ cursor: move;
121
+ touch-action: none;
122
+ }
123
+
109
124
  .ge-toolbar-helper {
125
+ position: absolute;
126
+ z-index: 1000;
110
127
  pointer-events: none;
111
128
  opacity: 0.85;
112
129
  }
@@ -131,10 +148,9 @@
131
148
 
132
149
  .ge-tools-drawer {
133
150
  /* Positioned, so a tool can hang a picker off itself. Deliberately
134
- not stacked above anything the rest of the time: jQuery UI's resize
135
- handle carries an inline z-index of 90 and runs down the column's
136
- edge, and a drawer sitting over it would take the clicks meant for
137
- the handle. */
151
+ not stacked above anything the rest of the time: the resize handle
152
+ runs down the column's edge, and a drawer sitting over it would take
153
+ the clicks meant for the handle. */
138
154
  position: relative;
139
155
  -webkit-touch-callout: none;
140
156
 
@@ -191,6 +207,83 @@
191
207
  input.ge-classes {
192
208
  width: 200px;
193
209
  }
210
+
211
+ /* The utility plugins' fields, folded under one toggle */
212
+ .ge-utilities {
213
+ margin-top: 5px;
214
+ font-size: 11px;
215
+
216
+ > .ge-utilities-toggle {
217
+ color: #333;
218
+ cursor: pointer;
219
+ text-decoration: none;
220
+
221
+ &::before {
222
+ content: '\25B8';
223
+ display: inline-block;
224
+ width: 1em;
225
+ }
226
+ }
227
+ &.ge-open > .ge-utilities-toggle::before {
228
+ content: '\25BE';
229
+ }
230
+
231
+ > .ge-utilities-body {
232
+ display: none;
233
+ flex-wrap: wrap;
234
+ gap: 4px 10px;
235
+ margin-top: 4px;
236
+ }
237
+ &.ge-open > .ge-utilities-body {
238
+ display: flex;
239
+ }
240
+
241
+ .ge-utility {
242
+ display: inline-flex;
243
+ flex-direction: column;
244
+ margin: 0;
245
+
246
+ select {
247
+ border: 1px solid #7F7F7F;
248
+ border-radius: 4px;
249
+ font-size: 11px;
250
+ padding: 1px 2px;
251
+ }
252
+ }
253
+ .ge-utility-note {
254
+ color: #666;
255
+ font-size: 10px;
256
+ max-width: 160px;
257
+ }
258
+
259
+ /* The spacing plugin: a side and a value per group */
260
+ .ge-spacing {
261
+ display: flex;
262
+ flex-wrap: wrap;
263
+ gap: 4px 10px;
264
+ }
265
+ .ge-spacing-group {
266
+ display: inline-flex;
267
+ flex-direction: column;
268
+
269
+ > .ge-spacing-side {
270
+ border: 1px solid #7F7F7F;
271
+ border-radius: 4px;
272
+ font-size: 11px;
273
+ padding: 1px 2px;
274
+ margin-bottom: 2px;
275
+ }
276
+ /* The group names the field once */
277
+ .ge-utility > .ge-utility-label {
278
+ display: none;
279
+ }
280
+ }
281
+ .ge-spacing-gutter {
282
+ flex-basis: 100%;
283
+ color: #666;
284
+ font-size: 10px;
285
+ }
286
+ }
194
287
  }
195
288
  }
196
289
  .row {
@@ -423,12 +516,18 @@
423
516
  }
424
517
  }
425
518
 
426
- /* Sorting */
427
- .ui-sortable-placeholder {
519
+ /* Sorting. The dragged node stays in the list and shows where it would
520
+ land - that is the placeholder - while a copy of it follows the
521
+ pointer. */
522
+ .ge-drag-placeholder {
428
523
  background: fadeout(yellow, 80%);
429
- visibility: visible !important;
524
+ opacity: 1;
430
525
  min-height: 50px;
431
526
  max-height: 100px;
527
+
528
+ > * {
529
+ visibility: hidden;
530
+ }
432
531
  }
433
532
 
434
533
  /* A size change should read as a movement rather than a jump, but not
@@ -437,23 +536,26 @@
437
536
  .column {
438
537
  transition: width 120ms ease, margin-left 120ms ease;
439
538
  }
440
- .column.ui-resizable-resizing {
539
+ .column.ge-resizing {
441
540
  transition: none;
442
541
  /* Follow the pointer in pixels: the layout mode's max-width is what
443
542
  the column will snap back into once the drag lands */
444
543
  max-width: none;
445
544
  }
446
545
 
447
- /* Resizing. jQuery UI's own stylesheet is not a dependency, so the handle
448
- is styled here: a grip on the column's edge, clear of the drawer, which
449
- is what keeps the resize gesture and the sort gesture apart */
450
- .column > .ui-resizable-handle {
546
+ /* Resizing: a grip on the column's edge, clear of the drawer, which is
547
+ what keeps the resize gesture and the sort gesture apart */
548
+ .column > .ge-resize-handle {
451
549
  position: absolute;
452
550
  display: block;
453
551
  z-index: 10;
552
+
553
+ /* The gesture is the editor's, not the page's: without this a touch
554
+ drag on the handle scrolls instead of resizing */
555
+ touch-action: none;
454
556
  }
455
- .column > .ui-resizable-e,
456
- .column > .ui-resizable-w {
557
+ .column > .ge-resize-e,
558
+ .column > .ge-resize-w {
457
559
  top: 0;
458
560
  bottom: 0;
459
561
  width: 8px;
@@ -464,10 +566,10 @@
464
566
  background: @colColor;
465
567
  }
466
568
  }
467
- .column > .ui-resizable-e {
569
+ .column > .ge-resize-e {
468
570
  right: -1px;
469
571
  }
470
- .column > .ui-resizable-w {
572
+ .column > .ge-resize-w {
471
573
  left: -1px;
472
574
  }
473
575
 
@@ -479,13 +581,13 @@
479
581
  font-size: 11px;
480
582
  color: @colTextColor;
481
583
  }
482
- .column.ui-resizable-resizing > .ge-tools-drawer > .ge-resize-size {
584
+ .column.ge-resizing > .ge-tools-drawer > .ge-resize-size {
483
585
  display: block;
484
586
  }
485
587
  }
486
588
 
487
589
  /* The handle belongs to editing, and never to the output */
488
- .ge-canvas:not(.ge-editing) .ui-resizable-handle {
590
+ .ge-canvas:not(.ge-editing) .ge-resize-handle {
489
591
  display: none;
490
592
  }
491
593
 
@@ -592,3 +694,93 @@
592
694
  }
593
695
 
594
696
  .ge-layout-modes();
697
+
698
+ /*
699
+ * The visibility plugin. A node Bootstrap would hide is kept on the canvas -
700
+ * there would be nothing left to click to show it again - and shown the way
701
+ * the view sees it instead. The selectors outweigh Bootstrap's d-* classes,
702
+ * which are !important too.
703
+ */
704
+ .ge-canvas.ge-editing {
705
+ .ge-visibility {
706
+ display: block !important;
707
+ }
708
+ .row.ge-visibility {
709
+ display: flex !important;
710
+ }
711
+
712
+ .ge-hidden-in-view {
713
+ opacity: .45;
714
+ background-image: repeating-linear-gradient(
715
+ -45deg, transparent 0, transparent 6px, rgba(0, 0, 0, .07) 6px, rgba(0, 0, 0, .07) 12px
716
+ );
717
+ }
718
+
719
+ /* The all view: hidden at some breakpoints, said in a corner */
720
+ [data-ge-hidden-in] {
721
+ position: relative;
722
+
723
+ &::after {
724
+ content: attr(data-ge-hidden-in);
725
+ position: absolute;
726
+ right: 2px;
727
+ bottom: 2px;
728
+ z-index: 1;
729
+ padding: 0 4px;
730
+ border-radius: 3px;
731
+ background: rgba(0, 0, 0, .6);
732
+ color: #fff;
733
+ font-size: 10px;
734
+ line-height: 16px;
735
+ pointer-events: none;
736
+ }
737
+ }
738
+ }
739
+
740
+ /* The order plugin: a column ordered by class in this view says where */
741
+ .ge-canvas.ge-editing .column[data-ge-order]::before {
742
+ content: attr(data-ge-order);
743
+ position: absolute;
744
+ left: 2px;
745
+ bottom: 2px;
746
+ z-index: 1;
747
+ padding: 0 4px;
748
+ border-radius: 3px;
749
+ background: fade(@colTextColor, 85%);
750
+ color: #fff;
751
+ font-size: 10px;
752
+ line-height: 16px;
753
+ pointer-events: none;
754
+ }
755
+
756
+ /*
757
+ * The gutters plugin. A row with gutter classes is drawn with its real
758
+ * gutters rather than the editor's frame: each column padded by half the
759
+ * horizontal gutter, and the vertical gutter above each column. Bootstrap
760
+ * takes the first line's back with a negative top margin on the row, which
761
+ * here would pull it over the row above, so the row's drawer takes it back
762
+ * instead and the gap shows between lines of columns only.
763
+ */
764
+ .ge-canvas.ge-editing .row.ge-gutters {
765
+ margin-top: 0;
766
+
767
+ > .ge-tools-drawer {
768
+ margin-top: 0;
769
+ margin-bottom: calc(@editGutter - var(--bs-gutter-y));
770
+ /* Bootstrap pads every child of a row by half its gutter, the drawer
771
+ too; it keeps the padding a row with no gutter class gives it */
772
+ padding-left: .75rem;
773
+ padding-right: .75rem;
774
+ }
775
+
776
+ > .column {
777
+ padding-left: calc(var(--bs-gutter-x) * .5);
778
+ padding-right: calc(var(--bs-gutter-x) * .5);
779
+
780
+ > .ge-tools-drawer {
781
+ margin-left: calc(var(--bs-gutter-x) * -.5);
782
+ margin-right: calc(var(--bs-gutter-x) * -.5);
783
+ width: calc(100% + var(--bs-gutter-x));
784
+ }
785
+ }
786
+ }