@themarioga/grid-editor 7.2.0 → 8.0.0-beta.2

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 (97) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/README.md +96 -30
  3. package/UPGRADING.md +86 -0
  4. package/dist/grideditor.bundle.min.js +3 -3
  5. package/dist/grideditor.css +149 -6
  6. package/dist/grideditor.d.ts +18 -0
  7. package/dist/grideditor.esm.js +257 -48
  8. package/dist/grideditor.jquery.js +0 -13
  9. package/dist/grideditor.jquery.min.js +1 -1
  10. package/dist/grideditor.jquery.min.js.map +3 -3
  11. package/dist/grideditor.js +257 -48
  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/locales/grideditor.es.esm.js +80 -6
  17. package/dist/locales/grideditor.es.js +80 -6
  18. package/dist/locales/grideditor.es.min.js +1 -1
  19. package/dist/locales/grideditor.es.min.js.map +2 -2
  20. package/dist/plugins/grideditor.accordion.min.js.map +2 -2
  21. package/dist/plugins/grideditor.alignment.esm.js +11 -38
  22. package/dist/plugins/grideditor.alignment.js +11 -38
  23. package/dist/plugins/grideditor.alignment.min.js +1 -1
  24. package/dist/plugins/grideditor.alignment.min.js.map +3 -3
  25. package/dist/plugins/grideditor.card.min.js.map +1 -1
  26. package/dist/plugins/grideditor.ckeditor.esm.js +0 -5
  27. package/dist/plugins/grideditor.ckeditor.js +0 -5
  28. package/dist/plugins/grideditor.ckeditor.min.js +1 -1
  29. package/dist/plugins/grideditor.ckeditor.min.js.map +3 -3
  30. package/dist/plugins/grideditor.clipboard.min.js.map +1 -1
  31. package/dist/plugins/grideditor.codemirror-inline.min.js.map +1 -1
  32. package/dist/plugins/grideditor.codemirror.min.js.map +1 -1
  33. package/dist/plugins/grideditor.elements.min.js.map +2 -2
  34. package/dist/plugins/grideditor.gutters.min.js.map +1 -1
  35. package/dist/plugins/grideditor.order.min.js.map +1 -1
  36. package/dist/plugins/grideditor.popup.min.js.map +1 -1
  37. package/dist/plugins/grideditor.sections.min.js.map +2 -2
  38. package/dist/plugins/grideditor.style.esm.js +1926 -0
  39. package/dist/plugins/grideditor.style.js +1923 -0
  40. package/dist/plugins/grideditor.style.min.js +4 -0
  41. package/dist/plugins/grideditor.style.min.js.map +7 -0
  42. package/dist/plugins/grideditor.summernote.min.js.map +2 -2
  43. package/dist/plugins/grideditor.tabs.min.js.map +2 -2
  44. package/dist/plugins/grideditor.tinymce.esm.js +1 -8
  45. package/dist/plugins/grideditor.tinymce.js +1 -8
  46. package/dist/plugins/grideditor.tinymce.min.js +1 -1
  47. package/dist/plugins/grideditor.tinymce.min.js.map +3 -3
  48. package/docs/events.md +4 -6
  49. package/docs/locale-keys.md +99 -15
  50. package/docs/plugins.md +47 -23
  51. package/example/ckeditor.html +0 -5
  52. package/example/index.html +17 -2
  53. package/example/style.html +163 -0
  54. package/example/utilities.html +21 -16
  55. package/package.json +1 -1
  56. package/src/js/dom.js +1 -2
  57. package/src/js/grideditor.jquery.js +7 -28
  58. package/src/js/grideditor.js +336 -67
  59. package/src/js/locales/grideditor.es.js +80 -6
  60. package/src/js/plugins/grideditor.alignment.js +21 -50
  61. package/src/js/plugins/grideditor.ckeditor.js +10 -23
  62. package/src/js/plugins/grideditor.style.js +185 -0
  63. package/src/js/plugins/grideditor.summernote.js +4 -5
  64. package/src/js/plugins/grideditor.tinymce.js +4 -17
  65. package/src/js/style/accordion.js +168 -0
  66. package/src/js/style/catalog.js +76 -0
  67. package/src/js/style/custom.js +84 -0
  68. package/src/js/style/display.js +229 -0
  69. package/src/js/style/drawerflow.js +118 -0
  70. package/src/js/style/fields.js +382 -0
  71. package/src/js/style/flex.js +156 -0
  72. package/src/js/{plugins/grideditor.float.js → style/float.js} +6 -16
  73. package/src/js/style/options.js +60 -0
  74. package/src/js/style/sections.js +298 -0
  75. package/src/js/{plugins/grideditor.spacing.js → style/spacing.js} +7 -19
  76. package/src/js/style/sticky.js +39 -0
  77. package/src/js/{plugins/grideditor.textalign.js → style/textalign.js} +6 -14
  78. package/src/js/text/grideditor.text.js +1 -1
  79. package/src/less/grideditor.less +151 -10
  80. package/types/grideditor.d.ts +18 -0
  81. package/dist/plugins/grideditor.float.esm.js +0 -34
  82. package/dist/plugins/grideditor.float.js +0 -41
  83. package/dist/plugins/grideditor.float.min.js +0 -1
  84. package/dist/plugins/grideditor.float.min.js.map +0 -7
  85. package/dist/plugins/grideditor.spacing.esm.js +0 -318
  86. package/dist/plugins/grideditor.spacing.js +0 -323
  87. package/dist/plugins/grideditor.spacing.min.js +0 -1
  88. package/dist/plugins/grideditor.spacing.min.js.map +0 -7
  89. package/dist/plugins/grideditor.textalign.esm.js +0 -40
  90. package/dist/plugins/grideditor.textalign.js +0 -47
  91. package/dist/plugins/grideditor.textalign.min.js +0 -1
  92. package/dist/plugins/grideditor.textalign.min.js.map +0 -7
  93. package/dist/plugins/grideditor.visibility.esm.js +0 -158
  94. package/dist/plugins/grideditor.visibility.js +0 -163
  95. package/dist/plugins/grideditor.visibility.min.js +0 -1
  96. package/dist/plugins/grideditor.visibility.min.js.map +0 -7
  97. package/src/js/plugins/grideditor.visibility.js +0 -171
@@ -273,6 +273,108 @@
273
273
  color: var(--bs-secondary-color, #666);
274
274
  font-size: 0.6875rem;
275
275
  }
276
+ /* A settings panel the dialog was opened from waits under its backdrop:
277
+ Bootstrap's popover would sit over the modal */
278
+ .ge-settings-panel.ge-under-dialog {
279
+ z-index: 1040;
280
+ }
281
+ /* What plugins add to a panel, between its general fields and Responsive.
282
+ In a popover or inline, a button that opens it in the dialog. */
283
+ .ge-details .ge-panel-section {
284
+ margin-top: 10px;
285
+ }
286
+ /* The style plugin's accordion: in a panel, or in the dialog, which is
287
+ outside any panel, so it carries the look of the fields it shares. */
288
+ .ge-style {
289
+ font-size: 0.8125rem;
290
+ }
291
+ .ge-style .accordion-button {
292
+ padding: 6px 10px;
293
+ font-size: 0.8125rem;
294
+ font-weight: 500;
295
+ }
296
+ .ge-style .accordion-body {
297
+ display: flex;
298
+ flex-direction: column;
299
+ gap: 10px;
300
+ padding: 8px 10px;
301
+ }
302
+ .ge-style .ge-style-label,
303
+ .ge-style .ge-utility-label,
304
+ .ge-style .ge-style-shadow-label {
305
+ color: var(--bs-secondary-color, #6c757d);
306
+ font-size: 0.75rem;
307
+ }
308
+ .ge-style .ge-style-note,
309
+ .ge-style .ge-utility-note,
310
+ .ge-style .ge-spacing-gutter {
311
+ color: var(--bs-secondary-color, #666);
312
+ font-size: 0.6875rem;
313
+ }
314
+ .ge-style .ge-style-fields,
315
+ .ge-style .ge-spacing {
316
+ display: grid;
317
+ grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
318
+ gap: 8px 10px;
319
+ }
320
+ .ge-style .ge-style-field,
321
+ .ge-style .ge-utility,
322
+ .ge-style .ge-spacing-group {
323
+ display: flex;
324
+ flex-direction: column;
325
+ gap: 2px;
326
+ margin: 0;
327
+ }
328
+ .ge-style .ge-spacing-group .ge-utility > .ge-utility-label {
329
+ display: none;
330
+ }
331
+ .ge-style .ge-spacing-gutter {
332
+ grid-column: 1 / -1;
333
+ }
334
+ .ge-style .ge-style-color .form-control-color {
335
+ flex: 0 0 2.25rem;
336
+ padding: 2px;
337
+ }
338
+ .ge-style .ge-style-shadow,
339
+ .ge-style .ge-style-field:has(.ge-style-shadow) {
340
+ grid-column: 1 / -1;
341
+ }
342
+ .ge-style .ge-style-shadow-builder {
343
+ display: grid;
344
+ grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
345
+ gap: 4px 8px;
346
+ align-items: end;
347
+ }
348
+ .ge-style .ge-style-shadow-part {
349
+ display: flex;
350
+ flex-direction: column;
351
+ gap: 2px;
352
+ margin: 0;
353
+ }
354
+ .ge-style .ge-style-shadow-color {
355
+ grid-column: span 2;
356
+ }
357
+ .ge-style .ge-style-shadow-mode {
358
+ display: inline-block;
359
+ margin-top: 2px;
360
+ font-size: 0.6875rem;
361
+ }
362
+ .ge-style .ge-style-catalog {
363
+ display: flex;
364
+ flex-direction: column;
365
+ gap: 4px;
366
+ }
367
+ .ge-style .ge-style-chips {
368
+ display: flex;
369
+ flex-wrap: wrap;
370
+ gap: 3px;
371
+ }
372
+ .ge-style .ge-style-chip {
373
+ --bs-btn-padding-y: 0;
374
+ --bs-btn-padding-x: 6px;
375
+ --bs-btn-font-size: 0.6875rem;
376
+ font-family: var(--bs-font-monospace, monospace);
377
+ }
276
378
  /* In a drawer it is part of the drawer, compact */
277
379
  .ge-tools-drawer > .ge-details {
278
380
  font-size: 11px;
@@ -299,6 +401,13 @@
299
401
  --bs-popover-max-width: 360px;
300
402
  width: 360px;
301
403
  max-width: calc(100vw - 16px);
404
+ /* Bootstrap's css leaves the arrow's position to Popper, which puts it on
405
+ as an inline style. Without it the arrow stays in the flow, a strip as
406
+ tall as the arrow above the header; out of it, the top or bottom of
407
+ .bs-popover-bottom and .bs-popover-top hang it outside the edge */
408
+ }
409
+ .ge-settings-popover > .popover-arrow {
410
+ position: absolute;
302
411
  }
303
412
  .ge-settings-popover > .popover-header {
304
413
  display: flex;
@@ -4481,20 +4590,35 @@
4481
4590
  margin-left: 91.66666667%;
4482
4591
  }
4483
4592
  /*
4484
- * The visibility plugin. A node Bootstrap would hide is kept on the canvas -
4485
- * there would be nothing left to click to show it again - and shown the way
4486
- * the view sees it instead. The selectors outweigh Bootstrap's d-* classes,
4487
- * which are !important too.
4593
+ * The style plugin's display. A node Bootstrap would hide is kept on the
4594
+ * canvas - there would be nothing left to click to show it again - and shown
4595
+ * as it would be if it were not hidden, which data-ge-display says. The
4596
+ * selectors outweigh Bootstrap's d-* classes, which are !important too.
4488
4597
  */
4489
4598
  .ge-canvas.ge-editing {
4490
4599
  /* The all view: hidden at some breakpoints, said in a corner */
4491
4600
  }
4492
- .ge-canvas.ge-editing .ge-visibility {
4601
+ .ge-canvas.ge-editing [data-ge-display="inline"] {
4602
+ display: inline !important;
4603
+ }
4604
+ .ge-canvas.ge-editing [data-ge-display="inline-block"] {
4605
+ display: inline-block !important;
4606
+ }
4607
+ .ge-canvas.ge-editing [data-ge-display="block"] {
4493
4608
  display: block !important;
4494
4609
  }
4495
- .ge-canvas.ge-editing .row.ge-visibility {
4610
+ .ge-canvas.ge-editing [data-ge-display="grid"] {
4611
+ display: grid !important;
4612
+ }
4613
+ .ge-canvas.ge-editing [data-ge-display="inline-grid"] {
4614
+ display: inline-grid !important;
4615
+ }
4616
+ .ge-canvas.ge-editing [data-ge-display="flex"] {
4496
4617
  display: flex !important;
4497
4618
  }
4619
+ .ge-canvas.ge-editing [data-ge-display="inline-flex"] {
4620
+ display: inline-flex !important;
4621
+ }
4498
4622
  .ge-canvas.ge-editing .ge-hidden-in-view {
4499
4623
  opacity: 0.45;
4500
4624
  background-image: repeating-linear-gradient(-45deg, transparent 0, transparent 6px, rgba(0, 0, 0, 0.07) 6px, rgba(0, 0, 0, 0.07) 12px);
@@ -4516,6 +4640,25 @@
4516
4640
  line-height: 16px;
4517
4641
  pointer-events: none;
4518
4642
  }
4643
+ /*
4644
+ * The style plugin's drawer on a flex or grid node: out of the flow, on top
4645
+ * and as wide as the node, over a transparent top border as tall as it is.
4646
+ * The border's width comes with the node's data-ge-drawer-out, from a rule
4647
+ * per height the plugin writes. The selectors outweigh Bootstrap's border
4648
+ * classes and the drawer's own margins, which the spacing part sets inline.
4649
+ */
4650
+ .ge-canvas.ge-editing .ge-drawer-out {
4651
+ position: relative;
4652
+ border-top-style: solid !important;
4653
+ border-top-color: transparent !important;
4654
+ }
4655
+ .ge-canvas.ge-editing .ge-drawer-out > .ge-tools-drawer {
4656
+ position: absolute;
4657
+ left: 0;
4658
+ right: 0;
4659
+ width: auto !important;
4660
+ margin: 0 !important;
4661
+ }
4519
4662
  /* The order plugin: a column ordered by class in this view says where */
4520
4663
  .ge-canvas.ge-editing .column[data-ge-order]::before {
4521
4664
  content: attr(data-ge-order);
@@ -53,6 +53,22 @@ export interface PresetClass {
53
53
  }
54
54
 
55
55
  /** A content filter: run on init and deinit with the canvas. A string names a function on window. */
56
+ /** A section of the style plugin's accordion. */
57
+ export type StyleSectionKey = 'size' | 'spacing' | 'border' | 'background' | 'text' | 'typography' | 'display' | 'flex' | 'position' | 'custom';
58
+
59
+ /** A section on or off, or on with some of its properties and without its catalog. */
60
+ export type StyleSection = boolean | { properties?: string[]; catalog?: boolean };
61
+
62
+ /** The style plugin's settings. */
63
+ export interface StyleOptions {
64
+ /** Every section is on unless it is turned off here. */
65
+ sections?: Partial<Record<StyleSectionKey, StyleSection>>;
66
+ /** The spacing section: the values offered, and what 0 to 5 come to - for the gaps too. */
67
+ spacing?: { values?: string[]; scale?: string[] };
68
+ /** The eye that hides and shows a node, the display family's: false leaves it out of the drawers. */
69
+ visibility?: { drawer?: boolean };
70
+ }
71
+
56
72
  export type CustomFilter = ((canvas: HTMLElement, isInit: boolean) => void) | string;
57
73
 
58
74
  /** The settings. Every one is optional. */
@@ -79,6 +95,8 @@ export interface GridEditorOptions {
79
95
  content_types?: string[];
80
96
  row_cols?: boolean;
81
97
  utilities?: Record<string, unknown>;
98
+ /** The style plugin's sections, and the options of the utilities it carries. */
99
+ style?: StyleOptions;
82
100
  elements?: { enabled?: boolean | 'auto'; selector?: string; auto?: boolean };
83
101
  custom_filter?: CustomFilter | CustomFilter[] | '';
84
102
  valid_col_sizes?: ColumnSize[];