@finchtoys/ui-vue 0.0.0-stage → 0.1.0
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/README.md +77 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3424 -0
- package/dist/types/library/components/menuState.d.ts +17 -0
- package/dist/types/library/components/modalStack.d.ts +1 -0
- package/dist/types/library/styles/classes.d.ts +478 -0
- package/dist/types/packages/vue/entry.d.ts +42 -0
- package/dist/types/packages/vue/src/components/Alert.vue.d.ts +21 -0
- package/dist/types/packages/vue/src/components/Badge.vue.d.ts +24 -0
- package/dist/types/packages/vue/src/components/Breadcrumb.vue.d.ts +13 -0
- package/dist/types/packages/vue/src/components/Button.vue.d.ts +42 -0
- package/dist/types/packages/vue/src/components/ButtonGroup.d.ts +45 -0
- package/dist/types/packages/vue/src/components/CheckBox.vue.d.ts +34 -0
- package/dist/types/packages/vue/src/components/Chip.vue.d.ts +40 -0
- package/dist/types/packages/vue/src/components/ConfirmDialog.vue.d.ts +43 -0
- package/dist/types/packages/vue/src/components/DialogMessage.vue.d.ts +8 -0
- package/dist/types/packages/vue/src/components/DropdownSelect.vue.d.ts +32 -0
- package/dist/types/packages/vue/src/components/Empty.vue.d.ts +24 -0
- package/dist/types/packages/vue/src/components/FreeModelBadge.vue.d.ts +5 -0
- package/dist/types/packages/vue/src/components/HoverCard.vue.d.ts +31 -0
- package/dist/types/packages/vue/src/components/IconTabBar.vue.d.ts +23 -0
- package/dist/types/packages/vue/src/components/InlineActionLink.vue.d.ts +23 -0
- package/dist/types/packages/vue/src/components/InlineSelect.vue.d.ts +22 -0
- package/dist/types/packages/vue/src/components/Input.vue.d.ts +42 -0
- package/dist/types/packages/vue/src/components/InputSelect.vue.d.ts +39 -0
- package/dist/types/packages/vue/src/components/Kbd.vue.d.ts +15 -0
- package/dist/types/packages/vue/src/components/ListRow.vue.d.ts +51 -0
- package/dist/types/packages/vue/src/components/MenuItem.vue.d.ts +31 -0
- package/dist/types/packages/vue/src/components/MenuPopover.vue.d.ts +49 -0
- package/dist/types/packages/vue/src/components/MenuSubmenu.vue.d.ts +37 -0
- package/dist/types/packages/vue/src/components/ModalShell.vue.d.ts +40 -0
- package/dist/types/packages/vue/src/components/MultiSelect.vue.d.ts +32 -0
- package/dist/types/packages/vue/src/components/OptionCard.vue.d.ts +25 -0
- package/dist/types/packages/vue/src/components/ScrollArea.vue.d.ts +26 -0
- package/dist/types/packages/vue/src/components/SearchField.vue.d.ts +31 -0
- package/dist/types/packages/vue/src/components/SecretInput.vue.d.ts +19 -0
- package/dist/types/packages/vue/src/components/SegmentedControl.vue.d.ts +15 -0
- package/dist/types/packages/vue/src/components/SkeletonBlock.vue.d.ts +2 -0
- package/dist/types/packages/vue/src/components/SkeletonCatalogCard.vue.d.ts +7 -0
- package/dist/types/packages/vue/src/components/SkeletonCatalogGrid.vue.d.ts +7 -0
- package/dist/types/packages/vue/src/components/StepSlider.vue.d.ts +14 -0
- package/dist/types/packages/vue/src/components/TextArea.vue.d.ts +20 -0
- package/dist/types/packages/vue/src/components/TimePicker.vue.d.ts +16 -0
- package/dist/types/packages/vue/src/components/ToggleSwitch.vue.d.ts +18 -0
- package/dist/types/packages/vue/src/components/Tooltip.vue.d.ts +39 -0
- package/dist/types/packages/vue/src/components/TypingDots.vue.d.ts +7 -0
- package/dist/types/packages/vue/src/components/WorkingText.vue.d.ts +19 -0
- package/dist/types/packages/vue/src/icons/LucideIcon.vue.d.ts +13 -0
- package/dist/types/packages/vue/src/icons/nodes.d.ts +7 -0
- package/package.json +59 -4
package/README.md
CHANGED
|
@@ -1,3 +1,78 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @finchtoys/ui-vue
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Finch's built-in components for **Vue 3**. Same class strings, same stylesheet, same behaviour as
|
|
4
|
+
[`@finchtoys/ui`](../..) — a panel written in Vue looks like Finch itself, without a second design system.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npm i @finchtoys/ui-vue vue
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import "@finchtoys/ui/style.css"; // the ONE stylesheet — nothing is recompiled for Vue
|
|
12
|
+
import { Button, Input, ToggleSwitch } from "@finchtoys/ui-vue";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The stylesheet is `@finchtoys/ui`'s prebuilt `dist/style.css`. Do not build Tailwind yourself: every
|
|
16
|
+
class this package puts on the page already has a rule there. Because colours/sizes come from the
|
|
17
|
+
`--ui-*` / `--finch-*` custom properties, light / dark / custom skins keep working unchanged.
|
|
18
|
+
|
|
19
|
+
## 提供什么
|
|
20
|
+
|
|
21
|
+
Everything in this list is exported from the package root (`import { X } from "@finchtoys/ui-vue"`).
|
|
22
|
+
|
|
23
|
+
| 分组 | 组件 |
|
|
24
|
+
|---|---|
|
|
25
|
+
| 展示 | `Badge` `FreeModelBadge` `Chip`(=`ActionChip`,`actionable`) `Kbd` `Empty` `InlineActionLink` `OptionCard` `Alert` `ListRow` `TypingDots` `WorkingText` `SkeletonBlock` `SkeletonCatalogCard` `SkeletonCatalogGrid` `DialogMessage` |
|
|
26
|
+
| 表单 | `Button` `ButtonGroup` `Input` `TextArea` `SecretInput` `CheckBox` `ToggleSwitch` `SegmentedControl` `SearchField` `StepSlider` `InputSelect` |
|
|
27
|
+
| 选择器 | `InlineSelect` `DropdownSelect` `MultiSelect` `TimePicker` |
|
|
28
|
+
| 导航 | `Breadcrumb` `IconTabBar` |
|
|
29
|
+
| 浮层 | `Tooltip` `HoverCard` `MenuPopover` `MenuItem` `MenuSubmenu` `ModalShell` `ConfirmDialog` |
|
|
30
|
+
| 滚动 | `ScrollArea` |
|
|
31
|
+
|
|
32
|
+
Also re-exported: `closeAllMenus` / `isAnyMenuOpen` / `bindMenuCloseOnFocus` / `subscribeMenuState` /
|
|
33
|
+
`subscribeMenuCloseAll` (the same menu-state singleton the React build uses — plain TS, no React).
|
|
34
|
+
|
|
35
|
+
Props follow the React API, with two idiomatic translations:
|
|
36
|
+
|
|
37
|
+
- **Node props → slots.** `leadingIcon` / `trailingIcon` / `icon` / `headerRight` / `endAdornment` /
|
|
38
|
+
`desc` / `marker` / `meta` / `float` / `content` are named slots (`#leading`, `#trailing`, `#icon`,
|
|
39
|
+
`#headerRight`, `#endAdornment`, `#desc`, `#marker`, `#meta`, `#float`, `#content`). A slot only
|
|
40
|
+
renders when the caller passes it — that is the Vue equivalent of "prop not set".
|
|
41
|
+
- **`className` → `class`.** Everywhere React appends `className`, pass `class="…"`; Vue merges it
|
|
42
|
+
after the component's own classes, exactly where React puts it. Vue then also renders it verbatim.
|
|
43
|
+
- **Controlled inputs → `v-model`.** `Input`, `TextArea`, `SecretInput` use `modelValue` +
|
|
44
|
+
`update:modelValue`; `MultiSelect` uses `modelValue: string[]`; `DropdownSelect` / `InlineSelect` /
|
|
45
|
+
`TimePicker` / `SegmentedControl` / `StepSlider` / `CheckBox` / `ToggleSwitch` emit `change` (and
|
|
46
|
+
`CheckBox` also `toggle`) — same as the React callbacks, just as events.
|
|
47
|
+
|
|
48
|
+
## 暂不提供 / 有降级
|
|
49
|
+
|
|
50
|
+
| 项 | 状态 | 原因 |
|
|
51
|
+
|---|---|---|
|
|
52
|
+
| `Emoji` / `EmojiText` | **不提供** | React 版依赖 Vite 专有的 `import.meta.glob` 内联 561 个 Twemoji SVG(约 1.2 MB)。Vue 消费者不一定是 Vite;要提供就得先设计一套资产出口(独立入口或按需 URL),本轮不做。`ListRow` 的 `title` 因此按纯文本渲染,不替换 emoji。 |
|
|
53
|
+
| `LiquidGlassFilter` | **不提供** | 它是宿主(Finch 主窗口)的液态玻璃 SVG filter 单例,不属于通用组件;`Toast` 的玻璃背景依赖它。 |
|
|
54
|
+
| `Toast` | **不提供** | 依赖 `registerToastApi` 全局单例 + 上面的玻璃滤镜;小程序 webview 里会退化成普通背景。宿主自己的 `window.finch.ui.toast` 已能覆盖大部分场景。 |
|
|
55
|
+
| `ScrollArea` | **降级** | Vue 版是原生滚动容器 + scroll 驱动的 mask 渐变;没有搬 React 版的 `ResizeObserver`/rAF 循环与横向模式。目前调用点(弹层、对话框)都只用纵向。 |
|
|
56
|
+
| `DropdownSelect` / `MultiSelect` | **降级** | 选项列表用原生滚动容器,没有 `ScrollArea` 的上下边缘渐变。 |
|
|
57
|
+
| `ButtonGroup` | **限制** | 用 `cloneVNode` 注入组样式(等价 React 的 `cloneElement`),但不会像 React 那样把 `<Tooltip><Button/></Tooltip>` 拆开再包回去。请把 Tooltip 放进组内而不是包住整个组项。 |
|
|
58
|
+
| `Tooltip` / `HoverCard` | **实现差异** | React 用 `cloneElement` 给触发器挂事件;Vue 在触发器外包一层 `display:contents` 的 span 并测量它的第一个元素子节点。布局与 class 不受影响,但触发器必须是单个元素。 |
|
|
59
|
+
| `SegmentedControl` | **限制** | `options[].icon` 收的是图标 key(字符串)而不是节点——数据驱动的选项列表里没法传 slot。 |
|
|
60
|
+
| SSR | **不支持** | 与 React 版一致:浮层用 `Teleport`/`createPortal`,定位依赖 `window`。 |
|
|
61
|
+
|
|
62
|
+
## 和 React 版的关系
|
|
63
|
+
|
|
64
|
+
- **class 字符串单一来源**:两边都从 `library/styles/classes.ts` 取值(React 直接 import,Vue 在构建时内联)。仓库里的 `verify-build.mjs` 会强制「已迁移组件不得再内联 class 字面量」,并检查每个 utility 在 `dist/style.css` 里确有规则。
|
|
65
|
+
- 不改样式:本包不产出 CSS。样式永远来自 `@finchtoys/ui/style.css`。
|
|
66
|
+
- `vue` 是 peer 依赖(不会给你第二份 Vue);`@finchtoys/ui` 是可选 peer,只为了那份 CSS。
|
|
67
|
+
|
|
68
|
+
## 开发
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm run build # 图标数据生成 → vite lib build → vue-tsc 输出 d.ts
|
|
72
|
+
npm run typecheck
|
|
73
|
+
npm run smoke # 最小冒烟:每个组件渲染不抛错 + class token 与 React 一致
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`smoke` 用 `renderToString` 分别渲染 React 与 Vue 两版,比对每个元素的 class 集合。它不是
|
|
77
|
+
spike 里那套逐属性/逐像素 harness —— 那套是用来证明路线可行的,这里只要「没在搬的过程中悄悄
|
|
78
|
+
改坏」。
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./types/packages/vue/entry";
|