@fusion.dev/helix-core 0.209.0 → 0.211.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.
@@ -1,12 +1,15 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { html, nothing } from 'lit';
3
3
  import { property, state } from 'lit/decorators.js';
4
+ import { html as staticHtml } from 'lit/static-html.js';
4
5
  import { FullscreenController } from '../../controllers/fullscreen-controller/fullscreen-controller.js';
5
6
  import { IdleController } from '../../controllers/idle-controller/idle-controller.js';
7
+ import { ToolbarController } from '../../controllers/toolbar-controller/toolbar-controller.js';
6
8
  import { inlineStep } from '../../utils/inline-step/inline-step.js';
7
9
  import { isRtl } from '../../utils/is-rtl/is-rtl.js';
8
10
  import { numberConverter, timeConverter } from '../../utils/number-converter/number-converter.js';
9
11
  import { formatWords, words } from '../../words/words.js';
12
+ const stopPress = (event) => event.stopPropagation();
10
13
  const HINT_SHOWS = 1600;
11
14
  export const MixinViewport = (Base) => {
12
15
  class Viewport extends Base {
@@ -27,6 +30,12 @@ export const MixinViewport = (Base) => {
27
30
  this.fullscreen = new FullscreenController(this, (full) => {
28
31
  this.filled = full;
29
32
  });
33
+ this.controlKeys = new ToolbarController(this, {
34
+ arrows: () => 'position',
35
+ members: () => [...(this.controlsElement?.children ?? [])],
36
+ own: true,
37
+ watch: () => this.renderRoot,
38
+ });
30
39
  this.idle = new IdleController(this, () => this.idleDelay, (resting) => {
31
40
  this.resting = resting;
32
41
  });
@@ -94,6 +103,10 @@ export const MixinViewport = (Base) => {
94
103
  if (target !== own && !own.matches('[part~="controls"]')) {
95
104
  return;
96
105
  }
106
+ const modified = event.shiftKey || event.ctrlKey || event.metaKey || event.altKey;
107
+ if (own.matches('[part~="controls"]') && !modified && /^(Arrow|Home$|End$)/.test(event.key)) {
108
+ return;
109
+ }
97
110
  if (event.ctrlKey || event.metaKey || event.altKey) {
98
111
  return;
99
112
  }
@@ -249,6 +262,12 @@ export const MixinViewport = (Base) => {
249
262
  ? this.panLeftLabel
250
263
  : this.panRightLabel;
251
264
  }
265
+ get controlTag() {
266
+ return this.tag('icon-button');
267
+ }
268
+ get controlAxes() {
269
+ return { raised: false };
270
+ }
252
271
  panGlyph(way) {
253
272
  return { down: '↓', left: '←', right: '→', up: '↑' }[this.sideOf(way)] ?? '';
254
273
  }
@@ -272,40 +291,94 @@ export const MixinViewport = (Base) => {
272
291
  return nothing;
273
292
  }
274
293
  const [up, start, end, down] = ['up', 'start', 'end', 'down'].map((way) => this.panGlyph(way));
275
- return html `<div part="controls" role="group" aria-label=${this.controlsLabel}>
294
+ const button = this.controlTag;
295
+ const { material, raised } = this.controlAxes;
296
+ const ground = material ?? nothing;
297
+ return staticHtml `<div part="controls" role="toolbar" aria-label=${this.controlsLabel}>
276
298
  ${pan
277
- ? html `<button part="pan-up" aria-label=${this.panLabel('up')} type="button" @click=${() => this.pan('up')}>
299
+ ? staticHtml `<${button}
300
+ part="pan-up"
301
+ exportparts="button: pan-up-button, live: pan-up-live, spinner: pan-up-spinner, text: pan-up-text"
302
+ label=${this.panLabel('up')}
303
+ material=${ground}
304
+ ?raised=${raised}
305
+ @click=${() => this.pan('up')}
306
+ @helix-press=${stopPress}
307
+ >
278
308
  <slot name="pan-up-icon">${up}</slot>
279
- </button>
280
- <button part="pan-start" aria-label=${this.panLabel('start')} type="button" @click=${() => this.pan('start')}>
309
+ </${button}>
310
+ <${button}
311
+ part="pan-start"
312
+ exportparts="button: pan-start-button, live: pan-start-live, spinner: pan-start-spinner, text: pan-start-text"
313
+ label=${this.panLabel('start')}
314
+ material=${ground}
315
+ ?raised=${raised}
316
+ @click=${() => this.pan('start')}
317
+ @helix-press=${stopPress}
318
+ >
281
319
  <slot name="pan-start-icon">${start}</slot>
282
- </button>
283
- <button part="pan-end" aria-label=${this.panLabel('end')} type="button" @click=${() => this.pan('end')}>
320
+ </${button}>
321
+ <${button}
322
+ part="pan-end"
323
+ exportparts="button: pan-end-button, live: pan-end-live, spinner: pan-end-spinner, text: pan-end-text"
324
+ label=${this.panLabel('end')}
325
+ material=${ground}
326
+ ?raised=${raised}
327
+ @click=${() => this.pan('end')}
328
+ @helix-press=${stopPress}
329
+ >
284
330
  <slot name="pan-end-icon">${end}</slot>
285
- </button>
286
- <button part="pan-down" aria-label=${this.panLabel('down')} type="button" @click=${() => this.pan('down')}>
331
+ </${button}>
332
+ <${button}
333
+ part="pan-down"
334
+ exportparts="button: pan-down-button, live: pan-down-live, spinner: pan-down-spinner, text: pan-down-text"
335
+ label=${this.panLabel('down')}
336
+ material=${ground}
337
+ ?raised=${raised}
338
+ @click=${() => this.pan('down')}
339
+ @helix-press=${stopPress}
340
+ >
287
341
  <slot name="pan-down-icon">${down}</slot>
288
- </button>`
342
+ </${button}>`
289
343
  : nothing}
290
344
  ${zoom
291
- ? html `<button part="zoom-in" aria-label=${this.zoomInLabel} type="button" @click=${() => this.zoom(1)}>
345
+ ? staticHtml `<${button}
346
+ part="zoom-in"
347
+ exportparts="button: zoom-in-button, live: zoom-in-live, spinner: zoom-in-spinner, text: zoom-in-text"
348
+ label=${this.zoomInLabel}
349
+ material=${ground}
350
+ ?raised=${raised}
351
+ @click=${() => this.zoom(1)}
352
+ @helix-press=${stopPress}
353
+ >
292
354
  <slot name="zoom-in-icon">+</slot>
293
- </button>
294
- <button part="zoom-out" aria-label=${this.zoomOutLabel} type="button" @click=${() => this.zoom(-1)}>
355
+ </${button}>
356
+ <${button}
357
+ part="zoom-out"
358
+ exportparts="button: zoom-out-button, live: zoom-out-live, spinner: zoom-out-spinner, text: zoom-out-text"
359
+ label=${this.zoomOutLabel}
360
+ material=${ground}
361
+ ?raised=${raised}
362
+ @click=${() => this.zoom(-1)}
363
+ @helix-press=${stopPress}
364
+ >
295
365
  <slot name="zoom-out-icon">−</slot>
296
- </button>`
366
+ </${button}>`
297
367
  : nothing}
298
368
  ${more}
299
369
  ${fullscreen
300
- ? html `<button
370
+ ? staticHtml `<${button}
301
371
  part="fullscreen"
302
- aria-label=${this.fullscreenLabel}
372
+ exportparts="button: fullscreen-button, live: fullscreen-live, spinner: fullscreen-spinner, text: fullscreen-text"
303
373
  aria-pressed=${this.filled ? 'true' : 'false'}
304
- type="button"
374
+ label=${this.fullscreenLabel}
375
+ material=${ground}
376
+ ?raised=${raised}
305
377
  @click=${this.toggleFullscreen}
378
+ @helix-press=${stopPress}
306
379
  >
307
380
  <slot name="fullscreen-icon">⤢</slot>
308
- </button>`
381
+ </${button}>`
309
382
  : nothing}
310
383
  </div>`;
311
384
  }
package/dist/version.d.ts CHANGED
@@ -6,4 +6,4 @@
6
6
  * release, so the two never disagree; a spec beside this holds them to it.
7
7
  * Nothing else in the running code knows which release it is.
8
8
  */
9
- export declare const VERSION = "0.209.0";
9
+ export declare const VERSION = "0.211.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.209.0';
1
+ export const VERSION = '0.211.0';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fusion.dev/helix-core",
3
3
  "description": "Helix element primitives: base classes, mixins, decorators, utilities.",
4
- "version": "0.209.0",
4
+ "version": "0.211.0",
5
5
  "license": "MIT",
6
6
  "author": "Ross Sheppard <ross.sheppard@fusion.dev>",
7
7
  "repository": {
@@ -81,12 +81,12 @@
81
81
  "bugs": "https://github.com/project-fusion/fusion/issues",
82
82
  "dependencies": {
83
83
  "@floating-ui/dom": "^1.8.0",
84
- "@fusion.dev/helix-icons": "0.209.0",
84
+ "@fusion.dev/helix-icons": "0.211.0",
85
85
  "tslib": "^2.8.1"
86
86
  },
87
87
  "devDependencies": {
88
- "@fusion.dev/helix-cem": "0.209.0",
89
- "@fusion.dev/helix-testing": "0.209.0",
88
+ "@fusion.dev/helix-cem": "0.211.0",
89
+ "@fusion.dev/helix-testing": "0.211.0",
90
90
  "@lit-labs/ssr": "^4.1.0",
91
91
  "lit": "^3.2.1"
92
92
  },