@operato/ocr 8.0.0-beta.0 β†’ 8.0.0-beta.1

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,15 @@
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.1](https://github.com/hatiolab/operato/compare/v8.0.0-beta.0...v8.0.0-beta.1) (2025-01-08)
7
+
8
+
9
+ ### :bug: Bug Fix
10
+
11
+ * missing .npmignore ([be05985](https://github.com/hatiolab/operato/commit/be05985abfae4af53501f718dd52932099f7fbcb))
12
+
13
+
14
+
6
15
  ## [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
16
 
8
17
  **Note:** Version bump only for package @operato/ocr
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@operato/ocr",
3
3
  "description": "Webcomponent ocr following open-wc recommendations",
4
4
  "author": "heartyoh@hatiolab.com",
5
- "version": "8.0.0-beta.0",
5
+ "version": "8.0.0-beta.1",
6
6
  "main": "dist/src/index.js",
7
7
  "module": "dist/src/index.js",
8
8
  "license": "MIT",
@@ -42,8 +42,8 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@material/web": "^2.0.0",
45
- "@operato/input": "^8.0.0-beta.0",
46
- "@operato/popup": "^8.0.0-beta.0",
45
+ "@operato/input": "^8.0.0-beta.1",
46
+ "@operato/popup": "^8.0.0-beta.1",
47
47
  "lit": "^3.1.2"
48
48
  },
49
49
  "devDependencies": {
@@ -78,5 +78,5 @@
78
78
  "prettier --write"
79
79
  ]
80
80
  },
81
- "gitHead": "c4e9cc245659d050a9ffd66542083a6daad4bcb9"
81
+ "gitHead": "d5b28a2e9deb632c0dc80132f6a7196dd6fe4220"
82
82
  }
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,52 +0,0 @@
1
- import { i18next } from '@operato/i18n'
2
-
3
- export const globalTypes = {
4
- locale: {
5
- name: 'Locale',
6
- description: 'Internationalization locale',
7
- toolbar: {
8
- icon: 'globe',
9
- items: [
10
- { value: 'en', right: 'πŸ‡ΊπŸ‡Έ', title: 'English' },
11
- { value: 'ko', right: 'πŸ‡°πŸ‡·', title: 'ν•œκ΅­μ–΄' },
12
- { value: 'zh', right: 'πŸ‡¨πŸ‡³', title: 'δΈ­ζ–‡' },
13
- { value: 'ja', right: 'πŸ‡―πŸ‡΅', title: 'ζ—₯本θͺž' },
14
- { value: 'ms', right: 'πŸ‡²πŸ‡Ύ', title: 'Bahasa Melayu' }
15
- ],
16
- showName: true
17
- }
18
- },
19
- theme: {
20
- name: 'Theme',
21
- description: 'Global theme for components',
22
- toolbar: {
23
- icon: 'paintbrush',
24
- items: [
25
- { value: 'light', title: 'Light' },
26
- { value: 'dark', title: 'Dark' }
27
- ],
28
- showName: true
29
- }
30
- }
31
- }
32
-
33
- export const decorators = [
34
- (Story, context) => {
35
- const { locale, theme } = context.globals
36
-
37
- if (locale) {
38
- i18next.changeLanguage(locale)
39
- }
40
-
41
- // Set the theme class for the document
42
- if (theme === 'dark') {
43
- document.documentElement.classList.add('dark')
44
- document.documentElement.classList.remove('light')
45
- } else {
46
- document.documentElement.classList.add('light')
47
- document.documentElement.classList.remove('dark')
48
- }
49
-
50
- return Story()
51
- }
52
- ]
@@ -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/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './ox-ocr-helper.js'
@@ -1,134 +0,0 @@
1
- import '@material/web/progress/linear-progress.js'
2
- import '@operato/input'
3
- import './ox-ocr-result-image'
4
-
5
- import { css, html, LitElement } from 'lit'
6
- import { customElement, property, query, state } from 'lit/decorators.js'
7
-
8
- import { copyToClipboard } from '@operato/utils'
9
-
10
- import { NOTHING_RESULT, ScanResult } from './type'
11
-
12
- @customElement('ox-ocr-helper')
13
- export class OcrHelper extends LitElement {
14
- static styles = [
15
- css`
16
- :host {
17
- display: flex;
18
- flex-direction: column;
19
- min-width: 240px;
20
- }
21
-
22
- [buttons] {
23
- display: flex;
24
- flex-direction: row-reverse;
25
- }
26
-
27
- #images {
28
- flex: 1;
29
- background-color: var(--md-sys-color-background, #f4f7fb);
30
- color: white;
31
-
32
- display: flex;
33
- flex-direction: column;
34
- }
35
-
36
- [tab] {
37
- display: flex;
38
- flex-direction: row;
39
- }
40
-
41
- [i] {
42
- min-width: 50px;
43
- background-color: var(--md-sys-color-on-secondary-container, #394e64);
44
- border-right: 1px solid rgba(0, 0, 0, 0.2);
45
- padding: var(--spacing-small, 4px);
46
- text-align: center;
47
- height: 1.4em;
48
- }
49
-
50
- [i][active] {
51
- background-color: var(--md-sys-color-on-primary-container, #22a6a7);
52
- font-weight: bold;
53
- }
54
-
55
- ox-ocr-result-image {
56
- flex: 1;
57
- }
58
- `
59
- ]
60
-
61
- @property({ type: Array }) result: ScanResult[] = []
62
- @property({ type: Array }) files: Array<any> = []
63
-
64
- @state() _index: number = 0
65
-
66
- @query('#capturer') fileUploader!: any
67
- @query('#copied') copied!: HTMLElement
68
-
69
- render() {
70
- const files = this.files || []
71
- const index = this._index || 0
72
- const file = files[index]
73
- const result = this.result?.[index] || NOTHING_RESULT
74
-
75
- return html`
76
- <div attachment-wrap>
77
- <ox-input-file
78
- id="capturer"
79
- label="Capture Images"
80
- accept="image/*"
81
- multiple="true"
82
- ?hidden=${false}
83
- @change=${(e: Event) => this.onFilesChange(e)}
84
- hide-filelist
85
- ></ox-input-file>
86
- </div>
87
- ${this.files.length > 0 && !(this.result.length > 0)
88
- ? html`<md-linear-progress indeterminate></md-linear-progress> `
89
- : html``}
90
-
91
- <div id="images">
92
- <div
93
- tab
94
- @click=${(e: MouseEvent) => {
95
- const item = (e.target as HTMLElement)?.closest('[i]')
96
- const children = (e.currentTarget as HTMLElement)?.querySelectorAll('[i]')
97
- if (item) {
98
- this._index = Array.from(children).indexOf(item)
99
- }
100
- }}
101
- >
102
- ${files.map((file: any, idx: number) => html`<div i ?active=${idx === index}>${idx}</div>`)}
103
- </div>
104
- <ox-ocr-result-image
105
- .file=${file}
106
- @selected=${(e: CustomEvent) => this.onSelected(e)}
107
- .result=${result}
108
- ></ox-ocr-result-image>
109
- </div>
110
-
111
- <div id="copied"></div>
112
- `
113
- }
114
-
115
- reset() {
116
- this.fileUploader.reset()
117
- this.copied.textContent = ''
118
- }
119
-
120
- onFilesChange(e: Event) {
121
- this.files = this.fileUploader.files
122
- this.result = []
123
-
124
- this.dispatchEvent(
125
- new CustomEvent('attached', {
126
- detail: this.fileUploader?.files
127
- })
128
- )
129
- }
130
-
131
- async onSelected(e: CustomEvent) {
132
- await copyToClipboard(e.detail)
133
- }
134
- }
@@ -1,342 +0,0 @@
1
- import { css, html, LitElement, PropertyValues } from 'lit'
2
- import { customElement, property, query, state } from 'lit/decorators.js'
3
-
4
- import { NOTHING_RESULT, ScanResult } from './type'
5
- import { touch2mouse } from './utils/touch-to-mouse-event'
6
-
7
- function convert2To4(p1: { x: number; y: number }, p2: { x: number; y: number }): { x: number; y: number }[] {
8
- const x = p2.x - p1.x
9
- const y = p2.y - p1.y
10
- const length = Math.sqrt(x * x + y * y)
11
- const center = { x: p1.x + x / 2, y: p1.y + y / 2 }
12
- const theta = Math.atan2(y, x)
13
-
14
- const newp1 = { x: center.x - length / 2, y: center.y }
15
- const newp2 = { x: center.x + length / 2, y: center.y }
16
-
17
- const rectpoints = [
18
- { x: newp1.x, y: newp1.y - 10 },
19
- { x: newp1.x, y: newp1.y + 10 },
20
- { x: newp2.x, y: newp2.y + 10 },
21
- { x: newp2.x, y: newp2.y - 10 }
22
- ]
23
-
24
- const cos = Math.cos(theta)
25
- const sin = Math.sin(theta)
26
-
27
- return rectpoints.map(({ x, y }: { x: number; y: number }) => {
28
- return {
29
- x: cos * (x - center.x) + sin * (y - center.y) + center.x,
30
- y: cos * (y - center.y) - sin * (x - center.x) + center.y
31
- }
32
- })
33
- }
34
-
35
- @customElement('ox-ocr-result-image')
36
- export class OcrResultImage extends LitElement {
37
- static styles = [
38
- css`
39
- :host {
40
- display: block;
41
- position: relative;
42
- }
43
-
44
- img {
45
- display: block;
46
- flex: 1;
47
- border: 0;
48
- padding: 0;
49
- margin: 0;
50
- max-width: 100%;
51
- max-height: 100%;
52
- }
53
-
54
- img[noimage] {
55
- display: none;
56
- }
57
-
58
- [overlay] {
59
- position: absolute;
60
- top: 0;
61
- left: 0;
62
- width: 100%;
63
- height: 100%;
64
-
65
- border: 0;
66
- padding: 0;
67
- margin: 0;
68
- opacity: 50%;
69
- }
70
-
71
- [notice] {
72
- position: absolute;
73
- bottom: 0;
74
- background-color: var(--md-sys-color-on-primary-container, #38a25b);
75
- padding: var(--padding-default, 9px) var(--spacing-large, 15px);
76
- opacity: 0.95;
77
-
78
- overflow-wrap: anywhere;
79
-
80
- color: #fff;
81
- font-size: 1.5em;
82
- }
83
- `
84
- ]
85
-
86
- @property({ type: Array }) file: any
87
- @property({ type: Array }) result: ScanResult = NOTHING_RESULT
88
-
89
- @state() _ratio: { x: number; y: number } = { x: 1, y: 1 }
90
- @state() _image!: string
91
- @state() _resizeObserver!: ResizeObserver
92
- @state() _trails: Array<Array<{ x: number; y: number }>> = []
93
- @state() _tracking: boolean = false
94
- @state() _selections: Array<number> = []
95
- @state() _text: string = ''
96
-
97
- @query('img') _img!: HTMLImageElement
98
- @query('[overlay]') _overlay!: HTMLCanvasElement
99
-
100
- render() {
101
- return html`
102
- <img src=${this._image} @load=${() => this.calculateRatio()} ?noimage=${!this._image} />
103
- <canvas overlay></canvas>
104
-
105
- ${this._text ? html` <div notice>${this._text} copied!</div> ` : html``}
106
- `
107
- }
108
-
109
- renderOverlay() {
110
- const { boundaries } = this.result
111
-
112
- const context = this._overlay.getContext('2d')
113
- if (!context) {
114
- return
115
- }
116
-
117
- context.save()
118
-
119
- context.clearRect(0, 0, this._overlay.width, this._overlay.height)
120
-
121
- context.lineWidth = 5
122
- context.strokeStyle = 'red'
123
- context.fillStyle = 'red'
124
- context.lineJoin = 'round'
125
- context.lineCap = 'round'
126
-
127
- this._image &&
128
- boundaries
129
- .map((bounds): Array<{ x: number; y: number }> => {
130
- return bounds.map(bound => {
131
- return {
132
- x: bound.x, //* this._ratio.x,
133
- y: bound.y // * this._ratio.y
134
- }
135
- })
136
- })
137
- .forEach((bounds, idx) => {
138
- context.beginPath()
139
-
140
- context.moveTo(bounds[0].x, bounds[0].y)
141
- context.lineTo(bounds[1].x, bounds[1].y)
142
- context.lineTo(bounds[2].x, bounds[2].y)
143
- context.lineTo(bounds[3].x, bounds[3].y)
144
- context.closePath()
145
-
146
- if (this._selections.includes(idx)) {
147
- context.fill()
148
- }
149
- context.stroke()
150
- })
151
-
152
- /* draw trails */
153
- if (this._trails && this._trails.length > 0) {
154
- context.lineWidth = 10
155
- context.strokeStyle = 'blue'
156
-
157
- context.beginPath()
158
-
159
- this._trails.forEach(trail => {
160
- if (trail && trail.length > 0) {
161
- const { x, y } = trail[0]
162
- context.moveTo(x, y)
163
-
164
- trail.slice(1).forEach(point => {
165
- const { x, y } = point
166
- context.lineTo(x, y)
167
- })
168
- }
169
- })
170
-
171
- context.stroke()
172
- }
173
-
174
- context.restore()
175
- }
176
-
177
- async calculateRatio() {
178
- const { naturalWidth, naturalHeight, offsetWidth, offsetHeight } = this._img
179
- const { offsetWidth: overlayWidth, offsetHeight: overlayHeight } = this._overlay
180
-
181
- if (!naturalWidth || !naturalHeight) {
182
- return
183
- }
184
-
185
- this._ratio = {
186
- x: offsetWidth / naturalWidth,
187
- y: offsetHeight / naturalHeight
188
- }
189
-
190
- this._overlay.setAttribute('width', String(overlayWidth / this._ratio.x))
191
- this._overlay.setAttribute('height', String(overlayHeight / this._ratio.y))
192
- }
193
-
194
- async connectedCallback() {
195
- await super.connectedCallback()
196
-
197
- this._resizeObserver = new ResizeObserver(entries => {
198
- this.calculateRatio()
199
- this.renderOverlay()
200
- })
201
-
202
- await this.updateComplete
203
- this._resizeObserver.observe(this._overlay)
204
-
205
- this.calculateRatio()
206
-
207
- this.addEventListener('mousedown', this.onTrailStart.bind(this) as EventListener)
208
- this.addEventListener('mouseup', this.onTrailEnd.bind(this) as EventListener)
209
- this.addEventListener('mousemove', this.onTrail.bind(this) as EventListener)
210
- this.addEventListener('touchstart', touch2mouse as EventListener)
211
- this.addEventListener('touchend', touch2mouse as EventListener)
212
- this.addEventListener('touchmove', touch2mouse as EventListener)
213
- }
214
-
215
- disconnectedCallback() {
216
- super.disconnectedCallback()
217
-
218
- this._resizeObserver.disconnect()
219
- }
220
-
221
- reset() {
222
- this._selections = []
223
- this._trails = []
224
- this._text = ''
225
- }
226
-
227
- async updated(changes: PropertyValues<this>) {
228
- if (changes.has('file') || changes.has('result')) {
229
- this.reset()
230
- }
231
-
232
- if (changes.has('result')) {
233
- this.result.boundaries = this.result.boundaries.map((bound: { x: number; y: number }[]) => {
234
- return bound.length > 2 ? bound : convert2To4(bound[0], bound[1])
235
- })
236
- }
237
-
238
- if (changes.has('file')) {
239
- this._image = this.file && URL.createObjectURL(this.file)
240
- if (this._image) {
241
- requestAnimationFrame(() => {
242
- URL.revokeObjectURL(this._image)
243
- })
244
-
245
- await this.updateComplete
246
- this.calculateRatio()
247
- }
248
- }
249
-
250
- this.renderOverlay()
251
- }
252
-
253
- findIndex(x: number, y: number): number {
254
- const { boundaries } = this.result
255
-
256
- return boundaries.findIndex(path => {
257
- var result = false
258
-
259
- path.forEach((p, idx) => {
260
- let j = (idx + path.length + 1) % path.length
261
-
262
- let x1 = p.x
263
- let y1 = p.y
264
- let x2 = path[j].x
265
- let y2 = path[j].y
266
-
267
- if (y1 > y != y2 > y && x < ((x2 - x1) * (y - y1)) / (y2 - y1) + x1) {
268
- result = !result
269
- }
270
- })
271
-
272
- return result
273
- })
274
- }
275
-
276
- updateTrails(point: { x: number; y: number }, started: boolean, attached?: boolean) {
277
- if (started && !attached) {
278
- this.reset()
279
- }
280
-
281
- if (started) {
282
- this._trails.push([])
283
- }
284
-
285
- var trail = this._trails[this._trails.length - 1]
286
- if (!trail) {
287
- return
288
- }
289
-
290
- trail.push(point)
291
-
292
- this._trails.flat().forEach(({ x, y }) => {
293
- const idx = this.findIndex(x, y)
294
- if (idx === -1) {
295
- return
296
- }
297
-
298
- if (!this._selections.includes(idx)) {
299
- this._selections.push(idx)
300
- }
301
- })
302
-
303
- this.requestUpdate()
304
- }
305
-
306
- onTrailStart(e: MouseEvent) {
307
- const { offsetX: x, offsetY: y, button, shiftKey } = e
308
-
309
- if (button !== 0) {
310
- return
311
- }
312
-
313
- this._tracking = true
314
- this.updateTrails({ x: x / this._ratio.x, y: y / this._ratio.y }, true, shiftKey)
315
- }
316
-
317
- onTrailEnd(e: MouseEvent) {
318
- if (!this._tracking) {
319
- return
320
- }
321
-
322
- this._text = this._selections.map(idx => this.result.texts[idx]).join('')
323
-
324
- this.dispatchEvent(
325
- new CustomEvent('select', {
326
- detail: this._text
327
- })
328
- )
329
-
330
- this._tracking = false
331
- }
332
-
333
- onTrail(e: MouseEvent) {
334
- const { offsetX: x, offsetY: y } = e
335
-
336
- if (!this._tracking) {
337
- return
338
- }
339
-
340
- this.updateTrails({ x: x / this._ratio.x, y: y / this._ratio.y }, false)
341
- }
342
- }
package/src/type.ts DELETED
@@ -1,13 +0,0 @@
1
- export type ScanResult = {
2
- key_values: {
3
- [key: string]: Array<string>
4
- }
5
- boundaries: Array<Array<{ x: number; y: number }>>
6
- texts: Array<string>
7
- }
8
-
9
- export const NOTHING_RESULT = {
10
- boundaries: [],
11
- key_values: {},
12
- texts: []
13
- }
@@ -1,39 +0,0 @@
1
- export function touch2mouse(e: TouchEvent) {
2
- e.preventDefault()
3
-
4
- if (e.touches.length > 1 || (e.type == 'touchend' && e.touches.length > 0)) {
5
- return
6
- }
7
-
8
- var type = ''
9
- const touch = e.changedTouches[0]
10
-
11
- switch (e.type) {
12
- case 'touchstart':
13
- type = 'mousedown'
14
- break
15
- case 'touchmove':
16
- type = 'mousemove'
17
- break
18
- case 'touchend':
19
- type = 'mouseup'
20
- break
21
- }
22
-
23
- const { screenX, screenY, clientX, clientY } = touch
24
- const { ctrlKey, altKey, shiftKey, metaKey } = e
25
-
26
- e.target?.dispatchEvent(
27
- new MouseEvent(type, {
28
- screenX,
29
- screenY,
30
- clientX,
31
- clientY,
32
- ctrlKey,
33
- altKey,
34
- shiftKey,
35
- metaKey,
36
- button: 0
37
- })
38
- )
39
- }
@@ -1,52 +0,0 @@
1
- import '../src/ox-ocr-helper.js'
2
-
3
- import { html, TemplateResult } from 'lit'
4
-
5
- export default {
6
- title: 'OcrHelper',
7
- component: 'ox-ocr-helper',
8
- argTypes: {
9
- title: { control: 'text' },
10
- counter: { control: 'number' },
11
- textColor: { control: 'color' }
12
- }
13
- }
14
-
15
- interface Story<T> {
16
- (args: T): TemplateResult
17
- args?: Partial<T>
18
- argTypes?: Record<string, unknown>
19
- }
20
-
21
- interface ArgTypes {
22
- title?: string
23
- counter?: number
24
- textColor?: string
25
- slot?: TemplateResult
26
- }
27
-
28
- const Template: Story<ArgTypes> = ({ title = 'Hello world', counter = 5, textColor, slot }: ArgTypes) => html`
29
- <ocr-helper style="--ocr-helper-text-color: ${textColor || 'black'}" .title=${title} .counter=${counter}>
30
- ${slot}
31
- </ocr-helper>
32
- `
33
-
34
- export const Regular = Template.bind({})
35
-
36
- export const CustomTitle = Template.bind({})
37
- CustomTitle.args = {
38
- title: 'My title'
39
- }
40
-
41
- export const CustomCounter = Template.bind({})
42
- CustomCounter.args = {
43
- counter: 123456
44
- }
45
-
46
- export const SlottedContent = Template.bind({})
47
- SlottedContent.args = {
48
- slot: html`<p>Slotted content</p>`
49
- }
50
- SlottedContent.argTypes = {
51
- slot: { table: { disable: true } }
52
- }
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": false,
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", "three"]
22
- },
23
- "include": ["**/*.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
- });