消费方的样式叶子子路径(tokens/utilities、components/<name>)收敛为两个目录 入口:@idealjs/stack-ui-kit/tokens 导出 utilities 工具类与 theme, @idealjs/stack-ui-kit/components 聚合 effectClasses/hoverHost/ticket。 同一文件内多条 components import 合并为一条。 tokens 入口带 ve 模块后,其它包的 .css.ts 不得再从它 import:ve 会把 ui-kit 的 token 模块按外来作用域重新编译一份,样式表多出约 1700 行死代码且构建不报错。 site-ui-kit 的 7 个 .css.ts 改走纯 TS 通道 @idealjs/stack-ui-kit/tokens/refs, exports 去掉上一提交加的 ./components/* 与 ./tokens/utilities 子路径。 tutorial 根 tsconfig 以精确 paths 指向 components/index.ts(打包器不做 realpath,同 react/themes/tokens 先例)。
This commit is contained in:
47 files changed
+65
-68
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { Dropdown } from '@idealjs/stack-ui-kit/react/dock/Dropdown'
|
||||
import { hoverableShadow, liftSm, shadowInk } from '@idealjs/stack-ui-kit/components/effectClasses'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import { hoverableShadow, liftSm, shadowInk } from '@idealjs/stack-ui-kit/components'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
|
||||
import type { ReactNode } from 'react'
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { BrickDot, Mark, Tri } from '@idealjs/stack-ui-kit/react/shapes'
|
||||
import { hoverableShadow, shadowInk } from '@idealjs/stack-ui-kit/components/effectClasses'
|
||||
import { hoverHost } from '@idealjs/stack-ui-kit/components/hoverHost'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import { hoverableShadow, shadowInk, hoverHost } from '@idealjs/stack-ui-kit/components'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
|
||||
import type { ReactNode } from 'react'
|
||||
import { MONTHS, monthOf, POSTS } from '../content/blogs'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { BrickDots } from '@idealjs/stack-site-ui-kit/components/MemphisCard'
|
||||
import { Mark, Ring, Tri, Wave } from '@idealjs/stack-ui-kit/react/shapes'
|
||||
import { shadowInk } from '@idealjs/stack-ui-kit/components/effectClasses'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import { shadowInk } from '@idealjs/stack-ui-kit/components'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
|
||||
import type { ChapterId } from '@idealjs/stack-site-ui-kit'
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { shadowInk } from '@idealjs/stack-ui-kit/components/effectClasses'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import { shadowInk } from '@idealjs/stack-ui-kit/components'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
import type { KeyboardEvent } from 'react'
|
||||
import { useEffect, useRef } from 'react'
|
||||
export interface ChatItem {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Dropdown } from '@idealjs/stack-ui-kit/react/dock/Dropdown'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
|
||||
import type { ReactNode } from 'react'
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { shadowInk } from '@idealjs/stack-ui-kit/components/effectClasses'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import { shadowInk } from '@idealjs/stack-ui-kit/components'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
import { neighborsOf, type PageKey, relHref } from '../lib/pages'
|
||||
export function PageTurnBar({ from }: { from: PageKey }) {
|
||||
const neighbors = neighborsOf(from)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DockSheet } from '@idealjs/stack-ui-kit/react/dock/DockSheet'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
|
||||
import type { ReactNode } from 'react'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Dropdown } from '@idealjs/stack-ui-kit/react/dock/Dropdown'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
|
||||
import type { ReactNode } from 'react'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
import * as themes from '@idealjs/stack-ui-kit/themes'
|
||||
import '@idealjs/stack-site-ui-kit/styles/index.css'
|
||||
import '../styles/tailwind.css'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { PageFlipZone } from '@idealjs/stack-site-ui-kit/components/PageFlipZone'
|
||||
import { SitePage } from '@idealjs/stack-site-ui-kit/components/SitePage'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
import type {
|
||||
ChapterId,
|
||||
NavItemLink,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { shadowInk } from '@idealjs/stack-ui-kit/components/effectClasses'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import { shadowInk } from '@idealjs/stack-ui-kit/components'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
import { TEMPLATE_FILES } from '../../lib/templateFiles'
|
||||
import { Section } from '../../lib/ui'
|
||||
import { Playground } from '../../playground'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Button } from '@idealjs/stack-ui-kit/react/Button'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
|
||||
import { relHref } from '../../lib/pages'
|
||||
import { Page, Section } from '../../lib/ui'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { shadowInk } from '@idealjs/stack-ui-kit/components/effectClasses'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import { shadowInk } from '@idealjs/stack-ui-kit/components'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
import { Page, Section } from '../../lib/ui'
|
||||
|
||||
const PAIRS = [
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Button } from '@idealjs/stack-ui-kit/react/Button'
|
||||
import { ShadowButton } from '@idealjs/stack-ui-kit/react/ShadowButton'
|
||||
import { ShadowCard } from '@idealjs/stack-ui-kit/react/ShadowCard'
|
||||
import { Mark } from '@idealjs/stack-ui-kit/react/shapes'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
|
||||
import { CHAPTERS, PROFILES } from '../../lib/chapters'
|
||||
import { relHref } from '../../lib/pages'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { BrowserMockup } from '@idealjs/stack-ui-kit/react/BrowserMockup'
|
||||
import { ShadowButton } from '@idealjs/stack-ui-kit/react/ShadowButton'
|
||||
import { Mark } from '@idealjs/stack-ui-kit/react/shapes'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
|
||||
export function BrowserMockupPreview() {
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Dropdown } from '@idealjs/stack-ui-kit/react/dock/Dropdown'
|
||||
import { shadowInk } from '@idealjs/stack-ui-kit/components/effectClasses'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import { shadowInk } from '@idealjs/stack-ui-kit/components'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
|
||||
import { useState } from 'react'
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Ticket } from '@idealjs/stack-ui-kit/react/Ticket'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
|
||||
import { useState } from 'react'
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ import {
|
||||
liftSm,
|
||||
shadowInk,
|
||||
shadowInkLift,
|
||||
} from '@idealjs/stack-ui-kit/components/effectClasses'
|
||||
import { hoverHost } from '@idealjs/stack-ui-kit/components/hoverHost'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
hoverHost,
|
||||
} from '@idealjs/stack-ui-kit/components'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
|
||||
import type { ReactNode } from 'react'
|
||||
import { CHAPTERS } from '../../lib/chapters'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { BrickDot, Mark, Ring, Tri, Wave } from '@idealjs/stack-ui-kit/react/shapes'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
|
||||
import type { ReactNode } from 'react'
|
||||
import { Page, Section } from '../../lib/ui'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { shadowInk } from '@idealjs/stack-ui-kit/components/effectClasses'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import { shadowInk } from '@idealjs/stack-ui-kit/components'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
import { Page, Section } from '../../lib/ui'
|
||||
|
||||
const SCALE = [
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { hoverableShadow, shadowInk } from '@idealjs/stack-ui-kit/components/effectClasses'
|
||||
import { hoverHost } from '@idealjs/stack-ui-kit/components/hoverHost'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import { hoverableShadow, shadowInk, hoverHost } from '@idealjs/stack-ui-kit/components'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
import { type PageKey, relHref } from '../../lib/pages'
|
||||
import { Page, Section } from '../../lib/ui'
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Button } from '@idealjs/stack-ui-kit/react/Button'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
|
||||
import { relHref } from '../../lib/pages'
|
||||
import { Page, Section } from '../../lib/ui'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Button } from '@idealjs/stack-ui-kit/react/Button'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
|
||||
import { MONTHS } from '../../content/blogs'
|
||||
import { relHref } from '../../lib/pages'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Button } from '@idealjs/stack-ui-kit/react/Button'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
|
||||
import { relHref } from '../../lib/pages'
|
||||
import { Page, Section } from '../../lib/ui'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { PageFlipZone } from '@idealjs/stack-site-ui-kit/components/PageFlipZone'
|
||||
import { SitePage } from '@idealjs/stack-site-ui-kit/components/SitePage'
|
||||
import { SiteSidebar } from '@idealjs/stack-site-ui-kit/components/SiteSidebar'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
|
||||
import { PageTurnBar } from '../../components/PageTurnBar'
|
||||
import { flipTargetsOf } from '../../lib/pages'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DockModal } from '@idealjs/stack-ui-kit/react/dock/DockModal'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
|
||||
import { useState } from 'react'
|
||||
import type { LlmConfig } from '../lib/agent/llm'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ClipboardChecklist } from '@idealjs/stack-site-ui-kit/components/learning/ClipboardChecklist'
|
||||
import { DataFlowBoard } from '@idealjs/stack-site-ui-kit/components/learning/DataFlowBoard'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
import type { DataFlowStep } from '@idealjs/stack-site-ui-kit'
|
||||
|
||||
import { useMemo, useRef, useState } from 'react'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
import type { ConsoleLevel } from './protocol'
|
||||
export interface OutputLine {
|
||||
level: ConsoleLevel | 'system'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ShadowButton } from '@idealjs/stack-ui-kit/react/ShadowButton'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
|
||||
import runtimeDoc from 'virtual:web-runner-doc'
|
||||
import { RUNTIME_ORIGIN, usePlayground } from './context'
|
||||
|
||||
@@ -18,12 +18,9 @@
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"paths": {
|
||||
"@idealjs/stack-ui-kit/react": ["../../packages/stack-ui-kit/src/react/index.ts"],
|
||||
"@idealjs/stack-ui-kit/components": ["../../packages/stack-ui-kit/src/components/index.ts"],
|
||||
"@idealjs/stack-ui-kit/themes": ["../../packages/stack-ui-kit/src/themes/index.ts"],
|
||||
"@idealjs/stack-ui-kit/tokens": ["../../packages/stack-ui-kit/src/tokens/index.ts"],
|
||||
"@idealjs/stack-ui-kit/components/*": ["../../packages/stack-ui-kit/src/components/*.css.ts"],
|
||||
"@idealjs/stack-ui-kit/tokens/utilities": [
|
||||
"../../packages/stack-ui-kit/src/tokens/utilities.css.ts"
|
||||
],
|
||||
"@idealjs/stack-ui-kit/stack-plugin": ["../../packages/stack-ui-kit/stack-plugin/index.ts"],
|
||||
"@idealjs/stack-site-ui-kit": ["../../packages/stack-site-ui-kit/src/index.ts"],
|
||||
"@idealjs/stack-site-ui-kit/*": ["../../packages/stack-site-ui-kit/*"],
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
- `styles/learning.css`:学习套件组件样式(按 `--color-*` 原名变量消费 token,`--learning-accent` 由 `toneStyle` 注入)
|
||||
- `styles/page-flip.css`:`@view-transition` 与 `html[data-vt]` 翻页动画(`--page-flip-spring` 由 ui-kit 的 `src/tokens/site.css.ts` 提供——theme 相关 token 统一收在 `@idealjs/stack-ui-kit`)
|
||||
- `src/components/*.css.ts`:token 一律 `import { theme } from '@idealjs/stack-ui-kit/tokens'`(纯 TS 常量,按原名 `var(--color-*)` 引用);不得 import ui-kit 的 `.css.ts` token 模块,否则它会被编译进第二个变量作用域,引用全部悬空
|
||||
- `src/components/*.css.ts`:token 一律 `import { theme } from '@idealjs/stack-ui-kit/tokens/refs'`(纯 TS 常量,按原名 `var(--color-*)` 引用);不得 import ui-kit 的 `.css.ts` token 模块,也不要走带 ve 工具类的 `@idealjs/stack-ui-kit/tokens` 入口,否则它会被编译进第二个变量作用域,引用全部悬空
|
||||
|
||||
app html 以包说明符引入:`<link rel="stylesheet" href="@idealjs/stack-site-ui-kit/styles/learning.css">`,构建期解析并落位 `__shared/`。
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { TicketProps } from '@idealjs/stack-ui-kit/react'
|
||||
import { Ticket } from '@idealjs/stack-ui-kit/react/Ticket'
|
||||
import { ticketStub, ticketTitle } from '@idealjs/stack-ui-kit/components/ticket'
|
||||
import { ticketStub, ticketTitle } from '@idealjs/stack-ui-kit/components'
|
||||
import type { Chapter } from '../types'
|
||||
import {
|
||||
emojiZone,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Ring, Tri } from '@idealjs/stack-ui-kit/react/shapes'
|
||||
import { hoverableShadow, shadowInk } from '@idealjs/stack-ui-kit/components/effectClasses'
|
||||
import { hoverHost } from '@idealjs/stack-ui-kit/components/hoverHost'
|
||||
import { hoverableShadow, shadowInk, hoverHost } from '@idealjs/stack-ui-kit/components'
|
||||
import { type ReactNode, useEffect, useRef, useState } from 'react'
|
||||
import type { Chapter } from '../types'
|
||||
import {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { hoverableShadow, shadowInk } from '@idealjs/stack-ui-kit/components/effectClasses'
|
||||
import { hoverHost } from '@idealjs/stack-ui-kit/components/hoverHost'
|
||||
import { hoverableShadow, shadowInk, hoverHost } from '@idealjs/stack-ui-kit/components'
|
||||
import type { CSSProperties, ReactNode } from 'react'
|
||||
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import type { Chapter, ChapterId } from '../types'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ShadowButton, shadowButtonClasses } from '@idealjs/stack-ui-kit/react/ShadowButton'
|
||||
import { shadowInk } from '@idealjs/stack-ui-kit/components/effectClasses'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import { shadowInk } from '@idealjs/stack-ui-kit/components'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
|
||||
import type { CSSProperties, ReactNode } from 'react'
|
||||
import { Fragment } from 'react'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ShadowButton, shadowButtonClasses } from '@idealjs/stack-ui-kit/react/ShadowButton'
|
||||
import { hoverHost } from '@idealjs/stack-ui-kit/components/hoverHost'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens/utilities'
|
||||
import { hoverHost } from '@idealjs/stack-ui-kit/components'
|
||||
import * as styles from '@idealjs/stack-ui-kit/tokens'
|
||||
import type { NavRowGroup, NavSectionLink } from './SiteNavbar'
|
||||
import {
|
||||
brandRow,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { style } from '@vanilla-extract/css'
|
||||
import { theme } from '@idealjs/stack-ui-kit/tokens'
|
||||
import { theme } from '@idealjs/stack-ui-kit/tokens/refs'
|
||||
|
||||
export const ticketFaceRow = style({
|
||||
display: 'flex',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { style } from '@vanilla-extract/css'
|
||||
import { theme } from '@idealjs/stack-ui-kit/tokens'
|
||||
import { theme } from '@idealjs/stack-ui-kit/tokens/refs'
|
||||
|
||||
export const guideRow = style({
|
||||
display: 'flex',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { style } from '@vanilla-extract/css'
|
||||
import { theme } from '@idealjs/stack-ui-kit/tokens'
|
||||
import { theme } from '@idealjs/stack-ui-kit/tokens/refs'
|
||||
|
||||
export const brickDots = style({
|
||||
display: 'flex',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { style } from '@vanilla-extract/css'
|
||||
import { theme } from '@idealjs/stack-ui-kit/tokens'
|
||||
import { theme } from '@idealjs/stack-ui-kit/tokens/refs'
|
||||
|
||||
export const edge = style({
|
||||
pointerEvents: 'none',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { style } from '@vanilla-extract/css'
|
||||
import { theme } from '@idealjs/stack-ui-kit/tokens'
|
||||
import { theme } from '@idealjs/stack-ui-kit/tokens/refs'
|
||||
|
||||
export const scene = style({
|
||||
position: 'relative',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { theme } from '@idealjs/stack-ui-kit/tokens'
|
||||
import { theme } from '@idealjs/stack-ui-kit/tokens/refs'
|
||||
import { style } from '@vanilla-extract/css'
|
||||
|
||||
const shellBase = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { theme } from '@idealjs/stack-ui-kit/tokens'
|
||||
import { theme } from '@idealjs/stack-ui-kit/tokens/refs'
|
||||
import { style } from '@vanilla-extract/css'
|
||||
|
||||
const narrow = 'screen and (max-width: 63.999rem)'
|
||||
|
||||
@@ -14,11 +14,11 @@ semantic 层以**原名**输出:ve 主题类产出的是带作用域哈希的
|
||||
## 组件 css.ts 如何消费 token
|
||||
|
||||
- ui-kit 包内:直接用契约 `themeVars`(`import { themeVars } from '../tokens/theme.css'`)。
|
||||
- 其它包(如 `@idealjs/stack-site-ui-kit`):只能 `import { theme } from '@idealjs/stack-ui-kit/tokens'`——纯 TS 常量,值为 `var(--color-*)` 原名字符串,不是 ve theme 机制。
|
||||
- 其它包(如 `@idealjs/stack-site-ui-kit`)的 `.css.ts` 文件:只能 `import { theme } from '@idealjs/stack-ui-kit/tokens/refs'`——纯 TS 常量,值为 `var(--color-*)` 原名字符串,不是 ve theme 机制。
|
||||
|
||||
**其它包不得 import ui-kit 的 `.css.ts` token 模块**:ve 的文件作用域按「编译根 + 文件路径」计算,跨包 import 会让同一个 token 模块被编译进第二个作用域,而主题类只挂其中一套,引用全部悬空。插件发现同一原名对应两个作用域会在构建期直接报错。
|
||||
|
||||
- 跨包消费样式叶子(`utilities.css.ts` 的工具类、`components/*.css.ts` 的效果类):按包 `exports` 子路径直连,不带 `.css` 后缀——`@idealjs/stack-ui-kit/tokens/utilities`、`@idealjs/stack-ui-kit/components/<name>`,与 `react/<name>` 叶子写法一致;`tokens/` 下只有 `utilities` 出口,theme/palette/site 契约模块不对外。
|
||||
- 跨包消费样式类走目录入口:工具类 `import * as styles from '@idealjs/stack-ui-kit/tokens'`(`utilities.css.ts`,与 `theme` 同出口),效果类 `import { … } from '@idealjs/stack-ui-kit/components'`(`effectClasses`/`hoverHost`/`ticket` 三个 `.css.ts`)。`tokens` 入口带 ve 模块,其它包的 `.css.ts` 不得从它 import——ve 编译会把 ui-kit 的 token 模块按外来作用域重新编译一份,引用悬空且构建不报错。
|
||||
|
||||
app 侧继续用 tailwind 工具类的场景,由 app 的桥接入口(`apps/tutorial/src/styles/tailwind.css`)以 `@theme reference` 引用这些原名变量生成 utility(`bg-ink`、`shadow-ink`、`max-lg:bg-ink/40` 等),不向 `:root` 重复发变量。
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
"exports": {
|
||||
"./react": "./src/react/index.ts",
|
||||
"./tokens": "./src/tokens/index.ts",
|
||||
"./tokens/utilities": "./src/tokens/utilities.css.ts",
|
||||
"./components/*": "./src/components/*.css.ts",
|
||||
"./tokens/refs": "./src/tokens/refs.ts",
|
||||
"./components": "./src/components/index.ts",
|
||||
"./themes": "./src/themes/index.ts",
|
||||
"./stack-plugin": "./stack-plugin/index.ts"
|
||||
},
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from './effectClasses.css'
|
||||
export * from './hoverHost.css'
|
||||
export * from './ticket.css'
|
||||
@@ -1 +1,2 @@
|
||||
export * from './utilities.css'
|
||||
export { theme } from './refs'
|
||||
Reference in new issue
Block a user