@omegagrid/core 0.10.25 → 0.10.26
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/dist/ui/annotation.d.ts +40 -0
- package/dist/ui/annotation.d.ts.map +1 -0
- package/dist/ui/annotation.js +354 -0
- package/dist/ui/annotation.js.map +1 -0
- package/dist/ui/annotation.style.d.ts +2 -0
- package/dist/ui/annotation.style.d.ts.map +1 -0
- package/dist/ui/annotation.style.js +90 -0
- package/dist/ui/annotation.style.js.map +1 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +1 -0
- package/dist/ui/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class AnnotationTool extends LitElement {
|
|
3
|
+
logoSvg: string;
|
|
4
|
+
colors: string[];
|
|
5
|
+
static styles: import("lit").CSSResult[];
|
|
6
|
+
private color;
|
|
7
|
+
private calloutNum;
|
|
8
|
+
private toolVisible;
|
|
9
|
+
private fillEnabled;
|
|
10
|
+
private arrowMode;
|
|
11
|
+
private tbLeft;
|
|
12
|
+
private tbTop;
|
|
13
|
+
private capturing;
|
|
14
|
+
private rl;
|
|
15
|
+
private cl;
|
|
16
|
+
private history;
|
|
17
|
+
private dragging;
|
|
18
|
+
private sx;
|
|
19
|
+
private sy;
|
|
20
|
+
private curRect;
|
|
21
|
+
private curArrow;
|
|
22
|
+
private tbDrag;
|
|
23
|
+
private tbOx;
|
|
24
|
+
private tbOy;
|
|
25
|
+
connectedCallback(): void;
|
|
26
|
+
disconnectedCallback(): void;
|
|
27
|
+
private _makeArrowEl;
|
|
28
|
+
private _doUndo;
|
|
29
|
+
private _doClear;
|
|
30
|
+
private _nextColor;
|
|
31
|
+
private _copyScreenshot;
|
|
32
|
+
private _onKeyDown;
|
|
33
|
+
private _onTbMouseDown;
|
|
34
|
+
private _onLayerMouseDown;
|
|
35
|
+
private _onLayerContextMenu;
|
|
36
|
+
private _onMouseMove;
|
|
37
|
+
private _onMouseUp;
|
|
38
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=annotation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotation.d.ts","sourceRoot":"","sources":["../../src/ui/annotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAiB,MAAM,KAAK,CAAC;AAWhD,qBACa,cAAe,SAAQ,UAAU;IAG7C,OAAO,EAAE,MAAM,CAAoB;IAGnC,MAAM,EAAE,MAAM,EAAE,CAAkB;IAElC,MAAM,CAAC,MAAM,4BAAW;IAEf,OAAO,CAAC,KAAK,CAAkB;IAC/B,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,SAAS,CAAS;IAErB,OAAO,CAAC,EAAE,CAAe;IACzB,OAAO,CAAC,EAAE,CAAe;IAEvC,OAAO,CAAC,OAAO,CAAuC;IACtD,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,EAAE,CAAK;IACf,OAAO,CAAC,EAAE,CAAK;IACf,OAAO,CAAC,OAAO,CAA+B;IAC9C,OAAO,CAAC,QAAQ,CAA4B;IAC5C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,IAAI,CAAK;IACjB,OAAO,CAAC,IAAI,CAAK;IAEjB,iBAAiB;IAOjB,oBAAoB;IAOpB,OAAO,CAAC,YAAY;IAqBpB,OAAO,CAAC,OAAO;IAOf,OAAO,CAAC,QAAQ;IAOhB,OAAO,CAAC,UAAU;YAMJ,eAAe;IAoC7B,OAAO,CAAC,UAAU,CAgBhB;IAEF,OAAO,CAAC,cAAc,CAOpB;IAEF,OAAO,CAAC,iBAAiB,CAkBvB;IAEF,OAAO,CAAC,mBAAmB,CAQzB;IAEF,OAAO,CAAC,YAAY,CAgBlB;IAEF,OAAO,CAAC,UAAU,CAgBhB;IAEF,MAAM;CAgEN"}
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, html, nothing } from 'lit';
|
|
8
|
+
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
9
|
+
import { styleMap } from 'lit/directives/style-map.js';
|
|
10
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
11
|
+
import constants from '../constants';
|
|
12
|
+
import { style } from './annotation.style';
|
|
13
|
+
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
14
|
+
const DEFAULT_COLORS = ['#007AFF', '#34C759', '#FF9500', '#AF52DE', '#FF3B30', '#00ffff', '#636363'];
|
|
15
|
+
const DEFAULT_LOGO_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="28" height="28"><path fill="#5ec7d1" d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"/></svg>`;
|
|
16
|
+
let AnnotationTool = class AnnotationTool extends LitElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.logoSvg = DEFAULT_LOGO_SVG;
|
|
20
|
+
this.colors = DEFAULT_COLORS;
|
|
21
|
+
this.color = this.colors[0];
|
|
22
|
+
this.calloutNum = 1;
|
|
23
|
+
this.toolVisible = true;
|
|
24
|
+
this.fillEnabled = false;
|
|
25
|
+
this.arrowMode = false;
|
|
26
|
+
this.tbLeft = null;
|
|
27
|
+
this.tbTop = null;
|
|
28
|
+
this.capturing = false;
|
|
29
|
+
this.history = [];
|
|
30
|
+
this.dragging = false;
|
|
31
|
+
this.sx = 0;
|
|
32
|
+
this.sy = 0;
|
|
33
|
+
this.curRect = null;
|
|
34
|
+
this.curArrow = null;
|
|
35
|
+
this.tbDrag = false;
|
|
36
|
+
this.tbOx = 0;
|
|
37
|
+
this.tbOy = 0;
|
|
38
|
+
this._onKeyDown = (e) => {
|
|
39
|
+
if (e.key === ';' || e.key === '`') {
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
this.toolVisible = !this.toolVisible;
|
|
42
|
+
}
|
|
43
|
+
if (this.toolVisible && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
44
|
+
if (e.key === 'z') {
|
|
45
|
+
e.preventDefault();
|
|
46
|
+
this._doUndo();
|
|
47
|
+
}
|
|
48
|
+
if (e.key === 'r') {
|
|
49
|
+
const tag = document.activeElement?.tagName;
|
|
50
|
+
if (tag !== 'INPUT' && tag !== 'TEXTAREA') {
|
|
51
|
+
e.preventDefault();
|
|
52
|
+
this._doClear();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (e.key === 'c') {
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
this._nextColor();
|
|
58
|
+
}
|
|
59
|
+
if (e.key === 'f') {
|
|
60
|
+
e.preventDefault();
|
|
61
|
+
this.fillEnabled = !this.fillEnabled;
|
|
62
|
+
}
|
|
63
|
+
if (e.key === 'a') {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
this.arrowMode = !this.arrowMode;
|
|
66
|
+
}
|
|
67
|
+
if (e.key === 's') {
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
this._copyScreenshot();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
this._onTbMouseDown = (e) => {
|
|
74
|
+
if (e.target !== e.currentTarget)
|
|
75
|
+
return;
|
|
76
|
+
this.tbDrag = true;
|
|
77
|
+
const tb = this.shadowRoot.querySelector('.tb');
|
|
78
|
+
const rect = tb.getBoundingClientRect();
|
|
79
|
+
this.tbOx = e.clientX - rect.left;
|
|
80
|
+
this.tbOy = e.clientY - rect.top;
|
|
81
|
+
};
|
|
82
|
+
this._onLayerMouseDown = (e) => {
|
|
83
|
+
e.stopPropagation();
|
|
84
|
+
if (e.button !== 0)
|
|
85
|
+
return;
|
|
86
|
+
this.dragging = true;
|
|
87
|
+
this.sx = e.clientX;
|
|
88
|
+
this.sy = e.clientY;
|
|
89
|
+
if (this.arrowMode) {
|
|
90
|
+
this.curArrow = this._makeArrowEl(this.sx, this.sy, this.sx, this.sy, this.color);
|
|
91
|
+
if (this.curArrow)
|
|
92
|
+
this.rl.appendChild(this.curArrow);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
this.curRect = document.createElementNS(SVG_NS, 'rect');
|
|
96
|
+
this.curRect.setAttribute('fill', this.fillEnabled ? this.color : 'none');
|
|
97
|
+
this.curRect.setAttribute('fill-opacity', this.fillEnabled ? '0.2' : '1');
|
|
98
|
+
this.curRect.setAttribute('stroke', this.color);
|
|
99
|
+
this.curRect.setAttribute('stroke-width', '2.5');
|
|
100
|
+
this.curRect.setAttribute('rx', '4');
|
|
101
|
+
this.rl.appendChild(this.curRect);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
this._onLayerContextMenu = (e) => {
|
|
105
|
+
e.preventDefault();
|
|
106
|
+
e.stopPropagation();
|
|
107
|
+
const g = document.createElementNS(SVG_NS, 'g');
|
|
108
|
+
g.innerHTML = `<circle cx="${e.clientX}" cy="${e.clientY}" r="14" fill="${this.color}"/><text x="${e.clientX}" y="${e.clientY + 5}" text-anchor="middle" fill="white" font-size="13" font-weight="bold" font-family="system-ui,sans-serif">${this.calloutNum}</text>`;
|
|
109
|
+
this.cl.appendChild(g);
|
|
110
|
+
this.history.push({ type: 'callout', el: g });
|
|
111
|
+
this.calloutNum++;
|
|
112
|
+
};
|
|
113
|
+
this._onMouseMove = (e) => {
|
|
114
|
+
if (this.tbDrag) {
|
|
115
|
+
this.tbLeft = e.clientX - this.tbOx;
|
|
116
|
+
this.tbTop = e.clientY - this.tbOy;
|
|
117
|
+
}
|
|
118
|
+
if (!this.dragging)
|
|
119
|
+
return;
|
|
120
|
+
if (this.arrowMode) {
|
|
121
|
+
if (this.curArrow)
|
|
122
|
+
this.curArrow.remove();
|
|
123
|
+
this.curArrow = this._makeArrowEl(this.sx, this.sy, e.clientX, e.clientY, this.color);
|
|
124
|
+
if (this.curArrow)
|
|
125
|
+
this.rl.appendChild(this.curArrow);
|
|
126
|
+
}
|
|
127
|
+
else if (this.curRect) {
|
|
128
|
+
this.curRect.setAttribute('x', String(Math.min(e.clientX, this.sx)));
|
|
129
|
+
this.curRect.setAttribute('y', String(Math.min(e.clientY, this.sy)));
|
|
130
|
+
this.curRect.setAttribute('width', String(Math.abs(e.clientX - this.sx)));
|
|
131
|
+
this.curRect.setAttribute('height', String(Math.abs(e.clientY - this.sy)));
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
this._onMouseUp = (e) => {
|
|
135
|
+
this.tbDrag = false;
|
|
136
|
+
if (!this.dragging)
|
|
137
|
+
return;
|
|
138
|
+
this.dragging = false;
|
|
139
|
+
if (Math.abs(e.clientX - this.sx) < 5 && Math.abs(e.clientY - this.sy) < 5) {
|
|
140
|
+
this.curRect?.remove();
|
|
141
|
+
this.curRect = null;
|
|
142
|
+
this.curArrow?.remove();
|
|
143
|
+
this.curArrow = null;
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (this.arrowMode) {
|
|
147
|
+
if (this.curArrow)
|
|
148
|
+
this.history.push({ type: 'arrow', el: this.curArrow });
|
|
149
|
+
this.curArrow = null;
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
if (this.curRect)
|
|
153
|
+
this.history.push({ type: 'rect', el: this.curRect });
|
|
154
|
+
this.curRect = null;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
connectedCallback() {
|
|
159
|
+
super.connectedCallback();
|
|
160
|
+
document.addEventListener('keydown', this._onKeyDown);
|
|
161
|
+
document.addEventListener('mousemove', this._onMouseMove);
|
|
162
|
+
document.addEventListener('mouseup', this._onMouseUp);
|
|
163
|
+
}
|
|
164
|
+
disconnectedCallback() {
|
|
165
|
+
super.disconnectedCallback();
|
|
166
|
+
document.removeEventListener('keydown', this._onKeyDown);
|
|
167
|
+
document.removeEventListener('mousemove', this._onMouseMove);
|
|
168
|
+
document.removeEventListener('mouseup', this._onMouseUp);
|
|
169
|
+
}
|
|
170
|
+
_makeArrowEl(x1, y1, x2, y2, col) {
|
|
171
|
+
const dx = x2 - x1, dy = y2 - y1;
|
|
172
|
+
const len = Math.sqrt(dx * dx + dy * dy);
|
|
173
|
+
if (len < 5)
|
|
174
|
+
return null;
|
|
175
|
+
const ux = dx / len, uy = dy / len;
|
|
176
|
+
const headLen = 14, headWidth = 7;
|
|
177
|
+
const ax = x2 - ux * headLen, ay = y2 - uy * headLen;
|
|
178
|
+
const px = -uy * headWidth, py = ux * headWidth;
|
|
179
|
+
const g = document.createElementNS(SVG_NS, 'g');
|
|
180
|
+
const line = document.createElementNS(SVG_NS, 'line');
|
|
181
|
+
line.setAttribute('x1', String(x1));
|
|
182
|
+
line.setAttribute('y1', String(y1));
|
|
183
|
+
line.setAttribute('x2', String(ax));
|
|
184
|
+
line.setAttribute('y2', String(ay));
|
|
185
|
+
line.setAttribute('stroke', col);
|
|
186
|
+
line.setAttribute('stroke-width', '2.5');
|
|
187
|
+
line.setAttribute('stroke-linecap', 'round');
|
|
188
|
+
const poly = document.createElementNS(SVG_NS, 'polygon');
|
|
189
|
+
poly.setAttribute('points', `${x2},${y2} ${ax + px},${ay + py} ${ax - px},${ay - py}`);
|
|
190
|
+
poly.setAttribute('fill', col);
|
|
191
|
+
g.append(line, poly);
|
|
192
|
+
return g;
|
|
193
|
+
}
|
|
194
|
+
_doUndo() {
|
|
195
|
+
const last = this.history.pop();
|
|
196
|
+
if (!last)
|
|
197
|
+
return;
|
|
198
|
+
last.el.remove();
|
|
199
|
+
if (last.type === 'callout')
|
|
200
|
+
this.calloutNum--;
|
|
201
|
+
}
|
|
202
|
+
_doClear() {
|
|
203
|
+
this.rl.innerHTML = '';
|
|
204
|
+
this.cl.innerHTML = '';
|
|
205
|
+
this.calloutNum = 1;
|
|
206
|
+
this.history = [];
|
|
207
|
+
}
|
|
208
|
+
_nextColor() {
|
|
209
|
+
const colors = this.colors;
|
|
210
|
+
const idx = colors.indexOf(this.color);
|
|
211
|
+
this.color = colors[(idx + 1) % colors.length];
|
|
212
|
+
}
|
|
213
|
+
async _copyScreenshot() {
|
|
214
|
+
const toolWasVisible = this.toolVisible;
|
|
215
|
+
this.toolVisible = false;
|
|
216
|
+
this.capturing = true;
|
|
217
|
+
await this.updateComplete;
|
|
218
|
+
try {
|
|
219
|
+
document.documentElement.style.cursor = 'none';
|
|
220
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
221
|
+
const stream = await navigator.mediaDevices.getDisplayMedia({
|
|
222
|
+
video: { displaySurface: 'browser', cursor: 'never' },
|
|
223
|
+
preferCurrentTab: true,
|
|
224
|
+
audio: false,
|
|
225
|
+
});
|
|
226
|
+
const video = document.createElement('video');
|
|
227
|
+
video.srcObject = stream;
|
|
228
|
+
await new Promise(resolve => { video.onloadedmetadata = () => resolve(); });
|
|
229
|
+
await video.play();
|
|
230
|
+
const canvas = document.createElement('canvas');
|
|
231
|
+
canvas.width = video.videoWidth;
|
|
232
|
+
canvas.height = video.videoHeight;
|
|
233
|
+
const ctx = canvas.getContext('2d');
|
|
234
|
+
await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(() => resolve())));
|
|
235
|
+
ctx.drawImage(video, 0, 0);
|
|
236
|
+
document.documentElement.style.cursor = '';
|
|
237
|
+
stream.getTracks().forEach((t) => t.stop());
|
|
238
|
+
const blob = await new Promise(resolve => canvas.toBlob(b => resolve(b)));
|
|
239
|
+
await navigator.clipboard.write([new ClipboardItem({ 'image/png': blob })]);
|
|
240
|
+
}
|
|
241
|
+
catch {
|
|
242
|
+
// user cancelled or permission denied
|
|
243
|
+
}
|
|
244
|
+
finally {
|
|
245
|
+
this.capturing = false;
|
|
246
|
+
this.toolVisible = toolWasVisible;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
render() {
|
|
250
|
+
const tbStyle = this.tbLeft !== null
|
|
251
|
+
? styleMap({ left: `${this.tbLeft}px`, top: `${this.tbTop}px`, transform: 'none' })
|
|
252
|
+
: {};
|
|
253
|
+
return html `
|
|
254
|
+
<svg class="overlay">
|
|
255
|
+
<g class="rl"></g>
|
|
256
|
+
<g class="cl"></g>
|
|
257
|
+
</svg>
|
|
258
|
+
|
|
259
|
+
${this.toolVisible ? html `
|
|
260
|
+
<div class="layer"
|
|
261
|
+
@mousedown=${this._onLayerMouseDown}
|
|
262
|
+
@contextmenu=${this._onLayerContextMenu}></div>
|
|
263
|
+
` : nothing}
|
|
264
|
+
|
|
265
|
+
<div class="tb" style=${tbStyle} @mousedown=${this._onTbMouseDown} ?hidden=${!this.toolVisible || this.capturing}>
|
|
266
|
+
<span class="hint">
|
|
267
|
+
LMB=<og-icon icon="${this.arrowMode ? 'arrow-right' : 'square'}"></og-icon>
|
|
268
|
+
RMB=<og-icon icon="circle-1"></og-icon>
|
|
269
|
+
c=color
|
|
270
|
+
</span>
|
|
271
|
+
<div class="sep"></div>
|
|
272
|
+
${(this.colors).map(hex => html `
|
|
273
|
+
<button class="color-btn ${hex === this.color ? 'active' : ''}"
|
|
274
|
+
style="background:${hex}"
|
|
275
|
+
@click=${(e) => { e.stopPropagation(); this.color = hex; }}>
|
|
276
|
+
</button>
|
|
277
|
+
`)}
|
|
278
|
+
<div class="sep"></div>
|
|
279
|
+
<span class="num">#${this.calloutNum}</span>
|
|
280
|
+
<og-button icon="arrow-right" color="${this.arrowMode ? 'blue' : 'gray'}"
|
|
281
|
+
title="Arrow mode (A)"
|
|
282
|
+
@click=${(e) => { e.stopPropagation(); this.arrowMode = !this.arrowMode; }}></og-button>
|
|
283
|
+
<og-button icon="fill" color="${this.fillEnabled ? 'blue' : 'gray'}"
|
|
284
|
+
title="Toggle fill (F)"
|
|
285
|
+
@click=${(e) => { e.stopPropagation(); this.fillEnabled = !this.fillEnabled; }}></og-button>
|
|
286
|
+
<og-button icon="rotate-left" color="gray"
|
|
287
|
+
title="Undo (Z)"
|
|
288
|
+
@click=${(e) => { e.stopPropagation(); this._doUndo(); }}></og-button>
|
|
289
|
+
<og-button icon="trash" color="gray"
|
|
290
|
+
title="Clear all (R)"
|
|
291
|
+
@click=${(e) => { e.stopPropagation(); this._doClear(); }}></og-button>
|
|
292
|
+
<og-button icon="copy" color="gray"
|
|
293
|
+
title="Copy screenshot to clipboard (S)"
|
|
294
|
+
@click=${(e) => { e.stopPropagation(); this._copyScreenshot(); }}></og-button>
|
|
295
|
+
<og-button icon="eye-slash" color="gray"
|
|
296
|
+
title="Hide (;)"
|
|
297
|
+
@click=${(e) => { e.stopPropagation(); this.toolVisible = false; }}></og-button>
|
|
298
|
+
<og-button icon="xmark" color="red"
|
|
299
|
+
title="Exit annotation tool"
|
|
300
|
+
@click=${(e) => { e.stopPropagation(); this.remove(); }}></og-button>
|
|
301
|
+
</div>
|
|
302
|
+
|
|
303
|
+
${!this.toolVisible ? html `
|
|
304
|
+
<div class="pip"
|
|
305
|
+
title="Restore annotation panel (;)"
|
|
306
|
+
@click=${(e) => { e.stopPropagation(); this.toolVisible = true; }}>
|
|
307
|
+
${unsafeHTML(this.logoSvg)}
|
|
308
|
+
</div>
|
|
309
|
+
` : nothing}
|
|
310
|
+
`;
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
AnnotationTool.styles = [style];
|
|
314
|
+
__decorate([
|
|
315
|
+
property({ type: String, attribute: 'logo-svg' })
|
|
316
|
+
], AnnotationTool.prototype, "logoSvg", void 0);
|
|
317
|
+
__decorate([
|
|
318
|
+
property({ type: Array })
|
|
319
|
+
], AnnotationTool.prototype, "colors", void 0);
|
|
320
|
+
__decorate([
|
|
321
|
+
state()
|
|
322
|
+
], AnnotationTool.prototype, "color", void 0);
|
|
323
|
+
__decorate([
|
|
324
|
+
state()
|
|
325
|
+
], AnnotationTool.prototype, "calloutNum", void 0);
|
|
326
|
+
__decorate([
|
|
327
|
+
state()
|
|
328
|
+
], AnnotationTool.prototype, "toolVisible", void 0);
|
|
329
|
+
__decorate([
|
|
330
|
+
state()
|
|
331
|
+
], AnnotationTool.prototype, "fillEnabled", void 0);
|
|
332
|
+
__decorate([
|
|
333
|
+
state()
|
|
334
|
+
], AnnotationTool.prototype, "arrowMode", void 0);
|
|
335
|
+
__decorate([
|
|
336
|
+
state()
|
|
337
|
+
], AnnotationTool.prototype, "tbLeft", void 0);
|
|
338
|
+
__decorate([
|
|
339
|
+
state()
|
|
340
|
+
], AnnotationTool.prototype, "tbTop", void 0);
|
|
341
|
+
__decorate([
|
|
342
|
+
state()
|
|
343
|
+
], AnnotationTool.prototype, "capturing", void 0);
|
|
344
|
+
__decorate([
|
|
345
|
+
query('.rl')
|
|
346
|
+
], AnnotationTool.prototype, "rl", void 0);
|
|
347
|
+
__decorate([
|
|
348
|
+
query('.cl')
|
|
349
|
+
], AnnotationTool.prototype, "cl", void 0);
|
|
350
|
+
AnnotationTool = __decorate([
|
|
351
|
+
customElement(`${constants.PREFIX}-annotation-tool`)
|
|
352
|
+
], AnnotationTool);
|
|
353
|
+
export { AnnotationTool };
|
|
354
|
+
//# sourceMappingURL=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AAC,CAAC,CAAC,IAAI,CAAA;;;cAGf,CAAC,CAAQ,EAAE,EAAE,GAAG,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC;OACtE,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC;;IAE3B,CAAC,CAAC,CAAC,OAAO;GACX,CAAC;IACH,CAAC;;AA/QM,qBAAM,GAAG,CAAC,KAAK,CAAC,AAAV,CAAW;AALxB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAC,CAAC;+CACb;AAGnC;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,KAAK,EAAC,CAAC;8CACU;AAIjB;IAAhB,KAAK,EAAE;6CAAgC;AACvB;IAAhB,KAAK,EAAE;kDAAwB;AACf;IAAhB,KAAK,EAAE;mDAA4B;AACnB;IAAhB,KAAK,EAAE;mDAA6B;AACpB;IAAhB,KAAK,EAAE;iDAA2B;AAClB;IAAhB,KAAK,EAAE;8CAAsC;AAC7B;IAAhB,KAAK,EAAE;6CAAqC;AAC5B;IAAhB,KAAK,EAAE;iDAA2B;AAEb;IAArB,KAAK,CAAC,KAAK,CAAC;0CAA0B;AACjB;IAArB,KAAK,CAAC,KAAK,CAAC;0CAA0B;AApB3B,cAAc;IAD1B,aAAa,CAAC,GAAG,SAAS,CAAC,MAAM,kBAAkB,CAAC;GACxC,cAAc,CAwR1B","sourcesContent":["import { LitElement, html, nothing } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport constants from '../constants';\nimport { style } from './annotation.style';\n\nconst SVG_NS = 'http://www.w3.org/2000/svg';\nconst DEFAULT_COLORS = ['#007AFF', '#34C759', '#FF9500', '#AF52DE', '#FF3B30', '#00ffff', '#636363'];\nconst DEFAULT_LOGO_SVG = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"28\" height=\"28\"><path fill=\"#5ec7d1\" d=\"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z\"/></svg>`;\n\n@customElement(`${constants.PREFIX}-annotation-tool`)\nexport class AnnotationTool extends LitElement {\n\n\t@property({type: String, attribute: 'logo-svg'})\n\tlogoSvg: string = DEFAULT_LOGO_SVG;\n\n\t@property({type: Array})\n\tcolors: string[] = DEFAULT_COLORS;\n\n\tstatic styles = [style];\n\n\t@state() private color = this.colors[0];\n\t@state() private calloutNum = 1;\n\t@state() private toolVisible = true;\n\t@state() private fillEnabled = false;\n\t@state() private arrowMode = false;\n\t@state() private tbLeft: number | null = null;\n\t@state() private tbTop: number | null = null;\n\t@state() private capturing = false;\n\n\t@query('.rl') private rl!: SVGGElement;\n\t@query('.cl') private cl!: SVGGElement;\n\n\tprivate history: { type: string; el: Element }[] = [];\n\tprivate dragging = false;\n\tprivate sx = 0;\n\tprivate sy = 0;\n\tprivate curRect: SVGRectElement | null = null;\n\tprivate curArrow: SVGGElement | null = null;\n\tprivate tbDrag = false;\n\tprivate tbOx = 0;\n\tprivate tbOy = 0;\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback();\n\t\tdocument.addEventListener('keydown', this._onKeyDown);\n\t\tdocument.addEventListener('mousemove', this._onMouseMove);\n\t\tdocument.addEventListener('mouseup', this._onMouseUp);\n\t}\n\n\tdisconnectedCallback() {\n\t\tsuper.disconnectedCallback();\n\t\tdocument.removeEventListener('keydown', this._onKeyDown);\n\t\tdocument.removeEventListener('mousemove', this._onMouseMove);\n\t\tdocument.removeEventListener('mouseup', this._onMouseUp);\n\t}\n\n\tprivate _makeArrowEl(x1: number, y1: number, x2: number, y2: number, col: string): SVGGElement | null {\n\t\tconst dx = x2 - x1, dy = y2 - y1;\n\t\tconst len = Math.sqrt(dx * dx + dy * dy);\n\t\tif (len < 5) return null;\n\t\tconst ux = dx / len, uy = dy / len;\n\t\tconst headLen = 14, headWidth = 7;\n\t\tconst ax = x2 - ux * headLen, ay = y2 - uy * headLen;\n\t\tconst px = -uy * headWidth, py = ux * headWidth;\n\t\tconst g = document.createElementNS(SVG_NS, 'g');\n\t\tconst line = document.createElementNS(SVG_NS, 'line');\n\t\tline.setAttribute('x1', String(x1)); line.setAttribute('y1', String(y1));\n\t\tline.setAttribute('x2', String(ax)); line.setAttribute('y2', String(ay));\n\t\tline.setAttribute('stroke', col); line.setAttribute('stroke-width', '2.5');\n\t\tline.setAttribute('stroke-linecap', 'round');\n\t\tconst poly = document.createElementNS(SVG_NS, 'polygon');\n\t\tpoly.setAttribute('points', `${x2},${y2} ${ax + px},${ay + py} ${ax - px},${ay - py}`);\n\t\tpoly.setAttribute('fill', col);\n\t\tg.append(line, poly);\n\t\treturn g;\n\t}\n\n\tprivate _doUndo() {\n\t\tconst last = this.history.pop();\n\t\tif (!last) return;\n\t\tlast.el.remove();\n\t\tif (last.type === 'callout') this.calloutNum--;\n\t}\n\n\tprivate _doClear() {\n\t\tthis.rl.innerHTML = '';\n\t\tthis.cl.innerHTML = '';\n\t\tthis.calloutNum = 1;\n\t\tthis.history = [];\n\t}\n\n\tprivate _nextColor() {\n\t\tconst colors = this.colors;\n\t\tconst idx = colors.indexOf(this.color);\n\t\tthis.color = colors[(idx + 1) % colors.length];\n\t}\n\n\tprivate async _copyScreenshot() {\n\t\tconst toolWasVisible = this.toolVisible;\n\t\tthis.toolVisible = false;\n\t\tthis.capturing = true;\n\t\tawait this.updateComplete;\n\t\ttry {\n\t\t\tdocument.documentElement.style.cursor = 'none';\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\tconst stream = await (navigator.mediaDevices as any).getDisplayMedia({\n\t\t\t\tvideo: { displaySurface: 'browser', cursor: 'never' },\n\t\t\t\tpreferCurrentTab: true,\n\t\t\t\taudio: false,\n\t\t\t});\n\t\t\tconst video = document.createElement('video');\n\t\t\tvideo.srcObject = stream;\n\t\t\tawait new Promise<void>(resolve => { video.onloadedmetadata = () => resolve(); });\n\t\t\tawait video.play();\n\t\t\tconst canvas = document.createElement('canvas');\n\t\t\tcanvas.width = video.videoWidth;\n\t\t\tcanvas.height = video.videoHeight;\n\t\t\tconst ctx = canvas.getContext('2d')!;\n\t\t\tawait new Promise<void>(resolve => requestAnimationFrame(() => requestAnimationFrame(() => resolve())));\n\t\t\tctx.drawImage(video, 0, 0);\n\t\t\tdocument.documentElement.style.cursor = '';\n\t\t\tstream.getTracks().forEach((t: MediaStreamTrack) => t.stop());\n\n\t\t\tconst blob = await new Promise<Blob>(resolve => canvas.toBlob(b => resolve(b!)));\n\t\t\tawait navigator.clipboard.write([new ClipboardItem({ 'image/png': blob })]);\n\t\t} catch {\n\t\t\t// user cancelled or permission denied\n\t\t} finally {\n\t\t\tthis.capturing = false;\n\t\t\tthis.toolVisible = toolWasVisible;\n\t\t}\n\t}\n\n\tprivate _onKeyDown = (e: KeyboardEvent) => {\n\t\tif (e.key === ';' || e.key === '`') {\n\t\t\te.preventDefault();\n\t\t\tthis.toolVisible = !this.toolVisible;\n\t\t}\n\t\tif (this.toolVisible && !e.ctrlKey && !e.metaKey && !e.altKey) {\n\t\t\tif (e.key === 'z') { e.preventDefault(); this._doUndo(); }\n\t\t\tif (e.key === 'r') {\n\t\t\t\tconst tag = document.activeElement?.tagName;\n\t\t\t\tif (tag !== 'INPUT' && tag !== 'TEXTAREA') { e.preventDefault(); this._doClear(); }\n\t\t\t}\n\t\t\tif (e.key === 'c') { e.preventDefault(); this._nextColor(); }\n\t\t\tif (e.key === 'f') { e.preventDefault(); this.fillEnabled = !this.fillEnabled; }\n\t\t\tif (e.key === 'a') { e.preventDefault(); this.arrowMode = !this.arrowMode; }\n\t\t\tif (e.key === 's') { e.preventDefault(); this._copyScreenshot(); }\n\t\t}\n\t};\n\n\tprivate _onTbMouseDown = (e: MouseEvent) => {\n\t\tif (e.target !== e.currentTarget) return;\n\t\tthis.tbDrag = true;\n\t\tconst tb = this.shadowRoot!.querySelector('.tb') as HTMLElement;\n\t\tconst rect = tb.getBoundingClientRect();\n\t\tthis.tbOx = e.clientX - rect.left;\n\t\tthis.tbOy = e.clientY - rect.top;\n\t};\n\n\tprivate _onLayerMouseDown = (e: MouseEvent) => {\n\t\te.stopPropagation();\n\t\tif (e.button !== 0) return;\n\t\tthis.dragging = true;\n\t\tthis.sx = e.clientX;\n\t\tthis.sy = e.clientY;\n\t\tif (this.arrowMode) {\n\t\t\tthis.curArrow = this._makeArrowEl(this.sx, this.sy, this.sx, this.sy, this.color);\n\t\t\tif (this.curArrow) this.rl.appendChild(this.curArrow);\n\t\t} else {\n\t\t\tthis.curRect = document.createElementNS(SVG_NS, 'rect');\n\t\t\tthis.curRect.setAttribute('fill', this.fillEnabled ? this.color : 'none');\n\t\t\tthis.curRect.setAttribute('fill-opacity', this.fillEnabled ? '0.2' : '1');\n\t\t\tthis.curRect.setAttribute('stroke', this.color);\n\t\t\tthis.curRect.setAttribute('stroke-width', '2.5');\n\t\t\tthis.curRect.setAttribute('rx', '4');\n\t\t\tthis.rl.appendChild(this.curRect);\n\t\t}\n\t};\n\n\tprivate _onLayerContextMenu = (e: MouseEvent) => {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\t\tconst g = document.createElementNS(SVG_NS, 'g');\n\t\tg.innerHTML = `<circle cx=\"${e.clientX}\" cy=\"${e.clientY}\" r=\"14\" fill=\"${this.color}\"/><text x=\"${e.clientX}\" y=\"${e.clientY + 5}\" text-anchor=\"middle\" fill=\"white\" font-size=\"13\" font-weight=\"bold\" font-family=\"system-ui,sans-serif\">${this.calloutNum}</text>`;\n\t\tthis.cl.appendChild(g);\n\t\tthis.history.push({ type: 'callout', el: g });\n\t\tthis.calloutNum++;\n\t};\n\n\tprivate _onMouseMove = (e: MouseEvent) => {\n\t\tif (this.tbDrag) {\n\t\t\tthis.tbLeft = e.clientX - this.tbOx;\n\t\t\tthis.tbTop = e.clientY - this.tbOy;\n\t\t}\n\t\tif (!this.dragging) return;\n\t\tif (this.arrowMode) {\n\t\t\tif (this.curArrow) this.curArrow.remove();\n\t\t\tthis.curArrow = this._makeArrowEl(this.sx, this.sy, e.clientX, e.clientY, this.color);\n\t\t\tif (this.curArrow) this.rl.appendChild(this.curArrow);\n\t\t} else if (this.curRect) {\n\t\t\tthis.curRect.setAttribute('x', String(Math.min(e.clientX, this.sx)));\n\t\t\tthis.curRect.setAttribute('y', String(Math.min(e.clientY, this.sy)));\n\t\t\tthis.curRect.setAttribute('width', String(Math.abs(e.clientX - this.sx)));\n\t\t\tthis.curRect.setAttribute('height', String(Math.abs(e.clientY - this.sy)));\n\t\t}\n\t};\n\n\tprivate _onMouseUp = (e: MouseEvent) => {\n\t\tthis.tbDrag = false;\n\t\tif (!this.dragging) return;\n\t\tthis.dragging = false;\n\t\tif (Math.abs(e.clientX - this.sx) < 5 && Math.abs(e.clientY - this.sy) < 5) {\n\t\t\tthis.curRect?.remove(); this.curRect = null;\n\t\t\tthis.curArrow?.remove(); this.curArrow = null;\n\t\t\treturn;\n\t\t}\n\t\tif (this.arrowMode) {\n\t\t\tif (this.curArrow) this.history.push({ type: 'arrow', el: this.curArrow });\n\t\t\tthis.curArrow = null;\n\t\t} else {\n\t\t\tif (this.curRect) this.history.push({ type: 'rect', el: this.curRect });\n\t\t\tthis.curRect = null;\n\t\t}\n\t};\n\n\trender() {\n\t\tconst tbStyle = this.tbLeft !== null\n\t\t\t? styleMap({ left: `${this.tbLeft}px`, top: `${this.tbTop}px`, transform: 'none' })\n\t\t\t: {};\n\n\t\treturn html`\n\t\t\t<svg class=\"overlay\">\n\t\t\t\t<g class=\"rl\"></g>\n\t\t\t\t<g class=\"cl\"></g>\n\t\t\t</svg>\n\n\t\t\t${this.toolVisible ? html`\n\t\t\t\t<div class=\"layer\"\n\t\t\t\t\t@mousedown=${this._onLayerMouseDown}\n\t\t\t\t\t@contextmenu=${this._onLayerContextMenu}></div>\n\t\t\t` : nothing}\n\n\t\t\t<div class=\"tb\" style=${tbStyle} @mousedown=${this._onTbMouseDown} ?hidden=${!this.toolVisible || this.capturing}>\n\t\t\t\t<span class=\"hint\">\n\t\t\t\t\tLMB=<og-icon icon=\"${this.arrowMode ? 'arrow-right' : 'square'}\"></og-icon> \n\t\t\t\t\tRMB=<og-icon icon=\"circle-1\"></og-icon> \n\t\t\t\t\tc=color\n\t\t\t\t</span>\n\t\t\t\t<div class=\"sep\"></div>\n\t\t\t\t${(this.colors).map(hex => html`\n\t\t\t\t\t<button class=\"color-btn ${hex === this.color ? 'active' : ''}\"\n\t\t\t\t\t\tstyle=\"background:${hex}\"\n\t\t\t\t\t\t@click=${(e: Event) => { e.stopPropagation(); this.color = hex; }}>\n\t\t\t\t\t</button>\n\t\t\t\t`)}\n\t\t\t\t<div class=\"sep\"></div>\n\t\t\t\t<span class=\"num\">#${this.calloutNum}</span>\n\t\t\t\t<og-button icon=\"arrow-right\" color=\"${this.arrowMode ? 'blue' : 'gray'}\"\n\t\t\t\t\ttitle=\"Arrow mode (A)\"\n\t\t\t\t\t@click=${(e: Event) => { e.stopPropagation(); this.arrowMode = !this.arrowMode; }}></og-button>\n\t\t\t\t<og-button icon=\"fill\" color=\"${this.fillEnabled ? 'blue' : 'gray'}\"\n\t\t\t\t\ttitle=\"Toggle fill (F)\"\n\t\t\t\t\t@click=${(e: Event) => { e.stopPropagation(); this.fillEnabled = !this.fillEnabled; }}></og-button>\n\t\t\t\t<og-button icon=\"rotate-left\" color=\"gray\"\n\t\t\t\t\ttitle=\"Undo (Z)\"\n\t\t\t\t\t@click=${(e: Event) => { e.stopPropagation(); this._doUndo(); }}></og-button>\n\t\t\t\t<og-button icon=\"trash\" color=\"gray\"\n\t\t\t\t\ttitle=\"Clear all (R)\"\n\t\t\t\t\t@click=${(e: Event) => { e.stopPropagation(); this._doClear(); }}></og-button>\n\t\t\t\t<og-button icon=\"copy\" color=\"gray\"\n\t\t\t\t\ttitle=\"Copy screenshot to clipboard (S)\"\n\t\t\t\t\t@click=${(e: Event) => { e.stopPropagation(); this._copyScreenshot(); }}></og-button>\n\t\t\t\t<og-button icon=\"eye-slash\" color=\"gray\"\n\t\t\t\t\ttitle=\"Hide (;)\"\n\t\t\t\t\t@click=${(e: Event) => { e.stopPropagation(); this.toolVisible = false; }}></og-button>\n\t\t\t\t<og-button icon=\"xmark\" color=\"red\"\n\t\t\t\t\ttitle=\"Exit annotation tool\"\n\t\t\t\t\t@click=${(e: Event) => { e.stopPropagation(); this.remove(); }}></og-button>\n\t\t\t</div>\n\n\t\t\t${!this.toolVisible ? html`\n\t\t\t\t<div class=\"pip\"\n\t\t\t\t\ttitle=\"Restore annotation panel (;)\"\n\t\t\t\t\t@click=${(e: Event) => { e.stopPropagation(); this.toolVisible = true; }}>\n\t\t\t\t\t${unsafeHTML(this.logoSvg)}\n\t\t\t\t</div>\n\t\t\t` : nothing}\n\t\t`;\n\t}\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotation.style.d.ts","sourceRoot":"","sources":["../../src/ui/annotation.style.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,KAAK,yBAuFjB,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const style = css `
|
|
3
|
+
:host { display: contents; }
|
|
4
|
+
|
|
5
|
+
og-button {
|
|
6
|
+
padding: 5px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.overlay {
|
|
10
|
+
position: fixed;
|
|
11
|
+
top: 0; left: 0;
|
|
12
|
+
width: 100vw; height: 100vh;
|
|
13
|
+
z-index: 999998;
|
|
14
|
+
pointer-events: none;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.layer {
|
|
18
|
+
position: fixed;
|
|
19
|
+
top: 0; left: 0;
|
|
20
|
+
width: 100vw; height: 100vh;
|
|
21
|
+
z-index: 999997;
|
|
22
|
+
cursor: crosshair;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.tb[hidden] { display: none; }
|
|
26
|
+
|
|
27
|
+
.tb {
|
|
28
|
+
position: fixed;
|
|
29
|
+
top: 12px; left: 50%;
|
|
30
|
+
transform: translateX(-50%);
|
|
31
|
+
z-index: 999999;
|
|
32
|
+
background: #1c1c1e;
|
|
33
|
+
border: 1px solid #48484a;
|
|
34
|
+
border-radius: 10px;
|
|
35
|
+
padding: 7px 12px;
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
gap: 7px;
|
|
39
|
+
box-shadow: 0 4px 24px rgba(0,0,0,.6);
|
|
40
|
+
font-family: system-ui, sans-serif;
|
|
41
|
+
font-size: 12px;
|
|
42
|
+
color: #fff;
|
|
43
|
+
user-select: none;
|
|
44
|
+
cursor: move;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.pip {
|
|
48
|
+
position: fixed;
|
|
49
|
+
bottom: 16px; right: 16px;
|
|
50
|
+
z-index: 999999;
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
opacity: 0.75;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.sep {
|
|
59
|
+
width: 1px;
|
|
60
|
+
height: 18px;
|
|
61
|
+
background: #48484a;
|
|
62
|
+
flex-shrink: 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.hint {
|
|
66
|
+
color: #8e8e93;
|
|
67
|
+
font-size: 11px;
|
|
68
|
+
white-space: nowrap;
|
|
69
|
+
display: flex;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.num {
|
|
73
|
+
color: #8e8e93;
|
|
74
|
+
min-width: 22px;
|
|
75
|
+
text-align: center;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.color-btn {
|
|
79
|
+
width: 18px;
|
|
80
|
+
height: 18px;
|
|
81
|
+
border-radius: 50%;
|
|
82
|
+
border: 2px solid transparent;
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
padding: 0;
|
|
85
|
+
flex-shrink: 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.color-btn.active { border-color: #fff; }
|
|
89
|
+
`;
|
|
90
|
+
//# sourceMappingURL=annotation.style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotation.style.js","sourceRoot":"","sources":["../../src/ui/annotation.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuFvB,CAAC","sourcesContent":["import { css } from 'lit';\nexport const style = css`\n\t:host { display: contents; }\n\n\tog-button {\n\t\tpadding: 5px;\n\t}\n\n\t.overlay {\n\t\tposition: fixed;\n\t\ttop: 0; left: 0;\n\t\twidth: 100vw; height: 100vh;\n\t\tz-index: 999998;\n\t\tpointer-events: none;\n\t}\n\n\t.layer {\n\t\tposition: fixed;\n\t\ttop: 0; left: 0;\n\t\twidth: 100vw; height: 100vh;\n\t\tz-index: 999997;\n\t\tcursor: crosshair;\n\t}\n\n\t.tb[hidden] { display: none; }\n\n\t.tb {\n\t\tposition: fixed;\n\t\ttop: 12px; left: 50%;\n\t\ttransform: translateX(-50%);\n\t\tz-index: 999999;\n\t\tbackground: #1c1c1e;\n\t\tborder: 1px solid #48484a;\n\t\tborder-radius: 10px;\n\t\tpadding: 7px 12px;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tgap: 7px;\n\t\tbox-shadow: 0 4px 24px rgba(0,0,0,.6);\n\t\tfont-family: system-ui, sans-serif;\n\t\tfont-size: 12px;\n\t\tcolor: #fff;\n\t\tuser-select: none;\n\t\tcursor: move;\n\t}\n\n\t.pip {\n\t\tposition: fixed;\n\t\tbottom: 16px; right: 16px;\n\t\tz-index: 999999;\n\t\tcursor: pointer;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\topacity: 0.75;\n\t}\n\n\t.sep {\n\t\twidth: 1px;\n\t\theight: 18px;\n\t\tbackground: #48484a;\n\t\tflex-shrink: 0;\n\t}\n\n\t.hint {\n\t\tcolor: #8e8e93;\n\t\tfont-size: 11px;\n\t\twhite-space: nowrap;\n\t\tdisplay: flex;\n\t}\n\n\t.num {\n\t\tcolor: #8e8e93;\n\t\tmin-width: 22px;\n\t\ttext-align: center;\n\t}\n\n\t.color-btn {\n\t\twidth: 18px;\n\t\theight: 18px;\n\t\tborder-radius: 50%;\n\t\tborder: 2px solid transparent;\n\t\tcursor: pointer;\n\t\tpadding: 0;\n\t\tflex-shrink: 0;\n\t}\n\n\t.color-btn.active { border-color: #fff; }\n`;\n"]}
|
package/dist/ui/index.d.ts
CHANGED
package/dist/ui/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,C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/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC","sourcesContent":["export * from './accordion';\nexport * from './alert';\nexport * from './baseElement';\nexport * from './button';\nexport * from './close';\nexport * from './checkbox';\nexport * from './container';\nexport * from './colorpicker';\nexport * from './dropdown';\nexport * from './dropdownColorPicker';\nexport * from './dropdownList';\nexport * from './dropdownMenu';\nexport * from './expander';\nexport * from './floatingWindow';\nexport * from './icon';\nexport * from './images';\nexport * from './input';\nexport * from './label';\nexport * from './fileInput';\nexport * from './numericInput';\nexport * from './list';\nexport * from './menu';\nexport * from './overlay';\nexport * from './panel';\nexport * from './sizer';\nexport * from './splitContainer';\nexport * from './slider';\nexport * from './sortableList';\nexport * from './switch';\nexport * from './tooltip';\nexport * from './loader';"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC","sourcesContent":["export * from './accordion';\nexport * from './annotation';\nexport * from './alert';\nexport * from './baseElement';\nexport * from './button';\nexport * from './close';\nexport * from './checkbox';\nexport * from './container';\nexport * from './colorpicker';\nexport * from './dropdown';\nexport * from './dropdownColorPicker';\nexport * from './dropdownList';\nexport * from './dropdownMenu';\nexport * from './expander';\nexport * from './floatingWindow';\nexport * from './icon';\nexport * from './images';\nexport * from './input';\nexport * from './label';\nexport * from './fileInput';\nexport * from './numericInput';\nexport * from './list';\nexport * from './menu';\nexport * from './overlay';\nexport * from './panel';\nexport * from './sizer';\nexport * from './splitContainer';\nexport * from './slider';\nexport * from './sortableList';\nexport * from './switch';\nexport * from './tooltip';\nexport * from './loader';"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omegagrid/core",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.26",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"description": "Core components",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@fortawesome/fontawesome-svg-core": "^7.0.1",
|
|
39
|
-
"@omegagrid/localize": "^0.10.
|
|
39
|
+
"@omegagrid/localize": "^0.10.26",
|
|
40
40
|
"color": "^4.2.3",
|
|
41
41
|
"date-fns": "^3.2.0",
|
|
42
42
|
"lit": "^3.1.1",
|