@themarioga/grid-editor 8.0.0-beta.2 → 8.0.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 (55) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +16 -9
  3. package/UPGRADING.md +21 -11
  4. package/dist/grideditor.bundle.min.js +3 -3
  5. package/dist/grideditor.css +77 -35
  6. package/dist/grideditor.d.ts +29 -8
  7. package/dist/grideditor.esm.js +7 -1
  8. package/dist/grideditor.js +7 -1
  9. package/dist/grideditor.min.css +1 -1
  10. package/dist/grideditor.min.css.map +1 -1
  11. package/dist/grideditor.min.js +2 -2
  12. package/dist/grideditor.min.js.map +3 -3
  13. package/dist/locales/grideditor.es.esm.js +86 -68
  14. package/dist/locales/grideditor.es.js +86 -68
  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.alignment.min.js.map +1 -1
  18. package/dist/plugins/{grideditor.style.esm.js → grideditor.inline-style.esm.js} +184 -184
  19. package/dist/plugins/{grideditor.style.js → grideditor.inline-style.js} +182 -182
  20. package/dist/plugins/grideditor.inline-style.min.js +4 -0
  21. package/dist/plugins/grideditor.inline-style.min.js.map +7 -0
  22. package/dist/plugins/grideditor.tabs.esm.js +274 -6
  23. package/dist/plugins/grideditor.tabs.js +274 -6
  24. package/dist/plugins/grideditor.tabs.min.js +1 -1
  25. package/dist/plugins/grideditor.tabs.min.js.map +3 -3
  26. package/docs/locale-keys.md +97 -79
  27. package/docs/plugins.md +5 -5
  28. package/example/containers.html +64 -2
  29. package/example/index.html +6 -6
  30. package/example/{style.html → inline-style.html} +5 -5
  31. package/example/utilities.html +3 -3
  32. package/package.json +1 -1
  33. package/src/js/grideditor.js +8 -0
  34. package/src/js/{style → inline-style}/accordion.js +9 -9
  35. package/src/js/{style → inline-style}/catalog.js +6 -6
  36. package/src/js/{style → inline-style}/custom.js +4 -4
  37. package/src/js/{style → inline-style}/display.js +2 -2
  38. package/src/js/{style → inline-style}/drawerflow.js +1 -1
  39. package/src/js/{style → inline-style}/fields.js +25 -25
  40. package/src/js/{style → inline-style}/flex.js +2 -2
  41. package/src/js/{style → inline-style}/float.js +2 -2
  42. package/src/js/{style → inline-style}/options.js +5 -5
  43. package/src/js/{style → inline-style}/sections.js +50 -50
  44. package/src/js/{style → inline-style}/spacing.js +2 -2
  45. package/src/js/{style → inline-style}/sticky.js +2 -2
  46. package/src/js/{style → inline-style}/textalign.js +2 -2
  47. package/src/js/locales/grideditor.es.js +86 -68
  48. package/src/js/plugins/grideditor.alignment.js +1 -1
  49. package/src/js/plugins/grideditor.inline-style.js +185 -0
  50. package/src/js/plugins/grideditor.tabs.js +311 -5
  51. package/src/less/grideditor.less +71 -25
  52. package/types/grideditor.d.ts +29 -8
  53. package/dist/plugins/grideditor.style.min.js +0 -4
  54. package/dist/plugins/grideditor.style.min.js.map +0 -7
  55. package/src/js/plugins/grideditor.style.js +0 -185
@@ -194,6 +194,8 @@
194
194
  btn-outline-secondary - and this only lays them out. */
195
195
  .ge-details {
196
196
  font-size: 0.8125rem;
197
+ /* Each section's heading: the general fields, and what plugins add */
198
+ /* Every section after the first, set off from the one above */
197
199
  /* The utility plugins' fields, folded under one toggle */
198
200
  }
199
201
  .ge-details .ge-details-general {
@@ -201,6 +203,17 @@
201
203
  flex-direction: column;
202
204
  gap: 8px;
203
205
  }
206
+ .ge-details .ge-section-title {
207
+ margin: 0 0 6px;
208
+ color: var(--bs-body-color, #333);
209
+ font-size: 0.8125rem;
210
+ font-weight: 600;
211
+ }
212
+ .ge-details .ge-panel-section,
213
+ .ge-details .ge-utilities {
214
+ padding-top: 10px;
215
+ border-top: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.1));
216
+ }
204
217
  .ge-details .ge-field {
205
218
  display: flex;
206
219
  flex-direction: column;
@@ -222,7 +235,7 @@
222
235
  .ge-details .ge-utilities > .ge-utilities-toggle {
223
236
  display: block;
224
237
  color: var(--bs-body-color, #333);
225
- font-weight: 500;
238
+ font-weight: 600;
226
239
  cursor: pointer;
227
240
  text-decoration: none;
228
241
  }
@@ -283,93 +296,93 @@
283
296
  .ge-details .ge-panel-section {
284
297
  margin-top: 10px;
285
298
  }
286
- /* The style plugin's accordion: in a panel, or in the dialog, which is
299
+ /* The inline-style plugin's accordion: in a panel, or in the dialog, which is
287
300
  outside any panel, so it carries the look of the fields it shares. */
288
- .ge-style {
301
+ .ge-inline-style {
289
302
  font-size: 0.8125rem;
290
303
  }
291
- .ge-style .accordion-button {
304
+ .ge-inline-style .accordion-button {
292
305
  padding: 6px 10px;
293
306
  font-size: 0.8125rem;
294
307
  font-weight: 500;
295
308
  }
296
- .ge-style .accordion-body {
309
+ .ge-inline-style .accordion-body {
297
310
  display: flex;
298
311
  flex-direction: column;
299
312
  gap: 10px;
300
313
  padding: 8px 10px;
301
314
  }
302
- .ge-style .ge-style-label,
303
- .ge-style .ge-utility-label,
304
- .ge-style .ge-style-shadow-label {
315
+ .ge-inline-style .ge-inline-style-label,
316
+ .ge-inline-style .ge-utility-label,
317
+ .ge-inline-style .ge-inline-style-shadow-label {
305
318
  color: var(--bs-secondary-color, #6c757d);
306
319
  font-size: 0.75rem;
307
320
  }
308
- .ge-style .ge-style-note,
309
- .ge-style .ge-utility-note,
310
- .ge-style .ge-spacing-gutter {
321
+ .ge-inline-style .ge-inline-style-note,
322
+ .ge-inline-style .ge-utility-note,
323
+ .ge-inline-style .ge-spacing-gutter {
311
324
  color: var(--bs-secondary-color, #666);
312
325
  font-size: 0.6875rem;
313
326
  }
314
- .ge-style .ge-style-fields,
315
- .ge-style .ge-spacing {
327
+ .ge-inline-style .ge-inline-style-fields,
328
+ .ge-inline-style .ge-spacing {
316
329
  display: grid;
317
330
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
318
331
  gap: 8px 10px;
319
332
  }
320
- .ge-style .ge-style-field,
321
- .ge-style .ge-utility,
322
- .ge-style .ge-spacing-group {
333
+ .ge-inline-style .ge-inline-style-field,
334
+ .ge-inline-style .ge-utility,
335
+ .ge-inline-style .ge-spacing-group {
323
336
  display: flex;
324
337
  flex-direction: column;
325
338
  gap: 2px;
326
339
  margin: 0;
327
340
  }
328
- .ge-style .ge-spacing-group .ge-utility > .ge-utility-label {
341
+ .ge-inline-style .ge-spacing-group .ge-utility > .ge-utility-label {
329
342
  display: none;
330
343
  }
331
- .ge-style .ge-spacing-gutter {
344
+ .ge-inline-style .ge-spacing-gutter {
332
345
  grid-column: 1 / -1;
333
346
  }
334
- .ge-style .ge-style-color .form-control-color {
347
+ .ge-inline-style .ge-inline-style-color .form-control-color {
335
348
  flex: 0 0 2.25rem;
336
349
  padding: 2px;
337
350
  }
338
- .ge-style .ge-style-shadow,
339
- .ge-style .ge-style-field:has(.ge-style-shadow) {
351
+ .ge-inline-style .ge-inline-style-shadow,
352
+ .ge-inline-style .ge-inline-style-field:has(.ge-inline-style-shadow) {
340
353
  grid-column: 1 / -1;
341
354
  }
342
- .ge-style .ge-style-shadow-builder {
355
+ .ge-inline-style .ge-inline-style-shadow-builder {
343
356
  display: grid;
344
357
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
345
358
  gap: 4px 8px;
346
359
  align-items: end;
347
360
  }
348
- .ge-style .ge-style-shadow-part {
361
+ .ge-inline-style .ge-inline-style-shadow-part {
349
362
  display: flex;
350
363
  flex-direction: column;
351
364
  gap: 2px;
352
365
  margin: 0;
353
366
  }
354
- .ge-style .ge-style-shadow-color {
367
+ .ge-inline-style .ge-inline-style-shadow-color {
355
368
  grid-column: span 2;
356
369
  }
357
- .ge-style .ge-style-shadow-mode {
370
+ .ge-inline-style .ge-inline-style-shadow-mode {
358
371
  display: inline-block;
359
372
  margin-top: 2px;
360
373
  font-size: 0.6875rem;
361
374
  }
362
- .ge-style .ge-style-catalog {
375
+ .ge-inline-style .ge-inline-style-catalog {
363
376
  display: flex;
364
377
  flex-direction: column;
365
378
  gap: 4px;
366
379
  }
367
- .ge-style .ge-style-chips {
380
+ .ge-inline-style .ge-inline-style-chips {
368
381
  display: flex;
369
382
  flex-wrap: wrap;
370
383
  gap: 3px;
371
384
  }
372
- .ge-style .ge-style-chip {
385
+ .ge-inline-style .ge-inline-style-chip {
373
386
  --bs-btn-padding-y: 0;
374
387
  --bs-btn-padding-x: 6px;
375
388
  --bs-btn-font-size: 0.6875rem;
@@ -437,6 +450,12 @@
437
450
  beside the content areas, and each of its panes is an ordinary region */
438
451
  /* A pane's own drawer is small and sits with its label rather than
439
452
  above it: a tab strip is a row of tabs, not a stack of them */
453
+ /* A tabs container laid out vertically from a breakpoint: Bootstrap's
454
+ classes answer to the window, and a breakpoint view narrows the canvas
455
+ instead, so the tabs plugin says which layout the view has and that is
456
+ what shows. The selectors outweigh Bootstrap's !important utilities.
457
+ Vertical, the container wraps, so its drawer is a line of its own
458
+ above the strip and the panes */
440
459
  /* The label is edited in place, so it needs to look like it can be */
441
460
  /* Open and closed while editing is what the page will ship, which is what
442
461
  data-ge-open says. Bootstrap's own collapse is not involved: its
@@ -477,7 +496,6 @@
477
496
  -moz-user-select: none;
478
497
  -ms-user-select: none;
479
498
  user-select: none;
480
- background: blue;
481
499
  margin: 0 -5px 5px;
482
500
  display: block;
483
501
  width: calc(100% + 2 * 5px);
@@ -502,6 +520,10 @@
502
520
  border-top: 1px solid rgba(0, 0, 0, 0.05);
503
521
  text-align: left;
504
522
  cursor: auto;
523
+ /* The one line a drawer has room for needs no heading */
524
+ }
525
+ .ge-canvas.ge-editing .ge-tools-drawer > .ge-details > .ge-section-title {
526
+ display: none;
505
527
  }
506
528
  .ge-canvas.ge-editing .ge-tools-drawer > .ge-details .ge-details-general {
507
529
  flex-direction: row;
@@ -522,6 +544,11 @@
522
544
  margin-right: 0;
523
545
  }
524
546
  .ge-canvas.ge-editing .row > .ge-tools-drawer {
547
+ /* Bootstrap pads every child of a row by half its gutter, and
548
+ caps it at the row's width: the drawer is not a column */
549
+ padding-left: 0;
550
+ padding-right: 0;
551
+ max-width: none;
525
552
  background: #e5e5e5;
526
553
  }
527
554
  .ge-canvas.ge-editing .row > .ge-tools-drawer > a {
@@ -639,6 +666,25 @@
639
666
  .ge-canvas.ge-editing .ge-tab .nav-link {
640
667
  padding-left: 4px;
641
668
  }
669
+ .ge-canvas.ge-editing [data-ge-tabs-layout="vertical"] {
670
+ display: flex !important;
671
+ flex-wrap: wrap;
672
+ align-items: flex-start !important;
673
+ }
674
+ .ge-canvas.ge-editing [data-ge-tabs-layout="vertical"] > .ge-container-drawer {
675
+ flex-shrink: 0;
676
+ }
677
+ .ge-canvas.ge-editing [data-ge-tabs-layout="vertical"] > .nav {
678
+ flex-direction: column !important;
679
+ margin-right: 1rem !important;
680
+ }
681
+ .ge-canvas.ge-editing [data-ge-tabs-layout="horizontal"] {
682
+ display: block !important;
683
+ }
684
+ .ge-canvas.ge-editing [data-ge-tabs-layout="horizontal"] > .nav {
685
+ flex-direction: row !important;
686
+ margin-right: 0 !important;
687
+ }
642
688
  .ge-canvas.ge-editing .ge-pane-label:hover {
643
689
  outline: 1px dotted #197550;
644
690
  }
@@ -4590,7 +4636,7 @@
4590
4636
  margin-left: 91.66666667%;
4591
4637
  }
4592
4638
  /*
4593
- * The style plugin's display. A node Bootstrap would hide is kept on the
4639
+ * The inline-style plugin's display. A node Bootstrap would hide is kept on the
4594
4640
  * canvas - there would be nothing left to click to show it again - and shown
4595
4641
  * as it would be if it were not hidden, which data-ge-display says. The
4596
4642
  * selectors outweigh Bootstrap's d-* classes, which are !important too.
@@ -4641,7 +4687,7 @@
4641
4687
  pointer-events: none;
4642
4688
  }
4643
4689
  /*
4644
- * The style plugin's drawer on a flex or grid node: out of the flow, on top
4690
+ * The inline-style plugin's drawer on a flex or grid node: out of the flow, on top
4645
4691
  * and as wide as the node, over a transparent top border as tall as it is.
4646
4692
  * The border's width comes with the node's data-ge-drawer-out, from a rule
4647
4693
  * per height the plugin writes. The selectors outweigh Bootstrap's border
@@ -4688,10 +4734,6 @@
4688
4734
  .ge-canvas.ge-editing .row.ge-gutters > .ge-tools-drawer {
4689
4735
  margin-top: 0;
4690
4736
  margin-bottom: calc(5px - var(--bs-gutter-y));
4691
- /* Bootstrap pads every child of a row by half its gutter, the drawer
4692
- too; it keeps the padding a row with no gutter class gives it */
4693
- padding-left: 0.75rem;
4694
- padding-right: 0.75rem;
4695
4737
  }
4696
4738
  .ge-canvas.ge-editing .row.ge-gutters > .column {
4697
4739
  padding-left: calc(var(--bs-gutter-x) * 0.5);
@@ -53,16 +53,34 @@ 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';
56
+ /** A section of the inline-style plugin's accordion. */
57
+ export type InlineStyleSectionKey = 'size' | 'spacing' | 'border' | 'background' | 'text' | 'typography' | 'display' | 'flex' | 'position' | 'custom';
58
58
 
59
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 };
60
+ export type InlineStyleSection = boolean | { properties?: string[]; catalog?: boolean };
61
61
 
62
- /** The style plugin's settings. */
63
- export interface StyleOptions {
62
+ /**
63
+ * A tabs container's variant: its strip's style, width and alignment, and
64
+ * whether it is laid out vertically - always, or from a breakpoint up.
65
+ */
66
+ export interface TabsOptions {
67
+ variant?: 'tabs' | 'pills' | 'underline';
68
+ width?: 'natural' | 'fill' | 'justified';
69
+ /** Only with the natural width, and horizontal. */
70
+ align?: 'start' | 'center' | 'end';
71
+ vertical?: boolean | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
72
+ }
73
+
74
+ /** createContainer('tabs', …): how many tabs, their labels, and the variant. */
75
+ export interface CreateTabsOptions extends Placement, TabsOptions {
76
+ tabs?: number;
77
+ labels?: string[];
78
+ }
79
+
80
+ /** The inline-style plugin's settings. */
81
+ export interface InlineStyleOptions {
64
82
  /** Every section is on unless it is turned off here. */
65
- sections?: Partial<Record<StyleSectionKey, StyleSection>>;
83
+ sections?: Partial<Record<InlineStyleSectionKey, InlineStyleSection>>;
66
84
  /** The spacing section: the values offered, and what 0 to 5 come to - for the gaps too. */
67
85
  spacing?: { values?: string[]; scale?: string[] };
68
86
  /** The eye that hides and shows a node, the display family's: false leaves it out of the drawers. */
@@ -95,8 +113,10 @@ export interface GridEditorOptions {
95
113
  content_types?: string[];
96
114
  row_cols?: boolean;
97
115
  utilities?: Record<string, unknown>;
98
- /** The style plugin's sections, and the options of the utilities it carries. */
99
- style?: StyleOptions;
116
+ /** The inline-style plugin's sections, and the options of the utilities it carries. */
117
+ inline_style?: InlineStyleOptions;
118
+ /** The tabs plugin: the variant of the tabs containers made new. */
119
+ tabs?: TabsOptions;
100
120
  elements?: { enabled?: boolean | 'auto'; selector?: string; auto?: boolean };
101
121
  custom_filter?: CustomFilter | CustomFilter[] | '';
102
122
  valid_col_sizes?: ColumnSize[];
@@ -328,6 +348,7 @@ export declare class GridEditor {
328
348
  createText(options: CreateTextOptions): HTMLElement | null;
329
349
  createElement(content: string | Node | ArrayLike<Node>, options?: CreateElementOptions): HTMLElement | null;
330
350
  createSection(options?: CreateSectionOptions): HTMLElement | null;
351
+ createContainer(type: 'tabs', options?: CreateTabsOptions): HTMLElement | null;
331
352
  createContainer(type: string, options?: Placement & Record<string, unknown>): HTMLElement | null;
332
353
  addTab(container: Target, options?: PaneOptions): HTMLElement | null;
333
354
  addAccordionItem(container: Target, options?: PaneOptions): HTMLElement | null;
@@ -2692,6 +2692,7 @@ function build(instance, baseElem, optionsOrMethod) {
2692
2692
  }
2693
2693
  function createDetails(container, cssClasses) {
2694
2694
  var detailsDiv = element("div", { "class": "ge-details" });
2695
+ detailsDiv.appendChild(sectionTitle(t("panel.section_general")));
2695
2696
  var general = detailsDiv.appendChild(element("div", { "class": "ge-details-general" }));
2696
2697
  var field = function(label) {
2697
2698
  var holder = element("label", { "class": "ge-field" });
@@ -2751,6 +2752,9 @@ function build(instance, baseElem, optionsOrMethod) {
2751
2752
  }
2752
2753
  return detailsDiv;
2753
2754
  }
2755
+ function sectionTitle(text) {
2756
+ return element("h6", { "class": "ge-section-title" }, text);
2757
+ }
2754
2758
  function pluginSections(node) {
2755
2759
  var kind = kindOf(node);
2756
2760
  var mode = panelMode();
@@ -2764,6 +2768,7 @@ function build(instance, baseElem, optionsOrMethod) {
2764
2768
  }
2765
2769
  var holder = element("div", { "class": "ge-panel-section", "data-ge-plugin": name });
2766
2770
  if (mode === "offcanvas" || mode === "modal") {
2771
+ holder.appendChild(sectionTitle(t(section.labelKey)));
2767
2772
  holder.appendChild(section.body);
2768
2773
  } else {
2769
2774
  var label = t(section.labelKey);
@@ -4100,7 +4105,7 @@ GridEditor.t = translate;
4100
4105
  GridEditor._plainHtml = plainHtml;
4101
4106
  GridEditor.Sortable = null;
4102
4107
  GridEditor.bootstrap = null;
4103
- GridEditor.version = false ? "dev" : "8.0.0-beta.2";
4108
+ GridEditor.version = false ? "dev" : "8.0.0";
4104
4109
  GridEditor.locales = {
4105
4110
  en: {
4106
4111
  "tool.move": "Move",
@@ -4130,6 +4135,7 @@ GridEditor.locales = {
4130
4135
  "panel.done": "Done",
4131
4136
  "panel.id": "Id",
4132
4137
  "panel.classes": "Classes",
4138
+ "panel.section_general": "Id and classes",
4133
4139
  "panel.kind_row": "Row",
4134
4140
  "panel.kind_column": "Column",
4135
4141
  "panel.kind_element": "Element",
@@ -2693,6 +2693,7 @@
2693
2693
  }
2694
2694
  function createDetails(container, cssClasses) {
2695
2695
  var detailsDiv = element("div", { "class": "ge-details" });
2696
+ detailsDiv.appendChild(sectionTitle(t("panel.section_general")));
2696
2697
  var general = detailsDiv.appendChild(element("div", { "class": "ge-details-general" }));
2697
2698
  var field = function(label) {
2698
2699
  var holder = element("label", { "class": "ge-field" });
@@ -2752,6 +2753,9 @@
2752
2753
  }
2753
2754
  return detailsDiv;
2754
2755
  }
2756
+ function sectionTitle(text) {
2757
+ return element("h6", { "class": "ge-section-title" }, text);
2758
+ }
2755
2759
  function pluginSections(node) {
2756
2760
  var kind = kindOf(node);
2757
2761
  var mode = panelMode();
@@ -2765,6 +2769,7 @@
2765
2769
  }
2766
2770
  var holder = element("div", { "class": "ge-panel-section", "data-ge-plugin": name });
2767
2771
  if (mode === "offcanvas" || mode === "modal") {
2772
+ holder.appendChild(sectionTitle(t(section.labelKey)));
2768
2773
  holder.appendChild(section.body);
2769
2774
  } else {
2770
2775
  var label = t(section.labelKey);
@@ -4101,7 +4106,7 @@
4101
4106
  GridEditor._plainHtml = plainHtml;
4102
4107
  GridEditor.Sortable = null;
4103
4108
  GridEditor.bootstrap = null;
4104
- GridEditor.version = false ? "dev" : "8.0.0-beta.2";
4109
+ GridEditor.version = false ? "dev" : "8.0.0";
4105
4110
  GridEditor.locales = {
4106
4111
  en: {
4107
4112
  "tool.move": "Move",
@@ -4131,6 +4136,7 @@
4131
4136
  "panel.done": "Done",
4132
4137
  "panel.id": "Id",
4133
4138
  "panel.classes": "Classes",
4139
+ "panel.section_general": "Id and classes",
4134
4140
  "panel.kind_row": "Row",
4135
4141
  "panel.kind_column": "Column",
4136
4142
  "panel.kind_element": "Element",