darkify-js 1.1.12 → 1.1.13-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/dist/darkify.d.ts +51 -10
- package/dist/darkify.esm.js +104 -33
- package/dist/darkify.umd.js +2 -2
- package/dist/plugins/index.d.ts +60 -0
- package/dist/plugins/index.esm.js +342 -0
- package/dist/plugins/index.umd.js +181 -0
- package/package.json +27 -11
package/dist/darkify.d.ts
CHANGED
|
@@ -1,39 +1,80 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
|
|
3
|
+
interface DarkifyPlugin<T extends LitElement = LitElement> {
|
|
4
|
+
el?: T;
|
|
5
|
+
render(): void | T;
|
|
6
|
+
onThemeChange?: (theme: string) => void;
|
|
7
|
+
onDestroy?: () => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface DarkifyPluginConstructor {
|
|
11
|
+
pluginId: string;
|
|
12
|
+
new (host: any, options?: any): DarkifyPlugin;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type StorageType = 'local' | 'session' | 'none';
|
|
16
|
+
|
|
1
17
|
interface Options {
|
|
2
18
|
autoMatchTheme: boolean;
|
|
3
|
-
useLocalStorage: boolean;
|
|
4
|
-
useSessionStorage: boolean;
|
|
5
19
|
useColorScheme: [string, string?];
|
|
20
|
+
useStorage: StorageType;
|
|
21
|
+
usePlugins?: (DarkifyPluginConstructor | [DarkifyPluginConstructor, any])[];
|
|
6
22
|
}
|
|
7
23
|
|
|
8
24
|
declare class Darkify {
|
|
9
25
|
private static readonly storageKey;
|
|
10
26
|
readonly options: Options;
|
|
27
|
+
private plugins;
|
|
11
28
|
theme: string;
|
|
12
|
-
|
|
13
|
-
_meta
|
|
29
|
+
private _elm;
|
|
30
|
+
private _meta;
|
|
31
|
+
private _style;
|
|
14
32
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @param
|
|
33
|
+
* Creates a new Darkify instance with default options
|
|
34
|
+
* @param element - Button ID (recommended) or HTML element selector
|
|
35
|
+
*/
|
|
36
|
+
constructor(element: string);
|
|
37
|
+
/**
|
|
38
|
+
* Creates a new Darkify instance with custom options only
|
|
39
|
+
* @param options - Options
|
|
40
|
+
*/
|
|
41
|
+
constructor(options: Partial<Options>);
|
|
42
|
+
/**
|
|
43
|
+
* Creates a new Darkify instance for managing dark/light theme
|
|
44
|
+
* @param element - Button ID (recommended) or HTML element selector
|
|
45
|
+
* @param options - Options
|
|
17
46
|
* @see {@link https://github.com/emrocode/darkify-js/wiki|Documentation}
|
|
18
47
|
*/
|
|
19
48
|
constructor(element: string, options: Partial<Options>);
|
|
20
49
|
private init;
|
|
50
|
+
private initPlugins;
|
|
51
|
+
private notifyPlugins;
|
|
52
|
+
private getStorage;
|
|
21
53
|
private getOsPreference;
|
|
22
54
|
private createAttribute;
|
|
23
55
|
private updateTags;
|
|
24
56
|
private savePreference;
|
|
25
57
|
private syncThemeBetweenTabs;
|
|
58
|
+
private setTheme;
|
|
26
59
|
/**
|
|
27
60
|
* Toggles the theme between light and dark modes
|
|
28
|
-
* @returns {void}
|
|
29
61
|
*/
|
|
30
62
|
toggleTheme(): void;
|
|
31
63
|
/**
|
|
32
|
-
* Retrieves the
|
|
33
|
-
* @returns
|
|
64
|
+
* Retrieves the currently active theme
|
|
65
|
+
* @returns The current theme name ('light' or 'dark')
|
|
34
66
|
*/
|
|
35
67
|
getCurrentTheme(): string;
|
|
68
|
+
/**
|
|
69
|
+
* Destroys the Darkify instance and cleans up all resources
|
|
70
|
+
*
|
|
71
|
+
* Removes all event listeners (system theme changes, click handlers, storage events),
|
|
72
|
+
* destroys all active plugins, removes injected DOM elements (<style> and <meta> tags),
|
|
73
|
+
* and frees associated resources.
|
|
74
|
+
* Call this method when the instance is no longer needed to prevent memory leaks.
|
|
75
|
+
*/
|
|
76
|
+
destroy(): void;
|
|
36
77
|
}
|
|
37
78
|
|
|
38
79
|
export { Darkify as default };
|
|
39
|
-
export type { Options };
|
|
80
|
+
export type { DarkifyPlugin, Options };
|
package/dist/darkify.esm.js
CHANGED
|
@@ -1,61 +1,110 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
3
|
* @author Emilio Romero <emrocode@gmail.com>
|
|
4
|
-
* @version 1.1.
|
|
4
|
+
* @version 1.1.13-beta.1
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
class EventListenerManager {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.listeners = [];
|
|
10
|
+
}
|
|
11
|
+
addListener(target, event, handler, options) {
|
|
12
|
+
target.addEventListener(event, handler, options);
|
|
13
|
+
this.listeners.push({ target, event, handler, options });
|
|
14
|
+
}
|
|
15
|
+
clearListeners() {
|
|
16
|
+
this.listeners.forEach(({ target, event, handler, options }) => {
|
|
17
|
+
target.removeEventListener(event, handler, options);
|
|
18
|
+
});
|
|
19
|
+
this.listeners = [];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
8
22
|
|
|
9
23
|
const defaultOptions = {
|
|
10
24
|
autoMatchTheme: true,
|
|
11
|
-
useLocalStorage: true,
|
|
12
|
-
useSessionStorage: false,
|
|
13
25
|
useColorScheme: ['#ffffff', '#000000'],
|
|
26
|
+
useStorage: 'local',
|
|
14
27
|
};
|
|
15
28
|
|
|
29
|
+
const isBrowser = typeof window !== 'undefined';
|
|
30
|
+
|
|
16
31
|
class Darkify {
|
|
17
32
|
constructor(element, options) {
|
|
18
33
|
this.options = defaultOptions;
|
|
34
|
+
this.plugins = [];
|
|
19
35
|
this.theme = 'light';
|
|
20
36
|
if (!isBrowser)
|
|
21
37
|
return;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
38
|
+
this._elm = new EventListenerManager();
|
|
39
|
+
const el = typeof element === 'string' ? element : undefined;
|
|
40
|
+
const inputOpts = element && typeof element === 'object' ? element : options;
|
|
41
|
+
const opts = Object.assign(Object.assign({}, defaultOptions), inputOpts);
|
|
26
42
|
this.options = opts;
|
|
27
|
-
this.theme = this.getOsPreference(
|
|
43
|
+
this.theme = this.getOsPreference();
|
|
28
44
|
this._style = document.createElement('style');
|
|
29
45
|
this._meta = document.createElement('meta');
|
|
30
|
-
this.init(element);
|
|
31
46
|
this.createAttribute();
|
|
47
|
+
this.init(el);
|
|
32
48
|
this.syncThemeBetweenTabs();
|
|
33
49
|
}
|
|
34
50
|
init(element) {
|
|
35
|
-
window
|
|
36
|
-
.matchMedia('(prefers-color-scheme: dark)')
|
|
37
|
-
.addEventListener('change', ({ matches: isDark }) => {
|
|
51
|
+
this._elm.addListener(window.matchMedia('(prefers-color-scheme: dark)'), 'change', ({ matches: isDark }) => {
|
|
38
52
|
this.theme = isDark ? 'dark' : 'light';
|
|
39
53
|
this.createAttribute();
|
|
40
54
|
});
|
|
41
|
-
|
|
42
|
-
|
|
55
|
+
const setup = () => {
|
|
56
|
+
this.initPlugins();
|
|
57
|
+
const hasWidget = this.plugins.some(p => p.el !== undefined);
|
|
58
|
+
if (element && !hasWidget) {
|
|
43
59
|
const htmlElement = document.querySelector(element);
|
|
44
|
-
|
|
45
|
-
|
|
60
|
+
if (htmlElement) {
|
|
61
|
+
this._elm.addListener(htmlElement, 'click', () => this.toggleTheme());
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
if (document.readyState !== 'loading') {
|
|
66
|
+
return setup();
|
|
46
67
|
}
|
|
68
|
+
this._elm.addListener(document, 'DOMContentLoaded', setup);
|
|
47
69
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
70
|
+
initPlugins() {
|
|
71
|
+
var _a;
|
|
72
|
+
(_a = this.options.usePlugins) === null || _a === void 0 ? void 0 : _a.forEach(p => {
|
|
73
|
+
const [Plugin, pluginOptions] = Array.isArray(p) ? p : [p, undefined];
|
|
74
|
+
const plugin = new Plugin(this, pluginOptions);
|
|
75
|
+
const renderedNode = plugin.render();
|
|
76
|
+
if (renderedNode) {
|
|
77
|
+
plugin.el = renderedNode;
|
|
78
|
+
}
|
|
79
|
+
this.plugins.push(plugin);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
notifyPlugins(theme) {
|
|
83
|
+
this.plugins.forEach(plugin => {
|
|
84
|
+
var _a;
|
|
85
|
+
(_a = plugin.onThemeChange) === null || _a === void 0 ? void 0 : _a.call(plugin, theme);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
getStorage() {
|
|
89
|
+
const { useStorage } = this.options;
|
|
90
|
+
if (useStorage === 'none')
|
|
91
|
+
return;
|
|
92
|
+
return useStorage === 'local' ? window.localStorage : window.sessionStorage;
|
|
93
|
+
}
|
|
94
|
+
getOsPreference() {
|
|
95
|
+
const storage = this.getStorage();
|
|
96
|
+
if (storage) {
|
|
97
|
+
const stored = storage.getItem(Darkify.storageKey);
|
|
98
|
+
if (stored)
|
|
99
|
+
return stored;
|
|
100
|
+
}
|
|
101
|
+
if (this.options.autoMatchTheme) {
|
|
102
|
+
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
103
|
+
}
|
|
104
|
+
return 'light';
|
|
56
105
|
}
|
|
57
106
|
createAttribute() {
|
|
58
|
-
const dataTheme = document.
|
|
107
|
+
const dataTheme = document.documentElement;
|
|
59
108
|
const { useColorScheme } = this.options;
|
|
60
109
|
const css = `/**! Darkify / A simple dark mode toggle library **/\n:root:where([data-theme="${this.theme}"]),[data-theme="${this.theme}"]{color-scheme:${this.theme}}`;
|
|
61
110
|
dataTheme.dataset.theme = this.theme;
|
|
@@ -65,36 +114,58 @@ class Darkify {
|
|
|
65
114
|
updateTags(css, useColorScheme) {
|
|
66
115
|
const [lightColor, darkColor] = useColorScheme;
|
|
67
116
|
this._meta.name = 'theme-color';
|
|
117
|
+
this._meta.media = `(prefers-color-scheme: ${this.theme})`;
|
|
68
118
|
this._meta.content = this.theme === 'light' ? lightColor : (darkColor !== null && darkColor !== void 0 ? darkColor : lightColor);
|
|
69
119
|
this._style.innerHTML = css;
|
|
70
|
-
const head = document.
|
|
120
|
+
const head = document.head;
|
|
71
121
|
if (!this._meta.parentNode)
|
|
72
122
|
head.appendChild(this._meta);
|
|
73
123
|
if (!this._style.parentNode)
|
|
74
124
|
head.appendChild(this._style);
|
|
75
125
|
}
|
|
76
126
|
savePreference() {
|
|
77
|
-
const {
|
|
78
|
-
|
|
79
|
-
|
|
127
|
+
const { useStorage } = this.options;
|
|
128
|
+
if (useStorage === 'none')
|
|
129
|
+
return;
|
|
130
|
+
const storage = useStorage === 'local';
|
|
131
|
+
const STO = storage ? window.localStorage : window.sessionStorage;
|
|
132
|
+
const OTS = storage ? window.sessionStorage : window.localStorage;
|
|
80
133
|
OTS.removeItem(Darkify.storageKey);
|
|
81
134
|
STO.setItem(Darkify.storageKey, this.theme);
|
|
82
135
|
}
|
|
83
136
|
syncThemeBetweenTabs() {
|
|
84
|
-
|
|
137
|
+
this._elm.addListener(window, 'storage', (e) => {
|
|
85
138
|
if (e.key === Darkify.storageKey && e.newValue) {
|
|
86
139
|
this.theme = e.newValue;
|
|
87
140
|
this.createAttribute();
|
|
141
|
+
this.notifyPlugins(e.newValue);
|
|
88
142
|
}
|
|
89
143
|
});
|
|
90
144
|
}
|
|
91
|
-
|
|
92
|
-
this.theme =
|
|
145
|
+
setTheme(newTheme) {
|
|
146
|
+
this.theme = newTheme;
|
|
93
147
|
this.createAttribute();
|
|
148
|
+
this.notifyPlugins(newTheme);
|
|
149
|
+
}
|
|
150
|
+
toggleTheme() {
|
|
151
|
+
this.setTheme(this.theme === 'light' ? 'dark' : 'light');
|
|
94
152
|
}
|
|
95
153
|
getCurrentTheme() {
|
|
96
154
|
return this.theme;
|
|
97
155
|
}
|
|
156
|
+
destroy() {
|
|
157
|
+
var _a, _b, _c, _d;
|
|
158
|
+
this._elm.clearListeners();
|
|
159
|
+
(_b = (_a = this._style) === null || _a === void 0 ? void 0 : _a.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(this._style);
|
|
160
|
+
(_d = (_c = this._meta) === null || _c === void 0 ? void 0 : _c.parentNode) === null || _d === void 0 ? void 0 : _d.removeChild(this._meta);
|
|
161
|
+
if (this.plugins.length > 0) {
|
|
162
|
+
this.plugins.forEach(plugin => {
|
|
163
|
+
var _a;
|
|
164
|
+
(_a = plugin.onDestroy) === null || _a === void 0 ? void 0 : _a.call(plugin);
|
|
165
|
+
});
|
|
166
|
+
this.plugins = [];
|
|
167
|
+
}
|
|
168
|
+
}
|
|
98
169
|
}
|
|
99
170
|
Darkify.storageKey = 'theme';
|
|
100
171
|
|
package/dist/darkify.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
3
|
* @author Emilio Romero <emrocode@gmail.com>
|
|
4
|
-
* @version 1.1.
|
|
4
|
+
* @version 1.1.13-beta.1
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Darkify=t()}(this,function(){"use strict";
|
|
7
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Darkify=t()}(this,function(){"use strict";class e{constructor(){this.listeners=[]}addListener(e,t,s,i){e.addEventListener(t,s,i),this.listeners.push({target:e,event:t,handler:s,options:i})}clearListeners(){this.listeners.forEach(({target:e,event:t,handler:s,options:i})=>{e.removeEventListener(t,s,i)}),this.listeners=[]}}const t={autoMatchTheme:!0,useColorScheme:["#ffffff","#000000"],useStorage:"local"},s="undefined"!=typeof window;class i{constructor(i,n){if(this.options=t,this.plugins=[],this.theme="light",!s)return;this._elm=new e;const o="string"==typeof i?i:void 0,h=i&&"object"==typeof i?i:n,r=Object.assign(Object.assign({},t),h);this.options=r,this.theme=this.getOsPreference(),this._style=document.createElement("style"),this._meta=document.createElement("meta"),this.createAttribute(),this.init(o),this.syncThemeBetweenTabs()}init(e){this._elm.addListener(window.matchMedia("(prefers-color-scheme: dark)"),"change",({matches:e})=>{this.theme=e?"dark":"light",this.createAttribute()});const t=()=>{this.initPlugins();const t=this.plugins.some(e=>void 0!==e.el);if(e&&!t){const t=document.querySelector(e);t&&this._elm.addListener(t,"click",()=>this.toggleTheme())}};if("loading"!==document.readyState)return t();this._elm.addListener(document,"DOMContentLoaded",t)}initPlugins(){var e;null===(e=this.options.usePlugins)||void 0===e||e.forEach(e=>{const[t,s]=Array.isArray(e)?e:[e,void 0],i=new t(this,s),n=i.render();n&&(i.el=n),this.plugins.push(i)})}notifyPlugins(e){this.plugins.forEach(t=>{var s;null===(s=t.onThemeChange)||void 0===s||s.call(t,e)})}getStorage(){const{useStorage:e}=this.options;if("none"!==e)return"local"===e?window.localStorage:window.sessionStorage}getOsPreference(){const e=this.getStorage();if(e){const t=e.getItem(i.storageKey);if(t)return t}return this.options.autoMatchTheme&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}createAttribute(){const e=document.documentElement,{useColorScheme:t}=this.options,s=`/**! Darkify / A simple dark mode toggle library **/\n:root:where([data-theme="${this.theme}"]),[data-theme="${this.theme}"]{color-scheme:${this.theme}}`;e.dataset.theme=this.theme,this.updateTags(s,t),this.savePreference()}updateTags(e,t){const[s,i]=t;this._meta.name="theme-color",this._meta.media=`(prefers-color-scheme: ${this.theme})`,this._meta.content="light"===this.theme?s:null!=i?i:s,this._style.innerHTML=e;const n=document.head;this._meta.parentNode||n.appendChild(this._meta),this._style.parentNode||n.appendChild(this._style)}savePreference(){const{useStorage:e}=this.options;if("none"===e)return;const t="local"===e,s=t?window.localStorage:window.sessionStorage;(t?window.sessionStorage:window.localStorage).removeItem(i.storageKey),s.setItem(i.storageKey,this.theme)}syncThemeBetweenTabs(){this._elm.addListener(window,"storage",e=>{e.key===i.storageKey&&e.newValue&&(this.theme=e.newValue,this.createAttribute(),this.notifyPlugins(e.newValue))})}setTheme(e){this.theme=e,this.createAttribute(),this.notifyPlugins(e)}toggleTheme(){this.setTheme("light"===this.theme?"dark":"light")}getCurrentTheme(){return this.theme}destroy(){var e,t,s,i;this._elm.clearListeners(),null===(t=null===(e=this._style)||void 0===e?void 0:e.parentNode)||void 0===t||t.removeChild(this._style),null===(i=null===(s=this._meta)||void 0===s?void 0:s.parentNode)||void 0===i||i.removeChild(this._meta),this.plugins.length>0&&(this.plugins.forEach(e=>{var t;null===(t=e.onDestroy)||void 0===t||t.call(e)}),this.plugins=[])}}return i.storageKey="theme",i});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as lit_html from 'lit-html';
|
|
2
|
+
import * as lit from 'lit';
|
|
3
|
+
import { LitElement } from 'lit';
|
|
4
|
+
import { DarkifyPlugin } from '../darkify';
|
|
5
|
+
|
|
6
|
+
interface ThemeWidgetOptions {
|
|
7
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
8
|
+
size?: 'small' | 'medium' | 'large';
|
|
9
|
+
shortcut?: string;
|
|
10
|
+
}
|
|
11
|
+
declare class ThemeWidgetElement extends LitElement {
|
|
12
|
+
position: ThemeWidgetOptions['position'];
|
|
13
|
+
size: ThemeWidgetOptions['size'];
|
|
14
|
+
shortcut: ThemeWidgetOptions['shortcut'];
|
|
15
|
+
private theme;
|
|
16
|
+
private _host?;
|
|
17
|
+
static styles: lit.CSSResult;
|
|
18
|
+
init(host: any, options: Required<ThemeWidgetOptions>): void;
|
|
19
|
+
onThemeChange(theme: string): void;
|
|
20
|
+
private _handleToggle;
|
|
21
|
+
disconnectedCallback(): void;
|
|
22
|
+
render(): lit_html.TemplateResult<1>;
|
|
23
|
+
}
|
|
24
|
+
declare global {
|
|
25
|
+
interface HTMLElementTagNameMap {
|
|
26
|
+
'd-widget': ThemeWidgetElement;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare class ThemeWidget implements DarkifyPlugin<ThemeWidgetElement> {
|
|
31
|
+
static readonly pluginId = "d-widget";
|
|
32
|
+
el: ThemeWidgetElement;
|
|
33
|
+
private options;
|
|
34
|
+
constructor(host: any, options?: ThemeWidgetOptions);
|
|
35
|
+
render(): ThemeWidgetElement;
|
|
36
|
+
onThemeChange(theme: string): void;
|
|
37
|
+
onDestroy(): void;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface KeyboardShortcutOptions {
|
|
41
|
+
key?: string;
|
|
42
|
+
ctrl?: boolean;
|
|
43
|
+
shift?: boolean;
|
|
44
|
+
target?: 'body' | 'input' | 'all';
|
|
45
|
+
cooldown?: number;
|
|
46
|
+
}
|
|
47
|
+
declare class KeyboardShortcut implements DarkifyPlugin {
|
|
48
|
+
static readonly pluginId = "d-keyboard-shortcut";
|
|
49
|
+
private _host;
|
|
50
|
+
private options;
|
|
51
|
+
private _lastTriggered;
|
|
52
|
+
constructor(host: any, options?: KeyboardShortcutOptions);
|
|
53
|
+
private handleKeyDown;
|
|
54
|
+
render(): void;
|
|
55
|
+
onDestroy(): void;
|
|
56
|
+
private matches;
|
|
57
|
+
private isTyping;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { KeyboardShortcut, ThemeWidget };
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation.
|
|
3
|
+
|
|
4
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
+
purpose with or without fee is hereby granted.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
function __decorate(decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
26
|
+
var e = new Error(message);
|
|
27
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @license
|
|
32
|
+
* Copyright 2019 Google LLC
|
|
33
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
34
|
+
*/
|
|
35
|
+
const t$2=globalThis,e$2=t$2.ShadowRoot&&(void 0===t$2.ShadyCSS||t$2.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$2=Symbol(),o$4=new WeakMap;let n$3 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$2)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$2&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$4.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$4.set(s,t));}return t}toString(){return this.cssText}};const r$4=t=>new n$3("string"==typeof t?t:t+"",void 0,s$2),i$3=(t,...e)=>{const o=1===t.length?t[0]:e.reduce((e,s,o)=>e+(t=>{if(true===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1],t[0]);return new n$3(o,t,s$2)},S$1=(s,o)=>{if(e$2)s.adoptedStyleSheets=o.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of o){const o=document.createElement("style"),n=t$2.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$2?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$4(e)})(t):t;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @license
|
|
39
|
+
* Copyright 2017 Google LLC
|
|
40
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
41
|
+
*/const{is:i$2,defineProperty:e$1,getOwnPropertyDescriptor:h$1,getOwnPropertyNames:r$3,getOwnPropertySymbols:o$3,getPrototypeOf:n$2}=Object,a$1=globalThis,c$1=a$1.trustedTypes,l$1=c$1?c$1.emptyScript:"",p$1=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$2(t,s),b$1={attribute:true,type:String,converter:u$1,reflect:false,useDefault:false,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;let y$1 = class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b$1){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e$1(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h$1(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b$1}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$2(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...r$3(t),...o$3(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$2(s));}else void 0!==s&&i.push(c$2(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach(t=>t.hostConnected?.());}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.());}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u$1).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$1;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null;}}requestUpdate(t,s,i,e=false,h){if(void 0!==t){const r=this.constructor;if(false===e&&(h=this[t]),i??=r.getPropertyOptions(t),!((i.hasChanged??f$1)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,i))))return;this.C(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),true!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),true===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];true!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(s)):this._$EM();}catch(s){throw t=false,this._$EM(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM();}updated(t){}firstUpdated(t){}};y$1.elementStyles=[],y$1.shadowRootOptions={mode:"open"},y$1[d$1("elementProperties")]=new Map,y$1[d$1("finalized")]=new Map,p$1?.({ReactiveElement:y$1}),(a$1.reactiveElementVersions??=[]).push("2.1.2");
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @license
|
|
45
|
+
* Copyright 2017 Google LLC
|
|
46
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
|
+
*/
|
|
48
|
+
const t$1=globalThis,i$1=t=>t,s$1=t$1.trustedTypes,e=s$1?s$1.createPolicy("lit-html",{createHTML:t=>t}):void 0,h="$lit$",o$2=`lit$${Math.random().toFixed(9).slice(2)}$`,n$1="?"+o$2,r$2=`<${n$1}>`,l=document,c=()=>l.createComment(""),a=t=>null===t||"object"!=typeof t&&"function"!=typeof t,u=Array.isArray,d=t=>u(t)||"function"==typeof t?.[Symbol.iterator],f="[ \t\n\f\r]",v=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,m=/>/g,p=RegExp(`>|${f}(?:([^\\s"'>=/]+)(${f}*=${f}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),g=/'/g,$=/"/g,y=/^(?:script|style|textarea|title)$/i,x=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),b=x(1),E=Symbol.for("lit-noChange"),A=Symbol.for("lit-nothing"),C=new WeakMap,P=l.createTreeWalker(l,129);function V(t,i){if(!u(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==e?e.createHTML(i):i}const N=(t,i)=>{const s=t.length-1,e=[];let n,l=2===i?"<svg>":3===i?"<math>":"",c=v;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,f=0;for(;f<s.length&&(c.lastIndex=f,u=c.exec(s),null!==u);)f=c.lastIndex,c===v?"!--"===u[1]?c=_:void 0!==u[1]?c=m:void 0!==u[2]?(y.test(u[2])&&(n=RegExp("</"+u[2],"g")),c=p):void 0!==u[3]&&(c=p):c===p?">"===u[0]?(c=n??v,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?p:'"'===u[3]?$:g):c===$||c===g?c=p:c===_||c===m?c=v:(c=p,n=void 0);const x=c===p&&t[i+1].startsWith("/>")?" ":"";l+=c===v?s+r$2:d>=0?(e.push(a),s.slice(0,d)+h+s.slice(d)+o$2+x):s+o$2+(-2===d?i:x);}return [V(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),e]};class S{constructor({strings:t,_$litType$:i},e){let r;this.parts=[];let l=0,a=0;const u=t.length-1,d=this.parts,[f,v]=N(t,i);if(this.el=S.createElement(f,e),P.currentNode=this.el.content,2===i||3===i){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=P.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(h)){const i=v[a++],s=r.getAttribute(t).split(o$2),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:l,name:e[2],strings:s,ctor:"."===e[1]?I:"?"===e[1]?L:"@"===e[1]?z:H}),r.removeAttribute(t);}else t.startsWith(o$2)&&(d.push({type:6,index:l}),r.removeAttribute(t));if(y.test(r.tagName)){const t=r.textContent.split(o$2),i=t.length-1;if(i>0){r.textContent=s$1?s$1.emptyScript:"";for(let s=0;s<i;s++)r.append(t[s],c()),P.nextNode(),d.push({type:2,index:++l});r.append(t[i],c());}}}else if(8===r.nodeType)if(r.data===n$1)d.push({type:2,index:l});else {let t=-1;for(;-1!==(t=r.data.indexOf(o$2,t+1));)d.push({type:7,index:l}),t+=o$2.length-1;}l++;}}static createElement(t,i){const s=l.createElement("template");return s.innerHTML=t,s}}function M(t,i,s=t,e){if(i===E)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=a(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(false),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=M(t,h._$AS(t,i.values),h,e)),i}class R{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??l).importNode(i,true);P.currentNode=e;let h=P.nextNode(),o=0,n=0,r=s[0];for(;void 0!==r;){if(o===r.index){let i;2===r.type?i=new k(h,h.nextSibling,this,t):1===r.type?i=new r.ctor(h,r.name,r.strings,this,t):6===r.type&&(i=new Z(h,this,t)),this._$AV.push(i),r=s[++n];}o!==r?.index&&(h=P.nextNode(),o++);}return P.currentNode=l,e}p(t){let i=0;for(const s of this._$AV) void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class k{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=A,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??true;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=M(this,t,i),a(t)?t===A||null==t||""===t?(this._$AH!==A&&this._$AR(),this._$AH=A):t!==this._$AH&&t!==E&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):d(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==A&&a(this._$AH)?this._$AA.nextSibling.data=t:this.T(l.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=S.createElement(V(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new R(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=C.get(t.strings);return void 0===i&&C.set(t.strings,i=new S(t)),i}k(t){u(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new k(this.O(c()),this.O(c()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,s){for(this._$AP?.(false,true,s);t!==this._$AB;){const s=i$1(t).nextSibling;i$1(t).remove(),t=s;}}setConnected(t){ void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class H{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=A,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=A;}_$AI(t,i=this,s,e){const h=this.strings;let o=false;if(void 0===h)t=M(this,t,i,0),o=!a(t)||t!==this._$AH&&t!==E,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=M(this,e[s+n],i,n),r===E&&(r=this._$AH[n]),o||=!a(r)||r!==this._$AH[n],r===A?t=A:t!==A&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===A?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class I extends H{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===A?void 0:t;}}class L extends H{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==A);}}class z extends H{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=M(this,t,i,0)??A)===E)return;const s=this._$AH,e=t===A&&s!==A||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==A&&(s===A||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class Z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){M(this,t);}}const B=t$1.litHtmlPolyfillSupport;B?.(S,k),(t$1.litHtmlVersions??=[]).push("3.3.2");const D=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new k(i.insertBefore(c(),t),t,void 0,s??{});}return h._$AI(t),h};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @license
|
|
52
|
+
* Copyright 2017 Google LLC
|
|
53
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
54
|
+
*/const s=globalThis;class i extends y$1{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=D(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return E}}i._$litElement$=true,i["finalized"]=true,s.litElementHydrateSupport?.({LitElement:i});const o$1=s.litElementPolyfillSupport;o$1?.({LitElement:i});(s.litElementVersions??=[]).push("4.2.2");
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @license
|
|
58
|
+
* Copyright 2017 Google LLC
|
|
59
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
60
|
+
*/
|
|
61
|
+
const t=t=>(e,o)=>{ void 0!==o?o.addInitializer(()=>{customElements.define(t,e);}):customElements.define(t,e);};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @license
|
|
65
|
+
* Copyright 2017 Google LLC
|
|
66
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
67
|
+
*/const o={attribute:true,type:String,converter:u$1,reflect:false,hasChanged:f$1},r$1=(t=o,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),"setter"===n&&((t=Object.create(t)).wrapped=true),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t,true,r);},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t,true,r);}}throw Error("Unsupported decorator location: "+n)};function n(t){return (e,o)=>"object"==typeof o?r$1(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @license
|
|
71
|
+
* Copyright 2017 Google LLC
|
|
72
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
73
|
+
*/function r(r){return n({...r,state:true,attribute:false})}
|
|
74
|
+
|
|
75
|
+
const pluginId = 'd-widget';
|
|
76
|
+
let ThemeWidgetElement = class ThemeWidgetElement extends i {
|
|
77
|
+
constructor() {
|
|
78
|
+
super(...arguments);
|
|
79
|
+
this.position = 'bottom-right';
|
|
80
|
+
this.size = 'medium';
|
|
81
|
+
this.shortcut = '';
|
|
82
|
+
this.theme = 'light';
|
|
83
|
+
}
|
|
84
|
+
init(host, options) {
|
|
85
|
+
this._host = host;
|
|
86
|
+
this.position = options.position;
|
|
87
|
+
this.size = options.size;
|
|
88
|
+
this.shortcut = options.shortcut;
|
|
89
|
+
this.theme = host.getCurrentTheme();
|
|
90
|
+
}
|
|
91
|
+
onThemeChange(theme) {
|
|
92
|
+
this.theme = theme;
|
|
93
|
+
}
|
|
94
|
+
_handleToggle() {
|
|
95
|
+
var _a;
|
|
96
|
+
(_a = this._host) === null || _a === void 0 ? void 0 : _a.toggleTheme();
|
|
97
|
+
}
|
|
98
|
+
disconnectedCallback() {
|
|
99
|
+
super.disconnectedCallback();
|
|
100
|
+
this._host._elm.clearListeners();
|
|
101
|
+
}
|
|
102
|
+
render() {
|
|
103
|
+
var _a;
|
|
104
|
+
const isLeftPosition = (_a = this.position) === null || _a === void 0 ? void 0 : _a.includes('left');
|
|
105
|
+
const iconContent = this.theme === 'light' ? '🌞' : '🌚';
|
|
106
|
+
const button = b `
|
|
107
|
+
<button
|
|
108
|
+
class="d-button"
|
|
109
|
+
aria-label="Toggle theme"
|
|
110
|
+
role="switch"
|
|
111
|
+
aria-checked=${this.theme === 'dark'}
|
|
112
|
+
@click=${this._handleToggle}
|
|
113
|
+
data-theme=${this.theme}>
|
|
114
|
+
<span class="d-icon">${iconContent}</span>
|
|
115
|
+
</button>
|
|
116
|
+
`;
|
|
117
|
+
const kbd = this.shortcut ? b `<kbd class="d-kbd">${this.shortcut}</kbd>` : A;
|
|
118
|
+
return b `
|
|
119
|
+
<div class="d-wrapper">${isLeftPosition ? b `${button}${kbd}` : b `${kbd}${button}`}</div>
|
|
120
|
+
`;
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
ThemeWidgetElement.styles = i$3 `
|
|
124
|
+
:host {
|
|
125
|
+
--widget-safe-top: env(safe-area-inset-top, 0px);
|
|
126
|
+
--widget-safe-right: env(safe-area-inset-right, 0px);
|
|
127
|
+
--widget-safe-bottom: env(safe-area-inset-bottom, 0px);
|
|
128
|
+
--widget-safe-left: env(safe-area-inset-left, 0px);
|
|
129
|
+
|
|
130
|
+
--margin: 24px;
|
|
131
|
+
--top: var(--margin);
|
|
132
|
+
--right: var(--margin);
|
|
133
|
+
--bottom: auto;
|
|
134
|
+
--left: auto;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
:host([position='top-left']) {
|
|
138
|
+
--top: var(--margin);
|
|
139
|
+
--right: auto;
|
|
140
|
+
--bottom: auto;
|
|
141
|
+
--left: var(--margin);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
:host([position='top-right']) {
|
|
145
|
+
--top: var(--margin);
|
|
146
|
+
--right: var(--margin);
|
|
147
|
+
--bottom: auto;
|
|
148
|
+
--left: auto;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
:host([position='bottom-left']) {
|
|
152
|
+
--top: auto;
|
|
153
|
+
--right: auto;
|
|
154
|
+
--bottom: calc(var(--margin) * 2);
|
|
155
|
+
--left: var(--margin);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
:host([position='bottom-right']) {
|
|
159
|
+
--top: auto;
|
|
160
|
+
--right: var(--margin);
|
|
161
|
+
--bottom: calc(var(--margin) * 2);
|
|
162
|
+
--left: auto;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
:host([size='small']) {
|
|
166
|
+
--size: 36px;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
:host([size='medium']) {
|
|
170
|
+
--size: 56px;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
:host([size='large']) {
|
|
174
|
+
--size: 72px;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.d-wrapper {
|
|
178
|
+
position: fixed;
|
|
179
|
+
top: calc(var(--top) + var(--widget-safe-top));
|
|
180
|
+
right: calc(var(--right) + var(--widget-safe-right));
|
|
181
|
+
bottom: calc(var(--bottom) + var(--widget-safe-bottom));
|
|
182
|
+
left: calc(var(--left) + var(--widget-safe-left));
|
|
183
|
+
z-index: 9999;
|
|
184
|
+
max-width: fit-content;
|
|
185
|
+
display: flex;
|
|
186
|
+
align-items: center;
|
|
187
|
+
column-gap: 0.5rem;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.d-button {
|
|
191
|
+
--icon-size: calc(var(--size) * 0.4);
|
|
192
|
+
|
|
193
|
+
position: relative;
|
|
194
|
+
width: var(--size);
|
|
195
|
+
height: var(--size);
|
|
196
|
+
border: none;
|
|
197
|
+
border-bottom: 2px solid hsl(from canvastext h s l / calc(alpha * 0.5));
|
|
198
|
+
border-radius: 50%;
|
|
199
|
+
box-shadow:
|
|
200
|
+
0 1px 3px 0 hsla(210, 6%, 25%, 0.3),
|
|
201
|
+
0 4px 8px 3px hsla(210, 6%, 25%, 0.3);
|
|
202
|
+
background-color: transparent;
|
|
203
|
+
color: canvastext;
|
|
204
|
+
cursor: pointer;
|
|
205
|
+
font-size: var(--icon-size);
|
|
206
|
+
display: flex;
|
|
207
|
+
flex-direction: column;
|
|
208
|
+
align-items: center;
|
|
209
|
+
justify-content: center;
|
|
210
|
+
overflow: hidden;
|
|
211
|
+
user-select: none;
|
|
212
|
+
-webkit-user-select: none;
|
|
213
|
+
-webkit-tap-highlight-color: transparent;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.d-button::before {
|
|
217
|
+
content: '';
|
|
218
|
+
position: absolute;
|
|
219
|
+
inset: 0;
|
|
220
|
+
z-index: -1;
|
|
221
|
+
border: none;
|
|
222
|
+
background-color: canvas;
|
|
223
|
+
filter: invert(90%);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.d-button:focus-visible {
|
|
227
|
+
outline: 2px solid currentcolor;
|
|
228
|
+
outline-offset: 2px;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.d-button:active {
|
|
232
|
+
transform: scale(0.98);
|
|
233
|
+
transition: transform 0.4s ease-in-out;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.d-kbd {
|
|
237
|
+
position: relative;
|
|
238
|
+
padding: 0.25em 0.4em;
|
|
239
|
+
font-size: 11px;
|
|
240
|
+
font-family: ui-monospace, monospace;
|
|
241
|
+
line-height: 1;
|
|
242
|
+
letter-spacing: -0.025em;
|
|
243
|
+
background-color: canvas;
|
|
244
|
+
color: canvastext;
|
|
245
|
+
filter: invert(90%);
|
|
246
|
+
border: none;
|
|
247
|
+
border-bottom: 2px solid hsl(from canvastext h s l / calc(alpha * 0.5));
|
|
248
|
+
border-radius: 0.25rem;
|
|
249
|
+
box-shadow: 0 0 2px hsla(0, 0%, 0%, 0.1);
|
|
250
|
+
user-select: none;
|
|
251
|
+
-webkit-user-select: none;
|
|
252
|
+
}
|
|
253
|
+
`;
|
|
254
|
+
__decorate([
|
|
255
|
+
n({ type: String, reflect: true })
|
|
256
|
+
], ThemeWidgetElement.prototype, "position", void 0);
|
|
257
|
+
__decorate([
|
|
258
|
+
n({ type: String, reflect: true })
|
|
259
|
+
], ThemeWidgetElement.prototype, "size", void 0);
|
|
260
|
+
__decorate([
|
|
261
|
+
n({ type: String, reflect: true })
|
|
262
|
+
], ThemeWidgetElement.prototype, "shortcut", void 0);
|
|
263
|
+
__decorate([
|
|
264
|
+
r()
|
|
265
|
+
], ThemeWidgetElement.prototype, "theme", void 0);
|
|
266
|
+
ThemeWidgetElement = __decorate([
|
|
267
|
+
t(pluginId)
|
|
268
|
+
], ThemeWidgetElement);
|
|
269
|
+
|
|
270
|
+
class ThemeWidget {
|
|
271
|
+
constructor(host, options) {
|
|
272
|
+
var _a, _b, _c;
|
|
273
|
+
this.options = {
|
|
274
|
+
position: (_a = options === null || options === void 0 ? void 0 : options.position) !== null && _a !== void 0 ? _a : 'bottom-right',
|
|
275
|
+
size: (_b = options === null || options === void 0 ? void 0 : options.size) !== null && _b !== void 0 ? _b : 'medium',
|
|
276
|
+
shortcut: (_c = options === null || options === void 0 ? void 0 : options.shortcut) !== null && _c !== void 0 ? _c : '',
|
|
277
|
+
};
|
|
278
|
+
this.el = document.createElement(pluginId);
|
|
279
|
+
this.el.init(host, this.options);
|
|
280
|
+
}
|
|
281
|
+
render() {
|
|
282
|
+
document.body.appendChild(this.el);
|
|
283
|
+
return this.el;
|
|
284
|
+
}
|
|
285
|
+
onThemeChange(theme) {
|
|
286
|
+
this.el.onThemeChange(theme);
|
|
287
|
+
}
|
|
288
|
+
onDestroy() {
|
|
289
|
+
this.el.remove();
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
ThemeWidget.pluginId = pluginId;
|
|
293
|
+
|
|
294
|
+
class KeyboardShortcut {
|
|
295
|
+
constructor(host, options) {
|
|
296
|
+
var _a, _b, _c, _d, _e;
|
|
297
|
+
this._lastTriggered = 0;
|
|
298
|
+
this.handleKeyDown = (e) => {
|
|
299
|
+
if (this.options.target === 'body' && this.isTyping(e))
|
|
300
|
+
return;
|
|
301
|
+
if (this.options.target === 'input' && !this.isTyping(e))
|
|
302
|
+
return;
|
|
303
|
+
if (this.matches(e)) {
|
|
304
|
+
e.preventDefault();
|
|
305
|
+
const now = Date.now();
|
|
306
|
+
if (now - this._lastTriggered < this.options.cooldown)
|
|
307
|
+
return;
|
|
308
|
+
this._lastTriggered = now;
|
|
309
|
+
this._host.toggleTheme();
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
this._host = host;
|
|
313
|
+
this.options = {
|
|
314
|
+
key: (_a = options === null || options === void 0 ? void 0 : options.key) !== null && _a !== void 0 ? _a : 'd',
|
|
315
|
+
ctrl: (_b = options === null || options === void 0 ? void 0 : options.ctrl) !== null && _b !== void 0 ? _b : false,
|
|
316
|
+
shift: (_c = options === null || options === void 0 ? void 0 : options.shift) !== null && _c !== void 0 ? _c : false,
|
|
317
|
+
target: (_d = options === null || options === void 0 ? void 0 : options.target) !== null && _d !== void 0 ? _d : 'body',
|
|
318
|
+
cooldown: (_e = options === null || options === void 0 ? void 0 : options.cooldown) !== null && _e !== void 0 ? _e : 300,
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
render() {
|
|
322
|
+
document.addEventListener('keydown', this.handleKeyDown);
|
|
323
|
+
}
|
|
324
|
+
onDestroy() {
|
|
325
|
+
document.removeEventListener('keydown', this.handleKeyDown);
|
|
326
|
+
}
|
|
327
|
+
matches(e) {
|
|
328
|
+
return (e.key.toLowerCase() === this.options.key.toLowerCase() &&
|
|
329
|
+
(!this.options.ctrl || e.ctrlKey || e.metaKey) &&
|
|
330
|
+
(!this.options.shift || e.shiftKey) &&
|
|
331
|
+
(this.options.ctrl || (!e.ctrlKey && !e.metaKey && !e.altKey)));
|
|
332
|
+
}
|
|
333
|
+
isTyping(e) {
|
|
334
|
+
const target = e.target;
|
|
335
|
+
const tagName = target.tagName.toLowerCase();
|
|
336
|
+
const isEditable = target.isContentEditable || tagName === 'input' || tagName === 'textarea';
|
|
337
|
+
return isEditable;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
KeyboardShortcut.pluginId = 'd-keyboard-shortcut';
|
|
341
|
+
|
|
342
|
+
export { KeyboardShortcut, ThemeWidget };
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).DarkifyPlugins={})}(this,function(t){"use strict";function e(t,e,s,i){var o,r=arguments.length,n=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var h=t.length-1;h>=0;h--)(o=t[h])&&(n=(r<3?o(n):r>3?o(e,s,n):o(e,s))||n);return r>3&&n&&Object.defineProperty(e,s,n),n}"function"==typeof SuppressedError&&SuppressedError;
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2019 Google LLC
|
|
5
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
+
*/
|
|
7
|
+
const s=globalThis,i=s.ShadowRoot&&(void 0===s.ShadyCSS||s.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,o=Symbol(),r=new WeakMap;let n=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==o)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(i&&void 0===t){const s=void 0!==e&&1===e.length;s&&(t=r.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&r.set(e,t))}return t}toString(){return this.cssText}};const h=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new n("string"==typeof t?t:t+"",void 0,o))(e)})(t):t,{is:a,defineProperty:l,getOwnPropertyDescriptor:c,getOwnPropertyNames:d,getOwnPropertySymbols:p,getPrototypeOf:u}=Object,f=globalThis,g=f.trustedTypes,$=g?g.emptyScript:"",m=f.reactiveElementPolyfillSupport,_=(t,e)=>t,v={toAttribute(t,e){switch(e){case Boolean:t=t?$:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},y=(t,e)=>!a(t,e),b={attribute:!0,type:String,converter:v,reflect:!1,useDefault:!1,hasChanged:y};
|
|
8
|
+
/**
|
|
9
|
+
* @license
|
|
10
|
+
* Copyright 2017 Google LLC
|
|
11
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
12
|
+
*/Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;let A=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=b){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);void 0!==i&&l(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:o}=c(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:i,set(e){const r=i?.call(this);o?.call(this,e),this.requestUpdate(t,r,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(_("elementProperties")))return;const t=u(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(_("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(_("properties"))){const t=this.properties,e=[...d(t),...p(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const s=this._$Eu(t,e);void 0!==s&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(h(t))}else void 0!==t&&e.push(h(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(i)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const i of e){const e=document.createElement("style"),o=s.litNonce;void 0!==o&&e.setAttribute("nonce",o),e.textContent=i.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(void 0!==i&&!0===s.reflect){const o=(void 0!==s.converter?.toAttribute?s.converter:v).toAttribute(e,s.type);this._$Em=t,null==o?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){const s=this.constructor,i=s._$Eh.get(t);if(void 0!==i&&this._$Em!==i){const t=s.getPropertyOptions(i),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:v;this._$Em=i;const r=o.fromAttribute(e,t.type);this[i]=r??this._$Ej?.get(i)??r,this._$Em=null}}requestUpdate(t,e,s,i=!1,o){if(void 0!==t){const r=this.constructor;if(!1===i&&(o=this[t]),s??=r.getPropertyOptions(t),!((s.hasChanged??y)(o,e)||s.useDefault&&s.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,s))))return;this.C(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:i,wrapped:o},r){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??e??this[t]),!0!==o||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),!0===i&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,s]of t){const{wrapped:t}=s,i=this[e];!0!==t||this._$AL.has(e)||void 0===i||this.C(e,void 0,s,i)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}};A.elementStyles=[],A.shadowRootOptions={mode:"open"},A[_("elementProperties")]=new Map,A[_("finalized")]=new Map,m?.({ReactiveElement:A}),(f.reactiveElementVersions??=[]).push("2.1.2");
|
|
13
|
+
/**
|
|
14
|
+
* @license
|
|
15
|
+
* Copyright 2017 Google LLC
|
|
16
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
|
+
*/
|
|
18
|
+
const w=globalThis,E=t=>t,S=w.trustedTypes,x=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,C="$lit$",P=`lit$${Math.random().toFixed(9).slice(2)}$`,T="?"+P,U=`<${T}>`,O=document,k=()=>O.createComment(""),z=t=>null===t||"object"!=typeof t&&"function"!=typeof t,M=Array.isArray,H="[ \t\n\f\r]",N=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,R=/-->/g,D=/>/g,j=RegExp(`>|${H}(?:([^\\s"'>=/]+)(${H}*=${H}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),L=/'/g,I=/"/g,B=/^(?:script|style|textarea|title)$/i,K=(t=>(e,...s)=>({_$litType$:t,strings:e,values:s}))(1),W=Symbol.for("lit-noChange"),q=Symbol.for("lit-nothing"),V=new WeakMap,J=O.createTreeWalker(O,129);function Z(t,e){if(!M(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==x?x.createHTML(e):e}const F=(t,e)=>{const s=t.length-1,i=[];let o,r=2===e?"<svg>":3===e?"<math>":"",n=N;for(let e=0;e<s;e++){const s=t[e];let h,a,l=-1,c=0;for(;c<s.length&&(n.lastIndex=c,a=n.exec(s),null!==a);)c=n.lastIndex,n===N?"!--"===a[1]?n=R:void 0!==a[1]?n=D:void 0!==a[2]?(B.test(a[2])&&(o=RegExp("</"+a[2],"g")),n=j):void 0!==a[3]&&(n=j):n===j?">"===a[0]?(n=o??N,l=-1):void 0===a[1]?l=-2:(l=n.lastIndex-a[2].length,h=a[1],n=void 0===a[3]?j:'"'===a[3]?I:L):n===I||n===L?n=j:n===R||n===D?n=N:(n=j,o=void 0);const d=n===j&&t[e+1].startsWith("/>")?" ":"";r+=n===N?s+U:l>=0?(i.push(h),s.slice(0,l)+C+s.slice(l)+P+d):s+P+(-2===l?e:d)}return[Z(t,r+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),i]};class G{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let o=0,r=0;const n=t.length-1,h=this.parts,[a,l]=F(t,e);if(this.el=G.createElement(a,s),J.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=J.nextNode())&&h.length<n;){if(1===i.nodeType){if(i.hasAttributes())for(const t of i.getAttributeNames())if(t.endsWith(C)){const e=l[r++],s=i.getAttribute(t).split(P),n=/([.?@])?(.*)/.exec(e);h.push({type:1,index:o,name:n[2],strings:s,ctor:"."===n[1]?et:"?"===n[1]?st:"@"===n[1]?it:tt}),i.removeAttribute(t)}else t.startsWith(P)&&(h.push({type:6,index:o}),i.removeAttribute(t));if(B.test(i.tagName)){const t=i.textContent.split(P),e=t.length-1;if(e>0){i.textContent=S?S.emptyScript:"";for(let s=0;s<e;s++)i.append(t[s],k()),J.nextNode(),h.push({type:2,index:++o});i.append(t[e],k())}}}else if(8===i.nodeType)if(i.data===T)h.push({type:2,index:o});else{let t=-1;for(;-1!==(t=i.data.indexOf(P,t+1));)h.push({type:7,index:o}),t+=P.length-1}o++}}static createElement(t,e){const s=O.createElement("template");return s.innerHTML=t,s}}function Q(t,e,s=t,i){if(e===W)return e;let o=void 0!==i?s._$Co?.[i]:s._$Cl;const r=z(e)?void 0:e._$litDirective$;return o?.constructor!==r&&(o?._$AO?.(!1),void 0===r?o=void 0:(o=new r(t),o._$AT(t,s,i)),void 0!==i?(s._$Co??=[])[i]=o:s._$Cl=o),void 0!==o&&(e=Q(t,o._$AS(t,e.values),o,i)),e}class X{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,i=(t?.creationScope??O).importNode(e,!0);J.currentNode=i;let o=J.nextNode(),r=0,n=0,h=s[0];for(;void 0!==h;){if(r===h.index){let e;2===h.type?e=new Y(o,o.nextSibling,this,t):1===h.type?e=new h.ctor(o,h.name,h.strings,this,t):6===h.type&&(e=new ot(o,this,t)),this._$AV.push(e),h=s[++n]}r!==h?.index&&(o=J.nextNode(),r++)}return J.currentNode=O,i}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class Y{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=q,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Q(this,t,e),z(t)?t===q||null==t||""===t?(this._$AH!==q&&this._$AR(),this._$AH=q):t!==this._$AH&&t!==W&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>M(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==q&&z(this._$AH)?this._$AA.nextSibling.data=t:this.T(O.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,i="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=G.createElement(Z(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(e);else{const t=new X(i,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=V.get(t.strings);return void 0===e&&V.set(t.strings,e=new G(t)),e}k(t){M(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const o of t)i===e.length?e.push(s=new Y(this.O(k()),this.O(k()),this,this.options)):s=e[i],s._$AI(o),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=E(t).nextSibling;E(t).remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class tt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,o){this.type=1,this._$AH=q,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=q}_$AI(t,e=this,s,i){const o=this.strings;let r=!1;if(void 0===o)t=Q(this,t,e,0),r=!z(t)||t!==this._$AH&&t!==W,r&&(this._$AH=t);else{const i=t;let n,h;for(t=o[0],n=0;n<o.length-1;n++)h=Q(this,i[s+n],e,n),h===W&&(h=this._$AH[n]),r||=!z(h)||h!==this._$AH[n],h===q?t=q:t!==q&&(t+=(h??"")+o[n+1]),this._$AH[n]=h}r&&!i&&this.j(t)}j(t){t===q?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class et extends tt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===q?void 0:t}}class st extends tt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==q)}}class it extends tt{constructor(t,e,s,i,o){super(t,e,s,i,o),this.type=5}_$AI(t,e=this){if((t=Q(this,t,e,0)??q)===W)return;const s=this._$AH,i=t===q&&s!==q||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==q&&(s===q||i);i&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class ot{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){Q(this,t)}}const rt=w.litHtmlPolyfillSupport;rt?.(G,Y),(w.litHtmlVersions??=[]).push("3.3.2");const nt=globalThis;
|
|
19
|
+
/**
|
|
20
|
+
* @license
|
|
21
|
+
* Copyright 2017 Google LLC
|
|
22
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
+
*/class ht extends A{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,s)=>{const i=s?.renderBefore??e;let o=i._$litPart$;if(void 0===o){const t=s?.renderBefore??null;i._$litPart$=o=new Y(e.insertBefore(k(),t),t,void 0,s??{})}return o._$AI(t),o})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return W}}ht._$litElement$=!0,ht.finalized=!0,nt.litElementHydrateSupport?.({LitElement:ht});const at=nt.litElementPolyfillSupport;at?.({LitElement:ht}),(nt.litElementVersions??=[]).push("4.2.2");
|
|
24
|
+
/**
|
|
25
|
+
* @license
|
|
26
|
+
* Copyright 2017 Google LLC
|
|
27
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
28
|
+
*/
|
|
29
|
+
const lt={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:y},ct=(t=lt,e,s)=>{const{kind:i,metadata:o}=s;let r=globalThis.litPropertyMetadata.get(o);if(void 0===r&&globalThis.litPropertyMetadata.set(o,r=new Map),"setter"===i&&((t=Object.create(t)).wrapped=!0),r.set(s.name,t),"accessor"===i){const{name:i}=s;return{set(s){const o=e.get.call(this);e.set.call(this,s),this.requestUpdate(i,o,t,!0,s)},init(e){return void 0!==e&&this.C(i,void 0,t,e),e}}}if("setter"===i){const{name:i}=s;return function(s){const o=this[i];e.call(this,s),this.requestUpdate(i,o,t,!0,s)}}throw Error("Unsupported decorator location: "+i)};
|
|
30
|
+
/**
|
|
31
|
+
* @license
|
|
32
|
+
* Copyright 2017 Google LLC
|
|
33
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
34
|
+
*/function dt(t){return(e,s)=>"object"==typeof s?ct(t,e,s):((t,e,s)=>{const i=e.hasOwnProperty(s);return e.constructor.createProperty(s,t),i?Object.getOwnPropertyDescriptor(e,s):void 0})(t,e,s)}
|
|
35
|
+
/**
|
|
36
|
+
* @license
|
|
37
|
+
* Copyright 2017 Google LLC
|
|
38
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
39
|
+
*/const pt="d-widget";let ut=class extends ht{constructor(){super(...arguments),this.position="bottom-right",this.size="medium",this.shortcut="",this.theme="light"}init(t,e){this._host=t,this.position=e.position,this.size=e.size,this.shortcut=e.shortcut,this.theme=t.getCurrentTheme()}onThemeChange(t){this.theme=t}_handleToggle(){var t;null===(t=this._host)||void 0===t||t.toggleTheme()}disconnectedCallback(){super.disconnectedCallback(),this._host._elm.clearListeners()}render(){var t;const e=null===(t=this.position)||void 0===t?void 0:t.includes("left"),s="light"===this.theme?"🌞":"🌚",i=K`
|
|
40
|
+
<button
|
|
41
|
+
class="d-button"
|
|
42
|
+
aria-label="Toggle theme"
|
|
43
|
+
role="switch"
|
|
44
|
+
aria-checked=${"dark"===this.theme}
|
|
45
|
+
@click=${this._handleToggle}
|
|
46
|
+
data-theme=${this.theme}>
|
|
47
|
+
<span class="d-icon">${s}</span>
|
|
48
|
+
</button>
|
|
49
|
+
`,o=this.shortcut?K`<kbd class="d-kbd">${this.shortcut}</kbd>`:q;return K`
|
|
50
|
+
<div class="d-wrapper">${e?K`${i}${o}`:K`${o}${i}`}</div>
|
|
51
|
+
`}};ut.styles=((t,...e)=>{const s=1===t.length?t[0]:e.reduce((e,s,i)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[i+1],t[0]);return new n(s,t,o)})`
|
|
52
|
+
:host {
|
|
53
|
+
--widget-safe-top: env(safe-area-inset-top, 0px);
|
|
54
|
+
--widget-safe-right: env(safe-area-inset-right, 0px);
|
|
55
|
+
--widget-safe-bottom: env(safe-area-inset-bottom, 0px);
|
|
56
|
+
--widget-safe-left: env(safe-area-inset-left, 0px);
|
|
57
|
+
|
|
58
|
+
--margin: 24px;
|
|
59
|
+
--top: var(--margin);
|
|
60
|
+
--right: var(--margin);
|
|
61
|
+
--bottom: auto;
|
|
62
|
+
--left: auto;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
:host([position='top-left']) {
|
|
66
|
+
--top: var(--margin);
|
|
67
|
+
--right: auto;
|
|
68
|
+
--bottom: auto;
|
|
69
|
+
--left: var(--margin);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:host([position='top-right']) {
|
|
73
|
+
--top: var(--margin);
|
|
74
|
+
--right: var(--margin);
|
|
75
|
+
--bottom: auto;
|
|
76
|
+
--left: auto;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
:host([position='bottom-left']) {
|
|
80
|
+
--top: auto;
|
|
81
|
+
--right: auto;
|
|
82
|
+
--bottom: calc(var(--margin) * 2);
|
|
83
|
+
--left: var(--margin);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
:host([position='bottom-right']) {
|
|
87
|
+
--top: auto;
|
|
88
|
+
--right: var(--margin);
|
|
89
|
+
--bottom: calc(var(--margin) * 2);
|
|
90
|
+
--left: auto;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
:host([size='small']) {
|
|
94
|
+
--size: 36px;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
:host([size='medium']) {
|
|
98
|
+
--size: 56px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
:host([size='large']) {
|
|
102
|
+
--size: 72px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.d-wrapper {
|
|
106
|
+
position: fixed;
|
|
107
|
+
top: calc(var(--top) + var(--widget-safe-top));
|
|
108
|
+
right: calc(var(--right) + var(--widget-safe-right));
|
|
109
|
+
bottom: calc(var(--bottom) + var(--widget-safe-bottom));
|
|
110
|
+
left: calc(var(--left) + var(--widget-safe-left));
|
|
111
|
+
z-index: 9999;
|
|
112
|
+
max-width: fit-content;
|
|
113
|
+
display: flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
column-gap: 0.5rem;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.d-button {
|
|
119
|
+
--icon-size: calc(var(--size) * 0.4);
|
|
120
|
+
|
|
121
|
+
position: relative;
|
|
122
|
+
width: var(--size);
|
|
123
|
+
height: var(--size);
|
|
124
|
+
border: none;
|
|
125
|
+
border-bottom: 2px solid hsl(from canvastext h s l / calc(alpha * 0.5));
|
|
126
|
+
border-radius: 50%;
|
|
127
|
+
box-shadow:
|
|
128
|
+
0 1px 3px 0 hsla(210, 6%, 25%, 0.3),
|
|
129
|
+
0 4px 8px 3px hsla(210, 6%, 25%, 0.3);
|
|
130
|
+
background-color: transparent;
|
|
131
|
+
color: canvastext;
|
|
132
|
+
cursor: pointer;
|
|
133
|
+
font-size: var(--icon-size);
|
|
134
|
+
display: flex;
|
|
135
|
+
flex-direction: column;
|
|
136
|
+
align-items: center;
|
|
137
|
+
justify-content: center;
|
|
138
|
+
overflow: hidden;
|
|
139
|
+
user-select: none;
|
|
140
|
+
-webkit-user-select: none;
|
|
141
|
+
-webkit-tap-highlight-color: transparent;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.d-button::before {
|
|
145
|
+
content: '';
|
|
146
|
+
position: absolute;
|
|
147
|
+
inset: 0;
|
|
148
|
+
z-index: -1;
|
|
149
|
+
border: none;
|
|
150
|
+
background-color: canvas;
|
|
151
|
+
filter: invert(90%);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.d-button:focus-visible {
|
|
155
|
+
outline: 2px solid currentcolor;
|
|
156
|
+
outline-offset: 2px;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.d-button:active {
|
|
160
|
+
transform: scale(0.98);
|
|
161
|
+
transition: transform 0.4s ease-in-out;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.d-kbd {
|
|
165
|
+
position: relative;
|
|
166
|
+
padding: 0.25em 0.4em;
|
|
167
|
+
font-size: 11px;
|
|
168
|
+
font-family: ui-monospace, monospace;
|
|
169
|
+
line-height: 1;
|
|
170
|
+
letter-spacing: -0.025em;
|
|
171
|
+
background-color: canvas;
|
|
172
|
+
color: canvastext;
|
|
173
|
+
filter: invert(90%);
|
|
174
|
+
border: none;
|
|
175
|
+
border-bottom: 2px solid hsl(from canvastext h s l / calc(alpha * 0.5));
|
|
176
|
+
border-radius: 0.25rem;
|
|
177
|
+
box-shadow: 0 0 2px hsla(0, 0%, 0%, 0.1);
|
|
178
|
+
user-select: none;
|
|
179
|
+
-webkit-user-select: none;
|
|
180
|
+
}
|
|
181
|
+
`,e([dt({type:String,reflect:!0})],ut.prototype,"position",void 0),e([dt({type:String,reflect:!0})],ut.prototype,"size",void 0),e([dt({type:String,reflect:!0})],ut.prototype,"shortcut",void 0),e([function(t){return dt({...t,state:!0,attribute:!1})}()],ut.prototype,"theme",void 0),ut=e([(t=>(e,s)=>{void 0!==s?s.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)})(pt)],ut);class ft{constructor(t,e){var s,i,o;this.options={position:null!==(s=null==e?void 0:e.position)&&void 0!==s?s:"bottom-right",size:null!==(i=null==e?void 0:e.size)&&void 0!==i?i:"medium",shortcut:null!==(o=null==e?void 0:e.shortcut)&&void 0!==o?o:""},this.el=document.createElement(pt),this.el.init(t,this.options)}render(){return document.body.appendChild(this.el),this.el}onThemeChange(t){this.el.onThemeChange(t)}onDestroy(){this.el.remove()}}ft.pluginId=pt;class gt{constructor(t,e){var s,i,o,r,n;this._lastTriggered=0,this.handleKeyDown=t=>{if(("body"!==this.options.target||!this.isTyping(t))&&("input"!==this.options.target||this.isTyping(t))&&this.matches(t)){t.preventDefault();const e=Date.now();if(e-this._lastTriggered<this.options.cooldown)return;this._lastTriggered=e,this._host.toggleTheme()}},this._host=t,this.options={key:null!==(s=null==e?void 0:e.key)&&void 0!==s?s:"d",ctrl:null!==(i=null==e?void 0:e.ctrl)&&void 0!==i&&i,shift:null!==(o=null==e?void 0:e.shift)&&void 0!==o&&o,target:null!==(r=null==e?void 0:e.target)&&void 0!==r?r:"body",cooldown:null!==(n=null==e?void 0:e.cooldown)&&void 0!==n?n:300}}render(){document.addEventListener("keydown",this.handleKeyDown)}onDestroy(){document.removeEventListener("keydown",this.handleKeyDown)}matches(t){return t.key.toLowerCase()===this.options.key.toLowerCase()&&(!this.options.ctrl||t.ctrlKey||t.metaKey)&&(!this.options.shift||t.shiftKey)&&(this.options.ctrl||!t.ctrlKey&&!t.metaKey&&!t.altKey)}isTyping(t){const e=t.target,s=e.tagName.toLowerCase();return e.isContentEditable||"input"===s||"textarea"===s}}gt.pluginId="d-keyboard-shortcut",t.KeyboardShortcut=gt,t.ThemeWidget=ft});
|
package/package.json
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "darkify-js",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.13-beta.1",
|
|
4
4
|
"description": "A simple dark mode toggle library",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./dist/darkify.esm.js",
|
|
9
|
+
"require": "./dist/darkify.umd.js",
|
|
10
|
+
"types": "./dist/darkify.d.ts"
|
|
11
|
+
},
|
|
12
|
+
"./plugins": {
|
|
13
|
+
"import": "./dist/plugins/index.esm.mjs",
|
|
14
|
+
"require": "./dist/plugins/index.umd.js",
|
|
15
|
+
"types": "./dist/plugins/index.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
9
19
|
"files": [
|
|
10
20
|
"dist"
|
|
11
21
|
],
|
|
@@ -14,7 +24,9 @@
|
|
|
14
24
|
"_bundle": "rollup -c rollup.config.ts --configPlugin typescript",
|
|
15
25
|
"build": "npm run _cls && npm run _bundle",
|
|
16
26
|
"format": "prettier --write src/",
|
|
17
|
-
"test": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest"
|
|
27
|
+
"test": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest",
|
|
28
|
+
"demo": "npm run build && sh demo.sh",
|
|
29
|
+
"prepublishOnly": "npm run build"
|
|
18
30
|
},
|
|
19
31
|
"repository": {
|
|
20
32
|
"type": "git",
|
|
@@ -33,18 +45,22 @@
|
|
|
33
45
|
"author": "Emilio Romero <emrocode@gmail.com>",
|
|
34
46
|
"license": "MIT",
|
|
35
47
|
"devDependencies": {
|
|
36
|
-
"@rollup/plugin-
|
|
48
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
49
|
+
"@rollup/plugin-terser": "^1.0.0",
|
|
37
50
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
38
51
|
"@types/jest": "^30.0.0",
|
|
39
|
-
"jest": "^30.
|
|
40
|
-
"jest-environment-jsdom": "^30.
|
|
52
|
+
"jest": "^30.3.0",
|
|
53
|
+
"jest-environment-jsdom": "^30.3.0",
|
|
41
54
|
"prettier": "^3.8.1",
|
|
42
|
-
"rollup": "^4.
|
|
55
|
+
"rollup": "^4.60.0",
|
|
43
56
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
44
|
-
"rollup-plugin-dts": "^6.
|
|
57
|
+
"rollup-plugin-dts": "^6.4.1",
|
|
45
58
|
"ts-jest": "^29.4.6",
|
|
46
59
|
"ts-node": "^10.9.2",
|
|
47
60
|
"tslib": "^2.8.1",
|
|
48
|
-
"typescript": "
|
|
61
|
+
"typescript": "~5.9.3"
|
|
62
|
+
},
|
|
63
|
+
"dependencies": {
|
|
64
|
+
"lit": "^3.3.2"
|
|
49
65
|
}
|
|
50
66
|
}
|