@operato/mini-map 8.0.0-beta.0 → 8.0.0-beta.2

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-beta.2](https://github.com/hatiolab/operato/compare/v8.0.0-beta.1...v8.0.0-beta.2) (2025-01-08)
7
+
8
+
9
+ ### :bug: Bug Fix
10
+
11
+ * typo .npmignore ([d9c0c8c](https://github.com/hatiolab/operato/commit/d9c0c8c79abc688c3c2cfb6c37fcb689483a5977))
12
+
13
+
14
+
15
+ ## [8.0.0-beta.1](https://github.com/hatiolab/operato/compare/v8.0.0-beta.0...v8.0.0-beta.1) (2025-01-08)
16
+
17
+
18
+ ### :bug: Bug Fix
19
+
20
+ * missing .npmignore ([be05985](https://github.com/hatiolab/operato/commit/be05985abfae4af53501f718dd52932099f7fbcb))
21
+
22
+
23
+
6
24
  ## [8.0.0-beta.0](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.56...v8.0.0-beta.0) (2025-01-07)
7
25
 
8
26
  **Note:** Version bump only for package @operato/mini-map
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@operato/mini-map",
3
3
  "description": "Webcomponent mini-map following open-wc recommendations",
4
4
  "author": "heartyoh",
5
- "version": "8.0.0-beta.0",
5
+ "version": "8.0.0-beta.2",
6
6
  "main": "dist/src/index.js",
7
7
  "module": "dist/src/index.js",
8
8
  "license": "MIT",
@@ -80,5 +80,5 @@
80
80
  "prettier --write"
81
81
  ]
82
82
  },
83
- "gitHead": "c4e9cc245659d050a9ffd66542083a6daad4bcb9"
83
+ "gitHead": "ee1b5124995accb99272d3b5854f3df1d8746dda"
84
84
  }
package/.editorconfig DELETED
@@ -1,29 +0,0 @@
1
- # EditorConfig helps developers define and maintain consistent
2
- # coding styles between different editors and IDEs
3
- # editorconfig.org
4
-
5
- root = true
6
-
7
-
8
- [*]
9
-
10
- # Change these settings to your own preference
11
- indent_style = space
12
- indent_size = 2
13
-
14
- # We recommend you to keep these unchanged
15
- end_of_line = lf
16
- charset = utf-8
17
- trim_trailing_whitespace = true
18
- insert_final_newline = true
19
-
20
- [*.md]
21
- trim_trailing_whitespace = false
22
-
23
- [*.json]
24
- indent_size = 2
25
-
26
- [*.{html,js,md}]
27
- block_comment_start = /**
28
- block_comment = *
29
- block_comment_end = */
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- stories: ['../dist/stories/**/*.stories.{js,md,mdx}'],
3
- };
@@ -1,8 +0,0 @@
1
- import { storybookPlugin } from '@web/dev-server-storybook';
2
- import baseConfig from '../web-dev-server.config.mjs';
3
-
4
- export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
5
- ...baseConfig,
6
- open: '/',
7
- plugins: [storybookPlugin({ type: 'web-components' }), ...baseConfig.plugins],
8
- });
package/demo/index.html DELETED
@@ -1,35 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en-GB">
3
- <head>
4
- <meta charset="utf-8" />
5
- <style>
6
- body {
7
- display: flex;
8
- width: 100vw;
9
- height: 100dvh;
10
- margin: 0;
11
- padding: 0;
12
- }
13
-
14
- #demo {
15
- flex: 1;
16
- background-color: red;
17
- }
18
- </style>
19
- </head>
20
- <body>
21
- <div id="demo"></div>
22
-
23
- <script type="module">
24
- import { minimap } from '../dist/src/mini-map.js'
25
-
26
- pulltorefresh({
27
- container: document.body,
28
- scrollable: document.querySelector('#demo'),
29
- refresh: () => {
30
- console.log('refreshed...')
31
- }
32
- })
33
- </script>
34
- </body>
35
- </html>
@@ -1,214 +0,0 @@
1
- import { html, css, LitElement, PropertyValueMap } from 'lit'
2
- import { customElement, property } from 'lit/decorators.js'
3
-
4
- @customElement('ox-mini-map')
5
- class OxMiniMapComponent extends LitElement {
6
- static styles = css`
7
- :host {
8
- display: flex;
9
- position: relative;
10
- background-color: gray;
11
- width: 200px; /* 기본 너비 */
12
- height: 150px; /* 기본 높이 */
13
- }
14
-
15
- #minimap {
16
- position: absolute;
17
- top: 50%;
18
- left: 50%;
19
- transform: translate(-50%, -50%);
20
- box-sizing: border-box;
21
- width: 100%;
22
- height: 100%;
23
- background-color: var(--md-sys-color-surface);
24
- overflow: hidden;
25
- }
26
-
27
- #viewport {
28
- position: absolute;
29
- border: 1px dashed blue;
30
- box-sizing: border-box;
31
- cursor: move;
32
- background-color: rgba(255, 255, 255, 0.5);
33
- }
34
- `
35
-
36
- @property({ type: Object }) target: HTMLElement | null = null
37
- private isDragging = false
38
- private startX = 0
39
- private startY = 0
40
- private initialScrollLeft = 0
41
- private initialScrollTop = 0
42
- private observer: MutationObserver | null = null
43
-
44
- connectedCallback() {
45
- super.connectedCallback()
46
- window.addEventListener('resize', this.handleResize.bind(this))
47
- this.addEventListener('pointermove', this.handlePointerMove.bind(this))
48
- this.addEventListener('pointerup', this.handlePointerUp.bind(this))
49
- if (this.target) {
50
- this.observeTarget(this.target)
51
- }
52
- }
53
-
54
- disconnectedCallback() {
55
- super.disconnectedCallback()
56
- window.removeEventListener('resize', this.handleResize.bind(this))
57
- window.removeEventListener('pointermove', this.handlePointerMove.bind(this))
58
- window.removeEventListener('pointerup', this.handlePointerUp.bind(this))
59
- if (this.observer) {
60
- this.observer.disconnect()
61
- this.observer = null
62
- }
63
- }
64
-
65
- firstUpdated(changes: PropertyValueMap<any> | Map<PropertyKey, unknown>) {
66
- super.firstUpdated(changes)
67
- this.updateTarget()
68
- }
69
-
70
- updated(changedProperties: Map<string, any>) {
71
- if (changedProperties.has('target')) {
72
- this.updateTarget()
73
- if (this.target) {
74
- this.observeTarget(this.target)
75
- }
76
- }
77
- }
78
-
79
- handleResize() {
80
- this.updateTarget()
81
- }
82
-
83
- observeTarget(target: HTMLElement) {
84
- if (this.observer) {
85
- this.observer.disconnect()
86
- }
87
- this.observer = new MutationObserver(() => {
88
- this.updateTarget()
89
- })
90
- this.observer.observe(target, { attributes: true, attributeFilter: ['style'] })
91
- }
92
-
93
- updateTarget() {
94
- const target = this.target || this.parentElement
95
- if (!target) {
96
- return
97
- }
98
-
99
- const targetStyle = window.getComputedStyle(target)
100
- const transform = targetStyle.transform
101
- const scaleMatch = /scale\(([^,]+),?([^)]+)?\)/.exec(transform)
102
- const leftMatch = /translate\(([^,]+)px, ?([^)]+)?px\)/.exec(transform)
103
-
104
- let scale = 1
105
- let left = 0
106
- let top = 0
107
-
108
- if (scaleMatch) {
109
- scale = parseFloat(scaleMatch[1])
110
- }
111
-
112
- if (leftMatch) {
113
- left = parseFloat(leftMatch[1])
114
- top = parseFloat(leftMatch[2] || '0')
115
- }
116
-
117
- const targetRatio = target.scrollHeight / target.scrollWidth
118
- const thisRatio = this.offsetHeight / this.offsetWidth
119
-
120
- const scaleMinimap =
121
- targetRatio > thisRatio ? this.offsetHeight / target.scrollHeight : this.offsetWidth / target.scrollWidth
122
-
123
- const minimapHeight = target.scrollHeight * scaleMinimap
124
- const minimapWidth = target.scrollWidth * scaleMinimap
125
-
126
- const viewportHeight = target.clientHeight * scaleMinimap
127
- const viewportWidth = target.clientWidth * scaleMinimap
128
-
129
- const minimap = this.shadowRoot?.getElementById('minimap') as HTMLElement
130
- const viewport = this.shadowRoot?.getElementById('viewport') as HTMLElement
131
-
132
- minimap.style.width = `${minimapWidth}px`
133
- minimap.style.height = `${minimapHeight}px`
134
-
135
- viewport.style.width = `${viewportWidth}px`
136
- viewport.style.height = `${viewportHeight}px`
137
-
138
- this.updateViewportPosition(scale, left, top)
139
- }
140
-
141
- updateViewportPosition(scale: number, left: number, top: number) {
142
- const target = this.target || this.parentElement
143
- if (!target) {
144
- return
145
- }
146
-
147
- const targetRatio = target.scrollHeight / target.scrollWidth
148
- const thisRatio = this.offsetHeight / this.offsetWidth
149
-
150
- const scaleMinimap =
151
- targetRatio > thisRatio ? this.offsetHeight / target.scrollHeight : this.offsetWidth / target.scrollWidth
152
-
153
- const viewport = this.shadowRoot?.getElementById('viewport') as HTMLElement
154
- viewport.style.transform = `scale(${scale}) translate(${left * scaleMinimap}px, ${top * scaleMinimap}px)`
155
- }
156
-
157
- handlePointerDown(event: MouseEvent) {
158
- this.isDragging = true
159
- this.startX = event.clientX
160
- this.startY = event.clientY
161
-
162
- const target = this.target || this.parentElement
163
- if (target) {
164
- this.initialScrollLeft = target.scrollLeft
165
- this.initialScrollTop = target.scrollTop
166
- }
167
-
168
- window.addEventListener('pointermove', this.handlePointerMove.bind(this))
169
- window.addEventListener('pointerup', this.handlePointerUp.bind(this))
170
-
171
- event.preventDefault()
172
- }
173
-
174
- handlePointerMove(event: MouseEvent) {
175
- if (!this.isDragging) return
176
-
177
- const deltaX = event.clientX - this.startX
178
- const deltaY = event.clientY - this.startY
179
-
180
- const target = this.target || this.parentElement
181
- if (!target) return
182
-
183
- const targetRatio = target.scrollHeight / target.scrollWidth
184
- const thisRatio = this.offsetHeight / this.offsetWidth
185
-
186
- const scale =
187
- targetRatio > thisRatio ? this.offsetHeight / target.scrollHeight : this.offsetWidth / target.scrollWidth
188
-
189
- const scrollX = deltaX / scale
190
- const scrollY = deltaY / scale
191
-
192
- target.scrollLeft = this.initialScrollLeft + scrollX
193
- target.scrollTop = this.initialScrollTop + scrollY
194
-
195
- this.updateViewportPosition(1, target.scrollLeft, target.scrollTop) // Assuming no additional transform during drag
196
-
197
- event.preventDefault()
198
- }
199
-
200
- handlePointerUp(event: MouseEvent) {
201
- this.isDragging = false
202
- window.removeEventListener('pointermove', this.handlePointerMove.bind(this))
203
- window.removeEventListener('pointerup', this.handlePointerUp.bind(this))
204
- event.preventDefault()
205
- }
206
-
207
- render() {
208
- return html`
209
- <div id="minimap">
210
- <div id="viewport" @pointerdown=${this.handlePointerDown}></div>
211
- </div>
212
- `
213
- }
214
- }
@@ -1,217 +0,0 @@
1
- import { css, LitElement, PropertyValues } from 'lit'
2
- import { customElement, property, state } from 'lit/decorators.js'
3
-
4
- import { gesture, GestureEventDoubleTap, GestureEventDrag, GestureEventPinch } from '@operato/utils/gesture-mixin.js'
5
-
6
- /**
7
- * Example usage:
8
- *
9
- * <html>
10
- * <head>
11
- * <script type="module" src="path/to/ox-zoomable-image.js"></script>
12
- * <style>
13
- * body {
14
- * margin: 0;
15
- * overflow: hidden;
16
- * display: flex;
17
- * justify-content: center;
18
- * align-items: center;
19
- * height: 100vh;
20
- * }
21
- * ox-zoomable-image {
22
- * width: 80%;
23
- * height: 80%;
24
- * }
25
- * </style>
26
- * </head>
27
- * <body>
28
- * <ox-zoomable-image src="path/to/your/image.jpg" restrict-boundary></ox-zoomable-image>
29
- * </body>
30
- * </html>
31
- */
32
-
33
- @customElement('ox-zoomable-image')
34
- export class OxZoomableImage extends gesture(LitElement) {
35
- // Define CSS styles for the component
36
- static styles = css`
37
- :host {
38
- display: block;
39
- position: relative;
40
- width: 100%;
41
- height: 100%;
42
- overflow: hidden;
43
-
44
- touch-action: none;
45
- }
46
-
47
- :host::before {
48
- content: '';
49
- display: block;
50
-
51
- position: absolute;
52
- top: 0;
53
- right: 0;
54
- width: 100%;
55
- height: 100%;
56
-
57
- background-image: var(
58
- --background-image,
59
- linear-gradient(var(--primary-color, lightgray), var(--primary-color, lightgray))
60
- );
61
- transform: var(--image-transform, '');
62
- background-repeat: no-repeat;
63
- background-position: center;
64
- background-size: contain;
65
-
66
- touch-action: none;
67
- }
68
- `
69
-
70
- @property({ type: String }) src?: string // Source URL for the image
71
- @property({ type: Boolean, attribute: 'restrict-boundary' }) restrictBoundary: boolean = false // Ensure the image stays within bounds
72
-
73
- @state() private zoom = 1 // Current zoom level
74
- @state() private left = 0 // Horizontal position
75
- @state() private top = 0 // Vertical position
76
- @state() private imageWidth = 0
77
- @state() private imageHeight = 0
78
-
79
- connectedCallback(): void {
80
- super.connectedCallback()
81
-
82
- // Register event listeners for zooming and dragging
83
- this.addEventListener('pinch', this.pinchHandler as EventListener)
84
- this.addEventListener('drag', this.dragHandler as EventListener)
85
- this.addEventListener('doubletap', this.doubleTapHandler as EventListener)
86
- this.addEventListener('wheel', this.wheelHandler as EventListener)
87
-
88
- this.calculateMinZoom() // Calculate the minimum zoom level based on the image and container size
89
- }
90
-
91
- disconnectedCallback(): void {
92
- // Remove event listeners when the component is disconnected
93
- this.removeEventListener('pinch', this.pinchHandler as EventListener)
94
- this.removeEventListener('drag', this.dragHandler as EventListener)
95
- this.removeEventListener('doubletap', this.doubleTapHandler as EventListener)
96
- this.removeEventListener('wheel', this.wheelHandler as EventListener)
97
-
98
- super.disconnectedCallback()
99
- }
100
-
101
- updated(changes: PropertyValues<this>): void {
102
- // Update the background image and transform style when properties change
103
- if (changes.has('src') && this.src) {
104
- this.style.setProperty('--background-image', `url('${this.src}')`)
105
- this.calculateMinZoom() // Recalculate the minimum zoom level when the source changes
106
- }
107
-
108
- this.updateTransform() // Apply the current zoom and position
109
- }
110
-
111
- private calculateMinZoom() {
112
- // Calculate the minimum zoom level to ensure the image always fills the container
113
- const img = new Image()
114
- img.src = this.src || ''
115
- img.onload = () => {
116
- this.imageWidth = img.width
117
- this.imageHeight = img.height
118
-
119
- console.log(this.imageWidth, this.imageHeight)
120
-
121
- this.zoom = 1 // this.minZoom
122
- this.left = 0 // Center the image
123
- this.top = 0 // Center the image
124
-
125
- this.updateTransform()
126
- }
127
- }
128
-
129
- private pinchHandler = (e: GestureEventPinch) => {
130
- const { scale, centerX, centerY } = e.detail
131
- this.zoomAt(centerX, centerY, scale)
132
- }
133
-
134
- private zoomAt(clientX: number, clientY: number, scale: number) {
135
- const { offsetLeft: left, offsetTop: top, offsetWidth: width, offsetHeight: height } = this
136
-
137
- const centerX = left + width / 2
138
- const centerY = top + height / 2
139
-
140
- // this.imageWidth
141
- // this.imageHeight
142
- const dx = ((centerX - clientX) / width) * 100 * (1 - scale)
143
- const dy = ((centerY - clientY) / height) * 100 * (1 - scale)
144
-
145
- this.left += dx
146
- this.top += dy
147
-
148
- this.zoom *= scale
149
- }
150
-
151
- private wheelHandler = (e: WheelEvent): void => {
152
- // Handle zoom in and out based on mouse wheel events
153
- e.preventDefault()
154
-
155
- const delta = Math.sign(e.deltaY)
156
- this.zoomAt(e.clientX, e.clientY, 1 - delta / 20)
157
- }
158
-
159
- private dragHandler = (e: GestureEventDrag): void => {
160
- const { deltaX, deltaY } = e.detail
161
-
162
- this.top += deltaY
163
- this.left += deltaX
164
-
165
- this.updateTransform()
166
- }
167
-
168
- private doubleTapHandler = (e: GestureEventDoubleTap): void => {
169
- // Reset zoom and position to initial state
170
- this.zoom = 1
171
- this.left = 0
172
- this.top = 0
173
- }
174
-
175
- private updateTransform() {
176
- if (this.restrictBoundary) {
177
- this.applyBounds() // Ensure the image stays within bounds
178
- }
179
-
180
- // Apply the current zoom and position to the image
181
- this.style.setProperty('--image-transform', `translate(${this.left}px, ${this.top}px) scale(${this.zoom})`)
182
- }
183
-
184
- private applyBounds() {
185
- // Ensure the image stays within the bounds of the container
186
- const hostWidth = this.offsetWidth
187
- const hostHeight = this.offsetHeight
188
-
189
- const aspectRatio = this.imageHeight / this.imageWidth
190
- const hostAspectRatio = hostHeight / hostWidth
191
-
192
- if (aspectRatio < hostAspectRatio) {
193
- /* image ratio is wider than host */
194
- var minX = (hostWidth * (1 - this.zoom)) / 2
195
- minX = minX > 0 ? -minX : minX
196
- var maxX = -minX
197
-
198
- var minY = (hostHeight - hostWidth * aspectRatio * this.zoom) / 2
199
- minY = Math.min(minY, -minY)
200
- var maxY = -minY
201
-
202
- this.left = Math.max(minX, Math.min(this.left, maxX))
203
- this.top = Math.max(minY, Math.min(this.top, maxY))
204
- } else {
205
- var minX = (hostWidth - (hostHeight / aspectRatio) * this.zoom) / 2
206
- minX = Math.min(minX, -minX)
207
- var maxX = -minX
208
-
209
- var minY = (-hostHeight * (1 - this.zoom)) / 2
210
- minY = minY > 0 ? -minY : minY
211
- var maxY = -minY
212
-
213
- this.left = Math.max(minX, Math.min(this.left, maxX))
214
- this.top = Math.max(minY, Math.min(this.top, maxY))
215
- }
216
- }
217
- }
@@ -1,54 +0,0 @@
1
- import { html, TemplateResult } from 'lit'
2
- import '../src/ox-mini-map.js'
3
-
4
- export default {
5
- title: 'MiniMap',
6
- component: 'ox-mini-map',
7
- argTypes: {}
8
- }
9
-
10
- interface Story<T> {
11
- (args: T): TemplateResult
12
- args?: Partial<T>
13
- argTypes?: Record<string, unknown>
14
- }
15
-
16
- interface ArgTypes {}
17
-
18
- const Template: Story<ArgTypes> = ({}: ArgTypes) => html`
19
- <style>
20
- #parent {
21
- padding: 0;
22
- margin: 0;
23
- width: 600px;
24
- height: 400px;
25
- background-color: red;
26
- position: relative; /* Make the parent element the reference for the mini map */
27
- overflow: auto;
28
- }
29
-
30
- #content {
31
- flex: 1;
32
- width: 1200px;
33
- height: 1000px;
34
- background-image: url('https://via.placeholder.com/800x600.png'); /* Fix the background image URL */
35
- background-size: cover;
36
- }
37
-
38
- ox-mini-map {
39
- position: fixed; /* Fix to the bottom right of the parent element */
40
- width: 160px;
41
- height: 120px;
42
- bottom: 10px;
43
- right: 10px;
44
- }
45
- </style>
46
-
47
- <div id="parent">
48
- <div id="content"></div>
49
- <ox-mini-map .target=${document.getElementById('parent')}></ox-mini-map>
50
- </div>
51
- `
52
-
53
- export const Regular = Template.bind({})
54
- Regular.args = {}
@@ -1,63 +0,0 @@
1
- import { html, TemplateResult } from 'lit-html'
2
- import '../src/ox-zoomable-image' // 경로를 실제 경로로 변경하세요.
3
-
4
- export default {
5
- title: 'OxZoomableImage',
6
- component: 'ox-zoomable-image',
7
- argTypes: {
8
- src: { control: 'text' },
9
- width: { control: 'number' },
10
- height: { control: 'number' },
11
- restrictBoundary: { control: 'boolean' }
12
- }
13
- }
14
-
15
- interface Story<T> {
16
- (args: T): TemplateResult
17
- args?: Partial<T>
18
- argTypes?: Record<string, unknown>
19
- }
20
-
21
- interface OxZoomableImageProps {
22
- src: string
23
- width: number
24
- height: number
25
- restrictBoundary: boolean
26
- }
27
-
28
- const Template: Story<OxZoomableImageProps> = ({ src, width, height, restrictBoundary }: OxZoomableImageProps) => html`
29
- <style>
30
- ox-zoomable-image {
31
- width: ${width}px;
32
- height: ${height}px;
33
- background-color: red;
34
- padding: 0;
35
- margin: 100px;
36
- }
37
- </style>
38
- <ox-zoomable-image src=${src} ?restrict-boundary=${restrictBoundary}></ox-zoomable-image>
39
- `
40
-
41
- export const Default = Template.bind({})
42
- Default.args = {
43
- src: 'https://via.placeholder.com/800x600.png', // 기본 이미지 URL을 실제 경로로 변경하세요.
44
- width: 400,
45
- height: 600,
46
- restrictBoundary: true
47
- }
48
-
49
- export const Wide = Template.bind({})
50
- Wide.args = {
51
- src: 'https://via.placeholder.com/800x600.png', // 기본 이미지 URL을 실제 경로로 변경하세요.
52
- width: 600,
53
- height: 300,
54
- restrictBoundary: true
55
- }
56
-
57
- export const CustomImage = Template.bind({})
58
- CustomImage.args = {
59
- src: 'https://via.placeholder.com/1200x800.png', // 다른 테스트 이미지 URL을 실제 경로로 변경하세요.
60
- width: 400,
61
- height: 600,
62
- restrictBoundary: true
63
- }
package/tsconfig.json DELETED
@@ -1,24 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es2018",
4
- "module": "esnext",
5
- "moduleResolution": "node",
6
- "noEmitOnError": true,
7
- "lib": ["es2017", "dom"],
8
- "strict": true,
9
- "esModuleInterop": true,
10
- "allowSyntheticDefaultImports": true,
11
- "experimentalDecorators": true,
12
- "useDefineForClassFields": false,
13
- "importHelpers": true,
14
- "outDir": "dist",
15
- "sourceMap": true,
16
- "inlineSources": true,
17
- "rootDir": "./",
18
- "declaration": true,
19
- "incremental": true,
20
- "skipLibCheck": true,
21
- "types": ["node", "mocha"]
22
- },
23
- "include": ["**/*.ts", "*.d.ts"]
24
- }
@@ -1,27 +0,0 @@
1
- // import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
2
-
3
- /** Use Hot Module replacement by adding --hmr to the start command */
4
- const hmr = process.argv.includes('--hmr');
5
-
6
- export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
7
- open: '/demo/',
8
- /** Use regular watch mode if HMR is not enabled. */
9
- watch: !hmr,
10
- /** Resolve bare module imports */
11
- nodeResolve: {
12
- exportConditions: ['browser', 'development'],
13
- },
14
-
15
- /** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
16
- // esbuildTarget: 'auto'
17
-
18
- /** Set appIndex to enable SPA routing */
19
- // appIndex: 'demo/index.html',
20
-
21
- plugins: [
22
- /** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
23
- // hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
24
- ],
25
-
26
- // See documentation for all available options
27
- });
@@ -1,41 +0,0 @@
1
- // import { playwrightLauncher } from '@web/test-runner-playwright';
2
-
3
- const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
4
-
5
- export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
6
- /** Test files to run */
7
- files: 'dist/test/**/*.test.js',
8
-
9
- /** Resolve bare module imports */
10
- nodeResolve: {
11
- exportConditions: ['browser', 'development'],
12
- },
13
-
14
- /** Filter out lit dev mode logs */
15
- filterBrowserLogs(log) {
16
- for (const arg of log.args) {
17
- if (typeof arg === 'string' && filteredLogs.some(l => arg.includes(l))) {
18
- return false;
19
- }
20
- }
21
- return true;
22
- },
23
-
24
- /** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
25
- // esbuildTarget: 'auto',
26
-
27
- /** Amount of browsers to run concurrently */
28
- // concurrentBrowsers: 2,
29
-
30
- /** Amount of test files per browser to test concurrently */
31
- // concurrency: 1,
32
-
33
- /** Browsers to run tests on */
34
- // browsers: [
35
- // playwrightLauncher({ product: 'chromium' }),
36
- // playwrightLauncher({ product: 'firefox' }),
37
- // playwrightLauncher({ product: 'webkit' }),
38
- // ],
39
-
40
- // See documentation for all available options
41
- });