@tbox.cn/app-module-mall-core 1.0.0-alpha.1 → 1.0.0-alpha.6

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.
@@ -1,15 +1,99 @@
1
1
  import type { ReactNode } from 'react';
2
- import './index.less';
3
2
 
4
3
  /**
5
4
  * 联单主视觉(素材变量链,主题轨 T-2.3):img/picture → CSS background。
6
5
  * page 变体在移动断点(≤392px)切 compact 裁切;strip 恒定 stage(原实现语义保持)。
6
+ * 元素只消费不声明 `--tbox-asset-*`(声明会截断 html[data-theme] 覆写继承)。
7
7
  */
8
+ const POSTER_BASE = 'activity-detail-presentation__poster block h-full w-full bg-cover bg-center';
9
+ const POSTER_STAGE = 'bg-[image:var(--tbox-asset-home-poster-stage,linear-gradient(135deg,#eaf3ff,#d7e7fd))]';
10
+ const POSTER_COMPACT = 'max-[392px]:bg-[image:var(--tbox-asset-home-poster-compact,linear-gradient(135deg,#eaf3ff,#d7e7fd))]';
11
+
12
+ /**
13
+ * 嵌入皮肤(跨模块,写成后代工具类而不是样式文件):
14
+ * barrier 有两层,故这些规则只能是「描述别人的后代」(选择器权重 0,2,0 高于卡片自身工具类的 0,1,0):
15
+ * ① SDK 的 `.tbox-card` 卡框在 kit 的 `@layer base` 里——详情页自身已是完整表面,必须抹平;
16
+ * ② 卡主体是 module-alipay-activity 的 `.promotion-bumpin__*` 标记:聊天流用它自己的深蓝头图,
17
+ * 详情页要的是白底平铺(主视觉已由上方 hero 承载,不能重复)。
18
+ * 数组里每一项都是完整类名字面量(`join` 只补分隔空格,不拼类名),构建期可被扫描。
19
+ */
20
+ const EMBED_SKIN = [
21
+ // ① 卡框抹平:外边距/裁切/描边/圆角/阴影/入场动画全部让位
22
+ '[&_.tbox-card]:m-0 [&_.tbox-card]:animate-none [&_.tbox-card]:overflow-visible',
23
+ '[&_.tbox-card]:rounded-none [&_.tbox-card]:border-0 [&_.tbox-card]:bg-transparent [&_.tbox-card]:shadow-none',
24
+ // ② 头部:白底平铺,隐藏封面与遮罩伪元素,压掉深蓝渐变与最小高度
25
+ '[&_.promotion-bumpin]:m-0 [&_.promotion-bumpin]:overflow-visible [&_.promotion-bumpin]:rounded-none',
26
+ '[&_.promotion-bumpin]:border-0 [&_.promotion-bumpin]:bg-card [&_.promotion-bumpin]:shadow-none',
27
+ '[&_.promotion-bumpin__header]:block [&_.promotion-bumpin__header]:min-h-0',
28
+ '[&_.promotion-bumpin__header]:bg-card! [&_.promotion-bumpin__header]:bg-none!',
29
+ '[&_.promotion-bumpin__header]:px-[11px] [&_.promotion-bumpin__header]:pt-[10px] [&_.promotion-bumpin__header]:pb-[7px]',
30
+ '[&_.promotion-bumpin__header]:before:hidden',
31
+ '[&_.promotion-bumpin__cover]:hidden [&_.promotion-bumpin__cover-placeholder]:hidden',
32
+ '[&_.promotion-bumpin__header-copy]:relative [&_.promotion-bumpin__header-copy]:z-[1]',
33
+ '[&_.promotion-bumpin__header-copy]:grid [&_.promotion-bumpin__header-copy]:max-w-full [&_.promotion-bumpin__header-copy]:gap-[3.5px]',
34
+ // 标签 / 标题 / 时段:改浅底深字,与详情页正文同一套字号档位
35
+ '[&_.promotion-bumpin__tag]:justify-self-start [&_.promotion-bumpin__tag]:rounded-full',
36
+ '[&_.promotion-bumpin__tag]:border-0 [&_.promotion-bumpin__tag]:bg-[#edf8f1]',
37
+ '[&_.promotion-bumpin__tag]:px-[10px] [&_.promotion-bumpin__tag]:py-[3px]',
38
+ '[&_.promotion-bumpin__tag]:text-sm [&_.promotion-bumpin__tag]:leading-[19px] [&_.promotion-bumpin__tag]:text-[#19744a]',
39
+ '[&_.promotion-bumpin__title]:m-0 [&_.promotion-bumpin__title]:text-xl [&_.promotion-bumpin__title]:leading-[28px]',
40
+ '[&_.promotion-bumpin__title]:font-[750] [&_.promotion-bumpin__title]:text-[#263022]',
41
+ '[&_.promotion-bumpin__period]:justify-self-start [&_.promotion-bumpin__period]:bg-transparent [&_.promotion-bumpin__period]:px-0 [&_.promotion-bumpin__period]:py-0',
42
+ '[&_.promotion-bumpin__period]:text-sm [&_.promotion-bumpin__period]:leading-[21px] [&_.promotion-bumpin__period]:text-[#6f7969]',
43
+ '[&_.promotion-bumpin__subtitle]:justify-self-start [&_.promotion-bumpin__subtitle]:bg-transparent [&_.promotion-bumpin__subtitle]:px-0 [&_.promotion-bumpin__subtitle]:py-0',
44
+ '[&_.promotion-bumpin__subtitle]:text-sm [&_.promotion-bumpin__subtitle]:leading-[21px] [&_.promotion-bumpin__subtitle]:text-[#6f7969]',
45
+ // 进度:浅蓝底内嵌块 + 蓝系节点,与首页联单进度同一套色
46
+ '[&_.promotion-bumpin__progress]:mx-4 [&_.promotion-bumpin__progress]:gap-1 [&_.promotion-bumpin__progress]:overflow-hidden',
47
+ '[&_.promotion-bumpin__progress]:rounded-[14px] [&_.promotion-bumpin__progress]:border [&_.promotion-bumpin__progress]:border-[rgba(10,110,184,0.12)]',
48
+ '[&_.promotion-bumpin__progress]:bg-[#f2f8fc] [&_.promotion-bumpin__progress]:px-3.5 [&_.promotion-bumpin__progress]:pt-1.5 [&_.promotion-bumpin__progress]:pb-[5px]',
49
+ '[&_.promotion-bumpin__steps]:px-1.5 [&_.promotion-bumpin__step-item]:gap-0.5',
50
+ '[&_.promotion-bumpin__step-node]:size-[22px] [&_.promotion-bumpin__step-node]:text-xs',
51
+ '[&_.promotion-bumpin__step-node]:border-[#1682cb] [&_.promotion-bumpin__step-node]:bg-[#eaf8ff] [&_.promotion-bumpin__step-node]:text-[#0d6fae]',
52
+ '[&_.promotion-bumpin__step-node_svg]:size-3',
53
+ '[&_.promotion-bumpin__step-node--done]:border-[#0a6eb8] [&_.promotion-bumpin__step-node--done]:bg-[#0a6eb8] [&_.promotion-bumpin__step-node--done]:text-white',
54
+ '[&_.promotion-bumpin__step-node--done]:shadow-[0_3px_9px_rgba(10,110,184,0.22)]',
55
+ '[&_.promotion-bumpin__step-node--locked]:border-[#ffdc6a] [&_.promotion-bumpin__step-node--locked]:bg-[#1475b6] [&_.promotion-bumpin__step-node--locked]:text-white',
56
+ '[&_.promotion-bumpin__step-line]:top-[11px] [&_.promotion-bumpin__step-line]:h-[2px] [&_.promotion-bumpin__step-line]:bg-[rgba(22,126,194,0.22)]',
57
+ '[&_.promotion-bumpin__step-line--done]:bg-[#0a6eb8] [&_.promotion-bumpin__step-line--done]:shadow-none',
58
+ '[&_.promotion-bumpin__progress-fill]:bg-[#0a6eb8] [&_.promotion-bumpin__progress-fill]:shadow-none',
59
+ '[&_.promotion-bumpin__step-label]:text-xs [&_.promotion-bumpin__step-label]:leading-[13px] [&_.promotion-bumpin__step-label]:text-[#6f7969]',
60
+ '[&_.promotion-bumpin__progress-text]:text-xs [&_.promotion-bumpin__progress-text]:leading-[13px] [&_.promotion-bumpin__progress-text]:text-[#6f7969]',
61
+ '[&_.promotion-bumpin__progress-bar]:h-2 [&_.promotion-bumpin__progress-bar]:bg-[rgba(10,110,184,0.14)]',
62
+ // 奖励池 / 活动规则:白卡片 + 细描边,标题与条目按详情页正文排版
63
+ '[&_.promotion-bumpin__prizes]:mx-4 [&_.promotion-bumpin__prizes]:mt-4 [&_.promotion-bumpin__prizes]:overflow-hidden',
64
+ '[&_.promotion-bumpin__prizes]:rounded-[14px] [&_.promotion-bumpin__prizes]:border [&_.promotion-bumpin__prizes]:border-[rgba(106,119,137,0.16)]',
65
+ '[&_.promotion-bumpin__prizes]:bg-card [&_.promotion-bumpin__prizes]:shadow-[0_3px_12px_rgba(70,91,122,0.06)]',
66
+ '[&_.promotion-bumpin__rules]:mx-4 [&_.promotion-bumpin__rules]:mt-4 [&_.promotion-bumpin__rules]:overflow-hidden',
67
+ '[&_.promotion-bumpin__rules]:rounded-[14px] [&_.promotion-bumpin__rules]:border [&_.promotion-bumpin__rules]:border-[rgba(106,119,137,0.16)]',
68
+ '[&_.promotion-bumpin__rules]:bg-card [&_.promotion-bumpin__rules]:shadow-[0_3px_12px_rgba(70,91,122,0.06)]',
69
+ '[&_.promotion-bumpin__prizes-header]:gap-2 [&_.promotion-bumpin__prizes-header]:border-b [&_.promotion-bumpin__prizes-header]:border-[rgba(106,119,137,0.12)]',
70
+ '[&_.promotion-bumpin__prizes-header]:px-3.5 [&_.promotion-bumpin__prizes-header]:pt-3 [&_.promotion-bumpin__prizes-header]:pb-2.5',
71
+ '[&_.promotion-bumpin__prizes-header]:text-base [&_.promotion-bumpin__prizes-header]:font-semibold',
72
+ '[&_.promotion-bumpin__prizes-header]:leading-[22px] [&_.promotion-bumpin__prizes-header]:text-[#263022]',
73
+ '[&_.promotion-bumpin__rules-header]:border-b [&_.promotion-bumpin__rules-header]:border-[rgba(106,119,137,0.12)]',
74
+ '[&_.promotion-bumpin__rules-header]:px-3.5 [&_.promotion-bumpin__rules-header]:pt-3 [&_.promotion-bumpin__rules-header]:pb-2.5',
75
+ '[&_.promotion-bumpin__rules-header]:text-base [&_.promotion-bumpin__rules-header]:font-semibold',
76
+ '[&_.promotion-bumpin__rules-header]:leading-[22px] [&_.promotion-bumpin__rules-header]:text-[#263022]',
77
+ '[&_.promotion-bumpin__prizes-header_svg]:size-[26px] [&_.promotion-bumpin__prizes-header_svg]:rounded-[8px]',
78
+ '[&_.promotion-bumpin__prizes-header_svg]:bg-[#edf6ff] [&_.promotion-bumpin__prizes-header_svg]:p-1.5 [&_.promotion-bumpin__prizes-header_svg]:text-[#0a6eb8]',
79
+ '[&_.promotion-bumpin__prize-item]:gap-3 [&_.promotion-bumpin__prize-item]:border-b [&_.promotion-bumpin__prize-item]:border-[rgba(106,119,137,0.1)]',
80
+ '[&_.promotion-bumpin__prize-item]:bg-card [&_.promotion-bumpin__prize-item]:px-3.5 [&_.promotion-bumpin__prize-item]:py-3',
81
+ '[&_.promotion-bumpin__prize-logo]:size-[42px] [&_.promotion-bumpin__prize-logo]:rounded-[12px]',
82
+ '[&_.promotion-bumpin__prize-logo-placeholder]:size-[42px] [&_.promotion-bumpin__prize-logo-placeholder]:rounded-[12px]',
83
+ '[&_.promotion-bumpin__prize-copy_strong]:text-base [&_.promotion-bumpin__prize-copy_strong]:leading-[22px] [&_.promotion-bumpin__prize-copy_strong]:text-[#263022]',
84
+ '[&_.promotion-bumpin__prize-copy_small]:text-sm [&_.promotion-bumpin__prize-copy_small]:leading-5 [&_.promotion-bumpin__prize-copy_small]:text-[#6f7969]',
85
+ '[&_.promotion-bumpin__prize-amount]:text-sm [&_.promotion-bumpin__prize-amount]:leading-5 [&_.promotion-bumpin__prize-amount]:text-[#6f7969]',
86
+ '[&_.promotion-bumpin__prizes-toggle]:border-t [&_.promotion-bumpin__prizes-toggle]:border-[rgba(106,119,137,0.1)]',
87
+ '[&_.promotion-bumpin__prizes-toggle]:bg-[#f8fafc] [&_.promotion-bumpin__prizes-toggle]:px-3.5 [&_.promotion-bumpin__prizes-toggle]:py-[11px]',
88
+ '[&_.promotion-bumpin__prizes-toggle]:text-sm [&_.promotion-bumpin__prizes-toggle]:leading-5 [&_.promotion-bumpin__prizes-toggle]:text-[#6f7969]',
89
+ '[&_.promotion-bumpin__rules-content]:px-3.5 [&_.promotion-bumpin__rules-content]:pt-3 [&_.promotion-bumpin__rules-content]:pb-3.5',
90
+ '[&_.promotion-bumpin__rules-content]:text-sm [&_.promotion-bumpin__rules-content]:leading-6 [&_.promotion-bumpin__rules-content]:text-[#6f7969]',
91
+ ].join(' ');
92
+
8
93
  export function ActivityDetailHero({ variant = 'page' }: { readonly variant?: 'page' | 'strip' }) {
9
- const className =
10
- variant === 'strip'
11
- ? 'activity-detail-presentation__poster activity-detail-presentation__poster--stage'
12
- : 'activity-detail-presentation__poster';
94
+ const className = variant === 'strip'
95
+ ? `${POSTER_BASE} activity-detail-presentation__poster--stage ${POSTER_STAGE}`
96
+ : `${POSTER_BASE} ${POSTER_STAGE} ${POSTER_COMPACT}`;
13
97
  return <span className={className} role="img" aria-label="参与联单,碰出惊喜" />;
14
98
  }
15
99
 
@@ -20,12 +104,21 @@ export function ActivityDetailPresentation({
20
104
  readonly children: ReactNode;
21
105
  readonly variant: 'page' | 'inline';
22
106
  }) {
107
+ const isPage = variant === 'page';
23
108
  return (
24
- <div className={`activity-detail-presentation activity-detail-presentation--${variant}`}>
25
- <div className={`activity-detail-presentation__hero activity-detail-presentation__hero--${variant}`}>
26
- <ActivityDetailHero variant={variant === 'inline' ? 'strip' : 'page'} />
109
+ <div
110
+ className={`activity-detail-presentation activity-detail-presentation--${variant} w-full min-w-0 overflow-hidden bg-card text-[#263022] ${isPage ? '' : '@container/activity rounded-[14px] [contain:layout_paint]'}`}
111
+ >
112
+ <div
113
+ className={`activity-detail-presentation__hero activity-detail-presentation__hero--${variant} relative w-full overflow-hidden bg-[#fff8e9] ${isPage ? 'aspect-[353/240]' : 'aspect-auto h-[152px]'}`}
114
+ >
115
+ <ActivityDetailHero variant={isPage ? 'page' : 'strip'} />
116
+ </div>
117
+ <div
118
+ className={`activity-detail-presentation__body relative z-[1] min-w-0 bg-card [&>*]:w-full ${isPage ? '-mt-[50px] rounded-t-[22px] px-0 pt-1 pb-4.5 shadow-[0_-10px_28px_rgba(38,48,34,0.08)]' : '-mt-3.5 rounded-t-[16px] px-0 pt-0 pb-2 shadow-none'} ${EMBED_SKIN}`}
119
+ >
120
+ {children}
27
121
  </div>
28
- <div className="activity-detail-presentation__body">{children}</div>
29
122
  </div>
30
123
  );
31
124
  }
@@ -2,8 +2,6 @@ import { useEffect, useRef } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
3
  import { X } from '@phosphor-icons/react';
4
4
  import type { GateCardContext, GatePhase } from '../../member-gate';
5
- import './index.less';
6
-
7
5
  const FOCUSABLE_SELECTOR = [
8
6
  'button:not([disabled])',
9
7
  '[href]',
@@ -147,40 +145,40 @@ export function MemberGateSheet({
147
145
  const confirmDisabled = busy || phase !== 'idle';
148
146
 
149
147
  return createPortal(
150
- <div className="member-login-sheet" role="presentation">
151
- <div className="member-login-sheet__mask" aria-hidden="true" onClick={() => onDismiss()} />
148
+ <div className="member-login-sheet fixed inset-0 z-[1100]" role="presentation">
149
+ <div className="member-login-sheet__mask absolute inset-0 bg-scrim animate-[member-login-mask-in_180ms_ease-out_both] motion-reduce:animate-none" aria-hidden="true" onClick={() => onDismiss()} />
152
150
  <section
153
151
  ref={sheetRef}
154
- className="member-login-sheet__panel"
152
+ className="member-login-sheet__panel absolute inset-x-0 bottom-0 mx-auto flex h-[58dvh] max-h-[calc(100dvh-env(safe-area-inset-top)-12px)] min-h-0 w-full max-w-[560px] overflow-hidden rounded-t-[28px] bg-card shadow-[0_-14px_44px_rgba(35,47,28,0.16)] animate-[member-login-sheet-in_260ms_cubic-bezier(0.22,0.72,0.24,1)_both] [@media(max-height:620px)]:h-[64dvh] landscape:[@media(max-height:500px)]:h-[88dvh] motion-reduce:animate-none"
155
153
  role="dialog"
156
154
  aria-modal="true"
157
155
  aria-labelledby={titleId}
158
156
  aria-describedby={descriptionId}
159
157
  >
160
- <div className="member-login-sheet__handle" aria-hidden="true" />
158
+ <div className="member-login-sheet__handle absolute left-1/2 top-2.25 z-10 h-1 w-9.5 -translate-x-1/2 rounded-full bg-neutral-soft" aria-hidden="true" />
161
159
  <button
162
160
  ref={closeRef}
163
161
  type="button"
164
- className="member-login-sheet__close"
162
+ className="member-login-sheet__close absolute right-4.5 top-4.5 z-20 grid size-9 place-items-center rounded-full border border-border bg-card p-0 text-foreground shadow-md outline-none focus-visible:ring-3 focus-visible:ring-focus-ring"
165
163
  aria-label="关闭登录提示"
166
164
  onClick={() => onDismiss()}
167
165
  >
168
166
  <X size={18} weight="bold" aria-hidden="true" />
169
167
  </button>
170
168
 
171
- <div className="member-login-sheet__scroll">
169
+ <div className="member-login-sheet__scroll flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain pb-[env(safe-area-inset-bottom)] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden">
172
170
  {/* 素材变量链(主题轨 T-2.3):主视觉经 CSS background(--tbox-asset-member-login-hero) */}
173
- <div className="member-login-sheet__hero" aria-hidden="true" />
174
- <div className="member-login-sheet__tear" aria-hidden="true" />
171
+ <div className="member-login-sheet__hero relative min-h-40 w-full flex-[1_1_190px] overflow-hidden member-hero [@media(max-height:620px)]:min-h-29 [@media(max-height:620px)]:flex-[0_0_116px]" aria-hidden="true" />
172
+ <div className="member-login-sheet__tear relative z-10 -mt-3.75 h-4 w-full shrink-0 bg-card [clip-path:polygon(0_70%,8%_28%,15%_72%,24%_22%,33%_66%,43%_18%,53%_72%,63%_25%,72%_68%,82%_20%,91%_64%,100%_32%,100%_100%,0_100%)]" aria-hidden="true" />
175
173
 
176
- <div className="member-login-sheet__content">
174
+ <div className="member-login-sheet__content shrink-0 px-3 pb-[calc(14px+env(safe-area-inset-bottom))] pt-3 text-center [@media(max-height:620px)]:pt-2 [&_h2]:m-0 [&_h2]:text-xl [&_h2]:font-bold [&_h2]:leading-tight [&_h2]:text-foreground">
177
175
  <h2 id={titleId}>{heroTitle}</h2>
178
- <p id={descriptionId} className="member-login-sheet__description">
176
+ <p id={descriptionId} className="member-login-sheet__description mt-1.5 text-sm leading-normal text-muted-foreground">
179
177
  {description}
180
178
  </p>
181
179
 
182
180
  {isTerminal ? (
183
- <div className="member-login-sheet__status-actions">
181
+ <div className="member-login-sheet__status-actions mx-auto mt-2 grid w-[min(100%,292px)] grid-cols-2 gap-2.5 [&_button]:min-h-11 [&_button]:rounded-xl [&_button]:border-0 [&_button]:bg-muted [&_button]:px-2.5 [&_button]:text-sm [&_button]:font-semibold [&_button]:text-secondary-foreground [&_button:last-child]:bg-member-accent [&_button:last-child]:text-white [&_button:disabled]:cursor-not-allowed [&_button:disabled]:opacity-68 [&_button:focus-visible]:ring-3 [&_button:focus-visible]:ring-focus-ring [&_button:active:not(:disabled)]:scale-98">
184
182
  <button type="button" onClick={() => onDismiss()}>暂不</button>
185
183
  <button
186
184
  ref={confirmButtonRef}
@@ -195,7 +193,7 @@ export function MemberGateSheet({
195
193
  <button
196
194
  ref={confirmButtonRef}
197
195
  type="button"
198
- className="member-login-sheet__login"
196
+ className="member-login-sheet__login mx-auto mt-2 flex min-h-11 w-[min(100%,292px)] items-center justify-center rounded-xl border-0 bg-member-accent px-4 text-sm font-semibold leading-none text-white shadow-md transition active:scale-98 disabled:cursor-not-allowed disabled:opacity-68"
199
197
  disabled={confirmDisabled}
200
198
  onClick={performConfirm}
201
199
  >
@@ -23,8 +23,6 @@ import {
23
23
  pickMallId,
24
24
  } from './home-runtime';
25
25
  import type { HomeConfig, LinkedOrderLoadState, MemberLoadState, ParkingLoadState } from './home-runtime';
26
- import './home-slot.less';
27
-
28
26
  const PARKING_FEE_QUERY = '查询停车费';
29
27
  const PARKING_VEHICLE_QUERY = '我的车辆';
30
28
  const PARKING_SERVICE_QUERY = '停车服务';
@@ -48,7 +48,7 @@ type BumpinPorts = {
48
48
 
49
49
  function warnUnassembled(specifier: string, e: unknown): void {
50
50
  portsLogger.warn(
51
- 'module ports 未装配(npx --yes @tbox.cn/app-cli module add 后生效)',
51
+ 'module ports 未装配(pnpm exec tbox-app module add 后生效)',
52
52
  specifier,
53
53
  String((e as Error)?.message ?? e).slice(0, 120),
54
54
  );
package/tbox.module.json CHANGED
@@ -3,7 +3,6 @@
3
3
  "id": "module-mall-core",
4
4
  "name": "商圈基础",
5
5
  "description": "提供商场首页、基础信息和支付宝登录,并汇总会员及停车服务状态",
6
- "version": "0.3.0",
7
6
  "kind": "business",
8
7
  "risk": {
9
8
  "level": "medium",
@@ -85,6 +85,46 @@ vi.mock('../../../packages/agent-ui-kit/src/components/QuickCommands/index.tsx',
85
85
  return <div className={`mock-quick-commands${props.hidden ? ' mock-quick-commands--hidden' : ''}`} />;
86
86
  },
87
87
  }));
88
+ // 同一组 mock 的模板副本路径:@tbox.cn/app-agent-ui-kit 是「真源 + 模板副本」两个同名包,
89
+ // pnpm 按锁解析其一(当前解析到副本)。ChatPage 内部用相对导入,entry mock 拦不住,
90
+ // 因此两条路径都要 mock——测试不依赖解析落点。
91
+ vi.mock('../../../templates/template-agent/packages/agent-ui-kit/src/components/MessageBubble/index.tsx', () => ({
92
+ MessageBubble: ({ message }: { message: { id: string } }) => <div data-order={message.id} />,
93
+ }));
94
+ vi.mock('../../../templates/template-agent/packages/agent-ui-kit/src/components/ScrollToBottomButton/index.tsx', () => ({
95
+ default: () => <div />,
96
+ }));
97
+ vi.mock('../../../templates/template-agent/packages/agent-ui-kit/src/components/CardRenderer.tsx', () => ({
98
+ CardRenderer: ({ card }: { card: TboxCardPayload }) => <div data-inline-card={card.id} />,
99
+ RawCardRenderer: ({ card }: { card: TboxCardPayload }) => <div data-raw-card={card.id} />,
100
+ }));
101
+ vi.mock('../../../templates/template-agent/packages/agent-ui-kit/src/components/ChatInput/index.tsx', () => ({
102
+ ChatInput: (props: {
103
+ blocked?: { message: string; onRetry?: () => void };
104
+ onNewChat?: () => void;
105
+ onVoiceActivityChange?: (active: boolean) => void;
106
+ }) => {
107
+ mocks.chatInputProps = props;
108
+ return props.blocked ? (
109
+ <div className="mock-chat-blocked">
110
+ <span className="mock-chat-blocked-msg">{props.blocked.message}</span>
111
+ {props.blocked.onRetry && (
112
+ <button className="mock-chat-blocked-retry" onClick={props.blocked.onRetry}>
113
+ 重试
114
+ </button>
115
+ )}
116
+ </div>
117
+ ) : (
118
+ <div className="mock-chat-input" />
119
+ );
120
+ },
121
+ }));
122
+ vi.mock('../../../templates/template-agent/packages/agent-ui-kit/src/components/QuickCommands/index.tsx', () => ({
123
+ QuickCommands: (props: { hidden?: boolean }) => {
124
+ mocks.quickCommandsProps = props;
125
+ return <div className={`mock-quick-commands${props.hidden ? ' mock-quick-commands--hidden' : ''}`} />;
126
+ },
127
+ }));
88
128
  // 应用侧(home-slot)经包入口消费 toast——entry 级覆盖
89
129
  vi.mock('@tbox.cn/app-agent-ui-kit', async (importOriginal) => {
90
130
  const actual = await importOriginal<typeof import('@tbox.cn/app-agent-ui-kit')>();
@@ -96,20 +136,32 @@ vi.mock('@tbox.cn/app-agent-ui-kit', async (importOriginal) => {
96
136
 
97
137
  // W2-3:usePullDownHistory 宿主迁 kit(ChatPage 内部相对消费)——文件级 mock 拦截
98
138
  // (双态相对路径先例:workspace 真源与模板副本同解——与 MessageBubble mock 同构)
99
- vi.mock('../../../packages/agent-ui-kit/src/hooks/use-pull-down-history', () => ({
100
- usePullDownHistory: (options: {
101
- disabled?: boolean;
102
- onLoad?: () => Promise<void>;
103
- scrollRef?: { current: HTMLElement | null };
104
- }) => {
105
- mocks.pullOptions = options;
106
- return {
107
- pullStatus: mocks.pullStatus,
108
- pullDistance: mocks.pullDistance ?? 0,
109
- resetPull: () => {},
110
- };
111
- },
112
- }));
139
+ // 钩子 mock 与当前 API 同形(ChatPage 读 pullStatus/pullDistance + 五个手势回调):
140
+ // 少一个回调,React 就会在渲染期拿到 undefined 属性——stub 必须完整。
141
+ function pullDownHistoryMock() {
142
+ return {
143
+ usePullDownHistory: (options: {
144
+ disabled?: boolean;
145
+ onLoad?: () => Promise<void>;
146
+ scrollRef?: { current: HTMLElement | null };
147
+ }) => {
148
+ mocks.pullOptions = options;
149
+ return {
150
+ pullStatus: mocks.pullStatus,
151
+ pullDistance: mocks.pullDistance ?? 0,
152
+ handleTouchStart: () => {},
153
+ handleTouchMove: () => {},
154
+ handleTouchEnd: () => {},
155
+ handleTouchCancel: () => {},
156
+ handleWheel: () => {},
157
+ };
158
+ },
159
+ };
160
+ }
161
+ // 双世界同解:workspace 真源与模板副本(templates/template-agent/packages/agent-ui-kit)
162
+ // 是同名包,pnpm 按锁解析其一——两条路径都 mock,测试不依赖解析落点。
163
+ vi.mock('../../../packages/agent-ui-kit/src/hooks/use-pull-down-history', pullDownHistoryMock);
164
+ vi.mock('../../../templates/template-agent/packages/agent-ui-kit/src/hooks/use-pull-down-history', pullDownHistoryMock);
113
165
 
114
166
  vi.mock('@tbox.cn/app-agent-sdk-client', async (importOriginal) => {
115
167
  const actual = await importOriginal<typeof import('@tbox.cn/app-agent-sdk-client')>();
@@ -1,178 +0,0 @@
1
- .home-activity-detail {
2
- position: fixed;
3
- inset: 0;
4
- z-index: 1200;
5
-
6
- &__mask {
7
- position: absolute;
8
- inset: 0;
9
- width: 100%;
10
- height: 100%;
11
- padding: 0;
12
- background: rgba(19, 26, 16, 0);
13
- border: 0;
14
- transition: background-color 220ms ease-out;
15
- -webkit-tap-highlight-color: transparent;
16
- }
17
-
18
- &[data-phase='open'] &__mask { background: rgba(19, 26, 16, 0.42); }
19
-
20
- &__surface {
21
- position: fixed;
22
- z-index: 1;
23
- min-width: 0;
24
- min-height: 0;
25
- margin: 0;
26
- overflow: hidden;
27
- background: #ffffff;
28
- border-radius: 14PX;
29
- box-shadow: 0 20PX 60PX rgba(22, 42, 30, 0.22);
30
- contain: layout paint;
31
- transition:
32
- top 300ms cubic-bezier(0.22, 0.72, 0.24, 1),
33
- left 300ms cubic-bezier(0.22, 0.72, 0.24, 1),
34
- width 300ms cubic-bezier(0.22, 0.72, 0.24, 1),
35
- height 300ms cubic-bezier(0.22, 0.72, 0.24, 1),
36
- border-radius 300ms cubic-bezier(0.22, 0.72, 0.24, 1),
37
- opacity 180ms ease-out,
38
- transform 180ms ease-out;
39
- will-change: top, left, width, height, border-radius, transform;
40
- }
41
-
42
- &[data-phase='open'] &__surface { border-radius: 24PX; }
43
-
44
- &[data-motion='fade'][data-phase='opening'] &__surface {
45
- opacity: 0;
46
- transform: scale(0.985);
47
- }
48
-
49
- &[data-motion='fade'][data-phase='open'] &__surface {
50
- opacity: 1;
51
- transform: scale(1);
52
- }
53
-
54
- &[data-phase='closing'][data-return-origin='false'] &__surface {
55
- opacity: 0;
56
- transform: scale(0.98);
57
- }
58
-
59
- &__transition-visual,
60
- &__content {
61
- position: absolute;
62
- inset: 0;
63
- }
64
-
65
- &__transition-visual {
66
- z-index: 2;
67
- overflow: hidden;
68
- background: #fff8e9;
69
- opacity: 1;
70
- transition: opacity 150ms ease-out;
71
-
72
- .mall-home__linked-order {
73
- width: 100%;
74
- height: auto;
75
- margin: 0;
76
- aspect-ratio: 353 / 240;
77
- border-radius: 0;
78
- box-shadow: none;
79
- }
80
- }
81
-
82
- &[data-phase='open'] &__transition-visual {
83
- pointer-events: none;
84
- opacity: 0;
85
- transition-delay: 150ms;
86
- }
87
-
88
- &__content {
89
- z-index: 1;
90
- min-height: 0;
91
- padding-bottom: env(safe-area-inset-bottom, 0PX);
92
- overflow-y: auto;
93
- overscroll-behavior: contain;
94
- scrollbar-width: none;
95
- background: #ffffff;
96
- opacity: 0;
97
- transform: translateY(12PX);
98
- transition: opacity 170ms ease-out, transform 170ms ease-out;
99
- -webkit-overflow-scrolling: touch;
100
-
101
- &::-webkit-scrollbar { display: none; }
102
- }
103
-
104
- &[data-phase='open'] &__content {
105
- opacity: 1;
106
- transform: translateY(0);
107
- transition-delay: 150ms;
108
- }
109
-
110
- &[data-motion='fade'][data-phase='open'] &__content {
111
- transition-delay: 0ms;
112
- }
113
-
114
- &__close {
115
- position: absolute;
116
- top: max(14PX, env(safe-area-inset-top, 0PX));
117
- right: 14PX;
118
- z-index: 4;
119
- display: grid;
120
- width: 42PX;
121
- height: 42PX;
122
- padding: 0;
123
- color: #263022;
124
- background: rgba(255, 255, 255, 0.92);
125
- border: 1PX solid rgba(61, 71, 56, 0.1);
126
- border-radius: 50%;
127
- box-shadow: 0 8PX 24PX rgba(34, 50, 38, 0.16);
128
- opacity: 0;
129
- place-items: center;
130
- transition: opacity 140ms ease-out;
131
- -webkit-tap-highlight-color: transparent;
132
-
133
- &:focus-visible {
134
- outline: 3PX solid rgba(82, 126, 56, 0.38);
135
- outline-offset: 2PX;
136
- }
137
- }
138
-
139
- &[data-phase='open'] &__close {
140
- opacity: 1;
141
- transition-delay: 170ms;
142
- }
143
-
144
- &[data-motion='fade'][data-phase='open'] &__close {
145
- transition-delay: 80ms;
146
- }
147
-
148
- &__sr-title {
149
- position: absolute;
150
- width: 1PX;
151
- height: 1PX;
152
- margin: -1PX;
153
- padding: 0;
154
- overflow: hidden;
155
- white-space: nowrap;
156
- border: 0;
157
- clip: rect(0 0 0 0);
158
- }
159
- }
160
-
161
- @media (max-width: 600PX) {
162
- .home-activity-detail[data-phase='open'] .home-activity-detail__surface {
163
- width: 100vw !important;
164
- height: 100dvh !important;
165
- border-radius: 0;
166
- }
167
- }
168
-
169
- @media (prefers-reduced-motion: reduce) {
170
- .home-activity-detail__mask,
171
- .home-activity-detail__surface,
172
- .home-activity-detail__transition-visual,
173
- .home-activity-detail__content,
174
- .home-activity-detail__close {
175
- transition-duration: 1ms;
176
- transition-delay: 0ms;
177
- }
178
- }