@lytjs/plugin-theme 4.0.5 → 4.1.0

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/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var p=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var z=(i,n)=>{for(var l in n)p(i,l,{get:n[l],enumerable:!0})},B=(i,n,l,f)=>{if(n&&typeof n=="object"||typeof n=="function")for(let g of K(n))!Q.call(i,g)&&g!==l&&p(i,g,{get:()=>n[g],enumerable:!(f=H(n,g))||f.enumerable});return i};var R=i=>B(p({},"__esModule",{value:!0}),i);var G={};z(G,{BUILT_IN_THEMES:()=>$,createTheme:()=>q});module.exports=R(G);var $={light:{"--bg":"#ffffff","--bg-secondary":"#f5f5f5","--text":"#333333","--text-secondary":"#666666","--text-muted":"#999999","--primary":"#42b883","--primary-hover":"#3aa876","--secondary":"#35495e","--success":"#10b981","--warning":"#f59e0b","--error":"#ef4444","--info":"#3b82f6","--border":"#e5e7eb","--shadow":"rgba(0, 0, 0, 0.1)"},dark:{"--bg":"#1a1a1a","--bg-secondary":"#2d2d2d","--text":"#e5e5e5","--text-secondary":"#a3a3a3","--text-muted":"#737373","--primary":"#42b883","--primary-hover":"#3aa876","--secondary":"#94a3b8","--success":"#10b981","--warning":"#f59e0b","--error":"#ef4444","--info":"#3b82f6","--border":"#404040","--shadow":"rgba(0, 0, 0, 0.3)"}};function y(){return document.documentElement}function U(i){return(...n)=>{}}function q(i={}){let{default:n="light",storageKey:l="lyt_theme",themes:f={},onChange:g,autoDetect:w=!0,useDataAttribute:C=!0,cssPrefix:h="--lyt-",debug:x=!1}=i,o=U(x),s={...$,...f},a=n,d={};function k(){try{let e=localStorage.getItem(l);if(e&&s[e])return e}catch(e){}return null}function E(e){try{localStorage.setItem(l,e)}catch(t){}}function P(){var e;return typeof window=="undefined"?"light":(e=window.matchMedia)!=null&&e.call(window,"(prefers-color-scheme: dark)").matches?"dark":"light"}function V(e){if(typeof window=="undefined"||!window.matchMedia)return()=>{};let t=window.matchMedia("(prefers-color-scheme: dark)");function r(c){e(c.matches?"dark":"light")}return t.addEventListener("change",r),()=>t.removeEventListener("change",r)}function u(e){let t=y(),r=s[e];if(!r){o(`theme '${e}' not found`);return}o(`applying theme '${e}'`,r),Object.entries(r).forEach(([c,v])=>{let T=c.startsWith("--")?c:`${h}${c}`;t.style.setProperty(T,v)}),Object.entries(d).forEach(([c,v])=>{let T=c.startsWith("--")?c:`${h}${c}`;t.style.setProperty(T,v)}),C&&t.setAttribute("data-theme",e),t.style.setProperty("color-scheme",e==="dark"?"dark":"light")}function m(e){if(!s[e]){o(`theme '${e}' not found, available:`,Object.keys(s));return}let t=a;t!==e&&(a=e,u(e),E(e),g&&g(e,t),o(`theme changed from '${t}' to '${e}'`))}function O(){let e=Object.keys(s),r=(e.indexOf(a)+1)%e.length;m(e[r])}function S(){m(n)}function j(){return Object.keys(s)}function I(e,t){s[e]=t,o(`added/updated theme '${e}'`,t),a===e&&u(e)}function L(e){if(e===n){o("cannot remove default theme");return}delete s[e],a===e&&m(n),o(`removed theme '${e}'`)}function M(){return s[a]||null}function D(e){return s[e]||null}function W(e,t){let r=e.startsWith("--")?e:`${h}${e}`;d[r]=t,y().style.setProperty(r,t),o(`set variable '${r}' = '${t}'`)}function _(e){let t=e.startsWith("--")?e:`${h}${e}`;delete d[t],y().style.removeProperty(t),o(`cleared variable '${t}'`)}function A(){Object.keys(d).forEach(e=>{y().style.removeProperty(e)}),Object.keys(d).forEach(e=>delete d[e]),u(a),o("cleared all dynamic variables")}function F(){let e=k();if(!e&&w){let t=P();e=s[t]?t:n}e||(e=n),o(`initializing with theme '${e}'`),a=e,u(e)}F();let b={install(e,t){e.config=e.config||{},e.config.globalProperties=e.config.globalProperties||{},e.config.globalProperties.$theme=b,typeof e.provide=="function"&&e.provide("theme",b)},get current(){return a},set:m,toggle:O,reset:S,list:j,addTheme:I,removeTheme:L,getConfig:M,getConfigFor:D,setVariable:W,clearVariable:_,clearVariables:A,getSystemPreference:P,watchSystemPreference:V};return b}
1
+ var p=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var z=(i,n)=>{for(var l in n)p(i,l,{get:n[l],enumerable:!0})},B=(i,n,l,f)=>{if(n&&typeof n=="object"||typeof n=="function")for(let g of K(n))!Q.call(i,g)&&g!==l&&p(i,g,{get:()=>n[g],enumerable:!(f=H(n,g))||f.enumerable});return i};var R=i=>B(p({},"__esModule",{value:!0}),i);var G={};z(G,{BUILT_IN_THEMES:()=>$,createTheme:()=>q});module.exports=R(G);var $={light:{"--bg":"#ffffff","--bg-secondary":"#f5f5f5","--text":"#333333","--text-secondary":"#666666","--text-muted":"#999999","--primary":"#42b883","--primary-hover":"#3aa876","--secondary":"#35495e","--success":"#10b981","--warning":"#f59e0b","--error":"#ef4444","--info":"#3b82f6","--border":"#e5e7eb","--shadow":"rgba(0, 0, 0, 0.1)"},dark:{"--bg":"#1a1a1a","--bg-secondary":"#2d2d2d","--text":"#e5e5e5","--text-secondary":"#a3a3a3","--text-muted":"#737373","--primary":"#42b883","--primary-hover":"#3aa876","--secondary":"#94a3b8","--success":"#10b981","--warning":"#f59e0b","--error":"#ef4444","--info":"#3b82f6","--border":"#404040","--shadow":"rgba(0, 0, 0, 0.3)"}};function y(){return document.documentElement}function U(i){return(...n)=>{}}function q(i={}){let{default:n="light",storageKey:l="lyt_theme",themes:f={},onChange:g,autoDetect:w=!0,useDataAttribute:C=!0,cssPrefix:h="--lyt-",debug:x=!1}=i,o=U(x),s={...$,...f},a=n,d={};function k(){try{let e=localStorage.getItem(l);if(e&&s[e])return e}catch(e){}return null}function E(e){try{localStorage.setItem(l,e)}catch(t){}}function P(){var e;return typeof window=="undefined"?"light":(e=window.matchMedia)!=null&&e.call(window,"(prefers-color-scheme: dark)").matches?"dark":"light"}function V(e){if(typeof window=="undefined"||!window.matchMedia)return()=>{};let t=window.matchMedia("(prefers-color-scheme: dark)");function r(c){e(c.matches?"dark":"light")}return t.addEventListener("change",r),()=>t.removeEventListener("change",r)}function u(e){let t=y(),r=s[e];if(!r){o(`theme '${e}' not found`);return}o(`applying theme '${e}'`,r),Object.entries(r).forEach(([c,v])=>{let T=c.startsWith("--")?c:`${h}${c}`;t.style.setProperty(T,v)}),Object.entries(d).forEach(([c,v])=>{let T=c.startsWith("--")?c:`${h}${c}`;t.style.setProperty(T,v)}),C&&t.setAttribute("data-theme",e),t.style.setProperty("color-scheme",e==="dark"?"dark":"light")}function m(e){if(!s[e]){o(`theme '${e}' not found, available:`,Object.keys(s));return}let t=a;t!==e&&(a=e,u(e),E(e),g&&g(e,t),o(`theme changed from '${t}' to '${e}'`))}function O(){let e=Object.keys(s),r=(e.indexOf(a)+1)%e.length;m(e[r])}function S(){m(n)}function j(){return Object.keys(s)}function I(e,t){s[e]=t,o(`added/updated theme '${e}'`,t),a===e&&u(e)}function L(e){if(e===n){o("cannot remove default theme");return}delete s[e],a===e&&m(n),o(`removed theme '${e}'`)}function M(){return s[a]||null}function D(e){return s[e]||null}function W(e,t){let r=e.startsWith("--")?e:`${h}${e}`;d[r]=t,y().style.setProperty(r,t),o(`set variable '${r}' = '${t}'`)}function _(e){let t=e.startsWith("--")?e:`${h}${e}`;delete d[t],y().style.removeProperty(t),o(`cleared variable '${t}'`)}function A(){Object.keys(d).forEach(e=>{y().style.removeProperty(e)}),Object.keys(d).forEach(e=>delete d[e]),u(a),o("cleared all dynamic variables")}function F(){let e=k();if(!e&&w){let t=P();e=s[t]?t:n}e||(e=n),o(`initializing with theme '${e}'`),a=e,u(e)}F();let b={install(e,t){e.config=e.config||{},e.config.globalProperties=e.config.globalProperties||{},e.config.globalProperties.$theme=b,typeof e.provide=="function"&&e.provide("theme",b)},get current(){return a},set:m,toggle:O,reset:S,list:j,addTheme:I,removeTheme:L,getConfig:M,getConfigFor:D,setVariable:W,clearVariable:_,clearVariables:A,getSystemPreference:P,watchSystemPreference:V};return b}
@@ -0,0 +1 @@
1
+ {"fileNames":["../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.dom.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.scripthost.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.full.d.ts","../src/index.ts"],"fileInfos":[{"version":"bcd24271a113971ba9eb71ff8cb01bc6b0f872a85c23fdbe5d93065b375933cd","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"3f88bedbeb09c6f5a6645cb24c7c55f1aa22d19ae96c8e6959cbd8b85a707bc6","signature":false,"impliedFormat":1},{"version":"7fe93b39b810eadd916be8db880dd7f0f7012a5cc6ffb62de8f62a2117fa6f1f","signature":false,"impliedFormat":1},{"version":"bb0074cc08b84a2374af33d8bf044b80851ccc9e719a5e202eacf40db2c31600","signature":false,"impliedFormat":1},{"version":"1a7daebe4f45fb03d9ec53d60008fbf9ac45a697fdc89e4ce218bc94b94f94d6","signature":false,"impliedFormat":1},{"version":"f94b133a3cb14a288803be545ac2683e0d0ff6661bcd37e31aaaec54fc382aed","signature":false,"impliedFormat":1},{"version":"f59d0650799f8782fd74cf73c19223730c6d1b9198671b1c5b3a38e1188b5953","signature":false,"impliedFormat":1},{"version":"8a15b4607d9a499e2dbeed9ec0d3c0d7372c850b2d5f1fb259e8f6d41d468a84","signature":false,"impliedFormat":1},{"version":"26e0fe14baee4e127f4365d1ae0b276f400562e45e19e35fd2d4c296684715e6","signature":false,"impliedFormat":1},{"version":"d6b1eba8496bdd0eed6fc8a685768fe01b2da4a0388b5fe7df558290bffcf32f","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"7f57fc4404ff020bc45b9c620aff2b40f700b95fe31164024c453a5e3c163c54","signature":false,"impliedFormat":1},{"version":"7f57fc4404ff020bc45b9c620aff2b40f700b95fe31164024c453a5e3c163c54","signature":false,"impliedFormat":1},{"version":"2a2de5b9459b3fc44decd9ce6100b72f1b002ef523126c1d3d8b2a4a63d74d78","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"f13f4b465c99041e912db5c44129a94588e1aafee35a50eab51044833f50b4ee","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"eadcffda2aa84802c73938e589b9e58248d74c59cb7fcbca6474e3435ac15504","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"105ba8ff7ba746404fe1a2e189d1d3d2e0eb29a08c18dded791af02f29fb4711","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"00343ca5b2e3d48fa5df1db6e32ea2a59afab09590274a6cccb1dbae82e60c7c","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"ebd9f816d4002697cb2864bea1f0b70a103124e18a8cd9645eeccc09bdf80ab4","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"2c1afac30a01772cd2a9a298a7ce7706b5892e447bb46bdbeef720f7b5da77ad","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"7b0225f483e4fa685625ebe43dd584bb7973bbd84e66a6ba7bbe175ee1048b4f","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"c0a4b8ac6ce74679c1da2b3795296f5896e31c38e888469a8e0f99dc3305de60","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"3084a7b5f569088e0146533a00830e206565de65cae2239509168b11434cd84f","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"c5079c53f0f141a0698faa903e76cb41cd664e3efb01cc17a5c46ec2eb0bef42","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"32cafbc484dea6b0ab62cf8473182bbcb23020d70845b406f80b7526f38ae862","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"fca4cdcb6d6c5ef18a869003d02c9f0fd95df8cfaf6eb431cd3376bc034cad36","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"b93ec88115de9a9dc1b602291b85baf825c85666bf25985cc5f698073892b467","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"f5c06dcc3fe849fcb297c247865a161f995cc29de7aa823afdd75aaaddc1419b","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"b77e16112127a4b169ef0b8c3a4d730edf459c5f25fe52d5e436a6919206c4d7","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"fbffd9337146eff822c7c00acbb78b01ea7ea23987f6c961eba689349e744f8c","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"a995c0e49b721312f74fdfb89e4ba29bd9824c770bbb4021d74d2bf560e4c6bd","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"c7b3542146734342e440a84b213384bfa188835537ddbda50d30766f0593aff9","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"ce6180fa19b1cccd07ee7f7dbb9a367ac19c0ed160573e4686425060b6df7f57","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"3f02e2476bccb9dbe21280d6090f0df17d2f66b74711489415a8aa4df73c9675","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"45e3ab34c1c013c8ab2dc1ba4c80c780744b13b5676800ae2e3be27ae862c40c","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"805c86f6cca8d7702a62a844856dbaa2a3fd2abef0536e65d48732441dde5b5b","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"e42e397f1a5a77994f0185fd1466520691456c772d06bf843e5084ceb879a0ad","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"f4c2b41f90c95b1c532ecc874bd3c111865793b23aebcc1c3cbbabcd5d76ffb0","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"ab26191cfad5b66afa11b8bf935ef1cd88fabfcb28d30b2dfa6fad877d050332","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"2088bc26531e38fb05eedac2951480db5309f6be3fa4a08d2221abb0f5b4200d","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"cb9d366c425fea79716a8fb3af0d78e6b22ebbab3bd64d25063b42dc9f531c1e","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"500934a8089c26d57ebdb688fc9757389bb6207a3c8f0674d68efa900d2abb34","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"689da16f46e647cef0d64b0def88910e818a5877ca5379ede156ca3afb780ac3","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"bc21cc8b6fee4f4c2440d08035b7ea3c06b3511314c8bab6bef7a92de58a2593","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"7ca53d13d2957003abb47922a71866ba7cb2068f8d154877c596d63c359fed25","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"54725f8c4df3d900cb4dac84b64689ce29548da0b4e9b7c2de61d41c79293611","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"e5594bc3076ac29e6c1ebda77939bc4c8833de72f654b6e376862c0473199323","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"2f3eb332c2d73e729f3364fcc0c2b375e72a121e8157d25a82d67a138c83a95c","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"6f4427f9642ce8d500970e4e69d1397f64072ab73b97e476b4002a646ac743b1","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"48915f327cd1dea4d7bd358d9dc7732f58f9e1626a29cc0c05c8c692419d9bb7","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"b7bf9377723203b5a6a4b920164df22d56a43f593269ba6ae1fdc97774b68855","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"db9709688f82c9e5f65a119c64d835f906efe5f559d08b11642d56eb85b79357","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"4b25b8c874acd1a4cf8444c3617e037d444d19080ac9f634b405583fd10ce1f7","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"37be57d7c90cf1f8112ee2636a068d8fd181289f82b744160ec56a7dc158a9f5","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"a917a49ac94cd26b754ab84e113369a75d1a47a710661d7cd25e961cc797065f","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"6d3261badeb7843d157ef3e6f5d1427d0eeb0af0cf9df84a62cfd29fd47ac86e","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"195daca651dde22f2167ac0d0a05e215308119a3100f5e6268e8317d05a92526","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"8b11e4285cd2bb164a4dc09248bdec69e9842517db4ca47c1ba913011e44ff2f","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"0508571a52475e245b02bc50fa1394065a0a3d05277fbf5120c3784b85651799","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"8f9af488f510c3015af3cc8c267a9e9d96c4dd38a1fdff0e11dc5a544711415b","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"fc611fea8d30ea72c6bbfb599c9b4d393ce22e2f5bfef2172534781e7d138104","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"1ce14b81c5cc821994aa8ec1d42b220dd41b27fcc06373bce3958af7421b77d4","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"b3a048b3e9302ef9a34ef4ebb9aecfb28b66abb3bce577206a79fee559c230da","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"01a30f9e8582b369075c0808df71121e6855cb06fd8d3d39511d9ebb66405205","signature":false,"impliedFormat":1},{"version":"24aeb0f3361c6622b0e3ba7ef969865b7b59cd19400cd417eb805addd9bbabac","signature":false}],"root":[64],"options":{"allowImportingTsExtensions":true,"composite":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"exactOptionalPropertyTypes":true,"module":99,"noEmitOnError":false,"noFallthroughCasesInSwitch":true,"noImplicitOverride":true,"noImplicitReturns":true,"noUncheckedIndexedAccess":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./types","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":9,"useDefineForClassFields":true,"verbatimModuleSyntax":true},"changeFileSet":[61,62,12,10,11,16,15,2,17,18,19,20,21,22,23,24,3,25,26,4,27,31,28,29,30,32,33,34,5,35,36,37,38,6,42,39,40,41,43,7,44,49,50,45,46,47,48,8,54,51,52,53,55,9,56,63,57,58,60,59,1,14,13,64],"version":"6.0.2"}
@@ -0,0 +1,71 @@
1
+ /** 主题配置 */
2
+ interface ThemeConfig {
3
+ /** CSS 变量键值对 */
4
+ [key: string]: string;
5
+ }
6
+ /** 主题插件配置选项 */
7
+ interface ThemeOptions {
8
+ /** 默认主题,默认 'light' */
9
+ default?: string;
10
+ /** localStorage 中存储主题的 key,默认 'lyt_theme' */
11
+ storageKey?: string;
12
+ /** 主题配置对象 */
13
+ themes?: {
14
+ [themeName: string]: ThemeConfig;
15
+ };
16
+ /** 主题切换时的回调 */
17
+ onChange?: (newTheme: string, oldTheme: string) => void;
18
+ /** 是否自动检测系统主题偏好 */
19
+ autoDetect?: boolean;
20
+ /** 是否添加 data-theme 属性到 html 标签 */
21
+ useDataAttribute?: boolean;
22
+ /** 自定义 CSS 变量前缀,默认 '--lyt-' */
23
+ cssPrefix?: string;
24
+ /** 是否开启调试模式 */
25
+ debug?: boolean;
26
+ }
27
+ /** 主题插件实例 */
28
+ interface ThemePlugin {
29
+ /** 安装到 Lyt 应用 */
30
+ install: (app: any, options?: any) => void;
31
+ /** 当前主题名称 */
32
+ readonly current: string;
33
+ /** 切换到指定主题 */
34
+ set(themeName: string): void;
35
+ /** 切换主题(在预设主题间循环) */
36
+ toggle(): void;
37
+ /** 重置为默认主题 */
38
+ reset(): void;
39
+ /** 获取所有可用主题列表 */
40
+ list(): string[];
41
+ /** 动态添加/更新主题 */
42
+ addTheme(name: string, config: ThemeConfig): void;
43
+ /** 移除主题 */
44
+ removeTheme(name: string): void;
45
+ /** 获取当前主题的 CSS 变量配置 */
46
+ getConfig(): ThemeConfig | null;
47
+ /** 获取指定主题的 CSS 变量配置 */
48
+ getConfigFor(themeName: string): ThemeConfig | null;
49
+ /** 动态设置 CSS 变量(不保存到持久化) */
50
+ setVariable(key: string, value: string): void;
51
+ /** 清除动态设置的 CSS 变量 */
52
+ clearVariable(key: string): void;
53
+ /** 清除所有动态变量 */
54
+ clearVariables(): void;
55
+ /** 获取系统偏好主题('light' 或 'dark') */
56
+ getSystemPreference(): 'light' | 'dark';
57
+ /** 监听系统主题变化 */
58
+ watchSystemPreference(callback: (theme: 'light' | 'dark') => void): () => void;
59
+ }
60
+ declare const BUILT_IN_THEMES: {
61
+ [key: string]: ThemeConfig;
62
+ };
63
+ /**
64
+ * 创建主题切换插件实例
65
+ * @param options 主题配置
66
+ * @returns ThemePlugin 插件实例
67
+ */
68
+ declare function createTheme(options?: ThemeOptions): ThemePlugin;
69
+ export { createTheme, BUILT_IN_THEMES };
70
+ export type { ThemeOptions, ThemePlugin, ThemeConfig };
71
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAmBA,WAAW;AACX,UAAU,WAAW;IACnB,gBAAgB;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CACtB;AAED,eAAe;AACf,UAAU,YAAY;IACpB,sBAAsB;IACtB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,aAAa;IACb,MAAM,CAAC,EAAE;QACP,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,CAAA;KACjC,CAAA;IACD,eAAe;IACf,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACvD,mBAAmB;IACnB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,kCAAkC;IAClC,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,+BAA+B;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,eAAe;IACf,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,aAAa;AACb,UAAU,WAAW;IACnB,iBAAiB;IACjB,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,IAAI,CAAA;IAC1C,aAAa;IACb,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,cAAc;IACd,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,qBAAqB;IACrB,MAAM,IAAI,IAAI,CAAA;IACd,cAAc;IACd,KAAK,IAAI,IAAI,CAAA;IACb,iBAAiB;IACjB,IAAI,IAAI,MAAM,EAAE,CAAA;IAChB,gBAAgB;IAChB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAAA;IACjD,WAAW;IACX,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,uBAAuB;IACvB,SAAS,IAAI,WAAW,GAAG,IAAI,CAAA;IAC/B,uBAAuB;IACvB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAAA;IACnD,2BAA2B;IAC3B,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7C,qBAAqB;IACrB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,eAAe;IACf,cAAc,IAAI,IAAI,CAAA;IACtB,iCAAiC;IACjC,mBAAmB,IAAI,OAAO,GAAG,MAAM,CAAA;IACvC,eAAe;IACf,qBAAqB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI,CAAA;CAC/E;AAID,QAAA,MAAM,eAAe,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAA;CAiClD,CAAA;AAwBD;;;;GAIG;AACH,iBAAS,WAAW,CAAC,OAAO,GAAE,YAAiB,GAAG,WAAW,CAuS5D;AAED,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,CAAA;AACvC,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,CAAA"}
package/package.json CHANGED
@@ -1,14 +1,16 @@
1
1
  {
2
2
  "name": "@lytjs/plugin-theme",
3
- "version": "4.0.5",
3
+ "version": "4.1.0",
4
4
  "description": "Lyt.js 主题切换插件 - 支持亮色/暗色主题和自定义主题",
5
- "main": "./src/index.ts",
6
- "module": "./src/index.ts",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/types/index.d.ts",
7
8
  "exports": {
8
9
  ".": {
9
- "import": "./src/index.ts",
10
- "require": "./src/index.ts",
11
- "default": "./src/index.ts"
10
+ "types": "./dist/types/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.cjs",
13
+ "default": "./dist/index.mjs"
12
14
  }
13
15
  },
14
16
  "sideEffects": false,