v0.10.31: video widget 画幅档位(aspect_ratio 219=21:9)+ slim 白名单补 key + Elementor kit 全局色/排版变量补全(a:hover=secondary #FFA11B、4d5c430=#fff 白字修正)

This commit is contained in:
bigcode
2026-11-03 23:32:26 +08:00
parent 66532b1569
commit c1e82d4718
5 changed files with 44 additions and 6 deletions
+3
View File
@@ -36,6 +36,7 @@
"vite": "^8.3.5",
},
"devDependencies": {
"playwright-core": "^1.64.1",
"vite-tsconfig-paths": "^6.1.1",
},
},
@@ -633,6 +634,8 @@
"picomatch": ["picomatch@4.0.7", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="],
"playwright-core": ["playwright-core@1.64.1", "", { "bin": { "playwright-core": "cli.js" } }, "sha512-BC4s8y6SEVA6Q1rSxZTto8hI1KUI3xXlHGZgvGqP4IqPdI/a6FX9H29IDNz7vKo9l21b6LfYosScPL6M3xxyDQ=="],
"postcss": ["postcss@8.5.32", "", { "dependencies": { "nanoid": "^3.3.20", "picocolors": "^1.1.1", "source-map-js": "^1.2.2" } }, "sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g=="],
"prettier": ["prettier@3.9.10", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-skGHTH1Yb9QvaTC4hWnRTzEYtCpApF0UMBPz+t/0ZPzP8ihefo/btKd+QA7pUE0fEwA1SbS/NmhyEcstdXOIdA=="],
+2 -1
View File
@@ -1,6 +1,6 @@
{
"name": "dusuniot-rebuild",
"version": "0.10.30",
"version": "0.10.31",
"private": true,
"type": "module",
"scripts": {
@@ -45,6 +45,7 @@
"vite": "^8.3.5"
},
"devDependencies": {
"playwright-core": "^1.64.1",
"vite-tsconfig-paths": "^6.1.1"
}
}
+14 -2
View File
@@ -2056,15 +2056,27 @@ function TabsWidget({ settings }: { settings: Record<string, unknown> }) {
);
}
/** # 组件 video widget:YouTube iframe 嵌入 */
/** # 常量 Elementor 视频 aspect_ratio 选项 → 高宽比(原站 --video-aspect-ratio 取证) **/
const VIDEO_RATIO: Record<string, number> = {
"11": 1,
"169": 16 / 9,
"43": 4 / 3,
"32": 3 / 2,
"219": 21 / 9,
"439": 43 / 9,
"916": 9 / 16,
};
/** # 组件 video widget:YouTube iframe 嵌入(aspect_ratio 决定占位比,缺省 16:9) */
function VideoWidget({ settings }: { settings: Record<string, unknown> }) {
let raw = s((settings.youtube_url as { url?: string } | undefined)?.url) || s(settings.youtube_url) || s(settings.video_url) || s((settings as Record<string, unknown>).url);
if (!raw) return null;
// 把 youtube watch 链接转为 embed
const m = raw.match(/[?&]v=([\w-]{6,})/) || raw.match(/youtu\.be\/([\w-]{6,})/);
const src = m ? `https://www.youtube.com/embed/${m[1]}` : raw;
const ratio = VIDEO_RATIO[s(settings.aspect_ratio)] ?? 16 / 9;
return (
<div className="relative mb-[18px] pt-[56.25%]">
<div className="relative" style={{ paddingTop: `${((1 / ratio) * 100).toFixed(4)}%` }}>
<iframe src={src} title="video" allowFullScreen className="absolute inset-0 h-full w-full border-0" />
</div>
);
+2
View File
@@ -142,6 +142,8 @@ const SETTING_KEYS = new Set([
"tab_active_color",
"video_url",
"youtube_url",
// video widget 画幅(219=21:9 等;research-development 视频 42.857% 占位)
"aspect_ratio",
"map",
"posts_per_page",
// shortcode widget 源码([elementor-template id="N"] 内嵌模板、页脚菜单/gtranslate)
+23 -3
View File
@@ -119,9 +119,28 @@
/* # 成员变量 兼容变量:数据库 HTML 兼容样式与少量内联 style 仍引用旧变量名 **/
:root {
--brand: #ed6c00;
/* Elementor 全局色(页面生成 CSS 引用:page_css 的 var(--e-global-color-*)) */
/* Elementor 全局色(kit-15 post-15.css 取证 2026-11-03;page_css 的 var(--e-global-color-*) 引用) */
--e-global-color-primary: #ed6c00;
--e-global-color-4d5c430: #1c2b3a;
--e-global-color-secondary: #ffa11b;
--e-global-color-text: #000000;
--e-global-color-accent: #474dff;
--e-global-color-4d5c430: #ffffff;
--e-global-color-e4e3ba3: #4a75ff;
--e-global-color-282ef76: #5c5e66;
--e-global-color-6fba50b: #444444;
--e-global-color-78696cf: #00c1bc;
--e-global-color-a6f03ac: #e9e9e9;
--e-global-color-ee1917e: #e0e5f9;
--e-global-color-26331af: #f4f5f8;
/* Elementor 全局排版(kit-15):page_css 的 font-family/weight 引用 */
--e-global-typography-primary-font-family: "Roboto";
--e-global-typography-primary-font-weight: 600;
--e-global-typography-secondary-font-family: "Roboto";
--e-global-typography-secondary-font-weight: 400;
--e-global-typography-text-font-family: "Roboto";
--e-global-typography-text-font-weight: 400;
--e-global-typography-accent-font-family: "Roboto";
--e-global-typography-accent-font-weight: 500;
--brand-dark: #c85600;
--ink: #1c2b3a;
--muted: #5f7183;
@@ -144,7 +163,8 @@
}
img { max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
/* 原站 kit-15(post-15.css):a:hover = --e-global-color-secondary #FFA11B */
a:hover { color: var(--e-global-color-secondary, #ffa11b); }
}
/* # 函数 站点容器(1200px 居中 + 两侧 16px) **/