@linkdesk/ui 0.1.4 → 0.1.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 (2) hide show
  1. package/README.md +64 -47
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,47 +1,64 @@
1
- # @linkdesk/ui
2
-
3
- LinkDesk 共享 UI 组件库——右键菜单 / 下拉 / 组合框 / 开关 / 滑杆 / 取色器 / 表单行 / 文件路径输入 / 主题选择等。
4
-
5
- 组件源码单一宿主于 LinkDesk 壳的 `src/components/shared/`,本包是其编译分发面:**插件作者 `npm i @linkdesk/ui` 后拿到的组件与内置插件同款、自动跟随宿主主题与玻璃态**,无需关心实现细节。
6
-
7
- ## 安装
8
-
9
- ```bash
10
- npm i @linkdesk/ui react react-dom
11
- ```
12
-
13
- ## 用法
14
-
15
- ```tsx
16
- import { SelectBox, Toggle } from "@linkdesk/ui";
17
- import "@linkdesk/ui/index.css"; // 绝大多数组件 CSS 由入口 JS 自动带入;需显式引入时用此路径
18
-
19
- export function MyView() {
20
- return (
21
- <Toggle
22
- checked={checked}
23
- onChange={setChecked}
24
- label={{ title: "启用", description: "打开后生效" }}
25
- />
26
- );
27
- }
28
- ```
29
-
30
- > 🔥 样式走宿主 CSS 变量——无需(也不应)在插件里覆盖主题 hex。i18n 文案经宿主语言系统,组件内部文案由宿主翻译。
31
-
32
- ## 设计约束
33
-
34
- - **单一源码,禁止拷贝**:本包 `dist/` 是构建产物(源码只在 LinkDesk 壳仓库),插件侧直接依赖 npm 分发;不要 fork 组件到插件内自维护。
35
- - **跟随主题**:所有组件消费宿主 CSS 变量,插件换主题自动变色。
36
- - 详见 LinkDesk 壳仓库 `docs/02-Electron架构/E6_插件生态与发布/01-插件独立构建/07-共享组件独立分发设计.md`。
37
-
38
- ## 开发(LinkDesk 壳仓库内)
39
-
40
- ```bash
41
- cd packages/linkdesk-ui
42
- npm run build # dist 构建:esm + 聚合 css + 声明文件
43
- ```
44
-
45
- ## License
46
-
47
- MIT
1
+ # @linkdesk/ui
2
+
3
+ The LinkDesk shared UI component library — context menus, dropdowns, combo boxes, toggles, sliders, color pickers, form rows, file path inputs, theme pickers, and more.
4
+
5
+ The component source lives in exactly one place, `src/components/shared/` in the LinkDesk shell; this package is its compiled distribution surface: **after `npm i @linkdesk/ui`, plugin authors get the same components the built-in plugins use, automatically following the host theme and glassmorphism**, with no need to care about implementation details.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm i @linkdesk/ui react react-dom
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```tsx
16
+ import { SelectBox, Toggle } from "@linkdesk/ui";
17
+ import "@linkdesk/ui/index.css"; // most component CSS is pulled in automatically by the entry JS; use this path when you need to import it explicitly
18
+
19
+ export function MyView() {
20
+ return (
21
+ <Toggle
22
+ checked={checked}
23
+ onChange={setChecked}
24
+ label={{ title: "Enable", description: "Takes effect once enabled" }}
25
+ />
26
+ );
27
+ }
28
+ ```
29
+
30
+ > 🔥 Styling goes through host CSS variables — there is no need (and no reason) to override theme hex values inside a plugin. i18n strings go through the host language system, and the text inside components is translated by the host.
31
+
32
+ ## Design constraints
33
+
34
+ - **Single source, copying forbidden**: this package's `dist/` is a build artifact (the source lives only in the LinkDesk shell repository), and plugins depend on the npm distribution directly; do not fork components into a plugin and maintain them there.
35
+ - **Follow the theme**: all components consume host CSS variables, so switching themes in a plugin recolors them automatically.
36
+ - See the LinkDesk shell repository's `docs/02-Electron架构/E6_插件生态与发布/01-插件独立构建/07-共享组件独立分发设计.md`.
37
+
38
+ ## Development (inside the LinkDesk shell repository)
39
+
40
+ ```bash
41
+ cd packages/linkdesk-ui
42
+ npm run build # dist build: esm + aggregated css + declaration files
43
+ ```
44
+
45
+ ## Maintaining this package (LinkDesk maintainers)
46
+
47
+ This package is **one of the five author axes** (the others: `@linkdesk/contracts` / `@linkdesk/plugin-sdk` / `create-linkdesk-plugin` / `@linkdesk/plugin-docs`) and has its own version axis — **publishing it does not bump the application, and the application does not bump it**.
48
+
49
+ Its surface is `src/**` + this README. The component source lives in the shell's `src/components/shared/` — **changing a component means this axis moved**, so bump and publish, otherwise plugin authors keep getting the old components.
50
+
51
+ ```bash
52
+ # 1. bump packages/linkdesk-ui/package.json version (0.x backward-compatible → patch)
53
+ # 2. npm run build (inside the package — dist is what ships)
54
+ # 3. publish
55
+ npm publish --registry=https://registry.npmjs.org # 🔴 the registry flag is mandatory — the machine default is a read-only mirror
56
+ # 4. record the baseline (run in the LinkDesk repo root)
57
+ npm run release:mark
58
+ ```
59
+
60
+ > Full procedure + the three measured pitfalls → **`docs/06-发布管理/作者轴npm发版.md`** in the LinkDesk repository.
61
+
62
+ ## License
63
+
64
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linkdesk/ui",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "@linkdesk/ui——LinkDesk 共享 UI 组件(右键/下拉/开关/取色器等)。壳 src/components/shared 单一源码经构建编译,插件作者 npm i 后与内置插件同款、自动跟随主题/玻璃的界面。",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",