@tbox.cn/app-template-agent 1.0.0-alpha.1 → 1.0.0-alpha.7
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 +7 -2
- 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/card-render/._demo.html +0 -0
- package/.tbox/card-render/._demo.png +0 -0
- package/.tbox/card-render/._scale-demo.audit.html +0 -0
- package/.tbox/card-render/._scale-demo.html +0 -0
- package/.tbox/card-render/baseline/._demo.png +0 -0
- package/.tbox/card-render/baseline/demo.png +0 -0
- package/.tbox/card-render/demo.html +342 -0
- package/.tbox/card-render/demo.png +0 -0
- package/.tbox/card-render/scale-demo.audit.html +984 -0
- package/.tbox/card-render/scale-demo.html +939 -0
- package/.tbox/default-modules.json +1 -1
- package/.tbox/evidence/._cards.txt +0 -0
- package/.tbox/evidence/._gate.json +0 -0
- package/.tbox/evidence/._last-gate.json +0 -0
- package/.tbox/evidence/._scenarios.json +0 -0
- package/.tbox/evidence/cards.txt +1 -0
- package/.tbox/evidence/gate.json +1 -0
- package/.tbox/evidence/last-gate.json +1 -0
- package/.tbox/evidence/scenarios.json +1 -0
- package/.tbox/miniapp-containers.json +1 -1
- package/AGENTS.md +59 -13
- package/ENV.md +4 -4
- package/README.md +22 -20
- package/apps/._AGENTS.md +0 -0
- package/apps/AGENTS.md +0 -4
- package/apps/client/._STYLE_GUIDE.md +0 -0
- package/apps/client/._VISUAL_RESTORE.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/.tbox-gen/._app-registry.ts +0 -0
- package/apps/client/.tbox-gen/._manifest.json +0 -0
- package/apps/client/.tbox-gen/._registry.client.ts +0 -0
- package/apps/client/.tbox-gen/._registry.server.ts +0 -0
- package/apps/client/.tbox-gen/app-registry.ts +3 -0
- package/apps/client/.tbox-gen/documents/._index.html +0 -0
- package/apps/client/.tbox-gen/documents/_tbox/._card-preview.html +0 -0
- package/apps/client/.tbox-gen/documents/_tbox/card-preview.html +38 -14
- package/apps/client/.tbox-gen/documents/index.html +38 -14
- package/apps/client/.tbox-gen/entries/._card-preview.tsx +0 -0
- package/apps/client/.tbox-gen/entries/._index.tsx +0 -0
- package/apps/client/.tbox-gen/entries/card-preview.tsx +3 -15
- package/apps/client/.tbox-gen/entries/index.tsx +8 -15
- package/apps/client/.tbox-gen/registry.server.ts +4 -4
- package/apps/client/STYLE_GUIDE.md +31 -64
- package/apps/client/index.html +38 -14
- package/apps/client/package.json +3 -3
- package/apps/client/scripts/._check-evidence.mjs +0 -0
- package/apps/client/scripts/._render-card.mjs +0 -0
- package/apps/client/scripts/check-evidence.mjs +831 -0
- package/apps/client/scripts/render-card.mjs +743 -0
- package/apps/client/src/._app.config.ts +0 -0
- package/apps/client/src/._vite-env.d.ts +0 -0
- package/apps/client/src/app.config.ts +40 -0
- package/apps/client/src/cards/._AGENTS.md +0 -0
- package/apps/client/src/cards/._registry.ts +0 -0
- package/apps/client/src/cards/AGENTS.md +11 -0
- 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/pages/page.tsx +2 -2
- package/apps/client/src/store/._chat.ts +0 -0
- package/apps/client/src/store/chat.ts +7 -3
- package/apps/client/src/styles/._brand.css +0 -0
- package/apps/client/src/styles/._tailwind.css +0 -0
- package/apps/client/src/styles/brand.css +51 -0
- package/apps/client/src/styles/tailwind.css +307 -0
- package/apps/client/src/test/._setup.ts +0 -0
- package/apps/client/src/vite-env.d.ts +0 -2
- package/apps/client/vite.config.ts +5 -22
- 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/probe.mjs +382 -0
- package/apps/server/scripts/scenario-lib.mjs +247 -0
- package/apps/server/scripts/scenario.mjs +33 -0
- 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/app.ts +10 -3
- package/apps/server/src/cards/._AGENTS.md +0 -0
- package/apps/server/src/cards/AGENTS.md +19 -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/dev.ts +2 -2
- package/apps/server/src/index.ts +2 -2
- package/apps/server/src/pre-tools.ts +7 -16
- package/apps/server/src/tools/._AGENTS.md +0 -0
- package/apps/server/src/tools/AGENTS.md +23 -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/apps/server/tests/tool-runtime.test.ts +0 -27
- package/config/._AGENTS.md +0 -0
- package/config/._README.md +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/AGENTS.md +13 -0
- package/config/README.md +4 -4
- package/config/chat.json +8 -2
- package/config/integrations.json +1 -1
- 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/._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/agent-prompt.md +38 -0
- package/docs/agent/card-action.md +96 -0
- package/docs/agent/card.md +116 -0
- package/docs/agent/conversation.md +52 -0
- package/docs/agent/kit.md +79 -0
- package/docs/agent/shell.md +76 -0
- package/docs/agent/state.md +85 -0
- package/docs/agent/style.md +95 -0
- package/docs/agent/tool-emits-card.md +57 -0
- package/docs/agent/tool.md +69 -0
- package/docs/agent/verify.md +145 -0
- package/eslint.config.mjs +18 -0
- 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/AGENTS.md +5 -5
- package/modules/provider-custom/INTEGRATION.md +2 -2
- 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/src/server/example-adapter.ts +2 -2
- package/modules/provider-custom/src/server/index.ts +1 -1
- package/modules/provider-custom/tests/._provider-custom.test.ts +0 -0
- package/package.json +13 -5
- 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/AGENTS.md +8 -0
- package/packages/agent-ui-kit/README.md +4 -4
- 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 +842 -0
- package/packages/agent-ui-kit/package.json +8 -5
- 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/._icons.ts +0 -0
- package/packages/agent-ui-kit/src/._index.ts +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/._types.ts +0 -0
- package/packages/agent-ui-kit/src/._vite-env.d.ts +0 -0
- package/packages/agent-ui-kit/src/ChatPage.tsx +34 -7
- 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/define-card.ts +34 -0
- package/packages/agent-ui-kit/src/card/primitives.test.tsx +147 -0
- package/packages/agent-ui-kit/src/card/primitives.tsx +627 -0
- package/packages/agent-ui-kit/src/card/use-card-actions.ts +86 -0
- package/packages/agent-ui-kit/src/chat-config.test.ts +35 -71
- package/packages/agent-ui-kit/src/chat-config.ts +18 -0
- package/packages/agent-ui-kit/src/components/._CardRenderer.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 +3 -3
- package/packages/agent-ui-kit/src/components/ActionBar/index.tsx +13 -14
- package/packages/agent-ui-kit/src/components/ChatHeader/._index.test.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ChatHeader/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ChatHeader/index.tsx +19 -17
- 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/index.tsx +32 -26
- 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/ChatInput/voice/VoicePressField.tsx +12 -3
- package/packages/agent-ui-kit/src/components/ChatInput/voice/VoiceRecordingOverlay.tsx +9 -9
- package/packages/agent-ui-kit/src/components/HistoryEntry/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/HistoryEntry/index.tsx +3 -4
- package/packages/agent-ui-kit/src/components/MediaList/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/MediaList/index.tsx +42 -28
- 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/MessageBubble/index.tsx +52 -27
- package/packages/agent-ui-kit/src/components/PullDownIndicator/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/PullDownIndicator/index.tsx +3 -4
- 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 +6 -6
- package/packages/agent-ui-kit/src/components/ReasoningBlock/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ReasoningBlock/index.tsx +14 -9
- package/packages/agent-ui-kit/src/components/ScrollToBottomButton/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ScrollToBottomButton/index.tsx +2 -4
- 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/index.tsx +54 -36
- 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/._useMediaUpload.ts +0 -0
- package/packages/agent-ui-kit/src/hooks/._useTTSAutoPlay.ts +0 -0
- package/packages/agent-ui-kit/src/icons.ts +39 -0
- package/packages/agent-ui-kit/src/index.ts +55 -2
- package/packages/agent-ui-kit/src/shell.contract.json +59 -0
- package/packages/agent-ui-kit/src/shell.test.ts +61 -0
- package/packages/agent-ui-kit/src/shell.ts +45 -0
- 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 +132 -0
- package/packages/agent-ui-kit/src/theme/contract.json +1 -1
- package/packages/agent-ui-kit/src/theme/theme-contract.test.ts +3 -3
- package/packages/agent-ui-kit/src/theme/{tokens.less → tokens.css} +14 -12
- 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/._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.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/AGENTS.md +4 -2
- package/packages/shared/package.json +7 -0
- package/packages/shared/src/._index.ts +0 -0
- package/pnpm-lock.template.yaml +679 -464
- package/pnpm-workspace.template.yaml +16 -11
- package/profiles/._mall.json +0 -0
- package/profiles/mall/._TEMPLATE.md +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/profiles/mall/config/._llm_provider.json +0 -0
- package/profiles/mall/config/._plugins.json +0 -0
- package/scenarios/._README.md +0 -0
- package/scenarios/README.md +7 -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/._compat-probe.mjs +0 -0
- package/scripts/._dev-alipay.mjs +0 -0
- package/scripts/._dev.sh +0 -0
- package/scripts/._gen-tailwind-sources.mjs +0 -0
- package/scripts/._generate.mjs +0 -0
- package/scripts/._prepare.sh +0 -0
- package/scripts/._smoke.mjs +0 -0
- package/scripts/._start.sh +0 -0
- package/scripts/._stop.sh +0 -0
- package/scripts/._verify-generated.mjs +0 -0
- package/scripts/check-css-target.mjs +69 -0
- package/scripts/check-fast.mjs +118 -0
- package/scripts/check-workspace.mjs +68 -19
- package/scripts/checks.json +253 -0
- package/scripts/compat-probe.mjs +108 -0
- package/scripts/dev-alipay.mjs +1 -1
- package/scripts/gen-tailwind-sources.mjs +55 -0
- package/tsconfig.base.json +1 -0
- package/apps/client/.tbox-gen/app-kind.ts +0 -1
- package/apps/client/src/platform/AgentChatApp.tsx +0 -6
- package/apps/client/src/platform/AppShell.tsx +0 -42
- package/apps/client/src/platform/agent-runtime.ts +0 -16
- package/apps/client/src/platform/bootstrap.ts +0 -55
- package/apps/client/src/platform/card-preview-page.tsx +0 -10
- package/apps/client/src/platform/mount-page.tsx +0 -20
- package/apps/client/src/platform/state/createPersistedStore.ts +0 -19
- package/apps/server/src/tools/clock.tool.ts +0 -24
- package/apps/server/src/tools/translate.tool.ts +0 -47
- package/packages/agent-ui-kit/src/ChatPage.less +0 -62
- package/packages/agent-ui-kit/src/components/ActionBar/index.less +0 -123
- package/packages/agent-ui-kit/src/components/ChatHeader/index.less +0 -148
- package/packages/agent-ui-kit/src/components/ChatInput/index.less +0 -394
- package/packages/agent-ui-kit/src/components/HistoryEntry/index.less +0 -49
- package/packages/agent-ui-kit/src/components/MediaList/index.less +0 -241
- package/packages/agent-ui-kit/src/components/MessageBubble/index.less +0 -325
- package/packages/agent-ui-kit/src/components/PullDownIndicator/index.less +0 -32
- package/packages/agent-ui-kit/src/components/QuickCommands/index.less +0 -63
- package/packages/agent-ui-kit/src/components/ReasoningBlock/index.less +0 -90
- package/packages/agent-ui-kit/src/components/ScrollToBottomButton/index.less +0 -32
- package/packages/agent-ui-kit/src/components/ToolCallBlock/index.less +0 -312
- package/packages/agent-ui-kit/src/theme/global.less +0 -99
- /package/packages/agent-ui-kit/src/theme/{motion.less → motion.css} +0 -0
|
@@ -1,81 +1,48 @@
|
|
|
1
|
-
# STYLE_GUIDE.md — `client/`
|
|
1
|
+
# STYLE_GUIDE.md — `apps/client/`
|
|
2
2
|
|
|
3
|
-
纯 web(Vite + React +
|
|
3
|
+
纯 web(Vite + React + Tailwind)的样式约定。只列对本项目仍适用的几条;本项目是 web-view H5、不是原生小程序,**没有小程序 CSS 限制**。
|
|
4
4
|
|
|
5
|
-
## 1.
|
|
5
|
+
## 1. 只有一种写法:Tailwind 工具类
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
样式写在 TSX 的 `className`,不新建样式文件、不写行内 `style`。入口是 `src/styles/tailwind.css`(只引 theme + utilities,不引 preflight),语义色/标度/字号档都在它的 `@theme inline` 里。
|
|
8
8
|
|
|
9
|
-
```
|
|
10
|
-
.
|
|
11
|
-
max-width: 800PX; /* 固定 800px,不转 rem */
|
|
12
|
-
padding: 24px; /* 24px → 0.24rem,随屏缩放 */
|
|
13
|
-
}
|
|
9
|
+
```tsx
|
|
10
|
+
<button className="inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-2 text-sm text-primary-foreground" />
|
|
14
11
|
```
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
- 类名必须是完整字面量:`bg-${tone}` 不会被扫描到,页面表现为「没有样式」。
|
|
14
|
+
- 类名与 `${` 之间留空格:`text-xs${cond ? … : …}` 会让整条类丢失。
|
|
15
|
+
- 动态状态用整串字面量三元或按状态键取的映射表。
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
max-width: var(--tbox-content-max-width); /* = 800PX */
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
> `1px` 边框默认不转(`minPixelValue`)。本项目无 stylelint,无需 `unit-case` 注释。
|
|
23
|
-
|
|
24
|
-
## 2. flex 里图标 / 图片别被压扁或溢出
|
|
17
|
+
## 2. 单位与档位
|
|
25
18
|
|
|
26
|
-
|
|
19
|
+
- 间距 1 单位 = 4px(`p-3` = 12px);非 4 倍数用精确值 `py-[3px]`。
|
|
20
|
+
- 字号只有 12/14/16/18/20/24/30/36 六档以上(`text-xs`…`text-4xl`),不写 `text-[13px]`。
|
|
21
|
+
- 圆角档位是 px(`rounded-sm`=6 / `md`=8 / `lg`=12 …),断点是 px(`md:` = 768px)。
|
|
22
|
+
- **不要用 rem/em 写尺寸**:入口会设置根字号,rem 会被放大。
|
|
23
|
+
- 颜色只写语义名(`text-foreground` / `bg-card` / `border-border` / `text-primary` …);一次性色值用 `bg-[#fff8e9]`;半透明用 `bg-[rgba(11,15,23,0.02)]`。
|
|
27
24
|
|
|
28
|
-
|
|
25
|
+
## 3. 品牌与主题
|
|
29
26
|
|
|
30
|
-
|
|
31
|
-
/* 标题行:右侧箭头图标别被长标题挤压 */
|
|
32
|
-
.title-row {
|
|
33
|
-
display: flex;
|
|
34
|
-
align-items: center;
|
|
35
|
-
justify-content: space-between;
|
|
27
|
+
品牌入口 `src/styles/brand.css`:只在 `html[data-theme='tbox']` 段覆写 `--tbox-*` 变量。工具类产物是 `var(--tbox-*)`,覆写照常生效。变量清单是封闭集(kit `theme/contract.json`),写错名字静默不生效。
|
|
36
28
|
|
|
37
|
-
|
|
38
|
-
}
|
|
29
|
+
## 4. 旧 web-view 兼容
|
|
39
30
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
height: 72px;
|
|
44
|
-
flex-shrink: 0;
|
|
45
|
-
overflow: hidden;
|
|
31
|
+
- 颜色语法一律 `rgba(r, g, b, a)`;`rgb(r g b / a)` 在旧 WebKit 上整条失效。
|
|
32
|
+
- 产物特征门禁:`pnpm check:css` 按 `package.json` 的 `tbox.compat.baseline` 扫越线特性。
|
|
33
|
+
- 禁用项(默认调色板 / 颜色透明度修饰符 / 越档字号 / 元素级 `--tbox-asset-*` / 类名紧贴 `${`)由 `check:fast` 判错。
|
|
46
34
|
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## 3. 隐藏滚动条(移动端观感)
|
|
35
|
+
## 5. 卡片排版
|
|
52
36
|
|
|
53
|
-
|
|
37
|
+
- flex 里的图标/图片加 `shrink-0` 与显式尺寸。
|
|
38
|
+
- 文字截断用 `truncate` / `line-clamp-2`,不要手写 `-webkit-box`。
|
|
39
|
+
- 卡片宽度由容器决定,不要写死宽度。
|
|
40
|
+
- 详细配方见 `docs/agent/style.md`。
|
|
54
41
|
|
|
55
|
-
|
|
42
|
+
## 6. 没有 px→rem 转换层
|
|
56
43
|
|
|
57
|
-
|
|
58
|
-
.scroll-container {
|
|
59
|
-
-ms-overflow-style: none; /* IE/Edge */
|
|
60
|
-
scrollbar-width: none; /* Firefox */
|
|
44
|
+
构建链里没有 `postcss-pxtorem`、也没有 `less`:写的 px 就是屏幕 px。
|
|
61
45
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
height: 0;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## 4. 颜色用 `rgba()` 传统语法(web-view 兼容)
|
|
71
|
-
|
|
72
|
-
CSS Color 4 的空格分隔 `rgb(r g b / a)` 语法在**部分旧机型的支付宝 web-view(旧 WebKit)**可能不支持,导致**整条属性失效**(不是降级,是消失)。新写代码优先用 `rgba()`:
|
|
73
|
-
|
|
74
|
-
```less
|
|
75
|
-
/* ✅ 安全 */
|
|
76
|
-
box-shadow: 0 3px 8px rgba(1, 112, 254, 0.04);
|
|
77
|
-
color: rgba(31, 59, 99, 0.85);
|
|
78
|
-
|
|
79
|
-
/* ⚠️ 旧 web-view 风险:整条可能失效 */
|
|
80
|
-
box-shadow: 0 3px 8px rgb(1 112 254 / 3.92%);
|
|
81
|
-
```
|
|
46
|
+
- 主题变量写大写 `PX` 或小写 `px` 都可以(没有转换器了),统一大写便于和旧版 CSS 对照;
|
|
47
|
+
- `less` 也别再加回来——样式只写 TSX 里的工具类,或 `styles/*.css` 里的变量/基座;
|
|
48
|
+
- kit 不从 registry 装:应用自带 `packages/agent-ui-kit`,模板 workspace 用 `link:` 把它指给模块的 optional peer。
|
package/apps/client/index.html
CHANGED
|
@@ -2,28 +2,52 @@
|
|
|
2
2
|
<html lang="zh-CN">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
|
-
<!--
|
|
5
|
+
<!-- 移动端视口;缩放锁定(尺寸全部是物理 px,不做 rem 换算) -->
|
|
6
6
|
<meta
|
|
7
7
|
name="viewport"
|
|
8
8
|
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"
|
|
9
9
|
/>
|
|
10
10
|
<meta name="theme-color" content="#fbfcfe" />
|
|
11
|
-
<!--
|
|
12
|
-
|
|
13
|
-
- 移动端(clientWidth<=450):动态 (100/750)*clientWidth;
|
|
14
|
-
- PC(clientWidth>450):固定 50px(页面不随窗口缩放,内容 800px 居中、渐变底铺满)。 -->
|
|
11
|
+
<!-- 兼容探测(S0b):入口同步判定内核档位,写 window.__tboxCompat 并广播 tbox:compat;
|
|
12
|
+
非 v4 原生档显示升级提示,避免无样式页面静默降级。 -->
|
|
15
13
|
<script>
|
|
16
14
|
(function () {
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
var el = document.documentElement;
|
|
16
|
+
function supports(prop, value) {
|
|
17
|
+
try { return CSS.supports(prop, value); } catch (e) { return false; }
|
|
18
|
+
}
|
|
19
|
+
function rule(css) {
|
|
20
|
+
try {
|
|
21
|
+
var style = document.createElement('style');
|
|
22
|
+
style.textContent = css;
|
|
23
|
+
document.head.appendChild(style);
|
|
24
|
+
var kept = !!(style.sheet && style.sheet.cssRules && style.sheet.cssRules.length);
|
|
25
|
+
document.head.removeChild(style);
|
|
26
|
+
return kept;
|
|
27
|
+
} catch (e) { return false; }
|
|
28
|
+
}
|
|
29
|
+
var result = {
|
|
30
|
+
ua: navigator.userAgent,
|
|
31
|
+
layers: rule('@layer a { --tbox-probe: 1 }'),
|
|
32
|
+
transform: supports('translate', '0 1px'),
|
|
33
|
+
logical: supports('padding-inline', '1px'),
|
|
34
|
+
where: supports('selector(:where(a))'),
|
|
35
|
+
};
|
|
36
|
+
result.engine = !result.layers ? 'v3.4' : (!result.transform || !result.where ? 'v4-flat' : 'v4');
|
|
37
|
+
window.__tboxCompat = result;
|
|
38
|
+
el.setAttribute('data-tbox-compat', result.engine);
|
|
39
|
+
try {
|
|
40
|
+
window.dispatchEvent(new CustomEvent('tbox:compat', { detail: result }));
|
|
41
|
+
} catch (e) {}
|
|
42
|
+
if (result.engine !== 'v4') {
|
|
43
|
+
var notice = document.createElement('div');
|
|
44
|
+
notice.id = 'tbox-compat-notice';
|
|
45
|
+
notice.setAttribute('role', 'status');
|
|
46
|
+
notice.textContent = '当前支付宝版本较旧,部分样式可能显示异常,建议升级支付宝或系统。';
|
|
47
|
+
notice.style.cssText = 'position:fixed;left:8px;right:8px;bottom:8px;z-index:9999;padding:8px 12px;border-radius:8px;background:#fff7e6;color:#8a5a00;font:12px/1.5 -apple-system,sans-serif;box-shadow:0 2px 8px rgba(0,0,0,.12);';
|
|
48
|
+
document.body.appendChild(notice);
|
|
49
|
+
console.info('[tbox-compat]', result);
|
|
23
50
|
}
|
|
24
|
-
setRootFontSize();
|
|
25
|
-
window.addEventListener('resize', setRootFontSize);
|
|
26
|
-
window.addEventListener('orientationchange', setRootFontSize);
|
|
27
51
|
})();
|
|
28
52
|
</script>
|
|
29
53
|
<!-- 出厂标题 = 此处静态值(theme-tbox brand.js 出厂不覆写标题);租户主题经其 brand.js 运行时覆写 document.title -->
|
package/apps/client/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"react": "catalog:",
|
|
18
18
|
"react-dom": "catalog:",
|
|
19
19
|
"zustand": "catalog:",
|
|
20
|
-
"@app
|
|
20
|
+
"@tbox.cn/app-agent-ui-kit": "workspace:*",
|
|
21
21
|
"@app/contracts-mall": "workspace:*",
|
|
22
22
|
"@tbox.cn/app-agent-sdk-client": "catalog:",
|
|
23
23
|
"@tbox.cn/app-sdk-client": "catalog:"
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"@types/react": "catalog:",
|
|
29
29
|
"@types/react-dom": "catalog:",
|
|
30
30
|
"@vitejs/plugin-react": "catalog:",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
31
|
+
"tailwindcss": "catalog:",
|
|
32
|
+
"@tailwindcss/vite": "catalog:",
|
|
33
33
|
"typescript": "catalog:",
|
|
34
34
|
"vite": "catalog:",
|
|
35
35
|
"vitest": "catalog:",
|
|
Binary file
|
|
Binary file
|