@operato/board 10.29.93 → 10.29.94

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@operato/board",
3
- "version": "10.29.93",
3
+ "version": "10.29.94",
4
4
  "description": "Webcomponent for board following open-wc recommendations",
5
5
  "author": "heartyoh",
6
6
  "type": "module",
@@ -142,17 +142,17 @@
142
142
  "dependencies": {
143
143
  "@material/web": "^2.0.0",
144
144
  "@open-wc/scoped-elements": "^2.1.3",
145
- "@operato/app": "^10.29.90",
146
- "@operato/data-grist": "^10.29.90",
147
- "@operato/font": "^10.29.90",
145
+ "@operato/app": "^10.29.94",
146
+ "@operato/data-grist": "^10.29.94",
147
+ "@operato/font": "^10.29.94",
148
148
  "@operato/graphql": "^10.29.85",
149
149
  "@operato/i18n": "^10.29.85",
150
- "@operato/input": "^10.29.90",
151
- "@operato/layout": "^10.29.90",
150
+ "@operato/input": "^10.29.94",
151
+ "@operato/layout": "^10.29.94",
152
152
  "@operato/markdown": "^10.29.83",
153
- "@operato/popup": "^10.29.85",
154
- "@operato/property-editor": "^10.29.90",
155
- "@operato/property-panel": "^10.29.92",
153
+ "@operato/popup": "^10.29.94",
154
+ "@operato/property-editor": "^10.29.94",
155
+ "@operato/property-panel": "^10.29.94",
156
156
  "@operato/styles": "^10.29.83",
157
157
  "@operato/utils": "^10.29.85",
158
158
  "@types/file-saver": "^2.0.4",
@@ -203,5 +203,5 @@
203
203
  "prettier --write"
204
204
  ]
205
205
  },
206
- "gitHead": "88ca21118763ca3b8cf42cd9eb9809bfc1c03051"
206
+ "gitHead": "5172807a0136c6f14dda157d1589abfbe35f892e"
207
207
  }
@@ -1,43 +0,0 @@
1
- import { LitElement } from 'lit';
2
- /**
3
- * A scene's actions menu (ADR-0209 amendment 1, decision 8), drawn as the scene draws its own popups -- the dark card of
4
- * the standard summary (`InfoWindow`) -- rather than as an application drop-down. It stands at the point pressed, kept
5
- * inside the window, and closes on a pick, Escape or a press outside.
6
- */
7
- export interface SceneActionMenuEntry {
8
- text: string;
9
- /** The action it runs: consecutive entries of one action make a group (a capability's commands) */
10
- action: string;
11
- run: () => void;
12
- }
13
- /**
14
- * Where the dividers go: between runs of one action, where either run has more than one entry -- so "Info · Open 360"
15
- * stay together and the commands stand apart, without a line under every single entry.
16
- */
17
- export declare function menuDividersBefore(entries: readonly {
18
- action: string;
19
- }[]): Set<number>;
20
- /** The menu's corner so that it stays inside the window: to the right and below the point, else flipped. */
21
- export declare function menuCorner(x: number, y: number, width: number, height: number, view: {
22
- width: number;
23
- height: number;
24
- }): {
25
- left: number;
26
- top: number;
27
- };
28
- export declare class OxSceneActionMenu extends LitElement {
29
- static styles: import("lit").CSSResult;
30
- entries: SceneActionMenuEntry[];
31
- private active;
32
- private dividers;
33
- private onOutside;
34
- render(): import("lit-html").TemplateResult<1>;
35
- connectedCallback(): void;
36
- disconnectedCallback(): void;
37
- firstUpdated(): void;
38
- pick(index: number): void;
39
- close: () => void;
40
- private onKey;
41
- /** Opens one menu at a point; an open one closes first. */
42
- static open(entries: SceneActionMenuEntry[], x: number, y: number): OxSceneActionMenu;
43
- }
@@ -1,163 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import { css, html, LitElement } from 'lit';
3
- import { customElement, property, state } from 'lit/decorators.js';
4
- /**
5
- * Where the dividers go: between runs of one action, where either run has more than one entry -- so "Info · Open 360"
6
- * stay together and the commands stand apart, without a line under every single entry.
7
- */
8
- export function menuDividersBefore(entries) {
9
- const runs = [];
10
- entries.forEach((entry, i) => {
11
- const last = runs[runs.length - 1];
12
- if (last && entries[last.start].action === entry.action)
13
- last.length++;
14
- else
15
- runs.push({ start: i, length: 1 });
16
- });
17
- const out = new Set();
18
- for (let i = 1; i < runs.length; i++)
19
- if (runs[i].length > 1 || runs[i - 1].length > 1)
20
- out.add(runs[i].start);
21
- return out;
22
- }
23
- /** The menu's corner so that it stays inside the window: to the right and below the point, else flipped. */
24
- export function menuCorner(x, y, width, height, view) {
25
- const margin = 8;
26
- const left = x + width + margin > view.width ? Math.max(margin, x - width) : x;
27
- const top = y + height + margin > view.height ? Math.max(margin, y - height) : y;
28
- return { left, top };
29
- }
30
- let OxSceneActionMenu = class OxSceneActionMenu extends LitElement {
31
- constructor() {
32
- super(...arguments);
33
- this.entries = [];
34
- this.active = -1;
35
- this.dividers = new Set();
36
- this.onOutside = (e) => {
37
- if (!e.composedPath().includes(this))
38
- this.close();
39
- };
40
- this.close = () => {
41
- this.remove();
42
- };
43
- this.onKey = (e) => {
44
- const n = this.entries.length;
45
- if (e.key === 'Escape')
46
- this.close();
47
- else if (e.key === 'ArrowDown')
48
- this.active = (this.active + 1) % n;
49
- else if (e.key === 'ArrowUp')
50
- this.active = (this.active - 1 + n) % n;
51
- else if (e.key === 'Enter' && this.active >= 0)
52
- this.pick(this.active);
53
- else
54
- return;
55
- e.preventDefault();
56
- e.stopPropagation();
57
- };
58
- }
59
- render() {
60
- this.dividers = menuDividersBefore(this.entries);
61
- return html `${this.entries.map((entry, i) => html `${this.dividers.has(i) ? html `<div part="divider"></div>` : ''}
62
- <button part="entry" ?active=${i === this.active} @click=${() => this.pick(i)} @pointerenter=${() => (this.active = i)}>
63
- ${entry.text}
64
- </button>`)}`;
65
- }
66
- connectedCallback() {
67
- super.connectedCallback();
68
- this.tabIndex = -1;
69
- this.addEventListener('keydown', this.onKey);
70
- /* A press elsewhere closes it -- after this turn, so the press that opened it does not */
71
- setTimeout(() => {
72
- document.addEventListener('pointerdown', this.onOutside, true);
73
- window.addEventListener('blur', this.close);
74
- });
75
- }
76
- disconnectedCallback() {
77
- super.disconnectedCallback();
78
- document.removeEventListener('pointerdown', this.onOutside, true);
79
- window.removeEventListener('blur', this.close);
80
- }
81
- firstUpdated() {
82
- this.focus({ preventScroll: true });
83
- }
84
- pick(index) {
85
- const entry = this.entries[index];
86
- this.close();
87
- entry === null || entry === void 0 ? void 0 : entry.run();
88
- }
89
- /** Opens one menu at a point; an open one closes first. */
90
- static open(entries, x, y) {
91
- document.querySelectorAll('ox-scene-action-menu').forEach(m => m.close());
92
- const menu = document.createElement('ox-scene-action-menu');
93
- menu.entries = entries;
94
- menu.style.left = `${x}px`;
95
- menu.style.top = `${y}px`;
96
- document.body.appendChild(menu);
97
- /* Kept inside the window once its size is known */
98
- menu.updateComplete.then(() => {
99
- const { width, height } = menu.getBoundingClientRect();
100
- const { left, top } = menuCorner(x, y, width, height, { width: window.innerWidth, height: window.innerHeight });
101
- menu.style.left = `${left}px`;
102
- menu.style.top = `${top}px`;
103
- });
104
- return menu;
105
- }
106
- };
107
- OxSceneActionMenu.styles = css `
108
- :host {
109
- position: fixed;
110
- z-index: 1000;
111
- display: block;
112
- min-width: 148px;
113
- padding: 4px;
114
- border-radius: 7px;
115
- background-color: rgba(62, 66, 78, 0.96);
116
- color: #f2f3f5;
117
- font: normal 13px/1.4 helvetica, arial, sans-serif;
118
- box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
119
- animation: appear 120ms ease-out;
120
- outline: none;
121
- user-select: none;
122
- }
123
- @keyframes appear {
124
- from {
125
- opacity: 0;
126
- transform: translateY(-3px);
127
- }
128
- }
129
- [part='entry'] {
130
- display: block;
131
- width: 100%;
132
- box-sizing: border-box;
133
- padding: 6px 12px;
134
- border: 0;
135
- border-radius: 4px;
136
- background: transparent;
137
- color: inherit;
138
- font: inherit;
139
- text-align: left;
140
- white-space: nowrap;
141
- cursor: pointer;
142
- }
143
- [part='entry']:hover,
144
- [part='entry'][active] {
145
- background-color: rgba(255, 255, 255, 0.12);
146
- }
147
- [part='divider'] {
148
- height: 1px;
149
- margin: 4px 8px;
150
- background-color: rgba(255, 255, 255, 0.14);
151
- }
152
- `;
153
- __decorate([
154
- property({ attribute: false })
155
- ], OxSceneActionMenu.prototype, "entries", void 0);
156
- __decorate([
157
- state()
158
- ], OxSceneActionMenu.prototype, "active", void 0);
159
- OxSceneActionMenu = __decorate([
160
- customElement('ox-scene-action-menu')
161
- ], OxSceneActionMenu);
162
- export { OxSceneActionMenu };
163
- //# sourceMappingURL=ox-scene-action-menu.js.map