@tbox.cn/app-template-agent 1.0.0-alpha.16 → 1.0.0-alpha.18
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.
- package/._.gitignore +0 -0
- package/._.nvmrc +0 -0
- package/._AGENTS.md +0 -0
- package/._ENV.md +0 -0
- package/._LEGAL.md +0 -0
- package/._LICENSE +0 -0
- package/._README.md +0 -0
- package/._eslint.config.mjs +0 -0
- package/._package.json +0 -0
- package/._pnpm-lock.template.yaml +0 -0
- package/._pnpm-workspace.template.yaml +0 -0
- package/._tsconfig.base.json +0 -0
- package/.gitignore +2 -0
- package/.tbox/._app.json +0 -0
- package/.tbox/._default-modules.json +0 -0
- package/.tbox/._miniapp-containers.json +0 -0
- package/.tbox/app.json +1 -1
- package/.tbox/cache/._apps-client-strict.tsbuildinfo +0 -0
- package/.tbox/cache/._apps-client.tsbuildinfo +0 -0
- package/.tbox/cache/._apps-server-strict.tsbuildinfo +0 -0
- package/.tbox/cache/._apps-server.tsbuildinfo +0 -0
- package/.tbox/cache/._packages-agent-ui-kit-strict.tsbuildinfo +0 -0
- package/.tbox/cache/._packages-agent-ui-kit.tsbuildinfo +0 -0
- package/.tbox/cache/._packages-shared-strict.tsbuildinfo +0 -0
- package/.tbox/cache/._packages-shared.tsbuildinfo +0 -0
- package/.tbox/cache/apps-client-strict.tsbuildinfo +1 -0
- package/.tbox/cache/apps-client.tsbuildinfo +1 -0
- package/.tbox/cache/apps-server-strict.tsbuildinfo +1 -0
- package/.tbox/cache/apps-server.tsbuildinfo +1 -0
- package/.tbox/cache/packages-agent-ui-kit-strict.tsbuildinfo +1 -0
- package/.tbox/cache/packages-agent-ui-kit.tsbuildinfo +1 -0
- package/.tbox/cache/packages-shared-strict.tsbuildinfo +1 -0
- package/.tbox/cache/packages-shared.tsbuildinfo +1 -0
- package/.tbox/default-modules.json +1 -1
- package/.tbox/factory/._chat.json +0 -0
- package/.tbox/miniapp-containers.json +1 -1
- package/AGENTS.md +4 -0
- package/apps/._AGENTS.md +0 -0
- package/apps/client/._index.html +0 -0
- package/apps/client/._package.json +0 -0
- package/apps/client/._tsconfig.json +0 -0
- package/apps/client/._vite.config.ts +0 -0
- package/apps/client/scripts/._acceptance-changes.test.mjs +0 -0
- package/apps/client/scripts/._check-evidence.mjs +0 -0
- package/apps/client/scripts/._color-scan.mjs +0 -0
- package/apps/client/scripts/._color-scan.test.mjs +0 -0
- package/apps/client/scripts/._evidence-gate.mjs +0 -0
- package/apps/client/scripts/._evidence-gate.test.mjs +0 -0
- package/apps/client/scripts/._experience-checks.mjs +0 -0
- package/apps/client/scripts/._geometry-kernel.test.mjs +0 -0
- package/apps/client/scripts/._home-preset-wiring.test.ts +0 -0
- package/apps/client/scripts/._home-preset-wiring.ts +0 -0
- package/apps/client/scripts/._in-process-checks.mjs +0 -0
- package/apps/client/scripts/._probe-checks.mjs +0 -0
- package/apps/client/scripts/._render-card.mjs +0 -0
- package/apps/client/scripts/._sample-entries.test.mjs +0 -0
- package/apps/client/scripts/._static-checks.test.mjs +0 -0
- package/apps/client/scripts/._storyboard.test.mjs +0 -0
- package/apps/client/scripts/._surface-css.mjs +0 -0
- package/apps/client/scripts/._theme-kernel.mjs +0 -0
- package/apps/client/scripts/._theme-kernel.test.mjs +0 -0
- package/apps/client/scripts/acceptance-changes.test.mjs +16 -3
- package/apps/client/scripts/check-evidence.mjs +69 -7
- package/apps/client/scripts/evidence-gate.mjs +9 -6
- package/apps/client/scripts/experience-checks.mjs +139 -0
- package/apps/client/scripts/geometry-kernel.test.mjs +3 -1
- package/apps/client/scripts/home-preset-wiring.test.ts +61 -0
- package/apps/client/scripts/home-preset-wiring.ts +41 -0
- package/apps/client/scripts/in-process-checks.mjs +100 -1
- package/apps/client/scripts/lib/._card-registry.mjs +0 -0
- package/apps/client/scripts/lib/._card-registry.test.mjs +0 -0
- package/apps/client/scripts/lib/._evidence-inputs.mjs +0 -0
- package/apps/client/scripts/lib/._evidence-inputs.test.mjs +0 -0
- package/apps/client/scripts/lib/._static-render.mjs +0 -0
- package/apps/client/scripts/lib/._static-render.test.mjs +0 -0
- package/apps/client/scripts/probe-checks.mjs +1 -0
- package/apps/client/scripts/static-checks.test.mjs +219 -0
- package/apps/client/src/._app.config.ts +0 -0
- package/apps/client/src/._vite-env.d.ts +0 -0
- package/apps/client/src/cards/._AGENTS.md +0 -0
- package/apps/client/src/cards/._home-preset.test.ts +0 -0
- package/apps/client/src/cards/._home-preset.ts +0 -0
- package/apps/client/src/cards/._registry.ts +0 -0
- package/apps/client/src/cards/home-preset.test.ts +40 -0
- package/apps/client/src/cards/home-preset.ts +19 -0
- package/apps/client/src/cards/registry.ts +10 -3
- package/apps/client/src/pages/._page.tsx +0 -0
- package/apps/client/src/pages/index/._index.tsx +0 -0
- package/apps/client/src/pages/index/index.tsx +1 -1
- package/apps/client/src/store/._chat.ts +0 -0
- package/apps/client/src/styles/._brand.css +0 -0
- package/apps/client/src/styles/._tailwind.css +0 -0
- package/apps/client/src/styles/tailwind.css +3 -1
- package/apps/client/src/test/._setup.ts +0 -0
- package/apps/client/tsconfig.json +1 -0
- package/apps/client/vite.config.ts +15 -5
- package/apps/server/._package.json +0 -0
- package/apps/server/._tsconfig.json +0 -0
- package/apps/server/._tsup.config.ts +0 -0
- package/apps/server/._vitest.config.ts +0 -0
- package/apps/server/scripts/._probe.mjs +0 -0
- package/apps/server/scripts/._scenario-lib.mjs +0 -0
- package/apps/server/scripts/._scenario.mjs +0 -0
- package/apps/server/scripts/scenario-lib.mjs +12 -1
- package/apps/server/src/._app.ts +0 -0
- package/apps/server/src/._dev.ts +0 -0
- package/apps/server/src/._index.ts +0 -0
- package/apps/server/src/._intent-routes.ts +0 -0
- package/apps/server/src/._pre-tools.ts +0 -0
- package/apps/server/src/actions/._AGENTS.md +0 -0
- package/apps/server/src/cards/._AGENTS.md +0 -0
- package/apps/server/src/cli/._collect-registry.ts +0 -0
- package/apps/server/src/cli/._plugin-doctor.ts +0 -0
- package/apps/server/src/cli/._plugin-inspect.ts +0 -0
- package/apps/server/src/config/._integration.ts +0 -0
- package/apps/server/src/tools/._AGENTS.md +0 -0
- package/apps/server/tests/._agent-prompt.test.ts +0 -0
- package/apps/server/tests/._cards-registry.test.ts +0 -0
- package/apps/server/tests/._deployment-loader.test.ts +0 -0
- package/apps/server/tests/._intent-dispatcher.test.ts +0 -0
- package/apps/server/tests/._tool-runtime.test.ts +0 -0
- package/apps/server/tests/helpers/._register.ts +0 -0
- package/config/._AGENTS.md +0 -0
- package/config/._README.md +0 -0
- package/config/._agent.jsonc +0 -0
- package/config/._chat.json +0 -0
- package/config/._integrations.json +0 -0
- package/config/._llm_provider.json +0 -0
- package/config/._plugins.json +0 -0
- package/config/agent.jsonc +10 -0
- package/docs/agent/._agent-prompt.md +0 -0
- package/docs/agent/._card-action.md +0 -0
- package/docs/agent/._card.md +0 -0
- package/docs/agent/._conversation.md +0 -0
- package/docs/agent/._errors.md +0 -0
- package/docs/agent/._kit.md +0 -0
- package/docs/agent/._shell.md +0 -0
- package/docs/agent/._state.md +0 -0
- package/docs/agent/._style.md +0 -0
- package/docs/agent/._tool-emits-card.md +0 -0
- package/docs/agent/._tool.md +0 -0
- package/docs/agent/._verify.md +0 -0
- package/docs/agent/card-action.md +5 -1
- package/docs/agent/card.md +7 -1
- package/docs/agent/errors.md +7 -1
- package/docs/agent/kit.md +7 -6
- package/docs/agent/shell.md +3 -1
- package/docs/agent/style.md +37 -0
- package/docs/agent/verify.md +5 -2
- package/modules/provider-custom/._AGENTS.md +0 -0
- package/modules/provider-custom/._INTEGRATION.md +0 -0
- package/modules/provider-custom/._LICENSE +0 -0
- package/modules/provider-custom/._README.md +0 -0
- package/modules/provider-custom/._package.json +0 -0
- package/modules/provider-custom/._tbox.module.json +0 -0
- package/modules/provider-custom/._tsconfig.json +0 -0
- package/modules/provider-custom/._tsup.config.ts +0 -0
- package/modules/provider-custom/src/._index.ts +0 -0
- package/modules/provider-custom/src/server/._example-adapter.ts +0 -0
- package/modules/provider-custom/src/server/._index.ts +0 -0
- package/modules/provider-custom/tests/._provider-custom.test.ts +0 -0
- package/package.json +5 -4
- package/packages/agent-ui-kit/._AGENTS.md +0 -0
- package/packages/agent-ui-kit/._LICENSE +0 -0
- package/packages/agent-ui-kit/._README.md +0 -0
- package/packages/agent-ui-kit/._catalog.json +0 -0
- package/packages/agent-ui-kit/._package.json +0 -0
- package/packages/agent-ui-kit/._tsconfig.json +0 -0
- package/packages/agent-ui-kit/._vitest.config.ts +0 -0
- package/packages/agent-ui-kit/README.md +1 -1
- package/packages/agent-ui-kit/assets/._keyboard-circle.svg +0 -0
- package/packages/agent-ui-kit/assets/._more-circle.svg +0 -0
- package/packages/agent-ui-kit/assets/._new-chat.svg +0 -0
- package/packages/agent-ui-kit/assets/._quick-command-star.svg +0 -0
- package/packages/agent-ui-kit/assets/._send-gradient.svg +0 -0
- package/packages/agent-ui-kit/assets/._stop@2x.png +0 -0
- package/packages/agent-ui-kit/assets/._voice-circle.svg +0 -0
- package/packages/agent-ui-kit/catalog.json +134 -5
- package/packages/agent-ui-kit/package.json +1 -1
- package/packages/agent-ui-kit/src/._ChatPage.tsx +0 -0
- package/packages/agent-ui-kit/src/._chat-config.test.ts +0 -0
- package/packages/agent-ui-kit/src/._chat-config.ts +0 -0
- package/packages/agent-ui-kit/src/._contract.test.tsx +0 -0
- package/packages/agent-ui-kit/src/._icons.ts +0 -0
- package/packages/agent-ui-kit/src/._index.ts +0 -0
- package/packages/agent-ui-kit/src/._preview-provider.tsx +0 -0
- package/packages/agent-ui-kit/src/._shell.contract.json +0 -0
- package/packages/agent-ui-kit/src/._shell.test.ts +0 -0
- package/packages/agent-ui-kit/src/._shell.ts +0 -0
- package/packages/agent-ui-kit/src/._store-context.tsx +0 -0
- package/packages/agent-ui-kit/src/._surface.test.tsx +0 -0
- package/packages/agent-ui-kit/src/._surface.tsx +0 -0
- package/packages/agent-ui-kit/src/._types.ts +0 -0
- package/packages/agent-ui-kit/src/._vite-env.d.ts +0 -0
- package/packages/agent-ui-kit/src/ChatPage.tsx +204 -27
- package/packages/agent-ui-kit/src/card/._action-list-pending.test.tsx +0 -0
- package/packages/agent-ui-kit/src/card/._confirm-fields.test.tsx +0 -0
- package/packages/agent-ui-kit/src/card/._define-card.test.ts +0 -0
- package/packages/agent-ui-kit/src/card/._define-card.ts +0 -0
- package/packages/agent-ui-kit/src/card/._primitives.test.tsx +0 -0
- package/packages/agent-ui-kit/src/card/._primitives.tsx +0 -0
- package/packages/agent-ui-kit/src/card/._use-card-actions.ts +0 -0
- package/packages/agent-ui-kit/src/card/._view-card-inline.test.tsx +0 -0
- package/packages/agent-ui-kit/src/card/._view-card.test.tsx +0 -0
- package/packages/agent-ui-kit/src/card/._view-card.tsx +0 -0
- package/packages/agent-ui-kit/src/card/confirm-fields.test.tsx +106 -0
- package/packages/agent-ui-kit/src/card/primitives.tsx +270 -59
- package/packages/agent-ui-kit/src/card/use-card-actions.ts +5 -1
- package/packages/agent-ui-kit/src/card/view-card.tsx +113 -22
- package/packages/agent-ui-kit/src/chat-config.ts +2 -0
- package/packages/agent-ui-kit/src/components/._CardRenderer.tsx +0 -0
- package/packages/agent-ui-kit/src/components/._HistoryList.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ActionBar/._DebugButton.test.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ActionBar/._DebugButton.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ActionBar/._index.test.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ActionBar/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ActionBar/DebugButton.tsx +12 -4
- package/packages/agent-ui-kit/src/components/ActionBar/index.tsx +61 -27
- package/packages/agent-ui-kit/src/components/BottomSheet/._index.test.tsx +0 -0
- package/packages/agent-ui-kit/src/components/BottomSheet/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/BottomSheet/index.test.tsx +11 -0
- package/packages/agent-ui-kit/src/components/BottomSheet/index.tsx +34 -3
- package/packages/agent-ui-kit/src/components/ChatInput/._index.test.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ChatInput/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ChatInput/._use-auto-rows.test.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ChatInput/._use-auto-rows.ts +0 -0
- package/packages/agent-ui-kit/src/components/ChatInput/voice/._VoicePressField.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ChatInput/voice/._VoiceRecordingOverlay.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ChatInput/voice/._machine.ts +0 -0
- package/packages/agent-ui-kit/src/components/ChatInput/voice/._useVoicePress.ts +0 -0
- package/packages/agent-ui-kit/src/components/HistoryEntry/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/MediaList/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/MessageBubble/._index.test.tsx +0 -0
- package/packages/agent-ui-kit/src/components/MessageBubble/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/PullDownIndicator/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/QuickCommands/._index.test.tsx +0 -0
- package/packages/agent-ui-kit/src/components/QuickCommands/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/QuickCommands/index.tsx +60 -14
- package/packages/agent-ui-kit/src/components/ReasoningBlock/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ScrollToBottomButton/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ToolCallBlock/._detail.test.ts +0 -0
- package/packages/agent-ui-kit/src/components/ToolCallBlock/._detail.ts +0 -0
- package/packages/agent-ui-kit/src/components/ToolCallBlock/._index.test.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ToolCallBlock/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ToolCallBlock/._titles.ts +0 -0
- package/packages/agent-ui-kit/src/components/ToolCallBlock/detail.test.ts +2 -0
- package/packages/agent-ui-kit/src/components/ToolCallBlock/detail.ts +9 -2
- package/packages/agent-ui-kit/src/contract.test.tsx +176 -0
- package/packages/agent-ui-kit/src/hooks/._use-drag-gesture.test.ts +0 -0
- package/packages/agent-ui-kit/src/hooks/._use-drag-gesture.ts +0 -0
- package/packages/agent-ui-kit/src/hooks/._use-pull-down-history.ts +0 -0
- package/packages/agent-ui-kit/src/hooks/._use-pull-down-wheel-native.test.ts +0 -0
- package/packages/agent-ui-kit/src/hooks/._use-stick-to-bottom.test.tsx +0 -0
- package/packages/agent-ui-kit/src/hooks/._use-stick-to-bottom.ts +0 -0
- package/packages/agent-ui-kit/src/hooks/._useMediaUpload.ts +0 -0
- package/packages/agent-ui-kit/src/hooks/._useTTSAutoPlay.ts +0 -0
- package/packages/agent-ui-kit/src/hooks/use-stick-to-bottom.test.tsx +101 -0
- package/packages/agent-ui-kit/src/hooks/use-stick-to-bottom.ts +35 -7
- package/packages/agent-ui-kit/src/index.ts +2 -0
- package/packages/agent-ui-kit/src/overlay/._Overlay.tsx +0 -0
- package/packages/agent-ui-kit/src/overlay/._focus.ts +0 -0
- package/packages/agent-ui-kit/src/overlay/._index.ts +0 -0
- package/packages/agent-ui-kit/src/overlay/._inert.ts +0 -0
- package/packages/agent-ui-kit/src/overlay/._layers.ts +0 -0
- package/packages/agent-ui-kit/src/overlay/._overlay.ssr.test.tsx +0 -0
- package/packages/agent-ui-kit/src/overlay/._overlay.test.tsx +0 -0
- package/packages/agent-ui-kit/src/overlay/._presence.ts +0 -0
- package/packages/agent-ui-kit/src/overlay/._scroll-lock.ts +0 -0
- package/packages/agent-ui-kit/src/overlay/._stack.ts +0 -0
- package/packages/agent-ui-kit/src/overlay/._use-overlay.ts +0 -0
- package/packages/agent-ui-kit/src/overlay/Overlay.tsx +20 -2
- package/packages/agent-ui-kit/src/preview-provider.tsx +8 -0
- package/packages/agent-ui-kit/src/shell.contract.json +1 -1
- package/packages/agent-ui-kit/src/shell.test.ts +105 -2
- package/packages/agent-ui-kit/src/test/._setup.ts +0 -0
- package/packages/agent-ui-kit/src/theme/._base.css +0 -0
- package/packages/agent-ui-kit/src/theme/._contract.json +0 -0
- package/packages/agent-ui-kit/src/theme/._motion.css +0 -0
- package/packages/agent-ui-kit/src/theme/._theme-contract.test.ts +0 -0
- package/packages/agent-ui-kit/src/theme/._theme.ts +0 -0
- package/packages/agent-ui-kit/src/theme/._tokens.css +0 -0
- package/packages/agent-ui-kit/src/theme/base.css +42 -2
- package/packages/agent-ui-kit/src/utils/._copyText.ts +0 -0
- package/packages/agent-ui-kit/src/utils/._haptics.test.ts +0 -0
- package/packages/agent-ui-kit/src/utils/._haptics.ts +0 -0
- package/packages/agent-ui-kit/src/utils/._image-preview-host.tsx +0 -0
- package/packages/agent-ui-kit/src/utils/._imagePreview.test.ts +0 -0
- package/packages/agent-ui-kit/src/utils/._imagePreview.ts +0 -0
- package/packages/agent-ui-kit/src/utils/._pull-down-machine.test.ts +0 -0
- package/packages/agent-ui-kit/src/utils/._pull-down-machine.ts +0 -0
- package/packages/agent-ui-kit/src/utils/._session-error.ts +0 -0
- package/packages/agent-ui-kit/src/utils/._toast.test.ts +0 -0
- package/packages/agent-ui-kit/src/utils/._toast.ts +0 -0
- package/packages/agent-ui-kit/src/utils/._tool-call-display.test.ts +0 -0
- package/packages/agent-ui-kit/src/utils/._tool-call-display.ts +0 -0
- package/packages/contracts-mall/._package.json +0 -0
- package/packages/contracts-mall/._tsconfig.json +0 -0
- package/packages/contracts-mall/src/._index.ts +0 -0
- package/packages/contracts-mall/src/._runtime.ts +0 -0
- package/packages/contracts-mall/src/server/._index.ts +0 -0
- package/packages/shared/._AGENTS.md +0 -0
- package/packages/shared/._package.json +0 -0
- package/packages/shared/._tsconfig.json +0 -0
- package/packages/shared/src/._index.ts +0 -0
- package/pnpm-lock.template.yaml +901 -897
- package/pnpm-workspace.template.yaml +17 -12
- package/profiles/._mall.json +0 -0
- package/profiles/mall/._TEMPLATE.md +0 -0
- package/profiles/mall/._chat.overrides.json +0 -0
- package/profiles/mall/config/._agent.jsonc +0 -0
- package/profiles/mall/config/._chat.json +0 -0
- package/profiles/mall/config/._knowledge.json +0 -0
- package/scenarios/._README.md +0 -0
- package/scripts/._assert-pack.mjs +0 -0
- package/scripts/._build.sh +0 -0
- package/scripts/._check-css-target.mjs +0 -0
- package/scripts/._check-fast.mjs +0 -0
- package/scripts/._check-workspace.mjs +0 -0
- package/scripts/._checks.json +0 -0
- package/scripts/._deliver.mjs +0 -0
- package/scripts/._dev-alipay.mjs +0 -0
- package/scripts/._dev.sh +0 -0
- package/scripts/._generate.mjs +0 -0
- package/scripts/._interaction-probe.mjs +0 -0
- package/scripts/._prepare.sh +0 -0
- package/scripts/._shell-probe.mjs +0 -0
- package/scripts/._smoke.mjs +0 -0
- package/scripts/._start.sh +0 -0
- package/scripts/._stop.sh +0 -0
- package/scripts/._storyboard.mjs +0 -0
- package/scripts/._verify-generated.mjs +0 -0
- package/scripts/check-fast.mjs +11 -2
- package/scripts/checks.json +80 -2
- package/scripts/deliver.mjs +85 -7
- package/scripts/interaction-probe.mjs +222 -0
- package/scripts/lib/._chrome-pipe.mjs +0 -0
- package/scripts/lib/._geometry-kernel.mjs +0 -0
- package/scripts/lib/geometry-kernel.mjs +8 -1
- package/scripts/shell-probe.mjs +8 -3
- package/scripts/storyboard.mjs +5 -0
|
@@ -10,6 +10,7 @@ import { ChatPage } from './ChatPage';
|
|
|
10
10
|
import { configureChatConfigDefaults, useChatConfigStore } from './chat-config';
|
|
11
11
|
import { createPreviewStore } from './preview-provider';
|
|
12
12
|
import { SHELL_CONTRACT } from './shell';
|
|
13
|
+
import { triggerResizeObservers } from './test/setup';
|
|
13
14
|
|
|
14
15
|
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
15
16
|
const read = (rel: string) => readFileSync(path.join(here, rel), 'utf8');
|
|
@@ -125,8 +126,12 @@ describe('商场对话壳的主题布局', () => {
|
|
|
125
126
|
// 壳没有页头:紧凑与非紧凑都不渲染常驻品牌区
|
|
126
127
|
expect(container.querySelector('.chat-page__brand')).toBeNull();
|
|
127
128
|
expect(container.querySelector('.chat-page__body')?.classList.contains('justify-center')).toBe(false);
|
|
128
|
-
|
|
129
|
-
expect(
|
|
129
|
+
// 有 home 槽:快捷胶囊固定在输入框上方,不沉到首页正文底部
|
|
130
|
+
expect(container.querySelector('.chat-page__body .quick-commands')).toBeNull();
|
|
131
|
+
expect(container.querySelector('.quick-commands + .tbox-chat-input')).not.toBeNull();
|
|
132
|
+
expect(
|
|
133
|
+
container.querySelector('.quick-commands')?.classList.contains(compact ? 'quick-commands--compact' : 'quick-commands--row'),
|
|
134
|
+
).toBe(true);
|
|
130
135
|
expect(container.querySelector('textarea')?.classList.contains('h-6')).toBe(compact);
|
|
131
136
|
expect(container.querySelector('.history-entry__button')?.classList.contains('min-h-11')).toBe(!compact);
|
|
132
137
|
} finally {
|
|
@@ -136,6 +141,27 @@ describe('商场对话壳的主题布局', () => {
|
|
|
136
141
|
useChatConfigStore.setState(previousConfig, true);
|
|
137
142
|
}
|
|
138
143
|
});
|
|
144
|
+
|
|
145
|
+
it('无 home 槽的纯对话欢迎态保留正文内两列网格', async () => {
|
|
146
|
+
const previousConfig = useChatConfigStore.getState();
|
|
147
|
+
const container = document.createElement('div');
|
|
148
|
+
document.body.append(container);
|
|
149
|
+
const root = createRoot(container);
|
|
150
|
+
const store = createPreviewStore({
|
|
151
|
+
messages: [], historyMessages: [], historyHasMore: false, orphanCards: [], cardsByMessageId: {},
|
|
152
|
+
runtimeStatus: 'ready', initConversation: async () => {}, destroy: () => {},
|
|
153
|
+
});
|
|
154
|
+
try {
|
|
155
|
+
configureChatConfigDefaults({ quickCommands: [{ label: '优惠', query: '有优惠吗?' }] });
|
|
156
|
+
await act(async () => root.render(createElement(ChatPage, { store, cards: {} })));
|
|
157
|
+
expect(container.querySelector('.chat-page__body .quick-commands--grid')).not.toBeNull();
|
|
158
|
+
expect(container.querySelector('.quick-commands + .tbox-chat-input')).toBeNull();
|
|
159
|
+
} finally {
|
|
160
|
+
await act(async () => root.unmount());
|
|
161
|
+
container.remove();
|
|
162
|
+
useChatConfigStore.setState(previousConfig, true);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
139
165
|
});
|
|
140
166
|
|
|
141
167
|
describe('历史首次打开', () => {
|
|
@@ -166,3 +192,80 @@ describe('历史首次打开', () => {
|
|
|
166
192
|
}
|
|
167
193
|
});
|
|
168
194
|
});
|
|
195
|
+
|
|
196
|
+
describe('空态滚动复位', () => {
|
|
197
|
+
const message = (id: string) => ({ id, role: 'user' as const, status: 'done' as const, content: id, createdAt: 1 });
|
|
198
|
+
/** 冲刷一轮 ResizeObserver 回调 + 等 rAF 真正执行(贴底写在 rAF 里)。 */
|
|
199
|
+
const flushFrame = async () => {
|
|
200
|
+
await act(async () => {
|
|
201
|
+
triggerResizeObservers();
|
|
202
|
+
await new Promise<void>((resolve) => requestAnimationFrame(() => requestAnimationFrame(() => resolve())));
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* 空会话四段断言(home 槽首页与纯对话欢迎态共用):
|
|
208
|
+
* 空态不被拽底 → 进对话贴底 → 上滑脱离后经非按钮路径清空 → 回顶且恢复跟随 → 非 send() 首消息仍贴底。
|
|
209
|
+
*/
|
|
210
|
+
async function expectEmptyStateRecovery(slots?: ClientSlotRegistry) {
|
|
211
|
+
const container = document.createElement('div');
|
|
212
|
+
document.body.append(container);
|
|
213
|
+
const root = createRoot(container);
|
|
214
|
+
const store = createPreviewStore({
|
|
215
|
+
messages: [], historyMessages: [], historyHasMore: false, orphanCards: [], cardsByMessageId: {},
|
|
216
|
+
runtimeStatus: 'ready', initConversation: async () => {}, destroy: () => {},
|
|
217
|
+
});
|
|
218
|
+
try {
|
|
219
|
+
await act(async () => root.render(createElement(ChatPage, { store, cards: {}, ...(slots ? { slots } : {}) })));
|
|
220
|
+
const body = container.querySelector<HTMLElement>('.chat-page__body')!;
|
|
221
|
+
// 内容 1200 / 视口 400 → 贴底位 = 800;写法与真实滚动容器同形(含 clamp 与 scroll 事件)。
|
|
222
|
+
let scrollTop = 0;
|
|
223
|
+
Object.defineProperty(body, 'scrollHeight', { configurable: true, get: () => 1200 });
|
|
224
|
+
Object.defineProperty(body, 'clientHeight', { configurable: true, get: () => 400 });
|
|
225
|
+
Object.defineProperty(body, 'scrollTop', {
|
|
226
|
+
configurable: true,
|
|
227
|
+
get: () => scrollTop,
|
|
228
|
+
set: (value: number) => {
|
|
229
|
+
scrollTop = Math.max(0, Math.min(value, 800));
|
|
230
|
+
body.dispatchEvent(new Event('scroll'));
|
|
231
|
+
},
|
|
232
|
+
});
|
|
233
|
+
const jumpVisible = () => container
|
|
234
|
+
.querySelector('[data-tbox-control="scroll-bottom"]')!
|
|
235
|
+
.classList.contains('scroll-to-bottom-btn--visible');
|
|
236
|
+
|
|
237
|
+
await flushFrame();
|
|
238
|
+
expect(scrollTop).toBe(0);
|
|
239
|
+
expect(jumpVisible()).toBe(false);
|
|
240
|
+
|
|
241
|
+
await act(async () => store.setState({ messages: [message('m1')] }));
|
|
242
|
+
await flushFrame();
|
|
243
|
+
expect(scrollTop).toBe(800);
|
|
244
|
+
|
|
245
|
+
// 用户上滑脱离跟随,再经非按钮路径清空回空会话:应回到顶部并恢复跟随态
|
|
246
|
+
await act(async () => body.dispatchEvent(new WheelEvent('wheel', { deltaY: -120 })));
|
|
247
|
+
await act(async () => store.setState({ messages: [] }));
|
|
248
|
+
await flushFrame();
|
|
249
|
+
expect(scrollTop).toBe(0);
|
|
250
|
+
expect(jumpVisible()).toBe(false);
|
|
251
|
+
|
|
252
|
+
// 模拟 runAutoSend / 服务端首推等非 send() 路径:恢复后的跟随态应再次贴底
|
|
253
|
+
await act(async () => store.setState({ messages: [message('m2')] }));
|
|
254
|
+
await flushFrame();
|
|
255
|
+
expect(scrollTop).toBe(800);
|
|
256
|
+
} finally {
|
|
257
|
+
await act(async () => root.unmount());
|
|
258
|
+
container.remove();
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
it('home 槽首页:首屏不被拽底;进对话贴底;清空回首页回顶并恢复跟随', async () => {
|
|
263
|
+
const slots = new ClientSlotRegistry();
|
|
264
|
+
slots.register('home', () => createElement('main', null, '商场首页'));
|
|
265
|
+
await expectEmptyStateRecovery(slots);
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
it('无 home 槽欢迎态:长首屏同样不拽底,清空回欢迎区后仍能贴底', async () => {
|
|
269
|
+
await expectEmptyStateRecovery();
|
|
270
|
+
});
|
|
271
|
+
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -146,14 +146,54 @@
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
|
|
149
|
+
/* 欢迎区表面变体(welcome.surface):只组合既有平台变量,不新增变量键
|
|
150
|
+
(contract.json 是封闭清单,加键即 doctor/主题包门禁报错)。 */
|
|
151
|
+
.chat-page__welcome--brand {
|
|
152
|
+
border-radius: var(--tbox-radius-lg);
|
|
153
|
+
/* 三停渐变全用现有平台变量(不引 color-mix:兼容门禁要求 color-mix 必须带静态回退)。
|
|
154
|
+
上层叠 18% 黑罩:任何品牌色下 14px 副标题对比度都能到 5:1 以上——
|
|
155
|
+
渐变本身在 primary 停点上只有 4.17:1,不足以承载小字正文。 */
|
|
156
|
+
background-color: var(--tbox-primary-dark);
|
|
157
|
+
background-image:
|
|
158
|
+
linear-gradient(0deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.18)),
|
|
159
|
+
linear-gradient(142deg, var(--tbox-primary-dark) 0%, var(--tbox-primary) 62%, var(--tbox-accent) 100%);
|
|
160
|
+
box-shadow: var(--tbox-shadow-md);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.chat-page__welcome--subtle {
|
|
164
|
+
border-radius: var(--tbox-radius-lg);
|
|
165
|
+
}
|
|
166
|
+
|
|
149
167
|
/* 表单控件继承排版:模板不引 preflight,原生 button/input 否则落到浏览器默认 13.33px(越档字号)。
|
|
150
|
-
|
|
151
|
-
:where(.tbox-app, .chat-page, .tbox-card) :where(button, input, textarea, select) {
|
|
168
|
+
作用域限定在壳、卡片与弹层内,工具类仍可覆写。 */
|
|
169
|
+
:where(.tbox-app, .chat-page, .tbox-card, [data-tbox-overlay]) :where(button, input, textarea, select) {
|
|
152
170
|
font: inherit;
|
|
153
171
|
color: inherit;
|
|
154
172
|
letter-spacing: inherit;
|
|
155
173
|
}
|
|
156
174
|
|
|
175
|
+
/* 按钮基座重置(无全局 preflight 的作用域替代):裸 <button> 否则会带出浏览器默认的
|
|
176
|
+
2px outset 边框与 buttonface 灰底——卡片里手写的按钮因此看起来像系统控件。
|
|
177
|
+
:where() 零权重 + base 层 → 任何工具类(bg-primary / border / px-3 …)无条件胜出。 */
|
|
178
|
+
:where(.tbox-card, .chat-page, [data-tbox-overlay]) button {
|
|
179
|
+
background: transparent;
|
|
180
|
+
border: 0 solid transparent;
|
|
181
|
+
padding: 0;
|
|
182
|
+
appearance: none;
|
|
183
|
+
-webkit-appearance: none;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/* 抽屉内嵌卡片融合:BottomSheet 已经提供外壳、圆角与内边距,
|
|
187
|
+
卡框的圆角/描边/阴影/底距与入场动画会让它变成「卡里套卡」。 */
|
|
188
|
+
.tbox-bottom-sheet__body .tbox-card {
|
|
189
|
+
margin-bottom: 0;
|
|
190
|
+
border: 0;
|
|
191
|
+
border-radius: 0;
|
|
192
|
+
box-shadow: none;
|
|
193
|
+
background: transparent;
|
|
194
|
+
animation: none;
|
|
195
|
+
}
|
|
196
|
+
|
|
157
197
|
/* 基元/模块迁移后不再各自写 margin reset:标题、段落、列表统一归零(在 base 层,工具类可覆写)。 */
|
|
158
198
|
h1, h2, h3, h4, h5, h6, p, dl, dd, dt, ul, ol {
|
|
159
199
|
margin: 0;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|