@tbox.cn/app-card-assets 0.1.0 → 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.
Files changed (48) hide show
  1. package/README.md +3 -1
  2. package/SOURCE.md +1 -1
  3. package/assets.json +1 -16
  4. package/components/Banner/index.tsx +2 -3
  5. package/components/BlockAnimal/LottiePlayer/index.tsx +2 -3
  6. package/components/BlockAnimal/index.tsx +13 -14
  7. package/components/BlockBarrage/index.tsx +10 -11
  8. package/components/BlockFanSwiper/index.tsx +6 -7
  9. package/components/BlockIntro/index.tsx +4 -5
  10. package/components/BlockIntroCenter/index.tsx +3 -4
  11. package/components/BlockNowList/index.tsx +10 -8
  12. package/components/BlockQuestionList/index.tsx +12 -13
  13. package/components/BlockServiceIconList/index.tsx +10 -11
  14. package/components/BlockServiceList/index.tsx +10 -11
  15. package/components/BlockTravelCarousel/index.tsx +16 -15
  16. package/components/BlockTravelCarousel/tags/Tags.tsx +2 -3
  17. package/components/OneCol/index.tsx +18 -19
  18. package/components/TwoCol/index.tsx +16 -17
  19. package/docs/Banner.md +1 -1
  20. package/docs/BlockAnimal.md +1 -1
  21. package/docs/BlockBarrage.md +1 -1
  22. package/docs/BlockFanSwiper.md +1 -1
  23. package/docs/BlockIntro.md +1 -1
  24. package/docs/BlockIntroCenter.md +1 -1
  25. package/docs/BlockNowList.md +1 -1
  26. package/docs/BlockQuestionList.md +1 -1
  27. package/docs/BlockServiceIconList.md +1 -1
  28. package/docs/BlockServiceList.md +1 -1
  29. package/docs/BlockTravelCarousel.md +1 -1
  30. package/docs/OneCol.md +1 -1
  31. package/docs/TwoCol.md +1 -1
  32. package/package.json +1 -1
  33. package/shared/home-integration.md +18 -16
  34. package/components/Banner/index.module.less +0 -11
  35. package/components/BlockAnimal/LottiePlayer/index.module.less +0 -11
  36. package/components/BlockAnimal/index.module.less +0 -78
  37. package/components/BlockBarrage/index.module.less +0 -101
  38. package/components/BlockFanSwiper/index.module.less +0 -89
  39. package/components/BlockIntro/index.module.less +0 -31
  40. package/components/BlockIntroCenter/index.module.less +0 -30
  41. package/components/BlockNowList/index.module.less +0 -72
  42. package/components/BlockQuestionList/index.module.less +0 -113
  43. package/components/BlockServiceIconList/index.module.less +0 -62
  44. package/components/BlockServiceList/index.module.less +0 -89
  45. package/components/BlockTravelCarousel/index.module.less +0 -125
  46. package/components/BlockTravelCarousel/tags/Tags.module.less +0 -20
  47. package/components/OneCol/index.module.less +0 -158
  48. package/components/TwoCol/index.module.less +0 -191
@@ -2,7 +2,6 @@ import { runCardClick } from '../../shared/actions';
2
2
  import type { CardAssetProps as ICardProps } from '../../shared/types';
3
3
  import React, { useState } from 'react';
4
4
  import { Swiper } from 'antd-mobile';
5
- import styles from './index.module.less';
6
5
  import Tags from './tags/Tags';
7
6
 
8
7
  interface BlockTravelCarouselProps extends ICardProps {
@@ -32,29 +31,29 @@ interface CarouselItemProps {
32
31
  const CarouselItem: React.FC<CarouselItemProps> = ({ item, hotTitle, hasDesc, onClick }) => {
33
32
  return (
34
33
  <div
35
- className={styles.infoCard}
34
+ className="relative h-[448px] w-full bg-cover bg-center bg-no-repeat box-border"
36
35
  style={{
37
36
  backgroundImage: `url(${item.imageUrl})`,
38
37
  }}
39
38
  onClick={onClick}
40
39
  >
41
- <div className={styles.escortMark} />
42
- <span className={styles.titleTag}>{hotTitle}</span>
43
- <div className={styles.infoBox}>
44
- <div className={styles.infoContainer}>
45
- <span className={styles.titleText}>{item.title}</span>
40
+ <div className="absolute top-[224px] left-0 h-[224px] w-full rounded-b-[24px] bg-[linear-gradient(to_bottom,rgba(0,0,0,0),rgba(0,0,0,0.5))]" />
41
+ <span className="absolute top-6 left-6 rounded-[8px] bg-[linear-gradient(90deg,#fe5500_0%,#ff8e00_100%)] px-[10px] text-center text-[length:22px] font-medium text-white box-border">{hotTitle}</span>
42
+ <div className="absolute bottom-8 w-full px-6">
43
+ <div className="flex items-center box-border">
44
+ <span className="mb-3 whitespace-nowrap text-[length:40px] font-medium leading-[48px] text-white box-border">{item.title}</span>
46
45
  {hasDesc && item.tags && (
47
- <div className={styles.tagsBox1}>
46
+ <div className="ml-4">
48
47
  <Tags tags={item.tags} />
49
48
  </div>
50
49
  )}
51
50
  </div>
52
51
  {!hasDesc && item.tags && (
53
- <div className={styles.tagsBox2}>
52
+ <div className="mt-3">
54
53
  <Tags tags={item.tags} />
55
54
  </div>
56
55
  )}
57
- {hasDesc && item.desc && <span className={styles.infoDesc}>{item.desc}</span>}
56
+ {hasDesc && item.desc && <span className="mt-4 text-ellipsis text-2xl font-medium leading-[32px] tracking-[1px] text-white opacity-70">{item.desc}</span>}
58
57
  </div>
59
58
  </div>
60
59
  );
@@ -69,12 +68,14 @@ const BlockTravelCarousel: React.FC<BlockTravelCarouselProps> = ({ cardData = {}
69
68
 
70
69
  if (!list.length) return null;
71
70
 
72
- const dotsBoxClass = hasDesc ? styles.dotsBox : styles.dotsBox2;
71
+ const dotsBoxClass = hasDesc
72
+ ? 'absolute bottom-3 left-0 flex w-full items-center justify-center'
73
+ : 'absolute right-6 bottom-8';
73
74
 
74
75
  return (
75
- <div className={styles.escortList}>
76
+ <div className="relative mb-7 h-[448px] w-full min-w-0 rounded-[24px] leading-normal box-border">
76
77
  <Swiper
77
- className={styles.swiper}
78
+ className="h-[448px] rounded-[24px]"
78
79
  autoplay={list.length > 1}
79
80
  autoplayInterval={3000}
80
81
  onIndexChange={setCurrentIndex}
@@ -88,9 +89,9 @@ const BlockTravelCarousel: React.FC<BlockTravelCarouselProps> = ({ cardData = {}
88
89
  ))}
89
90
  </Swiper>
90
91
  <div className={dotsBoxClass}>
91
- <div className={styles.customDots}>
92
+ <div className="flex justify-center">
92
93
  {list.map((_, index) => (
93
- <div key={index} className={`${styles.indicatorDot} ${currentIndex === index ? styles.active : ''}`} />
94
+ <div key={index} className={`mx-1 h-2 rounded-[4px] ${currentIndex === index ? 'w-[23px] bg-white' : 'w-2 bg-[rgba(255,255,255,0.4)]'}`} />
94
95
  ))}
95
96
  </div>
96
97
  </div>
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import styles from './Tags.module.less';
3
2
 
4
3
  interface TagsProps {
5
4
  tags?: string[];
@@ -7,9 +6,9 @@ interface TagsProps {
7
6
 
8
7
  const Tags: React.FC<TagsProps> = ({ tags = [] }) => {
9
8
  return (
10
- <div className={styles.buttonGroup}>
9
+ <div className="flex box-border">
11
10
  {tags.map((tag, index) => (
12
- <span key={index} className={styles.button}>
11
+ <span key={index} className="mr-3 flex h-[38px] items-center justify-center rounded-[19px] border-[1.5px] border-solid border-[#6c6e7e] bg-[rgba(255,255,255,0.14)] px-3 text-2xl leading-[inherit] text-white box-border">
13
12
  {tag}
14
13
  </span>
15
14
  ))}
@@ -1,7 +1,6 @@
1
1
  import { runCardClick } from '../../shared/actions';
2
2
  import type { CardAssetProps as ICardProps } from '../../shared/types';
3
3
  import React from 'react';
4
- import styles from './index.module.less';
5
4
 
6
5
  interface OneColProps extends ICardProps {
7
6
  cardData?: {
@@ -24,49 +23,49 @@ const OneCol: React.FC<OneColProps> = ({ cardData: { button = [], logo, welcome,
24
23
  const handleClick = (item: any) => runCardClick(bridgeAPI, item);
25
24
 
26
25
  return (
27
- <div className={styles.card}>
28
- <div className={styles.cardBody}>
29
- <div className={styles.container}>
26
+ <div className="mb-7 box-border w-full min-w-0 px-6 pt-[100px] leading-normal">
27
+ <div className="relative flex items-center rounded-[48px] bg-[rgba(255,255,255,0.5)] pt-[118px] pb-[15px] shadow-[0_2px_38px_#0f2a3138]">
28
+ <div className="w-full">
30
29
  {logo && (
31
- <div className={styles.avatarWrapperBox}>
32
- <div className={styles.avatarWrapper}>
33
- <img src={logo} className={styles.headerIcon} alt="logo" />
30
+ <div className="absolute -top-20 flex w-full items-center justify-center">
31
+ <div className="rounded-full bg-[linear-gradient(143deg,#8f64ff_0%,#92b2ff_35%,#bbd5ff_54%,#8dc4ff_73%,#33e4ff_100%)] p-1 leading-[0]">
32
+ <img src={logo} className="h-[148px] w-[148px] rounded-full" alt="logo" />
34
33
  </div>
35
34
  </div>
36
35
  )}
37
- {welcome && <div className={styles.title}>{welcome}</div>}
36
+ {welcome && <div className="mb-1 shrink overflow-hidden px-6 pb-6 text-center text-3xl font-semibold leading-[42px] text-[#1f3b63] text-ellipsis break-all line-clamp-2">{welcome}</div>}
38
37
  {desc && (
39
- <div className={styles.cardContentWrapper}>
40
- <div className={styles.textContent}>{desc}</div>
38
+ <div className="mx-8">
39
+ <div className="text-3xl leading-[48px] text-[#1f3b63]">{desc}</div>
41
40
  </div>
42
41
  )}
43
- <div className={styles.oneCol}>
42
+ <div className="px-6 pt-6">
44
43
  {button.map((item, index) => (
45
44
  <div
46
45
  key={index}
47
- className={`${styles.rowItemWrap} ${index === button.length - 1 ? '' : styles.rowItemWrapMargin}`}
46
+ className="mb-4"
48
47
  >
49
48
  <div
50
- className={`${styles.item} ${item.clickAction === 'link' ? styles.itemBackground : ''}`}
49
+ className={`flex items-center justify-between rounded-[48px] bg-white ${item.clickAction === 'link' ? 'bg-[url(https://mdn.alipayobjects.com/huamei_utmyzw/afts/img/wZNXQpLLo_kAAAAAAAAAAAAADrkDAQFr/original)] bg-[length:100%_100%] bg-left-top' : ''}`}
51
50
  style={{
52
51
  padding: (item.description ?? item.desc) ? '0.08rem 0.16rem' : '0.24rem 0.28rem',
53
52
  }}
54
53
  onClick={() => handleClick(item)}
55
54
  >
56
- <div className={styles.titleWrap}>
57
- <div className={styles.titleContainer}>
58
- {item.icon && <img src={item.icon} className={styles.icon} alt="icon" />}
55
+ <div className="mr-2 shrink">
56
+ <div className="flex items-center">
57
+ {item.icon && <img src={item.icon} className="mr-2 h-8 w-8 shrink-0" alt="icon" />}
59
58
  <div
60
- className={(item.description ?? item.desc) ? styles.title : styles.singleTitle}
59
+ className={(item.description ?? item.desc) ? 'mb-1 shrink overflow-hidden px-6 pb-6 text-center text-3xl font-semibold leading-[42px] text-[#1f3b63] text-ellipsis break-all line-clamp-2' : 'shrink overflow-hidden text-ellipsis break-all line-clamp-2 text-3xl font-normal leading-[42px]'}
61
60
  style={{ color: item.clickAction === 'link' ? '#367EEB' : '#1f3b63' }}
62
61
  >
63
62
  {item.title}
64
63
  </div>
65
64
  </div>
66
- {(item.description ?? item.desc) && <div className={styles.subTitle}>{(item.description ?? item.desc)}</div>}
65
+ {(item.description ?? item.desc) && <div className="text-2xl leading-[42px] text-[#8090a6]">{(item.description ?? item.desc)}</div>}
67
66
  </div>
68
67
  <img
69
- className={styles.arrow}
68
+ className="w-8"
70
69
  src="https://mdn.alipayobjects.com/huamei_dlpkmn/afts/img/A*-uhCQ6Ttuj0AAAAAAAAAAAAADty4AQ/original"
71
70
  alt="arrow"
72
71
  />
@@ -1,7 +1,6 @@
1
1
  import { runCardClick } from '../../shared/actions';
2
2
  import type { CardAssetProps as ICardProps } from '../../shared/types';
3
3
  import React, { useEffect, useState } from 'react';
4
- import styles from './index.module.less';
5
4
 
6
5
  interface TwoColProps extends ICardProps {
7
6
  cardData?: {
@@ -42,35 +41,35 @@ const TwoCol: React.FC<TwoColProps> = ({ cardData = {}, bridgeAPI }) => {
42
41
  }
43
42
 
44
43
  return (
45
- <div className={styles.card}>
46
- <div className={styles.cardBody}>
47
- <div className={styles.container}>
44
+ <div className="mb-7 w-full min-w-0 box-border px-6 pt-[100px]">
45
+ <div className="relative flex items-center rounded-[48px] bg-[rgba(255,255,255,0.5)] pt-[118px] pb-8 shadow-[0_2px_38px_#0f2a3138]">
46
+ <div className="w-full min-w-0">
48
47
  {(logo || welcome || desc) && (
49
- <div className={styles.avatarWrapperBox}>
50
- <div className={styles.avatarWrapper}>
51
- <img src={logo} className={styles.headerIcon} alt="logo" />
48
+ <div className="absolute -top-20 flex w-full items-center justify-center">
49
+ <div className="rounded-full bg-[linear-gradient(143deg,#8f64ff_0%,#92b2ff_35%,#bbd5ff_54%,#8dc4ff_73%,#33e4ff_100%)] p-1 leading-[0]">
50
+ <img src={logo} className="h-[148px] w-[148px] rounded-full" alt="logo" />
52
51
  </div>
53
52
  </div>
54
53
  )}
55
- {welcome && <div className={styles.title}>{welcome}</div>}
54
+ {welcome && <div className="px-6 pb-6 text-center text-3xl font-semibold leading-[48px] text-[#1f3b63]">{welcome}</div>}
56
55
  {desc && (
57
- <div className={styles.cardContentWrapper}>
58
- <div className={styles.textContent}>{desc}</div>
56
+ <div className="mx-8">
57
+ <div className="text-3xl leading-[48px] text-[#1f3b63]">{desc}</div>
59
58
  </div>
60
59
  )}
61
- <div className={styles.promotionWrapper}>
60
+ <div className="grid grid-cols-2 gap-3 whitespace-normal px-6 pt-6 box-border">
62
61
  {listData.map((item, index) => (
63
- <div key={index} className={styles.serviceItemContainer} onClick={() => handleClick(item)}>
64
- {item.class && <div className={styles.serviceItemClass}>{item.class}</div>}
65
- <div className={styles.serviceItemUpper}>
66
- <div className={styles.serviceItemUpperText}>{item.title}</div>
62
+ <div key={index} className={`relative mt-3 w-full min-w-0 rounded-[24px] border border-solid border-[rgba(141,159,184,0.4)] bg-white px-6 py-5 box-border${index === listData.length - 1 && listData.length % 2 === 1 ? ' col-span-2' : ''}`} onClick={() => handleClick(item)}>
63
+ {item.class && <div className="absolute -top-[9px] left-0 rounded-[16px] bg-[#60aaf9] px-3 py-1 text-xl leading-[18px] text-white">{item.class}</div>}
64
+ <div className="flex items-center justify-between">
65
+ <div className="min-w-0 flex-1 truncate text-3xl font-medium leading-[38px] text-[#1f3b63]">{item.title}</div>
67
66
  <img
68
- className={styles.arrowImg}
67
+ className="ml-[10px] h-6 w-6 shrink-0"
69
68
  src="https://mdn.alipayobjects.com/huamei_xdqfqd/afts/img/qFhvRJ4k084AAAAAAAAAAAAADmgHAQFr/original"
70
69
  alt="arrow"
71
70
  />
72
71
  </div>
73
- {item.desc && <div className={styles.serviceItemLower}>{item.desc}</div>}
72
+ {item.desc && <div className="mt-3 truncate text-[length:22px] leading-[30px] text-[#1f3b63] opacity-[0.45] break-all">{item.desc}</div>}
74
73
  </div>
75
74
  ))}
76
75
  </div>
package/docs/Banner.md CHANGED
@@ -14,4 +14,4 @@ import Banner from '@/components/home/components/Banner';
14
14
  <Banner cardData={/* 按示例填写 */} bridgeAPI={bridge} />
15
15
  ```
16
16
 
17
- CSS Modules 使用 index.module.less,尺寸沿宿主 750 设计稿 / rootValue=100 的 rem 链。组合父容器建议 width:100%、max-width:750px(由宿主转换)、min-width:0;可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
17
+ 组件样式是 TSX 内的 Tailwind 工具类,由应用的 `apps/client/src/styles/tailwind.css` 扫描 `apps/client/src` 自动生成;不携带独立样式文件。尺寸与字号沿用原值(普通物理 px,1:1,不做折半);组合父容器宽度与布局约定见 [接入本地首页](../shared/home-integration.md#容器宽度),可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
@@ -14,4 +14,4 @@ import BlockAnimal from '@/components/home/components/BlockAnimal';
14
14
  <BlockAnimal cardData={/* 按示例填写 */} bridgeAPI={bridge} />
15
15
  ```
16
16
 
17
- CSS Modules 使用 index.module.less,尺寸沿宿主 750 设计稿 / rootValue=100 的 rem 链。组合父容器建议 width:100%、max-width:750px(由宿主转换)、min-width:0;可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
17
+ 组件样式是 TSX 内的 Tailwind 工具类,由应用的 `apps/client/src/styles/tailwind.css` 扫描 `apps/client/src` 自动生成;不携带独立样式文件。尺寸与字号沿用原值(普通物理 px,1:1,不做折半);组合父容器宽度与布局约定见 [接入本地首页](../shared/home-integration.md#容器宽度),可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
@@ -14,4 +14,4 @@ import BlockBarrage from '@/components/home/components/BlockBarrage';
14
14
  <BlockBarrage cardData={/* 按示例填写 */} bridgeAPI={bridge} />
15
15
  ```
16
16
 
17
- CSS Modules 使用 index.module.less,尺寸沿宿主 750 设计稿 / rootValue=100 的 rem 链。组合父容器建议 width:100%、max-width:750px(由宿主转换)、min-width:0;可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
17
+ 组件样式是 TSX 内的 Tailwind 工具类,由应用的 `apps/client/src/styles/tailwind.css` 扫描 `apps/client/src` 自动生成;不携带独立样式文件。尺寸与字号沿用原值(普通物理 px,1:1,不做折半);组合父容器宽度与布局约定见 [接入本地首页](../shared/home-integration.md#容器宽度),可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
@@ -14,4 +14,4 @@ import BlockFanSwiper from '@/components/home/components/BlockFanSwiper';
14
14
  <BlockFanSwiper cardData={/* 按示例填写 */} bridgeAPI={bridge} />
15
15
  ```
16
16
 
17
- CSS Modules 使用 index.module.less,尺寸沿宿主 750 设计稿 / rootValue=100 的 rem 链。组合父容器建议 width:100%、max-width:750px(由宿主转换)、min-width:0;可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
17
+ 组件样式是 TSX 内的 Tailwind 工具类,由应用的 `apps/client/src/styles/tailwind.css` 扫描 `apps/client/src` 自动生成;不携带独立样式文件。尺寸与字号沿用原值(普通物理 px,1:1,不做折半);组合父容器宽度与布局约定见 [接入本地首页](../shared/home-integration.md#容器宽度),可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
@@ -14,4 +14,4 @@ import BlockIntro from '@/components/home/components/BlockIntro';
14
14
  <BlockIntro cardData={/* 按示例填写 */} bridgeAPI={bridge} />
15
15
  ```
16
16
 
17
- CSS Modules 使用 index.module.less,尺寸沿宿主 750 设计稿 / rootValue=100 的 rem 链。组合父容器建议 width:100%、max-width:750px(由宿主转换)、min-width:0;可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
17
+ 组件样式是 TSX 内的 Tailwind 工具类,由应用的 `apps/client/src/styles/tailwind.css` 扫描 `apps/client/src` 自动生成;不携带独立样式文件。尺寸与字号沿用原值(普通物理 px,1:1,不做折半);组合父容器宽度与布局约定见 [接入本地首页](../shared/home-integration.md#容器宽度),可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
@@ -14,4 +14,4 @@ import BlockIntroCenter from '@/components/home/components/BlockIntroCenter';
14
14
  <BlockIntroCenter cardData={/* 按示例填写 */} bridgeAPI={bridge} />
15
15
  ```
16
16
 
17
- CSS Modules 使用 index.module.less,尺寸沿宿主 750 设计稿 / rootValue=100 的 rem 链。组合父容器建议 width:100%、max-width:750px(由宿主转换)、min-width:0;可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
17
+ 组件样式是 TSX 内的 Tailwind 工具类,由应用的 `apps/client/src/styles/tailwind.css` 扫描 `apps/client/src` 自动生成;不携带独立样式文件。尺寸与字号沿用原值(普通物理 px,1:1,不做折半);组合父容器宽度与布局约定见 [接入本地首页](../shared/home-integration.md#容器宽度),可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
@@ -14,4 +14,4 @@ import BlockNowList from '@/components/home/components/BlockNowList';
14
14
  <BlockNowList cardData={/* 按示例填写 */} bridgeAPI={bridge} />
15
15
  ```
16
16
 
17
- CSS Modules 使用 index.module.less,尺寸沿宿主 750 设计稿 / rootValue=100 的 rem 链。组合父容器建议 width:100%、max-width:750px(由宿主转换)、min-width:0;可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
17
+ 组件样式是 TSX 内的 Tailwind 工具类,由应用的 `apps/client/src/styles/tailwind.css` 扫描 `apps/client/src` 自动生成;不携带独立样式文件。尺寸与字号沿用原值(普通物理 px,1:1,不做折半);组合父容器宽度与布局约定见 [接入本地首页](../shared/home-integration.md#容器宽度),可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
@@ -14,4 +14,4 @@ import BlockQuestionList from '@/components/home/components/BlockQuestionList';
14
14
  <BlockQuestionList cardData={/* 按示例填写 */} bridgeAPI={bridge} />
15
15
  ```
16
16
 
17
- CSS Modules 使用 index.module.less,尺寸沿宿主 750 设计稿 / rootValue=100 的 rem 链。组合父容器建议 width:100%、max-width:750px(由宿主转换)、min-width:0;可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
17
+ 组件样式是 TSX 内的 Tailwind 工具类,由应用的 `apps/client/src/styles/tailwind.css` 扫描 `apps/client/src` 自动生成;不携带独立样式文件。尺寸与字号沿用原值(普通物理 px,1:1,不做折半);组合父容器宽度与布局约定见 [接入本地首页](../shared/home-integration.md#容器宽度),可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
@@ -14,4 +14,4 @@ import BlockServiceIconList from '@/components/home/components/BlockServiceIconL
14
14
  <BlockServiceIconList cardData={/* 按示例填写 */} bridgeAPI={bridge} />
15
15
  ```
16
16
 
17
- CSS Modules 使用 index.module.less,尺寸沿宿主 750 设计稿 / rootValue=100 的 rem 链。组合父容器建议 width:100%、max-width:750px(由宿主转换)、min-width:0;可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
17
+ 组件样式是 TSX 内的 Tailwind 工具类,由应用的 `apps/client/src/styles/tailwind.css` 扫描 `apps/client/src` 自动生成;不携带独立样式文件。尺寸与字号沿用原值(普通物理 px,1:1,不做折半);组合父容器宽度与布局约定见 [接入本地首页](../shared/home-integration.md#容器宽度),可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
@@ -14,4 +14,4 @@ import BlockServiceList from '@/components/home/components/BlockServiceList';
14
14
  <BlockServiceList cardData={/* 按示例填写 */} bridgeAPI={bridge} />
15
15
  ```
16
16
 
17
- CSS Modules 使用 index.module.less,尺寸沿宿主 750 设计稿 / rootValue=100 的 rem 链。组合父容器建议 width:100%、max-width:750px(由宿主转换)、min-width:0;可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
17
+ 组件样式是 TSX 内的 Tailwind 工具类,由应用的 `apps/client/src/styles/tailwind.css` 扫描 `apps/client/src` 自动生成;不携带独立样式文件。尺寸与字号沿用原值(普通物理 px,1:1,不做折半);组合父容器宽度与布局约定见 [接入本地首页](../shared/home-integration.md#容器宽度),可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
@@ -14,4 +14,4 @@ import BlockTravelCarousel from '@/components/home/components/BlockTravelCarouse
14
14
  <BlockTravelCarousel cardData={/* 按示例填写 */} bridgeAPI={bridge} />
15
15
  ```
16
16
 
17
- CSS Modules 使用 index.module.less,尺寸沿宿主 750 设计稿 / rootValue=100 的 rem 链。组合父容器建议 width:100%、max-width:750px(由宿主转换)、min-width:0;可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
17
+ 组件样式是 TSX 内的 Tailwind 工具类,由应用的 `apps/client/src/styles/tailwind.css` 扫描 `apps/client/src` 自动生成;不携带独立样式文件。尺寸与字号沿用原值(普通物理 px,1:1,不做折半);组合父容器宽度与布局约定见 [接入本地首页](../shared/home-integration.md#容器宽度),可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
package/docs/OneCol.md CHANGED
@@ -14,4 +14,4 @@ import OneCol from '@/components/home/components/OneCol';
14
14
  <OneCol cardData={/* 按示例填写 */} bridgeAPI={bridge} />
15
15
  ```
16
16
 
17
- CSS Modules 使用 index.module.less,尺寸沿宿主 750 设计稿 / rootValue=100 的 rem 链。组合父容器建议 width:100%、max-width:750px(由宿主转换)、min-width:0;可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
17
+ 组件样式是 TSX 内的 Tailwind 工具类,由应用的 `apps/client/src/styles/tailwind.css` 扫描 `apps/client/src` 自动生成;不携带独立样式文件。尺寸与字号沿用原值(普通物理 px,1:1,不做折半);组合父容器宽度与布局约定见 [接入本地首页](../shared/home-integration.md#容器宽度),可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
package/docs/TwoCol.md CHANGED
@@ -14,4 +14,4 @@ import TwoCol from '@/components/home/components/TwoCol';
14
14
  <TwoCol cardData={/* 按示例填写 */} bridgeAPI={bridge} />
15
15
  ```
16
16
 
17
- CSS Modules 使用 index.module.less,尺寸沿宿主 750 设计稿 / rootValue=100 的 rem 链。组合父容器建议 width:100%、max-width:750px(由宿主转换)、min-width:0;可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
17
+ 组件样式是 TSX 内的 Tailwind 工具类,由应用的 `apps/client/src/styles/tailwind.css` 扫描 `apps/client/src` 自动生成;不携带独立样式文件。尺寸与字号沿用原值(普通物理 px,1:1,不做折半);组合父容器宽度与布局约定见 [接入本地首页](../shared/home-integration.md#容器宽度),可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tbox.cn/app-card-assets",
3
- "version": "0.1.0",
3
+ "version": "1.0.0-alpha.6",
4
4
  "type": "module",
5
5
  "description": "可复制、可编辑的卡片源码资源",
6
6
  "files": [
@@ -1,29 +1,25 @@
1
1
  # 接入本地首页
2
2
 
3
- 复制的 components/、shared/、docs/、examples/ 属于应用源码,可直接改写。home add 只复制素材与声明运行依赖,不注册槽位。先 pnpm install,再按此文组合。
3
+ `home add` 复制源码并声明依赖,运行 `pnpm install` 后,在 `apps/client/src/components/home/Home.tsx` 组合组件。用法和数据示例见复制目录的 `docs/`、`examples/`,本地源码可直接修改。
4
4
 
5
- ## 入口与保护
5
+ ## 注册首页
6
6
 
7
- 在 apps/client/src/business/home/Home.tsx 组合所选组件与数据,直接按路径导入,不创建全量卡片 registry。用法与 JSON 示例在复制目录的 docs/ 和 examples/。
8
-
9
- 在 apps/client/src/cards/registry.ts 的 registerAll(ctx) 之后,先检查 ctx.slots.has('home')。已有 home(尤其 mall-core)时停止自动接线,确认是否替换及门禁等业务副作用如何保留,不能直接覆盖。无 home 时导入本地 Home 并注册;该文件扩展名为 .ts,使用 createElement:
7
+ 在 `apps/client/src/cards/registry.ts` 取得 ctx 之后注册:页面首次 import 该文件发生在模块注册完成之后、ChatPage 渲染之前。先检查 `ctx.slots.has('home')`。已有 home(尤其 mall-core)时停止自动接线,确认是否替换及门禁等业务副作用如何保留,不能直接覆盖。无 home 时导入本地 Home 并注册;该文件扩展名为 `.ts`,使用 `createElement`:
10
8
 
11
9
  ```ts
12
10
  import { createElement } from 'react';
13
- import Home from '../business/home/Home';
11
+ import Home from '@/components/home/Home';
14
12
 
15
- // registerAll(ctx) 之后;保持原有 cards/filter/slots 导出。
13
+ // registry.ts 内 const ctx = getClientContext(); 之后;保持原有 cards/filter/slots 导出。
16
14
  if (ctx.slots.has('home')) throw new Error('已有首页,请确认替换方案');
17
15
  ctx.slots.register('home', (props) => createElement(Home, props));
18
16
  ```
19
17
 
20
- Home 的 props 使用 @tbox.cn/app-contracts 的 HomeSlotRenderProps。不要在 slot 回调里直接运行 Hooks;由 Home 组件处理状态。模板 ChatPage 已按 historyMessages、messages、inlineOrphanCards 判断首页显隐,无需再创建一套显隐逻辑。首页收起时子组件卸载,轮播、弹幕等按自身清理函数停止动画。
21
-
22
- ## 点击与资源
18
+ Home 的 props 使用 `@tbox.cn/app-contracts` 的 `HomeSlotRenderProps`。不要在 slot 回调里直接运行 Hooks;由 Home 组件处理状态。模板 ChatPage 已按 historyMessages、messages、inlineOrphanCards 判断首页显隐,无需再创建一套显隐逻辑。首页收起时子组件卸载,轮播、弹幕等按自身清理函数停止动画。
23
19
 
24
- 局部 CardAssetBridge 由 shared/actions.ts 的 createCardAssetBridge 创建。query 通过 home 槽传入的 onSend,复用 ChatPage 的滚动处理、生成中门控和现有 SEND_MESSAGE 链路;不要新建 WS、调用模型接口或把 query 改成 UI_ACTION。
20
+ ## 点击接线
25
21
 
26
- 跳转复用应用 useChatStore 的 sendUiAction,以 openLink 本地动作进入 SDK 现有导航逻辑:浏览器 window.open,支付宝壳按深链解析结果走 navigateTo/navigateToMiniProgram,其余链接走 ap.openURL,tel 使用既有电话入口。不要另写 location.assign、window.open 或独立容器桥,也不要在失败后再补一次跳转。
22
+ query 复用 `onSend`,跳转复用 `openLink`,不要另建消息或导航链路。`home` 是本地导航动作的来源标识,不需要创建服务端卡片实例;不要使用 sendMessage 类型的 UI_ACTION 或臆造卡片 ID 发起首页 query。将 bridge 传给卡片的 `bridgeAPI`:
27
23
 
28
24
  ```tsx
29
25
  import { createCardAssetBridge } from '@/components/home/shared/actions';
@@ -35,13 +31,19 @@ function Home({ onSend }: HomeSlotRenderProps) {
35
31
  const bridge = createCardAssetBridge(onSend, (url) => {
36
32
  sendUiAction('home', { type: 'openLink', url });
37
33
  });
38
- // 将 bridge 传给本地卡片的 bridgeAPI prop。
39
34
  // return <BlockServiceList cardData={data} bridgeAPI={bridge} />;
40
35
  }
41
36
  ```
42
37
 
43
- home 是本地导航动作的来源标识,不需要创建服务端卡片实例。不要使用 sendMessage 类型的 UI_ACTION 或臆造卡片 ID 发起首页 query。
38
+ `clickAction=query` 发起对话,`jump/link` 跳转;未指定时优先 jumpUrl,其次 query。适配器过滤空值及不支持的链接。
39
+
40
+ ## 容器宽度
44
41
 
45
- 适配器过滤空 query 和空链接;链接允许 http/https、alipay/alipays/alipayrisk 深链及 tel,拦截脚本与数据 URL。clickAction=query 时只发送 query;jump/link 时只跳转。缺少 clickAction 的旧示例以 jumpUrl 优先、query 次之;未知动作不执行。Banner 的 screenHeight 不提供半屏能力,所有跳转由现有导航链处理。
42
+ 首页撑满父容器,不设置固定宽度或额外 max-width,左右留白由组合层统一维护:
43
+
44
+ ```tsx
45
+ // 首页根容器
46
+ <div className="box-border w-full min-w-0">
47
+ ```
46
48
 
47
- 对业务数据接入、链接与图片按用户材料实现,不把素材示例描述成真实查询结果。首屏宽度、背景、间距在应用组合层维护,视觉遵循用户选定风格。
49
+ 保留卡片原有列数、滚动和动画。卡片样式为 TSX 内的 Tailwind 工具类:尺寸与字号为普通物理 px(1:1,不折半),复制进应用后由应用的 `apps/client/src/styles/tailwind.css` 扫描 `apps/client/src` 生成。图片与业务数据使用用户材料;更新资源包不会自动覆盖已复制的应用源码。
@@ -1,11 +0,0 @@
1
- .bannerContainer {
2
- width: 100%;
3
- }
4
-
5
- .bannerImage {
6
- width: 100%;
7
- margin-bottom: 28px;
8
- border-radius: 16px;
9
- cursor: pointer;
10
- display: block;
11
- }
@@ -1,11 +0,0 @@
1
- .playerContainer {
2
- display: flex;
3
- align-items: center;
4
- justify-content: center;
5
- position: relative;
6
- }
7
-
8
- .animationWrapper {
9
- width: 100%;
10
- height: 100%;
11
- }
@@ -1,78 +0,0 @@
1
- .blockAnimal {
2
- position: relative;
3
- width: 100%;
4
- height: 100%;
5
- margin-bottom: 32px;
6
- .blockContent {
7
- position: relative;
8
- }
9
- .blockMedia {
10
- min-height: 300px;
11
- }
12
- .animalGif {
13
- width: 100%;
14
- }
15
- .animalMp4 {
16
- width: 100%;
17
- }
18
-
19
- .welcomeWrapper {
20
- margin-top: 24px;
21
- border-radius: 8px 48px 48px 48px;
22
- padding: 24px 32px;
23
- background: #1f3b63;
24
- background: rgba(255, 255, 255, 0.4);
25
- }
26
-
27
- .welcomeText {
28
- font-size: 30px;
29
- color: #1f3b63;
30
- letter-spacing: 0;
31
- line-height: 48px;
32
- }
33
-
34
- .tipsContainer {
35
- position: absolute;
36
- width: 100%;
37
- height: 100%;
38
- top: 0;
39
- left: 0;
40
- }
41
-
42
- .lottieTips {
43
- font-size: 24px;
44
- position: absolute;
45
- padding: 12px 24px;
46
- background-color: #fff;
47
- flex-direction: row;
48
- justify-content: center;
49
- align-items: center;
50
- border-radius: 37px;
51
- }
52
-
53
- .tips-icon {
54
- height: 28px;
55
- width: 28px;
56
- }
57
-
58
- .tipsTitle {
59
- color: #1f3b63;
60
- font-size: 26px;
61
- margin-left: 8px;
62
- }
63
- }
64
- .guessbox {
65
- display: flex;
66
- flex-direction: column;
67
- align-items: flex-start;
68
- }
69
- .guessItem {
70
- background: rgba(255, 255, 255, 0.8);
71
- border-radius: 31px;
72
- padding: 8px 32px;
73
- margin-top: 16px;
74
- font-size: 26px;
75
- line-height: 1.5;
76
- color: #1f3b63;
77
- display: inline-block;
78
- }
@@ -1,101 +0,0 @@
1
- /* 弹幕组件样式 */
2
- .danmuWallWrap {
3
- margin-bottom: 28px;
4
- }
5
-
6
- .danmuWall {
7
- white-space: nowrap;
8
- display: flex;
9
- flex-direction: row;
10
- overflow: hidden;
11
-
12
- /* 边界淡出效果 - 24px宽度 */
13
- mask-image: linear-gradient(
14
- to right,
15
- transparent 0%,
16
- rgba(0, 0, 0, 0.1) 12px,
17
- rgba(0, 0, 0, 1) 24px,
18
- rgba(0, 0, 0, 1) calc(100% - 24px),
19
- rgba(0, 0, 0, 0.1) calc(100% - 12px),
20
- transparent 100%
21
- );
22
- -webkit-mask-image: linear-gradient(
23
- to right,
24
- transparent 0%,
25
- rgba(0, 0, 0, 0.1) 12px,
26
- rgba(0, 0, 0, 1) 24px,
27
- rgba(0, 0, 0, 1) calc(100% - 24px),
28
- rgba(0, 0, 0, 0.1) calc(100% - 12px),
29
- transparent 100%
30
- );
31
-
32
- }
33
-
34
- .danmuWallBox {
35
- display: flex;
36
- flex-direction: column;
37
- transition: transform 0.1s linear;
38
- width: 100%;
39
- min-width: 0;
40
- overflow-x: hidden;
41
- overflow-y: hidden;
42
- scrollbar-width: none;
43
- }
44
-
45
- .danmuWallTitleBox {
46
- margin-bottom: 24px;
47
- }
48
-
49
- .danmuWallTitle {
50
- font-size: 30px;
51
- color: #1f3b63;
52
- font-weight: 500;
53
- }
54
-
55
- .danmuWallItem {
56
- display: flex;
57
- flex-direction: column;
58
- margin-right: 20px;
59
- }
60
-
61
- /* 弹幕项样式 */
62
- .danmuItemWrap {
63
- display: flex;
64
- gap: 10px;
65
- margin-bottom: 16px;
66
- }
67
-
68
- .danmuItem {
69
- border-radius: 38px;
70
- background-color: rgb(244, 249, 255);
71
- padding: 13px 32px 12px 32px;
72
- box-sizing: border-box;
73
- display: flex;
74
- flex-direction: row;
75
- align-items: center;
76
- cursor: pointer;
77
- transition: background-color 0.3s ease;
78
- }
79
-
80
- .danmuWrap {
81
- display: flex;
82
- flex-direction: row;
83
- flex-wrap: wrap;
84
- }
85
-
86
- .danmuImage {
87
- border-radius: 14px;
88
- width: 28px;
89
- height: 28px;
90
- flex-shrink: 0;
91
- box-sizing: border-box;
92
- margin-right: 8px;
93
- }
94
-
95
- .danmuTitle {
96
- color: #1f3b63;
97
- font-size: 26px;
98
- white-space: nowrap;
99
- box-sizing: border-box;
100
- line-height: 1.2;
101
- }