From 785b001d8c33043865115cbec409273f103b4a53 Mon Sep 17 00:00:00 2001 From: jaywcjlove Date: Fri, 1 Sep 2023 02:18:46 +0000 Subject: [PATCH] deploy: 254026860cfac4a19368b137868413e5b63cd646 --- CONTRIBUTORS.svg | 4 +- LICENSE | 21 + badges.svg | 8 +- coverage-summary.json | 3 - css/copy.css | 49 ++ css/demo-preview.css | 62 ++ css/main.css | 258 ++++++++ css/media.css | 52 ++ css/sidebar.css | 41 ++ css/tocbot.css | 52 ++ index.html | 318 ++++----- js/copy.js | 40 ++ js/dark-mode.js | 162 +++++ js/demo-preview.js | 31 + js/markdown-style.js | 1006 +++++++++++++++++++++++++++++ js/tocbot.js | 128 ++++ lcov-report/favicon.png | Bin 540 -> 445 bytes lcov-report/index.html | 2 +- lcov-report/index.js.html | 2 +- lcov-report/sort-arrow-sprite.png | Bin 209 -> 138 bytes lcov.info | 90 --- sitemap.txt | 0 22 files changed, 2025 insertions(+), 304 deletions(-) create mode 100644 LICENSE delete mode 100644 coverage-summary.json create mode 100644 css/copy.css create mode 100644 css/demo-preview.css create mode 100644 css/main.css create mode 100644 css/media.css create mode 100644 css/sidebar.css create mode 100644 css/tocbot.css create mode 100644 js/copy.js create mode 100644 js/dark-mode.js create mode 100644 js/demo-preview.js create mode 100644 js/markdown-style.js create mode 100644 js/tocbot.js delete mode 100644 lcov.info create mode 100644 sitemap.txt diff --git a/CONTRIBUTORS.svg b/CONTRIBUTORS.svg index ece96fe5..ebef2f3a 100644 --- a/CONTRIBUTORS.svg +++ b/CONTRIBUTORS.svg @@ -8,7 +8,9 @@ + + - + \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..8a47ac70 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 uiw + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/badges.svg b/badges.svg index 4354a36c..561ac7d5 100644 --- a/badges.svg +++ b/badges.svg @@ -1,14 +1,14 @@ coverage: 100% - + - - + + - + - - babel-plugin-transform-remove-imports - - - + + + + babel-plugin-transform-remove-imports babel-plugin-transform-remove-imports 1.7.0 + + + + + + + + + + + + - -

babel-plugin-transform-remove-imports

-

- NPM version - Build and Test - Coverage Status - Downloadss - Repo Dependents -

-

Modular import plugin for babel for server-side rendering. Also works for cjs to delete imported CSS to avoid compilation errors..

-

Usage

-
npm install babel-plugin-transform-remove-imports --save-dev
-
-

Via .babelrc or babel-loader.

-
{
+  top
+    
+ +
+
+ +

babel-plugin-transform-remove-imports

+

+ NPM version + Build and Test + Coverage Status + Downloadss + Repo Dependents +

+

Modular import plugin for babel for server-side rendering. Also works for cjs to delete imported CSS to avoid compilation errors..

+

Usage

+
npm install babel-plugin-transform-remove-imports --save-dev
+
+

Via .babelrc or babel-loader.

+
{
   "plugins": [
     [
       "babel-plugin-transform-remove-imports", {
@@ -114,7 +57,7 @@ 

Support require

-

Via .babelrc or babel-loader.

-
{
+">
+

Support require

+

Via .babelrc or babel-loader.

+
{
   "plugins": [
     [
       "babel-plugin-transform-remove-imports", {
@@ -164,7 +107,7 @@ 

Options

-
    -
  • test: RegExp | string | (RegExp | string)[]
  • -
-

- A regular expression to match the imports that will be removed. - It could be a string or a RegExp object. - You could also pass an array here. -

-
    -
  • removeAll: boolean
  • -
-

Deletes all imports.

-
    -
  • remove?: 'effects'
  • -
-

Removing only side effects imports,Used with the test option. #3

-
// Input Code
+">
+

Options

+
    +
  • test: RegExp | string | (RegExp | string)[]
  • +
+

+ A regular expression to match the imports that will be removed. + It could be a string or a RegExp object. + You could also pass an array here. +

+
    +
  • removeAll: boolean
  • +
+

Deletes all imports.

+
    +
  • remove?: 'effects'
  • +
+

Removing only side effects imports,Used with the test option. #3

+
// Input Code
 import 'foo';
 import Foo from 'foo';
 
 // Output Code  ↓ ↓ ↓ ↓ ↓ ↓
 import Foo from 'foo';
-
-

Programmatic Usage

-
import plugin from 'babel-plugin-transform-remove-imports'
+">
+

Programmatic Usage

+
import plugin from 'babel-plugin-transform-remove-imports'
 import { transform } from 'babel-core'
  
 function replace (code) {
@@ -240,7 +183,7 @@ 

Contributors

-

As always, thanks to our amazing contributors!

-

Made with github-action-contributors.

-

License

-

MIT © Kenny Wong & Slava Fomin II

-
+">
+

Contributors

+

As always, thanks to our amazing contributors!

+

Made with github-action-contributors.

+

License

+

MIT © Kenny Wong & Slava Fomin II

+
+ + + + + + diff --git a/js/copy.js b/js/copy.js new file mode 100644 index 00000000..a3fe52df --- /dev/null +++ b/js/copy.js @@ -0,0 +1,40 @@ +/** + * https://github.com/uiwjs/copy-to-clipboard/blob/master/src/main.js + */ +function copyTextToClipboard(text, cb) { + const el = document.createElement('textarea'); + el.value = text; + el.setAttribute('readonly', ''); + el.style = { + position: 'absolute', + left: '-9999px', + } + document.body.appendChild(el); + const selected = document.getSelection().rangeCount > 0 ? document.getSelection().getRangeAt(0) : false; + el.select(); + let isCopy = false; + try { + const successful = document.execCommand('copy'); + isCopy = !!successful; + } catch (err) { + isCopy = false; + } + document.body.removeChild(el); + if (selected && document.getSelection) { + document.getSelection().removeAllRanges(); + document.getSelection().addRange(selected); + } + cb && cb(isCopy); +}; + +function copied(target, str) { + target.classList.add('active'); + const input = target.parentElement.querySelector('input'); + if (input) { + copyTextToClipboard(input.value || '', function() { + setTimeout(() => { + target.classList.remove('active'); + }, 2000); + }); + } +} \ No newline at end of file diff --git a/js/dark-mode.js b/js/dark-mode.js new file mode 100644 index 00000000..50a01653 --- /dev/null +++ b/js/dark-mode.js @@ -0,0 +1,162 @@ +/** + * @package @wcj/dark-mode@1.0.14 + * Web Component that toggles dark mode 🌒 + * Github: https://github.com/jaywcjlove/dark-mode.git + * Website: https://jaywcjlove.github.io/dark-mode + * + * Licensed under the MIT license. + * @license Copyright © 2022. Licensed under the MIT License + * @author kenny wong + */ +const t = document; +const e = '_dark_mode_theme_'; +const s = 'permanent'; +const o = 'colorschemechange'; +const i = 'permanentcolorscheme'; +const h = 'light'; +const r = 'dark'; +const n = (t, e, s = e) => { + Object.defineProperty(t, s, { + enumerable: true, + get() { + const t = this.getAttribute(e); + return t === null ? '' : t; + }, + set(t) { + this.setAttribute(e, t); + }, + }); +}; +const c = (t, e, s = e) => { + Object.defineProperty(t, s, { + enumerable: true, + get() { + return this.hasAttribute(e); + }, + set(t) { + if (t) { + this.setAttribute(e, ''); + } else { + this.removeAttribute(e); + } + }, + }); +}; +class a extends HTMLElement { + static get observedAttributes() { + return ['mode', h, r, s]; + } + LOCAL_NANE = e; + constructor() { + super(); + this.t(); + } + connectedCallback() { + n(this, 'mode'); + n(this, r); + n(this, h); + c(this, s); + const a = localStorage.getItem(e); + if (a && [h, r].includes(a)) { + this.mode = a; + this.permanent = true; + } + if (this.permanent && !a) { + localStorage.setItem(e, this.mode); + } + const l = [h, r].includes(a); + if (this.permanent && a) { + this.o(); + } else { + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + this.mode = r; + this.o(); + } + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches) { + this.mode = h; + this.o(); + } + } + if (!this.permanent && !l) { + window.matchMedia('(prefers-color-scheme: light)').onchange = (t) => { + this.mode = t.matches ? h : r; + this.o(); + }; + window.matchMedia('(prefers-color-scheme: dark)').onchange = (t) => { + this.mode = t.matches ? r : h; + this.o(); + }; + } + const d = new MutationObserver((s, h) => { + this.mode = t.documentElement.dataset.colorMode; + if (this.permanent && l) { + localStorage.setItem(e, this.mode); + this.i(i, { permanent: this.permanent }); + } + this.h(); + this.i(o, { colorScheme: this.mode }); + }); + d.observe(t.documentElement, { attributes: true }); + this.i(o, { colorScheme: this.mode }); + this.h(); + } + attributeChangedCallback(t, s, o) { + if (t === 'mode' && s !== o && [h, r].includes(o)) { + const t = localStorage.getItem(e); + if (this.mode === t) { + this.mode = o; + this.h(); + this.o(); + } else if (this.mode && this.mode !== t) { + this.h(); + this.o(); + } + } else if ((t === h || t === r) && s !== o) { + this.h(); + } + if (t === 'permanent' && typeof this.permanent === 'boolean') { + this.permanent ? localStorage.setItem(e, this.mode) : localStorage.removeItem(e); + } + } + o() { + t.documentElement.setAttribute('data-color-mode', this.mode); + } + h() { + this.icon.textContent = this.mode === h ? '🌒' : '🌞'; + this.text.textContent = this.mode === h ? this.getAttribute(r) : this.getAttribute(h); + } + t() { + var s = this.attachShadow({ mode: 'open' }); + this.label = t.createElement('span'); + this.label.setAttribute('class', 'wrapper'); + this.label.onclick = () => { + this.mode = this.mode === h ? r : h; + if (this.permanent) { + localStorage.setItem(e, this.mode); + } + this.o(); + this.h(); + }; + s.appendChild(this.label); + this.icon = t.createElement('span'); + this.label.appendChild(this.icon); + this.text = t.createElement('span'); + this.label.appendChild(this.text); + const o = `\n[data-color-mode*='dark'], [data-color-mode*='dark'] body {\n color-scheme: dark;\n --color-theme-bg: #0d1117;\n --color-theme-text: #c9d1d9;\n background-color: var(--color-theme-bg);\n color: var(--color-theme-text);\n}\n\n[data-color-mode*='light'], [data-color-mode*='light'] body {\n color-scheme: light;\n --color-theme-bg: #fff;\n --color-theme-text: #24292f;\n background-color: var(--color-theme-bg);\n color: var(--color-theme-text);\n}`; + const i = '_dark_mode_style_'; + const n = t.getElementById(i); + if (!n) { + var c = t.createElement('style'); + c.id = i; + c.textContent = o; + t.head.appendChild(c); + } + var a = t.createElement('style'); + a.textContent = `\n .wrapper { cursor: pointer; user-select: none; position: relative; }\n .wrapper > span + span { margin-left: .4rem; }\n `; + s.appendChild(a); + } + i(t, e) { + this.dispatchEvent(new CustomEvent(t, { bubbles: true, composed: true, detail: e })); + } +} +customElements.define('dark-mode', a); diff --git a/js/demo-preview.js b/js/demo-preview.js new file mode 100644 index 00000000..c96cf9fc --- /dev/null +++ b/js/demo-preview.js @@ -0,0 +1,31 @@ +const demo = document.querySelectorAll('.idoc-demo-warpper .idoc-demo-previw'); + +function getButton(elm, type = 'BUTTON') { + let btn; + do { + elm = elm.nextElementSibling + if (elm.tagName === type) { + btn = elm; + elm = undefined; + break; + } + } while (elm); + return btn; +} +if (demo && demo.length > 0) { + demo.forEach((item) => { + if (item.previousElementSibling && item.previousElementSibling.tagName === 'INPUT') { + const button = getButton(item); + if (button) { + button.innerHTML = item.classList.contains('ishiden') ? 'Preview' : 'Show Code'; + if (item.tagName === 'DIV') { + item.innerHTML = item.previousElementSibling.defaultValue + } + button.onclick = () => { + item.classList.toggle('ishiden'); + button.innerHTML = item.classList.contains('ishiden') ? 'Preview' : 'Show Code'; + } + } + } + }); +} \ No newline at end of file diff --git a/js/markdown-style.js b/js/markdown-style.js new file mode 100644 index 00000000..5d54bf23 --- /dev/null +++ b/js/markdown-style.js @@ -0,0 +1,1006 @@ +const octiconLinkStyle = ` +markdown-style h1:hover a.anchor .icon-link:before, +markdown-style h2:hover a.anchor .icon-link:before, +markdown-style h3:hover a.anchor .icon-link:before, +markdown-style h4:hover a.anchor .icon-link:before, +markdown-style h5:hover a.anchor .icon-link:before, +markdown-style h6:hover a.anchor .icon-link:before { + width: 16px; + height: 16px; + content: ' '; + display: inline-block; + background-color: currentColor; + -webkit-mask-image: url("data:image/svg+xml,"); + mask-image: url("data:image/svg+xml,"); +}`; + +const __TEMPLATE__ = document.createElement('template'); +__TEMPLATE__.innerHTML = ` + + +`; +class MarkdownStyle extends HTMLElement { + constructor() { + super(); + this.shadow = this.attachShadow({ mode: 'open' }); + this.shadow.appendChild(__TEMPLATE__.content.cloneNode(true)); + const style = Array.prototype.slice + .call(this.shadow.children) + .find((item) => item.tagName === 'STYLE'); + if (style) { + const id = '__MARKDOWN_STYLE__'; + const findStyle = document.getElementById(id); + if (!findStyle) { + style.id = id; + document.head.append(style); + } + } + } + get theme() { + const value = this.getAttribute('theme'); + return value === null ? '' : value; + } + set theme(name) { + this.setAttribute('theme', name); + } + connectedCallback() { + if (!this.theme) { + const { colorMode } = document.documentElement.dataset; + this.theme = colorMode; + const observer = new MutationObserver((mutationsList, observer) => { + this.theme = document.documentElement.dataset.colorMode; + }); + observer.observe(document.documentElement, { attributes: true }); + window.matchMedia('(prefers-color-scheme: light)').onchange = (event) => { + this.theme = event.matches ? 'light' : 'dark'; + }; + window.matchMedia('(prefers-color-scheme: dark)').onchange = (event) => { + this.theme = event.matches ? 'dark' : 'light'; + }; + } + } +} +customElements.define('markdown-style', MarkdownStyle); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/js/tocbot.js b/js/tocbot.js new file mode 100644 index 00000000..b6cebb1e --- /dev/null +++ b/js/tocbot.js @@ -0,0 +1,128 @@ +;(() => { + function debounce(fn, delay = 1000) { + let time = null + function _debounce(...args) { + if (time !== null) clearTimeout(time); + time = setTimeout(() => fn.apply(this, args), delay) + } + return _debounce + } + + const scrollSmoothOffset = 56; + function updateScroll() { + const heading = document.getElementById(decodeURIComponent(location.hash.replace(/^#/, ''))); + if (heading) { + document.scrollingElement.scrollTop = heading.offsetTop - scrollSmoothOffset + 3; + } + } + + function preventClickHandle(selector) { + const mdContainer = document.querySelectorAll(selector); + if (mdContainer && mdContainer.length > 0) { + mdContainer.forEach((anchor) => { + anchor.addEventListener('click', (e) => { + e.preventDefault(); + location.hash = anchor.getAttribute('href'); + updateScroll(); + updateAnchor(); + tocsCollapse() + }); + }); + } + } + function tocButton() { + const tocElement = document.querySelector(`a.gototop`); + if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50) { + tocElement.style.opacity = 0.5; + } else { + tocElement.style.opacity = 0; + } + } + function scrollListener(evn) { + const anchors = document.querySelectorAll('markdown-style a.anchor[href*="#"][aria-hidden]'); + const scrollTop = evn && evn.target && evn.target.scrollingElement && evn.target.scrollingElement.scrollTop; + let element; + let index = 0; + anchors.forEach((anchor, idx) => { + if (anchor.offsetTop - scrollSmoothOffset < scrollTop || (idx === 0 && anchor.offsetTop > scrollTop)) { + element = anchor; + index = idx; + } + }); + tocButton(); + if (element) { + const tocElement = document.querySelector(`a.tocs-link[href='${decodeURIComponent(element.hash)}']`); + if (tocElement) { + updateAnchor(tocElement) + tocsCollapse(tocElement); + } else { + const first = document.querySelector('a.tocs-link[href*="#"]'); + if (index === 0 && first) { + updateAnchor(first); + tocsCollapse(first); + } + } + } + } + + document.addEventListener('scroll',debounce(scrollListener, 30), false); + + function updateAnchor(element) { + const anchorContainer = document.querySelectorAll('.tocs aside.inner.toc a.tocs-link'); + anchorContainer.forEach((tocanchor) => { + tocanchor.classList.remove('is-active-link'); + }); + const anchor = element || document.querySelector(`a.tocs-link[href='${decodeURIComponent(location.hash)}']`); + if (anchor) { + anchor.classList.add('is-active-link'); + } + } + + function tocsCollapse(element) { + const tocContainer = document.querySelector('nav.tocs > aside.inner.toc'); + if (element) { + tocContainer.scrollTop = element.offsetTop; + } + + const list = document.querySelectorAll('aside.toc ol.tocs-list'); + list.forEach((item) => { + item.classList.remove('is-open'); + }); + if (element && element.nextElementSibling) { + element.nextElementSibling.classList.add('is-open'); + } + isOpen(element); + } + + function isOpen(element) { + if (!element) { + element = document.querySelector(`a.tocs-link[href='${decodeURIComponent(location.hash)}']`); + } + if (element && element.parentElement && element.parentElement.tagName !== 'ASIDE' && !element.parentElement.classList.contains('toc')) { + isOpen(element.parentElement); + if (element.parentElement.classList.contains('is-collapsed')) { + element.parentElement.classList.add('is-open'); + } + } + } + + preventClickHandle('markdown-style a.anchor[href*="#"][aria-hidden]'); + preventClickHandle('.tocs aside.inner.toc a.tocs-link'); + + function updateSiderBarScroll() { + const siderBar = document.querySelector(".sidebar[role*='navigation']"); + const siderAnchor = document.querySelector(".sidebar[role*='navigation'] a[class*='active']"); + if (siderAnchor) { + siderBar.scrollTop = siderAnchor.offsetTop; + } + } + + const timer = setTimeout(() => { + updateSiderBarScroll(); + updateScroll(); + updateAnchor(); + tocsCollapse() + clearTimeout(timer); + }, 100); + +})(); \ No newline at end of file diff --git a/lcov-report/favicon.png b/lcov-report/favicon.png index 6691817834a957c938e7f09640a37a645fb31457..c1525b811a167671e9de1fa78aab9f5c0b61cef7 100644 GIT binary patch delta 430 zcmV;f0a5;(1ib^08Gix*005AYXf^-<0fb3JK~#7Fwa){L7(o;U;D2ytRNFR!+IGX* zaq2i#+~|VZMqJyrZCmTz_d1zFT=&aF^DO)adH5X?!2d5GV*E@=nhZidb1}g$IC?q; zAaCDGE?oPif}IEB_a8|w8>kfF7M zKiG(hB%+3dfP|ReXY=m$yZ7}4GluxVdpx-3oO{l>_pw^iR)1(?cpF?peI5ZRTTkJ0 zxbvX!=g@6ANqoQVML557aqzcwfuFHD?(z~mb)%5YDYOzpDTV8_L^?|X^bK8sZ|P|k zmliTP*%Yr*RX9qx&^*gx;K^$jDSCF}b>s^kSi9NWdBD_M8J`x)SdZ3FbG)L@DDugf z#CcK@PeRx|9DjC5qEuFJ{)3jkRuSF$*Vy?e;b4z8__5VxaN30(V&)M(s&KDRC<5QN zs~8%vu(oQUyPIs%P01G&!USIWQpNOp0gd&iArJ_Vngzsu)s3}GuK8p;JAhX&89u%f z&{%)C&gSQPJ5$E~p)}>_8SH0x6Y(xfBJq#t{^4p9=;=&_qWl0C|x{qUi_60as#_s120wcrR ztm(;92UoXr4>IIna$KM{-26`kgW948*6-f1g}^W{F-9fPXfxVvghU?!A)4HCkbQVC Q00000Ne4wvM6N<$g5H$)jQ{`u diff --git a/lcov-report/index.html b/lcov-report/index.html index a26e7a37..9273469f 100644 --- a/lcov-report/index.html +++ b/lcov-report/index.html @@ -101,7 +101,7 @@

All files