@operato/oops 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 +9 -0
- package/package.json +4 -4
- package/.editorconfig +0 -29
- package/.storybook/main.js +0 -3
- package/.storybook/preview.js +0 -52
- package/.storybook/server.mjs +0 -8
- package/src/index.ts +0 -4
- package/src/ox-oops-note.ts +0 -43
- package/src/ox-oops-progress.ts +0 -79
- package/src/ox-oops-spinner.ts +0 -29
- package/src/ox-oops.ts +0 -226
- package/stories/index.stories.ts +0 -50
- 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,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/oops
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@operato/oops",
|
|
3
3
|
"description": "Webcomponent oops following open-wc recommendations",
|
|
4
4
|
"author": "heartyoh",
|
|
5
|
-
"version": "8.0.0-beta.
|
|
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",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@material/web": "^2.0.0",
|
|
57
|
-
"@operato/graphql": "^8.0.0-beta.
|
|
58
|
-
"@operato/styles": "^8.0.0-beta.
|
|
57
|
+
"@operato/graphql": "^8.0.0-beta.1",
|
|
58
|
+
"@operato/styles": "^8.0.0-beta.1",
|
|
59
59
|
"lit": "^3.1.2"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"prettier --write"
|
|
91
91
|
]
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "d5b28a2e9deb632c0dc80132f6a7196dd6fe4220"
|
|
94
94
|
}
|
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/src/index.ts
DELETED
package/src/ox-oops-note.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import '@material/web/icon/icon.js'
|
|
2
|
-
|
|
3
|
-
import { css, html, LitElement } from 'lit'
|
|
4
|
-
import { customElement, property } from 'lit/decorators.js'
|
|
5
|
-
|
|
6
|
-
@customElement('ox-oops-note')
|
|
7
|
-
export class OxOopsNote extends LitElement {
|
|
8
|
-
static styles = css`
|
|
9
|
-
:host {
|
|
10
|
-
display: block;
|
|
11
|
-
text-align: center;
|
|
12
|
-
}
|
|
13
|
-
md-icon {
|
|
14
|
-
font: var(--oops-note-icon-font);
|
|
15
|
-
color: var(--oops-note-icon-color);
|
|
16
|
-
border: var(--oops-note-icon-border);
|
|
17
|
-
border-radius: var(--oops-note-icon-border-radius);
|
|
18
|
-
padding: var(--oops-note-icon-padding);
|
|
19
|
-
}
|
|
20
|
-
[title] {
|
|
21
|
-
margin: var(--oops-note-title-margin);
|
|
22
|
-
font: var(--oops-note-title-font);
|
|
23
|
-
color: var(--oops-note-title-color);
|
|
24
|
-
text-transform: capitalize;
|
|
25
|
-
}
|
|
26
|
-
[description] {
|
|
27
|
-
font: var(--oops-note-description-font);
|
|
28
|
-
color: var(--oops-note-description-color);
|
|
29
|
-
}
|
|
30
|
-
`
|
|
31
|
-
|
|
32
|
-
@property({ type: String }) icon!: string
|
|
33
|
-
@property({ type: String }) title: string = ''
|
|
34
|
-
@property({ type: String }) description: string = ''
|
|
35
|
-
|
|
36
|
-
render() {
|
|
37
|
-
return html`
|
|
38
|
-
<md-icon>${this.icon}</md-icon>
|
|
39
|
-
<div title>${this.title}</div>
|
|
40
|
-
<div description>${this.description}</div>
|
|
41
|
-
`
|
|
42
|
-
}
|
|
43
|
-
}
|
package/src/ox-oops-progress.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import gql from 'graphql-tag'
|
|
2
|
-
import { html, LitElement, PropertyValues } from 'lit'
|
|
3
|
-
import { customElement, property } from 'lit/decorators.js'
|
|
4
|
-
|
|
5
|
-
import { subscribe } from '@operato/graphql'
|
|
6
|
-
|
|
7
|
-
@customElement('ox-oops-progress')
|
|
8
|
-
export class OxOopsProgress extends LitElement {
|
|
9
|
-
@property({ type: String }) tag?: string
|
|
10
|
-
|
|
11
|
-
private _subscription: any
|
|
12
|
-
|
|
13
|
-
render() {
|
|
14
|
-
return html` <slot></slot> `
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
disconnectedCallback() {
|
|
18
|
-
super.disconnectedCallback()
|
|
19
|
-
this.stopSubscribe()
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
get subscription() {
|
|
23
|
-
return this._subscription
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
set subscription(subscription) {
|
|
27
|
-
console.warn('oops-progress#subscription is readonly property')
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
async updated(changes: PropertyValues<this>) {
|
|
31
|
-
if (changes.has('tag') && this.subscription) {
|
|
32
|
-
await this.stopSubscribe()
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
async startSubscribe() {
|
|
37
|
-
if (!this.tag || this._subscription) {
|
|
38
|
-
return
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
this._subscription = await subscribe(
|
|
42
|
-
{
|
|
43
|
-
query: gql`
|
|
44
|
-
subscription {
|
|
45
|
-
data(tag: "${this.tag}") {
|
|
46
|
-
tag
|
|
47
|
-
data
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
`
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
next: async ({ data }: { data: any }) => {
|
|
54
|
-
if (data) {
|
|
55
|
-
const { progress = 0, message = '' } = data?.data?.data || {}
|
|
56
|
-
this.dispatchEvent(
|
|
57
|
-
new CustomEvent('progress', {
|
|
58
|
-
detail: {
|
|
59
|
-
progress,
|
|
60
|
-
message
|
|
61
|
-
}
|
|
62
|
-
})
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
if (progress >= 100) {
|
|
66
|
-
await this.stopSubscribe()
|
|
67
|
-
this.dispatchEvent(new CustomEvent('finish'))
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
async stopSubscribe() {
|
|
76
|
-
await this._subscription?.unsubscribe()
|
|
77
|
-
delete this._subscription
|
|
78
|
-
}
|
|
79
|
-
}
|
package/src/ox-oops-spinner.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { css, html, LitElement } from 'lit'
|
|
2
|
-
import { customElement } from 'lit/decorators.js'
|
|
3
|
-
|
|
4
|
-
@customElement('ox-oops-spinner')
|
|
5
|
-
export class OxOopsSpinner extends LitElement {
|
|
6
|
-
static styles = css`
|
|
7
|
-
:host {
|
|
8
|
-
width: 70px;
|
|
9
|
-
height: 70px;
|
|
10
|
-
margin: 0 auto;
|
|
11
|
-
background: url(/assets/images/spinner.png) 0 0 no-repeat;
|
|
12
|
-
background-size: 700%;
|
|
13
|
-
animation: spinner steps(6) 2s infinite both;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
@keyframes spinner {
|
|
17
|
-
0% {
|
|
18
|
-
background-position: 0%;
|
|
19
|
-
}
|
|
20
|
-
100% {
|
|
21
|
-
background-position: 100%;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
`
|
|
25
|
-
|
|
26
|
-
render() {
|
|
27
|
-
return html``
|
|
28
|
-
}
|
|
29
|
-
}
|
package/src/ox-oops.ts
DELETED
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
import { css, html, LitElement } from 'lit'
|
|
2
|
-
import { render } from 'lit-html'
|
|
3
|
-
import { customElement, state } from 'lit/decorators.js'
|
|
4
|
-
|
|
5
|
-
import { ScrollbarStyles } from '@operato/styles'
|
|
6
|
-
|
|
7
|
-
@customElement('ox-oops')
|
|
8
|
-
export class OxOops extends LitElement {
|
|
9
|
-
static styles = [
|
|
10
|
-
ScrollbarStyles,
|
|
11
|
-
css`
|
|
12
|
-
:host {
|
|
13
|
-
position: absolute;
|
|
14
|
-
display: none;
|
|
15
|
-
background-color: var(--md-sys-color-surface, #fff);
|
|
16
|
-
z-index: 100;
|
|
17
|
-
padding: 4px 0;
|
|
18
|
-
box-shadow: 2px 3px 10px 5px rgba(0, 0, 0, 0.15);
|
|
19
|
-
box-sizing: border-box;
|
|
20
|
-
min-width: fit-content;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
:host([active]) {
|
|
24
|
-
display: block;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
:host(*:focus) {
|
|
28
|
-
outline: none;
|
|
29
|
-
}
|
|
30
|
-
::slotted(*) {
|
|
31
|
-
padding: 5px 10px;
|
|
32
|
-
cursor: pointer;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
::slotted(*:focus) {
|
|
36
|
-
outline: none;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
::slotted([menu][active]),
|
|
40
|
-
::slotted([menu]:hover) {
|
|
41
|
-
background-color: #f6f6f6;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
::slotted([menu]),
|
|
45
|
-
::slotted(ox-oops-menuitem) {
|
|
46
|
-
border-left: 3px solid transparent;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
::slotted(ox-oops-menuitem[active]) {
|
|
50
|
-
border-left: 3px solid var(--md-sys-color-on-primary-container, #38a25b);
|
|
51
|
-
font-weight: bold;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
::slotted([separator]) {
|
|
55
|
-
height: 1px;
|
|
56
|
-
width: 100%;
|
|
57
|
-
padding: 0;
|
|
58
|
-
background-color: rgba(0, 0, 0, 0.15);
|
|
59
|
-
}
|
|
60
|
-
::slotted([menu] > input) {
|
|
61
|
-
border: var(--border-dim-color, 1px solid rgba(0, 0, 0, 0.3));
|
|
62
|
-
}
|
|
63
|
-
`
|
|
64
|
-
]
|
|
65
|
-
|
|
66
|
-
@state() _parent?: Element
|
|
67
|
-
|
|
68
|
-
render() {
|
|
69
|
-
return html` <slot> </slot> `
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
protected _onfocusout: (e: FocusEvent) => void = function (this: OxOops, e: FocusEvent) {
|
|
73
|
-
const to = e.relatedTarget as HTMLElement
|
|
74
|
-
|
|
75
|
-
if (!this.contains(to)) {
|
|
76
|
-
/* 분명히 내 범위가 아닌 엘리먼트로 포커스가 옮겨졌다면, ox-oops은 닫혀야 한다. */
|
|
77
|
-
// @ts-ignore for debug
|
|
78
|
-
!window.POPUP_DEBUG && this.close()
|
|
79
|
-
}
|
|
80
|
-
}.bind(this)
|
|
81
|
-
|
|
82
|
-
protected _onkeydown: (e: KeyboardEvent) => void = function (this: OxOops, e: KeyboardEvent) {
|
|
83
|
-
e.stopPropagation()
|
|
84
|
-
|
|
85
|
-
switch (e.key) {
|
|
86
|
-
case 'Esc': // for IE/Edge
|
|
87
|
-
case 'Escape':
|
|
88
|
-
this.close()
|
|
89
|
-
break
|
|
90
|
-
}
|
|
91
|
-
}.bind(this)
|
|
92
|
-
|
|
93
|
-
protected _onkeyup: (e: KeyboardEvent) => void = function (this: OxOops, e: KeyboardEvent) {
|
|
94
|
-
e.stopPropagation()
|
|
95
|
-
}.bind(this)
|
|
96
|
-
|
|
97
|
-
protected _onclick: (e: MouseEvent) => void = function (this: OxOops, e: MouseEvent) {
|
|
98
|
-
e.stopPropagation()
|
|
99
|
-
}.bind(this)
|
|
100
|
-
|
|
101
|
-
protected _onclose: (e: Event) => void = function (this: OxOops, e: Event) {
|
|
102
|
-
this.close()
|
|
103
|
-
}.bind(this)
|
|
104
|
-
|
|
105
|
-
protected _oncollapse: (e: Event) => void = function (this: OxOops, e: Event) {
|
|
106
|
-
e.stopPropagation()
|
|
107
|
-
this.close()
|
|
108
|
-
}.bind(this)
|
|
109
|
-
|
|
110
|
-
protected _onwindowblur: (e: Event) => void = function (this: OxOops, e: Event) {
|
|
111
|
-
// @ts-ignore for debug
|
|
112
|
-
!window.POPUP_DEBUG && this.close()
|
|
113
|
-
}.bind(this)
|
|
114
|
-
|
|
115
|
-
connectedCallback() {
|
|
116
|
-
super.connectedCallback()
|
|
117
|
-
|
|
118
|
-
this.addEventListener('focusout', this._onfocusout)
|
|
119
|
-
this.addEventListener('keydown', this._onkeydown)
|
|
120
|
-
this.addEventListener('keyup', this._onkeyup)
|
|
121
|
-
this.addEventListener('click', this._onclick)
|
|
122
|
-
this.addEventListener('ox-close', this._onclose)
|
|
123
|
-
this.addEventListener('ox-collapse', this._oncollapse)
|
|
124
|
-
|
|
125
|
-
this.setAttribute('tabindex', '0') // make this element focusable
|
|
126
|
-
this.guaranteeFocus()
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Configuration for opening ox-oops
|
|
131
|
-
*
|
|
132
|
-
* @typedef {Object} OopsOpenOptions
|
|
133
|
-
* @property {HTMLTemplate} template HTMLTemplate to be displayed inside the oops
|
|
134
|
-
* @property {Number} top The position-top where the pop-up will be displayed
|
|
135
|
-
* @property {Number} left The position-left where the pop-up will be displayed
|
|
136
|
-
* @property {HTMLElement} parent Oops's parent element
|
|
137
|
-
*/
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Open Oops
|
|
141
|
-
*
|
|
142
|
-
* @param {OopsOpenOptions}
|
|
143
|
-
*/
|
|
144
|
-
static open({
|
|
145
|
-
template,
|
|
146
|
-
top,
|
|
147
|
-
left,
|
|
148
|
-
right,
|
|
149
|
-
bottom,
|
|
150
|
-
parent
|
|
151
|
-
}: {
|
|
152
|
-
template: unknown
|
|
153
|
-
top?: number
|
|
154
|
-
left?: number
|
|
155
|
-
right?: number
|
|
156
|
-
bottom?: number
|
|
157
|
-
parent?: Element | null
|
|
158
|
-
}) {
|
|
159
|
-
const owner = parent || document.body
|
|
160
|
-
const target = document.createElement('ox-oops') as OxOops
|
|
161
|
-
|
|
162
|
-
render(template, target)
|
|
163
|
-
|
|
164
|
-
target._parent = owner
|
|
165
|
-
owner.appendChild(target)
|
|
166
|
-
|
|
167
|
-
target.open({ top, left, right, bottom })
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
open({
|
|
171
|
-
left,
|
|
172
|
-
top,
|
|
173
|
-
right,
|
|
174
|
-
bottom,
|
|
175
|
-
silent = false
|
|
176
|
-
}: {
|
|
177
|
-
left?: number
|
|
178
|
-
top?: number
|
|
179
|
-
right?: number
|
|
180
|
-
bottom?: number
|
|
181
|
-
silent?: boolean
|
|
182
|
-
}) {
|
|
183
|
-
if (left !== undefined) this.style.left = `${left}px`
|
|
184
|
-
if (top !== undefined) this.style.top = `${top}px`
|
|
185
|
-
if (right !== undefined) this.style.right = `${right}px`
|
|
186
|
-
if (bottom !== undefined) this.style.bottom = `${bottom}px`
|
|
187
|
-
|
|
188
|
-
this.setAttribute('active', '')
|
|
189
|
-
|
|
190
|
-
!silent && this.guaranteeFocus()
|
|
191
|
-
|
|
192
|
-
/* When the window is out of focus, all pop-ups should disappear. */
|
|
193
|
-
window.addEventListener('blur', this._onwindowblur)
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
guaranteeFocus() {
|
|
197
|
-
const focusible = this.querySelector(
|
|
198
|
-
':scope > button, :scope > [href], :scope > input, :scope > select, :scope > textarea, :scope > [tabindex]:not([tabindex="-1"])'
|
|
199
|
-
)
|
|
200
|
-
|
|
201
|
-
if (focusible) {
|
|
202
|
-
;(focusible as HTMLElement).focus()
|
|
203
|
-
} else {
|
|
204
|
-
this.focus()
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
close() {
|
|
209
|
-
this.removeAttribute('active')
|
|
210
|
-
|
|
211
|
-
window.removeEventListener('blur', this._onwindowblur)
|
|
212
|
-
|
|
213
|
-
if (this._parent) {
|
|
214
|
-
/* this case is when the oops is opened by OxOops.open(...) */
|
|
215
|
-
this.removeEventListener('focusout', this._onfocusout)
|
|
216
|
-
this.removeEventListener('keydown', this._onkeydown)
|
|
217
|
-
this.removeEventListener('keyup', this._onkeyup)
|
|
218
|
-
this.removeEventListener('click', this._onclick)
|
|
219
|
-
this.removeEventListener('ox-close', this._onclose)
|
|
220
|
-
this.removeEventListener('ox-collapse', this._oncollapse)
|
|
221
|
-
|
|
222
|
-
this._parent.removeChild(this)
|
|
223
|
-
delete this._parent
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
package/stories/index.stories.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import '../src/ox-oops'
|
|
2
|
-
|
|
3
|
-
import { html, TemplateResult } from 'lit'
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'ContextMenu',
|
|
7
|
-
component: 'ox-oops',
|
|
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
|
-
<ox-oops style="--ox-oops-text-color: ${textColor || 'black'}" .title=${title} .counter=${counter}> ${slot} </ox-oops>
|
|
30
|
-
`
|
|
31
|
-
|
|
32
|
-
export const Regular = Template.bind({})
|
|
33
|
-
|
|
34
|
-
export const CustomTitle = Template.bind({})
|
|
35
|
-
CustomTitle.args = {
|
|
36
|
-
title: 'My title'
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export const CustomCounter = Template.bind({})
|
|
40
|
-
CustomCounter.args = {
|
|
41
|
-
counter: 123456
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export const SlottedContent = Template.bind({})
|
|
45
|
-
SlottedContent.args = {
|
|
46
|
-
slot: html`<p>Slotted content</p>`
|
|
47
|
-
}
|
|
48
|
-
SlottedContent.argTypes = {
|
|
49
|
-
slot: { table: { disable: true } }
|
|
50
|
-
}
|
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
|
-
});
|