@themarioga/grid-editor 9.0.0-beta.3 → 9.0.0-beta.4

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 (36) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +24 -8
  3. package/dist/grideditor.bundle.min.js +2 -2
  4. package/dist/grideditor.css +187 -0
  5. package/dist/grideditor.d.ts +37 -0
  6. package/dist/grideditor.esm.js +6 -10
  7. package/dist/grideditor.js +6 -10
  8. package/dist/grideditor.min.css +1 -1
  9. package/dist/grideditor.min.css.map +1 -1
  10. package/dist/grideditor.min.js +1 -1
  11. package/dist/grideditor.min.js.map +3 -3
  12. package/dist/locales/grideditor.es.esm.js +20 -0
  13. package/dist/locales/grideditor.es.js +20 -0
  14. package/dist/locales/grideditor.es.min.js +2 -2
  15. package/dist/locales/grideditor.es.min.js.map +2 -2
  16. package/dist/plugins/grideditor.offcanvas.esm.js +551 -0
  17. package/dist/plugins/grideditor.offcanvas.js +556 -0
  18. package/dist/plugins/grideditor.offcanvas.min.js +1 -0
  19. package/dist/plugins/grideditor.offcanvas.min.js.map +7 -0
  20. package/dist/plugins/grideditor.popup.esm.js +90 -37
  21. package/dist/plugins/grideditor.popup.js +90 -37
  22. package/dist/plugins/grideditor.popup.min.js +1 -1
  23. package/dist/plugins/grideditor.popup.min.js.map +4 -4
  24. package/docs/events.md +4 -3
  25. package/docs/locale-keys.md +21 -1
  26. package/docs/plugins.md +11 -4
  27. package/example/containers.html +22 -4
  28. package/example/index.html +1 -1
  29. package/package.json +1 -1
  30. package/src/js/grideditor.js +7 -8
  31. package/src/js/locales/grideditor.es.js +20 -0
  32. package/src/js/plugins/grideditor.offcanvas.js +420 -0
  33. package/src/js/plugins/grideditor.popup.js +8 -70
  34. package/src/js/triggers/triggers.js +121 -0
  35. package/src/less/grideditor.less +60 -0
  36. package/types/grideditor.d.ts +37 -0
@@ -1040,6 +1040,66 @@ html.ge-sidebar-open {
1040
1040
  }
1041
1041
  }
1042
1042
 
1043
+ /* An offcanvas is rendered unfolded and in place too: a plain block with
1044
+ its body as an ordinary region, whichever edge it comes from on the
1045
+ page. Bootstrap fixes it to the window, hides it and shifts it out
1046
+ until its own JS adds .show, which the editor never asks for, so what
1047
+ it sets is undone here. The responsive classes hide the header and
1048
+ the body's padding from their breakpoint up, where the panel is
1049
+ content: the title still has to be there to edit */
1050
+ @ge-offcanvases: offcanvas, offcanvas-sm, offcanvas-md, offcanvas-lg, offcanvas-xl, offcanvas-xxl;
1051
+
1052
+ .ge-container-offcanvas {
1053
+ each(@ge-offcanvases, {
1054
+ .@{value} {
1055
+ position: static;
1056
+ z-index: auto;
1057
+ visibility: visible;
1058
+ width: auto;
1059
+ height: auto;
1060
+ max-width: none;
1061
+ max-height: none;
1062
+ margin: @editGutter 0;
1063
+ transform: none;
1064
+ transition: none;
1065
+ display: flex;
1066
+ flex-direction: column;
1067
+ background-color: var(--bs-offcanvas-bg) !important;
1068
+ border: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);
1069
+
1070
+ .offcanvas-header {
1071
+ display: flex;
1072
+ }
1073
+ .offcanvas-body {
1074
+ display: block;
1075
+ flex-grow: 1;
1076
+ padding: var(--bs-offcanvas-padding-y) var(--bs-offcanvas-padding-x);
1077
+ overflow: visible;
1078
+ }
1079
+ }
1080
+ });
1081
+
1082
+ /* d-*-none on the trigger is for the page: the editor needs it to select the container */
1083
+ > .ge-offcanvas-trigger {
1084
+ display: inline-block !important;
1085
+ margin-bottom: @editGutter;
1086
+ }
1087
+
1088
+ /* Folded away, for a page with several offcanvases on it */
1089
+ &.ge-offcanvas-collapsed {
1090
+ each(@ge-offcanvases, {
1091
+ .@{value} {
1092
+ display: none;
1093
+ }
1094
+ });
1095
+ }
1096
+ }
1097
+
1098
+ /* A trigger pointing at an offcanvas that is not there any more */
1099
+ .ge-offcanvas-orphan {
1100
+ outline: 2px dashed #d9534f;
1101
+ }
1102
+
1043
1103
  /* A trigger pointing at a popup that is not there any more */
1044
1104
  .ge-popup-orphan {
1045
1105
  outline: 2px dashed #d9534f;
@@ -111,6 +111,35 @@ export interface CarouselOptions {
111
111
  /** createContainer('carousel', …): the options, and how many slides. */
112
112
  export interface CreateCarouselOptions extends Placement, CarouselOptions {}
113
113
 
114
+ /**
115
+ * The offcanvas plugin's options, the ones an offcanvas made new has, as the
116
+ * offcanvas setting gives them and createContainer overrides them: where it
117
+ * comes from, its backdrop, whether the page scrolls behind it, Esc, the
118
+ * breakpoint from which it is content and not a panel, and the dark theme.
119
+ */
120
+ export interface OffcanvasOptions {
121
+ /** The edge it slides in from. Default `'start'`. */
122
+ placement?: 'start' | 'end' | 'top' | 'bottom';
123
+ /** A backdrop behind it: `true`, `false`, or `'static'`, which does not close it on a click. Default true. */
124
+ backdrop?: boolean | 'static';
125
+ /** The page can scroll while it is open. Default false. */
126
+ scroll?: boolean;
127
+ /** Esc closes it. Default true. */
128
+ keyboard?: boolean;
129
+ /** From this breakpoint up it is content in the page, and its trigger is hidden; null is a panel at every size. Default null. */
130
+ responsive?: 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | null;
131
+ /** `data-bs-theme="dark"`. Default false. */
132
+ dark?: boolean;
133
+ }
134
+
135
+ /** createContainer('offcanvas', …): the options, its title and its trigger. */
136
+ export interface CreateOffcanvasOptions extends Placement, OffcanvasOptions {
137
+ title?: string;
138
+ /** false makes none, for a trigger the page writes itself. Default true. */
139
+ trigger?: boolean;
140
+ trigger_label?: string;
141
+ }
142
+
114
143
  /** The inline-style plugin's settings. */
115
144
  export interface InlineStyleOptions {
116
145
  /** Every section is on unless it is turned off here. */
@@ -175,6 +204,8 @@ export interface GridEditorOptions {
175
204
  tabs?: TabsOptions;
176
205
  /** The carousel plugin: the options of the carousels made new. */
177
206
  carousel?: CarouselOptions;
207
+ /** The offcanvas plugin: the options of the offcanvases made new. */
208
+ offcanvas?: OffcanvasOptions;
178
209
  elements?: { enabled?: boolean | 'auto'; selector?: string; auto?: boolean; types?: ElementType[] };
179
210
  /** The autosave plugin: what is edited, kept in the browser's storage as it changes. */
180
211
  autosave?: AutosaveOptions;
@@ -347,6 +378,10 @@ export interface PopupOrphanPayload extends Payload {
347
378
  missing: string;
348
379
  }
349
380
 
381
+ export interface OffcanvasOrphanPayload extends Payload {
382
+ missing: string;
383
+ }
384
+
350
385
  export interface ViewChangePayload {
351
386
  canvas: HTMLElement;
352
387
  breakpoint: View;
@@ -406,6 +441,7 @@ export interface GridEditorEventMap {
406
441
  'grideditor:after-edit-html': EditHtmlPayload;
407
442
  'grideditor:after-copy': Payload;
408
443
  'grideditor:popup-orphan': PopupOrphanPayload;
444
+ 'grideditor:offcanvas-orphan': OffcanvasOrphanPayload;
409
445
  'grideditor:view-change': ViewChangePayload;
410
446
  'grideditor:target-change': TargetChangePayload;
411
447
  'grideditor:selection-change': SelectionChangePayload;
@@ -537,6 +573,7 @@ export declare class GridEditor {
537
573
  createSection(options?: CreateSectionOptions): HTMLElement | null;
538
574
  createContainer(type: 'tabs', options?: CreateTabsOptions): HTMLElement | null;
539
575
  createContainer(type: 'carousel', options?: CreateCarouselOptions): HTMLElement | null;
576
+ createContainer(type: 'offcanvas', options?: CreateOffcanvasOptions): HTMLElement | null;
540
577
  createContainer(type: string, options?: Placement & Record<string, unknown>): HTMLElement | null;
541
578
  addTab(container: Target, options?: PaneOptions): HTMLElement | null;
542
579
  addAccordionItem(container: Target, options?: PaneOptions): HTMLElement | null;