@operato/help 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 +8 -8
- 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/components/ox-help-icon.ts +0 -49
- package/src/components/ox-inline-help.ts +0 -29
- package/src/components/ox-title-with-help.ts +0 -39
- package/src/controller/help.ts +0 -13
- package/src/grist/help-decorated-renderer.ts +0 -19
- package/src/help-style.ts +0 -123
- package/src/index.ts +0 -5
- package/src/pages/ox-help-home.ts +0 -126
- package/src/themes/help-theme.css +0 -57
- package/src/viewparts/ox-help-panel.ts +0 -217
- 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/help
|
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"name": "@operato/help",
|
3
3
|
"description": "Webcomponent help 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": {
|
@@ -66,12 +66,12 @@
|
|
66
66
|
},
|
67
67
|
"dependencies": {
|
68
68
|
"@material/web": "^2.0.0",
|
69
|
-
"@operato/data-grist": "^8.0.0-beta.
|
70
|
-
"@operato/layout": "^8.0.0-beta.
|
71
|
-
"@operato/markdown": "^8.0.0-beta.
|
72
|
-
"@operato/shell": "^8.0.0-beta.
|
73
|
-
"@operato/styles": "^8.0.0-beta.
|
74
|
-
"@operato/utils": "^8.0.0-beta.
|
69
|
+
"@operato/data-grist": "^8.0.0-beta.2",
|
70
|
+
"@operato/layout": "^8.0.0-beta.2",
|
71
|
+
"@operato/markdown": "^8.0.0-beta.2",
|
72
|
+
"@operato/shell": "^8.0.0-beta.2",
|
73
|
+
"@operato/styles": "^8.0.0-beta.2",
|
74
|
+
"@operato/utils": "^8.0.0-beta.2",
|
75
75
|
"lit": "^3.1.2",
|
76
76
|
"pwa-helpers": "^0.9.1"
|
77
77
|
},
|
@@ -107,5 +107,5 @@
|
|
107
107
|
"prettier --write"
|
108
108
|
]
|
109
109
|
},
|
110
|
-
"gitHead": "
|
110
|
+
"gitHead": "ee1b5124995accb99272d3b5854f3df1d8746dda"
|
111
111
|
}
|
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/components/ox-help-icon.js'
|
38
|
-
|
39
|
-
const parent = document.querySelector('#demo')
|
40
|
-
const topic = 'abc'
|
41
|
-
|
42
|
-
render(html`<ox-help-icon .topic=${topic}></ox-help-icon>`, parent)
|
43
|
-
</script>
|
44
|
-
</body>
|
45
|
-
</html>
|
@@ -1,49 +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
|
-
import { openHelp } from '../controller/help.js'
|
7
|
-
|
8
|
-
@customElement('ox-help-icon')
|
9
|
-
export class HelpIcon extends LitElement {
|
10
|
-
static styles = css`
|
11
|
-
md-icon {
|
12
|
-
position: relative;
|
13
|
-
top: 4px;
|
14
|
-
cursor: help;
|
15
|
-
opacity: var(--help-icon-opacity);
|
16
|
-
color: var(--help-icon-color);
|
17
|
-
line-height: 0;
|
18
|
-
|
19
|
-
--md-icon-size: var(--help-icon-size);
|
20
|
-
|
21
|
-
&:hover {
|
22
|
-
opacity: var(--help-icon-hover-opacity);
|
23
|
-
color: var(--help-icon-hover-color);
|
24
|
-
}
|
25
|
-
}
|
26
|
-
`
|
27
|
-
|
28
|
-
@property({ type: String }) topic!: string
|
29
|
-
|
30
|
-
onclick = (e: Event) => {
|
31
|
-
e.stopPropagation()
|
32
|
-
|
33
|
-
openHelp(this.topic)
|
34
|
-
}
|
35
|
-
|
36
|
-
onpointerdown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null = (e: Event) => {
|
37
|
-
e.stopPropagation()
|
38
|
-
}
|
39
|
-
|
40
|
-
onpointerup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null = (e: Event) => {
|
41
|
-
e.stopPropagation()
|
42
|
-
}
|
43
|
-
|
44
|
-
render() {
|
45
|
-
const topic = this.topic
|
46
|
-
|
47
|
-
return html`${topic ? html`<md-icon>help</md-icon>` : html``}`
|
48
|
-
}
|
49
|
-
}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import { css, html, LitElement } from 'lit'
|
2
|
-
import { customElement, property } from 'lit/decorators.js'
|
3
|
-
|
4
|
-
import { openHelp } from '../controller/help.js'
|
5
|
-
|
6
|
-
@customElement('ox-inline-help')
|
7
|
-
export class InlineHelp extends LitElement {
|
8
|
-
static styles = css`
|
9
|
-
:host {
|
10
|
-
display: flex;
|
11
|
-
align-items: center;
|
12
|
-
}
|
13
|
-
`
|
14
|
-
|
15
|
-
@property({ type: String }) topic!: string
|
16
|
-
@property({ type: String }) type!: string
|
17
|
-
|
18
|
-
render() {
|
19
|
-
return html` <slot></slot> `
|
20
|
-
}
|
21
|
-
|
22
|
-
connectedCallback() {
|
23
|
-
super.connectedCallback()
|
24
|
-
|
25
|
-
this.renderRoot.addEventListener('click', e => {
|
26
|
-
openHelp(this.topic)
|
27
|
-
})
|
28
|
-
}
|
29
|
-
}
|
@@ -1,39 +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
|
-
import { i18next, localize } from '@operato/i18n'
|
7
|
-
|
8
|
-
import { openHelp } from '../controller/help.js'
|
9
|
-
|
10
|
-
@customElement('ox-title-with-help')
|
11
|
-
export class TitleWithHelp extends localize(i18next)(LitElement) {
|
12
|
-
static styles = css`
|
13
|
-
md-icon {
|
14
|
-
position: relative;
|
15
|
-
top: 4px;
|
16
|
-
cursor: help;
|
17
|
-
opacity: var(--help-icon-opacity);
|
18
|
-
color: var(--help-icon-color);
|
19
|
-
line-height: 0;
|
20
|
-
|
21
|
-
--md-icon-size: var(--help-icon-size);
|
22
|
-
|
23
|
-
&:hover {
|
24
|
-
opacity: var(--help-icon-hover-opacity);
|
25
|
-
color: var(--help-icon-hover-color);
|
26
|
-
}
|
27
|
-
}
|
28
|
-
`
|
29
|
-
|
30
|
-
@property({ type: String }) msgid!: string
|
31
|
-
@property({ type: String }) topic!: string
|
32
|
-
|
33
|
-
render() {
|
34
|
-
const title = i18next.t(this.msgid)
|
35
|
-
const topic = this.topic
|
36
|
-
|
37
|
-
return html` ${title} ${topic ? html`<md-icon @click=${() => openHelp(topic)}>help</md-icon>` : html``} `
|
38
|
-
}
|
39
|
-
}
|
package/src/controller/help.ts
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
import '../components/ox-help-icon.js'
|
2
|
-
|
3
|
-
import { html } from 'lit-html'
|
4
|
-
|
5
|
-
import { ColumnConfig, FieldRenderer, GristRecord } from '@operato/data-grist'
|
6
|
-
|
7
|
-
interface HelpExtendedRecord extends GristRecord {
|
8
|
-
help?: (value: any, column: ColumnConfig, record: GristRecord, rowIndex: number, owner: any) => string
|
9
|
-
}
|
10
|
-
|
11
|
-
const decoratorTemplate = (topic: string) => html`<ox-help-icon style="flex: 0;" .topic=${topic}>help</ox-help-icon>`
|
12
|
-
|
13
|
-
export const HelpDecoratedRenderer: FieldRenderer = (value, column, record, rowIndex, field) => {
|
14
|
-
const { help } = column?.record as HelpExtendedRecord
|
15
|
-
const text = value === undefined ? '' : value
|
16
|
-
|
17
|
-
const topic = help && help(value, column, record, rowIndex, field)
|
18
|
-
return html`<span>${text}</span> ${topic ? decoratorTemplate(topic) : ''}`
|
19
|
-
}
|
package/src/help-style.ts
DELETED
@@ -1,123 +0,0 @@
|
|
1
|
-
import { css } from 'lit'
|
2
|
-
|
3
|
-
export const HelpStyle = css`
|
4
|
-
h1 {
|
5
|
-
background-color: var(--help-panel-title-background-color);
|
6
|
-
margin: var(--help-panel-title-margin);
|
7
|
-
padding: var(--help-panel-title-padding);
|
8
|
-
font-size: var(--help-panel-h1-title-font-size);
|
9
|
-
text-transform: capitalize;
|
10
|
-
color: var(--help-panel-h1-title-color);
|
11
|
-
}
|
12
|
-
h2 {
|
13
|
-
margin: var(--help-panel-title-margin);
|
14
|
-
padding: var(--help-panel-title-padding);
|
15
|
-
font-size: var(--help-panel-h2-title-font-size);
|
16
|
-
color: var(--help-panel-h2-title-color);
|
17
|
-
text-transform: capitalize;
|
18
|
-
}
|
19
|
-
h3 {
|
20
|
-
margin: var(--help-panel-title-margin);
|
21
|
-
padding: var(--help-panel-title-padding);
|
22
|
-
font-size: var(--help-panel-h3-title-font-size);
|
23
|
-
color: var(--help-panel-h3-title-color);
|
24
|
-
}
|
25
|
-
md-icon {
|
26
|
-
vertical-align: middle;
|
27
|
-
}
|
28
|
-
|
29
|
-
img {
|
30
|
-
display: block;
|
31
|
-
margin: var(--spacing-small) var(--spacing-medium);
|
32
|
-
max-width: 100%;
|
33
|
-
}
|
34
|
-
img[src*='#icon25'] {
|
35
|
-
width: 25px;
|
36
|
-
height: 25px;
|
37
|
-
}
|
38
|
-
img[src*='#icon50'] {
|
39
|
-
width: 50px;
|
40
|
-
height: 50px;
|
41
|
-
}
|
42
|
-
img[src*='#icon100'] {
|
43
|
-
width: 100px;
|
44
|
-
height: 100px;
|
45
|
-
}
|
46
|
-
img[src*='#icon25inlined'],
|
47
|
-
img[src*='#icon50inlined'],
|
48
|
-
img[src*='#icon100inlined'] {
|
49
|
-
display: inline-block;
|
50
|
-
margin: var(--spacing-small);
|
51
|
-
}
|
52
|
-
p {
|
53
|
-
margin: var(--help-panel-paragraph-margin);
|
54
|
-
font-size: var(--help-panel-font-size);
|
55
|
-
}
|
56
|
-
[focusBox] {
|
57
|
-
display: block;
|
58
|
-
padding: var(--help-panel-focusBox-padding);
|
59
|
-
border: var(--help-panel-focusBox-border);
|
60
|
-
border-radius: var(--help-panel-focusBox-border-radius);
|
61
|
-
background-color: var(--help-panel-focusBox-background-color);
|
62
|
-
color: var(--help-panel-focusBox-color);
|
63
|
-
}
|
64
|
-
|
65
|
-
[subtitle] {
|
66
|
-
font-weight: bold;
|
67
|
-
}
|
68
|
-
[subtitle]::before {
|
69
|
-
content: '';
|
70
|
-
width: 7px;
|
71
|
-
height: 7px;
|
72
|
-
display: inline-block;
|
73
|
-
border: 3px solid var(--md-sys-color-surface);
|
74
|
-
border-radius: 50%;
|
75
|
-
margin-right: var(--spacing-small);
|
76
|
-
}
|
77
|
-
p + ol,
|
78
|
-
p + ul {
|
79
|
-
font-size: var(--help-panel-content-font-size);
|
80
|
-
}
|
81
|
-
ol,
|
82
|
-
ul {
|
83
|
-
padding: 0 0 0 30px;
|
84
|
-
}
|
85
|
-
ol li,
|
86
|
-
ul li {
|
87
|
-
margin: 0 0 2px 0;
|
88
|
-
}
|
89
|
-
a {
|
90
|
-
margin-bottom: 0 !important;
|
91
|
-
color: var(--help-panel-a-color);
|
92
|
-
font-size: var(--fontsize-default);
|
93
|
-
text-decoration: underline;
|
94
|
-
}
|
95
|
-
a md-icon {
|
96
|
-
margin: 0;
|
97
|
-
|
98
|
-
--md-icon-size: var(--help-panel-a-icon-size);
|
99
|
-
}
|
100
|
-
a:hover {
|
101
|
-
background-color: var(--opacity-light-dark-color);
|
102
|
-
font-weight: bold;
|
103
|
-
}
|
104
|
-
|
105
|
-
table {
|
106
|
-
border-collapse: collapse;
|
107
|
-
border: var(--border-dim-color);
|
108
|
-
font-size: 0.9em;
|
109
|
-
}
|
110
|
-
th {
|
111
|
-
border-top: 3px solid var(--md-sys-color-on-primary-container);
|
112
|
-
background-color: var(--md-sys-color-background);
|
113
|
-
color: var(--md-sys-color-on-secondary-container);
|
114
|
-
}
|
115
|
-
th,
|
116
|
-
td {
|
117
|
-
border-bottom: var(--border-dim-color);
|
118
|
-
padding: var(--spacing-small);
|
119
|
-
}
|
120
|
-
tr:nth-child(even) {
|
121
|
-
background-color: #f6f6f6;
|
122
|
-
}
|
123
|
-
`
|
package/src/index.ts
DELETED
@@ -1,126 +0,0 @@
|
|
1
|
-
import '@material/web/icon/icon.js'
|
2
|
-
|
3
|
-
import { css, html } from 'lit'
|
4
|
-
import { customElement, property, query } from 'lit/decorators.js'
|
5
|
-
import { connect } from 'pwa-helpers/connect-mixin.js'
|
6
|
-
|
7
|
-
import Headroom from '@operato/headroom'
|
8
|
-
import { i18next, localize } from '@operato/i18n'
|
9
|
-
import { navigate, PageView, store } from '@operato/shell'
|
10
|
-
import { HeadroomStyles, ScrollbarStyles } from '@operato/styles'
|
11
|
-
|
12
|
-
@customElement('ox-help-home')
|
13
|
-
class HelpHome extends connect(store)(localize(i18next)(PageView)) {
|
14
|
-
static styles = [
|
15
|
-
ScrollbarStyles,
|
16
|
-
HeadroomStyles,
|
17
|
-
css`
|
18
|
-
:host {
|
19
|
-
display: flex;
|
20
|
-
flex-direction: column;
|
21
|
-
overflow: hidden;
|
22
|
-
position: relative;
|
23
|
-
|
24
|
-
--md-icon-size: 24px;
|
25
|
-
}
|
26
|
-
|
27
|
-
#navigation {
|
28
|
-
position: absolute;
|
29
|
-
display: flex;
|
30
|
-
width: 100%;
|
31
|
-
padding: var(--help-navigation-padding);
|
32
|
-
border-bottom: var(--help-navigation-bottom);
|
33
|
-
background-color: var(--md-sys-color-surface);
|
34
|
-
}
|
35
|
-
|
36
|
-
#navigation md-icon {
|
37
|
-
padding: var(--help-navigation-icon-padding, var(--padding-default));
|
38
|
-
border-right: var(--help-navigation-icon-border);
|
39
|
-
cursor: pointer;
|
40
|
-
color: var(--help-icon-color);
|
41
|
-
}
|
42
|
-
|
43
|
-
#content {
|
44
|
-
flex: 1;
|
45
|
-
|
46
|
-
overflow: auto;
|
47
|
-
padding: var(--help-panel-content-padding);
|
48
|
-
margin: var(--help-panel-margin);
|
49
|
-
}
|
50
|
-
|
51
|
-
#upward {
|
52
|
-
--md-icon-size: 26px;
|
53
|
-
position: absolute;
|
54
|
-
bottom: var(--data-list-fab-position-vertical);
|
55
|
-
right: var(--data-list-fab-position-horizontal);
|
56
|
-
background-color: rgba(255, 255, 255, 0.7);
|
57
|
-
border-radius: 20px;
|
58
|
-
color: var(--data-list-fab-color);
|
59
|
-
box-shadow: var(--data-list-fab-shadow);
|
60
|
-
padding: 7px;
|
61
|
-
|
62
|
-
scroll-padding-top: 65px;
|
63
|
-
}
|
64
|
-
`
|
65
|
-
]
|
66
|
-
|
67
|
-
@property({ type: String }) topic!: string
|
68
|
-
@property({ type: Boolean }) showGotoTop: boolean = false
|
69
|
-
|
70
|
-
@query('#content') content!: HTMLElement
|
71
|
-
@query('#navigation') navigation!: HTMLElement
|
72
|
-
|
73
|
-
get context() {
|
74
|
-
return {
|
75
|
-
title: i18next.t('text.help')
|
76
|
-
}
|
77
|
-
}
|
78
|
-
|
79
|
-
render() {
|
80
|
-
const src = this.topic && `/helps/${this.topic || 'index'}.md`
|
81
|
-
|
82
|
-
return html`
|
83
|
-
<ox-markdown id="content" .src=${src} toc></ox-markdown>
|
84
|
-
|
85
|
-
<div id="navigation">
|
86
|
-
<md-icon @click=${() => navigate('help')} ?disabled=${this.topic == 'index'}>home</md-icon>
|
87
|
-
<md-icon @click=${() => window.history.back()}>keyboard_arrow_left</md-icon>
|
88
|
-
<md-icon @click=${() => window.history.forward()}>keyboard_arrow_right</md-icon>
|
89
|
-
</div>
|
90
|
-
|
91
|
-
${this.showGotoTop
|
92
|
-
? html` <md-icon id="upward" @click=${(e: Event) => this.gotoTop(e)}>arrow_upward</md-icon> `
|
93
|
-
: html``}
|
94
|
-
`
|
95
|
-
}
|
96
|
-
|
97
|
-
override async firstUpdated() {
|
98
|
-
this.content.addEventListener('scroll', (e: Event) => {
|
99
|
-
this.showGotoTop = (e.target as HTMLElement)?.scrollTop !== 0
|
100
|
-
})
|
101
|
-
|
102
|
-
await this.requestUpdate()
|
103
|
-
|
104
|
-
var originPaddingTop = parseFloat(getComputedStyle(this.content, null).getPropertyValue('padding-top'))
|
105
|
-
this.content.style.paddingTop = this.navigation.clientHeight + originPaddingTop + 'px'
|
106
|
-
|
107
|
-
var headroom = new Headroom(this.navigation, {
|
108
|
-
scroller: this.content
|
109
|
-
})
|
110
|
-
|
111
|
-
headroom.init()
|
112
|
-
}
|
113
|
-
|
114
|
-
override async pageUpdated(changes: any, lifecycle: any) {
|
115
|
-
if (this.active) {
|
116
|
-
this.topic = lifecycle.params['topic'] || 'index'
|
117
|
-
this.content.scrollTop = 0
|
118
|
-
}
|
119
|
-
}
|
120
|
-
|
121
|
-
gotoTop(e: Event) {
|
122
|
-
this.content.scrollTop = 0
|
123
|
-
|
124
|
-
e.stopPropagation()
|
125
|
-
}
|
126
|
-
}
|
@@ -1,57 +0,0 @@
|
|
1
|
-
body {
|
2
|
-
--help-panel-background-color: var(--theme-white-color);
|
3
|
-
--help-panel-width: 450px;
|
4
|
-
--help-panel-margin: 0;
|
5
|
-
--help-panel-padding: var(--padding-default) 0 var(--padding-default) var(--padding-wide);
|
6
|
-
--help-panel-border-raidus: 9px;
|
7
|
-
--help-panel-box-shadow: 2px 2px 2px 0px rgba(0, 0, 0, 0.15);
|
8
|
-
--help-panel-border: 2px solid var(--primary-color);
|
9
|
-
|
10
|
-
--help-panel-color: var(--primary-text-color);
|
11
|
-
|
12
|
-
--help-panel-title-margin: var(--margin-default) 0 var(--margin-narrow) 0;
|
13
|
-
--help-panel-title-padding: 0;
|
14
|
-
--help-panel-title-background-color: rgba(var(--primary-color-rgb), 0.1);
|
15
|
-
--help-panel-h1-title-font-size: 1.6em;
|
16
|
-
--help-panel-h1-title-color: var(--primary-color);
|
17
|
-
--help-panel-h2-title-font-size: 1.3em;
|
18
|
-
--help-panel-h2-title-color: var(--secondary-color);
|
19
|
-
--help-panel-h3-title-font-size: 1.1em;
|
20
|
-
--help-panel-h3-title-color: var(--secondary-text-color);
|
21
|
-
|
22
|
-
--help-panel-content-padding: var(--padding-default) var(--padding-wide);
|
23
|
-
--help-panel-paragraph-margin: 0 0 var(--margin-default) 0;
|
24
|
-
--help-panel-font-size: 0.9em;
|
25
|
-
--help-panel-content-font-size: 0.8em;
|
26
|
-
|
27
|
-
--help-panel-focusBox-padding: var(--padding-narrow) var(--padding-default);
|
28
|
-
--help-panel-focusBox-border: 1px solid rgba(0, 0, 0, 0.2);
|
29
|
-
--help-panel-focusBox-border-radius: var(--border-radius);
|
30
|
-
--help-panel-focusBox-background-color: rgba(0, 0, 0, 0.2);
|
31
|
-
--help-panel-focusBox-color: #ffe393;
|
32
|
-
|
33
|
-
--help-panel-a-color: var(--secondary-color);
|
34
|
-
--help-panel-a-icon-size: 1.3em;
|
35
|
-
|
36
|
-
--help-icon-color: var(--secondary-color);
|
37
|
-
--help-icon-hover-color: var(--primary-color);
|
38
|
-
--help-icon-size: 18px;
|
39
|
-
--help-icon-opacity: 0.4;
|
40
|
-
--help-icon-hover-opacity: 1;
|
41
|
-
|
42
|
-
--help-navigation-padding: 0;
|
43
|
-
--help-navigation-bottom: 1px solid rgba(var(--primary-color-rgb), 0.5);
|
44
|
-
--help-navigation-icon-padding: 0;
|
45
|
-
--help-navigation-icon-border: 1px solid rgba(0, 0, 0, 0.1);
|
46
|
-
}
|
47
|
-
|
48
|
-
@media only screen and (max-width: 460px) {
|
49
|
-
body {
|
50
|
-
--help-panel-width: 100vw;
|
51
|
-
--help-panel-border-raidus: 0;
|
52
|
-
--help-panel-border: none;
|
53
|
-
--help-panel-box-shadow: none;
|
54
|
-
|
55
|
-
--help-panel-title-padding: 0 0 0 var(--padding-wide);
|
56
|
-
}
|
57
|
-
}
|
@@ -1,217 +0,0 @@
|
|
1
|
-
import '@material/web/icon/icon.js'
|
2
|
-
import '@operato/markdown/ox-markdown.js'
|
3
|
-
|
4
|
-
import { css, html, LitElement, PropertyValues } from 'lit'
|
5
|
-
import { customElement, property, query, state } from 'lit/decorators.js'
|
6
|
-
import { connect } from 'pwa-helpers/connect-mixin.js'
|
7
|
-
|
8
|
-
import Headroom from '@operato/headroom'
|
9
|
-
import { closeOverlay } from '@operato/layout'
|
10
|
-
import { navigate, store } from '@operato/shell'
|
11
|
-
import { HeadroomStyles, ScrollbarStyles } from '@operato/styles'
|
12
|
-
|
13
|
-
@customElement('ox-help-panel')
|
14
|
-
class HelpPanel extends connect(store)(LitElement) {
|
15
|
-
static styles = [
|
16
|
-
ScrollbarStyles,
|
17
|
-
HeadroomStyles,
|
18
|
-
css`
|
19
|
-
:host {
|
20
|
-
display: flex;
|
21
|
-
flex-direction: column;
|
22
|
-
background-color: var(--help-panel-background-color);
|
23
|
-
|
24
|
-
position: relative;
|
25
|
-
width: var(--help-panel-width);
|
26
|
-
max-height: 90%;
|
27
|
-
border-radius: var(--help-panel-border-raidus);
|
28
|
-
border: var(--help-panel-border);
|
29
|
-
box-shadow: var(--help-panel-box-shadow);
|
30
|
-
color: var(--help-panel-color);
|
31
|
-
margin: 4px;
|
32
|
-
|
33
|
-
overflow: hidden;
|
34
|
-
|
35
|
-
--md-icon-size: 24px;
|
36
|
-
}
|
37
|
-
|
38
|
-
:host(:focus) {
|
39
|
-
outline: none;
|
40
|
-
}
|
41
|
-
|
42
|
-
#navigation {
|
43
|
-
display: flex;
|
44
|
-
position: absolute;
|
45
|
-
width: 100%;
|
46
|
-
padding: var(--help-navigation-padding);
|
47
|
-
border-bottom: var(--help-navigation-bottom);
|
48
|
-
background-color: var(--md-sys-color-surface);
|
49
|
-
}
|
50
|
-
|
51
|
-
#navigation md-icon {
|
52
|
-
padding: var(--help-navigation-icon-padding, var(--padding-default));
|
53
|
-
border-right: var(--help-navigation-icon-border);
|
54
|
-
cursor: pointer;
|
55
|
-
color: var(--help-icon-color);
|
56
|
-
}
|
57
|
-
|
58
|
-
#close {
|
59
|
-
margin-left: auto;
|
60
|
-
border-right: 0;
|
61
|
-
}
|
62
|
-
|
63
|
-
#content {
|
64
|
-
flex: 1;
|
65
|
-
overflow: auto;
|
66
|
-
padding: var(--help-panel-content-padding);
|
67
|
-
margin: var(--help-panel-margin);
|
68
|
-
}
|
69
|
-
|
70
|
-
#upward {
|
71
|
-
--md-icon-size: 26px;
|
72
|
-
position: absolute;
|
73
|
-
bottom: var(--data-list-fab-position-vertical);
|
74
|
-
right: var(--data-list-fab-position-horizontal);
|
75
|
-
background-color: rgba(255, 255, 255, 0.7);
|
76
|
-
border-radius: 20px;
|
77
|
-
color: var(--data-list-fab-color);
|
78
|
-
box-shadow: var(--data-list-fab-shadow);
|
79
|
-
padding: 7px;
|
80
|
-
}
|
81
|
-
|
82
|
-
md-icon[filled] {
|
83
|
-
font-variation-settings: 'FILL' 1;
|
84
|
-
}
|
85
|
-
|
86
|
-
@media screen and (max-width: 460px) {
|
87
|
-
:host {
|
88
|
-
height: 100%;
|
89
|
-
max-height: 100%;
|
90
|
-
margin: 0;
|
91
|
-
}
|
92
|
-
}
|
93
|
-
`
|
94
|
-
]
|
95
|
-
|
96
|
-
@property({ type: String }) topic!: string
|
97
|
-
@property({ type: Boolean }) showGotoTop: boolean = false
|
98
|
-
|
99
|
-
@state() historyIndex: number = -1
|
100
|
-
@state() history: string[] = []
|
101
|
-
|
102
|
-
@query('#content') content!: HTMLElement
|
103
|
-
@query('#navigation') navigation!: HTMLElement
|
104
|
-
|
105
|
-
render() {
|
106
|
-
const src = this.topic && `/helps/${this.topic}.md`
|
107
|
-
|
108
|
-
return html`
|
109
|
-
<div id="navigation">
|
110
|
-
<md-icon filled @click=${() => this.goHome()} ?disabled=${this.history[0] === this.history[this.historyIndex]}>
|
111
|
-
home
|
112
|
-
</md-icon>
|
113
|
-
<md-icon filled @click=${() => this.historyBack()} ?disabled=${this.historyIndex < 1}>
|
114
|
-
keyboard_arrow_left
|
115
|
-
</md-icon>
|
116
|
-
<md-icon filled @click=${() => this.historyForward()} ?disabled=${this.historyIndex >= this.history.length - 1}>
|
117
|
-
keyboard_arrow_right
|
118
|
-
</md-icon>
|
119
|
-
<md-icon filled @click=${() => navigate(`help?topic=${this.topic}`)}> open_in_new </md-icon>
|
120
|
-
<md-icon filled id="close" @click=${() => closeOverlay('help')}> close </md-icon>
|
121
|
-
</div>
|
122
|
-
|
123
|
-
${!this.showGotoTop
|
124
|
-
? html``
|
125
|
-
: html` <md-icon filled id="upward" @click=${(e: Event) => this.gotoTop(e)}>arrow_upward</md-icon> `}
|
126
|
-
<ox-markdown id="content" .src=${src}></ox-markdown>
|
127
|
-
`
|
128
|
-
}
|
129
|
-
|
130
|
-
async firstUpdated() {
|
131
|
-
this.setupRouter()
|
132
|
-
|
133
|
-
this.content.addEventListener('scroll', (e: Event) => {
|
134
|
-
this.showGotoTop = (e.target as HTMLElement)?.scrollTop !== 0
|
135
|
-
})
|
136
|
-
|
137
|
-
await this.requestUpdate()
|
138
|
-
|
139
|
-
var originPaddingTop = parseFloat(getComputedStyle(this.content, null).getPropertyValue('padding-top'))
|
140
|
-
this.content.style.paddingTop = this.navigation.clientHeight + originPaddingTop + 'px'
|
141
|
-
|
142
|
-
var headroom = new Headroom(this.navigation, {
|
143
|
-
scroller: this.content
|
144
|
-
})
|
145
|
-
headroom.init()
|
146
|
-
}
|
147
|
-
|
148
|
-
async updated(changes: PropertyValues<this>) {
|
149
|
-
if (changes.has('topic')) {
|
150
|
-
if (this.historyIndex === -1) {
|
151
|
-
this.history = [this.topic]
|
152
|
-
this.historyIndex = 0
|
153
|
-
}
|
154
|
-
}
|
155
|
-
|
156
|
-
if (changes.has('historyIndex')) {
|
157
|
-
this.topic = this.history[this.historyIndex]
|
158
|
-
this.content.scrollTop = 0
|
159
|
-
}
|
160
|
-
}
|
161
|
-
|
162
|
-
setupRouter() {
|
163
|
-
this.addEventListener('click', e => {
|
164
|
-
if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey) {
|
165
|
-
return
|
166
|
-
}
|
167
|
-
|
168
|
-
const anchor = e.composedPath().filter(n => (n as HTMLElement).tagName === 'A')[0] as HTMLAnchorElement
|
169
|
-
if (!anchor || anchor.target || anchor.hasAttribute('download') || anchor.getAttribute('rel') === 'external') {
|
170
|
-
return
|
171
|
-
}
|
172
|
-
|
173
|
-
const href = anchor.href
|
174
|
-
const newUrl = new URL(href, document.baseURI)
|
175
|
-
if (!href || href.indexOf('mailto:') !== -1 || newUrl.origin !== location.origin) {
|
176
|
-
return
|
177
|
-
}
|
178
|
-
|
179
|
-
e.preventDefault()
|
180
|
-
e.stopPropagation()
|
181
|
-
|
182
|
-
const pathname = newUrl.pathname
|
183
|
-
const topic = newUrl.searchParams?.get('topic')
|
184
|
-
if (pathname.endsWith('/help') && topic) {
|
185
|
-
this.history = [...this.history.slice(0, this.historyIndex + 1), topic]
|
186
|
-
this.historyIndex++
|
187
|
-
this.topic = topic
|
188
|
-
} else {
|
189
|
-
navigate(href)
|
190
|
-
}
|
191
|
-
|
192
|
-
return
|
193
|
-
})
|
194
|
-
}
|
195
|
-
|
196
|
-
gotoTop(e: Event) {
|
197
|
-
this.content.scrollTop = 0
|
198
|
-
|
199
|
-
e.stopPropagation()
|
200
|
-
}
|
201
|
-
|
202
|
-
goHome() {
|
203
|
-
if (!this.history?.[0] || this.history[0] == this.topic) {
|
204
|
-
return
|
205
|
-
}
|
206
|
-
this.history.push(this.history[0])
|
207
|
-
this.historyIndex = this.history.length - 1
|
208
|
-
}
|
209
|
-
|
210
|
-
historyBack() {
|
211
|
-
this.historyIndex > 0 && this.historyIndex--
|
212
|
-
}
|
213
|
-
|
214
|
-
historyForward() {
|
215
|
-
this.history && this.historyIndex < this.history.length - 1 && this.historyIndex++
|
216
|
-
}
|
217
|
-
}
|
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
|
-
});
|