@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.
- package/README.md +64 -47
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,47 +1,64 @@
|
|
|
1
|
-
# @linkdesk/ui
|
|
2
|
-
|
|
3
|
-
LinkDesk
|
|
4
|
-
|
|
5
|
-
|
|
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"; //
|
|
18
|
-
|
|
19
|
-
export function MyView() {
|
|
20
|
-
return (
|
|
21
|
-
<Toggle
|
|
22
|
-
checked={checked}
|
|
23
|
-
onChange={setChecked}
|
|
24
|
-
label={{ title: "
|
|
25
|
-
/>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
> 🔥
|
|
31
|
-
|
|
32
|
-
##
|
|
33
|
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
|
|
38
|
-
##
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
cd packages/linkdesk-ui
|
|
42
|
-
npm run build # dist
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
##
|
|
46
|
-
|
|
47
|
-
|
|
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