@morlay/dsh-client-ui-primitives 0.0.8 → 0.0.9

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 (44) hide show
  1. package/README.md +17 -18
  2. package/dist/client-DYp99CgT.mjs +3730 -0
  3. package/dist/client-uyVkC7mu.cjs +17197 -0
  4. package/dist/client.cjs +54 -0
  5. package/dist/client.d.cts +4 -0
  6. package/dist/client.d.mts +2 -664
  7. package/dist/client.mjs +2 -3728
  8. package/dist/index-AMHtcyMt.d.mts +647 -0
  9. package/dist/index.cjs +54 -0
  10. package/dist/index.d.mts +4 -5
  11. package/dist/index.mjs +4 -5
  12. package/dist/reference-hchCWm3z.cjs +482 -0
  13. package/dist/reference.cjs +4 -0
  14. package/dist/reference.d.mts +3 -0
  15. package/dist/reference.mjs +1 -0
  16. package/package.json +28 -30
  17. package/src/client/controls/IconButton.tsx +4 -2
  18. package/src/client/controls/ModelRouteList.module.css +1 -1
  19. package/src/client/controls/SeatButton.module.css +1 -1
  20. package/src/client/controls/SeatButton.tsx +1 -2
  21. package/src/client/controls/classes.ts +1 -3
  22. package/src/client/controls/index.ts +1 -7
  23. package/src/client/index.ts +7 -1
  24. package/src/client/layout/Row.tsx +20 -17
  25. package/src/client/layout/Stack.tsx +19 -16
  26. package/src/client/layout/Text.tsx +8 -1
  27. package/src/client/schema-form/Editor.tsx +26 -9
  28. package/src/client/schema-form/SchemaForm.tsx +6 -1
  29. package/src/client/schema-form/index.ts +5 -0
  30. package/src/client/schema-form/schema-form.module.css +16 -16
  31. package/src/client/schema-form/testing/fake-scope.ts +0 -1
  32. package/src/client/schema-form/value.tsx +8 -3
  33. package/src/client/settings-form/SettingsFieldRow.module.css +1 -1
  34. package/src/client/settings-form/SettingsFieldRow.tsx +4 -2
  35. package/src/index.ts +6 -2
  36. package/src/reference-markdown.tsx +2 -6
  37. package/dist/rolldown-runtime-EAsCxrDo.mjs +0 -14
  38. package/locale/en.json +0 -6
  39. package/locale/zh.json +0 -6
  40. package/src/client/controls/SearchInput.module.css +0 -11
  41. package/src/client/controls/SearchInput.tsx +0 -22
  42. package/src/client/controls/Tabs.module.css +0 -48
  43. package/src/client/controls/Tabs.tsx +0 -57
  44. /package/src/{client/markdown-text.ts → markdown-text.ts} +0 -0
package/dist/index.cjs ADDED
@@ -0,0 +1,54 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_client = require("./client-uyVkC7mu.cjs");
3
+ const require_reference = require("./reference-hchCWm3z.cjs");
4
+ exports.Bubble = require_client.Bubble;
5
+ exports.Button = require_client.Button;
6
+ exports.DisclosureRow = require_client.DisclosureRow;
7
+ exports.IconButton = require_client.IconButton;
8
+ exports.ModelRouteList = require_client.ModelRouteList;
9
+ exports.MultilineField = require_client.MultilineField;
10
+ exports.ReferenceMarkdown = require_client.ReferenceMarkdown;
11
+ exports.Row = require_client.Row;
12
+ exports.SCHEMA_FORM_NS = require_client.NS;
13
+ exports.SchemaFormController = require_client.SchemaFormController;
14
+ exports.SchemaFormHints = require_client.SchemaFormHints;
15
+ exports.SearchSelect = require_client.SearchSelect;
16
+ exports.SeatButton = require_client.SeatButton;
17
+ exports.SettingsFieldRow = require_client.SettingsFieldRow;
18
+ exports.Spinner = require_client.Spinner;
19
+ exports.Stack = require_client.Stack;
20
+ exports.TagInput = require_client.TagInput;
21
+ exports.Text = require_client.Text;
22
+ exports.TimeLabel = require_client.TimeLabel;
23
+ exports.VisuallyHidden = require_client.VisuallyHidden;
24
+ exports.apply = require_client.apply;
25
+ exports.failureOf = require_client.failureOf;
26
+ exports.findReferences = require_reference.findReferences;
27
+ exports.formatReference = require_reference.formatReference;
28
+ exports.formatReferenceMention = require_reference.formatReferenceMention;
29
+ exports.inject = require_client.inject;
30
+ exports.isLocalReference = require_reference.isLocalReference;
31
+ exports.markdownLabels = require_client.markdownLabels;
32
+ exports.mergeTags = require_client.mergeTags;
33
+ exports.parseReference = require_reference.parseReference;
34
+ exports.parseReferenceToken = require_reference.parseReferenceToken;
35
+ exports.parseTagList = require_client.parseTagList;
36
+ exports.projectRoot = require_client.projectRoot;
37
+ exports.referenceMentions = require_client.referenceMentions;
38
+ exports.rowRegistrations = require_client.rowRegistrations;
39
+ Object.defineProperty(exports, "schemaForm", {
40
+ enumerable: true,
41
+ get: function() {
42
+ return require_client.schema_form_exports;
43
+ }
44
+ });
45
+ exports.walkFields = require_client.walkFields;
46
+ var _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
47
+ Object.keys(_deepseek_ai_dsh_client_ui_primitives).forEach(function(k) {
48
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
49
+ enumerable: true,
50
+ get: function() {
51
+ return _deepseek_ai_dsh_client_ui_primitives[k];
52
+ }
53
+ });
54
+ });
package/dist/index.d.mts CHANGED
@@ -1,5 +1,4 @@
1
- import { c as parseReferenceToken, n as ReferenceSpan, r as findReferences, t as Reference } from "./reference-BX54bj6_.mjs";
2
- //#region src/index.d.ts
3
- export declare function apply(): void;
4
- //#endregion
5
- export { type Reference, type ReferenceSpan, findReferences, parseReferenceToken };
1
+ import { $ as Bubble, A as SearchSelect, B as VisuallyHidden, C as SuggestedKeys, D as parseTagList, E as mergeTags, F as ModelRouteCandidate, G as SpinnerProps, H as TimeLabel, I as ModelRouteList, J as DisclosureRow, K as SeatButton, L as ModelRouteListProps, M as SearchSelectProps, N as MultilineField, O as TagInput, P as MultilineFieldProps, Q as ButtonTone, R as IconButton, S as FieldNode, T as walkFields, U as TimeLabelProps, V as VisuallyHiddenProps, W as Spinner, X as Button, Y as DisclosureRowProps, Z as ButtonProps, _ as SelectOption, a as ReferenceMarkdownProps, at as Stack, b as failureOf, c as index_d_exports, ct as RowProps, d as SchemaFormActions, dt as LayoutJustify, et as BubbleProps, f as SchemaFormController, ft as LayoutPad, g as SchemaFormHints, gt as markdownLabels, h as projectRoot, ht as MarkdownCopySeat, i as ReferenceMarkdown, it as TextProps, j as SearchSelectOption, k as TagInputProps, l as rowRegistrations, lt as LayoutAlign, m as SchemaFormState, mt as TextTone, n as inject, nt as SettingsFieldRowProps, o as referenceMentions, ot as StackProps, p as SchemaFormFace, pt as TextSize, q as SeatButtonProps, r as ReferenceActions, rt as Text, s as NS, st as Row, t as apply, tt as SettingsFieldRow, u as SchemaFormLocaleKey, ut as LayoutGap, v as SelectSpec, w as WalkedField, x as FieldMeta, y as ValidationFailure, z as IconButtonProps } from "./index-AMHtcyMt.mjs";
2
+ 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";
3
+ export * from "@deepseek-ai/dsh-client-ui-primitives";
4
+ export { Bubble, type BubbleProps, Button, type ButtonProps, type ButtonTone, DisclosureRow, type DisclosureRowProps, type FieldMeta, type FieldNode, IconButton, type IconButtonProps, type LayoutAlign, type LayoutGap, type LayoutJustify, type LayoutPad, MarkdownCopySeat, type ModelRouteCandidate, ModelRouteList, type ModelRouteListProps, MultilineField, type MultilineFieldProps, type Reference, type ReferenceActions, ReferenceMarkdown, type ReferenceMarkdownProps, type ReferenceSpan, Row, type RowProps, NS as SCHEMA_FORM_NS, type SchemaFormActions, SchemaFormController, type SchemaFormFace, SchemaFormHints, type SchemaFormLocaleKey, type SchemaFormState, SearchSelect, type SearchSelectOption, type SearchSelectProps, SeatButton, type SeatButtonProps, type SelectOption, type SelectSpec, SettingsFieldRow, type SettingsFieldRowProps, Spinner, type SpinnerProps, Stack, type StackProps, type SuggestedKeys, TagInput, type TagInputProps, Text, type TextProps, type TextSize, type TextTone, TimeLabel, type TimeLabelProps, type ValidationFailure, VisuallyHidden, type VisuallyHiddenProps, type WalkedField, apply, failureOf, findReferences, formatReference, formatReferenceMention, inject, isLocalReference, markdownLabels, mergeTags, parseReference, parseReferenceToken, parseTagList, projectRoot, referenceMentions, rowRegistrations, index_d_exports as schemaForm, walkFields };
package/dist/index.mjs CHANGED
@@ -1,5 +1,4 @@
1
- import { o as parseReferenceToken, t as findReferences } from "./reference-Cjcn21uW.mjs";
2
- //#region src/index.ts
3
- function apply() {}
4
- //#endregion
5
- export { apply, findReferences, parseReferenceToken };
1
+ import { A as failureOf, C as markdownLabels, D as SchemaFormHints, E as rowRegistrations, O as SchemaFormController, S as Row, T as schema_form_exports, _ as Button, a as TagInput, b as Text, c as SearchSelect, d as IconButton, f as VisuallyHidden, g as DisclosureRow, h as SeatButton, i as referenceMentions, j as walkFields, k as projectRoot, l as MultilineField, m as Spinner, n as inject, o as mergeTags, p as TimeLabel, r as ReferenceMarkdown, s as parseTagList, t as apply, u as ModelRouteList, v as Bubble, w as NS, x as Stack, y as SettingsFieldRow } from "./client-DYp99CgT.mjs";
2
+ import { a as parseReference, i as isLocalReference, n as formatReference, o as parseReferenceToken, r as formatReferenceMention, t as findReferences } from "./reference-Cjcn21uW.mjs";
3
+ export * from "@deepseek-ai/dsh-client-ui-primitives";
4
+ export { Bubble, Button, DisclosureRow, IconButton, ModelRouteList, MultilineField, ReferenceMarkdown, Row, NS as SCHEMA_FORM_NS, SchemaFormController, SchemaFormHints, SearchSelect, SeatButton, SettingsFieldRow, Spinner, Stack, TagInput, Text, TimeLabel, VisuallyHidden, apply, failureOf, findReferences, formatReference, formatReferenceMention, inject, isLocalReference, markdownLabels, mergeTags, parseReference, parseReferenceToken, parseTagList, projectRoot, referenceMentions, rowRegistrations, schema_form_exports as schemaForm, walkFields };
@@ -0,0 +1,482 @@
1
+ let mdast_util_from_markdown = require("mdast-util-from-markdown");
2
+ let mdast_util_gfm = require("mdast-util-gfm");
3
+ let micromark_util_character = require("micromark-util-character");
4
+ let micromark_extension_gfm = require("micromark-extension-gfm");
5
+ let micromark_util_symbol = require("micromark-util-symbol");
6
+ //#region src/reference.ts
7
+ const DEFAULT_PROTOCOL = "file";
8
+ const EXTERNAL_PROTOCOLS = [
9
+ "http",
10
+ "https",
11
+ "mailto"
12
+ ];
13
+ const LINE_FRAGMENT = /^L(\d+)(?:C(\d+))?(?:-L(\d+))?$/u;
14
+ const SCHEME = /^([A-Za-z][A-Za-z0-9+.-]*):/u;
15
+ const BARE_PATH = /^([^:]+):(\d+)(?::(\d+))?$/u;
16
+ const MENTION_WHITESPACE = /\s/u;
17
+ const URI_UNSAFE = /[%#()\s<>"`]/gu;
18
+ const PATH_PUNCTUATION = [
19
+ micromark_util_symbol.codes.slash,
20
+ micromark_util_symbol.codes.dash,
21
+ micromark_util_symbol.codes.underscore,
22
+ micromark_util_symbol.codes.dot,
23
+ micromark_util_symbol.codes.plusSign,
24
+ micromark_util_symbol.codes.percentSign,
25
+ micromark_util_symbol.codes.atSign,
26
+ micromark_util_symbol.codes.tilde,
27
+ micromark_util_symbol.codes.equalsTo
28
+ ];
29
+ const TRIGGERS = [
30
+ ":",
31
+ "[",
32
+ "@"
33
+ ];
34
+ function parseReference(value, title) {
35
+ const raw = value.trim();
36
+ if (raw === "") return void 0;
37
+ const matched = SCHEME.exec(raw);
38
+ const protocol = matched === null ? DEFAULT_PROTOCOL : matched[1].toLowerCase();
39
+ let rest = matched === null ? raw : raw.slice(matched[0].length);
40
+ if (matched !== null && /\s/u.test(rest)) return void 0;
41
+ const fragment = splitLineFragment(rest);
42
+ rest = fragment.head;
43
+ let origin;
44
+ if (rest.startsWith("//")) {
45
+ const end = authorityEnd(rest);
46
+ const authority = rest.slice(2, end);
47
+ if (authority === "") return void 0;
48
+ origin = `${protocol}://${authority}`;
49
+ rest = rest.slice(end).replace(/^\//u, "");
50
+ }
51
+ const decoded = protocol === DEFAULT_PROTOCOL ? decodeUri(rest) : rest;
52
+ if (decoded === void 0 || decoded === "" && origin === void 0) return void 0;
53
+ return {
54
+ protocol,
55
+ ...origin === void 0 ? {} : { origin },
56
+ ...decoded === "" ? {} : { path: decoded },
57
+ ...title === void 0 || title === "" ? {} : { title },
58
+ ...fragment.lines
59
+ };
60
+ }
61
+ function parseReferenceToken(value) {
62
+ return SCHEME.test(value) ? parseReference(value) : void 0;
63
+ }
64
+ function formatReference(reference) {
65
+ const protocol = reference.protocol === "" ? DEFAULT_PROTOCOL : reference.protocol;
66
+ const path = reference.path ?? "";
67
+ if (reference.origin !== void 0) return `${reference.origin}${path === "" ? "" : `/${path}`}`;
68
+ return `${protocol}:${encodeUri(path)}${lineFragmentOf(reference)}`;
69
+ }
70
+ function isLocalReference(reference) {
71
+ return !EXTERNAL_PROTOCOLS.includes(reference.protocol);
72
+ }
73
+ function formatReferenceMention(reference) {
74
+ const path = reference.path ?? "";
75
+ return MENTION_WHITESPACE.test(path) ? `@"${path}"` : `@${path}`;
76
+ }
77
+ function findReferences(text) {
78
+ const spans = [];
79
+ if (text === "" || !TRIGGERS.some((trigger) => text.includes(trigger))) return spans;
80
+ collectReferences(parseReferenceDocument(text), spans);
81
+ return spans;
82
+ }
83
+ function parseReferenceDocument(text) {
84
+ return (0, mdast_util_from_markdown.fromMarkdown)(text, {
85
+ extensions: [(0, micromark_extension_gfm.gfm)(), referenceSyntax()],
86
+ mdastExtensions: [(0, mdast_util_gfm.gfmFromMarkdown)(), referenceFromMarkdown()]
87
+ });
88
+ }
89
+ function collectReferences(node, spans) {
90
+ const position = node.position;
91
+ if (node.type === "reference" && position !== void 0) {
92
+ const reference = referenceOfNode(node);
93
+ if (reference !== void 0) spans.push({
94
+ start: position.start.offset,
95
+ end: position.end.offset,
96
+ reference
97
+ });
98
+ }
99
+ for (const child of node.children ?? []) collectReferences(child, spans);
100
+ }
101
+ function referenceOfNode(node) {
102
+ const protocol = node.protocol;
103
+ if (protocol === void 0) return void 0;
104
+ return {
105
+ protocol,
106
+ ...node.origin === void 0 ? {} : { origin: node.origin },
107
+ ...node.path === void 0 ? {} : { path: node.path },
108
+ ...node.title === void 0 ? {} : { title: node.title },
109
+ ...node.lineStart === void 0 ? {} : { lineStart: node.lineStart },
110
+ ...node.lineEnd === void 0 ? {} : { lineEnd: node.lineEnd },
111
+ ...node.column === void 0 ? {} : { column: node.column }
112
+ };
113
+ }
114
+ const previousReference = function(code) {
115
+ return isBoundary(code);
116
+ };
117
+ const tokenizeReference = function(effects, ok, nok) {
118
+ const { events } = this;
119
+ let at = false;
120
+ let head = "";
121
+ return start;
122
+ function start(code) {
123
+ if (insideLabel(events)) return nok(code);
124
+ effects.enter("reference");
125
+ if (code === micromark_util_symbol.codes.atSign) {
126
+ at = true;
127
+ effects.consume(code);
128
+ return afterAt;
129
+ }
130
+ return headStart(code);
131
+ }
132
+ function afterAt(code) {
133
+ if (code === micromark_util_symbol.codes.quotationMark) {
134
+ effects.consume(code);
135
+ return quotedPath;
136
+ }
137
+ return (0, micromark_util_character.asciiAlpha)(code) ? headStart(code) : pathStart(code);
138
+ }
139
+ function quotedPath(code) {
140
+ if (code === null || (0, micromark_util_character.markdownLineEnding)(code)) return nok(code);
141
+ effects.consume(code);
142
+ return code === micromark_util_symbol.codes.quotationMark ? afterQuotedPath : quotedPath;
143
+ }
144
+ function afterQuotedPath(code) {
145
+ if (code !== micromark_util_symbol.codes.numberSign) return finish(code);
146
+ effects.consume(code);
147
+ return fragmentInside;
148
+ }
149
+ function fragmentInside(code) {
150
+ if (isPathCode(code) || code === micromark_util_symbol.codes.numberSign) {
151
+ effects.consume(code);
152
+ return fragmentInside;
153
+ }
154
+ return finish(code);
155
+ }
156
+ function headStart(code) {
157
+ if (!(0, micromark_util_character.asciiAlpha)(code)) return nok(code);
158
+ head = "";
159
+ return headInside(code);
160
+ }
161
+ function headInside(code) {
162
+ if (code === null || !(0, micromark_util_character.asciiAlpha)(code)) return afterHead(code);
163
+ head += String.fromCodePoint(code);
164
+ effects.consume(code);
165
+ return headInside;
166
+ }
167
+ function afterHead(code) {
168
+ if (code === micromark_util_symbol.codes.colon && isKnownScheme(head)) {
169
+ effects.consume(code);
170
+ return head.toLowerCase() === "skill" ? skillInside : fileInside;
171
+ }
172
+ return at ? pathInside(code) : nok(code);
173
+ }
174
+ function pathStart(code) {
175
+ if (!isPathCode(code) || code === micromark_util_symbol.codes.atSign) return nok(code);
176
+ effects.consume(code);
177
+ return pathInside;
178
+ }
179
+ function fileInside(code) {
180
+ if (!isFileCode(code)) return nok(code);
181
+ effects.consume(code);
182
+ return fileRest;
183
+ }
184
+ function fileRest(code) {
185
+ if (isFileCode(code)) {
186
+ effects.consume(code);
187
+ return fileRest;
188
+ }
189
+ return finish(code);
190
+ }
191
+ function skillInside(code) {
192
+ if (!isSkillCode(code)) return nok(code);
193
+ effects.consume(code);
194
+ return skillRest;
195
+ }
196
+ function skillRest(code) {
197
+ if (isSkillCode(code)) {
198
+ effects.consume(code);
199
+ return skillRest;
200
+ }
201
+ return finish(code);
202
+ }
203
+ function pathInside(code) {
204
+ if (isPathCode(code) || code === micromark_util_symbol.codes.numberSign) {
205
+ effects.consume(code);
206
+ return pathInside;
207
+ }
208
+ if (code !== micromark_util_symbol.codes.colon) return isBoundary(code) ? finish(code) : nok(code);
209
+ effects.consume(code);
210
+ return lineInside;
211
+ }
212
+ function lineInside(code) {
213
+ if (!(0, micromark_util_character.asciiDigit)(code)) return nok(code);
214
+ effects.consume(code);
215
+ return lineRest;
216
+ }
217
+ function lineRest(code) {
218
+ if ((0, micromark_util_character.asciiDigit)(code)) {
219
+ effects.consume(code);
220
+ return lineRest;
221
+ }
222
+ if (code !== micromark_util_symbol.codes.colon) return finish(code);
223
+ effects.consume(code);
224
+ return columnInside;
225
+ }
226
+ function columnInside(code) {
227
+ if (!(0, micromark_util_character.asciiDigit)(code)) return nok(code);
228
+ effects.consume(code);
229
+ return columnRest;
230
+ }
231
+ function columnRest(code) {
232
+ if ((0, micromark_util_character.asciiDigit)(code)) {
233
+ effects.consume(code);
234
+ return columnRest;
235
+ }
236
+ return finish(code);
237
+ }
238
+ function finish(code) {
239
+ if (!isBoundary(code)) return nok(code);
240
+ effects.exit("reference");
241
+ return ok(code);
242
+ }
243
+ };
244
+ const referenceConstruct = {
245
+ name: "reference",
246
+ previous: previousReference,
247
+ tokenize: tokenizeReference
248
+ };
249
+ const referenceSyntaxExtension = { text: {
250
+ [micromark_util_symbol.codes.atSign]: referenceConstruct,
251
+ [micromark_util_symbol.codes.lowercaseF]: referenceConstruct,
252
+ [micromark_util_symbol.codes.uppercaseF]: referenceConstruct,
253
+ [micromark_util_symbol.codes.lowercaseS]: referenceConstruct,
254
+ [micromark_util_symbol.codes.uppercaseS]: referenceConstruct
255
+ } };
256
+ function referenceSyntax() {
257
+ return referenceSyntaxExtension;
258
+ }
259
+ function insideLabel(events) {
260
+ for (let index = events.length - 1; index >= 0; index -= 1) {
261
+ const token = events[index]?.[1];
262
+ if (token === void 0) continue;
263
+ if ((token.type === micromark_util_symbol.types.labelLink || token.type === micromark_util_symbol.types.labelImage) && token._balanced !== true) return true;
264
+ }
265
+ return false;
266
+ }
267
+ function isBoundary(code) {
268
+ return code === null || (0, micromark_util_character.markdownLineEndingOrSpace)(code) || (0, micromark_util_character.unicodeWhitespace)(code) || (0, micromark_util_character.unicodePunctuation)(code);
269
+ }
270
+ function isPathCode(code) {
271
+ if (code === null || (0, micromark_util_character.markdownLineEndingOrSpace)(code)) return false;
272
+ if (!(0, micromark_util_character.unicodePunctuation)(code)) return true;
273
+ return PATH_PUNCTUATION.includes(code);
274
+ }
275
+ function isFileCode(code) {
276
+ return isPathCode(code) || code === micromark_util_symbol.codes.numberSign || code === micromark_util_symbol.codes.colon;
277
+ }
278
+ function isSkillCode(code) {
279
+ return (0, micromark_util_character.asciiAlphanumeric)(code) || code === micromark_util_symbol.codes.dash || code === micromark_util_symbol.codes.underscore || code === micromark_util_symbol.codes.dot;
280
+ }
281
+ function enterReference(token) {
282
+ this.enter({ type: "reference" }, token);
283
+ }
284
+ function exitReference(token) {
285
+ const node = this.stack[this.stack.length - 1];
286
+ const raw = this.sliceSerialize(token);
287
+ const reference = parseBareReference(raw);
288
+ if (node !== void 0) {
289
+ if (reference === void 0) {
290
+ node.type = "text";
291
+ node.value = raw;
292
+ } else Object.assign(node, reference);
293
+ }
294
+ this.exit(token);
295
+ }
296
+ const transformLinks = function(tree) {
297
+ convertLinks(tree);
298
+ };
299
+ function convertLinks(parent) {
300
+ const children = parent.children;
301
+ if (children === void 0) return;
302
+ for (let index = 0; index < children.length; index += 1) {
303
+ const child = children[index];
304
+ if (child === void 0) continue;
305
+ if (child.type === "link") {
306
+ const reference = parseReference(child.url ?? "", labelOf(child));
307
+ if (reference !== void 0) {
308
+ children[index] = referenceNodeOf(reference, child, children[index - 1]);
309
+ continue;
310
+ }
311
+ }
312
+ convertLinks(child);
313
+ }
314
+ }
315
+ function referenceNodeOf(reference, link, previous) {
316
+ const node = {
317
+ type: "reference",
318
+ ...reference
319
+ };
320
+ const position = link.position;
321
+ if (position === void 0) return node;
322
+ node.position = startsAfterAt(previous, position.start) ? atStart(position) : position;
323
+ return node;
324
+ }
325
+ function startsAfterAt(previous, start) {
326
+ if (previous?.type !== "text" || previous.value?.endsWith("@") !== true) return false;
327
+ const position = previous.position;
328
+ if (position === void 0 || position.end.offset !== start.offset) return false;
329
+ return position.end.offset - position.start.offset === previous.value.length;
330
+ }
331
+ function atStart(position) {
332
+ return {
333
+ start: {
334
+ line: position.start.line,
335
+ column: position.start.column - 1,
336
+ offset: position.start.offset - 1
337
+ },
338
+ end: position.end
339
+ };
340
+ }
341
+ function labelOf(node) {
342
+ const label = textOf(node);
343
+ return label === "" ? void 0 : label;
344
+ }
345
+ function textOf(node) {
346
+ if (node.value !== void 0) return node.value;
347
+ let text = "";
348
+ for (const child of node.children ?? []) text += textOf(child);
349
+ return text;
350
+ }
351
+ function parseBareReference(raw) {
352
+ const body = raw.startsWith("@") ? raw.slice(1) : raw;
353
+ if (body === "") return void 0;
354
+ if (body.startsWith(QUOTED_PATH)) return parseQuotedReference(body);
355
+ const scheme = SCHEME.exec(body);
356
+ if (scheme !== null && isKnownScheme(scheme[1])) return parseReference(body);
357
+ const matched = BARE_PATH.exec(body);
358
+ const path = matched?.[1];
359
+ const line = matched?.[2];
360
+ if (path === void 0 || line === void 0) return parseReference(body);
361
+ const decoded = decodeUri(path);
362
+ if (decoded === void 0 || decoded === "") return void 0;
363
+ const column = matched?.[3];
364
+ return {
365
+ protocol: DEFAULT_PROTOCOL,
366
+ path: decoded,
367
+ lineStart: Number(line),
368
+ ...column === void 0 ? {} : { column: Number(column) }
369
+ };
370
+ }
371
+ const QUOTED_PATH = "\"";
372
+ function parseQuotedReference(body) {
373
+ const end = body.indexOf(QUOTED_PATH, 1);
374
+ if (end === -1) return void 0;
375
+ const path = body.slice(1, end);
376
+ if (path === "") return void 0;
377
+ const fragment = splitLineFragment(body.slice(end + 1));
378
+ if (fragment.head !== "") return void 0;
379
+ return {
380
+ protocol: DEFAULT_PROTOCOL,
381
+ path,
382
+ ...fragment.lines
383
+ };
384
+ }
385
+ function referenceFromMarkdown() {
386
+ return {
387
+ enter: { reference: enterReference },
388
+ exit: { reference: exitReference },
389
+ transforms: [transformLinks]
390
+ };
391
+ }
392
+ function isKnownScheme(name) {
393
+ const protocol = name.toLowerCase();
394
+ return protocol === "file" || protocol === "skill";
395
+ }
396
+ function splitLineFragment(value) {
397
+ const hashAt = value.indexOf("#");
398
+ if (hashAt === -1) return {
399
+ head: value,
400
+ lines: {}
401
+ };
402
+ const matched = LINE_FRAGMENT.exec(value.slice(hashAt + 1));
403
+ if (matched === null) return {
404
+ head: value,
405
+ lines: {}
406
+ };
407
+ const lineStart = matched[1];
408
+ if (lineStart === void 0) return {
409
+ head: value,
410
+ lines: {}
411
+ };
412
+ const column = matched[2];
413
+ const lineEnd = matched[3];
414
+ return {
415
+ head: value.slice(0, hashAt),
416
+ lines: {
417
+ lineStart: Number(lineStart),
418
+ ...column === void 0 ? {} : { column: Number(column) },
419
+ ...lineEnd === void 0 ? {} : { lineEnd: Number(lineEnd) }
420
+ }
421
+ };
422
+ }
423
+ function lineFragmentOf(reference) {
424
+ if (reference.lineStart === void 0) return "";
425
+ const column = reference.column === void 0 ? "" : `C${String(reference.column)}`;
426
+ const lineEnd = reference.lineEnd === void 0 ? "" : `-L${String(reference.lineEnd)}`;
427
+ return `#L${String(reference.lineStart)}${column}${lineEnd}`;
428
+ }
429
+ function authorityEnd(value) {
430
+ for (let index = 2; index < value.length; index += 1) {
431
+ const char = value[index];
432
+ if (char === "/" || char === "?" || char === "#") return index;
433
+ }
434
+ return value.length;
435
+ }
436
+ function encodeUri(uri) {
437
+ return uri.replace(URI_UNSAFE, (char) => `%${char.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0")}`);
438
+ }
439
+ function decodeUri(value) {
440
+ try {
441
+ return decodeURIComponent(value);
442
+ } catch {
443
+ return;
444
+ }
445
+ }
446
+ //#endregion
447
+ Object.defineProperty(exports, "findReferences", {
448
+ enumerable: true,
449
+ get: function() {
450
+ return findReferences;
451
+ }
452
+ });
453
+ Object.defineProperty(exports, "formatReference", {
454
+ enumerable: true,
455
+ get: function() {
456
+ return formatReference;
457
+ }
458
+ });
459
+ Object.defineProperty(exports, "formatReferenceMention", {
460
+ enumerable: true,
461
+ get: function() {
462
+ return formatReferenceMention;
463
+ }
464
+ });
465
+ Object.defineProperty(exports, "isLocalReference", {
466
+ enumerable: true,
467
+ get: function() {
468
+ return isLocalReference;
469
+ }
470
+ });
471
+ Object.defineProperty(exports, "parseReference", {
472
+ enumerable: true,
473
+ get: function() {
474
+ return parseReference;
475
+ }
476
+ });
477
+ Object.defineProperty(exports, "parseReferenceToken", {
478
+ enumerable: true,
479
+ get: function() {
480
+ return parseReferenceToken;
481
+ }
482
+ });
@@ -0,0 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_reference = require("./reference-hchCWm3z.cjs");
3
+ exports.findReferences = require_reference.findReferences;
4
+ exports.parseReferenceToken = require_reference.parseReferenceToken;
@@ -0,0 +1,3 @@
1
+ import { c as parseReferenceToken, n as ReferenceSpan, r as findReferences, t as Reference } from "./reference-BX54bj6_.mjs";
2
+ //#endregion
3
+ export { type Reference, type ReferenceSpan, findReferences, parseReferenceToken };
@@ -0,0 +1 @@
1
+ export { t as findReferences, o as parseReferenceToken } from "./reference-Cjcn21uW.mjs";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@morlay/dsh-client-ui-primitives",
3
- "version": "0.0.8",
4
- "description": "client UI kit for this workspace: re-exports the official ui-primitives (Button / Menu / Input / Tag / Modal / Switch / SettingsForm …) plus our own layout primitives (Stack / Row / Text / Panel) and controls (TagInput / SearchSelect / ModelRouteList / Tabs / Spinner …), all styled with the same CSS Modules + `--dsw-*` tokens as upstream; also the shared reference parser/renderer (findReferences / parseReferenceToken) and the schema-generated row config page. Ships as an inlined client library (`dsh.client.inline`), not as an assembly row.",
3
+ "version": "0.0.9",
4
+ "description": "client UI kit for this workspace: re-exports the official ui-primitives (Button / Menu / Input / Tag / Modal / Switch / SettingsForm …) plus our own layout primitives (Stack / Row / Text / Panel) and controls (TagInput / SearchSelect / ModelRouteList / Spinner …), all styled with the same CSS Modules + `--dsw-*` tokens as upstream; also the shared reference parser/renderer (findReferences / parseReferenceToken) and the schema-generated row config page. Ships as an inlined client library (`dsh.client.inline`), not as an assembly row.",
5
5
  "keywords": [
6
6
  "client",
7
7
  "css-modules",
@@ -16,17 +16,26 @@
16
16
  "url": "https://github.com/morlay/dsh-plugin.git"
17
17
  },
18
18
  "files": [
19
- "locale/*.json",
20
19
  "dist",
21
20
  "src",
22
21
  "!**/__tests__"
23
22
  ],
24
23
  "type": "module",
25
24
  "exports": {
26
- ".": "./dist/index.mjs",
27
- "./client": "./dist/client.mjs",
25
+ ".": {
26
+ "types": "./dist/index.d.mts",
27
+ "default": "./dist/index.mjs"
28
+ },
29
+ "./reference": {
30
+ "types": "./dist/reference.d.mts",
31
+ "default": "./dist/reference.mjs"
32
+ },
28
33
  "./package.json": "./package.json",
29
- "./locale/*.json": "./locale/*.json"
34
+ "./client": {
35
+ "types": "./dist/client.d.mts",
36
+ "import": "./dist/client.mjs",
37
+ "default": "./dist/client.mjs"
38
+ }
30
39
  },
31
40
  "dependencies": {
32
41
  "mdast-util-from-markdown": "^2.0.3",
@@ -37,36 +46,25 @@
37
46
  "micromark-util-types": "^2.0.2"
38
47
  },
39
48
  "devDependencies": {
40
- "@deepseek-ai/dsh-api-remotes": "0.2.0-rc.2",
41
- "@deepseek-ai/dsh-client-locale": "0.2.0-rc.2",
42
- "@deepseek-ai/dsh-client-store": "0.2.0-rc.2",
43
- "@deepseek-ai/dsh-client-ui-plugin-manager": "0.2.0-rc.2",
44
- "@deepseek-ai/dsh-client-ui-primitives": "0.2.0-rc.2",
45
- "@deepseek-ai/dsh-client-ui-renderer": "0.2.0-rc.2",
46
- "@deepseek-ai/dsh-client-ui-settings": "0.2.0-rc.2",
47
- "@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.2",
48
- "@deepseek-ai/dsh-util-values": "0.2.0-rc.2",
49
- "@deepseek-ai/schemastery": "3.18.4",
49
+ "@deepseek-ai/dsh-util-values": "0.2.1-alpha.5",
50
+ "@deepseek-ai/schemastery": "3.18.5-alpha.2",
51
+ "@morlay/session-rdb": "0.1.6",
50
52
  "@testing-library/react": "^16.3.0",
51
53
  "@types/mdast": "^4.0.4",
52
54
  "@types/react": "~18.3.1",
53
- "react": "^18.2.0",
54
55
  "react-dom": "^18.2.0"
55
56
  },
56
57
  "peerDependencies": {
57
- "@deepseek-ai/cordis": "^4.0.4",
58
- "@deepseek-ai/dsh-api-remotes": "^0.2.0-rc.2",
59
- "@deepseek-ai/dsh-client-locale": "^0.2.0-rc.2",
60
- "@deepseek-ai/dsh-client-store": "^0.2.0-rc.2",
61
- "@deepseek-ai/dsh-client-ui-plugin-manager": "^0.2.0-rc.2",
62
- "@deepseek-ai/dsh-client-ui-renderer": "^0.2.0-rc.2",
63
- "@deepseek-ai/dsh-client-ui-settings": "^0.2.0-rc.2",
64
- "@deepseek-ai/dsh-client-ui-slots": "^0.2.0-rc.2"
65
- },
66
- "dsh": {
67
- "client": {
68
- "inline": true
69
- }
58
+ "@deepseek-ai/cordis": "4.0.5-alpha.2",
59
+ "@deepseek-ai/dsh-api-remotes": "0.2.1-alpha.5",
60
+ "@deepseek-ai/dsh-client-locale": "0.2.1-alpha.5",
61
+ "@deepseek-ai/dsh-client-store": "0.2.1-alpha.5",
62
+ "@deepseek-ai/dsh-client-ui-plugin-manager": "0.2.1-alpha.5",
63
+ "@deepseek-ai/dsh-client-ui-primitives": "0.2.1-alpha.5",
64
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.1-alpha.5",
65
+ "@deepseek-ai/dsh-client-ui-settings": "0.2.1-alpha.5",
66
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.1-alpha.5",
67
+ "react": "^18.2.0"
70
68
  },
71
69
  "scripts": {
72
70
  "build": "pnpm exec tsdown"
@@ -4,8 +4,10 @@ import type { ButtonHTMLAttributes, ReactNode } from "react";
4
4
  import { classes } from "./classes.ts";
5
5
  import css from "./IconButton.module.css";
6
6
 
7
- export interface IconButtonProps
8
- extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "aria-label"> {
7
+ export interface IconButtonProps extends Omit<
8
+ ButtonHTMLAttributes<HTMLButtonElement>,
9
+ "children" | "aria-label"
10
+ > {
9
11
  // 无障碍名(图标没有文字,这个名字是它唯一的标识)。
10
12
  label: string;
11
13
  // 图标。