diff --git a/README.md b/README.md index 33a3eca..1a92843 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,8 @@ halo: ## 主题适配 +### 调用搜索弹框 + 此插件是一个通用的搜索框插件,主题需要做的只是通过 JS API 唤起搜索框即可,以下是代码示例: ```html @@ -59,3 +61,96 @@ halo: ``` 其中,`pluginFinder.available('PluginSearchWidget')` 的作用是判断使用者是否安装和启用了此插件,如果没有安装或者没有启用,那么就不会显示搜索入口。 + +### 适配配色 + +目前,此插件为了让主题更好的适配颜色,对外暴露了以下 CSS 变量: + +```css +--halo-search-widget-color-modal-layer: ; /* 搜索弹框遮罩层颜色 */ +--halo-search-widget-color-modal-content-bg: ; /* 搜索弹框内容区域背景色 */ +--halo-search-widget-color-form-input: ; /* 搜索框输入框字体颜色 */ +--halo-search-widget-color-form-input-placeholder: ; /* 搜索框输入框占位符颜色 */ +--halo-search-widget-color-form-input-bg: ; /* 搜索框输入框背景色 */ +--halo-search-widget-color-form-divider: ; /* 搜索框分割线颜色 */ +--halo-search-widget-color-result-item-bg: ; /* 搜索结果项背景色 */ +--halo-search-widget-color-result-item-hover-bg: ; /* 搜索结果项鼠标悬浮背景色 */ +--halo-search-widget-color-result-item-title: ; /* 搜索结果项标题颜色 */ +--halo-search-widget-color-result-item-content: ; /* 搜索结果项内容颜色 */ +--halo-search-widget-color-command-kbd-item: ; /* 搜索结果项快捷键提示字体颜色 */ +--halo-search-widget-color-command-kbd-border: ; /* 搜索结果项快捷键提示边框颜色 */ +--halo-search-widget-color-result-empty: ; /* 搜索结果为空时的颜色 */ +``` + +主题可以利用这些 CSS 变量来适配主题的配色,或者用于适配暗黑模式。 + +适配主题配色示例: + +```css +:root { + --halo-search-widget-color-modal-layer: rgb(107 114 128 / 0.75); + --halo-search-widget-color-modal-content-bg: #fff; + --halo-search-widget-color-form-input: #000; + --halo-search-widget-color-form-input-placeholder: #999; + --halo-search-widget-color-form-input-bg: #fff; + --halo-search-widget-color-form-divider: #eaeaea; + --halo-search-widget-color-result-item-bg: #fff; + --halo-search-widget-color-result-item-hover-bg: #f5f5f5; + --halo-search-widget-color-result-item-title: #000; + --halo-search-widget-color-result-item-content: #999; + --halo-search-widget-color-command-kbd-item: #fff; + --halo-search-widget-color-command-kbd-border: #fff; + --halo-search-widget-color-result-empty: #999; +} +``` + +适配暗黑模式切换示例: + +```css +@media (prefers-color-scheme: dark) { + .color-scheme-auto { + color-scheme: dark; + --halo-search-widget-color-modal-layer: rgba(0, 0, 0, 0.8); + --halo-search-widget-color-modal-content-bg: rgb(15 23 42); + --halo-search-widget-color-form-input: rgb(255, 255, 255); + --halo-search-widget-color-form-input-placeholder: rgb(148 163 184); + --halo-search-widget-color-form-input-bg: rgb(15 23 42); + --halo-search-widget-color-form-divider: rgb(30 41 59); + --halo-search-widget-color-result-item-bg: rgb(30 41 59); + --halo-search-widget-color-result-item-hover-bg: rgb(51 65 85); + --halo-search-widget-color-result-item-title: rgb(255 255 255); + --halo-search-widget-color-result-item-content: rgb(148 163 184); + --halo-search-widget-color-command-kbd-item: rgb(148 163 184); + --halo-search-widget-color-command-kbd-border: rgb(30 41 59); + --halo-search-widget-color-result-empty: rgb(148 163 184); + } +} + +.color-scheme-dark { + color-scheme: dark; + --halo-search-widget-color-modal-layer: rgba(0, 0, 0, 0.8); + --halo-search-widget-color-modal-content-bg: rgb(15 23 42); + --halo-search-widget-color-form-input: rgb(255, 255, 255); + --halo-search-widget-color-form-input-placeholder: rgb(148 163 184); + --halo-search-widget-color-form-input-bg: rgb(15 23 42); + --halo-search-widget-color-form-divider: rgb(30 41 59); + --halo-search-widget-color-result-item-bg: rgb(30 41 59); + --halo-search-widget-color-result-item-hover-bg: rgb(51 65 85); + --halo-search-widget-color-result-item-title: rgb(255 255 255); + --halo-search-widget-color-result-item-content: rgb(148 163 184); + --halo-search-widget-color-command-kbd-item: rgb(148 163 184); + --halo-search-widget-color-command-kbd-border: rgb(30 41 59); + --halo-search-widget-color-result-empty: rgb(148 163 184); +} +``` + +此外,为了让主题可以更加方便的适配暗黑模式,此插件也提供了一套暗黑模式的配色方案,主题可以直接使用此方案,而不需要自己去适配暗黑模式,适配方式如下: + +1. 在 html 或者 body 标签添加 class: + 1. `color-scheme-auto`:自动模式,根据系统的暗黑模式自动切换。 + 2. `color-scheme-dark` / `dark`:强制暗黑模式。 + 3. `color-scheme-light` / `light`:强制明亮模式。 +2. 在 html 或者 body 标签添加 `data-color-scheme` 属性: + 1. `auto`:自动模式,根据系统的暗黑模式自动切换。 + 2. `dark`:强制暗黑模式。 + 3. `light`:强制明亮模式。 diff --git a/packages/example/index.html b/packages/example/index.html index ef7754a..28325e0 100644 --- a/packages/example/index.html +++ b/packages/example/index.html @@ -1,16 +1,20 @@ - + + Vite + Lit + TS - diff --git a/packages/search-widget/package.json b/packages/search-widget/package.json index 3cd60bd..35727c4 100644 --- a/packages/search-widget/package.json +++ b/packages/search-widget/package.json @@ -6,13 +6,15 @@ ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" - } + }, + "./var.css": "./var.css" }, "main": "./dist/index.js", "module": "./dist/index.js", "types": "./dist/index.d.ts", "files": [ - "dist" + "dist", + "var.css" ], "scripts": { "dev": "tsc -w", diff --git a/packages/search-widget/src/search-form.ts b/packages/search-widget/src/search-form.ts index 2ea95b3..87f9172 100644 --- a/packages/search-widget/src/search-form.ts +++ b/packages/search-widget/src/search-form.ts @@ -154,6 +154,50 @@ export class SearchForm extends LitElement { static override styles = [ resetStyles, css` + :host { + --color-form-input-bg: var( + --halo-search-widget-color-form-input-bg, + #fff + ); + --color-form-input: var(--halo-search-widget-color-form-input, #333); + --color-form-input-placeholder: var( + --halo-search-widget-color-form-input-placeholder, + rgb(107 114 128) + ); + --color-form-divider: var( + --halo-search-widget-color-form-divider, + rgb(243 244 246) + ); + --color-result-empty: var( + --halo-search-widget-color-result-empty, + rgb(107 114 128) + ); + --color-result-item-bg: var( + --halo-search-widget-color-result-item-bg, + rgb(249 250 251) + ); + --color-result-item-hover-bg: var( + --halo-search-widget-color-result-item-hover-bg, + rgb(243 244 246) + ); + --color-result-item-title: var( + --halo-search-widget-color-result-item-title, + #333 + ); + --color-result-item-content: var( + --halo-search-widget-color-result-item-content, + rgb(75, 85, 99) + ); + --color-command-kbd-item: var( + --halo-search-widget-color-command-kbd-item, + #333 + ); + --color-command-kbd-border: var( + --halo-search-widget-color-command-kbd-border, + #e5e7eb + ); + } + :host * { box-sizing: border-box; border-width: 0; @@ -169,11 +213,11 @@ export class SearchForm extends LitElement { .search-form__input { border-bottom-width: 1px; - border-color: rgb(243 244 246); + border-color: var(--color-form-divider); padding: 0.625rem 1rem; position: sticky; top: 0; - background-color: #fff; + background-color: var(--color-form-input-bg); } .search-form__input input { @@ -184,6 +228,12 @@ export class SearchForm extends LitElement { border: none; font-size: 1rem; line-height: 1.5rem; + background-color: var(--color-form-input-bg); + color: var(--color-form-input); + } + + .search-form__input input::placeholder { + color: var(--color-form-input-placeholder); } .search-form__result { @@ -197,7 +247,7 @@ export class SearchForm extends LitElement { justify-content: center; font-size: 0.875rem; line-height: 1.25rem; - color: rgb(107 114 128); + color: var(--color-result-empty); } .search-form__result-wrapper { @@ -221,13 +271,13 @@ export class SearchForm extends LitElement { flex-direction: column; gap: 0.25rem; border-radius: 0.375rem; - background-color: rgb(249 250 251); + background-color: var(--color-result-item-bg); padding: 0.5rem 0.625rem; } .search-form__result-item:hover, .search-form__result-item.selected { - background-color: rgb(243 244 246); + background-color: var(--color-result-item-hover-bg); } .search-form__result-item-title { @@ -236,19 +286,20 @@ export class SearchForm extends LitElement { font-weight: 600; padding: 0; margin: 0; + color: var(--color-result-item-title); } .search-form__result-item-content { font-size: 0.75rem; line-height: 1rem; - color: rgb(75 85 99); + color: var(--color-result-item-content); padding: 0; margin: 0; } .search-form__commands { border-top-width: 1px; - border-color: rgb(243 244 246); + border-color: var(--color-form-divider); padding: 0.625rem 1rem; display: flex; justify-content: flex-end; @@ -263,16 +314,17 @@ export class SearchForm extends LitElement { .search-form__commands-item span { font-size: 0.75rem; line-height: 1rem; - color: rgb(75 85 99); + color: var(--color-command-kbd-item); } .search-form__commands-item kbd { - color: rgb(75 85 99); + color: var(--color-command-kbd-item); font-size: 10px; text-align: center; padding: 0.125rem 0.3rem; border-width: 1px; border-radius: 0.25rem; + border-color: var(--color-command-kbd-border); min-width: 1.25rem; margin-left: 0.3rem; box-shadow: 0 0 #0000, 0 0 #0000, 0 1px 2px 0 rgb(0 0 0 / 0.05); diff --git a/packages/search-widget/src/search-modal.ts b/packages/search-widget/src/search-modal.ts index f617999..335a675 100644 --- a/packages/search-widget/src/search-modal.ts +++ b/packages/search-widget/src/search-modal.ts @@ -51,6 +51,17 @@ export class SearchModal extends LitElement { } static override styles = css` + :host { + --color-modal-layer: var( + --halo-search-widget-color-modal-layer, + rgb(107 114 128 / 0.75) + ); + --color-modal-content-bg: var( + --halo-search-widget-color-modal-content-bg, + #fff + ); + } + .modal__wrapper { position: fixed; left: 0px; @@ -73,7 +84,7 @@ export class SearchModal extends LitElement { height: 100%; width: 100%; flex: none; - background-color: rgb(107 114 128 / 0.75); + background-color: var(--color-modal-layer); animation: fadeIn 0.15s both; } @@ -83,7 +94,7 @@ export class SearchModal extends LitElement { flex-direction: column; align-items: stretch; border-radius: 5px; - background-color: #fff; + background-color: var(--color-modal-content-bg); width: calc(100vw - 20px); max-height: calc(100vh - 5rem); max-width: 650px; diff --git a/packages/search-widget/var.css b/packages/search-widget/var.css new file mode 100644 index 0000000..1f2cbdc --- /dev/null +++ b/packages/search-widget/var.css @@ -0,0 +1,38 @@ +@media (prefers-color-scheme: dark) { + .color-scheme-auto, + [data-color-scheme='auto'] { + color-scheme: dark; + --halo-search-widget-color-modal-layer: rgba(0, 0, 0, 0.8); + --halo-search-widget-color-modal-content-bg: rgb(15 23 42); + --halo-search-widget-color-form-input: rgb(255, 255, 255); + --halo-search-widget-color-form-input-placeholder: rgb(148 163 184); + --halo-search-widget-color-form-input-bg: rgb(15 23 42); + --halo-search-widget-color-form-divider: rgb(30 41 59); + --halo-search-widget-color-result-item-bg: rgb(30 41 59); + --halo-search-widget-color-result-item-hover-bg: rgb(51 65 85); + --halo-search-widget-color-result-item-title: rgb(255 255 255); + --halo-search-widget-color-result-item-content: rgb(148 163 184); + --halo-search-widget-color-command-kbd-item: rgb(148 163 184); + --halo-search-widget-color-command-kbd-border: rgb(30 41 59); + --halo-search-widget-color-result-empty: rgb(148 163 184); + } +} + +.color-scheme-dark, +.dark, +[data-color-scheme='dark'] { + color-scheme: dark; + --halo-search-widget-color-modal-layer: rgba(0, 0, 0, 0.8); + --halo-search-widget-color-modal-content-bg: rgb(15 23 42); + --halo-search-widget-color-form-input: rgb(255, 255, 255); + --halo-search-widget-color-form-input-placeholder: rgb(148 163 184); + --halo-search-widget-color-form-input-bg: rgb(15 23 42); + --halo-search-widget-color-form-divider: rgb(30 41 59); + --halo-search-widget-color-result-item-bg: rgb(30 41 59); + --halo-search-widget-color-result-item-hover-bg: rgb(51 65 85); + --halo-search-widget-color-result-item-title: rgb(255 255 255); + --halo-search-widget-color-result-item-content: rgb(148 163 184); + --halo-search-widget-color-command-kbd-item: rgb(148 163 184); + --halo-search-widget-color-command-kbd-border: rgb(30 41 59); + --halo-search-widget-color-result-empty: rgb(148 163 184); +} diff --git a/packages/search-widget/vite.config.ts b/packages/search-widget/vite.config.ts deleted file mode 100644 index ee62cea..0000000 --- a/packages/search-widget/vite.config.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { fileURLToPath, URL } from 'node:url'; - -import { defineConfig } from 'vite'; -import path from 'path'; -import Dts from 'vite-plugin-dts'; -import { Plugin } from 'vite'; - -export default defineConfig({ - plugins: [ - Dts({ - tsconfigPath: './tsconfig.json', - entryRoot: './src', - outDir: './dist', - insertTypesEntry: true, - }) as Plugin, - ], - resolve: { - alias: { - '@': fileURLToPath(new URL('./src', import.meta.url)), - }, - }, - build: { - lib: { - entry: path.resolve(__dirname, 'src/index.ts'), - name: 'HaloSearchWidget', - fileName: (format) => `halo-search-widget.${format}.js`, - }, - }, -}); diff --git a/packages/widget/src/index.ts b/packages/widget/src/index.ts index ddb56c0..ce4fa89 100644 --- a/packages/widget/src/index.ts +++ b/packages/widget/src/index.ts @@ -1,4 +1,5 @@ import { SearchModal } from '@halo-dev/search-widget'; +import '@halo-dev/search-widget/var.css'; export { SearchModal }; diff --git a/src/main/java/run/halo/search/widget/SearchWidgetHeadProcessor.java b/src/main/java/run/halo/search/widget/SearchWidgetHeadProcessor.java index 61713c2..94a3167 100644 --- a/src/main/java/run/halo/search/widget/SearchWidgetHeadProcessor.java +++ b/src/main/java/run/halo/search/widget/SearchWidgetHeadProcessor.java @@ -26,6 +26,7 @@ private String searchWidgetScript() { return """ + """; } diff --git a/src/main/resources/index.html b/src/main/resources/index.html deleted file mode 100644 index 61ead9a..0000000 --- a/src/main/resources/index.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - Document - - - - - diff --git a/src/main/resources/static/search-widget.iife.js b/src/main/resources/static/search-widget.iife.js index 963ccce..b30f5f4 100644 --- a/src/main/resources/static/search-widget.iife.js +++ b/src/main/resources/static/search-widget.iife.js @@ -1,22 +1,22 @@ -var SearchWidget=function($){var zt;"use strict";/** +var SearchWidget=function(g){var zt;"use strict";/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const D=globalThis,X=D.ShadowRoot&&(D.ShadyCSS===void 0||D.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Y=Symbol(),ut=new WeakMap;let ft=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==Y)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(X&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=ut.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&ut.set(e,t))}return t}toString(){return this.cssText}};const Wt=i=>new ft(typeof i=="string"?i:i+"",void 0,Y),tt=(i,...t)=>{const e=i.length===1?i[0]:t.reduce((s,n,r)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+i[r+1],i[0]);return new ft(e,i,Y)},Gt=(i,t)=>{if(X)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const s=document.createElement("style"),n=D.litNonce;n!==void 0&&s.setAttribute("nonce",n),s.textContent=e.cssText,i.appendChild(s)}},mt=X?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return Wt(e)})(i):i;/** + */const D=globalThis,X=D.ShadowRoot&&(D.ShadyCSS===void 0||D.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Y=Symbol(),pt=new WeakMap;let ft=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==Y)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(X&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=pt.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&pt.set(e,t))}return t}toString(){return this.cssText}};const Wt=i=>new ft(typeof i=="string"?i:i+"",void 0,Y),tt=(i,...t)=>{const e=i.length===1?i[0]:t.reduce((s,r,o)=>s+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+i[o+1],i[0]);return new ft(e,i,Y)},Gt=(i,t)=>{if(X)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const s=document.createElement("style"),r=D.litNonce;r!==void 0&&s.setAttribute("nonce",r),s.textContent=e.cssText,i.appendChild(s)}},mt=X?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return Wt(e)})(i):i;/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const{is:Vt,defineProperty:Kt,getOwnPropertyDescriptor:Ft,getOwnPropertyNames:qt,getOwnPropertySymbols:Jt,getPrototypeOf:Zt}=Object,_=globalThis,$t=_.trustedTypes,Qt=$t?$t.emptyScript:"",et=_.reactiveElementPolyfillSupport,P=(i,t)=>i,B={toAttribute(i,t){switch(t){case Boolean:i=i?Qt:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},it=(i,t)=>!Vt(i,t),gt={attribute:!0,type:String,converter:B,reflect:!1,hasChanged:it};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),_.litPropertyMetadata??(_.litPropertyMetadata=new WeakMap);class x extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=gt){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),n=this.getPropertyDescriptor(t,s,e);n!==void 0&&Kt(this.prototype,t,n)}}static getPropertyDescriptor(t,e,s){const{get:n,set:r}=Ft(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get(){return n==null?void 0:n.call(this)},set(o){const a=n==null?void 0:n.call(this);r.call(this,o),this.requestUpdate(t,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??gt}static _$Ei(){if(this.hasOwnProperty(P("elementProperties")))return;const t=Zt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(P("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(P("properties"))){const e=this.properties,s=[...qt(e),...Jt(e)];for(const n of s)this.createProperty(n,e[n])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[s,n]of e)this.elementProperties.set(s,n)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const n=this._$Eu(e,s);n!==void 0&&this._$Eh.set(n,e)}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 n of s)e.unshift(mt(n))}else t!==void 0&&e.push(mt(t));return e}static _$Eu(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$Eg=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e;(this._$ES??(this._$ES=[])).push(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$ES)==null||e.splice(this._$ES.indexOf(t)>>>0,1)}_$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 Gt(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)==null||t.forEach(e=>{var s;return(s=e.hostConnected)==null?void 0:s.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)==null||t.forEach(e=>{var s;return(s=e.hostDisconnected)==null?void 0:s.call(e)})}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EO(t,e){var r;const s=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,s);if(n!==void 0&&s.reflect===!0){const o=(((r=s.converter)==null?void 0:r.toAttribute)!==void 0?s.converter:B).toAttribute(e,s.type);this._$Em=t,o==null?this.removeAttribute(n):this.setAttribute(n,o),this._$Em=null}}_$AK(t,e){var r;const s=this.constructor,n=s._$Eh.get(t);if(n!==void 0&&this._$Em!==n){const o=s.getPropertyOptions(n),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((r=o.converter)==null?void 0:r.fromAttribute)!==void 0?o.converter:B;this._$Em=n,this[n]=a.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,s,n=!1,r){if(t!==void 0){if(s??(s=this.constructor.getPropertyOptions(t)),!(s.hasChanged??it)(n?r:this[t],e))return;this.C(t,e,s)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(t,e,s){this._$AL.has(t)||this._$AL.set(t,e),s.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this._$Ep){for(const[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[r,o]of n)o.wrapped!==!0||this._$AL.has(r)||this[r]===void 0||this.C(r,this[r],o)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(s=this._$ES)==null||s.forEach(n=>{var r;return(r=n.hostUpdate)==null?void 0:r.call(n)}),this.update(e)):this._$ET()}catch(n){throw t=!1,this._$ET(),n}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$ES)==null||e.forEach(s=>{var n;return(n=s.hostUpdated)==null?void 0:n.call(s)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EO(e,this[e]))),this._$ET()}updated(t){}firstUpdated(t){}}x.elementStyles=[],x.shadowRootOptions={mode:"open"},x[P("elementProperties")]=new Map,x[P("finalized")]=new Map,et==null||et({ReactiveElement:x}),(_.reactiveElementVersions??(_.reactiveElementVersions=[])).push("2.0.0");/** + */const{is:Vt,defineProperty:Kt,getOwnPropertyDescriptor:Ft,getOwnPropertyNames:qt,getOwnPropertySymbols:Jt,getPrototypeOf:Zt}=Object,_=globalThis,gt=_.trustedTypes,Qt=gt?gt.emptyScript:"",et=_.reactiveElementPolyfillSupport,P=(i,t)=>i,B={toAttribute(i,t){switch(t){case Boolean:i=i?Qt:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},it=(i,t)=>!Vt(i,t),$t={attribute:!0,type:String,converter:B,reflect:!1,hasChanged:it};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),_.litPropertyMetadata??(_.litPropertyMetadata=new WeakMap);class x extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=$t){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),r=this.getPropertyDescriptor(t,s,e);r!==void 0&&Kt(this.prototype,t,r)}}static getPropertyDescriptor(t,e,s){const{get:r,set:o}=Ft(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get(){return r==null?void 0:r.call(this)},set(n){const a=r==null?void 0:r.call(this);o.call(this,n),this.requestUpdate(t,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??$t}static _$Ei(){if(this.hasOwnProperty(P("elementProperties")))return;const t=Zt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(P("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(P("properties"))){const e=this.properties,s=[...qt(e),...Jt(e)];for(const r of s)this.createProperty(r,e[r])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[s,r]of e)this.elementProperties.set(s,r)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const r=this._$Eu(e,s);r!==void 0&&this._$Eh.set(r,e)}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 r of s)e.unshift(mt(r))}else t!==void 0&&e.push(mt(t));return e}static _$Eu(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$Eg=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e;(this._$ES??(this._$ES=[])).push(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$ES)==null||e.splice(this._$ES.indexOf(t)>>>0,1)}_$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 Gt(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)==null||t.forEach(e=>{var s;return(s=e.hostConnected)==null?void 0:s.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)==null||t.forEach(e=>{var s;return(s=e.hostDisconnected)==null?void 0:s.call(e)})}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EO(t,e){var o;const s=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,s);if(r!==void 0&&s.reflect===!0){const n=(((o=s.converter)==null?void 0:o.toAttribute)!==void 0?s.converter:B).toAttribute(e,s.type);this._$Em=t,n==null?this.removeAttribute(r):this.setAttribute(r,n),this._$Em=null}}_$AK(t,e){var o;const s=this.constructor,r=s._$Eh.get(t);if(r!==void 0&&this._$Em!==r){const n=s.getPropertyOptions(r),a=typeof n.converter=="function"?{fromAttribute:n.converter}:((o=n.converter)==null?void 0:o.fromAttribute)!==void 0?n.converter:B;this._$Em=r,this[r]=a.fromAttribute(e,n.type),this._$Em=null}}requestUpdate(t,e,s,r=!1,o){if(t!==void 0){if(s??(s=this.constructor.getPropertyOptions(t)),!(s.hasChanged??it)(r?o:this[t],e))return;this.C(t,e,s)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(t,e,s){this._$AL.has(t)||this._$AL.set(t,e),s.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this._$Ep){for(const[o,n]of this._$Ep)this[o]=n;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[o,n]of r)n.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.C(o,this[o],n)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(s=this._$ES)==null||s.forEach(r=>{var o;return(o=r.hostUpdate)==null?void 0:o.call(r)}),this.update(e)):this._$ET()}catch(r){throw t=!1,this._$ET(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$ES)==null||e.forEach(s=>{var r;return(r=s.hostUpdated)==null?void 0:r.call(s)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EO(e,this[e]))),this._$ET()}updated(t){}firstUpdated(t){}}x.elementStyles=[],x.shadowRootOptions={mode:"open"},x[P("elementProperties")]=new Map,x[P("finalized")]=new Map,et==null||et({ReactiveElement:x}),(_.reactiveElementVersions??(_.reactiveElementVersions=[])).push("2.0.0");/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const U=globalThis,W=U.trustedTypes,_t=W?W.createPolicy("lit-html",{createHTML:i=>i}):void 0,yt="$lit$",y=`lit$${(Math.random()+"").slice(9)}$`,bt="?"+y,Xt=`<${bt}>`,v=document,O=()=>v.createComment(""),j=i=>i===null||typeof i!="object"&&typeof i!="function",vt=Array.isArray,Yt=i=>vt(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",st=`[ -\f\r]`,M=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,At=/-->/g,St=/>/g,A=RegExp(`>|${st}(?:([^\\s"'>=/]+)(${st}*=${st}*(?:[^ -\f\r"'\`<>=]|("|')|))|$)`,"g"),wt=/'/g,Et=/"/g,xt=/^(?:script|style|textarea|title)$/i,te=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),S=te(1),g=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),Tt=new WeakMap,w=v.createTreeWalker(v,129);function Ct(i,t){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return _t!==void 0?_t.createHTML(t):t}const ee=(i,t)=>{const e=i.length-1,s=[];let n,r=t===2?"":"",o=M;for(let a=0;a"?(o=n??M,h=-1):p[1]===void 0?h=-2:(h=o.lastIndex-p[2].length,c=p[1],o=p[3]===void 0?A:p[3]==='"'?Et:wt):o===Et||o===wt?o=A:o===At||o===St?o=M:(o=A,n=void 0);const m=o===A&&i[a+1].startsWith("/>")?" ":"";r+=o===M?l+Xt:h>=0?(s.push(c),l.slice(0,h)+yt+l.slice(h)+y+m):l+y+(h===-2?a:m)}return[Ct(i,r+(i[e]||"")+(t===2?"":"")),s]};class N{constructor({strings:t,_$litType$:e},s){let n;this.parts=[];let r=0,o=0;const a=t.length-1,l=this.parts,[c,p]=ee(t,e);if(this.el=N.createElement(c,s),w.currentNode=this.el.content,e===2){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(n=w.nextNode())!==null&&l.length0){n.textContent=W?W.emptyScript:"";for(let m=0;m2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=d}_$AI(t,e=this,s,n){const r=this.strings;let o=!1;if(r===void 0)t=T(this,t,e,0),o=!j(t)||t!==this._$AH&&t!==g,o&&(this._$AH=t);else{const a=t;let l,c;for(t=r[0],l=0;l{const s=(e==null?void 0:e.renderBefore)??t;let n=s._$litPart$;if(n===void 0){const r=(e==null?void 0:e.renderBefore)??null;s._$litPart$=n=new I(t.insertBefore(O(),r),r,void 0,e??{})}return n._$AI(i),n};/** + */const U=globalThis,W=U.trustedTypes,_t=W?W.createPolicy("lit-html",{createHTML:i=>i}):void 0,bt="$lit$",b=`lit$${(Math.random()+"").slice(9)}$`,yt="?"+b,Xt=`<${yt}>`,v=document,O=()=>v.createComment(""),j=i=>i===null||typeof i!="object"&&typeof i!="function",vt=Array.isArray,Yt=i=>vt(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",st=`[ +\f\r]`,M=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,At=/-->/g,wt=/>/g,A=RegExp(`>|${st}(?:([^\\s"'>=/]+)(${st}*=${st}*(?:[^ +\f\r"'\`<>=]|("|')|))|$)`,"g"),St=/'/g,Et=/"/g,xt=/^(?:script|style|textarea|title)$/i,te=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),w=te(1),$=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),Tt=new WeakMap,S=v.createTreeWalker(v,129);function Ct(i,t){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return _t!==void 0?_t.createHTML(t):t}const ee=(i,t)=>{const e=i.length-1,s=[];let r,o=t===2?"":"",n=M;for(let a=0;a"?(n=r??M,c=-1):u[1]===void 0?c=-2:(c=n.lastIndex-u[2].length,h=u[1],n=u[3]===void 0?A:u[3]==='"'?Et:St):n===Et||n===St?n=A:n===At||n===wt?n=M:(n=A,r=void 0);const m=n===A&&i[a+1].startsWith("/>")?" ":"";o+=n===M?l+Xt:c>=0?(s.push(h),l.slice(0,c)+bt+l.slice(c)+b+m):l+b+(c===-2?a:m)}return[Ct(i,o+(i[e]||"")+(t===2?"":"")),s]};class N{constructor({strings:t,_$litType$:e},s){let r;this.parts=[];let o=0,n=0;const a=t.length-1,l=this.parts,[h,u]=ee(t,e);if(this.el=N.createElement(h,s),S.currentNode=this.el.content,e===2){const c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(r=S.nextNode())!==null&&l.length0){r.textContent=W?W.emptyScript:"";for(let m=0;m2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=d}_$AI(t,e=this,s,r){const o=this.strings;let n=!1;if(o===void 0)t=T(this,t,e,0),n=!j(t)||t!==this._$AH&&t!==$,n&&(this._$AH=t);else{const a=t;let l,h;for(t=o[0],l=0;l{const s=(e==null?void 0:e.renderBefore)??t;let r=s._$litPart$;if(r===void 0){const o=(e==null?void 0:e.renderBefore)??null;s._$litPart$=r=new I(t.insertBefore(O(),o),o,void 0,e??{})}return r._$AI(i),r};/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */let C=class extends x{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=ae(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return g}};C._$litElement$=!0,C.finalized=!0,(zt=globalThis.litElementHydrateSupport)==null||zt.call(globalThis,{LitElement:C});const rt=globalThis.litElementPolyfillSupport;rt==null||rt({LitElement:C}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.0");/** + */let C=class extends x{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=ae(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return $}};C._$litElement$=!0,C.finalized=!0,(zt=globalThis.litElementHydrateSupport)==null||zt.call(globalThis,{LitElement:C});const ot=globalThis.litElementPolyfillSupport;ot==null||ot({LitElement:C}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.0");/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause @@ -24,15 +24,15 @@ var SearchWidget=function($){var zt;"use strict";/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const le={attribute:!0,type:String,converter:B,reflect:!1,hasChanged:it},he=(i=le,t,e)=>{const{kind:s,metadata:n}=e;let r=globalThis.litPropertyMetadata.get(n);if(r===void 0&&globalThis.litPropertyMetadata.set(n,r=new Map),r.set(e.name,i),s==="accessor"){const{name:o}=e;return{set(a){const l=t.get.call(this);t.set.call(this,a),this.requestUpdate(o,l,i)},init(a){return a!==void 0&&this.C(o,void 0,i),a}}}if(s==="setter"){const{name:o}=e;return function(a){const l=this[o];t.call(this,a),this.requestUpdate(o,l,i)}}throw Error("Unsupported decorator location: "+s)};function V(i){return(t,e)=>typeof e=="object"?he(i,t,e):((s,n,r)=>{const o=n.hasOwnProperty(r);return n.constructor.createProperty(r,o?{...s,wrapped:!0}:s),o?Object.getOwnPropertyDescriptor(n,r):void 0})(i,t,e)}/** + */const le={attribute:!0,type:String,converter:B,reflect:!1,hasChanged:it},ce=(i=le,t,e)=>{const{kind:s,metadata:r}=e;let o=globalThis.litPropertyMetadata.get(r);if(o===void 0&&globalThis.litPropertyMetadata.set(r,o=new Map),o.set(e.name,i),s==="accessor"){const{name:n}=e;return{set(a){const l=t.get.call(this);t.set.call(this,a),this.requestUpdate(n,l,i)},init(a){return a!==void 0&&this.C(n,void 0,i),a}}}if(s==="setter"){const{name:n}=e;return function(a){const l=this[n];t.call(this,a),this.requestUpdate(n,l,i)}}throw Error("Unsupported decorator location: "+s)};function V(i){return(t,e)=>typeof e=="object"?ce(i,t,e):((s,r,o)=>{const n=r.hasOwnProperty(o);return r.constructor.createProperty(o,n?{...s,wrapped:!0}:s),n?Object.getOwnPropertyDescriptor(r,o):void 0})(i,t,e)}/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */function ot(i){return V({...i,state:!0,attribute:!1})}/** + */function nt(i){return V({...i,state:!0,attribute:!1})}/** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const ce=i=>i.strings===void 0;/** + */const he=i=>i.strings===void 0;/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause @@ -40,19 +40,19 @@ var SearchWidget=function($){var zt;"use strict";/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const R=(i,t)=>{var s;const e=i._$AN;if(e===void 0)return!1;for(const n of e)(s=n._$AO)==null||s.call(n,t,!1),R(n,t);return!0},J=i=>{let t,e;do{if((t=i._$AM)===void 0)break;e=t._$AN,e.delete(i),i=t}while((e==null?void 0:e.size)===0)},Pt=i=>{for(let t;t=i._$AM;i=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(i))break;e.add(i),ue(t)}};function de(i){this._$AN!==void 0?(J(this),this._$AM=i,Pt(this)):this._$AM=i}function pe(i,t=!1,e=0){const s=this._$AH,n=this._$AN;if(n!==void 0&&n.size!==0)if(t)if(Array.isArray(s))for(let r=e;r{i.type==K.CHILD&&(i._$AP??(i._$AP=pe),i._$AQ??(i._$AQ=de))};class fe extends q{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),Pt(this),this.isConnected=t._$AU}_$AO(t,e=!0){var s,n;t!==this.isConnected&&(this.isConnected=t,t?(s=this.reconnected)==null||s.call(this):(n=this.disconnected)==null||n.call(this)),e&&(R(this,t),J(this))}setValue(t){if(ce(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}/** + */const R=(i,t)=>{var s;const e=i._$AN;if(e===void 0)return!1;for(const r of e)(s=r._$AO)==null||s.call(r,t,!1),R(r,t);return!0},J=i=>{let t,e;do{if((t=i._$AM)===void 0)break;e=t._$AN,e.delete(i),i=t}while((e==null?void 0:e.size)===0)},Pt=i=>{for(let t;t=i._$AM;i=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(i))break;e.add(i),pe(t)}};function de(i){this._$AN!==void 0?(J(this),this._$AM=i,Pt(this)):this._$AM=i}function ue(i,t=!1,e=0){const s=this._$AH,r=this._$AN;if(r!==void 0&&r.size!==0)if(t)if(Array.isArray(s))for(let o=e;o{i.type==K.CHILD&&(i._$AP??(i._$AP=ue),i._$AQ??(i._$AQ=de))};class fe extends q{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),Pt(this),this.isConnected=t._$AU}_$AO(t,e=!0){var s,r;t!==this.isConnected&&(this.isConnected=t,t?(s=this.reconnected)==null||s.call(this):(r=this.disconnected)==null||r.call(this)),e&&(R(this,t),J(this))}setValue(t){if(he(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}/** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const me=()=>new $e;class $e{}const at=new WeakMap,ge=F(class extends fe{render(i){return d}update(i,[t]){var s;const e=t!==this.G;return e&&this.G!==void 0&&this.ot(void 0),(e||this.rt!==this.lt)&&(this.G=t,this.ct=(s=i.options)==null?void 0:s.host,this.ot(this.lt=i.element)),d}ot(i){if(typeof this.G=="function"){const t=this.ct??globalThis;let e=at.get(t);e===void 0&&(e=new WeakMap,at.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ct,void 0),e.set(this.G,i),i!==void 0&&this.G.call(this.ct,i)}else this.G.value=i}get rt(){var i,t;return typeof this.G=="function"?(i=at.get(this.ct??globalThis))==null?void 0:i.get(this.G):(t=this.G)==null?void 0:t.value}disconnected(){this.rt===this.lt&&this.ot(void 0)}reconnected(){this.ot(this.lt)}});var _e=typeof global=="object"&&global&&global.Object===Object&&global;const ye=_e;var be=typeof self=="object"&&self&&self.Object===Object&&self,ve=ye||be||Function("return this")();const Ut=ve;var Ae=Ut.Symbol;const Z=Ae;var Ot=Object.prototype,Se=Ot.hasOwnProperty,we=Ot.toString,H=Z?Z.toStringTag:void 0;function Ee(i){var t=Se.call(i,H),e=i[H];try{i[H]=void 0;var s=!0}catch{}var n=we.call(i);return s&&(t?i[H]=e:delete i[H]),n}var xe=Object.prototype,Te=xe.toString;function Ce(i){return Te.call(i)}var ke="[object Null]",Pe="[object Undefined]",jt=Z?Z.toStringTag:void 0;function Ue(i){return i==null?i===void 0?Pe:ke:jt&&jt in Object(i)?Ee(i):Ce(i)}function Oe(i){return i!=null&&typeof i=="object"}var je="[object Symbol]";function Me(i){return typeof i=="symbol"||Oe(i)&&Ue(i)==je}var Ne=/\s/;function Ie(i){for(var t=i.length;t--&&Ne.test(i.charAt(t)););return t}var Re=/^\s+/;function He(i){return i&&i.slice(0,Ie(i)+1).replace(Re,"")}function lt(i){var t=typeof i;return i!=null&&(t=="object"||t=="function")}var Mt=0/0,ze=/^[-+]0x[0-9a-f]+$/i,Le=/^0b[01]+$/i,De=/^0o[0-7]+$/i,Be=parseInt;function Nt(i){if(typeof i=="number")return i;if(Me(i))return Mt;if(lt(i)){var t=typeof i.valueOf=="function"?i.valueOf():i;i=lt(t)?t+"":t}if(typeof i!="string")return i===0?i:+i;i=He(i);var e=Le.test(i);return e||De.test(i)?Be(i.slice(2),e?2:8):ze.test(i)?Mt:+i}var We=function(){return Ut.Date.now()};const ht=We;var Ge="Expected a function",Ve=Math.max,Ke=Math.min;function Fe(i,t,e){var s,n,r,o,a,l,c=0,p=!1,h=!1,f=!0;if(typeof i!="function")throw new TypeError(Ge);t=Nt(t)||0,lt(e)&&(p=!!e.leading,h="maxWait"in e,r=h?Ve(Nt(e.maxWait)||0,t):r,f="trailing"in e?!!e.trailing:f);function m(u){var b=s,L=n;return s=n=void 0,c=u,o=i.apply(L,b),o}function k(u){return c=u,a=setTimeout(Q,t),p?m(u):o}function Ye(u){var b=u-l,L=u-c,Bt=t-b;return h?Ke(Bt,r-L):Bt}function Lt(u){var b=u-l,L=u-c;return l===void 0||b>=t||b<0||h&&L>=r}function Q(){var u=ht();if(Lt(u))return Dt(u);a=setTimeout(Q,Ye(u))}function Dt(u){return a=void 0,f&&s?m(u):(s=n=void 0,o)}function ti(){a!==void 0&&clearTimeout(a),c=0,s=l=n=a=void 0}function ei(){return a===void 0?o:Dt(ht())}function pt(){var u=ht(),b=Lt(u);if(s=arguments,n=this,l=u,b){if(a===void 0)return k(l);if(h)return clearTimeout(a),a=setTimeout(Q,t),m(l)}return a===void 0&&(a=setTimeout(Q,t)),o}return pt.cancel=ti,pt.flush=ei,pt}/** + */const me=()=>new ge;class ge{}const at=new WeakMap,$e=F(class extends fe{render(i){return d}update(i,[t]){var s;const e=t!==this.G;return e&&this.G!==void 0&&this.ot(void 0),(e||this.rt!==this.lt)&&(this.G=t,this.ct=(s=i.options)==null?void 0:s.host,this.ot(this.lt=i.element)),d}ot(i){if(typeof this.G=="function"){const t=this.ct??globalThis;let e=at.get(t);e===void 0&&(e=new WeakMap,at.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ct,void 0),e.set(this.G,i),i!==void 0&&this.G.call(this.ct,i)}else this.G.value=i}get rt(){var i,t;return typeof this.G=="function"?(i=at.get(this.ct??globalThis))==null?void 0:i.get(this.G):(t=this.G)==null?void 0:t.value}disconnected(){this.rt===this.lt&&this.ot(void 0)}reconnected(){this.ot(this.lt)}});var _e=typeof global=="object"&&global&&global.Object===Object&&global;const be=_e;var ye=typeof self=="object"&&self&&self.Object===Object&&self,ve=be||ye||Function("return this")();const Ut=ve;var Ae=Ut.Symbol;const Z=Ae;var Ot=Object.prototype,we=Ot.hasOwnProperty,Se=Ot.toString,H=Z?Z.toStringTag:void 0;function Ee(i){var t=we.call(i,H),e=i[H];try{i[H]=void 0;var s=!0}catch{}var r=Se.call(i);return s&&(t?i[H]=e:delete i[H]),r}var xe=Object.prototype,Te=xe.toString;function Ce(i){return Te.call(i)}var ke="[object Null]",Pe="[object Undefined]",jt=Z?Z.toStringTag:void 0;function Ue(i){return i==null?i===void 0?Pe:ke:jt&&jt in Object(i)?Ee(i):Ce(i)}function Oe(i){return i!=null&&typeof i=="object"}var je="[object Symbol]";function Me(i){return typeof i=="symbol"||Oe(i)&&Ue(i)==je}var Ne=/\s/;function Ie(i){for(var t=i.length;t--&&Ne.test(i.charAt(t)););return t}var Re=/^\s+/;function He(i){return i&&i.slice(0,Ie(i)+1).replace(Re,"")}function lt(i){var t=typeof i;return i!=null&&(t=="object"||t=="function")}var Mt=0/0,ze=/^[-+]0x[0-9a-f]+$/i,Le=/^0b[01]+$/i,De=/^0o[0-7]+$/i,Be=parseInt;function Nt(i){if(typeof i=="number")return i;if(Me(i))return Mt;if(lt(i)){var t=typeof i.valueOf=="function"?i.valueOf():i;i=lt(t)?t+"":t}if(typeof i!="string")return i===0?i:+i;i=He(i);var e=Le.test(i);return e||De.test(i)?Be(i.slice(2),e?2:8):ze.test(i)?Mt:+i}var We=function(){return Ut.Date.now()};const ct=We;var Ge="Expected a function",Ve=Math.max,Ke=Math.min;function Fe(i,t,e){var s,r,o,n,a,l,h=0,u=!1,c=!1,f=!0;if(typeof i!="function")throw new TypeError(Ge);t=Nt(t)||0,lt(e)&&(u=!!e.leading,c="maxWait"in e,o=c?Ve(Nt(e.maxWait)||0,t):o,f="trailing"in e?!!e.trailing:f);function m(p){var y=s,L=r;return s=r=void 0,h=p,n=i.apply(L,y),n}function k(p){return h=p,a=setTimeout(Q,t),u?m(p):n}function Ye(p){var y=p-l,L=p-h,Bt=t-y;return c?Ke(Bt,o-L):Bt}function Lt(p){var y=p-l,L=p-h;return l===void 0||y>=t||y<0||c&&L>=o}function Q(){var p=ct();if(Lt(p))return Dt(p);a=setTimeout(Q,Ye(p))}function Dt(p){return a=void 0,f&&s?m(p):(s=r=void 0,n)}function ti(){a!==void 0&&clearTimeout(a),h=0,s=l=r=a=void 0}function ei(){return a===void 0?n:Dt(ct())}function ut(){var p=ct(),y=Lt(p);if(s=arguments,r=this,l=p,y){if(a===void 0)return k(l);if(c)return clearTimeout(a),a=setTimeout(Q,t),m(l)}return a===void 0&&(a=setTimeout(Q,t)),n}return ut.cancel=ti,ut.flush=ei,ut}/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */let ct=class extends q{constructor(t){if(super(t),this.et=d,t.type!==K.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===d||t==null)return this.vt=void 0,this.et=t;if(t===g)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.et)return this.vt;this.et=t;const e=[t];return e.raw=e,this.vt={_$litType$:this.constructor.resultType,strings:e,values:[]}}};ct.directiveName="unsafeHTML",ct.resultType=1;const It=F(ct);/** + */let ht=class extends q{constructor(t){if(super(t),this.et=d,t.type!==K.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===d||t==null)return this.vt=void 0,this.et=t;if(t===$)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.et)return this.vt;this.et=t;const e=[t];return e.raw=e,this.vt={_$litType$:this.constructor.resultType,strings:e,values:[]}}};ht.directiveName="unsafeHTML",ht.resultType=1;const It=F(ht);/** * @license * Copyright 2018 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const qe=F(class extends q{constructor(i){var t;if(super(i),i.type!==K.ATTRIBUTE||i.name!=="class"||((t=i.strings)==null?void 0:t.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(i){return" "+Object.keys(i).filter(t=>i[t]).join(" ")+" "}update(i,[t]){var s,n;if(this.it===void 0){this.it=new Set,i.strings!==void 0&&(this.st=new Set(i.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(const r in t)t[r]&&!((s=this.st)!=null&&s.has(r))&&this.it.add(r);return this.render(t)}const e=i.element.classList;for(const r of this.it)r in t||(e.remove(r),this.it.delete(r));for(const r in t){const o=!!t[r];o===this.it.has(r)||(n=this.st)!=null&&n.has(r)||(o?(e.add(r),this.it.add(r)):(e.remove(r),this.it.delete(r)))}return g}}),Je=tt` + */const qe=F(class extends q{constructor(i){var t;if(super(i),i.type!==K.ATTRIBUTE||i.name!=="class"||((t=i.strings)==null?void 0:t.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(i){return" "+Object.keys(i).filter(t=>i[t]).join(" ")+" "}update(i,[t]){var s,r;if(this.it===void 0){this.it=new Set,i.strings!==void 0&&(this.st=new Set(i.strings.join(" ").split(/\s/).filter(o=>o!=="")));for(const o in t)t[o]&&!((s=this.st)!=null&&s.has(o))&&this.it.add(o);return this.render(t)}const e=i.element.classList;for(const o of this.it)o in t||(e.remove(o),this.it.delete(o));for(const o in t){const n=!!t[o];n===this.it.has(o)||(r=this.st)!=null&&r.has(o)||(n?(e.add(o),this.it.add(o)):(e.remove(o),this.it.delete(o)))}return $}}),Je=tt` *, ::before, ::after { @@ -199,7 +199,7 @@ var SearchWidget=function($){var zt;"use strict";/** [role='button'] { cursor: pointer; } -`;var z=globalThis&&globalThis.__decorate||function(i,t,e,s){var n=arguments.length,r=n<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(i,t,e,s);else for(var a=i.length-1;a>=0;a--)(o=i[a])&&(r=(n<3?o(r):n>3?o(t,e,r):o(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r};let E=class extends C{constructor(){super(),this.baseUrl="",this.hits=[],this.loading=!1,this.selectedIndex=0,this.inputRef=me(),this.fetchHits=Fe(async t=>{const s=await(await fetch(`${this.baseUrl}/apis/api.halo.run/v1alpha1/indices/post?keyword=${t}&highlightPreTag=%3Cmark%3E&highlightPostTag=%3C/mark%3E`)).json();this.hits=s.hits||[],this.loading=!1},300),this.handleKeydown=t=>{const{key:e,ctrlKey:s}=t;if((e==="ArrowUp"||e==="k"&&s)&&(this.selectedIndex=Math.max(0,this.selectedIndex-1),t.preventDefault()),(e==="ArrowDown"||e==="j"&&s)&&(this.selectedIndex=Math.min(this.hits.length,this.selectedIndex+1),t.preventDefault()),e==="Enter"){const n=this.hits[this.selectedIndex-1];n&&this.handleOpenLink(n)}},this.addEventListener("keydown",this.handleKeydown)}render(){return S` +`;var z=globalThis&&globalThis.__decorate||function(i,t,e,s){var r=arguments.length,o=r<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,s);else for(var a=i.length-1;a>=0;a--)(n=i[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o};let E=class extends C{constructor(){super(),this.baseUrl="",this.hits=[],this.loading=!1,this.selectedIndex=0,this.inputRef=me(),this.fetchHits=Fe(async t=>{const s=await(await fetch(`${this.baseUrl}/apis/api.halo.run/v1alpha1/indices/post?keyword=${t}&highlightPreTag=%3Cmark%3E&highlightPostTag=%3C/mark%3E`)).json();this.hits=s.hits||[],this.loading=!1},300),this.handleKeydown=t=>{const{key:e,ctrlKey:s}=t;if((e==="ArrowUp"||e==="k"&&s)&&(this.selectedIndex=Math.max(0,this.selectedIndex-1),t.preventDefault()),(e==="ArrowDown"||e==="j"&&s)&&(this.selectedIndex=Math.min(this.hits.length,this.selectedIndex+1),t.preventDefault()),e==="Enter"){const r=this.hits[this.selectedIndex-1];r&&this.handleOpenLink(r)}},this.addEventListener("keydown",this.handleKeydown)}render(){return w`
- ${!this.loading&&this.hits.length===0?S`
+ ${!this.loading&&this.hits.length===0?w`
没有搜索结果
`:""} - ${this.loading?S`
搜索中...
`:S` + ${this.loading?w`
搜索中...
`:w`
    - ${this.hits.map((t,e)=>S`
  • + ${this.hits.map((t,e)=>w`
  • @@ -249,6 +249,50 @@ var SearchWidget=function($){var zt;"use strict";/**
`}firstUpdated(t){var e;super.firstUpdated(t),(e=this.inputRef.value)==null||e.focus()}onInput(t){const s=t.target.value;if(this.selectedIndex=0,s===""){this.hits=[];return}this.loading=!0,this.fetchHits(s)}handleOpenLink(t){window.location.href=t.permalink}};E.styles=[Je,tt` + :host { + --color-form-input-bg: var( + --halo-search-widget-color-form-input-bg, + #fff + ); + --color-form-input: var(--halo-search-widget-color-form-input, #333); + --color-form-input-placeholder: var( + --halo-search-widget-color-form-input-placeholder, + rgb(107 114 128) + ); + --color-form-divider: var( + --halo-search-widget-color-form-divider, + rgb(243 244 246) + ); + --color-result-empty: var( + --halo-search-widget-color-result-empty, + rgb(107 114 128) + ); + --color-result-item-bg: var( + --halo-search-widget-color-result-item-bg, + rgb(249 250 251) + ); + --color-result-item-hover-bg: var( + --halo-search-widget-color-result-item-hover-bg, + rgb(243 244 246) + ); + --color-result-item-title: var( + --halo-search-widget-color-result-item-title, + #333 + ); + --color-result-item-content: var( + --halo-search-widget-color-result-item-content, + rgb(75, 85, 99) + ); + --color-command-kbd-item: var( + --halo-search-widget-color-command-kbd-item, + #333 + ); + --color-command-kbd-border: var( + --halo-search-widget-color-command-kbd-border, + #e5e7eb + ); + } + :host * { box-sizing: border-box; border-width: 0; @@ -264,11 +308,11 @@ var SearchWidget=function($){var zt;"use strict";/** .search-form__input { border-bottom-width: 1px; - border-color: rgb(243 244 246); + border-color: var(--color-form-divider); padding: 0.625rem 1rem; position: sticky; top: 0; - background-color: #fff; + background-color: var(--color-form-input-bg); } .search-form__input input { @@ -279,6 +323,12 @@ var SearchWidget=function($){var zt;"use strict";/** border: none; font-size: 1rem; line-height: 1.5rem; + background-color: var(--color-form-input-bg); + color: var(--color-form-input); + } + + .search-form__input input::placeholder { + color: var(--color-form-input-placeholder); } .search-form__result { @@ -292,7 +342,7 @@ var SearchWidget=function($){var zt;"use strict";/** justify-content: center; font-size: 0.875rem; line-height: 1.25rem; - color: rgb(107 114 128); + color: var(--color-result-empty); } .search-form__result-wrapper { @@ -316,13 +366,13 @@ var SearchWidget=function($){var zt;"use strict";/** flex-direction: column; gap: 0.25rem; border-radius: 0.375rem; - background-color: rgb(249 250 251); + background-color: var(--color-result-item-bg); padding: 0.5rem 0.625rem; } .search-form__result-item:hover, .search-form__result-item.selected { - background-color: rgb(243 244 246); + background-color: var(--color-result-item-hover-bg); } .search-form__result-item-title { @@ -331,19 +381,20 @@ var SearchWidget=function($){var zt;"use strict";/** font-weight: 600; padding: 0; margin: 0; + color: var(--color-result-item-title); } .search-form__result-item-content { font-size: 0.75rem; line-height: 1rem; - color: rgb(75 85 99); + color: var(--color-result-item-content); padding: 0; margin: 0; } .search-form__commands { border-top-width: 1px; - border-color: rgb(243 244 246); + border-color: var(--color-form-divider); padding: 0.625rem 1rem; display: flex; justify-content: flex-end; @@ -358,33 +409,45 @@ var SearchWidget=function($){var zt;"use strict";/** .search-form__commands-item span { font-size: 0.75rem; line-height: 1rem; - color: rgb(75 85 99); + color: var(--color-command-kbd-item); } .search-form__commands-item kbd { - color: rgb(75 85 99); + color: var(--color-command-kbd-item); font-size: 10px; text-align: center; padding: 0.125rem 0.3rem; border-width: 1px; border-radius: 0.25rem; + border-color: var(--color-command-kbd-border); min-width: 1.25rem; margin-left: 0.3rem; box-shadow: 0 0 #0000, 0 0 #0000, 0 1px 2px 0 rgb(0 0 0 / 0.05); } - `],z([V({type:String})],E.prototype,"baseUrl",void 0),z([ot()],E.prototype,"hits",void 0),z([ot()],E.prototype,"loading",void 0),z([ot()],E.prototype,"selectedIndex",void 0),E=z([kt("search-form")],E);/** + `],z([V({type:String})],E.prototype,"baseUrl",void 0),z([nt()],E.prototype,"hits",void 0),z([nt()],E.prototype,"loading",void 0),z([nt()],E.prototype,"selectedIndex",void 0),E=z([kt("search-form")],E);/** * @license * Copyright 2018 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const Rt="important",Ze=" !"+Rt,Qe=F(class extends q{constructor(i){var t;if(super(i),i.type!==K.ATTRIBUTE||i.name!=="style"||((t=i.strings)==null?void 0:t.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(i){return Object.keys(i).reduce((t,e)=>{const s=i[e];return s==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`},"")}update(i,[t]){const{style:e}=i.element;if(this.ut===void 0)return this.ut=new Set(Object.keys(t)),this.render(t);for(const s of this.ut)t[s]==null&&(this.ut.delete(s),s.includes("-")?e.removeProperty(s):e[s]=null);for(const s in t){const n=t[s];if(n!=null){this.ut.add(s);const r=typeof n=="string"&&n.endsWith(Ze);s.includes("-")||r?e.setProperty(s,r?n.slice(0,-11):n,r?Rt:""):e[s]=n}}return g}});var dt=globalThis&&globalThis.__decorate||function(i,t,e,s){var n=arguments.length,r=n<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(i,t,e,s);else for(var a=i.length-1;a>=0;a--)(o=i[a])&&(r=(n<3?o(r):n>3?o(t,e,r):o(t,e))||r);return n>3&&r&&Object.defineProperty(t,e,r),r};$.SearchModal=class extends C{constructor(){super(...arguments),this.open=!1,this.baseUrl="",this.handleKeydown=t=>{const{key:e}=t;e==="Escape"&&(this.close(),t.preventDefault())}}render(){return S`
2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(i){return Object.keys(i).reduce((t,e)=>{const s=i[e];return s==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`},"")}update(i,[t]){const{style:e}=i.element;if(this.ut===void 0)return this.ut=new Set(Object.keys(t)),this.render(t);for(const s of this.ut)t[s]==null&&(this.ut.delete(s),s.includes("-")?e.removeProperty(s):e[s]=null);for(const s in t){const r=t[s];if(r!=null){this.ut.add(s);const o=typeof r=="string"&&r.endsWith(Ze);s.includes("-")||o?e.setProperty(s,o?r.slice(0,-11):r,o?Rt:""):e[s]=r}}return $}});var dt=globalThis&&globalThis.__decorate||function(i,t,e,s){var r=arguments.length,o=r<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,s);else for(var a=i.length-1;a>=0;a--)(n=i[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o};g.SearchModal=class extends C{constructor(){super(...arguments),this.open=!1,this.baseUrl="",this.handleKeydown=t=>{const{key:e}=t;e==="Escape"&&(this.close(),t.preventDefault())}}render(){return w``}close(){this.open=!1}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.handleKeydown)}disconnectedCallback(){window.removeEventListener("keydown",this.handleKeydown),super.disconnectedCallback()}},$.SearchModal.styles=tt` +
`}close(){this.open=!1}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.handleKeydown)}disconnectedCallback(){window.removeEventListener("keydown",this.handleKeydown),super.disconnectedCallback()}},g.SearchModal.styles=tt` + :host { + --color-modal-layer: var( + --halo-search-widget-color-modal-layer, + rgb(107 114 128 / 0.75) + ); + --color-modal-content-bg: var( + --halo-search-widget-color-modal-content-bg, + #fff + ); + } + .modal__wrapper { position: fixed; left: 0px; @@ -407,7 +470,7 @@ var SearchWidget=function($){var zt;"use strict";/** height: 100%; width: 100%; flex: none; - background-color: rgb(107 114 128 / 0.75); + background-color: var(--color-modal-layer); animation: fadeIn 0.15s both; } @@ -417,7 +480,7 @@ var SearchWidget=function($){var zt;"use strict";/** flex-direction: column; align-items: stretch; border-radius: 5px; - background-color: #fff; + background-color: var(--color-modal-content-bg); width: calc(100vw - 20px); max-height: calc(100vh - 5rem); max-width: 650px; @@ -446,4 +509,4 @@ var SearchWidget=function($){var zt;"use strict";/** transform: translate3d(0, 0, 0); } } - `,dt([V({type:Boolean})],$.SearchModal.prototype,"open",void 0),dt([V({type:String})],$.SearchModal.prototype,"baseUrl",void 0),$.SearchModal=dt([kt("search-modal")],$.SearchModal);const Ht=document.createElement("search-modal");document.body.append(Ht);function Xe(){Ht.open=!0}return $.open=Xe,Object.defineProperty($,Symbol.toStringTag,{value:"Module"}),$}({}); + `,dt([V({type:Boolean})],g.SearchModal.prototype,"open",void 0),dt([V({type:String})],g.SearchModal.prototype,"baseUrl",void 0),g.SearchModal=dt([kt("search-modal")],g.SearchModal);const ii="",Ht=document.createElement("search-modal");document.body.append(Ht);function Xe(){Ht.open=!0}return g.open=Xe,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"}),g}({}); diff --git a/src/main/resources/static/style.css b/src/main/resources/static/style.css new file mode 100644 index 0000000..ef427e9 --- /dev/null +++ b/src/main/resources/static/style.css @@ -0,0 +1 @@ +@media (prefers-color-scheme: dark){.color-scheme-auto,[data-color-scheme=auto]{color-scheme:dark;--halo-search-widget-color-modal-layer: rgba(0, 0, 0, .8);--halo-search-widget-color-modal-content-bg: rgb(15 23 42);--halo-search-widget-color-form-input: rgb(255, 255, 255);--halo-search-widget-color-form-input-placeholder: rgb(148 163 184);--halo-search-widget-color-form-input-bg: rgb(15 23 42);--halo-search-widget-color-form-divider: rgb(30 41 59);--halo-search-widget-color-result-item-bg: rgb(30 41 59);--halo-search-widget-color-result-item-hover-bg: rgb(51 65 85);--halo-search-widget-color-result-item-title: rgb(255 255 255);--halo-search-widget-color-result-item-content: rgb(148 163 184);--halo-search-widget-color-command-kbd-item: rgb(148 163 184);--halo-search-widget-color-command-kbd-border: rgb(30 41 59);--halo-search-widget-color-result-empty: rgb(148 163 184)}}.color-scheme-dark,.dark,[data-color-scheme=dark]{color-scheme:dark;--halo-search-widget-color-modal-layer: rgba(0, 0, 0, .8);--halo-search-widget-color-modal-content-bg: rgb(15 23 42);--halo-search-widget-color-form-input: rgb(255, 255, 255);--halo-search-widget-color-form-input-placeholder: rgb(148 163 184);--halo-search-widget-color-form-input-bg: rgb(15 23 42);--halo-search-widget-color-form-divider: rgb(30 41 59);--halo-search-widget-color-result-item-bg: rgb(30 41 59);--halo-search-widget-color-result-item-hover-bg: rgb(51 65 85);--halo-search-widget-color-result-item-title: rgb(255 255 255);--halo-search-widget-color-result-item-content: rgb(148 163 184);--halo-search-widget-color-command-kbd-item: rgb(148 163 184);--halo-search-widget-color-command-kbd-border: rgb(30 41 59);--halo-search-widget-color-result-empty: rgb(148 163 184)}