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

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.
Files changed (33) hide show
  1. package/AGENTS.md +3 -3
  2. package/README.md +4 -4
  3. package/dist/{chunk-QPBYZO27.js → chunk-ZBHJWURF.js} +1399 -1611
  4. package/dist/{chunk-FIHBQMON.js → chunk-ZVXAPBVE.js} +1 -1
  5. package/dist/client/index.d.ts +0 -11
  6. package/dist/client/index.js +1 -1
  7. package/dist/index.js +2 -2
  8. package/dist/server/index.d.ts +16 -16
  9. package/dist/server/index.js +1 -1
  10. package/package.json +7 -7
  11. package/src/client/HomeActivityDetailDialog.tsx +21 -81
  12. package/src/client/MallHome.tsx +109 -54
  13. package/src/client/cards/overrides/BumpInActivityChatCard.tsx +1 -1
  14. package/src/client/components/ActivityDetailPresentation/index.tsx +102 -9
  15. package/src/client/components/MemberGateSheet/index.tsx +38 -92
  16. package/src/client/home-slot.tsx +8 -64
  17. package/src/client/index.ts +4 -3
  18. package/src/client/member-gate-overlay.tsx +89 -0
  19. package/src/server/module-ports.ts +1 -1
  20. package/tbox.module.json +1 -2
  21. package/tests/MemberGateSheet.test.tsx +9 -0
  22. package/tests/home-slot.test.tsx +110 -30
  23. package/tsup.config.ts +0 -1
  24. package/dist/HomeActivityDetailDialog-2GJFYSMZ.less +0 -178
  25. package/dist/MallHome-PABCNS6D.less +0 -623
  26. package/dist/home-slot-WBZ6ONDP.less +0 -4
  27. package/dist/index-ELJ55M66.less +0 -256
  28. package/dist/index-U5YRUY7P.less +0 -352
  29. package/src/client/HomeActivityDetailDialog.less +0 -178
  30. package/src/client/MallHome.less +0 -623
  31. package/src/client/components/ActivityDetailPresentation/index.less +0 -352
  32. package/src/client/components/MemberGateSheet/index.less +0 -256
  33. package/src/client/home-slot.less +0 -4
@@ -240,7 +240,7 @@ import { createLogger as createLogger2 } from "@tbox.cn/app-agent-sdk-server";
240
240
  var portsLogger = createLogger2("server");
241
241
  function warnUnassembled(specifier, e) {
242
242
  portsLogger.warn(
243
- "module ports \u672A\u88C5\u914D\uFF08npx --yes @tbox.cn/app-cli module add \u540E\u751F\u6548\uFF09",
243
+ "module ports \u672A\u88C5\u914D\uFF08pnpm exec tbox-app module add \u540E\u751F\u6548\uFF09",
244
244
  specifier,
245
245
  String(e?.message ?? e).slice(0, 120)
246
246
  );
@@ -1,17 +1,6 @@
1
1
  import { CardComponent } from '@tbox.cn/app-contracts';
2
2
  import { ClientContext } from '@tbox.cn/app-agent-sdk-client';
3
3
 
4
- /**
5
- * module-mall-core 客户端入口(与服务端 serverModule 对称;2026-09-20 随 module-mall-home 并入)。
6
- *
7
- * 注册面(应用组装端 registerAll(ctx) 内生效):
8
- * - ctx.slots.register('home', homeSlotValue):商圈主屏槽(空态首屏 + 会话态恒挂载,域自持显隐);
9
- * - ctx.cards.registerOverride('promotion-bumpin-activity', ...):聊天视图组合层覆盖
10
- * (原始形态仍由 provider 模块注册——RawCardRenderer 详情弹层防嵌套);
11
- * - ctx.cards.registerInlineFilter(filterInlineCards):会员门禁卡系剥离(浮层自持,不进内联流);
12
- * - cards map 'mall-home':首页预览卡(dev 预览专用——/_tbox/card-preview 目录收录,chat 零出场)。
13
- */
14
-
15
4
  declare const clientModule: {
16
5
  cards: {
17
6
  'mall-home': CardComponent;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  clientModule,
3
3
  client_default
4
- } from "../chunk-QPBYZO27.js";
4
+ } from "../chunk-ZBHJWURF.js";
5
5
  export {
6
6
  clientModule,
7
7
  client_default as default
package/dist/index.js CHANGED
@@ -9,10 +9,10 @@ import {
9
9
  resolveMallInfo,
10
10
  resolveMallScopeAssembly,
11
11
  serverModule
12
- } from "./chunk-FIHBQMON.js";
12
+ } from "./chunk-ZVXAPBVE.js";
13
13
  import {
14
14
  clientModule
15
- } from "./chunk-QPBYZO27.js";
15
+ } from "./chunk-ZBHJWURF.js";
16
16
  export {
17
17
  bindMallInfoContext,
18
18
  buildDefaultMallContext,
@@ -204,17 +204,17 @@ declare const serverModule: {
204
204
  parkedMinutes: zod.ZodOptional<zod.ZodNumber>;
205
205
  }, "strip", zod.ZodTypeAny, {
206
206
  status: "ready";
207
- primaryPlate: string;
208
207
  plateCount: number;
209
- parkedPlates?: string[] | undefined;
208
+ primaryPlate: string;
210
209
  freeMinutesRemaining?: number | undefined;
210
+ parkedPlates?: string[] | undefined;
211
211
  parkedMinutes?: number | undefined;
212
212
  }, {
213
213
  status: "ready";
214
- primaryPlate: string;
215
214
  plateCount: number;
216
- parkedPlates?: string[] | undefined;
215
+ primaryPlate: string;
217
216
  freeMinutesRemaining?: number | undefined;
217
+ parkedPlates?: string[] | undefined;
218
218
  parkedMinutes?: number | undefined;
219
219
  }>, zod.ZodObject<{
220
220
  status: zod.ZodLiteral<"unavailable">;
@@ -245,34 +245,34 @@ declare const serverModule: {
245
245
  progressUnit: zod.ZodOptional<zod.ZodString>;
246
246
  }, "strip", zod.ZodTypeAny, {
247
247
  title: string;
248
- progressStyle?: "bar" | "steps" | undefined;
249
248
  totalProgress?: string | undefined;
250
249
  currentProgress?: string | undefined;
251
250
  progressUnit?: string | undefined;
251
+ progressStyle?: "steps" | "bar" | undefined;
252
252
  }, {
253
253
  title: string;
254
- progressStyle?: "bar" | "steps" | undefined;
255
254
  totalProgress?: string | undefined;
256
255
  currentProgress?: string | undefined;
257
256
  progressUnit?: string | undefined;
257
+ progressStyle?: "steps" | "bar" | undefined;
258
258
  }>;
259
259
  }, "strip", zod.ZodTypeAny, {
260
260
  status: "ready";
261
261
  banner: {
262
262
  title: string;
263
- progressStyle?: "bar" | "steps" | undefined;
264
263
  totalProgress?: string | undefined;
265
264
  currentProgress?: string | undefined;
266
265
  progressUnit?: string | undefined;
266
+ progressStyle?: "steps" | "bar" | undefined;
267
267
  };
268
268
  }, {
269
269
  status: "ready";
270
270
  banner: {
271
271
  title: string;
272
- progressStyle?: "bar" | "steps" | undefined;
273
272
  totalProgress?: string | undefined;
274
273
  currentProgress?: string | undefined;
275
274
  progressUnit?: string | undefined;
275
+ progressStyle?: "steps" | "bar" | undefined;
276
276
  };
277
277
  }>, zod.ZodObject<{
278
278
  status: zod.ZodLiteral<"unauthenticated">;
@@ -329,10 +329,10 @@ declare const serverModule: {
329
329
  status: "empty";
330
330
  } | {
331
331
  status: "ready";
332
- primaryPlate: string;
333
332
  plateCount: number;
334
- parkedPlates?: string[] | undefined;
333
+ primaryPlate: string;
335
334
  freeMinutesRemaining?: number | undefined;
335
+ parkedPlates?: string[] | undefined;
336
336
  parkedMinutes?: number | undefined;
337
337
  } | {
338
338
  status: "unavailable";
@@ -345,10 +345,10 @@ declare const serverModule: {
345
345
  status: "ready";
346
346
  banner: {
347
347
  title: string;
348
- progressStyle?: "bar" | "steps" | undefined;
349
348
  totalProgress?: string | undefined;
350
349
  currentProgress?: string | undefined;
351
350
  progressUnit?: string | undefined;
351
+ progressStyle?: "steps" | "bar" | undefined;
352
352
  };
353
353
  } | {
354
354
  status: "unauthenticated";
@@ -359,9 +359,9 @@ declare const serverModule: {
359
359
  } | {
360
360
  status: "error";
361
361
  };
362
+ enrollUrl?: string | null | undefined;
362
363
  mallName?: string | undefined;
363
364
  showDevServices?: boolean | undefined;
364
- enrollUrl?: string | null | undefined;
365
365
  }, {
366
366
  member: {
367
367
  status: "loading";
@@ -392,10 +392,10 @@ declare const serverModule: {
392
392
  status: "empty";
393
393
  } | {
394
394
  status: "ready";
395
- primaryPlate: string;
396
395
  plateCount: number;
397
- parkedPlates?: string[] | undefined;
396
+ primaryPlate: string;
398
397
  freeMinutesRemaining?: number | undefined;
398
+ parkedPlates?: string[] | undefined;
399
399
  parkedMinutes?: number | undefined;
400
400
  } | {
401
401
  status: "unavailable";
@@ -408,10 +408,10 @@ declare const serverModule: {
408
408
  status: "ready";
409
409
  banner: {
410
410
  title: string;
411
- progressStyle?: "bar" | "steps" | undefined;
412
411
  totalProgress?: string | undefined;
413
412
  currentProgress?: string | undefined;
414
413
  progressUnit?: string | undefined;
414
+ progressStyle?: "steps" | "bar" | undefined;
415
415
  };
416
416
  } | {
417
417
  status: "unauthenticated";
@@ -422,9 +422,9 @@ declare const serverModule: {
422
422
  } | {
423
423
  status: "error";
424
424
  };
425
+ enrollUrl?: string | null | undefined;
425
426
  mallName?: string | undefined;
426
427
  showDevServices?: boolean | undefined;
427
- enrollUrl?: string | null | undefined;
428
428
  }>>;
429
429
  };
430
430
  preTools: {
@@ -10,7 +10,7 @@ import {
10
10
  resolveMallScopeAssembly,
11
11
  serverModule,
12
12
  server_default
13
- } from "../chunk-FIHBQMON.js";
13
+ } from "../chunk-ZVXAPBVE.js";
14
14
  export {
15
15
  bindMallInfoContext,
16
16
  buildDefaultMallContext,
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@tbox.cn/app-module-mall-core",
3
- "version": "1.0.0-alpha.1",
3
+ "version": "1.0.0-alpha.11",
4
4
  "type": "module",
5
- "description": "商圈基础模块:scope 域装配注册 + mall-info 工具链 + mall-directory 服务 + 首页主屏(home 槽 / 联单面板 / 会员停车快览)+ 首页预览卡。",
5
+ "description": "商圈基础模块:scope 域装配注册 + mall-info 工具链 + mall-directory 服务 + 会员会话浮层(conversationOverlay 槽)+ MallHome 保留组件+ 首页预览卡。",
6
6
  "exports": {
7
7
  ".": {
8
8
  "types": "./dist/index.d.ts",
@@ -19,10 +19,10 @@
19
19
  "./package.json": "./package.json"
20
20
  },
21
21
  "dependencies": {
22
- "@tbox.cn/app-contracts": "1.0.0-alpha.1",
23
- "@tbox.cn/app-contracts-mall": "1.0.0-alpha.1",
24
- "@tbox.cn/app-agent-sdk-client": "1.0.0-alpha.1",
25
- "@tbox.cn/app-agent-sdk-server": "1.0.0-alpha.1"
22
+ "@tbox.cn/app-contracts-mall": "1.0.0-alpha.11",
23
+ "@tbox.cn/app-contracts": "1.0.0-alpha.11",
24
+ "@tbox.cn/app-agent-sdk-server": "1.0.0-alpha.11",
25
+ "@tbox.cn/app-agent-sdk-client": "1.0.0-alpha.11"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "react": "18.3.1",
@@ -30,7 +30,7 @@
30
30
  "@phosphor-icons/react": "2.1.10",
31
31
  "express": "4.22.2",
32
32
  "zod": "3.25.76",
33
- "@tbox.cn/app-agent-ui-kit": "1.0.0-alpha.1"
33
+ "@tbox.cn/app-agent-ui-kit": "^1.0.0-alpha.11"
34
34
  },
35
35
  "peerDependenciesMeta": {
36
36
  "@tbox.cn/app-agent-ui-kit": {
@@ -10,18 +10,9 @@ import {
10
10
  } from 'react';
11
11
  import { createPortal } from 'react-dom';
12
12
  import { X } from '@phosphor-icons/react';
13
+ import { OVERLAY_LAYER_CLASS, useOverlay } from '@tbox.cn/app-agent-ui-kit/overlay';
13
14
  import type { TboxCardPayload } from '@tbox.cn/app-contracts';
14
15
  import { ActivityDetailPresentation } from './components/ActivityDetailPresentation';
15
- import './HomeActivityDetailDialog.less';
16
-
17
- const FOCUSABLE_SELECTOR = [
18
- 'button:not([disabled])',
19
- '[href]',
20
- 'input:not([disabled])',
21
- 'select:not([disabled])',
22
- 'textarea:not([disabled])',
23
- '[tabindex]:not([tabindex="-1"])',
24
- ].join(',');
25
16
  const MORPH_DURATION_MS = 300;
26
17
 
27
18
  type MorphPhase = 'opening' | 'open' | 'closing';
@@ -140,70 +131,19 @@ export function HomeActivityDetailDialog({
140
131
  return () => window.removeEventListener('resize', updateDestination);
141
132
  }, []);
142
133
 
143
- useEffect(() => {
144
- const previousFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null;
145
- const previousBodyOverflow = document.body.style.overflow;
146
- const appRoot = document.getElementById('root');
147
- const previousAriaHidden = appRoot?.getAttribute('aria-hidden') ?? null;
148
- const previousInert = appRoot?.inert ?? false;
149
- const scrollHost = triggerRef.current?.closest<HTMLElement>('.chat-page__body') ?? null;
150
- const previousScrollOverflow = scrollHost?.style.overflow ?? '';
151
- const previousOverscroll = scrollHost?.style.overscrollBehavior ?? '';
152
-
153
- document.body.style.overflow = 'hidden';
154
- if (scrollHost) {
155
- scrollHost.style.overflow = 'hidden';
156
- scrollHost.style.overscrollBehavior = 'none';
157
- }
158
- if (appRoot) {
159
- appRoot.setAttribute('aria-hidden', 'true');
160
- appRoot.inert = true;
161
- }
162
- closeRef.current?.focus();
163
-
164
- const handleKeyDown = (event: KeyboardEvent) => {
165
- if (event.key === 'Escape') {
166
- event.preventDefault();
167
- requestClose();
168
- return;
169
- }
170
- if (event.key !== 'Tab') return;
171
- const focusable = Array.from(
172
- panelRef.current?.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR) ?? [],
173
- );
174
- if (focusable.length === 0) {
175
- event.preventDefault();
176
- panelRef.current?.focus();
177
- return;
178
- }
179
- const first = focusable[0];
180
- const last = focusable[focusable.length - 1];
181
- if (event.shiftKey && document.activeElement === first) {
182
- event.preventDefault();
183
- last.focus();
184
- } else if (!event.shiftKey && document.activeElement === last) {
185
- event.preventDefault();
186
- first.focus();
187
- }
188
- };
189
- document.addEventListener('keydown', handleKeyDown);
190
-
191
- return () => {
192
- document.removeEventListener('keydown', handleKeyDown);
193
- if (closeTimerRef.current !== null) window.clearTimeout(closeTimerRef.current);
194
- document.body.style.overflow = previousBodyOverflow;
195
- if (scrollHost) {
196
- scrollHost.style.overflow = previousScrollOverflow;
197
- scrollHost.style.overscrollBehavior = previousOverscroll;
198
- }
199
- if (appRoot) {
200
- appRoot.inert = previousInert;
201
- if (previousAriaHidden === null) appRoot.removeAttribute('aria-hidden');
202
- else appRoot.setAttribute('aria-hidden', previousAriaHidden);
203
- }
204
- (triggerRef.current ?? previousFocus)?.focus({ preventScroll: true });
205
- };
206
- }, [requestClose, triggerRef]);
134
+ // 弹层行为(传送遮罩层、滚动锁、应用根惰性、Escape、焦点循环与恢复)由 kit overlay 承担;
135
+ // 这里只留 FLIP 形变自己的状态机。
136
+ useOverlay({
137
+ active: true,
138
+ onDismiss: () => requestClose(),
139
+ panelRef,
140
+ initialFocus: closeRef,
141
+ restoreFocus: triggerRef.current ? { current: triggerRef.current } : 'previous',
142
+ });
143
+
144
+ useEffect(() => () => {
145
+ if (closeTimerRef.current !== null) window.clearTimeout(closeTimerRef.current);
146
+ }, []);
207
147
 
208
148
  const surfaceRect = motion === 'fade'
209
149
  ? destination
@@ -221,32 +161,32 @@ export function HomeActivityDetailDialog({
221
161
 
222
162
  return createPortal(
223
163
  <div
224
- className="home-activity-detail"
164
+ className={`home-activity-detail group/detail fixed inset-0 ${OVERLAY_LAYER_CLASS.modal}`}
225
165
  data-motion={motion}
226
166
  data-phase={phase}
227
167
  data-return-origin={returnToOrigin ? 'true' : 'false'}
228
168
  >
229
- <button type="button" className="home-activity-detail__mask" aria-label="关闭活动详情" onClick={requestClose} />
169
+ <button type="button" className="home-activity-detail__mask absolute inset-0 size-full border-0 bg-transparent p-0 transition-colors duration-200 group-data-[phase=open]/detail:bg-scrim" aria-label="关闭活动详情" onClick={requestClose} />
230
170
  <section
231
171
  ref={panelRef}
232
172
  id={getHomeActivityDialogId(card.id)}
233
- className="home-activity-detail__surface"
173
+ className="home-activity-detail__surface fixed z-10 min-h-0 min-w-0 overflow-hidden rounded-xl bg-card shadow-[0_20px_60px_rgba(22,42,30,0.22)] contain-[layout_paint] transition-all duration-300 will-change-[top,left,width,height,border-radius,transform] group-data-[phase=open]/detail:rounded-2xl group-data-[motion=fade]/detail:group-data-[phase=opening]/detail:scale-[0.985] group-data-[motion=fade]/detail:group-data-[phase=opening]/detail:opacity-0 group-data-[motion=fade]/detail:group-data-[phase=open]/detail:scale-100 group-data-[motion=fade]/detail:group-data-[phase=open]/detail:opacity-100 group-data-[phase=closing]/detail:group-data-[return-origin=false]/detail:scale-[0.98] group-data-[phase=closing]/detail:group-data-[return-origin=false]/detail:opacity-0 max-[600px]:h-screen! max-[600px]:supports-[height:100dvh]:h-dvh! max-[600px]:w-screen! max-[600px]:rounded-none! motion-reduce:transition-none"
234
174
  style={surfaceStyle}
235
175
  role="dialog"
236
176
  aria-modal="true"
237
177
  aria-labelledby={titleId}
238
178
  tabIndex={-1}
239
179
  >
240
- <h2 id={titleId} className="home-activity-detail__sr-title">{title}</h2>
180
+ <h2 id={titleId} className="home-activity-detail__sr-title sr-only">{title}</h2>
241
181
  {transitionVisual && (
242
- <div className="home-activity-detail__transition-visual" aria-hidden="true">{transitionVisual}</div>
182
+ <div className="home-activity-detail__transition-visual absolute inset-0 z-20 overflow-hidden bg-warn-surface transition-opacity duration-150 group-data-[phase=open]/detail:pointer-events-none group-data-[phase=open]/detail:opacity-0 group-data-[phase=open]/detail:delay-150 [&_.mall-home__linked-order]:m-0 [&_.mall-home__linked-order]:aspect-[353/240] [&_.mall-home__linked-order]:h-auto [&_.mall-home__linked-order]:w-full [&_.mall-home__linked-order]:rounded-none [&_.mall-home__linked-order]:shadow-none" aria-hidden="true">{transitionVisual}</div>
243
183
  )}
244
- <div className="home-activity-detail__content">
184
+ <div className="home-activity-detail__content absolute inset-0 z-10 min-h-0 translate-y-3 overflow-y-auto overscroll-contain bg-card pb-[env(safe-area-inset-bottom)] opacity-0 transition-[opacity,transform] duration-150 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden group-data-[phase=open]/detail:translate-y-0 group-data-[phase=open]/detail:opacity-100 group-data-[phase=open]/detail:delay-150 group-data-[motion=fade]/detail:group-data-[phase=open]/detail:delay-0 motion-reduce:transition-none">
245
185
  <ActivityDetailPresentation variant="page">
246
186
  {children}
247
187
  </ActivityDetailPresentation>
248
188
  </div>
249
- <button ref={closeRef} type="button" className="home-activity-detail__close" aria-label="关闭活动详情,返回首页" onClick={requestClose}>
189
+ <button ref={closeRef} type="button" className="home-activity-detail__close absolute right-3.5 top-[max(14px,env(safe-area-inset-top))] z-30 grid size-10.5 place-items-center rounded-full border border-border bg-card p-0 text-foreground opacity-0 shadow-lg transition-opacity duration-150 group-data-[phase=open]/detail:opacity-100 group-data-[phase=open]/detail:delay-150 focus-visible:outline-3 focus-visible:outline-offset-2 focus-visible:outline-focus-ring motion-reduce:transition-none" aria-label="关闭活动详情,返回首页" onClick={requestClose}>
250
190
  <X size={21} weight="bold" aria-hidden="true" />
251
191
  </button>
252
192
  </section>