diff --git a/assets/admin/extract-naive-styles.mjs b/assets/admin/extract-naive-styles.mjs index caabd2b7..838de687 100644 --- a/assets/admin/extract-naive-styles.mjs +++ b/assets/admin/extract-naive-styles.mjs @@ -27,8 +27,7 @@ const COMPONENT_STYLES = [ // 内部基础组件 ['_internal/scrollbar/src/styles/index.cssr.mjs'], // 布局 - ['layout/src/styles/index.cssr.mjs'], - ['layout-sider/src/styles/index.cssr.mjs'], + ['layout/src/styles/layout.cssr.mjs'], // 导航 ['menu/src/styles/index.cssr.mjs'], ['breadcrumb/src/styles/index.cssr.mjs'], @@ -36,17 +35,19 @@ const COMPONENT_STYLES = [ ['steps/src/styles/index.cssr.mjs'], ['pagination/src/styles/index.cssr.mjs'], // 表单 - ['form/src/styles/index.cssr.mjs'], - ['form-item/src/styles/index.cssr.mjs'], - ['input/src/styles/index.cssr.mjs'], - ['input-number/src/styles/index.cssr.mjs'], + ['form/src/styles/form.cssr.mjs'], + ['form/src/styles/form-item.cssr.mjs'], + ['input/src/styles/input.cssr.mjs'], + ['input/src/styles/input-group.cssr.mjs'], + ['input-number/src/styles/input-number.cssr.mjs'], ['switch/src/styles/index.cssr.mjs'], ['select/src/styles/index.cssr.mjs'], - ['radio/src/styles/index.cssr.mjs'], + ['radio/src/styles/radio.cssr.mjs'], + ['radio/src/styles/radio-group.cssr.mjs'], ['checkbox/src/styles/index.cssr.mjs'], ['slider/src/styles/index.cssr.mjs'], ['rate/src/styles/index.cssr.mjs'], - ['date-picker/src/styles/indexcode/index.cssr.mjs'], + ['date-picker/src/styles/index.cssr.mjs'], ['time-picker/src/styles/index.cssr.mjs'], // 展示 ['card/src/styles/index.cssr.mjs'], @@ -68,12 +69,12 @@ const COMPONENT_STYLES = [ ['notification/src/styles/index.cssr.mjs'], ['popconfirm/src/styles/index.cssr.mjs'], ['popover/src/styles/index.cssr.mjs'], - ['tooltip/src/styles/index.cssr.mjs'], + // tooltip 复用 popover 的共享样式(自身没有独立 cssr 文件)。 ['dropdown/src/styles/index.cssr.mjs'], // 其他 ['icon/src/styles/index.cssr.mjs'], ['icon-wrapper/src/styles/index.cssr.mjs'], - ['space/src/styles/index.cssr.mjs'], + // space 全部用内联 style 布局,没有 cssr 文件,故不在此列。 ['divider/src/styles/index.cssr.mjs'], ['gradient-text/src/styles/index.cssr.mjs'], ['ellipsis/src/styles/index.cssr.mjs'], @@ -87,19 +88,19 @@ const COMPONENT_STYLES = [ ['tree/src/styles/index.cssr.mjs'], ['thing/src/styles/index.cssr.mjs'], ['color-picker/src/styles/index.cssr.mjs'], - ['typography/src/styles/index.cssr.mjs'], + ['typography/src/styles/p.cssr.mjs'], + ['typography/src/styles/a.cssr.mjs'], + ['typography/src/styles/blockquote.cssr.mjs'], + ['typography/src/styles/list.cssr.mjs'], + ['typography/src/styles/hr.cssr.mjs'], + ['typography/src/styles/header.cssr.mjs'], ['auto-complete/src/styles/index.cssr.mjs'], ['cascader/src/styles/index.cssr.mjs'], ['dynamic-input/src/styles/index.cssr.mjs'], ['dynamic-tags/src/styles/index.cssr.mjs'], ['input-otp/src/styles/index.cssr.mjs'], - // 过渡动画 - ['_styles/transitions/fade-in-width-expand.cssr.mjs'], - ['_styles/transitions/fade-in-height-expand.cssr.mjs'], - ['_styles/transitions/icon-switch.cssr.mjs'], - ['_styles/transitions/scale-transition.cssr.mjs'], // 全局 - ['global-style/src/styles/index.cssr.mjs'], + ['_styles/global/index.cssr.mjs'], ] async function extractStyles() { @@ -118,24 +119,17 @@ async function extractStyles() { const defaultExport = styleModule.default || styleModule - if (typeof defaultExport === 'function') { - // 直接调用 render() 提取 CSS - const css = defaultExport({ - clsPrefix: 'n', - // 使用 light 主题变量 - }) + // cssr 模块有两种导出形态:函数本体,或带 render() 的 CNode 对象。 + // 两者都必须接收 props 对象(至少 {}),否则 render 内部读 + // props.bPrefix 会抛错——card / data-table / dialog 等组件的样式 + // 曾因漏传参数被整体跳过。 + const css = typeof defaultExport === 'function' + ? defaultExport({ clsPrefix: 'n' }) + : defaultExport.render({ clsPrefix: 'n' }) - if (typeof css === 'string' && css.trim()) { - allCss.push(`/* ${componentPath} */\n${css}`) - successCount++ - } - } else if (defaultExport && typeof defaultExport.render === 'function') { - // 如果是 CNode 对象,调用 render() - const css = defaultExport.render() - if (typeof css === 'string' && css.trim()) { - allCss.push(`/* ${componentPath} */\n${css}`) - successCount++ - } + if (typeof css === 'string' && css.trim()) { + allCss.push(`/* ${componentPath} */\n${css}`) + successCount++ } } catch (err) { const code = err && err.code diff --git a/tools/admin-contract-report.json b/tools/admin-contract-report.json index f1a4be59..a4549e78 100644 --- a/tools/admin-contract-report.json +++ b/tools/admin-contract-report.json @@ -1,5 +1,5 @@ { - "generated_at": "2026-10-26T13:10:51+00:00", + "generated_at": "2026-10-26T13:32:51+00:00", "errors": [], "warnings": [ "customPage tools-update section 'tools/update' not in PHP schema (ok if pure operational page)",