@fusion.dev/helix-headless 0.211.1 → 0.212.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.
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Where a point on the drawn screen lands on the device, with the picture
3
+ * turned by `rotation`.
4
+ *
5
+ * **The device's units are its own way up.** A source that sends frames in the
6
+ * device's natural orientation, a phone's portrait, keeps sending them that
7
+ * way while the device is turned, and the frame turns the picture to show it.
8
+ * A tap on the turned picture still has to reach the device at the point it
9
+ * names in its own orientation, so every point is turned back before it is
10
+ * sent, and every point drawn from the device is turned forward.
11
+ *
12
+ * Points here are fractions of a box, from `0` at the left and top to `1` at
13
+ * the right and bottom, so the arithmetic needs no sizes.
14
+ */
15
+ /** A point as a fraction of a box, across and down. */
16
+ export interface Fraction {
17
+ /** Across, from `0` at the left edge to `1` at the right. */
18
+ u: number;
19
+ /** Down, from `0` at the top edge to `1` at the bottom. */
20
+ v: number;
21
+ }
22
+ /**
23
+ * How many quarter turns clockwise a rotation in degrees is, from `0` to `3`.
24
+ * A rotation between quarters goes to the nearest one, and a negative one
25
+ * turns the other way.
26
+ */
27
+ export declare const quarterTurns: (degrees: number) => 0 | 1 | 2 | 3;
28
+ /**
29
+ * A point on the drawn picture, turned back to the device's own way up.
30
+ * The picture is turned `turns` quarters clockwise from the device.
31
+ */
32
+ export declare const unturn: ({ u, v }: Fraction, turns: number) => Fraction;
33
+ /** A point on the device, turned forward to where it is drawn. */
34
+ export declare const turn: ({ u, v }: Fraction, turns: number) => Fraction;
35
+ /**
36
+ * A distance on the drawn picture, turned back to the device's own way up.
37
+ * A distance turns as a point does and keeps no origin, so a scroll down a
38
+ * picture turned a quarter clockwise is a scroll toward the device's right,
39
+ * whose left edge is drawn along the top.
40
+ */
41
+ export declare const unturnDistance: ({ u, v }: Fraction, turns: number) => Fraction;
@@ -0,0 +1,42 @@
1
+ export const quarterTurns = (degrees) => {
2
+ if (!Number.isFinite(degrees)) {
3
+ return 0;
4
+ }
5
+ return (((Math.round(degrees / 90) % 4) + 4) % 4);
6
+ };
7
+ export const unturn = ({ u, v }, turns) => {
8
+ switch (turns) {
9
+ case 1:
10
+ return { u: v, v: 1 - u };
11
+ case 2:
12
+ return { u: 1 - u, v: 1 - v };
13
+ case 3:
14
+ return { u: 1 - v, v: u };
15
+ default:
16
+ return { u, v };
17
+ }
18
+ };
19
+ export const turn = ({ u, v }, turns) => {
20
+ switch (turns) {
21
+ case 1:
22
+ return { u: 1 - v, v: u };
23
+ case 2:
24
+ return { u: 1 - u, v: 1 - v };
25
+ case 3:
26
+ return { u: v, v: 1 - u };
27
+ default:
28
+ return { u, v };
29
+ }
30
+ };
31
+ export const unturnDistance = ({ u, v }, turns) => {
32
+ switch (turns) {
33
+ case 1:
34
+ return { u: v, v: -u };
35
+ case 2:
36
+ return { u: -u, v: -v };
37
+ case 3:
38
+ return { u: -v, v: u };
39
+ default:
40
+ return { u, v };
41
+ }
42
+ };
@@ -107,6 +107,16 @@ registerElementEvents({
107
107
  'toggle',
108
108
  ],
109
109
  'helix-headless-date-picker': ['change', 'helix-before-change', 'helix-navigate', 'input'],
110
+ 'helix-headless-device-screen': [
111
+ 'helix-device-button',
112
+ 'helix-device-key',
113
+ 'helix-device-screenshot',
114
+ 'helix-device-scroll',
115
+ 'helix-device-swipe',
116
+ 'helix-device-tap',
117
+ 'helix-device-text',
118
+ 'helix-device-touch',
119
+ ],
110
120
  'helix-headless-dialog': ['close', 'helix-before-close', 'helix-before-open', 'toggle'],
111
121
  'helix-headless-donut-chart': ['helix-reading-change', 'helix-reading-press'],
112
122
  'helix-headless-drawer': ['close', 'helix-before-close', 'helix-before-open', 'toggle'],
@@ -1,5 +1,5 @@
1
1
  import { __decorate } from "tslib";
2
- import { auditName, customElement, formatWords, HelixElement, HelixGraphFilterEvent, HelixGraphLayoutEvent, HelixGraphPanEvent, HelixGraphPartChangeEvent, HelixGraphReadyEvent, HelixGraphSignalEvent, HelixGraphZoomEvent, isRtl, MixinControllerActive, MixinViewport, numberConverter, SCROLLER_RULE, scrollRoom, scrollWithin, ToolbarController, Typeahead, VIRTUAL_RULE, VirtualizeController, words, wordsLocale, } from '@fusion.dev/helix-core';
2
+ import { auditName, customElement, formatWords, HelixElement, HelixGraphFilterEvent, HelixGraphLayoutEvent, HelixGraphPanEvent, HelixGraphPartChangeEvent, HelixGraphReadyEvent, HelixGraphSignalEvent, HelixGraphZoomEvent, isRtl, MixinControllerActive, MixinViewport, numberConverter, SCROLLER_RULE, scrollRoom, scrollWithin, stopPress, ToolbarController, Typeahead, VIRTUAL_RULE, VirtualizeController, words, wordsLocale, } from '@fusion.dev/helix-core';
3
3
  import { list, magnifyingGlass } from '@fusion.dev/helix-icons';
4
4
  import { html, nothing } from 'lit';
5
5
  import { property, state } from 'lit/decorators.js';
@@ -9,7 +9,6 @@ import { repeat } from 'lit/directives/repeat.js';
9
9
  import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
10
10
  import { adjacencyOf, cursorAfter, entriesOf, groupsOf, nameOf, sortedOf, within, withoutGroups, } from './graph-model.js';
11
11
  const LONG_LAYOUT = 5000;
12
- const stopPress = (event) => event.stopPropagation();
13
12
  let HelixHeadlessGraph = class HelixHeadlessGraph extends MixinViewport(MixinControllerActive(HelixElement)) {
14
13
  constructor() {
15
14
  super(...arguments);
package/dist/index.d.ts CHANGED
@@ -38,6 +38,7 @@ export * from './data-table/index.js';
38
38
  export * from './date-input/index.js';
39
39
  export * from './date-picker/index.js';
40
40
  export * from './description-list/index.js';
41
+ export * from './device-screen/index.js';
41
42
  export * from './dialog/index.js';
42
43
  export * from './divider/index.js';
43
44
  export * from './donut-chart/index.js';
package/dist/index.js CHANGED
@@ -29,6 +29,7 @@ export * from './data-table/index.js';
29
29
  export * from './date-input/index.js';
30
30
  export * from './date-picker/index.js';
31
31
  export * from './description-list/index.js';
32
+ export * from './device-screen/index.js';
32
33
  export * from './dialog/index.js';
33
34
  export * from './divider/index.js';
34
35
  export * from './donut-chart/index.js';
@@ -1,5 +1,5 @@
1
1
  import { __decorate } from "tslib";
2
- import { auditName, customElement, focusItemOf, formatWords, HelixActivateEvent, HelixBeforeChangeEvent, HelixBeforeToggleEvent, HelixElement, HelixMapClusterEvent, HelixMapPanEvent, HelixMapPartChangeEvent, HelixMapReadyEvent, HelixMapRotateEvent, HelixMapTiltEvent, HelixMapZoomEvent, HelixToggleEvent, hostAria, KeyboardNavigationController, MixinViewport, numberConverter, requestChange, words, } from '@fusion.dev/helix-core';
2
+ import { auditName, customElement, focusItemOf, formatWords, HelixActivateEvent, HelixBeforeChangeEvent, HelixBeforeToggleEvent, HelixElement, HelixMapClusterEvent, HelixMapPanEvent, HelixMapPartChangeEvent, HelixMapReadyEvent, HelixMapRotateEvent, HelixMapTiltEvent, HelixMapZoomEvent, HelixToggleEvent, hostAria, KeyboardNavigationController, MixinViewport, numberConverter, requestChange, stopPress, words, } from '@fusion.dev/helix-core';
3
3
  import { buildings, cloudRain, dotsNine, leaf, mountains, path, polygon, stack, target, } from '@fusion.dev/helix-icons';
4
4
  import { html, nothing } from 'lit';
5
5
  import { property, state } from 'lit/decorators.js';
@@ -36,7 +36,6 @@ const TILTED = 50;
36
36
  const placed = (marker) => Number.isFinite(marker.lat) && Number.isFinite(marker.lng);
37
37
  const ASK_LAPSES = 3000;
38
38
  const SETTLES = 400;
39
- const stopPress = (event) => event.stopPropagation();
40
39
  let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement) {
41
40
  constructor() {
42
41
  super(...arguments);
@@ -1,5 +1,5 @@
1
1
  import { __decorate } from "tslib";
2
- import { CopyController, customElement, drawIcon, FullscreenController, formatWords, HelixElement, HelixTerminalBellEvent, HelixTerminalInputEvent, HelixTerminalLinkEvent, HelixTerminalResizeEvent, HelixTerminalRestartEvent, HelixTerminalTitleEvent, numberConverter, onApple, words, } from '@fusion.dev/helix-core';
2
+ import { CopyController, customElement, drawIcon, FullscreenController, formatWords, HelixElement, HelixTerminalBellEvent, HelixTerminalInputEvent, HelixTerminalLinkEvent, HelixTerminalResizeEvent, HelixTerminalRestartEvent, HelixTerminalTitleEvent, numberConverter, onApple, stopPress, words, } from '@fusion.dev/helix-core';
3
3
  import { arrowClockwise, broom, caretDown, caretUp, copy, cornersOut, magnifyingGlass, x, } from '@fusion.dev/helix-icons';
4
4
  import { nothing } from 'lit';
5
5
  import { property, state } from 'lit/decorators.js';
@@ -13,7 +13,6 @@ import { isTab, shortcutOf, spokenChord } from '../keys.js';
13
13
  const ANSI = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white'];
14
14
  const camel = (name) => name.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
15
15
  const unset = (color) => color === '' || color === 'transparent' || /^rgba\(\s*0,\s*0,\s*0,\s*0\s*\)$/.test(color);
16
- const stopPress = (event) => event.stopPropagation();
17
16
  const BELL = 200;
18
17
  const RESTING_CONTROLS = 'find clear';
19
18
  const opens = (href) => /^https?:\/\//i.test(href);