@operato/markdown 8.0.0-beta.0 β†’ 8.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,15 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [8.0.0-beta.1](https://github.com/hatiolab/operato/compare/v8.0.0-beta.0...v8.0.0-beta.1) (2025-01-08)
7
+
8
+
9
+ ### :bug: Bug Fix
10
+
11
+ * missing .npmignore ([be05985](https://github.com/hatiolab/operato/commit/be05985abfae4af53501f718dd52932099f7fbcb))
12
+
13
+
14
+
6
15
  ## [8.0.0-beta.0](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.56...v8.0.0-beta.0) (2025-01-07)
7
16
 
8
17
  **Note:** Version bump only for package @operato/markdown
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@operato/markdown",
3
3
  "description": "Webcomponent markdown following open-wc recommendations",
4
4
  "author": "heartyoh",
5
- "version": "8.0.0-beta.0",
5
+ "version": "8.0.0-beta.1",
6
6
  "main": "dist/src/index.js",
7
7
  "module": "dist/src/index.js",
8
8
  "exports": {
@@ -41,7 +41,7 @@
41
41
  "storybook:build": "tsc && npm run analyze -- --exclude dist && build-storybook"
42
42
  },
43
43
  "dependencies": {
44
- "@operato/styles": "^8.0.0-beta.0",
44
+ "@operato/styles": "^8.0.0-beta.1",
45
45
  "lit": "^3.1.2",
46
46
  "marked": "^4.0.7"
47
47
  },
@@ -78,5 +78,5 @@
78
78
  "prettier --write"
79
79
  ]
80
80
  },
81
- "gitHead": "c4e9cc245659d050a9ffd66542083a6daad4bcb9"
81
+ "gitHead": "d5b28a2e9deb632c0dc80132f6a7196dd6fe4220"
82
82
  }
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
- });
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './ox-markdown'
@@ -1,121 +0,0 @@
1
- import { css } from 'lit'
2
-
3
- export const MarkdownStyle = css`
4
- h1 {
5
- margin: var(--help-panel-title-margin);
6
- padding: var(--help-panel-title-padding);
7
- font-size: 20px;
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: 18px;
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: 16px;
22
- color: var(--help-panel-h3-title-color);
23
- }
24
- md-icon {
25
- vertical-align: middle;
26
- }
27
-
28
- img {
29
- display: block;
30
- margin: var(--spacing-large) var(--spacing-large);
31
- max-width: 90%;
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(--spacing-small);
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(--md-sys-color-surface);
73
- border-radius: 50%;
74
- margin-right: var(--spacing-small);
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 md-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-dim-color);
106
- font-size: 0.9em;
107
- }
108
- th {
109
- border-top: 3px solid var(--md-sys-color-on-primary-container);
110
- background-color: var(--md-sys-color-background);
111
- color: var(--md-sys-color-on-secondary-container);
112
- }
113
- th,
114
- td {
115
- border-bottom: var(--border-dim-color);
116
- padding: var(--spacing-small);
117
- }
118
- tr:nth-child(even) {
119
- background-color: #f6f6f6;
120
- }
121
- `
package/src/markdown.ts DELETED
@@ -1,21 +0,0 @@
1
- const worker = new Worker(new URL('../../workers/markdown-webworker.js', import.meta.url), { type: 'module' })
2
-
3
- const TIMEOUT_LIMIT = 20000
4
-
5
- export async function md(markdown: string, options: StructuredSerializeOptions): Promise<any> {
6
- return new Promise((resolve, reject) => {
7
- var timeout = setTimeout(() => {
8
- reject('Marked took too long!')
9
- }, TIMEOUT_LIMIT)
10
-
11
- worker.onmessage = e => {
12
- clearTimeout(timeout)
13
- resolve(e.data)
14
- }
15
-
16
- worker.postMessage({
17
- content: markdown,
18
- options
19
- })
20
- })
21
- }
@@ -1,116 +0,0 @@
1
- import { LitElement, PropertyValues, TemplateResult, css, html } from 'lit'
2
- import { customElement, property, state } from 'lit/decorators.js'
3
-
4
- import { DirectiveResult } from 'lit-html/directive'
5
- import { MarkdownStyle } from './markdown-style'
6
- import { ScrollbarStyles } from '@operato/styles'
7
- import { md } from './markdown'
8
- import { unsafeHTML } from 'lit/directives/unsafe-html.js'
9
-
10
- @customElement('ox-markdown')
11
- export class OxMarkdown extends LitElement {
12
- static styles = [
13
- ScrollbarStyles,
14
- MarkdownStyle,
15
- css`
16
- #toc {
17
- position: absolute;
18
- max-width: 250px;
19
- background-color: var(--md-sys-color-surface);
20
- padding: var(--padding-default);
21
- right: var(--spacing-large);
22
- font: bold var(--fontsize-large) var(--theme-font);
23
- color: var(--md-sys-color-on-secondary-container);
24
- }
25
- #toc ul {
26
- list-style: circle;
27
- margin: var(--margin-default) 0 0 var(--spacing-large);
28
- padding: 0;
29
- }
30
- #toc a {
31
- display: inline-block;
32
- margin-left: -var(--spacing-small);
33
- padding: var(--spacing-small) 0;
34
- font: normal var(--fontsize-default) var(--theme-font);
35
- color: var(--md-sys-color-on-secondary-container);
36
- text-decoration: none;
37
- cursor: pointer;
38
- }
39
- #toc a:hover {
40
- background-color: var(--md-sys-color-surface);
41
- text-decoration: underline;
42
- color: var(--md-sys-color-on-primary-container);
43
- }
44
-
45
- @media screen and (max-width: 460px) {
46
- #toc {
47
- background-color: var(--md-sys-color-background);
48
- border-left: 4px solid var(--md-sys-color-on-primary-container);
49
- border-bottom: 1px dotted rgba(0, 0, 0, 0.2);
50
- position: relative;
51
- width: 100%;
52
- max-width: initial;
53
- padding: var(--padding-default) var(--padding-default) var(--padding-default) var(--spacing-large);
54
- }
55
- }
56
- `
57
- ]
58
-
59
- @property({ type: String }) src?: string
60
- @property({ type: Boolean }) toc: boolean = false
61
-
62
- @state() _html?: TemplateResult | DirectiveResult | null
63
- @state() _headings: any[] = []
64
-
65
- render() {
66
- return html` ${this.toc ? this.renderToc() : html``} ${this._html} `
67
- }
68
-
69
- renderToc() {
70
- var toc = this._headings || []
71
-
72
- return toc && toc.length > 0
73
- ? html`
74
- <div id="toc">
75
- Table Of Contents
76
- <ul>
77
- ${toc.map(
78
- heading => html` <li><a @click=${() => heading?.scrollIntoView()}>${heading.textContent}</a></li> `
79
- )}
80
- </ul>
81
- </div>
82
- `
83
- : html``
84
- }
85
-
86
- async updated(changed: PropertyValues<this>) {
87
- if (changed.has('src')) {
88
- if (this.src) {
89
- const response = await fetch(this.src)
90
- const content = await response.text()
91
-
92
- if (!response.ok) {
93
- this._html = html`
94
- <h1>Error : ${response.status}</h1>
95
- <div>${content}</div>
96
- `
97
- } else {
98
- if (response.headers.get('Content-Type')?.indexOf('text/markdown') !== -1) {
99
- this._html = unsafeHTML(
100
- (await md(content, {
101
- baseUrl: this.src,
102
- linkBaseUrl: document.baseURI
103
- } as StructuredSerializeOptions)) || ''
104
- )
105
- } else {
106
- this._html = unsafeHTML(content || '')
107
- }
108
- }
109
- }
110
- }
111
-
112
- if (changed.has('_html')) {
113
- this._headings = Array.from(this.renderRoot.querySelectorAll('h2'))
114
- }
115
- }
116
- }
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
- });