Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ coverage.out

# 主题包依赖
theme/node_modules/
theme/dist/
2 changes: 1 addition & 1 deletion theme/dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ export { appShellTokens, darkTheme, foundationTokens, lightElevationContexts, li
export { createAppShellCssVarMap, createFoundationCssVarMap, createStaticCssVarMap, createTailwindThemeBridge, createThemeCssVarMap, generateThemeCSS, getStoredTheme, injectThemeStyle, setTheme, staticToCssVar, tokenToCssVar, } from './css.js';
export type { TokenName } from './helpers.js';
export { cssVar, themeStyle } from './helpers.js';
export type { AccountSurfaceProps, AccountFormProps, BadgeProps, ButtonProps, ButtonVariant, CardProps, FieldProps, FormActionsProps, PluginBatchAccountInput, PluginBatchImportResult, PluginFrontendModule, PluginMenuItemDefinition, PluginOAuthBatchExchangeResult, PluginOAuthBridge, PluginOAuthExchangeResult, PluginOAuthStartResult, PanelHeaderProps, PluginPlatformIconProps, PluginStatusKind, PluginStyleFoundationOptions, PluginTailwindConfigOptions, PluginRouteDefinition, ResolvePluginThemeOptions, ScopedPluginThemeOptions, SectionProps, SelectableCardProps, StatusTextProps, UsageRecordSurfaceProps, } from './plugin.js';
export type { AccountSurfaceProps, AccountFormProps, BadgeProps, ButtonProps, ButtonVariant, CardProps, FieldProps, FormActionsProps, PluginBatchAccountInput, PluginBatchImportResult, PluginFrontendModule, PluginMenuItemDefinition, PluginOAuthBatchExchangeResult, PluginOAuthBridge, PluginOAuthExchangeResult, PluginOAuthStartResult, PanelHeaderProps, PluginPlatformIconProps, PluginStatusKind, PluginStyleFoundationOptions, PluginTailwindConfigOptions, PluginRouteDefinition, ResolvePluginThemeOptions, ScopedPluginThemeOptions, SectionProps, SelectableCardProps, StatusTextProps, UsageRecordSurfaceProps, UsageServiceTierFastResolver, } from './plugin.js';
export { DEFAULT_PLUGIN_CLASS_PREFIX, DEFAULT_PLUGIN_FOUNDATION_STYLE_ID, DEFAULT_PLUGIN_THEME_ATTRIBUTE, DEFAULT_PLUGIN_THEME_STYLE_ID, Badge, Button, Card, Field, FormActions, PanelHeader, Section, SecretInput, SelectableCard, StatusText, TextInput, TextArea, cn, createPluginTailwindConfig, ensurePluginStyleFoundation, injectStyle, pluginFoundationCssText, resolvePluginTheme, useScopedPluginTheme, } from './plugin.js';
8 changes: 8 additions & 0 deletions theme/dist/plugin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ export interface UsageRecordSurfaceProps {
recordId?: string | number;
context?: Record<string, unknown>;
}
/**
* 平台插件自行判断某条 usage 的 service_tier 是否应展示为 fast。
*
* 不同上游平台可能使用不同字段值表达 fast/priority/flex 等服务层级,
* Core 只负责调用该函数并套用统一 fast 样式,不内置平台语义。
*/
export type UsageServiceTierFastResolver = (context?: Record<string, unknown>) => boolean;
export interface PluginFrontendModule {
routes?: PluginRouteDefinition[];
menuItems?: PluginMenuItemDefinition[];
Expand All @@ -105,6 +112,7 @@ export interface PluginFrontendModule {
* Core 只提供表格骨架与回退渲染,不内置平台语义。
*/
usageModelMeta?: ComponentType<UsageRecordSurfaceProps>;
isUsageServiceTierFast?: UsageServiceTierFastResolver;
usageMetricDetail?: ComponentType<UsageRecordSurfaceProps>;
usageCostDetail?: ComponentType<UsageRecordSurfaceProps>;
platformIcon?: ComponentType<PluginPlatformIconProps>;
Expand Down
4 changes: 2 additions & 2 deletions theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"description": "AirGate 插件前端主题、样式隔离和公共组件包",
"type": "module",
"packageManager": "npm@11.6.2",
"packageManager": "pnpm@11.1.1",
"license": "MIT",
"repository": {
"type": "git",
Expand Down Expand Up @@ -43,7 +43,7 @@
],
"scripts": {
"build": "tsc",
"prepack": "npm run build",
"prepack": "pnpm run build",
"dev": "tsc --watch"
},
"peerDependencies": {
Expand Down
48 changes: 48 additions & 0 deletions theme/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions theme/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export type {
SelectableCardProps,
StatusTextProps,
UsageRecordSurfaceProps,
UsageServiceTierFastResolver,
} from './plugin.js';

// 插件前端 SDK:样式注入、主题同步、Tailwind bridge 和公共组件
Expand Down
9 changes: 9 additions & 0 deletions theme/src/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ export interface UsageRecordSurfaceProps {
context?: Record<string, unknown>;
}

/**
* 平台插件自行判断某条 usage 的 service_tier 是否应展示为 fast。
*
* 不同上游平台可能使用不同字段值表达 fast/priority/flex 等服务层级,
* Core 只负责调用该函数并套用统一 fast 样式,不内置平台语义。
*/
export type UsageServiceTierFastResolver = (context?: Record<string, unknown>) => boolean;

export interface PluginFrontendModule {
routes?: PluginRouteDefinition[];
menuItems?: PluginMenuItemDefinition[];
Expand All @@ -137,6 +145,7 @@ export interface PluginFrontendModule {
* Core 只提供表格骨架与回退渲染,不内置平台语义。
*/
usageModelMeta?: ComponentType<UsageRecordSurfaceProps>;
isUsageServiceTierFast?: UsageServiceTierFastResolver;
usageMetricDetail?: ComponentType<UsageRecordSurfaceProps>;
usageCostDetail?: ComponentType<UsageRecordSurfaceProps>;
platformIcon?: ComponentType<PluginPlatformIconProps>;
Expand Down