@themarioga/grid-editor 9.2.6 → 9.4.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 (51) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +109 -5
  3. package/dist/grideditor.bundle.min.js +2 -2
  4. package/dist/grideditor.css +329 -0
  5. package/dist/grideditor.d.ts +125 -0
  6. package/dist/grideditor.esm.js +27 -5
  7. package/dist/grideditor.js +27 -5
  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 +125 -0
  13. package/dist/locales/grideditor.es.js +125 -0
  14. package/dist/locales/grideditor.es.min.js +1 -1
  15. package/dist/locales/grideditor.es.min.js.map +2 -2
  16. package/dist/plugins/grideditor.dropdown.esm.js +2231 -0
  17. package/dist/plugins/grideditor.dropdown.js +2232 -0
  18. package/dist/plugins/grideditor.dropdown.min.js +1 -0
  19. package/dist/plugins/grideditor.dropdown.min.js.map +7 -0
  20. package/dist/plugins/grideditor.navbar.esm.js +2188 -0
  21. package/dist/plugins/grideditor.navbar.js +2189 -0
  22. package/dist/plugins/grideditor.navbar.min.js +1 -0
  23. package/dist/plugins/grideditor.navbar.min.js.map +7 -0
  24. package/dist/plugins/grideditor.sidenav.esm.js +2082 -0
  25. package/dist/plugins/grideditor.sidenav.js +2083 -0
  26. package/dist/plugins/grideditor.sidenav.min.js +1 -0
  27. package/dist/plugins/grideditor.sidenav.min.js.map +7 -0
  28. package/docs/events.md +5 -1
  29. package/docs/locale-keys.md +126 -1
  30. package/docs/plugins.md +24 -4
  31. package/example/containers.html +93 -2
  32. package/example/index.html +1 -1
  33. package/example/playground.html +3 -0
  34. package/package.json +1 -1
  35. package/src/js/grideditor.js +36 -4
  36. package/src/js/locales/grideditor.es.js +125 -0
  37. package/src/js/nav/browse.js +51 -0
  38. package/src/js/nav/canvas.js +170 -0
  39. package/src/js/nav/convert.js +179 -0
  40. package/src/js/nav/drawers.js +290 -0
  41. package/src/js/nav/dropdown.js +253 -0
  42. package/src/js/nav/feature.js +113 -0
  43. package/src/js/nav/locale.js +128 -0
  44. package/src/js/nav/markup.js +121 -0
  45. package/src/js/nav/panels.js +454 -0
  46. package/src/js/nav/pieces.js +253 -0
  47. package/src/js/plugins/grideditor.dropdown.js +335 -0
  48. package/src/js/plugins/grideditor.navbar.js +454 -0
  49. package/src/js/plugins/grideditor.sidenav.js +349 -0
  50. package/src/less/grideditor.less +231 -0
  51. package/types/grideditor.d.ts +125 -0
@@ -140,6 +140,122 @@ export interface CreateOffcanvasOptions extends Placement, OffcanvasOptions {
140
140
  trigger_label?: string;
141
141
  }
142
142
 
143
+ /** A breakpoint a navbar or a sidenav answers to: Bootstrap has none below `sm`. */
144
+ export type NavBreakpoint = 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
145
+
146
+ /** The backgrounds a navbar and a sidenav offer: `bg-*`. */
147
+ export type NavBackground = 'body-tertiary' | 'body' | 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'light' | 'dark';
148
+
149
+ /** What the browse of the navbar and sidenav plugins is told: the node the field is for, which field, and what it shows. */
150
+ export interface NavBrowseContext {
151
+ node: HTMLElement;
152
+ /** `'href'` for a link, an item or the brand; `'src'` for the brand's image. */
153
+ property: 'href' | 'src';
154
+ value: string;
155
+ }
156
+
157
+ /** The host's file browser of the navbar and sidenav plugins, with the form of `inline_style.browse`. */
158
+ export type NavBrowse = (
159
+ done: (url?: string | null) => void,
160
+ context: NavBrowseContext,
161
+ ) => void | Promise<string | null | undefined>;
162
+
163
+ /**
164
+ * The navbar plugin's options, the ones a navbar made new has, as the navbar
165
+ * setting gives them and createContainer overrides them.
166
+ */
167
+ export interface NavbarOptions {
168
+ /** From this breakpoint up it is expanded; `true` always, `false` never. Default `'lg'`. */
169
+ expand?: boolean | NavBreakpoint;
170
+ /** How it folds: a collapse, an offcanvas, or `false` for not at all. Default `'collapse'`. */
171
+ collapse?: 'collapse' | 'offcanvas' | false;
172
+ /** The edge an offcanvas comes from. Default `'end'`. */
173
+ offcanvas_placement?: 'start' | 'end';
174
+ /** `bg-*`; `null` for none. Default `'body-tertiary'`. */
175
+ bg?: NavBackground | null;
176
+ /** `data-bs-theme`. Default null. */
177
+ theme?: 'light' | 'dark' | null;
178
+ /** `fixed-*` or `sticky-*`; null for in the flow. Default null. */
179
+ position?: 'fixed-top' | 'fixed-bottom' | 'sticky-top' | 'sticky-bottom' | null;
180
+ /** The width of what is inside: `'fluid'` (`container-fluid`), `'fixed'` (`container`) or a breakpoint (`container-{bp}`). Default `'fluid'`. */
181
+ width?: 'fluid' | 'fixed' | NavBreakpoint;
182
+ }
183
+
184
+ /** The navbar setting: the options of the navbars made new, and the host's file browser. */
185
+ export interface NavbarSetting extends NavbarOptions {
186
+ browse?: NavBrowse;
187
+ }
188
+
189
+ /** createContainer('navbar', …): the options, and the brand's text or `false` for none. */
190
+ export interface CreateNavbarOptions extends Placement, NavbarOptions {
191
+ brand?: string | false;
192
+ }
193
+
194
+ /**
195
+ * The sidenav plugin's options, the ones a sidebar made new has, as the
196
+ * sidenav setting gives them and createContainer overrides them.
197
+ */
198
+ export interface SidenavOptions {
199
+ /** A css length the browser takes as a width. Default `'280px'`. */
200
+ width?: string;
201
+ /** `bg-*`; `null` for none. Default `'body-tertiary'`. */
202
+ bg?: NavBackground | null;
203
+ /** `data-bs-theme`. Default null. */
204
+ theme?: 'light' | 'dark' | null;
205
+ /** The links as pills, or plain. Default `'pills'`. */
206
+ style?: 'pills' | 'plain';
207
+ /** `vh-100 sticky-top overflow-y-auto`. Default false. */
208
+ full_height?: boolean;
209
+ /** Below this breakpoint it is an offcanvas a button opens; null for always visible. Default null. */
210
+ responsive?: NavBreakpoint | null;
211
+ }
212
+
213
+ /** The sidenav setting: the options of the sidebars made new, and the host's file browser. */
214
+ export interface SidenavSetting extends SidenavOptions {
215
+ browse?: NavBrowse;
216
+ }
217
+
218
+ /** createContainer('sidenav', …): the options, the brand's text or `false` for none, and the button's text. */
219
+ export interface CreateSidenavOptions extends Placement, SidenavOptions {
220
+ brand?: string | false;
221
+ /** The text of the button that opens a responsive sidebar. */
222
+ trigger_label?: string;
223
+ }
224
+
225
+ /** The Bootstrap styles of the button of a dropdown. */
226
+ export type DropdownStyle = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'light' | 'dark' | 'link';
227
+
228
+ /**
229
+ * The dropdown plugin's options, the ones a dropdown made new has, as the
230
+ * dropdown setting gives them and createContainer overrides them.
231
+ */
232
+ export interface DropdownOptions {
233
+ /** The text of the button, or of the action of a split one. Default `'Dropdown'`, in the interface's language. */
234
+ label?: string;
235
+ /** What the menu holds: items - links, dividers, headers, texts - or free content, rows and columns. Default `'items'`. */
236
+ menu?: 'items' | 'content';
237
+ /** `btn-*`. Default `'secondary'`. */
238
+ style?: DropdownStyle;
239
+ /** `btn-outline-*`; `link` has none. Default false. */
240
+ outline?: boolean;
241
+ /** `btn-sm` or `btn-lg`; null for neither. Default null. */
242
+ size?: 'sm' | 'lg' | null;
243
+ /** `dropdown`, `dropup`, `dropend` or `dropstart`. Default `'down'`. */
244
+ direction?: 'down' | 'up' | 'end' | 'start';
245
+ /** `dropdown-menu-end`. Default false. */
246
+ menu_end?: boolean;
247
+ /** An action and a caret, as two buttons. Default false. */
248
+ split?: boolean;
249
+ }
250
+
251
+ /** The dropdown setting: the options of the dropdowns made new, and the host's file browser. */
252
+ export interface DropdownSetting extends DropdownOptions {
253
+ browse?: NavBrowse;
254
+ }
255
+
256
+ /** createContainer('dropdown', …) */
257
+ export interface CreateDropdownOptions extends Placement, DropdownOptions {}
258
+
143
259
  /** What a file browser is told about the field it was opened from. */
144
260
  export interface InlineStyleBrowseContext {
145
261
  node: HTMLElement;
@@ -226,6 +342,12 @@ export interface GridEditorOptions {
226
342
  carousel?: CarouselOptions;
227
343
  /** The offcanvas plugin: the options of the offcanvases made new. */
228
344
  offcanvas?: OffcanvasOptions;
345
+ /** The navbar plugin: the options of the navbars made new, and `browse`. */
346
+ navbar?: NavbarSetting;
347
+ /** The sidenav plugin: the options of the sidebars made new, and `browse`. */
348
+ sidenav?: SidenavSetting;
349
+ /** The dropdown plugin: the options of the dropdowns made new, and `browse`. */
350
+ dropdown?: DropdownSetting;
229
351
  elements?: { enabled?: boolean | 'auto'; selector?: string; auto?: boolean; types?: ElementType[] };
230
352
  /** The autosave plugin: what is edited, kept in the browser's storage as it changes. */
231
353
  autosave?: AutosaveOptions;
@@ -594,6 +716,9 @@ export declare class GridEditor {
594
716
  createContainer(type: 'tabs', options?: CreateTabsOptions): HTMLElement | null;
595
717
  createContainer(type: 'carousel', options?: CreateCarouselOptions): HTMLElement | null;
596
718
  createContainer(type: 'offcanvas', options?: CreateOffcanvasOptions): HTMLElement | null;
719
+ createContainer(type: 'navbar', options?: CreateNavbarOptions): HTMLElement | null;
720
+ createContainer(type: 'sidenav', options?: CreateSidenavOptions): HTMLElement | null;
721
+ createContainer(type: 'dropdown', options?: CreateDropdownOptions): HTMLElement | null;
597
722
  createContainer(type: string, options?: Placement & Record<string, unknown>): HTMLElement | null;
598
723
  addTab(container: Target, options?: PaneOptions): HTMLElement | null;
599
724
  addAccordionItem(container: Target, options?: PaneOptions): HTMLElement | null;