weifuwu 0.27.18 β†’ 0.27.20

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.js CHANGED
@@ -3681,7 +3681,7 @@ function wfuwAssets() {
3681
3681
  return new Response(jsContent, {
3682
3682
  headers: {
3683
3683
  "content-type": "application/javascript; charset=utf-8",
3684
- "cache-control": "public, max-age=31536000, immutable"
3684
+ "cache-control": "public, max-age=0, must-revalidate"
3685
3685
  }
3686
3686
  });
3687
3687
  });
@@ -3696,7 +3696,7 @@ function wfuwAssets() {
3696
3696
  return new Response(cssContent, {
3697
3697
  headers: {
3698
3698
  "content-type": "text/css; charset=utf-8",
3699
- "cache-control": "public, max-age=31536000, immutable"
3699
+ "cache-control": "public, max-age=0, must-revalidate"
3700
3700
  }
3701
3701
  });
3702
3702
  });
@@ -1,4 +1,6 @@
1
1
  {
2
+ "theme": { "dark": "πŸŒ™" },
3
+ "lang": { "zh": "δΈ­ζ–‡", "en": "EN" },
2
4
  "title": "Build APIs & UI, Zero Build Step",
3
5
  "cta": "Try Me",
4
6
  "docs": "Documentation",
@@ -1,4 +1,6 @@
1
1
  {
2
+ "theme": { "dark": "πŸŒ™" },
3
+ "lang": { "zh": "δΈ­ζ–‡", "en": "EN" },
2
4
  "title": "ι›ΆηΌ–θ―‘ζž„ε»Ί API ε’Œ UI",
3
5
  "cta": "体ιͺŒδΈ€δΈ‹",
4
6
  "docs": "ζ–‡ζ‘£",
@@ -3,33 +3,28 @@ import { html, raw } from 'weifuwu'
3
3
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
4
  export default function (ctx: any) {
5
5
  const t = ctx.i18n?.t || ((k: string) => k)
6
- const theme = ctx.theme?.value || 'system'
7
- const locale = ctx.i18n?.locale || 'en'
8
6
 
9
7
  return html`<div wu-data='${raw(JSON.stringify({ open: false }))}'>
10
- <!-- Navbar -->
11
8
  <nav class="wu-flex wu-items-center wu-justify-between wu-p-4 wu-border-bottom">
12
9
  <strong class="wu-text-lg">weifuwu</strong>
13
10
  <div class="wu-flex wu-gap-sm wu-items-center">
14
- <button wu-theme="dark" class="wu-btn wu-btn-sm">πŸŒ™</button>
15
- <button wu-lang="zh-CN" class="wu-btn wu-btn-sm">δΈ­ζ–‡</button>
11
+ <button wu-theme="dark" class="wu-btn wu-btn-sm" wu-text-key="theme.dark">πŸŒ™</button>
12
+ <button wu-lang="zh-CN" class="wu-btn wu-btn-sm" wu-text-key="lang.zh">δΈ­ζ–‡</button>
16
13
  </div>
17
14
  </nav>
18
15
 
19
- <!-- Hero -->
20
16
  <section class="wu-p-4" style="max-width: 640px; margin: 80px auto; text-align: center;">
21
- <h1 class="wu-text-2xl" style="margin-bottom: 8px;">${t('title')}</h1>
17
+ <h1 class="wu-text-2xl" style="margin-bottom: 8px;" wu-text-key="title">${t('title')}</h1>
22
18
  <p class="wu-text-secondary wu-text-md" style="margin-bottom: 32px;">
23
19
  Pure Node.js, no build step
24
20
  </p>
25
21
 
26
22
  <div class="wu-flex wu-justify-center wu-gap-md">
27
- <button class="wu-btn wu-btn-primary" wu-on="click: open = !open">${t('cta')}</button>
28
- <a href="https://weifuwu.dev" class="wu-btn" target="_blank"> ${t('docs')} </a>
23
+ <button class="wu-btn wu-btn-primary" wu-on="click: open = !open" wu-text-key="cta">${t('cta')}</button>
24
+ <a href="https://weifuwu.dev" class="wu-btn" target="_blank" wu-text-key="docs">${t('docs')}</a>
29
25
  </div>
30
26
 
31
- <!-- Demo: toggled content -->
32
- <div wu-show="open" class="wu-card" style="margin-top: 24px; text-align: left;">
27
+ <div wu-show="open" class="wu-card" style="margin-top: 24px; text-align: left;" wu-text-key="demo">
33
28
  ${t('demo')}
34
29
  </div>
35
30
  </section>
@@ -11,6 +11,7 @@
11
11
  * @license MIT
12
12
  * @version 0.1.0
13
13
  */
14
+ const WFU_VERSION = '0.27.19';
14
15
  (function () {
15
16
  'use strict'
16
17
 
@@ -757,8 +758,13 @@
757
758
  // Toggle all [wu-theme] buttons: dark ↔ light
758
759
  document.querySelectorAll('[wu-theme]').forEach((b) => {
759
760
  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')
761
+ if (v === 'dark') {
762
+ b.setAttribute('wu-theme', 'light')
763
+ b.textContent = 'β˜€οΈ'
764
+ } else if (v === 'light') {
765
+ b.setAttribute('wu-theme', 'dark')
766
+ b.textContent = 'πŸŒ™'
767
+ }
762
768
  })
763
769
  })
764
770
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weifuwu",
3
3
  "type": "module",
4
- "version": "0.27.18",
4
+ "version": "0.27.20",
5
5
  "description": "Web-standard HTTP microframework for Node.js β€” (req, ctx) => Response",
6
6
  "exports": {
7
7
  ".": "./dist/index.js"