@operato/help 8.0.0-alpha.8 → 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/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-alpha.8",
5
+ "version": "8.0.0-beta.1",
6
6
  "main": "dist/src/index.js",
7
7
  "module": "dist/src/index.js",
8
8
  "exports": {
@@ -66,27 +66,27 @@
66
66
  },
67
67
  "dependencies": {
68
68
  "@material/web": "^2.0.0",
69
- "@operato/data-grist": "^8.0.0-alpha.8",
70
- "@operato/layout": "^8.0.0-alpha.4",
71
- "@operato/markdown": "^8.0.0-alpha.4",
72
- "@operato/shell": "^8.0.0-alpha.4",
73
- "@operato/styles": "^8.0.0-alpha.4",
74
- "@operato/utils": "^8.0.0-alpha.0",
69
+ "@operato/data-grist": "^8.0.0-beta.1",
70
+ "@operato/layout": "^8.0.0-beta.1",
71
+ "@operato/markdown": "^8.0.0-beta.1",
72
+ "@operato/shell": "^8.0.0-beta.1",
73
+ "@operato/styles": "^8.0.0-beta.1",
74
+ "@operato/utils": "^8.0.0-beta.1",
75
75
  "lit": "^3.1.2",
76
76
  "pwa-helpers": "^0.9.1"
77
77
  },
78
78
  "devDependencies": {
79
- "@custom-elements-manifest/analyzer": "^0.9.2",
79
+ "@custom-elements-manifest/analyzer": "^0.10.0",
80
80
  "@hatiolab/prettier-config": "^1.0.0",
81
81
  "@open-wc/eslint-config": "^12.0.3",
82
- "@open-wc/testing": "^3.1.6",
83
- "@typescript-eslint/eslint-plugin": "^7.0.1",
84
- "@typescript-eslint/parser": "^7.0.1",
85
- "@web/dev-server": "^0.3.0",
82
+ "@open-wc/testing": "^4.0.0",
83
+ "@typescript-eslint/eslint-plugin": "^8.0.0",
84
+ "@typescript-eslint/parser": "^8.0.0",
85
+ "@web/dev-server": "^0.4.0",
86
86
  "@web/dev-server-storybook": "^2.0.1",
87
- "@web/test-runner": "^0.18.0",
88
- "concurrently": "^8.0.1",
89
- "eslint": "^8.39.0",
87
+ "@web/test-runner": "^0.19.0",
88
+ "concurrently": "^9.0.0",
89
+ "eslint": "^9.0.0",
90
90
  "eslint-config-prettier": "^9.1.0",
91
91
  "husky": "^9.0.11",
92
92
  "lint-staged": "^15.2.2",
@@ -107,5 +107,5 @@
107
107
  "prettier --write"
108
108
  ]
109
109
  },
110
- "gitHead": "f495fb42a98844182ac2db30d7c2aea815488d62"
110
+ "gitHead": "d5b28a2e9deb632c0dc80132f6a7196dd6fe4220"
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 = */
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- stories: ['../dist/stories/**/*.stories.{js,md,mdx}'],
3
- };
@@ -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
- ]
@@ -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
- });
@@ -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
- onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null = (e: Event) => {
37
- e.stopPropagation()
38
- }
39
-
40
- onmouseup: ((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
- }
@@ -1,13 +0,0 @@
1
- import { closeOverlay, openOverlay } from '@operato/layout'
2
-
3
- export function openHelp(topic: string) {
4
- openOverlay('help', {
5
- templateProperties: {
6
- topic
7
- }
8
- })
9
- }
10
-
11
- export function closeHelp() {
12
- closeOverlay('help')
13
- }
@@ -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>&nbsp;${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,5 +0,0 @@
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'
@@ -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
- }