@fusion.dev/helix-core 0.210.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.
- package/custom-elements.json +1 -1
- package/dist/controllers/aria-forward-controller/aria-forward-controller.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/mixins/mixin-viewport/mixin-viewport.d.ts +18 -0
- package/dist/mixins/mixin-viewport/mixin-viewport.js +79 -17
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
|
@@ -3,6 +3,7 @@ import { elementById } from '../../utils/element-by-id/element-by-id.js';
|
|
|
3
3
|
import { labelsOf } from '../../utils/labels-of/labels-of.js';
|
|
4
4
|
import { nameText } from '../../utils/name-text/name-text.js';
|
|
5
5
|
const RELATIONSHIPS = [
|
|
6
|
+
['aria-controls', 'ariaControlsElements'],
|
|
6
7
|
['aria-describedby', 'ariaDescribedByElements'],
|
|
7
8
|
['aria-labelledby', 'ariaLabelledByElements'],
|
|
8
9
|
];
|
|
@@ -10,7 +11,6 @@ const STATES = [
|
|
|
10
11
|
'aria-current',
|
|
11
12
|
'aria-expanded',
|
|
12
13
|
'aria-haspopup',
|
|
13
|
-
'aria-controls',
|
|
14
14
|
'aria-invalid',
|
|
15
15
|
'aria-pressed',
|
|
16
16
|
'aria-required',
|
package/dist/index.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ export { MixinPickerField, type MixinPickerFieldInterface, } from './mixins/mixi
|
|
|
60
60
|
export { MixinSegmentedField, type MixinSegmentedFieldInterface, } from './mixins/mixin-segmented-field/mixin-segmented-field.js';
|
|
61
61
|
export { MixinSelectableItem, type MixinSelectableItemInterface, } from './mixins/mixin-selectable-item/mixin-selectable-item.js';
|
|
62
62
|
export { MixinTokens, type MixinTokensInterface } from './mixins/mixin-tokens/mixin-tokens.js';
|
|
63
|
-
export { MixinViewport, type ViewportControlsPlacement, type ViewportElement, type ViewportGestureLabels, type ViewportGestureMode, type ViewportGestures, type ViewportWay, } from './mixins/mixin-viewport/mixin-viewport.js';
|
|
63
|
+
export { MixinViewport, type ViewportControlAxes, type ViewportControlsPlacement, type ViewportElement, type ViewportGestureLabels, type ViewportGestureMode, type ViewportGestures, type ViewportWay, } from './mixins/mixin-viewport/mixin-viewport.js';
|
|
64
64
|
export { anchorElement } from './utils/anchor-element/anchor-element.js';
|
|
65
65
|
export { arrowReach, sideOf } from './utils/arrow/arrow.js';
|
|
66
66
|
export { assignSlot, assignSlots } from './utils/assign-slots/assign-slots.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { nothing, type TemplateResult } from 'lit';
|
|
2
|
+
import { type StaticValue } from 'lit/static-html.js';
|
|
2
3
|
import { FullscreenController } from '../../controllers/fullscreen-controller/fullscreen-controller.js';
|
|
3
4
|
import { IdleController } from '../../controllers/idle-controller/idle-controller.js';
|
|
4
5
|
import type { ViewportPanDetail, ViewportZoomDetail } from '../../events/events.js';
|
|
@@ -8,6 +9,15 @@ type Constructor<T> = new (...args: any[]) => T;
|
|
|
8
9
|
export type ViewportWay = 'up' | 'down' | 'start' | 'end';
|
|
9
10
|
/** Where the controls sit, in the corner words the rest of the library uses. */
|
|
10
11
|
export type ViewportControlsPlacement = 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';
|
|
12
|
+
/**
|
|
13
|
+
* The styled axes a surface's controls are drawn with, which the styled tier
|
|
14
|
+
* says and the headless tier leaves unset, having nothing to paint: `raised`,
|
|
15
|
+
* since the controls float over the drawing, and the `material` under them.
|
|
16
|
+
*/
|
|
17
|
+
export interface ViewportControlAxes {
|
|
18
|
+
material?: 'frosted' | 'glass' | 'transparent' | undefined;
|
|
19
|
+
raised: boolean;
|
|
20
|
+
}
|
|
11
21
|
/** Which gestures a surface takes from the page. */
|
|
12
22
|
export type ViewportGestures = 'activate' | 'always' | 'cooperative';
|
|
13
23
|
/**
|
|
@@ -112,6 +122,14 @@ export declare class ViewportElement {
|
|
|
112
122
|
protected drawsControls(group: string): boolean;
|
|
113
123
|
/** More buttons for the group of controls, after zoom, for a family that adds its own. */
|
|
114
124
|
protected renderMoreControls(): TemplateResult | typeof nothing;
|
|
125
|
+
/**
|
|
126
|
+
* The element each control is drawn as: the family's own Icon Button, which
|
|
127
|
+
* the family names with `this.tag('icon-button')` so its source says what it
|
|
128
|
+
* renders and its imports register it.
|
|
129
|
+
*/
|
|
130
|
+
protected get controlTag(): StaticValue;
|
|
131
|
+
/** The styled axes each control is drawn with, unset on the headless tier. */
|
|
132
|
+
protected get controlAxes(): ViewportControlAxes;
|
|
115
133
|
/** Answers a key the family adds, and says whether it did. */
|
|
116
134
|
protected handleMoreKeys(event: KeyboardEvent): boolean;
|
|
117
135
|
/** What one pan control is called, for a family that draws its own. */
|
|
@@ -1,6 +1,7 @@
|
|
|
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';
|
|
6
7
|
import { ToolbarController } from '../../controllers/toolbar-controller/toolbar-controller.js';
|
|
@@ -8,6 +9,7 @@ import { inlineStep } from '../../utils/inline-step/inline-step.js';
|
|
|
8
9
|
import { isRtl } from '../../utils/is-rtl/is-rtl.js';
|
|
9
10
|
import { numberConverter, timeConverter } from '../../utils/number-converter/number-converter.js';
|
|
10
11
|
import { formatWords, words } from '../../words/words.js';
|
|
12
|
+
const stopPress = (event) => event.stopPropagation();
|
|
11
13
|
const HINT_SHOWS = 1600;
|
|
12
14
|
export const MixinViewport = (Base) => {
|
|
13
15
|
class Viewport extends Base {
|
|
@@ -260,6 +262,12 @@ export const MixinViewport = (Base) => {
|
|
|
260
262
|
? this.panLeftLabel
|
|
261
263
|
: this.panRightLabel;
|
|
262
264
|
}
|
|
265
|
+
get controlTag() {
|
|
266
|
+
return this.tag('icon-button');
|
|
267
|
+
}
|
|
268
|
+
get controlAxes() {
|
|
269
|
+
return { raised: false };
|
|
270
|
+
}
|
|
263
271
|
panGlyph(way) {
|
|
264
272
|
return { down: '↓', left: '←', right: '→', up: '↑' }[this.sideOf(way)] ?? '';
|
|
265
273
|
}
|
|
@@ -283,40 +291,94 @@ export const MixinViewport = (Base) => {
|
|
|
283
291
|
return nothing;
|
|
284
292
|
}
|
|
285
293
|
const [up, start, end, down] = ['up', 'start', 'end', 'down'].map((way) => this.panGlyph(way));
|
|
286
|
-
|
|
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}>
|
|
287
298
|
${pan
|
|
288
|
-
?
|
|
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
|
+
>
|
|
289
308
|
<slot name="pan-up-icon">${up}</slot>
|
|
290
|
-
|
|
291
|
-
|
|
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
|
+
>
|
|
292
319
|
<slot name="pan-start-icon">${start}</slot>
|
|
293
|
-
|
|
294
|
-
|
|
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
|
+
>
|
|
295
330
|
<slot name="pan-end-icon">${end}</slot>
|
|
296
|
-
|
|
297
|
-
|
|
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
|
+
>
|
|
298
341
|
<slot name="pan-down-icon">${down}</slot>
|
|
299
|
-
|
|
342
|
+
</${button}>`
|
|
300
343
|
: nothing}
|
|
301
344
|
${zoom
|
|
302
|
-
?
|
|
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
|
+
>
|
|
303
354
|
<slot name="zoom-in-icon">+</slot>
|
|
304
|
-
|
|
305
|
-
|
|
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
|
+
>
|
|
306
365
|
<slot name="zoom-out-icon">−</slot>
|
|
307
|
-
|
|
366
|
+
</${button}>`
|
|
308
367
|
: nothing}
|
|
309
368
|
${more}
|
|
310
369
|
${fullscreen
|
|
311
|
-
?
|
|
370
|
+
? staticHtml `<${button}
|
|
312
371
|
part="fullscreen"
|
|
313
|
-
|
|
372
|
+
exportparts="button: fullscreen-button, live: fullscreen-live, spinner: fullscreen-spinner, text: fullscreen-text"
|
|
314
373
|
aria-pressed=${this.filled ? 'true' : 'false'}
|
|
315
|
-
|
|
374
|
+
label=${this.fullscreenLabel}
|
|
375
|
+
material=${ground}
|
|
376
|
+
?raised=${raised}
|
|
316
377
|
@click=${this.toggleFullscreen}
|
|
378
|
+
@helix-press=${stopPress}
|
|
317
379
|
>
|
|
318
380
|
<slot name="fullscreen-icon">⤢</slot>
|
|
319
|
-
|
|
381
|
+
</${button}>`
|
|
320
382
|
: nothing}
|
|
321
383
|
</div>`;
|
|
322
384
|
}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '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.
|
|
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.
|
|
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.
|
|
89
|
-
"@fusion.dev/helix-testing": "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
|
},
|