weifuwu 0.27.16 β†’ 0.27.18

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.
@@ -12,9 +12,7 @@ export default function (ctx: any) {
12
12
  <strong class="wu-text-lg">weifuwu</strong>
13
13
  <div class="wu-flex wu-gap-sm wu-items-center">
14
14
  <button wu-theme="dark" class="wu-btn wu-btn-sm">πŸŒ™</button>
15
- <button wu-theme="light" class="wu-btn wu-btn-sm">β˜€οΈ</button>
16
15
  <button wu-lang="zh-CN" class="wu-btn wu-btn-sm">δΈ­ζ–‡</button>
17
- <button wu-lang="en" class="wu-btn wu-btn-sm">EN</button>
18
16
  </div>
19
17
  </nav>
20
18
 
@@ -754,6 +754,12 @@
754
754
  document.cookie = 'theme=' + value + '; Path=/; SameSite=Lax; Max-Age=31536000'
755
755
  // Sync with server (no redirect, JSON request)
756
756
  fetch('/__theme/' + value, { headers: { Accept: 'application/json' } }).catch(() => {})
757
+ // Toggle all [wu-theme] buttons: dark ↔ light
758
+ document.querySelectorAll('[wu-theme]').forEach((b) => {
759
+ const v = b.getAttribute('wu-theme')
760
+ if (v === 'dark') b.setAttribute('wu-theme', 'light')
761
+ else if (v === 'light') b.setAttribute('wu-theme', 'dark')
762
+ })
757
763
  })
758
764
 
759
765
  // ═══════════════════════════════════════════════════════════════════
@@ -777,6 +783,12 @@
777
783
  if (!btn) return
778
784
  const locale = btn.getAttribute('wu-lang')
779
785
  switchLocale(locale)
786
+ // Toggle all [wu-lang] buttons: zh-CN ↔ en
787
+ document.querySelectorAll('[wu-lang]').forEach((b) => {
788
+ const v = b.getAttribute('wu-lang')
789
+ if (v === 'zh-CN') b.setAttribute('wu-lang', 'en')
790
+ else if (v === 'en') b.setAttribute('wu-lang', 'zh-CN')
791
+ })
780
792
  })
781
793
 
782
794
  async function switchLocale(locale) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weifuwu",
3
3
  "type": "module",
4
- "version": "0.27.16",
4
+ "version": "0.27.18",
5
5
  "description": "Web-standard HTTP microframework for Node.js β€” (req, ctx) => Response",
6
6
  "exports": {
7
7
  ".": "./dist/index.js"