@operato/markdown 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 +18 -0
- package/package.json +3 -3
- package/.editorconfig +0 -29
- package/.storybook/main.js +0 -3
- package/.storybook/preview.js +0 -52
- package/.storybook/server.mjs +0 -8
- package/demo/index.html +0 -45
- package/src/index.ts +0 -1
- package/src/markdown-style.ts +0 -121
- package/src/markdown.ts +0 -21
- package/src/ox-markdown.ts +0 -116
- package/tsconfig.json +0 -24
- package/web-dev-server.config.mjs +0 -27
- package/web-test-runner.config.mjs +0 -41
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/markdown
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@operato/markdown",
|
|
3
3
|
"description": "Webcomponent markdown following open-wc recommendations",
|
|
4
4
|
"author": "heartyoh",
|
|
5
|
-
"version": "8.0.0-beta.
|
|
5
|
+
"version": "8.0.0-beta.2",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
7
7
|
"module": "dist/src/index.js",
|
|
8
8
|
"exports": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"storybook:build": "tsc && npm run analyze -- --exclude dist && build-storybook"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@operato/styles": "^8.0.0-beta.
|
|
44
|
+
"@operato/styles": "^8.0.0-beta.2",
|
|
45
45
|
"lit": "^3.1.2",
|
|
46
46
|
"marked": "^4.0.7"
|
|
47
47
|
},
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"prettier --write"
|
|
79
79
|
]
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "ee1b5124995accb99272d3b5854f3df1d8746dda"
|
|
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 = */
|
package/.storybook/main.js
DELETED
package/.storybook/preview.js
DELETED
|
@@ -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
|
-
]
|
package/.storybook/server.mjs
DELETED
|
@@ -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,45 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en-GB">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<style>
|
|
6
|
-
body {
|
|
7
|
-
background: #fafafa;
|
|
8
|
-
--ox-checkbox-size: 12px;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
#demo {
|
|
12
|
-
position: relative;
|
|
13
|
-
height: 300px;
|
|
14
|
-
background-color: lightgray;
|
|
15
|
-
vertical-align: middle;
|
|
16
|
-
}
|
|
17
|
-
</style>
|
|
18
|
-
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet" />
|
|
19
|
-
<link
|
|
20
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
|
|
21
|
-
rel="stylesheet"
|
|
22
|
-
/>
|
|
23
|
-
<link
|
|
24
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
|
|
25
|
-
rel="stylesheet"
|
|
26
|
-
/>
|
|
27
|
-
<link
|
|
28
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
|
|
29
|
-
rel="stylesheet"
|
|
30
|
-
/>
|
|
31
|
-
</head>
|
|
32
|
-
<body>
|
|
33
|
-
<div id="demo"></div>
|
|
34
|
-
|
|
35
|
-
<script type="module">
|
|
36
|
-
import { html, render } from 'lit'
|
|
37
|
-
import '../dist/src/ox-markdown.js'
|
|
38
|
-
import '@material/web/icon/icon.js'
|
|
39
|
-
|
|
40
|
-
const parent = document.querySelector('#demo')
|
|
41
|
-
|
|
42
|
-
render(html`clike anywhere in this box to show markdown.`, parent)
|
|
43
|
-
</script>
|
|
44
|
-
</body>
|
|
45
|
-
</html>
|
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ox-markdown'
|
package/src/markdown-style.ts
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { css } from 'lit'
|
|
2
|
-
|
|
3
|
-
export const MarkdownStyle = css`
|
|
4
|
-
h1 {
|
|
5
|
-
margin: var(--help-panel-title-margin);
|
|
6
|
-
padding: var(--help-panel-title-padding);
|
|
7
|
-
font-size: 20px;
|
|
8
|
-
text-transform: capitalize;
|
|
9
|
-
color: var(--help-panel-h1-title-color);
|
|
10
|
-
}
|
|
11
|
-
h2 {
|
|
12
|
-
margin: var(--help-panel-title-margin);
|
|
13
|
-
padding: var(--help-panel-title-padding);
|
|
14
|
-
font-size: 18px;
|
|
15
|
-
color: var(--help-panel-h2-title-color);
|
|
16
|
-
text-transform: capitalize;
|
|
17
|
-
}
|
|
18
|
-
h3 {
|
|
19
|
-
margin: var(--help-panel-title-margin);
|
|
20
|
-
padding: var(--help-panel-title-padding);
|
|
21
|
-
font-size: 16px;
|
|
22
|
-
color: var(--help-panel-h3-title-color);
|
|
23
|
-
}
|
|
24
|
-
md-icon {
|
|
25
|
-
vertical-align: middle;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
img {
|
|
29
|
-
display: block;
|
|
30
|
-
margin: var(--spacing-large) var(--spacing-large);
|
|
31
|
-
max-width: 90%;
|
|
32
|
-
}
|
|
33
|
-
img[src*='#icon25'] {
|
|
34
|
-
width: 25px;
|
|
35
|
-
height: 25px;
|
|
36
|
-
}
|
|
37
|
-
img[src*='#icon50'] {
|
|
38
|
-
width: 50px;
|
|
39
|
-
height: 50px;
|
|
40
|
-
}
|
|
41
|
-
img[src*='#icon100'] {
|
|
42
|
-
width: 100px;
|
|
43
|
-
height: 100px;
|
|
44
|
-
}
|
|
45
|
-
img[src*='#icon25inlined'],
|
|
46
|
-
img[src*='#icon50inlined'],
|
|
47
|
-
img[src*='#icon100inlined'] {
|
|
48
|
-
display: inline-block;
|
|
49
|
-
margin: var(--spacing-small);
|
|
50
|
-
}
|
|
51
|
-
p {
|
|
52
|
-
margin: var(--help-panel-paragraph-margin);
|
|
53
|
-
font-size: var(--help-panel-font-size);
|
|
54
|
-
}
|
|
55
|
-
[focusBox] {
|
|
56
|
-
display: block;
|
|
57
|
-
padding: var(--help-panel-focusBox-padding);
|
|
58
|
-
border: var(--help-panel-focusBox-border);
|
|
59
|
-
border-radius: var(--help-panel-focusBox-border-radius);
|
|
60
|
-
background-color: var(--help-panel-focusBox-background-color);
|
|
61
|
-
color: var(--help-panel-focusBox-color);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
[subtitle] {
|
|
65
|
-
font-weight: bold;
|
|
66
|
-
}
|
|
67
|
-
[subtitle]::before {
|
|
68
|
-
content: '';
|
|
69
|
-
width: 7px;
|
|
70
|
-
height: 7px;
|
|
71
|
-
display: inline-block;
|
|
72
|
-
border: 3px solid var(--md-sys-color-surface);
|
|
73
|
-
border-radius: 50%;
|
|
74
|
-
margin-right: var(--spacing-small);
|
|
75
|
-
}
|
|
76
|
-
p + ol,
|
|
77
|
-
p + ul {
|
|
78
|
-
font-size: var(--help-panel-content-font-size);
|
|
79
|
-
}
|
|
80
|
-
ol,
|
|
81
|
-
ul {
|
|
82
|
-
padding: 0 0 0 30px;
|
|
83
|
-
}
|
|
84
|
-
ol li,
|
|
85
|
-
ul li {
|
|
86
|
-
margin: 0 0 2px 0;
|
|
87
|
-
}
|
|
88
|
-
a {
|
|
89
|
-
margin-bottom: 0 !important;
|
|
90
|
-
color: var(--help-panel-a-color);
|
|
91
|
-
font-size: var(--fontsize-default);
|
|
92
|
-
text-decoration: underline;
|
|
93
|
-
}
|
|
94
|
-
a md-icon {
|
|
95
|
-
font-size: var(--help-panel-a-icon-size);
|
|
96
|
-
margin: 0;
|
|
97
|
-
}
|
|
98
|
-
a:hover {
|
|
99
|
-
background-color: var(--opacity-light-dark-color);
|
|
100
|
-
font-weight: bold;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
table {
|
|
104
|
-
border-collapse: collapse;
|
|
105
|
-
border: var(--border-dim-color);
|
|
106
|
-
font-size: 0.9em;
|
|
107
|
-
}
|
|
108
|
-
th {
|
|
109
|
-
border-top: 3px solid var(--md-sys-color-on-primary-container);
|
|
110
|
-
background-color: var(--md-sys-color-background);
|
|
111
|
-
color: var(--md-sys-color-on-secondary-container);
|
|
112
|
-
}
|
|
113
|
-
th,
|
|
114
|
-
td {
|
|
115
|
-
border-bottom: var(--border-dim-color);
|
|
116
|
-
padding: var(--spacing-small);
|
|
117
|
-
}
|
|
118
|
-
tr:nth-child(even) {
|
|
119
|
-
background-color: #f6f6f6;
|
|
120
|
-
}
|
|
121
|
-
`
|
package/src/markdown.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const worker = new Worker(new URL('../../workers/markdown-webworker.js', import.meta.url), { type: 'module' })
|
|
2
|
-
|
|
3
|
-
const TIMEOUT_LIMIT = 20000
|
|
4
|
-
|
|
5
|
-
export async function md(markdown: string, options: StructuredSerializeOptions): Promise<any> {
|
|
6
|
-
return new Promise((resolve, reject) => {
|
|
7
|
-
var timeout = setTimeout(() => {
|
|
8
|
-
reject('Marked took too long!')
|
|
9
|
-
}, TIMEOUT_LIMIT)
|
|
10
|
-
|
|
11
|
-
worker.onmessage = e => {
|
|
12
|
-
clearTimeout(timeout)
|
|
13
|
-
resolve(e.data)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
worker.postMessage({
|
|
17
|
-
content: markdown,
|
|
18
|
-
options
|
|
19
|
-
})
|
|
20
|
-
})
|
|
21
|
-
}
|
package/src/ox-markdown.ts
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { LitElement, PropertyValues, TemplateResult, css, html } from 'lit'
|
|
2
|
-
import { customElement, property, state } from 'lit/decorators.js'
|
|
3
|
-
|
|
4
|
-
import { DirectiveResult } from 'lit-html/directive'
|
|
5
|
-
import { MarkdownStyle } from './markdown-style'
|
|
6
|
-
import { ScrollbarStyles } from '@operato/styles'
|
|
7
|
-
import { md } from './markdown'
|
|
8
|
-
import { unsafeHTML } from 'lit/directives/unsafe-html.js'
|
|
9
|
-
|
|
10
|
-
@customElement('ox-markdown')
|
|
11
|
-
export class OxMarkdown extends LitElement {
|
|
12
|
-
static styles = [
|
|
13
|
-
ScrollbarStyles,
|
|
14
|
-
MarkdownStyle,
|
|
15
|
-
css`
|
|
16
|
-
#toc {
|
|
17
|
-
position: absolute;
|
|
18
|
-
max-width: 250px;
|
|
19
|
-
background-color: var(--md-sys-color-surface);
|
|
20
|
-
padding: var(--padding-default);
|
|
21
|
-
right: var(--spacing-large);
|
|
22
|
-
font: bold var(--fontsize-large) var(--theme-font);
|
|
23
|
-
color: var(--md-sys-color-on-secondary-container);
|
|
24
|
-
}
|
|
25
|
-
#toc ul {
|
|
26
|
-
list-style: circle;
|
|
27
|
-
margin: var(--margin-default) 0 0 var(--spacing-large);
|
|
28
|
-
padding: 0;
|
|
29
|
-
}
|
|
30
|
-
#toc a {
|
|
31
|
-
display: inline-block;
|
|
32
|
-
margin-left: -var(--spacing-small);
|
|
33
|
-
padding: var(--spacing-small) 0;
|
|
34
|
-
font: normal var(--fontsize-default) var(--theme-font);
|
|
35
|
-
color: var(--md-sys-color-on-secondary-container);
|
|
36
|
-
text-decoration: none;
|
|
37
|
-
cursor: pointer;
|
|
38
|
-
}
|
|
39
|
-
#toc a:hover {
|
|
40
|
-
background-color: var(--md-sys-color-surface);
|
|
41
|
-
text-decoration: underline;
|
|
42
|
-
color: var(--md-sys-color-on-primary-container);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@media screen and (max-width: 460px) {
|
|
46
|
-
#toc {
|
|
47
|
-
background-color: var(--md-sys-color-background);
|
|
48
|
-
border-left: 4px solid var(--md-sys-color-on-primary-container);
|
|
49
|
-
border-bottom: 1px dotted rgba(0, 0, 0, 0.2);
|
|
50
|
-
position: relative;
|
|
51
|
-
width: 100%;
|
|
52
|
-
max-width: initial;
|
|
53
|
-
padding: var(--padding-default) var(--padding-default) var(--padding-default) var(--spacing-large);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
`
|
|
57
|
-
]
|
|
58
|
-
|
|
59
|
-
@property({ type: String }) src?: string
|
|
60
|
-
@property({ type: Boolean }) toc: boolean = false
|
|
61
|
-
|
|
62
|
-
@state() _html?: TemplateResult | DirectiveResult | null
|
|
63
|
-
@state() _headings: any[] = []
|
|
64
|
-
|
|
65
|
-
render() {
|
|
66
|
-
return html` ${this.toc ? this.renderToc() : html``} ${this._html} `
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
renderToc() {
|
|
70
|
-
var toc = this._headings || []
|
|
71
|
-
|
|
72
|
-
return toc && toc.length > 0
|
|
73
|
-
? html`
|
|
74
|
-
<div id="toc">
|
|
75
|
-
Table Of Contents
|
|
76
|
-
<ul>
|
|
77
|
-
${toc.map(
|
|
78
|
-
heading => html` <li><a @click=${() => heading?.scrollIntoView()}>${heading.textContent}</a></li> `
|
|
79
|
-
)}
|
|
80
|
-
</ul>
|
|
81
|
-
</div>
|
|
82
|
-
`
|
|
83
|
-
: html``
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
async updated(changed: PropertyValues<this>) {
|
|
87
|
-
if (changed.has('src')) {
|
|
88
|
-
if (this.src) {
|
|
89
|
-
const response = await fetch(this.src)
|
|
90
|
-
const content = await response.text()
|
|
91
|
-
|
|
92
|
-
if (!response.ok) {
|
|
93
|
-
this._html = html`
|
|
94
|
-
<h1>Error : ${response.status}</h1>
|
|
95
|
-
<div>${content}</div>
|
|
96
|
-
`
|
|
97
|
-
} else {
|
|
98
|
-
if (response.headers.get('Content-Type')?.indexOf('text/markdown') !== -1) {
|
|
99
|
-
this._html = unsafeHTML(
|
|
100
|
-
(await md(content, {
|
|
101
|
-
baseUrl: this.src,
|
|
102
|
-
linkBaseUrl: document.baseURI
|
|
103
|
-
} as StructuredSerializeOptions)) || ''
|
|
104
|
-
)
|
|
105
|
-
} else {
|
|
106
|
-
this._html = unsafeHTML(content || '')
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (changed.has('_html')) {
|
|
113
|
-
this._headings = Array.from(this.renderRoot.querySelectorAll('h2'))
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
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"]
|
|
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
|
-
});
|