@ulu/frontend 0.1.0-beta.80 → 0.1.0-beta.81

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.
@@ -5202,8 +5202,23 @@
5202
5202
 
5203
5203
  <li><a href="#new-exports.resizer(container%2C-control%2C-options)">new exports.Resizer(container, control, options)</a>
5204
5204
  </li>
5205
+
5206
+ <li><a href="#resizer.destroy()">resizer.destroy()</a>
5207
+ </li>
5205
5208
  </ol>
5206
5209
  </li>
5210
+
5211
+ <li><a href="#ui%2Fresizer~multiplier">ui/resizer~multiplier</a>
5212
+ </li>
5213
+
5214
+ <li><a href="#ui%2Fresizer~overridemaxdimensions">ui/resizer~overrideMaxDimensions</a>
5215
+ </li>
5216
+
5217
+ <li><a href="#ui%2Fresizer~fromx-%3A-%22left%22-%7C-%22right%22-%7C-null">ui/resizer~fromX : "left" | "right" | null</a>
5218
+ </li>
5219
+
5220
+ <li><a href="#ui%2Fresizer~fromy-%3A-%22top%22-%7C-%22bottom%22-%7C-null">ui/resizer~fromY : "top" | "bottom" | null</a>
5221
+ </li>
5207
5222
  </ol>
5208
5223
  </div>
5209
5224
  </div>
@@ -5220,9 +5235,22 @@
5220
5235
  <ul>
5221
5236
  <li><a href="#module_ui/resizer">ui/resizer</a>
5222
5237
  <ul>
5238
+ <li><em>static</em>
5239
+ <ul>
5223
5240
  <li><a href="#module_ui/resizer.Resizer">.Resizer</a>
5224
5241
  <ul>
5225
5242
  <li><a href="#new_module_ui/resizer.Resizer_new">new exports.Resizer(container, control, options)</a></li>
5243
+ <li><a href="#module_ui/resizer.Resizer+destroy">.destroy()</a></li>
5244
+ </ul>
5245
+ </li>
5246
+ </ul>
5247
+ </li>
5248
+ <li><em>inner</em>
5249
+ <ul>
5250
+ <li><a href="#module_ui/resizer..multiplier">~multiplier</a></li>
5251
+ <li><a href="#module_ui/resizer..overrideMaxDimensions">~overrideMaxDimensions</a></li>
5252
+ <li><a href="#module_ui/resizer..fromX">~fromX</a> : <code>&quot;left&quot;</code> | <code>&quot;right&quot;</code> | <code>null</code></li>
5253
+ <li><a href="#module_ui/resizer..fromY">~fromY</a> : <code>&quot;top&quot;</code> | <code>&quot;bottom&quot;</code> | <code>null</code></li>
5226
5254
  </ul>
5227
5255
  </li>
5228
5256
  </ul>
@@ -5230,14 +5258,23 @@
5230
5258
  </ul>
5231
5259
  <p><a name="module_ui/resizer.Resizer"></a></p>
5232
5260
  <h2 id="ui%2Fresizer.resizer" tabindex="-1">ui/resizer.Resizer</h2>
5233
- <p><strong>Kind</strong>: static class of <a href="#module_ui/resizer"><code>ui/resizer</code></a><br>
5234
- <a name="new_module_ui/resizer.Resizer_new"></a></p>
5261
+ <p><strong>Kind</strong>: static class of <a href="#module_ui/resizer"><code>ui/resizer</code></a></p>
5262
+ <ul>
5263
+ <li><a href="#module_ui/resizer.Resizer">.Resizer</a>
5264
+ <ul>
5265
+ <li><a href="#new_module_ui/resizer.Resizer_new">new exports.Resizer(container, control, options)</a></li>
5266
+ <li><a href="#module_ui/resizer.Resizer+destroy">.destroy()</a></li>
5267
+ </ul>
5268
+ </li>
5269
+ </ul>
5270
+ <p><a name="new_module_ui/resizer.Resizer_new"></a></p>
5235
5271
  <h3 id="new-exports.resizer(container%2C-control%2C-options)" tabindex="-1">new exports.Resizer(container, control, options)</h3>
5236
5272
  <table>
5237
5273
  <thead>
5238
5274
  <tr>
5239
5275
  <th>Param</th>
5240
5276
  <th>Type</th>
5277
+ <th>Default</th>
5241
5278
  <th>Description</th>
5242
5279
  </tr>
5243
5280
  </thead>
@@ -5245,35 +5282,67 @@
5245
5282
  <tr>
5246
5283
  <td>container</td>
5247
5284
  <td><code>Node</code></td>
5248
- <td>Container to be resize</td>
5285
+ <td></td>
5286
+ <td>Container to be resized</td>
5249
5287
  </tr>
5250
5288
  <tr>
5251
5289
  <td>control</td>
5252
5290
  <td><code>Node</code></td>
5291
+ <td></td>
5253
5292
  <td>Resize handle element</td>
5254
5293
  </tr>
5255
5294
  <tr>
5256
5295
  <td>options</td>
5257
5296
  <td><code>Object</code></td>
5258
- <td>Defualt can be changed on class</td>
5297
+ <td></td>
5298
+ <td>Options to configure the resizer.</td>
5259
5299
  </tr>
5260
5300
  <tr>
5261
5301
  <td>options.debug</td>
5262
5302
  <td><code>Boolean</code></td>
5263
- <td>Enable non-essential debugging logs</td>
5303
+ <td></td>
5304
+ <td>Enable non-essential debugging logs.</td>
5264
5305
  </tr>
5265
5306
  <tr>
5266
- <td>options.overrideMaxWidth</td>
5307
+ <td>options.overrideMaxDimensions</td>
5267
5308
  <td><code>Boolean</code></td>
5268
- <td>When script is activated by handle remove the elements max-width and allow the width of the resize to exceed the max (default false)</td>
5309
+ <td></td>
5310
+ <td>When script is activated by handle, remove the element's max-width/max-height and allow the resize to exceed them (default false).</td>
5269
5311
  </tr>
5270
5312
  <tr>
5271
- <td>options.fromLeft</td>
5272
- <td><code>Boolean</code></td>
5273
- <td>The script should assume the handle is on the left side of the element</td>
5313
+ <td>[options.fromX]</td>
5314
+ <td><code>&quot;left&quot;</code> | <code>&quot;right&quot;</code> | <code>null</code></td>
5315
+ <td><code></code></td>
5316
+ <td>Horizontal resizing direction.</td>
5317
+ </tr>
5318
+ <tr>
5319
+ <td>[options.fromY]</td>
5320
+ <td><code>&quot;top&quot;</code> | <code>&quot;bottom&quot;</code> | <code>null</code></td>
5321
+ <td><code></code></td>
5322
+ <td>Vertical resizing direction.</td>
5274
5323
  </tr>
5275
5324
  </tbody>
5276
5325
  </table>
5326
+ <p><a name="module_ui/resizer.Resizer+destroy"></a></p>
5327
+ <h3 id="resizer.destroy()" tabindex="-1">resizer.destroy()</h3>
5328
+ <p>Cleans up event listeners to prevent memory leaks.</p>
5329
+ <p><strong>Kind</strong>: instance method of <a href="#module_ui/resizer.Resizer"><code>Resizer</code></a><br>
5330
+ <a name="module_ui/resizer..multiplier"></a></p>
5331
+ <h2 id="ui%2Fresizer~multiplier" tabindex="-1">ui/resizer~multiplier</h2>
5332
+ <p>Amount to increase size by (ie. pointer movement * multiplier)</p>
5333
+ <p><strong>Kind</strong>: inner property of <a href="#module_ui/resizer"><code>ui/resizer</code></a><br>
5334
+ <a name="module_ui/resizer..overrideMaxDimensions"></a></p>
5335
+ <h2 id="ui%2Fresizer~overridemaxdimensions" tabindex="-1">ui/resizer~overrideMaxDimensions</h2>
5336
+ <p>Remove max-width, max-height</p>
5337
+ <p><strong>Kind</strong>: inner property of <a href="#module_ui/resizer"><code>ui/resizer</code></a><br>
5338
+ <a name="module_ui/resizer..fromX"></a></p>
5339
+ <h2 id="ui%2Fresizer~fromx-%3A-%22left%22-%7C-%22right%22-%7C-null" tabindex="-1">ui/resizer~fromX : <code>&quot;left&quot;</code> | <code>&quot;right&quot;</code> | <code>null</code></h2>
5340
+ <p>Specifies the horizontal edge from which resizing occurs.<code>null</code> means no horizontal resizing.- Default null</p>
5341
+ <p><strong>Kind</strong>: inner property of <a href="#module_ui/resizer"><code>ui/resizer</code></a><br>
5342
+ <a name="module_ui/resizer..fromY"></a></p>
5343
+ <h2 id="ui%2Fresizer~fromy-%3A-%22top%22-%7C-%22bottom%22-%7C-null" tabindex="-1">ui/resizer~fromY : <code>&quot;top&quot;</code> | <code>&quot;bottom&quot;</code> | <code>null</code></h2>
5344
+ <p>Specifies the vertical edge from which resizing occurs.- <code>null</code> means no vertical resizing.- Default null</p>
5345
+ <p><strong>Kind</strong>: inner property of <a href="#module_ui/resizer"><code>ui/resizer</code></a></p>
5277
5346
 
5278
5347
  </div>
5279
5348
  </div>
@@ -5337,7 +5337,7 @@
5337
5337
  </table>
5338
5338
  <p><a name="module_utils/class-logger..config"></a></p>
5339
5339
  <h2 id="utils%2Fclass-logger~config" tabindex="-1">utils/class-logger~config</h2>
5340
- <p>Configuration Object</p>
5340
+ <p>Global Configuration Object</p>
5341
5341
  <p><strong>Kind</strong>: inner constant of <a href="#module_utils/class-logger"><code>utils/class-logger</code></a></p>
5342
5342
 
5343
5343
  </div>
@@ -5459,7 +5459,7 @@
5459
5459
  <li><strong>Group:</strong> css-icon</li>
5460
5460
  <li><strong>Type:</strong> mixin</li>
5461
5461
  <li><strong>Lines (comments):</strong> 101-103</li>
5462
- <li><strong>Lines (code):</strong> 105-438</li>
5462
+ <li><strong>Lines (code):</strong> 105-448</li>
5463
5463
  </ul>
5464
5464
  </details>
5465
5465
  <h4 id="examples-1" tabindex="-1">Examples</h4>
@@ -5281,6 +5281,7 @@
5281
5281
  <span class="pjs-token pjs-string">"resizer-color"</span><span class="pjs-token pjs-punctuation">:</span> <span class="pjs-token pjs-function">rgb</span><span class="pjs-token pjs-punctuation">(</span>99<span class="pjs-token pjs-punctuation">,</span> 99<span class="pjs-token pjs-punctuation">,</span> 99<span class="pjs-token pjs-punctuation">)</span><span class="pjs-token pjs-punctuation">,</span>
5282
5282
  <span class="pjs-token pjs-string">"resizer-color-hover"</span><span class="pjs-token pjs-punctuation">:</span> black<span class="pjs-token pjs-punctuation">,</span>
5283
5283
  <span class="pjs-token pjs-string">"resizer-width"</span><span class="pjs-token pjs-punctuation">:</span> 1.25rem<span class="pjs-token pjs-punctuation">,</span>
5284
+ <span class="pjs-token pjs-string">"resizer-center-size"</span> <span class="pjs-token pjs-punctuation">:</span> 1.65rem<span class="pjs-token pjs-punctuation">,</span>
5284
5285
  <span class="pjs-token pjs-string">"title-color"</span><span class="pjs-token pjs-punctuation">:</span> white<span class="pjs-token pjs-punctuation">,</span>
5285
5286
  <span class="pjs-token pjs-string">"title-font-weight"</span><span class="pjs-token pjs-punctuation">:</span> bold<span class="pjs-token pjs-punctuation">,</span>
5286
5287
  <span class="pjs-token pjs-string">"title-font-family"</span> <span class="pjs-token pjs-punctuation">:</span> <span class="pjs-token pjs-null pjs-keyword">null</span><span class="pjs-token pjs-punctuation">,</span>
@@ -5298,8 +5299,8 @@
5298
5299
  <li><strong>File:</strong> _modal.scss</li>
5299
5300
  <li><strong>Group:</strong> modal</li>
5300
5301
  <li><strong>Type:</strong> variable</li>
5301
- <li><strong>Lines (comments):</strong> 31-71</li>
5302
- <li><strong>Lines (code):</strong> 73-117</li>
5302
+ <li><strong>Lines (comments):</strong> 31-72</li>
5303
+ <li><strong>Lines (code):</strong> 74-119</li>
5303
5304
  </ul>
5304
5305
  </details>
5305
5306
  <h4 id="map-properties" tabindex="-1">Map Properties</h4>
@@ -5506,6 +5507,12 @@
5506
5507
  <td style="text-align:left">The width of the resizer.</td>
5507
5508
  </tr>
5508
5509
  <tr>
5510
+ <td style="text-align:left">resizer-center-size</td>
5511
+ <td style="text-align:left">Dimension</td>
5512
+ <td style="text-align:left">1.65rem</td>
5513
+ <td style="text-align:left">The width/height of the resizer (in bottom right corner) used when position center with resize enabled</td>
5514
+ </tr>
5515
+ <tr>
5509
5516
  <td style="text-align:left">title-color</td>
5510
5517
  <td style="text-align:left">Color</td>
5511
5518
  <td style="text-align:left">white</td>
@@ -5563,8 +5570,8 @@
5563
5570
  <li><strong>File:</strong> _modal.scss</li>
5564
5571
  <li><strong>Group:</strong> modal</li>
5565
5572
  <li><strong>Type:</strong> mixin</li>
5566
- <li><strong>Lines (comments):</strong> 119-122</li>
5567
- <li><strong>Lines (code):</strong> 124-126</li>
5573
+ <li><strong>Lines (comments):</strong> 121-124</li>
5574
+ <li><strong>Lines (code):</strong> 126-128</li>
5568
5575
  </ul>
5569
5576
  </details>
5570
5577
  <h4 id="examples" tabindex="-1">Examples</h4>
@@ -5603,8 +5610,8 @@
5603
5610
  <li><strong>File:</strong> _modal.scss</li>
5604
5611
  <li><strong>Group:</strong> modal</li>
5605
5612
  <li><strong>Type:</strong> mixin</li>
5606
- <li><strong>Lines (comments):</strong> 138-140</li>
5607
- <li><strong>Lines (code):</strong> 142-500</li>
5613
+ <li><strong>Lines (comments):</strong> 140-142</li>
5614
+ <li><strong>Lines (code):</strong> 144-513</li>
5608
5615
  </ul>
5609
5616
  </details>
5610
5617
  <h4 id="examples-1" tabindex="-1">Examples</h4>
@@ -5627,8 +5634,8 @@
5627
5634
  <li><strong>File:</strong> _modal.scss</li>
5628
5635
  <li><strong>Group:</strong> modal</li>
5629
5636
  <li><strong>Type:</strong> function</li>
5630
- <li><strong>Lines (comments):</strong> 128-131</li>
5631
- <li><strong>Lines (code):</strong> 133-136</li>
5637
+ <li><strong>Lines (comments):</strong> 130-133</li>
5638
+ <li><strong>Lines (code):</strong> 135-138</li>
5632
5639
  </ul>
5633
5640
  </details>
5634
5641
  <h4 id="examples-2" tabindex="-1">Examples</h4>
@@ -21,30 +21,31 @@ const events = {
21
21
  * - Is triggered by modules that were responsible for modifying the page
22
22
  */
23
23
  pageModified(context) {
24
- context.dispatchEvent(new CustomEvent(getName("pageModified"), { bubbles: true }));
24
+ context.dispatchEvent(createEvent("pageModified"));
25
25
  },
26
26
  /**
27
27
  * Event called when page is resized
28
28
  */
29
29
  pageResized(context) {
30
- context.dispatchEvent(new CustomEvent(getName("pageResized"), { bubbles: true }));
30
+ context.dispatchEvent(createEvent("pageResized"));
31
31
  },
32
32
  /**
33
33
  * Event dispatched before page print begins (teardown/restructure/hide things)
34
34
  */
35
35
  beforePrint(context) {
36
- context.dispatchEvent(new CustomEvent(getName("beforePrint"), { bubbles: true }));
36
+ context.dispatchEvent(createEvent("beforePrint"));
37
37
  },
38
38
  /**
39
39
  * Event dispatched after page print (cleanup)
40
40
  */
41
41
  afterPrint(context) {
42
- context.dispatchEvent(new CustomEvent(getName("afterPrint"), { bubbles: true }));
42
+ context.dispatchEvent(createEvent("afterPrint"));
43
43
  }
44
44
  };
45
45
 
46
46
  /**
47
- * Triggers one of our custom events
47
+ * Triggers one of our custom events (page/document level events)
48
+ * - UI components may dispatch their own events, this is just used for system wide events
48
49
  * @param {String} type Type of event to dispatch
49
50
  * @param {Node} context Element to trigger the event from
50
51
  * @example
@@ -62,6 +63,7 @@ export function dispatch(type, context) {
62
63
 
63
64
  /**
64
65
  * Namespaced event
66
+ * - Should be used for all ulu script/component events
65
67
  * @param {String} type Type of event to get the actual event name for
66
68
  * @returns {String}
67
69
  */
@@ -69,6 +71,16 @@ export function getName(type) {
69
71
  return "ulu:" + type;
70
72
  }
71
73
 
74
+ /**
75
+ * Create ulu namespaced custom event
76
+ * @param {String} type Event base name (not prefixed)
77
+ * @param {any} data Custom data to pass with the event (will be available as `event.detail`)
78
+ * @param {Object} options CustomEvent options default `{ bubbles: true }`. If `detail` is also provided, it will be merged with this options object and will override the 'data' argument for this function
79
+ */
80
+ export function createEvent(type, data = null, options = { bubbles: true }) {
81
+ return new CustomEvent(getName(type), { detail: data, ...options });
82
+ }
83
+
72
84
  /**
73
85
  * Setup resize handler/dispatch
74
86
  */
package/js/settings.js CHANGED
@@ -8,6 +8,7 @@
8
8
  * @typedef {object} Defaults
9
9
  * @property {string} iconClassClose - The CSS class string for the close icon
10
10
  * @property {string} iconClassDragX - The CSS class string for the drag X icon
11
+ * @property {string} iconClassDragBoth - The CSS class string for the dragging in both directions
11
12
  * @property {string} iconClassPrevious - The CSS class string for the previous icon
12
13
  * @property {string} iconClassNext - The CSS class string for the next icon
13
14
  * @property {string} cssvarPrefix - The prefix to use for CSS custom properties
@@ -19,6 +20,7 @@
19
20
  const defaults = {
20
21
  iconClassClose: "css-icon css-icon--close",
21
22
  iconClassDragX: "css-icon css-icon--drag-x",
23
+ iconClassDragBoth: "css-icon css-icon--drag-both",
22
24
  iconClassPrevious: "css-icon css-icon--angle-left",
23
25
  iconClassNext: "css-icon css-icon--angle-right",
24
26
  cssvarPrefix: "",
package/js/ui/dialog.js CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { ComponentInitializer } from "../utils/system.js";
6
6
  import { wasClickOutside, preventScroll as setupPreventScroll } from "@ulu/utils/browser/dom.js";
7
+ import { debounce } from "@ulu/utils/performance.js";
7
8
  import { pauseVideos as pauseYoutubeVideos, prepVideos as prepYoutubeVideos } from "../utils/pause-youtube-video.js";
8
9
 
9
10
  /**
@@ -131,9 +132,37 @@ export function setupDialog(dialog, userOptions) {
131
132
  const options = Object.assign({}, currentDefaults, userOptions);
132
133
  const body = document.body;
133
134
  const { preventScrollShift: preventShift } = options;
135
+ let isPointerDown = false;
136
+ let isResizing = false;
137
+
138
+
139
+ // This was added to provide a simple flag for "isPointerDown" so that
140
+ // we can disable click outside if it was a click that originated inside the dialog, probable from
141
+ // native resize handle. If this causes issues in the future we can explore tracking the pointer
142
+ // with setPointerCapture but I'm worried about it affecting inner elements with their own pointer events
143
+ // This seems like it will be ok we just don't allow outside closing if there was pointerdown from within the modal
144
+ dialog.addEventListener("pointerdown", handlePointerdown);
134
145
 
135
146
  dialog.addEventListener("click", handleClicks);
136
147
 
148
+ // Watching for resizes to avoid closing outside during resizes
149
+ // - There is no resize event for css resize (so this uses pointerdown and resize observer)
150
+ const handleResizeEnd = debounce(() => {
151
+ if (isResizing && !isPointerDown) {
152
+ isResizing = false;
153
+ }
154
+ }, 500);
155
+
156
+ const resizeObserver = new ResizeObserver(() => {
157
+ if (isPointerDown) {
158
+ if (!isResizing) {
159
+ isResizing = true;
160
+ }
161
+ handleResizeEnd();
162
+ }
163
+ });
164
+ resizeObserver.observe(dialog);
165
+
137
166
  if (options.documentEnd) {
138
167
  body.appendChild(dialog);
139
168
  }
@@ -158,12 +187,27 @@ export function setupDialog(dialog, userOptions) {
158
187
  });
159
188
  }
160
189
 
190
+ function handlePointerdown() {
191
+ if (isPointerDown) return;
192
+ isPointerDown = true;
193
+
194
+ const done = () => {
195
+ // After event queue (click) - so after click handler for outside is called
196
+ setTimeout(() => {
197
+ isPointerDown = false;
198
+ isResizing = false;
199
+ }, 0);
200
+ };
201
+ document.addEventListener("pointerup", done, { once: true });
202
+ document.addEventListener("pointercancel", done, { once: true });
203
+ }
204
+
161
205
  function handleClicks(event) {
162
206
  const { target } = event;
207
+ const targetIsDialog = target === dialog;
163
208
  const closeFromButton = target.closest(initializer.attributeSelector("close"));
164
- let closeFromOutside = options.clickOutsideCloses &&
165
- target === dialog &&
166
- wasClickOutside(dialog, event);
209
+ const allowCloseOutside = !isResizing && options.clickOutsideCloses;
210
+ const closeFromOutside = allowCloseOutside && targetIsDialog && wasClickOutside(dialog, event);
167
211
  if (closeFromOutside || closeFromButton) {
168
212
  if (options.pauseVideos) {
169
213
  pauseVideos(dialog);
@@ -78,14 +78,16 @@ export const defaults = {
78
78
  footerHtml: null,
79
79
  classCloseIcon: wrapSettingString("iconClassClose"),
80
80
  classResizerIcon: wrapSettingString("iconClassDragX"),
81
+ classResizerIconBoth: wrapSettingString("iconClassDragBoth"),
81
82
  debug: false,
82
83
  templateCloseIcon(config) {
83
84
  const { baseClass, classCloseIcon } = config;
84
85
  return `<span class="${ baseClass }__close-icon ${ classCloseIcon }" aria-hidden="true"></span>`;
85
86
  },
86
87
  templateResizerIcon(config) {
87
- const { baseClass, classResizerIcon } = config;
88
- return `<span class="${ baseClass }__resizer-icon ${ classResizerIcon }" aria-hidden="true"></span>`;
88
+ const { baseClass, classResizerIcon, classResizerIconBoth } = config;
89
+ const iconClass = config.position === "center" ? classResizerIconBoth : classResizerIcon;
90
+ return `<span class="${ baseClass }__resizer-icon ${ iconClass }" aria-hidden="true"></span>`;
89
91
  },
90
92
  /**
91
93
  * Default modal template
@@ -129,7 +131,7 @@ export const defaults = {
129
131
  ` : "" }
130
132
  <div class="${ baseClass }__body" ${ initializer.getAttribute("body") }></div>
131
133
  ${ footerHtml ? `<div class="${ baseClass }__footer">${ footerHtml }</div>`: "" }
132
- ${ config.hasResizer ?
134
+ ${ config.allowResize ?
133
135
  `<div class="${ baseClass }__resizer" ${ initializer.getAttribute("resizer") }>
134
136
  ${ config.templateResizerIcon(config) }
135
137
  </div>` : ""
@@ -172,9 +174,8 @@ export function buildModal(content, options) {
172
174
 
173
175
  const config = Object.assign({}, currentDefaults, options);
174
176
 
175
- if (config.position !== "center" && config.allowResize) {
176
- config.hasResizer = true;
177
- }
177
+ const { position } = config;
178
+
178
179
  if (config.debug) {
179
180
  initializer.log(config, content);
180
181
  }
@@ -186,7 +187,7 @@ export function buildModal(content, options) {
186
187
  const modal = createElementFromHtml(markup.trim());
187
188
  const selectChild = key => modal.querySelector(initializer.attributeSelector(key));
188
189
  const body = selectChild("body");
189
- const resizer = selectChild("resizer");
190
+ const resizerElement = selectChild("resizer");
190
191
  const dialogOptions = separateDialogOptions(config);
191
192
 
192
193
  // Replace content with new dialog, and then insert the content into the new dialogs body
@@ -209,10 +210,20 @@ export function buildModal(content, options) {
209
210
  }
210
211
  }
211
212
 
212
- if (config.hasResizer) {
213
- new Resizer(modal, resizer, {
214
- fromLeft: config.position === "right"
215
- });
213
+ let resizer;
214
+ const resizablePositions = ["left", "right", "center"];
215
+ const isCenter = position === "center";
216
+ const isRight = position === "right";
217
+
218
+ if (config.allowResize) {
219
+ if (resizablePositions.includes(position)) {
220
+ const resizerOptions = isCenter ?
221
+ { fromX: "right", fromY: "bottom", multiplier: 2 } :
222
+ { fromX: isRight ? "left" : "right" };
223
+ resizer = new Resizer(modal, resizerElement, resizerOptions);
224
+ } else {
225
+ console.warn(`${ position } is not supported for resizing`);
226
+ }
216
227
  }
217
228
 
218
229
  if (config.print) {
@@ -225,7 +236,7 @@ export function buildModal(content, options) {
225
236
  printClone.remove();
226
237
  });
227
238
  }
228
- return { modal };
239
+ return { modal, resizer };
229
240
  }
230
241
 
231
242
  /**