@operato/input 8.0.0-alpha.26 → 8.0.0-alpha.29

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
@@ -2,7 +2,7 @@
2
2
  "name": "@operato/input",
3
3
  "description": "Webcomponents for input following open-wc recommendations",
4
4
  "author": "heartyoh@hatiolab.com",
5
- "version": "8.0.0-alpha.26",
5
+ "version": "8.0.0-alpha.29",
6
6
  "main": "dist/src/index.js",
7
7
  "module": "dist/src/index.js",
8
8
  "license": "MIT",
@@ -216,9 +216,9 @@
216
216
  "@material/web": "^2.0.0",
217
217
  "@operato/color-picker": "^8.0.0-alpha.0",
218
218
  "@operato/i18n": "^8.0.0-alpha.0",
219
- "@operato/popup": "^8.0.0-alpha.4",
220
- "@operato/styles": "^8.0.0-alpha.4",
221
- "@operato/utils": "^8.0.0-alpha.0",
219
+ "@operato/popup": "^8.0.0-alpha.29",
220
+ "@operato/styles": "^8.0.0-alpha.27",
221
+ "@operato/utils": "^8.0.0-alpha.29",
222
222
  "@polymer/paper-dropdown-menu": "^3.2.0",
223
223
  "@polymer/paper-item": "^3.0.1",
224
224
  "@thebespokepixel/es-tinycolor": "^3.1.0",
@@ -262,5 +262,5 @@
262
262
  "prettier --write"
263
263
  ]
264
264
  },
265
- "gitHead": "14f757972a99c6c6807d3a7e8a555afbd4f891ce"
265
+ "gitHead": "f2f91b0c9ba7b29d7eeaca566f8e5875fa554331"
266
266
  }
@@ -210,7 +210,7 @@ export class OxInputColorStops extends OxFormField {
210
210
  <div
211
211
  id="markers"
212
212
  @dblclick=${(e: MouseEvent) => this._onDblClickMarkers(e)}
213
- @mousedown=${(e: MouseEvent) => this._onMouseDown(e)}
213
+ @pointerdown=${(e: PointerEvent) => this._onPointerDown(e)}
214
214
  @dragstart=${(e: DragEvent) => this._onDragStart(e)}
215
215
  @drag=${this._throttled(100, this._onDrag.bind(this))}
216
216
  @dragend=${(e: DragEvent) => this._onDragEnd(e)}
@@ -422,7 +422,7 @@ export class OxInputColorStops extends OxFormField {
422
422
  this.colorEditor.showPicker()
423
423
  }
424
424
 
425
- _onMouseDown(e: MouseEvent) {
425
+ _onPointerDown(e: PointerEvent) {
426
426
  if (this.disabled) {
427
427
  return
428
428
  }
@@ -80,13 +80,10 @@ export class OxInputSignature extends OxFormField {
80
80
  <canvas
81
81
  width="800"
82
82
  height="400"
83
- @mousedown=${this.startDrawing}
84
- @mouseup=${this.stopDrawing}
85
- @mousemove=${this.draw}
86
- @mouseleave=${this.stopDrawing}
87
- @touchstart=${this.startDrawing}
88
- @touchend=${this.stopDrawing}
89
- @touchmove=${this.draw}
83
+ @pointerdown=${this.startDrawing}
84
+ @pointerup=${this.stopDrawing}
85
+ @pointermove=${this.draw}
86
+ @pointerleave=${this.stopDrawing}
90
87
  ></canvas>
91
88
  <div class="controls">
92
89
  <button @click="${this.clearCanvas}">Clear</button>
@@ -87,9 +87,7 @@ export class OxSelectFloor extends OxFormField {
87
87
  @query('.carousel-container') private carouselContainer!: HTMLDivElement
88
88
 
89
89
  private isDragging = false
90
- private lastTouchY = 0
91
90
  private lastMouseY = 0
92
- private startY = 0
93
91
 
94
92
  render() {
95
93
  const length = this.cards.length
@@ -99,13 +97,10 @@ export class OxSelectFloor extends OxFormField {
99
97
  <div
100
98
  class="carousel-container"
101
99
  @wheel=${this.handleWheel}
102
- @mousedown=${this.handleMouseDown}
103
- @mousemove=${this.handleMouseMove}
104
- @mouseup=${this.handleMouseUp}
105
- @mouseleave=${this.handleMouseLeave}
106
- @touchstart=${this.handleTouchStart}
107
- @touchmove=${this.handleTouchMove}
108
- @touchend=${this.handleTouchEnd}
100
+ @pointerdown=${this.handlePointerDown}
101
+ @pointermove=${this.handlePointerMove}
102
+ @pointerup=${this.handlePointerUp}
103
+ @pointerleave=${this.handlePointerLeave}
109
104
  >
110
105
  ${cards.map(({ image, name }, index) => {
111
106
  return html`
@@ -162,40 +157,20 @@ export class OxSelectFloor extends OxFormField {
162
157
  this.updateSelectedIndex(this.selectedIndex + delta)
163
158
  }
164
159
 
165
- handleTouchStart(event: TouchEvent) {
166
- this.lastTouchY = event.touches[0].clientY
167
- this.startY = this.lastTouchY
168
- }
169
-
170
- handleTouchMove(event: TouchEvent) {
171
- const touch = event.touches[0]
172
- const deltaY = touch.clientY - this.lastMouseY
173
-
174
- if (!this.lastMouseY) {
175
- this.lastMouseY = touch.clientY
176
- }
177
-
178
- if (Math.abs(deltaY) > 30) {
179
- this.lastMouseY = touch.clientY
180
- const direction = deltaY > 0 ? -1 : 1
181
- this.updateSelectedIndex(this.selectedIndex + direction)
182
- }
183
- }
184
-
185
- handleTouchEnd() {
186
- this.isDragging = false
187
- }
160
+ handlePointerDown(event: PointerEvent) {
161
+ event.preventDefault()
188
162
 
189
- handleMouseDown(event: MouseEvent) {
190
163
  this.isDragging = true
191
164
  this.lastMouseY = event.clientY
192
165
  }
193
166
 
194
- handleMouseMove(event: MouseEvent) {
167
+ handlePointerMove(event: PointerEvent) {
195
168
  if (!this.isDragging) {
196
169
  return
197
170
  }
198
171
 
172
+ event.preventDefault()
173
+
199
174
  const deltaY = event.clientY - this.lastMouseY
200
175
 
201
176
  if (!this.lastMouseY) {
@@ -209,11 +184,14 @@ export class OxSelectFloor extends OxFormField {
209
184
  }
210
185
  }
211
186
 
212
- handleMouseUp() {
187
+ handlePointerUp(event: PointerEvent) {
188
+ event.preventDefault()
213
189
  this.isDragging = false
214
190
  }
215
191
 
216
- handleMouseLeave() {
192
+ handlePointerLeave(event: PointerEvent) {
193
+ event.preventDefault()
194
+
217
195
  this.isDragging = false
218
196
  }
219
197
 
@@ -9,7 +9,8 @@ body {
9
9
  /* monthly layout */
10
10
  --calendar-monthly-ol-margin: var(--margin-default) 0;
11
11
  --calendar-monthly-ol-top-border: 2px solid var(--md-sys-color-secondary);
12
- --calendar-current-monty-background-color: var(--md-sys-color-surface-variant);
12
+ --calendar-current-month-background-color: var(--md-sys-color-surface-variant);
13
+ --calendar-current-month-color: var(--md-sys-color-on-surface);
13
14
  --calendar-monthly-label-align: left;
14
15
  --calendar-monthly-label-padding: var(--padding-narrow) 0;
15
16
  --calendar-monthly-label-color: var(--md-sys-color-secondary);
@@ -35,6 +36,7 @@ body {
35
36
  --calendar-weekly-ol-margin: var(--margin-default) 0;
36
37
  --calendar-weekly-ol-top-border: 2px solid var(--md-sys-color-secondary);
37
38
  --calendar-current-week-background-color: var(--md-sys-color-surface-variant);
39
+ --calendar-current-week-color: var(--md-sys-color-on-surface);
38
40
  --calendar-weekly-label-align: center;
39
41
  --calendar-weekly-label-padding: var(--padding-narrow) 0;
40
42
  --calendar-weekly-label-color: var(--md-sys-color-secondary);
@@ -1,17 +0,0 @@
1
- import { LitElement } from 'lit';
2
- export declare class OxZoomableImage extends LitElement {
3
- static styles: import("lit").CSSResult;
4
- src: string;
5
- image: HTMLImageElement;
6
- private scale;
7
- private startX;
8
- private startY;
9
- private x;
10
- private y;
11
- private dragging;
12
- render(): import("lit-html").TemplateResult<1>;
13
- private handleWheel;
14
- private handleMouseDown;
15
- private handleMouseMove;
16
- private handleMouseUp;
17
- }
@@ -1,80 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import { LitElement, html, css } from 'lit';
3
- import { customElement, property, query } from 'lit/decorators.js';
4
- let OxZoomableImage = class OxZoomableImage extends LitElement {
5
- constructor() {
6
- super(...arguments);
7
- this.src = '';
8
- this.scale = 1;
9
- this.startX = 0;
10
- this.startY = 0;
11
- this.x = 0;
12
- this.y = 0;
13
- this.dragging = false;
14
- }
15
- static { this.styles = css `
16
- :host {
17
- display: block;
18
- overflow: hidden;
19
- position: relative;
20
- }
21
-
22
- img {
23
- transition: transform 0.25s ease;
24
- transform-origin: center;
25
- cursor: grab;
26
- }
27
- `; }
28
- render() {
29
- return html `
30
- <img
31
- id="zoomableImage"
32
- src="${this.src}"
33
- @wheel="${this.handleWheel}"
34
- @mousedown="${this.handleMouseDown}"
35
- @mousemove="${this.handleMouseMove}"
36
- @mouseup="${this.handleMouseUp}"
37
- @mouseleave="${this.handleMouseUp}"
38
- style="transform: translate(${this.x}px, ${this.y}px) scale(${this.scale});"
39
- />
40
- `;
41
- }
42
- handleWheel(event) {
43
- event.preventDefault();
44
- const delta = event.deltaY;
45
- const zoomIntensity = 0.1;
46
- this.scale += delta > 0 ? -zoomIntensity : zoomIntensity;
47
- this.scale = Math.max(0.1, Math.min(this.scale, 4));
48
- this.requestUpdate();
49
- }
50
- handleMouseDown(event) {
51
- this.startX = event.clientX - this.x;
52
- this.startY = event.clientY - this.y;
53
- this.dragging = true;
54
- const img = this.image;
55
- img.style.cursor = 'grabbing';
56
- }
57
- handleMouseMove(event) {
58
- if (!this.dragging)
59
- return;
60
- this.x = event.clientX - this.startX;
61
- this.y = event.clientY - this.startY;
62
- this.requestUpdate();
63
- }
64
- handleMouseUp() {
65
- this.dragging = false;
66
- const img = this.image;
67
- img.style.cursor = 'grab';
68
- }
69
- };
70
- __decorate([
71
- property({ type: String })
72
- ], OxZoomableImage.prototype, "src", void 0);
73
- __decorate([
74
- query('img')
75
- ], OxZoomableImage.prototype, "image", void 0);
76
- OxZoomableImage = __decorate([
77
- customElement('ox-zoomable-image')
78
- ], OxZoomableImage);
79
- export { OxZoomableImage };
80
- //# sourceMappingURL=ox-zoomable-image.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ox-zoomable-image.js","sourceRoot":"","sources":["../../src/ox-zoomable-image.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAG3D,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,UAAU;IAAxC;;QAeuB,QAAG,GAAG,EAAE,CAAA;QAI5B,UAAK,GAAW,CAAC,CAAA;QACjB,WAAM,GAAW,CAAC,CAAA;QAClB,WAAM,GAAW,CAAC,CAAA;QAClB,MA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O,eAAe,CAAC,KAAiB;QACvC,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,OAAM;QAC1B,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAA;QACpC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAA;QACpC,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC;IAEO,aAAa;QACnB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAA;QACrB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAyB,CAAA;QAC1C,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAA;IAC3B,CAAC;;AAtD2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAS;AAEtB;IAAb,KAAK,CAAC,KAAK,CAAC;8CAAyB;AAjB3B,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAsE3B","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\n@customElement('ox-zoomable-image')\nexport class OxZoomableImage extends LitElement {\n static styles = css`\n :host {\n display: block;\n overflow: hidden;\n position: relative;\n }\n\n img {\n transition: transform 0.25s ease;\n transform-origin: center;\n cursor: grab;\n }\n `\n\n @property({ type: String }) src = ''\n\n @query('img') image!: HTMLImageElement\n\n private scale: number = 1\n private startX: number = 0\n private startY: number = 0\n private x: number = 0\n private y: number = 0\n private dragging: boolean = false\n\n render() {\n return html`\n <img\n id=\"zoomableImage\"\n src=\"${this.src}\"\n @wheel=\"${this.handleWheel}\"\n @mousedown=\"${this.handleMouseDown}\"\n @mousemove=\"${this.handleMouseMove}\"\n @mouseup=\"${this.handleMouseUp}\"\n @mouseleave=\"${this.handleMouseUp}\"\n style=\"transform: translate(${this.x}px, ${this.y}px) scale(${this.scale});\"\n />\n `\n }\n\n private handleWheel(event: WheelEvent) {\n event.preventDefault()\n const delta = event.deltaY\n const zoomIntensity = 0.1\n this.scale += delta > 0 ? -zoomIntensity : zoomIntensity\n this.scale = Math.max(0.1, Math.min(this.scale, 4))\n this.requestUpdate()\n }\n\n private handleMouseDown(event: MouseEvent) {\n this.startX = event.clientX - this.x\n this.startY = event.clientY - this.y\n this.dragging = true\n const img = this.image as HTMLImageElement\n img.style.cursor = 'grabbing'\n }\n\n private handleMouseMove(event: MouseEvent) {\n if (!this.dragging) return\n this.x = event.clientX - this.startX\n this.y = event.clientY - this.startY\n this.requestUpdate()\n }\n\n private handleMouseUp() {\n this.dragging = false\n const img = this.image as HTMLImageElement\n img.style.cursor = 'grab'\n }\n}\n"]}
@@ -1,75 +0,0 @@
1
- import { LitElement, html, css } from 'lit'
2
- import { customElement, property, query } from 'lit/decorators.js'
3
-
4
- @customElement('ox-zoomable-image')
5
- export class OxZoomableImage extends LitElement {
6
- static styles = css`
7
- :host {
8
- display: block;
9
- overflow: hidden;
10
- position: relative;
11
- }
12
-
13
- img {
14
- transition: transform 0.25s ease;
15
- transform-origin: center;
16
- cursor: grab;
17
- }
18
- `
19
-
20
- @property({ type: String }) src = ''
21
-
22
- @query('img') image!: HTMLImageElement
23
-
24
- private scale: number = 1
25
- private startX: number = 0
26
- private startY: number = 0
27
- private x: number = 0
28
- private y: number = 0
29
- private dragging: boolean = false
30
-
31
- render() {
32
- return html`
33
- <img
34
- id="zoomableImage"
35
- src="${this.src}"
36
- @wheel="${this.handleWheel}"
37
- @mousedown="${this.handleMouseDown}"
38
- @mousemove="${this.handleMouseMove}"
39
- @mouseup="${this.handleMouseUp}"
40
- @mouseleave="${this.handleMouseUp}"
41
- style="transform: translate(${this.x}px, ${this.y}px) scale(${this.scale});"
42
- />
43
- `
44
- }
45
-
46
- private handleWheel(event: WheelEvent) {
47
- event.preventDefault()
48
- const delta = event.deltaY
49
- const zoomIntensity = 0.1
50
- this.scale += delta > 0 ? -zoomIntensity : zoomIntensity
51
- this.scale = Math.max(0.1, Math.min(this.scale, 4))
52
- this.requestUpdate()
53
- }
54
-
55
- private handleMouseDown(event: MouseEvent) {
56
- this.startX = event.clientX - this.x
57
- this.startY = event.clientY - this.y
58
- this.dragging = true
59
- const img = this.image as HTMLImageElement
60
- img.style.cursor = 'grabbing'
61
- }
62
-
63
- private handleMouseMove(event: MouseEvent) {
64
- if (!this.dragging) return
65
- this.x = event.clientX - this.startX
66
- this.y = event.clientY - this.startY
67
- this.requestUpdate()
68
- }
69
-
70
- private handleMouseUp() {
71
- this.dragging = false
72
- const img = this.image as HTMLImageElement
73
- img.style.cursor = 'grab'
74
- }
75
- }