@operato/help 0.3.22
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/.editorconfig +29 -0
- package/.storybook/main.js +3 -0
- package/.storybook/server.mjs +8 -0
- package/CHANGELOG.md +260 -0
- package/LICENSE +21 -0
- package/README.md +75 -0
- package/demo/index.html +32 -0
- package/dist/src/components/ox-help-icon.d.ts +7 -0
- package/dist/src/components/ox-help-icon.js +35 -0
- package/dist/src/components/ox-help-icon.js.map +1 -0
- package/dist/src/components/ox-inline-help.d.ts +8 -0
- package/dist/src/components/ox-inline-help.js +32 -0
- package/dist/src/components/ox-inline-help.js.map +1 -0
- package/dist/src/components/ox-title-with-help.d.ts +10 -0
- package/dist/src/components/ox-title-with-help.js +40 -0
- package/dist/src/components/ox-title-with-help.js.map +1 -0
- package/dist/src/controller/help.d.ts +2 -0
- package/dist/src/controller/help.js +12 -0
- package/dist/src/controller/help.js.map +1 -0
- package/dist/src/grist/help-decorated-renderer.d.ts +3 -0
- package/dist/src/grist/help-decorated-renderer.js +10 -0
- package/dist/src/grist/help-decorated-renderer.js.map +1 -0
- package/dist/src/help-style.d.ts +1 -0
- package/dist/src/help-style.js +122 -0
- package/dist/src/help-style.js.map +1 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.js +6 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/pages/ox-help-home.d.ts +1 -0
- package/dist/src/pages/ox-help-home.js +123 -0
- package/dist/src/pages/ox-help-home.js.map +1 -0
- package/dist/src/viewparts/ox-help-panel.d.ts +2 -0
- package/dist/src/viewparts/ox-help-panel.js +214 -0
- package/dist/src/viewparts/ox-help-panel.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +84 -0
- package/src/components/ox-help-icon.ts +34 -0
- package/src/components/ox-inline-help.ts +29 -0
- package/src/components/ox-title-with-help.ts +39 -0
- package/src/controller/help.ts +13 -0
- package/src/grist/help-decorated-renderer.ts +19 -0
- package/src/help-style.ts +122 -0
- package/src/index.ts +5 -0
- package/src/pages/ox-help-home.ts +127 -0
- package/src/themes/help-theme.css +57 -0
- package/src/viewparts/ox-help-panel.ts +213 -0
- package/tsconfig.json +23 -0
- package/web-dev-server.config.mjs +27 -0
- package/web-test-runner.config.mjs +41 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const HelpStyle = css `
|
|
3
|
+
h1 {
|
|
4
|
+
background-color: var(--help-panel-title-background-color);
|
|
5
|
+
margin: var(--help-panel-title-margin);
|
|
6
|
+
padding: var(--help-panel-title-padding);
|
|
7
|
+
font-size: var(--help-panel-h1-title-font-size);
|
|
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: var(--help-panel-h2-title-font-size);
|
|
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: var(--help-panel-h3-title-font-size);
|
|
22
|
+
color: var(--help-panel-h3-title-color);
|
|
23
|
+
}
|
|
24
|
+
mwc-icon {
|
|
25
|
+
vertical-align: middle;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
img {
|
|
29
|
+
display: block;
|
|
30
|
+
margin: var(--margin-narrow) var(--margin-default);
|
|
31
|
+
max-width: 100%;
|
|
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(--margin-narrow);
|
|
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(--theme-white-color);
|
|
73
|
+
border-radius: 50%;
|
|
74
|
+
margin-right: var(--margin-narrow);
|
|
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 mwc-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-dark-color);
|
|
106
|
+
font-size: 0.9em;
|
|
107
|
+
}
|
|
108
|
+
th {
|
|
109
|
+
border-top: 3px solid var(--primary-color);
|
|
110
|
+
background-color: var(--main-section-background-color);
|
|
111
|
+
color: var(--secondary-color);
|
|
112
|
+
}
|
|
113
|
+
th,
|
|
114
|
+
td {
|
|
115
|
+
border-bottom: var(--border-dark-color);
|
|
116
|
+
padding: var(--padding-narrow);
|
|
117
|
+
}
|
|
118
|
+
tr:nth-child(even) {
|
|
119
|
+
background-color: #f6f6f6;
|
|
120
|
+
}
|
|
121
|
+
`;
|
|
122
|
+
//# sourceMappingURL=help-style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help-style.js","sourceRoot":"","sources":["../../src/help-style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuH3B,CAAA","sourcesContent":["import { css } from 'lit'\n\nexport const HelpStyle = css`\n h1 {\n background-color: var(--help-panel-title-background-color);\n margin: var(--help-panel-title-margin);\n padding: var(--help-panel-title-padding);\n font-size: var(--help-panel-h1-title-font-size);\n text-transform: capitalize;\n color: var(--help-panel-h1-title-color);\n }\n h2 {\n margin: var(--help-panel-title-margin);\n padding: var(--help-panel-title-padding);\n font-size: var(--help-panel-h2-title-font-size);\n color: var(--help-panel-h2-title-color);\n text-transform: capitalize;\n }\n h3 {\n margin: var(--help-panel-title-margin);\n padding: var(--help-panel-title-padding);\n font-size: var(--help-panel-h3-title-font-size);\n color: var(--help-panel-h3-title-color);\n }\n mwc-icon {\n vertical-align: middle;\n }\n\n img {\n display: block;\n margin: var(--margin-narrow) var(--margin-default);\n max-width: 100%;\n }\n img[src*='#icon25'] {\n width: 25px;\n height: 25px;\n }\n img[src*='#icon50'] {\n width: 50px;\n height: 50px;\n }\n img[src*='#icon100'] {\n width: 100px;\n height: 100px;\n }\n img[src*='#icon25inlined'],\n img[src*='#icon50inlined'],\n img[src*='#icon100inlined'] {\n display: inline-block;\n margin: var(--margin-narrow);\n }\n p {\n margin: var(--help-panel-paragraph-margin);\n font-size: var(--help-panel-font-size);\n }\n [focusBox] {\n display: block;\n padding: var(--help-panel-focusBox-padding);\n border: var(--help-panel-focusBox-border);\n border-radius: var(--help-panel-focusBox-border-radius);\n background-color: var(--help-panel-focusBox-background-color);\n color: var(--help-panel-focusBox-color);\n }\n\n [subtitle] {\n font-weight: bold;\n }\n [subtitle]::before {\n content: '';\n width: 7px;\n height: 7px;\n display: inline-block;\n border: 3px solid var(--theme-white-color);\n border-radius: 50%;\n margin-right: var(--margin-narrow);\n }\n p + ol,\n p + ul {\n font-size: var(--help-panel-content-font-size);\n }\n ol,\n ul {\n padding: 0 0 0 30px;\n }\n ol li,\n ul li {\n margin: 0 0 2px 0;\n }\n a {\n margin-bottom: 0 !important;\n color: var(--help-panel-a-color);\n font-size: var(--fontsize-default);\n text-decoration: underline;\n }\n a mwc-icon {\n font-size: var(--help-panel-a-icon-size);\n margin: 0;\n }\n a:hover {\n background-color: var(--opacity-light-dark-color);\n font-weight: bold;\n }\n\n table {\n border-collapse: collapse;\n border: var(--border-dark-color);\n font-size: 0.9em;\n }\n th {\n border-top: 3px solid var(--primary-color);\n background-color: var(--main-section-background-color);\n color: var(--secondary-color);\n }\n th,\n td {\n border-bottom: var(--border-dark-color);\n padding: var(--padding-narrow);\n }\n tr:nth-child(even) {\n background-color: #f6f6f6;\n }\n`\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './controller/help.js';
|
|
2
|
+
export * from './grist/help-decorated-renderer.js';
|
|
3
|
+
export * from './components/ox-inline-help.js';
|
|
4
|
+
export * from './components/ox-title-with-help.js';
|
|
5
|
+
export * from './components/ox-help-icon.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,oCAAoC,CAAA;AAClD,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oCAAoC,CAAA;AAClD,cAAc,8BAA8B,CAAA","sourcesContent":["export * from './controller/help.js'\nexport * from './grist/help-decorated-renderer.js'\nexport * from './components/ox-inline-help.js'\nexport * from './components/ox-title-with-help.js'\nexport * from './components/ox-help-icon.js'\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@material/mwc-icon-button';
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import '@material/mwc-icon-button';
|
|
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
|
+
import Headroom from '@operato/headroom';
|
|
7
|
+
import { i18next, localize } from '@operato/i18n';
|
|
8
|
+
import { navigate, PageView, store } from '@operato/shell';
|
|
9
|
+
import { HeadroomStyles, ScrollbarStyles } from '@operato/styles';
|
|
10
|
+
let HelpHome = class HelpHome extends connect(store)(localize(i18next)(PageView)) {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.showGotoTop = false;
|
|
14
|
+
}
|
|
15
|
+
get context() {
|
|
16
|
+
return {
|
|
17
|
+
title: i18next.t('text.help')
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
render() {
|
|
21
|
+
const src = this.topic && `/helps/${this.topic || 'index'}.md`;
|
|
22
|
+
return html `
|
|
23
|
+
<ox-markdown id="content" .src=${src} toc></ox-markdown>
|
|
24
|
+
|
|
25
|
+
<div id="navigation">
|
|
26
|
+
<mwc-icon-button icon="home" @click=${() => navigate('help')} ?disabled=${this.topic == 'index'}></mwc-icon-button>
|
|
27
|
+
<mwc-icon-button icon="keyboard_arrow_left" @click=${() => window.history.back()}></mwc-icon-button icon="">
|
|
28
|
+
<mwc-icon-button icon="keyboard_arrow_right" @click=${() => window.history.forward()}></mwc-icon-button icon="">
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
${this.showGotoTop
|
|
32
|
+
? html ` <mwc-icon id="upward" @click=${(e) => this.gotoTop(e)}>arrow_upward</mwc-icon> `
|
|
33
|
+
: html ``}
|
|
34
|
+
`;
|
|
35
|
+
}
|
|
36
|
+
async firstUpdated() {
|
|
37
|
+
this.content.addEventListener('scroll', (e) => {
|
|
38
|
+
var _a;
|
|
39
|
+
this.showGotoTop = ((_a = e.target) === null || _a === void 0 ? void 0 : _a.scrollTop) !== 0;
|
|
40
|
+
});
|
|
41
|
+
await this.requestUpdate();
|
|
42
|
+
var originPaddingTop = parseFloat(getComputedStyle(this.content, null).getPropertyValue('padding-top'));
|
|
43
|
+
this.content.style.paddingTop = this.navigation.clientHeight + originPaddingTop + 'px';
|
|
44
|
+
var headroom = new Headroom(this.navigation, {
|
|
45
|
+
scroller: this.content
|
|
46
|
+
});
|
|
47
|
+
headroom.init();
|
|
48
|
+
}
|
|
49
|
+
async pageUpdated(changes, lifecycle) {
|
|
50
|
+
if (this.active) {
|
|
51
|
+
this.topic = lifecycle.params['topic'] || 'index';
|
|
52
|
+
this.content.scrollTop = 0;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
gotoTop(e) {
|
|
56
|
+
this.content.scrollTop = 0;
|
|
57
|
+
e.stopPropagation();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
HelpHome.styles = [
|
|
61
|
+
ScrollbarStyles,
|
|
62
|
+
HeadroomStyles,
|
|
63
|
+
css `
|
|
64
|
+
:host {
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-direction: column;
|
|
67
|
+
overflow: hidden;
|
|
68
|
+
position: relative;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
#navigation {
|
|
72
|
+
position: absolute;
|
|
73
|
+
display: flex;
|
|
74
|
+
width: 100%;
|
|
75
|
+
padding: var(--help-navigation-padding);
|
|
76
|
+
border-bottom: var(--help-navigation-bottom);
|
|
77
|
+
background-color: white;
|
|
78
|
+
}
|
|
79
|
+
#navigation mwc-icon-button {
|
|
80
|
+
padding: var(--help-navigation-icon-padding);
|
|
81
|
+
border-right: var(--help-navigation-icon-border);
|
|
82
|
+
cursor: pointer;
|
|
83
|
+
color: var(--help-icon-color);
|
|
84
|
+
}
|
|
85
|
+
#content {
|
|
86
|
+
flex: 1;
|
|
87
|
+
|
|
88
|
+
overflow: auto;
|
|
89
|
+
padding: var(--help-panel-content-padding);
|
|
90
|
+
margin: var(--help-panel-margin);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
#upward {
|
|
94
|
+
--mdc-icon-size: 26px;
|
|
95
|
+
position: absolute;
|
|
96
|
+
bottom: var(--data-list-fab-position-vertical);
|
|
97
|
+
right: var(--data-list-fab-position-horizontal);
|
|
98
|
+
background-color: rgba(255, 255, 255, 0.7);
|
|
99
|
+
border-radius: 20px;
|
|
100
|
+
color: var(--data-list-fab-color);
|
|
101
|
+
box-shadow: var(--data-list-fab-shadow);
|
|
102
|
+
padding: 7px;
|
|
103
|
+
|
|
104
|
+
scroll-padding-top: 65px;
|
|
105
|
+
}
|
|
106
|
+
`
|
|
107
|
+
];
|
|
108
|
+
__decorate([
|
|
109
|
+
property({ type: String })
|
|
110
|
+
], HelpHome.prototype, "topic", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
property({ type: Boolean })
|
|
113
|
+
], HelpHome.prototype, "showGotoTop", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
query('#content')
|
|
116
|
+
], HelpHome.prototype, "content", void 0);
|
|
117
|
+
__decorate([
|
|
118
|
+
query('#navigation')
|
|
119
|
+
], HelpHome.prototype, "navigation", void 0);
|
|
120
|
+
HelpHome = __decorate([
|
|
121
|
+
customElement('ox-help-home')
|
|
122
|
+
], HelpHome);
|
|
123
|
+
//# sourceMappingURL=ox-help-home.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ox-help-home.js","sourceRoot":"","sources":["../../../src/pages/ox-help-home.ts"],"names":[],"mappings":";AAAA,OAAO,2BAA2B,CAAA;AAElC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,QAAQ,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAGjE,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC;IAAlE;;QAmD+B,gBAAW,GAAY,KAAK,CAAA;IA+D3D,CAAC;IA1DC,IAAI,OAAO;QACT,OAAO;YACL,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC;SAC9B,CAAA;IACH,CAAC;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,EAAE,CAAA;IACjB,CAAC;IAEQ,KAAK,CAAC,WAAW,CAAC,OAAY,EAAE,SAAc;QACrD,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,OAAO,CAAA;YACjD,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,CAAC,CAAA;SAC3B;IACH,CAAC;IAED,OAAO,CAAC,CAAQ;QACd,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,CAAC,CAAA;QAE1B,CAAC,CAAC,eAAe,EAAE,CAAA;IACrB,CAAC;CACF,CAAA;AAjHQ,eAAM,GAAG;IACd,eAAe;IACf,cAAc;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2CF;CACF,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAe;AACb;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CAA6B;AAEtC;IAAlB,KAAK,CAAC,UAAU,CAAC;yCAAsB;AAClB;IAArB,KAAK,CAAC,aAAa,CAAC;4CAAyB;AAtD1C,QAAQ;IADb,aAAa,CAAC,cAAc,CAAC;GACxB,QAAQ,CAkHb","sourcesContent":["import '@material/mwc-icon-button'\n\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport Headroom from '@operato/headroom'\nimport { i18next, localize } from '@operato/i18n'\nimport { navigate, PageView, store } from '@operato/shell'\nimport { HeadroomStyles, ScrollbarStyles } from '@operato/styles'\n\n@customElement('ox-help-home')\nclass HelpHome extends connect(store)(localize(i18next)(PageView)) {\n static styles = [\n ScrollbarStyles,\n HeadroomStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n overflow: hidden;\n position: relative;\n }\n\n #navigation {\n position: absolute;\n display: flex;\n width: 100%;\n padding: var(--help-navigation-padding);\n border-bottom: var(--help-navigation-bottom);\n background-color: white;\n }\n #navigation mwc-icon-button {\n padding: var(--help-navigation-icon-padding);\n border-right: var(--help-navigation-icon-border);\n cursor: pointer;\n color: var(--help-icon-color);\n }\n #content {\n flex: 1;\n\n overflow: auto;\n padding: var(--help-panel-content-padding);\n margin: var(--help-panel-margin);\n }\n\n #upward {\n --mdc-icon-size: 26px;\n position: absolute;\n bottom: var(--data-list-fab-position-vertical);\n right: var(--data-list-fab-position-horizontal);\n background-color: rgba(255, 255, 255, 0.7);\n border-radius: 20px;\n color: var(--data-list-fab-color);\n box-shadow: var(--data-list-fab-shadow);\n padding: 7px;\n\n scroll-padding-top: 65px;\n }\n `\n ]\n\n @property({ type: String }) topic!: string\n @property({ type: Boolean }) showGotoTop: boolean = false\n\n @query('#content') content!: HTMLElement\n @query('#navigation') navigation!: HTMLElement\n\n get context() {\n return {\n title: i18next.t('text.help')\n }\n }\n\n render() {\n const src = this.topic && `/helps/${this.topic || 'index'}.md`\n\n return html`\n <ox-markdown id=\"content\" .src=${src} toc></ox-markdown>\n\n <div id=\"navigation\">\n <mwc-icon-button icon=\"home\" @click=${() => navigate('help')} ?disabled=${\n this.topic == 'index'\n }></mwc-icon-button>\n <mwc-icon-button icon=\"keyboard_arrow_left\" @click=${() => window.history.back()}></mwc-icon-button icon=\"\">\n <mwc-icon-button icon=\"keyboard_arrow_right\" @click=${() =>\n window.history.forward()}></mwc-icon-button icon=\"\">\n </div> \n\n ${\n this.showGotoTop\n ? html` <mwc-icon id=\"upward\" @click=${(e: Event) => this.gotoTop(e)}>arrow_upward</mwc-icon> `\n : html``\n }\n `\n }\n\n override async firstUpdated() {\n this.content.addEventListener('scroll', (e: Event) => {\n this.showGotoTop = (e.target as HTMLElement)?.scrollTop !== 0\n })\n\n await this.requestUpdate()\n\n var originPaddingTop = parseFloat(getComputedStyle(this.content, null).getPropertyValue('padding-top'))\n this.content.style.paddingTop = this.navigation.clientHeight + originPaddingTop + 'px'\n\n var headroom = new Headroom(this.navigation, {\n scroller: this.content\n })\n\n headroom.init()\n }\n\n override async pageUpdated(changes: any, lifecycle: any) {\n if (this.active) {\n this.topic = lifecycle.params['topic'] || 'index'\n this.content.scrollTop = 0\n }\n }\n\n gotoTop(e: Event) {\n this.content.scrollTop = 0\n\n e.stopPropagation()\n }\n}\n"]}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import '@material/mwc-icon-button';
|
|
3
|
+
import '@operato/markdown/ox-markdown.js';
|
|
4
|
+
import { css, html, LitElement } from 'lit';
|
|
5
|
+
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
6
|
+
import { connect } from 'pwa-helpers/connect-mixin.js';
|
|
7
|
+
import Headroom from '@operato/headroom';
|
|
8
|
+
import { closeOverlay } from '@operato/layout';
|
|
9
|
+
import { navigate, store } from '@operato/shell';
|
|
10
|
+
import { HeadroomStyles, ScrollbarStyles } from '@operato/styles';
|
|
11
|
+
let HelpPanel = class HelpPanel extends connect(store)(LitElement) {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.showGotoTop = false;
|
|
15
|
+
this.historyIndex = 0;
|
|
16
|
+
this.history = [];
|
|
17
|
+
}
|
|
18
|
+
render() {
|
|
19
|
+
return html `
|
|
20
|
+
<div id="navigation">
|
|
21
|
+
<mwc-icon-button
|
|
22
|
+
icon="home"
|
|
23
|
+
@click=${() => this.goHome()}
|
|
24
|
+
?disabled=${this.history[0] === this.history[this.historyIndex]}
|
|
25
|
+
></mwc-icon-button>
|
|
26
|
+
<mwc-icon-button
|
|
27
|
+
icon="keyboard_arrow_left"
|
|
28
|
+
@click=${() => this.historyBack()}
|
|
29
|
+
?disabled=${this.historyIndex < 1}
|
|
30
|
+
></mwc-icon-button>
|
|
31
|
+
<mwc-icon-button
|
|
32
|
+
icon="keyboard_arrow_right"
|
|
33
|
+
@click=${() => this.historyForward()}
|
|
34
|
+
?disabled=${this.historyIndex >= this.history.length - 1}
|
|
35
|
+
></mwc-icon-button>
|
|
36
|
+
<mwc-icon-button icon="open_in_new" @click=${() => navigate(`help?topic=${this.topic}`)}></mwc-icon-button>
|
|
37
|
+
<mwc-icon-button icon="close" id="close" @click=${() => closeOverlay('help')}></mwc-icon-button>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
${!this.showGotoTop
|
|
41
|
+
? html ``
|
|
42
|
+
: html ` <mwc-icon id="upward" @click=${(e) => this.gotoTop(e)}>arrow_upward</mwc-icon> `}
|
|
43
|
+
<ox-markdown id="content" .src=${this.topic && `/helps/${this.topic}.md`}></ox-markdown>
|
|
44
|
+
`;
|
|
45
|
+
}
|
|
46
|
+
async firstUpdated() {
|
|
47
|
+
this.setupRouter();
|
|
48
|
+
this.content.addEventListener('scroll', (e) => {
|
|
49
|
+
var _a;
|
|
50
|
+
this.showGotoTop = ((_a = e.target) === null || _a === void 0 ? void 0 : _a.scrollTop) !== 0;
|
|
51
|
+
});
|
|
52
|
+
await this.requestUpdate();
|
|
53
|
+
var originPaddingTop = parseFloat(getComputedStyle(this.content, null).getPropertyValue('padding-top'));
|
|
54
|
+
this.content.style.paddingTop = this.navigation.clientHeight + originPaddingTop + 'px';
|
|
55
|
+
var headroom = new Headroom(this.navigation, {
|
|
56
|
+
scroller: this.content
|
|
57
|
+
});
|
|
58
|
+
headroom.init();
|
|
59
|
+
}
|
|
60
|
+
async updated(changes) {
|
|
61
|
+
if (changes.has('topic')) {
|
|
62
|
+
if (!this.history) {
|
|
63
|
+
this.history = [this.topic];
|
|
64
|
+
this.historyIndex = 0;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (changes.has('historyIndex')) {
|
|
68
|
+
this.topic = this.history[this.historyIndex];
|
|
69
|
+
this.content.scrollTop = 0;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
setupRouter() {
|
|
73
|
+
this.addEventListener('click', e => {
|
|
74
|
+
var _a;
|
|
75
|
+
if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const anchor = e.composedPath().filter(n => n.tagName === 'A')[0];
|
|
79
|
+
if (!anchor || anchor.target || anchor.hasAttribute('download') || anchor.getAttribute('rel') === 'external') {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const href = anchor.href;
|
|
83
|
+
const newUrl = new URL(href);
|
|
84
|
+
if (!href || href.indexOf('mailto:') !== -1 || newUrl.origin !== location.origin) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
e.preventDefault();
|
|
88
|
+
e.stopPropagation();
|
|
89
|
+
const pathname = newUrl.pathname;
|
|
90
|
+
const topic = (_a = newUrl.searchParams) === null || _a === void 0 ? void 0 : _a.get('topic');
|
|
91
|
+
if (pathname === '/help' && topic) {
|
|
92
|
+
this.history = [...this.history.slice(0, this.historyIndex + 1), topic];
|
|
93
|
+
this.historyIndex++;
|
|
94
|
+
this.topic = topic;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
navigate(href);
|
|
98
|
+
}
|
|
99
|
+
return;
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
gotoTop(e) {
|
|
103
|
+
this.content.scrollTop = 0;
|
|
104
|
+
e.stopPropagation();
|
|
105
|
+
}
|
|
106
|
+
goHome() {
|
|
107
|
+
var _a;
|
|
108
|
+
if (!((_a = this.history) === null || _a === void 0 ? void 0 : _a[0]) || this.history[0] == this.topic) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
this.history.push(this.history[0]);
|
|
112
|
+
this.historyIndex = this.history.length - 1;
|
|
113
|
+
}
|
|
114
|
+
historyBack() {
|
|
115
|
+
this.historyIndex > 0 && this.historyIndex--;
|
|
116
|
+
}
|
|
117
|
+
historyForward() {
|
|
118
|
+
this.history && this.historyIndex < this.history.length - 1 && this.historyIndex++;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
HelpPanel.styles = [
|
|
122
|
+
ScrollbarStyles,
|
|
123
|
+
HeadroomStyles,
|
|
124
|
+
css `
|
|
125
|
+
:host {
|
|
126
|
+
display: flex;
|
|
127
|
+
flex-direction: column;
|
|
128
|
+
background-color: var(--help-panel-background-color);
|
|
129
|
+
|
|
130
|
+
position: relative;
|
|
131
|
+
width: var(--help-panel-width);
|
|
132
|
+
max-height: 90%;
|
|
133
|
+
border-radius: var(--help-panel-border-raidus);
|
|
134
|
+
border: var(--help-panel-border);
|
|
135
|
+
box-shadow: var(--help-panel-box-shadow);
|
|
136
|
+
color: var(--help-panel-color);
|
|
137
|
+
margin: 4px;
|
|
138
|
+
|
|
139
|
+
overflow: hidden;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
:host(:focus) {
|
|
143
|
+
outline: none;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
#navigation {
|
|
147
|
+
display: flex;
|
|
148
|
+
position: absolute;
|
|
149
|
+
width: 100%;
|
|
150
|
+
padding: var(--help-navigation-padding);
|
|
151
|
+
border-bottom: var(--help-navigation-bottom);
|
|
152
|
+
background-color: white;
|
|
153
|
+
}
|
|
154
|
+
#navigation mwc-icon-button {
|
|
155
|
+
border-right: var(--help-navigation-icon-border);
|
|
156
|
+
cursor: pointer;
|
|
157
|
+
color: var(--help-icon-color);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
#close {
|
|
161
|
+
margin-left: auto;
|
|
162
|
+
border-right: 0;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
#content {
|
|
166
|
+
flex: 1;
|
|
167
|
+
overflow: auto;
|
|
168
|
+
padding: var(--help-panel-content-padding);
|
|
169
|
+
margin: var(--help-panel-margin);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
#upward {
|
|
173
|
+
--mdc-icon-size: 26px;
|
|
174
|
+
position: absolute;
|
|
175
|
+
bottom: var(--data-list-fab-position-vertical);
|
|
176
|
+
right: var(--data-list-fab-position-horizontal);
|
|
177
|
+
background-color: rgba(255, 255, 255, 0.7);
|
|
178
|
+
border-radius: 20px;
|
|
179
|
+
color: var(--data-list-fab-color);
|
|
180
|
+
box-shadow: var(--data-list-fab-shadow);
|
|
181
|
+
padding: 7px;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
@media screen and (max-width: 480px) {
|
|
185
|
+
:host {
|
|
186
|
+
height: 100%;
|
|
187
|
+
max-height: 100%;
|
|
188
|
+
margin: 0;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
`
|
|
192
|
+
];
|
|
193
|
+
__decorate([
|
|
194
|
+
property({ type: String })
|
|
195
|
+
], HelpPanel.prototype, "topic", void 0);
|
|
196
|
+
__decorate([
|
|
197
|
+
property({ type: Boolean })
|
|
198
|
+
], HelpPanel.prototype, "showGotoTop", void 0);
|
|
199
|
+
__decorate([
|
|
200
|
+
state()
|
|
201
|
+
], HelpPanel.prototype, "historyIndex", void 0);
|
|
202
|
+
__decorate([
|
|
203
|
+
state()
|
|
204
|
+
], HelpPanel.prototype, "history", void 0);
|
|
205
|
+
__decorate([
|
|
206
|
+
query('#content')
|
|
207
|
+
], HelpPanel.prototype, "content", void 0);
|
|
208
|
+
__decorate([
|
|
209
|
+
query('#navigation')
|
|
210
|
+
], HelpPanel.prototype, "navigation", void 0);
|
|
211
|
+
HelpPanel = __decorate([
|
|
212
|
+
customElement('ox-help-panel')
|
|
213
|
+
], HelpPanel);
|
|
214
|
+
//# sourceMappingURL=ox-help-panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ox-help-panel.js","sourceRoot":"","sources":["../../../src/viewparts/ox-help-panel.ts"],"names":[],"mappings":";AAAA,OAAO,2BAA2B,CAAA;AAClC,OAAO,kCAAkC,CAAA;AAEzC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,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5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;8CAA6B;AAEhD;IAAR,KAAK,EAAE;+CAAyB;AACxB;IAAR,KAAK,EAAE;0CAAuB;AAEZ;IAAlB,KAAK,CAAC,UAAU,CAAC;0CAAsB;AAClB;IAArB,KAAK,CAAC,aAAa,CAAC;6CAAyB;AAjF1C,SAAS;IADd,aAAa,CAAC,eAAe,CAAC;GACzB,SAAS,CAuMd","sourcesContent":["import '@material/mwc-icon-button'\nimport '@operato/markdown/ox-markdown.js'\n\nimport { css, html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport Headroom from '@operato/headroom'\nimport { closeOverlay } from '@operato/layout'\nimport { navigate, store } from '@operato/shell'\nimport { HeadroomStyles, ScrollbarStyles } from '@operato/styles'\n\n@customElement('ox-help-panel')\nclass HelpPanel extends connect(store)(LitElement) {\n static styles = [\n ScrollbarStyles,\n HeadroomStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n background-color: var(--help-panel-background-color);\n\n position: relative;\n width: var(--help-panel-width);\n max-height: 90%;\n border-radius: var(--help-panel-border-raidus);\n border: var(--help-panel-border);\n box-shadow: var(--help-panel-box-shadow);\n color: var(--help-panel-color);\n margin: 4px;\n\n overflow: hidden;\n }\n\n :host(:focus) {\n outline: none;\n }\n\n #navigation {\n display: flex;\n position: absolute;\n width: 100%;\n padding: var(--help-navigation-padding);\n border-bottom: var(--help-navigation-bottom);\n background-color: white;\n }\n #navigation mwc-icon-button {\n border-right: var(--help-navigation-icon-border);\n cursor: pointer;\n color: var(--help-icon-color);\n }\n\n #close {\n margin-left: auto;\n border-right: 0;\n }\n\n #content {\n flex: 1;\n overflow: auto;\n padding: var(--help-panel-content-padding);\n margin: var(--help-panel-margin);\n }\n\n #upward {\n --mdc-icon-size: 26px;\n position: absolute;\n bottom: var(--data-list-fab-position-vertical);\n right: var(--data-list-fab-position-horizontal);\n background-color: rgba(255, 255, 255, 0.7);\n border-radius: 20px;\n color: var(--data-list-fab-color);\n box-shadow: var(--data-list-fab-shadow);\n padding: 7px;\n }\n\n @media screen and (max-width: 480px) {\n :host {\n height: 100%;\n max-height: 100%;\n margin: 0;\n }\n }\n `\n ]\n\n @property({ type: String }) topic!: string\n @property({ type: Boolean }) showGotoTop: boolean = false\n\n @state() historyIndex: number = 0\n @state() history: string[] = []\n\n @query('#content') content!: HTMLElement\n @query('#navigation') navigation!: HTMLElement\n\n render() {\n return html`\n <div id=\"navigation\">\n <mwc-icon-button\n icon=\"home\"\n @click=${() => this.goHome()}\n ?disabled=${this.history[0] === this.history[this.historyIndex]}\n ></mwc-icon-button>\n <mwc-icon-button\n icon=\"keyboard_arrow_left\"\n @click=${() => this.historyBack()}\n ?disabled=${this.historyIndex < 1}\n ></mwc-icon-button>\n <mwc-icon-button\n icon=\"keyboard_arrow_right\"\n @click=${() => this.historyForward()}\n ?disabled=${this.historyIndex >= this.history.length - 1}\n ></mwc-icon-button>\n <mwc-icon-button icon=\"open_in_new\" @click=${() => navigate(`help?topic=${this.topic}`)}></mwc-icon-button>\n <mwc-icon-button icon=\"close\" id=\"close\" @click=${() => closeOverlay('help')}></mwc-icon-button>\n </div>\n\n ${!this.showGotoTop\n ? html``\n : html` <mwc-icon id=\"upward\" @click=${(e: Event) => this.gotoTop(e)}>arrow_upward</mwc-icon> `}\n <ox-markdown id=\"content\" .src=${this.topic && `/helps/${this.topic}.md`}></ox-markdown>\n `\n }\n\n async firstUpdated() {\n this.setupRouter()\n\n this.content.addEventListener('scroll', (e: Event) => {\n this.showGotoTop = (e.target as HTMLElement)?.scrollTop !== 0\n })\n\n await this.requestUpdate()\n\n var originPaddingTop = parseFloat(getComputedStyle(this.content, null).getPropertyValue('padding-top'))\n this.content.style.paddingTop = this.navigation.clientHeight + originPaddingTop + 'px'\n\n var headroom = new Headroom(this.navigation, {\n scroller: this.content\n })\n headroom.init()\n }\n\n async updated(changes: PropertyValues<this>) {\n if (changes.has('topic')) {\n if (!this.history) {\n this.history = [this.topic]\n this.historyIndex = 0\n }\n }\n\n if (changes.has('historyIndex')) {\n this.topic = this.history[this.historyIndex]\n this.content.scrollTop = 0\n }\n }\n\n setupRouter() {\n this.addEventListener('click', e => {\n if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey) {\n return\n }\n\n const anchor = e.composedPath().filter(n => (n as HTMLElement).tagName === 'A')[0] as HTMLAnchorElement\n if (!anchor || anchor.target || anchor.hasAttribute('download') || anchor.getAttribute('rel') === 'external') {\n return\n }\n\n const href = anchor.href\n const newUrl = new URL(href)\n if (!href || href.indexOf('mailto:') !== -1 || newUrl.origin !== location.origin) {\n return\n }\n\n e.preventDefault()\n e.stopPropagation()\n\n const pathname = newUrl.pathname\n const topic = newUrl.searchParams?.get('topic')\n if (pathname === '/help' && topic) {\n this.history = [...this.history.slice(0, this.historyIndex + 1), topic]\n this.historyIndex++\n this.topic = topic\n } else {\n navigate(href)\n }\n\n return\n })\n }\n\n gotoTop(e: Event) {\n this.content.scrollTop = 0\n\n e.stopPropagation()\n }\n\n goHome() {\n if (!this.history?.[0] || this.history[0] == this.topic) {\n return\n }\n this.history.push(this.history[0])\n this.historyIndex = this.history.length - 1\n }\n\n historyBack() {\n this.historyIndex > 0 && this.historyIndex--\n }\n\n historyForward() {\n this.history && this.historyIndex < this.history.length - 1 && this.historyIndex++\n }\n}\n"]}
|