@morlay/dsh-client-ui-primitives 0.0.2-alpha.4 → 0.0.2-alpha.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 CHANGED
@@ -8,13 +8,14 @@
8
8
 
9
9
  ## 能力
10
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 与类型推导来源) |
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
+ | `findReferences` / `parseReferenceToken` | host 面:`@` 引用的统一解析与形态归一(`@path` / `@"path"` / `skill:name` → 结构化引用与 span),`Reference` / `ReferenceSpan` 类型 |
18
+ | `designTokens` | 生成的 token 树,叶子是官方默认值(可作 fallback 与类型推导来源) |
18
19
 
19
20
  样式注入是**惰性立即注入**(某条规则第一次生成时就 append `<style data-css="…">`,
20
21
  按 id 去重),不提供 Provider。
package/dist/client.cjs CHANGED
@@ -323,7 +323,7 @@ window.__ModuleLoader__.load({
323
323
  //#endregion
324
324
  //#region src/client/theme.generated.ts
325
325
  /**
326
- * 官方主题的 `--dsw-*` token 全集(359 个),由 packages/client/ui-primitives/scripts/gen-design-tokens.mts 生成,勿手改。
326
+ * 官方主题的 `--dsw-*` token 全集(361 个),由 packages/client/ui-primitives/scripts/gen-design-tokens.mts 生成,勿手改。
327
327
  *
328
328
  * 叶子是该变量的**默认值**(官方 light 主题里首次出现的定义):既是类型推导的来源,也可作 fallback。
329
329
  * `"$"` 键出现在「自身也是 token 的分支」上(命名体系里有 40 个短名同时是长名前缀的 token)。
@@ -458,6 +458,7 @@ window.__ModuleLoader__.load({
458
458
  "primary": "var(--dsw-static-red-600)",
459
459
  "secondary": "var(--dsw-static-red-400)"
460
460
  },
461
+ "idle": { "primary": "var(--dsw-static-neutral-300)" },
461
462
  "success": {
462
463
  "primary": "var(--dsw-static-green-500)",
463
464
  "secondary": "var(--dsw-static-green-400)",
@@ -803,6 +804,7 @@ window.__ModuleLoader__.load({
803
804
  "think": { "select": "linear-gradient(180deg, #f5f6f7 20.19%, rgba(245, 246, 247, 0) 100%)" }
804
805
  },
805
806
  "mask": { "blur": "blur(2px)" },
807
+ "menu": { "backdrop": { "filter": "blur(40px) saturate(150%)" } },
806
808
  "shadow": {
807
809
  "lv1": {
808
810
  "$": "0 2px 4px 0 rgba(0, 0, 0, 0.05)",
@@ -818,7 +820,7 @@ window.__ModuleLoader__.load({
818
820
  },
819
821
  "input": { "major": "var(--dsw-static-neutral-bluish-00)" },
820
822
  "login": { "input": "var(--dsw-static-neutral-bluish-50)" },
821
- "menu": "var(--dsw-alias-bg-layer-3)",
823
+ "menu": "rgba(248, 249, 250, 0.58)",
822
824
  "selector": "var(--dsw-static-neutral-bluish-60)",
823
825
  "sidebar": {
824
826
  "fill": "var(--dsw-static-neutral-bluish-50)",
@@ -859,7 +861,7 @@ window.__ModuleLoader__.load({
859
861
  "100": "rgb(228, 237, 253)",
860
862
  "200": "rgb(211, 226, 255)",
861
863
  "300": "rgb(183, 200, 254)",
862
- "400": "rgb(103, 158, 254)",
864
+ "400": "rgb(122, 170, 255)",
863
865
  "450": "rgb(86, 134, 254)",
864
866
  "500": "rgb(65, 118, 230)",
865
867
  "600": "rgb(72, 104, 178)",
@@ -13240,6 +13242,7 @@ window.__ModuleLoader__.load({
13240
13242
  const LINE_FRAGMENT = /^L(\d+)(?:C(\d+))?(?:-L(\d+))?$/u;
13241
13243
  const SCHEME = /^([A-Za-z][A-Za-z0-9+.-]*):/u;
13242
13244
  const BARE_PATH = /^([^:]+):(\d+)(?::(\d+))?$/u;
13245
+ const MENTION_WHITESPACE = /\s/u;
13243
13246
  const URI_UNSAFE = /[%#()\s<>"`]/gu;
13244
13247
  const PATH_PUNCTUATION = [
13245
13248
  codes.slash,
@@ -13296,6 +13299,10 @@ window.__ModuleLoader__.load({
13296
13299
  function isLocalReference(reference) {
13297
13300
  return !EXTERNAL_PROTOCOLS.includes(reference.protocol);
13298
13301
  }
13302
+ function formatReferenceMention(reference) {
13303
+ const path = reference.path ?? "";
13304
+ return MENTION_WHITESPACE.test(path) ? `@"${path}"` : `@${path}`;
13305
+ }
13299
13306
  function findReferences(text) {
13300
13307
  const spans = [];
13301
13308
  if (text === "" || !TRIGGERS.some((trigger) => text.includes(trigger))) return spans;
@@ -13352,8 +13359,29 @@ window.__ModuleLoader__.load({
13352
13359
  return headStart(code);
13353
13360
  }
13354
13361
  function afterAt(code) {
13362
+ if (code === codes.quotationMark) {
13363
+ effects.consume(code);
13364
+ return quotedPath;
13365
+ }
13355
13366
  return asciiAlpha(code) ? headStart(code) : pathStart(code);
13356
13367
  }
13368
+ function quotedPath(code) {
13369
+ if (code === null || markdownLineEnding(code)) return nok(code);
13370
+ effects.consume(code);
13371
+ return code === codes.quotationMark ? afterQuotedPath : quotedPath;
13372
+ }
13373
+ function afterQuotedPath(code) {
13374
+ if (code !== codes.numberSign) return finish(code);
13375
+ effects.consume(code);
13376
+ return fragmentInside;
13377
+ }
13378
+ function fragmentInside(code) {
13379
+ if (isPathCode(code) || code === codes.numberSign) {
13380
+ effects.consume(code);
13381
+ return fragmentInside;
13382
+ }
13383
+ return finish(code);
13384
+ }
13357
13385
  function headStart(code) {
13358
13386
  if (!asciiAlpha(code)) return nok(code);
13359
13387
  head = "";
@@ -13552,6 +13580,7 @@ window.__ModuleLoader__.load({
13552
13580
  function parseBareReference(raw) {
13553
13581
  const body = raw.startsWith("@") ? raw.slice(1) : raw;
13554
13582
  if (body === "") return void 0;
13583
+ if (body.startsWith(QUOTED_PATH)) return parseQuotedReference(body);
13555
13584
  const scheme = SCHEME.exec(body);
13556
13585
  if (scheme !== null && isKnownScheme(scheme[1])) return parseReference(body);
13557
13586
  const matched = BARE_PATH.exec(body);
@@ -13568,6 +13597,21 @@ window.__ModuleLoader__.load({
13568
13597
  ...column === void 0 ? {} : { column: Number(column) }
13569
13598
  };
13570
13599
  }
13600
+ /** 引号 mention 的起手字符:`@"path with spaces"`。 */
13601
+ const QUOTED_PATH = "\"";
13602
+ function parseQuotedReference(body) {
13603
+ const end = body.indexOf(QUOTED_PATH, 1);
13604
+ if (end === -1) return void 0;
13605
+ const path = body.slice(1, end);
13606
+ if (path === "") return void 0;
13607
+ const fragment = splitLineFragment(body.slice(end + 1));
13608
+ if (fragment.head !== "") return void 0;
13609
+ return {
13610
+ protocol: DEFAULT_PROTOCOL,
13611
+ path,
13612
+ ...fragment.lines
13613
+ };
13614
+ }
13571
13615
  function referenceFromMarkdown() {
13572
13616
  return {
13573
13617
  enter: { reference: enterReference },
@@ -13701,6 +13745,7 @@ window.__ModuleLoader__.load({
13701
13745
  exports.dsw = dsw;
13702
13746
  exports.findReferences = findReferences;
13703
13747
  exports.formatReference = formatReference;
13748
+ exports.formatReferenceMention = formatReferenceMention;
13704
13749
  exports.inject = inject;
13705
13750
  exports.isLocalReference = isLocalReference;
13706
13751
  exports.markdownLabels = markdownLabels;
package/dist/client.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as isLocalReference, i as formatReference, n as ReferenceSpan, o as parseReference, r as findReferences, s as parseReferenceToken, t as Reference } from "./reference-Do8Uwujy.cjs";
1
+ import { a as formatReferenceMention, c as parseReferenceToken, i as formatReference, n as ReferenceSpan, o as isLocalReference, r as findReferences, s as parseReference, t as Reference } from "./reference-BX54bj6_.cjs";
2
2
  import { Context } from "@deepseek-ai/cordis";
3
3
  import { ComponentProps, ComponentPropsWithRef, ElementType, ForwardRefExoticComponent, Ref, RefAttributes } from "react";
4
4
  import { MarkdownFileMentions, MarkdownLabels, MarkdownLabels as MarkdownLabels$1, MarkdownPathImages } from "@deepseek-ai/dsh-client-ui-primitives";
@@ -9414,7 +9414,7 @@ declare function styleOf(component: StyledComponent<ElementType>): CSSProps;
9414
9414
  //#endregion
9415
9415
  //#region src/client/theme.generated.d.ts
9416
9416
  /**
9417
- * 官方主题的 `--dsw-*` token 全集(359 个),由 packages/client/ui-primitives/scripts/gen-design-tokens.mts 生成,勿手改。
9417
+ * 官方主题的 `--dsw-*` token 全集(361 个),由 packages/client/ui-primitives/scripts/gen-design-tokens.mts 生成,勿手改。
9418
9418
  *
9419
9419
  * 叶子是该变量的**默认值**(官方 light 主题里首次出现的定义):既是类型推导的来源,也可作 fallback。
9420
9420
  * `"$"` 键出现在「自身也是 token 的分支」上(命名体系里有 40 个短名同时是长名前缀的 token)。
@@ -9577,6 +9577,9 @@ declare const designTokens: {
9577
9577
  readonly primary: "var(--dsw-static-red-600)";
9578
9578
  readonly secondary: "var(--dsw-static-red-400)";
9579
9579
  };
9580
+ readonly idle: {
9581
+ readonly primary: "var(--dsw-static-neutral-300)";
9582
+ };
9580
9583
  readonly success: {
9581
9584
  readonly primary: "var(--dsw-static-green-500)";
9582
9585
  readonly secondary: "var(--dsw-static-green-400)";
@@ -10010,6 +10013,11 @@ declare const designTokens: {
10010
10013
  readonly mask: {
10011
10014
  readonly blur: "blur(2px)";
10012
10015
  };
10016
+ readonly menu: {
10017
+ readonly backdrop: {
10018
+ readonly filter: "blur(40px) saturate(150%)";
10019
+ };
10020
+ };
10013
10021
  readonly shadow: {
10014
10022
  readonly lv1: {
10015
10023
  readonly $: "0 2px 4px 0 rgba(0, 0, 0, 0.05)";
@@ -10029,7 +10037,7 @@ declare const designTokens: {
10029
10037
  readonly login: {
10030
10038
  readonly input: "var(--dsw-static-neutral-bluish-50)";
10031
10039
  };
10032
- readonly menu: "var(--dsw-alias-bg-layer-3)";
10040
+ readonly menu: "rgba(248, 249, 250, 0.58)";
10033
10041
  readonly selector: "var(--dsw-static-neutral-bluish-60)";
10034
10042
  readonly sidebar: {
10035
10043
  readonly fill: "var(--dsw-static-neutral-bluish-50)";
@@ -10072,7 +10080,7 @@ declare const designTokens: {
10072
10080
  readonly "100": "rgb(228, 237, 253)";
10073
10081
  readonly "200": "rgb(211, 226, 255)";
10074
10082
  readonly "300": "rgb(183, 200, 254)";
10075
- readonly "400": "rgb(103, 158, 254)";
10083
+ readonly "400": "rgb(122, 170, 255)";
10076
10084
  readonly "450": "rgb(86, 134, 254)";
10077
10085
  readonly "500": "rgb(65, 118, 230)";
10078
10086
  readonly "600": "rgb(72, 104, 178)";
@@ -10296,6 +10304,9 @@ declare const dsw: TokenVars<{
10296
10304
  readonly primary: "var(--dsw-static-red-600)";
10297
10305
  readonly secondary: "var(--dsw-static-red-400)";
10298
10306
  };
10307
+ readonly idle: {
10308
+ readonly primary: "var(--dsw-static-neutral-300)";
10309
+ };
10299
10310
  readonly success: {
10300
10311
  readonly primary: "var(--dsw-static-green-500)";
10301
10312
  readonly secondary: "var(--dsw-static-green-400)";
@@ -10729,6 +10740,11 @@ declare const dsw: TokenVars<{
10729
10740
  readonly mask: {
10730
10741
  readonly blur: "blur(2px)";
10731
10742
  };
10743
+ readonly menu: {
10744
+ readonly backdrop: {
10745
+ readonly filter: "blur(40px) saturate(150%)";
10746
+ };
10747
+ };
10732
10748
  readonly shadow: {
10733
10749
  readonly lv1: {
10734
10750
  readonly $: "0 2px 4px 0 rgba(0, 0, 0, 0.05)";
@@ -10748,7 +10764,7 @@ declare const dsw: TokenVars<{
10748
10764
  readonly login: {
10749
10765
  readonly input: "var(--dsw-static-neutral-bluish-50)";
10750
10766
  };
10751
- readonly menu: "var(--dsw-alias-bg-layer-3)";
10767
+ readonly menu: "rgba(248, 249, 250, 0.58)";
10752
10768
  readonly selector: "var(--dsw-static-neutral-bluish-60)";
10753
10769
  readonly sidebar: {
10754
10770
  readonly fill: "var(--dsw-static-neutral-bluish-50)";
@@ -10791,7 +10807,7 @@ declare const dsw: TokenVars<{
10791
10807
  readonly "100": "rgb(228, 237, 253)";
10792
10808
  readonly "200": "rgb(211, 226, 255)";
10793
10809
  readonly "300": "rgb(183, 200, 254)";
10794
- readonly "400": "rgb(103, 158, 254)";
10810
+ readonly "400": "rgb(122, 170, 255)";
10795
10811
  readonly "450": "rgb(86, 134, 254)";
10796
10812
  readonly "500": "rgb(65, 118, 230)";
10797
10813
  readonly "600": "rgb(72, 104, 178)";
@@ -10880,4 +10896,4 @@ declare const ReferenceMarkdown: import("react").MemoExoticComponent<({ text, la
10880
10896
  declare const inject: readonly string[];
10881
10897
  declare function apply(_ctx: Context): void;
10882
10898
  //#endregion
10883
- export { type CSSObject, type CSSProps, type CSSSelector, type CSSValue, type CSSVar, type CSSVarRef, MarkdownCopySeat, type Reference, type ReferenceActions, ReferenceMarkdown, type ReferenceMarkdownProps, type ReferenceSpan, type StyledComponent, Styling, Token, type TokenVars, type Tokens, apply, designTokens, dsw, findReferences, formatReference, inject, isLocalReference, markdownLabels, parseReference, parseReferenceToken, referenceMentions, styleOf, styled, styling };
10899
+ export { type CSSObject, type CSSProps, type CSSSelector, type CSSValue, type CSSVar, type CSSVarRef, MarkdownCopySeat, type Reference, type ReferenceActions, ReferenceMarkdown, type ReferenceMarkdownProps, type ReferenceSpan, type StyledComponent, Styling, Token, type TokenVars, type Tokens, apply, designTokens, dsw, findReferences, formatReference, formatReferenceMention, inject, isLocalReference, markdownLabels, parseReference, parseReferenceToken, referenceMentions, styleOf, styled, styling };
package/dist/client.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as isLocalReference, i as formatReference, n as ReferenceSpan, o as parseReference, r as findReferences, s as parseReferenceToken, t as Reference } from "./reference-Do8Uwujy.mjs";
1
+ import { a as formatReferenceMention, c as parseReferenceToken, i as formatReference, n as ReferenceSpan, o as isLocalReference, r as findReferences, s as parseReference, t as Reference } from "./reference-BX54bj6_.mjs";
2
2
  import { ComponentProps, ComponentPropsWithRef, ElementType, ForwardRefExoticComponent, Ref, RefAttributes } from "react";
3
3
  import { MarkdownFileMentions, MarkdownLabels, MarkdownLabels as MarkdownLabels$1, MarkdownPathImages } from "@deepseek-ai/dsh-client-ui-primitives";
4
4
  import { Context } from "@deepseek-ai/cordis";
@@ -9414,7 +9414,7 @@ declare function styleOf(component: StyledComponent<ElementType>): CSSProps;
9414
9414
  //#endregion
9415
9415
  //#region src/client/theme.generated.d.ts
9416
9416
  /**
9417
- * 官方主题的 `--dsw-*` token 全集(359 个),由 packages/client/ui-primitives/scripts/gen-design-tokens.mts 生成,勿手改。
9417
+ * 官方主题的 `--dsw-*` token 全集(361 个),由 packages/client/ui-primitives/scripts/gen-design-tokens.mts 生成,勿手改。
9418
9418
  *
9419
9419
  * 叶子是该变量的**默认值**(官方 light 主题里首次出现的定义):既是类型推导的来源,也可作 fallback。
9420
9420
  * `"$"` 键出现在「自身也是 token 的分支」上(命名体系里有 40 个短名同时是长名前缀的 token)。
@@ -9577,6 +9577,9 @@ declare const designTokens: {
9577
9577
  readonly primary: "var(--dsw-static-red-600)";
9578
9578
  readonly secondary: "var(--dsw-static-red-400)";
9579
9579
  };
9580
+ readonly idle: {
9581
+ readonly primary: "var(--dsw-static-neutral-300)";
9582
+ };
9580
9583
  readonly success: {
9581
9584
  readonly primary: "var(--dsw-static-green-500)";
9582
9585
  readonly secondary: "var(--dsw-static-green-400)";
@@ -10010,6 +10013,11 @@ declare const designTokens: {
10010
10013
  readonly mask: {
10011
10014
  readonly blur: "blur(2px)";
10012
10015
  };
10016
+ readonly menu: {
10017
+ readonly backdrop: {
10018
+ readonly filter: "blur(40px) saturate(150%)";
10019
+ };
10020
+ };
10013
10021
  readonly shadow: {
10014
10022
  readonly lv1: {
10015
10023
  readonly $: "0 2px 4px 0 rgba(0, 0, 0, 0.05)";
@@ -10029,7 +10037,7 @@ declare const designTokens: {
10029
10037
  readonly login: {
10030
10038
  readonly input: "var(--dsw-static-neutral-bluish-50)";
10031
10039
  };
10032
- readonly menu: "var(--dsw-alias-bg-layer-3)";
10040
+ readonly menu: "rgba(248, 249, 250, 0.58)";
10033
10041
  readonly selector: "var(--dsw-static-neutral-bluish-60)";
10034
10042
  readonly sidebar: {
10035
10043
  readonly fill: "var(--dsw-static-neutral-bluish-50)";
@@ -10072,7 +10080,7 @@ declare const designTokens: {
10072
10080
  readonly "100": "rgb(228, 237, 253)";
10073
10081
  readonly "200": "rgb(211, 226, 255)";
10074
10082
  readonly "300": "rgb(183, 200, 254)";
10075
- readonly "400": "rgb(103, 158, 254)";
10083
+ readonly "400": "rgb(122, 170, 255)";
10076
10084
  readonly "450": "rgb(86, 134, 254)";
10077
10085
  readonly "500": "rgb(65, 118, 230)";
10078
10086
  readonly "600": "rgb(72, 104, 178)";
@@ -10296,6 +10304,9 @@ declare const dsw: TokenVars<{
10296
10304
  readonly primary: "var(--dsw-static-red-600)";
10297
10305
  readonly secondary: "var(--dsw-static-red-400)";
10298
10306
  };
10307
+ readonly idle: {
10308
+ readonly primary: "var(--dsw-static-neutral-300)";
10309
+ };
10299
10310
  readonly success: {
10300
10311
  readonly primary: "var(--dsw-static-green-500)";
10301
10312
  readonly secondary: "var(--dsw-static-green-400)";
@@ -10729,6 +10740,11 @@ declare const dsw: TokenVars<{
10729
10740
  readonly mask: {
10730
10741
  readonly blur: "blur(2px)";
10731
10742
  };
10743
+ readonly menu: {
10744
+ readonly backdrop: {
10745
+ readonly filter: "blur(40px) saturate(150%)";
10746
+ };
10747
+ };
10732
10748
  readonly shadow: {
10733
10749
  readonly lv1: {
10734
10750
  readonly $: "0 2px 4px 0 rgba(0, 0, 0, 0.05)";
@@ -10748,7 +10764,7 @@ declare const dsw: TokenVars<{
10748
10764
  readonly login: {
10749
10765
  readonly input: "var(--dsw-static-neutral-bluish-50)";
10750
10766
  };
10751
- readonly menu: "var(--dsw-alias-bg-layer-3)";
10767
+ readonly menu: "rgba(248, 249, 250, 0.58)";
10752
10768
  readonly selector: "var(--dsw-static-neutral-bluish-60)";
10753
10769
  readonly sidebar: {
10754
10770
  readonly fill: "var(--dsw-static-neutral-bluish-50)";
@@ -10791,7 +10807,7 @@ declare const dsw: TokenVars<{
10791
10807
  readonly "100": "rgb(228, 237, 253)";
10792
10808
  readonly "200": "rgb(211, 226, 255)";
10793
10809
  readonly "300": "rgb(183, 200, 254)";
10794
- readonly "400": "rgb(103, 158, 254)";
10810
+ readonly "400": "rgb(122, 170, 255)";
10795
10811
  readonly "450": "rgb(86, 134, 254)";
10796
10812
  readonly "500": "rgb(65, 118, 230)";
10797
10813
  readonly "600": "rgb(72, 104, 178)";
@@ -10880,4 +10896,4 @@ declare const ReferenceMarkdown: import("react").MemoExoticComponent<({ text, la
10880
10896
  declare const inject: readonly string[];
10881
10897
  declare function apply(_ctx: Context): void;
10882
10898
  //#endregion
10883
- export { type CSSObject, type CSSProps, type CSSSelector, type CSSValue, type CSSVar, type CSSVarRef, MarkdownCopySeat, type Reference, type ReferenceActions, ReferenceMarkdown, type ReferenceMarkdownProps, type ReferenceSpan, type StyledComponent, Styling, Token, type TokenVars, type Tokens, apply, designTokens, dsw, findReferences, formatReference, inject, isLocalReference, markdownLabels, parseReference, parseReferenceToken, referenceMentions, styleOf, styled, styling };
10899
+ export { type CSSObject, type CSSProps, type CSSSelector, type CSSValue, type CSSVar, type CSSVarRef, MarkdownCopySeat, type Reference, type ReferenceActions, ReferenceMarkdown, type ReferenceMarkdownProps, type ReferenceSpan, type StyledComponent, Styling, Token, type TokenVars, type Tokens, apply, designTokens, dsw, findReferences, formatReference, formatReferenceMention, inject, isLocalReference, markdownLabels, parseReference, parseReferenceToken, referenceMentions, styleOf, styled, styling };
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as ReferenceSpan, r as findReferences, s as parseReferenceToken, t as Reference } from "./reference-Do8Uwujy.cjs";
1
+ import { c as parseReferenceToken, n as ReferenceSpan, r as findReferences, t as Reference } from "./reference-BX54bj6_.cjs";
2
2
  //#region src/index.d.ts
3
3
  declare function apply(): void;
4
4
  //#endregion
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as ReferenceSpan, r as findReferences, s as parseReferenceToken, t as Reference } from "./reference-Do8Uwujy.mjs";
1
+ import { c as parseReferenceToken, n as ReferenceSpan, r as findReferences, t as Reference } from "./reference-BX54bj6_.mjs";
2
2
  //#region src/index.d.ts
3
3
  declare function apply(): void;
4
4
  //#endregion
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as parseReferenceToken, t as findReferences } from "./reference-BLcMVsqa.mjs";
1
+ import { o as parseReferenceToken, t as findReferences } from "./reference-Dxy9uQYz.mjs";
2
2
  //#region src/index.ts
3
3
  function apply() {}
4
4
  //#endregion
@@ -24,6 +24,7 @@ declare function parseReference(value: string, title?: string): Reference | unde
24
24
  declare function parseReferenceToken(value: string): Reference | undefined;
25
25
  declare function formatReference(reference: Reference): string;
26
26
  declare function isLocalReference(reference: Reference): boolean;
27
+ declare function formatReferenceMention(reference: Reference): string;
27
28
  declare function findReferences(text: string): readonly ReferenceSpan[];
28
29
  //#endregion
29
- export { isLocalReference as a, formatReference as i, ReferenceSpan as n, parseReference as o, findReferences as r, parseReferenceToken as s, Reference as t };
30
+ export { formatReferenceMention as a, parseReferenceToken as c, formatReference as i, ReferenceSpan as n, isLocalReference as o, findReferences as r, parseReference as s, Reference as t };
@@ -24,6 +24,7 @@ declare function parseReference(value: string, title?: string): Reference | unde
24
24
  declare function parseReferenceToken(value: string): Reference | undefined;
25
25
  declare function formatReference(reference: Reference): string;
26
26
  declare function isLocalReference(reference: Reference): boolean;
27
+ declare function formatReferenceMention(reference: Reference): string;
27
28
  declare function findReferences(text: string): readonly ReferenceSpan[];
28
29
  //#endregion
29
- export { isLocalReference as a, formatReference as i, ReferenceSpan as n, parseReference as o, findReferences as r, parseReferenceToken as s, Reference as t };
30
+ export { formatReferenceMention as a, parseReferenceToken as c, formatReference as i, ReferenceSpan as n, isLocalReference as o, findReferences as r, parseReference as s, Reference as t };
@@ -1,6 +1,6 @@
1
1
  import { fromMarkdown } from "mdast-util-from-markdown";
2
2
  import { gfmFromMarkdown } from "mdast-util-gfm";
3
- import { asciiAlpha, asciiAlphanumeric, asciiDigit, markdownLineEndingOrSpace, unicodePunctuation, unicodeWhitespace } from "micromark-util-character";
3
+ import { asciiAlpha, asciiAlphanumeric, asciiDigit, markdownLineEnding, markdownLineEndingOrSpace, unicodePunctuation, unicodeWhitespace } from "micromark-util-character";
4
4
  import { gfm } from "micromark-extension-gfm";
5
5
  import { codes, types } from "micromark-util-symbol";
6
6
  //#region src/reference.ts
@@ -13,6 +13,7 @@ const EXTERNAL_PROTOCOLS = [
13
13
  const LINE_FRAGMENT = /^L(\d+)(?:C(\d+))?(?:-L(\d+))?$/u;
14
14
  const SCHEME = /^([A-Za-z][A-Za-z0-9+.-]*):/u;
15
15
  const BARE_PATH = /^([^:]+):(\d+)(?::(\d+))?$/u;
16
+ const MENTION_WHITESPACE = /\s/u;
16
17
  const URI_UNSAFE = /[%#()\s<>"`]/gu;
17
18
  const PATH_PUNCTUATION = [
18
19
  codes.slash,
@@ -69,6 +70,10 @@ function formatReference(reference) {
69
70
  function isLocalReference(reference) {
70
71
  return !EXTERNAL_PROTOCOLS.includes(reference.protocol);
71
72
  }
73
+ function formatReferenceMention(reference) {
74
+ const path = reference.path ?? "";
75
+ return MENTION_WHITESPACE.test(path) ? `@"${path}"` : `@${path}`;
76
+ }
72
77
  function findReferences(text) {
73
78
  const spans = [];
74
79
  if (text === "" || !TRIGGERS.some((trigger) => text.includes(trigger))) return spans;
@@ -125,8 +130,29 @@ const tokenizeReference = function(effects, ok, nok) {
125
130
  return headStart(code);
126
131
  }
127
132
  function afterAt(code) {
133
+ if (code === codes.quotationMark) {
134
+ effects.consume(code);
135
+ return quotedPath;
136
+ }
128
137
  return asciiAlpha(code) ? headStart(code) : pathStart(code);
129
138
  }
139
+ function quotedPath(code) {
140
+ if (code === null || markdownLineEnding(code)) return nok(code);
141
+ effects.consume(code);
142
+ return code === codes.quotationMark ? afterQuotedPath : quotedPath;
143
+ }
144
+ function afterQuotedPath(code) {
145
+ if (code !== codes.numberSign) return finish(code);
146
+ effects.consume(code);
147
+ return fragmentInside;
148
+ }
149
+ function fragmentInside(code) {
150
+ if (isPathCode(code) || code === codes.numberSign) {
151
+ effects.consume(code);
152
+ return fragmentInside;
153
+ }
154
+ return finish(code);
155
+ }
130
156
  function headStart(code) {
131
157
  if (!asciiAlpha(code)) return nok(code);
132
158
  head = "";
@@ -325,6 +351,7 @@ function textOf(node) {
325
351
  function parseBareReference(raw) {
326
352
  const body = raw.startsWith("@") ? raw.slice(1) : raw;
327
353
  if (body === "") return void 0;
354
+ if (body.startsWith(QUOTED_PATH)) return parseQuotedReference(body);
328
355
  const scheme = SCHEME.exec(body);
329
356
  if (scheme !== null && isKnownScheme(scheme[1])) return parseReference(body);
330
357
  const matched = BARE_PATH.exec(body);
@@ -341,6 +368,21 @@ function parseBareReference(raw) {
341
368
  ...column === void 0 ? {} : { column: Number(column) }
342
369
  };
343
370
  }
371
+ /** 引号 mention 的起手字符:`@"path with spaces"`。 */
372
+ const QUOTED_PATH = "\"";
373
+ function parseQuotedReference(body) {
374
+ const end = body.indexOf(QUOTED_PATH, 1);
375
+ if (end === -1) return void 0;
376
+ const path = body.slice(1, end);
377
+ if (path === "") return void 0;
378
+ const fragment = splitLineFragment(body.slice(end + 1));
379
+ if (fragment.head !== "") return void 0;
380
+ return {
381
+ protocol: DEFAULT_PROTOCOL,
382
+ path,
383
+ ...fragment.lines
384
+ };
385
+ }
344
386
  function referenceFromMarkdown() {
345
387
  return {
346
388
  enter: { reference: enterReference },
@@ -403,4 +445,4 @@ function decodeUri(value) {
403
445
  }
404
446
  }
405
447
  //#endregion
406
- export { parseReferenceToken as a, parseReference as i, formatReference as n, isLocalReference as r, findReferences as t };
448
+ export { parseReference as a, isLocalReference as i, formatReference as n, parseReferenceToken as o, formatReferenceMention as r, findReferences as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morlay/dsh-client-ui-primitives",
3
- "version": "0.0.2-alpha.4",
3
+ "version": "0.0.2-alpha.6",
4
4
  "description": "css-in-js styling kit (styled / Token / Styling) for the forked conversation UI: consumes the official --dsw-* design tokens, so no CSS Modules precompile step is needed.",
5
5
  "keywords": [
6
6
  "client",
@@ -40,7 +40,7 @@
40
40
  "micromark-util-types": "^2.0.2"
41
41
  },
42
42
  "devDependencies": {
43
- "@deepseek-ai/dsh-client-ui-primitives": "0.1.6-alpha.2",
43
+ "@deepseek-ai/dsh-client-ui-primitives": "0.1.7-alpha.1",
44
44
  "@types/mdast": "^4.0.4",
45
45
  "@types/react": "~18.3.1",
46
46
  "csstype": "^3.1.3",
@@ -48,7 +48,7 @@
48
48
  "react-dom": "^18.2.0"
49
49
  },
50
50
  "peerDependencies": {
51
- "@deepseek-ai/cordis": "4.0.2"
51
+ "@deepseek-ai/cordis": "4.0.3"
52
52
  },
53
53
  "dsh": {
54
54
  "client": {
@@ -7,6 +7,7 @@ export * from "./markdown-labels.ts";
7
7
  export {
8
8
  findReferences,
9
9
  formatReference,
10
+ formatReferenceMention,
10
11
  isLocalReference,
11
12
  parseReference,
12
13
  parseReferenceToken,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 官方主题的 `--dsw-*` token 全集(359 个),由 packages/client/ui-primitives/scripts/gen-design-tokens.mts 生成,勿手改。
2
+ * 官方主题的 `--dsw-*` token 全集(361 个),由 packages/client/ui-primitives/scripts/gen-design-tokens.mts 生成,勿手改。
3
3
  *
4
4
  * 叶子是该变量的**默认值**(官方 light 主题里首次出现的定义):既是类型推导的来源,也可作 fallback。
5
5
  * `"$"` 键出现在「自身也是 token 的分支」上(命名体系里有 40 个短名同时是长名前缀的 token)。
@@ -162,6 +162,9 @@ export const designTokens = {
162
162
  "primary": "var(--dsw-static-red-600)",
163
163
  "secondary": "var(--dsw-static-red-400)",
164
164
  },
165
+ "idle": {
166
+ "primary": "var(--dsw-static-neutral-300)",
167
+ },
165
168
  "success": {
166
169
  "primary": "var(--dsw-static-green-500)",
167
170
  "secondary": "var(--dsw-static-green-400)",
@@ -595,6 +598,11 @@ export const designTokens = {
595
598
  "mask": {
596
599
  "blur": "blur(2px)",
597
600
  },
601
+ "menu": {
602
+ "backdrop": {
603
+ "filter": "blur(40px) saturate(150%)",
604
+ },
605
+ },
598
606
  "shadow": {
599
607
  "lv1": {
600
608
  "$": "0 2px 4px 0 rgba(0, 0, 0, 0.05)",
@@ -614,7 +622,7 @@ export const designTokens = {
614
622
  "login": {
615
623
  "input": "var(--dsw-static-neutral-bluish-50)",
616
624
  },
617
- "menu": "var(--dsw-alias-bg-layer-3)",
625
+ "menu": "rgba(248, 249, 250, 0.58)",
618
626
  "selector": "var(--dsw-static-neutral-bluish-60)",
619
627
  "sidebar": {
620
628
  "fill": "var(--dsw-static-neutral-bluish-50)",
@@ -657,7 +665,7 @@ export const designTokens = {
657
665
  "100": "rgb(228, 237, 253)",
658
666
  "200": "rgb(211, 226, 255)",
659
667
  "300": "rgb(183, 200, 254)",
660
- "400": "rgb(103, 158, 254)",
668
+ "400": "rgb(122, 170, 255)",
661
669
  "450": "rgb(86, 134, 254)",
662
670
  "500": "rgb(65, 118, 230)",
663
671
  "600": "rgb(72, 104, 178)",
package/src/reference.ts CHANGED
@@ -10,6 +10,7 @@ import {
10
10
  asciiAlpha,
11
11
  asciiAlphanumeric,
12
12
  asciiDigit,
13
+ markdownLineEnding,
13
14
  markdownLineEndingOrSpace,
14
15
  unicodePunctuation,
15
16
  unicodeWhitespace,
@@ -62,6 +63,8 @@ const SCHEME = /^([A-Za-z][A-Za-z0-9+.-]*):/u;
62
63
 
63
64
  const BARE_PATH = /^([^:]+):(\d+)(?::(\d+))?$/u;
64
65
 
66
+ const MENTION_WHITESPACE = /\s/u;
67
+
65
68
  const URI_UNSAFE = /[%#()\s<>"`]/gu;
66
69
 
67
70
  const PATH_PUNCTUATION: readonly Code[] = [
@@ -127,6 +130,13 @@ export function isLocalReference(reference: Reference): boolean {
127
130
  return !EXTERNAL_PROTOCOLS.includes(reference.protocol);
128
131
  }
129
132
 
133
+ // 引用在提示文本里的 mention 形态:`@` 接路径,路径含空白时用引号包住。
134
+ // 谁产出的都走这一个函数归一——消息里是这一形态与「产生方是谁」无关。
135
+ export function formatReferenceMention(reference: Reference): string {
136
+ const path = reference.path ?? "";
137
+ return MENTION_WHITESPACE.test(path) ? `@"${path}"` : `@${path}`;
138
+ }
139
+
130
140
  export function findReferences(text: string): readonly ReferenceSpan[] {
131
141
  const spans: ReferenceSpan[] = [];
132
142
  if (text === "" || !TRIGGERS.some((trigger) => text.includes(trigger))) return spans;
@@ -210,9 +220,34 @@ const tokenizeReference: Tokenizer = function (effects, ok, nok) {
210
220
  }
211
221
 
212
222
  function afterAt(code: Code): State | undefined {
223
+ if (code === codes.quotationMark) {
224
+ effects.consume(code);
225
+ return quotedPath;
226
+ }
213
227
  return asciiAlpha(code) ? headStart(code) : pathStart(code);
214
228
  }
215
229
 
230
+ // `@"path with spaces"`:引号内的空格是路径的一部分,换行与未闭合都让整个形态退回普通文本。
231
+ function quotedPath(code: Code): State | undefined {
232
+ if (code === null || markdownLineEnding(code)) return nok(code);
233
+ effects.consume(code);
234
+ return code === codes.quotationMark ? afterQuotedPath : quotedPath;
235
+ }
236
+
237
+ function afterQuotedPath(code: Code): State | undefined {
238
+ if (code !== codes.numberSign) return finish(code);
239
+ effects.consume(code);
240
+ return fragmentInside;
241
+ }
242
+
243
+ function fragmentInside(code: Code): State | undefined {
244
+ if (isPathCode(code) || code === codes.numberSign) {
245
+ effects.consume(code);
246
+ return fragmentInside;
247
+ }
248
+ return finish(code);
249
+ }
250
+
216
251
  function headStart(code: Code): State | undefined {
217
252
  if (!asciiAlpha(code)) return nok(code);
218
253
  head = "";
@@ -469,6 +504,7 @@ function textOf(node: MarkdownNode): string {
469
504
  function parseBareReference(raw: string): Reference | undefined {
470
505
  const body = raw.startsWith("@") ? raw.slice(1) : raw;
471
506
  if (body === "") return undefined;
507
+ if (body.startsWith(QUOTED_PATH)) return parseQuotedReference(body);
472
508
  const scheme = SCHEME.exec(body);
473
509
  if (scheme !== null && isKnownScheme(scheme[1] as string)) return parseReference(body);
474
510
  const matched = BARE_PATH.exec(body);
@@ -486,6 +522,20 @@ function parseBareReference(raw: string): Reference | undefined {
486
522
  };
487
523
  }
488
524
 
525
+ /** 引号 mention 的起手字符:`@"path with spaces"`。 */
526
+ const QUOTED_PATH = '"';
527
+
528
+ function parseQuotedReference(body: string): Reference | undefined {
529
+ const end = body.indexOf(QUOTED_PATH, 1);
530
+ if (end === -1) return undefined;
531
+ const path = body.slice(1, end);
532
+ if (path === "") return undefined;
533
+ // 闭合引号之后只允许行号 fragment(`@"a b.ts"#L12-L40`);其它尾巴说明这不是一个引号引用。
534
+ const fragment = splitLineFragment(body.slice(end + 1));
535
+ if (fragment.head !== "") return undefined;
536
+ return { protocol: DEFAULT_PROTOCOL, path, ...fragment.lines };
537
+ }
538
+
489
539
  export function referenceFromMarkdown(): MdastExtension {
490
540
  return {
491
541
  enter: { reference: enterReference },