@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/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [8.0.0-alpha.29](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.28...v8.0.0-alpha.29) (2024-10-10)
7
+
8
+
9
+ ### :bug: Bug Fix
10
+
11
+ * apply pointer-event ([ecc73a1](https://github.com/hatiolab/operato/commit/ecc73a1d2df0d8ce7ba462965062a91461c504c3))
12
+
13
+
14
+
15
+ ## [8.0.0-alpha.27](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.26...v8.0.0-alpha.27) (2024-10-06)
16
+
17
+
18
+ ### :bug: Bug Fix
19
+
20
+ * calendar css variables ([9ea1918](https://github.com/hatiolab/operato/commit/9ea191844c72de5f920a8da85ad50209ba77cc07))
21
+
22
+
23
+
6
24
  ## [8.0.0-alpha.26](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.25...v8.0.0-alpha.26) (2024-10-06)
7
25
 
8
26
 
@@ -60,7 +60,7 @@ export declare class OxInputColorStops extends OxFormField {
60
60
  _onChangeSubComponent(e: Event): void;
61
61
  _onDblClickColorbar(e: MouseEvent): void;
62
62
  _onDblClickMarkers(e: MouseEvent): void;
63
- _onMouseDown(e: MouseEvent): void;
63
+ _onPointerDown(e: PointerEvent): void;
64
64
  private dragstart;
65
65
  _onDragStart(e: DragEvent): void;
66
66
  _throttled(delay: number, fn: (...args: any[]) => any): (...args: any[]) => any;
@@ -182,7 +182,7 @@ let OxInputColorStops = class OxInputColorStops extends OxFormField {
182
182
  <div
183
183
  id="markers"
184
184
  @dblclick=${(e) => this._onDblClickMarkers(e)}
185
- @mousedown=${(e) => this._onMouseDown(e)}
185
+ @pointerdown=${(e) => this._onPointerDown(e)}
186
186
  @dragstart=${(e) => this._onDragStart(e)}
187
187
  @drag=${this._throttled(100, this._onDrag.bind(this))}
188
188
  @dragend=${(e) => this._onDragEnd(e)}
@@ -360,7 +360,7 @@ let OxInputColorStops = class OxInputColorStops extends OxFormField {
360
360
  }
361
361
  this.colorEditor.showPicker();
362
362
  }
363
- _onMouseDown(e) {
363
+ _onPointerDown(e) {
364
364
  if (this.disabled) {
365
365
  return;
366
366
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ox-input-color-stops.js","sourceRoot":"","sources":["../../src/ox-input-color-stops.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,kBAAkB,CAAA;AAEzB,OAAO,EAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,OAAO,UAAU,MAAM,mBAAmB,CAAA;AAO1C;;;;;;;;;;;;;;;EAeE;AAEK,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,WAAW;IAA3C;;QAkGL;;;;WAIG;QACyB,SAAI,GAAyB,OAAO,CAAA;QAChE;;WAEG;QACyB,QAAG,GAAW,CAAC,CAAA;QAC3C;;WAEG;QACyB,QAAG,GAAW,CAAC,CAAA;QAiSnC,cAAS,GAA+C,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;IAyF7F,CAAC;aAxeQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+FlB,AA/FY,CA+FZ;IA2BD,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAA;QAEzB,IAA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AO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CACvG,CAAA;IACH,CAAC;;AAjY2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAqC;AAIpC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAgB;AAIf;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAgB;AAIhB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;gDAAoB;AAClB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAa;AAEpB;IAAnB,KAAK,CAAC,WAAW,CAAC;mDAAuB;AAClB;IAAvB,KAAK,CAAC,eAAe,CAAC;sDAA2B;AAvHvC,iBAAiB;IAD7B,aAAa,CAAC,sBAAsB,CAAC;GACzB,iBAAiB,CAye7B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport './ox-input-color'\n\nimport { PropertyValues, css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field'\nimport { OxInputColor } from './ox-input-color'\nimport deepEquals from 'lodash-es/isEqual'\n\nexport type ColorStop = {\n color: string\n position: number\n}\n\n/**\n범위내에서 여러 컬러셋(포지션과 색깔) 배열을 편집하는 컴포넌트이다.\n\n미리보기 Bar에서는 gradient나, solid 형태의 컬러셋을 보여준다.\n\n새로운 컬러셋을 추가고자 할 때는 미리보기 Bar를 더블클릭한다.\n컬러셋을 제거하고자 할 때는 컬러셋 마커를 아래방향으로 드래깅한다.\n컬러셋의 위치를 옮기고자 할 때는, 컬러셋 마커를 좌우로 드래깅하여 이동시키거나,\n옮기고자하는 컬러셋 마커를 마우스로 선택하고, 포지션 입력 에디터에서 직접 수정한다.\n컬러셋의 색상을 바꾸고자 할 때는, 컬러셋 마커를 더블클릭하여 컬러파레트를 팝업시켜서 색상을 선택하거나, 색상 입력 에디터에서 직접 색상을 수정할 수 있다.\n\nExample:\n\n <ox-input-color-stops type=\"gradient\" .value=${gradient.colorStops}>\n </ox-input-color-stops>\n*/\n@customElement('ox-input-color-stops')\nexport class OxInputColorStops extends OxFormField {\n static styles = css`\n :host {\n display: grid;\n grid-template-columns: repeat(10, 1fr);\n grid-gap: 0;\n grid-auto-rows: minmax(0, auto);\n }\n\n #color-stops {\n grid-column: 1 / 11;\n grid-row: 1;\n\n clear: both;\n margin-bottom: -3px;\n }\n\n #colorbar {\n width: 95%;\n height: 12px;\n margin: auto;\n margin-bottom: 25px;\n border: 1px solid #ccc;\n }\n\n #markers {\n position: relative;\n top: 30px;\n }\n\n #markers div {\n width: 10px;\n height: 10px;\n margin-top: -15px;\n position: absolute;\n border: 2px solid #fff;\n cursor: pointer;\n -webkit-box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);\n -moz-box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);\n box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);\n }\n\n #markers div::before {\n border-bottom: 6px solid #fff;\n border-left: 7px solid transparent;\n border-right: 7px solid transparent;\n content: '';\n width: 0;\n height: 0;\n left: -2px;\n position: absolute;\n top: -8px;\n }\n\n #markers div[focused] {\n border-color: var(--things-editor-colorbar-marker-focused-color, #585858);\n }\n\n #markers div[focused]:before {\n border-bottom: 7px solid var(--things-editor-colorbar-marker-focused-color, #585858);\n }\n\n .icon-only-label {\n background: url(/assets/images/icon-properties-label.png) no-repeat;\n width: 30px;\n height: 24px;\n }\n\n .icon-only-label.color {\n grid-column: 1 / 2;\n grid-row: 2;\n\n background-position: 70% -498px;\n float: left;\n margin-top: 0;\n }\n\n .icon-only-label.position {\n grid-column: 7 / 8;\n grid-row: 2;\n\n background-position: 70% -797px;\n float: left;\n margin-top: 0;\n }\n\n ox-input-color {\n grid-column: 2 / 7;\n grid-row: 2;\n }\n\n input[type='number'] {\n grid-column: 8 / 11;\n grid-row: 2;\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n `\n\n /**\n * `type`은 color-stop bar의 표시 방법을 의미한다.\n * - 'solid' : 컬러스톱위치에서 다음 컬러스톱까지 solid color로 채운다.\n * - 'gradient' : 컬러스톱위치에서 다음 컬러스톱까지 gradient color로 채운다.\n */\n @property({ type: String }) type: 'solid' | 'gradient' = 'solid'\n /**\n * `min`은 color-stop bar의 위치값 범위의 최소값을 의미한다.\n */\n @property({ type: Number }) min: number = 0\n /**\n * `max`은 color-stop bar의 위치값 범위의 최대값을 의미한다.\n */\n @property({ type: Number }) max: number = 1\n /**\n * `value`은 color-stops에 의해 만들어진 color-stop 배열을 유지한다.\n */\n @property({ type: Array }) value?: ColorStop[]\n @property({ type: Object }) focused: any\n\n @query('#colorbar') colorbar!: HTMLElement\n @query('#color-editor') colorEditor!: OxInputColor\n\n private _dragImage?: HTMLImageElement\n\n connectedCallback() {\n super.connectedCallback()\n\n this._dragImage = new Image()\n this._dragImage.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='\n }\n\n firstUpdated() {\n window.addEventListener('resize', () => {\n this.requestUpdate()\n })\n }\n\n updated(changes: PropertyValues<this>) {\n var needRerenderColorBar = false\n\n if (changes.has('value') && this.value instanceof Array) {\n var oldValue = changes.get('value')\n if (\n this.focused &&\n (!oldValue ||\n this.value.findIndex(v => v.position == this.focused.position && v.color == this.focused.color) == -1)\n ) {\n /* 이전 값이 없었던 경우에 focused를 클리어시킨다.\n * 이전 값이 있던 경우에도, focused는 이 에디터 내부에서만 선택될 수 있으며, 수정될 수 있으므로 동일한 포지션을 갖는 value가 없으면, 새로운 에디터가 시작된 것으로 판단하여 focused를 클리어시킨다.\n */\n this.focused = null\n }\n\n if (!deepEquals(oldValue, this.value)) {\n needRerenderColorBar = true\n }\n }\n\n if (needRerenderColorBar || changes.has('min') || changes.has('max')) {\n if (!this.value) {\n this.value = [\n { color: 'white', position: this.min },\n { color: 'white', position: this.max }\n ]\n }\n\n this._renderColorBar(this.min, this.max, this.type)\n this.requestUpdate()\n }\n }\n\n render() {\n return html`\n <div id=\"color-stops\">\n <div id=\"colorbar\" @dblclick=${(e: MouseEvent) => this._onDblClickColorbar(e)}>\n <div\n id=\"markers\"\n @dblclick=${(e: MouseEvent) => this._onDblClickMarkers(e)}\n @mousedown=${(e: MouseEvent) => this._onMouseDown(e)}\n @dragstart=${(e: DragEvent) => this._onDragStart(e)}\n @drag=${this._throttled(100, this._onDrag.bind(this))}\n @dragend=${(e: DragEvent) => this._onDragEnd(e)}\n >\n ${this._refinedValue(this.value).map(\n (item, index) => html`\n <div\n .style=\"background-color:${item.color};margin-left:${this._calculatePosition(\n item.position,\n this.min,\n this.max\n )}px;\"\n marker-index=${index}\n draggable=\"true\"\n ></div>\n `\n )}\n </div>\n </div>\n </div>\n\n <label class=\"icon-only-label color\"></label>\n <ox-input-color\n id=\"color-editor\"\n .value=${this.focused && this.focused.color}\n @change=${(e: Event) => this._onChangeSubComponent(e)}\n ?disabled=${this.disabled}\n >\n </ox-input-color>\n\n <label class=\"icon-only-label position\"></label>\n <input\n type=\"number\"\n id=\"color-position\"\n .value=${this.focused && this.focused.position}\n @change=${(e: Event) => this._onChangeSubComponent(e)}\n step=\"0.01\"\n ?disabled=${this.disabled}\n />\n `\n }\n\n _refinedValue(value: any) {\n return value instanceof Array ? value : []\n }\n\n _setFocused(index: number) {\n if (this.focused && this.focused.index === index) {\n return\n }\n\n var marker = this.renderRoot.querySelector(`#markers div[marker-index='${index}']`) as HTMLElement\n var olds = this.renderRoot.querySelectorAll('#markers div[focused]')\n olds.length > 0 && olds.forEach(old => old.removeAttribute('focused'))\n marker && marker.setAttribute('focused', '')\n\n if (!marker) {\n this.focused = null\n return\n }\n\n var colorStop = this.value![index]\n\n this._changeFocused({\n index: index,\n color: colorStop.color,\n position: Math.max(this.min, Math.min(colorStop.position, this.max))\n })\n }\n\n _changeFocused(focused: any) {\n if (!focused) {\n this._setFocused(-1) // clear focused marker\n\n return\n }\n\n this.focused = focused\n\n this.value = this.value!.map((colorStop, index): ColorStop => {\n if (index != focused.index) {\n return colorStop\n }\n\n return {\n color: focused.color,\n position: focused.position\n }\n }).sort((a: ColorStop, b: ColorStop) => {\n return b.position < a.position ? 1 : -1\n })\n\n var colorStop = this.value[focused.index]\n\n if (focused.position != colorStop.position || focused.color != colorStop.color) {\n var index = -1\n for (var i = 0; i < this.value.length; i++) {\n colorStop = this.value[i]\n if (focused.position == colorStop.position && focused.color == colorStop.color) {\n index = i\n break\n }\n }\n\n this._setFocused(index)\n }\n }\n\n _renderColorBar(min: number, max: number, type: 'solid' | 'gradient') {\n var value = this._refinedValue(this.value)\n var gradient = ''\n\n if (value instanceof Array && value.length > 0) {\n if (this.type == 'gradient') {\n var stopsStrings = (value || []).map(function (stop) {\n var position = (stop.position - min) / (max - min)\n return `${stop.color} ${position * 100}%`\n })\n } else {\n var stops = value || []\n var last: ColorStop | undefined\n var last_position = 0\n var stopsStrings = stops.map(function (stop) {\n var stop_position = (stop.position - min) / (max - min)\n if (last) {\n last_position = (last.position - min) / (max - min)\n var step = `${stop.color} ${last_position * 100}%, ${stop.color} ${stop_position * 100}%`\n } else {\n var step = `${stop.color} ${stop_position * 100}%`\n }\n last = stop\n return step\n })\n if (last) {\n last_position = (last.position - min) / (max - min)\n stopsStrings.push(`${last.color} ${last_position * 100}%, white ${last_position * 100}%, white 100%`)\n }\n }\n\n gradient = stopsStrings.join(',')\n } else {\n gradient = 'black 0%, black 100%'\n }\n\n this.colorbar!.style.background = `linear-gradient(to right, ${gradient})`\n /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */\n }\n\n _onChangeSubComponent(e: Event) {\n var element = e.target as HTMLInputElement\n var id = element.id\n\n if (!this.focused) {\n return\n }\n\n switch (id) {\n case 'color-editor':\n this._changeFocused({\n ...this.focused,\n color: element.value\n })\n break\n case 'color-position':\n this._changeFocused({\n ...this.focused,\n position: Math.max(this.min, Math.min(Number(element.value), this.max))\n })\n break\n }\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onDblClickColorbar(e: MouseEvent) {\n if (this.disabled) {\n return\n }\n\n /* 마커를 클릭한 경우를 걸러낸다. */\n if (e.target !== this.colorbar) return\n\n var width = this.colorbar.offsetWidth\n var position = this.min + (this.max - this.min) * (e.offsetX / width)\n var colorStops = this.value ? this.value.slice() : []\n\n for (var i = 0; i < colorStops.length; i++) {\n if (colorStops[i].position > position) break\n }\n\n colorStops.splice(i, 0, {\n position: position,\n color: '#fff'\n })\n\n this.value = colorStops\n\n this.focused = null\n this._setFocused(i)\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onDblClickMarkers(e: MouseEvent) {\n if (this.disabled) {\n return\n }\n\n this.colorEditor.showPicker()\n }\n\n _onMouseDown(e: MouseEvent) {\n if (this.disabled) {\n return\n }\n\n var marker = e.target as HTMLElement\n var index = marker.getAttribute('marker-index')\n\n this._setFocused(Number(index))\n }\n\n private dragstart: { position: number; x: number; y: number } = { position: 0, x: 0, y: 0 }\n\n _onDragStart(e: DragEvent) {\n if (this.disabled) {\n return\n }\n\n /* drag 시에 ghost image를 보이지 않게 하려고 함 */\n e.dataTransfer?.setDragImage(this._dragImage!, 0, 0)\n\n this.dragstart = {\n position: this.focused.position,\n x: e.clientX,\n y: e.clientY\n }\n }\n\n // TODO onDrag 이벤트가 계속 발생하므로 처리하는 성능 저하됨. 그래서 throttling 하도록 함\n _throttled(delay: number, fn: (...args: any[]) => any) {\n let lastCall = 0\n return function (...args: any[]) {\n const now = new Date().getTime()\n if (now - lastCall < delay) {\n return\n }\n lastCall = now\n return fn(...args)\n }\n }\n\n _onDrag(e: DragEvent) {\n if (this.disabled) {\n return\n }\n\n if (e.clientX <= 0) {\n return\n }\n\n var width = this.colorbar.offsetWidth\n var position = this.dragstart.position + ((e.clientX - this.dragstart.x) / width) * (this.max - this.min)\n\n if (position != this.focused.position) {\n this._changeFocused({\n ...this.focused,\n position: Math.max(this.min, Math.min(position, this.max))\n })\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n }\n\n _onDragEnd(e: DragEvent) {\n if (this.disabled) {\n return\n }\n\n if (e.clientY - this.dragstart.y > 40) {\n this.value!.splice(this.focused.index, 1)\n this.value = this.value!.slice()\n\n this._setFocused(-1)\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n }\n\n _calculatePosition(position: number, min: number, max: number) {\n /* TODO 7 ==> 마커 폭의 절반으로 계산해야함. */\n var calculated = position\n\n if (calculated > this.max) calculated = this.max\n else if (calculated < this.min) calculated = this.min\n\n var width = (this.colorbar && this.colorbar.offsetWidth) || 0\n\n return ((calculated - this.min) / (this.max - this.min)) * width - 7\n }\n\n protected appendFormData({ formData }: FormDataEvent): void {\n if (!this.name) return\n\n const value = this.value\n\n formData.append(\n this.name!,\n typeof value === 'string' ? value : value === undefined || value === null ? '' : JSON.stringify(value)\n )\n }\n}\n"]}
1
+ {"version":3,"file":"ox-input-color-stops.js","sourceRoot":"","sources":["../../src/ox-input-color-stops.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,kBAAkB,CAAA;AAEzB,OAAO,EAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,OAAO,UAAU,MAAM,mBAAmB,CAAA;AAO1C;;;;;;;;;;;;;;;EAeE;AAEK,IAAM,iBAAiB,GAAvB,MAAM,iBAA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zB,iBAAiB,CAye7B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport './ox-input-color'\n\nimport { PropertyValues, css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field'\nimport { OxInputColor } from './ox-input-color'\nimport deepEquals from 'lodash-es/isEqual'\n\nexport type ColorStop = {\n color: string\n position: number\n}\n\n/**\n범위내에서 여러 컬러셋(포지션과 색깔) 배열을 편집하는 컴포넌트이다.\n\n미리보기 Bar에서는 gradient나, solid 형태의 컬러셋을 보여준다.\n\n새로운 컬러셋을 추가고자 할 때는 미리보기 Bar를 더블클릭한다.\n컬러셋을 제거하고자 할 때는 컬러셋 마커를 아래방향으로 드래깅한다.\n컬러셋의 위치를 옮기고자 할 때는, 컬러셋 마커를 좌우로 드래깅하여 이동시키거나,\n옮기고자하는 컬러셋 마커를 마우스로 선택하고, 포지션 입력 에디터에서 직접 수정한다.\n컬러셋의 색상을 바꾸고자 할 때는, 컬러셋 마커를 더블클릭하여 컬러파레트를 팝업시켜서 색상을 선택하거나, 색상 입력 에디터에서 직접 색상을 수정할 수 있다.\n\nExample:\n\n <ox-input-color-stops type=\"gradient\" .value=${gradient.colorStops}>\n </ox-input-color-stops>\n*/\n@customElement('ox-input-color-stops')\nexport class OxInputColorStops extends OxFormField {\n static styles = css`\n :host {\n display: grid;\n grid-template-columns: repeat(10, 1fr);\n grid-gap: 0;\n grid-auto-rows: minmax(0, auto);\n }\n\n #color-stops {\n grid-column: 1 / 11;\n grid-row: 1;\n\n clear: both;\n margin-bottom: -3px;\n }\n\n #colorbar {\n width: 95%;\n height: 12px;\n margin: auto;\n margin-bottom: 25px;\n border: 1px solid #ccc;\n }\n\n #markers {\n position: relative;\n top: 30px;\n }\n\n #markers div {\n width: 10px;\n height: 10px;\n margin-top: -15px;\n position: absolute;\n border: 2px solid #fff;\n cursor: pointer;\n -webkit-box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);\n -moz-box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);\n box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);\n }\n\n #markers div::before {\n border-bottom: 6px solid #fff;\n border-left: 7px solid transparent;\n border-right: 7px solid transparent;\n content: '';\n width: 0;\n height: 0;\n left: -2px;\n position: absolute;\n top: -8px;\n }\n\n #markers div[focused] {\n border-color: var(--things-editor-colorbar-marker-focused-color, #585858);\n }\n\n #markers div[focused]:before {\n border-bottom: 7px solid var(--things-editor-colorbar-marker-focused-color, #585858);\n }\n\n .icon-only-label {\n background: url(/assets/images/icon-properties-label.png) no-repeat;\n width: 30px;\n height: 24px;\n }\n\n .icon-only-label.color {\n grid-column: 1 / 2;\n grid-row: 2;\n\n background-position: 70% -498px;\n float: left;\n margin-top: 0;\n }\n\n .icon-only-label.position {\n grid-column: 7 / 8;\n grid-row: 2;\n\n background-position: 70% -797px;\n float: left;\n margin-top: 0;\n }\n\n ox-input-color {\n grid-column: 2 / 7;\n grid-row: 2;\n }\n\n input[type='number'] {\n grid-column: 8 / 11;\n grid-row: 2;\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n `\n\n /**\n * `type`은 color-stop bar의 표시 방법을 의미한다.\n * - 'solid' : 컬러스톱위치에서 다음 컬러스톱까지 solid color로 채운다.\n * - 'gradient' : 컬러스톱위치에서 다음 컬러스톱까지 gradient color로 채운다.\n */\n @property({ type: String }) type: 'solid' | 'gradient' = 'solid'\n /**\n * `min`은 color-stop bar의 위치값 범위의 최소값을 의미한다.\n */\n @property({ type: Number }) min: number = 0\n /**\n * `max`은 color-stop bar의 위치값 범위의 최대값을 의미한다.\n */\n @property({ type: Number }) max: number = 1\n /**\n * `value`은 color-stops에 의해 만들어진 color-stop 배열을 유지한다.\n */\n @property({ type: Array }) value?: ColorStop[]\n @property({ type: Object }) focused: any\n\n @query('#colorbar') colorbar!: HTMLElement\n @query('#color-editor') colorEditor!: OxInputColor\n\n private _dragImage?: HTMLImageElement\n\n connectedCallback() {\n super.connectedCallback()\n\n this._dragImage = new Image()\n this._dragImage.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='\n }\n\n firstUpdated() {\n window.addEventListener('resize', () => {\n this.requestUpdate()\n })\n }\n\n updated(changes: PropertyValues<this>) {\n var needRerenderColorBar = false\n\n if (changes.has('value') && this.value instanceof Array) {\n var oldValue = changes.get('value')\n if (\n this.focused &&\n (!oldValue ||\n this.value.findIndex(v => v.position == this.focused.position && v.color == this.focused.color) == -1)\n ) {\n /* 이전 값이 없었던 경우에 focused를 클리어시킨다.\n * 이전 값이 있던 경우에도, focused는 이 에디터 내부에서만 선택될 수 있으며, 수정될 수 있으므로 동일한 포지션을 갖는 value가 없으면, 새로운 에디터가 시작된 것으로 판단하여 focused를 클리어시킨다.\n */\n this.focused = null\n }\n\n if (!deepEquals(oldValue, this.value)) {\n needRerenderColorBar = true\n }\n }\n\n if (needRerenderColorBar || changes.has('min') || changes.has('max')) {\n if (!this.value) {\n this.value = [\n { color: 'white', position: this.min },\n { color: 'white', position: this.max }\n ]\n }\n\n this._renderColorBar(this.min, this.max, this.type)\n this.requestUpdate()\n }\n }\n\n render() {\n return html`\n <div id=\"color-stops\">\n <div id=\"colorbar\" @dblclick=${(e: MouseEvent) => this._onDblClickColorbar(e)}>\n <div\n id=\"markers\"\n @dblclick=${(e: MouseEvent) => this._onDblClickMarkers(e)}\n @pointerdown=${(e: PointerEvent) => this._onPointerDown(e)}\n @dragstart=${(e: DragEvent) => this._onDragStart(e)}\n @drag=${this._throttled(100, this._onDrag.bind(this))}\n @dragend=${(e: DragEvent) => this._onDragEnd(e)}\n >\n ${this._refinedValue(this.value).map(\n (item, index) => html`\n <div\n .style=\"background-color:${item.color};margin-left:${this._calculatePosition(\n item.position,\n this.min,\n this.max\n )}px;\"\n marker-index=${index}\n draggable=\"true\"\n ></div>\n `\n )}\n </div>\n </div>\n </div>\n\n <label class=\"icon-only-label color\"></label>\n <ox-input-color\n id=\"color-editor\"\n .value=${this.focused && this.focused.color}\n @change=${(e: Event) => this._onChangeSubComponent(e)}\n ?disabled=${this.disabled}\n >\n </ox-input-color>\n\n <label class=\"icon-only-label position\"></label>\n <input\n type=\"number\"\n id=\"color-position\"\n .value=${this.focused && this.focused.position}\n @change=${(e: Event) => this._onChangeSubComponent(e)}\n step=\"0.01\"\n ?disabled=${this.disabled}\n />\n `\n }\n\n _refinedValue(value: any) {\n return value instanceof Array ? value : []\n }\n\n _setFocused(index: number) {\n if (this.focused && this.focused.index === index) {\n return\n }\n\n var marker = this.renderRoot.querySelector(`#markers div[marker-index='${index}']`) as HTMLElement\n var olds = this.renderRoot.querySelectorAll('#markers div[focused]')\n olds.length > 0 && olds.forEach(old => old.removeAttribute('focused'))\n marker && marker.setAttribute('focused', '')\n\n if (!marker) {\n this.focused = null\n return\n }\n\n var colorStop = this.value![index]\n\n this._changeFocused({\n index: index,\n color: colorStop.color,\n position: Math.max(this.min, Math.min(colorStop.position, this.max))\n })\n }\n\n _changeFocused(focused: any) {\n if (!focused) {\n this._setFocused(-1) // clear focused marker\n\n return\n }\n\n this.focused = focused\n\n this.value = this.value!.map((colorStop, index): ColorStop => {\n if (index != focused.index) {\n return colorStop\n }\n\n return {\n color: focused.color,\n position: focused.position\n }\n }).sort((a: ColorStop, b: ColorStop) => {\n return b.position < a.position ? 1 : -1\n })\n\n var colorStop = this.value[focused.index]\n\n if (focused.position != colorStop.position || focused.color != colorStop.color) {\n var index = -1\n for (var i = 0; i < this.value.length; i++) {\n colorStop = this.value[i]\n if (focused.position == colorStop.position && focused.color == colorStop.color) {\n index = i\n break\n }\n }\n\n this._setFocused(index)\n }\n }\n\n _renderColorBar(min: number, max: number, type: 'solid' | 'gradient') {\n var value = this._refinedValue(this.value)\n var gradient = ''\n\n if (value instanceof Array && value.length > 0) {\n if (this.type == 'gradient') {\n var stopsStrings = (value || []).map(function (stop) {\n var position = (stop.position - min) / (max - min)\n return `${stop.color} ${position * 100}%`\n })\n } else {\n var stops = value || []\n var last: ColorStop | undefined\n var last_position = 0\n var stopsStrings = stops.map(function (stop) {\n var stop_position = (stop.position - min) / (max - min)\n if (last) {\n last_position = (last.position - min) / (max - min)\n var step = `${stop.color} ${last_position * 100}%, ${stop.color} ${stop_position * 100}%`\n } else {\n var step = `${stop.color} ${stop_position * 100}%`\n }\n last = stop\n return step\n })\n if (last) {\n last_position = (last.position - min) / (max - min)\n stopsStrings.push(`${last.color} ${last_position * 100}%, white ${last_position * 100}%, white 100%`)\n }\n }\n\n gradient = stopsStrings.join(',')\n } else {\n gradient = 'black 0%, black 100%'\n }\n\n this.colorbar!.style.background = `linear-gradient(to right, ${gradient})`\n /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */\n }\n\n _onChangeSubComponent(e: Event) {\n var element = e.target as HTMLInputElement\n var id = element.id\n\n if (!this.focused) {\n return\n }\n\n switch (id) {\n case 'color-editor':\n this._changeFocused({\n ...this.focused,\n color: element.value\n })\n break\n case 'color-position':\n this._changeFocused({\n ...this.focused,\n position: Math.max(this.min, Math.min(Number(element.value), this.max))\n })\n break\n }\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onDblClickColorbar(e: MouseEvent) {\n if (this.disabled) {\n return\n }\n\n /* 마커를 클릭한 경우를 걸러낸다. */\n if (e.target !== this.colorbar) return\n\n var width = this.colorbar.offsetWidth\n var position = this.min + (this.max - this.min) * (e.offsetX / width)\n var colorStops = this.value ? this.value.slice() : []\n\n for (var i = 0; i < colorStops.length; i++) {\n if (colorStops[i].position > position) break\n }\n\n colorStops.splice(i, 0, {\n position: position,\n color: '#fff'\n })\n\n this.value = colorStops\n\n this.focused = null\n this._setFocused(i)\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onDblClickMarkers(e: MouseEvent) {\n if (this.disabled) {\n return\n }\n\n this.colorEditor.showPicker()\n }\n\n _onPointerDown(e: PointerEvent) {\n if (this.disabled) {\n return\n }\n\n var marker = e.target as HTMLElement\n var index = marker.getAttribute('marker-index')\n\n this._setFocused(Number(index))\n }\n\n private dragstart: { position: number; x: number; y: number } = { position: 0, x: 0, y: 0 }\n\n _onDragStart(e: DragEvent) {\n if (this.disabled) {\n return\n }\n\n /* drag 시에 ghost image를 보이지 않게 하려고 함 */\n e.dataTransfer?.setDragImage(this._dragImage!, 0, 0)\n\n this.dragstart = {\n position: this.focused.position,\n x: e.clientX,\n y: e.clientY\n }\n }\n\n // TODO onDrag 이벤트가 계속 발생하므로 처리하는 성능 저하됨. 그래서 throttling 하도록 함\n _throttled(delay: number, fn: (...args: any[]) => any) {\n let lastCall = 0\n return function (...args: any[]) {\n const now = new Date().getTime()\n if (now - lastCall < delay) {\n return\n }\n lastCall = now\n return fn(...args)\n }\n }\n\n _onDrag(e: DragEvent) {\n if (this.disabled) {\n return\n }\n\n if (e.clientX <= 0) {\n return\n }\n\n var width = this.colorbar.offsetWidth\n var position = this.dragstart.position + ((e.clientX - this.dragstart.x) / width) * (this.max - this.min)\n\n if (position != this.focused.position) {\n this._changeFocused({\n ...this.focused,\n position: Math.max(this.min, Math.min(position, this.max))\n })\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n }\n\n _onDragEnd(e: DragEvent) {\n if (this.disabled) {\n return\n }\n\n if (e.clientY - this.dragstart.y > 40) {\n this.value!.splice(this.focused.index, 1)\n this.value = this.value!.slice()\n\n this._setFocused(-1)\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n }\n\n _calculatePosition(position: number, min: number, max: number) {\n /* TODO 7 ==> 마커 폭의 절반으로 계산해야함. */\n var calculated = position\n\n if (calculated > this.max) calculated = this.max\n else if (calculated < this.min) calculated = this.min\n\n var width = (this.colorbar && this.colorbar.offsetWidth) || 0\n\n return ((calculated - this.min) / (this.max - this.min)) * width - 7\n }\n\n protected appendFormData({ formData }: FormDataEvent): void {\n if (!this.name) return\n\n const value = this.value\n\n formData.append(\n this.name!,\n typeof value === 'string' ? value : value === undefined || value === null ? '' : JSON.stringify(value)\n )\n }\n}\n"]}
@@ -69,13 +69,10 @@ let OxInputSignature = class OxInputSignature extends OxFormField {
69
69
  <canvas
70
70
  width="800"
71
71
  height="400"
72
- @mousedown=${this.startDrawing}
73
- @mouseup=${this.stopDrawing}
74
- @mousemove=${this.draw}
75
- @mouseleave=${this.stopDrawing}
76
- @touchstart=${this.startDrawing}
77
- @touchend=${this.stopDrawing}
78
- @touchmove=${this.draw}
72
+ @pointerdown=${this.startDrawing}
73
+ @pointerup=${this.stopDrawing}
74
+ @pointermove=${this.draw}
75
+ @pointerleave=${this.stopDrawing}
79
76
  ></canvas>
80
77
  <div class="controls">
81
78
  <button @click="${this.clearCanvas}">Clear</button>
@@ -1 +1 @@
1
- {"version":3,"file":"ox-input-signature.js","sourceRoot":"","sources":["../../src/ox-input-signature.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAGzC,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,WAAW;IAA1C;;QAsDuB,UAAK,GAAkB,IAAI,CAAA;QAU/C,cAAS,GAAG,KAAK,CAAA;IA0I3B,CAAC;aAzMQ,WAAM,GAAG;QACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAiDF;KACF,AAnDY,CAmDZ;IAcD,MAAM;QACJ,OAAO,IAAI,CAAA;8CAC+B,IAAI,CAAC,UAAU;;;;;;uBAMtC,IAAI,CAAC,YAAY;qBACnB,IAAI,CAAC,WAAW;uBACd,IAAI,CAAC,IAAI;wBACR,IAAI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IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI,CAAC,KAAK;SACnB,CAAC,CACH,CAAA;IACH,CAAC;;AAnJ2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAA4B;AAG/C;IADP,KAAK,CAAC,oBAAoB,CAAC;oDACO;AAE3B;IADP,KAAK,CAAC,QAAQ,CAAC;gDACkB;AAE1B;IADP,KAAK,CAAC,QAAQ,CAAC;gDACkB;AA7DvB,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CA0M5B","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport { css, html, PropertyValues } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field.js'\n\n@customElement('ox-input-signature')\nexport class OxInputSignature extends OxFormField {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n min-height: var(--signature-min-height, 80px);\n min-width: var(--signature-min-width, 120px);\n\n background-color: var(--signature-background-color, white);\n\n overflow: hidden;\n }\n\n .signature-preview {\n flex: 1;\n align-self: stretch;\n\n border: 1px solid var(--md-sys-color-outline);\n background-size: contain;\n background-repeat: no-repeat;\n background-position: center;\n }\n\n dialog canvas {\n border: 1px solid var(--md-sys-color-outline);\n }\n\n .controls {\n margin-top: 10px;\n display: flex;\n flex-direction: row;\n gap: var(--spacing-medium);\n }\n\n .filler {\n flex: 1;\n }\n\n /* 버튼 스타일 */\n button {\n background-color: var(--md-sys-color-primary);\n color: var(--md-sys-color-on-primary);\n padding: 10px 20px;\n border: none;\n border-radius: var(--spacing-small);\n font-family: 'Roboto', sans-serif;\n font-size: 14px;\n cursor: pointer;\n transition: background-color 0.3s ease;\n }\n `\n ]\n\n @property({ type: String }) value: string | null = null\n\n @query('.signature-preview')\n private previewDiv!: HTMLDivElement\n @query('dialog')\n private dialog!: HTMLDialogElement\n @query('canvas')\n private canvas!: HTMLCanvasElement\n\n private ctx!: CanvasRenderingContext2D\n private isDrawing = false\n\n render() {\n return html`\n <div class=\"signature-preview\" @click=${this.openDialog}></div>\n\n <dialog>\n <canvas\n width=\"800\"\n height=\"400\"\n @mousedown=${this.startDrawing}\n @mouseup=${this.stopDrawing}\n @mousemove=${this.draw}\n @mouseleave=${this.stopDrawing}\n @touchstart=${this.startDrawing}\n @touchend=${this.stopDrawing}\n @touchmove=${this.draw}\n ></canvas>\n <div class=\"controls\">\n <button @click=\"${this.clearCanvas}\">Clear</button>\n <div class=\"filler\"></div>\n <button @click=\"${this.saveSignature}\">Save</button>\n <button @click=\"${this.closeDialog}\">Close</button>\n </div>\n </dialog>\n `\n }\n\n firstUpdated() {\n this.ctx = this.canvas.getContext('2d')!\n this.ctx.strokeStyle = '#000'\n this.ctx.lineWidth = 2\n\n // 처음 로딩 시 서명 데이터를 미리보기 div에 표시\n if (this.value) {\n this.loadSignature(this.value)\n }\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('value')) {\n this.loadSignature(this.value)\n }\n }\n\n openDialog() {\n if (this.disabled) {\n return\n }\n\n this.dialog.showModal()\n\n if (this.value) {\n const img = new Image()\n img.onload = () => {\n this.ctx.drawImage(img, 0, 0, this.canvas.width, this.canvas.height)\n }\n img.src = this.value\n }\n }\n\n closeDialog() {\n this.dialog.close()\n }\n\n startDrawing(event: MouseEvent | TouchEvent) {\n if (this.disabled) {\n return\n }\n\n event.preventDefault()\n event.stopPropagation()\n\n this.isDrawing = true\n this.ctx.beginPath()\n const position = this.getEventPosition(event)\n this.ctx.moveTo(position.x, position.y)\n }\n\n stopDrawing(event: MouseEvent | TouchEvent) {\n event.preventDefault()\n event.stopPropagation()\n\n this.isDrawing = false\n }\n\n draw(event: MouseEvent | TouchEvent) {\n if (!this.isDrawing) {\n return\n }\n\n event.preventDefault()\n event.stopPropagation()\n\n const position = this.getEventPosition(event)\n this.ctx.lineTo(position.x, position.y)\n this.ctx.stroke()\n }\n\n clearCanvas() {\n this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height)\n }\n\n saveSignature() {\n this.value = this.canvas.toDataURL()\n this._notifyChange()\n this.previewDiv.style.backgroundImage = `url(${this.value})`\n this.closeDialog()\n }\n\n loadSignature(dataUrl: string | null) {\n this.previewDiv.style.backgroundImage = dataUrl ? `url(${dataUrl})` : 'none'\n }\n\n getEventPosition(event: MouseEvent | TouchEvent) {\n const rect = this.canvas.getBoundingClientRect()\n\n // 캔버스의 실제 크기와 CSS 크기 간의 비율을 계산\n const scaleX = this.canvas.width / rect.width\n const scaleY = this.canvas.height / rect.height\n\n // 실제 좌표 계산\n const isTouchEvent = event instanceof TouchEvent\n const x = (isTouchEvent ? event.touches[0].clientX - rect.left : (event as MouseEvent).clientX - rect.left) * scaleX\n const y = (isTouchEvent ? event.touches[0].clientY - rect.top : (event as MouseEvent).clientY - rect.top) * scaleY\n\n return { x, y }\n }\n\n _notifyChange() {\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
1
+ {"version":3,"file":"ox-input-signature.js","sourceRoot":"","sources":["../../src/ox-input-signature.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAGzC,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,WAAW;IAA1C;;QAsDuB,UAAK,GAAkB,IAAI,CAAA;QAU/C,cAAS,GAAG,KAAK,CAAA;IAuI3B,CAAC;aAtMQ,WAAM,GAAG;QACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAG,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAA;QAElH,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;IACjB,CAAC;IAED,aAAa;QACX,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI,CAAC,KAAK;SACnB,CAAC,CACH,CAAA;IACH,CAAC;;AAhJ2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAA4B;AAG/C;IADP,KAAK,CAAC,oBAAoB,CAAC;oDACO;AAE3B;IADP,KAAK,CAAC,QAAQ,CAAC;gDACkB;AAE1B;IADP,KAAK,CAAC,QAAQ,CAAC;gDACkB;AA7DvB,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CAuM5B","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport { css, html, PropertyValues } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field.js'\n\n@customElement('ox-input-signature')\nexport class OxInputSignature extends OxFormField {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n min-height: var(--signature-min-height, 80px);\n min-width: var(--signature-min-width, 120px);\n\n background-color: var(--signature-background-color, white);\n\n overflow: hidden;\n }\n\n .signature-preview {\n flex: 1;\n align-self: stretch;\n\n border: 1px solid var(--md-sys-color-outline);\n background-size: contain;\n background-repeat: no-repeat;\n background-position: center;\n }\n\n dialog canvas {\n border: 1px solid var(--md-sys-color-outline);\n }\n\n .controls {\n margin-top: 10px;\n display: flex;\n flex-direction: row;\n gap: var(--spacing-medium);\n }\n\n .filler {\n flex: 1;\n }\n\n /* 버튼 스타일 */\n button {\n background-color: var(--md-sys-color-primary);\n color: var(--md-sys-color-on-primary);\n padding: 10px 20px;\n border: none;\n border-radius: var(--spacing-small);\n font-family: 'Roboto', sans-serif;\n font-size: 14px;\n cursor: pointer;\n transition: background-color 0.3s ease;\n }\n `\n ]\n\n @property({ type: String }) value: string | null = null\n\n @query('.signature-preview')\n private previewDiv!: HTMLDivElement\n @query('dialog')\n private dialog!: HTMLDialogElement\n @query('canvas')\n private canvas!: HTMLCanvasElement\n\n private ctx!: CanvasRenderingContext2D\n private isDrawing = false\n\n render() {\n return html`\n <div class=\"signature-preview\" @click=${this.openDialog}></div>\n\n <dialog>\n <canvas\n width=\"800\"\n height=\"400\"\n @pointerdown=${this.startDrawing}\n @pointerup=${this.stopDrawing}\n @pointermove=${this.draw}\n @pointerleave=${this.stopDrawing}\n ></canvas>\n <div class=\"controls\">\n <button @click=\"${this.clearCanvas}\">Clear</button>\n <div class=\"filler\"></div>\n <button @click=\"${this.saveSignature}\">Save</button>\n <button @click=\"${this.closeDialog}\">Close</button>\n </div>\n </dialog>\n `\n }\n\n firstUpdated() {\n this.ctx = this.canvas.getContext('2d')!\n this.ctx.strokeStyle = '#000'\n this.ctx.lineWidth = 2\n\n // 처음 로딩 시 서명 데이터를 미리보기 div에 표시\n if (this.value) {\n this.loadSignature(this.value)\n }\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('value')) {\n this.loadSignature(this.value)\n }\n }\n\n openDialog() {\n if (this.disabled) {\n return\n }\n\n this.dialog.showModal()\n\n if (this.value) {\n const img = new Image()\n img.onload = () => {\n this.ctx.drawImage(img, 0, 0, this.canvas.width, this.canvas.height)\n }\n img.src = this.value\n }\n }\n\n closeDialog() {\n this.dialog.close()\n }\n\n startDrawing(event: MouseEvent | TouchEvent) {\n if (this.disabled) {\n return\n }\n\n event.preventDefault()\n event.stopPropagation()\n\n this.isDrawing = true\n this.ctx.beginPath()\n const position = this.getEventPosition(event)\n this.ctx.moveTo(position.x, position.y)\n }\n\n stopDrawing(event: MouseEvent | TouchEvent) {\n event.preventDefault()\n event.stopPropagation()\n\n this.isDrawing = false\n }\n\n draw(event: MouseEvent | TouchEvent) {\n if (!this.isDrawing) {\n return\n }\n\n event.preventDefault()\n event.stopPropagation()\n\n const position = this.getEventPosition(event)\n this.ctx.lineTo(position.x, position.y)\n this.ctx.stroke()\n }\n\n clearCanvas() {\n this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height)\n }\n\n saveSignature() {\n this.value = this.canvas.toDataURL()\n this._notifyChange()\n this.previewDiv.style.backgroundImage = `url(${this.value})`\n this.closeDialog()\n }\n\n loadSignature(dataUrl: string | null) {\n this.previewDiv.style.backgroundImage = dataUrl ? `url(${dataUrl})` : 'none'\n }\n\n getEventPosition(event: MouseEvent | TouchEvent) {\n const rect = this.canvas.getBoundingClientRect()\n\n // 캔버스의 실제 크기와 CSS 크기 간의 비율을 계산\n const scaleX = this.canvas.width / rect.width\n const scaleY = this.canvas.height / rect.height\n\n // 실제 좌표 계산\n const isTouchEvent = event instanceof TouchEvent\n const x = (isTouchEvent ? event.touches[0].clientX - rect.left : (event as MouseEvent).clientX - rect.left) * scaleX\n const y = (isTouchEvent ? event.touches[0].clientY - rect.top : (event as MouseEvent).clientY - rect.top) * scaleY\n\n return { x, y }\n }\n\n _notifyChange() {\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
@@ -13,22 +13,17 @@ export declare class OxSelectFloor extends OxFormField {
13
13
  private activeIndex;
14
14
  private carouselContainer;
15
15
  private isDragging;
16
- private lastTouchY;
17
16
  private lastMouseY;
18
- private startY;
19
17
  render(): import("lit-html").TemplateResult<1>;
20
18
  updated(changes: PropertyValues<this>): void;
21
19
  firstUpdated(): void;
22
20
  getClassForCard(index: number): "selected" | "compressed";
23
21
  isActive(index: number): boolean;
24
22
  handleWheel(event: WheelEvent): void;
25
- handleTouchStart(event: TouchEvent): void;
26
- handleTouchMove(event: TouchEvent): void;
27
- handleTouchEnd(): void;
28
- handleMouseDown(event: MouseEvent): void;
29
- handleMouseMove(event: MouseEvent): void;
30
- handleMouseUp(): void;
31
- handleMouseLeave(): void;
23
+ handlePointerDown(event: PointerEvent): void;
24
+ handlePointerMove(event: PointerEvent): void;
25
+ handlePointerUp(event: PointerEvent): void;
26
+ handlePointerLeave(event: PointerEvent): void;
32
27
  private toggleActiveCard;
33
28
  private updateSelectedIndex;
34
29
  private scrollToSelectedCard;
@@ -10,9 +10,7 @@ let OxSelectFloor = class OxSelectFloor extends OxFormField {
10
10
  this.selectedIndex = -1;
11
11
  this.activeIndex = null;
12
12
  this.isDragging = false;
13
- this.lastTouchY = 0;
14
13
  this.lastMouseY = 0;
15
- this.startY = 0;
16
14
  }
17
15
  static { this.styles = [
18
16
  css `
@@ -89,13 +87,10 @@ let OxSelectFloor = class OxSelectFloor extends OxFormField {
89
87
  <div
90
88
  class="carousel-container"
91
89
  @wheel=${this.handleWheel}
92
- @mousedown=${this.handleMouseDown}
93
- @mousemove=${this.handleMouseMove}
94
- @mouseup=${this.handleMouseUp}
95
- @mouseleave=${this.handleMouseLeave}
96
- @touchstart=${this.handleTouchStart}
97
- @touchmove=${this.handleTouchMove}
98
- @touchend=${this.handleTouchEnd}
90
+ @pointerdown=${this.handlePointerDown}
91
+ @pointermove=${this.handlePointerMove}
92
+ @pointerup=${this.handlePointerUp}
93
+ @pointerleave=${this.handlePointerLeave}
99
94
  >
100
95
  ${cards.map(({ image, name }, index) => {
101
96
  return html `
@@ -147,33 +142,16 @@ let OxSelectFloor = class OxSelectFloor extends OxFormField {
147
142
  const delta = Math.sign(event.deltaY);
148
143
  this.updateSelectedIndex(this.selectedIndex + delta);
149
144
  }
150
- handleTouchStart(event) {
151
- this.lastTouchY = event.touches[0].clientY;
152
- this.startY = this.lastTouchY;
153
- }
154
- handleTouchMove(event) {
155
- const touch = event.touches[0];
156
- const deltaY = touch.clientY - this.lastMouseY;
157
- if (!this.lastMouseY) {
158
- this.lastMouseY = touch.clientY;
159
- }
160
- if (Math.abs(deltaY) > 30) {
161
- this.lastMouseY = touch.clientY;
162
- const direction = deltaY > 0 ? -1 : 1;
163
- this.updateSelectedIndex(this.selectedIndex + direction);
164
- }
165
- }
166
- handleTouchEnd() {
167
- this.isDragging = false;
168
- }
169
- handleMouseDown(event) {
145
+ handlePointerDown(event) {
146
+ event.preventDefault();
170
147
  this.isDragging = true;
171
148
  this.lastMouseY = event.clientY;
172
149
  }
173
- handleMouseMove(event) {
150
+ handlePointerMove(event) {
174
151
  if (!this.isDragging) {
175
152
  return;
176
153
  }
154
+ event.preventDefault();
177
155
  const deltaY = event.clientY - this.lastMouseY;
178
156
  if (!this.lastMouseY) {
179
157
  this.lastMouseY = event.clientY;
@@ -184,10 +162,12 @@ let OxSelectFloor = class OxSelectFloor extends OxFormField {
184
162
  this.updateSelectedIndex(this.selectedIndex + direction);
185
163
  }
186
164
  }
187
- handleMouseUp() {
165
+ handlePointerUp(event) {
166
+ event.preventDefault();
188
167
  this.isDragging = false;
189
168
  }
190
- handleMouseLeave() {
169
+ handlePointerLeave(event) {
170
+ event.preventDefault();
191
171
  this.isDragging = false;
192
172
  }
193
173
  toggleActiveCard(index) {
@@ -1 +1 @@
1
- {"version":3,"file":"ox-select-floor.js","sourceRoot":"","sources":["../../src/ox-select-floor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAQtC,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,WAAW;IAAvC;;QAsEsB,UAAK,GAAW,EAAE,CAAA;QAEjB,gBAAW,GAAG,EAAE,CAAA;QAE3B,kBAAa,GAAG,CAAC,CAAC,CAAA;QAClB,gBAAW,GAAkB,IAAI,CAAA;QAG1C,eAAU,GAAG,KAAK,CAAA;QAClB,eAAU,GAAG,CAAC,CAAA;QACd,eAAU,GAAG,CAAC,CAAA;QACd,WAAM,GA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,eAAe,EAAE,CAAA;QACtB,IAAI,CAAC,oBAAoB,EAAE,CAAA;IAC7B,CAAC;IAEO,eAAe;QACrB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,aAAa,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;QAEzF,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,MAAM,EAAE,IAAI,CAAC,KAAK;SACnB,CAAC,CACH,CAAA;IACH,CAAC;IAEO,gBAAgB,CAAC,CAAQ,EAAE,KAAa;QAC9C,MAAM,UAAU,GAAG,CAAC,CAAC,MAA0B,CAAA;QAC/C,MAAM,WAAW,GAAG,UAAU,CAAC,YAAY,GAAG,UAAU,CAAC,aAAa,CAAA;QACtE,MAAM,SAAS,GAAG,UAAU,CAAC,WAAW,GAAG,WAAW,CAAA;QACtD,UAAU,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,SAAS,IAAI,CAAA;IAC5C,CAAC;;AAtL0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;4CAAmB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAiB;AAE3B;IAAhB,KAAK,EAAE;oDAA2B;AAClB;IAAhB,KAAK,EAAE;kDAA0C;AACZ;IAArC,KAAK,CAAC,qBAAqB,CAAC;wDAA2C;AA5E7D,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CA6PzB","sourcesContent":["import { css, html, PropertyValues } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { OxFormField } from './ox-form-field'\n\ntype Card = {\n name: string\n image: string\n}\n\n@customElement('ox-select-floor')\nexport class OxSelectFloor extends OxFormField {\n static styles = [\n css`\n :host {\n display: block;\n position: relative;\n overflow: hidden;\n height: 100%;\n\n --ox-select-floor-rotate-x: 60deg;\n --ox-select-floor-rotate-x-active: 40deg;\n --ox-select-floor-perspective: 1200px;\n }\n\n .carousel-container {\n position: relative;\n height: 100%;\n width: 100%;\n overflow: hidden;\n user-select: none;\n }\n\n .card {\n position: absolute;\n bottom: 0;\n width: 100%;\n background-color: white;\n transition:\n transform 0.3s ease,\n opacity 0.3s ease,\n box-shadow 0.3s ease,\n border 0.3s ease;\n transform-origin: bottom;\n transform: perspective(var(--ox-select-floor-perspective)) rotateX(var(--ox-select-floor-rotate-x));\n opacity: 0.5;\n border: 2px solid transparent;\n border-radius: 12px;\n box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\n }\n\n .card img {\n width: 100%;\n height: auto;\n display: block;\n pointer-events: none;\n border-radius: 12px;\n }\n\n .selected {\n opacity: 0.8;\n z-index: 1;\n border: 4px solid #3b82f6;\n box-shadow: 0 8px 16px rgba(59, 130, 246, 0.4);\n }\n\n .selected.active {\n opacity: 1;\n z-index: 2;\n transform: perspective(var(--ox-select-floor-perspective)) rotateX(var(--ox-select-floor-rotate-x-active));\n box-shadow: 0 12px 24px rgba(59, 130, 246, 0.4);\n }\n\n [template-container] {\n position: absolute;\n right: 10px;\n z-index: 1;\n }\n `\n ]\n\n @property({ type: Array }) cards: Card[] = []\n @property({ type: String }) value?: string\n @property({ type: Number }) bottomLimit = 70\n\n @state() private selectedIndex = -1\n @state() private activeIndex: number | null = null\n @query('.carousel-container') private carouselContainer!: HTMLDivElement\n\n private isDragging = false\n private lastTouchY = 0\n private lastMouseY = 0\n private startY = 0\n\n render() {\n const length = this.cards.length\n const cards = this.cards\n\n return html`\n <div\n class=\"carousel-container\"\n @wheel=${this.handleWheel}\n @mousedown=${this.handleMouseDown}\n @mousemove=${this.handleMouseMove}\n @mouseup=${this.handleMouseUp}\n @mouseleave=${this.handleMouseLeave}\n @touchstart=${this.handleTouchStart}\n @touchmove=${this.handleTouchMove}\n @touchend=${this.handleTouchEnd}\n >\n ${cards.map(({ image, name }, index) => {\n return html`\n <div\n class=\"card ${this.getClassForCard(index)} ${this.isActive(index) ? 'active' : ''}\"\n style=\"bottom: ${(this.bottomLimit * index) / length}%;\"\n @click=${() => this.selectCard(index)}\n @tap=${() => this.toggleActiveCard(index)}\n >\n <img src=\"${image}\" @load=${(e: Event) => this.adjustCardHeight(e, index)} />\n </div>\n `\n })}\n ${cards.map(({ image, name }, index) => {\n return html`\n <div\n style=\"bottom: ${(this.bottomLimit * index) / length}%;\"\n @click=${() => this.selectCard(index)}\n template-container\n >\n <slot name=\"template-${index}\"></slot>\n </div>\n `\n })}\n </div>\n `\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('value')) {\n if (this.value) {\n this.selectedIndex = this.cards.findIndex(card => card.name == this.value)\n } else {\n this.selectedIndex = -1\n }\n }\n }\n\n firstUpdated() {\n this.scrollToSelectedCard()\n }\n\n getClassForCard(index: number) {\n return index === this.selectedIndex ? 'selected' : 'compressed'\n }\n\n isActive(index: number): boolean {\n return this.activeIndex === index\n }\n\n handleWheel(event: WheelEvent) {\n event.preventDefault()\n const delta = Math.sign(event.deltaY)\n this.updateSelectedIndex(this.selectedIndex + delta)\n }\n\n handleTouchStart(event: TouchEvent) {\n this.lastTouchY = event.touches[0].clientY\n this.startY = this.lastTouchY\n }\n\n handleTouchMove(event: TouchEvent) {\n const touch = event.touches[0]\n const deltaY = touch.clientY - this.lastMouseY\n\n if (!this.lastMouseY) {\n this.lastMouseY = touch.clientY\n }\n\n if (Math.abs(deltaY) > 30) {\n this.lastMouseY = touch.clientY\n const direction = deltaY > 0 ? -1 : 1\n this.updateSelectedIndex(this.selectedIndex + direction)\n }\n }\n\n handleTouchEnd() {\n this.isDragging = false\n }\n\n handleMouseDown(event: MouseEvent) {\n this.isDragging = true\n this.lastMouseY = event.clientY\n }\n\n handleMouseMove(event: MouseEvent) {\n if (!this.isDragging) {\n return\n }\n\n const deltaY = event.clientY - this.lastMouseY\n\n if (!this.lastMouseY) {\n this.lastMouseY = event.clientY\n }\n\n if (Math.abs(deltaY) > 30) {\n this.lastMouseY = event.clientY\n const direction = deltaY > 0 ? -1 : 1\n this.updateSelectedIndex(this.selectedIndex + direction)\n }\n }\n\n handleMouseUp() {\n this.isDragging = false\n }\n\n handleMouseLeave() {\n this.isDragging = false\n }\n\n private toggleActiveCard(index: number) {\n if (this.activeIndex === index) {\n this.activeIndex = null\n } else {\n this.activeIndex = index\n }\n }\n\n private updateSelectedIndex(newIndex: number) {\n this.activeIndex = null\n\n this.selectedIndex = Math.max(-1, Math.min(newIndex, this.cards.length - 1))\n this.scrollToSelectedCard()\n }\n\n private scrollToSelectedCard() {\n const cardHeight = 320\n const targetScrollTop = this.selectedIndex * cardHeight - (window.innerHeight / 2 - cardHeight / 2)\n\n this.carouselContainer.scrollTo({ top: targetScrollTop, behavior: 'smooth' })\n }\n\n private selectCard(index: number) {\n this.selectedIndex = index\n this.notifySelection()\n this.scrollToSelectedCard()\n }\n\n private notifySelection() {\n this.value = this.selectedIndex !== -1 ? this.cards[this.selectedIndex]?.name : undefined\n\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: this.value\n })\n )\n }\n\n private adjustCardHeight(e: Event, index: number) {\n const imgElement = e.target as HTMLImageElement\n const aspectRatio = imgElement.naturalWidth / imgElement.naturalHeight\n const newHeight = imgElement.offsetWidth / aspectRatio\n imgElement.style.height = `${newHeight}px`\n }\n}\n"]}
1
+ {"version":3,"file":"ox-select-floor.js","sourceRoot":"","sources":["../../src/ox-select-floor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAQtC,I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C,YAAY,GAAG,UAAU,CAAC,aAAa,CAAA;QACtE,MAAM,SAAS,GAAG,UAAU,CAAC,WAAW,GAAG,WAAW,CAAA;QACtD,UAAU,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,SAAS,IAAI,CAAA;IAC5C,CAAC;;AAhK0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;4CAAmB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAiB;AAE3B;IAAhB,KAAK,EAAE;oDAA2B;AAClB;IAAhB,KAAK,EAAE;kDAA0C;AACZ;IAArC,KAAK,CAAC,qBAAqB,CAAC;wDAA2C;AA5E7D,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CAuOzB","sourcesContent":["import { css, html, PropertyValues } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { OxFormField } from './ox-form-field'\n\ntype Card = {\n name: string\n image: string\n}\n\n@customElement('ox-select-floor')\nexport class OxSelectFloor extends OxFormField {\n static styles = [\n css`\n :host {\n display: block;\n position: relative;\n overflow: hidden;\n height: 100%;\n\n --ox-select-floor-rotate-x: 60deg;\n --ox-select-floor-rotate-x-active: 40deg;\n --ox-select-floor-perspective: 1200px;\n }\n\n .carousel-container {\n position: relative;\n height: 100%;\n width: 100%;\n overflow: hidden;\n user-select: none;\n }\n\n .card {\n position: absolute;\n bottom: 0;\n width: 100%;\n background-color: white;\n transition:\n transform 0.3s ease,\n opacity 0.3s ease,\n box-shadow 0.3s ease,\n border 0.3s ease;\n transform-origin: bottom;\n transform: perspective(var(--ox-select-floor-perspective)) rotateX(var(--ox-select-floor-rotate-x));\n opacity: 0.5;\n border: 2px solid transparent;\n border-radius: 12px;\n box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\n }\n\n .card img {\n width: 100%;\n height: auto;\n display: block;\n pointer-events: none;\n border-radius: 12px;\n }\n\n .selected {\n opacity: 0.8;\n z-index: 1;\n border: 4px solid #3b82f6;\n box-shadow: 0 8px 16px rgba(59, 130, 246, 0.4);\n }\n\n .selected.active {\n opacity: 1;\n z-index: 2;\n transform: perspective(var(--ox-select-floor-perspective)) rotateX(var(--ox-select-floor-rotate-x-active));\n box-shadow: 0 12px 24px rgba(59, 130, 246, 0.4);\n }\n\n [template-container] {\n position: absolute;\n right: 10px;\n z-index: 1;\n }\n `\n ]\n\n @property({ type: Array }) cards: Card[] = []\n @property({ type: String }) value?: string\n @property({ type: Number }) bottomLimit = 70\n\n @state() private selectedIndex = -1\n @state() private activeIndex: number | null = null\n @query('.carousel-container') private carouselContainer!: HTMLDivElement\n\n private isDragging = false\n private lastMouseY = 0\n\n render() {\n const length = this.cards.length\n const cards = this.cards\n\n return html`\n <div\n class=\"carousel-container\"\n @wheel=${this.handleWheel}\n @pointerdown=${this.handlePointerDown}\n @pointermove=${this.handlePointerMove}\n @pointerup=${this.handlePointerUp}\n @pointerleave=${this.handlePointerLeave}\n >\n ${cards.map(({ image, name }, index) => {\n return html`\n <div\n class=\"card ${this.getClassForCard(index)} ${this.isActive(index) ? 'active' : ''}\"\n style=\"bottom: ${(this.bottomLimit * index) / length}%;\"\n @click=${() => this.selectCard(index)}\n @tap=${() => this.toggleActiveCard(index)}\n >\n <img src=\"${image}\" @load=${(e: Event) => this.adjustCardHeight(e, index)} />\n </div>\n `\n })}\n ${cards.map(({ image, name }, index) => {\n return html`\n <div\n style=\"bottom: ${(this.bottomLimit * index) / length}%;\"\n @click=${() => this.selectCard(index)}\n template-container\n >\n <slot name=\"template-${index}\"></slot>\n </div>\n `\n })}\n </div>\n `\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('value')) {\n if (this.value) {\n this.selectedIndex = this.cards.findIndex(card => card.name == this.value)\n } else {\n this.selectedIndex = -1\n }\n }\n }\n\n firstUpdated() {\n this.scrollToSelectedCard()\n }\n\n getClassForCard(index: number) {\n return index === this.selectedIndex ? 'selected' : 'compressed'\n }\n\n isActive(index: number): boolean {\n return this.activeIndex === index\n }\n\n handleWheel(event: WheelEvent) {\n event.preventDefault()\n const delta = Math.sign(event.deltaY)\n this.updateSelectedIndex(this.selectedIndex + delta)\n }\n\n handlePointerDown(event: PointerEvent) {\n event.preventDefault()\n\n this.isDragging = true\n this.lastMouseY = event.clientY\n }\n\n handlePointerMove(event: PointerEvent) {\n if (!this.isDragging) {\n return\n }\n\n event.preventDefault()\n\n const deltaY = event.clientY - this.lastMouseY\n\n if (!this.lastMouseY) {\n this.lastMouseY = event.clientY\n }\n\n if (Math.abs(deltaY) > 30) {\n this.lastMouseY = event.clientY\n const direction = deltaY > 0 ? -1 : 1\n this.updateSelectedIndex(this.selectedIndex + direction)\n }\n }\n\n handlePointerUp(event: PointerEvent) {\n event.preventDefault()\n this.isDragging = false\n }\n\n handlePointerLeave(event: PointerEvent) {\n event.preventDefault()\n\n this.isDragging = false\n }\n\n private toggleActiveCard(index: number) {\n if (this.activeIndex === index) {\n this.activeIndex = null\n } else {\n this.activeIndex = index\n }\n }\n\n private updateSelectedIndex(newIndex: number) {\n this.activeIndex = null\n\n this.selectedIndex = Math.max(-1, Math.min(newIndex, this.cards.length - 1))\n this.scrollToSelectedCard()\n }\n\n private scrollToSelectedCard() {\n const cardHeight = 320\n const targetScrollTop = this.selectedIndex * cardHeight - (window.innerHeight / 2 - cardHeight / 2)\n\n this.carouselContainer.scrollTo({ top: targetScrollTop, behavior: 'smooth' })\n }\n\n private selectCard(index: number) {\n this.selectedIndex = index\n this.notifySelection()\n this.scrollToSelectedCard()\n }\n\n private notifySelection() {\n this.value = this.selectedIndex !== -1 ? this.cards[this.selectedIndex]?.name : undefined\n\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: this.value\n })\n )\n }\n\n private adjustCardHeight(e: Event, index: number) {\n const imgElement = e.target as HTMLImageElement\n const aspectRatio = imgElement.naturalWidth / imgElement.naturalHeight\n const newHeight = imgElement.offsetWidth / aspectRatio\n imgElement.style.height = `${newHeight}px`\n }\n}\n"]}