@morlay/dsh-client-ui-primitives 0.0.2-alpha.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/LICENSE +21 -0
- package/README.md +37 -0
- package/cordis.patch.yml +3 -0
- package/dist/client.cjs +13715 -0
- package/dist/client.d.cts +10883 -0
- package/dist/client.d.mts +10883 -0
- package/dist/index.d.cts +5 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.mjs +5 -0
- package/dist/reference-BLcMVsqa.mjs +406 -0
- package/dist/reference-Do8Uwujy.d.cts +29 -0
- package/dist/reference-Do8Uwujy.d.mts +29 -0
- package/package.json +66 -0
- package/src/client/index.ts +20 -0
- package/src/client/markdown-labels.ts +10 -0
- package/src/client/markdown-text.ts +6 -0
- package/src/client/styling/css.ts +27 -0
- package/src/client/styling/index.ts +6 -0
- package/src/client/styling/styled.tsx +56 -0
- package/src/client/styling/styling.ts +137 -0
- package/src/client/styling/token.ts +275 -0
- package/src/client/styling/toolkit.ts +37 -0
- package/src/client/theme.generated.ts +724 -0
- package/src/client/theme.ts +5 -0
- package/src/index.ts +4 -0
- package/src/reference-markdown.tsx +136 -0
- package/src/reference.ts +552 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 morlay
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# @morlay/dsh-client-ui-primitives
|
|
2
|
+
|
|
3
|
+
对话 UI 的 **css-in-js 样式层**:`styled` / `Token` / `Styling`,消费官方主题已注入的
|
|
4
|
+
`--dsw-*` 变量,因此不需要 CSS Modules 那一步预编译(源码可直接加载)。
|
|
5
|
+
|
|
6
|
+
设计取舍(为什么 css-in-js、为什么生成 token 树、与上游 `ui-primitives` 的关系)见
|
|
7
|
+
[ADR-css-in-js样式层与官方token消费](./.agents/adrs/20260917-css-in-js样式层与官方token消费.md)。
|
|
8
|
+
|
|
9
|
+
## 能力
|
|
10
|
+
|
|
11
|
+
| 导出 | 用途 |
|
|
12
|
+
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
13
|
+
| `styled('div')(style, …)` | 生成带 `data-css-*` 的组件;多个样式对象深合并(变体叠基样式) |
|
|
14
|
+
| `styling` | `props(style)` 取 `data-css-*` 属性、`keyframes`、`injectGlobals`、`sheets()` |
|
|
15
|
+
| `Token` | 变量引用代理(`vars`)、局部变量赋值(`assignVars`)、变体选择器(`variants`)、组合子(`calc` / `min` / `max` / `url` / `colorMix` / `colorScale` / `fallbackVar` / `val`) |
|
|
16
|
+
| `dsw` | 官方主题变量引用:`dsw.alias.bg.base` → `var(--dsw-alias-bg-base)` |
|
|
17
|
+
| `designTokens` | 生成的 token 树,叶子是官方默认值(可作 fallback 与类型推导来源) |
|
|
18
|
+
|
|
19
|
+
样式注入是**惰性立即注入**(某条规则第一次生成时就 append `<style data-css="…">`,
|
|
20
|
+
按 id 去重),不提供 Provider。
|
|
21
|
+
|
|
22
|
+
## token 树
|
|
23
|
+
|
|
24
|
+
`designTokens`(`src/client/theme.generated.ts`)由 `scripts/gen-design-tokens.mts` 从
|
|
25
|
+
上游主题源码生成,共 **359 个 `--dsw-*`**:叶子是该变量在 light 主题里的默认值。
|
|
26
|
+
生成机制、`"$"` 键语义与守卫判据见
|
|
27
|
+
[ADR-css-in-js样式层与官方token消费](./.agents/adrs/20260917-css-in-js样式层与官方token消费.md)。
|
|
28
|
+
|
|
29
|
+
## 装配
|
|
30
|
+
|
|
31
|
+
本包是 profile 的一行 insert(client 半按 `dsh.client` 声明加载);本仓库的装配真源是
|
|
32
|
+
`packages/session/better-session/cordis.patch.yml` 的 `ui-primitives-fork` 行。
|
|
33
|
+
|
|
34
|
+
## 已知限制
|
|
35
|
+
|
|
36
|
+
- token 值只在生成物里(默认值),运行时不重新定义官方变量;主题切换仍由官方 `--dsw-*` 覆盖完成。
|
|
37
|
+
- `styled` 不做 polymorphic(无 `as` / `asChild`):需要换渲染元素时直接 `styled('a')` 或包一层组件。
|
package/cordis.patch.yml
ADDED