@things-factory/help 4.0.41 → 4.0.42
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/client/bootstrap.js +4 -3
- package/client/index.js +1 -5
- package/client/route.js +1 -1
- package/package.json +5 -6
- package/things-factory.config.js +2 -2
- package/client/components/help-icon.js +0 -39
- package/client/components/inline-help.js +0 -34
- package/client/components/title-with-help.js +0 -41
- package/client/controller/help.js +0 -13
- package/client/grist/help-decorated-renderer.js +0 -12
- package/client/help-style.js +0 -122
- package/client/pages/help-home.js +0 -129
- package/client/viewparts/help-panel.js +0 -216
package/client/bootstrap.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import '@operato/help/ox-help-panel.js'
|
|
2
|
+
|
|
1
3
|
import { html } from 'lit-html'
|
|
2
|
-
import { appendViewpart, VIEWPART_POSITION } from '@things-factory/layout-base'
|
|
3
4
|
|
|
4
|
-
import '
|
|
5
|
+
import { appendViewpart, VIEWPART_POSITION } from '@operato/layout'
|
|
5
6
|
|
|
6
7
|
export default function bootstrap() {
|
|
7
8
|
appendViewpart({
|
|
@@ -9,7 +10,7 @@ export default function bootstrap() {
|
|
|
9
10
|
viewpart: {
|
|
10
11
|
show: false,
|
|
11
12
|
hovering: 'edge',
|
|
12
|
-
template: html` <help-panel></help-panel> `
|
|
13
|
+
template: html` <ox-help-panel></ox-help-panel> `
|
|
13
14
|
},
|
|
14
15
|
position: VIEWPART_POSITION.ASIDEBAR
|
|
15
16
|
})
|
package/client/index.js
CHANGED
package/client/route.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/help",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.42",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -26,10 +26,9 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@material/mwc-icon": "^0.25.3",
|
|
28
28
|
"@material/mwc-icon-button": "^0.25.3",
|
|
29
|
-
"@operato/
|
|
30
|
-
"@operato/
|
|
31
|
-
"@things-factory/
|
|
32
|
-
"@things-factory/layout-base": "^4.0.41"
|
|
29
|
+
"@operato/help": "^0.3.24",
|
|
30
|
+
"@operato/layout": "^0.3.24",
|
|
31
|
+
"@things-factory/shell": "^4.0.42"
|
|
33
32
|
},
|
|
34
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "794709ebadf4ae0f89a107a86a41a381ce26b465"
|
|
35
34
|
}
|
package/things-factory.config.js
CHANGED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { LitElement, html, css } from 'lit-element'
|
|
2
|
-
import { openHelp } from '@things-factory/help'
|
|
3
|
-
|
|
4
|
-
import '@material/mwc-icon'
|
|
5
|
-
|
|
6
|
-
export class HelpIcon extends LitElement {
|
|
7
|
-
static get styles() {
|
|
8
|
-
return css`
|
|
9
|
-
mwc-icon {
|
|
10
|
-
position: relative;
|
|
11
|
-
top: 4px;
|
|
12
|
-
cursor: help;
|
|
13
|
-
opacity: var(--help-icon-opacity);
|
|
14
|
-
color: var(--help-icon-color);
|
|
15
|
-
font-size: var(--help-icon-size);
|
|
16
|
-
line-height: 0;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
mwc-icon:hover {
|
|
20
|
-
opacity: var(--help-icon-hover-opacity);
|
|
21
|
-
color: var(--help-icon-hover-color);
|
|
22
|
-
}
|
|
23
|
-
`
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
static get properties() {
|
|
27
|
-
return {
|
|
28
|
-
topic: String
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
render() {
|
|
33
|
-
const topic = this.topic
|
|
34
|
-
|
|
35
|
-
return html`${topic ? html`<mwc-icon @click=${e => openHelp(topic)}>help</mwc-icon>` : html``}`
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
customElements.define('help-icon', HelpIcon)
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { html, css, LitElement } from 'lit-element'
|
|
2
|
-
import { openHelp } from '../controller/help'
|
|
3
|
-
|
|
4
|
-
export class InlineHelp extends LitElement {
|
|
5
|
-
static get styles() {
|
|
6
|
-
return css`
|
|
7
|
-
:host {
|
|
8
|
-
display: flex;
|
|
9
|
-
align-items: center;
|
|
10
|
-
}
|
|
11
|
-
`
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
static get properties() {
|
|
15
|
-
return {
|
|
16
|
-
topic: String,
|
|
17
|
-
type: String
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
render() {
|
|
22
|
-
return html` <slot></slot> `
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
connectedCallback() {
|
|
26
|
-
super.connectedCallback()
|
|
27
|
-
|
|
28
|
-
this.renderRoot.addEventListener('click', e => {
|
|
29
|
-
openHelp(this.topic)
|
|
30
|
-
})
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
customElements.define('inline-help', InlineHelp)
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { LitElement, html, css } from 'lit-element'
|
|
2
|
-
import { openHelp } from '@things-factory/help'
|
|
3
|
-
import { i18next, localize } from '@things-factory/i18n-base'
|
|
4
|
-
|
|
5
|
-
import '@material/mwc-icon'
|
|
6
|
-
|
|
7
|
-
export class TitleWithHelp extends localize(i18next)(LitElement) {
|
|
8
|
-
static get styles() {
|
|
9
|
-
return css`
|
|
10
|
-
mwc-icon {
|
|
11
|
-
position: relative;
|
|
12
|
-
top: 4px;
|
|
13
|
-
cursor: help;
|
|
14
|
-
opacity: var(--help-icon-opacity);
|
|
15
|
-
color: var(--help-icon-color);
|
|
16
|
-
font-size: var(--help-icon-size);
|
|
17
|
-
line-height: 0;
|
|
18
|
-
}
|
|
19
|
-
mwc-icon:hover {
|
|
20
|
-
opacity: var(--help-icon-hover-opacity);
|
|
21
|
-
color: var(--help-icon-hover-color);
|
|
22
|
-
}
|
|
23
|
-
`
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
static get properties() {
|
|
27
|
-
return {
|
|
28
|
-
msgid: String,
|
|
29
|
-
topic: String
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
render() {
|
|
34
|
-
const title = i18next.t(this.msgid)
|
|
35
|
-
const topic = this.topic
|
|
36
|
-
|
|
37
|
-
return html` ${title} ${topic ? html`<mwc-icon @click=${e => openHelp(topic)}>help</mwc-icon>` : html``} `
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
customElements.define('title-with-help', TitleWithHelp)
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit-html'
|
|
2
|
-
import '../components/help-icon'
|
|
3
|
-
|
|
4
|
-
const decoratorTemplate = topic => html`<help-icon style="flex: 0;" .topic=${topic}>help</help-icon>`
|
|
5
|
-
|
|
6
|
-
export const HelpDecoratedRenderer = (value, column, record, rowIndex, field) => {
|
|
7
|
-
const { help } = column?.record
|
|
8
|
-
const text = value === undefined ? '' : value
|
|
9
|
-
|
|
10
|
-
const topic = help && help(value, column, record, rowIndex, field)
|
|
11
|
-
return topic ? html`${text} ${decoratorTemplate(topic)}` : text
|
|
12
|
-
}
|
package/client/help-style.js
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { css } from 'lit-element'
|
|
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
|
-
mwc-icon {
|
|
26
|
-
vertical-align: middle;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
img {
|
|
30
|
-
display: block;
|
|
31
|
-
margin: var(--margin-narrow) var(--margin-default);
|
|
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(--margin-narrow);
|
|
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(--theme-white-color);
|
|
74
|
-
border-radius: 50%;
|
|
75
|
-
margin-right: var(--margin-narrow);
|
|
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 mwc-icon {
|
|
96
|
-
font-size: var(--help-panel-a-icon-size);
|
|
97
|
-
margin: 0;
|
|
98
|
-
}
|
|
99
|
-
a:hover {
|
|
100
|
-
background-color: var(--opacity-light-dark-color);
|
|
101
|
-
font-weight: bold;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
table {
|
|
105
|
-
border-collapse: collapse;
|
|
106
|
-
border: var(--border-dark-color);
|
|
107
|
-
font-size: 0.9em;
|
|
108
|
-
}
|
|
109
|
-
th {
|
|
110
|
-
border-top: 3px solid var(--primary-color);
|
|
111
|
-
background-color: var(--main-section-background-color);
|
|
112
|
-
color: var(--secondary-color);
|
|
113
|
-
}
|
|
114
|
-
th,
|
|
115
|
-
td {
|
|
116
|
-
border-bottom: var(--border-dark-color);
|
|
117
|
-
padding: var(--padding-narrow);
|
|
118
|
-
}
|
|
119
|
-
tr:nth-child(even) {
|
|
120
|
-
background-color: #f6f6f6;
|
|
121
|
-
}
|
|
122
|
-
`
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import '@material/mwc-icon-button'
|
|
2
|
-
|
|
3
|
-
import { HeadroomStyles, ScrollbarStyles } from '@things-factory/styles'
|
|
4
|
-
import { PageView, navigate, store } from '@things-factory/shell'
|
|
5
|
-
import { css, html } from 'lit-element'
|
|
6
|
-
import { i18next, localize } from '@things-factory/i18n-base'
|
|
7
|
-
|
|
8
|
-
import Headroom from '@operato/headroom'
|
|
9
|
-
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
10
|
-
|
|
11
|
-
class HelpHome extends connect(store)(localize(i18next)(PageView)) {
|
|
12
|
-
static get styles() {
|
|
13
|
-
return [
|
|
14
|
-
ScrollbarStyles,
|
|
15
|
-
HeadroomStyles,
|
|
16
|
-
css`
|
|
17
|
-
:host {
|
|
18
|
-
display: flex;
|
|
19
|
-
flex-direction: column;
|
|
20
|
-
overflow: hidden;
|
|
21
|
-
position: relative;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
#navigation {
|
|
25
|
-
position: absolute;
|
|
26
|
-
display: flex;
|
|
27
|
-
width: 100%;
|
|
28
|
-
padding: var(--help-navigation-padding);
|
|
29
|
-
border-bottom: var(--help-navigation-bottom);
|
|
30
|
-
background-color: white;
|
|
31
|
-
}
|
|
32
|
-
#navigation mwc-icon-button {
|
|
33
|
-
padding: var(--help-navigation-icon-padding);
|
|
34
|
-
border-right: var(--help-navigation-icon-border);
|
|
35
|
-
cursor: pointer;
|
|
36
|
-
color: var(--help-icon-color);
|
|
37
|
-
}
|
|
38
|
-
#content {
|
|
39
|
-
flex: 1;
|
|
40
|
-
|
|
41
|
-
overflow: auto;
|
|
42
|
-
padding: var(--help-panel-content-padding);
|
|
43
|
-
margin: var(--help-panel-margin);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
#upward {
|
|
47
|
-
--mdc-icon-size: 26px;
|
|
48
|
-
position: absolute;
|
|
49
|
-
bottom: var(--data-list-fab-position-vertical);
|
|
50
|
-
right: var(--data-list-fab-position-horizontal);
|
|
51
|
-
background-color: rgba(255, 255, 255, 0.7);
|
|
52
|
-
border-radius: 20px;
|
|
53
|
-
color: var(--data-list-fab-color);
|
|
54
|
-
box-shadow: var(--data-list-fab-shadow);
|
|
55
|
-
padding: 7px;
|
|
56
|
-
|
|
57
|
-
scroll-padding-top: 65px;
|
|
58
|
-
}
|
|
59
|
-
`
|
|
60
|
-
]
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
static get properties() {
|
|
64
|
-
return {
|
|
65
|
-
topic: String,
|
|
66
|
-
showGotoTop: Boolean
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
get context() {
|
|
71
|
-
return {
|
|
72
|
-
title: i18next.t('text.help')
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
render() {
|
|
77
|
-
const src = this.topic && `/helps/${this.topic || 'index'}.md`
|
|
78
|
-
|
|
79
|
-
return html`
|
|
80
|
-
<ox-markdown id="content" .src=${src} toc></ox-markdown>
|
|
81
|
-
|
|
82
|
-
<div id="navigation">
|
|
83
|
-
<mwc-icon-button icon="home" @click=${e => navigate('help')} ?disabled=${
|
|
84
|
-
this.topic == 'index'
|
|
85
|
-
}></mwc-icon-button>
|
|
86
|
-
<mwc-icon-button icon="keyboard_arrow_left" @click=${e => window.history.back()}></mwc-icon-button icon="">
|
|
87
|
-
<mwc-icon-button icon="keyboard_arrow_right" @click=${e => window.history.forward()}></mwc-icon-button icon="">
|
|
88
|
-
</div>
|
|
89
|
-
|
|
90
|
-
${
|
|
91
|
-
this.showGotoTop ? html` <mwc-icon id="upward" @click=${e => this.gotoTop(e)}>arrow_upward</mwc-icon> ` : html``
|
|
92
|
-
}
|
|
93
|
-
`
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
async firstUpdated() {
|
|
97
|
-
var content = this.renderRoot.querySelector('#content')
|
|
98
|
-
content.addEventListener('scroll', e => {
|
|
99
|
-
this.showGotoTop = e.target.scrollTop !== 0
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
var navigation = this.renderRoot.querySelector('#navigation')
|
|
103
|
-
|
|
104
|
-
await this.requestUpdate()
|
|
105
|
-
|
|
106
|
-
var originPaddingTop = parseFloat(getComputedStyle(content, null).getPropertyValue('padding-top'))
|
|
107
|
-
content.style.paddingTop = navigation.clientHeight + originPaddingTop + 'px'
|
|
108
|
-
|
|
109
|
-
var headroom = new Headroom(navigation, {
|
|
110
|
-
scroller: content
|
|
111
|
-
})
|
|
112
|
-
headroom.init()
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
async pageUpdated(changes, lifecycle) {
|
|
116
|
-
if (this.active) {
|
|
117
|
-
this.topic = lifecycle.params['topic'] || 'index'
|
|
118
|
-
this.renderRoot.querySelector('#content').scrollTop = 0
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
gotoTop(e) {
|
|
123
|
-
this.renderRoot.querySelector('#content').scrollTop = 0
|
|
124
|
-
|
|
125
|
-
e.stopPropagation()
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
customElements.define('help-home', HelpHome)
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import '@material/mwc-icon-button'
|
|
2
|
-
import '@operato/markdown'
|
|
3
|
-
|
|
4
|
-
import { HeadroomStyles, ScrollbarStyles } from '@things-factory/styles'
|
|
5
|
-
import { LitElement, css, html } from 'lit-element'
|
|
6
|
-
import { navigate, store } from '@things-factory/shell'
|
|
7
|
-
|
|
8
|
-
import Headroom from '@operato/headroom'
|
|
9
|
-
import { closeOverlay } from '@things-factory/layout-base'
|
|
10
|
-
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
11
|
-
|
|
12
|
-
class HelpPanel extends connect(store)(LitElement) {
|
|
13
|
-
static get properties() {
|
|
14
|
-
return {
|
|
15
|
-
topic: String,
|
|
16
|
-
historyIndex: Number,
|
|
17
|
-
showGotoTop: Boolean
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
static get styles() {
|
|
22
|
-
return [
|
|
23
|
-
ScrollbarStyles,
|
|
24
|
-
HeadroomStyles,
|
|
25
|
-
css`
|
|
26
|
-
:host {
|
|
27
|
-
display: flex;
|
|
28
|
-
flex-direction: column;
|
|
29
|
-
background-color: var(--help-panel-background-color);
|
|
30
|
-
|
|
31
|
-
position: relative;
|
|
32
|
-
width: var(--help-panel-width);
|
|
33
|
-
max-height: 90%;
|
|
34
|
-
border-radius: var(--help-panel-border-raidus);
|
|
35
|
-
border: var(--help-panel-border);
|
|
36
|
-
box-shadow: var(--help-panel-box-shadow);
|
|
37
|
-
color: var(--help-panel-color);
|
|
38
|
-
margin: 4px;
|
|
39
|
-
|
|
40
|
-
overflow: hidden;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
:host(:focus) {
|
|
44
|
-
outline: none;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
#navigation {
|
|
48
|
-
display: flex;
|
|
49
|
-
position: absolute;
|
|
50
|
-
width: 100%;
|
|
51
|
-
padding: var(--help-navigation-padding);
|
|
52
|
-
border-bottom: var(--help-navigation-bottom);
|
|
53
|
-
background-color: white;
|
|
54
|
-
}
|
|
55
|
-
#navigation mwc-icon-button {
|
|
56
|
-
border-right: var(--help-navigation-icon-border);
|
|
57
|
-
cursor: pointer;
|
|
58
|
-
color: var(--help-icon-color);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
#close {
|
|
62
|
-
margin-left: auto;
|
|
63
|
-
border-right: 0;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
#content {
|
|
67
|
-
flex: 1;
|
|
68
|
-
overflow: auto;
|
|
69
|
-
padding: var(--help-panel-content-padding);
|
|
70
|
-
margin: var(--help-panel-margin);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
#upward {
|
|
74
|
-
--mdc-icon-size: 26px;
|
|
75
|
-
position: absolute;
|
|
76
|
-
bottom: var(--data-list-fab-position-vertical);
|
|
77
|
-
right: var(--data-list-fab-position-horizontal);
|
|
78
|
-
background-color: rgba(255, 255, 255, 0.7);
|
|
79
|
-
border-radius: 20px;
|
|
80
|
-
color: var(--data-list-fab-color);
|
|
81
|
-
box-shadow: var(--data-list-fab-shadow);
|
|
82
|
-
padding: 7px;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
@media screen and (max-width: 480px) {
|
|
86
|
-
:host {
|
|
87
|
-
height: 100%;
|
|
88
|
-
max-height: 100%;
|
|
89
|
-
margin: 0;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
`
|
|
93
|
-
]
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
render() {
|
|
97
|
-
return html`
|
|
98
|
-
<div id="navigation">
|
|
99
|
-
<mwc-icon-button
|
|
100
|
-
icon="home"
|
|
101
|
-
@click=${e => this.goHome()}
|
|
102
|
-
?disabled=${!this.history || this.history[0] === this.history[this.historyIndex]}
|
|
103
|
-
></mwc-icon-button>
|
|
104
|
-
<mwc-icon-button
|
|
105
|
-
icon="keyboard_arrow_left"
|
|
106
|
-
@click=${e => this.historyBack()}
|
|
107
|
-
?disabled=${!this.history || this.historyIndex < 1}
|
|
108
|
-
></mwc-icon-button>
|
|
109
|
-
<mwc-icon-button
|
|
110
|
-
icon="keyboard_arrow_right"
|
|
111
|
-
@click=${e => this.historyForward()}
|
|
112
|
-
?disabled=${!this.history || this.historyIndex >= this.history.length - 1}
|
|
113
|
-
></mwc-icon-button>
|
|
114
|
-
<mwc-icon-button icon="open_in_new" @click=${e => navigate(`help?topic=${this.topic}`)}></mwc-icon-button>
|
|
115
|
-
<mwc-icon-button icon="close" id="close" @click=${e => closeOverlay('help')}></mwc-icon-button>
|
|
116
|
-
</div>
|
|
117
|
-
${!this.showGotoTop
|
|
118
|
-
? html``
|
|
119
|
-
: html` <mwc-icon id="upward" @click=${e => this.gotoTop(e)}>arrow_upward</mwc-icon> `}
|
|
120
|
-
<ox-markdown id="content" .src=${this.topic && `/helps/${this.topic}.md`}></ox-markdown>
|
|
121
|
-
`
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
async firstUpdated() {
|
|
125
|
-
this.setupRouter()
|
|
126
|
-
|
|
127
|
-
var content = this.renderRoot.querySelector('#content')
|
|
128
|
-
content.addEventListener('scroll', e => {
|
|
129
|
-
this.showGotoTop = e.target.scrollTop !== 0
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
var navigation = this.renderRoot.querySelector('#navigation')
|
|
133
|
-
|
|
134
|
-
await this.requestUpdate()
|
|
135
|
-
|
|
136
|
-
var originPaddingTop = parseFloat(getComputedStyle(content, null).getPropertyValue('padding-top'))
|
|
137
|
-
content.style.paddingTop = navigation.clientHeight + originPaddingTop + 'px'
|
|
138
|
-
|
|
139
|
-
var headroom = new Headroom(navigation, {
|
|
140
|
-
scroller: content
|
|
141
|
-
})
|
|
142
|
-
headroom.init()
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
async updated(changed) {
|
|
146
|
-
if (changed.has('topic')) {
|
|
147
|
-
if (!this.history) {
|
|
148
|
-
this.history = [this.topic]
|
|
149
|
-
this.historyIndex = 0
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (changed.has('historyIndex')) {
|
|
154
|
-
this.topic = this.history[this.historyIndex]
|
|
155
|
-
this.renderRoot.querySelector('#content').scrollTop = 0
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
setupRouter() {
|
|
160
|
-
this.addEventListener('click', e => {
|
|
161
|
-
if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey) {
|
|
162
|
-
return
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
const anchor = e.composedPath().filter(n => n.tagName === 'A')[0]
|
|
166
|
-
if (!anchor || anchor.target || anchor.hasAttribute('download') || anchor.getAttribute('rel') === 'external') {
|
|
167
|
-
return
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const href = anchor.href
|
|
171
|
-
const newUrl = new URL(href)
|
|
172
|
-
if (!href || href.indexOf('mailto:') !== -1 || newUrl.origin !== location.origin) {
|
|
173
|
-
return
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
e.preventDefault()
|
|
177
|
-
e.stopPropagation()
|
|
178
|
-
|
|
179
|
-
const pathname = newUrl.pathname
|
|
180
|
-
const topic = newUrl.searchParams?.get('topic')
|
|
181
|
-
if (pathname === '/help' && topic) {
|
|
182
|
-
this.history = [...this.history.slice(0, this.historyIndex + 1), topic]
|
|
183
|
-
this.historyIndex++
|
|
184
|
-
this.topic = topic
|
|
185
|
-
} else {
|
|
186
|
-
navigate(href)
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
return
|
|
190
|
-
})
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
gotoTop(e) {
|
|
194
|
-
this.renderRoot.querySelector('#content').scrollTop = 0
|
|
195
|
-
|
|
196
|
-
e.stopPropagation()
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
goHome() {
|
|
200
|
-
if (!this.history?.[0] || this.history[0] == this.topic) {
|
|
201
|
-
return
|
|
202
|
-
}
|
|
203
|
-
this.history.push(this.history[0])
|
|
204
|
-
this.historyIndex = this.history.length - 1
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
historyBack() {
|
|
208
|
-
this.historyIndex > 0 && this.historyIndex--
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
historyForward() {
|
|
212
|
-
this.history && this.historyIndex < this.history.length - 1 && this.historyIndex++
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
customElements.define('help-panel', HelpPanel)
|